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
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PLAN-4.6 core: the Portal marker (R2), registered on import by the public `Portal` module.
|
|
3
|
+
* A template rewrite (registry `pres`): the `portal` marker becomes a hidden placeholder whose
|
|
4
|
+
* hooks patch its children into the target with a separate snabbdom patch function. As today
|
|
5
|
+
* (the 5.x core's createPortalPlaceholder):
|
|
6
|
+
* - the target is looked up on insert; one rendered later is retried 10 times, 5 ms apart, and a
|
|
7
|
+
* late mount pokes the DOM driver (G-261 pokeDOM); never found: SYG417;
|
|
8
|
+
* - an update patches the portal's content; a removal patches it to empty (its destroy hooks
|
|
9
|
+
* run: G-359) and removes it;
|
|
10
|
+
* - the children move into the placeholder unprocessed (components inside a Portal are not
|
|
11
|
+
* instantiated, as today).
|
|
12
|
+
* G-316: the mount state lives in one object the placeholder's successive
|
|
13
|
+
* vnodes share (`_p`, handed on by postpatch), so a late-target retry mounts the latest children
|
|
14
|
+
* once, and a removal cancels a pending retry. `_portalVnode` stays on the current vnode (testing).
|
|
15
|
+
*/
|
|
16
|
+
import {pres} from '../registry'
|
|
17
|
+
import {init as snabbdomInit} from '../../cycle/dom/snabbdom'
|
|
18
|
+
import defaultModules from '../../cycle/dom/modules'
|
|
19
|
+
import {pokeDOM, flat} from '../../cycle/dom/utils'
|
|
20
|
+
import {warn} from '../../extra/diagnostics/legacy'
|
|
21
|
+
|
|
22
|
+
let patch: any
|
|
23
|
+
const notFound = (target: string) => warn('SYG417', 'Portal', `Target '${target}' not found; content not rendered`, 'Render the target first')
|
|
24
|
+
// (fragments among the children are flattened, as the DOM driver does)
|
|
25
|
+
const box = (children: any[]) => flat({sel: 'div', data: {}, children, text: undefined, elm: undefined, key: undefined})
|
|
26
|
+
|
|
27
|
+
interface PortalState { v: any; kids: any[]; pv: any; c: any; t: any; dead: boolean }
|
|
28
|
+
|
|
29
|
+
function mount(st: PortalState, target: string): boolean {
|
|
30
|
+
const container = document.querySelector(target)
|
|
31
|
+
if (!container) return false
|
|
32
|
+
const anchor = document.createElement('div')
|
|
33
|
+
container.appendChild(anchor)
|
|
34
|
+
st.pv = st.v.data._portalVnode = (patch ||= snabbdomInit(defaultModules))(anchor, box(st.kids))
|
|
35
|
+
st.c = st.v.data._portalContainer = container
|
|
36
|
+
return true
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** mount the portal's children into its target (retried while the target isn't rendered yet) */
|
|
40
|
+
function start(vnode: any, target: string, kids: any[]) {
|
|
41
|
+
const st: PortalState = vnode.data._p = {v: vnode, kids, pv: null, c: null, t: 0, dead: false}
|
|
42
|
+
let attempts = 0
|
|
43
|
+
const tryMount = () => {
|
|
44
|
+
st.t = 0
|
|
45
|
+
if (st.dead || st.pv) return
|
|
46
|
+
if (mount(st, target)) { if (attempts) pokeDOM(st.c) }
|
|
47
|
+
else if (attempts++ < 10) st.t = setTimeout(tryMount, 5)
|
|
48
|
+
else notFound(target)
|
|
49
|
+
}
|
|
50
|
+
tryMount()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function portalPlaceholder(target: string, children: any[]): any {
|
|
54
|
+
const portalChildren = children || []
|
|
55
|
+
return {
|
|
56
|
+
// G-328: a selector a plain div can't match, so snabbdom replaces (destroy / insert) the
|
|
57
|
+
// placeholder when a plain div takes its place, or the reverse, instead of patching it
|
|
58
|
+
sel: 'div.sygnal-portal',
|
|
59
|
+
data: {
|
|
60
|
+
style: {display: 'none'},
|
|
61
|
+
attrs: {'data-sygnal-portal': target},
|
|
62
|
+
portalChildren,
|
|
63
|
+
hook: {
|
|
64
|
+
insert: (vnode: any) => start(vnode, target, portalChildren),
|
|
65
|
+
postpatch: (oldVnode: any, newVnode: any) => {
|
|
66
|
+
const st: PortalState | undefined = oldVnode.data?._p
|
|
67
|
+
// G-318: reached by a patch, never inserted (hydration over server markup, or a plain
|
|
68
|
+
// div at the same position before): it starts here, as the 5.x core mounted it
|
|
69
|
+
if (!st) return void start(newVnode, target, newVnode.data?.portalChildren || [])
|
|
70
|
+
newVnode.data._p = st
|
|
71
|
+
st.v = newVnode
|
|
72
|
+
st.kids = newVnode.data?.portalChildren || []
|
|
73
|
+
// not mounted yet: the pending retry mounts these children
|
|
74
|
+
if (!st.pv) return
|
|
75
|
+
st.pv = newVnode.data._portalVnode = patch(st.pv, box(st.kids))
|
|
76
|
+
newVnode.data._portalContainer = st.c
|
|
77
|
+
},
|
|
78
|
+
destroy: (vnode: any) => {
|
|
79
|
+
const st: PortalState | undefined = vnode.data?._p
|
|
80
|
+
if (!st) return
|
|
81
|
+
st.dead = true
|
|
82
|
+
clearTimeout(st.t)
|
|
83
|
+
const el = st.pv?.elm
|
|
84
|
+
// G-359: patched to empty first, so the content's destroy hooks run (a widget unmounts)
|
|
85
|
+
if (el) patch(st.pv, box([])), el.remove()
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
children: [],
|
|
90
|
+
text: undefined,
|
|
91
|
+
elm: undefined,
|
|
92
|
+
key: undefined,
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
pres.portal = (n) => portalPlaceholder(n.data?.props?.target, n.children || [])
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PLAN-4.6 core: Suspense (R2), registered on import by the public `Suspense` module. A
|
|
3
|
+
* post-processor (registry `posts`) of the injected vnode of an instance whose template has a
|
|
4
|
+
* `suspense` marker (the 5.x core's processSuspensePost):
|
|
5
|
+
* - the core injects a child whose READY is false with data-sygnal-ready="false", and a lazy
|
|
6
|
+
* component still loading renders data-sygnal-lazy="loading";
|
|
7
|
+
* - a boundary with a `fallback` shows it (in a data-sygnal-suspense="pending" div) while any
|
|
8
|
+
* child below it, not below an inner boundary, is either; else its children (one child
|
|
9
|
+
* unwrapped, several in a "resolved" div). A child's scoped vnode (data.isolate) was processed
|
|
10
|
+
* by its own instance.
|
|
11
|
+
*/
|
|
12
|
+
import {posts} from '../registry'
|
|
13
|
+
|
|
14
|
+
// (4-I G-556: through fragments, e.g. a Collection's items)
|
|
15
|
+
function hasNotReadyChild(v: any): boolean {
|
|
16
|
+
if (!v) return false
|
|
17
|
+
const a = v.data?.attrs
|
|
18
|
+
// (4-K G-572: a not-ready child whose view returns text is marked `ready: false`: no element to mark)
|
|
19
|
+
if (v.ready === false || a?.['data-sygnal-ready'] === 'false' || a?.['data-sygnal-lazy'] === 'loading') return true
|
|
20
|
+
if (v.sel === 'suspense') return false
|
|
21
|
+
return Array.isArray(v.children) && v.children.some(hasNotReadyChild)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function suspensePost(v: any): any {
|
|
25
|
+
if (!v || v.data?.isolate) return v
|
|
26
|
+
if (v.sel === 'suspense') {
|
|
27
|
+
const fallback = v.data?.props?.fallback, children = v.children || []
|
|
28
|
+
const pending = fallback && children.some(hasNotReadyChild)
|
|
29
|
+
if (!pending && children.length === 1) return suspensePost(children[0])
|
|
30
|
+
return {sel: 'div', data: {attrs: {'data-sygnal-suspense': pending ? 'pending' : 'resolved'}}, children: pending ? [typeof fallback === 'string' ? {text: fallback} : fallback] : children.map(suspensePost), text: undefined, elm: undefined, key: undefined}
|
|
31
|
+
}
|
|
32
|
+
const kids = v.children
|
|
33
|
+
let out: any
|
|
34
|
+
for (let i = 0; kids && i < kids.length; i++) {
|
|
35
|
+
const o = suspensePost(kids[i])
|
|
36
|
+
if (o !== kids[i]) (out ||= kids.slice())[i] = o
|
|
37
|
+
}
|
|
38
|
+
return out ? {...v, children: out} : v
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
posts.suspense = suspensePost
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PLAN-4.6 core: the Transition marker (R2), registered on import by the public `Transition`
|
|
3
|
+
* module. A template rewrite (registry `pres`): the `transition` marker is replaced by its first
|
|
4
|
+
* child (walked on, at the marker's path), with snabbdom hooks that add the classes as today
|
|
5
|
+
* (the 5.x core's applyTransitionHooks):
|
|
6
|
+
* `${name}-enter|leave-from` + `-active`, two frames later `-from` becomes `-to`, and at the end
|
|
7
|
+
* (transitionend, or `duration` ms) `-active` and `-to` go. A user's insert/remove hooks on the
|
|
8
|
+
* child still run. G-279: a leaving element pokes the DOM driver once it is gone. Around a
|
|
9
|
+
* Collection (4-I G-559): on each item.
|
|
10
|
+
*/
|
|
11
|
+
import {pres} from '../registry'
|
|
12
|
+
import {pokeDOM} from '../../cycle/dom/utils'
|
|
13
|
+
|
|
14
|
+
function onEnd(el: any, duration: number | undefined, cb: () => void): void {
|
|
15
|
+
if (typeof duration === 'number') return void setTimeout(cb, duration)
|
|
16
|
+
const h = () => { el.removeEventListener('transitionend', h); cb() }
|
|
17
|
+
el.addEventListener('transitionend', h)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** a copy of the vnode with the hooks (4-I: a copy, so an item's own vnode keeps its hooks) */
|
|
21
|
+
export function transitionHooks(vnode: any, p: {name?: string, duration?: number}): any {
|
|
22
|
+
const hook = {...vnode.data?.hook}, {insert, remove} = hook, name = p.name || 'v', duration = p.duration
|
|
23
|
+
const run = (el: any, phase: string, done?: () => void) => {
|
|
24
|
+
const c = (s: string) => `${name}-${phase}-${s}`
|
|
25
|
+
el.classList.add(c('from'), c('active'))
|
|
26
|
+
requestAnimationFrame(() => {
|
|
27
|
+
requestAnimationFrame(() => {
|
|
28
|
+
el.classList.remove(c('from'))
|
|
29
|
+
el.classList.add(c('to'))
|
|
30
|
+
onEnd(el, duration, () => {
|
|
31
|
+
el.classList.remove(c('active'), c('to'))
|
|
32
|
+
done && done()
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
hook.insert = (vn: any) => {
|
|
38
|
+
if (insert) insert(vn)
|
|
39
|
+
const el = vn.elm
|
|
40
|
+
if (el && el.classList) run(el, 'enter')
|
|
41
|
+
}
|
|
42
|
+
hook.remove = (vn: any, rm: () => void) => {
|
|
43
|
+
if (remove) remove(vn, () => {})
|
|
44
|
+
const el = vn.elm
|
|
45
|
+
if (!el || !el.classList) return void rm()
|
|
46
|
+
run(el, 'leave', () => {
|
|
47
|
+
const p = el.parentNode, f = () => el.parentNode || pokeDOM(p)
|
|
48
|
+
rm()
|
|
49
|
+
f()
|
|
50
|
+
el.addEventListener('transitionend', f)
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
return {...vnode, data: {...vnode.data, hook}}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 4-J G-566 / 4-K G-573: an item vnode's copies, per name and duration, under a private symbol
|
|
57
|
+
// (no global symbol registry entry per name)
|
|
58
|
+
const T = Symbol()
|
|
59
|
+
|
|
60
|
+
pres.transition = (n) => {
|
|
61
|
+
const child = n.children?.[0], p = n.data?.props || {}, k = p.name + ' ' + p.duration
|
|
62
|
+
// no element child: the text child (or the marker itself, left as it is: today's behaviour)
|
|
63
|
+
if (!child?.sel) return child || n
|
|
64
|
+
// 4-I G-559 (D229): a Collection has no element of its own: each item's root element takes the
|
|
65
|
+
// hooks (each item enters and leaves on its own). The host calls `tr` per item vnode; the copy is
|
|
66
|
+
// kept on that vnode for the name and duration, so an unchanged item keeps its vnode (4-J G-566:
|
|
67
|
+
// under a symbol, which nothing that walks a vnode's fields sees). An item whose root is a
|
|
68
|
+
// fragment or text has no element to animate: nothing happens
|
|
69
|
+
return child.sel == 'collection' ? {...child, data: {...child.data, tr: (v: any) => (v[T] ||= {})[k] ||= transitionHooks(v, p)}} : transitionHooks(child, p)
|
|
70
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PLAN-4.6 core: the module registries (04-hooks-contract §2.1). A feature module fills them
|
|
3
|
+
* when it is imported; the core only looks them up, so an app that never imports the module pays
|
|
4
|
+
* nothing (D157). R2 fills hosts (core/hosts: Collection, Switchable) and the markers
|
|
5
|
+
* (core/markers: Portal, Transition, ClientOnly, Suspense, lazy), each imported by its public
|
|
6
|
+
* module; R3 adds the definition hooks (behaviors, undo, selection, pager, persist, resources).
|
|
7
|
+
*
|
|
8
|
+
* The entries are core modules: they get the owner's raw instance (hooks get InstanceViews).
|
|
9
|
+
*/
|
|
10
|
+
import type {ComponentFn, DefSource} from './hooks'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* marker sel -> a child that renders in place of the marker (Collection, Switchable): render(),
|
|
14
|
+
* setProps(props, children, marker, id), dispose(), ready, outv / last, insts() (its instances)
|
|
15
|
+
*/
|
|
16
|
+
export const hosts: Record<string, (owner: any, props: Record<string, any>, children: any[], id: string, marker: any) => any> = {}
|
|
17
|
+
/** marker sel -> a template rewrite during the reconcile walk (Portal, Transition, ClientOnly, Slot,
|
|
18
|
+
* widget); `path` is the marker's place in the owner's template ('r.0.2': a widget's identity) */
|
|
19
|
+
export const pres: Record<string, (vnode: any, owner: any, path: string) => any> = {}
|
|
20
|
+
/** marker sel -> a post-processor of an instance's injected vnode whose template had it (Suspense) */
|
|
21
|
+
export const posts: Record<string, (vnode: any, owner: any) => any> = {}
|
|
22
|
+
/** component function -> the function to instantiate (lazy: the loaded component once resolved) */
|
|
23
|
+
export const resolvers: Array<(view: ComponentFn, owner: any) => ComponentFn | undefined> = []
|
|
24
|
+
/** definition time, every app: (src, view) -> src (behaviors, undo, selection, pager, persist, resources) */
|
|
25
|
+
export const defHooks: Array<(src: DefSource, view: ComponentFn) => DefSource | void> = []
|