@cratis/scene.react 4.15.0 → 4.16.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/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/index.js +7 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/navigation/createHashSceneHistory.js +43 -0
- package/dist/cjs/navigation/createHashSceneHistory.js.map +1 -0
- 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/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- 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 +1 -0
- package/dist/esm/navigation/index.d.ts.map +1 -1
- package/dist/esm/navigation/index.js +1 -0
- package/dist/esm/navigation/index.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/createHashSceneHistory.ts +42 -0
- package/navigation/index.ts +1 -0
- 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
|
|
|
@@ -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,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,cAAA,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,+CAAAA,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,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
|
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');
|
|
@@ -72,6 +75,9 @@ exports.useRenderBindingResolver = RenderBindingScopeContext.useRenderBindingRes
|
|
|
72
75
|
exports.useRenderBindingScope = RenderBindingScopeContext.useRenderBindingScope;
|
|
73
76
|
exports.UnresolvedComponent = UnresolvedComponent.UnresolvedComponent;
|
|
74
77
|
exports.useBoundQuery = useBoundQuery.useBoundQuery;
|
|
78
|
+
exports.useValueOutput = useValueOutput.useValueOutput;
|
|
79
|
+
exports.valueOutputName = useValueOutput.valueOutputName;
|
|
80
|
+
exports.valueOutputProperty = valueOutputProperty.valueOutputProperty;
|
|
75
81
|
exports.createReactRenderer = createReactRenderer.createReactRenderer;
|
|
76
82
|
exports.InteractiveComponent = InteractiveComponent.InteractiveComponent;
|
|
77
83
|
exports.CoreText = CoreText.CoreText;
|
|
@@ -99,6 +105,7 @@ exports.SceneNavigationProvider = SceneNavigationContext.SceneNavigationProvider
|
|
|
99
105
|
exports.useSceneNavigation = SceneNavigationContext.useSceneNavigation;
|
|
100
106
|
exports.SceneNavigationHost = SceneNavigationHost.SceneNavigationHost;
|
|
101
107
|
exports.createBrowserSceneHistory = createBrowserSceneHistory.createBrowserSceneHistory;
|
|
108
|
+
exports.createHashSceneHistory = createHashSceneHistory.createHashSceneHistory;
|
|
102
109
|
exports.createMemorySceneHistory = createMemorySceneHistory.createMemorySceneHistory;
|
|
103
110
|
exports.diagnoseRenderedNavigation = diagnoseRenderedNavigation.diagnoseRenderedNavigation;
|
|
104
111
|
exports.identityRoute = identityRoute.identityRoute;
|
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,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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AQyB,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,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,CAAA,C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GAAA,CAACiD,IAAAA,EAAAA;AAAG9C,QAAAA,eAAAA,EAAeJ,QAAQK,EAAE;AAAG4B,QAAAA,QAAAA,EAAAA,KAAAA,CAAMkB;;AACjD;AAEA,iDACO,SAASC,SAAAA,CAAU,EAAEpD,OAAO,EAA4B,EAAA;AAC3D,IAAA,MAAMgD,QAAAA,GAAWrD,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,UAAA,CAAA;AAClD,IAAA,qBAAOK,GAAA,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,GAAA,CAACuD,KAAAA,EAAAA;AAAIpD,QAAAA,eAAAA,EAAeJ,QAAQK,EAAE;AAAE,QAAA,QAAA,gBAAAJ,GAAA,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,IAAA,CAAC0B,GAAAA,EAAAA;AAAExD,QAAAA,eAAAA,EAAeJ,QAAQK,EAAE;;AAAE,YAAA,iBAAA;YAAgBV,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,MAAA;;;AAC1F;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -4,6 +4,8 @@ export { BindingOutputProvider, useBindingOutputScope, useBindingOutputs } from
|
|
|
4
4
|
export { RenderBindingScopeProvider, useRenderBindingResolver, useRenderBindingScope } from './renderer/RenderBindingScopeContext.js';
|
|
5
5
|
export { UnresolvedComponent } from './renderer/UnresolvedComponent.js';
|
|
6
6
|
export { useBoundQuery } from './renderer/useBoundQuery.js';
|
|
7
|
+
export { useValueOutput, valueOutputName } from './renderer/useValueOutput.js';
|
|
8
|
+
export { valueOutputProperty } from './renderer/valueOutputProperty.js';
|
|
7
9
|
export { createReactRenderer } from './renderer/createReactRenderer.js';
|
|
8
10
|
export { InteractiveComponent } from './renderer/InteractiveComponent.js';
|
|
9
11
|
export { CoreText } from './core/CoreText.js';
|
|
@@ -19,6 +21,7 @@ export { extractNavigationItem } from './NavBar/extractNavigationItem.js';
|
|
|
19
21
|
export { SceneNavigationProvider, useSceneNavigation } from './navigation/SceneNavigationContext.js';
|
|
20
22
|
export { SceneNavigationHost } from './navigation/SceneNavigationHost.js';
|
|
21
23
|
export { createBrowserSceneHistory } from './navigation/createBrowserSceneHistory.js';
|
|
24
|
+
export { createHashSceneHistory } from './navigation/createHashSceneHistory.js';
|
|
22
25
|
export { createMemorySceneHistory } from './navigation/createMemorySceneHistory.js';
|
|
23
26
|
export { diagnoseRenderedNavigation } from './navigation/diagnoseRenderedNavigation.js';
|
|
24
27
|
export { identityRoute } from './navigation/identityRoute.js';
|
package/dist/esm/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 @@
|
|
|
1
|
+
{"version":3,"file":"createHashSceneHistory.d.ts","sourceRoot":"","sources":["../../../navigation/createHashSceneHistory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAY9C,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,kBAA2B,GAAG,YAAY,CAyBzF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
const stateKey = 'sceneNavigation';
|
|
4
|
+
/**
|
|
5
|
+
* A history kept in the URL fragment - `index.html#/WorkItemDetails?workItemId=B` - for hosts that are served
|
|
6
|
+
* as a single file or from a path they do not control, such as a generated runtime or a webview. It behaves
|
|
7
|
+
* like `createBrowserSceneHistory`: entries are pushed with their navigation state, back and forward restore
|
|
8
|
+
* them, and a typed or bookmarked fragment is matched by URL alone. A fragment changed by hand, which fires
|
|
9
|
+
* `hashchange` rather than `popstate`, is reported the same way.
|
|
10
|
+
*/ function createHashSceneHistory(browser = window) {
|
|
11
|
+
const location = ()=>{
|
|
12
|
+
const fragment = browser.location.hash.replace(/^#\/?/, '');
|
|
13
|
+
return fragment.length ? fragment : undefined;
|
|
14
|
+
};
|
|
15
|
+
const href = (url)=>`${browser.location.pathname}${browser.location.search}#/${url ?? ''}`;
|
|
16
|
+
const stored = (value)=>value?.[stateKey];
|
|
17
|
+
return {
|
|
18
|
+
location,
|
|
19
|
+
state: ()=>stored(browser.history.state),
|
|
20
|
+
push: (state)=>browser.history.pushState({
|
|
21
|
+
[stateKey]: state
|
|
22
|
+
}, '', href(state.url)),
|
|
23
|
+
replace: (state)=>browser.history.replaceState({
|
|
24
|
+
[stateKey]: state
|
|
25
|
+
}, '', href(state.url)),
|
|
26
|
+
back: ()=>browser.history.back(),
|
|
27
|
+
listen: (listener)=>{
|
|
28
|
+
const onPopState = (event)=>listener(location(), stored(event.state));
|
|
29
|
+
const onHashChange = ()=>listener(location(), stored(browser.history.state));
|
|
30
|
+
browser.addEventListener('popstate', onPopState);
|
|
31
|
+
browser.addEventListener('hashchange', onHashChange);
|
|
32
|
+
return ()=>{
|
|
33
|
+
browser.removeEventListener('popstate', onPopState);
|
|
34
|
+
browser.removeEventListener('hashchange', onHashChange);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { createHashSceneHistory };
|
|
41
|
+
//# 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;;"}
|
|
@@ -6,6 +6,7 @@ export * from './SceneNavigationHost';
|
|
|
6
6
|
export * from './SceneNavigationState';
|
|
7
7
|
export * from './SceneRoute';
|
|
8
8
|
export * from './createBrowserSceneHistory';
|
|
9
|
+
export * from './createHashSceneHistory';
|
|
9
10
|
export * from './createMemorySceneHistory';
|
|
10
11
|
export * from './diagnoseRenderedNavigation';
|
|
11
12
|
export * from './identityRoute';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../navigation/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../navigation/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC"}
|