@spearwolf/shadow-objects 0.30.2 → 0.32.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.
Files changed (122) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/bundle.js +13 -13
  3. package/package.json +3 -3
  4. package/src/bundle.js +4 -4
  5. package/src/bundle.js.map +7 -1
  6. package/src/constants.js +53 -40
  7. package/src/constants.js.map +7 -1
  8. package/src/create-worker.bundle.js +6 -8
  9. package/src/create-worker.bundle.js.map +7 -1
  10. package/src/create-worker.js +5 -2
  11. package/src/create-worker.js.map +7 -1
  12. package/src/elements/ShaeElement.js +57 -54
  13. package/src/elements/ShaeElement.js.map +7 -1
  14. package/src/elements/ShaeEntElement.d.ts.map +1 -1
  15. package/src/elements/ShaeEntElement.js +320 -341
  16. package/src/elements/ShaeEntElement.js.map +7 -1
  17. package/src/elements/ShaePropElement.js +312 -320
  18. package/src/elements/ShaePropElement.js.map +7 -1
  19. package/src/elements/ShaeWorkerElement.js +234 -229
  20. package/src/elements/ShaeWorkerElement.js.map +7 -1
  21. package/src/elements/constants.js +37 -22
  22. package/src/elements/constants.js.map +7 -1
  23. package/src/elements/events.d.ts +1 -1
  24. package/src/elements/events.d.ts.map +1 -1
  25. package/src/elements/events.js +1 -2
  26. package/src/elements/events.js.map +7 -1
  27. package/src/elements.js +4 -4
  28. package/src/elements.js.map +7 -1
  29. package/src/in-the-dark/Entity.d.ts +1 -1
  30. package/src/in-the-dark/Entity.d.ts.map +1 -1
  31. package/src/in-the-dark/Entity.js +299 -293
  32. package/src/in-the-dark/Entity.js.map +7 -1
  33. package/src/in-the-dark/Kernel.d.ts.map +1 -1
  34. package/src/in-the-dark/Kernel.js +556 -533
  35. package/src/in-the-dark/Kernel.js.map +7 -1
  36. package/src/in-the-dark/Registry.d.ts.map +1 -1
  37. package/src/in-the-dark/Registry.js +101 -104
  38. package/src/in-the-dark/Registry.js.map +7 -1
  39. package/src/in-the-dark/ShadowObject.d.ts.map +1 -1
  40. package/src/in-the-dark/ShadowObject.js +21 -23
  41. package/src/in-the-dark/ShadowObject.js.map +7 -1
  42. package/src/in-the-dark/SignalsPath.d.ts.map +1 -1
  43. package/src/in-the-dark/SignalsPath.js +139 -123
  44. package/src/in-the-dark/SignalsPath.js.map +7 -1
  45. package/src/in-the-dark/events.js +11 -9
  46. package/src/in-the-dark/events.js.map +7 -1
  47. package/src/in-the-dark/importModule.js +31 -29
  48. package/src/in-the-dark/importModule.js.map +7 -1
  49. package/src/index.d.ts +2 -2
  50. package/src/index.d.ts.map +1 -1
  51. package/src/index.js +14 -14
  52. package/src/index.js.map +7 -1
  53. package/src/shadow-objects.js +6 -6
  54. package/src/shadow-objects.js.map +7 -1
  55. package/src/shadow-objects.worker.js +3 -3
  56. package/src/shadow-objects.worker.js.map +7 -1
  57. package/src/shae-ent.js +3 -3
  58. package/src/shae-ent.js.map +7 -1
  59. package/src/shae-prop.js +3 -3
  60. package/src/shae-prop.js.map +7 -1
  61. package/src/shae-worker.js +3 -3
  62. package/src/shae-worker.js.map +7 -1
  63. package/src/types.d.ts +3 -2
  64. package/src/types.d.ts.map +1 -1
  65. package/src/types.js +1 -2
  66. package/src/types.js.map +7 -1
  67. package/src/utils/ConsoleLogger.js +179 -185
  68. package/src/utils/ConsoleLogger.js.map +7 -1
  69. package/src/utils/FrameLoop.js +41 -40
  70. package/src/utils/FrameLoop.js.map +7 -1
  71. package/src/utils/array-utils.js +22 -24
  72. package/src/utils/array-utils.js.map +7 -1
  73. package/src/utils/attr-utils.js +15 -11
  74. package/src/utils/attr-utils.js.map +7 -1
  75. package/src/utils/constants.js +5 -2
  76. package/src/utils/constants.js.map +7 -1
  77. package/src/utils/generateUUID.d.ts.map +1 -1
  78. package/src/utils/generateUUID.js +269 -32
  79. package/src/utils/generateUUID.js.map +7 -1
  80. package/src/utils/props-utils.js +34 -43
  81. package/src/utils/props-utils.js.map +7 -1
  82. package/src/utils/toMaybe.js +5 -2
  83. package/src/utils/toMaybe.js.map +7 -1
  84. package/src/utils/toNamespace.js +6 -3
  85. package/src/utils/toNamespace.js.map +7 -1
  86. package/src/utils/toUrlString.js +9 -6
  87. package/src/utils/toUrlString.js.map +7 -1
  88. package/src/utils/waitForMessageOfType.js +30 -32
  89. package/src/utils/waitForMessageOfType.js.map +7 -1
  90. package/src/view/ComponentChanges.d.ts +1 -1
  91. package/src/view/ComponentChanges.d.ts.map +1 -1
  92. package/src/view/ComponentChanges.js +249 -251
  93. package/src/view/ComponentChanges.js.map +7 -1
  94. package/src/view/ComponentContext.d.ts.map +1 -1
  95. package/src/view/ComponentContext.js +303 -331
  96. package/src/view/ComponentContext.js.map +7 -1
  97. package/src/view/ComponentMemory.d.ts +1 -0
  98. package/src/view/ComponentMemory.d.ts.map +1 -1
  99. package/src/view/ComponentMemory.js +73 -76
  100. package/src/view/ComponentMemory.js.map +7 -1
  101. package/src/view/IShadowObjectEnvProxy.js +1 -2
  102. package/src/view/IShadowObjectEnvProxy.js.map +7 -1
  103. package/src/view/LocalShadowObjectEnv.d.ts.map +1 -1
  104. package/src/view/LocalShadowObjectEnv.js +57 -52
  105. package/src/view/LocalShadowObjectEnv.js.map +7 -1
  106. package/src/view/RemoteWorkerEnv.js +134 -123
  107. package/src/view/RemoteWorkerEnv.js.map +7 -1
  108. package/src/view/ShadowEnv.d.ts.map +1 -1
  109. package/src/view/ShadowEnv.js +232 -228
  110. package/src/view/ShadowEnv.js.map +7 -1
  111. package/src/view/ViewComponent.d.ts +9 -0
  112. package/src/view/ViewComponent.d.ts.map +1 -1
  113. package/src/view/ViewComponent.js +142 -130
  114. package/src/view/ViewComponent.js.map +7 -1
  115. package/src/view/cloneChangeTrail.js +13 -11
  116. package/src/view/cloneChangeTrail.js.map +7 -1
  117. package/src/worker/MessageRouter.d.ts.map +1 -1
  118. package/src/worker/MessageRouter.js +78 -67
  119. package/src/worker/MessageRouter.js.map +7 -1
  120. package/src/worker/WorkerRuntime.js +22 -21
  121. package/src/worker/WorkerRuntime.js.map +7 -1
  122. package/tsconfig.lib.tsbuildinfo +0 -1
