sygnal 5.4.0 → 6.0.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 (316) hide show
  1. package/CHANGELOG.md +646 -0
  2. package/README.md +24 -9
  3. package/dist/astro/client.cjs.js +16 -9
  4. package/dist/astro/client.cjs.js.map +1 -1
  5. package/dist/astro/client.mjs +16 -9
  6. package/dist/astro/client.mjs.map +1 -1
  7. package/dist/astro/index.cjs.js +362 -91
  8. package/dist/astro/index.cjs.js.map +1 -1
  9. package/dist/astro/index.mjs +362 -92
  10. package/dist/astro/index.mjs.map +1 -1
  11. package/dist/astro/server.cjs.js +3396 -165
  12. package/dist/astro/server.cjs.js.map +1 -1
  13. package/dist/astro/server.mjs +3396 -165
  14. package/dist/astro/server.mjs.map +1 -1
  15. package/dist/devtools.cjs.js +1431 -0
  16. package/dist/devtools.cjs.js.map +1 -0
  17. package/dist/devtools.esm.js +1419 -0
  18. package/dist/devtools.esm.js.map +1 -0
  19. package/dist/diagnostics.cjs.js +3032 -296
  20. package/dist/diagnostics.cjs.js.map +1 -1
  21. package/dist/diagnostics.esm.js +3032 -296
  22. package/dist/diagnostics.esm.js.map +1 -1
  23. package/dist/element.cjs.js +230 -0
  24. package/dist/element.cjs.js.map +1 -0
  25. package/dist/element.esm.js +228 -0
  26. package/dist/element.esm.js.map +1 -0
  27. package/dist/guide/accessibility.md +257 -0
  28. package/dist/guide/adapters.md +221 -0
  29. package/dist/guide/behaviors.md +312 -0
  30. package/dist/guide/browser-sources.md +203 -0
  31. package/dist/guide/drag-and-drop.md +342 -0
  32. package/dist/guide/element-commands.md +306 -0
  33. package/dist/guide/error-boundaries.md +169 -0
  34. package/dist/guide/forms-reference.md +381 -0
  35. package/dist/guide/forms.md +250 -0
  36. package/dist/guide/http.md +299 -0
  37. package/dist/guide/inputs.md +173 -0
  38. package/dist/guide/persistence.md +245 -0
  39. package/dist/guide/recipes/carousel.md +155 -0
  40. package/dist/guide/recipes/charts.md +177 -0
  41. package/dist/guide/recipes/code-editor.md +135 -0
  42. package/dist/guide/recipes/data-grid.md +155 -0
  43. package/dist/guide/recipes/data-table.md +196 -0
  44. package/dist/guide/recipes/i18n.md +222 -0
  45. package/dist/guide/recipes/icons.md +115 -0
  46. package/dist/guide/recipes/overview.md +33 -0
  47. package/dist/guide/recipes/rich-text.md +154 -0
  48. package/dist/guide/resources.md +471 -0
  49. package/dist/guide/ssr.md +255 -0
  50. package/dist/guide/timers.md +178 -0
  51. package/dist/guide/ui/accordion.md +93 -0
  52. package/dist/guide/ui/combobox.md +144 -0
  53. package/dist/guide/ui/dialog.md +124 -0
  54. package/dist/guide/ui/disclosure.md +60 -0
  55. package/dist/guide/ui/menu.md +125 -0
  56. package/dist/guide/ui/overview.md +166 -0
  57. package/dist/guide/ui/popover.md +101 -0
  58. package/dist/guide/ui/select.md +114 -0
  59. package/dist/guide/ui/tabs.md +161 -0
  60. package/dist/guide/ui/toaster.md +152 -0
  61. package/dist/guide/ui/tooltip.md +103 -0
  62. package/dist/guide/undo.md +178 -0
  63. package/dist/guide/virtual-collections.md +183 -0
  64. package/dist/guide/web-components.md +179 -0
  65. package/dist/guide/widgets.md +217 -0
  66. package/dist/index.cjs.js +13178 -5769
  67. package/dist/index.cjs.js.map +1 -1
  68. package/dist/index.d.ts +2908 -276
  69. package/dist/index.esm.js +13149 -5779
  70. package/dist/index.esm.js.map +1 -1
  71. package/dist/jsx-dev-runtime.cjs.js +26 -334
  72. package/dist/jsx-dev-runtime.cjs.js.map +1 -1
  73. package/dist/jsx-dev-runtime.esm.js +19 -327
  74. package/dist/jsx-dev-runtime.esm.js.map +1 -1
  75. package/dist/jsx-runtime.cjs.js +26 -334
  76. package/dist/jsx-runtime.cjs.js.map +1 -1
  77. package/dist/jsx-runtime.esm.js +19 -327
  78. package/dist/jsx-runtime.esm.js.map +1 -1
  79. package/dist/jsx.cjs.js +10 -314
  80. package/dist/jsx.cjs.js.map +1 -1
  81. package/dist/jsx.esm.js +8 -315
  82. package/dist/jsx.esm.js.map +1 -1
  83. package/dist/react.cjs.js +117 -0
  84. package/dist/react.cjs.js.map +1 -0
  85. package/dist/react.esm.js +115 -0
  86. package/dist/react.esm.js.map +1 -0
  87. package/dist/shims/globalthis.cjs +20 -0
  88. package/dist/sygnal.min.js +1 -1
  89. package/dist/sygnal.min.js.map +1 -1
  90. package/dist/ui-combobox.cjs.js +169 -0
  91. package/dist/ui-combobox.cjs.js.map +1 -0
  92. package/dist/ui-combobox.esm.js +148 -0
  93. package/dist/ui-combobox.esm.js.map +1 -0
  94. package/dist/ui-menu.cjs.js +87 -0
  95. package/dist/ui-menu.cjs.js.map +1 -0
  96. package/dist/ui-menu.esm.js +66 -0
  97. package/dist/ui-menu.esm.js.map +1 -0
  98. package/dist/ui-select.cjs.js +104 -0
  99. package/dist/ui-select.cjs.js.map +1 -0
  100. package/dist/ui-select.esm.js +83 -0
  101. package/dist/ui-select.esm.js.map +1 -0
  102. package/dist/ui.cjs.js +738 -0
  103. package/dist/ui.cjs.js.map +1 -0
  104. package/dist/ui.esm.js +727 -0
  105. package/dist/ui.esm.js.map +1 -0
  106. package/dist/vike/ClientOnly.cjs.js +4 -14
  107. package/dist/vike/ClientOnly.cjs.js.map +1 -1
  108. package/dist/vike/ClientOnly.mjs +4 -14
  109. package/dist/vike/ClientOnly.mjs.map +1 -1
  110. package/dist/vike/{+config.js → config/+config.js} +9 -1
  111. package/dist/vike/config/+config.js.map +1 -0
  112. package/dist/vike/config/package.json +6 -0
  113. package/dist/vike/onRenderClient.cjs.js +165 -95
  114. package/dist/vike/onRenderClient.cjs.js.map +1 -1
  115. package/dist/vike/onRenderClient.mjs +165 -95
  116. package/dist/vike/onRenderClient.mjs.map +1 -1
  117. package/dist/vike/onRenderHtml.cjs.js +59 -24
  118. package/dist/vike/onRenderHtml.cjs.js.map +1 -1
  119. package/dist/vike/onRenderHtml.mjs +60 -25
  120. package/dist/vike/onRenderHtml.mjs.map +1 -1
  121. package/dist/vite/plugin.cjs.js +323 -88
  122. package/dist/vite/plugin.cjs.js.map +1 -1
  123. package/dist/vite/plugin.mjs +323 -89
  124. package/dist/vite/plugin.mjs.map +1 -1
  125. package/dist/zag.cjs.js +408 -0
  126. package/dist/zag.cjs.js.map +1 -0
  127. package/dist/zag.esm.js +405 -0
  128. package/dist/zag.esm.js.map +1 -0
  129. package/llms.txt +166 -103
  130. package/package.json +98 -14
  131. package/src/astro/client.ts +27 -16
  132. package/src/astro/index.d.ts +24 -0
  133. package/src/astro/index.ts +69 -3
  134. package/src/astro/server.ts +8 -2
  135. package/src/collection.ts +6 -93
  136. package/src/core/actions.ts +134 -0
  137. package/src/core/cell.ts +202 -0
  138. package/src/core/debug.ts +23 -0
  139. package/src/core/define.ts +242 -0
  140. package/src/core/hooks.ts +314 -0
  141. package/src/core/hosts/collection.ts +325 -0
  142. package/src/core/hosts/switchable.ts +146 -0
  143. package/src/core/instance.ts +592 -0
  144. package/src/core/markers/clientonly.ts +13 -0
  145. package/src/core/markers/lazy.ts +40 -0
  146. package/src/core/markers/portal.ts +96 -0
  147. package/src/core/markers/suspense.ts +41 -0
  148. package/src/core/markers/transition.ts +70 -0
  149. package/src/core/registry.ts +25 -0
  150. package/src/core/runtime.ts +573 -0
  151. package/src/core/statics.ts +104 -0
  152. package/src/core/teardown.ts +60 -0
  153. package/src/core/view.ts +37 -0
  154. package/src/cycle/dom/DocumentDOMSource.ts +13 -8
  155. package/src/cycle/dom/ElementFinder.ts +7 -9
  156. package/src/cycle/dom/EventDelegator.ts +174 -223
  157. package/src/cycle/dom/IsolateModule.ts +65 -35
  158. package/src/cycle/dom/MainDOMSource.ts +9 -2
  159. package/src/cycle/dom/PriorityQueue.ts +4 -2
  160. package/src/cycle/dom/SymbolTree.ts +18 -47
  161. package/src/cycle/dom/classNameModule.ts +9 -7
  162. package/src/cycle/dom/controlledInputModule.ts +23 -6
  163. package/src/cycle/dom/enrichEventStream.ts +25 -47
  164. package/src/cycle/dom/fragment.ts +7 -0
  165. package/src/cycle/dom/isolate.ts +30 -27
  166. package/src/cycle/dom/makeDOMDriver.ts +115 -56
  167. package/src/cycle/dom/mockDOMSource.ts +21 -1
  168. package/src/cycle/dom/modules.ts +16 -3
  169. package/src/cycle/dom/propsModule.ts +65 -0
  170. package/src/cycle/dom/selectModule.ts +22 -17
  171. package/src/cycle/dom/snabbdom.ts +1 -6
  172. package/src/cycle/dom/thunk.ts +3 -0
  173. package/src/cycle/dom/utils.ts +98 -0
  174. package/src/cycle/dom/viewTransition.ts +43 -0
  175. package/src/cycle/state/StateSource.ts +19 -3
  176. package/src/cycle/state/objIsEqual.ts +50 -0
  177. package/src/cycle/state/types.ts +0 -10
  178. package/src/defineComponent.ts +34 -0
  179. package/src/devtools.d.ts +151 -0
  180. package/src/devtools.ts +34 -0
  181. package/src/element.d.ts +59 -0
  182. package/src/element.ts +235 -0
  183. package/src/extra/backoff.ts +9 -0
  184. package/src/extra/behaviors.ts +169 -0
  185. package/src/extra/browserSignals.ts +23 -0
  186. package/src/extra/browserSources.ts +326 -0
  187. package/src/extra/command.ts +3 -3
  188. package/src/extra/controls.ts +47 -0
  189. package/src/extra/copyAsTest.ts +286 -0
  190. package/src/extra/devtools.ts +101 -31
  191. package/src/extra/devtoolsActions.ts +379 -0
  192. package/src/extra/devtoolsHook.ts +9 -0
  193. package/src/extra/devtoolsNext.ts +83 -0
  194. package/src/extra/diagnostics/checks/actionLog.ts +108 -0
  195. package/src/extra/diagnostics/checks/behaviors.ts +49 -0
  196. package/src/extra/diagnostics/checks/browserSources.ts +96 -0
  197. package/src/extra/diagnostics/checks/collections.ts +1 -1
  198. package/src/extra/diagnostics/checks/controls.ts +148 -0
  199. package/src/extra/diagnostics/checks/dataset.ts +57 -0
  200. package/src/extra/diagnostics/checks/dom.ts +20 -11
  201. package/src/extra/diagnostics/checks/elementCommands.ts +175 -0
  202. package/src/extra/diagnostics/checks/events.ts +17 -2
  203. package/src/extra/diagnostics/checks/fetch.ts +135 -0
  204. package/src/extra/diagnostics/checks/forms.ts +163 -0
  205. package/src/extra/diagnostics/checks/index.ts +97 -4
  206. package/src/extra/diagnostics/checks/inspect.ts +140 -32
  207. package/src/extra/diagnostics/checks/next.ts +417 -0
  208. package/src/extra/diagnostics/checks/persist.ts +54 -0
  209. package/src/extra/diagnostics/checks/props.ts +10 -5
  210. package/src/extra/diagnostics/checks/public.d.ts +98 -7
  211. package/src/extra/diagnostics/checks/replies.ts +128 -0
  212. package/src/extra/diagnostics/checks/router.ts +100 -0
  213. package/src/extra/diagnostics/checks/rxjsHints.ts +1 -1
  214. package/src/extra/diagnostics/checks/shared.ts +86 -2
  215. package/src/extra/diagnostics/checks/shorthand.ts +115 -0
  216. package/src/extra/diagnostics/checks/sortable.ts +129 -0
  217. package/src/extra/diagnostics/checks/state.ts +100 -7
  218. package/src/extra/diagnostics/checks/statics.ts +48 -0
  219. package/src/extra/diagnostics/checks/strict.ts +10 -67
  220. package/src/extra/diagnostics/checks/timers.ts +80 -0
  221. package/src/extra/diagnostics/checks/viewTransitions.ts +47 -0
  222. package/src/extra/diagnostics/checks/virtual.ts +73 -0
  223. package/src/extra/diagnostics/checks/widgets.ts +109 -0
  224. package/src/extra/diagnostics/checks/wiring.ts +66 -10
  225. package/src/extra/diagnostics/codes.ts +268 -23
  226. package/src/extra/diagnostics/index.ts +34 -9
  227. package/src/extra/diagnostics/legacy.ts +17 -0
  228. package/src/extra/driverFactories.ts +83 -19
  229. package/src/extra/elementCommands.ts +53 -0
  230. package/src/extra/fetchDriver.ts +519 -0
  231. package/src/extra/focusWithin.ts +27 -0
  232. package/src/extra/form.ts +268 -0
  233. package/src/extra/formHelpers.ts +139 -0
  234. package/src/extra/head.ts +106 -0
  235. package/src/extra/hmr.ts +2 -3
  236. package/src/extra/owned.ts +24 -0
  237. package/src/extra/pager.ts +50 -0
  238. package/src/extra/persist.ts +133 -0
  239. package/src/extra/pwa.ts +1 -1
  240. package/src/extra/queryCache.ts +107 -0
  241. package/src/extra/reducers.ts +1 -1
  242. package/src/extra/reduxDevtools.ts +92 -0
  243. package/src/extra/replies.ts +54 -0
  244. package/src/extra/router.ts +323 -0
  245. package/src/extra/run.ts +90 -217
  246. package/src/extra/selection.ts +76 -0
  247. package/src/extra/socketDriver.ts +265 -0
  248. package/src/extra/sortable.ts +377 -0
  249. package/src/extra/ssr.ts +427 -160
  250. package/src/extra/standardSchema.ts +27 -0
  251. package/src/extra/testing.ts +2433 -175
  252. package/src/extra/timers.ts +95 -0
  253. package/src/extra/undo.ts +261 -0
  254. package/src/extra/viewTransitions.ts +38 -0
  255. package/src/extra/virtual.ts +513 -0
  256. package/src/extra/widget.ts +201 -0
  257. package/src/index.d.ts +2631 -117
  258. package/src/index.ts +25 -4
  259. package/src/jsx-runtime.ts +15 -1
  260. package/src/jsx.ts +2 -1
  261. package/src/lazy.ts +50 -7
  262. package/src/portal.ts +3 -1
  263. package/src/pragma/index.ts +256 -133
  264. package/src/react-peers.d.ts +5 -0
  265. package/src/react.d.ts +43 -0
  266. package/src/react.ts +110 -0
  267. package/src/shared.ts +48 -0
  268. package/src/slot.ts +1 -1
  269. package/src/suspense.ts +3 -1
  270. package/src/switchable.ts +6 -121
  271. package/src/transition.ts +3 -1
  272. package/src/ui/accordion.ts +64 -0
  273. package/src/ui/dialog.ts +129 -0
  274. package/src/ui/disclosure.ts +35 -0
  275. package/src/ui/popover.ts +45 -0
  276. package/src/ui/shared.ts +94 -0
  277. package/src/ui/tabs.ts +82 -0
  278. package/src/ui/toaster.ts +198 -0
  279. package/src/ui/tooltip.ts +70 -0
  280. package/src/ui/zag/combobox.ts +115 -0
  281. package/src/ui/zag/menu.ts +40 -0
  282. package/src/ui/zag/select.ts +54 -0
  283. package/src/ui/zag/shared.ts +43 -0
  284. package/src/ui-combobox.d.ts +20 -0
  285. package/src/ui-combobox.ts +6 -0
  286. package/src/ui-menu.d.ts +30 -0
  287. package/src/ui-menu.ts +6 -0
  288. package/src/ui-select.d.ts +17 -0
  289. package/src/ui-select.ts +6 -0
  290. package/src/ui-zag-types.d.ts +42 -0
  291. package/src/ui.d.ts +208 -0
  292. package/src/ui.ts +15 -0
  293. package/src/vike/+config.ts +9 -1
  294. package/src/vike/ClientOnly.ts +1 -1
  295. package/src/vike/onRenderClient.ts +144 -96
  296. package/src/vike/onRenderHtml.ts +69 -26
  297. package/src/vike/types.ts +7 -1
  298. package/src/vite/globalthis-shim.ts +18 -0
  299. package/src/vite/globalthis.ts +56 -0
  300. package/src/vite/plugin.d.ts +22 -3
  301. package/src/vite/plugin.ts +222 -24
  302. package/src/zag.d.ts +64 -0
  303. package/src/zag.ts +238 -0
  304. package/dist/vike/+config.cjs.js +0 -66
  305. package/dist/vike/+config.cjs.js.map +0 -1
  306. package/dist/vike/+config.js.map +0 -1
  307. package/src/component.ts +0 -2301
  308. package/src/cycle/isolate/index.ts +0 -196
  309. package/src/cycle/run/index.ts +0 -151
  310. package/src/cycle/run/internals.ts +0 -143
  311. package/src/cycle/state/Collection.ts +0 -184
  312. package/src/cycle/state/index.ts +0 -5
  313. package/src/cycle/state/pickCombine.ts +0 -201
  314. package/src/cycle/state/pickMerge.ts +0 -122
  315. package/src/cycle/state/withState.ts +0 -47
  316. package/src/pragma/fn.ts +0 -55
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sygnal",
3
- "version": "5.4.0",
3
+ "version": "6.0.0",
4
4
  "description": "An intuitive framework for building fast and small components or applications based on Cycle.js",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "types": "./dist/index.d.ts",
