what-core 0.14.0 → 0.15.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 (145) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -38
  3. package/a11y.d.ts +128 -0
  4. package/data.d.ts +294 -0
  5. package/dist/a11y.js +510 -0
  6. package/dist/a11y.min.js +413 -0
  7. package/dist/actions.js +158 -0
  8. package/dist/actions.min.js +112 -0
  9. package/dist/animation.js +481 -0
  10. package/dist/animation.min.js +295 -0
  11. package/dist/async.js +180 -0
  12. package/dist/async.min.js +134 -0
  13. package/dist/components.js +577 -0
  14. package/dist/components.min.js +413 -0
  15. package/dist/data.js +1212 -0
  16. package/dist/data.min.js +918 -0
  17. package/dist/diagnostics.js +187 -0
  18. package/dist/diagnostics.min.js +134 -0
  19. package/dist/dom.js +796 -0
  20. package/dist/dom.min.js +603 -0
  21. package/dist/entries/a11y.js +43 -0
  22. package/dist/entries/a11y.min.js +43 -0
  23. package/dist/entries/data.js +29 -0
  24. package/dist/entries/data.min.js +29 -0
  25. package/dist/entries/dom.js +45 -0
  26. package/dist/entries/dom.min.js +45 -0
  27. package/dist/entries/form.js +31 -0
  28. package/dist/entries/form.min.js +31 -0
  29. package/dist/entries/internal.js +123 -0
  30. package/dist/entries/internal.min.js +123 -0
  31. package/dist/entries/motion.js +23 -0
  32. package/dist/entries/motion.min.js +23 -0
  33. package/dist/entries/ui.js +25 -0
  34. package/dist/entries/ui.min.js +25 -0
  35. package/dist/env.js +5 -0
  36. package/dist/env.min.js +5 -0
  37. package/dist/errors.js +1518 -0
  38. package/dist/errors.min.js +548 -0
  39. package/dist/form.js +936 -0
  40. package/dist/form.min.js +703 -0
  41. package/dist/guardrails.js +84 -0
  42. package/dist/guardrails.min.js +55 -0
  43. package/dist/h.js +232 -0
  44. package/dist/h.min.js +171 -0
  45. package/dist/head.js +241 -0
  46. package/dist/head.min.js +207 -0
  47. package/dist/helpers.js +126 -0
  48. package/dist/helpers.min.js +98 -0
  49. package/dist/hooks.js +255 -0
  50. package/dist/hooks.min.js +153 -0
  51. package/dist/hot.js +215 -0
  52. package/dist/hot.min.js +24 -0
  53. package/dist/hydration-data.js +495 -0
  54. package/dist/hydration-data.min.js +371 -0
  55. package/dist/import-changes.js +273 -0
  56. package/dist/import-changes.min.js +272 -0
  57. package/dist/index.js +95 -0
  58. package/dist/index.min.js +95 -227
  59. package/dist/jsx-dev-runtime.js +10 -0
  60. package/dist/jsx-dev-runtime.min.js +10 -1
  61. package/dist/jsx-runtime.js +27 -0
  62. package/dist/jsx-runtime.min.js +15 -1
  63. package/dist/live.js +54 -0
  64. package/dist/live.min.js +49 -0
  65. package/dist/markup-rules.js +250 -0
  66. package/dist/markup-rules.min.js +213 -0
  67. package/dist/reactive.js +3334 -0
  68. package/dist/reactive.min.js +2033 -0
  69. package/dist/render.js +4746 -0
  70. package/dist/render.min.js +2797 -1
  71. package/dist/scheduler.js +225 -0
  72. package/dist/scheduler.min.js +162 -0
  73. package/dist/selector.js +11 -0
  74. package/dist/selector.min.js +10 -0
  75. package/dist/server-context.js +148 -0
  76. package/dist/server-context.min.js +121 -0
  77. package/dist/skeleton.js +342 -0
  78. package/dist/skeleton.min.js +310 -0
  79. package/dist/store.js +72 -0
  80. package/dist/store.min.js +50 -0
  81. package/dist/testing.js +720 -0
  82. package/dist/testing.min.js +458 -1
  83. package/dist/vnode-adoption.js +19 -0
  84. package/dist/vnode-adoption.min.js +19 -0
  85. package/dist/vnode-renderer.js +61 -0
  86. package/dist/vnode-renderer.min.js +47 -0
  87. package/dom.d.ts +44 -0
  88. package/form.d.ts +218 -0
  89. package/hot.d.ts +35 -0
  90. package/index.d.ts +421 -736
  91. package/internal.d.ts +284 -0
  92. package/jsx-runtime.d.ts +160 -137
  93. package/markup-rules.d.ts +83 -0
  94. package/motion.d.ts +156 -0
  95. package/package.json +117 -3
  96. package/render.d.ts +278 -29
  97. package/src/a11y.js +64 -59
  98. package/src/actions.js +226 -0
  99. package/src/animation.js +105 -57
  100. package/src/async.js +259 -0
  101. package/src/components.js +495 -144
  102. package/src/data.js +1410 -1159
  103. package/src/diagnostics.js +263 -0
  104. package/src/dom.js +1159 -872
  105. package/src/entries/a11y.js +24 -0
  106. package/src/entries/data.js +17 -0
  107. package/src/entries/dom.js +29 -0
  108. package/src/entries/form.js +16 -0
  109. package/src/entries/internal.js +63 -0
  110. package/src/entries/motion.js +13 -0
  111. package/src/entries/ui.js +13 -0
  112. package/src/env-development.js +12 -0
  113. package/src/env.js +33 -0
  114. package/src/errors.js +1144 -168
  115. package/src/form.js +723 -225
  116. package/src/guardrails.js +38 -126
  117. package/src/h.js +227 -152
  118. package/src/head.js +189 -19
  119. package/src/helpers.js +47 -75
  120. package/src/hooks.js +233 -248
  121. package/src/hot.js +316 -0
  122. package/src/hydration-data.js +859 -16
  123. package/src/import-changes.js +156 -0
  124. package/src/index.js +38 -188
  125. package/src/jsx-dev-runtime.js +7 -14
  126. package/src/jsx-runtime.js +25 -9
  127. package/src/live.js +80 -0
  128. package/src/markup-rules.js +387 -0
  129. package/src/reactive.js +4400 -862
  130. package/src/render.js +6502 -2570
  131. package/src/scheduler.js +56 -21
  132. package/src/selector.js +31 -0
  133. package/src/server-context.js +252 -22
  134. package/src/skeleton.js +22 -12
  135. package/src/store.js +17 -31
  136. package/src/testing.js +389 -63
  137. package/src/vnode-adoption.js +48 -0
  138. package/src/vnode-renderer.js +114 -0
  139. package/testing.d.ts +81 -1
  140. package/ui.d.ts +20 -0
  141. package/dist/chunk-6YOUZ6T4.min.js +0 -1
  142. package/dist/chunk-FN6HXME3.min.js +0 -11
  143. package/dist/chunk-VKZY7JPN.min.js +0 -1
  144. package/src/agent-context.js +0 -127
  145. package/src/warnings.js +0 -193
