@cratis/scene.react 4.8.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 +34 -5
- package/dist/cjs/SceneElementView.js +20 -5
- 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 +19 -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 +17 -0
- package/dist/cjs/packages/DesignTimeBundle.js.map +1 -0
- package/dist/cjs/packages/DesignTimeProvider.js +23 -0
- package/dist/cjs/packages/DesignTimeProvider.js.map +1 -0
- package/dist/cjs/packages/PackageHostConfiguration.js +71 -0
- package/dist/cjs/packages/PackageHostConfiguration.js.map +1 -0
- package/dist/cjs/packages/ScenePackageBundle.js +2 -0
- package/dist/cjs/packages/ScenePackageBundle.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/BindingOutputContext.js +74 -0
- package/dist/cjs/renderer/BindingOutputContext.js.map +1 -0
- package/dist/cjs/renderer/InteractiveComponent.js +37 -2
- 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 +6 -2
- package/dist/esm/SceneElementView.d.ts.map +1 -1
- package/dist/esm/SceneElementView.js +20 -5
- 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 +7 -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 +22 -0
- package/dist/esm/packages/DesignTimeAction.d.ts.map +1 -0
- package/dist/esm/packages/DesignTimeAction.js +2 -0
- package/dist/esm/packages/DesignTimeAction.js.map +1 -0
- package/dist/esm/packages/DesignTimeBundle.d.ts +14 -0
- package/dist/esm/packages/DesignTimeBundle.d.ts.map +1 -0
- package/dist/esm/packages/DesignTimeBundle.js +15 -0
- package/dist/esm/packages/DesignTimeBundle.js.map +1 -0
- 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 +25 -0
- package/dist/esm/packages/PackageHostConfiguration.d.ts.map +1 -0
- package/dist/esm/packages/PackageHostConfiguration.js +69 -0
- package/dist/esm/packages/PackageHostConfiguration.js.map +1 -0
- package/dist/esm/packages/ScenePackageBundle.d.ts +2 -0
- package/dist/esm/packages/ScenePackageBundle.d.ts.map +1 -1
- package/dist/esm/packages/ScenePackageBundle.js +2 -0
- package/dist/esm/packages/ScenePackageBundle.js.map +1 -1
- package/dist/esm/packages/index.d.ts +9 -0
- package/dist/esm/packages/index.d.ts.map +1 -1
- package/dist/esm/packages/index.js +9 -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/BindingOutputContext.d.ts +18 -0
- package/dist/esm/renderer/BindingOutputContext.d.ts.map +1 -0
- package/dist/esm/renderer/BindingOutputContext.js +70 -0
- package/dist/esm/renderer/BindingOutputContext.js.map +1 -0
- package/dist/esm/renderer/ComponentRegistry.d.ts +2 -0
- package/dist/esm/renderer/ComponentRegistry.d.ts.map +1 -1
- package/dist/esm/renderer/InteractiveComponent.d.ts.map +1 -1
- package/dist/esm/renderer/InteractiveComponent.js +38 -3
- 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 +3 -0
- package/dist/esm/renderer/index.d.ts.map +1 -1
- package/dist/esm/renderer/index.js +3 -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 +24 -0
- package/packages/DesignTimeBundle.ts +30 -0
- 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 +98 -0
- package/packages/ScenePackageBundle.ts +5 -0
- package/packages/index.ts +9 -0
- package/renderer/AbortableQueryRunner.ts +27 -0
- package/renderer/BindingOutputContext.tsx +69 -0
- package/renderer/ComponentRegistry.ts +4 -0
- package/renderer/InteractiveComponent.tsx +30 -3
- package/renderer/RenderBindingScopeContext.tsx +73 -0
- package/renderer/index.ts +3 -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 { ComponentRegistry, createReactRenderer } from './renderer';
|
|
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`.
|
|
@@ -18,14 +21,40 @@ export interface SceneElementViewProps {
|
|
|
18
21
|
* being edited or played: there is no design-time mode.
|
|
19
22
|
*/
|
|
20
23
|
configuration?: EffectiveConfiguration;
|
|
24
|
+
|
|
25
|
+
/** Called when rendered components publish or clear output properties for typed bindings. */
|
|
26
|
+
onComponentOutputsChanged?: (outputs: Record<string, Record<string, unknown>>) => void;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
/**
|
|
24
30
|
* Renders a Scene element tree with the real `Scene.React` renderer - the WYSIWYG building block Studio's
|
|
25
31
|
* preview surface and Stage's shipped web bundle both consume unmodified.
|
|
26
32
|
*/
|
|
27
|
-
export function SceneElementView({
|
|
28
|
-
|
|
33
|
+
export function SceneElementView({
|
|
34
|
+
element,
|
|
35
|
+
registry,
|
|
36
|
+
resolveBinding,
|
|
37
|
+
configuration,
|
|
38
|
+
onComponentOutputsChanged,
|
|
39
|
+
dataContext,
|
|
40
|
+
queryResults,
|
|
41
|
+
componentOutputs,
|
|
42
|
+
}: SceneElementViewProps) {
|
|
29
43
|
const configured = useMemo(() => configuration ? applyEffectiveConfiguration(element, configuration) : element, [element, configuration]);
|
|
30
|
-
return
|
|
44
|
+
return (
|
|
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>
|
|
53
|
+
);
|
|
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)}</>;
|
|
31
60
|
}
|
|
@@ -3,6 +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 RenderBindingScopeContext = require('./renderer/RenderBindingScopeContext.js');
|
|
6
7
|
var createReactRenderer = require('./renderer/createReactRenderer.js');
|
|
7
8
|
require('./interactions/useInteractions.js');
|
|
8
9
|
require('./interactions/NotificationHost.js');
|
|
@@ -10,16 +11,30 @@ require('./interactions/NotificationHost.js');
|
|
|
10
11
|
/**
|
|
11
12
|
* Renders a Scene element tree with the real `Scene.React` renderer - the WYSIWYG building block Studio's
|
|
12
13
|
* preview surface and Stage's shipped web bundle both consume unmodified.
|
|
13
|
-
*/ function SceneElementView({ element, registry, resolveBinding, configuration }) {
|
|
14
|
-
const renderer = react.useMemo(()=>createReactRenderer.createReactRenderer(registry), [
|
|
15
|
-
registry
|
|
16
|
-
]);
|
|
14
|
+
*/ function SceneElementView({ element, registry, resolveBinding, configuration, onComponentOutputsChanged, dataContext, queryResults, componentOutputs }) {
|
|
17
15
|
const configured = react.useMemo(()=>configuration ? scene_engine.applyEffectiveConfiguration(element, configuration) : element, [
|
|
18
16
|
element,
|
|
19
17
|
configuration
|
|
20
18
|
]);
|
|
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();
|
|
21
36
|
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
22
|
-
children: scene_engine.renderElement(
|
|
37
|
+
children: scene_engine.renderElement(element, renderer, resolveBinding)
|
|
23
38
|
});
|
|
24
39
|
}
|
|
25
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 { ComponentRegistry, createReactRenderer } from './renderer';\n\nexport interface SceneElementViewProps {\n element: SceneElement;\n registry: ComponentRegistry;\n resolveBinding
|
|
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":";;;;;;;;;;;;;AAA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
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,C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A,EAAM,OAAA;gBAASC,KAAAA,EAAO,OAAA;gBAASC,KAAAA,EAAO,SAAA;AAAWC,gBAAAA,SAAAA,EAAWC,8BAAkBO,UAAU;AAAEL,gBAAAA,OAAAA,EAAS,EAAE;gBACrGM,IAAAA,EAAM;oBACFX,KAAAA,EAAO,iBAAA;oBACPF,UAAAA,EAAY;AACR,wBAAA;4BAAEC,IAAAA,EAAM,OAAA;4BAASC,KAAAA,EAAO,OAAA;4BAASC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,8BAAkBC,MAAM;4BAAEI,WAAAA,EAAa;gCAAEC,QAAAA,EAAU,IAAA;gCAAMG,aAAAA,EAAe;AAAE;AAAE,yBAAA;AAC1I,wBAAA;4BAAEb,IAAAA,EAAM,MAAA;4BAAQC,KAAAA,EAAO,MAAA;4BAAQC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,8BAAkBU,IAAI;4BAAEN,UAAAA,EAAY;AAAa,yBAAA;AAC7G,wBAAA;4BAAER,IAAAA,EAAM,aAAA;4BAAeC,KAAAA,EAAO,aAAA;4BAAeC,KAAAA,EAAO,SAAA;AAAWC,4BAAAA,SAAAA,EAAWC,8BAAkBW,WAAW;4BAAEP,UAAAA,EAAY,cAAA;4BAAgBC,WAAAA,EAAa;gCAAEC,QAAAA,EAAU;AAAK;AAAE;AACxK;AACL;AACJ;AACH;AACL;;;"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var SceneElementView = require('./SceneElementView.js');
|
|
4
|
+
var AbortableQueryRunner = require('./renderer/AbortableQueryRunner.js');
|
|
5
|
+
var BindingOutputContext = require('./renderer/BindingOutputContext.js');
|
|
6
|
+
var RenderBindingScopeContext = require('./renderer/RenderBindingScopeContext.js');
|
|
4
7
|
var UnresolvedComponent = require('./renderer/UnresolvedComponent.js');
|
|
5
8
|
var createReactRenderer = require('./renderer/createReactRenderer.js');
|
|
6
9
|
var InteractiveComponent = require('./renderer/InteractiveComponent.js');
|
|
@@ -14,10 +17,14 @@ var coreComponents = require('./core/coreComponents.js');
|
|
|
14
17
|
var corePackage = require('./core/corePackage.js');
|
|
15
18
|
var NavBar = require('./NavBar/NavBar.js');
|
|
16
19
|
var extractNavigationItem = require('./NavBar/extractNavigationItem.js');
|
|
20
|
+
var resolveDestination = require('./navigation/resolveDestination.js');
|
|
17
21
|
var IconAdapterRegistry = require('./icons/IconAdapterRegistry.js');
|
|
18
22
|
var IconAdapterContext = require('./icons/IconAdapterContext.js');
|
|
19
23
|
var useIconGlyph = require('./icons/useIconGlyph.js');
|
|
20
24
|
var SceneIcon = require('./icons/SceneIcon.js');
|
|
25
|
+
var DesignTimeBundle = require('./packages/DesignTimeBundle.js');
|
|
26
|
+
var DesignTimeProvider = require('./packages/DesignTimeProvider.js');
|
|
27
|
+
var PackageHostConfiguration = require('./packages/PackageHostConfiguration.js');
|
|
21
28
|
var ScenePackageBundle = require('./packages/ScenePackageBundle.js');
|
|
22
29
|
var ComponentsUiLibraryContract = require('./packages/ComponentsUiLibraryContract.js');
|
|
23
30
|
var themeTokens = require('./theme/themeTokens.js');
|
|
@@ -33,6 +40,13 @@ var useInteractionHosts = require('./interactions/useInteractionHosts.js');
|
|
|
33
40
|
|
|
34
41
|
|
|
35
42
|
exports.SceneElementView = SceneElementView.SceneElementView;
|
|
43
|
+
exports.AbortableQueryRunner = AbortableQueryRunner.AbortableQueryRunner;
|
|
44
|
+
exports.BindingOutputProvider = BindingOutputContext.BindingOutputProvider;
|
|
45
|
+
exports.useBindingOutputScope = BindingOutputContext.useBindingOutputScope;
|
|
46
|
+
exports.useBindingOutputs = BindingOutputContext.useBindingOutputs;
|
|
47
|
+
exports.RenderBindingScopeProvider = RenderBindingScopeContext.RenderBindingScopeProvider;
|
|
48
|
+
exports.useRenderBindingResolver = RenderBindingScopeContext.useRenderBindingResolver;
|
|
49
|
+
exports.useRenderBindingScope = RenderBindingScopeContext.useRenderBindingScope;
|
|
36
50
|
exports.UnresolvedComponent = UnresolvedComponent.UnresolvedComponent;
|
|
37
51
|
exports.createReactRenderer = createReactRenderer.createReactRenderer;
|
|
38
52
|
exports.InteractiveComponent = InteractiveComponent.InteractiveComponent;
|
|
@@ -57,12 +71,17 @@ exports.corePackage = corePackage.corePackage;
|
|
|
57
71
|
exports.corePackageManifest = corePackage.corePackageManifest;
|
|
58
72
|
exports.NavBar = NavBar.NavBar;
|
|
59
73
|
exports.extractNavigationItem = extractNavigationItem.extractNavigationItem;
|
|
74
|
+
exports.resolveDestination = resolveDestination.resolveDestination;
|
|
60
75
|
exports.IconAdapterRegistry = IconAdapterRegistry.IconAdapterRegistry;
|
|
61
76
|
exports.createIconAdapterRegistry = IconAdapterRegistry.createIconAdapterRegistry;
|
|
62
77
|
exports.IconAdapterProvider = IconAdapterContext.IconAdapterProvider;
|
|
63
78
|
exports.useIconAdapters = IconAdapterContext.useIconAdapters;
|
|
64
79
|
exports.useIconGlyph = useIconGlyph.useIconGlyph;
|
|
65
80
|
exports.SceneIcon = SceneIcon.SceneIcon;
|
|
81
|
+
exports.validateDesignTimeBundle = DesignTimeBundle.validateDesignTimeBundle;
|
|
82
|
+
exports.DesignTimeProvider = DesignTimeProvider.DesignTimeProvider;
|
|
83
|
+
exports.useDesignTimeContext = DesignTimeProvider.useDesignTimeContext;
|
|
84
|
+
exports.resolvePackageHost = PackageHostConfiguration.resolvePackageHost;
|
|
66
85
|
exports.componentRegistryKey = ScenePackageBundle.componentRegistryKey;
|
|
67
86
|
exports.mergeIconAdapters = ScenePackageBundle.mergeIconAdapters;
|
|
68
87
|
exports.mergePackageRegistries = ScenePackageBundle.mergePackageRegistries;
|
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,CAACV,YAAYW,sBAAsB,IAAI,EAAC,CAAA,CACpEC,GAAG,CAAC,CAAC,CAACC,IAAAA,EAAMC,QAAQ,GAAK;AAACD,YAAAA,IAAAA;YAAME,MAAAA,CAA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AI,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;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
function validateDesignTimeBundle(bundle) {
|
|
6
|
+
if (!bundle) return [];
|
|
7
|
+
const problems = [];
|
|
8
|
+
for (const [name, action] of Object.entries(bundle.actions ?? {})){
|
|
9
|
+
if (action.descriptor.id !== name) {
|
|
10
|
+
problems.push(`registers design-time action '${name}' with descriptor id '${action.descriptor.id}'`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return problems;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.validateDesignTimeBundle = validateDesignTimeBundle;
|
|
17
|
+
//# sourceMappingURL=DesignTimeBundle.js.map
|
|
@@ -0,0 +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 } 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;;;"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_engine = require('@cratis/scene.engine');
|
|
4
|
+
var IconAdapterRegistry = require('../icons/IconAdapterRegistry.js');
|
|
5
|
+
var ScenePackageBundle = require('./ScenePackageBundle.js');
|
|
6
|
+
|
|
7
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
8
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the approved package set a standalone or embedded React host uses.
|
|
11
|
+
*/ function resolvePackageHost(configuration) {
|
|
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
|
+
}
|
|
20
|
+
const byName = new Map(configuration.bundles.map((bundle)=>[
|
|
21
|
+
bundle.manifest.name,
|
|
22
|
+
bundle
|
|
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(' -> ')}`);
|
|
30
|
+
const bundles = [];
|
|
31
|
+
const runtimeSingletons = new Map();
|
|
32
|
+
const assets = [];
|
|
33
|
+
for (const packageName of selection.packages){
|
|
34
|
+
const bundle = byName.get(packageName);
|
|
35
|
+
if (!bundle) {
|
|
36
|
+
diagnostics.push(`UI profile asks for '${packageName}' but the host did not approve a bundle for it`);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
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))) {
|
|
45
|
+
diagnostics.push(`Package '${packageName}' declares network assets, but host policy forbids them`);
|
|
46
|
+
}
|
|
47
|
+
assets.push(...packageAssets);
|
|
48
|
+
for (const dependency of bundle.manifest.runtimeSingletons ?? []){
|
|
49
|
+
const owner = runtimeSingletons.get(dependency);
|
|
50
|
+
if (owner && owner !== packageName) {
|
|
51
|
+
diagnostics.push(`Runtime singleton '${dependency}' is provided by both '${owner}' and '${packageName}'`);
|
|
52
|
+
}
|
|
53
|
+
runtimeSingletons.set(dependency, packageName);
|
|
54
|
+
}
|
|
55
|
+
bundles.push(bundle);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
bundles,
|
|
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,
|
|
66
|
+
diagnostics
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
exports.resolvePackageHost = resolvePackageHost;
|
|
71
|
+
//# sourceMappingURL=PackageHostConfiguration.js.map
|
|
@@ -0,0 +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 { 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","iconLibrary","adapter","filter","undefined"],"mappings":";;;;;;AAAA;AACA;AA8BA;;IAGO,SAASA,kBAAAA,CAAmBC,aAAuC,EAAA;AACtE,IAAA,MAAMC,cAAwB,EAAE;AAChC,IAAA,MAAMC,QAAQ,IAAIC,GAAAA,EAAAA;AAClB,IAAA,KAAK,MAAMC,MAAAA,IAAUJ,aAAAA,CAAcK,OAAO,CAAE;A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rDC,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;;"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var scene_model = require('@cratis/scene.model');
|
|
4
4
|
var IconAdapterRegistry = require('../icons/IconAdapterRegistry.js');
|
|
5
5
|
var ComponentsUiLibraryContract = require('./ComponentsUiLibraryContract.js');
|
|
6
|
+
var DesignTimeBundle = require('./DesignTimeBundle.js');
|
|
6
7
|
|
|
7
8
|
// Copyright (c) Cratis. All rights reserved.
|
|
8
9
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
@@ -72,6 +73,7 @@ var ComponentsUiLibraryContract = require('./ComponentsUiLibraryContract.js');
|
|
|
72
73
|
}
|
|
73
74
|
problems.push(...validateIconLibrary(bundle));
|
|
74
75
|
problems.push(...validateDescriptors(bundle));
|
|
76
|
+
problems.push(...DesignTimeBundle.validateDesignTimeBundle(bundle.designTime));
|
|
75
77
|
return problems;
|
|
76
78
|
}
|
|
77
79
|
function validateIconLibrary(bundle) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScenePackageBundle.js","sources":["../../../packages/ScenePackageBundle.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, DialogTemplate, Layout, PackageKind, PropertyValueType, ScenePackage, Screen, ScreenTemplate, Theme } from '@cratis/scene.model';\nimport { IconAdapterRegistry, createIconAdapterRegistry } from '../icons/IconAdapterRegistry';\nimport { IconLibraryBundle } from '../icons/IconLibraryBundle';\nimport { ComponentRegistry } from '../renderer';\nimport { ComponentsUiLibraryContract, validateComponentsUiLibraryContract } from './ComponentsUiLibraryContract';\n\n/**\n * What a package actually ships to a React renderer, as opposed to what it *declares*.\n *\n * `ScenePackage` is the declaration — a name, a kind, dependencies, and the names of what it\n * contributes. It is deliberately platform-agnostic and lives in `Scene.Model`, because Stage's build and\n * Studio's design-time queries both read it without ever loading a component. A bundle is the other half:\n * the real React components, layouts, screens and themes behind those names, which only a renderer needs.\n *\n * A package publishes exactly one bundle, as a named export following its own name —\n * `primeReactPackage`, `cratisComponentsPackage`, `corePackage`. A host loads it from the module the\n * declaration's `ScenePackage.module` names.\n */\nexport interface ScenePackageBundle {\n /**\n * The package's own declaration. Its `components`, `layouts` and `themes` name lists must agree with\n * what this bundle actually provides — {@link validatePackageBundle} is what proves they do.\n */\n manifest: ScenePackage;\n\n /**\n * The components this package provides, keyed by {@link componentRegistryKey}.\n */\n components: ComponentRegistry;\n\n /**\n * The application shells this package provides, if any. Only a blueprint has these.\n */\n layouts?: Layout[];\n\n /**\n * The screen templates this package provides — the shapes that go inside a layout, each declaring\n * which of its parent's slots it fills.\n */\n screenTemplates?: ScreenTemplate[];\n\n /**\n * The dialog templates this package provides.\n */\n dialogTemplates?: DialogTemplate[];\n\n /**\n * Sample screens this package ships — a layout package's gallery, so a preview has real content to\n * put through the real engine rather than a mockup.\n */\n screens?: Screen[];\n\n /**\n * What can be edited on this package's components - one {@link ComponentDescriptor} per component that is\n * editable at design time. They are data, so Studio reads them without rendering anything, and they travel with\n * the components they describe rather than in a registry of their own. {@link validatePackageBundle} checks\n * that every descriptor names a component the manifest declares.\n */\n descriptors?: ComponentDescriptor[];\n\n /**\n * The themes this package ships, if any.\n */\n themes?: Theme[];\n\n /**\n * The icon catalog and renderer adapter of an icon-library package. Present exactly when the\n * manifest declares an icon library.\n */\n iconLibrary?: IconLibraryBundle;\n\n /**\n * Optional web-renderer mapping to a Components UiLibrary. Scene's catalog remains independently\n * authored; hosts check the loaded export with validateComponentsUiLibraryMapping before rendering.\n */\n componentsUiLibrary?: ComponentsUiLibraryContract;\n}\n\n/**\n * The key a component is registered and looked up under: the package that provides it, then the bare name\n * a screen refers to it by.\n *\n * A screen writes a bare name (`button`) or a package-qualified one (`PrimeReact.button`);\n * `resolveComponentName` turns either into a `{ name, package }` pair, and this turns that pair into the\n * registry key. Nothing should build this string by hand — the separator is an implementation detail of\n * the registry, deliberately not the `.` used for qualification in a screen, so a package name containing\n * dots stays unambiguous.\n */\nexport function componentRegistryKey(packageName: string, componentName: string): string {\n return `${packageName}:${componentName}`;\n}\n\n/**\n * Checks that a bundle provides everything its manifest declares, and declares everything it provides, and that\n * every descriptor it ships is for a component it declares and is well formed.\n *\n * A manifest that promises a component the bundle does not register renders as `UnresolvedComponent` at\n * runtime — a blank box, far from where the mistake was made. A component registered but not declared is\n * invisible to `resolveComponentName`, so a screen can never name it. Both are silent failures, which is\n * why every package's specs run this.\n */\nexport function validatePackageBundle(bundle: ScenePackageBundle): string[] {\n const problems: string[] = [];\n const { manifest } = bundle;\n\n for (const name of manifest.components) {\n if (!(componentRegistryKey(manifest.name, name) in bundle.components)) {\n problems.push(`declares the component '${name}' but registers no implementation for it`);\n }\n }\n\n const declared = new Set(manifest.components.map((name) => componentRegistryKey(manifest.name, name)));\n for (const key of Object.keys(bundle.components)) {\n if (!declared.has(key)) {\n problems.push(`registers '${key}', which the manifest does not declare`);\n }\n }\n\n const providedLayouts = new Set((bundle.layouts ?? []).map((layout) => layout.name));\n for (const name of manifest.layouts) {\n if (!providedLayouts.has(name)) {\n problems.push(`declares the layout '${name}' but provides no definition for it`);\n }\n }\n\n const providedScreenTemplates = new Set((bundle.screenTemplates ?? []).map((template) => template.name));\n for (const name of manifest.screenTemplates) {\n if (!providedScreenTemplates.has(name)) {\n problems.push(`declares the screen template '${name}' but provides no definition for it`);\n }\n }\n\n const providedDialogTemplates = new Set((bundle.dialogTemplates ?? []).map((template) => template.name));\n for (const name of manifest.dialogTemplates) {\n if (!providedDialogTemplates.has(name)) {\n problems.push(`declares the dialog template '${name}' but provides no definition for it`);\n }\n }\n\n const providedThemes = new Set((bundle.themes ?? []).map((theme) => theme.name));\n for (const name of manifest.themes) {\n if (!providedThemes.has(name)) {\n problems.push(`declares the theme '${name}' but provides no definition for it`);\n }\n }\n\n if (bundle.componentsUiLibrary) {\n if (manifest.kind !== PackageKind.ComponentLibrary) {\n problems.push('declares a Components UI library mapping but is not of kind ComponentLibrary');\n }\n problems.push(...validateComponentsUiLibraryContract(bundle.componentsUiLibrary));\n }\n\n problems.push(...validateIconLibrary(bundle));\n problems.push(...validateDescriptors(bundle));\n\n return problems;\n}\n\nfunction validateIconLibrary(bundle: ScenePackageBundle): string[] {\n const problems: string[] = [];\n const { manifest, iconLibrary } = bundle;\n const declaresIconLibrary = manifest.kind === PackageKind.IconLibrary || manifest.iconLibrary !== undefined;\n\n if (manifest.kind === PackageKind.IconLibrary && !manifest.iconLibrary) {\n problems.push('is an icon library but declares no iconLibrary metadata');\n }\n\n if (manifest.kind !== PackageKind.IconLibrary && manifest.iconLibrary) {\n problems.push('declares iconLibrary metadata but is not of kind IconLibrary');\n }\n\n if (declaresIconLibrary && !iconLibrary) {\n problems.push('declares an icon library but the bundle provides no catalog or adapter for it');\n }\n\n if (!declaresIconLibrary && iconLibrary) {\n problems.push('provides an icon catalog and adapter, which the manifest does not declare');\n }\n\n if (iconLibrary) {\n if (iconLibrary.catalog.library !== manifest.name) {\n problems.push(`provides an icon catalog for '${iconLibrary.catalog.library}' instead of '${manifest.name}'`);\n }\n\n if (iconLibrary.adapter.library !== manifest.name) {\n problems.push(`provides an icon adapter for '${iconLibrary.adapter.library}' instead of '${manifest.name}'`);\n }\n\n if (manifest.iconLibrary && !manifest.iconLibrary.renderers.includes('react')) {\n problems.push(\"provides a React icon adapter but does not list 'react' among its icon renderers\");\n }\n }\n\n return problems;\n}\n\nfunction validateDescriptors(bundle: ScenePackageBundle): string[] {\n const problems: string[] = [];\n const declared = new Set(bundle.manifest.components.map((name) => componentRegistryKey(bundle.manifest.name, name)));\n const described = new Set<string>();\n\n for (const descriptor of bundle.descriptors ?? []) {\n if (!declared.has(descriptor.component)) {\n problems.push(`describes '${descriptor.component}', which the manifest does not declare as a component`);\n }\n\n if (described.has(descriptor.component)) {\n problems.push(`describes '${descriptor.component}' more than once`);\n }\n\n described.add(descriptor.component);\n\n const paths = new Set<string>();\n for (const property of descriptor.properties) {\n if (paths.has(property.path)) {\n problems.push(`'${descriptor.component}' describes the property '${property.path}' more than once`);\n }\n\n paths.add(property.path);\n\n if (property.valueType === PropertyValueType.Collection && property.item === undefined) {\n problems.push(`'${descriptor.component}' describes the collection '${property.path}' without describing its items`);\n }\n\n if (property.valueType === PropertyValueType.Enum && (property.choices ?? []).length === 0) {\n problems.push(`'${descriptor.component}' describes the enum '${property.path}' without choices`);\n }\n }\n }\n\n return problems;\n}\n\n/**\n * Merges the component registries of several bundles into the single registry a renderer consumes.\n *\n * Keys carry their package name, so nothing collides and merge order does not matter — which package wins\n * a *bare* name is decided earlier, by `resolveComponentName` walking the profile's priority order.\n */\nexport function mergePackageRegistries(bundles: ScenePackageBundle[]): ComponentRegistry {\n return Object.assign({}, ...bundles.map((bundle) => bundle.components)) as ComponentRegistry;\n}\n\n/**\n * Collects the icon adapters of several bundles into the registry `SceneIcon` renders through.\n *\n * @throws Error when two bundles provide an adapter for the same library.\n */\nexport function mergeIconAdapters(bundles: ScenePackageBundle[]): IconAdapterRegistry {\n return createIconAdapterRegistry(bundles.flatMap((bundle) => (bundle.iconLibrary ? [bundle.iconLibrary.adapter] : [])));\n}\n"],"names":["componentRegistryKey","packageName","componentName","validatePackageBundle","bundle","problems","manifest","name","components","push","declared","Set","map","key","Object","keys","has","providedLayouts","layouts","layout","providedScreenTemplates","screenTemplates","template","providedDialogTemplates","dialogTemplates","providedThemes","themes","theme","componentsUiLibrary","kind","PackageKind","ComponentLibrary","validateComponentsUiLibraryContract","validateIconLibrary","validateDescriptors","iconLibrary","declaresIconLibrary","IconLibrary","undefined","catalog","library","adapter","renderers","includes","described","descriptor","descriptors","component","add","paths","property","properties","path","valueType","PropertyValueType","Collection","item","Enum","choices","length","mergePackageRegistries","bundles","assign","mergeIconAdapters","createIconAdapterRegistry","flatMap"],"mappings":";;;;;;AAAA;AACA;AAgFA;;;;;;;;;AASC,IACM,SAASA,oBAAAA,CAAqBC,WAAmB,EAAEC,aAAqB,EAAA;AAC3E,IAAA,OAAO,CAAA,EAAGD,WAAAA,CAAY,CAAC,EAAEC,aAAAA,CAAAA,CAAe;AAC5C;AAEA;;;;;;;;IASO,SAASC,qBAAAA,CAAsBC,MAA0B,EAAA;AAC5D,IAAA,MAAMC,WAAqB,EAAE;IAC7B,MAAM,EAAEC,QAAQ,EAAE,GAAGF,MAAAA;AAErB,IAAA,KAAK,MAAMG,IAAAA,IAAQD,QAAAA,CAASE,UAAU,CAAE;QACpC,IAAI,EAAER,oBAAAA,CAAqBM,QAAAA,CAASC,IAAI,EAAEA,IAAAA,CAAAA,IAASH,MAAAA,CAAOI,UAAS,CAAA,EAAI;AACnEH,YAAAA,QAAAA,CAASI,IAAI,CAAC,CAAC,wBAAwB,EAAEF,IAAAA,CAAK,wCAAwC,CAAC,CAAA;AAC3F,QAAA;AACJ,IAAA;AAEA,IAAA,MAAMG,QAAAA,GAAW,IAAIC,GAAAA,CAAIL,QAAAA,CAASE,UAAU,CAACI,GAAG,CAAC,CAACL,IAAAA,GAASP,oBAAAA,CAAqBM,QAAAA,CAASC,IAAI,EAAEA,IAAAA,CAAAA,CAAAA,CAAAA;AAC/F,IAAA,KAAK,MAAMM,GAAAA,IAAOC,MAAAA,CAAOC,IAAI,CAACX,MAAAA,CAAOI,UAAU,CAAA,CAAG;AAC9C,QAAA,IAAI,CAACE,QAAAA,CAASM,GAAG,CAACH,GAAAA,CAAAA,EAAM;AACpBR,YAAAA,QAAAA,CAASI,IAAI,CAAC,CAAC,WAAW,EAAEI,GAAAA,CAAI,sCAAsC,CAAC,CAAA;AAC3E,QAAA;AACJ,IAAA;AAEA,IAAA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,IAAIF,QAAAA,CAASG,SAAS,KAAKC,6BAAAA,CAAkBC,UAAU,IAAIL,QAAAA,CAASM,IAAI,KAAKlB,SAAAA,EAAW;AACpFjC,gBAAAA,QAAAA,CAASI,IAAI,CAAC,CAAC,CAAC,EAAEoC,UAAAA,CAAWE,SAAS,CAAC,4BAA4B,EAAEG,QAAAA,CAASE,IAAI,CAAC,8BAA8B,CAAC,CAAA;AACtH,YAAA;AAEA,YAAA,IAAIF,SAASG,SAAS,KAAKC,6BAAAA,CAAkBG,IAAI,IAAI,CAACP,QAAAA,CAASQ,OAAO,IAAI,EAAC,EAAGC,MAAM,KAAK,CAAA,EAAG;AACxFtD,gBAAAA,QAAAA,CAASI,IAAI,CAAC,CAAC,CAAC,EAAEoC,UAAAA,CAAWE,SAAS,CAAC,sBAAsB,EAAEG,QAAAA,CAASE,IAAI,CAAC,iBAAiB,CAAC,CAAA;AACnG,YAAA;AACJ,QAAA;AACJ,IAAA;IAEA,OAAO/C,QAAAA;AACX;AAEA;;;;;IAMO,SAASuD,sBAAAA,CAAuBC,OAA6B,EAAA;IAChE,OAAO/C,MAAAA,CAAOgD,MAAM,CAAC,EAAC,EAAA,GAAMD,OAAAA,CAAQjD,GAAG,CAAC,CAACR,MAAAA,GAAWA,MAAAA,CAAOI,UAAU,CAAA,CAAA;AACzE;AAEA;;;;IAKO,SAASuD,iBAAAA,CAAkBF,OAA6B,EAAA;IAC3D,OAAOG,6CAAAA,CAA0BH,QAAQI,OAAO,CAAC,CAAC7D,MAAAA,GAAYA,MAAAA,CAAO+B,WAAW,GAAG;YAAC/B,MAAAA,CAAO+B,WAAW,CAACM;AAAQ,SAAA,GAAG,EAAE,CAAA,CAAA;AACxH;;;;;"}
|
|
1
|
+
{"version":3,"file":"ScenePackageBundle.js","sources":["../../../packages/ScenePackageBundle.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, DialogTemplate, Layout, PackageKind, PropertyValueType, ScenePackage, Screen, ScreenTemplate, Theme } from '@cratis/scene.model';\nimport { IconAdapterRegistry, createIconAdapterRegistry } from '../icons/IconAdapterRegistry';\nimport { IconLibraryBundle } from '../icons/IconLibraryBundle';\nimport { ComponentRegistry } from '../renderer';\nimport { ComponentsUiLibraryContract, validateComponentsUiLibraryContract } from './ComponentsUiLibraryContract';\nimport { DesignTimeBundle, validateDesignTimeBundle } from './DesignTimeBundle';\n\n/**\n * What a package actually ships to a React renderer, as opposed to what it *declares*.\n *\n * `ScenePackage` is the declaration — a name, a kind, dependencies, and the names of what it\n * contributes. It is deliberately platform-agnostic and lives in `Scene.Model`, because Stage's build and\n * Studio's design-time queries both read it without ever loading a component. A bundle is the other half:\n * the real React components, layouts, screens and themes behind those names, which only a renderer needs.\n *\n * A package publishes exactly one bundle, as a named export following its own name —\n * `primeReactPackage`, `cratisComponentsPackage`, `corePackage`. A host loads it from the module the\n * declaration's `ScenePackage.module` names.\n */\nexport interface ScenePackageBundle {\n /**\n * The package's own declaration. Its `components`, `layouts` and `themes` name lists must agree with\n * what this bundle actually provides — {@link validatePackageBundle} is what proves they do.\n */\n manifest: ScenePackage;\n\n /**\n * The components this package provides, keyed by {@link componentRegistryKey}.\n */\n components: ComponentRegistry;\n\n /**\n * The application shells this package provides, if any. Only a blueprint has these.\n */\n layouts?: Layout[];\n\n /**\n * The screen templates this package provides — the shapes that go inside a layout, each declaring\n * which of its parent's slots it fills.\n */\n screenTemplates?: ScreenTemplate[];\n\n /**\n * The dialog templates this package provides.\n */\n dialogTemplates?: DialogTemplate[];\n\n /**\n * Sample screens this package ships — a layout package's gallery, so a preview has real content to\n * put through the real engine rather than a mockup.\n */\n screens?: Screen[];\n\n /**\n * What can be edited on this package's components - one {@link ComponentDescriptor} per component that is\n * editable at design time. They are data, so Studio reads them without rendering anything, and they travel with\n * the components they describe rather than in a registry of their own. {@link validatePackageBundle} checks\n * that every descriptor names a component the manifest declares.\n */\n descriptors?: ComponentDescriptor[];\n\n /**\n * The themes this package ships, if any.\n */\n themes?: Theme[];\n\n /**\n * The icon catalog and renderer adapter of an icon-library package. Present exactly when the\n * manifest declares an icon library.\n */\n iconLibrary?: IconLibraryBundle;\n\n /**\n * Optional web-renderer mapping to a Components UiLibrary. Scene's catalog remains independently\n * authored; hosts check the loaded export with validateComponentsUiLibraryMapping before rendering.\n */\n componentsUiLibrary?: ComponentsUiLibraryContract;\n\n /** Optional React-only design-time tooling. Runtime hosts can omit it entirely. */\n designTime?: DesignTimeBundle;\n}\n\n/**\n * The key a component is registered and looked up under: the package that provides it, then the bare name\n * a screen refers to it by.\n *\n * A screen writes a bare name (`button`) or a package-qualified one (`PrimeReact.button`);\n * `resolveComponentName` turns either into a `{ name, package }` pair, and this turns that pair into the\n * registry key. Nothing should build this string by hand — the separator is an implementation detail of\n * the registry, deliberately not the `.` used for qualification in a screen, so a package name containing\n * dots stays unambiguous.\n */\nexport function componentRegistryKey(packageName: string, componentName: string): string {\n return `${packageName}:${componentName}`;\n}\n\n/**\n * Checks that a bundle provides everything its manifest declares, and declares everything it provides, and that\n * every descriptor it ships is for a component it declares and is well formed.\n *\n * A manifest that promises a component the bundle does not register renders as `UnresolvedComponent` at\n * runtime — a blank box, far from where the mistake was made. A component registered but not declared is\n * invisible to `resolveComponentName`, so a screen can never name it. Both are silent failures, which is\n * why every package's specs run this.\n */\nexport function validatePackageBundle(bundle: ScenePackageBundle): string[] {\n const problems: string[] = [];\n const { manifest } = bundle;\n\n for (const name of manifest.components) {\n if (!(componentRegistryKey(manifest.name, name) in bundle.components)) {\n problems.push(`declares the component '${name}' but registers no implementation for it`);\n }\n }\n\n const declared = new Set(manifest.components.map((name) => componentRegistryKey(manifest.name, name)));\n for (const key of Object.keys(bundle.components)) {\n if (!declared.has(key)) {\n problems.push(`registers '${key}', which the manifest does not declare`);\n }\n }\n\n const providedLayouts = new Set((bundle.layouts ?? []).map((layout) => layout.name));\n for (const name of manifest.layouts) {\n if (!providedLayouts.has(name)) {\n problems.push(`declares the layout '${name}' but provides no definition for it`);\n }\n }\n\n const providedScreenTemplates = new Set((bundle.screenTemplates ?? []).map((template) => template.name));\n for (const name of manifest.screenTemplates) {\n if (!providedScreenTemplates.has(name)) {\n problems.push(`declares the screen template '${name}' but provides no definition for it`);\n }\n }\n\n const providedDialogTemplates = new Set((bundle.dialogTemplates ?? []).map((template) => template.name));\n for (const name of manifest.dialogTemplates) {\n if (!providedDialogTemplates.has(name)) {\n problems.push(`declares the dialog template '${name}' but provides no definition for it`);\n }\n }\n\n const providedThemes = new Set((bundle.themes ?? []).map((theme) => theme.name));\n for (const name of manifest.themes) {\n if (!providedThemes.has(name)) {\n problems.push(`declares the theme '${name}' but provides no definition for it`);\n }\n }\n\n if (bundle.componentsUiLibrary) {\n if (manifest.kind !== PackageKind.ComponentLibrary) {\n problems.push('declares a Components UI library mapping but is not of kind ComponentLibrary');\n }\n problems.push(...validateComponentsUiLibraryContract(bundle.componentsUiLibrary));\n }\n\n problems.push(...validateIconLibrary(bundle));\n problems.push(...validateDescriptors(bundle));\n problems.push(...validateDesignTimeBundle(bundle.designTime));\n\n return problems;\n}\n\nfunction validateIconLibrary(bundle: ScenePackageBundle): string[] {\n const problems: string[] = [];\n const { manifest, iconLibrary } = bundle;\n const declaresIconLibrary = manifest.kind === PackageKind.IconLibrary || manifest.iconLibrary !== undefined;\n\n if (manifest.kind === PackageKind.IconLibrary && !manifest.iconLibrary) {\n problems.push('is an icon library but declares no iconLibrary metadata');\n }\n\n if (manifest.kind !== PackageKind.IconLibrary && manifest.iconLibrary) {\n problems.push('declares iconLibrary metadata but is not of kind IconLibrary');\n }\n\n if (declaresIconLibrary && !iconLibrary) {\n problems.push('declares an icon library but the bundle provides no catalog or adapter for it');\n }\n\n if (!declaresIconLibrary && iconLibrary) {\n problems.push('provides an icon catalog and adapter, which the manifest does not declare');\n }\n\n if (iconLibrary) {\n if (iconLibrary.catalog.library !== manifest.name) {\n problems.push(`provides an icon catalog for '${iconLibrary.catalog.library}' instead of '${manifest.name}'`);\n }\n\n if (iconLibrary.adapter.library !== manifest.name) {\n problems.push(`provides an icon adapter for '${iconLibrary.adapter.library}' instead of '${manifest.name}'`);\n }\n\n if (manifest.iconLibrary && !manifest.iconLibrary.renderers.includes('react')) {\n problems.push(\"provides a React icon adapter but does not list 'react' among its icon renderers\");\n }\n }\n\n return problems;\n}\n\nfunction validateDescriptors(bundle: ScenePackageBundle): string[] {\n const problems: string[] = [];\n const declared = new Set(bundle.manifest.components.map((name) => componentRegistryKey(bundle.manifest.name, name)));\n const described = new Set<string>();\n\n for (const descriptor of bundle.descriptors ?? []) {\n if (!declared.has(descriptor.component)) {\n problems.push(`describes '${descriptor.component}', which the manifest does not declare as a component`);\n }\n\n if (described.has(descriptor.component)) {\n problems.push(`describes '${descriptor.component}' more than once`);\n }\n\n described.add(descriptor.component);\n\n const paths = new Set<string>();\n for (const property of descriptor.properties) {\n if (paths.has(property.path)) {\n problems.push(`'${descriptor.component}' describes the property '${property.path}' more than once`);\n }\n\n paths.add(property.path);\n\n if (property.valueType === PropertyValueType.Collection && property.item === undefined) {\n problems.push(`'${descriptor.component}' describes the collection '${property.path}' without describing its items`);\n }\n\n if (property.valueType === PropertyValueType.Enum && (property.choices ?? []).length === 0) {\n problems.push(`'${descriptor.component}' describes the enum '${property.path}' without choices`);\n }\n }\n }\n\n return problems;\n}\n\n/**\n * Merges the component registries of several bundles into the single registry a renderer consumes.\n *\n * Keys carry their package name, so nothing collides and merge order does not matter — which package wins\n * a *bare* name is decided earlier, by `resolveComponentName` walking the profile's priority order.\n */\nexport function mergePackageRegistries(bundles: ScenePackageBundle[]): ComponentRegistry {\n return Object.assign({}, ...bundles.map((bundle) => bundle.components)) as ComponentRegistry;\n}\n\n/**\n * Collects the icon adapters of several bundles into the registry `SceneIcon` renders through.\n *\n * @throws Error when two bundles provide an adapter for the same library.\n */\nexport function mergeIconAdapters(bundles: ScenePackageBundle[]): IconAdapterRegistry {\n return createIconAdapterRegistry(bundles.flatMap((bundle) => (bundle.iconLibrary ? [bundle.iconLibrary.adapter] : [])));\n}\n"],"names":["componentRegistryKey","packageName","componentName","validatePackageBundle","bundle","problems","manifest","name","components","push","declared","Set","map","key","Object","keys","has","providedLayouts","layouts","layout","providedScreenTemplates","screenTemplates","template","providedDialogTemplates","dialogTemplates","providedThemes","themes","theme","componentsUiLibrary","kind","PackageKind","ComponentLibrary","validateComponentsUiLibraryContract","validateIconLibrary","validateDescriptors","validateDesignTimeBundle","designTime","iconLibrary","declaresIconLibrary","IconLibrary","undefined","catalog","library","adapter","renderers","includes","described","descriptor","descriptors","component","add","paths","property","properties","path","valueType","PropertyValueType","Collection","item","Enum","choices","length","mergePackageRegistries","bundles","assign","mergeIconAdapters","createIconAdapterRegistry","flatMap"],"mappings":";;;;;;;AAAA;AACA;AAoFA;;;;;;;;;AASC,IACM,SAASA,oBAAAA,CAAqBC,WAAmB,EAAEC,aAAqB,EAAA;AAC3E,IAAA,OAAO,CAAA,EAAGD,WAAAA,CAAY,CAAC,EAAEC,aAAAA,CAAAA,CAAe;AAC5C;AAEA;;;;;;;;IASO,SAASC,qBAAAA,CAAsBC,MAA0B,EAAA;AAC5D,IAAA,MAAMC,WAAqB,EAAE;IAC7B,MAAM,EAAEC,QAAQ,EAAE,GAAGF,MAAAA;AAErB,IAAA,KAAK,MAAMG,IAAAA,IAAQD,QAAAA,CAASE,UAAU,CAAE;QACpC,IAAI,EAAER,oBAAAA,CAAqBM,QAAAA,CAASC,IAAI,EAAEA,IAAAA,CAAAA,IAASH,MAAAA,CAAOI,UAAS,CAAA,EAAI;AACnEH,YAAAA,QAAAA,CAASI,IAAI,CAAC,CAAC,wBAAwB,EAAEF,IAAAA,CAAK,wCAAwC,CAAC,CAAA;AAC3F,QAAA;AACJ,IAAA;AAEA,IAAA,MAAMG,QAAAA,GAAW,IAAIC,GAAAA,CAAIL,QAAAA,CAASE,UAAU,CAACI,GAAG,CAAC,CAACL,IAAAA,GAASP,oBAAAA,CAAqB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