@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
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var scene_engine = require('@cratis/scene.engine');
|
|
6
|
+
var scene_model = require('@cratis/scene.model');
|
|
7
|
+
var BindingOutputContext = require('./BindingOutputContext.js');
|
|
8
|
+
|
|
9
|
+
const Context = /*#__PURE__*/ react.createContext(undefined);
|
|
10
|
+
/**
|
|
11
|
+
* Provides the inherited reactive binding scope for a rendered Scene tree.
|
|
12
|
+
*/ function RenderBindingScopeProvider(props) {
|
|
13
|
+
const current = react.useContext(Context);
|
|
14
|
+
if (current) return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
15
|
+
children: props.children
|
|
16
|
+
});
|
|
17
|
+
return /*#__PURE__*/ jsxRuntime.jsx(BindingOutputContext.BindingOutputProvider, {
|
|
18
|
+
onOutputsChanged: props.onComponentOutputsChanged,
|
|
19
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(RenderBindingScopeInner, {
|
|
20
|
+
...props
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function RenderBindingScopeInner({ children, dataContext, queryResults, componentOutputs, resolveBinding }) {
|
|
25
|
+
const outputs = BindingOutputContext.useBindingOutputScope();
|
|
26
|
+
const previousValues = react.useRef(new Map());
|
|
27
|
+
const scope = react.useMemo(()=>({
|
|
28
|
+
dataContext,
|
|
29
|
+
queryResults,
|
|
30
|
+
componentOutputs: {
|
|
31
|
+
...componentOutputs ?? {},
|
|
32
|
+
...outputs
|
|
33
|
+
}
|
|
34
|
+
}), [
|
|
35
|
+
componentOutputs,
|
|
36
|
+
dataContext,
|
|
37
|
+
outputs,
|
|
38
|
+
queryResults
|
|
39
|
+
]);
|
|
40
|
+
const resolver = react.useCallback((binding)=>{
|
|
41
|
+
if (!binding.kind && resolveBinding) return resolveBinding(binding);
|
|
42
|
+
const key = JSON.stringify(binding);
|
|
43
|
+
const value = scene_engine.resolveBindingExpression(binding, scope);
|
|
44
|
+
if (binding.nullBehavior === scene_model.BindingNullBehavior.Preserve && value === undefined) {
|
|
45
|
+
return previousValues.current.get(key);
|
|
46
|
+
}
|
|
47
|
+
if (value !== undefined) previousValues.current.set(key, value);
|
|
48
|
+
return value;
|
|
49
|
+
}, [
|
|
50
|
+
resolveBinding,
|
|
51
|
+
scope
|
|
52
|
+
]);
|
|
53
|
+
const value = react.useMemo(()=>({
|
|
54
|
+
resolveBinding: resolver,
|
|
55
|
+
scope
|
|
56
|
+
}), [
|
|
57
|
+
resolver,
|
|
58
|
+
scope
|
|
59
|
+
]);
|
|
60
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Context.Provider, {
|
|
61
|
+
value: value,
|
|
62
|
+
children: children
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function useRenderBindingResolver() {
|
|
66
|
+
const context = react.useContext(Context);
|
|
67
|
+
if (!context) throw new Error('No Scene render binding scope is available.');
|
|
68
|
+
return context.resolveBinding;
|
|
69
|
+
}
|
|
70
|
+
function useRenderBindingScope() {
|
|
71
|
+
return react.useContext(Context)?.scope ?? {};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
exports.RenderBindingScopeProvider = RenderBindingScopeProvider;
|
|
75
|
+
exports.useRenderBindingResolver = useRenderBindingResolver;
|
|
76
|
+
exports.useRenderBindingScope = useRenderBindingScope;
|
|
77
|
+
//# sourceMappingURL=RenderBindingScopeContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenderBindingScopeContext.js","sources":["../../../renderer/RenderBindingScopeContext.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, useCallback, useContext, useMemo, useRef } from 'react';\nimport { BindingResolver, BindingScope, resolveBindingExpression } from '@cratis/scene.engine';\nimport { BindingExpression, BindingNullBehavior } from '@cratis/scene.model';\nimport { BindingOutputProvider, useBindingOutputScope } from './BindingOutputContext';\n\ninterface RenderBindingScopeValue {\n resolveBinding: BindingResolver;\n scope: BindingScope;\n}\n\nconst Context = createContext<RenderBindingScopeValue | undefined>(undefined);\n\nexport interface RenderBindingScopeProviderProps {\n children: ReactNode;\n dataContext?: unknown;\n queryResults?: Record<string, unknown>;\n componentOutputs?: Record<string, Record<string, unknown>>;\n resolveBinding?: BindingResolver;\n onComponentOutputsChanged?: (outputs: Record<string, Record<string, unknown>>) => void;\n}\n\n/**\n * Provides the inherited reactive binding scope for a rendered Scene tree.\n */\nexport function RenderBindingScopeProvider(props: RenderBindingScopeProviderProps) {\n const current = useContext(Context);\n if (current) return <>{props.children}</>;\n\n return (\n <BindingOutputProvider onOutputsChanged={props.onComponentOutputsChanged}>\n <RenderBindingScopeInner {...props} />\n </BindingOutputProvider>\n );\n}\n\nfunction RenderBindingScopeInner({ children, dataContext, queryResults, componentOutputs, resolveBinding }: RenderBindingScopeProviderProps) {\n const outputs = useBindingOutputScope();\n const previousValues = useRef(new Map<string, unknown>());\n const scope = useMemo<BindingScope>(() => ({\n dataContext,\n queryResults,\n componentOutputs: { ...(componentOutputs ?? {}), ...outputs },\n }), [componentOutputs, dataContext, outputs, queryResults]);\n\n const resolver = useCallback<BindingResolver>((binding: BindingExpression) => {\n if (!binding.kind && resolveBinding) return resolveBinding(binding);\n\n const key = JSON.stringify(binding);\n const value = resolveBindingExpression(binding, scope);\n if (binding.nullBehavior === BindingNullBehavior.Preserve && value === undefined) {\n return previousValues.current.get(key);\n }\n\n if (value !== undefined) previousValues.current.set(key, value);\n return value;\n }, [resolveBinding, scope]);\n\n const value = useMemo<RenderBindingScopeValue>(() => ({ resolveBinding: resolver, scope }), [resolver, scope]);\n return <Context.Provider value={value}>{children}</Context.Provider>;\n}\n\nexport function useRenderBindingResolver(): BindingResolver {\n const context = useContext(Context);\n if (!context) throw new Error('No Scene render binding scope is available.');\n return context.resolveBinding;\n}\n\nexport function useRenderBindingScope(): BindingScope {\n return useContext(Context)?.scope ?? {};\n}\n"],"names":["Context","createContext","undefined","RenderBindingScopeProvider","props","current","useContext","_jsx","_Fragment","children","BindingOutputProvider","onOutputsChanged","onComponentOutputsChanged","RenderBindingScopeInner","dataContext","queryResults","componentOutputs","resolveBinding","outputs","useBindingOutputScope","previousValues","useRef","Map","scope","useMemo","resolver","useCallback","binding","kind","key","JSON","stringify","value","resolveBindingExpression","nullBehavior","BindingNullBehavior","Preserve","get","set","Provider","useRenderBindingResolver","context","Error","useRenderBindingScope"],"mappings":";;;;;;;;AAaA,MAAMA,wBAAUC,mBAAAA,CAAmDC,SAAAA,CAAAA;AAWnE;;IAGO,SAASC,0BAAAA,CAA2BC,KAAsC,EAAA;AAC7E,IAAA,MAAMC,UAAUC,gBAAAA,CAAWN,OAAAA,CAAAA;AAC3B,IAAA,IAAIK,SAAS,qBAAOE,cAAA,CAAAC,mBAAA,EAAA;AAAGJ,QAAAA,QAAAA,EAAAA,KAAAA,CAAMK;;AAE7B,IAAA,qBACIF,cAAA,CAACG,0CAAAA,EAAAA;AAAsBC,QAAAA,gBAAAA,EAAkBP,MAAMQ,yBAAyB;AACpE,QAAA,QAAA,gBAAAL,cAAA,CAACM,uBAAAA,EAAAA;AAAyB,YAAA,GAAGT;;;AAGzC;AAEA,SAASS,uBAAAA,CAAwB,EAAEJ,QAAQ,EAAEK,WAAW,EAAEC,YAAY,EAAEC,gBAAgB,EAAEC,cAAc,EAAmC,EAAA;AACvI,IAAA,M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AA,CAAA;IAC7G,qBAAOhB,cAAA,CAACP,QAAQuC,QAAQ,EAAA;QAACP,KAAAA,EAAOA,KAAAA;AAAQvB,QAAAA,QAAAA,EAAAA;;AAC5C;AAEO,SAAS+B,wBAAAA,GAAAA;AACZ,IAAA,MAAMC,UAAUnC,gBAAAA,CAAWN,OAAAA,CAAAA;AAC3B,IAAA,IAAI,CAACyC,OAAAA,EAAS,MAAM,IAAIC,KAAAA,CAAM,6CAAA,CAAA;AAC9B,IAAA,OAAOD,QAAQxB,cAAc;AACjC;AAEO,SAAS0B,qBAAAA,GAAAA;IACZ,OAAOrC,gBAAAA,CAAWN,OAAAA,CAAAA,EAAUuB,KAAAA,IAAS,EAAC;AAC1C;;;;"}
|
|
@@ -4,9 +4,12 @@ import { ComponentRegistry } from './renderer';
|
|
|
4
4
|
export interface SceneElementViewProps {
|
|
5
5
|
element: SceneElement;
|
|
6
6
|
registry: ComponentRegistry;
|
|
7
|
-
resolveBinding
|
|
7
|
+
resolveBinding?: BindingResolver;
|
|
8
|
+
dataContext?: unknown;
|
|
9
|
+
queryResults?: Record<string, unknown>;
|
|
10
|
+
componentOutputs?: Record<string, Record<string, unknown>>;
|
|
8
11
|
configuration?: EffectiveConfiguration;
|
|
9
12
|
onComponentOutputsChanged?: (outputs: Record<string, Record<string, unknown>>) => void;
|
|
10
13
|
}
|
|
11
|
-
export declare function SceneElementView({ element, registry, resolveBinding, configuration, onComponentOutputsChanged }: SceneElementViewProps): import("react").JSX.Element;
|
|
14
|
+
export declare function SceneElementView({ element, registry, resolveBinding, configuration, onComponentOutputsChanged, dataContext, queryResults, componentOutputs, }: SceneElementViewProps): import("react").JSX.Element;
|
|
12
15
|
//# sourceMappingURL=SceneElementView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneElementView.d.ts","sourceRoot":"","sources":["../../SceneElementView.tsx"],"names":[],"mappings":"AAIA,OAAO,EAA8C,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,
|
|
1
|
+
{"version":3,"file":"SceneElementView.d.ts","sourceRoot":"","sources":["../../SceneElementView.tsx"],"names":[],"mappings":"AAIA,OAAO,EAA8C,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAA6E,MAAM,YAAY,CAAC;AAE1H,MAAM,WAAW,qBAAqB;IAClC,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAQ3D,aAAa,CAAC,EAAE,sBAAsB,CAAC;IAGvC,yBAAyB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC;CAC1F;AAMD,wBAAgB,gBAAgB,CAAC,EAC7B,OAAO,EACP,QAAQ,EACR,cAAc,EACd,aAAa,EACb,yBAAyB,EACzB,WAAW,EACX,YAAY,EACZ,gBAAgB,GACnB,EAAE,qBAAqB,+BAYvB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { applyEffectiveConfiguration, renderElement } from '@cratis/scene.engine';
|
|
4
|
-
import {
|
|
4
|
+
import { RenderBindingScopeProvider, useRenderBindingResolver } from './renderer/RenderBindingScopeContext.js';
|
|
5
5
|
import { createReactRenderer } from './renderer/createReactRenderer.js';
|
|
6
6
|
import './interactions/useInteractions.js';
|
|
7
7
|
import './interactions/NotificationHost.js';
|
|
@@ -9,17 +9,30 @@ import './interactions/NotificationHost.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* Renders a Scene element tree with the real `Scene.React` renderer - the WYSIWYG building block Studio's
|
|
11
11
|
* preview surface and Stage's shipped web bundle both consume unmodified.
|
|
12
|
-
*/ function SceneElementView({ element, registry, resolveBinding, configuration, onComponentOutputsChanged }) {
|
|
13
|
-
const renderer = useMemo(()=>createReactRenderer(registry), [
|
|
14
|
-
registry
|
|
15
|
-
]);
|
|
12
|
+
*/ function SceneElementView({ element, registry, resolveBinding, configuration, onComponentOutputsChanged, dataContext, queryResults, componentOutputs }) {
|
|
16
13
|
const configured = useMemo(()=>configuration ? applyEffectiveConfiguration(element, configuration) : element, [
|
|
17
14
|
element,
|
|
18
15
|
configuration
|
|
19
16
|
]);
|
|
20
|
-
return /*#__PURE__*/ jsx(
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
return /*#__PURE__*/ jsx(RenderBindingScopeProvider, {
|
|
18
|
+
dataContext: dataContext,
|
|
19
|
+
queryResults: queryResults,
|
|
20
|
+
componentOutputs: componentOutputs,
|
|
21
|
+
resolveBinding: resolveBinding,
|
|
22
|
+
onComponentOutputsChanged: onComponentOutputsChanged,
|
|
23
|
+
children: /*#__PURE__*/ jsx(RenderedElement, {
|
|
24
|
+
element: configured,
|
|
25
|
+
registry: registry
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function RenderedElement({ element, registry }) {
|
|
30
|
+
const renderer = useMemo(()=>createReactRenderer(registry), [
|
|
31
|
+
registry
|
|
32
|
+
]);
|
|
33
|
+
const resolveBinding = useRenderBindingResolver();
|
|
34
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
35
|
+
children: renderElement(element, renderer, resolveBinding)
|
|
23
36
|
});
|
|
24
37
|
}
|
|
25
38
|
|
|
@@ -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,OAAAA,CAAQ,IAAMN,gBAAgBO,2BAAAA,CAA4BV,OAAAA,EAASG,iBAAiBH,OAAAA,EAAS;AAACA,QAAAA,OAAAA;AAASG,QAAAA;AAAc,KAAA,CAAA;AACxI,IAAA,qBACIQ,GAAA,CAACC,0BAAAA,EAAAA;QACGP,WAAAA,EAAaA,WAAAA;QACbC,YAAAA,EAAcA,YAAAA;QACdC,gBAAAA,EAAkBA,gBAAAA;QAClBL,cAAAA,EAAgBA,cAAAA;QAChBE,yBAAAA,EAA2BA,yBAAAA;AAC3B,QAAA,QAAA,gBAAAO,GAAA,CAACE,eAAAA,EAAAA;YAAgBb,OAAAA,EAASQ,UAAAA;YAAYP,QAAAA,EAAUA;;;AAG5D;AAEA,SAASY,eAAAA,CAAgB,EAAEb,OAAO,EAAEC,QAAQ,EAA0D,EAAA;AAClG,IAAA,MAAMa,QAAAA,GAAWL,OAAAA,CAAQ,IAAMM,mBAAAA,CAAoBd,QAAAA,CAAAA,EAAW;AAACA,QAAAA;AAAS,KAAA,CAAA;AACxE,IAAA,MAAMC,cAAAA,GAAiBc,wBAAAA,EAAAA;IACvB,qBAAOL,GAAA,CAAAM,QAAA,EAAA;AAAGC,QAAAA,QAAAA,EAAAA,aAAAA,CAAclB,SAASc,QAAAA,EAAUZ,cAAAA;;AAC/C;;"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import 'react/jsx-runtime';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '@cratis/scene.engine';
|
|
4
|
+
import '@cratis/scene.model';
|
|
1
5
|
import { componentRegistryKey } from '../packages/ScenePackageBundle.js';
|
|
2
6
|
import { CoreText } from './CoreText.js';
|
|
3
7
|
import { CoreButton } from './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,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUC,QAAAA;IACxC,CAACD,oBAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYE,UAAAA;IAC1C,CAACF,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUG,QAAAA;IACxC,CAACH,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUI,QAAAA;IACxC,CAACJ,oBAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYK,UAAAA;IAC1C,CAACL,oBAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaM,WAAAA;IAC3C,CAACN,oBAAAA,CAAqB,MAAA,EAAQ,UAAA,CAAA,GAAcO,YAAAA;IAC5C,CAACP,oBAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWQ,SAAAA;IACzC,CAACR,oBAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWS,SAAAA;IACzC,CAACT,oBAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYU,UAAAA;IAC1C,CAACV,oBAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaW,WAAAA;IAC3C,CAACX,oBAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWY,SAAAA;IACzC,CAACZ,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUa,QAAAA;IACxC,CAACb,oBAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUc,QAAAA;IACxC,CAACd,oBAAAA,CAAqB,MAAA,EAAQ,eAAA,CAAA,GAAmBe;AACrD;;"}
|
|
@@ -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,oBAAAA,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,kBAAkBC,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,kBAAkBC;AAAO,aAAA;AACvF,YAAA;gBACIL,IAAAA,EAAM,SAAA;gBAAWC,KAAAA,EAAO,SAAA;gBAAWC,KAAAA,EAAO,UAAA;AAAYC,gBAAAA,SAAAA,EAAWC,kBAAkBC,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,UAAA;AAAYC,gBAAAA,SAAAA,EAAWC,kBAAkBO,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,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { SceneElementView } from './SceneElementView.js';
|
|
2
|
+
export { AbortableQueryRunner } from './renderer/AbortableQueryRunner.js';
|
|
2
3
|
export { BindingOutputProvider, useBindingOutputScope, useBindingOutputs } from './renderer/BindingOutputContext.js';
|
|
4
|
+
export { RenderBindingScopeProvider, useRenderBindingResolver, useRenderBindingScope } from './renderer/RenderBindingScopeContext.js';
|
|
3
5
|
export { UnresolvedComponent } from './renderer/UnresolvedComponent.js';
|
|
4
6
|
export { createReactRenderer } from './renderer/createReactRenderer.js';
|
|
5
7
|
export { InteractiveComponent } from './renderer/InteractiveComponent.js';
|
|
@@ -13,11 +15,13 @@ export { coreComponents } from './core/coreComponents.js';
|
|
|
13
15
|
export { corePackage, corePackageManifest } from './core/corePackage.js';
|
|
14
16
|
export { NavBar } from './NavBar/NavBar.js';
|
|
15
17
|
export { extractNavigationItem } from './NavBar/extractNavigationItem.js';
|
|
18
|
+
export { resolveDestination } from './navigation/resolveDestination.js';
|
|
16
19
|
export { IconAdapterRegistry, createIconAdapterRegistry } from './icons/IconAdapterRegistry.js';
|
|
17
20
|
export { IconAdapterProvider, useIconAdapters } from './icons/IconAdapterContext.js';
|
|
18
21
|
export { useIconGlyph } from './icons/useIconGlyph.js';
|
|
19
22
|
export { SceneIcon } from './icons/SceneIcon.js';
|
|
20
23
|
export { validateDesignTimeBundle } from './packages/DesignTimeBundle.js';
|
|
24
|
+
export { DesignTimeProvider, useDesignTimeContext } from './packages/DesignTimeProvider.js';
|
|
21
25
|
export { resolvePackageHost } from './packages/PackageHostConfiguration.js';
|
|
22
26
|
export { componentRegistryKey, mergeIconAdapters, mergePackageRegistries, validatePackageBundle } from './packages/ScenePackageBundle.js';
|
|
23
27
|
export { validateComponentsUiLibraryContract, validateComponentsUiLibraryMapping } from './packages/ComponentsUiLibraryContract.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DestinationKind } from '@cratis/scene.model';
|
|
2
|
+
export interface DestinationResolution {
|
|
3
|
+
kind: DestinationKind;
|
|
4
|
+
url?: string;
|
|
5
|
+
outlet?: string;
|
|
6
|
+
dialog?: string;
|
|
7
|
+
action: 'navigate' | 'openDialog' | 'openExternal';
|
|
8
|
+
diagnostics: string[];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=DestinationResolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DestinationResolution.d.ts","sourceRoot":"","sources":["../../../navigation/DestinationResolution.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,eAAe,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,GAAG,YAAY,GAAG,cAAc,CAAC;IACnD,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DestinationResolution.js","sourceRoot":"","sources":["../../../navigation/DestinationResolution.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../navigation/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../navigation/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BindingScope } from '@cratis/scene.engine';
|
|
2
|
+
import { DestinationReference } from '@cratis/scene.model';
|
|
3
|
+
import { DestinationResolution } from './DestinationResolution';
|
|
4
|
+
export declare function resolveDestination(destination: DestinationReference, scope?: BindingScope): DestinationResolution;
|
|
5
|
+
//# sourceMappingURL=resolveDestination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveDestination.d.ts","sourceRoot":"","sources":["../../../navigation/resolveDestination.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAA4B,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAmB,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAKhE,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,oBAAoB,EAAE,KAAK,GAAE,YAAiB,GAAG,qBAAqB,CAiBrH"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { resolveBindingExpression } from '@cratis/scene.engine';
|
|
2
|
+
import { DestinationKind } from '@cratis/scene.model';
|
|
3
|
+
|
|
4
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
5
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
6
|
+
/**
|
|
7
|
+
* Resolves a destination into a renderer-neutral navigation action, deep link and target outlet/dialog.
|
|
8
|
+
*/ function resolveDestination(destination, scope = {}) {
|
|
9
|
+
const diagnostics = [];
|
|
10
|
+
const kind = destination.kind ?? (destination.dialog ? DestinationKind.Dialog : DestinationKind.Outlet);
|
|
11
|
+
const parameters = Object.entries(destination.routeParameterBindings ?? {}).map(([name, binding])=>[
|
|
12
|
+
name,
|
|
13
|
+
String(resolveBindingExpression(binding, scope) ?? '')
|
|
14
|
+
]);
|
|
15
|
+
const base = destination.route ?? identityRoute(destination);
|
|
16
|
+
if (!base && kind !== DestinationKind.Dialog) diagnostics.push('Destination has no routeable screen, stable identity or route.');
|
|
17
|
+
const url = base ? appendParameters(base, parameters) : undefined;
|
|
18
|
+
return {
|
|
19
|
+
kind,
|
|
20
|
+
url,
|
|
21
|
+
outlet: destination.outlet,
|
|
22
|
+
dialog: destination.dialog,
|
|
23
|
+
action: kind === DestinationKind.Dialog ? 'openDialog' : kind === DestinationKind.External ? 'openExternal' : 'navigate',
|
|
24
|
+
diagnostics
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function identityRoute(destination) {
|
|
28
|
+
if (destination.screen) return destination.screen;
|
|
29
|
+
const parts = [
|
|
30
|
+
destination.module,
|
|
31
|
+
destination.feature,
|
|
32
|
+
destination.slice
|
|
33
|
+
].filter((part)=>typeof part === 'string' && part.length > 0);
|
|
34
|
+
return parts.length ? parts.join('/') : undefined;
|
|
35
|
+
}
|
|
36
|
+
function appendParameters(route, parameters) {
|
|
37
|
+
if (!parameters.length) return route;
|
|
38
|
+
let replaced = route;
|
|
39
|
+
const unused = [];
|
|
40
|
+
for (const [name, value] of parameters){
|
|
41
|
+
const marker = `{${name}}`;
|
|
42
|
+
if (replaced.includes(marker)) {
|
|
43
|
+
replaced = replaced.split(marker).join(encodeURIComponent(value));
|
|
44
|
+
} else {
|
|
45
|
+
unused.push(`${encodeURIComponent(name)}=${encodeURIComponent(value)}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return unused.length ? `${replaced}?${unused.join('&')}` : replaced;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { resolveDestination };
|
|
52
|
+
//# 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,eAAAA,CAAgBC,MAAM,GAAGD,eAAAA,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,CAAOC,wBAAAA,CAAyBF,SAASb,KAAAA,CAAAA,IAAU,EAAA;AAAI,SAAA,CAAA;AAC5F,IAAA,MAAMgB,IAAAA,GAAOjB,WAAAA,CAAYkB,KAAK,IAAIC,aAAAA,CAAcnB,WAAAA,CAAAA;IAChD,IAAI,CAACiB,QAAQd,IAAAA,KAASE,eAAAA,CAAgBC,MAAM,EAAEJ,WAAAA,CAAYkB,IAAI,CAAC,gEAAA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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,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
descriptor: ComponentDescriptor;
|
|
1
|
+
import { DesignTimeActionDescriptor, SceneEdit } from '@cratis/scene.model';
|
|
2
|
+
import { DesignTimeContext } from './DesignTimeContext';
|
|
3
|
+
export interface DesignTimeActionContext extends DesignTimeContext {
|
|
5
4
|
commandMetadata?: {
|
|
6
5
|
properties: {
|
|
7
6
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesignTimeAction.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeAction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"DesignTimeAction.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeAction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAC9D,eAAe,CAAC,EAAE;QAAE,UAAU,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,CAAC;CACtF;AAED,MAAM,WAAW,sBAAsB;IACnC,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB;AAKD,MAAM,WAAW,gBAAgB;IAC7B,UAAU,EAAE,0BAA0B,CAAC;IACvC,SAAS,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC;IACrD,SAAS,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC;IACrD,OAAO,CAAC,OAAO,EAAE,uBAAuB,GAAG,sBAAsB,CAAC;CACrE"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { ComponentType
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
2
|
import { DesignTimeAction } from './DesignTimeAction';
|
|
3
|
+
import { DesignTimeComponentProps } from './DesignTimeComponentProps';
|
|
4
|
+
import { DesignTimePropertyDisplayProps } from './DesignTimePropertyDisplayProps';
|
|
5
|
+
import { DesignTimePropertyEditorProps } from './DesignTimePropertyEditorProps';
|
|
3
6
|
export interface DesignTimeBundle {
|
|
4
|
-
previews?: Record<string, ComponentType<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
children?: ReactNode;
|
|
9
|
-
}>>;
|
|
10
|
-
propertyEditors?: Record<string, ComponentType<Record<string, unknown>>>;
|
|
11
|
-
propertyDisplays?: Record<string, ComponentType<{
|
|
12
|
-
value: unknown;
|
|
13
|
-
}>>;
|
|
7
|
+
previews?: Record<string, ComponentType<DesignTimeComponentProps>>;
|
|
8
|
+
designers?: Record<string, ComponentType<DesignTimeComponentProps>>;
|
|
9
|
+
propertyEditors?: Record<string, ComponentType<DesignTimePropertyEditorProps>>;
|
|
10
|
+
propertyDisplays?: Record<string, ComponentType<DesignTimePropertyDisplayProps>>;
|
|
14
11
|
actions?: Record<string, DesignTimeAction>;
|
|
15
12
|
}
|
|
16
13
|
export declare function validateDesignTimeBundle(bundle: DesignTimeBundle | undefined): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DesignTimeBundle.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeBundle.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"DesignTimeBundle.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeBundle.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAKhF,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,wBAAwB,CAAC,CAAC,CAAC;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,wBAAwB,CAAC,CAAC,CAAC;IACpE,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,6BAA6B,CAAC,CAAC,CAAC;IAC/E,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,8BAA8B,CAAC,CAAC,CAAC;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC9C;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,GAAG,MAAM,EAAE,CASvF"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"DesignTimeComponentProps.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeComponentProps.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,MAAM,WAAW,wBAAwB;IACrC,OAAO,EAAE,iBAAiB,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesignTimeComponentProps.js","sourceRoot":"","sources":["../../../packages/DesignTimeComponentProps.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentDescriptor, EffectiveConfiguration, ExternalComponent, SceneEdit, SceneElement, Screen, UiProfile } from '@cratis/scene.model';
|
|
2
|
+
import { BindingDiagnostic } from '@cratis/scene.engine';
|
|
3
|
+
import { ScenePackageBundle } from './ScenePackageBundle';
|
|
4
|
+
export interface DesignTimeContext {
|
|
5
|
+
element: ExternalComponent;
|
|
6
|
+
root: SceneElement;
|
|
7
|
+
screen?: Screen;
|
|
8
|
+
descriptor: ComponentDescriptor;
|
|
9
|
+
configuration?: EffectiveConfiguration;
|
|
10
|
+
profile: UiProfile;
|
|
11
|
+
bundles: ScenePackageBundle[];
|
|
12
|
+
permissions: Record<string, boolean>;
|
|
13
|
+
capabilities: Record<string, boolean>;
|
|
14
|
+
diagnostics: BindingDiagnostic[];
|
|
15
|
+
submitEdits(edits: SceneEdit[]): void;
|
|
16
|
+
submitAction(actionId: string, edits: SceneEdit[]): void;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=DesignTimeContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesignTimeContext.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimeContext.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,MAAM,EACN,SAAS,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAK1D,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,mBAAmB,CAAC;IAChC,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,OAAO,EAAE,SAAS,CAAC;IACnB,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,WAAW,EAAE,iBAAiB,EAAE,CAAC;IACjC,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACtC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;CAC5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesignTimeContext.js","sourceRoot":"","sources":["../../../packages/DesignTimeContext.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PropertyDescriptor } from '@cratis/scene.model';
|
|
2
|
+
import { DesignTimeContext } from './DesignTimeContext';
|
|
3
|
+
export interface DesignTimePropertyDisplayProps {
|
|
4
|
+
context: DesignTimeContext;
|
|
5
|
+
property: PropertyDescriptor;
|
|
6
|
+
value: unknown;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=DesignTimePropertyDisplayProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesignTimePropertyDisplayProps.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimePropertyDisplayProps.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,MAAM,WAAW,8BAA8B;IAC3C,OAAO,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesignTimePropertyDisplayProps.js","sourceRoot":"","sources":["../../../packages/DesignTimePropertyDisplayProps.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropertyDescriptor } from '@cratis/scene.model';
|
|
2
|
+
import { DesignTimeContext } from './DesignTimeContext';
|
|
3
|
+
export interface DesignTimePropertyEditorProps {
|
|
4
|
+
context: DesignTimeContext;
|
|
5
|
+
property: PropertyDescriptor;
|
|
6
|
+
value: unknown;
|
|
7
|
+
setValue(value: unknown): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=DesignTimePropertyEditorProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesignTimePropertyEditorProps.d.ts","sourceRoot":"","sources":["../../../packages/DesignTimePropertyEditorProps.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,MAAM,WAAW,6BAA6B;IAC1C,OAAO,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesignTimePropertyEditorProps.js","sourceRoot":"","sources":["../../../packages/DesignTimePropertyEditorProps.ts"],"names":[],"mappings":""}
|