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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import xs, {Stream} from 'xstream';
|
|
2
|
+
import {senderOf, allowed, makeReplies} from './replies';
|
|
2
3
|
|
|
3
4
|
interface DriverFromAsyncOptions {
|
|
4
5
|
selector?: string;
|
|
@@ -8,10 +9,46 @@ interface DriverFromAsyncOptions {
|
|
|
8
9
|
post?: (val: any, incoming?: any) => any;
|
|
9
10
|
}
|
|
10
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Create a driver from a promise-returning function.
|
|
14
|
+
*
|
|
15
|
+
* Each value the app sends to the driver calls the function (arguments picked
|
|
16
|
+
* by `args`, after `pre`). The resolved value, after `post`, is delivered as
|
|
17
|
+
* `{ [return]: value, [selector]: request[selector] }` (defaults:
|
|
18
|
+
* `{ value, category }`) and read with `source.select(category)`. A promise
|
|
19
|
+
* that resolves to `null`/`undefined` is delivered the same way. Replies that
|
|
20
|
+
* resolve before any `select()` listener exists (a BOOTSTRAP request, say) are
|
|
21
|
+
* held and delivered once the first one subscribes.
|
|
22
|
+
*
|
|
23
|
+
* Errors: if the function's promise (or a promise returned by `post`)
|
|
24
|
+
* rejects, or `post` throws, the error is delivered on `source.errors()`,
|
|
25
|
+
* never on `select()`:
|
|
26
|
+
*
|
|
27
|
+
* ```js
|
|
28
|
+
* // payload: { error, category: request.category, request }
|
|
29
|
+
* intent: ({ QUOTE }) => ({
|
|
30
|
+
* GOT_QUOTE: QUOTE.select('quote'),
|
|
31
|
+
* QUOTE_ERROR: QUOTE.errors('quote'), // or .errors() / .errors(e => ...)
|
|
32
|
+
* })
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* `errors(selector?)` filters like `select()`: no argument = all errors, a
|
|
36
|
+
* string matches the request's selector property, a function is a predicate on
|
|
37
|
+
* the error payload. An error no errors() listener matches is logged with
|
|
38
|
+
* console.error. Errors that occur before the first errors() listener
|
|
39
|
+
* subscribes (a BOOTSTRAP request) are held like early replies.
|
|
40
|
+
*
|
|
41
|
+
* Reply actions (PLAN-3): a request object a component sends with `ok` /
|
|
42
|
+
* `error` action names gets its outcome as that action, on exactly the sending
|
|
43
|
+
* instance (never on select()/errors()): `ok` data is the resolved value (after
|
|
44
|
+
* `post`), `error` data `{ error, request }`. A request naming only one of them
|
|
45
|
+
* sends the other outcome down select()/errors(). A reply for a disposed
|
|
46
|
+
* instance is dropped. Requests with a `then` / `catch` key are refused (SYG610).
|
|
47
|
+
*/
|
|
11
48
|
function driverFromAsync(
|
|
12
49
|
promiseReturningFunction: (...args: any[]) => Promise<any>,
|
|
13
50
|
opts: DriverFromAsyncOptions = {}
|
|
14
|
-
): (fromApp$: Stream<any>) => {select: (selector?: any) => Stream<any
|
|
51
|
+
): (fromApp$: Stream<any>) => {select: (selector?: any) => Stream<any>; errors: (selector?: any) => Stream<any>; [k: string]: any} {
|
|
15
52
|
const {
|
|
16
53
|
selector: selectorProperty = 'category',
|
|
17
54
|
args: functionArgs = 'value',
|
|
@@ -39,17 +76,88 @@ function driverFromAsync(
|
|
|
39
76
|
}
|
|
40
77
|
|
|
41
78
|
return (fromApp$: Stream<any>) => {
|
|
79
|
+
// G-069: a reply can resolve before anything has subscribed to select() (e.g. a
|
|
80
|
+
// BOOTSTRAP request to an instantly-resolving promise under run()). Such replies are
|
|
81
|
+
// buffered (at most EARLY_REPLY_LIMIT, oldest dropped) until the first select()
|
|
82
|
+
// listener subscribes, then delivered in order on a microtask, so every select()
|
|
83
|
+
// wired in the same pass sees them. After that, a reply that arrives while no one
|
|
84
|
+
// listens is dropped, as with any xstream source.
|
|
85
|
+
const EARLY_REPLY_LIMIT = 100;
|
|
42
86
|
let sendFn: ((val: any) => void) | null = null;
|
|
87
|
+
let started = false;
|
|
88
|
+
let pending: any[] = [];
|
|
89
|
+
const flush = () => {
|
|
90
|
+
const queued = pending;
|
|
91
|
+
pending = [];
|
|
92
|
+
queued.forEach(reply => sendFn?.(reply));
|
|
93
|
+
};
|
|
94
|
+
const deliver = (reply: any) => {
|
|
95
|
+
if (!started || pending.length > 0) {
|
|
96
|
+
pending.push(reply);
|
|
97
|
+
if (pending.length > EARLY_REPLY_LIMIT) pending.shift();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
sendFn?.(reply);
|
|
101
|
+
};
|
|
43
102
|
|
|
44
103
|
const toApp$ = xs.create<any>({
|
|
45
104
|
start: (listener) => {
|
|
46
105
|
sendFn = listener.next.bind(listener);
|
|
106
|
+
if (!started) {
|
|
107
|
+
started = true;
|
|
108
|
+
if (pending.length > 0) queueMicrotask(flush);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
stop: () => {
|
|
112
|
+
sendFn = null;
|
|
47
113
|
},
|
|
48
|
-
stop: () => {},
|
|
49
114
|
});
|
|
50
115
|
|
|
116
|
+
// Active errors(selector) streams (1H-6): an error goes to the ones it matches, and is
|
|
117
|
+
// logged when none matches.
|
|
118
|
+
const errorSubs = new Set<{listener: any; selector: any}>();
|
|
119
|
+
const matches = (selector: any, val: any) =>
|
|
120
|
+
selector === undefined ||
|
|
121
|
+
(typeof selector === 'function' ? selector(val) : val?.[selectorProperty] === selector);
|
|
122
|
+
const filterBy = (stream: Stream<any>, selector?: any) =>
|
|
123
|
+
selector === undefined ? stream : stream.filter((val: any) => matches(selector, val));
|
|
124
|
+
const errMsg = `Error in driver created using driverFromAsync(${functionName})`;
|
|
125
|
+
const dispatchError = (val: any) => {
|
|
126
|
+
let handled = false;
|
|
127
|
+
errorSubs.forEach(sub => {
|
|
128
|
+
let hit = false;
|
|
129
|
+
try { hit = matches(sub.selector, val); } catch (_) {}
|
|
130
|
+
if (hit) {
|
|
131
|
+
handled = true;
|
|
132
|
+
sub.listener.next(val);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
if (!handled) console.error(`${errMsg}: ${val.error}`);
|
|
136
|
+
};
|
|
137
|
+
// G-092: like early replies, errors that occur before the first errors() listener
|
|
138
|
+
// subscribes are held (same limit) and dispatched on a microtask once it does. If
|
|
139
|
+
// nothing has subscribed by the next macrotask, they are dispatched (i.e. logged) then.
|
|
140
|
+
let errStarted = false;
|
|
141
|
+
let pendingErrors: any[] = [];
|
|
142
|
+
const flushErrors = () => {
|
|
143
|
+
errStarted = true;
|
|
144
|
+
const queued = pendingErrors;
|
|
145
|
+
pendingErrors = [];
|
|
146
|
+
queued.forEach(dispatchError);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// 3E/R11: set by the source's dispose(), which Cycle's engine calls on teardown just
|
|
150
|
+
// before it completes the sink proxies; that completion is expected, not worth a warning.
|
|
151
|
+
let disposing = false;
|
|
152
|
+
const {replies, reply} = makeReplies();
|
|
153
|
+
|
|
51
154
|
fromApp$.addListener({
|
|
52
155
|
next: (incoming: any) => {
|
|
156
|
+
const isObject = typeof incoming === 'object' && incoming !== null;
|
|
157
|
+
if (isObject && !allowed(incoming, `driverFromAsync(${functionName})`)) return;
|
|
158
|
+
const sender = isObject ? senderOf(incoming) : undefined;
|
|
159
|
+
const ok = sender !== undefined && incoming.ok;
|
|
160
|
+
const error = sender !== undefined && incoming.error;
|
|
53
161
|
const preProcessed = preFunction(incoming);
|
|
54
162
|
let argArr: any[] = [];
|
|
55
163
|
if (typeof preProcessed === 'object' && preProcessed !== null) {
|
|
@@ -64,62 +172,53 @@ function driverFromAsync(
|
|
|
64
172
|
argArr = functionArgs.map((arg: string) => preProcessed[arg]);
|
|
65
173
|
}
|
|
66
174
|
}
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
outgoing = rawVal;
|
|
74
|
-
if (typeof outgoing === 'object' && outgoing !== null) {
|
|
75
|
-
outgoing[selectorProperty] = incoming[selectorProperty];
|
|
76
|
-
} else {
|
|
77
|
-
console.warn(
|
|
78
|
-
`The 'return' option for driverFromAsync(${functionName}) was not set, but the promise returned an non-object. The result will be returned as-is, but the '${selectorProperty}' property will not be set, so will not be filtered by the 'select' method of the driver.`
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
} else if (typeof returnProperty === 'string') {
|
|
82
|
-
outgoing = {
|
|
83
|
-
[returnProperty]: rawVal,
|
|
84
|
-
[selectorProperty]: incoming[selectorProperty],
|
|
85
|
-
};
|
|
86
|
-
} else {
|
|
87
|
-
throw new Error(
|
|
88
|
-
`The 'return' option for driverFromAsync(${functionName}) must be a string. Received ${typeof returnProperty}`
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
return outgoing;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
if (typeof innerVal.then === 'function') {
|
|
95
|
-
innerVal
|
|
96
|
-
.then((innerOutgoing: any) => {
|
|
97
|
-
const processedOutgoing = postFunction(innerOutgoing, incoming);
|
|
98
|
-
if (typeof processedOutgoing.then === 'function') {
|
|
99
|
-
processedOutgoing
|
|
100
|
-
.then((innerProcessedOutgoing: any) => {
|
|
101
|
-
sendFn!(constructReply(innerProcessedOutgoing));
|
|
102
|
-
})
|
|
103
|
-
.catch((err: any) => console.error(`${errMsg}: ${err}`));
|
|
104
|
-
} else {
|
|
105
|
-
sendFn!(constructReply(processedOutgoing));
|
|
106
|
-
}
|
|
107
|
-
})
|
|
108
|
-
.catch((err: any) => console.error(`${errMsg}: ${err}`));
|
|
175
|
+
const constructReply = (rawVal: any) => {
|
|
176
|
+
let outgoing: any;
|
|
177
|
+
if (returnProperty === undefined) {
|
|
178
|
+
outgoing = rawVal;
|
|
179
|
+
if (typeof outgoing === 'object' && outgoing !== null) {
|
|
180
|
+
outgoing[selectorProperty] = incoming[selectorProperty];
|
|
109
181
|
} else {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
182
|
+
console.warn(
|
|
183
|
+
`The 'return' option for driverFromAsync(${functionName}) was not set, but the promise returned an non-object. The result will be returned as-is, but the '${selectorProperty}' property will not be set, so will not be filtered by the 'select' method of the driver.`
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
} else if (typeof returnProperty === 'string') {
|
|
187
|
+
outgoing = {
|
|
188
|
+
[returnProperty]: rawVal,
|
|
189
|
+
[selectorProperty]: incoming[selectorProperty],
|
|
190
|
+
};
|
|
191
|
+
} else {
|
|
192
|
+
throw new Error(
|
|
193
|
+
`The 'return' option for driverFromAsync(${functionName}) must be a string. Received ${typeof returnProperty}`
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
return outgoing;
|
|
197
|
+
};
|
|
198
|
+
// Rejections (of the function, a thenable it resolves to, or post()) go to errors();
|
|
199
|
+
// an error no active errors() selector matches is logged, as before.
|
|
200
|
+
const reportError = (err: any) => {
|
|
201
|
+
if (error) return reply(sender, error, {error: err, request: incoming});
|
|
202
|
+
const val = {error: err, [selectorProperty]: incoming?.[selectorProperty], request: incoming};
|
|
203
|
+
if (errStarted) return dispatchError(val);
|
|
204
|
+
if (pendingErrors.push(val) === 1) setTimeout(flushErrors);
|
|
205
|
+
if (pendingErrors.length > EARLY_REPLY_LIMIT) pendingErrors.shift();
|
|
206
|
+
};
|
|
207
|
+
const isThenable = (val: any) => val != null && typeof val.then === 'function';
|
|
208
|
+
promiseReturningFunction(...argArr)
|
|
209
|
+
.then((innerVal: any) =>
|
|
210
|
+
isThenable(innerVal)
|
|
211
|
+
? innerVal.then((innerOutgoing: any) => postFunction(innerOutgoing, incoming))
|
|
212
|
+
: postFunction(innerVal, incoming)
|
|
213
|
+
)
|
|
214
|
+
.then((val: any) => (ok ? val : constructReply(val)))
|
|
215
|
+
.then((outgoing: any) => {
|
|
216
|
+
try {
|
|
217
|
+
ok ? reply(sender, ok, outgoing) : deliver(outgoing);
|
|
218
|
+
} catch (err) {
|
|
219
|
+
console.error(`${errMsg}: ${err}`);
|
|
120
220
|
}
|
|
121
|
-
})
|
|
122
|
-
.catch((err: any) => console.error(`${errMsg}: ${err}`));
|
|
221
|
+
}, reportError);
|
|
123
222
|
},
|
|
124
223
|
error: (err: any) => {
|
|
125
224
|
console.error(
|
|
@@ -128,6 +227,7 @@ function driverFromAsync(
|
|
|
128
227
|
);
|
|
129
228
|
},
|
|
130
229
|
complete: () => {
|
|
230
|
+
if (disposing) return;
|
|
131
231
|
console.warn(
|
|
132
232
|
`Unexpected completion of sink stream to driver created using driverFromAsync(${functionName})`
|
|
133
233
|
);
|
|
@@ -135,10 +235,22 @@ function driverFromAsync(
|
|
|
135
235
|
});
|
|
136
236
|
|
|
137
237
|
return {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
238
|
+
dispose: () => {
|
|
239
|
+
disposing = true;
|
|
240
|
+
},
|
|
241
|
+
select: (selector?: any) => filterBy(toApp$, selector),
|
|
242
|
+
...replies,
|
|
243
|
+
errors: (selector?: any) => {
|
|
244
|
+
let sub: any;
|
|
245
|
+
return xs.create<any>({
|
|
246
|
+
start: (listener) => {
|
|
247
|
+
errorSubs.add((sub = {listener, selector}));
|
|
248
|
+
if (!errStarted) queueMicrotask(flushErrors);
|
|
249
|
+
},
|
|
250
|
+
stop: () => {
|
|
251
|
+
errorSubs.delete(sub);
|
|
252
|
+
},
|
|
253
|
+
});
|
|
142
254
|
},
|
|
143
255
|
};
|
|
144
256
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* PLAN-4 GS-2: element commands, the built-in ELEMENT sink.
|
|
3
|
+
*
|
|
4
|
+
* SUBMIT: { STATE: validate, ELEMENT: (s) => (s.errors.email ? { focus: Email } : ABORT) },
|
|
5
|
+
* OPEN_HELP: { ELEMENT: { showModal: HelpDialog } },
|
|
6
|
+
*
|
|
7
|
+
* A command is `{ <method>: target, ...options }`: the FIRST key is the method, the other keys
|
|
8
|
+
* are its options (D118); an array sends several, in order. The target (a control or a
|
|
9
|
+
* selector) is resolved in the SENDING instance's own DOM source, so isolation applies (a
|
|
10
|
+
* Collection item reaches only its own elements; a parent doesn't reach its children's).
|
|
11
|
+
*
|
|
12
|
+
* The method: D102 first, a control whose spec object declares `commands` runs
|
|
13
|
+
* `commands[method](element, options)` (it overrides a native method of the same name; only the
|
|
14
|
+
* control itself carries a spec, a template-string selector doesn't). A widget host
|
|
15
|
+
* (src/extra/widget.ts) carries its widget's commands, which win the same way for a selector
|
|
16
|
+
* target (PLAN-5 D196: `{ focus: '.editor' }` runs the widget's `focus`). Then the element's own
|
|
17
|
+
* method: `close` gets `returnValue` as its argument (D118), `togglePopover` its `force` (a
|
|
18
|
+
* boolean, or no argument: a browser that only takes a boolean treats an object as true), every
|
|
19
|
+
* other method the options object (focus { preventScroll }, scrollIntoView { block, inline,
|
|
20
|
+
* behavior }, blur, select, click, showModal, show, showPopover, hidePopover; also play, pause, showPicker,
|
|
21
|
+
* requestSubmit, reset...). The core runs any method the element has (no list: it
|
|
22
|
+
* would cost ~60 B); the dev entry reports the ones that change the DOM Sygnal renders (SYG641).
|
|
23
|
+
*
|
|
24
|
+
* Timing: a command runs once the render it may depend on is on the page. The instance's DOM
|
|
25
|
+
* source emits after every DOM mutation of the app (a patch), so the command runs in a microtask
|
|
26
|
+
* after the next patch at which its target exists. When no patch comes (the action changed
|
|
27
|
+
* nothing that renders), it runs at the first 16 ms check instead; the checks repeat every 16 ms
|
|
28
|
+
* while the target is missing, about 1 s, then it is given up (SYG640 in dev). A disposed
|
|
29
|
+
* instance's pending commands are dropped. Without a DOM source nothing runs (SSR renders views
|
|
30
|
+
* without instances); a null command is skipped (ABORT is the way to send nothing).
|
|
31
|
+
*
|
|
32
|
+
* Failures (no match: SYG640; neither a spec command nor an element method: SYG641) go to the
|
|
33
|
+
* 'sygnal/diagnostics' dev entry through the core bridge (`elementCommand`), which words them;
|
|
34
|
+
* the core carries no message text. In production a failed command does nothing.
|
|
35
|
+
*/
|
|
36
|
+
export function runElementCommands(c: any, cmds: any): void {
|
|
37
|
+
const dom = c.sources[c.DOMSourceName];
|
|
38
|
+
if (dom) for (const cmd of ([] as any[]).concat(cmds)) if (cmd) {
|
|
39
|
+
const m = Object.keys(cmd)[0], {[m]: t, ...o} = cmd, s = dom.select('' + t).elements();
|
|
40
|
+
let els: any, n = 0, k = 0, l: any;
|
|
41
|
+
const run = (last?: any) => {
|
|
42
|
+
const e = !c._disposed && els?.[0], f = t?.spec?.commands?.[m] || e?.__sw?.w.commands[m];
|
|
43
|
+
if (!l || !e && !last) return;
|
|
44
|
+
s.removeListener(l);
|
|
45
|
+
clearInterval(i);
|
|
46
|
+
l = 0;
|
|
47
|
+
e && (f || e[m]) ? f ? f(e, o) : e[m](m == 'close' ? o.returnValue : m == 'togglePopover' ? o.force : o)
|
|
48
|
+
: (globalThis as any).__SYGNAL_DIAGNOSTICS__?.elementCommand?.(c, cmd, e);
|
|
49
|
+
}, i = setInterval(() => run(++k > 62), 16);
|
|
50
|
+
// the first value (the DOM as it is now) is skipped; the next ones follow a patch
|
|
51
|
+
s.addListener(l = {next: (x: any) => { els = x; n++ && queueMicrotask(run); }});
|
|
52
|
+
}
|
|
53
|
+
}
|
package/src/extra/eventDriver.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import xs, {Stream} from 'xstream';
|
|
2
2
|
import {adapt} from '../cycle/run/adapt';
|
|
3
|
+
// [diagnostics hook] no-op when diagnostics are off
|
|
4
|
+
import {onBusEmit, onBusSelect} from './diagnostics/index';
|
|
3
5
|
|
|
4
6
|
export interface EventBusSource {
|
|
5
7
|
select(type?: string | string[]): any;
|
|
@@ -15,6 +17,7 @@ export default function eventBusDriver(out$: Stream<BusEvent>): EventBusSource {
|
|
|
15
17
|
|
|
16
18
|
out$.subscribe({
|
|
17
19
|
next: (event: BusEvent) => {
|
|
20
|
+
onBusEmit(event && event.type, (event as any)?.__emitterName);
|
|
18
21
|
events.dispatchEvent(new CustomEvent('data', {detail: event}));
|
|
19
22
|
if (typeof window !== 'undefined' && (window as any).__SYGNAL_DEVTOOLS__?.connected) {
|
|
20
23
|
(window as any).__SYGNAL_DEVTOOLS__.onBusEvent(event);
|
|
@@ -26,6 +29,7 @@ export default function eventBusDriver(out$: Stream<BusEvent>): EventBusSource {
|
|
|
26
29
|
|
|
27
30
|
return {
|
|
28
31
|
select: (type?: string | string[]) => {
|
|
32
|
+
onBusSelect(type);
|
|
29
33
|
const all = !type;
|
|
30
34
|
const _type = Array.isArray(type) ? type : [type];
|
|
31
35
|
let cb: ((e: Event) => void) | undefined;
|