what-core 0.11.0 → 0.11.1

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 (91) hide show
  1. package/dist/{chunk-RI7T5VFD.min.js → chunk-D5YDPQ57.min.js} +1 -2
  2. package/dist/chunk-O3SKPRTY.min.js +0 -1
  3. package/dist/chunk-W33M3HL5.min.js +1 -0
  4. package/dist/index.min.js +2 -3
  5. package/dist/jsx-dev-runtime.min.js +0 -1
  6. package/dist/jsx-runtime.min.js +0 -1
  7. package/dist/render.min.js +1 -2
  8. package/dist/testing.min.js +1 -2
  9. package/package.json +2 -2
  10. package/src/agent-context.js +1 -1
  11. package/src/reactive.js +20 -4
  12. package/dist/a11y.js +0 -440
  13. package/dist/animation.js +0 -548
  14. package/dist/chunk-2IZMPODD.min.js +0 -2
  15. package/dist/chunk-2IZMPODD.min.js.map +0 -7
  16. package/dist/chunk-2P7OVL2L.js +0 -1386
  17. package/dist/chunk-2P7OVL2L.js.map +0 -7
  18. package/dist/chunk-5EQUBJWQ.js +0 -1365
  19. package/dist/chunk-5EQUBJWQ.js.map +0 -7
  20. package/dist/chunk-6DAIK77K.min.js +0 -2
  21. package/dist/chunk-6DAIK77K.min.js.map +0 -7
  22. package/dist/chunk-AW3BAPIK.js +0 -1685
  23. package/dist/chunk-AW3BAPIK.js.map +0 -7
  24. package/dist/chunk-AZP2EOGX.js +0 -188
  25. package/dist/chunk-AZP2EOGX.js.map +0 -7
  26. package/dist/chunk-CCINITLW.js +0 -1692
  27. package/dist/chunk-CCINITLW.js.map +0 -7
  28. package/dist/chunk-F2HUXI22.js +0 -1675
  29. package/dist/chunk-F2HUXI22.js.map +0 -7
  30. package/dist/chunk-GZRA4IAJ.js +0 -1699
  31. package/dist/chunk-GZRA4IAJ.js.map +0 -7
  32. package/dist/chunk-H3GA34JK.js +0 -1384
  33. package/dist/chunk-H3GA34JK.js.map +0 -7
  34. package/dist/chunk-KBM6CWG4.min.js +0 -2
  35. package/dist/chunk-KBM6CWG4.min.js.map +0 -7
  36. package/dist/chunk-KL7TNUIU.min.js +0 -2
  37. package/dist/chunk-KL7TNUIU.min.js.map +0 -7
  38. package/dist/chunk-L6XOF7P4.min.js +0 -2
  39. package/dist/chunk-L6XOF7P4.min.js.map +0 -7
  40. package/dist/chunk-M7UEET5O.js +0 -1323
  41. package/dist/chunk-M7UEET5O.js.map +0 -7
  42. package/dist/chunk-MH7L756Y.min.js +0 -2
  43. package/dist/chunk-MH7L756Y.min.js.map +0 -7
  44. package/dist/chunk-O3SKPRTY.min.js.map +0 -7
  45. package/dist/chunk-RI7T5VFD.min.js.map +0 -7
  46. package/dist/chunk-RN6QIBWL.min.js +0 -2
  47. package/dist/chunk-RN6QIBWL.min.js.map +0 -7
  48. package/dist/chunk-VKCFJ4OT.min.js +0 -2
  49. package/dist/chunk-VKCFJ4OT.min.js.map +0 -7
  50. package/dist/chunk-VMTTYB4L.min.js +0 -2
  51. package/dist/chunk-VMTTYB4L.min.js.map +0 -7
  52. package/dist/chunk-VP4WLF5A.js +0 -1323
  53. package/dist/chunk-VP4WLF5A.js.map +0 -7
  54. package/dist/chunk-YA3W4XKH.js +0 -1323
  55. package/dist/chunk-YA3W4XKH.js.map +0 -7
  56. package/dist/compiler.js +0 -1799
  57. package/dist/compiler.js.map +0 -7
  58. package/dist/compiler.min.js +0 -2
  59. package/dist/compiler.min.js.map +0 -7
  60. package/dist/components.js +0 -229
  61. package/dist/data.js +0 -638
  62. package/dist/devtools.js +0 -10
  63. package/dist/devtools.js.map +0 -7
  64. package/dist/devtools.min.js +0 -2
  65. package/dist/devtools.min.js.map +0 -7
  66. package/dist/dom.js +0 -439
  67. package/dist/form.js +0 -509
  68. package/dist/h.js +0 -152
  69. package/dist/head.js +0 -51
  70. package/dist/helpers.js +0 -140
  71. package/dist/hooks.js +0 -210
  72. package/dist/index.js +0 -3576
  73. package/dist/index.js.map +0 -7
  74. package/dist/index.min.js.map +0 -7
  75. package/dist/jsx-dev-runtime.js +0 -23
  76. package/dist/jsx-dev-runtime.js.map +0 -7
  77. package/dist/jsx-dev-runtime.min.js.map +0 -7
  78. package/dist/jsx-runtime.js +0 -21
  79. package/dist/jsx-runtime.js.map +0 -7
  80. package/dist/jsx-runtime.min.js.map +0 -7
  81. package/dist/reactive.js +0 -432
  82. package/dist/render.js +0 -53
  83. package/dist/render.js.map +0 -7
  84. package/dist/render.min.js.map +0 -7
  85. package/dist/scheduler.js +0 -246
  86. package/dist/skeleton.js +0 -363
  87. package/dist/store.js +0 -83
  88. package/dist/testing.js +0 -439
  89. package/dist/testing.js.map +0 -7
  90. package/dist/testing.min.js.map +0 -7
  91. package/dist/what.js +0 -117
