smoothly 1.0.0-alpha.218 → 1.0.0-alpha.219

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.
Files changed (44) hide show
  1. package/dist/cjs/Data-50d47740.js +589 -0
  2. package/dist/cjs/Data-50d47740.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +1 -14
  4. package/dist/cjs/index.cjs.js.map +1 -1
  5. package/dist/cjs/smoothly-app_80.cjs.entry.js +1 -1
  6. package/dist/cjs/smoothly-trigger-sink.cjs.entry.js +1 -1
  7. package/dist/cjs/smoothly-trigger-source.cjs.entry.js +1 -1
  8. package/dist/collection/model/index.js +0 -1
  9. package/dist/collection/model/index.js.map +1 -1
  10. package/dist/collection/smoothly.js +1 -1
  11. package/dist/collection/smoothly.js.map +1 -1
  12. package/dist/custom-elements/index.js +0 -701
  13. package/dist/custom-elements/index.js.map +1 -1
  14. package/dist/esm/Data-c8093b5a.js +579 -0
  15. package/dist/esm/Data-c8093b5a.js.map +1 -0
  16. package/dist/esm/index.js +1 -14
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/smoothly-app_80.entry.js +1 -1
  19. package/dist/esm/smoothly-trigger-sink.entry.js +1 -1
  20. package/dist/esm/smoothly-trigger-source.entry.js +1 -1
  21. package/dist/smoothly/index.esm.js +1 -1
  22. package/dist/smoothly/index.esm.js.map +1 -1
  23. package/dist/smoothly/p-2e986022.js +2 -0
  24. package/dist/smoothly/p-2e986022.js.map +1 -0
  25. package/dist/smoothly/{p-127dcc56.entry.js → p-635c813e.entry.js} +2 -2
  26. package/dist/smoothly/{p-a0ebd646.entry.js → p-7a69b43f.entry.js} +2 -2
  27. package/dist/smoothly/p-7c554bf0.entry.js +2 -0
  28. package/dist/smoothly/{p-661684df.entry.js.map → p-7c554bf0.entry.js.map} +1 -1
  29. package/dist/smoothly/smoothly.esm.js +1 -1
  30. package/dist/types/model/index.d.ts +0 -1
  31. package/dist/types/smoothly.d.ts +1 -1
  32. package/package.json +1 -2
  33. package/dist/cjs/Data-ae713814.js +0 -1277
  34. package/dist/cjs/Data-ae713814.js.map +0 -1
  35. package/dist/collection/model/ClientIdentifier.js +0 -13
  36. package/dist/collection/model/ClientIdentifier.js.map +0 -1
  37. package/dist/esm/Data-0390d600.js +0 -1267
  38. package/dist/esm/Data-0390d600.js.map +0 -1
  39. package/dist/smoothly/p-661684df.entry.js +0 -2
  40. package/dist/smoothly/p-9b828bde.js +0 -2
  41. package/dist/smoothly/p-9b828bde.js.map +0 -1
  42. package/dist/types/model/ClientIdentifier.d.ts +0 -5
  43. /package/dist/smoothly/{p-127dcc56.entry.js.map → p-635c813e.entry.js.map} +0 -0
  44. /package/dist/smoothly/{p-a0ebd646.entry.js.map → p-7a69b43f.entry.js.map} +0 -0
@@ -0,0 +1,589 @@
1
+ 'use strict';
2
+
3
+ class Type {
4
+ get name() {
5
+ return typeof this._name == "function" ? this._name() : this._name;
6
+ }
7
+ get condition() {
8
+ return typeof this._condition == "function" ? this._condition() : this._condition;
9
+ }
10
+ optional() {
11
+ return new IslyOptional(this);
12
+ }
13
+ readonly() {
14
+ return new IslyReadonly(this);
15
+ }
16
+ array(...options) {
17
+ return array(this, ...options);
18
+ }
19
+ constructor(_name, _condition) {
20
+ this._name = _name;
21
+ this._condition = _condition;
22
+ /**
23
+ * Return the value if the value is valid for the type, otherwise undefined.
24
+ * For objects, unknown properties are filtered.
25
+ *
26
+ * Eg: isly.number().value(NaN) returns undefined
27
+ */
28
+ this.get = value => (this.is(value) ? this.getValue(value) : undefined);
29
+ /**
30
+ * Return a flaw object, describing the flaws of the value compared to expected type.
31
+ *
32
+ * If it is a correct value, according to the type, it returns a Flaw with the message `{message:"This type is correct.", isFlaw: false, ... }`
33
+ *
34
+ * Implemented as a closure.
35
+ */
36
+ this.flaw = value => {
37
+ return this.is(value)
38
+ ? {
39
+ type: this.name,
40
+ ...(this.condition ? { condition: this.condition } : undefined),
41
+ isFlaw: false,
42
+ message: "This type is correct.",
43
+ }
44
+ : {
45
+ ...(this.condition ? { condition: this.condition } : undefined),
46
+ ...this.createFlaw(value),
47
+ type: this.name,
48
+ };
49
+ };
50
+ }
51
+ getValue(value) {
52
+ return value;
53
+ }
54
+ /**
55
+ * Override this to create custom Flaws.
56
+ * Not necessary for simple types.
57
+ */
58
+ createFlaw(value) {
59
+ return {};
60
+ }
61
+ /**
62
+ * Used by types that use a backend type.
63
+ */
64
+ createFlawFromType(backend, value) {
65
+ return "createFlaw" in backend && typeof backend.createFlaw == "function"
66
+ ? backend.createFlaw(value)
67
+ : backend.flaw(value);
68
+ }
69
+ }
70
+ class IslyOptional extends Type {
71
+ constructor(backend) {
72
+ super(() => backend.name + " | undefined", backend.condition);
73
+ this.backend = backend;
74
+ this.is = (value => value == undefined || this.backend.is(value));
75
+ }
76
+ createFlaw(value) {
77
+ return this.createFlawFromType(this.backend, value);
78
+ }
79
+ }
80
+ class IslyReadonly extends Type {
81
+ constructor(backend) {
82
+ super(() => `Readonly<${backend.name}>`, backend.condition);
83
+ this.backend = backend;
84
+ this.is = (value => value == undefined || this.backend.is(value));
85
+ }
86
+ createFlaw(value) {
87
+ return this.createFlawFromType(this.backend, value);
88
+ }
89
+ }
90
+ function array(itemType, ...options) {
91
+ return new IslyArray(itemType, options);
92
+ }
93
+ const criteriaFunctions$1 = {
94
+ length: {
95
+ is: (value, optionValue) => value.length == optionValue,
96
+ condition: optionValue => `length == ${optionValue}`,
97
+ },
98
+ minLength: {
99
+ is: (value, optionValue) => value.length >= optionValue,
100
+ condition: optionValue => `minLength == ${optionValue}`,
101
+ },
102
+ maxLength: {
103
+ is: (value, optionValue) => value.length <= optionValue,
104
+ condition: optionValue => `maxLength == ${optionValue}`,
105
+ },
106
+ };
107
+ class IslyArray extends Type {
108
+ constructor(itemType, options) {
109
+ super(() => this.baseName() + "[]", options.length > 0 ? options.map(c => criteriaFunctions$1[c.criteria].condition(c.value)).join(" & ") : undefined);
110
+ this.itemType = itemType;
111
+ this.options = options;
112
+ this.is = (value => globalThis.Array.isArray(value) &&
113
+ this.options.every(option => criteriaFunctions$1[option.criteria].is(value, option.value)) &&
114
+ value.every(item => this.itemType.is(item)));
115
+ }
116
+ baseName() {
117
+ return this.itemType.name.includes(" ") ? `(${this.itemType.name})` : this.itemType.name;
118
+ }
119
+ itemName(index) {
120
+ return `${this.baseName()}[${index}]`;
121
+ }
122
+ createFlaw(value) {
123
+ const flaws = (globalThis.Array.isArray(value) &&
124
+ value.flatMap((item, index) => {
125
+ const subFlaw = this.itemType.flaw(item);
126
+ return subFlaw.isFlaw ?? true ? [{ ...subFlaw, type: this.itemName(index) }] : [];
127
+ })) ||
128
+ [];
129
+ return {
130
+ ...(flaws.length > 0 ? { flaws } : undefined),
131
+ };
132
+ }
133
+ getValue(value) {
134
+ return value.map(item => this.itemType.get(item));
135
+ }
136
+ }
137
+
138
+ class IslyBoolean extends Type {
139
+ constructor(booleanValue) {
140
+ super(booleanValue == undefined ? "boolean" : booleanValue ? "true" : "false");
141
+ this.booleanValue = booleanValue;
142
+ this.is = (value => typeof value == "boolean" && (this.booleanValue == undefined || value == this.booleanValue));
143
+ }
144
+ }
145
+ function boolean(booleanValue) {
146
+ return new IslyBoolean(booleanValue);
147
+ }
148
+
149
+ class IslyLazy extends Type {
150
+ constructor(factory, name) {
151
+ super(name ?? (() => (this.backend ??= factory()).name), () => (this.backend ??= factory()).condition);
152
+ this.factory = factory;
153
+ this.is = (value => (this.backend ??= this.factory()).is(value));
154
+ this.get = value => this.backend.get(value);
155
+ }
156
+ createFlaw(value) {
157
+ return this.createFlawFromType((this.backend ??= this.factory()), value);
158
+ }
159
+ }
160
+ /**
161
+ * Late evaluation of a type
162
+ * Can be used for for recursive types.
163
+ *
164
+ * @param factory
165
+ * @param name Provide a name, to avoid infinite loop if the type i recursive
166
+ * @returns
167
+ */
168
+ function lazy(factory, name) {
169
+ return new IslyLazy(factory, name);
170
+ }
171
+
172
+ class IslyObject extends Type {
173
+ constructor(baseType, properties, name) {
174
+ super(() => name ??
175
+ (this.baseType ? `${this.baseType.name} & ` : "") +
176
+ `{${globalThis.Object.entries(this.properties)
177
+ .map(([property, type]) => `${property}: ${type.name}`)
178
+ .join(", ")}}`);
179
+ this.baseType = baseType;
180
+ this.properties = properties;
181
+ this.is = (value => !!(value &&
182
+ (this.baseType == undefined || this.baseType.is(value)) &&
183
+ typeof value == "object" &&
184
+ !globalThis.Array.isArray(value) &&
185
+ globalThis.Object.entries(this.properties).every(([property, type]) => type.is(value[property]))));
186
+ }
187
+ extend(properties, name) {
188
+ return new IslyObject(this, properties, name);
189
+ }
190
+ omit(omits, name) {
191
+ return new IslyObject(this.baseType?.omit(omits), globalThis.Object.fromEntries(globalThis.Object.entries(this.properties).filter(([key]) => !omits.includes(key))), name ?? `Omit<${this.name}, ${omits.map(key => `"${String(key)}"`).join(" | ")}>`);
192
+ }
193
+ pick(picks, name) {
194
+ return new IslyObject(this.baseType?.pick(picks), globalThis.Object.fromEntries(globalThis.Object.entries(this.properties).filter(([key]) => picks.includes(key))), name ?? `Pick<${this.name}, ${picks.map(key => `"${String(key)}"`).join(" | ")}>`);
195
+ }
196
+ createFlaw(value) {
197
+ return {
198
+ flaws: [
199
+ this.baseType ? this.baseType.flaw(value)?.flaws ?? [] : [],
200
+ globalThis.Object.entries(this.properties)
201
+ .map(([property, type]) => [property, type.flaw(value?.[property])])
202
+ .map(([property, flaw]) => (flaw?.isFlaw ?? true) && { property, ...flaw })
203
+ .filter(flaw => flaw),
204
+ ]
205
+ .flat()
206
+ .filter(flaw => flaw?.isFlaw ?? true),
207
+ };
208
+ }
209
+ /**
210
+ * get-function on a object returns a object with only specified properties
211
+ */
212
+ getValue(value) {
213
+ const result = this.baseType ? this.baseType.getValue(value) : {};
214
+ if (result)
215
+ for (const [key, type] of globalThis.Object.entries(this.properties))
216
+ if (key in value)
217
+ result[key] = type.get(value[key]);
218
+ return result;
219
+ }
220
+ }
221
+ function object(properties, name) {
222
+ return new IslyObject(undefined, properties ?? {}, name);
223
+ }
224
+
225
+ class IslyString extends Type {
226
+ constructor(stringCondition) {
227
+ super(typeof stringCondition == "string" ? `"${stringCondition}"` : "string", () => {
228
+ const conditionObject = this.getConditionObject();
229
+ return conditionObject instanceof RegExp
230
+ ? `/${conditionObject.source}/${conditionObject.flags}`
231
+ : globalThis.Object.keys(conditionObject)
232
+ .map(key => `"${key}"`)
233
+ .join(" | ");
234
+ });
235
+ this.stringCondition = stringCondition;
236
+ this.is = (value => {
237
+ const conditionObject = this.getConditionObject();
238
+ return (typeof value == "string" &&
239
+ (conditionObject instanceof RegExp
240
+ ? conditionObject.test(value)
241
+ : typeof conditionObject == "object"
242
+ ? value in conditionObject //TODO, avoid "hasOwnProperty toString etc."
243
+ : conditionObject));
244
+ });
245
+ }
246
+ getConditionObject() {
247
+ return (this.conditionObject ??= Array.isArray(this.stringCondition)
248
+ ? this.stringCondition.reduce((result, current) => {
249
+ result[current] = true;
250
+ return result;
251
+ }, globalThis.Object.create(null))
252
+ : typeof this.stringCondition == "string"
253
+ ? { [this.stringCondition]: true }
254
+ : typeof this.stringCondition == "object" // Record or RegExp!
255
+ ? this.stringCondition
256
+ : true);
257
+ }
258
+ }
259
+ function string(condition) {
260
+ return new IslyString(condition);
261
+ }
262
+
263
+ var Flaw;
264
+ (function (Flaw) {
265
+ Flaw.type = object({
266
+ message: string().optional(),
267
+ isFlaw: boolean().optional(),
268
+ property: string().optional(),
269
+ type: string(),
270
+ flaws: array(lazy(() => Flaw.type)).optional(),
271
+ condition: string().optional(),
272
+ }, "Flaw");
273
+ Flaw.is = Flaw.type.is;
274
+ Flaw.flaw = Flaw.type.flaw;
275
+ })(Flaw || (Flaw = {}));
276
+
277
+ class IslyFromIs extends Type {
278
+ constructor(name, isFunction) {
279
+ super(name);
280
+ this.isFunction = isFunction;
281
+ this.is = (value => this.isFunction(value));
282
+ }
283
+ }
284
+ function fromIs(name, is) {
285
+ return new IslyFromIs(name, is);
286
+ }
287
+
288
+ const criteriaFunctions = {
289
+ positive: {
290
+ is: (value) => value > 0,
291
+ condition: "> 0",
292
+ },
293
+ negative: {
294
+ is: (value) => value < 0,
295
+ condition: "< 0",
296
+ },
297
+ integer: {
298
+ is: (value) => Number.isInteger(value),
299
+ condition: "Number.isInteger",
300
+ },
301
+ };
302
+ function fromCriteria(criteria) {
303
+ return /* Eg: criteria == 42 */ typeof criteria == "number"
304
+ ? [value => value == criteria, " == " + criteria.toString()]
305
+ : // Eg: criteria == [0,1,2]
306
+ ((c) => Array.isArray(c) && c.every(c => typeof c == "number"))(criteria)
307
+ ? [value => criteria.map(fromCriteria).some(c => c[0](value)), criteria.join(" | ")]
308
+ : // Eg: criteria == ["positive", "negative"]
309
+ ((c) => Array.isArray(c) && c.every(c => typeof c == "string" && c in criteriaFunctions))(criteria)
310
+ ? [
311
+ value => criteria.map(fromCriteria).every(c => c[0](value)),
312
+ criteria
313
+ .map(fromCriteria)
314
+ .map(c => c[1])
315
+ .join(" & "),
316
+ ]
317
+ : // Eg: criteria == () => true
318
+ typeof criteria === "function"
319
+ ? [criteria, "custom"]
320
+ : // Eg: criteria == "positive"
321
+ criteria in criteriaFunctions
322
+ ? [criteriaFunctions[criteria].is, criteriaFunctions[criteria].condition]
323
+ : // Eg: criteria is unknown
324
+ [() => false, "Unknown criteria"];
325
+ }
326
+ class IslyNumber extends Type {
327
+ constructor(isFunction, condition) {
328
+ super("number", condition);
329
+ this.isFunction = isFunction;
330
+ this.is = (value => typeof value == "number" &&
331
+ !Number.isNaN(value - value) && // NaN-NaN==NaN && Infinity-Infinity==NaN && (-Infinity)-(-Infinity)==NaN
332
+ (!this.isFunction || this.isFunction(value)));
333
+ }
334
+ }
335
+ /**
336
+ * NaN, Infinite and -Infinite is not considered to be numbers by this type,
337
+ * since that it is hardly ever desirable when validating input data.
338
+ *
339
+ * @param criteria
340
+ * @returns
341
+ */
342
+ function number(criteria) {
343
+ const [isFunction, condition] = criteria == undefined ? [undefined, undefined] : fromCriteria(criteria);
344
+ return new IslyNumber(isFunction, condition);
345
+ }
346
+
347
+ class IslyRecord extends Type {
348
+ constructor(keyType, valueType) {
349
+ super(() => `Record<${keyType.name}, ${valueType.name}>`);
350
+ this.keyType = keyType;
351
+ this.valueType = valueType;
352
+ this.is = (value => !!(value &&
353
+ typeof value == "object" &&
354
+ !globalThis.Array.isArray(value) &&
355
+ globalThis.Object.entries(value).every(([key, value]) => this.keyType.is(this.keyType.name == "number" && `${+key}` == key ? +key : key) && this.valueType.is(value))));
356
+ }
357
+ createFlaw(value) {
358
+ return {
359
+ flaws: value &&
360
+ typeof value == "object" &&
361
+ !globalThis.Array.isArray(value) &&
362
+ globalThis.Object.entries(value).flatMap(([key, propertyValue]) => [
363
+ this.keyType.flaw(this.keyType.name == "number" && `${+key}` == key ? +key : key),
364
+ this.valueType.flaw(propertyValue),
365
+ ]
366
+ .map((flaw, index) => (flaw.isFlaw ?? true) && { property: key + ` (${["key", "value"][index]})`, ...flaw })
367
+ .filter(Boolean)),
368
+ };
369
+ }
370
+ getValue(value) {
371
+ return globalThis.Object.fromEntries(globalThis.Object.entries(value).map(([key, value]) => [key, this.valueType.get(value)]));
372
+ }
373
+ }
374
+ function record(keyType, valueType) {
375
+ return new IslyRecord(keyType, valueType);
376
+ }
377
+
378
+ class IslyUnion extends Type {
379
+ constructor(...types) {
380
+ super(() => types.map(type => type.name).join(" | "));
381
+ this.is = (value => this.types.some(type => type.is(value)));
382
+ this.types = types;
383
+ }
384
+ createFlaw(value) {
385
+ return {
386
+ flaws: this.types.map(type => type.flaw(value)).filter(flaw => flaw),
387
+ };
388
+ }
389
+ getValue(value) {
390
+ return this.types.find(type => type.is(value))?.get(value);
391
+ }
392
+ }
393
+ function union(...types) {
394
+ return new IslyUnion(...types);
395
+ }
396
+
397
+ class IslyUndefined extends Type {
398
+ constructor() {
399
+ super(...arguments);
400
+ this.is = (value => value === undefined);
401
+ }
402
+ }
403
+ function islyUndefined(name) {
404
+ return new IslyUndefined(name ?? "undefined");
405
+ }
406
+
407
+ exports.Color = void 0;
408
+ (function (Color) {
409
+ Color.types = [
410
+ "default",
411
+ "primary",
412
+ "secondary",
413
+ "tertiary",
414
+ "success",
415
+ "warning",
416
+ "danger",
417
+ "light",
418
+ "medium",
419
+ "dark",
420
+ ];
421
+ Color.type = string(Color.types);
422
+ Color.is = Color.type.is;
423
+ })(exports.Color || (exports.Color = {}));
424
+
425
+ exports.Icon = void 0;
426
+ (function (Icon) {
427
+ const names = {
428
+ "*": "https://ionicons.pages.dev/svg/${name}.svg",
429
+ };
430
+ const cache = {};
431
+ async function fetch(url) {
432
+ const response = await globalThis.fetch(url);
433
+ return response.ok ? response.text() : undefined;
434
+ }
435
+ async function load(name) {
436
+ var _a, _b;
437
+ const url = ((_a = names[name]) !== null && _a !== void 0 ? _a : names["*"]).replace("${name}", name);
438
+ return (_b = cache[url]) !== null && _b !== void 0 ? _b : (cache[url] = fetch(url));
439
+ }
440
+ Icon.load = load;
441
+ function add(url, ...name) {
442
+ for (const n of name)
443
+ names[n] = url;
444
+ }
445
+ Icon.add = add;
446
+ })(exports.Icon || (exports.Icon = {}));
447
+
448
+ class Message {
449
+ static is(value) {
450
+ return typeof value == "object" && typeof value.destination == "string" && value.content != undefined;
451
+ }
452
+ static send(message, content, context) {
453
+ if (Message.is(message) && context == undefined) {
454
+ context = content;
455
+ if (!context)
456
+ context = window;
457
+ const destination = message.destination.split("#", 2);
458
+ message = { destination: destination[1], content: message.content };
459
+ context.postMessage(message, destination[0]);
460
+ }
461
+ else if (typeof context != "string") {
462
+ if (!context)
463
+ context = window;
464
+ if (typeof message == "string")
465
+ Message.send({ destination: message, content }, context);
466
+ }
467
+ }
468
+ static listen(origin, handle, context) {
469
+ const splitted = origin.split("#", 2);
470
+ let destination = "";
471
+ if (splitted.length == 2) {
472
+ origin = splitted[0];
473
+ destination = splitted[1];
474
+ }
475
+ (context || window).addEventListener("message", (e) => {
476
+ const message = e.data;
477
+ if (Message.is(message) &&
478
+ (origin == "*" || e.origin == origin) &&
479
+ (destination == "" || message.destination == destination))
480
+ handle(message.destination, message.content);
481
+ });
482
+ }
483
+ }
484
+
485
+ class Trigger {
486
+ static is(value) {
487
+ return typeof value == "object" && typeof value.name == "string";
488
+ }
489
+ }
490
+
491
+ var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
492
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
493
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
494
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
495
+ };
496
+ var _Listenable_listeners;
497
+ class Listenable {
498
+ constructor() {
499
+ _Listenable_listeners.set(this, {});
500
+ }
501
+ listen(property, listener, options) {
502
+ var _a, _b;
503
+ (_b = (_a = __classPrivateFieldGet(this, _Listenable_listeners, "f")[property]) === null || _a === void 0 ? void 0 : _a.push(listener)) !== null && _b !== void 0 ? _b : (__classPrivateFieldGet(this, _Listenable_listeners, "f")[property] = [listener]);
504
+ if (!(options === null || options === void 0 ? void 0 : options.lazy))
505
+ listener(this[property]);
506
+ }
507
+ unlisten(property, listener) {
508
+ var _a, _b;
509
+ const index = (_a = __classPrivateFieldGet(this, _Listenable_listeners, "f")[property]) === null || _a === void 0 ? void 0 : _a.indexOf(listener);
510
+ index != undefined && index >= 0 && ((_b = __classPrivateFieldGet(this, _Listenable_listeners, "f")[property]) === null || _b === void 0 ? void 0 : _b.splice(index, 1));
511
+ }
512
+ batchListen(listeners, options) {
513
+ for (const key in listeners) {
514
+ const listener = listeners[key];
515
+ listener && this.listen(key, listener, options);
516
+ }
517
+ }
518
+ batchUnlisten(listeners) {
519
+ for (const key in listeners) {
520
+ const listener = listeners[key];
521
+ listener && this.unlisten(key, listener);
522
+ }
523
+ }
524
+ static load(backend) {
525
+ const result = backend.listenable;
526
+ return Object.defineProperties(result, getProperties(backend));
527
+ function getProperties(backend) {
528
+ return Object.fromEntries(Object.entries(Object.assign(Object.assign({}, Object.getOwnPropertyDescriptors(backend)), Object.getOwnPropertyDescriptors(Object.getPrototypeOf(backend)))).map(([name, descriptor]) => [
529
+ name,
530
+ typeof descriptor.value == "function"
531
+ ? {
532
+ get() {
533
+ return backend[name].bind(backend);
534
+ },
535
+ }
536
+ : descriptor.writable || descriptor.set
537
+ ? {
538
+ get() {
539
+ return backend[name];
540
+ },
541
+ set(value) {
542
+ var _a;
543
+ backend[name] = value;
544
+ (_a = __classPrivateFieldGet(result, _Listenable_listeners, "f")[name]) === null || _a === void 0 ? void 0 : _a.forEach(listener => listener(backend[name]));
545
+ },
546
+ }
547
+ : {
548
+ get() {
549
+ return backend[name];
550
+ },
551
+ },
552
+ ]));
553
+ }
554
+ }
555
+ }
556
+ _Listenable_listeners = new WeakMap();
557
+
558
+ exports.Data = void 0;
559
+ (function (Data) {
560
+ Data.valueType = union(string(), number(), boolean(), fromIs("Blob", value => value instanceof Blob), islyUndefined());
561
+ Data.type = record(string(), union(lazy(() => Data.type, "Data"), Data.valueType));
562
+ function set(data, [head, ...tail], value) {
563
+ const current = data[head !== null && head !== void 0 ? head : ""];
564
+ return Object.assign(Object.assign({}, data), { [head !== null && head !== void 0 ? head : ""]: !tail.length
565
+ ? value
566
+ : set(typeof current == "object" && !(current instanceof Blob) ? current : {}, tail, value) });
567
+ }
568
+ Data.set = set;
569
+ function deepen(data) {
570
+ return merge({}, data);
571
+ }
572
+ Data.deepen = deepen;
573
+ function merge(data, changes) {
574
+ return Object.entries(changes).reduce((r, [name, value]) => set(r, name.split("."), value), data);
575
+ }
576
+ Data.merge = merge;
577
+ })(exports.Data || (exports.Data = {}));
578
+
579
+ exports.Listenable = Listenable;
580
+ exports.Message = Message;
581
+ exports.Trigger = Trigger;
582
+ exports.Type = Type;
583
+ exports.boolean = boolean;
584
+ exports.object = object;
585
+ exports.record = record;
586
+ exports.string = string;
587
+ exports.union = union;
588
+
589
+ //# sourceMappingURL=Data-50d47740.js.map