sygnal 5.4.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +646 -0
- package/README.md +24 -9
- package/dist/astro/client.cjs.js +16 -9
- package/dist/astro/client.cjs.js.map +1 -1
- package/dist/astro/client.mjs +16 -9
- package/dist/astro/client.mjs.map +1 -1
- package/dist/astro/index.cjs.js +362 -91
- package/dist/astro/index.cjs.js.map +1 -1
- package/dist/astro/index.mjs +362 -92
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/server.cjs.js +3396 -165
- package/dist/astro/server.cjs.js.map +1 -1
- package/dist/astro/server.mjs +3396 -165
- package/dist/astro/server.mjs.map +1 -1
- 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 +3032 -296
- package/dist/diagnostics.cjs.js.map +1 -1
- package/dist/diagnostics.esm.js +3032 -296
- package/dist/diagnostics.esm.js.map +1 -1
- 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 +13178 -5769
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2908 -276
- package/dist/index.esm.js +13149 -5779
- package/dist/index.esm.js.map +1 -1
- package/dist/jsx-dev-runtime.cjs.js +26 -334
- package/dist/jsx-dev-runtime.cjs.js.map +1 -1
- package/dist/jsx-dev-runtime.esm.js +19 -327
- package/dist/jsx-dev-runtime.esm.js.map +1 -1
- package/dist/jsx-runtime.cjs.js +26 -334
- package/dist/jsx-runtime.cjs.js.map +1 -1
- package/dist/jsx-runtime.esm.js +19 -327
- package/dist/jsx-runtime.esm.js.map +1 -1
- package/dist/jsx.cjs.js +10 -314
- package/dist/jsx.cjs.js.map +1 -1
- package/dist/jsx.esm.js +8 -315
- package/dist/jsx.esm.js.map +1 -1
- 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 +1 -1
- package/dist/sygnal.min.js.map +1 -1
- 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 +4 -14
- package/dist/vike/ClientOnly.cjs.js.map +1 -1
- package/dist/vike/ClientOnly.mjs +4 -14
- package/dist/vike/ClientOnly.mjs.map +1 -1
- package/dist/vike/{+config.js → config/+config.js} +9 -1
- package/dist/vike/config/+config.js.map +1 -0
- package/dist/vike/config/package.json +6 -0
- package/dist/vike/onRenderClient.cjs.js +165 -95
- package/dist/vike/onRenderClient.cjs.js.map +1 -1
- package/dist/vike/onRenderClient.mjs +165 -95
- package/dist/vike/onRenderClient.mjs.map +1 -1
- package/dist/vike/onRenderHtml.cjs.js +59 -24
- package/dist/vike/onRenderHtml.cjs.js.map +1 -1
- package/dist/vike/onRenderHtml.mjs +60 -25
- package/dist/vike/onRenderHtml.mjs.map +1 -1
- package/dist/vite/plugin.cjs.js +323 -88
- package/dist/vite/plugin.cjs.js.map +1 -1
- package/dist/vite/plugin.mjs +323 -89
- package/dist/vite/plugin.mjs.map +1 -1
- 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 +166 -103
- package/package.json +98 -14
- package/src/astro/client.ts +27 -16
- package/src/astro/index.d.ts +24 -0
- package/src/astro/index.ts +69 -3
- package/src/astro/server.ts +8 -2
- package/src/collection.ts +6 -93
- 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 +9 -2
- package/src/cycle/dom/PriorityQueue.ts +4 -2
- package/src/cycle/dom/SymbolTree.ts +18 -47
- package/src/cycle/dom/classNameModule.ts +9 -7
- package/src/cycle/dom/controlledInputModule.ts +23 -6
- package/src/cycle/dom/enrichEventStream.ts +25 -47
- package/src/cycle/dom/fragment.ts +7 -0
- package/src/cycle/dom/isolate.ts +30 -27
- package/src/cycle/dom/makeDOMDriver.ts +115 -56
- package/src/cycle/dom/mockDOMSource.ts +21 -1
- package/src/cycle/dom/modules.ts +16 -3
- 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 +19 -3
- 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 +101 -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 +1 -1
- 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 +20 -11
- package/src/extra/diagnostics/checks/elementCommands.ts +175 -0
- package/src/extra/diagnostics/checks/events.ts +17 -2
- 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 +97 -4
- package/src/extra/diagnostics/checks/inspect.ts +140 -32
- 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 +10 -5
- package/src/extra/diagnostics/checks/public.d.ts +98 -7
- 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 +1 -1
- package/src/extra/diagnostics/checks/shared.ts +86 -2
- 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 +100 -7
- package/src/extra/diagnostics/checks/statics.ts +48 -0
- package/src/extra/diagnostics/checks/strict.ts +10 -67
- 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 +66 -10
- package/src/extra/diagnostics/codes.ts +268 -23
- package/src/extra/diagnostics/index.ts +34 -9
- package/src/extra/diagnostics/legacy.ts +17 -0
- package/src/extra/driverFactories.ts +83 -19
- package/src/extra/elementCommands.ts +53 -0
- package/src/extra/fetchDriver.ts +519 -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 +1 -1
- 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 +90 -217
- 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 +2433 -175
- 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/index.d.ts +2631 -117
- package/src/index.ts +25 -4
- 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 +256 -133
- 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 -121
- 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 +7 -1
- package/src/vite/globalthis-shim.ts +18 -0
- package/src/vite/globalthis.ts +56 -0
- package/src/vite/plugin.d.ts +22 -3
- package/src/vite/plugin.ts +222 -24
- package/src/zag.d.ts +64 -0
- package/src/zag.ts +238 -0
- package/dist/vike/+config.cjs.js +0 -66
- package/dist/vike/+config.cjs.js.map +0 -1
- package/dist/vike/+config.js.map +0 -1
- package/src/component.ts +0 -2301
- 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 -184
- package/src/cycle/state/index.ts +0 -5
- package/src/cycle/state/pickCombine.ts +0 -201
- 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,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PLAN-4.6 core: the Switchable host (R2). Registered on import (the public `Switchable`
|
|
3
|
+
* module imports this file).
|
|
4
|
+
*
|
|
5
|
+
* - `of={{ name: Fn }}` (D163: functions only; SYG415), `current` (SYG416), `state` (a key, a
|
|
6
|
+
* lens or none: the pages' state; SYG409 / SYG410 as for a tag child), `instance` (D83).
|
|
7
|
+
* - Every page is created at mount and stays alive while hidden: its intent, actions, PARENT
|
|
8
|
+
* (to the owner's CHILD.select) and, in R3, its background statics run from mount (R4-1).
|
|
9
|
+
* - A hidden page is not rendered: its view is first called when it is first shown, and a page
|
|
10
|
+
* shown again renders only if its inputs changed meanwhile (G-121; D172: no `lazy` prop).
|
|
11
|
+
* - An `isolatedState` page owns its state (a local cell), whatever the Switchable's `state` is,
|
|
12
|
+
* so it never sees a state-bound sibling's slice, nor they its local state (G-292).
|
|
13
|
+
* - D83: the current page shown with another `instance` than it last had is disposed and made
|
|
14
|
+
* again (fresh local state, DISPOSE / BOOTSTRAP); a page never shown adopts the first one.
|
|
15
|
+
* - Its output is the current page's vnode (the page's own DOM scope); READY stays out, as today
|
|
16
|
+
* (the owner treats the Switchable as ready).
|
|
17
|
+
*/
|
|
18
|
+
import {hosts} from '../registry'
|
|
19
|
+
import {resolve} from './collection'
|
|
20
|
+
import {Inst, shallowEq} from '../instance'
|
|
21
|
+
import {Cell, keyCell, lensCell, localCell} from '../cell'
|
|
22
|
+
import {isObj} from '../define'
|
|
23
|
+
import {uidPart} from '../../shared'
|
|
24
|
+
import {error as logError, fail} from '../../extra/diagnostics/legacy'
|
|
25
|
+
|
|
26
|
+
/** `view`: the page component as given; `fn`: as resolved (a lazy() page: the loaded one, G-317) */
|
|
27
|
+
interface Page { inst: Inst; i: any; view: any; fn: any }
|
|
28
|
+
|
|
29
|
+
const OF_FIX = 'Use of={{ name: Component }}', CUR_FIX = "Set current to a key of 'of'"
|
|
30
|
+
|
|
31
|
+
/** today's addComponent checks (thrown: the owner renders its error fallback, SYG408) */
|
|
32
|
+
function check(owner: Inst, props: Record<string, any>) {
|
|
33
|
+
const of = props.of
|
|
34
|
+
if (!of) fail('SYG415', owner, "Switchable is missing 'of'", OF_FIX)
|
|
35
|
+
if (!isObj(of)) fail('SYG415', owner, `Switchable 'of' is a ${typeof of}`, OF_FIX)
|
|
36
|
+
if (!Object.values(of).every(c => typeof c == 'function')) fail('SYG415', owner, "Switchable 'of' has a value that is not a component", OF_FIX)
|
|
37
|
+
const cur = props.current
|
|
38
|
+
if (!cur || typeof cur != 'string') fail('SYG416', owner, `Switchable 'current' is missing or a ${typeof cur}`, CUR_FIX)
|
|
39
|
+
if (!(cur in of)) fail('SYG416', owner, `Switchable 'current' '${cur}' is not a key of 'of'`, CUR_FIX)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** a page's props: the Switchable's, kept by identity while equal (`of` compared shallowly) */
|
|
43
|
+
function sameProps(a: any, b: any) {
|
|
44
|
+
if (!a || !b) return false
|
|
45
|
+
const ka = Object.keys(a)
|
|
46
|
+
if (ka.length !== Object.keys(b).length) return false
|
|
47
|
+
for (const k of ka) if (a[k] !== b[k] && !(k == 'of' && shallowEq(a[k], b[k]))) return false
|
|
48
|
+
return true
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export class SwitchableHost {
|
|
52
|
+
pages: Record<string, Page> = {}
|
|
53
|
+
cell: Cell
|
|
54
|
+
cur!: string
|
|
55
|
+
ready = true
|
|
56
|
+
disposed = false
|
|
57
|
+
outv: any; last: any; lr = true
|
|
58
|
+
props: any
|
|
59
|
+
kids: any[] = []
|
|
60
|
+
uidBase: string
|
|
61
|
+
|
|
62
|
+
constructor(public owner: Inst, props: Record<string, any>, children: any[], id: string) {
|
|
63
|
+
check(owner, props)
|
|
64
|
+
const st = props.state, calc = typeof st == 'string' && owner.def.calcNames?.has(st)
|
|
65
|
+
this.cell = typeof st == 'string' ? keyCell(owner.cell, st, calc && owner.def.name, undefined, 'Switchable sub-component')
|
|
66
|
+
: st !== undefined ? lensCell(owner.cell, st, owner.def.name, (e) => owner.app.appError(owner, e, 'view'))
|
|
67
|
+
: owner.cell
|
|
68
|
+
this.uidBase = owner.uid(uidPart(id.replace(/.*::(r\.)?/, '')))
|
|
69
|
+
this.props = props
|
|
70
|
+
this.kids = children
|
|
71
|
+
for (const name in props.of) {
|
|
72
|
+
const view = props.of[name], fn = resolve(view, owner)
|
|
73
|
+
this.pages[name] = {inst: this.make(name, fn), i: undefined, view, fn}
|
|
74
|
+
}
|
|
75
|
+
this.setProps(props, children)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
make(name: string, view: any): Inst {
|
|
79
|
+
const o = this.owner, app = o.app, def = app.def(view), scope = app.scope()
|
|
80
|
+
const inst = new Inst(app, def, o, def.isolated ? localCell(app, this.cell) : this.cell, o.dom && o.dom.isolateSource(o.dom, scope),
|
|
81
|
+
this.props, this.kids, scope, this.uidBase + '-' + uidPart(name), 'page')
|
|
82
|
+
inst.shown = false
|
|
83
|
+
return inst
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
setProps(props: Record<string, any>, children: any[]) {
|
|
87
|
+
let cur = props.current
|
|
88
|
+
if (!(typeof cur == 'string' && cur in this.pages)) {
|
|
89
|
+
// (today this threw out of the owner's render; the core keeps the page shown)
|
|
90
|
+
logError('SYG416', this.owner, `Switchable 'current' '${cur}' is not a key of 'of'`, CUR_FIX)
|
|
91
|
+
cur = this.cur
|
|
92
|
+
}
|
|
93
|
+
if (!sameProps(props, this.props) || children !== this.kids) {
|
|
94
|
+
this.props = props
|
|
95
|
+
this.kids = children
|
|
96
|
+
for (const n in this.pages) this.pages[n].inst.setProps(props, children)
|
|
97
|
+
}
|
|
98
|
+
// G-317: a lazy() page that has loaded is made again with the loaded component
|
|
99
|
+
for (const n in this.pages) {
|
|
100
|
+
const p = this.pages[n], fn = resolve(p.view, this.owner)
|
|
101
|
+
if (fn !== p.fn) {
|
|
102
|
+
const shown = p.inst.shown
|
|
103
|
+
p.inst.dispose()
|
|
104
|
+
p.inst = this.make(n, p.fn = fn)
|
|
105
|
+
p.inst.shown = shown
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const page = this.pages[cur]
|
|
109
|
+
if (page) {
|
|
110
|
+
// D83: shown with another instance key than it was last shown with: made again
|
|
111
|
+
if (page.i !== undefined && page.i !== props.instance) {
|
|
112
|
+
page.inst.dispose()
|
|
113
|
+
page.inst = this.make(cur, page.fn)
|
|
114
|
+
}
|
|
115
|
+
page.i = props.instance
|
|
116
|
+
}
|
|
117
|
+
if (cur !== this.cur) {
|
|
118
|
+
if (this.cur !== undefined) this.pages[this.cur].inst.shown = false
|
|
119
|
+
this.cur = cur
|
|
120
|
+
}
|
|
121
|
+
if (page) page.inst.shown = true
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
insts(): Inst[] { return Object.values(this.pages).map(p => p.inst) }
|
|
125
|
+
|
|
126
|
+
/** only the current page renders (G-121); a hidden page keeps its last vnode and catches up when shown */
|
|
127
|
+
/** G-319: a hidden page's Collections follow their arrays (no view call) */
|
|
128
|
+
sync() {
|
|
129
|
+
if (!this.disposed) for (const n in this.pages) this.pages[n].inst.sync()
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
render(): any {
|
|
133
|
+
if (this.disposed) return this.outv
|
|
134
|
+
for (const n in this.pages) if (n !== this.cur) this.pages[n].inst.sync()
|
|
135
|
+
const page = this.pages[this.cur]
|
|
136
|
+
return (this.outv = page ? page.inst.render() : undefined)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
dispose() {
|
|
140
|
+
if (this.disposed) return
|
|
141
|
+
this.disposed = true
|
|
142
|
+
for (const n in this.pages) this.pages[n].inst.dispose()
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
hosts.switchable = (owner, props, children, id) => new SwitchableHost(owner, props, children, id)
|