@cratis/scene.react 4.15.0 → 4.17.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/core/ScreenplayCoreComponents.tsx +24 -3
- package/core/coreComponents.ts +2 -0
- package/core/coreDescriptors.ts +6 -0
- package/core/corePackage.ts +1 -0
- package/dist/cjs/SceneElementView.js +1 -0
- package/dist/cjs/SceneElementView.js.map +1 -1
- package/dist/cjs/core/ScreenplayCoreComponents.js +25 -5
- package/dist/cjs/core/ScreenplayCoreComponents.js.map +1 -1
- package/dist/cjs/core/coreComponents.js +3 -1
- package/dist/cjs/core/coreComponents.js.map +1 -1
- package/dist/cjs/core/coreDescriptors.js +16 -0
- package/dist/cjs/core/coreDescriptors.js.map +1 -1
- package/dist/cjs/core/corePackage.js +2 -1
- package/dist/cjs/core/corePackage.js.map +1 -1
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/navigation/CoreOutlet.js +32 -0
- package/dist/cjs/navigation/CoreOutlet.js.map +1 -0
- package/dist/cjs/navigation/SceneNavigationContext.js +2 -0
- package/dist/cjs/navigation/SceneNavigationContext.js.map +1 -1
- package/dist/cjs/navigation/SceneNavigationHost.js +46 -29
- package/dist/cjs/navigation/SceneNavigationHost.js.map +1 -1
- package/dist/cjs/navigation/SceneOutletContext.js +14 -0
- package/dist/cjs/navigation/SceneOutletContext.js.map +1 -0
- package/dist/cjs/navigation/collectOutletOwners.js +36 -0
- package/dist/cjs/navigation/collectOutletOwners.js.map +1 -0
- package/dist/cjs/navigation/createHashSceneHistory.js +43 -0
- package/dist/cjs/navigation/createHashSceneHistory.js.map +1 -0
- package/dist/cjs/navigation/placeInOutlet.js +65 -0
- package/dist/cjs/navigation/placeInOutlet.js.map +1 -0
- package/dist/cjs/navigation/useSceneHistoryNavigation.js +22 -6
- package/dist/cjs/navigation/useSceneHistoryNavigation.js.map +1 -1
- package/dist/cjs/renderer/useValueOutput.js +31 -0
- package/dist/cjs/renderer/useValueOutput.js.map +1 -0
- package/dist/cjs/renderer/valueOutputProperty.js +28 -0
- package/dist/cjs/renderer/valueOutputProperty.js.map +1 -0
- package/dist/esm/SceneElementView.js +1 -0
- package/dist/esm/SceneElementView.js.map +1 -1
- package/dist/esm/core/ScreenplayCoreComponents.d.ts.map +1 -1
- package/dist/esm/core/ScreenplayCoreComponents.js +25 -5
- package/dist/esm/core/ScreenplayCoreComponents.js.map +1 -1
- package/dist/esm/core/coreComponents.d.ts.map +1 -1
- package/dist/esm/core/coreComponents.js +3 -1
- package/dist/esm/core/coreComponents.js.map +1 -1
- package/dist/esm/core/coreDescriptors.d.ts.map +1 -1
- package/dist/esm/core/coreDescriptors.js +16 -0
- package/dist/esm/core/coreDescriptors.js.map +1 -1
- package/dist/esm/core/corePackage.d.ts.map +1 -1
- package/dist/esm/core/corePackage.js +2 -1
- package/dist/esm/core/corePackage.js.map +1 -1
- package/dist/esm/index.js +8 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/navigation/CoreOutlet.d.ts +3 -0
- package/dist/esm/navigation/CoreOutlet.d.ts.map +1 -0
- package/dist/esm/navigation/CoreOutlet.js +30 -0
- package/dist/esm/navigation/CoreOutlet.js.map +1 -0
- package/dist/esm/navigation/SceneNavigationContext.d.ts +3 -0
- package/dist/esm/navigation/SceneNavigationContext.d.ts.map +1 -1
- package/dist/esm/navigation/SceneNavigationContext.js +3 -2
- package/dist/esm/navigation/SceneNavigationContext.js.map +1 -1
- package/dist/esm/navigation/SceneNavigationHost.d.ts.map +1 -1
- package/dist/esm/navigation/SceneNavigationHost.js +47 -30
- package/dist/esm/navigation/SceneNavigationHost.js.map +1 -1
- package/dist/esm/navigation/SceneNavigationState.d.ts +2 -0
- package/dist/esm/navigation/SceneNavigationState.d.ts.map +1 -1
- package/dist/esm/navigation/SceneOutletContext.d.ts +9 -0
- package/dist/esm/navigation/SceneOutletContext.d.ts.map +1 -0
- package/dist/esm/navigation/SceneOutletContext.js +11 -0
- package/dist/esm/navigation/SceneOutletContext.js.map +1 -0
- package/dist/esm/navigation/collectOutletOwners.d.ts +4 -0
- package/dist/esm/navigation/collectOutletOwners.d.ts.map +1 -0
- package/dist/esm/navigation/collectOutletOwners.js +33 -0
- package/dist/esm/navigation/collectOutletOwners.js.map +1 -0
- package/dist/esm/navigation/createHashSceneHistory.d.ts +4 -0
- package/dist/esm/navigation/createHashSceneHistory.d.ts.map +1 -0
- package/dist/esm/navigation/createHashSceneHistory.js +41 -0
- package/dist/esm/navigation/createHashSceneHistory.js.map +1 -0
- package/dist/esm/navigation/index.d.ts +5 -0
- package/dist/esm/navigation/index.d.ts.map +1 -1
- package/dist/esm/navigation/index.js +5 -0
- package/dist/esm/navigation/index.js.map +1 -1
- package/dist/esm/navigation/placeInOutlet.d.ts +4 -0
- package/dist/esm/navigation/placeInOutlet.d.ts.map +1 -0
- package/dist/esm/navigation/placeInOutlet.js +63 -0
- package/dist/esm/navigation/placeInOutlet.js.map +1 -0
- package/dist/esm/navigation/useSceneHistoryNavigation.d.ts +2 -1
- package/dist/esm/navigation/useSceneHistoryNavigation.d.ts.map +1 -1
- package/dist/esm/navigation/useSceneHistoryNavigation.js +22 -6
- package/dist/esm/navigation/useSceneHistoryNavigation.js.map +1 -1
- package/dist/esm/renderer/index.d.ts +2 -0
- package/dist/esm/renderer/index.d.ts.map +1 -1
- package/dist/esm/renderer/index.js +2 -0
- package/dist/esm/renderer/index.js.map +1 -1
- package/dist/esm/renderer/useValueOutput.d.ts +4 -0
- package/dist/esm/renderer/useValueOutput.d.ts.map +1 -0
- package/dist/esm/renderer/useValueOutput.js +28 -0
- package/dist/esm/renderer/useValueOutput.js.map +1 -0
- package/dist/esm/renderer/valueOutputProperty.d.ts +3 -0
- package/dist/esm/renderer/valueOutputProperty.d.ts.map +1 -0
- package/dist/esm/renderer/valueOutputProperty.js +26 -0
- package/dist/esm/renderer/valueOutputProperty.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/navigation/CoreOutlet.tsx +26 -0
- package/navigation/SceneNavigationContext.tsx +10 -0
- package/navigation/SceneNavigationHost.tsx +12 -6
- package/navigation/SceneNavigationState.ts +13 -0
- package/navigation/SceneOutletContext.tsx +19 -0
- package/navigation/collectOutletOwners.ts +30 -0
- package/navigation/createHashSceneHistory.ts +42 -0
- package/navigation/index.ts +5 -0
- package/navigation/placeInOutlet.ts +68 -0
- package/navigation/useSceneHistoryNavigation.ts +20 -5
- package/package.json +5 -5
- package/renderer/index.ts +2 -0
- package/renderer/useValueOutput.ts +28 -0
- package/renderer/valueOutputProperty.ts +25 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneNavigationHost.js","sources":["../../../navigation/SceneNavigationHost.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useMemo, useState } from 'react';\nimport { BindingScope } from '@cratis/scene.engine';\nimport { DestinationReference, SceneElement } from '@cratis/scene.model';\nimport { SceneElementView } from '../SceneElementView';\nimport { ComponentRegistry } from '../renderer';\nimport { createMemorySceneHistory } from './createMemorySceneHistory';\nimport { SceneHistory } from './SceneHistory';\nimport { SceneNavigationProvider } from './SceneNavigationContext';\nimport { SceneRoute } from './SceneRoute';\nimport { sceneRoutesFrom } from './sceneRoutesFrom';\nimport { useSceneHistoryNavigation } from './useSceneHistoryNavigation';\n\nexport interface SceneNavigationHostProps {\n screens: Record<string, SceneElement>;\n dialogs?: Record<string, SceneElement>;\n initialScreen: string;\n registry: ComponentRegistry;\n bindingScope?: BindingScope;\n\n /**\n * Where entries are recorded. `createBrowserSceneHistory()` drives the address bar, so deep links,\n * refresh and back/forward work; the default is an in-memory history for embedded hosts.\n */\n history?: SceneHistory;\n\n /** The destinations the application navigates to, so their route overrides can be deep linked. */\n destinations?: DestinationReference[];\n\n /** An explicit route table, used instead of the one derived from `screens` and `destinations`. */\n routes?: SceneRoute[];\n}\n\n/**\n * Executes Scene destinations against an in-memory rendered hierarchy: screen
|
|
1
|
+
{"version":3,"file":"SceneNavigationHost.js","sources":["../../../navigation/SceneNavigationHost.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useMemo, useState } from 'react';\nimport { BindingScope } from '@cratis/scene.engine';\nimport { DestinationReference, SceneElement } from '@cratis/scene.model';\nimport { SceneElementView } from '../SceneElementView';\nimport { ComponentRegistry } from '../renderer';\nimport { createMemorySceneHistory } from './createMemorySceneHistory';\nimport { SceneHistory } from './SceneHistory';\nimport { SceneNavigationProvider } from './SceneNavigationContext';\nimport { SceneRoute } from './SceneRoute';\nimport { sceneRoutesFrom } from './sceneRoutesFrom';\nimport { collectOutletOwners } from './collectOutletOwners';\nimport { SceneOutletContext } from './SceneOutletContext';\nimport { useSceneHistoryNavigation } from './useSceneHistoryNavigation';\n\nexport interface SceneNavigationHostProps {\n screens: Record<string, SceneElement>;\n dialogs?: Record<string, SceneElement>;\n initialScreen: string;\n registry: ComponentRegistry;\n bindingScope?: BindingScope;\n\n /**\n * Where entries are recorded. `createBrowserSceneHistory()` drives the address bar, so deep links,\n * refresh and back/forward work; the default is an in-memory history for embedded hosts.\n */\n history?: SceneHistory;\n\n /** The destinations the application navigates to, so their route overrides can be deep linked. */\n destinations?: DestinationReference[];\n\n /** An explicit route table, used instead of the one derived from `screens` and `destinations`. */\n routes?: SceneRoute[];\n}\n\n/**\n * Executes Scene destinations against an in-memory rendered hierarchy: a destination into a nested outlet -\n * one a screen declares with `core:outlet` - places its screen there and keeps the screens above it, to any\n * depth; any other screen route replaces the primary region,\n * dialog destinations render dialog content over the screen that opened them, and external destinations\n * only report their resolved action. Every navigation is a history entry.\n */\nexport function SceneNavigationHost({ screens, dialogs = {}, initialScreen, registry, bindingScope = {}, history, destinations, routes }: SceneNavigationHostProps) {\n const [memoryHistory] = useState(() => createMemorySceneHistory());\n const routeTable = useMemo(() => routes ?? sceneRoutesFrom(Object.keys(screens), destinations), [destinations, routes, screens]);\n const outletOwners = useMemo(() => collectOutletOwners(screens), [screens]);\n const value = useSceneHistoryNavigation(history ?? memoryHistory, routeTable, initialScreen, bindingScope, outletOwners, destinations);\n const outletContext = useMemo(() => ({ screens, registry }), [registry, screens]);\n\n const screen = screens[value.primaryScreen];\n const dialog = value.currentDialog ? dialogs[value.currentDialog] : undefined;\n\n return <SceneNavigationProvider value={value}><SceneOutletContext.Provider value={outletContext}>\n <div data-scene-outlet={value.primaryScreen === value.currentScreen ? value.currentOutlet ?? 'primary' : 'primary'} data-scene-url={value.currentUrl}>\n {screen && <SceneElementView element={screen} registry={registry} dataContext={bindingScope.dataContext} queryResults={bindingScope.queryResults} componentOutputs={bindingScope.componentOutputs} />}\n </div>\n {dialog && <div role='dialog' aria-modal='true' aria-label={value.currentDialog} data-scene-dialog={value.currentDialog}>\n <SceneElementView element={dialog} registry={registry} dataContext={bindingScope.dataContext} queryResults={bindingScope.queryResults} componentOutputs={bindingScope.componentOutputs} />\n </div>}\n </SceneOutletContext.Provider></SceneNavigationProvider>;\n}\n"],"names":["SceneNavigationHost","screens","dialogs","initialScreen","registry","bindingScope","history","destinations","routes","memoryHistory","useState","createMemorySceneHistory","routeTable","useMemo","sceneRoutesFrom","Object","keys","outletOwners","collectOutletOwners","value","useSceneHistoryNavigation","outletContext","screen","primaryScreen","dialog","currentDialog","undefined","_jsx","SceneNavigationProvider","_jsxs","SceneOutletContext","Provider","div","data-scene-outlet","currentScreen","currentOutlet","data-scene-url","currentUrl","SceneElementView","element","dataContext","queryResults","componentOutputs","role","aria-modal","aria-label","data-scene-dialog"],"mappings":";;;;;;;;;;;;AAqCA;;;;;;IAOO,SAASA,mBAAAA,CAAoB,EAAEC,OAAO,EAAEC,OAAAA,GAAU,EAAE,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,YAAAA,GAAe,EAAE,EAAEC,OAAO,EAAEC,YAAY,EAAEC,MAAM,EAA4B,EAAA;AAC9J,IA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AA,EAAgBjB,MAAMkB,UAAU;AAC/If,oBAAAA,QAAAA,EAAAA,MAAAA,kBAAUK,cAAA,CAACW,iCAAAA,EAAAA;wBAAiBC,OAAAA,EAASjB,MAAAA;wBAAQlB,QAAAA,EAAUA,QAAAA;AAAUoC,wBAAAA,WAAAA,EAAanC,aAAamC,WAAW;AAAEC,wBAAAA,YAAAA,EAAcpC,aAAaoC,YAAY;AAAEC,wBAAAA,gBAAAA,EAAkBrC,aAAaqC;;;AAEpLlB,gBAAAA,MAAAA,kBAAUG,cAAA,CAACK,KAAAA,EAAAA;oBAAIW,IAAAA,EAAK,QAAA;oBAASC,YAAAA,EAAW,MAAA;AAAOC,oBAAAA,YAAAA,EAAY1B,MAAMM,aAAa;AAAEqB,oBAAAA,mBAAAA,EAAmB3B,MAAMM,aAAa;AACnH,oBAAA,QAAA,gBAAAE,cAAA,CAACW,iCAAAA,EAAAA;wBAAiBC,OAAAA,EAASf,MAAAA;wBAAQpB,QAAAA,EAAUA,QAAAA;AAAUoC,wBAAAA,WAAAA,EAAanC,aAAamC,WAAW;AAAEC,wBAAAA,YAAAA,EAAcpC,aAAaoC,YAAY;AAAEC,wBAAAA,gBAAAA,EAAkBrC,aAAaqC;;;;;;AAGlL;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
|
|
5
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
6
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
7
|
+
const SceneOutletContext = /*#__PURE__*/ react.createContext(undefined);
|
|
8
|
+
/** The screens and registry of the enclosing navigation host, or undefined outside one. */ function useSceneOutlets() {
|
|
9
|
+
return react.useContext(SceneOutletContext);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.SceneOutletContext = SceneOutletContext;
|
|
13
|
+
exports.useSceneOutlets = useSceneOutlets;
|
|
14
|
+
//# sourceMappingURL=SceneOutletContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SceneOutletContext.js","sources":["../../../navigation/SceneOutletContext.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { createContext, useContext } from 'react';\nimport { SceneElement } from '@cratis/scene.model';\nimport { ComponentRegistry } from '../renderer';\n\n/** What a nested outlet needs to render the screen placed in it. */\nexport interface SceneOutletContextValue {\n screens: Record<string, SceneElement>;\n registry: ComponentRegistry;\n}\n\nexport const SceneOutletContext = createContext<SceneOutletContextValue | undefined>(undefined);\n\n/** The screens and registry of the enclosing navigation host, or undefined outside one. */\nexport function useSceneOutlets(): SceneOutletContextValue | undefined {\n return useContext(SceneOutletContext);\n}\n"],"names":["SceneOutletContext","createContext","undefined","useSceneOutlets","useContext"],"mappings":";;;;AAAA;AACA;AAYO,MAAMA,kBAAAA,iBAAqBC,mBAAAA,CAAmDC,SAAAA;AAErF,4FACO,SAASC,eAAAA,GAAAA;AACZ,IAAA,OAAOC,gBAAAA,CAAWJ,kBAAAA,CAAAA;AACtB;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/** The registry key of the component that declares a nested outlet. */ const outletComponentName = 'core:outlet';
|
|
6
|
+
/**
|
|
7
|
+
* Which screen declares each nested outlet: every `core:outlet` element, by its `name`, mapped to the screen
|
|
8
|
+
* whose tree contains it. A screen that declares an outlet another screen also declares keeps the first one,
|
|
9
|
+
* in screen order - the same rule navigation diagnostics report as a duplicate outlet.
|
|
10
|
+
*/ function collectOutletOwners(screens) {
|
|
11
|
+
const owners = {};
|
|
12
|
+
for (const [screen, element] of Object.entries(screens)){
|
|
13
|
+
for (const outlet of outletNames(element)){
|
|
14
|
+
if (!(outlet in owners)) owners[outlet] = screen;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return owners;
|
|
18
|
+
}
|
|
19
|
+
function outletNames(element) {
|
|
20
|
+
const node = element;
|
|
21
|
+
const own = node.componentName === outletComponentName && typeof node.properties?.name === 'string' ? [
|
|
22
|
+
node.properties.name
|
|
23
|
+
] : [];
|
|
24
|
+
const children = [
|
|
25
|
+
...Object.values(node.slots ?? {}).flat(),
|
|
26
|
+
...Array.isArray(node.children) ? node.children : []
|
|
27
|
+
];
|
|
28
|
+
return [
|
|
29
|
+
...own,
|
|
30
|
+
...children.flatMap(outletNames)
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
exports.collectOutletOwners = collectOutletOwners;
|
|
35
|
+
exports.outletComponentName = outletComponentName;
|
|
36
|
+
//# sourceMappingURL=collectOutletOwners.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectOutletOwners.js","sources":["../../../navigation/collectOutletOwners.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SceneElement } from '@cratis/scene.model';\n\n/** The registry key of the component that declares a nested outlet. */\nexport const outletComponentName = 'core:outlet';\n\n/**\n * Which screen declares each nested outlet: every `core:outlet` element, by its `name`, mapped to the screen\n * whose tree contains it. A screen that declares an outlet another screen also declares keeps the first one,\n * in screen order - the same rule navigation diagnostics report as a duplicate outlet.\n */\nexport function collectOutletOwners(screens: Record<string, SceneElement>): Record<string, string> {\n const owners: Record<string, string> = {};\n for (const [screen, element] of Object.entries(screens)) {\n for (const outlet of outletNames(element)) {\n if (!(outlet in owners)) owners[outlet] = screen;\n }\n }\n\n return owners;\n}\n\nfunction outletNames(element: SceneElement): string[] {\n const node = element as { componentName?: string; properties?: Record<string, unknown>; slots?: Record<string, SceneElement[]>; children?: SceneElement[] };\n const own = node.componentName === outletComponentName && typeof node.properties?.name === 'string' ? [node.properties.name] : [];\n const children = [...Object.values(node.slots ?? {}).flat(), ...(Array.isArray(node.children) ? node.children : [])];\n return [...own, ...children.flatMap(outletNames)];\n}\n"],"names":["outletComponentName","collectOutletOwners","screens","owners","screen","element","Object","entries","outlet","outletNames","node","own","componentName","properties","name","children","values","slots","flat","Array","isArray","flatMap"],"mappings":";;AAAA;AACA;AAIA,wEACO,MAAMA,mBAAAA,GAAsB;AAEnC;;;;IAKO,SAASC,mBAAAA,CAAoBC,OAAqC,EAAA;AACrE,IAAA,MAAMC,SAAiC,EAAC;IACxC,KAAK,MAAM,CAACC,MAAAA,EAAQC,OAAAA,CAAQ,IAAIC,MAAAA,CAAOC,OAAO,CAACL,OAAAA,CAAAA,CAAU;QACrD,KAAK,MAAMM,MAAAA,IAAUC,WAAAA,CAAYJ,OAAAA,CAAAA,CAAU;YACvC,IAAI,EAAEG,MAAAA,IAAUL,MAAK,GAAIA,MAAM,CAACK,OAAO,GAAGJ,MAAAA;AAC9C,QAAA;AACJ,IAAA;IAEA,OAAOD,MAAAA;AACX;AAEA,SAASM,YAAYJ,OAAqB,EAAA;AACtC,IAAA,MAAMK,IAAAA,GAAOL,OAAAA;IACb,MAAMM,GAAAA,GAAMD,IAAAA,CAAKE,aAAa,KAAKZ,mBAAAA,IAAuB,OAAOU,IAAAA,CAAKG,UAAU,EAAEC,IAAAA,KAAS,QAAA,GAAW;QAACJ,IAAAA,CAAKG,UAAU,CAACC;AAAK,KAAA,GAAG,EAAE;AACjI,IAAA,MAAMC,QAAAA,GAAW;AAAIT,QAAAA,GAAAA,MAAAA,CAAOU,MAAM,CAACN,IAAAA,CAAKO,KAAK,IAAI,IAAIC,IAAI,EAAA;WAAQC,KAAAA,CAAMC,OAAO,CAACV,IAAAA,CAAKK,QAAQ,IAAIL,IAAAA,CAAKK,QAAQ,GAAG;AAAI,KAAA;IACpH,OAAO;AAAIJ,QAAAA,GAAAA,GAAAA;AAAQI,QAAAA,GAAAA,QAAAA,CAASM,OAAO,CAACZ,WAAAA;AAAa,KAAA;AACrD;;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
const stateKey = 'sceneNavigation';
|
|
6
|
+
/**
|
|
7
|
+
* A history kept in the URL fragment - `index.html#/WorkItemDetails?workItemId=B` - for hosts that are served
|
|
8
|
+
* as a single file or from a path they do not control, such as a generated runtime or a webview. It behaves
|
|
9
|
+
* like `createBrowserSceneHistory`: entries are pushed with their navigation state, back and forward restore
|
|
10
|
+
* them, and a typed or bookmarked fragment is matched by URL alone. A fragment changed by hand, which fires
|
|
11
|
+
* `hashchange` rather than `popstate`, is reported the same way.
|
|
12
|
+
*/ function createHashSceneHistory(browser = window) {
|
|
13
|
+
const location = ()=>{
|
|
14
|
+
const fragment = browser.location.hash.replace(/^#\/?/, '');
|
|
15
|
+
return fragment.length ? fragment : undefined;
|
|
16
|
+
};
|
|
17
|
+
const href = (url)=>`${browser.location.pathname}${browser.location.search}#/${url ?? ''}`;
|
|
18
|
+
const stored = (value)=>value?.[stateKey];
|
|
19
|
+
return {
|
|
20
|
+
location,
|
|
21
|
+
state: ()=>stored(browser.history.state),
|
|
22
|
+
push: (state)=>browser.history.pushState({
|
|
23
|
+
[stateKey]: state
|
|
24
|
+
}, '', href(state.url)),
|
|
25
|
+
replace: (state)=>browser.history.replaceState({
|
|
26
|
+
[stateKey]: state
|
|
27
|
+
}, '', href(state.url)),
|
|
28
|
+
back: ()=>browser.history.back(),
|
|
29
|
+
listen: (listener)=>{
|
|
30
|
+
const onPopState = (event)=>listener(location(), stored(event.state));
|
|
31
|
+
const onHashChange = ()=>listener(location(), stored(browser.history.state));
|
|
32
|
+
browser.addEventListener('popstate', onPopState);
|
|
33
|
+
browser.addEventListener('hashchange', onHashChange);
|
|
34
|
+
return ()=>{
|
|
35
|
+
browser.removeEventListener('popstate', onPopState);
|
|
36
|
+
browser.removeEventListener('hashchange', onHashChange);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.createHashSceneHistory = createHashSceneHistory;
|
|
43
|
+
//# sourceMappingURL=createHashSceneHistory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createHashSceneHistory.js","sources":["../../../navigation/createHashSceneHistory.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SceneBrowserWindow } from './createBrowserSceneHistory';\nimport { SceneHistory } from './SceneHistory';\nimport { SceneNavigationState } from './SceneNavigationState';\n\nconst stateKey = 'sceneNavigation';\n\n/**\n * A history kept in the URL fragment - `index.html#/WorkItemDetails?workItemId=B` - for hosts that are served\n * as a single file or from a path they do not control, such as a generated runtime or a webview. It behaves\n * like `createBrowserSceneHistory`: entries are pushed with their navigation state, back and forward restore\n * them, and a typed or bookmarked fragment is matched by URL alone. A fragment changed by hand, which fires\n * `hashchange` rather than `popstate`, is reported the same way.\n */\nexport function createHashSceneHistory(browser: SceneBrowserWindow = window): SceneHistory {\n const location = () => {\n const fragment = browser.location.hash.replace(/^#\\/?/, '');\n return fragment.length ? fragment : undefined;\n };\n const href = (url: string | undefined) => `${browser.location.pathname}${browser.location.search}#/${url ?? ''}`;\n const stored = (value: unknown) => (value as Record<string, SceneNavigationState> | null)?.[stateKey];\n\n return {\n location,\n state: () => stored(browser.history.state),\n push: state => browser.history.pushState({ [stateKey]: state }, '', href(state.url)),\n replace: state => browser.history.replaceState({ [stateKey]: state }, '', href(state.url)),\n back: () => browser.history.back(),\n listen: listener => {\n const onPopState = (event: PopStateEvent) => listener(location(), stored(event.state));\n const onHashChange = () => listener(location(), stored(browser.history.state));\n browser.addEventListener('popstate', onPopState);\n browser.addEventListener('hashchange', onHashChange);\n return () => {\n browser.removeEventListener('popstate', onPopState);\n browser.removeEventListener('hashchange', onHashChange);\n };\n },\n };\n}\n"],"names":["stateKey","createHashSceneHistory","browser","window","location","fragment","hash","replace","length","undefined","href","url","pathname","search","stored","value","state","history","push","pushState","replaceState","back","listen","listener","onPopState","event","onHashChange","addEventListener","removeEventListener"],"mappings":";;AAAA;AACA;AAMA,MAAMA,QAAAA,GAAW,iBAAA;AAEjB;;;;;;AAMC,IACM,SAASC,sBAAAA,CAAuBC,OAAAA,GAA8BC,MAAM,EAAA;AACvE,IAAA,MAAMC,QAAAA,GAAW,IAAA;QACb,MAAMC,QAAAA,GAAWH,QAAQE,QAAQ,CAACE,IAAI,CAACC,OAAO,CAAC,OAAA,EAAS,EAAA,CAAA;QACxD,OAAOF,QAAAA,CAASG,MAAM,GAAGH,QAAAA,GAAWI,SAAAA;AACxC,IAAA,CAAA;AACA,IAAA,MAAMC,OAAO,CAACC,GAAAA,GAA4B,CAAA,EAAGT,OAAAA,CAAQE,QAAQ,CAACQ,QAAQ,CAAA,EAAGV,OAAAA,CAAQE,QAAQ,CAACS,MAAM,CAAC,EAAE,EAAEF,OAAO,EAAA,CAAA,CAAI;AAChH,IAAA,MAAMG,MAAAA,GAAS,CAACC,KAAAA,GAAoBA,KAAAA,GAAwDf,QAAAA,CAAS;IAErG,OAAO;AACHI,QAAAA,QAAAA;AACAY,QAAAA,KAAAA,EAAO,IAAMF,MAAAA,CAAOZ,OAAAA,CAAQe,OAAO,CAACD,KAAK,CAAA;AACzCE,QAAAA,IAAAA,EAAMF,CAAAA,KAAAA,GAASd,OAAAA,CAAQe,OAAO,CAACE,SAAS,CAAC;AAAE,gBAAA,CAACnB,WAAWgB;aAAM,EAAG,EAAA,EAAIN,IAAAA,CAAKM,KAAAA,CAAML,GAAG,CAAA,CAAA;AAClFJ,QAAAA,OAAAA,EAASS,CAAAA,KAAAA,GAASd,OAAAA,CAAQe,OAAO,CAACG,YAAY,CAAC;AAAE,gBAAA,CAACpB,WAAWgB;aAAM,EAAG,EAAA,EAAIN,IAAAA,CAAKM,KAAAA,CAAML,GAAG,CAAA,CAAA;AACxFU,QAAAA,IAAAA,EAAM,IAAMnB,OAAAA,CAAQe,OAAO,CAACI,IAAI,EAAA;AAChCC,QAAAA,MAAAA,EAAQC,CAAAA,QAAAA,GAAAA;AACJ,YAAA,MAAMC,aAAa,CAACC,KAAAA,GAAyBF,SAASnB,QAAAA,EAAAA,EAAYU,MAAAA,CAAOW,MAAMT,KAAK,CAAA,CAAA;YACpF,MAAMU,YAAAA,GAAe,IAAMH,QAAAA,CAASnB,QAAAA,EAAAA,EAAYU,OAAOZ,OAAAA,CAAQe,OAAO,CAACD,KAAK,CAAA,CAAA;YAC5Ed,OAAAA,CAAQyB,gBAAgB,CAAC,UAAA,EAAYH,UAAAA,CAAAA;YACrCtB,OAAAA,CAAQyB,gBAAgB,CAAC,YAAA,EAAcD,YAAAA,CAAAA;YACvC,OAAO,IAAA;gBACHxB,OAAAA,CAAQ0B,mBAAmB,CAAC,UAAA,EAAYJ,UAAAA,CAAAA;gBACxCtB,OAAAA,CAAQ0B,mBAAmB,CAAC,YAAA,EAAcF,YAAAA,CAAAA;AAC9C,YAAA,CAAA;AACJ,QAAA;AACJ,KAAA;AACJ;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
|
+
/** The most levels of nesting a placement follows before it stops, so a cyclic model cannot loop forever. */ const maximumDepth = 32;
|
|
6
|
+
/**
|
|
7
|
+
* Places a screen, recursively composing nested outlets.
|
|
8
|
+
*
|
|
9
|
+
* When `outlet` is a nested outlet - one a screen declares with `core:outlet` - the screen goes into it, and
|
|
10
|
+
* the screen that declares it is placed first: where it already is, or, when it is not on the page, where a
|
|
11
|
+
* known destination puts it, up to the primary region. Outlets declared by screens that are no longer on the
|
|
12
|
+
* page are dropped. Any other outlet replaces the primary region and clears every nested placement.
|
|
13
|
+
*/ function placeInOutlet(current, screen, outlet, owners, destinations = []) {
|
|
14
|
+
const primary = current.primary ?? current.screen;
|
|
15
|
+
const placements = {
|
|
16
|
+
...current.outlets ?? {}
|
|
17
|
+
};
|
|
18
|
+
let root = primary;
|
|
19
|
+
let target = {
|
|
20
|
+
screen,
|
|
21
|
+
outlet
|
|
22
|
+
};
|
|
23
|
+
for(let depth = 0; target && depth < maximumDepth; depth++){
|
|
24
|
+
const owner = target.outlet === undefined ? undefined : owners[target.outlet];
|
|
25
|
+
if (owner === undefined) {
|
|
26
|
+
root = target.screen;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
placements[target.outlet] = target.screen;
|
|
30
|
+
if (isOnPage(owner, root, placements, owners)) break;
|
|
31
|
+
target = {
|
|
32
|
+
screen: owner,
|
|
33
|
+
outlet: destinations.find((destination)=>destination.screen === owner && destination.outlet)?.outlet
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
primary: root,
|
|
38
|
+
outlets: reachable(root, placements, owners)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Whether a screen is the root or shown in an outlet reachable from it. */ function isOnPage(screen, root, placements, owners) {
|
|
42
|
+
return screen === root || Object.values(reachable(root, placements, owners)).includes(screen);
|
|
43
|
+
}
|
|
44
|
+
/** Only the placements reachable from the root through the outlets each placed screen declares. */ function reachable(root, placements, owners) {
|
|
45
|
+
const kept = {};
|
|
46
|
+
const pending = [
|
|
47
|
+
root
|
|
48
|
+
];
|
|
49
|
+
const seen = new Set();
|
|
50
|
+
while(pending.length > 0){
|
|
51
|
+
const screen = pending.shift();
|
|
52
|
+
if (seen.has(screen)) continue;
|
|
53
|
+
seen.add(screen);
|
|
54
|
+
for (const [outlet, placed] of Object.entries(placements)){
|
|
55
|
+
if (owners[outlet] === screen) {
|
|
56
|
+
kept[outlet] = placed;
|
|
57
|
+
pending.push(placed);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return kept;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
exports.placeInOutlet = placeInOutlet;
|
|
65
|
+
//# sourceMappingURL=placeInOutlet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placeInOutlet.js","sources":["../../../navigation/placeInOutlet.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DestinationReference } from '@cratis/scene.model';\nimport { SceneNavigationState } from './SceneNavigationState';\n\n/** The most levels of nesting a placement follows before it stops, so a cyclic model cannot loop forever. */\nconst maximumDepth = 32;\n\n/**\n * Places a screen, recursively composing nested outlets.\n *\n * When `outlet` is a nested outlet - one a screen declares with `core:outlet` - the screen goes into it, and\n * the screen that declares it is placed first: where it already is, or, when it is not on the page, where a\n * known destination puts it, up to the primary region. Outlets declared by screens that are no longer on the\n * page are dropped. Any other outlet replaces the primary region and clears every nested placement.\n */\nexport function placeInOutlet(\n current: SceneNavigationState,\n screen: string,\n outlet: string | undefined,\n owners: Record<string, string>,\n destinations: DestinationReference[] = [],\n): Pick<SceneNavigationState, 'primary' | 'outlets'> {\n const primary = current.primary ?? current.screen;\n const placements: Record<string, string> = { ...(current.outlets ?? {}) };\n let root = primary;\n\n let target: { screen: string; outlet: string | undefined } | undefined = { screen, outlet };\n for (let depth = 0; target && depth < maximumDepth; depth++) {\n const owner = target.outlet === undefined ? undefined : owners[target.outlet];\n if (owner === undefined) {\n root = target.screen;\n break;\n }\n\n placements[target.outlet!] = target.screen;\n if (isOnPage(owner, root, placements, owners)) break;\n target = { screen: owner, outlet: destinations.find(destination => destination.screen === owner && destination.outlet)?.outlet };\n }\n\n return { primary: root, outlets: reachable(root, placements, owners) };\n}\n\n/** Whether a screen is the root or shown in an outlet reachable from it. */\nfunction isOnPage(screen: string, root: string, placements: Record<string, string>, owners: Record<string, string>): boolean {\n return screen === root || Object.values(reachable(root, placements, owners)).includes(screen);\n}\n\n/** Only the placements reachable from the root through the outlets each placed screen declares. */\nfunction reachable(root: string, placements: Record<string, string>, owners: Record<string, string>): Record<string, string> {\n const kept: Record<string, string> = {};\n const pending = [root];\n const seen = new Set<string>();\n while (pending.length > 0) {\n const screen = pending.shift()!;\n if (seen.has(screen)) continue;\n seen.add(screen);\n for (const [outlet, placed] of Object.entries(placements)) {\n if (owners[outlet] === screen) {\n kept[outlet] = placed;\n pending.push(placed);\n }\n }\n }\n\n return kept;\n}\n"],"names":["maximumDepth","placeInOutlet","current","screen","outlet","owners","destinations","primary","placements","outlets","root","target","depth","owner","undefined","isOnPage","find","destination","reachable","Object","values","includes","kept","pending","seen","Set","length","shift","has","add","placed","entries","push"],"mappings":";;AAAA;AACA;AAKA,8GACA,MAAMA,YAAAA,GAAe,EAAA;AAErB;;;;;;;AAOC,IACM,SAASC,aAAAA,CACZC,OAA6B,EAC7BC,MAAc,EACdC,MAA0B,EAC1BC,MAA8B,EAC9BC,YAAAA,GAAuC,EAAE,EAAA;AAEzC,IAAA,MAAMC,OAAAA,GAAUL,OAAAA,CAAQK,OAAO,IAAIL,QAAQC,MAAM;AACjD,IAAA,MAAMK,UAAAA,GAAqC;AAAE,QAAA,GAAIN,OAAAA,CAAQO,OAAO,IAAI;AAAI,KAAA;AACxE,IAAA,IAAIC,IAAAA,GAAOH,OAAAA;AAEX,IAAA,IAAII,MAAAA,GAAqE;AAAER,QAAAA,MAAAA;AAAQC,QAAAA;AAAO,KAAA;AAC1F,IAAA,IAAK,IAAIQ,KAAAA,GAAQ,CAAA,EAAGD,MAAAA,IAAUC,KAAAA,GAAQZ,cAAcY,KAAAA,EAAAA,CAAS;QACzD,MAAMC,KAAAA,GAAQF,MAAAA,CAAOP,MAAM,KAAKU,SAAAA,GAAYA,YAAYT,MAAM,CAACM,MAAAA,CAAOP,MAAM,CAAC;AAC7E,QAAA,IAAIS,UAAUC,SAAAA,EAAW;AACrBJ,YAAAA,IAAAA,GAAOC,OAAOR,MAAM;AACpB,YA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AM,CAACC,MAAAA,EAAQ0B,MAAAA,CAAO,IAAIX,MAAAA,CAAOY,OAAO,CAACvB,UAAAA,CAAAA,CAAa;AACvD,YAAA,IAAIH,MAAM,CAACD,MAAAA,CAAO,KAAKD,MAAAA,EAAQ;gBAC3BmB,IAAI,CAAClB,OAAO,GAAG0B,MAAAA;AACfP,gBAAAA,OAAAA,CAAQS,IAAI,CAACF,MAAAA,CAAAA;AACjB,YAAA;AACJ,QAAA;AACJ,IAAA;IAEA,OAAOR,IAAAA;AACX;;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var react = require('react');
|
|
4
4
|
var scene_model = require('@cratis/scene.model');
|
|
5
5
|
var matchSceneRoute = require('./matchSceneRoute.js');
|
|
6
|
+
var placeInOutlet = require('./placeInOutlet.js');
|
|
6
7
|
var resolveDestination = require('./resolveDestination.js');
|
|
7
8
|
|
|
8
9
|
// Copyright (c) Cratis. All rights reserved.
|
|
@@ -11,16 +12,24 @@ var resolveDestination = require('./resolveDestination.js');
|
|
|
11
12
|
* Keeps a navigation host's state in a {@link SceneHistory}: every navigation and every dialog is an entry,
|
|
12
13
|
* so back and forward step through them, a refresh restores the stored entry, and a deep link is matched
|
|
13
14
|
* against the route table. Closing a dialog goes back to the entry that opened it.
|
|
14
|
-
*/ function useSceneHistoryNavigation(history, routes, initialScreen, bindingScope) {
|
|
15
|
+
*/ function useSceneHistoryNavigation(history, routes, initialScreen, bindingScope, outletOwners = {}, destinations = []) {
|
|
15
16
|
const fromLocation = react.useCallback((url)=>{
|
|
16
17
|
const match = url ? matchSceneRoute.matchSceneRoute(url, routes) : undefined;
|
|
17
|
-
|
|
18
|
+
if (!match) return undefined;
|
|
19
|
+
const start = {
|
|
20
|
+
screen: initialScreen};
|
|
21
|
+
const placement = placeInOutlet.placeInOutlet(start, match.route.screen, match.route.outlet, outletOwners, destinations);
|
|
22
|
+
return {
|
|
18
23
|
screen: match.route.screen,
|
|
19
24
|
url,
|
|
20
25
|
outlet: match.route.outlet,
|
|
21
|
-
parameters: match.parameters
|
|
22
|
-
|
|
26
|
+
parameters: match.parameters,
|
|
27
|
+
...placement
|
|
28
|
+
};
|
|
23
29
|
}, [
|
|
30
|
+
destinations,
|
|
31
|
+
initialScreen,
|
|
32
|
+
outletOwners,
|
|
24
33
|
routes
|
|
25
34
|
]);
|
|
26
35
|
const fallback = react.useMemo(()=>({
|
|
@@ -61,17 +70,22 @@ var resolveDestination = require('./resolveDestination.js');
|
|
|
61
70
|
dialog: resolution.dialog
|
|
62
71
|
});
|
|
63
72
|
} else if (resolution.kind !== scene_model.DestinationKind.External) {
|
|
73
|
+
const screen = destination.screen ?? destination.slice ?? state.screen;
|
|
74
|
+
const placement = placeInOutlet.placeInOutlet(state, screen, resolution.outlet, outletOwners, destinations);
|
|
64
75
|
go({
|
|
65
|
-
screen
|
|
76
|
+
screen,
|
|
66
77
|
url: resolution.url,
|
|
67
78
|
outlet: resolution.outlet,
|
|
68
|
-
parameters: resolution.parameters
|
|
79
|
+
parameters: resolution.parameters,
|
|
80
|
+
...placement
|
|
69
81
|
});
|
|
70
82
|
}
|
|
71
83
|
return resolution;
|
|
72
84
|
}, [
|
|
73
85
|
bindingScope,
|
|
86
|
+
destinations,
|
|
74
87
|
go,
|
|
88
|
+
outletOwners,
|
|
75
89
|
state
|
|
76
90
|
]);
|
|
77
91
|
const closeDialog = react.useCallback((result)=>{
|
|
@@ -87,6 +101,8 @@ var resolveDestination = require('./resolveDestination.js');
|
|
|
87
101
|
]);
|
|
88
102
|
return react.useMemo(()=>({
|
|
89
103
|
currentScreen: state.screen,
|
|
104
|
+
primaryScreen: state.primary ?? state.screen,
|
|
105
|
+
outlets: state.outlets ?? {},
|
|
90
106
|
currentUrl: state.url,
|
|
91
107
|
currentOutlet: state.outlet,
|
|
92
108
|
currentDialog: state.dialog,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSceneHistoryNavigation.js","sources":["../../../navigation/useSceneHistoryNavigation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { BindingScope } from '@cratis/scene.engine';\nimport { DestinationKind, DestinationReference } from '@cratis/scene.model';\nimport { DialogResult } from './DialogResult';\nimport { matchSceneRoute } from './matchSceneRoute';\nimport { resolveDestination } from './resolveDestination';\nimport { SceneHistory } from './SceneHistory';\nimport { SceneNavigationContextValue } from './SceneNavigationContext';\nimport { SceneNavigationState } from './SceneNavigationState';\nimport { SceneRoute } from './SceneRoute';\n\n/**\n * Keeps a navigation host's state in a {@link SceneHistory}: every navigation and every dialog is an entry,\n * so back and forward step through them, a refresh restores the stored entry, and a deep link is matched\n * against the route table. Closing a dialog goes back to the entry that opened it.\n */\nexport function useSceneHistoryNavigation(history: SceneHistory
|
|
1
|
+
{"version":3,"file":"useSceneHistoryNavigation.js","sources":["../../../navigation/useSceneHistoryNavigation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { BindingScope } from '@cratis/scene.engine';\nimport { DestinationKind, DestinationReference } from '@cratis/scene.model';\nimport { DialogResult } from './DialogResult';\nimport { matchSceneRoute } from './matchSceneRoute';\nimport { placeInOutlet } from './placeInOutlet';\nimport { resolveDestination } from './resolveDestination';\nimport { SceneHistory } from './SceneHistory';\nimport { SceneNavigationContextValue } from './SceneNavigationContext';\nimport { SceneNavigationState } from './SceneNavigationState';\nimport { SceneRoute } from './SceneRoute';\n\n/**\n * Keeps a navigation host's state in a {@link SceneHistory}: every navigation and every dialog is an entry,\n * so back and forward step through them, a refresh restores the stored entry, and a deep link is matched\n * against the route table. Closing a dialog goes back to the entry that opened it.\n */\nexport function useSceneHistoryNavigation(\n history: SceneHistory,\n routes: SceneRoute[],\n initialScreen: string,\n bindingScope: BindingScope,\n outletOwners: Record<string, string> = {},\n destinations: DestinationReference[] = [],\n): SceneNavigationContextValue {\n const fromLocation = useCallback((url: string | undefined): SceneNavigationState | undefined => {\n const match = url ? matchSceneRoute(url, routes) : undefined;\n if (!match) return undefined;\n const start: SceneNavigationState = { screen: initialScreen, parameters: {} };\n const placement = placeInOutlet(start, match.route.screen, match.route.outlet, outletOwners, destinations);\n return { screen: match.route.screen, url, outlet: match.route.outlet, parameters: match.parameters, ...placement };\n }, [destinations, initialScreen, outletOwners, routes]);\n const fallback = useMemo<SceneNavigationState>(() => ({ screen: initialScreen, url: initialScreen, parameters: {} }), [initialScreen]);\n\n const [unresolvedUrl] = useState(() => {\n const url = history.location();\n return !history.state() && url && !fromLocation(url) ? url : undefined;\n });\n const [state, setState] = useState<SceneNavigationState>(() => history.state() ?? fromLocation(history.location()) ?? fallback);\n const [dialogResult, setDialogResult] = useState<DialogResult>();\n\n // Back and forward restore the stored entry, or match a URL the host never wrote against the current routes.\n const restore = useRef((url: string | undefined, stored: SceneNavigationState | undefined) => stored ?? fromLocation(url) ?? fallback);\n restore.current = (url, stored) => stored ?? fromLocation(url) ?? fallback;\n const initialState = useRef(state);\n\n // The current entry is written once, when a history is attached; later entries are written by navigate.\n useEffect(() => {\n history.replace(initialState.current);\n return history.listen((url, stored) => setState(restore.current(url, stored)));\n }, [history]);\n\n const go = useCallback((next: SceneNavigationState) => {\n history.push(next);\n setState(next);\n }, [history]);\n\n const navigate = useCallback((destination: DestinationReference) => {\n const resolution = resolveDestination(destination, bindingScope);\n if (resolution.kind === DestinationKind.Dialog) {\n if (resolution.dialog) go({ ...state, dialog: resolution.dialog });\n } else if (resolution.kind !== DestinationKind.External) {\n const screen = destination.screen ?? destination.slice ?? state.screen;\n const placement = placeInOutlet(state, screen, resolution.outlet, outletOwners, destinations);\n go({ screen, url: resolution.url, outlet: resolution.outlet, parameters: resolution.parameters, ...placement });\n }\n\n return resolution;\n }, [bindingScope, destinations, go, outletOwners, state]);\n\n const closeDialog = useCallback((result?: unknown) => {\n if (!state.dialog) return;\n setDialogResult({ dialog: state.dialog, result });\n history.back();\n }, [history, state.dialog]);\n\n return useMemo(() => ({\n currentScreen: state.screen,\n primaryScreen: state.primary ?? state.screen,\n outlets: state.outlets ?? {},\n currentUrl: state.url,\n currentOutlet: state.outlet,\n currentDialog: state.dialog,\n currentParameters: state.parameters,\n dialogResult,\n unresolvedUrl,\n bindingScope,\n navigate,\n closeDialog,\n back: () => history.back(),\n }), [bindingScope, closeDialog, dialogResult, history, navigate, state, unresolvedUrl]);\n}\n"],"names":["useSceneHistoryNavigation","history","routes","initialScreen","bindingScope","outletOwners","destinations","fromLocation","useCallback","url","match","matchSceneRoute","undefined","start","screen","placement","placeInOutlet","route","outlet","parameters","fallback","useMemo","unresolvedUrl","useState","location","state","setState","dialogResult","setDialogResult","restore","useRef","stored","current","initialState","useEffect","replace","listen","go","next","push","navigate","destination","resolution","resolveDestination","kind","DestinationKind","Dialog","dialog","External","slice","closeDialog","result","back","currentScreen","primaryScreen","primary","outlets","currentUrl","currentOutlet","currentDialog","currentParameters"],"mappings":";;;;;;;;AAAA;AACA;AAcA;;;;AAIC,IACM,SAASA,yBAAAA,CACZC,OAAqB,EACrBC,MAAoB,EACpBC,aAAqB,EACrBC,YAA0B,EAC1BC,YAAAA,GAAuC,EAAE,EACzCC,eAAuC,EAAE,EAAA;IAEzC,MAAMC,YAAAA,GAAeC,kBAAY,CAACC,GAAAA,GAAAA;AAC9B,QAAA,MAAMC,KAAAA,GAAQD,GAAAA,GAAME,+BAAAA,CAAgBF,GAAAA,EAAKP,MAAAA,CAAAA,GAAUU,SAAAA;QACnD,IAAI,CAACF,OAAO,OAAOE,SAAAA;AACnB,QAAA,MAAMC,KAAAA,GAA8B;YAAEC,MAAAA,EAAQX,aAA8B,CAAA;AAC5E,QAAA,MAAMY,SAAAA,GAAYC,2BAAAA,CAAcH,KAAAA,EAAOH,KAAAA,CAAMO,KAAK,CAACH,MAAM,EAAEJ,KAAAA,CAAMO,KAAK,CAACC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;AACAL,YAAAA,aAAAA;AACAlB,YAAAA,YAAAA;AACAoC,YAAAA,QAAAA;AACAU,YAAAA,WAAAA;YACAE,IAAAA,EAAM,IAAMnD,QAAQmD,IAAI;AAC5B,SAAA,CAAA,EAAI;AAAChD,QAAAA,YAAAA;AAAc8C,QAAAA,WAAAA;AAAavB,QAAAA,YAAAA;AAAc1B,QAAAA,OAAAA;AAASuC,QAAAA,QAAAA;AAAUf,QAAAA,KAAAA;AAAOH,QAAAA;AAAc,KAAA,CAAA;AAC1F;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
|
|
5
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
6
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
7
|
+
/** The output property an input widget publishes its current value under. */ const valueOutputName = 'value';
|
|
8
|
+
/**
|
|
9
|
+
* Publishes an input widget's current value as its `value` output: once when it mounts, with the initial
|
|
10
|
+
* value, and again on every change. Other elements bind to it with a `componentProperty` binding, and a
|
|
11
|
+
* command action maps it as `component.<id>.value`. The renderer clears the output when the widget unmounts.
|
|
12
|
+
*
|
|
13
|
+
* Values are published as JSON-compatible data so both engines read the same thing: a `Date` is published
|
|
14
|
+
* as its ISO 8601 string, and `undefined` as `null`.
|
|
15
|
+
*/ function useValueOutput(bindingOutputs, value) {
|
|
16
|
+
const published = value instanceof Date ? value.toISOString() : value ?? null;
|
|
17
|
+
const key = JSON.stringify(published);
|
|
18
|
+
const latest = react.useRef(published);
|
|
19
|
+
latest.current = published;
|
|
20
|
+
// Published by value through `key`: a new array or object with the same content is not a change.
|
|
21
|
+
react.useEffect(()=>{
|
|
22
|
+
bindingOutputs?.setOutput(valueOutputName, latest.current);
|
|
23
|
+
}, [
|
|
24
|
+
bindingOutputs,
|
|
25
|
+
key
|
|
26
|
+
]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
exports.useValueOutput = useValueOutput;
|
|
30
|
+
exports.valueOutputName = valueOutputName;
|
|
31
|
+
//# sourceMappingURL=useValueOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useValueOutput.js","sources":["../../../renderer/useValueOutput.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useEffect, useRef } from 'react';\nimport { ComponentBindingOutputs } from './BindingOutputContext';\n\n/** The output property an input widget publishes its current value under. */\nexport const valueOutputName = 'value';\n\n/**\n * Publishes an input widget's current value as its `value` output: once when it mounts, with the initial\n * value, and again on every change. Other elements bind to it with a `componentProperty` binding, and a\n * command action maps it as `component.<id>.value`. The renderer clears the output when the widget unmounts.\n *\n * Values are published as JSON-compatible data so both engines read the same thing: a `Date` is published\n * as its ISO 8601 string, and `undefined` as `null`.\n */\nexport function useValueOutput(bindingOutputs: ComponentBindingOutputs | undefined, value: unknown): void {\n const published = value instanceof Date ? value.toISOString() : value ?? null;\n const key = JSON.stringify(published);\n const latest = useRef(published);\n latest.current = published;\n\n // Published by value through `key`: a new array or object with the same content is not a change.\n useEffect(() => {\n bindingOutputs?.setOutput(valueOutputName, latest.current);\n }, [bindingOutputs, key]);\n}\n"],"names":["valueOutputName","useValueOutput","bindingOutputs","value","published","Date","toISOString","key","JSON","stringify","latest","useRef","current","useEffect","setOutput"],"mappings":";;;;AAAA;AACA;AAKA,8EACO,MAAMA,eAAAA,GAAkB;AAE/B;;;;;;;AAOC,IACM,SAASC,cAAAA,CAAeC,cAAmD,EAAEC,KAAc,EAAA;AAC9F,IAAA,MAAMC,YAAYD,KAAAA,YAAiBE,IAAAA,GAAOF,KAAAA,CAAMG,WAAW,KAAKH,KAAAA,IAAS,IAAA;IACzE,MAAMI,GAAAA,GAAMC,IAAAA,CAAKC,SAAS,CAACL,SAAAA,CAAAA;AAC3B,IAAA,MAAMM,SAASC,YAAAA,CAAOP,SAAAA,CAAAA;AACtBM,IAAAA,MAAAA,CAAOE,OAAO,GAAGR,SAAAA;;IAGjBS,eAAAA,CAAU,IAAA;QACNX,cAAAA,EAAgBY,SAAAA,CAAUd,eAAAA,EAAiBU,MAAAA,CAAOE,OAAO,CAAA;IAC7D,CAAA,EAAG;AAACV,QAAAA,cAAAA;AAAgBK,QAAAA;AAAI,KAAA,CAAA;AAC5B;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_model = require('@cratis/scene.model');
|
|
4
|
+
var useValueOutput = require('./useValueOutput.js');
|
|
5
|
+
|
|
6
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
7
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
8
|
+
/**
|
|
9
|
+
* The descriptor entry an input widget declares for the value it publishes with `useValueOutput`, so a
|
|
10
|
+
* designer can offer it as a binding source - for a detail component, a query argument or a command input.
|
|
11
|
+
*
|
|
12
|
+
* @param valueType The type of value the widget publishes.
|
|
13
|
+
* @param description What the value is, when the default sentence does not say enough.
|
|
14
|
+
*/ function valueOutputProperty(valueType, description = 'What the user has entered, published as the input changes.') {
|
|
15
|
+
return {
|
|
16
|
+
path: useValueOutput.valueOutputName,
|
|
17
|
+
label: 'Value',
|
|
18
|
+
group: 'Outputs',
|
|
19
|
+
valueType,
|
|
20
|
+
readOnly: true,
|
|
21
|
+
output: true,
|
|
22
|
+
bindingMode: scene_model.BindingMode.OneWay,
|
|
23
|
+
description
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.valueOutputProperty = valueOutputProperty;
|
|
28
|
+
//# sourceMappingURL=valueOutputProperty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valueOutputProperty.js","sources":["../../../renderer/valueOutputProperty.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { BindingMode, PropertyDescriptor, PropertyValueType } from '@cratis/scene.model';\nimport { valueOutputName } from './useValueOutput';\n\n/**\n * The descriptor entry an input widget declares for the value it publishes with `useValueOutput`, so a\n * designer can offer it as a binding source - for a detail component, a query argument or a command input.\n *\n * @param valueType The type of value the widget publishes.\n * @param description What the value is, when the default sentence does not say enough.\n */\nexport function valueOutputProperty(valueType: PropertyValueType, description = 'What the user has entered, published as the input changes.'): PropertyDescriptor {\n return {\n path: valueOutputName,\n label: 'Value',\n group: 'Outputs',\n valueType,\n readOnly: true,\n output: true,\n bindingMode: BindingMode.OneWay,\n description,\n };\n}\n"],"names":["valueOutputProperty","valueType","description","path","valueOutputName","label","group","readOnly","output","bindingMode","BindingMode","OneWay"],"mappings":";;;;;AAAA;AACA;AAKA;;;;;;AAMC,IACM,SAASA,mBAAAA,CAAoBC,SAA4B,EAAEC,cAAc,4DAA4D,EAAA;IACxI,OAAO;QACHC,IAAAA,EAAMC,8BAAAA;QACNC,KAAAA,EAAO,OAAA;QACPC,KAAAA,EAAO,SAAA;AACPL,QAAAA,SAAAA;QACAM,QAAAA,EAAU,IAAA;QACVC,MAAAA,EAAQ,IAAA;AACRC,QAAAA,WAAAA,EAAaC,wBAAYC,MAAM;AAC/BT,QAAAA;AACJ,KAAA;AACJ;;"}
|
|
@@ -2,6 +2,7 @@ import { jsx, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { applyEffectiveConfiguration, renderElement } from '@cratis/scene.engine';
|
|
4
4
|
import { RenderBindingScopeProvider, useRenderBindingResolver } from './renderer/RenderBindingScopeContext.js';
|
|
5
|
+
import '@cratis/scene.model';
|
|
5
6
|
import { createReactRenderer } from './renderer/createReactRenderer.js';
|
|
6
7
|
import './interactions/useInteractions.js';
|
|
7
8
|
import './interactions/NotificationHost.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneElementView.js","sources":["../../SceneElementView.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useMemo } from 'react';\nimport { applyEffectiveConfiguration, renderElement, BindingResolver } from '@cratis/scene.engine';\nimport { EffectiveConfiguration, SceneElement } from '@cratis/scene.model';\nimport { ComponentRegistry, RenderBindingScopeProvider, createReactRenderer, useRenderBindingResolver } from './renderer';\n\nexport interface SceneElementViewProps {\n element: SceneElement;\n registry: ComponentRegistry;\n resolveBinding?: BindingResolver;\n dataContext?: unknown;\n queryResults?: Record<string, unknown>;\n componentOutputs?: Record<string, Record<string, unknown>>;\n\n /**\n * The resolved configuration of the template chain the element sits in, from `resolveEffectiveConfiguration`.\n * When given, each configurable component renders with its resolved properties - what a screen's own values add\n * to an inherited template. It is the same data the editor shows, and the same code path whether the screen is\n * being edited or played: there is no design-time mode.\n */\n configuration?: EffectiveConfiguration;\n\n /** Called when rendered components publish or clear output properties for typed bindings. */\n onComponentOutputsChanged?: (outputs: Record<string, Record<string, unknown>>) => void;\n}\n\n/**\n * Renders a Scene element tree with the real `Scene.React` renderer - the WYSIWYG building block Studio's\n * preview surface and Stage's shipped web bundle both consume unmodified.\n */\nexport function SceneElementView({\n element,\n registry,\n resolveBinding,\n configuration,\n onComponentOutputsChanged,\n dataContext,\n queryResults,\n componentOutputs,\n}: SceneElementViewProps) {\n const configured = useMemo(() => configuration ? applyEffectiveConfiguration(element, configuration) : element, [element, configuration]);\n return (\n <RenderBindingScopeProvider\n dataContext={dataContext}\n queryResults={queryResults}\n componentOutputs={componentOutputs}\n resolveBinding={resolveBinding}\n onComponentOutputsChanged={onComponentOutputsChanged}>\n <RenderedElement element={configured} registry={registry} />\n </RenderBindingScopeProvider>\n );\n}\n\nfunction RenderedElement({ element, registry }: { element: SceneElement; registry: ComponentRegistry }) {\n const renderer = useMemo(() => createReactRenderer(registry), [registry]);\n const resolveBinding = useRenderBindingResolver();\n return <>{renderElement(element, renderer, resolveBinding)}</>;\n}\n"],"names":["SceneElementView","element","registry","resolveBinding","configuration","onComponentOutputsChanged","dataContext","queryResults","componentOutputs","configured","useMemo","applyEffectiveConfiguration","_jsx","RenderBindingScopeProvider","RenderedElement","renderer","createReactRenderer","useRenderBindingResolver","_Fragment","renderElement"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SceneElementView.js","sources":["../../SceneElementView.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useMemo } from 'react';\nimport { applyEffectiveConfiguration, renderElement, BindingResolver } from '@cratis/scene.engine';\nimport { EffectiveConfiguration, SceneElement } from '@cratis/scene.model';\nimport { ComponentRegistry, RenderBindingScopeProvider, createReactRenderer, useRenderBindingResolver } from './renderer';\n\nexport interface SceneElementViewProps {\n element: SceneElement;\n registry: ComponentRegistry;\n resolveBinding?: BindingResolver;\n dataContext?: unknown;\n queryResults?: Record<string, unknown>;\n componentOutputs?: Record<string, Record<string, unknown>>;\n\n /**\n * The resolved configuration of the template chain the element sits in, from `resolveEffectiveConfiguration`.\n * When given, each configurable component renders with its resolved properties - what a screen's own values add\n * to an inherited template. It is the same data the editor shows, and the same code path whether the screen is\n * being edited or played: there is no design-time mode.\n */\n configuration?: EffectiveConfiguration;\n\n /** Called when rendered components publish or clear output properties for typed bindings. */\n onComponentOutputsChanged?: (outputs: Record<string, Record<string, unknown>>) => void;\n}\n\n/**\n * Renders a Scene element tree with the real `Scene.React` renderer - the WYSIWYG building block Studio's\n * preview surface and Stage's shipped web bundle both consume unmodified.\n */\nexport function SceneElementView({\n element,\n registry,\n resolveBinding,\n configuration,\n onComponentOutputsChanged,\n dataContext,\n queryResults,\n componentOutputs,\n}: SceneElementViewProps) {\n const configured = useMemo(() => configuration ? applyEffectiveConfiguration(element, configuration) : element, [element, configuration]);\n return (\n <RenderBindingScopeProvider\n dataContext={dataContext}\n queryResults={queryResults}\n componentOutputs={componentOutputs}\n resolveBinding={resolveBinding}\n onComponentOutputsChanged={onComponentOutputsChanged}>\n <RenderedElement element={configured} registry={registry} />\n </RenderBindingScopeProvider>\n );\n}\n\nfunction RenderedElement({ element, registry }: { element: SceneElement; registry: ComponentRegistry }) {\n const renderer = useMemo(() => createReactRenderer(registry), [registry]);\n const resolveBinding = useRenderBindingResolver();\n return <>{renderElement(element, renderer, resolveBinding)}</>;\n}\n"],"names":["SceneElementView","element","registry","resolveBinding","configuration","onComponentOutputsChanged","dataContext","queryResults","componentOutputs","configured","useMemo","applyEffectiveConfiguration","_jsx","RenderBindingScopeProvider","RenderedElement","renderer","createReactRenderer","useRenderBindingResolver","_Fragment","renderElement"],"mappings":";;;;;;;;;AA4BA;;;AAGC,IACM,SAASA,gBAAAA,CAAiB,EAC7BC,OAAO,EACPC,QAAQ,EACRC,cAAc,EACdC,aAAa,EACbC,yBAAyB,EACzBC,WAAW,EACXC,YAAY,EACZC,gBAAgB,EACI,EAAA;AACpB,IAAA,MAAMC,aAAaC,OAAAA,CAAQ,IAAMN,gBAAgBO,2BAAAA,CAA4BV,OAAAA,EAASG,iBAAiBH,OAAAA,EAAS;AAACA,QAAAA,OAAAA;AAASG,QAAAA;AAAc,KAAA,CAAA;AACxI,IAAA,qBACIQ,GAAA,CAACC,0BAAAA,EAAAA;QACGP,WAAAA,EAAaA,WAAAA;QACbC,YAAAA,EAAcA,YAAAA;QACdC,gBAAAA,EAAkBA,gBAAAA;QAClBL,cAAAA,EAAgBA,cAAAA;QAChBE,yBAAAA,EAA2BA,yBAAAA;AAC3B,QAAA,QAAA,gBAAAO,GAAA,CAACE,eAAAA,EAAAA;YAAgBb,OAAAA,EAASQ,UAAAA;YAAYP,QAAAA,EAAUA;;;AAG5D;AAEA,SAASY,eAAAA,CAAgB,EAAEb,OAAO,EAAEC,QAAQ,EAA0D,EAAA;AAClG,IAAA,MAAMa,QAAAA,GAAWL,OAAAA,CAAQ,IAAMM,mBAAAA,CAAoBd,QAAAA,CAAAA,EAAW;AAACA,QAAAA;AAAS,KAAA,CAAA;AACxE,IAAA,MAAMC,cAAAA,GAAiBc,wBAAAA,EAAAA;IACvB,qBAAOL,GAAA,CAAAM,QAAA,EAAA;AAAGC,QAAAA,QAAAA,EAAAA,aAAAA,CAAclB,SAASc,QAAAA,EAAUZ,cAAAA;;AAC/C;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenplayCoreComponents.d.ts","sourceRoot":"","sources":["../../../core/ScreenplayCoreComponents.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScreenplayCoreComponents.d.ts","sourceRoot":"","sources":["../../../core/ScreenplayCoreComponents.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAyB,MAAM,aAAa,CAAC;AAO9E,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAE7D;AAgBD,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAY/D;AAGD,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,wBAAwB,+BAGvE;AAGD,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAIjE;AAGD,wBAAgB,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAE9D;AAGD,wBAAgB,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,wBAAwB,+BAErE;AAGD,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAG/D;AAGD,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,wBAAwB,+BAEvE;AAGD,wBAAgB,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAG9D;AAGD,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAG7D;AAGD,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BAE7D"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { resolveArgumentSource } from '@cratis/scene.engine';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { useRenderBindingScope } from '../renderer/RenderBindingScopeContext.js';
|
|
5
|
+
import '@cratis/scene.model';
|
|
6
|
+
import '../interactions/useInteractions.js';
|
|
7
|
+
import '../interactions/NotificationHost.js';
|
|
2
8
|
|
|
3
|
-
// Copyright (c) Cratis. All rights reserved.
|
|
4
|
-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
5
9
|
function textProperty(properties, name, fallback = '') {
|
|
6
10
|
return typeof properties[name] === 'string' ? properties[name] : fallback;
|
|
7
11
|
}
|
|
@@ -12,15 +16,31 @@ function textProperty(properties, name, fallback = '') {
|
|
|
12
16
|
"data-scene-data": textProperty(element.properties, 'typeName')
|
|
13
17
|
});
|
|
14
18
|
}
|
|
15
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Renders a modeled command action and emits a host-neutral command event when invoked.
|
|
21
|
+
*
|
|
22
|
+
* The event carries the resolved `arguments`, by name, read when the action is invoked: a
|
|
23
|
+
* `component.<id>.<output>` source reads what another element publishes - such as what the user typed into
|
|
24
|
+
* an input - and any other source is a data-context path. Hosts that read the mapping from `element`
|
|
25
|
+
* themselves keep working.
|
|
26
|
+
*/ function CoreAction({ element }) {
|
|
16
27
|
const command = textProperty(element.properties, 'command');
|
|
17
28
|
const label = textProperty(element.properties, 'label', command);
|
|
18
|
-
const
|
|
29
|
+
const scope = useRenderBindingScope();
|
|
30
|
+
const invoke = ()=>{
|
|
31
|
+
const mapping = Array.isArray(element.properties.arguments) ? element.properties.arguments : [];
|
|
32
|
+
const args = Object.fromEntries(mapping.filter((argument)=>typeof argument.name === 'string' && typeof argument.source === 'string').map((argument)=>[
|
|
33
|
+
argument.name,
|
|
34
|
+
resolveArgumentSource(argument.source, scope)
|
|
35
|
+
]));
|
|
36
|
+
globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', {
|
|
19
37
|
detail: {
|
|
20
38
|
command,
|
|
21
|
-
element
|
|
39
|
+
element,
|
|
40
|
+
arguments: args
|
|
22
41
|
}
|
|
23
42
|
}));
|
|
43
|
+
};
|
|
24
44
|
return /*#__PURE__*/ jsx("button", {
|
|
25
45
|
type: "button",
|
|
26
46
|
"data-scene-id": element.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenplayCoreComponents.js","sources":["../../../core/ScreenplayCoreComponents.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { RegisteredComponentProps } from '../renderer';\n\nfunction textProperty(properties: Record<string, unknown>, name: string, fallback = ''): string {\n return typeof properties[name] === 'string' ? properties[name] : fallback;\n}\n\n/** Carries a Screenplay data declaration without adding visual chrome. */\nexport function CoreData({ element }: RegisteredComponentProps) {\n return <span hidden data-scene-id={element.id} data-scene-data={textProperty(element.properties, 'typeName')} />;\n}\n\n/** Renders a modeled command action and emits a host-neutral command event when invoked. */\nexport function CoreAction({ element }: RegisteredComponentProps) {\n const command = textProperty(element.properties, 'command');\n const label = textProperty(element.properties, 'label', command);\n const invoke = () => globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', { detail: { command, element } }));\n return <button type='button' data-scene-id={element.id} onClick={invoke}>{label}</button>;\n}\n\n/** Groups the nested content of a Screenplay section. */\nexport function CoreSection({ element, slots }: RegisteredComponentProps) {\n const name = textProperty(element.properties, 'name');\n return <section data-scene-id={element.id}>{name && <h2>{name}</h2>}{slots.content}</section>;\n}\n\n/** Renders navigation intent and emits a host-neutral navigation event. */\nexport function CoreNavigate({ element }: RegisteredComponentProps) {\n const targetScreen = textProperty(element.properties, 'targetScreen');\n const navigate = () => globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', { detail: { targetScreen, element } }));\n return <button type='button' data-scene-id={element.id} onClick={navigate}>{targetScreen}</button>;\n}\n\n/** Renders a Screenplay title directive. */\nexport function CoreTitle({ element }: RegisteredComponentProps) {\n return <h1 data-scene-id={element.id}>{textProperty(element.properties, 'text')}</h1>;\n}\n\n/** Renders the structural shell of a Screenplay table. Query data is supplied by the host. */\nexport function CoreTable({ element, slots }: RegisteredComponentProps) {\n return <section data-scene-id={element.id} role='table'><header role='row'>{slots.columns}</header></section>;\n}\n\n/** Renders a Screenplay table-column heading. */\nexport function CoreColumn({ element }: RegisteredComponentProps) {\n const property = textProperty(element.properties, 'property');\n return <span data-scene-id={element.id} role='columnheader'>{textProperty(element.properties, 'label', property)}</span>;\n}\n\n/** Renders the structural shell of a Screenplay summary. Query data is supplied by the host. */\nexport function CoreSummary({ element, slots }: RegisteredComponentProps) {\n return <dl data-scene-id={element.id}>{slots.fields}</dl>;\n}\n\n/** Renders a Screenplay summary field label. */\nexport function CoreField({ element }: RegisteredComponentProps) {\n const property = textProperty(element.properties, 'property');\n return <dt data-scene-id={element.id}>{textProperty(element.properties, 'label', property)}</dt>;\n}\n\n/** Renders a Screenplay code block. */\nexport function CoreCode({ element }: RegisteredComponentProps) {\n const language = textProperty(element.properties, 'language');\n return <pre data-scene-id={element.id}><code data-language={language}>{textProperty(element.properties, 'code')}</code></pre>;\n}\n\n/** Makes an external screen-file reference visible until a host supplies that file. */\nexport function CoreFile({ element }: RegisteredComponentProps) {\n return <p data-scene-id={element.id}>Screen source: {textProperty(element.properties, 'path')}</p>;\n}\n"],"names":["textProperty","properties","name","fallback","CoreData","element","_jsx","span","hidden","data-scene-id","id","data-scene-data","CoreAction","command","label","invoke","globalThis","dispatchEvent","CustomEvent","detail","button","type","onClick","CoreSection","slots","_jsxs","section","h2","content","CoreNavigate","targetScreen","navigate","CoreTitle","h1","CoreTable","role","header","columns","CoreColumn","property","CoreSummary","dl","fields","CoreField","dt","CoreCode","language","pre","code","data-language","CoreFile","p"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScreenplayCoreComponents.js","sources":["../../../core/ScreenplayCoreComponents.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { resolveArgumentSource } from '@cratis/scene.engine';\nimport { RegisteredComponentProps, useRenderBindingScope } from '../renderer';\n\nfunction textProperty(properties: Record<string, unknown>, name: string, fallback = ''): string {\n return typeof properties[name] === 'string' ? properties[name] : fallback;\n}\n\n/** Carries a Screenplay data declaration without adding visual chrome. */\nexport function CoreData({ element }: RegisteredComponentProps) {\n return <span hidden data-scene-id={element.id} data-scene-data={textProperty(element.properties, 'typeName')} />;\n}\n\n/** One entry of a command action's argument mapping. */\ninterface ArgumentMapping {\n name?: unknown;\n source?: unknown;\n}\n\n/**\n * Renders a modeled command action and emits a host-neutral command event when invoked.\n *\n * The event carries the resolved `arguments`, by name, read when the action is invoked: a\n * `component.<id>.<output>` source reads what another element publishes - such as what the user typed into\n * an input - and any other source is a data-context path. Hosts that read the mapping from `element`\n * themselves keep working.\n */\nexport function CoreAction({ element }: RegisteredComponentProps) {\n const command = textProperty(element.properties, 'command');\n const label = textProperty(element.properties, 'label', command);\n const scope = useRenderBindingScope();\n const invoke = () => {\n const mapping = Array.isArray(element.properties.arguments) ? element.properties.arguments as ArgumentMapping[] : [];\n const args = Object.fromEntries(mapping\n .filter((argument): argument is { name: string; source: string } => typeof argument.name === 'string' && typeof argument.source === 'string')\n .map(argument => [argument.name, resolveArgumentSource(argument.source, scope)]));\n globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', { detail: { command, element, arguments: args } }));\n };\n return <button type='button' data-scene-id={element.id} onClick={invoke}>{label}</button>;\n}\n\n/** Groups the nested content of a Screenplay section. */\nexport function CoreSection({ element, slots }: RegisteredComponentProps) {\n const name = textProperty(element.properties, 'name');\n return <section data-scene-id={element.id}>{name && <h2>{name}</h2>}{slots.content}</section>;\n}\n\n/** Renders navigation intent and emits a host-neutral navigation event. */\nexport function CoreNavigate({ element }: RegisteredComponentProps) {\n const targetScreen = textProperty(element.properties, 'targetScreen');\n const navigate = () => globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', { detail: { targetScreen, element } }));\n return <button type='button' data-scene-id={element.id} onClick={navigate}>{targetScreen}</button>;\n}\n\n/** Renders a Screenplay title directive. */\nexport function CoreTitle({ element }: RegisteredComponentProps) {\n return <h1 data-scene-id={element.id}>{textProperty(element.properties, 'text')}</h1>;\n}\n\n/** Renders the structural shell of a Screenplay table. Query data is supplied by the host. */\nexport function CoreTable({ element, slots }: RegisteredComponentProps) {\n return <section data-scene-id={element.id} role='table'><header role='row'>{slots.columns}</header></section>;\n}\n\n/** Renders a Screenplay table-column heading. */\nexport function CoreColumn({ element }: RegisteredComponentProps) {\n const property = textProperty(element.properties, 'property');\n return <span data-scene-id={element.id} role='columnheader'>{textProperty(element.properties, 'label', property)}</span>;\n}\n\n/** Renders the structural shell of a Screenplay summary. Query data is supplied by the host. */\nexport function CoreSummary({ element, slots }: RegisteredComponentProps) {\n return <dl data-scene-id={element.id}>{slots.fields}</dl>;\n}\n\n/** Renders a Screenplay summary field label. */\nexport function CoreField({ element }: RegisteredComponentProps) {\n const property = textProperty(element.properties, 'property');\n return <dt data-scene-id={element.id}>{textProperty(element.properties, 'label', property)}</dt>;\n}\n\n/** Renders a Screenplay code block. */\nexport function CoreCode({ element }: RegisteredComponentProps) {\n const language = textProperty(element.properties, 'language');\n return <pre data-scene-id={element.id}><code data-language={language}>{textProperty(element.properties, 'code')}</code></pre>;\n}\n\n/** Makes an external screen-file reference visible until a host supplies that file. */\nexport function CoreFile({ element }: RegisteredComponentProps) {\n return <p data-scene-id={element.id}>Screen source: {textProperty(element.properties, 'path')}</p>;\n}\n"],"names":["textProperty","properties","name","fallback","CoreData","element","_jsx","span","hidden","data-scene-id","id","data-scene-data","CoreAction","command","label","scope","useRenderBindingScope","invoke","mapping","Array","isArray","arguments","args","Object","fromEntries","filter","argument","source","map","resolveArgumentSource","globalThis","dispatchEvent","CustomEvent","detail","button","type","onClick","CoreSection","slots","_jsxs","section","h2","content","CoreNavigate","targetScreen","navigate","CoreTitle","h1","CoreTable","role","header","columns","CoreColumn","property","CoreSummary","dl","fields","CoreField","dt","CoreCode","language","pre","code","data-language","CoreFile","p"],"mappings":";;;;;;;;AAMA,SAASA,aAAaC,UAAmC,EAAEC,IAAY,EAAEC,WAAW,EAAE,EAAA;IAClF,OAAO,OAAOF,UAAU,CAACC,IAAAA,CAAK,KAAK,QAAA,GAAWD,UAAU,CAACC,IAAAA,CAAK,GAAGC,QAAAA;AACrE;AAEA,2EACO,SAASC,QAAAA,CAAS,EAAEC,OAAO,EAA4B,EAAA;AAC1D,IAAA,qBAAOC,GAAA,CAACC,MAAAA,EAAAA;QAAKC,MAAM,EAAA,IAAA;AAACC,QAAAA,eAAAA,EAAeJ,QAAQK,EAAE;QAAEC,iBAAAA,EAAiBX,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,UAAA;;AACrG;AAQA;;;;;;;AAOC,IACM,SAASW,UAAAA,CAAW,EAAEP,OAAO,EAA4B,EAAA;AAC5D,IAAA,MAAMQ,OAAAA,GAAUb,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,SAAA,CAAA;AACjD,IAAA,MAAMa,KAAAA,GAAQd,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,OAAA,EAASY,OAAAA,CAAAA;AACxD,IAAA,MAAME,KAAAA,GAAQC,qBAAAA,EAAAA;AACd,IAAA,MAAMC,MAAAA,GAAS,IAAA;AACX,QAAA,MAAMC,OAAAA,GAAUC,KAAAA,CAAMC,OAAO,CAACf,QAAQJ,UAAU,CAACoB,SAAS,CAAA,GAAIhB,OAAAA,CAAQJ,UAAU,CAACoB,SAAS,GAAwB,EAAE;QACpH,MAAMC,IAAAA,GAAOC,OAAOC,WAAW,CAACN,QAC3BO,MAAM,CAAC,CAACC,QAAAA,GAA2D,OAAOA,QAAAA,CAASxB,IAAI,KAAK,QAAA,IAAY,OAAOwB,QAAAA,CAASC,MAAM,KAAK,QAAA,C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,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"coreComponents.d.ts","sourceRoot":"","sources":["../../../core/coreComponents.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAyBhD,eAAO,MAAM,cAAc,EAAE,iBAiB5B,CAAC"}
|
|
@@ -4,6 +4,7 @@ import '@cratis/scene.engine';
|
|
|
4
4
|
import '@cratis/scene.model';
|
|
5
5
|
import '../interactions/useInteractions.js';
|
|
6
6
|
import '../interactions/NotificationHost.js';
|
|
7
|
+
import { CoreOutlet } from '../navigation/CoreOutlet.js';
|
|
7
8
|
import { componentRegistryKey } from '../packages/ScenePackageBundle.js';
|
|
8
9
|
import '../packages/runDesignTimeAction.js';
|
|
9
10
|
import { CoreText } from './CoreText.js';
|
|
@@ -32,7 +33,8 @@ import { CoreFile, CoreCode, CoreField, CoreSummary, CoreColumn, CoreTable, Core
|
|
|
32
33
|
[componentRegistryKey('core', 'field')]: CoreField,
|
|
33
34
|
[componentRegistryKey('core', 'code')]: CoreCode,
|
|
34
35
|
[componentRegistryKey('core', 'file')]: CoreFile,
|
|
35
|
-
[componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar
|
|
36
|
+
[componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar,
|
|
37
|
+
[componentRegistryKey('core', 'outlet')]: CoreOutlet
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
export { coreComponents };
|