@adobe/design-data-wasm 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +121 -0
- package/package.json +56 -0
- package/pkg/node/README.md +121 -0
- package/pkg/node/design_data_wasm.d.ts +439 -0
- package/pkg/node/design_data_wasm.js +897 -0
- package/pkg/node/design_data_wasm_bg.wasm +0 -0
- package/pkg/node/design_data_wasm_bg.wasm.d.ts +33 -0
- package/pkg/web/README.md +121 -0
- package/pkg/web/design_data_wasm.d.ts +497 -0
- package/pkg/web/design_data_wasm.js +981 -0
- package/pkg/web/design_data_wasm_bg.wasm +0 -0
- package/pkg/web/design_data_wasm_bg.wasm.d.ts +33 -0
|
@@ -0,0 +1,897 @@
|
|
|
1
|
+
/* @ts-self-types="./design_data_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A loaded token dataset you can query, validate, resolve, and diff.
|
|
5
|
+
*
|
|
6
|
+
* ```js
|
|
7
|
+
* import init, { Dataset } from "@adobe/design-data-wasm";
|
|
8
|
+
* await init();
|
|
9
|
+
*
|
|
10
|
+
* // Use the canonical embedded Spectrum dataset:
|
|
11
|
+
* const ds = Dataset.embedded();
|
|
12
|
+
* const results = ds.query("property=color,colorScheme=dark");
|
|
13
|
+
*
|
|
14
|
+
* // Or load your own tokens:
|
|
15
|
+
* const tokens = await fetch("/tokens.json").then(r => r.json());
|
|
16
|
+
* const ds2 = Dataset.fromTokens(tokens);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
class Dataset {
|
|
20
|
+
static __wrap(ptr) {
|
|
21
|
+
const obj = Object.create(Dataset.prototype);
|
|
22
|
+
obj.__wbg_ptr = ptr;
|
|
23
|
+
DatasetFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
24
|
+
return obj;
|
|
25
|
+
}
|
|
26
|
+
__destroy_into_raw() {
|
|
27
|
+
const ptr = this.__wbg_ptr;
|
|
28
|
+
this.__wbg_ptr = 0;
|
|
29
|
+
DatasetFinalization.unregister(this);
|
|
30
|
+
return ptr;
|
|
31
|
+
}
|
|
32
|
+
free() {
|
|
33
|
+
const ptr = this.__destroy_into_raw();
|
|
34
|
+
wasm.__wbg_dataset_free(ptr, 0);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Compute the semantic diff between this dataset and another.
|
|
38
|
+
*
|
|
39
|
+
* Returns a [`DiffResult`] with arrays of renamed, deprecated, reverted, added,
|
|
40
|
+
* deleted, and updated tokens.
|
|
41
|
+
*
|
|
42
|
+
* ```js
|
|
43
|
+
* const oldDs = Dataset.fromTokens(oldTokens);
|
|
44
|
+
* const newDs = Dataset.fromTokens(newTokens);
|
|
45
|
+
* const diff = oldDs.diff(newDs);
|
|
46
|
+
* console.log(`${diff.added.length} tokens added`);
|
|
47
|
+
* ```
|
|
48
|
+
* @param {Dataset} other
|
|
49
|
+
* @returns {DiffResult}
|
|
50
|
+
*/
|
|
51
|
+
diff(other) {
|
|
52
|
+
_assertClass(other, Dataset);
|
|
53
|
+
const ret = wasm.dataset_diff(this.__wbg_ptr, other.__wbg_ptr);
|
|
54
|
+
if (ret[2]) {
|
|
55
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
56
|
+
}
|
|
57
|
+
return takeFromExternrefTable0(ret[0]);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Open the canonical embedded Spectrum dataset from the prebuilt cache.
|
|
61
|
+
*
|
|
62
|
+
* The cache is opened once and reused; subsequent calls are cheap.
|
|
63
|
+
*
|
|
64
|
+
* Throws if the embedded cache was not generated (run `moon run sdk-wasm:cache-build`).
|
|
65
|
+
* @returns {Dataset}
|
|
66
|
+
*/
|
|
67
|
+
static embedded() {
|
|
68
|
+
const ret = wasm.dataset_embedded();
|
|
69
|
+
if (ret[2]) {
|
|
70
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
71
|
+
}
|
|
72
|
+
return Dataset.__wrap(ret[0]);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Build a dataset from an array of raw token JSON objects.
|
|
76
|
+
*
|
|
77
|
+
* Accepts the same format as the cascade token JSON files — an array of token
|
|
78
|
+
* objects each with a `name` object (e.g. `{ "name": { "property": "..." }, "value": ... }`).
|
|
79
|
+
*
|
|
80
|
+
* ```js
|
|
81
|
+
* const tokens = await fetch("/spectrum-tokens.json").then(r => r.json());
|
|
82
|
+
* const ds = Dataset.fromTokens(tokens);
|
|
83
|
+
* ```
|
|
84
|
+
* @param {any} tokens_json
|
|
85
|
+
* @returns {Dataset}
|
|
86
|
+
*/
|
|
87
|
+
static fromTokens(tokens_json) {
|
|
88
|
+
const ret = wasm.dataset_fromTokens(tokens_json);
|
|
89
|
+
if (ret[2]) {
|
|
90
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
91
|
+
}
|
|
92
|
+
return Dataset.__wrap(ret[0]);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Emit a structural overview of the dataset for agent session start.
|
|
96
|
+
*
|
|
97
|
+
* Returns a plain JS object with the same shape as `design-data primer --format json`:
|
|
98
|
+
* `{ specVersion, tokenCount, modeSets, components, taxonomyFields, manifest, provenance }`.
|
|
99
|
+
*
|
|
100
|
+
* For the embedded Spectrum dataset (`Dataset.embedded()`), `taxonomyFields` and
|
|
101
|
+
* `manifest` are baked into the prebuilt `.redb` blob by the `cache-build` task.
|
|
102
|
+
* For in-memory datasets (`Dataset.fromTokens()`), both are empty / null.
|
|
103
|
+
*
|
|
104
|
+
* `provenance.source` is:
|
|
105
|
+
* - `"embedded"` when created via `Dataset.embedded()` (includes `designDataVersion`)
|
|
106
|
+
* - `"in-memory"` when created via `Dataset.fromTokens()`
|
|
107
|
+
* @returns {any}
|
|
108
|
+
*/
|
|
109
|
+
primer() {
|
|
110
|
+
const ret = wasm.dataset_primer(this.__wbg_ptr);
|
|
111
|
+
if (ret[2]) {
|
|
112
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
113
|
+
}
|
|
114
|
+
return takeFromExternrefTable0(ret[0]);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Filter tokens using a query expression.
|
|
118
|
+
*
|
|
119
|
+
* **Syntax:** `key=value` pairs separated by `,` (AND) or `|` (OR).
|
|
120
|
+
* Use `!=` for negation and `*` as a wildcard suffix or prefix.
|
|
121
|
+
* Valid keys: `property`, `component`, `variant`, `state`, `colorScheme`,
|
|
122
|
+
* `scale`, `contrast`, `uuid`, `$schema`.
|
|
123
|
+
*
|
|
124
|
+
* ```js
|
|
125
|
+
* const results = ds.query("property=color,colorScheme=dark");
|
|
126
|
+
* const all = ds.query(""); // returns all tokens
|
|
127
|
+
* ```
|
|
128
|
+
* @param {string} filter_expr
|
|
129
|
+
* @returns {TokenResultArray}
|
|
130
|
+
*/
|
|
131
|
+
query(filter_expr) {
|
|
132
|
+
const ptr0 = passStringToWasm0(filter_expr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
133
|
+
const len0 = WASM_VECTOR_LEN;
|
|
134
|
+
const ret = wasm.dataset_query(this.__wbg_ptr, ptr0, len0);
|
|
135
|
+
if (ret[2]) {
|
|
136
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
137
|
+
}
|
|
138
|
+
return takeFromExternrefTable0(ret[0]);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Resolve a token for a given property in a specific context.
|
|
142
|
+
*
|
|
143
|
+
* The `context` object maps mode-set names to their active mode values —
|
|
144
|
+
* e.g. `{ colorScheme: "dark", scale: "medium" }`.
|
|
145
|
+
*
|
|
146
|
+
* Returns the winning token record plus its specificity, or `undefined` if
|
|
147
|
+
* no token matches the property+context combination.
|
|
148
|
+
*
|
|
149
|
+
* ```js
|
|
150
|
+
* const result = ds.resolve("background", { colorScheme: "dark", scale: "medium" });
|
|
151
|
+
* if (result) console.log(result.token.raw.value);
|
|
152
|
+
* ```
|
|
153
|
+
* @param {string} property
|
|
154
|
+
* @param {ResolutionContext} context
|
|
155
|
+
* @returns {ResolveResult | undefined}
|
|
156
|
+
*/
|
|
157
|
+
resolve(property, context) {
|
|
158
|
+
const ptr0 = passStringToWasm0(property, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
159
|
+
const len0 = WASM_VECTOR_LEN;
|
|
160
|
+
const ret = wasm.dataset_resolve(this.__wbg_ptr, ptr0, len0, context);
|
|
161
|
+
if (ret[2]) {
|
|
162
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
163
|
+
}
|
|
164
|
+
return takeFromExternrefTable0(ret[0]);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Resolve a legacy token reference by slug in a given context, returning
|
|
168
|
+
* the terminal value and the full alias chain.
|
|
169
|
+
*
|
|
170
|
+
* Bridges the legacy *object-map* slug model used by `docs/s2-tokens-viewer`
|
|
171
|
+
* to the cascade dataset. The wasm `resolve()` method resolves by *property*
|
|
172
|
+
* name in a mode-set context; this method resolves by *legacy slug* and a flat
|
|
173
|
+
* context map matching name-object fields.
|
|
174
|
+
*
|
|
175
|
+
* Context keys mirror cascade name-object fields:
|
|
176
|
+
* - `{ colorScheme: "light" | "dark" | "wireframe" }`
|
|
177
|
+
* - `{ scale: "desktop" | "mobile" }`
|
|
178
|
+
*
|
|
179
|
+
* The candidate with the most matching context fields wins; tie-breaking is
|
|
180
|
+
* stable (secondary sort by uuid ascending). When an alias chain passes through
|
|
181
|
+
* a set-level UUID, the context-appropriate child is selected so that e.g.
|
|
182
|
+
* `{accent-color-900}` under `{ colorScheme: "dark" }` correctly resolves to
|
|
183
|
+
* the dark variant of `{blue-900}`.
|
|
184
|
+
*
|
|
185
|
+
* Dangling aliases (a `$ref` target absent from the embedded dataset) are
|
|
186
|
+
* handled gracefully: the walk stops and the partial chain is returned with
|
|
187
|
+
* `value: undefined`.
|
|
188
|
+
*
|
|
189
|
+
* ```js
|
|
190
|
+
* const r = ds.resolveReference("{accent-color-100}", { colorScheme: "light" });
|
|
191
|
+
* // r.chain → ["{accent-color-100}", "{blue-100}", "rgb(245, 249, 255)"]
|
|
192
|
+
* // r.value → "rgb(245, 249, 255)"
|
|
193
|
+
* ```
|
|
194
|
+
* @param {string} token_ref
|
|
195
|
+
* @param {ResolutionContext} context
|
|
196
|
+
* @returns {ReferenceChainResult | undefined}
|
|
197
|
+
*/
|
|
198
|
+
resolveReference(token_ref, context) {
|
|
199
|
+
const ptr0 = passStringToWasm0(token_ref, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
200
|
+
const len0 = WASM_VECTOR_LEN;
|
|
201
|
+
const ret = wasm.dataset_resolveReference(this.__wbg_ptr, ptr0, len0, context);
|
|
202
|
+
if (ret[2]) {
|
|
203
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
204
|
+
}
|
|
205
|
+
return takeFromExternrefTable0(ret[0]);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Rank existing tokens by similarity to a natural-language `intent` string.
|
|
209
|
+
*
|
|
210
|
+
* Uses Jaccard similarity over the bag-of-words formed from each token's
|
|
211
|
+
* key segments, name-object field values, and description text. Optionally
|
|
212
|
+
* filter to tokens matching a specific `propertyHint` (e.g. `"color"`).
|
|
213
|
+
*
|
|
214
|
+
* ```js
|
|
215
|
+
* const results = ds.suggest("primary button background", undefined, 5);
|
|
216
|
+
* ```
|
|
217
|
+
* @param {string} intent
|
|
218
|
+
* @param {string | null | undefined} property_hint
|
|
219
|
+
* @param {number} limit
|
|
220
|
+
* @returns {SuggestResultArray}
|
|
221
|
+
*/
|
|
222
|
+
suggest(intent, property_hint, limit) {
|
|
223
|
+
const ptr0 = passStringToWasm0(intent, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
224
|
+
const len0 = WASM_VECTOR_LEN;
|
|
225
|
+
var ptr1 = isLikeNone(property_hint) ? 0 : passStringToWasm0(property_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
226
|
+
var len1 = WASM_VECTOR_LEN;
|
|
227
|
+
const ret = wasm.dataset_suggest(this.__wbg_ptr, ptr0, len0, ptr1, len1, limit);
|
|
228
|
+
if (ret[2]) {
|
|
229
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
230
|
+
}
|
|
231
|
+
return takeFromExternrefTable0(ret[0]);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Return the number of tokens in the dataset.
|
|
235
|
+
* @returns {number}
|
|
236
|
+
*/
|
|
237
|
+
tokenCount() {
|
|
238
|
+
const ret = wasm.dataset_tokenCount(this.__wbg_ptr);
|
|
239
|
+
return ret >>> 0;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Run relational validation rules over the dataset.
|
|
243
|
+
*
|
|
244
|
+
* Returns a [`ValidationResult`] with `valid`, `errors`, and `warnings`.
|
|
245
|
+
* This runs the same rules as `design-data validate` but without structural
|
|
246
|
+
* (JSON Schema) checks — those require filesystem access unavailable in wasm.
|
|
247
|
+
*
|
|
248
|
+
* ```js
|
|
249
|
+
* const result = ds.validate();
|
|
250
|
+
* if (!result.valid) console.error(result.errors);
|
|
251
|
+
* ```
|
|
252
|
+
* @returns {ValidationResult}
|
|
253
|
+
*/
|
|
254
|
+
validate() {
|
|
255
|
+
const ret = wasm.dataset_validate(this.__wbg_ptr);
|
|
256
|
+
return ret;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (Symbol.dispose) Dataset.prototype[Symbol.dispose] = Dataset.prototype.free;
|
|
260
|
+
exports.Dataset = Dataset;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Find a registry entry by its ID or one of its aliases.
|
|
264
|
+
*
|
|
265
|
+
* Returns `undefined` if not found.
|
|
266
|
+
* Equivalent to `@adobe/design-system-registry`'s `findValue(registry, searchTerm)`.
|
|
267
|
+
* @param {any} registry
|
|
268
|
+
* @param {string} search_term
|
|
269
|
+
* @returns {any}
|
|
270
|
+
*/
|
|
271
|
+
function findValue(registry, search_term) {
|
|
272
|
+
const ptr0 = passStringToWasm0(search_term, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
273
|
+
const len0 = WASM_VECTOR_LEN;
|
|
274
|
+
const ret = wasm.findValue(registry, ptr0, len0);
|
|
275
|
+
if (ret[2]) {
|
|
276
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
277
|
+
}
|
|
278
|
+
return takeFromExternrefTable0(ret[0]);
|
|
279
|
+
}
|
|
280
|
+
exports.findValue = findValue;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Return all non-deprecated value entries.
|
|
284
|
+
*
|
|
285
|
+
* Equivalent to `@adobe/design-system-registry`'s `getActiveValues(registry)`.
|
|
286
|
+
* @param {any} registry
|
|
287
|
+
* @returns {any}
|
|
288
|
+
*/
|
|
289
|
+
function getActiveValues(registry) {
|
|
290
|
+
const ret = wasm.getActiveValues(registry);
|
|
291
|
+
if (ret[2]) {
|
|
292
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
293
|
+
}
|
|
294
|
+
return takeFromExternrefTable0(ret[0]);
|
|
295
|
+
}
|
|
296
|
+
exports.getActiveValues = getActiveValues;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Return the list of advisory field names (fields whose values are informational,
|
|
300
|
+
* not normative — e.g. `"variant"`, `"state"`).
|
|
301
|
+
* @returns {string[]}
|
|
302
|
+
*/
|
|
303
|
+
function getAdvisoryFields() {
|
|
304
|
+
const ret = wasm.getAdvisoryFields();
|
|
305
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
306
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
307
|
+
return v1;
|
|
308
|
+
}
|
|
309
|
+
exports.getAdvisoryFields = getAdvisoryFields;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Return the default value entry, or `undefined` if none is marked as default.
|
|
313
|
+
*
|
|
314
|
+
* Equivalent to `@adobe/design-system-registry`'s `getDefault(registry)`.
|
|
315
|
+
* @param {any} registry
|
|
316
|
+
* @returns {any}
|
|
317
|
+
*/
|
|
318
|
+
function getDefault(registry) {
|
|
319
|
+
const ret = wasm.getDefault(registry);
|
|
320
|
+
if (ret[2]) {
|
|
321
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
322
|
+
}
|
|
323
|
+
return takeFromExternrefTable0(ret[0]);
|
|
324
|
+
}
|
|
325
|
+
exports.getDefault = getDefault;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Return all IDs (and aliases) registered for a given field name.
|
|
329
|
+
*
|
|
330
|
+
* `fieldName` should be the canonical field key as used in token `name` objects —
|
|
331
|
+
* e.g. `"property"`, `"component"`, `"variant"`, `"state"`.
|
|
332
|
+
*
|
|
333
|
+
* Returns `undefined` if the field is not in the embedded registry.
|
|
334
|
+
* @param {string} field_name
|
|
335
|
+
* @returns {string[] | undefined}
|
|
336
|
+
*/
|
|
337
|
+
function getFieldValues(field_name) {
|
|
338
|
+
const ptr0 = passStringToWasm0(field_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
339
|
+
const len0 = WASM_VECTOR_LEN;
|
|
340
|
+
const ret = wasm.getFieldValues(ptr0, len0);
|
|
341
|
+
let v2;
|
|
342
|
+
if (ret[0] !== 0) {
|
|
343
|
+
v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
344
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
345
|
+
}
|
|
346
|
+
return v2;
|
|
347
|
+
}
|
|
348
|
+
exports.getFieldValues = getFieldValues;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Return the list of field names that can be used as filter keys in query
|
|
352
|
+
* expressions (e.g. `"property"`, `"component"`, `"$schema"`).
|
|
353
|
+
*
|
|
354
|
+
* This is the canonical set maintained in `design_data_core::query::ALLOWED_KEYS`,
|
|
355
|
+
* exposed here so callers do not need to hard-code it.
|
|
356
|
+
* @returns {string[]}
|
|
357
|
+
*/
|
|
358
|
+
function getIndexedFields() {
|
|
359
|
+
const ret = wasm.getIndexedFields();
|
|
360
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
361
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
362
|
+
return v1;
|
|
363
|
+
}
|
|
364
|
+
exports.getIndexedFields = getIndexedFields;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Return all value IDs from a registry vocabulary object.
|
|
368
|
+
*
|
|
369
|
+
* Equivalent to `@adobe/design-system-registry`'s `getValues(registry)`.
|
|
370
|
+
* @param {any} registry
|
|
371
|
+
* @returns {string[]}
|
|
372
|
+
*/
|
|
373
|
+
function getValues(registry) {
|
|
374
|
+
const ret = wasm.getValues(registry);
|
|
375
|
+
if (ret[3]) {
|
|
376
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
377
|
+
}
|
|
378
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
379
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
380
|
+
return v1;
|
|
381
|
+
}
|
|
382
|
+
exports.getValues = getValues;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Return `true` if `value` (an ID or alias) is registered for `fieldName`.
|
|
386
|
+
* @param {string} field_name
|
|
387
|
+
* @param {string} value
|
|
388
|
+
* @returns {boolean}
|
|
389
|
+
*/
|
|
390
|
+
function hasFieldValue(field_name, value) {
|
|
391
|
+
const ptr0 = passStringToWasm0(field_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
392
|
+
const len0 = WASM_VECTOR_LEN;
|
|
393
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
394
|
+
const len1 = WASM_VECTOR_LEN;
|
|
395
|
+
const ret = wasm.hasFieldValue(ptr0, len0, ptr1, len1);
|
|
396
|
+
return ret !== 0;
|
|
397
|
+
}
|
|
398
|
+
exports.hasFieldValue = hasFieldValue;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Return `true` if `searchTerm` matches any value ID or alias in the registry.
|
|
402
|
+
*
|
|
403
|
+
* Equivalent to `@adobe/design-system-registry`'s `hasValue(registry, searchTerm)`.
|
|
404
|
+
* @param {any} registry
|
|
405
|
+
* @param {string} search_term
|
|
406
|
+
* @returns {boolean}
|
|
407
|
+
*/
|
|
408
|
+
function hasValue(registry, search_term) {
|
|
409
|
+
const ptr0 = passStringToWasm0(search_term, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
410
|
+
const len0 = WASM_VECTOR_LEN;
|
|
411
|
+
const ret = wasm.hasValue(registry, ptr0, len0);
|
|
412
|
+
if (ret[2]) {
|
|
413
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
414
|
+
}
|
|
415
|
+
return ret[0] !== 0;
|
|
416
|
+
}
|
|
417
|
+
exports.hasValue = hasValue;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Initialise the panic hook so that Rust panics are forwarded to the browser console.
|
|
421
|
+
*
|
|
422
|
+
* Call this once when the wasm module loads. Idempotent.
|
|
423
|
+
*/
|
|
424
|
+
function init() {
|
|
425
|
+
wasm.init();
|
|
426
|
+
}
|
|
427
|
+
exports.init = init;
|
|
428
|
+
function __wbg_get_imports() {
|
|
429
|
+
const import0 = {
|
|
430
|
+
__proto__: null,
|
|
431
|
+
__wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
|
|
432
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
433
|
+
return ret;
|
|
434
|
+
},
|
|
435
|
+
__wbg_Number_6b506e6536831eaa: function(arg0) {
|
|
436
|
+
const ret = Number(arg0);
|
|
437
|
+
return ret;
|
|
438
|
+
},
|
|
439
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
440
|
+
const ret = String(arg1);
|
|
441
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
442
|
+
const len1 = WASM_VECTOR_LEN;
|
|
443
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
444
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
445
|
+
},
|
|
446
|
+
__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d: function(arg0, arg1) {
|
|
447
|
+
const v = arg1;
|
|
448
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
449
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
450
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
451
|
+
},
|
|
452
|
+
__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9: function(arg0) {
|
|
453
|
+
const v = arg0;
|
|
454
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
455
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
456
|
+
},
|
|
457
|
+
__wbg___wbindgen_debug_string_0accd80f45e5faa2: function(arg0, arg1) {
|
|
458
|
+
const ret = debugString(arg1);
|
|
459
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
460
|
+
const len1 = WASM_VECTOR_LEN;
|
|
461
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
462
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
463
|
+
},
|
|
464
|
+
__wbg___wbindgen_in_70a403a56e771704: function(arg0, arg1) {
|
|
465
|
+
const ret = arg0 in arg1;
|
|
466
|
+
return ret;
|
|
467
|
+
},
|
|
468
|
+
__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9: function(arg0) {
|
|
469
|
+
const ret = typeof(arg0) === 'bigint';
|
|
470
|
+
return ret;
|
|
471
|
+
},
|
|
472
|
+
__wbg___wbindgen_is_function_754e9f305ff6029e: function(arg0) {
|
|
473
|
+
const ret = typeof(arg0) === 'function';
|
|
474
|
+
return ret;
|
|
475
|
+
},
|
|
476
|
+
__wbg___wbindgen_is_object_56732c2bc353f41d: function(arg0) {
|
|
477
|
+
const val = arg0;
|
|
478
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
479
|
+
return ret;
|
|
480
|
+
},
|
|
481
|
+
__wbg___wbindgen_is_string_c236cabd84a4d769: function(arg0) {
|
|
482
|
+
const ret = typeof(arg0) === 'string';
|
|
483
|
+
return ret;
|
|
484
|
+
},
|
|
485
|
+
__wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
|
|
486
|
+
const ret = arg0 === undefined;
|
|
487
|
+
return ret;
|
|
488
|
+
},
|
|
489
|
+
__wbg___wbindgen_jsval_eq_1068e624fa87f6ab: function(arg0, arg1) {
|
|
490
|
+
const ret = arg0 === arg1;
|
|
491
|
+
return ret;
|
|
492
|
+
},
|
|
493
|
+
__wbg___wbindgen_jsval_loose_eq_2c56564c75129511: function(arg0, arg1) {
|
|
494
|
+
const ret = arg0 == arg1;
|
|
495
|
+
return ret;
|
|
496
|
+
},
|
|
497
|
+
__wbg___wbindgen_number_get_9bb1761122181af2: function(arg0, arg1) {
|
|
498
|
+
const obj = arg1;
|
|
499
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
500
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
501
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
502
|
+
},
|
|
503
|
+
__wbg___wbindgen_string_get_72bdf95d3ae505b1: function(arg0, arg1) {
|
|
504
|
+
const obj = arg1;
|
|
505
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
506
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
507
|
+
var len1 = WASM_VECTOR_LEN;
|
|
508
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
509
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
510
|
+
},
|
|
511
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
512
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
513
|
+
},
|
|
514
|
+
__wbg_call_8a89609d89f6608a: function() { return handleError(function (arg0, arg1) {
|
|
515
|
+
const ret = arg0.call(arg1);
|
|
516
|
+
return ret;
|
|
517
|
+
}, arguments); },
|
|
518
|
+
__wbg_done_60cf307fcc680536: function(arg0) {
|
|
519
|
+
const ret = arg0.done;
|
|
520
|
+
return ret;
|
|
521
|
+
},
|
|
522
|
+
__wbg_entries_04b37a02507f1713: function(arg0) {
|
|
523
|
+
const ret = Object.entries(arg0);
|
|
524
|
+
return ret;
|
|
525
|
+
},
|
|
526
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
527
|
+
let deferred0_0;
|
|
528
|
+
let deferred0_1;
|
|
529
|
+
try {
|
|
530
|
+
deferred0_0 = arg0;
|
|
531
|
+
deferred0_1 = arg1;
|
|
532
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
533
|
+
} finally {
|
|
534
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
535
|
+
}
|
|
536
|
+
},
|
|
537
|
+
__wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
|
|
538
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
539
|
+
}, arguments); },
|
|
540
|
+
__wbg_get_1f8f054ddbaa7db2: function() { return handleError(function (arg0, arg1) {
|
|
541
|
+
const ret = Reflect.get(arg0, arg1);
|
|
542
|
+
return ret;
|
|
543
|
+
}, arguments); },
|
|
544
|
+
__wbg_get_2b48c7d0d006a781: function(arg0, arg1) {
|
|
545
|
+
const ret = arg0[arg1 >>> 0];
|
|
546
|
+
return ret;
|
|
547
|
+
},
|
|
548
|
+
__wbg_get_unchecked_33f6e5c9e2f2d6b2: function(arg0, arg1) {
|
|
549
|
+
const ret = arg0[arg1 >>> 0];
|
|
550
|
+
return ret;
|
|
551
|
+
},
|
|
552
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
553
|
+
const ret = arg0[arg1];
|
|
554
|
+
return ret;
|
|
555
|
+
},
|
|
556
|
+
__wbg_instanceof_ArrayBuffer_8f49811467741499: function(arg0) {
|
|
557
|
+
let result;
|
|
558
|
+
try {
|
|
559
|
+
result = arg0 instanceof ArrayBuffer;
|
|
560
|
+
} catch (_) {
|
|
561
|
+
result = false;
|
|
562
|
+
}
|
|
563
|
+
const ret = result;
|
|
564
|
+
return ret;
|
|
565
|
+
},
|
|
566
|
+
__wbg_instanceof_Map_9fc06d9a951bcee6: function(arg0) {
|
|
567
|
+
let result;
|
|
568
|
+
try {
|
|
569
|
+
result = arg0 instanceof Map;
|
|
570
|
+
} catch (_) {
|
|
571
|
+
result = false;
|
|
572
|
+
}
|
|
573
|
+
const ret = result;
|
|
574
|
+
return ret;
|
|
575
|
+
},
|
|
576
|
+
__wbg_instanceof_Uint8Array_86f30649f63ef9c2: function(arg0) {
|
|
577
|
+
let result;
|
|
578
|
+
try {
|
|
579
|
+
result = arg0 instanceof Uint8Array;
|
|
580
|
+
} catch (_) {
|
|
581
|
+
result = false;
|
|
582
|
+
}
|
|
583
|
+
const ret = result;
|
|
584
|
+
return ret;
|
|
585
|
+
},
|
|
586
|
+
__wbg_isArray_67c2c9c4313f4448: function(arg0) {
|
|
587
|
+
const ret = Array.isArray(arg0);
|
|
588
|
+
return ret;
|
|
589
|
+
},
|
|
590
|
+
__wbg_isSafeInteger_66acec27e09e99a7: function(arg0) {
|
|
591
|
+
const ret = Number.isSafeInteger(arg0);
|
|
592
|
+
return ret;
|
|
593
|
+
},
|
|
594
|
+
__wbg_iterator_8732428d309e270e: function() {
|
|
595
|
+
const ret = Symbol.iterator;
|
|
596
|
+
return ret;
|
|
597
|
+
},
|
|
598
|
+
__wbg_length_4a591ecaa01354d9: function(arg0) {
|
|
599
|
+
const ret = arg0.length;
|
|
600
|
+
return ret;
|
|
601
|
+
},
|
|
602
|
+
__wbg_length_66f1a4b2e9026940: function(arg0) {
|
|
603
|
+
const ret = arg0.length;
|
|
604
|
+
return ret;
|
|
605
|
+
},
|
|
606
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
607
|
+
const ret = new Error();
|
|
608
|
+
return ret;
|
|
609
|
+
},
|
|
610
|
+
__wbg_new_50bb5ebeecef71a8: function(arg0, arg1) {
|
|
611
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
612
|
+
return ret;
|
|
613
|
+
},
|
|
614
|
+
__wbg_new_578aeef4b6b94378: function(arg0) {
|
|
615
|
+
const ret = new Uint8Array(arg0);
|
|
616
|
+
return ret;
|
|
617
|
+
},
|
|
618
|
+
__wbg_new_622fc80556be2e26: function() {
|
|
619
|
+
const ret = new Map();
|
|
620
|
+
return ret;
|
|
621
|
+
},
|
|
622
|
+
__wbg_new_ce1ab61c1c2b300d: function() {
|
|
623
|
+
const ret = new Object();
|
|
624
|
+
return ret;
|
|
625
|
+
},
|
|
626
|
+
__wbg_new_d90091b82fdf5b91: function() {
|
|
627
|
+
const ret = new Array();
|
|
628
|
+
return ret;
|
|
629
|
+
},
|
|
630
|
+
__wbg_next_9e03acdf51c4960d: function(arg0) {
|
|
631
|
+
const ret = arg0.next;
|
|
632
|
+
return ret;
|
|
633
|
+
},
|
|
634
|
+
__wbg_next_eb8ca7351fa27906: function() { return handleError(function (arg0) {
|
|
635
|
+
const ret = arg0.next();
|
|
636
|
+
return ret;
|
|
637
|
+
}, arguments); },
|
|
638
|
+
__wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
|
|
639
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
640
|
+
},
|
|
641
|
+
__wbg_set_52b1e1eb5bed906a: function(arg0, arg1, arg2) {
|
|
642
|
+
const ret = arg0.set(arg1, arg2);
|
|
643
|
+
return ret;
|
|
644
|
+
},
|
|
645
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
646
|
+
arg0[arg1] = arg2;
|
|
647
|
+
},
|
|
648
|
+
__wbg_set_dca99999bba88a9a: function(arg0, arg1, arg2) {
|
|
649
|
+
arg0[arg1 >>> 0] = arg2;
|
|
650
|
+
},
|
|
651
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
652
|
+
const ret = arg1.stack;
|
|
653
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
654
|
+
const len1 = WASM_VECTOR_LEN;
|
|
655
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
656
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
657
|
+
},
|
|
658
|
+
__wbg_value_f3625092ee4b37f4: function(arg0) {
|
|
659
|
+
const ret = arg0.value;
|
|
660
|
+
return ret;
|
|
661
|
+
},
|
|
662
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
663
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
664
|
+
const ret = arg0;
|
|
665
|
+
return ret;
|
|
666
|
+
},
|
|
667
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
668
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
669
|
+
const ret = arg0;
|
|
670
|
+
return ret;
|
|
671
|
+
},
|
|
672
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
673
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
674
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
675
|
+
return ret;
|
|
676
|
+
},
|
|
677
|
+
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
678
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
679
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
680
|
+
return ret;
|
|
681
|
+
},
|
|
682
|
+
__wbindgen_init_externref_table: function() {
|
|
683
|
+
const table = wasm.__wbindgen_externrefs;
|
|
684
|
+
const offset = table.grow(4);
|
|
685
|
+
table.set(0, undefined);
|
|
686
|
+
table.set(offset + 0, undefined);
|
|
687
|
+
table.set(offset + 1, null);
|
|
688
|
+
table.set(offset + 2, true);
|
|
689
|
+
table.set(offset + 3, false);
|
|
690
|
+
},
|
|
691
|
+
};
|
|
692
|
+
return {
|
|
693
|
+
__proto__: null,
|
|
694
|
+
"./design_data_wasm_bg.js": import0,
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
const DatasetFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
699
|
+
? { register: () => {}, unregister: () => {} }
|
|
700
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_dataset_free(ptr, 1));
|
|
701
|
+
|
|
702
|
+
function addToExternrefTable0(obj) {
|
|
703
|
+
const idx = wasm.__externref_table_alloc();
|
|
704
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
705
|
+
return idx;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
function _assertClass(instance, klass) {
|
|
709
|
+
if (!(instance instanceof klass)) {
|
|
710
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
function debugString(val) {
|
|
715
|
+
// primitive types
|
|
716
|
+
const type = typeof val;
|
|
717
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
718
|
+
return `${val}`;
|
|
719
|
+
}
|
|
720
|
+
if (type == 'string') {
|
|
721
|
+
return `"${val}"`;
|
|
722
|
+
}
|
|
723
|
+
if (type == 'symbol') {
|
|
724
|
+
const description = val.description;
|
|
725
|
+
if (description == null) {
|
|
726
|
+
return 'Symbol';
|
|
727
|
+
} else {
|
|
728
|
+
return `Symbol(${description})`;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
if (type == 'function') {
|
|
732
|
+
const name = val.name;
|
|
733
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
734
|
+
return `Function(${name})`;
|
|
735
|
+
} else {
|
|
736
|
+
return 'Function';
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
// objects
|
|
740
|
+
if (Array.isArray(val)) {
|
|
741
|
+
const length = val.length;
|
|
742
|
+
let debug = '[';
|
|
743
|
+
if (length > 0) {
|
|
744
|
+
debug += debugString(val[0]);
|
|
745
|
+
}
|
|
746
|
+
for(let i = 1; i < length; i++) {
|
|
747
|
+
debug += ', ' + debugString(val[i]);
|
|
748
|
+
}
|
|
749
|
+
debug += ']';
|
|
750
|
+
return debug;
|
|
751
|
+
}
|
|
752
|
+
// Test for built-in
|
|
753
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
754
|
+
let className;
|
|
755
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
756
|
+
className = builtInMatches[1];
|
|
757
|
+
} else {
|
|
758
|
+
// Failed to match the standard '[object ClassName]'
|
|
759
|
+
return toString.call(val);
|
|
760
|
+
}
|
|
761
|
+
if (className == 'Object') {
|
|
762
|
+
// we're a user defined class or Object
|
|
763
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
764
|
+
// easier than looping through ownProperties of `val`.
|
|
765
|
+
try {
|
|
766
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
767
|
+
} catch (_) {
|
|
768
|
+
return 'Object';
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
// errors
|
|
772
|
+
if (val instanceof Error) {
|
|
773
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
774
|
+
}
|
|
775
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
776
|
+
return className;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
780
|
+
ptr = ptr >>> 0;
|
|
781
|
+
const mem = getDataViewMemory0();
|
|
782
|
+
const result = [];
|
|
783
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
784
|
+
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
785
|
+
}
|
|
786
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
787
|
+
return result;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
791
|
+
ptr = ptr >>> 0;
|
|
792
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
let cachedDataViewMemory0 = null;
|
|
796
|
+
function getDataViewMemory0() {
|
|
797
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
798
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
799
|
+
}
|
|
800
|
+
return cachedDataViewMemory0;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
function getStringFromWasm0(ptr, len) {
|
|
804
|
+
return decodeText(ptr >>> 0, len);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
let cachedUint8ArrayMemory0 = null;
|
|
808
|
+
function getUint8ArrayMemory0() {
|
|
809
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
810
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
811
|
+
}
|
|
812
|
+
return cachedUint8ArrayMemory0;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
function handleError(f, args) {
|
|
816
|
+
try {
|
|
817
|
+
return f.apply(this, args);
|
|
818
|
+
} catch (e) {
|
|
819
|
+
const idx = addToExternrefTable0(e);
|
|
820
|
+
wasm.__wbindgen_exn_store(idx);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
function isLikeNone(x) {
|
|
825
|
+
return x === undefined || x === null;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
829
|
+
if (realloc === undefined) {
|
|
830
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
831
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
832
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
833
|
+
WASM_VECTOR_LEN = buf.length;
|
|
834
|
+
return ptr;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
let len = arg.length;
|
|
838
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
839
|
+
|
|
840
|
+
const mem = getUint8ArrayMemory0();
|
|
841
|
+
|
|
842
|
+
let offset = 0;
|
|
843
|
+
|
|
844
|
+
for (; offset < len; offset++) {
|
|
845
|
+
const code = arg.charCodeAt(offset);
|
|
846
|
+
if (code > 0x7F) break;
|
|
847
|
+
mem[ptr + offset] = code;
|
|
848
|
+
}
|
|
849
|
+
if (offset !== len) {
|
|
850
|
+
if (offset !== 0) {
|
|
851
|
+
arg = arg.slice(offset);
|
|
852
|
+
}
|
|
853
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
854
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
855
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
856
|
+
|
|
857
|
+
offset += ret.written;
|
|
858
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
WASM_VECTOR_LEN = offset;
|
|
862
|
+
return ptr;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
function takeFromExternrefTable0(idx) {
|
|
866
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
867
|
+
wasm.__externref_table_dealloc(idx);
|
|
868
|
+
return value;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
872
|
+
cachedTextDecoder.decode();
|
|
873
|
+
function decodeText(ptr, len) {
|
|
874
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
const cachedTextEncoder = new TextEncoder();
|
|
878
|
+
|
|
879
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
880
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
881
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
882
|
+
view.set(buf);
|
|
883
|
+
return {
|
|
884
|
+
read: arg.length,
|
|
885
|
+
written: buf.length
|
|
886
|
+
};
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
let WASM_VECTOR_LEN = 0;
|
|
891
|
+
|
|
892
|
+
const wasmPath = `${__dirname}/design_data_wasm_bg.wasm`;
|
|
893
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
894
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
895
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
896
|
+
let wasm = wasmInstance.exports;
|
|
897
|
+
wasm.__wbindgen_start();
|