@@ -31,6 +31,47 @@
31
31
  "import": "./dist/diagnostics.esm.js",
32
32
  "require": "./dist/diagnostics.cjs.js"
33
33
  },
34
+ "./devtools": {
35
+ "types": "./src/devtools.d.ts",
36
+ "import": "./dist/devtools.esm.js",
37
+ "require": "./dist/devtools.cjs.js"
38
+ },
39
+ "./element": {
40
+ "types": "./src/element.d.ts",
41
+ "import": "./dist/element.esm.js",
42
+ "require": "./dist/element.cjs.js"
43
+ },
44
+ "./ui": {
45
+ "types": "./src/ui.d.ts",
46
+ "import": "./dist/ui.esm.js",
47
+ "require": "./dist/ui.cjs.js"
48
+ },
49
+ "./ui/menu": {
50
+ "types": "./src/ui-menu.d.ts",
51
+ "import": "./dist/ui-menu.esm.js",
52
+ "require": "./dist/ui-menu.cjs.js"
53
+ },
54
+ "./ui/select": {
55
+ "types": "./src/ui-select.d.ts",
56
+ "import": "./dist/ui-select.esm.js",
57
+ "require": "./dist/ui-select.cjs.js"
58
+ },
59
+ "./ui/combobox": {
60
+ "types": "./src/ui-combobox.d.ts",
61
+ "import": "./dist/ui-combobox.esm.js",
62
+ "require": "./dist/ui-combobox.cjs.js"
63
+ },
64
+ "./zag": {
65
+ "types": "./src/zag.d.ts",
66
+ "import": "./dist/zag.esm.js",
67
+ "require": "./dist/zag.cjs.js"
68
+ },
69
+ "./react": {
70
+ "types": "./src/react.d.ts",
71
+ "import": "./dist/react.esm.js",
72
+ "require": "./dist/react.cjs.js"
73
+ },
74
+ "./shims/globalthis": "./dist/shims/globalthis.cjs",
34
75
  "./vite": {
35
76
  "types": "./src/vite/plugin.d.ts",
36
77
  "import": "./dist/vite/plugin.mjs",
@@ -53,18 +94,15 @@
53
94
  },
