@cratis/scene.react 4.9.0 → 4.10.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/SceneElementView.tsx +29 -7
- package/dist/cjs/SceneElementView.js +21 -8
- package/dist/cjs/SceneElementView.js.map +1 -1
- package/dist/cjs/core/coreComponents.js +4 -0
- package/dist/cjs/core/coreComponents.js.map +1 -1
- package/dist/cjs/core/coreDescriptors.js +3 -0
- package/dist/cjs/core/coreDescriptors.js.map +1 -1
- package/dist/cjs/index.js +11 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/navigation/resolveDestination.js +54 -0
- package/dist/cjs/navigation/resolveDestination.js.map +1 -0
- package/dist/cjs/packages/DesignTimeBundle.js.map +1 -1
- package/dist/cjs/packages/DesignTimeProvider.js +23 -0
- package/dist/cjs/packages/DesignTimeProvider.js.map +1 -0
- package/dist/cjs/packages/PackageHostConfiguration.js +30 -2
- package/dist/cjs/packages/PackageHostConfiguration.js.map +1 -1
- package/dist/cjs/renderer/AbortableQueryRunner.js +26 -0
- package/dist/cjs/renderer/AbortableQueryRunner.js.map +1 -0
- package/dist/cjs/renderer/InteractiveComponent.js +30 -1
- package/dist/cjs/renderer/InteractiveComponent.js.map +1 -1
- package/dist/cjs/renderer/RenderBindingScopeContext.js +77 -0
- package/dist/cjs/renderer/RenderBindingScopeContext.js.map +1 -0
- package/dist/esm/SceneElementView.d.ts +5 -2
- package/dist/esm/SceneElementView.d.ts.map +1 -1
- package/dist/esm/SceneElementView.js +22 -9
- package/dist/esm/SceneElementView.js.map +1 -1
- package/dist/esm/core/coreComponents.js +4 -0
- package/dist/esm/core/coreComponents.js.map +1 -1
- package/dist/esm/core/coreDescriptors.js +3 -0
- package/dist/esm/core/coreDescriptors.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/navigation/DestinationResolution.d.ts +10 -0
- package/dist/esm/navigation/DestinationResolution.d.ts.map +1 -0
- package/dist/esm/navigation/DestinationResolution.js +2 -0
- package/dist/esm/navigation/DestinationResolution.js.map +1 -0
- package/dist/esm/navigation/index.d.ts +3 -0
- package/dist/esm/navigation/index.d.ts.map +1 -0
- package/dist/esm/navigation/index.js +3 -0
- package/dist/esm/navigation/index.js.map +1 -0
- package/dist/esm/navigation/resolveDestination.d.ts +5 -0
- package/dist/esm/navigation/resolveDestination.d.ts.map +1 -0
- package/dist/esm/navigation/resolveDestination.js +52 -0
- package/dist/esm/navigation/resolveDestination.js.map +1 -0
- package/dist/esm/packages/DesignTimeAction.d.ts +3 -4
- package/dist/esm/packages/DesignTimeAction.d.ts.map +1 -1
- package/dist/esm/packages/DesignTimeBundle.d.ts +8 -11
- package/dist/esm/packages/DesignTimeBundle.d.ts.map +1 -1
- package/dist/esm/packages/DesignTimeBundle.js.map +1 -1
- package/dist/esm/packages/DesignTimeComponentProps.d.ts +5 -0
- package/dist/esm/packages/DesignTimeComponentProps.d.ts.map +1 -0
- package/dist/esm/packages/DesignTimeComponentProps.js +2 -0
- package/dist/esm/packages/DesignTimeComponentProps.js.map +1 -0
- package/dist/esm/packages/DesignTimeContext.d.ts +18 -0
- package/dist/esm/packages/DesignTimeContext.d.ts.map +1 -0
- package/dist/esm/packages/DesignTimeContext.js +2 -0
- package/dist/esm/packages/DesignTimeContext.js.map +1 -0
- package/dist/esm/packages/DesignTimePropertyDisplayProps.d.ts +8 -0
- package/dist/esm/packages/DesignTimePropertyDisplayProps.d.ts.map +1 -0
- package/dist/esm/packages/DesignTimePropertyDisplayProps.js +2 -0
- package/dist/esm/packages/DesignTimePropertyDisplayProps.js.map +1 -0
- package/dist/esm/packages/DesignTimePropertyEditorProps.d.ts +9 -0
- package/dist/esm/packages/DesignTimePropertyEditorProps.d.ts.map +1 -0
- package/dist/esm/packages/DesignTimePropertyEditorProps.js +2 -0
- package/dist/esm/packages/DesignTimePropertyEditorProps.js.map +1 -0
- package/dist/esm/packages/DesignTimeProvider.d.ts +9 -0
- package/dist/esm/packages/DesignTimeProvider.d.ts.map +1 -0
- package/dist/esm/packages/DesignTimeProvider.js +20 -0
- package/dist/esm/packages/DesignTimeProvider.js.map +1 -0
- package/dist/esm/packages/PackageHostConfiguration.d.ts +8 -1
- package/dist/esm/packages/PackageHostConfiguration.d.ts.map +1 -1
- package/dist/esm/packages/PackageHostConfiguration.js +31 -3
- package/dist/esm/packages/PackageHostConfiguration.js.map +1 -1
- package/dist/esm/packages/index.d.ts +6 -0
- package/dist/esm/packages/index.d.ts.map +1 -1
- package/dist/esm/packages/index.js +6 -0
- package/dist/esm/packages/index.js.map +1 -1
- package/dist/esm/renderer/AbortableQueryRunner.d.ts +7 -0
- package/dist/esm/renderer/AbortableQueryRunner.d.ts.map +1 -0
- package/dist/esm/renderer/AbortableQueryRunner.js +24 -0
- package/dist/esm/renderer/AbortableQueryRunner.js.map +1 -0
- package/dist/esm/renderer/InteractiveComponent.d.ts.map +1 -1
- package/dist/esm/renderer/InteractiveComponent.js +31 -2
- package/dist/esm/renderer/InteractiveComponent.js.map +1 -1
- package/dist/esm/renderer/RenderBindingScopeContext.d.ts +14 -0
- package/dist/esm/renderer/RenderBindingScopeContext.d.ts.map +1 -0
- package/dist/esm/renderer/RenderBindingScopeContext.js +73 -0
- package/dist/esm/renderer/RenderBindingScopeContext.js.map +1 -0
- 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/tsconfig.tsbuildinfo +1 -1
- package/index.ts +1 -0
- package/navigation/DestinationResolution.ts +13 -0
- package/navigation/index.ts +5 -0
- package/navigation/resolveDestination.ts +50 -0
- package/package.json +5 -5
- package/packages/DesignTimeAction.ts +3 -4
- package/packages/DesignTimeBundle.ts +8 -5
- package/packages/DesignTimeComponentProps.ts +11 -0
- package/packages/DesignTimeContext.ts +32 -0
- package/packages/DesignTimePropertyDisplayProps.ts +14 -0
- package/packages/DesignTimePropertyEditorProps.ts +15 -0
- package/packages/DesignTimeProvider.tsx +25 -0
- package/packages/PackageHostConfiguration.ts +47 -5
- package/packages/index.ts +6 -0
- package/renderer/AbortableQueryRunner.ts +27 -0
- package/renderer/InteractiveComponent.tsx +27 -3
- package/renderer/RenderBindingScopeContext.tsx +73 -0
- package/renderer/index.ts +2 -0
package/SceneElementView.tsx
CHANGED
|
@@ -4,12 +4,15 @@
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { applyEffectiveConfiguration, renderElement, BindingResolver } from '@cratis/scene.engine';
|
|
6
6
|
import { EffectiveConfiguration, SceneElement } from '@cratis/scene.model';
|
|
7
|
-
import {
|
|
7
|
+
import { ComponentRegistry, RenderBindingScopeProvider, createReactRenderer, useRenderBindingResolver } from './renderer';
|
|
8
8
|
|
|
9
9
|
export interface SceneElementViewProps {
|
|
10
10
|
element: SceneElement;
|
|
11
11
|
registry: ComponentRegistry;
|
|
12
|
-
resolveBinding
|
|
12
|
+
resolveBinding?: BindingResolver;
|
|
13
|
+
dataContext?: unknown;
|
|
14
|
+
queryResults?: Record<string, unknown>;
|
|
15
|
+
componentOutputs?: Record<string, Record<string, unknown>>;
|
|
13
16
|
|
|
14
17
|
/**
|
|
15
18
|
* The resolved configuration of the template chain the element sits in, from `resolveEffectiveConfiguration`.
|
|
@@ -27,12 +30,31 @@ export interface SceneElementViewProps {
|
|
|
27
30
|
* Renders a Scene element tree with the real `Scene.React` renderer - the WYSIWYG building block Studio's
|
|
28
31
|
* preview surface and Stage's shipped web bundle both consume unmodified.
|
|
29
32
|
*/
|
|
30
|
-
export function SceneElementView({
|
|
31
|
-
|
|
33
|
+
export function SceneElementView({
|
|
34
|
+
element,
|
|
35
|
+
registry,
|
|
36
|
+
resolveBinding,
|
|
37
|
+
configuration,
|
|
38
|
+
onComponentOutputsChanged,
|
|
39
|
+
dataContext,
|
|
40
|
+
queryResults,
|
|
41
|
+
componentOutputs,
|
|
42
|
+
}: SceneElementViewProps) {
|
|
32
43
|
const configured = useMemo(() => configuration ? applyEffectiveConfiguration(element, configuration) : element, [element, configuration]);
|
|
33
44
|
return (
|
|
34
|
-
<
|
|
35
|
-
{
|
|
36
|
-
|
|
45
|
+
<RenderBindingScopeProvider
|
|
46
|
+
dataContext={dataContext}
|
|
47
|
+
queryResults={queryResults}
|
|
48
|
+
componentOutputs={componentOutputs}
|
|
49
|
+
resolveBinding={resolveBinding}
|
|
50
|
+
onComponentOutputsChanged={onComponentOutputsChanged}>
|
|
51
|
+
<RenderedElement element={configured} registry={registry} />
|
|
52
|
+
</RenderBindingScopeProvider>
|
|
37
53
|
);
|
|
38
54
|
}
|
|
55
|
+
|
|
56
|
+
function RenderedElement({ element, registry }: { element: SceneElement; registry: ComponentRegistry }) {
|
|
57
|
+
const renderer = useMemo(() => createReactRenderer(registry), [registry]);
|
|
58
|
+
const resolveBinding = useRenderBindingResolver();
|
|
59
|
+
return <>{renderElement(element, renderer, resolveBinding)}</>;
|
|
60
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var scene_engine = require('@cratis/scene.engine');
|
|
6
|
-
var
|
|
6
|
+
var RenderBindingScopeContext = require('./renderer/RenderBindingScopeContext.js');
|
|
7
7
|
var createReactRenderer = require('./renderer/createReactRenderer.js');
|
|
8
8
|
require('./interactions/useInteractions.js');
|
|
9
9
|
require('./interactions/NotificationHost.js');
|
|
@@ -11,17 +11,30 @@ require('./interactions/NotificationHost.js');
|
|
|
11
11
|
/**
|
|
12
12
|
* Renders a Scene element tree with the real `Scene.React` renderer - the WYSIWYG building block Studio's
|
|
13
13
|
* preview surface and Stage's shipped web bundle both consume unmodified.
|
|
14
|
-
*/ function SceneElementView({ element, registry, resolveBinding, configuration, onComponentOutputsChanged }) {
|
|
15
|
-
const renderer = react.useMemo(()=>createReactRenderer.createReactRenderer(registry), [
|
|
16
|
-
registry
|
|
17
|
-
]);
|
|
14
|
+
*/ function SceneElementView({ element, registry, resolveBinding, configuration, onComponentOutputsChanged, dataContext, queryResults, componentOutputs }) {
|
|
18
15
|
const configured = react.useMemo(()=>configuration ? scene_engine.applyEffectiveConfiguration(element, configuration) : element, [
|
|
19
16
|
element,
|
|
20
17
|
configuration
|
|
21
18
|
]);
|
|
22
|
-
return /*#__PURE__*/ jsxRuntime.jsx(
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
return /*#__PURE__*/ jsxRuntime.jsx(RenderBindingScopeContext.RenderBindingScopeProvider, {
|
|
20
|
+
dataContext: dataContext,
|
|
21
|
+
queryResults: queryResults,
|
|
22
|
+
componentOutputs: componentOutputs,
|
|
23
|
+
resolveBinding: resolveBinding,
|
|
24
|
+
onComponentOutputsChanged: onComponentOutputsChanged,
|
|
25
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(RenderedElement, {
|
|
26
|
+
element: configured,
|
|
27
|
+
registry: registry
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function RenderedElement({ element, registry }) {
|
|
32
|
+
const renderer = react.useMemo(()=>createReactRenderer.createReactRenderer(registry), [
|
|
33
|
+
registry
|
|
34
|
+
]);
|
|
35
|
+
const resolveBinding = RenderBindingScopeContext.useRenderBindingResolver();
|
|
36
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
37
|
+
children: scene_engine.renderElement(element, renderer, resolveBinding)
|
|
25
38
|
});
|
|
26
39
|
}
|
|
27
40
|
|
|
@@ -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 {
|
|
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,5 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
require('react/jsx-runtime');
|
|
4
|
+
require('react');
|
|
5
|
+
require('@cratis/scene.engine');
|
|
6
|
+
require('@cratis/scene.model');
|
|
3
7
|
var ScenePackageBundle = require('../packages/ScenePackageBundle.js');
|
|
4
8
|
var CoreText = require('./CoreText.js');
|
|
5
9
|
var CoreButton = require('./CoreButton.js');
|
|
@@ -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 {\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":";;;;;;;;;;;;;AAAA;AACA;AAsBA;;;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;AACrD;;"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var scene_model = require('@cratis/scene.model');
|
|
4
|
+
require('react/jsx-runtime');
|
|
5
|
+
require('react');
|
|
6
|
+
require('@cratis/scene.engine');
|
|
4
7
|
var ScenePackageBundle = require('../packages/ScenePackageBundle.js');
|
|
5
8
|
|
|
6
9
|
// Copyright (c) Cratis. All rights reserved.
|
|
@@ -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":"
|
|
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,YAAA;gBACIP,IAAAA,EAAM,WAAA;gBAAaC,KAAAA,EAAO,kBAAA;gBAAoBC,KAAAA,EAAO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QueryRunner = require('./renderer/AbortableQueryRunner.js');
|
|
4
5
|
var BindingOutputContext = require('./renderer/BindingOutputContext.js');
|
|
6
|
+
var RenderBindingScopeContext = require('./renderer/RenderBindingScopeContext.js');
|
|
5
7
|
var UnresolvedComponent = require('./renderer/UnresolvedComponent.js');
|
|
6
8
|
var createReactRenderer = require('./renderer/createReactRenderer.js');
|
|
7
9
|
var InteractiveComponent = require('./renderer/InteractiveComponent.js');
|
|
@@ -15,11 +17,13 @@ var coreComponents = require('./core/coreComponents.js');
|
|
|
15
17
|
var corePackage = require('./core/corePackage.js');
|
|
16
18
|
var NavBar = require('./NavBar/NavBar.js');
|
|
17
19
|
var extractNavigationItem = require('./NavBar/extractNavigationItem.js');
|
|
20
|
+
var resolveDestination = require('./navigation/resolveDestination.js');
|
|
18
21
|
var IconAdapterRegistry = require('./icons/IconAdapterRegistry.js');
|
|
19
22
|
var IconAdapterContext = require('./icons/IconAdapterContext.js');
|
|
20
23
|
var useIconGlyph = require('./icons/useIconGlyph.js');
|
|
21
24
|
var SceneIcon = require('./icons/SceneIcon.js');
|
|
22
25
|
var DesignTimeBundle = require('./packages/DesignTimeBundle.js');
|
|
26
|
+
var DesignTimeProvider = require('./packages/DesignTimeProvider.js');
|
|
23
27
|
var PackageHostConfiguration = require('./packages/PackageHostConfiguration.js');
|
|
24
28
|
var ScenePackageBundle = require('./packages/ScenePackageBundle.js');
|
|
25
29
|
var ComponentsUiLibraryContract = require('./packages/ComponentsUiLibraryContract.js');
|
|
@@ -36,9 +40,13 @@ var useInteractionHosts = require('./interactions/useInteractionHosts.js');
|
|
|
36
40
|
|
|
37
41
|
|
|
38
42
|
exports.SceneElementView = SceneElementView.SceneElementView;
|
|
43
|
+
exports.AbortableQueryRunner = AbortableQueryRunner.AbortableQueryRunner;
|
|
39
44
|
exports.BindingOutputProvider = BindingOutputContext.BindingOutputProvider;
|
|
40
45
|
exports.useBindingOutputScope = BindingOutputContext.useBindingOutputScope;
|
|
41
46
|
exports.useBindingOutputs = BindingOutputContext.useBindingOutputs;
|
|
47
|
+
exports.RenderBindingScopeProvider = RenderBindingScopeContext.RenderBindingScopeProvider;
|
|
48
|
+
exports.useRenderBindingResolver = RenderBindingScopeContext.useRenderBindingResolver;
|
|
49
|
+
exports.useRenderBindingScope = RenderBindingScopeContext.useRenderBindingScope;
|
|
42
50
|
exports.UnresolvedComponent = UnresolvedComponent.UnresolvedComponent;
|
|
43
51
|
exports.createReactRenderer = createReactRenderer.createReactRenderer;
|
|
44
52
|
exports.InteractiveComponent = InteractiveComponent.InteractiveComponent;
|
|
@@ -63,6 +71,7 @@ exports.corePackage = corePackage.corePackage;
|
|
|
63
71
|
exports.corePackageManifest = corePackage.corePackageManifest;
|
|
64
72
|
exports.NavBar = NavBar.NavBar;
|
|
65
73
|
exports.extractNavigationItem = extractNavigationItem.extractNavigationItem;
|
|
74
|
+
exports.resolveDestination = resolveDestination.resolveDestination;
|
|
66
75
|
exports.IconAdapterRegistry = IconAdapterRegistry.IconAdapterRegistry;
|
|
67
76
|
exports.createIconAdapterRegistry = IconAdapterRegistry.createIconAdapterRegistry;
|
|
68
77
|
exports.IconAdapterProvider = IconAdapterContext.IconAdapterProvider;
|
|
@@ -70,6 +79,8 @@ exports.useIconAdapters = IconAdapterContext.useIconAdapters;
|
|
|
70
79
|
exports.useIconGlyph = useIconGlyph.useIconGlyph;
|
|
71
80
|
exports.SceneIcon = SceneIcon.SceneIcon;
|
|
72
81
|
exports.validateDesignTimeBundle = DesignTimeBundle.validateDesignTimeBundle;
|
|
82
|
+
exports.DesignTimeProvider = DesignTimeProvider.DesignTimeProvider;
|
|
83
|
+
exports.useDesignTimeContext = DesignTimeProvider.useDesignTimeContext;
|
|
73
84
|
exports.resolvePackageHost = PackageHostConfiguration.resolvePackageHost;
|
|
74
85
|
exports.componentRegistryKey = ScenePackageBundle.componentRegistryKey;
|
|
75
86
|
exports.mergeIconAdapters = ScenePackageBundle.mergeIconAdapters;
|
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,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_engine = require('@cratis/scene.engine');
|
|
4
|
+
var scene_model = require('@cratis/scene.model');
|
|
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
|
+
* Resolves a destination into a renderer-neutral navigation action, deep link and target outlet/dialog.
|
|
10
|
+
*/ function resolveDestination(destination, scope = {}) {
|
|
11
|
+
const diagnostics = [];
|
|
12
|
+
const kind = destination.kind ?? (destination.dialog ? scene_model.DestinationKind.Dialog : scene_model.DestinationKind.Outlet);
|
|
13
|
+
const parameters = Object.entries(destination.routeParameterBindings ?? {}).map(([name, binding])=>[
|
|
14
|
+
name,
|
|
15
|
+
String(scene_engine.resolveBindingExpression(binding, scope) ?? '')
|
|
16
|
+
]);
|
|
17
|
+
const base = destination.route ?? identityRoute(destination);
|
|
18
|
+
if (!base && kind !== scene_model.DestinationKind.Dialog) diagnostics.push('Destination has no routeable screen, stable identity or route.');
|
|
19
|
+
const url = base ? appendParameters(base, parameters) : undefined;
|
|
20
|
+
return {
|
|
21
|
+
kind,
|
|
22
|
+
url,
|
|
23
|
+
outlet: destination.outlet,
|
|
24
|
+
dialog: destination.dialog,
|
|
25
|
+
action: kind === scene_model.DestinationKind.Dialog ? 'openDialog' : kind === scene_model.DestinationKind.External ? 'openExternal' : 'navigate',
|
|
26
|
+
diagnostics
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function identityRoute(destination) {
|
|
30
|
+
if (destination.screen) return destination.screen;
|
|
31
|
+
const parts = [
|
|
32
|
+
destination.module,
|
|
33
|
+
destination.feature,
|
|
34
|
+
destination.slice
|
|
35
|
+
].filter((part)=>typeof part === 'string' && part.length > 0);
|
|
36
|
+
return parts.length ? parts.join('/') : undefined;
|
|
37
|
+
}
|
|
38
|
+
function appendParameters(route, parameters) {
|
|
39
|
+
if (!parameters.length) return route;
|
|
40
|
+
let replaced = route;
|
|
41
|
+
const unused = [];
|
|
42
|
+
for (const [name, value] of parameters){
|
|
43
|
+
const marker = `{${name}}`;
|
|
44
|
+
if (replaced.includes(marker)) {
|
|
45
|
+
replaced = replaced.split(marker).join(encodeURIComponent(value));
|
|
46
|
+
} else {
|
|
47
|
+
unused.push(`${encodeURIComponent(name)}=${encodeURIComponent(value)}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return unused.length ? `${replaced}?${unused.join('&')}` : replaced;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
exports.resolveDestination = resolveDestination;
|
|
54
|
+
//# sourceMappingURL=resolveDestination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveDestination.js","sources":["../../../navigation/resolveDestination.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 { BindingScope, resolveBindingExpression } from '@cratis/scene.engine';\nimport { DestinationKind, DestinationReference } from '@cratis/scene.model';\nimport { DestinationResolution } from './DestinationResolution';\n\n/**\n * Resolves a destination into a renderer-neutral navigation action, deep link and target outlet/dialog.\n */\nexport function resolveDestination(destination: DestinationReference, scope: BindingScope = {}): DestinationResolution {\n const diagnostics: string[] = [];\n const kind = destination.kind ?? (destination.dialog ? DestinationKind.Dialog : DestinationKind.Outlet);\n const parameters = Object.entries(destination.routeParameterBindings ?? {})\n .map(([name, binding]) => [name, String(resolveBindingExpression(binding, scope) ?? '')] as const);\n const base = destination.route ?? identityRoute(destination);\n if (!base && kind !== DestinationKind.Dialog) diagnostics.push('Destination has no routeable screen, stable identity or route.');\n\n const url = base ? appendParameters(base, parameters) : undefined;\n return {\n kind,\n url,\n outlet: destination.outlet,\n dialog: destination.dialog,\n action: kind === DestinationKind.Dialog ? 'openDialog' : kind === DestinationKind.External ? 'openExternal' : 'navigate',\n diagnostics,\n };\n}\n\nfunction identityRoute(destination: DestinationReference): string | undefined {\n if (destination.screen) return destination.screen;\n const parts = [destination.module, destination.feature, destination.slice].filter((part): part is string => typeof part === 'string' && part.length > 0);\n return parts.length ? parts.join('/') : undefined;\n}\n\nfunction appendParameters(route: string, parameters: readonly (readonly [string, string])[]): string {\n if (!parameters.length) return route;\n let replaced = route;\n const unused: string[] = [];\n for (const [name, value] of parameters) {\n const marker = `{${name}}`;\n if (replaced.includes(marker)) {\n replaced = replaced.split(marker).join(encodeURIComponent(value));\n } else {\n unused.push(`${encodeURIComponent(name)}=${encodeURIComponent(value)}`);\n }\n }\n\n return unused.length ? `${replaced}?${unused.join('&')}` : replaced;\n}\n"],"names":["resolveDestination","destination","scope","diagnostics","kind","dialog","DestinationKind","Dialog","Outlet","parameters","Object","entries","routeParameterBindings","map","name","binding","String","resolveBindingExpression","base","route","identityRoute","push","url","appendParameters","undefined","outlet","action","External","screen","parts","module","feature","slice","filter","part","length","join","replaced","unused","value","marker","includes","split","encodeURIComponent"],"mappings":";;;;;AAAA;AACA;AAMA;;AAEC,IACM,SAASA,kBAAAA,CAAmBC,WAAiC,EAAEC,KAAAA,GAAsB,EAAE,EAAA;AAC1F,IAAA,MAAMC,cAAwB,EAAE;AAChC,IAAA,MAAMC,IAAAA,GAAOH,WAAAA,CAAYG,IAAI,KAAKH,WAAAA,CAAYI,MAAM,GAAGC,2BAAAA,CAAgBC,MAAM,GAAGD,2BAAAA,CAAgBE,MAAM,CAAD;AACrG,IAAA,MAAMC,UAAAA,GAAaC,MAAAA,CAAOC,OAAO,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GN,KAAAA,CAAMO,IAAI,CAAC,GAAA,CAAA,GAAOZ,SAAAA;AAC5C;AAEA,SAASD,gBAAAA,CAAiBJ,KAAa,EAAEV,UAAkD,EAAA;AACvF,IAAA,IAAI,CAACA,UAAAA,CAAW0B,MAAM,EAAE,OAAOhB,KAAAA;AAC/B,IAAA,IAAIkB,QAAAA,GAAWlB,KAAAA;AACf,IAAA,MAAMmB,SAAmB,EAAE;AAC3B,IAAA,KAAK,MAAM,CAACxB,IAAAA,EAAMyB,KAAAA,CAAM,IAAI9B,UAAAA,CAAY;AACpC,QAAA,MAAM+B,SAAS,CAAC,CAAC,EAAE1B,IAAAA,CAAK,CAAC,CAAC;QAC1B,IAAIuB,QAAAA,CAASI,QAAQ,CAACD,MAAAA,CAAAA,EAAS;AAC3BH,YAAAA,QAAAA,GAAWA,SAASK,KAAK,CAACF,MAAAA,CAAAA,CAAQJ,IAAI,CAACO,kBAAAA,CAAmBJ,KAAAA,CAAAA,CAAAA;QAC9D,CAAA,MAAO;YACHD,MAAAA,CAAOjB,IAAI,CAAC,CAAA,EAAGsB,kBAAAA,CAAmB7B,MAAM,CAAC,EAAE6B,mBAAmBJ,KAAAA,CAAAA,CAAAA,CAAQ,CAAA;AAC1E,QAAA;AACJ,IAAA;IAEA,OAAOD,MAAAA,CAAOH,MAAM,GAAG,CAAA,EAAGE,QAAAA,CAAS,CAAC,EAAEC,MAAAA,CAAOF,IAAI,CAAC,GAAA,CAAA,CAAA,CAAM,GAAGC,QAAAA;AAC/D;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesignTimeBundle.js","sources":["../../../packages/DesignTimeBundle.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 { ComponentType
|
|
1
|
+
{"version":3,"file":"DesignTimeBundle.js","sources":["../../../packages/DesignTimeBundle.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 { ComponentType } from 'react';\nimport { DesignTimeAction } from './DesignTimeAction';\nimport { DesignTimeComponentProps } from './DesignTimeComponentProps';\nimport { DesignTimePropertyDisplayProps } from './DesignTimePropertyDisplayProps';\nimport { DesignTimePropertyEditorProps } from './DesignTimePropertyEditorProps';\n\n/**\n * Optional React-only design-time surface a package may publish beside its runtime bundle.\n */\nexport interface DesignTimeBundle {\n previews?: Record<string, ComponentType<DesignTimeComponentProps>>;\n designers?: Record<string, ComponentType<DesignTimeComponentProps>>;\n propertyEditors?: Record<string, ComponentType<DesignTimePropertyEditorProps>>;\n propertyDisplays?: Record<string, ComponentType<DesignTimePropertyDisplayProps>>;\n actions?: Record<string, DesignTimeAction>;\n}\n\nexport function validateDesignTimeBundle(bundle: DesignTimeBundle | undefined): string[] {\n if (!bundle) return [];\n const problems: string[] = [];\n for (const [name, action] of Object.entries(bundle.actions ?? {})) {\n if (action.descriptor.id !== name) {\n problems.push(`registers design-time action '${name}' with descriptor id '${action.descriptor.id}'`);\n }\n }\n return problems;\n}\n"],"names":["validateDesignTimeBundle","bundle","problems","name","action","Object","entries","actions","descriptor","id","push"],"mappings":";;AAAA;AACA;AAmBO,SAASA,yBAAyBC,MAAoC,EAAA;IACzE,IAAI,CAACA,MAAAA,EAAQ,OAAO,EAAE;AACtB,IAAA,MAAMC,WAAqB,EAAE;AAC7B,IAAA,KAAK,MAAM,CAACC,IAAAA,EAAMC,MAAAA,CAAO,IAAIC,MAAAA,CAAOC,OAAO,CAACL,MAAAA,CAAOM,OAAO,IAAI,EAAC,CAAA,CAAI;AAC/D,QAAA,IAAIH,MAAAA,CAAOI,UAAU,CAACC,EAAE,KAAKN,IAAAA,EAAM;AAC/BD,YAAAA,QAAAA,CAASQ,IAAI,CAAC,CAAC,8BAA8B,EAAEP,IAAAA,CAAK,sBAAsB,EAAEC,MAAAA,CAAOI,UAAU,CAACC,EAAE,CAAC,CAAC,CAAC,CAAA;AACvG,QAAA;AACJ,IAAA;IACA,OAAOP,QAAAA;AACX;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
|
|
6
|
+
const Context = /*#__PURE__*/ react.createContext(undefined);
|
|
7
|
+
/**
|
|
8
|
+
* Makes the generic package-side design-time context available to nested package components.
|
|
9
|
+
*/ function DesignTimeProvider({ context, children }) {
|
|
10
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Context.Provider, {
|
|
11
|
+
value: context,
|
|
12
|
+
children: children
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function useDesignTimeContext() {
|
|
16
|
+
const context = react.useContext(Context);
|
|
17
|
+
if (!context) throw new Error('No Scene design-time context is available.');
|
|
18
|
+
return context;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
exports.DesignTimeProvider = DesignTimeProvider;
|
|
22
|
+
exports.useDesignTimeContext = useDesignTimeContext;
|
|
23
|
+
//# sourceMappingURL=DesignTimeProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesignTimeProvider.js","sources":["../../../packages/DesignTimeProvider.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 { DesignTimeContext } from './DesignTimeContext';\n\nconst Context = createContext<DesignTimeContext | undefined>(undefined);\n\nexport interface DesignTimeProviderProps {\n context: DesignTimeContext;\n children: ReactNode;\n}\n\n/**\n * Makes the generic package-side design-time context available to nested package components.\n */\nexport function DesignTimeProvider({ context, children }: DesignTimeProviderProps) {\n return <Context.Provider value={context}>{children}</Context.Provider>;\n}\n\nexport function useDesignTimeContext(): DesignTimeContext {\n const context = useContext(Context);\n if (!context) throw new Error('No Scene design-time context is available.');\n return context;\n}\n"],"names":["Context","createContext","undefined","DesignTimeProvider","context","children","_jsx","Provider","value","useDesignTimeContext","useContext","Error"],"mappings":";;;;;AAMA,MAAMA,wBAAUC,mBAAAA,CAA6CC,SAAAA,CAAAA;AAO7D;;AAEC,IACM,SAASC,kBAAAA,CAAmB,EAAEC,OAAO,EAAEC,QAAQ,EAA2B,EAAA;IAC7E,qBAAOC,cAAA,CAACN,QAAQO,QAAQ,EAAA;QAACC,KAAAA,EAAOJ,OAAAA;AAAUC,QAAAA,QAAAA,EAAAA;;AAC9C;AAEO,SAASI,oBAAAA,GAAAA;AACZ,IAAA,MAAML,UAAUM,gBAAAA,CAAWV,OAAAA,CAAAA;AAC3B,IAAA,IAAI,CAACI,OAAAA,EAAS,MAAM,IAAIO,KAAAA,CAAM,4CAAA,CAAA;IAC9B,OAAOP,OAAAA;AACX;;;"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var scene_engine = require('@cratis/scene.engine');
|
|
4
|
+
var IconAdapterRegistry = require('../icons/IconAdapterRegistry.js');
|
|
3
5
|
var ScenePackageBundle = require('./ScenePackageBundle.js');
|
|
4
6
|
|
|
5
7
|
// Copyright (c) Cratis. All rights reserved.
|
|
@@ -8,21 +10,41 @@ var ScenePackageBundle = require('./ScenePackageBundle.js');
|
|
|
8
10
|
* Resolves the approved package set a standalone or embedded React host uses.
|
|
9
11
|
*/ function resolvePackageHost(configuration) {
|
|
10
12
|
const diagnostics = [];
|
|
13
|
+
const names = new Map();
|
|
14
|
+
for (const bundle of configuration.bundles){
|
|
15
|
+
names.set(bundle.manifest.name, (names.get(bundle.manifest.name) ?? 0) + 1);
|
|
16
|
+
}
|
|
17
|
+
for (const [name, count] of names){
|
|
18
|
+
if (count > 1) diagnostics.push(`Package '${name}' is approved more than once; duplicate bundles are ambiguous`);
|
|
19
|
+
}
|
|
11
20
|
const byName = new Map(configuration.bundles.map((bundle)=>[
|
|
12
21
|
bundle.manifest.name,
|
|
13
22
|
bundle
|
|
14
23
|
]));
|
|
24
|
+
const selection = scene_engine.resolvePackageDependencies(configuration.profile.packages, configuration.bundles.map((bundle)=>bundle.manifest));
|
|
25
|
+
for (const missing of selection.missing)diagnostics.push(`Package '${missing.package}' depends on missing package '${missing.dependsOn}'`);
|
|
26
|
+
for (const conflict of selection.versionConflicts){
|
|
27
|
+
diagnostics.push(`Package '${conflict.package}' requires '${conflict.dependsOn}' ${conflict.requiredRange} but approved version is ${conflict.actualVersion}`);
|
|
28
|
+
}
|
|
29
|
+
for (const cycle of selection.cycles)diagnostics.push(`Package dependency cycle: ${cycle.join(' -> ')}`);
|
|
15
30
|
const bundles = [];
|
|
16
31
|
const runtimeSingletons = new Map();
|
|
17
|
-
|
|
32
|
+
const assets = [];
|
|
33
|
+
for (const packageName of selection.packages){
|
|
18
34
|
const bundle = byName.get(packageName);
|
|
19
35
|
if (!bundle) {
|
|
20
36
|
diagnostics.push(`UI profile asks for '${packageName}' but the host did not approve a bundle for it`);
|
|
21
37
|
continue;
|
|
22
38
|
}
|
|
23
|
-
|
|
39
|
+
diagnostics.push(...ScenePackageBundle.validatePackageBundle(bundle).map((problem)=>`${packageName}: ${problem}`));
|
|
40
|
+
if (!configuration.policy.allowExecutableImports && bundle.designTime) {
|
|
41
|
+
diagnostics.push(`Package '${packageName}' provides executable design-time contributions, but host policy forbids them`);
|
|
42
|
+
}
|
|
43
|
+
const packageAssets = bundle.manifest.assets ?? [];
|
|
44
|
+
if (!configuration.policy.allowNetworkAssets && packageAssets.some((asset)=>/^https?:\/\//.test(asset))) {
|
|
24
45
|
diagnostics.push(`Package '${packageName}' declares network assets, but host policy forbids them`);
|
|
25
46
|
}
|
|
47
|
+
assets.push(...packageAssets);
|
|
26
48
|
for (const dependency of bundle.manifest.runtimeSingletons ?? []){
|
|
27
49
|
const owner = runtimeSingletons.get(dependency);
|
|
28
50
|
if (owner && owner !== packageName) {
|
|
@@ -35,6 +57,12 @@ var ScenePackageBundle = require('./ScenePackageBundle.js');
|
|
|
35
57
|
return {
|
|
36
58
|
bundles,
|
|
37
59
|
components: ScenePackageBundle.mergePackageRegistries(bundles),
|
|
60
|
+
layouts: bundles.flatMap((bundle)=>bundle.layouts ?? []),
|
|
61
|
+
screenTemplates: bundles.flatMap((bundle)=>bundle.screenTemplates ?? []),
|
|
62
|
+
dialogTemplates: bundles.flatMap((bundle)=>bundle.dialogTemplates ?? []),
|
|
63
|
+
themes: bundles.flatMap((bundle)=>bundle.themes ?? []),
|
|
64
|
+
icons: IconAdapterRegistry.createIconAdapterRegistry(bundles.map((bundle)=>bundle.iconLibrary?.adapter).filter((adapter)=>adapter !== undefined)),
|
|
65
|
+
assets,
|
|
38
66
|
diagnostics
|
|
39
67
|
};
|
|
40
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PackageHostConfiguration.js","sources":["../../../packages/PackageHostConfiguration.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 { UiProfile } from '@cratis/scene.model';\nimport { ScenePackageBundle, mergePackageRegistries } from './ScenePackageBundle';\n\nexport interface PackageHostPolicy {\n allowExecutableImports: boolean;\n allowNetworkAssets: boolean;\n}\n\nexport interface PackageHostConfiguration {\n bundles: ScenePackageBundle[];\n profile: UiProfile;\n policy: PackageHostPolicy;\n}\n\nexport interface ResolvedPackageHost {\n bundles: ScenePackageBundle[];\n components: ReturnType<typeof mergePackageRegistries>;\n diagnostics: string[];\n}\n\n/**\n * Resolves the approved package set a standalone or embedded React host uses.\n */\nexport function resolvePackageHost(configuration: PackageHostConfiguration): ResolvedPackageHost {\n const diagnostics: string[] = [];\n const byName = new Map(configuration.bundles.map(bundle => [bundle.manifest.name, bundle]));\n const bundles: ScenePackageBundle[] = [];\n const runtimeSingletons = new Map<string, string>();\n\n for (const packageName of
|
|
1
|
+
{"version":3,"file":"PackageHostConfiguration.js","sources":["../../../packages/PackageHostConfiguration.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 { DialogTemplate, Layout, ScreenTemplate, Theme, UiProfile } from '@cratis/scene.model';\nimport { resolvePackageDependencies } from '@cratis/scene.engine';\nimport { IconAdapterRegistry, createIconAdapterRegistry } from '../icons/IconAdapterRegistry';\nimport { ScenePackageBundle, mergePackageRegistries, validatePackageBundle } from './ScenePackageBundle';\n\nexport interface PackageHostPolicy {\n allowExecutableImports: boolean;\n allowNetworkAssets: boolean;\n}\n\nexport interface PackageHostConfiguration {\n bundles: ScenePackageBundle[];\n profile: UiProfile;\n policy: PackageHostPolicy;\n}\n\nexport interface ResolvedPackageHost {\n bundles: ScenePackageBundle[];\n components: ReturnType<typeof mergePackageRegistries>;\n layouts: Layout[];\n screenTemplates: ScreenTemplate[];\n dialogTemplates: DialogTemplate[];\n themes: Theme[];\n icons: IconAdapterRegistry;\n assets: string[];\n diagnostics: string[];\n}\n\n/**\n * Resolves the approved package set a standalone or embedded React host uses.\n */\nexport function resolvePackageHost(configuration: PackageHostConfiguration): ResolvedPackageHost {\n const diagnostics: string[] = [];\n const names = new Map<string, number>();\n for (const bundle of configuration.bundles) {\n names.set(bundle.manifest.name, (names.get(bundle.manifest.name) ?? 0) + 1);\n }\n\n for (const [name, count] of names) {\n if (count > 1) diagnostics.push(`Package '${name}' is approved more than once; duplicate bundles are ambiguous`);\n }\n\n const byName = new Map(configuration.bundles.map(bundle => [bundle.manifest.name, bundle]));\n const selection = resolvePackageDependencies(configuration.profile.packages, configuration.bundles.map(bundle => bundle.manifest));\n for (const missing of selection.missing) diagnostics.push(`Package '${missing.package}' depends on missing package '${missing.dependsOn}'`);\n for (const conflict of selection.versionConflicts) {\n diagnostics.push(`Package '${conflict.package}' requires '${conflict.dependsOn}' ${conflict.requiredRange} but approved version is ${conflict.actualVersion}`);\n }\n for (const cycle of selection.cycles) diagnostics.push(`Package dependency cycle: ${cycle.join(' -> ')}`);\n\n const bundles: ScenePackageBundle[] = [];\n const runtimeSingletons = new Map<string, string>();\n const assets: string[] = [];\n\n for (const packageName of selection.packages) {\n const bundle = byName.get(packageName);\n if (!bundle) {\n diagnostics.push(`UI profile asks for '${packageName}' but the host did not approve a bundle for it`);\n continue;\n }\n\n diagnostics.push(...validatePackageBundle(bundle).map(problem => `${packageName}: ${problem}`));\n if (!configuration.policy.allowExecutableImports && bundle.designTime) {\n diagnostics.push(`Package '${packageName}' provides executable design-time contributions, but host policy forbids them`);\n }\n\n const packageAssets = bundle.manifest.assets ?? [];\n if (!configuration.policy.allowNetworkAssets && packageAssets.some(asset => /^https?:\\/\\//.test(asset))) {\n diagnostics.push(`Package '${packageName}' declares network assets, but host policy forbids them`);\n }\n assets.push(...packageAssets);\n\n for (const dependency of bundle.manifest.runtimeSingletons ?? []) {\n const owner = runtimeSingletons.get(dependency);\n if (owner && owner !== packageName) {\n diagnostics.push(`Runtime singleton '${dependency}' is provided by both '${owner}' and '${packageName}'`);\n }\n runtimeSingletons.set(dependency, packageName);\n }\n\n bundles.push(bundle);\n }\n\n return {\n bundles,\n components: mergePackageRegistries(bundles),\n layouts: bundles.flatMap(bundle => bundle.layouts ?? []),\n screenTemplates: bundles.flatMap(bundle => bundle.screenTemplates ?? []),\n dialogTemplates: bundles.flatMap(bundle => bundle.dialogTemplates ?? []),\n themes: bundles.flatMap(bundle => bundle.themes ?? []),\n icons: createIconAdapterRegistry(bundles.map(bundle => bundle.iconLibrary?.adapter).filter(adapter => adapter !== undefined)),\n assets,\n diagnostics,\n };\n}\n"],"names":["resolvePackageHost","configuration","diagnostics","names","Map","bundle","bundles","set","manifest","name","get","count","push","byName","map","selection","resolvePackageDependencies","profile","packages","missing","package","dependsOn","conflict","versionConflicts","requiredRange","actualVersion","cycle","cycles","join","runtimeSingletons","assets","packageName","validatePackageBundle","problem","policy","allowExecutableImports","designTime","packageAssets","allowNetworkAssets","some","asset","test","dependency","owner","components","mergePackageRegistries","layouts","flatMap","screenTemplates","dialogTemplates","themes","icons","createIconAdapterRegistry","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2C,eAAe,IAAI,EAAE,CAAA;QACvEC,eAAAA,EAAiB3C,OAAAA,CAAQyC,OAAO,CAAC1C,CAAAA,SAAUA,MAAAA,CAAO4C,eAAe,IAAI,EAAE,CAAA;QACvEC,MAAAA,EAAQ5C,OAAAA,CAAQyC,OAAO,CAAC1C,CAAAA,SAAUA,MAAAA,CAAO6C,MAAM,IAAI,EAAE,CAAA;AACrDC,QAAAA,KAAAA,EAAOC,6CAAAA,CAA0B9C,OAAAA,CAAQQ,GAAG,CAACT,CAAAA,MAAAA,GAAUA,MAAAA,CAAOgD,WAAW,EAAEC,OAAAA,CAAAA,CAASC,MAAM,CAACD,CAAAA,UAAWA,OAAAA,KAAYE,SAAAA,CAAAA,CAAAA;AAClH1B,QAAAA,MAAAA;AACA5B,QAAAA;AACJ,KAAA;AACJ;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* Runs query bindings so a newer argument set aborts and ignores older work.
|
|
7
|
+
*/ class AbortableQueryRunner {
|
|
8
|
+
#controller;
|
|
9
|
+
#generation = 0;
|
|
10
|
+
async run(query, argumentsValue, performer) {
|
|
11
|
+
this.#controller?.abort();
|
|
12
|
+
const controller = new AbortController();
|
|
13
|
+
const generation = ++this.#generation;
|
|
14
|
+
this.#controller = controller;
|
|
15
|
+
const result = await performer(query, argumentsValue, controller.signal);
|
|
16
|
+
return generation === this.#generation && !controller.signal.aborted ? result : undefined;
|
|
17
|
+
}
|
|
18
|
+
clear() {
|
|
19
|
+
this.#controller?.abort();
|
|
20
|
+
this.#generation++;
|
|
21
|
+
this.#controller = undefined;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.AbortableQueryRunner = AbortableQueryRunner;
|
|
26
|
+
//# sourceMappingURL=AbortableQueryRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbortableQueryRunner.js","sources":["../../../renderer/AbortableQueryRunner.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\nexport type QueryPerformer = (query: string, argumentsValue: unknown, signal: AbortSignal) => Promise<unknown>;\n\n/**\n * Runs query bindings so a newer argument set aborts and ignores older work.\n */\nexport class AbortableQueryRunner {\n #controller?: AbortController;\n #generation = 0;\n\n async run(query: string, argumentsValue: unknown, performer: QueryPerformer): Promise<unknown | undefined> {\n this.#controller?.abort();\n const controller = new AbortController();\n const generation = ++this.#generation;\n this.#controller = controller;\n const result = await performer(query, argumentsValue, controller.signal);\n return generation === this.#generation && !controller.signal.aborted ? result : undefined;\n }\n\n clear(): void {\n this.#controller?.abort();\n this.#generation++;\n this.#controller = undefined;\n }\n}\n"],"names":["AbortableQueryRunner","run","query","argumentsValue","performer","abort","controller","AbortController","generation","result","signal","aborted","undefined","clear"],"mappings":";;AAAA;AACA;AAIA;;AAEC,IACM,MAAMA,oBAAAA,CAAAA;AACT,IAAA,WAAW;IACX,WAAW,GAAG,CAAA;AAEd,IAAA,MAAMC,IAAIC,KAAa,EAAEC,cAAuB,EAAEC,SAAyB,EAAgC;QACvG,IAAI,CAAC,WAAW,EAAEC,KAAAA,EAAAA;AAClB,QAAA,MAAMC,aAAa,IAAIC,eAAAA,EAAAA;AACvB,QAAA,MAAMC,UAAAA,GAAa,EAAE,IAAI,CAAC,WAAW;QACrC,IAAI,CAAC,WAAW,GAAGF,UAAAA;AACnB,QAAA,MAAMG,SAAS,MAAML,SAAAA,CAAUF,KAAAA,EAAOC,cAAAA,EAAgBG,WAAWI,MAAM,CAAA;AACvE,QAAA,OAAOF,UAAAA,KAAe,IAAI,CAAC,WAAW,IAAI,CAACF,UAAAA,CAAWI,MAAM,CAACC,OAAO,GAAGF,MAAAA,GAASG,SAAAA;AACpF,IAAA;IAEAC,KAAAA,GAAc;QACV,IAAI,CAAC,WAAW,EAAER,KAAAA,EAAAA;QAClB,IAAI,CAAC,WAAW,EAAA;QAChB,IAAI,CAAC,WAAW,GAAGO,SAAAA;AACvB,IAAA;AACJ;;"}
|
|
@@ -5,6 +5,7 @@ require('react/jsx-runtime');
|
|
|
5
5
|
var useInteractions = require('../interactions/useInteractions.js');
|
|
6
6
|
require('../interactions/NotificationHost.js');
|
|
7
7
|
var BindingOutputContext = require('./BindingOutputContext.js');
|
|
8
|
+
var RenderBindingScopeContext = require('./RenderBindingScopeContext.js');
|
|
8
9
|
|
|
9
10
|
// Copyright (c) Cratis. All rights reserved.
|
|
10
11
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
@@ -17,16 +18,44 @@ var BindingOutputContext = require('./BindingOutputContext.js');
|
|
|
17
18
|
*/ function InteractiveComponent({ component, element, slots }) {
|
|
18
19
|
const interactions = useInteractions.useInteractions(element.id, element.behaviors);
|
|
19
20
|
const bindingOutputs = BindingOutputContext.useBindingOutputs(element.id);
|
|
21
|
+
const resolveBinding = RenderBindingScopeContext.useRenderBindingResolver();
|
|
22
|
+
const resolvedElement = react.useMemo(()=>({
|
|
23
|
+
...element,
|
|
24
|
+
properties: resolveProperties(element.properties, resolveBinding)
|
|
25
|
+
}), [
|
|
26
|
+
element,
|
|
27
|
+
resolveBinding
|
|
28
|
+
]);
|
|
20
29
|
react.useEffect(()=>()=>bindingOutputs.clearAll(), [
|
|
21
30
|
element.id
|
|
22
31
|
]);
|
|
23
32
|
return /*#__PURE__*/ react.createElement(component, {
|
|
24
|
-
element,
|
|
33
|
+
element: resolvedElement,
|
|
25
34
|
slots,
|
|
26
35
|
interactions,
|
|
27
36
|
bindingOutputs
|
|
28
37
|
});
|
|
29
38
|
}
|
|
39
|
+
function resolveProperties(properties, resolveBinding) {
|
|
40
|
+
return Object.fromEntries(Object.entries(properties).map(([name, value])=>[
|
|
41
|
+
name,
|
|
42
|
+
resolveValue(value, resolveBinding)
|
|
43
|
+
]));
|
|
44
|
+
}
|
|
45
|
+
function resolveValue(value, resolveBinding) {
|
|
46
|
+
if (isBindingExpression(value)) return resolveBinding(value);
|
|
47
|
+
if (Array.isArray(value)) return value.map((entry)=>resolveValue(entry, resolveBinding));
|
|
48
|
+
if (value !== null && typeof value === 'object') {
|
|
49
|
+
return Object.fromEntries(Object.entries(value).map(([name, entry])=>[
|
|
50
|
+
name,
|
|
51
|
+
resolveValue(entry, resolveBinding)
|
|
52
|
+
]));
|
|
53
|
+
}
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
function isBindingExpression(value) {
|
|
57
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value) && typeof value.path === 'string';
|
|
58
|
+
}
|
|
30
59
|
|
|
31
60
|
exports.InteractiveComponent = InteractiveComponent;
|
|
32
61
|
//# sourceMappingURL=InteractiveComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InteractiveComponent.js","sources":["../../../renderer/InteractiveComponent.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 { ComponentType, ReactNode, createElement, useEffect } from 'react';\nimport { ExternalComponent } from '@cratis/scene.model';\nimport { useInteractions } from '../interactions';\nimport { useBindingOutputs } from './BindingOutputContext';\nimport { RegisteredComponentProps } from './ComponentRegistry';\n\nexport interface InteractiveComponentProps {\n component: ComponentType<RegisteredComponentProps>;\n element: ExternalComponent;\n slots: Record<string, ReactNode[]>;\n}\n\n/**\n * Resolves an element's interactions and hands them to the component that renders it.\n *\n * This exists as a component rather than as a call inside the renderer because resolving them is a hook, and a\n * hook cannot run inside the plain function a {@link Renderer} is. Keeping the renderer plain is what lets the\n * same element tree be rendered by something that is not React at all.\n */\nexport function InteractiveComponent({ component, element, slots }: InteractiveComponentProps) {\n const interactions = useInteractions(element.id, element.behaviors);\n const bindingOutputs = useBindingOutputs(element.id);\n useEffect(() => () => bindingOutputs.clearAll(), [element.id]);\n return createElement(component, { element, slots, interactions, bindingOutputs });\n}\n"],"names":["InteractiveComponent","component","element","slots","interactions","useInteractions","id","behaviors","bindingOutputs","useBindingOutputs","useEffect","clearAll","createElement"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InteractiveComponent.js","sources":["../../../renderer/InteractiveComponent.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 { ComponentType, ReactNode, createElement, useEffect, useMemo } from 'react';\nimport { BindingExpression, ExternalComponent } from '@cratis/scene.model';\nimport { useInteractions } from '../interactions';\nimport { useBindingOutputs } from './BindingOutputContext';\nimport { RegisteredComponentProps } from './ComponentRegistry';\nimport { useRenderBindingResolver } from './RenderBindingScopeContext';\n\nexport interface InteractiveComponentProps {\n component: ComponentType<RegisteredComponentProps>;\n element: ExternalComponent;\n slots: Record<string, ReactNode[]>;\n}\n\n/**\n * Resolves an element's interactions and hands them to the component that renders it.\n *\n * This exists as a component rather than as a call inside the renderer because resolving them is a hook, and a\n * hook cannot run inside the plain function a {@link Renderer} is. Keeping the renderer plain is what lets the\n * same element tree be rendered by something that is not React at all.\n */\nexport function InteractiveComponent({ component, element, slots }: InteractiveComponentProps) {\n const interactions = useInteractions(element.id, element.behaviors);\n const bindingOutputs = useBindingOutputs(element.id);\n const resolveBinding = useRenderBindingResolver();\n const resolvedElement = useMemo(() => ({\n ...element,\n properties: resolveProperties(element.properties, resolveBinding),\n }), [element, resolveBinding]);\n useEffect(() => () => bindingOutputs.clearAll(), [element.id]);\n return createElement(component, { element: resolvedElement, slots, interactions, bindingOutputs });\n}\n\nfunction resolveProperties(properties: Record<string, unknown>, resolveBinding: (binding: BindingExpression) => unknown): Record<string, unknown> {\n return Object.fromEntries(Object.entries(properties).map(([name, value]) => [name, resolveValue(value, resolveBinding)]));\n}\n\nfunction resolveValue(value: unknown, resolveBinding: (binding: BindingExpression) => unknown): unknown {\n if (isBindingExpression(value)) return resolveBinding(value);\n if (Array.isArray(value)) return value.map(entry => resolveValue(entry, resolveBinding));\n if (value !== null && typeof value === 'object') {\n return Object.fromEntries(Object.entries(value as Record<string, unknown>).map(([name, entry]) => [name, resolveValue(entry, resolveBinding)]));\n }\n\n return value;\n}\n\nfunction isBindingExpression(value: unknown): value is BindingExpression {\n return value !== null && typeof value === 'object' && !Array.isArray(value) && typeof (value as Record<string, unknown>).path === 'string';\n}\n"],"names":["InteractiveComponent","component","element","slots","interactions","useInteractions","id","behaviors","bindingOutputs","useBindingOutputs","resolveBinding","useRenderBindingResolver","resolvedElement","useMemo","properties","resolveProperties","useEffect","clearAll","createElement","Object","fromEntries","entries","map","name","value","resolveValue","isBindingExpression","Array","isArray","entry","path"],"mappings":";;;;;;;;;AAAA;AACA;AAeA;;;;;;IAOO,SAASA,oBAAAA,CAAqB,EAAEC,SAAS,EAAEC,OAAO,EAAEC,KAAK,EAA6B,EAAA;AACzF,IAAA,MAAMC,eAAeC,+BAAAA,CAAgBH,OAAAA,CAAQI,EAAE,EAAEJ,QAAQK,SAAS,CAAA;IAClE,MAAMC,cAAAA,GAAiBC,sCAAAA,CAAkBP,OAAAA,CAAQI,EAAE,CAAA;AACnD,IAAA,MAAMI,cAAAA,GAAiBC,kDAAAA,EAAAA;IACvB,MAAMC,eAAAA,GAAkBC,aAAAA,CAAQ,KAAO;AACnC,YAAA,GAAGX,OAAO;YACVY,UAAAA,EAAYC,iBAAAA,CAAkBb,OAAAA,CAAQY,UAAU,EAAEJ,cAAAA;AACtD,SAAA,CAAA,EAAI;AAACR,QAAAA,OAAAA;AAASQ,QAAAA;AAAe,KAAA,CAAA;AAC7BM,IAAAA,eAAAA,CAAU,IAAM,IAAMR,cAAAA,CAAeS,QAAQ,EAAA,EAAI;AAACf,QAAAA,OAAAA,CAAQI;AAAG,KAAA,CAAA;AAC7D,IAAA,qBAAOY,oBAAcjB,SAAAA,EAAW;QAAEC,OAAAA,EAASU,eAAAA;AAAiBT,QAAAA,KAAA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