@cratis/scene.engine 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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,kCAAkC,CAAC;AACjD,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,kCAAkC,CAAC;AACjD,cAAc,WAAW,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { createBindingResolver, resolveBindingExpression } from './resolveBindingExpression.js';
2
2
  export { nestBindingScope } from './nestBindingScope.js';
3
+ export { componentArgumentSourcePrefix, resolveArgumentSource } from './resolveArgumentSource.js';
3
4
  export { removeComponentOutputs } from './removeComponentOutputs.js';
4
5
  export { QueryBindingState } from './QueryBindingState.js';
5
6
  export { validateBindingExpression } from './validateBindingExpression.js';
@@ -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,4 @@
1
+ import { BindingScope } from './BindingScope';
2
+ export declare const componentArgumentSourcePrefix = "component.";
3
+ export declare function resolveArgumentSource(source: string, scope: BindingScope): unknown;
4
+ //# sourceMappingURL=resolveArgumentSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveArgumentSource.d.ts","sourceRoot":"","sources":["../../resolveArgumentSource.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,eAAO,MAAM,6BAA6B,eAAe,CAAC;AAa1D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAWlF"}
@@ -0,0 +1,33 @@
1
+ import { BindingSourceKind } from '@cratis/scene.model';
2
+ import { resolveBindingExpression } from './resolveBindingExpression.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
+ /** The prefix of an argument source that reads another element's output. */ const componentArgumentSourcePrefix = 'component.';
7
+ /**
8
+ * Resolves where a command argument comes from, as an action's argument mapping writes it.
9
+ *
10
+ * `component.<id>.<output>` reads an output another element publishes - an input's `value`, a table's
11
+ * `selectedItem.id` - from the same output scope a `componentProperty` binding reads. Element ids may contain
12
+ * dots, so the longest id with outputs in scope wins: `component.order.lines.value` reads `value` of
13
+ * `order.lines` when that element exists. Any other source is a path in the data context. An empty source,
14
+ * or an element with no outputs in scope, resolves as absent.
15
+ *
16
+ * The C# engine (`ArgumentSources.Resolve`) behaves identically; both run `argument-source-fixtures.json`.
17
+ */ function resolveArgumentSource(source, scope) {
18
+ if (!source) return undefined;
19
+ if (!source.startsWith(componentArgumentSourcePrefix)) return resolveBindingExpression({
20
+ path: source
21
+ }, scope);
22
+ const reference = source.substring(componentArgumentSourcePrefix.length);
23
+ const componentId = Object.keys(scope.componentOutputs ?? {}).filter((id)=>reference === id || reference.startsWith(`${id}.`)).sort((left, right)=>right.length - left.length)[0];
24
+ if (componentId === undefined) return undefined;
25
+ return resolveBindingExpression({
26
+ kind: BindingSourceKind.ComponentProperty,
27
+ componentId,
28
+ path: reference.substring(componentId.length + 1)
29
+ }, scope);
30
+ }
31
+
32
+ export { componentArgumentSourcePrefix, resolveArgumentSource };
33
+ //# sourceMappingURL=resolveArgumentSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveArgumentSource.js","sources":["../../resolveArgumentSource.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 { BindingSourceKind } from '@cratis/scene.model';\nimport { BindingScope } from './BindingScope';\nimport { resolveBindingExpression } from './resolveBindingExpression';\n\n/** The prefix of an argument source that reads another element's output. */\nexport const componentArgumentSourcePrefix = 'component.';\n\n/**\n * Resolves where a command argument comes from, as an action's argument mapping writes it.\n *\n * `component.<id>.<output>` reads an output another element publishes - an input's `value`, a table's\n * `selectedItem.id` - from the same output scope a `componentProperty` binding reads. Element ids may contain\n * dots, so the longest id with outputs in scope wins: `component.order.lines.value` reads `value` of\n * `order.lines` when that element exists. Any other source is a path in the data context. An empty source,\n * or an element with no outputs in scope, resolves as absent.\n *\n * The C# engine (`ArgumentSources.Resolve`) behaves identically; both run `argument-source-fixtures.json`.\n */\nexport function resolveArgumentSource(source: string, scope: BindingScope): unknown {\n if (!source) return undefined;\n if (!source.startsWith(componentArgumentSourcePrefix)) return resolveBindingExpression({ path: source }, scope);\n\n const reference = source.substring(componentArgumentSourcePrefix.length);\n const componentId = Object.keys(scope.componentOutputs ?? {})\n .filter(id => reference === id || reference.startsWith(`${id}.`))\n .sort((left, right) => right.length - left.length)[0];\n if (componentId === undefined) return undefined;\n\n return resolveBindingExpression({ kind: BindingSourceKind.ComponentProperty, componentId, path: reference.substring(componentId.length + 1) }, scope);\n}\n"],"names":["componentArgumentSourcePrefix","resolveArgumentSource","source","scope","undefined","startsWith","resolveBindingExpression","path","reference","substring","length","componentId","Object","keys","componentOutputs","filter","id","sort","left","right","kind","BindingSourceKind","ComponentProperty"],"mappings":";;;AAAA;AACA;AAMA,6EACO,MAAMA,6BAAAA,GAAgC;AAE7C;;;;;;;;;;AAUC,IACM,SAASC,qBAAAA,CAAsBC,MAAc,EAAEC,KAAmB,EAAA;IACrE,IAAI,CAACD,QAAQ,OAAOE,SAAAA;AACpB,IAAA,IAAI,CAACF,MAAAA,CAAOG,UAAU,CAACL,6BAAAA,CAAAA,EAAgC,OAAOM,wBAAAA,CAAyB;QAAEC,IAAAA,EAAML;KAAO,EAAGC,KAAAA,CAAAA;AAEzG,IAAA,MAAMK,SAAAA,GAAYN,MAAAA,CAAOO,SAAS,CAACT,8BAA8BU,MAAM,CAAA;AACvE,IAAA,MAAMC,WAAAA,GAAcC,MAAAA,CAAOC,IAAI,CAACV,MAAMW,gBAAgB,IAAI,EAAC,CAAA,CACtDC,MAAM,CAACC,CAAAA,EAAAA,GAAMR,SAAAA,KAAcQ,MAAMR,SAAAA,CAAUH,UAAU,CAAC,CAAA,EAAGW,GAAG,CAAC,CAAC,CAAA,CAAA,CAC9DC,IAAI,CAAC,CAACC,IAAAA,EAAMC,KAAAA,GAAUA,KAAAA,CAAMT,MAAM,GAAGQ,IAAAA,CAAKR,MAAM,CAAC,CAAC,CAAA,CAAE;IACzD,IAAIC,WAAAA,KAAgBP,WAAW,OAAOA,SAAAA;AAEtC,IAAA,OAAOE,wBAAAA,CAAyB;AAAEc,QAAAA,IAAAA,EAAMC,kBAAkBC,iBAAiB;AAAEX,QAAAA,WAAAA;AAAaJ,QAAAA,IAAAA,EAAMC,SAAAA,CAAUC,SAAS,CAACE,WAAAA,CAAYD,MAAM,GAAG,CAAA;KAAG,EAAGP,KAAAA,CAAAA;AACnJ;;"}