package/src/warnings.js DELETED
@@ -1,193 +0,0 @@
1
- // What Framework - Dev-mode Warning System
2
- // Helpful, not noisy: each unique warning fires only once.
3
- // All warnings are dev-only and tree-shaken in production builds.
4
- //
5
- // STATUS: warn() and the fire-once bookkeeping work. NONE of the five
6
- // warnXxx() helpers below has a caller anywhere in the framework, and this
7
- // module is not re-exported from index.js, so nothing outside its own unit
8
- // test has ever imported it. Verified 2026-08 by grepping every package for
9
- // each helper name: the only hits are the definitions here and
10
- // packages/core/test/warnings.test.js, which calls them directly.
11
- //
12
- // That matters because docs-site/llms-full.txt advertises several of these as
13
- // conditions "the runtime detects and reports in dev mode". It does not. What
14
- // each one would actually need, written down so the next reader does not have
15
- // to re-derive it (same reasoning as the removed-guardrail note in
16
- // guardrails.js):
17
- //
18
- // warnMissingSignalRead Redundant. The condition IS reported, by
19
- // installSignalReadGuardrail() in guardrails.js,
20
- // which raises ERR_MISSING_SIGNAL_READ off the
21
- // signal's toString/valueOf. Prefer that path.
22
- //
23
- // warnSignalWriteDuringRender Needs two hooks in files this module cannot
24
- // reach: a render-phase flag set around the
25
- // `Component(reactiveProps)` call in dom.js
26
- // createComponent(), and a read of that flag in
27
- // _sigWrite() in reactive.js. Both are required:
28
- // the write site alone cannot tell a render from
29
- // a handler, and the render site alone never sees
30
- // the write. A signal function cannot be patched
31
- // from outside to catch this either — sig(v)
32
- // calls the _sigWrite closure directly, not the
33
- // replaceable sig.set property. NOTE the false
34
- // positive to avoid when wiring it: components
35
- // run ONCE, so a handler merely DEFINED in a
36
- // component body is not a write during render.
37
- // Only a write that executes synchronously
38
- // inside the body counts, which is exactly what
39
- // a render-phase flag measures.
40
- //
41
- // warnEffectWithoutCleanup Would have to observe addEventListener calls
42
- // made during an effect's run and correlate them
43
- // with the effect's return value. Nothing tracks
44
- // that today.
45
- //
46
- // warnLargeListWithoutKeys The condition is already reported, at BUILD
47
- // time, by the babel plugin (search
48
- // ERR_MISSING_KEY in
49
- // packages/compiler/src/babel-plugin.js).
50
- // Key-ness is settled by the source, so the
51
- // compiler sees it and the runtime does not need
52
- // to.
53
- //
54
- // warnUnusedSignal Needs a read-count on every signal plus a
55
- // disposal hook to check it at. reactive.js
56
- // tracks neither.
57
- //
58
- // ERR_ORPHAN_EFFECT, also advertised in llms-full.txt, has no helper here on
59
- // purpose: it is not detectable. See the note at the bottom of this file.
60
-
61
- import { __DEV__ } from './reactive.js';
62
-
63
- // Track which warnings have already been emitted (fire-once per unique key)
64
- const _emitted = new Set();
65
-
66
- /**
67
- * Emit a dev-mode warning. Fires only once per unique key.
68
- * @param {string} key - Unique identifier for de-duplication
69
- * @param {string} message - Warning message
70
- */
71
- export function warn(key, message) {
72
- if (!__DEV__) return;
73
- if (_emitted.has(key)) return;
74
- _emitted.add(key);
75
- console.warn(message);
76
- }
77
-
78
- /**
79
- * Reset all emitted warnings (for testing).
80
- */
81
- export function _resetWarnings() {
82
- _emitted.clear();
83
- }
84
-
85
- /**
86
- * Check if a warning has been emitted (for testing).
87
- * @param {string} key
88
- * @returns {boolean}
89
- */
90
- export function _wasWarned(key) {
91
- return _emitted.has(key);
92
- }
93
-
94
- // --- Warning functions ---
95
-
96
- /**
97
- * Warn when a signal is used in JSX without being called.
98
- * Detects: {count} instead of {count()} where count is a signal function.
99
- * @param {string} signalName - The signal's debug name
100
- * @param {string} [componentName] - The component where it occurred
101
- */
102
- export function warnMissingSignalRead(signalName, componentName) {
103
- if (!__DEV__) return;
104
- const ctx = componentName ? ` in <${componentName}>` : '';
105
- warn(
106
- `missing-read:${signalName}:${componentName || ''}`,
107
- `[what] Warning: Signal '${signalName}' used without being called${ctx}. Did you mean {${signalName}()}?`
108
- );
109
- }
110
-
111
- /**
112
- * Warn when a signal is written during render (component function execution).
113
- * Writes should happen in effects or event handlers, not during render.
114
- * @param {string} signalName - The signal's debug name
115
- * @param {string} [componentName] - The component where it occurred
116
- */
117
- export function warnSignalWriteDuringRender(signalName, componentName) {
118
- if (!__DEV__) return;
119
- const ctx = componentName ? ` of <${componentName}>` : '';
120
- warn(
121
- `write-during-render:${signalName}:${componentName || ''}`,
122
- `[what] Warning: Signal '${signalName}' written during render${ctx}. Move to effect or event handler.`
123
- );
124
- }
125
-
126
- /**
127
- * Warn when an effect adds an event listener but has no cleanup return.
128
- * @param {string} [componentName] - The component where it occurred
129
- */
130
- export function warnEffectWithoutCleanup(componentName) {
131
- if (!__DEV__) return;
132
- const ctx = componentName ? ` in <${componentName}>` : '';
133
- warn(
134
- `effect-no-cleanup:${componentName || 'unknown'}`,
135
- `[what] Warning: Effect${ctx} adds event listener but has no cleanup. Return a cleanup function from the effect to avoid memory leaks.`
136
- );
137
- }
138
-
139
- /**
140
- * Warn when rendering a large list without keys.
141
- * @param {number} count - Number of items in the list
142
- * @param {string} [componentName] - The component where it occurred
143
- */
144
- export function warnLargeListWithoutKeys(count, componentName) {
145
- if (!__DEV__) return;
146
- const ctx = componentName ? ` in <${componentName}>` : '';
147
- warn(
148
- `no-keys:${componentName || 'unknown'}`,
149
- `[what] Warning: Rendering ${count} items without keys${ctx}. Add key props for efficient DOM updates.`
150
- );
151
- }
152
-
153
- /**
154
- * Warn when a signal is created but never read.
155
- * Called lazily (e.g., on component unmount or root dispose).
156
- * @param {string} signalName - The signal's debug name
157
- * @param {string} [componentName] - The component where it occurred
158
- */
159
- export function warnUnusedSignal(signalName, componentName) {
160
- if (!__DEV__) return;
161
- const ctx = componentName ? ` in <${componentName}>` : '';
162
- warn(
163
- `unused-signal:${signalName}:${componentName || ''}`,
164
- `[what] Warning: Signal '${signalName}' created${ctx} but never read.`
165
- );
166
- }
167
-
168
- // --- Why there is no warnOrphanEffect() ---
169
- //
170
- // ERROR_CODES.ORPHAN_EFFECT ("created outside a reactive root — it will never
171
- // be cleaned up") has no detectable condition in What, so no helper for it is
172
- // added here. The only signal available at effect() creation time is whether
173
- // there is a current owner, and getOwner() returns null in every ordinary
174
- // place an effect is written. Measured against this build:
175
- //
176
- // module scope ........ null onMount() callback ... null
177
- // component body ...... null event handler ....... null
178
- // inside createRoot() .. owner
179
- //
180
- // So the check would fire on effects created in a component body, which is
181
- // the very thing the error's own suggestion text tells the user to do
182
- // instead. Firing on the recommended fix is the worst possible outcome for a
183
- // warning, and there is no second signal to narrow it with: What has no
184
- // component-level owner for an effect to attach to. Detecting this would mean
185
- // giving components an owner scope first, which is a reactivity change, not a
186
- // warning.
187
- //
188
- // (Related, and separately worth someone's attention: because a component
189
- // body has no owner, a bare effect() created in one is not registered for
190
- // disposal at all. Unmounting the component leaves it subscribed and re-running
191
- // — reproducible by mounting a component that calls effect(), unmounting it,
192
- // then writing the signal it reads and watching the run count climb. Fixing
193
- // that lives in dom.js/reactive.js, not here.)