54
95
  "./vike": {
55
96
  "types": "./src/vike/types.ts",
56
- "import": "./dist/vike/+config.js",
57
- "require": "./dist/vike/+config.cjs.js"
97
+ "default": "./dist/vike/config/+config.js"
58
98
  },
59
99
  "./vike/config": {
60
100
  "types": "./src/vike/types.ts",
61
- "import": "./dist/vike/+config.js",
62
- "require": "./dist/vike/+config.cjs.js"
101
+ "default": "./dist/vike/config/+config.js"
63
102
  },
64
103
  "./config": {
65
104
  "types": "./src/vike/types.ts",
66
- "import": "./dist/vike/+config.js",
67
- "require": "./dist/vike/+config.cjs.js"
105
+ "default": "./dist/vike/config/+config.js"
68
106
  },
69
107
  "./vike/onRenderHtml": {
70
108
  "import": "./dist/vike/onRenderHtml.mjs",
@@ -86,15 +124,19 @@
86
124
  "files": [
87
125
  "dist",
88
126
  "src",
89
- "llms.txt"
127
+ "llms.txt",
128
+ "CHANGELOG.md"
90
129
  ],
91
130
  "scripts": {
92
- "test": "vitest run && npm run test:examples && npm run test:types && npm run test:browser",
131
+ "test": "vitest run && npm run test:examples && npm run test:types && npm run test:browser && npm run test:perf-gate",
132
+ "test:perf-gate": "node scripts/perf-gate.mjs",
93
133
  "test:examples": "node scripts/test-examples.mjs",
94
- "test:types": "npx tsc --project type-tests/tsconfig.json 2>&1 | grep '^type-tests/' && exit 1 || exit 0",
134
+ "test:recipes": "node scripts/test-recipes.mjs",
135
+ "test:types": "npx tsc --project tsconfig.json --noEmit && npx tsc --project type-tests/tsconfig.json",
95
136
  "test:browser": "npm test --prefix browser-tests",
96
137
  "test:watch": "vitest",
97
- "build": "npx rollup -c && npx rollup -c rollup.config.dts.mjs",
138
+ "clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
139
+ "build": "npm run clean && npx rollup -c && npx rollup -c rollup.config.dts.mjs && node scripts/copy-guides.mjs",
98
140
  "build:types": "npx rollup -c rollup.config.dts.mjs",
99
141
  "build:all": "npm run build",
100
142
  "build:devtools": "node devtools/build.mjs",
@@ -106,7 +148,7 @@
106
148
  "url": "git+https://github.com/tpresley/sygnal.git"
107
149
  },
108
150
  "engines": {
109
- "node": ">=12.0.0"
151
+ "node": "^20.19.0 || >=22.12.0"
110
152
  },
111
153
  "keywords": [
112
154
  "cycle",
@@ -122,20 +164,62 @@
122
164
  },
123
165
  "homepage": "https://github.com/tpresley/sygnal#readme",
124
166
  "dependencies": {
125
- "extend": "^3.0.2",
167
+ "@tanstack/virtual-core": "^3.17.11",
126
168
  "snabbdom": "^3.6.3",
127
169
  "xstream": "^11.14.0"
128
170
  },
171
+ "peerDependencies": {
172
+ "@zag-js/combobox": "~1.45.0",
173
+ "@zag-js/menu": "~1.45.0",
174
+ "@zag-js/select": "~1.45.0",
175
+ "@zag-js/vanilla": "~1.45.0",
176
+ "react": ">=18.0.0",
177
+ "react-dom": ">=18.0.0"
178
+ },
179
+ "peerDependenciesMeta": {
180
+ "@zag-js/combobox": {
181
+ "optional": true
182
+ },
183
+ "@zag-js/menu": {
184
+ "optional": true
185
+ },
186
+ "@zag-js/select": {
187
+ "optional": true
188
+ },
189
+ "@zag-js/vanilla": {
190
+ "optional": true
191
+ },
192
+ "react": {
193
+ "optional": true
194
+ },
195
+ "react-dom": {
196
+ "optional": true
197
+ }
198
+ },
129
199
  "devDependencies": {
130
200
  "@rollup/plugin-commonjs": "^25.0.4",
131
201
  "@rollup/plugin-node-resolve": "^15.2.1",
132
202
  "@rollup/plugin-terser": "^0.4.3",
133
203
  "@rollup/plugin-typescript": "^11.1.6",
204
+ "@zag-js/combobox": "1.45.0",
205
+ "@zag-js/dialog": "1.45.0",
206
+ "@zag-js/menu": "1.45.0",
207
+ "@zag-js/select": "1.45.0",
208
+ "@zag-js/vanilla": "1.45.0",
209
+ "flatpickr": "4.6.13",
134
210
  "jsdom": "^29.1.1",
211
+ "preact": "11.0.0",
212
+ "react": "19.3.0",
213
+ "react-dom": "19.3.0",
135
214
  "rollup": "^3.28.1",
136
215
  "rollup-plugin-dts": "^6.1.1",
137
216
  "tslib": "^2.6.2",
138
217
  "typescript": "^5.4.5",
139
- "vitest": "^4.0.18"
218
+ "valibot": "^1.5.0",
219
+ "vitest": "^4.0.18",
220
+ "zod": "^4.6.5"
221
+ },
222
+ "overrides": {
223
+ "vite": "^7.3.6"
140
224
  }
141
225
  }
