@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,7 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { resolveArgumentSource } from '@cratis/scene.engine';
|
|
5
|
+
import { RegisteredComponentProps, useRenderBindingScope } from '../renderer';
|
|
5
6
|
|
|
6
7
|
function textProperty(properties: Record<string, unknown>, name: string, fallback = ''): string {
|
|
7
8
|
return typeof properties[name] === 'string' ? properties[name] : fallback;
|
|
@@ -12,11 +13,31 @@ export function CoreData({ element }: RegisteredComponentProps) {
|
|
|
12
13
|
return <span hidden data-scene-id={element.id} data-scene-data={textProperty(element.properties, 'typeName')} />;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
/**
|
|
16
|
+
/** One entry of a command action's argument mapping. */
|
|
17
|
+
interface ArgumentMapping {
|
|
18
|
+
name?: unknown;
|
|
19
|
+
source?: unknown;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Renders a modeled command action and emits a host-neutral command event when invoked.
|
|
24
|
+
*
|
|
25
|
+
* The event carries the resolved `arguments`, by name, read when the action is invoked: a
|
|
26
|
+
* `component.<id>.<output>` source reads what another element publishes - such as what the user typed into
|
|
27
|
+
* an input - and any other source is a data-context path. Hosts that read the mapping from `element`
|
|
28
|
+
* themselves keep working.
|
|
29
|
+
*/
|
|
16
30
|
export function CoreAction({ element }: RegisteredComponentProps) {
|
|
17
31
|
const command = textProperty(element.properties, 'command');
|
|
18
32
|
const label = textProperty(element.properties, 'label', command);
|
|
19
|
-
const
|
|
33
|
+
const scope = useRenderBindingScope();
|
|
34
|
+
const invoke = () => {
|
|
35
|
+
const mapping = Array.isArray(element.properties.arguments) ? element.properties.arguments as ArgumentMapping[] : [];
|
|
36
|
+
const args = Object.fromEntries(mapping
|
|
37
|
+
.filter((argument): argument is { name: string; source: string } => typeof argument.name === 'string' && typeof argument.source === 'string')
|
|
38
|
+
.map(argument => [argument.name, resolveArgumentSource(argument.source, scope)]));
|
|
39
|
+
globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', { detail: { command, element, arguments: args } }));
|
|
40
|
+
};
|
|
20
41
|
return <button type='button' data-scene-id={element.id} onClick={invoke}>{label}</button>;
|
|
21
42
|
}
|
|
22
43
|
|
package/core/coreComponents.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { CoreText } from './CoreText';
|
|
|
7
7
|
import { CoreButton } from './CoreButton';
|
|
8
8
|
import { CoreCard } from './CoreCard';
|
|
9
9
|
import { CoreNavigationBar } from './CoreNavigationBar';
|
|
10
|
+
import { CoreOutlet } from '../navigation/CoreOutlet';
|
|
10
11
|
import {
|
|
11
12
|
CoreAction,
|
|
12
13
|
CoreCode,
|
|
@@ -41,4 +42,5 @@ export const coreComponents: ComponentRegistry = {
|
|
|
41
42
|
[componentRegistryKey('core', 'code')]: CoreCode,
|
|
42
43
|
[componentRegistryKey('core', 'file')]: CoreFile,
|
|
43
44
|
[componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar,
|
|
45
|
+
[componentRegistryKey('core', 'outlet')]: CoreOutlet,
|
|
44
46
|
};
|
package/core/coreDescriptors.ts
CHANGED
|
@@ -53,6 +53,12 @@ export const coreDescriptors: ComponentDescriptor[] = [
|
|
|
53
53
|
{ path: 'label', label: 'Heading', group: 'Content', valueType: PropertyValueType.String },
|
|
54
54
|
],
|
|
55
55
|
},
|
|
56
|
+
{
|
|
57
|
+
component: key('outlet'),
|
|
58
|
+
displayName: 'Outlet',
|
|
59
|
+
description: 'A named region another screen opens into. Placing a screen here keeps this screen on the page, and the placed screen may declare outlets of its own.',
|
|
60
|
+
properties: [{ path: 'name', label: 'Name', group: 'Navigation', valueType: PropertyValueType.String, constraints: { required: true } }],
|
|
61
|
+
},
|
|
56
62
|
{
|
|
57
63
|
component: key('navigationBar'),
|
|
58
64
|
displayName: 'Navigation bar',
|
package/core/corePackage.ts
CHANGED
|
@@ -4,6 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var scene_engine = require('@cratis/scene.engine');
|
|
6
6
|
var RenderBindingScopeContext = require('./renderer/RenderBindingScopeContext.js');
|
|
7
|
+
require('@cratis/scene.model');
|
|
7
8
|
var createReactRenderer = require('./renderer/createReactRenderer.js');
|
|
8
9
|
require('./interactions/useInteractions.js');
|
|
9
10
|
require('./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,aAAAA,CAAQ,IAAMN,gBAAgBO,wCAAAA,CAA4BV,OAAAA,EAASG,iBAAiBH,OAAAA,EAAS;AAACA,QAAAA,OAAAA;AAASG,QAAAA;AAAc,KAAA,CAAA;AACxI,IAAA,qBACIQ,cAAA,CAACC,oDAAAA,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,cAAA,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,aAAAA,CAAQ,IAAMM,uCAAAA,CAAoBd,QAAAA,CAAAA,EAAW;AAACA,QAAAA;AAAS,KAAA,CAAA;AACxE,IAAA,MAAMC,cAAAA,GAAiBc,kDAAAA,EAAAA;IACvB,qBAAOL,cAAA,CAAAM,mBAAA,EAAA;AAAGC,QAAAA,QAAAA,EAAAA,0BAAAA,CAAclB,SAASc,QAAAA,EAAUZ,cAAAA;;AAC/C;;"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var scene_engine = require('@cratis/scene.engine');
|
|
5
|
+
require('react');
|
|
6
|
+
var RenderBindingScopeContext = require('../renderer/RenderBindingScopeContext.js');
|
|
7
|
+
require('@cratis/scene.model');
|
|
8
|
+
require('../interactions/useInteractions.js');
|
|
9
|
+
require('../interactions/NotificationHost.js');
|
|
4
10
|
|
|
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
11
|
function textProperty(properties, name, fallback = '') {
|
|
8
12
|
return typeof properties[name] === 'string' ? properties[name] : fallback;
|
|
9
13
|
}
|
|
@@ -14,15 +18,31 @@ function textProperty(properties, name, fallback = '') {
|
|
|
14
18
|
"data-scene-data": textProperty(element.properties, 'typeName')
|
|
15
19
|
});
|
|
16
20
|
}
|
|
17
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Renders a modeled command action and emits a host-neutral command event when invoked.
|
|
23
|
+
*
|
|
24
|
+
* The event carries the resolved `arguments`, by name, read when the action is invoked: a
|
|
25
|
+
* `component.<id>.<output>` source reads what another element publishes - such as what the user typed into
|
|
26
|
+
* an input - and any other source is a data-context path. Hosts that read the mapping from `element`
|
|
27
|
+
* themselves keep working.
|
|
28
|
+
*/ function CoreAction({ element }) {
|
|
18
29
|
const command = textProperty(element.properties, 'command');
|
|
19
30
|
const label = textProperty(element.properties, 'label', command);
|
|
20
|
-
const
|
|
31
|
+
const scope = RenderBindingScopeContext.useRenderBindingScope();
|
|
32
|
+
const invoke = ()=>{
|
|
33
|
+
const mapping = Array.isArray(element.properties.arguments) ? element.properties.arguments : [];
|
|
34
|
+
const args = Object.fromEntries(mapping.filter((argument)=>typeof argument.name === 'string' && typeof argument.source === 'string').map((argument)=>[
|
|
35
|
+
argument.name,
|
|
36
|
+
scene_engine.resolveArgumentSource(argument.source, scope)
|
|
37
|
+
]));
|
|
38
|
+
globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', {
|
|
21
39
|
detail: {
|
|
22
40
|
command,
|
|
23
|
-
element
|
|
41
|
+
element,
|
|
42
|
+
arguments: args
|
|
24
43
|
}
|
|
25
44
|
}));
|
|
45
|
+
};
|
|
26
46
|
return /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
27
47
|
type: "button",
|
|
28
48
|
"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,OAAO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AA,GAAWrD,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,UAAA,CAAA;AAClD,IAAA,qBAAOK,cAAA,CAACoD,IAAAA,EAAAA;AAAGjD,QAAAA,eAAAA,EAAeJ,QAAQK,EAAE;kBAAGV,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,OAAA,EAASoD,QAAAA;;AACrF;AAEA,wCACO,SAASM,QAAAA,CAAS,EAAEtD,OAAO,EAA4B,EAAA;AAC1D,IAAA,MAAMuD,QAAAA,GAAW5D,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,UAAA,CAAA;AAClD,IAAA,qBAAOK,cAAA,CAACuD,KAAAA,EAAAA;AAAIpD,QAAAA,eAAAA,EAAeJ,QAAQK,EAAE;AAAE,QAAA,QAAA,gBAAAJ,cAAA,CAACwD,MAAAA,EAAAA;YAAKC,eAAAA,EAAeH,QAAAA;sBAAW5D,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,MAAA;;;AAC5G;AAEA,wFACO,SAAS+D,QAAAA,CAAS,EAAE3D,OAAO,EAA4B,EAAA;AAC1D,IAAA,qBAAOkC,eAAA,CAAC0B,GAAAA,EAAAA;AAAExD,QAAAA,eAAAA,EAAeJ,QAAQK,EAAE;;AAAE,YAAA,iBAAA;YAAgBV,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,MAAA;;;AAC1F;;;;;;;;;;;;"}
|
|
@@ -6,6 +6,7 @@ require('@cratis/scene.engine');
|
|
|
6
6
|
require('@cratis/scene.model');
|
|
7
7
|
require('../interactions/useInteractions.js');
|
|
8
8
|
require('../interactions/NotificationHost.js');
|
|
9
|
+
var CoreOutlet = require('../navigation/CoreOutlet.js');
|
|
9
10
|
var ScenePackageBundle = require('../packages/ScenePackageBundle.js');
|
|
10
11
|
require('../packages/runDesignTimeAction.js');
|
|
11
12
|
var CoreText = require('./CoreText.js');
|
|
@@ -34,7 +35,8 @@ var ScreenplayCoreComponents = require('./ScreenplayCoreComponents.js');
|
|
|
34
35
|
[ScenePackageBundle.componentRegistryKey('core', 'field')]: ScreenplayCoreComponents.CoreField,
|
|
35
36
|
[ScenePackageBundle.componentRegistryKey('core', 'code')]: ScreenplayCoreComponents.CoreCode,
|
|
36
37
|
[ScenePackageBundle.componentRegistryKey('core', 'file')]: ScreenplayCoreComponents.CoreFile,
|
|
37
|
-
[ScenePackageBundle.componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar.CoreNavigationBar
|
|
38
|
+
[ScenePackageBundle.componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar.CoreNavigationBar,
|
|
39
|
+
[ScenePackageBundle.componentRegistryKey('core', 'outlet')]: CoreOutlet.CoreOutlet
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
exports.coreComponents = coreComponents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreComponents.js","sources":["../../../core/coreComponents.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 { ComponentRegistry } from '../renderer';\nimport { componentRegistryKey } from '../packages';\nimport { CoreText } from './CoreText';\nimport { CoreButton } from './CoreButton';\nimport { CoreCard } from './CoreCard';\nimport { CoreNavigationBar } from './CoreNavigationBar';\nimport {\n CoreAction,\n CoreCode,\n CoreColumn,\n CoreData,\n CoreField,\n CoreFile,\n CoreNavigate,\n CoreSection,\n CoreSummary,\n CoreTable,\n CoreTitle,\n} from './ScreenplayCoreComponents';\n\n/**\n * The `core` package's component registry - the final fallback every `ui profile` resolves against\n * regardless of which other packages it lists (Scene#3).\n */\nexport const coreComponents: ComponentRegistry = {\n [componentRegistryKey('core', 'text')]: CoreText,\n [componentRegistryKey('core', 'button')]: CoreButton,\n [componentRegistryKey('core', 'card')]: CoreCard,\n [componentRegistryKey('core', 'data')]: CoreData,\n [componentRegistryKey('core', 'action')]: CoreAction,\n [componentRegistryKey('core', 'section')]: CoreSection,\n [componentRegistryKey('core', 'navigate')]: CoreNavigate,\n [componentRegistryKey('core', 'title')]: CoreTitle,\n [componentRegistryKey('core', 'table')]: CoreTable,\n [componentRegistryKey('core', 'column')]: CoreColumn,\n [componentRegistryKey('core', 'summary')]: CoreSummary,\n [componentRegistryKey('core', 'field')]: CoreField,\n [componentRegistryKey('core', 'code')]: CoreCode,\n [componentRegistryKey('core', 'file')]: CoreFile,\n [componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar,\n};\n"],"names":["coreComponents","componentRegistryKey","CoreText","CoreButton","CoreCard","CoreData","CoreAction","CoreSection","CoreNavigate","CoreTitle","CoreTable","CoreColumn","CoreSummary","CoreField","CoreCode","CoreFile","CoreNavigationBar"],"mappings":"
|
|
1
|
+
{"version":3,"file":"coreComponents.js","sources":["../../../core/coreComponents.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 { ComponentRegistry } from '../renderer';\nimport { componentRegistryKey } from '../packages';\nimport { CoreText } from './CoreText';\nimport { CoreButton } from './CoreButton';\nimport { CoreCard } from './CoreCard';\nimport { CoreNavigationBar } from './CoreNavigationBar';\nimport { CoreOutlet } from '../navigation/CoreOutlet';\nimport {\n CoreAction,\n CoreCode,\n CoreColumn,\n CoreData,\n CoreField,\n CoreFile,\n CoreNavigate,\n CoreSection,\n CoreSummary,\n CoreTable,\n CoreTitle,\n} from './ScreenplayCoreComponents';\n\n/**\n * The `core` package's component registry - the final fallback every `ui profile` resolves against\n * regardless of which other packages it lists (Scene#3).\n */\nexport const coreComponents: ComponentRegistry = {\n [componentRegistryKey('core', 'text')]: CoreText,\n [componentRegistryKey('core', 'button')]: CoreButton,\n [componentRegistryKey('core', 'card')]: CoreCard,\n [componentRegistryKey('core', 'data')]: CoreData,\n [componentRegistryKey('core', 'action')]: CoreAction,\n [componentRegistryKey('core', 'section')]: CoreSection,\n [componentRegistryKey('core', 'navigate')]: CoreNavigate,\n [componentRegistryKey('core', 'title')]: CoreTitle,\n [componentRegistryKey('core', 'table')]: CoreTable,\n [componentRegistryKey('core', 'column')]: CoreColumn,\n [componentRegistryKey('core', 'summary')]: CoreSummary,\n [componentRegistryKey('core', 'field')]: CoreField,\n [componentRegistryKey('core', 'code')]: CoreCode,\n [componentRegistryKey('core', 'file')]: CoreFile,\n [componentRegistryKey('core', 'navigationBar')]: CoreNavigationBar,\n [componentRegistryKey('core', 'outlet')]: CoreOutlet,\n};\n"],"names":["coreComponents","componentRegistryKey","CoreText","CoreButton","CoreCard","CoreData","CoreAction","CoreSection","CoreNavigate","CoreTitle","CoreTable","CoreColumn","CoreSummary","CoreField","CoreCode","CoreFile","CoreNavigationBar","CoreOutlet"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AAuBA;;;UAIaA,cAAAA,GAAoC;IAC7C,CAACC,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUC,iBAAAA;IACxC,CAACD,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYE,qBAAAA;IAC1C,CAACF,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUG,iBAAAA;IACxC,CAACH,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUI,iCAAAA;IACxC,CAACJ,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYK,mCAAAA;IAC1C,CAACL,uCAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaM,oCAAAA;IAC3C,CAACN,uCAAAA,CAAqB,MAAA,EAAQ,UAAA,CAAA,GAAcO,qCAAAA;IAC5C,CAACP,uCAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWQ,kCAAAA;IACzC,CAACR,uCAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWS,kCAAAA;IACzC,CAACT,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYU,mCAAAA;IAC1C,CAACV,uCAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaW,oCAAAA;IAC3C,CAACX,uCAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWY,kCAAAA;IACzC,CAACZ,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUa,iCAAAA;IACxC,CAACb,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUc,iCAAAA;IACxC,CAACd,uCAAAA,CAAqB,MAAA,EAAQ,eAAA,CAAA,GAAmBe,mCAAAA;IACjD,CAACf,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYgB;AAC9C;;"}
|
|
@@ -109,6 +109,22 @@ const key = (name)=>ScenePackageBundle.componentRegistryKey('core', name);
|
|
|
109
109
|
}
|
|
110
110
|
]
|
|
111
111
|
},
|
|
112
|
+
{
|
|
113
|
+
component: key('outlet'),
|
|
114
|
+
displayName: 'Outlet',
|
|
115
|
+
description: 'A named region another screen opens into. Placing a screen here keeps this screen on the page, and the placed screen may declare outlets of its own.',
|
|
116
|
+
properties: [
|
|
117
|
+
{
|
|
118
|
+
path: 'name',
|
|
119
|
+
label: 'Name',
|
|
120
|
+
group: 'Navigation',
|
|
121
|
+
valueType: scene_model.PropertyValueType.String,
|
|
122
|
+
constraints: {
|
|
123
|
+
required: true
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
},
|
|
112
128
|
{
|
|
113
129
|
component: key('navigationBar'),
|
|
114
130
|
displayName: 'Navigation bar',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreDescriptors.js","sources":["../../../core/coreDescriptors.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 { ComponentDescriptor, PropertyValueType } from '@cratis/scene.model';\nimport { componentRegistryKey } from '../packages';\n\nconst key = (name: string) => componentRegistryKey('core', name);\n\n/**\n * What can be edited on the `core` package's components.\n *\n * Only the components an author configures by hand are described: a button's label, an action's command and its\n * argument mapping, a column's heading, and the navigation bar. The Screenplay structural components - `data`,\n * `section`, `summary` - have nothing to edit that is not already a node in the tree.\n */\nexport const coreDescriptors: ComponentDescriptor[] = [\n {\n component: key('button'),\n displayName: 'Button',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, default: '' },\n ],\n },\n {\n component: key('action'),\n displayName: 'Command action',\n description: 'Invokes a modeled command. The command and its argument mapping are stored on the element; the host that handles the command event reads them.',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String },\n {\n path: 'command', label: 'Command', group: 'Behavior', valueType: PropertyValueType.String,\n editorKind: 'stateChangeReference', constraints: { required: true },\n description: 'The state change this action submits.',\n },\n {\n path: 'arguments', label: 'Argument mapping', group: 'Behavior', valueType: PropertyValueType.Collection,\n description: 'Where each command argument comes from.',\n item: {\n label: 'Argument',\n properties: [\n { path: 'name', label: 'Argument', group: 'Behavior', valueType: PropertyValueType.String, constraints: { required: true } },\n { path: 'source', label: 'Source', group: 'Behavior', valueType: PropertyValueType.String, editorKind: 'bindingPath', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n {\n component: key('column'),\n displayName: 'Table column',\n properties: [\n { path: 'property', label: 'Result field', group: 'Data', valueType: PropertyValueType.String, editorKind: 'resultField', constraints: { required: true } },\n { path: 'label', label: 'Heading', group: 'Content', valueType: PropertyValueType.String },\n ],\n },\n {\n component: key('navigationBar'),\n displayName: 'Navigation bar',\n description: 'A list of navigation items. A template author fixes the first item (Home) and can expose the list so that screens add their own.',\n properties: [\n { path: 'title', label: 'Title', group: 'Content', valueType: PropertyValueType.String, default: 'Navigation' },\n {\n path: 'items', label: 'Items', group: 'Content', valueType: PropertyValueType.Collection, default: [],\n item: {\n label: 'Navigation item',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, constraints: { required: true, minimumLength: 1 } },\n { path: 'icon', label: 'Icon', group: 'Content', valueType: PropertyValueType.Icon, editorKind: 'iconPicker' },\n { path: 'destination', label: 'Destination', group: 'Content', valueType: PropertyValueType.Destination, editorKind: 'screenPicker', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n];\n"],"names":["key","name","componentRegistryKey","coreDescriptors","component","displayName","properties","path","label","group","valueType","PropertyValueType","String","default","description","editorKind","constraints","required","Collection","item","minimumLength","Icon","Destination"],"mappings":";;;;;;;;;;;AAAA;AACA;AAKA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,uCAAAA,CAAqB,MAAA,EAAQD,IAAAA,CAAAA;AAE3D;;;;;;UAOaE,eAAAA,GAAyC;AAClD,IAAA;AACIC,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,QAAA;QACbC,UAAAA,EAAY;AACR,YAAA;gBAAEC,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,8BAAkBC,MAAM;gBAAEC,OAAAA,EAAS;AAAG;AACvG;AACL,KAAA;AACA,IAAA;AACIT,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,gBAAA;QACbS,WAAAA,EAAa,gJAAA;QACbR,UAAAA,EAAY;AACR,YAAA;gBAAEC,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,8BAAkBC;AAAO,aAAA;AACvF,YAAA;gBACIL,IAAAA,EAAM,SAAA;gBAAWC,KAAAA,EAAO,SAAA;gBAAWC,KAAAA,EAAO,UAAA;AAAYC,gBAAAA,SAAAA,EAAWC,8BAAkBC,MAAM;gBACzFG,UAAAA,EAAY,sBAAA;gBAAwBC,WAAAA,EAAa;oBAAEC,QAAAA,EAAU;AAAK,iBAAA;gBAClEH,WAAAA,EAAa;AACjB,aAAA;AACA,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ptors.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 { ComponentDescriptor, PropertyValueType } from '@cratis/scene.model';\nimport { componentRegistryKey } from '../packages';\n\nconst key = (name: string) => componentRegistryKey('core', name);\n\n/**\n * What can be edited on the `core` package's components.\n *\n * Only the components an author configures by hand are described: a button's label, an action's command and its\n * argument mapping, a column's heading, and the navigation bar. The Screenplay structural components - `data`,\n * `section`, `summary` - have nothing to edit that is not already a node in the tree.\n */\nexport const coreDescriptors: ComponentDescriptor[] = [\n {\n component: key('button'),\n displayName: 'Button',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, default: '' },\n ],\n },\n {\n component: key('action'),\n displayName: 'Command action',\n description: 'Invokes a modeled command. The command and its argument mapping are stored on the element; the host that handles the command event reads them.',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String },\n {\n path: 'command', label: 'Command', group: 'Behavior', valueType: PropertyValueType.String,\n editorKind: 'stateChangeReference', constraints: { required: true },\n description: 'The state change this action submits.',\n },\n {\n path: 'arguments', label: 'Argument mapping', group: 'Behavior', valueType: PropertyValueType.Collection,\n description: 'Where each command argument comes from.',\n item: {\n label: 'Argument',\n properties: [\n { path: 'name', label: 'Argument', group: 'Behavior', valueType: PropertyValueType.String, constraints: { required: true } },\n { path: 'source', label: 'Source', group: 'Behavior', valueType: PropertyValueType.String, editorKind: 'bindingPath', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n {\n component: key('column'),\n displayName: 'Table column',\n properties: [\n { path: 'property', label: 'Result field', group: 'Data', valueType: PropertyValueType.String, editorKind: 'resultField', constraints: { required: true } },\n { path: 'label', label: 'Heading', group: 'Content', valueType: PropertyValueType.String },\n ],\n },\n {\n component: key('outlet'),\n displayName: 'Outlet',\n description: 'A named region another screen opens into. Placing a screen here keeps this screen on the page, and the placed screen may declare outlets of its own.',\n properties: [{ path: 'name', label: 'Name', group: 'Navigation', valueType: PropertyValueType.String, constraints: { required: true } }],\n },\n {\n component: key('navigationBar'),\n displayName: 'Navigation bar',\n description: 'A list of navigation items. A template author fixes the first item (Home) and can expose the list so that screens add their own.',\n properties: [\n { path: 'title', label: 'Title', group: 'Content', valueType: PropertyValueType.String, default: 'Navigation' },\n {\n path: 'items', label: 'Items', group: 'Content', valueType: PropertyValueType.Collection, default: [],\n item: {\n label: 'Navigation item',\n properties: [\n { path: 'label', label: 'Label', group: 'Content', valueType: PropertyValueType.String, constraints: { required: true, minimumLength: 1 } },\n { path: 'icon', label: 'Icon', group: 'Content', valueType: PropertyValueType.Icon, editorKind: 'iconPicker' },\n { path: 'destination', label: 'Destination', group: 'Content', valueType: PropertyValueType.Destination, editorKind: 'screenPicker', constraints: { required: true } },\n ],\n },\n },\n ],\n },\n];\n"],"names":["key","name","componentRegistryKey","coreDescriptors","component","displayName","properties","path","label","group","valueType","PropertyValueType","String","default","description","editorKind","constraints","required","Collection","item","minimumLength","Icon","Destination"],"mappings":";;;;;;;;;;;AAAA;AACA;AAKA,MAAMA,GAAAA,GAAM,CAACC,IAAAA,GAAiBC,uCAAAA,CAAqB,MAAA,EAAQD,IAAAA,CAAAA;AAE3D;;;;;;UAOaE,eAAAA,GAAyC;AAClD,IAAA;AACIC,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,QAAA;QACbC,UAAAA,EAAY;AACR,YAAA;gBAAEC,IAAAA,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,8BAAkBC,MAAM;gBAAEC,OAAAA,EAAS;AAAG;AACvG;AACL,KAAA;AACA,IAAA;AACIT,QAAAA,SAAAA,EAAWJ,GAAAA,CAAI,QAAA,CAAA;QACfK,WAAAA,EAAa,gBAAA;QACbS,WAAAA,EAAa,gJAAA;QACbR,UAAAA,EAAY;AACR,YAAA;gBAAEC,I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oBACPF,UAAAA,EAAY;AACR,wBAAA;4BAAEC,IAAAA,EAAM,OAAA;4BAASC,KAAAA,EAAO,OAAA;4BAASC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,8BAAkBC,MAAM;4BAAEI,WAAAA,EAAa;gCAAEC,QAAAA,EAAU,IAAA;gCAAMG,aAAAA,EAAe;AAAE;AAAE,yBAAA;AAC1I,wBAAA;4BAAEb,IAAAA,EAAM,MAAA;4BAAQC,KAAAA,EAAO,MAAA;4BAAQC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,8BAAkBU,IAAI;4BAAEN,UAAAA,EAAY;AAAa,yBAAA;AAC7G,wBAAA;4BAAER,IAAAA,EAAM,aAAA;4BAAeC,KAAAA,EAAO,aAAA;4BAAeC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,8BAAkBW,WAAW;4BAAEP,UAAAA,EAAY,cAAA;4BAAgBC,WAAAA,EAAa;gCAAEC,QAAAA,EAAU;AAAK;AAAE;AACxK;AACL;AACJ;AACH;AACL;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corePackage.js","sources":["../../../core/corePackage.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 { PackageKind, ScenePackage } from '@cratis/scene.model';\nimport { ScenePackageBundle } from '../packages';\nimport { coreComponents } from './coreComponents';\nimport { coreDescriptors } from './coreDescriptors';\n\n/**\n * The `core` package's declaration. Every other package is loaded by a host that reads its manifest;\n * `core` ships inside the renderer itself, because Scene#3 guarantees a bare name always has somewhere to\n * resolve regardless of which packages a profile lists. It is still declared the same way as any other -\n * a package picker should be able to show it, and the dependency resolver should be able to reason about\n * it, without a special case.\n */\nexport const corePackageManifest: ScenePackage = {\n name: 'core',\n version: '1.0.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [],\n components: [\n 'text',\n 'button',\n 'card',\n 'data',\n 'action',\n 'section',\n 'navigate',\n 'title',\n 'table',\n 'column',\n 'summary',\n 'field',\n 'code',\n 'file',\n 'navigationBar',\n ],\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n themes: [],\n displayName: 'Core',\n description: 'The built-in fallback vocabulary every ui profile resolves against.',\n module: '@cratis/scene.react',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n};\n\n/**\n * The `core` package as a loadable bundle.\n */\nexport const corePackage: ScenePackageBundle = {\n manifest: corePackageManifest,\n components: coreComponents,\n descriptors: coreDescriptors,\n};\n"],"names":["corePackageManifest","name","version","kind","PackageKind","ComponentLibrary","dependencies","components","layouts","screenTemplates","dialogTemplates","themes","displayName","description","module","license","licenseUrl","corePackage","manifest","coreComponents","descriptors","coreDescriptors"],"mappings":";;;;;;AAAA;AACA;AAOA;;;;;;UAOaA,mBAAAA,GAAoC;IAC7CC,IAAAA,EAAM,MAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,wBAAYC,gBAAgB;AAClCC,IAAAA,YAAAA,EAAc,EAAE;IAChBC,UAAAA,EAAY;AACR,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,UAAA;AACA,QAAA,OAAA;AACA,QAAA,OAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,OAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA;AACH,KAAA;AACDC,IAAAA,OAAAA,EAAS,EAAE;AACXC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,MAAAA,EAAQ,EAAE;IACVC,WAAAA,EAAa,MAAA;IACbC,WAAAA,EAAa,qEAAA;IACbC,MAAAA,EAAQ,qBAAA;IACRC,OAAAA,EAAS,KAAA;IACTC,UAAAA,EAAY;AAChB;AAEA;;UAGaC,WAAAA,GAAkC;IAC3CC,QAAAA,EAAUlB,mBAAAA;IACVO,UAAAA,EAAYY,6BAAAA;IACZC,WAAAA,EAAaC;AACjB;;;"}
|
|
1
|
+
{"version":3,"file":"corePackage.js","sources":["../../../core/corePackage.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 { PackageKind, ScenePackage } from '@cratis/scene.model';\nimport { ScenePackageBundle } from '../packages';\nimport { coreComponents } from './coreComponents';\nimport { coreDescriptors } from './coreDescriptors';\n\n/**\n * The `core` package's declaration. Every other package is loaded by a host that reads its manifest;\n * `core` ships inside the renderer itself, because Scene#3 guarantees a bare name always has somewhere to\n * resolve regardless of which packages a profile lists. It is still declared the same way as any other -\n * a package picker should be able to show it, and the dependency resolver should be able to reason about\n * it, without a special case.\n */\nexport const corePackageManifest: ScenePackage = {\n name: 'core',\n version: '1.0.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [],\n components: [\n 'text',\n 'button',\n 'card',\n 'data',\n 'action',\n 'section',\n 'navigate',\n 'title',\n 'table',\n 'column',\n 'summary',\n 'field',\n 'code',\n 'file',\n 'navigationBar',\n 'outlet',\n ],\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n themes: [],\n displayName: 'Core',\n description: 'The built-in fallback vocabulary every ui profile resolves against.',\n module: '@cratis/scene.react',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n};\n\n/**\n * The `core` package as a loadable bundle.\n */\nexport const corePackage: ScenePackageBundle = {\n manifest: corePackageManifest,\n components: coreComponents,\n descriptors: coreDescriptors,\n};\n"],"names":["corePackageManifest","name","version","kind","PackageKind","ComponentLibrary","dependencies","components","layouts","screenTemplates","dialogTemplates","themes","displayName","description","module","license","licenseUrl","corePackage","manifest","coreComponents","descriptors","coreDescriptors"],"mappings":";;;;;;AAAA;AACA;AAOA;;;;;;UAOaA,mBAAAA,GAAoC;IAC7CC,IAAAA,EAAM,MAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,wBAAYC,gBAAgB;AAClCC,IAAAA,YAAAA,EAAc,EAAE;IAChBC,UAAAA,EAAY;AACR,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,UAAA;AACA,QAAA,OAAA;AACA,QAAA,OAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,OAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,eAAA;AACA,QAAA;AACH,KAAA;AACDC,IAAAA,OAAAA,EAAS,EAAE;AACXC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,MAAAA,EAAQ,EAAE;IACVC,WAAAA,EAAa,MAAA;IACbC,WAAAA,EAAa,qEAAA;IACbC,MAAAA,EAAQ,qBAAA;IACRC,OAAAA,EAAS,KAAA;IACTC,UAAAA,EAAY;AAChB;AAEA;;UAGaC,WAAAA,GAAkC;IAC3CC,QAAAA,EAAUlB,mBAAAA;IACVO,UAAAA,EAAYY,6BAAAA;IACZC,WAAAA,EAAaC;AACjB;;;"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -6,6 +6,8 @@ var BindingOutputContext = require('./renderer/BindingOutputContext.js');
|
|
|
6
6
|
var RenderBindingScopeContext = require('./renderer/RenderBindingScopeContext.js');
|
|
7
7
|
var UnresolvedComponent = require('./renderer/UnresolvedComponent.js');
|
|
8
8
|
var useBoundQuery = require('./renderer/useBoundQuery.js');
|
|
9
|
+
var useValueOutput = require('./renderer/useValueOutput.js');
|
|
10
|
+
var valueOutputProperty = require('./renderer/valueOutputProperty.js');
|
|
9
11
|
var createReactRenderer = require('./renderer/createReactRenderer.js');
|
|
10
12
|
var InteractiveComponent = require('./renderer/InteractiveComponent.js');
|
|
11
13
|
var CoreText = require('./core/CoreText.js');
|
|
@@ -21,6 +23,7 @@ var extractNavigationItem = require('./NavBar/extractNavigationItem.js');
|
|
|
21
23
|
var SceneNavigationContext = require('./navigation/SceneNavigationContext.js');
|
|
22
24
|
var SceneNavigationHost = require('./navigation/SceneNavigationHost.js');
|
|
23
25
|
var createBrowserSceneHistory = require('./navigation/createBrowserSceneHistory.js');
|
|
26
|
+
var createHashSceneHistory = require('./navigation/createHashSceneHistory.js');
|
|
24
27
|
var createMemorySceneHistory = require('./navigation/createMemorySceneHistory.js');
|
|
25
28
|
var diagnoseRenderedNavigation = require('./navigation/diagnoseRenderedNavigation.js');
|
|
26
29
|
var identityRoute = require('./navigation/identityRoute.js');
|
|
@@ -29,6 +32,10 @@ var navigationRouteKey = require('./navigation/navigationRouteKey.js');
|
|
|
29
32
|
var resolveDestination = require('./navigation/resolveDestination.js');
|
|
30
33
|
var sceneRoutesFrom = require('./navigation/sceneRoutesFrom.js');
|
|
31
34
|
var useSceneHistoryNavigation = require('./navigation/useSceneHistoryNavigation.js');
|
|
35
|
+
var CoreOutlet = require('./navigation/CoreOutlet.js');
|
|
36
|
+
var SceneOutletContext = require('./navigation/SceneOutletContext.js');
|
|
37
|
+
var collectOutletOwners = require('./navigation/collectOutletOwners.js');
|
|
38
|
+
var placeInOutlet = require('./navigation/placeInOutlet.js');
|
|
32
39
|
var IconAdapterRegistry = require('./icons/IconAdapterRegistry.js');
|
|
33
40
|
var IconAdapterContext = require('./icons/IconAdapterContext.js');
|
|
34
41
|
var useIconGlyph = require('./icons/useIconGlyph.js');
|
|
@@ -72,6 +79,9 @@ exports.useRenderBindingResolver = RenderBindingScopeContext.useRenderBindingRes
|
|
|
72
79
|
exports.useRenderBindingScope = RenderBindingScopeContext.useRenderBindingScope;
|
|
73
80
|
exports.UnresolvedComponent = UnresolvedComponent.UnresolvedComponent;
|
|
74
81
|
exports.useBoundQuery = useBoundQuery.useBoundQuery;
|
|
82
|
+
exports.useValueOutput = useValueOutput.useValueOutput;
|
|
83
|
+
exports.valueOutputName = useValueOutput.valueOutputName;
|
|
84
|
+
exports.valueOutputProperty = valueOutputProperty.valueOutputProperty;
|
|
75
85
|
exports.createReactRenderer = createReactRenderer.createReactRenderer;
|
|
76
86
|
exports.InteractiveComponent = InteractiveComponent.InteractiveComponent;
|
|
77
87
|
exports.CoreText = CoreText.CoreText;
|
|
@@ -95,10 +105,12 @@ exports.corePackage = corePackage.corePackage;
|
|
|
95
105
|
exports.corePackageManifest = corePackage.corePackageManifest;
|
|
96
106
|
exports.NavBar = NavBar.NavBar;
|
|
97
107
|
exports.extractNavigationItem = extractNavigationItem.extractNavigationItem;
|
|
108
|
+
exports.SceneNavigationContextInternal = SceneNavigationContext.SceneNavigationContextInternal;
|
|
98
109
|
exports.SceneNavigationProvider = SceneNavigationContext.SceneNavigationProvider;
|
|
99
110
|
exports.useSceneNavigation = SceneNavigationContext.useSceneNavigation;
|
|
100
111
|
exports.SceneNavigationHost = SceneNavigationHost.SceneNavigationHost;
|
|
101
112
|
exports.createBrowserSceneHistory = createBrowserSceneHistory.createBrowserSceneHistory;
|
|
113
|
+
exports.createHashSceneHistory = createHashSceneHistory.createHashSceneHistory;
|
|
102
114
|
exports.createMemorySceneHistory = createMemorySceneHistory.createMemorySceneHistory;
|
|
103
115
|
exports.diagnoseRenderedNavigation = diagnoseRenderedNavigation.diagnoseRenderedNavigation;
|
|
104
116
|
exports.identityRoute = identityRoute.identityRoute;
|
|
@@ -107,6 +119,12 @@ exports.navigationRouteKey = navigationRouteKey.navigationRouteKey;
|
|
|
107
119
|
exports.resolveDestination = resolveDestination.resolveDestination;
|
|
108
120
|
exports.sceneRoutesFrom = sceneRoutesFrom.sceneRoutesFrom;
|
|
109
121
|
exports.useSceneHistoryNavigation = useSceneHistoryNavigation.useSceneHistoryNavigation;
|
|
122
|
+
exports.CoreOutlet = CoreOutlet.CoreOutlet;
|
|
123
|
+
exports.SceneOutletContext = SceneOutletContext.SceneOutletContext;
|
|
124
|
+
exports.useSceneOutlets = SceneOutletContext.useSceneOutlets;
|
|
125
|
+
exports.collectOutletOwners = collectOutletOwners.collectOutletOwners;
|
|
126
|
+
exports.outletComponentName = collectOutletOwners.outletComponentName;
|
|
127
|
+
exports.placeInOutlet = placeInOutlet.placeInOutlet;
|
|
110
128
|
exports.IconAdapterRegistry = IconAdapterRegistry.IconAdapterRegistry;
|
|
111
129
|
exports.createIconAdapterRegistry = IconAdapterRegistry.createIconAdapterRegistry;
|
|
112
130
|
exports.IconAdapterProvider = IconAdapterContext.IconAdapterProvider;
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var SceneElementView = require('../SceneElementView.js');
|
|
6
|
+
var SceneNavigationContext = require('./SceneNavigationContext.js');
|
|
7
|
+
var SceneOutletContext = require('./SceneOutletContext.js');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A nested outlet a screen declares: `core:outlet` with a `name`. Inside a navigation host it renders the
|
|
11
|
+
* screen placed in that outlet - which may declare outlets of its own, so composition nests to any depth -
|
|
12
|
+
* and nothing while the outlet is empty. Outside a navigation host it renders the empty region.
|
|
13
|
+
*/ function CoreOutlet({ element }) {
|
|
14
|
+
const name = typeof element.properties.name === 'string' ? element.properties.name : '';
|
|
15
|
+
const navigation = react.useContext(SceneNavigationContext.SceneNavigationContextInternal);
|
|
16
|
+
const outlets = SceneOutletContext.useSceneOutlets();
|
|
17
|
+
const placed = navigation?.outlets[name];
|
|
18
|
+
const screen = placed && outlets ? outlets.screens[placed] : undefined;
|
|
19
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
20
|
+
"data-scene-outlet": name,
|
|
21
|
+
"data-scene-outlet-screen": placed,
|
|
22
|
+
children: screen && outlets && /*#__PURE__*/ jsxRuntime.jsx(SceneElementView.SceneElementView, {
|
|
23
|
+
element: screen,
|
|
24
|
+
registry: outlets.registry,
|
|
25
|
+
dataContext: navigation?.bindingScope.dataContext,
|
|
26
|
+
queryResults: navigation?.bindingScope.queryResults
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
exports.CoreOutlet = CoreOutlet;
|
|
32
|
+
//# sourceMappingURL=CoreOutlet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreOutlet.js","sources":["../../../navigation/CoreOutlet.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 { useContext } from 'react';\nimport { RegisteredComponentProps } from '../renderer/ComponentRegistry';\nimport { SceneElementView } from '../SceneElementView';\nimport { SceneNavigationContextInternal } from './SceneNavigationContext';\nimport { useSceneOutlets } from './SceneOutletContext';\n\n/**\n * A nested outlet a screen declares: `core:outlet` with a `name`. Inside a navigation host it renders the\n * screen placed in that outlet - which may declare outlets of its own, so composition nests to any depth -\n * and nothing while the outlet is empty. Outside a navigation host it renders the empty region.\n */\nexport function CoreOutlet({ element }: RegisteredComponentProps) {\n const name = typeof element.properties.name === 'string' ? element.properties.name : '';\n const navigation = useContext(SceneNavigationContextInternal);\n const outlets = useSceneOutlets();\n const placed = navigation?.outlets[name];\n const screen = placed && outlets ? outlets.screens[placed] : undefined;\n\n return <div data-scene-outlet={name} data-scene-outlet-screen={placed}>\n {screen && outlets && <SceneElementView element={screen} registry={outlets.registry}\n dataContext={navigation?.bindingScope.dataContext} queryResults={navigation?.bindingScope.queryResults} />}\n </div>;\n}\n"],"names":["CoreOutlet","element","name","properties","navigation","useContext","SceneNavigationContextInternal","outlets","useSceneOutlets","placed","screen","screens","undefined","_jsx","div","data-scene-outlet","data-scene-outlet-screen","SceneElementView","registry","dataContext","bindingScope","queryResults"],"mappings":";;;;;;;;AASA;;;;AAIC,IACM,SAASA,UAAAA,CAAW,EAAEC,OAAO,EAA4B,EAAA;AAC5D,IAAA,MAAMC,IAAAA,GAAO,OAAOD,OAAAA,CAAQE,UAAU,CAACD,IAAI,KAAK,QAAA,GAAWD,OAAAA,CAAQE,UAAU,CAACD,IAAI,GAAG,EAAA;AACrF,IAAA,MAAME,aAAaC,gBAAAA,CAAWC,qDAAAA,CAAAA;AAC9B,IAAA,MAAMC,OAAAA,GAAUC,kCAAAA,EAAAA;AAChB,IAAA,MAAMC,MAAAA,GAASL,UAAAA,EAAYG,OAAO,CAACL,IAAAA,CAAK;AACxC,IAAA,MAAMQ,SAASD,MAAAA,IAAUF,OAAAA,GAAUA,QAAQI,OAAO,CAACF,OAAO,GAAGG,SAAAA;AAE7D,IAAA,qBAAOC,cAAA,CAACC,KAAAA,EAAAA;QAAIC,mBAAAA,EAAmBb,IAAAA;QAAMc,0BAAAA,EAA0BP,MAAAA;AAC1DC,QAAAA,QAAAA,EAAAA,MAAAA,IAAUH,yBAAWM,cAAA,CAACI,iCAAAA,EAAAA;YAAiBhB,OAAAA,EAASS,MAAAA;AAAQQ,YAAAA,QAAAA,EAAUX,QAAQW,QAAQ;AAC/EC,YAAAA,WAAAA,EAAaf,YAAYgB,YAAAA,CAAaD,WAAAA;AAAaE,YAAAA,YAAAA,EAAcjB,YAAYgB,YAAAA,CAAaC;;;AAEtG;;"}
|
|
@@ -4,6 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var react = require('react');
|
|
5
5
|
|
|
6
6
|
const Context = /*#__PURE__*/ react.createContext(undefined);
|
|
7
|
+
/** The navigation context itself, for components that render outside a host as well as inside one. */ const SceneNavigationContextInternal = Context;
|
|
7
8
|
function SceneNavigationProvider({ value, children }) {
|
|
8
9
|
return /*#__PURE__*/ jsxRuntime.jsx(Context.Provider, {
|
|
9
10
|
value: value,
|
|
@@ -16,6 +17,7 @@ function useSceneNavigation() {
|
|
|
16
17
|
return context;
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
exports.SceneNavigationContextInternal = SceneNavigationContextInternal;
|
|
19
21
|
exports.SceneNavigationProvider = SceneNavigationProvider;
|
|
20
22
|
exports.useSceneNavigation = useSceneNavigation;
|
|
21
23
|
//# sourceMappingURL=SceneNavigationContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneNavigationContext.js","sources":["../../../navigation/SceneNavigationContext.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 { ReactNode, createContext, useContext } from 'react';\nimport { BindingScope } from '@cratis/scene.engine';\nimport { DestinationReference } from '@cratis/scene.model';\nimport { DestinationResolution } from './DestinationResolution';\nimport { DialogResult } from './DialogResult';\n\nexport interface SceneNavigationContextValue {\n currentScreen: string;\n currentUrl?: string;\n currentOutlet?: string;\n currentDialog?: string;\n\n /** The route parameters of the current entry - from the destination that opened it, or the deep link. */\n currentParameters: Record<string, string>;\n\n /** What the last dialog returned when it closed. */\n dialogResult?: DialogResult;\n\n /** A deep link that matched no route; the host fell back to its initial screen. */\n unresolvedUrl?: string;\n bindingScope: BindingScope;\n navigate(destination: DestinationReference): DestinationResolution;\n\n /** Closes the open dialog, returning to the entry that opened it, and records its result. */\n closeDialog(result?: unknown): void;\n\n /** Goes back one history entry. */\n back(): void;\n}\n\nconst Context = createContext<SceneNavigationContextValue | undefined>(undefined);\n\nexport interface SceneNavigationProviderProps {\n value: SceneNavigationContextValue;\n children: ReactNode;\n}\n\nexport function SceneNavigationProvider({ value, children }: SceneNavigationProviderProps) {\n return <Context.Provider value={value}>{children}</Context.Provider>;\n}\n\nexport function useSceneNavigation(): SceneNavigationContextValue {\n const context = useContext(Context);\n if (!context) throw new Error('No Scene navigation context is available.');\n return context;\n}\n"],"names":["Context","createContext","undefined","SceneNavigationProvider","value","children","_jsx","Provider","useSceneNavigation","context","useContext","Error"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"SceneNavigationContext.js","sources":["../../../navigation/SceneNavigationContext.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 { ReactNode, createContext, useContext } from 'react';\nimport { BindingScope } from '@cratis/scene.engine';\nimport { DestinationReference } from '@cratis/scene.model';\nimport { DestinationResolution } from './DestinationResolution';\nimport { DialogResult } from './DialogResult';\n\nexport interface SceneNavigationContextValue {\n /** The screen the last navigation opened. */\n currentScreen: string;\n\n /** The screen in the primary region. */\n primaryScreen: string;\n\n /** Which screen each nested outlet shows, by outlet name. */\n outlets: Record<string, string>;\n currentUrl?: string;\n currentOutlet?: string;\n currentDialog?: string;\n\n /** The route parameters of the current entry - from the destination that opened it, or the deep link. */\n currentParameters: Record<string, string>;\n\n /** What the last dialog returned when it closed. */\n dialogResult?: DialogResult;\n\n /** A deep link that matched no route; the host fell back to its initial screen. */\n unresolvedUrl?: string;\n bindingScope: BindingScope;\n navigate(destination: DestinationReference): DestinationResolution;\n\n /** Closes the open dialog, returning to the entry that opened it, and records its result. */\n closeDialog(result?: unknown): void;\n\n /** Goes back one history entry. */\n back(): void;\n}\n\nconst Context = createContext<SceneNavigationContextValue | undefined>(undefined);\n\n/** The navigation context itself, for components that render outside a host as well as inside one. */\nexport const SceneNavigationContextInternal = Context;\n\nexport interface SceneNavigationProviderProps {\n value: SceneNavigationContextValue;\n children: ReactNode;\n}\n\nexport function SceneNavigationProvider({ value, children }: SceneNavigationProviderProps) {\n return <Context.Provider value={value}>{children}</Context.Provider>;\n}\n\nexport function useSceneNavigation(): SceneNavigationContextValue {\n const context = useContext(Context);\n if (!context) throw new Error('No Scene navigation context is available.');\n return context;\n}\n"],"names":["Context","createContext","undefined","SceneNavigationContextInternal","SceneNavigationProvider","value","children","_jsx","Provider","useSceneNavigation","context","useContext","Error"],"mappings":";;;;;AAwCA,MAAMA,wBAAUC,mBAAAA,CAAuDC,SAAAA,CAAAA;AAEvE,uGACO,MAAMC,8BAAAA,GAAiCH;AAOvC,SAASI,uBAAAA,CAAwB,EAAEC,KAAK,EAAEC,QAAQ,EAAgC,EAAA;IACrF,qBAAOC,cAAA,CAACP,QAAQQ,QAAQ,EAAA;QAACH,KAAAA,EAAOA,KAAAA;AAAQC,QAAAA,QAAAA,EAAAA;;AAC5C;AAEO,SAASG,kBAAAA,GAAAA;AACZ,IAAA,MAAMC,UAAUC,gBAAAA,CAAWX,OAAAA,CAAAA;AAC3B,IAAA,IAAI,CAACU,OAAAA,EAAS,MAAM,IAAIE,KAAAA,CAAM,2CAAA,CAAA;IAC9B,OAAOF,OAAAA;AACX;;;;"}
|
|
@@ -6,10 +6,14 @@ var SceneElementView = require('../SceneElementView.js');
|
|
|
6
6
|
var createMemorySceneHistory = require('./createMemorySceneHistory.js');
|
|
7
7
|
var SceneNavigationContext = require('./SceneNavigationContext.js');
|
|
8
8
|
var sceneRoutesFrom = require('./sceneRoutesFrom.js');
|
|
9
|
+
var collectOutletOwners = require('./collectOutletOwners.js');
|
|
10
|
+
var SceneOutletContext = require('./SceneOutletContext.js');
|
|
9
11
|
var useSceneHistoryNavigation = require('./useSceneHistoryNavigation.js');
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
|
-
* Executes Scene destinations against an in-memory rendered hierarchy:
|
|
14
|
+
* Executes Scene destinations against an in-memory rendered hierarchy: a destination into a nested outlet -
|
|
15
|
+
* one a screen declares with `core:outlet` - places its screen there and keeps the screens above it, to any
|
|
16
|
+
* depth; any other screen route replaces the primary region,
|
|
13
17
|
* dialog destinations render dialog content over the screen that opened them, and external destinations
|
|
14
18
|
* only report their resolved action. Every navigation is a history entry.
|
|
15
19
|
*/ function SceneNavigationHost({ screens, dialogs = {}, initialScreen, registry, bindingScope = {}, history, destinations, routes }) {
|
|
@@ -19,37 +23,50 @@ var useSceneHistoryNavigation = require('./useSceneHistoryNavigation.js');
|
|
|
19
23
|
routes,
|
|
20
24
|
screens
|
|
21
25
|
]);
|
|
22
|
-
const
|
|
23
|
-
|
|
26
|
+
const outletOwners = react.useMemo(()=>collectOutletOwners.collectOutletOwners(screens), [
|
|
27
|
+
screens
|
|
28
|
+
]);
|
|
29
|
+
const value = useSceneHistoryNavigation.useSceneHistoryNavigation(history ?? memoryHistory, routeTable, initialScreen, bindingScope, outletOwners, destinations);
|
|
30
|
+
const outletContext = react.useMemo(()=>({
|
|
31
|
+
screens,
|
|
32
|
+
registry
|
|
33
|
+
}), [
|
|
34
|
+
registry,
|
|
35
|
+
screens
|
|
36
|
+
]);
|
|
37
|
+
const screen = screens[value.primaryScreen];
|
|
24
38
|
const dialog = value.currentDialog ? dialogs[value.currentDialog] : undefined;
|
|
25
|
-
return /*#__PURE__*/ jsxRuntime.
|
|
39
|
+
return /*#__PURE__*/ jsxRuntime.jsx(SceneNavigationContext.SceneNavigationProvider, {
|
|
26
40
|
value: value,
|
|
27
|
-
children:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(SceneOutletContext.SceneOutletContext.Provider, {
|
|
42
|
+
value: outletContext,
|
|
43
|
+
children: [
|
|
44
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
45
|
+
"data-scene-outlet": value.primaryScreen === value.currentScreen ? value.currentOutlet ?? 'primary' : 'primary',
|
|
46
|
+
"data-scene-url": value.currentUrl,
|
|
47
|
+
children: screen && /*#__PURE__*/ jsxRuntime.jsx(SceneElementView.SceneElementView, {
|
|
48
|
+
element: screen,
|
|
49
|
+
registry: registry,
|
|
50
|
+
dataContext: bindingScope.dataContext,
|
|
51
|
+
queryResults: bindingScope.queryResults,
|
|
52
|
+
componentOutputs: bindingScope.componentOutputs
|
|
53
|
+
})
|
|
54
|
+
}),
|
|
55
|
+
dialog && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
56
|
+
role: "dialog",
|
|
57
|
+
"aria-modal": "true",
|
|
58
|
+
"aria-label": value.currentDialog,
|
|
59
|
+
"data-scene-dialog": value.currentDialog,
|
|
60
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(SceneElementView.SceneElementView, {
|
|
61
|
+
element: dialog,
|
|
62
|
+
registry: registry,
|
|
63
|
+
dataContext: bindingScope.dataContext,
|
|
64
|
+
queryResults: bindingScope.queryResults,
|
|
65
|
+
componentOutputs: bindingScope.componentOutputs
|
|
66
|
+
})
|
|
50
67
|
})
|
|
51
|
-
|
|
52
|
-
|
|
68
|
+
]
|
|
69
|
+
})
|
|
53
70
|
});
|
|
54
71
|
}
|
|
55
72
|
|