@cratis/scene.react 4.15.0 → 4.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/ScreenplayCoreComponents.tsx +24 -3
- package/dist/cjs/SceneElementView.js +1 -0
- package/dist/cjs/SceneElementView.js.map +1 -1
- package/dist/cjs/core/ScreenplayCoreComponents.js +25 -5
- package/dist/cjs/core/ScreenplayCoreComponents.js.map +1 -1
- package/dist/cjs/index.js +7 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/navigation/createHashSceneHistory.js +43 -0
- package/dist/cjs/navigation/createHashSceneHistory.js.map +1 -0
- package/dist/cjs/renderer/useValueOutput.js +31 -0
- package/dist/cjs/renderer/useValueOutput.js.map +1 -0
- package/dist/cjs/renderer/valueOutputProperty.js +28 -0
- package/dist/cjs/renderer/valueOutputProperty.js.map +1 -0
- package/dist/esm/SceneElementView.js +1 -0
- package/dist/esm/SceneElementView.js.map +1 -1
- package/dist/esm/core/ScreenplayCoreComponents.d.ts.map +1 -1
- package/dist/esm/core/ScreenplayCoreComponents.js +25 -5
- package/dist/esm/core/ScreenplayCoreComponents.js.map +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/navigation/createHashSceneHistory.d.ts +4 -0
- package/dist/esm/navigation/createHashSceneHistory.d.ts.map +1 -0
- package/dist/esm/navigation/createHashSceneHistory.js +41 -0
- package/dist/esm/navigation/createHashSceneHistory.js.map +1 -0
- package/dist/esm/navigation/index.d.ts +1 -0
- package/dist/esm/navigation/index.d.ts.map +1 -1
- package/dist/esm/navigation/index.js +1 -0
- package/dist/esm/navigation/index.js.map +1 -1
- package/dist/esm/renderer/index.d.ts +2 -0
- package/dist/esm/renderer/index.d.ts.map +1 -1
- package/dist/esm/renderer/index.js +2 -0
- package/dist/esm/renderer/index.js.map +1 -1
- package/dist/esm/renderer/useValueOutput.d.ts +4 -0
- package/dist/esm/renderer/useValueOutput.d.ts.map +1 -0
- package/dist/esm/renderer/useValueOutput.js +28 -0
- package/dist/esm/renderer/useValueOutput.js.map +1 -0
- package/dist/esm/renderer/valueOutputProperty.d.ts +3 -0
- package/dist/esm/renderer/valueOutputProperty.d.ts.map +1 -0
- package/dist/esm/renderer/valueOutputProperty.js +26 -0
- package/dist/esm/renderer/valueOutputProperty.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/navigation/createHashSceneHistory.ts +42 -0
- package/navigation/index.ts +1 -0
- package/package.json +5 -5
- package/renderer/index.ts +2 -0
- package/renderer/useValueOutput.ts +28 -0
- package/renderer/valueOutputProperty.ts +25 -0
|
@@ -6,6 +6,7 @@ export * from './SceneNavigationHost';
|
|
|
6
6
|
export * from './SceneNavigationState';
|
|
7
7
|
export * from './SceneRoute';
|
|
8
8
|
export * from './createBrowserSceneHistory';
|
|
9
|
+
export * from './createHashSceneHistory';
|
|
9
10
|
export * from './createMemorySceneHistory';
|
|
10
11
|
export * from './diagnoseRenderedNavigation';
|
|
11
12
|
export * from './identityRoute';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../navigation/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../navigation/index.ts"],"names":[],"mappings":"AAGA,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC"}
|
|
@@ -4,6 +4,8 @@ export * from './ComponentRegistry';
|
|
|
4
4
|
export * from './RenderBindingScopeContext';
|
|
5
5
|
export * from './UnresolvedComponent';
|
|
6
6
|
export * from './useBoundQuery';
|
|
7
|
+
export * from './useValueOutput';
|
|
8
|
+
export * from './valueOutputProperty';
|
|
7
9
|
export * from './createReactRenderer';
|
|
8
10
|
export * from './InteractiveComponent';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../renderer/index.ts"],"names":[],"mappings":"AAGA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../renderer/index.ts"],"names":[],"mappings":"AAGA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
|
@@ -4,6 +4,8 @@ export * from './ComponentRegistry';
|
|
|
4
4
|
export * from './RenderBindingScopeContext';
|
|
5
5
|
export * from './UnresolvedComponent';
|
|
6
6
|
export * from './useBoundQuery';
|
|
7
|
+
export * from './useValueOutput';
|
|
8
|
+
export * from './valueOutputProperty';
|
|
7
9
|
export * from './createReactRenderer';
|
|
8
10
|
export * from './InteractiveComponent';
|
|
9
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../renderer/index.ts"],"names":[],"mappings":"AAGA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../renderer/index.ts"],"names":[],"mappings":"AAGA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ComponentBindingOutputs } from './BindingOutputContext';
|
|
2
|
+
export declare const valueOutputName = "value";
|
|
3
|
+
export declare function useValueOutput(bindingOutputs: ComponentBindingOutputs | undefined, value: unknown): void;
|
|
4
|
+
//# sourceMappingURL=useValueOutput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useValueOutput.d.ts","sourceRoot":"","sources":["../../../renderer/useValueOutput.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAGjE,eAAO,MAAM,eAAe,UAAU,CAAC;AAUvC,wBAAgB,cAAc,CAAC,cAAc,EAAE,uBAAuB,GAAG,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAUxG"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
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
|
+
/** The output property an input widget publishes its current value under. */ const valueOutputName = 'value';
|
|
6
|
+
/**
|
|
7
|
+
* Publishes an input widget's current value as its `value` output: once when it mounts, with the initial
|
|
8
|
+
* value, and again on every change. Other elements bind to it with a `componentProperty` binding, and a
|
|
9
|
+
* command action maps it as `component.<id>.value`. The renderer clears the output when the widget unmounts.
|
|
10
|
+
*
|
|
11
|
+
* Values are published as JSON-compatible data so both engines read the same thing: a `Date` is published
|
|
12
|
+
* as its ISO 8601 string, and `undefined` as `null`.
|
|
13
|
+
*/ function useValueOutput(bindingOutputs, value) {
|
|
14
|
+
const published = value instanceof Date ? value.toISOString() : value ?? null;
|
|
15
|
+
const key = JSON.stringify(published);
|
|
16
|
+
const latest = useRef(published);
|
|
17
|
+
latest.current = published;
|
|
18
|
+
// Published by value through `key`: a new array or object with the same content is not a change.
|
|
19
|
+
useEffect(()=>{
|
|
20
|
+
bindingOutputs?.setOutput(valueOutputName, latest.current);
|
|
21
|
+
}, [
|
|
22
|
+
bindingOutputs,
|
|
23
|
+
key
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { useValueOutput, valueOutputName };
|
|
28
|
+
//# sourceMappingURL=useValueOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useValueOutput.js","sources":["../../../renderer/useValueOutput.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useEffect, useRef } from 'react';\nimport { ComponentBindingOutputs } from './BindingOutputContext';\n\n/** The output property an input widget publishes its current value under. */\nexport const valueOutputName = 'value';\n\n/**\n * Publishes an input widget's current value as its `value` output: once when it mounts, with the initial\n * value, and again on every change. Other elements bind to it with a `componentProperty` binding, and a\n * command action maps it as `component.<id>.value`. The renderer clears the output when the widget unmounts.\n *\n * Values are published as JSON-compatible data so both engines read the same thing: a `Date` is published\n * as its ISO 8601 string, and `undefined` as `null`.\n */\nexport function useValueOutput(bindingOutputs: ComponentBindingOutputs | undefined, value: unknown): void {\n const published = value instanceof Date ? value.toISOString() : value ?? null;\n const key = JSON.stringify(published);\n const latest = useRef(published);\n latest.current = published;\n\n // Published by value through `key`: a new array or object with the same content is not a change.\n useEffect(() => {\n bindingOutputs?.setOutput(valueOutputName, latest.current);\n }, [bindingOutputs, key]);\n}\n"],"names":["valueOutputName","useValueOutput","bindingOutputs","value","published","Date","toISOString","key","JSON","stringify","latest","useRef","current","useEffect","setOutput"],"mappings":";;AAAA;AACA;AAKA,8EACO,MAAMA,eAAAA,GAAkB;AAE/B;;;;;;;AAOC,IACM,SAASC,cAAAA,CAAeC,cAAmD,EAAEC,KAAc,EAAA;AAC9F,IAAA,MAAMC,YAAYD,KAAAA,YAAiBE,IAAAA,GAAOF,KAAAA,CAAMG,WAAW,KAAKH,KAAAA,IAAS,IAAA;IACzE,MAAMI,GAAAA,GAAMC,IAAAA,CAAKC,SAAS,CAACL,SAAAA,CAAAA;AAC3B,IAAA,MAAMM,SAASC,MAAAA,CAAOP,SAAAA,CAAAA;AACtBM,IAAAA,MAAAA,CAAOE,OAAO,GAAGR,SAAAA;;IAGjBS,SAAAA,CAAU,IAAA;QACNX,cAAAA,EAAgBY,SAAAA,CAAUd,eAAAA,EAAiBU,MAAAA,CAAOE,OAAO,CAAA;IAC7D,CAAA,EAAG;AAACV,QAAAA,cAAAA;AAAgBK,QAAAA;AAAI,KAAA,CAAA;AAC5B;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valueOutputProperty.d.ts","sourceRoot":"","sources":["../../../renderer/valueOutputProperty.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAUzF,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,iBAAiB,EAAE,WAAW,SAA+D,GAAG,kBAAkB,CAWhK"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BindingMode } from '@cratis/scene.model';
|
|
2
|
+
import { valueOutputName } from './useValueOutput.js';
|
|
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
|
+
* The descriptor entry an input widget declares for the value it publishes with `useValueOutput`, so a
|
|
8
|
+
* designer can offer it as a binding source - for a detail component, a query argument or a command input.
|
|
9
|
+
*
|
|
10
|
+
* @param valueType The type of value the widget publishes.
|
|
11
|
+
* @param description What the value is, when the default sentence does not say enough.
|
|
12
|
+
*/ function valueOutputProperty(valueType, description = 'What the user has entered, published as the input changes.') {
|
|
13
|
+
return {
|
|
14
|
+
path: valueOutputName,
|
|
15
|
+
label: 'Value',
|
|
16
|
+
group: 'Outputs',
|
|
17
|
+
valueType,
|
|
18
|
+
readOnly: true,
|
|
19
|
+
output: true,
|
|
20
|
+
bindingMode: BindingMode.OneWay,
|
|
21
|
+
description
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { valueOutputProperty };
|
|
26
|
+
//# sourceMappingURL=valueOutputProperty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valueOutputProperty.js","sources":["../../../renderer/valueOutputProperty.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { BindingMode, PropertyDescriptor, PropertyValueType } from '@cratis/scene.model';\nimport { valueOutputName } from './useValueOutput';\n\n/**\n * The descriptor entry an input widget declares for the value it publishes with `useValueOutput`, so a\n * designer can offer it as a binding source - for a detail component, a query argument or a command input.\n *\n * @param valueType The type of value the widget publishes.\n * @param description What the value is, when the default sentence does not say enough.\n */\nexport function valueOutputProperty(valueType: PropertyValueType, description = 'What the user has entered, published as the input changes.'): PropertyDescriptor {\n return {\n path: valueOutputName,\n label: 'Value',\n group: 'Outputs',\n valueType,\n readOnly: true,\n output: true,\n bindingMode: BindingMode.OneWay,\n description,\n };\n}\n"],"names":["valueOutputProperty","valueType","description","path","valueOutputName","label","group","readOnly","output","bindingMode","BindingMode","OneWay"],"mappings":";;;AAAA;AACA;AAKA;;;;;;AAMC,IACM,SAASA,mBAAAA,CAAoBC,SAA4B,EAAEC,cAAc,4DAA4D,EAAA;IACxI,OAAO;QACHC,IAAAA,EAAMC,eAAAA;QACNC,KAAAA,EAAO,OAAA;QACPC,KAAAA,EAAO,SAAA;AACPL,QAAAA,SAAAA;QACAM,QAAAA,EAAU,IAAA;QACVC,MAAAA,EAAQ,IAAA;AACRC,QAAAA,WAAAA,EAAaC,YAAYC,MAAM;AAC/BT,QAAAA;AACJ,KAAA;AACJ;;"}
|