@@ -1,21 +1,26 @@
1
1
  // The public entry (external in the build), so islands share the app's
2
2
  // Sygnal core instead of a bundled copy (B-019).
3
3
  import { run } from 'sygnal'
4
+ // PLAN-4 GS-11 / D120: the app-level error hook, the default export of the module the
5
+ // integration's `onError` option names (undefined without it); served by sygnal/astro's Vite plugin
6
+ // @ts-ignore — a virtual module
7
+ import onError from 'virtual:sygnal/astro-on-error'
4
8
 
5
9
  interface SygnalComponent {
6
10
  (args: any): any;
7
- isSygnalComponent?: boolean;
8
11
  model?: any;
9
12
  intent?: any;
10
- hmrActions?: any;
13
+ connections?: any;
14
+ resources?: any;
15
+ route?: any;
16
+ head?: any;
17
+ persist?: any;
18
+ uses?: any;
19
+ timers?: any;
20
+ viewTransitions?: any;
11
21
  context?: any;
12
- peers?: any;
13
- components?: any;
14
22
  initialState?: any;
15
23
  calculated?: any;
16
- storeCalculatedInState?: any;
17
- DOMSourceName?: string;
18
- stateSourceName?: string;
19
24
  onError?: (error: Error, info: { componentName: string }) => any;
20
25
  debug?: boolean;
21
26
  componentName?: string;
@@ -29,8 +34,7 @@ interface AstroMetadata {
29
34
  function looksLikeSygnalComponent(Component: any): Component is SygnalComponent {
30
35
  if (typeof Component !== 'function') return false
31
36
  return Boolean(
32
- Component.isSygnalComponent ||
33
- Component.model ||
37
+ Component.model ||
34
38
  Component.intent ||
35
39
  Component.initialState ||
36
40
  Component.componentName
@@ -61,23 +65,30 @@ export default (element: any) => {
61
65
  const Wrapped: any = (args: any) => Component({ ...islandProps, ...args, props: islandProps })
62
66
  Wrapped.model = Component.model
63
67
  Wrapped.intent = Component.intent
64
- Wrapped.hmrActions = Component.hmrActions
65
68
  Wrapped.context = Component.context
66
- Wrapped.peers = Component.peers
67
- Wrapped.components = Component.components
68
69
  Wrapped.initialState = Component.initialState
69
70
  Wrapped.calculated = Component.calculated
70
- Wrapped.storeCalculatedInState = Component.storeCalculatedInState
71
- Wrapped.DOMSourceName = Component.DOMSourceName
72
- Wrapped.stateSourceName = Component.stateSourceName
73
71
  Wrapped.onError = Component.onError
74
72
  Wrapped.debug = Component.debug
73
+ Wrapped.connections = Component.connections
74
+ Wrapped.resources = Component.resources
75
+ Wrapped.route = Component.route
76
+ Wrapped.head = Component.head
77
+ // PLAN-4 3-B2: more statics the core reads off the root view: persist (root only: the island
78
+ // is its app's root), uses, timers (they run only with a timer driver) and viewTransitions
79
+ Wrapped.persist = Component.persist
80
+ Wrapped.uses = Component.uses
81
+ Wrapped.timers = Component.timers
82
+ Wrapped.viewTransitions = Component.viewTransitions
75
83
  Wrapped.componentName = Component.componentName || Component.name
76
84
  // run() names the root by `name` first: diagnostics and devtools should
77
85
  // say 'Counter', not 'Wrapped'
78
86
  try { Object.defineProperty(Wrapped, 'name', { value: Wrapped.componentName, configurable: true }) } catch (_) {}
79
87
 
80
- const app = run(Wrapped, {}, { mountPoint })
88
+ // G-206: a `uid` island prop is the island's uid root (as on the server); the view's own
89
+ // uid() function wins over the prop (args are spread last)
90
+ // 3-B2: `__hydrate` tells persist() whether the island starts over the server's markup
91
+ const app = run(Wrapped, { __hydrate: () => client !== 'only' && canHydrate }, { mountPoint, onError, uid: islandProps.uid })
81
92
  element.__sygnal = app
82
93
  }
83
94
  }
@@ -12,6 +12,7 @@ declare type SygnalAstroIntegration = {
12
12
  updateConfig: (config: any) => void;
13
13
  command?: 'dev' | 'build' | 'preview' | 'sync';
14
14
  logger?: { warn: (message: string) => void };
15
+ config?: { root?: URL | string; vite?: any };
15
16
  }) => void;
16
17
  };
17
18
  };
@@ -29,6 +30,29 @@ export interface SygnalAstroOptions {
29
30
  * @default true
30
31
  */
31
32
  check?: boolean | CheckPluginOptions;
33
+ /**
34
+ * Resolve xstream's `globalthis` dependency to a stub returning the native
35
+ * `globalThis` (see the sygnal/vite `nativeGlobalThis` option), in
36
+ * `astro dev` and `astro build`. false: keep the polyfill package.
37
+ * @default true
38
+ */
39
+ nativeGlobalThis?: boolean;
40
+ /**
41
+ * Install the DevTools bridge for islands in `astro dev` (see the sygnal/vite
42
+ * `devtools` option). Never in `astro build`.
43
+ * @default true
44
+ */
45
+ devtools?: boolean;
46
+ /**
47
+ * The islands' app-level error hook (PLAN-4 GS-11): the path of a module, relative to the
48
+ * Astro project root, whose default export is called as run()'s and renderToString's
49
+ * `onError`, in the browser and during SSR. Reporting only, after a component's onError
50
+ * boundary chose the fallback.
51
+ * @example sygnal({ onError: './src/onError.js' })
52
+ * // src/onError.js
53
+ * export default (error, { componentName, action, phase }) => report(error)
54
+ */
55
+ onError?: string;
32
56
  }