@@ -1,330 +1,322 @@
1
- import { batch, createEffect, createSignal, link } from '@spearwolf/signalize';
2
- import { readBooleanAttribute } from '../utils/attr-utils.js';
3
- import { ConsoleLogger } from '../utils/ConsoleLogger.js';
4
- import { TRUTHY_VALUES } from '../utils/constants.js';
5
- import { ATTR_NAME, ATTR_NO_TRIM, ATTR_TYPE, ATTR_VALUE } from './constants.js';
1
+ import { batch, createEffect, createSignal, link } from "@spearwolf/signalize";
2
+ import { readBooleanAttribute } from "../utils/attr-utils.js";
3
+ import { ConsoleLogger } from "../utils/ConsoleLogger.js";
4
+ import { TRUTHY_VALUES } from "../utils/constants.js";
5
+ import { ATTR_NAME, ATTR_NO_TRIM, ATTR_TYPE, ATTR_VALUE } from "./constants.js";
6
6
  const findEntNode = (start) => {
7
- let el = start.parentElement;
8
- while (el) {
9
- if (el.isShaeEntElement) {
10
- return el;
11
- }
12
- el = el.parentElement;
7
+ let el = start.parentElement;
8
+ while (el) {
9
+ if (el.isShaeEntElement) {
10
+ return el;
13
11
  }
14
- return undefined;
12
+ el = el.parentElement;
13
+ }
14
+ return void 0;
15
15
  };
16
- const TYPES = new Set([
17
- 'string',
18
- 'text',
19
- 'number',
20
- 'bigint',
21
- 'float',
22
- 'int',
23
- 'integer',
24
- 'hex',
25
- 'hexadecimal',
26
- 'oct',
27
- 'octal',
28
- 'bin',
29
- 'binary',
30
- 'bool',
31
- 'boolean',
32
- '[]',
33
- 'text[]',
34
- 'string[]',
35
- 'number[]',
36
- 'float[]',
37
- 'int[]',
38
- 'integer[]',
39
- 'hex[]',
40
- 'hexadecimal[]',
41
- 'oct[]',
42
- 'octal[]',
43
- 'bin[]',
44
- 'binary[]',
45
- 'bool[]',
46
- 'boolean[]',
47
- 'int8array',
48
- 'uint8array',
49
- 'uint8clampedarray',
50
- 'int16array',
51
- 'uint16array',
52
- 'int32array',
53
- 'uint32array',
54
- 'float32array',
55
- 'float64array',
56
- 'bigint64array',
57
- 'biguint64array',
58
- 'json',
16
+ const TYPES = /* @__PURE__ */ new Set([
17
+ "string",
18
+ "text",
19
+ "number",
20
+ "bigint",
21
+ "float",
22
+ "int",
23
+ "integer",
24
+ "hex",
25
+ "hexadecimal",
26
+ "oct",
27
+ "octal",
28
+ "bin",
29
+ "binary",
30
+ "bool",
31
+ "boolean",
32
+ "[]",
33
+ "text[]",
34
+ "string[]",
35
+ "number[]",
36
+ "float[]",
37
+ "int[]",
38
+ "integer[]",
39
+ "hex[]",
40
+ "hexadecimal[]",
41
+ "oct[]",
42
+ "octal[]",
43
+ "bin[]",
44
+ "binary[]",
45
+ "bool[]",
46
+ "boolean[]",
47
+ "int8array",
48
+ "uint8array",
49
+ "uint8clampedarray",
50
+ "int16array",
51
+ "uint16array",
52
+ "int32array",
53
+ "uint32array",
54
+ "float32array",
55
+ "float64array",
56
+ "bigint64array",
57
+ "biguint64array",
58
+ "json"
59
59
  ]);
60
- export class ShaePropElement extends HTMLElement {
61
- static { this.observedAttributes = [ATTR_NAME, ATTR_VALUE, ATTR_TYPE, ATTR_NO_TRIM]; }
62
- get name() {
63
- return this.name$.value;
64
- }
65
- get value() {
66
- return this.valueOut$.value;
67
- }
68
- set value(val) {
69
- this.valueIn$.set(val);
70
- }
71
- get shouldTrim() {
72
- return this.shouldTrim$.value;
73
- }
74
- get entNode() {
75
- return this.entNode$.value;
76
- }
77
- set entNode(el) {
78
- this.entNode$.set(el);
79
- }
80
- get viewComponent() {
81
- return this.viewComponent$.value;
82
- }
83
- constructor() {
84
- super();
85
- this.isShaeEntElement = true;
86
- this.entNode$ = createSignal();
87
- this.viewComponent$ = createSignal();
88
- this.name$ = createSignal();
89
- this.valueIn$ = createSignal();
90
- this.valueOut$ = createSignal();
91
- this.type$ = createSignal();
92
- this.shouldTrim$ = createSignal(true);
93
- this.logger = new ConsoleLogger('ShaePropElement');
94
- this.#findEntNode = () => {
95
- this.entNode$.set(findEntNode(this));
60
+ class ShaePropElement extends HTMLElement {
61
+ constructor() {
62
+ super();
63
+ this.isShaeEntElement = true;
64
+ this.entNode$ = createSignal();
65
+ this.viewComponent$ = createSignal();
66
+ this.name$ = createSignal();
67
+ this.valueIn$ = createSignal();
68
+ this.valueOut$ = createSignal();
69
+ this.type$ = createSignal();
70
+ this.shouldTrim$ = createSignal(true);
71
+ this.logger = new ConsoleLogger("ShaePropElement");
72
+ this.#findEntNode = () => {
73
+ this.entNode$.set(findEntNode(this));
74
+ };
75
+ this.#disconnectFromEntNode = () => {
76
+ queueMicrotask(() => {
77
+ if (!this.isConnected) {
78
+ this.entNode$.set(void 0);
79
+ }
80
+ });
81
+ };
82
+ this.#readNameAttribute = () => {
83
+ this.name$.set(this.getAttribute(ATTR_NAME)?.trim() ?? void 0);
84
+ };
85
+ this.#readValueAttribute = () => {
86
+ this.valueIn$.set(this.getAttribute(ATTR_VALUE));
87
+ };
88
+ this.#readTypeAttribute = () => {
89
+ let type = this.getAttribute(ATTR_TYPE)?.trim().toLowerCase();
90
+ if (type && !TYPES.has(type)) {
91
+ if (this.logger.isWarn) {
92
+ this.logger.warn(`[${this.name}] unknown type "${type}"`, {
93
+ shaeProp: this
94
+ });
95
+ }
96
+ type = void 0;
97
+ }
98
+ this.type$.set(type);
99
+ };
100
+ this.#readNoTrimAttribute = () => {
101
+ this.shouldTrim$.set(!readBooleanAttribute(this, ATTR_NO_TRIM));
102
+ };
103
+ this.entNode$.onChange((entNode) => {
104
+ if (entNode) {
105
+ const con = link(entNode.viewComponent$, this.viewComponent$);
106
+ return () => {
107
+ con.destroy();
96
108
  };
97
- this.#disconnectFromEntNode = () => {
98
- queueMicrotask(() => {
99
- if (!this.isConnected) {
100
- this.entNode$.set(undefined);
101
- }
109
+ } else {
110
+ this.viewComponent$.set(void 0);
111
+ }
112
+ });
113
+ createEffect(() => {
114
+ const vc = this.viewComponent$.get();
115
+ if (vc) {
116
+ const name = this.name$.get();
117
+ if (name) {
118
+ const value = this.valueOut$.get();
119
+ if (this.logger.isDebug) {
120
+ this.logger.debug(`[${this.name}] view-component set-property`, name, value, vc.uuid, {
121
+ viewComponent: vc,
122
+ shaeProp: this
102
123
  });
103
- };
104
- this.#readNameAttribute = () => {
105
- this.name$.set(this.getAttribute(ATTR_NAME)?.trim() ?? undefined);
106
- };
107
- this.#readValueAttribute = () => {
108
- this.valueIn$.set(this.getAttribute(ATTR_VALUE));
109
- };
110
- this.#readTypeAttribute = () => {
111
- let type = this.getAttribute(ATTR_TYPE)?.trim().toLowerCase();
112
- if (type && !TYPES.has(type)) {
113
- if (this.logger.isWarn) {
114
- this.logger.warn(`[${this.name}] unknown type "${type}"`, {
115
- shaeProp: this,
116
- });
117
- }
118
- type = undefined;
119
- }
120
- this.type$.set(type);
121
- };
122
- this.#readNoTrimAttribute = () => {
123
- this.shouldTrim$.set(!readBooleanAttribute(this, ATTR_NO_TRIM));
124
- };
125
- this.entNode$.onChange((entNode) => {
126
- if (entNode) {
127
- const con = link(entNode.viewComponent$, this.viewComponent$);
128
- return () => {
129
- con.destroy();
130
- };
131
- }
132
- else {
133
- this.viewComponent$.set(undefined);
134
- }
135
- });
136
- // this.viewComponent$.onChange((vc) => {
137
- // if (vc) {
138
- // console.log(`[shae-prop:"${this.name}"] view-component changed to`, vc?.uuid, {
139
- // viewComponent: vc,
140
- // shaeProp: this,
141
- // });
142
- // } else {
143
- // console.log(`[shae-prop:"${this.name}"] lost connection to view-component :/`, {
144
- // shaeProp: this,
145
- // });
146
- // }
147
- // });
148
- createEffect(() => {
149
- const vc = this.viewComponent$.get();
150
- if (vc) {
151
- const name = this.name$.get();
152
- if (name) {
153
- const value = this.valueOut$.get();
154
- if (this.logger.isDebug) {
155
- this.logger.debug(`[${this.name}] view-component set-property`, name, value, vc.uuid, {
156
- viewComponent: vc,
157
- shaeProp: this,
158
- });
159
- }
160
- vc.setProperty(name, value);
161
- if (this.isConnected) {
162
- this.entNode?.syncShadowObjects();
163
- }
164
- }
165
- }
166
- });
167
- createEffect(() => {
168
- const type = this.type$.get();
169
- const shouldTrim = this.shouldTrim$.get();
170
- let value = this.valueIn$.get();
171
- if (shouldTrim && typeof value === 'string') {
172
- value = value.trim();
173
- }
174
- value = value || undefined;
175
- if (value != null && typeof value === 'string' && type) {
176
- switch (type) {
177
- case 'string':
178
- case 'text':
179
- break;
180
- case 'number':
181
- value = Number(value);
182
- break;
183
- case 'bigint':
184
- value = BigInt(value);
185
- break;
186
- case 'float':
187
- value = parseFloat(value);
188
- break;
189
- case 'int':
190
- case 'integer':
191
- value = parseInt(value, 10);
192
- break;
193
- case 'hex':
194
- case 'hexadecimal':
195
- value = parseInt(value, 16);
196
- break;
197
- case 'oct':
198
- case 'octal':
199
- value = parseInt(value, 8);
200
- break;
201
- case 'bin':
202
- case 'binary':
203
- value = parseInt(value, 2);
204
- break;
205
- case 'bool':
206
- case 'boolean':
207
- value = TRUTHY_VALUES.has(value.toLowerCase());
208
- break;
209
- case '[]':
210
- case 'text[]':
211
- case 'string[]':
212
- value = value.split(/\W+/);
213
- break;
214
- case 'number[]':
215
- value = value.split(/\s+/).map((v) => Number(v));
216
- break;
217
- case 'float[]':
218
- value = value.split(/\s+/).map((v) => parseFloat(v));
219
- break;
220
- case 'int[]':
221
- case 'integer[]':
222
- value = value.split(/\s+/).map((v) => parseInt(v));
223
- break;
224
- case 'hex[]':
225
- case 'hexadecimal[]':
226
- value = value.split(/\W+/).map((v) => parseInt(v, 16));
227
- break;
228
- case 'oct[]':
229
- case 'octal[]':
230
- value = value.split(/\W+/).map((v) => parseInt(v, 8));
231
- break;
232
- case 'bin[]':
233
- case 'binary[]':
234
- value = value.split(/\W+/).map((v) => parseInt(v, 2));
235
- break;
236
- case 'bool[]':
237
- case 'boolean[]':
238
- value = value.split(/\W+/).map((v) => TRUTHY_VALUES.has(v.toLowerCase()));
239
- break;
240
- case 'int8array':
241
- value = new Int8Array(value.split(/\W+/).map((v) => Number(v)));
242
- break;
243
- case 'uint8array':
244
- value = new Uint8Array(value.split(/\W+/).map((v) => Number(v)));
245
- break;
246
- case 'uint8clampedarray':
247
- value = new Uint8ClampedArray(value.split(/\W+/).map((v) => Number(v)));
248
- break;
249
- case 'int16array':
250
- value = new Int16Array(value.split(/\W+/).map((v) => Number(v)));
251
- break;
252
- case 'uint16array':
253
- value = new Uint16Array(value.split(/\W+/).map((v) => Number(v)));
254
- break;
255
- case 'int32array':
256
- value = new Int32Array(value.split(/\W+/).map((v) => Number(v)));
257
- break;
258
- case 'uint32array':
259
- value = new Uint32Array(value.split(/\W+/).map((v) => Number(v)));
260
- break;
261
- case 'float32array':
262
- value = new Float32Array(value.split(/\s+/).map((v) => Number(v)));
263
- break;
264
- case 'float64array':
265
- value = new Float64Array(value.split(/\s+/).map((v) => Number(v)));
266
- break;
267
- case 'bigint64array':
268
- value = new BigInt64Array(value.split(/\W+/).map((v) => BigInt(v)));
269
- break;
270
- case 'biguint64array':
271
- value = new BigUint64Array(value.split(/\W+/).map((v) => BigInt(v)));
272
- break;
273
- case 'json':
274
- value = JSON.parse(value);
275
- break;
276
- default:
277
- if (this.logger.isWarn) {
278
- this.logger.warn(`[${this.name}] unknown type "${type}"`, {
279
- value,
280
- shaeProp: this,
281
- });
282
- }
283
- }
124
+ }
125
+ vc.setProperty(name, value);
126
+ if (this.isConnected) {
127
+ this.entNode?.syncShadowObjects();
128
+ }
129
+ }
130
+ }
131
+ });
132
+ createEffect(() => {
133
+ const type = this.type$.get();
134
+ const shouldTrim = this.shouldTrim$.get();
135
+ let value = this.valueIn$.get();
136
+ if (shouldTrim && typeof value === "string") {
137
+ value = value.trim();
138
+ }
139
+ value = value || void 0;
140
+ if (value != null && typeof value === "string" && type) {
141
+ switch (type) {
142
+ case "string":
143
+ case "text":
144
+ break;
145
+ case "number":
146
+ value = Number(value);
147
+ break;
148
+ case "bigint":
149
+ value = BigInt(value);
150
+ break;
151
+ case "float":
152
+ value = parseFloat(value);
153
+ break;
154
+ case "int":
155
+ case "integer":
156
+ value = parseInt(value, 10);
157
+ break;
158
+ case "hex":
159
+ case "hexadecimal":
160
+ value = parseInt(value, 16);
161
+ break;
162
+ case "oct":
163
+ case "octal":
164
+ value = parseInt(value, 8);
165
+ break;
166
+ case "bin":
167
+ case "binary":
168
+ value = parseInt(value, 2);
169
+ break;
170
+ case "bool":
171
+ case "boolean":
172
+ value = TRUTHY_VALUES.has(value.toLowerCase());
173
+ break;
174
+ case "[]":
175
+ case "text[]":
176
+ case "string[]":
177
+ value = value.split(/\W+/);
178
+ break;
179
+ case "number[]":
180
+ value = value.split(/\s+/).map((v) => Number(v));
181
+ break;
182
+ case "float[]":
183
+ value = value.split(/\s+/).map((v) => parseFloat(v));
184
+ break;
185
+ case "int[]":
186
+ case "integer[]":
187
+ value = value.split(/\s+/).map((v) => parseInt(v));
188
+ break;
189
+ case "hex[]":
190
+ case "hexadecimal[]":
191
+ value = value.split(/\W+/).map((v) => parseInt(v, 16));
192
+ break;
193
+ case "oct[]":
194
+ case "octal[]":
195
+ value = value.split(/\W+/).map((v) => parseInt(v, 8));
196
+ break;
197
+ case "bin[]":
198
+ case "binary[]":
199
+ value = value.split(/\W+/).map((v) => parseInt(v, 2));
200
+ break;
201
+ case "bool[]":
202
+ case "boolean[]":
203
+ value = value.split(/\W+/).map((v) => TRUTHY_VALUES.has(v.toLowerCase()));
204
+ break;
205
+ case "int8array":
206
+ value = new Int8Array(value.split(/\W+/).map((v) => Number(v)));
207
+ break;
208
+ case "uint8array":
209
+ value = new Uint8Array(value.split(/\W+/).map((v) => Number(v)));
210
+ break;
211
+ case "uint8clampedarray":
212
+ value = new Uint8ClampedArray(value.split(/\W+/).map((v) => Number(v)));
213
+ break;
214
+ case "int16array":
215
+ value = new Int16Array(value.split(/\W+/).map((v) => Number(v)));
216
+ break;
217
+ case "uint16array":
218
+ value = new Uint16Array(value.split(/\W+/).map((v) => Number(v)));
219
+ break;
220
+ case "int32array":
221
+ value = new Int32Array(value.split(/\W+/).map((v) => Number(v)));
222
+ break;
223
+ case "uint32array":
224
+ value = new Uint32Array(value.split(/\W+/).map((v) => Number(v)));
225
+ break;
226
+ case "float32array":
227
+ value = new Float32Array(value.split(/\s+/).map((v) => Number(v)));
228
+ break;
229
+ case "float64array":
230
+ value = new Float64Array(value.split(/\s+/).map((v) => Number(v)));
231
+ break;
232
+ case "bigint64array":
233
+ value = new BigInt64Array(value.split(/\W+/).map((v) => BigInt(v)));
234
+ break;
235
+ case "biguint64array":
236
+ value = new BigUint64Array(value.split(/\W+/).map((v) => BigInt(v)));
237
+ break;
238
+ case "json":
239
+ value = JSON.parse(value);
240
+ break;
241
+ default:
242
+ if (this.logger.isWarn) {
243
+ this.logger.warn(`[${this.name}] unknown type "${type}"`, {
244
+ value,
245
+ shaeProp: this
246
+ });
284
247
  }
285
- this.valueOut$.set(value);
286
- });
287
- batch(() => {
288
- this.#readNameAttribute();
289
- this.#readValueAttribute();
290
- this.#readTypeAttribute();
291
- this.#readNoTrimAttribute();
292
- });
293
- this.style.display = 'contents';
294
- }
295
- connectedCallback() {
296
- batch(() => {
297
- this.#findEntNode();
298
- this.#readNameAttribute();
299
- this.#readValueAttribute();
300
- this.#readTypeAttribute();
301
- this.#readNoTrimAttribute();
302
- });
303
- }
304
- attributeChangedCallback(name) {
305
- switch (name) {
306
- case ATTR_NAME:
307
- this.#readNameAttribute();
308
- break;
309
- case ATTR_VALUE:
310
- this.#readValueAttribute();
311
- break;
312
- case ATTR_TYPE:
313
- this.#readTypeAttribute();
314
- break;
315
- case ATTR_NO_TRIM:
316
- this.#readNoTrimAttribute();
317
- break;
318
248
  }
249
+ }
250
+ this.valueOut$.set(value);
251
+ });
252
+ batch(() => {
253
+ this.#readNameAttribute();
254
+ this.#readValueAttribute();
255
+ this.#readTypeAttribute();
256
+ this.#readNoTrimAttribute();
257
+ });
258
+ this.style.display = "contents";
259
+ }
260
+ static {
261
+ this.observedAttributes = [ATTR_NAME, ATTR_VALUE, ATTR_TYPE, ATTR_NO_TRIM];
262
+ }
263
+ get name() {
264
+ return this.name$.value;
265
+ }
266
+ get value() {
267
+ return this.valueOut$.value;
268
+ }
269
+ set value(val) {
270
+ this.valueIn$.set(val);
271
+ }
272
+ get shouldTrim() {
273
+ return this.shouldTrim$.value;
274
+ }
275
+ get entNode() {
276
+ return this.entNode$.value;
277
+ }
278
+ set entNode(el) {
279
+ this.entNode$.set(el);
280
+ }
281
+ get viewComponent() {
282
+ return this.viewComponent$.value;
283
+ }
284
+ connectedCallback() {
285
+ batch(() => {
286
+ this.#findEntNode();
287
+ this.#readNameAttribute();
288
+ this.#readValueAttribute();
289
+ this.#readTypeAttribute();
290
+ this.#readNoTrimAttribute();
291
+ });
292
+ }
293
+ attributeChangedCallback(name) {
294
+ switch (name) {
295
+ case ATTR_NAME:
296
+ this.#readNameAttribute();
297
+ break;
298
+ case ATTR_VALUE:
299
+ this.#readValueAttribute();
300
+ break;
301
+ case ATTR_TYPE:
302
+ this.#readTypeAttribute();
303
+ break;
304
+ case ATTR_NO_TRIM:
305
+ this.#readNoTrimAttribute();
306
+ break;
319
307
  }
320
- disconnectedCallback() {
321
- this.#disconnectFromEntNode();
322
- }
323
- #findEntNode;
324
- #disconnectFromEntNode;
325
- #readNameAttribute;
326
- #readValueAttribute;
327
- #readTypeAttribute;
328
- #readNoTrimAttribute;
308
+ }
309
+ disconnectedCallback() {
310
+ this.#disconnectFromEntNode();
311
+ }
312
+ #findEntNode;
313
+ #disconnectFromEntNode;
314
+ #readNameAttribute;
315
+ #readValueAttribute;
316
+ #readTypeAttribute;
317
+ #readNoTrimAttribute;
329
318
  }
330
- //# sourceMappingURL=ShaePropElement.js.map
319
+ export {
320
+ ShaePropElement
321
+ };
322
+ //# sourceMappingURL=ShaePropElement.js.map