sygnal 5.3.7 → 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.
- package/CHANGELOG.md +646 -0
- package/README.md +77 -47
- package/dist/astro/client.cjs.js +33 -8114
- package/dist/astro/client.cjs.js.map +1 -0
- package/dist/astro/client.mjs +33 -8114
- package/dist/astro/client.mjs.map +1 -0
- package/dist/astro/index.cjs.js +1039 -9
- package/dist/astro/index.cjs.js.map +1 -0
- package/dist/astro/index.mjs +1038 -9
- package/dist/astro/index.mjs.map +1 -0
- package/dist/astro/server.cjs.js +3400 -166
- package/dist/astro/server.cjs.js.map +1 -0
- package/dist/astro/server.mjs +3400 -166
- package/dist/astro/server.mjs.map +1 -0
- package/dist/devtools.cjs.js +1431 -0
- package/dist/devtools.cjs.js.map +1 -0
- package/dist/devtools.esm.js +1419 -0
- package/dist/devtools.esm.js.map +1 -0
- package/dist/diagnostics.cjs.js +4033 -0
- package/dist/diagnostics.cjs.js.map +1 -0
- package/dist/diagnostics.esm.js +4003 -0
- package/dist/diagnostics.esm.js.map +1 -0
- package/dist/element.cjs.js +230 -0
- package/dist/element.cjs.js.map +1 -0
- package/dist/element.esm.js +228 -0
- package/dist/element.esm.js.map +1 -0
- package/dist/guide/accessibility.md +257 -0
- package/dist/guide/adapters.md +221 -0
- package/dist/guide/behaviors.md +312 -0
- package/dist/guide/browser-sources.md +203 -0
- package/dist/guide/drag-and-drop.md +342 -0
- package/dist/guide/element-commands.md +306 -0
- package/dist/guide/error-boundaries.md +169 -0
- package/dist/guide/forms-reference.md +381 -0
- package/dist/guide/forms.md +250 -0
- package/dist/guide/http.md +299 -0
- package/dist/guide/inputs.md +173 -0
- package/dist/guide/persistence.md +245 -0
- package/dist/guide/recipes/carousel.md +155 -0
- package/dist/guide/recipes/charts.md +177 -0
- package/dist/guide/recipes/code-editor.md +135 -0
- package/dist/guide/recipes/data-grid.md +155 -0
- package/dist/guide/recipes/data-table.md +196 -0
- package/dist/guide/recipes/i18n.md +222 -0
- package/dist/guide/recipes/icons.md +115 -0
- package/dist/guide/recipes/overview.md +33 -0
- package/dist/guide/recipes/rich-text.md +154 -0
- package/dist/guide/resources.md +471 -0
- package/dist/guide/ssr.md +255 -0
- package/dist/guide/timers.md +178 -0
- package/dist/guide/ui/accordion.md +93 -0
- package/dist/guide/ui/combobox.md +144 -0
- package/dist/guide/ui/dialog.md +124 -0
- package/dist/guide/ui/disclosure.md +60 -0
- package/dist/guide/ui/menu.md +125 -0
- package/dist/guide/ui/overview.md +166 -0
- package/dist/guide/ui/popover.md +101 -0
- package/dist/guide/ui/select.md +114 -0
- package/dist/guide/ui/tabs.md +161 -0
- package/dist/guide/ui/toaster.md +152 -0
- package/dist/guide/ui/tooltip.md +103 -0
- package/dist/guide/undo.md +178 -0
- package/dist/guide/virtual-collections.md +183 -0
- package/dist/guide/web-components.md +179 -0
- package/dist/guide/widgets.md +217 -0
- package/dist/index.cjs.js +15283 -6279
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +3739 -370
- package/dist/index.esm.js +15230 -6274
- package/dist/index.esm.js.map +1 -0
- package/dist/jsx-dev-runtime.cjs.js +27 -329
- package/dist/jsx-dev-runtime.cjs.js.map +1 -0
- package/dist/jsx-dev-runtime.esm.js +20 -322
- package/dist/jsx-dev-runtime.esm.js.map +1 -0
- package/dist/jsx-runtime.cjs.js +27 -329
- package/dist/jsx-runtime.cjs.js.map +1 -0
- package/dist/jsx-runtime.esm.js +20 -322
- package/dist/jsx-runtime.esm.js.map +1 -0
- package/dist/jsx.cjs.js +11 -309
- package/dist/jsx.cjs.js.map +1 -0
- package/dist/jsx.esm.js +9 -310
- package/dist/jsx.esm.js.map +1 -0
- package/dist/react.cjs.js +117 -0
- package/dist/react.cjs.js.map +1 -0
- package/dist/react.esm.js +115 -0
- package/dist/react.esm.js.map +1 -0
- package/dist/shims/globalthis.cjs +20 -0
- package/dist/sygnal.min.js +2 -1
- package/dist/sygnal.min.js.map +1 -0
- package/dist/ui-combobox.cjs.js +169 -0
- package/dist/ui-combobox.cjs.js.map +1 -0
- package/dist/ui-combobox.esm.js +148 -0
- package/dist/ui-combobox.esm.js.map +1 -0
- package/dist/ui-menu.cjs.js +87 -0
- package/dist/ui-menu.cjs.js.map +1 -0
- package/dist/ui-menu.esm.js +66 -0
- package/dist/ui-menu.esm.js.map +1 -0
- package/dist/ui-select.cjs.js +104 -0
- package/dist/ui-select.cjs.js.map +1 -0
- package/dist/ui-select.esm.js +83 -0
- package/dist/ui-select.esm.js.map +1 -0
- package/dist/ui.cjs.js +738 -0
- package/dist/ui.cjs.js.map +1 -0
- package/dist/ui.esm.js +727 -0
- package/dist/ui.esm.js.map +1 -0
- package/dist/vike/ClientOnly.cjs.js +5 -14
- package/dist/vike/ClientOnly.cjs.js.map +1 -0
- package/dist/vike/ClientOnly.mjs +5 -14
- package/dist/vike/ClientOnly.mjs.map +1 -0
- package/dist/vike/{+config.js → config/+config.js} +10 -1
- package/dist/vike/config/+config.js.map +1 -0
- package/dist/vike/config/package.json +6 -0
- package/dist/vike/onRenderClient.cjs.js +166 -95
- package/dist/vike/onRenderClient.cjs.js.map +1 -0
- package/dist/vike/onRenderClient.mjs +166 -95
- package/dist/vike/onRenderClient.mjs.map +1 -0
- package/dist/vike/onRenderHtml.cjs.js +60 -24
- package/dist/vike/onRenderHtml.cjs.js.map +1 -0
- package/dist/vike/onRenderHtml.mjs +61 -25
- package/dist/vike/onRenderHtml.mjs.map +1 -0
- package/dist/vite/plugin.cjs.js +926 -65
- package/dist/vite/plugin.cjs.js.map +1 -0
- package/dist/vite/plugin.mjs +925 -65
- package/dist/vite/plugin.mjs.map +1 -0
- package/dist/zag.cjs.js +408 -0
- package/dist/zag.cjs.js.map +1 -0
- package/dist/zag.esm.js +405 -0
- package/dist/zag.esm.js.map +1 -0
- package/llms.txt +313 -0
- package/package.json +109 -16
- package/src/astro/client.ts +40 -18
- package/src/astro/index.d.ts +48 -1
- package/src/astro/index.ts +106 -9
- package/src/astro/server.ts +11 -3
- package/src/collection.ts +6 -90
- package/src/core/actions.ts +134 -0
- package/src/core/cell.ts +202 -0
- package/src/core/debug.ts +23 -0
- package/src/core/define.ts +242 -0
- package/src/core/hooks.ts +314 -0
- package/src/core/hosts/collection.ts +325 -0
- package/src/core/hosts/switchable.ts +146 -0
- package/src/core/instance.ts +592 -0
- package/src/core/markers/clientonly.ts +13 -0
- package/src/core/markers/lazy.ts +40 -0
- package/src/core/markers/portal.ts +96 -0
- package/src/core/markers/suspense.ts +41 -0
- package/src/core/markers/transition.ts +70 -0
- package/src/core/registry.ts +25 -0
- package/src/core/runtime.ts +573 -0
- package/src/core/statics.ts +104 -0
- package/src/core/teardown.ts +60 -0
- package/src/core/view.ts +37 -0
- package/src/cycle/dom/DocumentDOMSource.ts +13 -8
- package/src/cycle/dom/ElementFinder.ts +7 -9
- package/src/cycle/dom/EventDelegator.ts +174 -223
- package/src/cycle/dom/IsolateModule.ts +65 -35
- package/src/cycle/dom/MainDOMSource.ts +13 -2
- package/src/cycle/dom/PriorityQueue.ts +4 -2
- package/src/cycle/dom/SymbolTree.ts +18 -47
- package/src/cycle/dom/classNameModule.ts +76 -0
- package/src/cycle/dom/controlledInputModule.ts +50 -0
- package/src/cycle/dom/enrichEventStream.ts +29 -45
- package/src/cycle/dom/fragment.ts +7 -0
- package/src/cycle/dom/isolate.ts +30 -27
- package/src/cycle/dom/makeDOMDriver.ts +115 -57
- package/src/cycle/dom/mockDOMSource.ts +83 -9
- package/src/cycle/dom/modules.ts +21 -4
- package/src/cycle/dom/propsModule.ts +65 -0
- package/src/cycle/dom/selectModule.ts +22 -17
- package/src/cycle/dom/snabbdom.ts +1 -6
- package/src/cycle/dom/thunk.ts +3 -0
- package/src/cycle/dom/utils.ts +98 -0
- package/src/cycle/dom/viewTransition.ts +43 -0
- package/src/cycle/state/StateSource.ts +20 -4
- package/src/cycle/state/objIsEqual.ts +50 -0
- package/src/cycle/state/types.ts +0 -10
- package/src/defineComponent.ts +34 -0
- package/src/devtools.d.ts +151 -0
- package/src/devtools.ts +34 -0
- package/src/element.d.ts +59 -0
- package/src/element.ts +235 -0
- package/src/extra/backoff.ts +9 -0
- package/src/extra/behaviors.ts +169 -0
- package/src/extra/browserSignals.ts +23 -0
- package/src/extra/browserSources.ts +326 -0
- package/src/extra/command.ts +3 -3
- package/src/extra/controls.ts +47 -0
- package/src/extra/copyAsTest.ts +286 -0
- package/src/extra/devtools.ts +109 -31
- package/src/extra/devtoolsActions.ts +379 -0
- package/src/extra/devtoolsHook.ts +9 -0
- package/src/extra/devtoolsNext.ts +83 -0
- package/src/extra/diagnostics/checks/actionLog.ts +108 -0
- package/src/extra/diagnostics/checks/behaviors.ts +49 -0
- package/src/extra/diagnostics/checks/browserSources.ts +96 -0
- package/src/extra/diagnostics/checks/collections.ts +67 -0
- package/src/extra/diagnostics/checks/controls.ts +148 -0
- package/src/extra/diagnostics/checks/dataset.ts +57 -0
- package/src/extra/diagnostics/checks/dom.ts +250 -0
- package/src/extra/diagnostics/checks/elementCommands.ts +175 -0
- package/src/extra/diagnostics/checks/events.ts +83 -0
- package/src/extra/diagnostics/checks/fetch.ts +135 -0
- package/src/extra/diagnostics/checks/forms.ts +163 -0
- package/src/extra/diagnostics/checks/index.ts +202 -0
- package/src/extra/diagnostics/checks/inspect.ts +427 -0
- package/src/extra/diagnostics/checks/next.ts +417 -0
- package/src/extra/diagnostics/checks/persist.ts +54 -0
- package/src/extra/diagnostics/checks/props.ts +56 -0
- package/src/extra/diagnostics/checks/public.d.ts +302 -0
- package/src/extra/diagnostics/checks/replies.ts +128 -0
- package/src/extra/diagnostics/checks/router.ts +100 -0
- package/src/extra/diagnostics/checks/rxjsHints.ts +88 -0
- package/src/extra/diagnostics/checks/shared.ts +203 -0
- package/src/extra/diagnostics/checks/shorthand.ts +115 -0
- package/src/extra/diagnostics/checks/sortable.ts +129 -0
- package/src/extra/diagnostics/checks/state.ts +148 -0
- package/src/extra/diagnostics/checks/statics.ts +48 -0
- package/src/extra/diagnostics/checks/strict.ts +55 -0
- package/src/extra/diagnostics/checks/timers.ts +80 -0
- package/src/extra/diagnostics/checks/viewTransitions.ts +47 -0
- package/src/extra/diagnostics/checks/virtual.ts +73 -0
- package/src/extra/diagnostics/checks/widgets.ts +109 -0
- package/src/extra/diagnostics/checks/wiring.ts +121 -0
- package/src/extra/diagnostics/codes.ts +477 -0
- package/src/extra/diagnostics/index.ts +353 -0
- package/src/extra/diagnostics/legacy.ts +76 -0
- package/src/extra/driverFactories.ts +172 -60
- package/src/extra/elementCommands.ts +53 -0
- package/src/extra/eventDriver.ts +4 -0
- package/src/extra/fetchDriver.ts +519 -0
- package/src/extra/flatten.ts +75 -0
- package/src/extra/focusWithin.ts +27 -0
- package/src/extra/form.ts +268 -0
- package/src/extra/formHelpers.ts +139 -0
- package/src/extra/head.ts +106 -0
- package/src/extra/hmr.ts +2 -3
- package/src/extra/owned.ts +24 -0
- package/src/extra/pager.ts +50 -0
- package/src/extra/persist.ts +133 -0
- package/src/extra/pwa.ts +1 -1
- package/src/extra/queryCache.ts +107 -0
- package/src/extra/reducers.ts +13 -6
- package/src/extra/reduxDevtools.ts +92 -0
- package/src/extra/replies.ts +54 -0
- package/src/extra/router.ts +323 -0
- package/src/extra/run.ts +94 -210
- package/src/extra/selection.ts +76 -0
- package/src/extra/socketDriver.ts +265 -0
- package/src/extra/sortable.ts +377 -0
- package/src/extra/ssr.ts +427 -160
- package/src/extra/standardSchema.ts +27 -0
- package/src/extra/testing.ts +3158 -190
- package/src/extra/timers.ts +95 -0
- package/src/extra/undo.ts +261 -0
- package/src/extra/viewTransitions.ts +38 -0
- package/src/extra/virtual.ts +513 -0
- package/src/extra/widget.ts +201 -0
- package/src/extra/xstreamExtras.ts +269 -0
- package/src/index.d.ts +3012 -87
- package/src/index.ts +32 -10
- package/src/jsx-runtime.ts +15 -1
- package/src/jsx.ts +2 -1
- package/src/lazy.ts +50 -7
- package/src/portal.ts +3 -1
- package/src/pragma/index.ts +262 -134
- package/src/react-peers.d.ts +5 -0
- package/src/react.d.ts +43 -0
- package/src/react.ts +110 -0
- package/src/shared.ts +48 -0
- package/src/slot.ts +1 -1
- package/src/suspense.ts +3 -1
- package/src/switchable.ts +6 -119
- package/src/transition.ts +3 -1
- package/src/ui/accordion.ts +64 -0
- package/src/ui/dialog.ts +129 -0
- package/src/ui/disclosure.ts +35 -0
- package/src/ui/popover.ts +45 -0
- package/src/ui/shared.ts +94 -0
- package/src/ui/tabs.ts +82 -0
- package/src/ui/toaster.ts +198 -0
- package/src/ui/tooltip.ts +70 -0
- package/src/ui/zag/combobox.ts +115 -0
- package/src/ui/zag/menu.ts +40 -0
- package/src/ui/zag/select.ts +54 -0
- package/src/ui/zag/shared.ts +43 -0
- package/src/ui-combobox.d.ts +20 -0
- package/src/ui-combobox.ts +6 -0
- package/src/ui-menu.d.ts +30 -0
- package/src/ui-menu.ts +6 -0
- package/src/ui-select.d.ts +17 -0
- package/src/ui-select.ts +6 -0
- package/src/ui-zag-types.d.ts +42 -0
- package/src/ui.d.ts +208 -0
- package/src/ui.ts +15 -0
- package/src/vike/+config.ts +9 -1
- package/src/vike/ClientOnly.ts +1 -1
- package/src/vike/onRenderClient.ts +144 -96
- package/src/vike/onRenderHtml.ts +69 -26
- package/src/vike/types.ts +27 -4
- package/src/vite/globalthis-shim.ts +18 -0
- package/src/vite/globalthis.ts +56 -0
- package/src/vite/plugin.d.ts +114 -2
- package/src/vite/plugin.ts +920 -56
- package/src/zag.d.ts +64 -0
- package/src/zag.ts +238 -0
- package/dist/astro/astro/client.d.ts +0 -5
- package/dist/astro/astro/index.d.ts +0 -16
- package/dist/astro/astro/server.d.ts +0 -12
- package/dist/astro/client.d.ts +0 -5
- package/dist/astro/client.esm.js +0 -4665
- package/dist/astro/collection.d.ts +0 -12
- package/dist/astro/component.d.ts +0 -22
- package/dist/astro/cycle/dom/BodyDOMSource.d.ts +0 -10
- package/dist/astro/cycle/dom/DOMSource.d.ts +0 -11
- package/dist/astro/cycle/dom/DocumentDOMSource.d.ts +0 -12
- package/dist/astro/cycle/dom/ElementFinder.d.ts +0 -8
- package/dist/astro/cycle/dom/EventDelegator.d.ts +0 -34
- package/dist/astro/cycle/dom/IsolateModule.d.ts +0 -23
- package/dist/astro/cycle/dom/MainDOMSource.d.ts +0 -32
- package/dist/astro/cycle/dom/PriorityQueue.d.ts +0 -7
- package/dist/astro/cycle/dom/ScopeChecker.d.ts +0 -9
- package/dist/astro/cycle/dom/SymbolTree.d.ts +0 -9
- package/dist/astro/cycle/dom/VNodeWrapper.d.ts +0 -8
- package/dist/astro/cycle/dom/enrichEventStream.d.ts +0 -24
- package/dist/astro/cycle/dom/fromEvent.d.ts +0 -6
- package/dist/astro/cycle/dom/index.d.ts +0 -8
- package/dist/astro/cycle/dom/isolate.d.ts +0 -9
- package/dist/astro/cycle/dom/makeDOMDriver.d.ts +0 -11
- package/dist/astro/cycle/dom/mockDOMSource.d.ts +0 -17
- package/dist/astro/cycle/dom/modules.d.ts +0 -5
- package/dist/astro/cycle/dom/snabbdom.d.ts +0 -22
- package/dist/astro/cycle/dom/styleModule.d.ts +0 -13
- package/dist/astro/cycle/dom/thunk.d.ts +0 -11
- package/dist/astro/cycle/dom/utils.d.ts +0 -8
- package/dist/astro/cycle/isolate/index.d.ts +0 -42
- package/dist/astro/cycle/run/adapt.d.ts +0 -6
- package/dist/astro/cycle/run/index.d.ts +0 -36
- package/dist/astro/cycle/run/internals.d.ts +0 -8
- package/dist/astro/cycle/run/types.d.ts +0 -49
- package/dist/astro/cycle/state/Collection.d.ts +0 -29
- package/dist/astro/cycle/state/StateSource.d.ts +0 -20
- package/dist/astro/cycle/state/index.d.ts +0 -5
- package/dist/astro/cycle/state/pickCombine.d.ts +0 -3
- package/dist/astro/cycle/state/pickMerge.d.ts +0 -3
- package/dist/astro/cycle/state/types.d.ts +0 -18
- package/dist/astro/cycle/state/withState.d.ts +0 -17
- package/dist/astro/extra/classes.d.ts +0 -7
- package/dist/astro/extra/devtools.d.ts +0 -78
- package/dist/astro/extra/dragDriver.d.ts +0 -20
- package/dist/astro/extra/driverFactories.d.ts +0 -12
- package/dist/astro/extra/eventDriver.d.ts +0 -9
- package/dist/astro/extra/exactState.d.ts +0 -1
- package/dist/astro/extra/hmr.d.ts +0 -17
- package/dist/astro/extra/logDriver.d.ts +0 -2
- package/dist/astro/extra/processDrag.d.ts +0 -19
- package/dist/astro/extra/processForm.d.ts +0 -15
- package/dist/astro/extra/run.d.ts +0 -13
- package/dist/astro/extra/xstreamCompat.d.ts +0 -5
- package/dist/astro/index.d.ts +0 -19
- package/dist/astro/index.esm.js +0 -27
- package/dist/astro/jsx-dev-runtime.d.ts +0 -1
- package/dist/astro/jsx-runtime.d.ts +0 -4
- package/dist/astro/jsx.d.ts +0 -2
- package/dist/astro/pragma/fn.d.ts +0 -7
- package/dist/astro/pragma/index.d.ts +0 -7
- package/dist/astro/pragma/is.d.ts +0 -10
- package/dist/astro/server.d.ts +0 -12
- package/dist/astro/server.esm.js +0 -25
- package/dist/astro/switchable.d.ts +0 -7
- package/dist/collection.d.ts +0 -12
- package/dist/component.d.ts +0 -22
- package/dist/cycle/dom/BodyDOMSource.d.ts +0 -10
- package/dist/cycle/dom/DOMSource.d.ts +0 -11
- package/dist/cycle/dom/DocumentDOMSource.d.ts +0 -12
- package/dist/cycle/dom/ElementFinder.d.ts +0 -8
- package/dist/cycle/dom/EventDelegator.d.ts +0 -34
- package/dist/cycle/dom/IsolateModule.d.ts +0 -23
- package/dist/cycle/dom/MainDOMSource.d.ts +0 -32
- package/dist/cycle/dom/PriorityQueue.d.ts +0 -7
- package/dist/cycle/dom/ScopeChecker.d.ts +0 -9
- package/dist/cycle/dom/SymbolTree.d.ts +0 -9
- package/dist/cycle/dom/VNodeWrapper.d.ts +0 -8
- package/dist/cycle/dom/enrichEventStream.d.ts +0 -24
- package/dist/cycle/dom/fromEvent.d.ts +0 -6
- package/dist/cycle/dom/index.d.ts +0 -8
- package/dist/cycle/dom/isolate.d.ts +0 -9
- package/dist/cycle/dom/makeDOMDriver.d.ts +0 -11
- package/dist/cycle/dom/mockDOMSource.d.ts +0 -17
- package/dist/cycle/dom/modules.d.ts +0 -5
- package/dist/cycle/dom/snabbdom.d.ts +0 -22
- package/dist/cycle/dom/styleModule.d.ts +0 -13
- package/dist/cycle/dom/thunk.d.ts +0 -11
- package/dist/cycle/dom/utils.d.ts +0 -8
- package/dist/cycle/isolate/index.d.ts +0 -42
- package/dist/cycle/run/adapt.d.ts +0 -6
- package/dist/cycle/run/index.d.ts +0 -36
- package/dist/cycle/run/internals.d.ts +0 -8
- package/dist/cycle/run/types.d.ts +0 -49
- package/dist/cycle/state/Collection.d.ts +0 -29
- package/dist/cycle/state/StateSource.d.ts +0 -20
- package/dist/cycle/state/index.d.ts +0 -5
- package/dist/cycle/state/pickCombine.d.ts +0 -3
- package/dist/cycle/state/pickMerge.d.ts +0 -3
- package/dist/cycle/state/types.d.ts +0 -18
- package/dist/cycle/state/withState.d.ts +0 -17
- package/dist/extra/classes.d.ts +0 -7
- package/dist/extra/devtools.d.ts +0 -78
- package/dist/extra/dragDriver.d.ts +0 -20
- package/dist/extra/driverFactories.d.ts +0 -12
- package/dist/extra/eventDriver.d.ts +0 -9
- package/dist/extra/exactState.d.ts +0 -1
- package/dist/extra/hmr.d.ts +0 -17
- package/dist/extra/logDriver.d.ts +0 -2
- package/dist/extra/processDrag.d.ts +0 -19
- package/dist/extra/processForm.d.ts +0 -15
- package/dist/extra/run.d.ts +0 -13
- package/dist/extra/xstreamCompat.d.ts +0 -5
- package/dist/jsx-dev-runtime.d.ts +0 -1
- package/dist/jsx-dev-runtime.js +0 -224
- package/dist/jsx-runtime.d.ts +0 -4
- package/dist/jsx-runtime.js +0 -224
- package/dist/jsx.d.ts +0 -2
- package/dist/pragma/fn.d.ts +0 -7
- package/dist/pragma/index.d.ts +0 -7
- package/dist/pragma/is.d.ts +0 -10
- package/dist/switchable.d.ts +0 -7
- package/dist/vike/+config.cjs.js +0 -65
- package/src/component.ts +0 -2256
- package/src/cycle/isolate/index.ts +0 -196
- package/src/cycle/run/index.ts +0 -151
- package/src/cycle/run/internals.ts +0 -143
- package/src/cycle/state/Collection.ts +0 -174
- package/src/cycle/state/index.ts +0 -5
- package/src/cycle/state/pickCombine.ts +0 -167
- package/src/cycle/state/pickMerge.ts +0 -122
- package/src/cycle/state/withState.ts +0 -47
- package/src/pragma/fn.ts +0 -55
package/src/zag.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// 'sygnal/zag' (PLAN-5 W-2, D203): fromZag, a Zag.js machine as a widget tag. Types for the entry.
|
|
2
|
+
import type { Widget, WidgetDefinition } from 'sygnal'
|
|
3
|
+
|
|
4
|
+
/** snabbdom data for one element, from a Zag prop getter: spread it on the element in JSX */
|
|
5
|
+
export interface ZagElementProps {
|
|
6
|
+
attrs: Record<string, any>
|
|
7
|
+
on: Record<string, (event: any) => void>
|
|
8
|
+
props: Record<string, any>
|
|
9
|
+
style: Record<string, any>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** A Zag machine package: `import * as menu from '@zag-js/menu'` */
|
|
13
|
+
export interface ZagPackage {
|
|
14
|
+
machine: any
|
|
15
|
+
connect: (service: any, normalize: any) => any
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The adapter instance (`t.widget(sel).instance` with `dom: 'real'`) */
|
|
19
|
+
export interface ZagInstance {
|
|
20
|
+
/** The host element */
|
|
21
|
+
el: HTMLElement
|
|
22
|
+
/** The VanillaMachine */
|
|
23
|
+
machine: any
|
|
24
|
+
/** The connected api (prop getters return ZagElementProps) */
|
|
25
|
+
api(): any
|
|
26
|
+
/** Dispatches an event on the host, as `mount`'s `dispatch` */
|
|
27
|
+
dispatch(name: string, detail?: any): void
|
|
28
|
+
/** Recomputes the machine props (`options.props`), notifies the machine and re-renders */
|
|
29
|
+
refresh(): void
|
|
30
|
+
/** Whatever a part keeps per instance */
|
|
31
|
+
[key: string]: any
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface FromZagOptions<P = any> {
|
|
35
|
+
/**
|
|
36
|
+
* Dispatched event name → the Zag callback (detail: Zag's details object), or [callback,
|
|
37
|
+
* (details, x) => detail]; null only declares the name (dispatch it with `x.dispatch`)
|
|
38
|
+
*/
|
|
39
|
+
events?: Record<string, string | [string, (details: any, x: ZagInstance) => any] | null>
|
|
40
|
+
/** The machine's props from the widget's props (default: the widget props as they are) */
|
|
41
|
+
props?: (props: P, x: ZagInstance) => Record<string, any>
|
|
42
|
+
/** Element commands: `{ open: (api) => api.setOpen(true) }`, called with the api, the options and the instance */
|
|
43
|
+
commands?: Record<string, (api: any, options: any, x: ZagInstance) => any>
|
|
44
|
+
/** The host element (default 'div') */
|
|
45
|
+
tag?: string
|
|
46
|
+
/** A name for diagnostics */
|
|
47
|
+
name?: string
|
|
48
|
+
/** What server rendering puts in the host */
|
|
49
|
+
fallback?: WidgetDefinition['fallback']
|
|
50
|
+
/** More prop names for the host element */
|
|
51
|
+
hostProps?: string[]
|
|
52
|
+
/** Prop names that stay off the host (the render applies them, e.g. `aria-label` on the trigger) */
|
|
53
|
+
ownProps?: string[]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A Zag machine as a widget tag. `render(api, props, x)` renders the machine's parts with Sygnal
|
|
58
|
+
* JSX, spreading the prop getters: `<button {...api.getTriggerProps()}>`. Machine callbacks named
|
|
59
|
+
* in `events` become bubbling DOM events on the host (`DOM.select('.menu').events('select').detail()`).
|
|
60
|
+
*/
|
|
61
|
+
export function fromZag<P = any>(zag: ZagPackage, render: (api: any, props: P, x: ZagInstance) => any, options?: FromZagOptions<P>): Widget<P, ZagInstance>
|
|
62
|
+
|
|
63
|
+
/** One Zag prop bag as snabbdom data `{ attrs, on, props, style }` (what the api's prop getters return inside fromZag) */
|
|
64
|
+
export function zagProps(bag: Record<string, any>): ZagElementProps
|
package/src/zag.ts
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* 'sygnal/zag' (PLAN-5 W-2, D203): `fromZag(zag, render, options)`, a Zag.js machine as a widget
|
|
3
|
+
* tag (defineWidget). Generalises experiment E3.
|
|
4
|
+
*
|
|
5
|
+
* import * as menu from '@zag-js/menu'
|
|
6
|
+
* export const Actions = fromZag(menu, (api, props) => (
|
|
7
|
+
* <div>
|
|
8
|
+
* <button {...api.getTriggerProps()}>{props.label}</button>
|
|
9
|
+
* <div {...api.getPositionerProps()}>
|
|
10
|
+
* <div {...api.getContentProps()}>
|
|
11
|
+
* {props.items.map((i) => <div {...api.getItemProps({ value: i.value })}>{i.label}</div>)}
|
|
12
|
+
* </div>
|
|
13
|
+
* </div>
|
|
14
|
+
* </div>
|
|
15
|
+
* ), { events: { select: ['onSelect', (d) => d.value] }, commands: { open: (api) => api.setOpen(true) } })
|
|
16
|
+
* // view: <Actions className="actions" label="Actions" items={ITEMS} />
|
|
17
|
+
* // intent: PICK: DOM.select('.actions').events('select').detail()
|
|
18
|
+
*
|
|
19
|
+
* - The machine runs on @zag-js/vanilla's VanillaMachine (an optional peer, pinned ~1.45.0 with
|
|
20
|
+
* the machine packages: Zag's packages depend on each other's exact versions). One per host.
|
|
21
|
+
* - Props: the machine's props are a getter over the newest widget props (`options.props(p, x)`
|
|
22
|
+
* maps them; by default they pass as they are), memoised per render and per `x.refresh()`. A
|
|
23
|
+
* render with other props sets them and notifies the machine, so its watchers see controlled
|
|
24
|
+
* props (`open`, `value`) change. No props are captured at mount (E3's stale-props bug).
|
|
25
|
+
* VanillaMachine.updateProps is not used: it merges into the previous props (a removed prop
|
|
26
|
+
* stays) and wraps the previous getter on every call.
|
|
27
|
+
* - Zag's prop getters are normalised for snabbdom (`zagProps`): `{ attrs, on, props, style }`,
|
|
28
|
+
* which a JSX spread routes to those modules. `render(api, props, x)` returns one vnode (an
|
|
29
|
+
* array is wrapped in a `display: contents` div), patched into the host by a private snabbdom
|
|
30
|
+
* patch (the host is opaque to the app's patch). It re-runs when the machine notifies and when
|
|
31
|
+
* the props change.
|
|
32
|
+
* - Machine callbacks become dispatched DOM events on the host: `events: { name: 'onX' }` (detail:
|
|
33
|
+
* Zag's details object) or `{ name: ['onX', (details, x) => detail] }`; `{ name: null }` only
|
|
34
|
+
* declares it (a callback from the props mapping dispatches it with `x.dispatch`). A callback
|
|
35
|
+
* the props mapping also returns runs first.
|
|
36
|
+
* - Commands: `commands: { open: (api, options, x) => api.setOpen(true) }` (D102 element commands).
|
|
37
|
+
* - The instance (`t.widget(sel).instance` with `dom: 'real'`) is `x`: `{ el, api(), machine,
|
|
38
|
+
* refresh() }` plus whatever the part keeps on it.
|
|
39
|
+
* - Errors (G-409): a render that throws while the widget mounts stops the machine and is SYG660;
|
|
40
|
+
* on a later, machine-driven redraw it stops the machine and goes to the widget's error path
|
|
41
|
+
* (mount's `error`): SYG661 and the owner's onError fallback in its place. Either way the
|
|
42
|
+
* rendered content is released (refs nulled, destroy hooks, listeners off; G-438).
|
|
43
|
+
* - The render is plain elements only (G-410): it is patched outside the component tree, so a
|
|
44
|
+
* Sygnal component, a widget tag or special JSX inside it can't run (SYG669 in dev).
|
|
45
|
+
* - Wrong arguments throw SYG667 when the widget is defined.
|
|
46
|
+
*
|
|
47
|
+
* Separate entry: rollup turns './index' into the external 'sygnal' and keeps snabbdom and
|
|
48
|
+
* @zag-js/* external (D209), so importing 'sygnal' or 'sygnal/ui' never needs Zag.
|
|
49
|
+
*/
|
|
50
|
+
import {VanillaMachine} from '@zag-js/vanilla'
|
|
51
|
+
import {init} from 'snabbdom/build/init.js'
|
|
52
|
+
import {h} from 'snabbdom/build/h.js'
|
|
53
|
+
import {classModule} from 'snabbdom/build/modules/class.js'
|
|
54
|
+
import {propsModule} from 'snabbdom/build/modules/props.js'
|
|
55
|
+
import {attributesModule} from 'snabbdom/build/modules/attributes.js'
|
|
56
|
+
import {datasetModule} from 'snabbdom/build/modules/dataset.js'
|
|
57
|
+
import {eventListenersModule} from 'snabbdom/build/modules/eventlisteners.js'
|
|
58
|
+
import {styleModule} from './cycle/dom/styleModule'
|
|
59
|
+
import {defineWidget} from './index'
|
|
60
|
+
|
|
61
|
+
const patch = init([classModule, propsModule, attributesModule, datasetModule, styleModule, eventListenersModule])
|
|
62
|
+
|
|
63
|
+
// React-style event props whose DOM event has another name (as @zag-js/vanilla's normalizeProps)
|
|
64
|
+
const EV: any = {Focus: 'focusin', Blur: 'focusout', Change: 'input', DoubleClick: 'dblclick'}
|
|
65
|
+
const NAME: any = {htmlFor: 'for', className: 'class'}
|
|
66
|
+
// enumerated attributes whose false must be written, not removed
|
|
67
|
+
const STR = /^(aria-|spellcheck$|draggable$|contenteditable$)/i
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* One Zag prop bag (`api.getTriggerProps()` with any normaliser, or raw) as snabbdom data
|
|
71
|
+
* `{ attrs, on, props, style }`: `onX` handlers to `on` (onChange → input, onFocus → focusin, …),
|
|
72
|
+
* `value` / `checked` (and their `default…`) to `props`, `style`, and the rest to `attrs` (names
|
|
73
|
+
* lowercased, htmlFor → for; an ARIA boolean as "true" / "false"; false removes the attribute).
|
|
74
|
+
*/
|
|
75
|
+
export const zagProps = (bag: any): any => {
|
|
76
|
+
const attrs: any = {}, on: any = {}, props: any = {}, style: any = {}
|
|
77
|
+
for (const k in bag) {
|
|
78
|
+
const v = bag[k]
|
|
79
|
+
if (v === undefined) continue
|
|
80
|
+
if (typeof v == 'function' && /^on[A-Z]/.test(k)) on[EV[k.slice(2)] || k.slice(2).toLowerCase()] = v
|
|
81
|
+
else if (k == 'style') Object.assign(style, v)
|
|
82
|
+
else if (/^(default)?(value|checked|Value|Checked)$/.test(k)) props[k.replace(/^default(.)/, (_, c) => c.toLowerCase())] = v
|
|
83
|
+
else attrs[NAME[k] || (/^(viewBox|preserveAspectRatio)$/.test(k) ? k : k.toLowerCase())] = typeof v == 'boolean' && STR.test(k) ? '' + v : v
|
|
84
|
+
}
|
|
85
|
+
return {attrs, on, props, style}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Zag's normaliser shape (@zag-js/types createNormalizer): every element kind maps through zagProps
|
|
89
|
+
const normalize: any = new Proxy({}, {get: (_, k) => (k == 'style' ? (s: any) => ({...s}) : zagProps)})
|
|
90
|
+
|
|
91
|
+
const fail = (m: string): never => {
|
|
92
|
+
throw new Error(`[Sygnal SYG667] ${m}. https://sygnal.js.org/reference/errors#syg667`)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let ids = 0
|
|
96
|
+
|
|
97
|
+
// snabbdom's destroy pass over a rendered tree, without removing it from the DOM (G-412)
|
|
98
|
+
const release = (v: any) => {
|
|
99
|
+
const d = v?.data
|
|
100
|
+
if (d) { d.hook?.destroy?.(v); (eventListenersModule.destroy as any)(v) }
|
|
101
|
+
v?.children?.forEach(release)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// G-410 (dev only): what a render must not contain: a component (data.c), a widget tag, special JSX.
|
|
105
|
+
// G-439 / G-470: a marker is a vnode the pragma made from a marker function (`data.m`), with or
|
|
106
|
+
// without props (`<Suspense>`, `h(Transition, null)`, `<Slot>`); a plain <slot> element is not,
|
|
107
|
+
// whatever its children
|
|
108
|
+
const SPECIAL: any = {transition: 'Transition', portal: 'Portal', collection: 'Collection', switchable: 'Switchable',
|
|
109
|
+
suspense: 'Suspense', clientonly: 'ClientOnly', 'virtual-collection': 'VirtualCollection', slot: 'Slot'}
|
|
110
|
+
const foreign = (v: any, out: string[]): string[] => {
|
|
111
|
+
if (!v || typeof v != 'object') return out
|
|
112
|
+
if (Array.isArray(v)) { v.forEach(c => foreign(c, out)); return out }
|
|
113
|
+
const d = v.data
|
|
114
|
+
let t = d?.c ? v.sel : v.sel == 'widget' && d?.ww ? d.ww.def.name || 'widget' : d?.m && SPECIAL[v.sel]
|
|
115
|
+
if (t) out.includes(t = '<' + t + '>') || out.push(t)
|
|
116
|
+
return foreign(v.children, out)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function start(zag: any, render: any, o: any, el: any, p0: any, dispatch: any, error: any, w: any): any {
|
|
120
|
+
// live: 0 while start() runs (a throwing draw throws: SYG660), then 1 (it goes to error: SYG661)
|
|
121
|
+
// f669: this instance's render had foreign content (G-470: per instance, not on the widget tag,
|
|
122
|
+
// so another app or test, or diagnostics turned on later, still gets its report)
|
|
123
|
+
let props = p0, memo: any, on = 1, busy = 0, again = 0, live = 0, f669 = 0
|
|
124
|
+
let vn: any = el.appendChild(document.createElement('div'))
|
|
125
|
+
const id = p0.id ?? 'sygnal-zag-' + ++ids
|
|
126
|
+
// the instance (the part's per-instance fields too); the props mapping gets it from the start
|
|
127
|
+
const x: any = {el, dispatch}
|
|
128
|
+
// the events' callbacks: dispatch on the host
|
|
129
|
+
const cbs: any = {}
|
|
130
|
+
for (const name in o.events) {
|
|
131
|
+
const [cb, map] = ([] as any[]).concat(o.events[name])
|
|
132
|
+
// null: declared only (the part dispatches it with x.dispatch)
|
|
133
|
+
if (!cb) continue
|
|
134
|
+
const prev = cbs[cb]
|
|
135
|
+
cbs[cb] = (d: any) => { prev?.(d); dispatch(name, map ? map(d, x) : d) }
|
|
136
|
+
}
|
|
137
|
+
// the machine's props: the newest widget props, mapped (memoised until the next render or refresh)
|
|
138
|
+
const machineProps = () => {
|
|
139
|
+
if (memo) return memo
|
|
140
|
+
const mp = o.props ? o.props(props, x) : props
|
|
141
|
+
const out: any = {...mp, id, getRootNode: () => (el.isConnected ? el.getRootNode() : document)}
|
|
142
|
+
for (const cb in cbs) {
|
|
143
|
+
const u = mp[cb]
|
|
144
|
+
out[cb] = u ? (d: any) => { u(d); cbs[cb](d) } : cbs[cb]
|
|
145
|
+
}
|
|
146
|
+
return (memo = out)
|
|
147
|
+
}
|
|
148
|
+
// notify(): a public field of VanillaMachine (typed private), the one way to re-run its watchers
|
|
149
|
+
// without updateProps (Zag pinned ~1.45.0; the tests cover it)
|
|
150
|
+
const m: any = new VanillaMachine(zag.machine, machineProps)
|
|
151
|
+
const api = () => zag.connect(m.service, normalize)
|
|
152
|
+
const draw = () => {
|
|
153
|
+
if (!on) return
|
|
154
|
+
if (busy) return void (again = 1)
|
|
155
|
+
busy = 1
|
|
156
|
+
try {
|
|
157
|
+
do {
|
|
158
|
+
again = 0
|
|
159
|
+
const out = render(api(), props, x)
|
|
160
|
+
// G-439: once found, this instance's render isn't walked again (the report is once per
|
|
161
|
+
// widget tag: checks/widgets.ts)
|
|
162
|
+
const dev = (globalThis as any).__SYGNAL_DIAGNOSTICS__?.widget
|
|
163
|
+
if (dev && !f669) { const f = foreign(out, []); f.length && (f669 = 1, dev(669, w(), undefined, f)) }
|
|
164
|
+
vn = patch(vn, Array.isArray(out) ? h('div', {style: {display: 'contents'}}, out) : out || h('!', ''))
|
|
165
|
+
} while (again && on)
|
|
166
|
+
} catch (e) {
|
|
167
|
+
// G-409: the machine stops; a machine-driven redraw (an event handler, a watcher) hands the
|
|
168
|
+
// error to the widget (SYG661 + the owner's onError fallback) instead of throwing into Zag
|
|
169
|
+
halt()
|
|
170
|
+
// G-438: a failed mount has no unmount: its content is released here
|
|
171
|
+
if (!live) { free(); throw e }
|
|
172
|
+
error(e)
|
|
173
|
+
} finally { busy = 0 }
|
|
174
|
+
}
|
|
175
|
+
const halt = () => {
|
|
176
|
+
if (!on) return
|
|
177
|
+
on = 0
|
|
178
|
+
try { m.stop() } catch (_) {}
|
|
179
|
+
}
|
|
180
|
+
// G-412: the content stays (a <Transition> leave animates the host with it); its destroy hooks
|
|
181
|
+
// run (refs in the render) and its listeners come off, as a patch to nothing would do. Once,
|
|
182
|
+
// and only for a rendered vnode (before the first draw, vn is the placeholder element). G-472:
|
|
183
|
+
// vn is cleared first, so a destroy hook that stops the widget (or throws) doesn't release twice
|
|
184
|
+
const free = () => {
|
|
185
|
+
const v = vn
|
|
186
|
+
vn = 0
|
|
187
|
+
if (v?.sel !== undefined) release(v)
|
|
188
|
+
}
|
|
189
|
+
Object.assign(x, {
|
|
190
|
+
machine: m,
|
|
191
|
+
api,
|
|
192
|
+
refresh: () => { memo = 0; m.notify() },
|
|
193
|
+
set: (p: any) => { props = p; x.refresh() },
|
|
194
|
+
// G-438: after a halt (G-409) the machine is already stopped, and the content is still released
|
|
195
|
+
stop: () => {
|
|
196
|
+
const was = on
|
|
197
|
+
on = 0
|
|
198
|
+
try { was && m.stop() } finally { free() }
|
|
199
|
+
},
|
|
200
|
+
})
|
|
201
|
+
m.subscribe(draw)
|
|
202
|
+
draw()
|
|
203
|
+
// G-409: a start() or second draw that throws leaves no running machine (then SYG660)
|
|
204
|
+
try { m.start() } catch (e) { halt(); free(); throw e }
|
|
205
|
+
draw()
|
|
206
|
+
live = 1
|
|
207
|
+
return x
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* A Zag machine as a widget tag: `fromZag(zag, render, options)` where `zag` is a machine package
|
|
212
|
+
* (`import * as menu from '@zag-js/menu'`: its `machine` and `connect`), `render(api, props, x)`
|
|
213
|
+
* renders its parts with the prop getters spread (`<button {...api.getTriggerProps()}>`).
|
|
214
|
+
* Options: `events` (dispatched name → Zag callback, or [callback, details → detail]), `props`
|
|
215
|
+
* ((widgetProps, x) → machine props), `commands` ((api, options, x) → …), and defineWidget's
|
|
216
|
+
* `tag`, `name`, `fallback`, `hostProps`, `ownProps`.
|
|
217
|
+
*/
|
|
218
|
+
export function fromZag(zag: any, render: any, options: any = {}): any {
|
|
219
|
+
if (!zag || !zag.machine || typeof zag.connect != 'function') fail('fromZag(zag, render): the first argument is not a Zag machine package (import * as menu from \'@zag-js/menu\')')
|
|
220
|
+
if (typeof render != 'function') fail('fromZag(zag, render): render must be a function (api, props) => vnode')
|
|
221
|
+
const o = options, commands: any = {}
|
|
222
|
+
let tag: any
|
|
223
|
+
for (const c in o.commands) commands[c] = (x: any, opt: any) => o.commands[c](x.api(), opt, x)
|
|
224
|
+
return tag = defineWidget({
|
|
225
|
+
tag: o.tag,
|
|
226
|
+
name: o.name,
|
|
227
|
+
fallback: o.fallback,
|
|
228
|
+
hostProps: o.hostProps,
|
|
229
|
+
ownProps: o.ownProps,
|
|
230
|
+
// D211: a first-party part (sygnal/ui/menu…): its event names are documented, no SYG144
|
|
231
|
+
$own: o.$own,
|
|
232
|
+
events: Object.keys(o.events || {}),
|
|
233
|
+
commands,
|
|
234
|
+
mount: (el: any, p: any, dispatch: any, error: any) => start(zag, render, o, el, p, dispatch, error, () => tag),
|
|
235
|
+
update: (x: any, p: any) => x.set(p),
|
|
236
|
+
unmount: (x: any) => x.stop(),
|
|
237
|
+
})
|
|
238
|
+
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
interface AstroRenderer {
|
|
2
|
-
name: string;
|
|
3
|
-
clientEntrypoint: string;
|
|
4
|
-
serverEntrypoint: string;
|
|
5
|
-
}
|
|
6
|
-
interface AstroConfigSetupArgs {
|
|
7
|
-
addRenderer: (renderer: AstroRenderer) => void;
|
|
8
|
-
updateConfig: (config: any) => void;
|
|
9
|
-
}
|
|
10
|
-
export default function sygnalAstroIntegration(): {
|
|
11
|
-
name: string;
|
|
12
|
-
hooks: {
|
|
13
|
-
'astro:config:setup': ({ addRenderer, updateConfig }: AstroConfigSetupArgs) => void;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare function check(Component: any): boolean;
|
|
2
|
-
export declare function renderToStaticMarkup(): {
|
|
3
|
-
html: string;
|
|
4
|
-
attrs: Record<string, any>;
|
|
5
|
-
};
|
|
6
|
-
export declare const supportsAstroStaticSlot = true;
|
|
7
|
-
declare const _default: {
|
|
8
|
-
check: typeof check;
|
|
9
|
-
renderToStaticMarkup: typeof renderToStaticMarkup;
|
|
10
|
-
supportsAstroStaticSlot: boolean;
|
|
11
|
-
};
|
|
12
|
-
export default _default;
|