33
57
 
34
58
  /**
@@ -1,8 +1,38 @@
1
1
  import sygnalVite from '../vite/plugin'
2
+ import { globalThisAlias } from '../vite/globalthis'
2
3
  import type { DiagnosticsMode, DiagnosticsPluginOptions, CheckPluginOptions } from '../vite/plugin'
4
+ // Node built-ins (the integration runs in Node). The package has no @types/node.
5
+ // @ts-ignore
6
+ import path from 'node:path'
7
+ // @ts-ignore
8
+ import { fileURLToPath } from 'node:url'
3
9
 
4
10
  const SYGNAL_RENDERER_NAME = '@sygnal/astro'
5
11
 
12
+ // PLAN-4 GS-11 / D120: both island entries import this; it re-exports the default export of the
13
+ // module the `onError` option names (undefined without it)
14
+ const ON_ERROR_ID = 'virtual:sygnal/astro-on-error'
15
+
16
+ /** The Vite plugin serving ON_ERROR_ID; `file` is absolute (undefined: no hook) */
17
+ function onErrorPlugin(file?: string) {
18
+ return {
19
+ name: 'sygnal:astro-on-error',
20
+ resolveId: (id: string) => id === ON_ERROR_ID ? '\0' + ON_ERROR_ID : undefined,
21
+ load: (id: string) => id === '\0' + ON_ERROR_ID
22
+ ? (file ? `export { default } from ${JSON.stringify(file)}` : 'export default undefined')
23
+ : undefined,
24
+ // Vite 6+ (Astro 6 renders in its own 'prerender' / 'ssr' environments): the island server
25
+ // entry imports the virtual module, so Vite must load it (not Node). `ssr.noExternal`
26
+ // below covers the 'ssr' environment and older Vite
27
+ configEnvironment: (name: string) => name === 'client' ? undefined : { resolve: { noExternal: ['sygnal'] } },
28
+ }
29
+ }
30
+
31
+ /** The project root as a directory path (Astro gives a file: URL) */
32
+ const rootDir = (root: any): string =>
33
+ // @ts-ignore — Node's process
34
+ !root ? process.cwd() : typeof root === 'string' ? root : fileURLToPath(root)
35
+
6
36
  interface AstroRenderer {
7
37
  name: string;
8
38
  clientEntrypoint: string;
@@ -14,6 +44,7 @@ interface AstroConfigSetupArgs {
14
44
  updateConfig: (config: any) => void;
15
45
  command?: 'dev' | 'build' | 'preview' | 'sync';
16
46
  logger?: { warn: (message: string) => void };
47
+ config?: { root?: URL | string; vite?: { resolve?: { alias?: any } } };
17
48
  }
18
49
 
19
50
  export interface SygnalAstroOptions {
@@ -26,13 +57,34 @@ export interface SygnalAstroOptions {
26
57
  diagnostics?: DiagnosticsMode | DiagnosticsPluginOptions;
27
58
  /** Run sygnal-check in `astro dev` (see the sygnal/vite `check` option). @default true */
28
59
  check?: boolean | CheckPluginOptions;
60
+ /**
61
+ * Resolve xstream's `globalthis` dependency to a stub returning the native
62
+ * `globalThis` (see the sygnal/vite `nativeGlobalThis` option), in
63
+ * `astro dev` and `astro build`. false: keep the polyfill package.
64
+ * @default true
65
+ */
66
+ nativeGlobalThis?: boolean;
67
+ /**
68
+ * Install the DevTools bridge for islands in `astro dev` (see the sygnal/vite
69
+ * `devtools` option). Never in `astro build`.
70
+ * @default true
71
+ */
72
+ devtools?: boolean;
73
+ /**
74
+ * PLAN-4 GS-11: the islands' app-level error hook: the path of a module (relative to the Astro
75
+ * project root) whose default export is called as run()'s / renderToString's `onError`
76
+ * (error, { componentName, action, phase }), in the browser and during SSR. Reporting only,
77
+ * after a component's onError boundary chose the fallback.
78
+ * @example sygnal({ onError: './src/onError.js' })
79
+ */
80
+ onError?: string;
29
81
  }
30
82
 
31
83
  export default function sygnalAstroIntegration(options: SygnalAstroOptions = {}) {
32
84
  return {
33
85
  name: SYGNAL_RENDERER_NAME,
34
86
  hooks: {
35
- 'astro:config:setup': ({ addRenderer, updateConfig, command }: AstroConfigSetupArgs) => {
87
+ 'astro:config:setup': ({ addRenderer, updateConfig, command, config }: AstroConfigSetupArgs) => {
36
88
  addRenderer({
37
89
  name: SYGNAL_RENDERER_NAME,
38
90
  clientEntrypoint: 'sygnal/astro/client',
@@ -44,12 +96,17 @@ export default function sygnalAstroIntegration(options: SygnalAstroOptions = {})
44
96
  jsx: 'automatic',
45
97
  jsxImportSource: 'sygnal',
46
98
  },
99
+ // D120: the island entries import the virtual onError module, so they stay on Vite:
100
+ // not pre-bundled with it, and not externalized (loaded by Node) during SSR
101
+ optimizeDeps: { exclude: [ON_ERROR_ID] },
102
+ ssr: { noExternal: ['sygnal'] },
47
103
  }
104
+ const hook = options.onError ? path.resolve(rootDir(config?.root), options.onError) : undefined
48
105
 
49
106
  // Dev mode (G-014): islands are started by sygnal/astro/client, which
50
107
  // user code never imports, so the sygnal Vite plugin wraps that entry
51
- // in dev to set the dev flag and load the runtime checks first. It
52
- // also runs sygnal-check. Nothing is added to `astro build`.
108
+ // in dev to install DevTools, set the dev flag and load the runtime checks first. It
109
+ // also runs sygnal-check. `astro build` only gets the `globalthis` alias.
53
110
  if (command === 'dev') {
54
111
  vite.plugins = [sygnalVite({
55
112
  disableJsx: true,
@@ -57,9 +114,18 @@ export default function sygnalAstroIntegration(options: SygnalAstroOptions = {})
57
114
  vitestSetup: false,
58
115
  diagnostics: options.diagnostics,
59
116
  check: options.check,
117
+ nativeGlobalThis: options.nativeGlobalThis,
118
+ devtools: options.devtools,
60
119
  })]
120
+ } else if (options.nativeGlobalThis !== false) {
121
+ // G-099: the same `globalthis` alias the plugin adds in dev (R2-7: unless the
122
+ // user's vite config already aliases `globalthis`)
123
+ const alias = globalThisAlias(config?.vite?.resolve?.alias)
124
+ if (alias.length) vite.resolve = { alias }
61
125
  }
62
126
 
127
+ vite.plugins = [...(vite.plugins || []), onErrorPlugin(hook)]
128
+
63
129
  updateConfig({ vite })
64
130
  },
65
131
  },
@@ -1,10 +1,12 @@
1
1
  import {renderToString} from '../extra/ssr'
2
+ // PLAN-4 GS-11 / D120: the integration's `onError` module (see client.ts)
3
+ // @ts-ignore — a virtual module
4
+ import onError from 'virtual:sygnal/astro-on-error'
2
5
 
3
6
  function looksLikeSygnalComponent(Component: any): boolean {
4
7
  if (typeof Component !== 'function') return false
5
8
  return Boolean(
6
- Component.isSygnalComponent ||
7
- Component.model ||
9
+ Component.model ||
8
10
  Component.intent ||
9
11
  Component.initialState ||
10
12
  Component.componentName
@@ -27,6 +29,10 @@ export function renderToStaticMarkup(
27
29
  const html = renderToString(Component, {
28
30
  state: props.initialState || Component.initialState,
29
31
  props: {...props, props},
32
+ // PLAN-4 GS-11: the app-level error hook (as the client's run() gets)
33
+ onError,
34
+ // G-206: a `uid` island prop is its uid root (as on the client), for two islands on a page
35
+ uid: props.uid,
30
36
  })
31
37
  return {html, attrs: {}}
32
38
  } catch (err: any) {
package/src/collection.ts CHANGED
@@ -1,101 +1,14 @@
1
- import isolate from './cycle/isolate/index';
2
- import {makeCollection} from './cycle/state/index';
3
- import {h} from './cycle/dom/index';
4
- import type {Lens} from './cycle/state/types';
5
- import {fail} from './extra/diagnostics/legacy';
6
-
7
- let COLLECTION_COUNT = 0;
8
-
9
- interface CollectionOptions {
10
- combineList?: string[];
11
- globalList?: string[];
12
- stateSourceName?: string;
13
- domSourceName?: string;
14
- container?: string;
15
- containerClass?: string;
16
- }
17
-
18
- export default function collection(
19
- component: (...args: any[]) => any,
20
- stateLense: string | Lens<any, any>,
21
- opts: CollectionOptions = {}
22
- ): (sources: any) => any {
23
- if (typeof component !== 'function') {
24
- fail('SYG411', 'collection', 'first argument (component) must be a function', 'Pass a component function');
25
- }
26
- const {
27
- combineList = ['DOM'],
28
- globalList = ['EVENTS'],
29
- stateSourceName = 'STATE',
30
- domSourceName = 'DOM',
31
- container = 'div',
32
- containerClass,
33
- } = opts;
34
-
35
- return (sources: any) => {
36
- const key = `sygnal-collection-${COLLECTION_COUNT++}`;
37
- const collectionOpts = {
38
- item: component,
39
- itemKey: (state: any, ind: number) =>
40
- typeof state.id !== 'undefined' ? state.id : ind,
41
- // B-009: prefix with the collection instance so two Collections in one parent whose
42
- // items share ids get different DOM isolation scopes
43
- itemScope: (itemKey: any) => `${key}-${itemKey}`,
44
- channel: stateSourceName,
45
- collectSinks: (instances: any) => {
46
- return Object.entries(sources).reduce<Record<string, any>>(
47
- (acc, [name]) => {
48
- if (combineList.includes(name)) {
49
- const combined = instances.pickCombine(name);
50
- if (name === domSourceName && container) {
51
- acc[domSourceName] = combined.map((children: any) => {
52
- const data = containerClass
53
- ? {props: {className: containerClass}}
54
- : {};
55
- return {
56
- sel: container,
57
- data,
58
- children,
59
- key,
60
- text: undefined,
61
- elm: undefined,
62
- };
63
- });
64
- } else {
65
- acc[name] = combined;
66
- }
67
- } else {
68
- acc[name] = instances.pickMerge(name);
69
- }
70
- return acc;
71
- },
72
- {}
73
- );
74
- },
75
- };
76
-
77
- const isolateOpts: Record<string, any> = {[stateSourceName]: stateLense};
78
-
79
- globalList.forEach((global) => (isolateOpts[global] = null));
80
- combineList.forEach((combine) => (isolateOpts[combine] = null));
81
-
82
- return makeIsolatedCollection(collectionOpts, isolateOpts, sources);
83
- };
84
- }
85
-
86
- function makeIsolatedCollection(
87
- collectionOpts: any,
88
- isolateOpts: any,
89
- sources: any
90
- ): any {
91
- return isolate(makeCollection(collectionOpts), isolateOpts)(sources);
92
- }
1
+ import {h} from './cycle/dom/snabbdom';
2
+ // the core's handler for this marker, registered on import (D157)
3
+ import './core/hosts/collection';
93
4
 
5
+ /** `<Collection of={Item} from="items" />`: a marker vnode the core's Collection host renders */
94
6
  const Collection = (props: any) => {
95
7
  const {children, ...sanitizedProps} = props;
96
8
  return h('collection', {props: sanitizedProps}, children);
97
9
  };
98
- (Collection as any).label = 'collection';
10
+ (Collection as any).componentName = 'collection';
99
11
  (Collection as any).preventInstantiation = true;
100
12
 
101
13
  export {Collection};
14
+ export default Collection;