package/dist/reactive.js DELETED
@@ -1,432 +0,0 @@
1
- export const __DEV__ = typeof process !== 'undefined'
2
- ? process.env?.NODE_ENV !== 'production'
3
- : true;
4
- export let __devtools = null;
5
- export function __setDevToolsHooks(hooks) {
6
- if (__DEV__) __devtools = hooks;
7
- }
8
- let currentEffect = null;
9
- let currentRoot = null;
10
- let currentOwner = null;
11
- let batchDepth = 0;
12
- let pendingEffects = [];
13
- const subSetOwner = new WeakMap();
14
- const NEEDS_UPSTREAM = Symbol('needs_upstream');
15
- let iterativeEvalStack = null;
16
- export function signal(initial, debugName) {
17
- let value = initial;
18
- const subs = new Set();
19
- function sig(...args) {
20
- if (args.length === 0) {
21
- if (currentEffect) {
22
- subs.add(currentEffect);
23
- currentEffect.deps.push(subs);
24
- }
25
- return value;
26
- }
27
- const nextVal = typeof args[0] === 'function' ? args[0](value) : args[0];
28
- if (Object.is(value, nextVal)) return;
29
- value = nextVal;
30
- if (__DEV__ && __devtools) __devtools.onSignalUpdate(sig);
31
- notify(subs);
32
- }
33
- sig.set = (next) => {
34
- const nextVal = typeof next === 'function' ? next(value) : next;
35
- if (Object.is(value, nextVal)) return;
36
- value = nextVal;
37
- if (__DEV__ && __devtools) __devtools.onSignalUpdate(sig);
38
- notify(subs);
39
- };
40
- sig.peek = () => value;
41
- sig.subscribe = (fn) => {
42
- return effect(() => fn(sig()));
43
- };
44
- sig._signal = true;
45
- if (__DEV__) {
46
- sig._subs = subs;
47
- if (debugName) sig._debugName = debugName;
48
- }
49
- if (__DEV__ && __devtools) __devtools.onSignalCreate(sig);
50
- return sig;
51
- }
52
- export function computed(fn) {
53
- let value, dirty = true;
54
- const subs = new Set();
55
- const inner = _createEffect(() => {
56
- value = fn();
57
- dirty = false;
58
- }, true);
59
- inner._level = 1;
60
- inner._computed = true;
61
- inner._computedSubs = subs;
62
- subSetOwner.set(subs, inner);
63
- inner._markDirty = () => { dirty = true; };
64
- inner._isDirty = () => dirty;
65
- function read() {
66
- if (currentEffect) {
67
- subs.add(currentEffect);
68
- currentEffect.deps.push(subs);
69
- }
70
- if (dirty) _evaluateComputed(inner);
71
- return value;
72
- }
73
- inner._onNotify = () => {
74
- dirty = true;
75
- notify(subs);
76
- };
77
- read._signal = true;
78
- read.peek = () => {
79
- if (dirty) _evaluateComputed(inner);
80
- return value;
81
- };
82
- return read;
83
- }
84
- function _evaluateComputed(computedEffect) {
85
- if (iterativeEvalStack !== null) {
86
- iterativeEvalStack.push(computedEffect);
87
- throw NEEDS_UPSTREAM;
88
- }
89
- const stack = [computedEffect];
90
- iterativeEvalStack = stack;
91
- try {
92
- while (stack.length > 0) {
93
- const current = stack[stack.length - 1];
94
- if (!current._isDirty || !current._isDirty()) {
95
- stack.pop();
96
- continue;
97
- }
98
- try {
99
- _runEffect(current);
100
- _updateLevel(current);
101
- stack.pop();
102
- } catch (err) {
103
- if (err === NEEDS_UPSTREAM) {
104
- current._markDirty();
105
- } else {
106
- throw err;
107
- }
108
- }
109
- }
110
- } finally {
111
- iterativeEvalStack = null;
112
- }
113
- }
114
- function _updateLevel(e) {
115
- let maxDepLevel = 0;
116
- for (let i = 0; i < e.deps.length; i++) {
117
- const owner = subSetOwner.get(e.deps[i]);
118
- const depLevel = owner ? owner._level : 0;
119
- if (depLevel > maxDepLevel) maxDepLevel = depLevel;
120
- }
121
- e._level = maxDepLevel + 1;
122
- }
123
- export function effect(fn, opts) {
124
- const e = _createEffect(fn);
125
- e._level = 1;
126
- const prev = currentEffect;
127
- currentEffect = e;
128
- try {
129
- const result = e.fn();
130
- if (typeof result === 'function') e._cleanup = result;
131
- } finally {
132
- currentEffect = prev;
133
- }
134
- _updateEffectLevel(e);
135
- if (opts?.stable) e._stable = true;
136
- const dispose = () => _disposeEffect(e);
137
- if (currentRoot) {
138
- currentRoot.disposals.push(dispose);
139
- }
140
- return dispose;
141
- }
142
- function _updateEffectLevel(e) {
143
- let maxDepLevel = 0;
144
- for (let i = 0; i < e.deps.length; i++) {
145
- const owner = subSetOwner.get(e.deps[i]);
146
- const depLevel = owner ? owner._level : 0;
147
- if (depLevel > maxDepLevel) maxDepLevel = depLevel;
148
- }
149
- e._level = maxDepLevel + 1;
150
- }
151
- export function batch(fn) {
152
- batchDepth++;
153
- try {
154
- fn();
155
- } finally {
156
- batchDepth--;
157
- if (batchDepth === 0) flush();
158
- }
159
- }
160
- function _createEffect(fn, lazy) {
161
- const e = {
162
- fn,
163
- deps: [],
164
- lazy: lazy || false,
165
- _onNotify: null,
166
- disposed: false,
167
- _pending: false,
168
- _stable: false,
169
- _level: 0,
170
- _computed: false,
171
- _computedSubs: null,
172
- _isDirty: null,
173
- _markDirty: null,
174
- };
175
- if (__DEV__ && __devtools) __devtools.onEffectCreate(e);
176
- return e;
177
- }
178
- function _runEffect(e) {
179
- if (e.disposed) return;
180
- if (e._stable) {
181
- if (e._cleanup) {
182
- try { e._cleanup(); } catch (err) {
183
- if (__DEV__) console.warn('[what] Error in effect cleanup:', err);
184
- }
185
- e._cleanup = null;
186
- }
187
- const prev = currentEffect;
188
- currentEffect = null;
189
- try {
190
- const result = e.fn();
191
- if (typeof result === 'function') e._cleanup = result;
192
- } catch (err) {
193
- if (__devtools?.onError) __devtools.onError(err, { type: 'effect', effect: e });
194
- if (__DEV__) console.warn('[what] Error in stable effect:', err);
195
- } finally {
196
- currentEffect = prev;
197
- }
198
- if (__DEV__ && __devtools?.onEffectRun) __devtools.onEffectRun(e);
199
- return;
200
- }
201
- cleanup(e);
202
- if (e._cleanup) {
203
- try { e._cleanup(); } catch (err) {
204
- if (__devtools?.onError) __devtools.onError(err, { type: 'effect-cleanup', effect: e });
205
- if (__DEV__) console.warn('[what] Error in effect cleanup:', err);
206
- }
207
- e._cleanup = null;
208
- }
209
- const prev = currentEffect;
210
- currentEffect = e;
211
- try {
212
- const result = e.fn();
213
- if (typeof result === 'function') {
214
- e._cleanup = result;
215
- }
216
- } catch (err) {
217
- if (err === NEEDS_UPSTREAM) throw err;
218
- if (__devtools?.onError) __devtools.onError(err, { type: 'effect', effect: e });
219
- throw err;
220
- } finally {
221
- currentEffect = prev;
222
- }
223
- if (__DEV__ && __devtools?.onEffectRun) __devtools.onEffectRun(e);
224
- }
225
- function _disposeEffect(e) {
226
- e.disposed = true;
227
- if (__DEV__ && __devtools) __devtools.onEffectDispose(e);
228
- cleanup(e);
229
- if (e._cleanup) {
230
- try { e._cleanup(); } catch (err) {
231
- if (__DEV__) console.warn('[what] Error in effect cleanup on dispose:', err);
232
- }
233
- e._cleanup = null;
234
- }
235
- }
236
- function cleanup(e) {
237
- const deps = e.deps;
238
- for (let i = 0; i < deps.length; i++) deps[i].delete(e);
239
- deps.length = 0;
240
- }
241
- let notifyQueue = null;
242
- function notify(subs) {
243
- const isOutermost = notifyQueue === null;
244
- if (isOutermost) notifyQueue = [];
245
- notifyQueue.push(subs);
246
- if (!isOutermost) return;
247
- try {
248
- while (notifyQueue.length > 0) {
249
- const currentSubs = notifyQueue.shift();
250
- for (const e of currentSubs) {
251
- if (e.disposed) continue;
252
- if (e._onNotify) {
253
- e._onNotify();
254
- } else if (batchDepth === 0 && e._stable) {
255
- const prev = currentEffect;
256
- currentEffect = null;
257
- try {
258
- const result = e.fn();
259
- if (typeof result === 'function') {
260
- if (e._cleanup) try { e._cleanup(); } catch (err) {}
261
- e._cleanup = result;
262
- }
263
- } catch (err) {
264
- if (__devtools?.onError) __devtools.onError(err, { type: 'effect', effect: e });
265
- if (__DEV__) console.warn('[what] Error in stable effect:', err);
266
- } finally {
267
- currentEffect = prev;
268
- }
269
- } else if (!e._pending) {
270
- e._pending = true;
271
- pendingEffects.push(e);
272
- }
273
- }
274
- }
275
- } finally {
276
- notifyQueue = null;
277
- }
278
- if (batchDepth === 0 && pendingEffects.length > 0) scheduleMicrotask();
279
- }
280
- let microtaskScheduled = false;
281
- function scheduleMicrotask() {
282
- if (!microtaskScheduled) {
283
- microtaskScheduled = true;
284
- queueMicrotask(() => {
285
- microtaskScheduled = false;
286
- flush();
287
- });
288
- }
289
- }
290
- function flush() {
291
- let iterations = 0;
292
- while (pendingEffects.length > 0 && iterations < 25) {
293
- const batch = pendingEffects;
294
- pendingEffects = [];
295
- batch.sort((a, b) => a._level - b._level);
296
- for (let i = 0; i < batch.length; i++) {
297
- const e = batch[i];
298
- e._pending = false;
299
- if (!e.disposed && !e._onNotify) {
300
- _runEffect(e);
301
- if (!e._computed) _updateEffectLevel(e);
302
- }
303
- }
304
- iterations++;
305
- }
306
- if (iterations >= 25) {
307
- if (__DEV__) {
308
- const remaining = pendingEffects.slice(0, 3);
309
- const effectNames = remaining.map(e => e.fn?.name || e.fn?.toString().slice(0, 60) || '(anonymous)');
310
- console.warn(
311
- `[what] Possible infinite effect loop detected (25 iterations). ` +
312
- `Likely cause: an effect writes to a signal it also reads, creating a cycle. ` +
313
- `Use untrack() to read signals without subscribing. ` +
314
- `Looping effects: ${effectNames.join(', ')}`
315
- );
316
- } else {
317
- console.warn('[what] Possible infinite effect loop detected');
318
- }
319
- for (let i = 0; i < pendingEffects.length; i++) pendingEffects[i]._pending = false;
320
- pendingEffects.length = 0;
321
- }
322
- }
323
- export function memo(fn) {
324
- let value;
325
- const subs = new Set();
326
- const e = _createEffect(() => {
327
- const next = fn();
328
- if (!Object.is(value, next)) {
329
- value = next;
330
- notify(subs);
331
- }
332
- });
333
- e._level = 1;
334
- _runEffect(e);
335
- _updateEffectLevel(e);
336
- subSetOwner.set(subs, e);
337
- if (currentRoot) {
338
- currentRoot.disposals.push(() => _disposeEffect(e));
339
- }
340
- function read() {
341
- if (currentEffect) {
342
- subs.add(currentEffect);
343
- currentEffect.deps.push(subs);
344
- }
345
- return value;
346
- }
347
- read._signal = true;
348
- read.peek = () => value;
349
- return read;
350
- }
351
- export function flushSync() {
352
- microtaskScheduled = false;
353
- flush();
354
- }
355
- export function untrack(fn) {
356
- const prev = currentEffect;
357
- currentEffect = null;
358
- try {
359
- return fn();
360
- } finally {
361
- currentEffect = prev;
362
- }
363
- }
364
- export function getOwner() {
365
- return currentOwner;
366
- }
367
- export function runWithOwner(owner, fn) {
368
- const prev = currentOwner;
369
- const prevRoot = currentRoot;
370
- currentOwner = owner;
371
- currentRoot = owner;
372
- try {
373
- return fn();
374
- } finally {
375
- currentOwner = prev;
376
- currentRoot = prevRoot;
377
- }
378
- }
379
- export function createRoot(fn) {
380
- const prevRoot = currentRoot;
381
- const prevOwner = currentOwner;
382
- const root = {
383
- disposals: [],
384
- owner: currentOwner,
385
- children: [],
386
- _disposed: false,
387
- };
388
- if (currentOwner) {
389
- currentOwner.children.push(root);
390
- }
391
- currentRoot = root;
392
- currentOwner = root;
393
- try {
394
- const dispose = () => {
395
- if (root._disposed) return;
396
- root._disposed = true;
397
- for (let i = root.children.length - 1; i >= 0; i--) {
398
- _disposeRoot(root.children[i]);
399
- }
400
- root.children.length = 0;
401
- for (let i = root.disposals.length - 1; i >= 0; i--) {
402
- root.disposals[i]();
403
- }
404
- root.disposals.length = 0;
405
- if (root.owner) {
406
- const idx = root.owner.children.indexOf(root);
407
- if (idx >= 0) root.owner.children.splice(idx, 1);
408
- }
409
- };
410
- return fn(dispose);
411
- } finally {
412
- currentRoot = prevRoot;
413
- currentOwner = prevOwner;
414
- }
415
- }
416
- function _disposeRoot(root) {
417
- if (root._disposed) return;
418
- root._disposed = true;
419
- for (let i = root.children.length - 1; i >= 0; i--) {
420
- _disposeRoot(root.children[i]);
421
- }
422
- root.children.length = 0;
423
- for (let i = root.disposals.length - 1; i >= 0; i--) {
424
- root.disposals[i]();
425
- }
426
- root.disposals.length = 0;
427
- }
428
- export function onCleanup(fn) {
429
- if (currentRoot) {
430
- currentRoot.disposals.push(fn);
431
- }
432
- }
package/dist/render.js DELETED
@@ -1,53 +0,0 @@
1
- import {
2
- _$createComponent,
3
- _$templateImpl,
4
- _setTextInsertHook,
5
- classList,
6
- delegateEvents,
7
- hydrate,
8
- insert,
9
- isHydrating,
10
- mapArray,
11
- on,
12
- setAttr,
13
- setChecked,
14
- setClass,
15
- setProp,
16
- setStyle,
17
- setValue,
18
- spread,
19
- svgTemplate,
20
- template
21
- } from "./chunk-H3GA34JK.js";
22
- import {
23
- effect,
24
- memo,
25
- untrack
26
- } from "./chunk-GZRA4IAJ.js";
27
- import "./chunk-AZP2EOGX.js";
28
- export {
29
- _$createComponent,
30
- _$templateImpl as _$template,
31
- _setTextInsertHook,
32
- template as _template,
33
- classList,
34
- delegateEvents,
35
- effect,
36
- hydrate,
37
- insert,
38
- isHydrating,
39
- mapArray,
40
- memo,
41
- on,
42
- setAttr,
43
- setChecked,
44
- setClass,
45
- setProp,
46
- setStyle,
47
- setValue,
48
- spread,
49
- svgTemplate,
50
- template,
51
- untrack
52
- };
53
- //# sourceMappingURL=render.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }