@cratis/scene.engine 3.7.0 → 4.0.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.
Files changed (53) hide show
  1. package/ActionDispatcher.ts +87 -0
  2. package/buildStarterProfile.ts +2 -2
  3. package/dist/cjs/buildStarterProfile.js.map +1 -1
  4. package/dist/cjs/index.js +9 -0
  5. package/dist/cjs/index.js.map +1 -1
  6. package/dist/cjs/resolveBehaviors.js +104 -0
  7. package/dist/cjs/resolveBehaviors.js.map +1 -0
  8. package/dist/cjs/runActions.js +219 -0
  9. package/dist/cjs/runActions.js.map +1 -0
  10. package/dist/esm/ActionDispatcher.d.ts +27 -0
  11. package/dist/esm/ActionDispatcher.d.ts.map +1 -0
  12. package/dist/esm/ActionDispatcher.js +2 -0
  13. package/dist/esm/ActionDispatcher.js.map +1 -0
  14. package/dist/esm/buildStarterProfile.d.ts +2 -2
  15. package/dist/esm/buildStarterProfile.d.ts.map +1 -1
  16. package/dist/esm/buildStarterProfile.js.map +1 -1
  17. package/dist/esm/for_resolveBehaviors/when_resolving_additive_attachments.d.ts +2 -0
  18. package/dist/esm/for_resolveBehaviors/when_resolving_additive_attachments.d.ts.map +1 -0
  19. package/dist/esm/for_resolveBehaviors/when_resolving_additive_attachments.js +68 -0
  20. package/dist/esm/for_resolveBehaviors/when_resolving_additive_attachments.js.map +1 -0
  21. package/dist/esm/for_runActions/given/a_recording_dispatcher.d.ts +21 -0
  22. package/dist/esm/for_runActions/given/a_recording_dispatcher.d.ts.map +1 -0
  23. package/dist/esm/for_runActions/given/a_recording_dispatcher.js +45 -0
  24. package/dist/esm/for_runActions/given/a_recording_dispatcher.js.map +1 -0
  25. package/dist/esm/for_runActions/when_running_a_sequence_of_actions.d.ts +2 -0
  26. package/dist/esm/for_runActions/when_running_a_sequence_of_actions.d.ts.map +1 -0
  27. package/dist/esm/for_runActions/when_running_a_sequence_of_actions.js +126 -0
  28. package/dist/esm/for_runActions/when_running_a_sequence_of_actions.js.map +1 -0
  29. package/dist/esm/for_runActions/when_running_against_the_shared_fixture_corpus.d.ts +2 -0
  30. package/dist/esm/for_runActions/when_running_against_the_shared_fixture_corpus.d.ts.map +1 -0
  31. package/dist/esm/for_runActions/when_running_against_the_shared_fixture_corpus.js +61 -0
  32. package/dist/esm/for_runActions/when_running_against_the_shared_fixture_corpus.js.map +1 -0
  33. package/dist/esm/index.d.ts +3 -0
  34. package/dist/esm/index.d.ts.map +1 -1
  35. package/dist/esm/index.js +2 -0
  36. package/dist/esm/index.js.map +1 -1
  37. package/dist/esm/resolveBehaviors.d.ts +16 -0
  38. package/dist/esm/resolveBehaviors.d.ts.map +1 -0
  39. package/dist/esm/resolveBehaviors.js +99 -0
  40. package/dist/esm/resolveBehaviors.js.map +1 -0
  41. package/dist/esm/runActions.d.ts +26 -0
  42. package/dist/esm/runActions.d.ts.map +1 -0
  43. package/dist/esm/runActions.js +215 -0
  44. package/dist/esm/runActions.js.map +1 -0
  45. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  46. package/for_resolveBehaviors/when_resolving_additive_attachments.ts +100 -0
  47. package/for_runActions/given/a_recording_dispatcher.ts +72 -0
  48. package/for_runActions/when_running_a_sequence_of_actions.ts +226 -0
  49. package/for_runActions/when_running_against_the_shared_fixture_corpus.ts +124 -0
  50. package/index.ts +3 -0
  51. package/package.json +3 -3
  52. package/resolveBehaviors.ts +137 -0
  53. package/runActions.ts +284 -0
@@ -0,0 +1,87 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+
4
+ import { NotificationLevel } from '@cratis/scene.model';
5
+
6
+ /**
7
+ * What came back from executing a command.
8
+ *
9
+ * Validation and authorization failures are outcomes rather than exceptions, because the model already describes
10
+ * them and a form has to show them next to the field they belong to.
11
+ */
12
+ export interface CommandOutcome {
13
+ isSuccess: boolean;
14
+ validationErrors?: { member: string; message: string }[];
15
+ exceptionMessages?: string[];
16
+ response?: unknown;
17
+ }
18
+
19
+ /**
20
+ * What came back from a dialog that closed.
21
+ */
22
+ export interface DialogOutcome {
23
+ isConfirmed: boolean;
24
+ result?: unknown;
25
+ }
26
+
27
+ /**
28
+ * The seam a renderer implements, one method per action kind.
29
+ *
30
+ * The engine decides *what* happens and in what order; the dispatcher performs the effects. That split is what
31
+ * keeps the sequencing - continuations, short-circuits, ordering - testable without a DOM, and what lets a
32
+ * non-React renderer inherit the semantics instead of reimplementing them.
33
+ *
34
+ * Every method that can fail returns an outcome rather than throwing, so a failure is something the engine can
35
+ * branch on with `on failure` instead of something that unwinds the whole interaction.
36
+ */
37
+ export interface ActionDispatcher {
38
+ /**
39
+ * Submits a command.
40
+ */
41
+ executeCommand(command: string, args: Record<string, unknown>): Promise<CommandOutcome>;
42
+
43
+ /**
44
+ * Goes to a screen. The dispatcher decides what address that is, if its platform has addresses at all.
45
+ */
46
+ navigate(screen: string, args: Record<string, unknown>): Promise<void> | void;
47
+
48
+ /**
49
+ * Goes back.
50
+ */
51
+ navigateBack(): Promise<void> | void;
52
+
53
+ /**
54
+ * Opens a dialog and resolves when it closes.
55
+ */
56
+ openDialog(dialogTemplate: string, args: Record<string, unknown>): Promise<DialogOutcome>;
57
+
58
+ /**
59
+ * Closes the innermost dialog.
60
+ */
61
+ closeDialog(result?: unknown): Promise<void> | void;
62
+
63
+ /**
64
+ * Re-runs a query.
65
+ */
66
+ refreshQuery(query: string): Promise<void>;
67
+
68
+ /**
69
+ * Writes screen state.
70
+ */
71
+ setState(target: string, value: unknown): void;
72
+
73
+ /**
74
+ * Surfaces a message.
75
+ */
76
+ notify(level: NotificationLevel, message: string): void;
77
+
78
+ /**
79
+ * Asks the user to confirm, and resolves with what they chose.
80
+ */
81
+ confirm(message: string): Promise<boolean>;
82
+
83
+ /**
84
+ * Fires an application trigger.
85
+ */
86
+ raise(trigger: string, args: Record<string, unknown>): Promise<void>;
87
+ }
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Cratis. All rights reserved.
2
2
  // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
3
 
4
- import { SizeClass, UiProfile, UiStarter } from '@cratis/scene.model';
4
+ import { TargetSizeClass, UiProfile, UiStarter } from '@cratis/scene.model';
5
5
 
6
6
  /**
7
7
  * Builds the sandboxed {@link UiProfile} a {@link UiStarter}'s gallery boots through - part of
@@ -16,6 +16,6 @@ import { SizeClass, UiProfile, UiStarter } from '@cratis/scene.model';
16
16
  * @param defaultSizeClass The size class assumed when the renderer cannot otherwise determine one.
17
17
  * @returns A {@link UiProfile} named after the starter, scoped to exactly its own `packages`.
18
18
  */
19
- export function buildStarterProfile(starter: UiStarter, targetPlatform: string, defaultSizeClass?: SizeClass): UiProfile {
19
+ export function buildStarterProfile(starter: UiStarter, targetPlatform: string, defaultSizeClass?: TargetSizeClass): UiProfile {
20
20
  return { name: starter.name, targetPlatform, packages: starter.packages, defaultSizeClass };
21
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"buildStarterProfile.js","sources":["../../buildStarterProfile.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 { SizeClass, UiProfile, UiStarter } from '@cratis/scene.model';\n\n/**\n * Builds the sandboxed {@link UiProfile} a {@link UiStarter}'s gallery boots through - part of\n * Cratis/Scene#6. Studio runs a starter's gallery screens as a working mini-app rather than a simulated\n * preview, so the gallery needs a real profile scoped to exactly the starter's own package list, not the\n * consuming project's eventual profile. Studio's design-time tooling and Stage's build-time resolution\n * use the C# twin of this function in `Cratis.Scene.Engine`; both sides are asserted against the same\n * shared fixture corpus so they cannot drift apart.\n *\n * @param starter The {@link UiStarter} to build the profile for.\n * @param targetPlatform The platform the gallery runs on (e.g. `web`).\n * @param defaultSizeClass The size class assumed when the renderer cannot otherwise determine one.\n * @returns A {@link UiProfile} named after the starter, scoped to exactly its own `packages`.\n */\nexport function buildStarterProfile(starter: UiStarter, targetPlatform: string, defaultSizeClass?: SizeClass): UiProfile {\n return { name: starter.name, targetPlatform, packages: starter.packages, defaultSizeClass };\n}\n"],"names":["buildStarterProfile","starter","targetPlatform","defaultSizeClass","name","packages"],"mappings":";;AAAA;AACA;AAIA;;;;;;;;;;;;AAYC,IACM,SAASA,mBAAAA,CAAoBC,OAAkB,EAAEC,cAAsB,EAAEC,gBAA4B,EAAA;IACxG,OAAO;AAAEC,QAAAA,IAAAA,EAAMH,QAAQG,IAAI;AAAEF,QAAAA,cAAAA;AAAgBG,QAAAA,QAAAA,EAAUJ,QAAQI,QAAQ;AAAEF,QAAAA;AAAiB,KAAA;AAC9F;;"}
1
+ {"version":3,"file":"buildStarterProfile.js","sources":["../../buildStarterProfile.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 { TargetSizeClass, UiProfile, UiStarter } from '@cratis/scene.model';\n\n/**\n * Builds the sandboxed {@link UiProfile} a {@link UiStarter}'s gallery boots through - part of\n * Cratis/Scene#6. Studio runs a starter's gallery screens as a working mini-app rather than a simulated\n * preview, so the gallery needs a real profile scoped to exactly the starter's own package list, not the\n * consuming project's eventual profile. Studio's design-time tooling and Stage's build-time resolution\n * use the C# twin of this function in `Cratis.Scene.Engine`; both sides are asserted against the same\n * shared fixture corpus so they cannot drift apart.\n *\n * @param starter The {@link UiStarter} to build the profile for.\n * @param targetPlatform The platform the gallery runs on (e.g. `web`).\n * @param defaultSizeClass The size class assumed when the renderer cannot otherwise determine one.\n * @returns A {@link UiProfile} named after the starter, scoped to exactly its own `packages`.\n */\nexport function buildStarterProfile(starter: UiStarter, targetPlatform: string, defaultSizeClass?: TargetSizeClass): UiProfile {\n return { name: starter.name, targetPlatform, packages: starter.packages, defaultSizeClass };\n}\n"],"names":["buildStarterProfile","starter","targetPlatform","defaultSizeClass","name","packages"],"mappings":";;AAAA;AACA;AAIA;;;;;;;;;;;;AAYC,IACM,SAASA,mBAAAA,CAAoBC,OAAkB,EAAEC,cAAsB,EAAEC,gBAAkC,EAAA;IAC9G,OAAO;AAAEC,QAAAA,IAAAA,EAAMH,QAAQG,IAAI;AAAEF,QAAAA,cAAAA;AAAgBG,QAAAA,QAAAA,EAAUJ,QAAQI,QAAQ;AAAEF,QAAAA;AAAiB,KAAA;AAC9F;;"}
package/dist/cjs/index.js CHANGED
@@ -18,6 +18,8 @@ var packageCatalog = require('./packageCatalog.js');
18
18
  var resolveScreenTemplates = require('./resolveScreenTemplates.js');
19
19
  var buildStarterProfile = require('./buildStarterProfile.js');
20
20
  var incompatibleStarterThemes = require('./incompatibleStarterThemes.js');
21
+ var runActions = require('./runActions.js');
22
+ var resolveBehaviors = require('./resolveBehaviors.js');
21
23
 
22
24
 
23
25
 
@@ -62,4 +64,11 @@ exports.isScreenTemplateResolutionValid = resolveScreenTemplates.isScreenTemplat
62
64
  exports.resolveScreenTemplates = resolveScreenTemplates.resolveScreenTemplates;
63
65
  exports.buildStarterProfile = buildStarterProfile.buildStarterProfile;
64
66
  exports.incompatibleStarterThemes = incompatibleStarterThemes.incompatibleStarterThemes;
67
+ exports.InteractionStop = runActions.InteractionStop;
68
+ exports.runActions = runActions.runActions;
69
+ exports.runBindings = runActions.runBindings;
70
+ exports.resolveApplicationTriggerBehaviors = resolveBehaviors.resolveApplicationTriggerBehaviors;
71
+ exports.resolveBehaviors = resolveBehaviors.resolveBehaviors;
72
+ exports.resolveEventBehaviors = resolveBehaviors.resolveEventBehaviors;
73
+ exports.resolveIntervalBehaviors = resolveBehaviors.resolveIntervalBehaviors;
65
74
  //# sourceMappingURL=index.js.map
@@ -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,104 @@
1
+ 'use strict';
2
+
3
+ // Copyright (c) Cratis. All rights reserved.
4
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
5
+ /**
6
+ * Whether the trigger is the built-in kind asked for.
7
+ */ function isKind(trigger, kind) {
8
+ return trigger.kind === kind;
9
+ }
10
+ /**
11
+ * Collects the bindings that respond to a built-in interaction kind, in the order they run.
12
+ *
13
+ * Attachments are **additive**: a behavior on a template and a behavior on an element both run, rather than the
14
+ * more specific one replacing the less specific one. The order is outermost attachment first, declaration order
15
+ * within a level, and any behavior that declares an `order` sorts by it.
16
+ *
17
+ * The additive rule is what lets a module say 'confirm every destructive action' without every screen beneath it
18
+ * having to cooperate - but it also means the order has to be deterministic, or the same document behaves
19
+ * differently between runs. That is why this is a pure function over an ordered list rather than something
20
+ * assembled while rendering.
21
+ *
22
+ * @param attachments The attachment levels, outermost first.
23
+ * @param kind The built-in interaction kind that occurred.
24
+ * @returns The bindings to run, in order.
25
+ */ function resolveBehaviors(attachments, kind) {
26
+ const resolved = [];
27
+ attachments.forEach((attachment, level)=>{
28
+ let declaration = 0;
29
+ for (const behavior of attachment.behaviors ?? []){
30
+ for (const binding of behavior.bindings ?? []){
31
+ if (!isKind(binding.trigger, kind)) continue;
32
+ resolved.push({
33
+ entry: {
34
+ level: attachment.level,
35
+ behaviorName: behavior.name,
36
+ binding
37
+ },
38
+ level: attachment.depth ?? level,
39
+ declaration: declaration++,
40
+ order: behavior.order
41
+ });
42
+ }
43
+ }
44
+ });
45
+ // An explicit order wins over position; everything else keeps the order it was written in. Sorting is
46
+ // stable on (order, level, declaration) so the result never depends on the sort implementation.
47
+ return resolved.sort((left, right)=>{
48
+ if (left.order !== right.order) {
49
+ if (left.order === undefined) return 1;
50
+ if (right.order === undefined) return -1;
51
+ return left.order - right.order;
52
+ }
53
+ return left.level !== right.level ? left.level - right.level : left.declaration - right.declaration;
54
+ }).map((candidate)=>candidate.entry);
55
+ }
56
+ /**
57
+ * Collects the bindings that respond to a named application trigger firing.
58
+ *
59
+ * @param attachments The attachment levels, outermost first.
60
+ * @param triggerName The application trigger that fired.
61
+ * @returns The bindings to run, in order.
62
+ */ function resolveApplicationTriggerBehaviors(attachments, triggerName) {
63
+ return collect(attachments, (trigger)=>trigger.triggerName === triggerName);
64
+ }
65
+ /**
66
+ * Collects the bindings that respond to a modeled domain event being observed.
67
+ *
68
+ * @param attachments The attachment levels, outermost first.
69
+ * @param eventName The event that was observed.
70
+ * @returns The bindings to run, in order.
71
+ */ function resolveEventBehaviors(attachments, eventName) {
72
+ return collect(attachments, (trigger)=>trigger.eventName === eventName);
73
+ }
74
+ /**
75
+ * Collects every interval binding, so a host can schedule them.
76
+ *
77
+ * @param attachments The attachment levels, outermost first.
78
+ * @returns The interval bindings, in order.
79
+ */ function resolveIntervalBehaviors(attachments) {
80
+ return collect(attachments, (trigger)=>typeof trigger.seconds === 'number');
81
+ }
82
+ function collect(attachments, matches) {
83
+ const resolved = [];
84
+ for (const attachment of attachments){
85
+ for (const behavior of attachment.behaviors ?? []){
86
+ for (const binding of behavior.bindings ?? []){
87
+ if (matches(binding.trigger)) {
88
+ resolved.push({
89
+ level: attachment.level,
90
+ behaviorName: behavior.name,
91
+ binding
92
+ });
93
+ }
94
+ }
95
+ }
96
+ }
97
+ return resolved;
98
+ }
99
+
100
+ exports.resolveApplicationTriggerBehaviors = resolveApplicationTriggerBehaviors;
101
+ exports.resolveBehaviors = resolveBehaviors;
102
+ exports.resolveEventBehaviors = resolveEventBehaviors;
103
+ exports.resolveIntervalBehaviors = resolveIntervalBehaviors;
104
+ //# sourceMappingURL=resolveBehaviors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveBehaviors.js","sources":["../../resolveBehaviors.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 { Behavior, InteractionBinding, InteractionTrigger, InteractionTriggerKind } from '@cratis/scene.model';\n\n/**\n * One level of the containment tree a behavior can be attached to, outermost first.\n *\n * Named rather than positional so a finding can say *where* a behavior came from - 'the module's behavior ran\n * before the element's' is only a useful thing to report if the level has a name.\n */\nexport interface BehaviorAttachment {\n level: string;\n behaviors: Behavior[];\n\n /**\n * How deeply nested this attachment is, with 0 the outermost.\n *\n * Optional, defaulting to the position in the list. Stating it explicitly is what lets a caller assemble the\n * list in whatever order is convenient - walking a tree upwards from the element, for instance - without the\n * resolved order silently depending on that choice.\n */\n depth?: number;\n}\n\n/**\n * One binding to run, with the attachment it came from.\n */\nexport interface ResolvedBinding {\n level: string;\n behaviorName?: string;\n binding: InteractionBinding;\n}\n\n/**\n * Whether the trigger is the built-in kind asked for.\n */\nfunction isKind(trigger: InteractionTrigger, kind: InteractionTriggerKind): boolean {\n return (trigger as { kind?: InteractionTriggerKind }).kind === kind;\n}\n\n/**\n * Collects the bindings that respond to a built-in interaction kind, in the order they run.\n *\n * Attachments are **additive**: a behavior on a template and a behavior on an element both run, rather than the\n * more specific one replacing the less specific one. The order is outermost attachment first, declaration order\n * within a level, and any behavior that declares an `order` sorts by it.\n *\n * The additive rule is what lets a module say 'confirm every destructive action' without every screen beneath it\n * having to cooperate - but it also means the order has to be deterministic, or the same document behaves\n * differently between runs. That is why this is a pure function over an ordered list rather than something\n * assembled while rendering.\n *\n * @param attachments The attachment levels, outermost first.\n * @param kind The built-in interaction kind that occurred.\n * @returns The bindings to run, in order.\n */\nexport function resolveBehaviors(attachments: BehaviorAttachment[], kind: InteractionTriggerKind): ResolvedBinding[] {\n const resolved: { entry: ResolvedBinding; level: number; declaration: number; order?: number }[] = [];\n\n attachments.forEach((attachment, level) => {\n let declaration = 0;\n for (const behavior of (attachment.behaviors ?? [])) {\n for (const binding of (behavior.bindings ?? [])) {\n if (!isKind(binding.trigger, kind)) continue;\n\n resolved.push({\n entry: { level: attachment.level, behaviorName: behavior.name, binding },\n level: attachment.depth ?? level,\n declaration: declaration++,\n order: behavior.order,\n });\n }\n }\n });\n\n // An explicit order wins over position; everything else keeps the order it was written in. Sorting is\n // stable on (order, level, declaration) so the result never depends on the sort implementation.\n return resolved\n .sort((left, right) => {\n if (left.order !== right.order) {\n if (left.order === undefined) return 1;\n if (right.order === undefined) return -1;\n return left.order - right.order;\n }\n\n return left.level !== right.level ? left.level - right.level : left.declaration - right.declaration;\n })\n .map(candidate => candidate.entry);\n}\n\n/**\n * Collects the bindings that respond to a named application trigger firing.\n *\n * @param attachments The attachment levels, outermost first.\n * @param triggerName The application trigger that fired.\n * @returns The bindings to run, in order.\n */\nexport function resolveApplicationTriggerBehaviors(attachments: BehaviorAttachment[], triggerName: string): ResolvedBinding[] {\n return collect(attachments, trigger => (trigger as { triggerName?: string }).triggerName === triggerName);\n}\n\n/**\n * Collects the bindings that respond to a modeled domain event being observed.\n *\n * @param attachments The attachment levels, outermost first.\n * @param eventName The event that was observed.\n * @returns The bindings to run, in order.\n */\nexport function resolveEventBehaviors(attachments: BehaviorAttachment[], eventName: string): ResolvedBinding[] {\n return collect(attachments, trigger => (trigger as { eventName?: string }).eventName === eventName);\n}\n\n/**\n * Collects every interval binding, so a host can schedule them.\n *\n * @param attachments The attachment levels, outermost first.\n * @returns The interval bindings, in order.\n */\nexport function resolveIntervalBehaviors(attachments: BehaviorAttachment[]): ResolvedBinding[] {\n return collect(attachments, trigger => typeof (trigger as { seconds?: number }).seconds === 'number');\n}\n\nfunction collect(attachments: BehaviorAttachment[], matches: (trigger: InteractionTrigger) => boolean): ResolvedBinding[] {\n const resolved: ResolvedBinding[] = [];\n for (const attachment of attachments) {\n for (const behavior of (attachment.behaviors ?? [])) {\n for (const binding of (behavior.bindings ?? [])) {\n if (matches(binding.trigger)) {\n resolved.push({ level: attachment.level, behaviorName: behavior.name, binding });\n }\n }\n }\n }\n\n return resolved;\n}\n"],"names":["isKind","trigger","kind","resolveBehaviors","attachments","resolved","forEach","attachment","level","declaration","behavior","behaviors","binding","bindings","push","entry","behaviorName","name","depth","order","sort","left","right","undefined","map","candidate","resolveApplicationTriggerBehaviors","triggerName","collect","resolveEventBehaviors","eventName","resolveIntervalBehaviors","seconds","matches"],"mappings":";;AAAA;AACA;AAiCA;;AAEC,IACD,SAASA,MAAAA,CAAOC,OAA2B,EAAEC,IAA4B,EAAA;IACrE,OAAQD,OAAAA,CAA8CC,IAAI,KAAKA,IAAAA;AACnE;AAEA;;;;;;;;;;;;;;;AAeC,IACM,SAASC,gBAAAA,CAAiBC,WAAiC,EAAEF,IAA4B,EAAA;AAC5F,IAAA,MAAMG,WAA6F,EAAE;IAErGD,WAAAA,CAAYE,OAAO,CAAC,CAACC,UAAAA,EAAYC,KAAAA,GAAAA;AAC7B,QAAA,IAAIC,WAAAA,GAAc,CAAA;AAClB,QAAA,KAAK,MAAMC,QAAAA,IAAaH,UAAAA,CAAWI,SAAS,IAAI,EAAE,CAAG;AACjD,YAAA,KAAK,MAAMC,OAAAA,IAAYF,QAAAA,CAASG,QAAQ,IAAI,EAAE,CAAG;AAC7C,gBAAA,IAAI,CAACb,MAAAA,CAAOY,OAAAA,CAAQX,OAAO,EAAEC,IAAAA,CAAAA,EAAO;AAEpCG,gBAAAA,QAAAA,CAASS,IAAI,CAAC;oBACVC,KAAAA,EAAO;AAAEP,wBAAAA,KAAAA,EAAOD,WAAWC,KAAK;AAAEQ,wBAAAA,YAAAA,EAAcN,SAASO,IAAI;AAAEL,wBAAAA;AAAQ,qBAAA;oBACvEJ,KAAAA,EAAOD,UAAAA,CAAWW,KAAK,IAAIV,KAAAA;oBAC3BC,WAAAA,EAAaA,WAAAA,EAAAA;AACbU,oBAAAA,KAAAA,EAAOT,SAASS;AACpB,iBAAA,CAAA;AACJ,YAAA;AACJ,QAAA;AACJ,IAAA,CAAA,CAAA;;;AAIA,IAAA,OAAOd,QAAAA,CACFe,IAAI,CAAC,CAACC,IAAAA,EAAMC,KAAAA,GAAAA;AACT,QAAA,IAAID,IAAAA,CAAKF,KAAK,KAAKG,KAAAA,CAAMH,KAAK,EAAE;A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MC,OAAAA,IAAYF,QAAAA,CAASG,QAAQ,IAAI,EAAE,CAAG;gBAC7C,IAAIoB,OAAAA,CAAQrB,OAAAA,CAAQX,OAAO,CAAA,EAAG;AAC1BI,oBAAAA,QAAAA,CAASS,IAAI,CAAC;AAAEN,wBAAAA,KAAAA,EAAOD,WAAWC,KAAK;AAAEQ,wBAAAA,YAAAA,EAAcN,SAASO,IAAI;AAAEL,wBAAAA;AAAQ,qBAAA,CAAA;AAClF,gBAAA;AACJ,YAAA;AACJ,QAAA;AACJ,IAAA;IAEA,OAAOP,QAAAA;AACX;;;;;"}
@@ -0,0 +1,219 @@
1
+ 'use strict';
2
+
3
+ var scene_model = require('@cratis/scene.model');
4
+
5
+ // Copyright (c) Cratis. All rights reserved.
6
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
7
+ /**
8
+ * Why an interaction stopped before running everything it was given.
9
+ */ var InteractionStop = /*#__PURE__*/ function(InteractionStop) {
10
+ /** Everything ran. */ InteractionStop["Completed"] = "Completed";
11
+ /** A `confirm` was declined, so the actions it gates did not run. */ InteractionStop["Declined"] = "Declined";
12
+ /** A navigation happened, so anything after it belonged to a screen that is gone. */ InteractionStop["Navigated"] = "Navigated";
13
+ /** An action could not be realized and was reported. */ InteractionStop["Reported"] = "Reported";
14
+ return InteractionStop;
15
+ }({});
16
+ function describe(action) {
17
+ switch(action.kind){
18
+ case scene_model.InteractionActionKind.ExecuteCommand:
19
+ return `execute ${action.command}`;
20
+ case scene_model.InteractionActionKind.Navigate:
21
+ return `navigate to ${action.screen}`;
22
+ case scene_model.InteractionActionKind.NavigateBack:
23
+ return 'navigate back';
24
+ case scene_model.InteractionActionKind.OpenDialog:
25
+ return `open dialog ${action.dialogTemplate}`;
26
+ case scene_model.InteractionActionKind.CloseDialog:
27
+ return 'close dialog';
28
+ case scene_model.InteractionActionKind.RefreshQuery:
29
+ return `refresh ${action.query}`;
30
+ case scene_model.InteractionActionKind.SetState:
31
+ return `set ${action.target}`;
32
+ case scene_model.InteractionActionKind.Notify:
33
+ return 'notify';
34
+ case scene_model.InteractionActionKind.Confirm:
35
+ return 'confirm';
36
+ case scene_model.InteractionActionKind.RaiseTrigger:
37
+ return `raise ${action.trigger}`;
38
+ default:
39
+ return String(action.kind);
40
+ }
41
+ }
42
+ function argumentsOf(action, context) {
43
+ const args = {};
44
+ for (const argument of action.arguments ?? []){
45
+ args[argument.name] = context.resolve(argument.value);
46
+ }
47
+ return args;
48
+ }
49
+ function messageOf(message, context, findings) {
50
+ if (message.text !== undefined) return message.text;
51
+ if (message.stringsKey !== undefined) return context.localize ? context.localize(message.stringsKey) : message.stringsKey;
52
+ if (message.binding !== undefined) {
53
+ const resolved = context.resolve(message.binding);
54
+ if (resolved === undefined || resolved === null) {
55
+ findings.push({
56
+ kind: 'unresolvedMessage',
57
+ detail: `The message binding '${message.binding.path}' resolved to nothing`
58
+ });
59
+ return '';
60
+ }
61
+ return String(resolved);
62
+ }
63
+ findings.push({
64
+ kind: 'unresolvedMessage',
65
+ detail: 'The action carries no message'
66
+ });
67
+ return '';
68
+ }
69
+ /**
70
+ * Runs a sequence of actions, in order, handling continuations.
71
+ *
72
+ * The rules, all of which live here rather than in a renderer so they can be asserted without a DOM:
73
+ *
74
+ * - Actions run in the order they were declared.
75
+ * - A declined `confirm` stops the sequence. Gating what follows is the whole point of it.
76
+ * - A navigation stops the sequence, because the screen the remaining actions were written for is gone. The
77
+ * compiler reports that as unreachable, so reaching it at runtime means the document changed underneath.
78
+ * - An action that can fail branches into `onSuccess` or `onFailure`; a dialog also runs `onResult`.
79
+ * - An action kind the engine does not know is **reported and the sequence abandoned**, never silently skipped.
80
+ * Continuing would half-apply a sequence whose gate may well have been the action this renderer could not
81
+ * understand. This is what lets a newer document be opened by an older renderer without pretending it worked.
82
+ *
83
+ * @param actions The actions to run.
84
+ * @param dispatcher The seam that performs the effects.
85
+ * @param context How to resolve bindings and localization.
86
+ * @returns What happened.
87
+ */ async function runActions(actions, dispatcher, context) {
88
+ const run = {
89
+ stop: "Completed",
90
+ findings: [],
91
+ ran: []
92
+ };
93
+ await runSequence(actions, dispatcher, context, run);
94
+ return run;
95
+ }
96
+ async function runSequence(actions, dispatcher, context, run) {
97
+ for (const action of actions){
98
+ if (await runOne(action, dispatcher, context, run)) return;
99
+ }
100
+ }
101
+ async function runOne(action, dispatcher, context, run) {
102
+ const args = argumentsOf(action, context);
103
+ switch(action.kind){
104
+ case scene_model.InteractionActionKind.ExecuteCommand:
105
+ {
106
+ run.ran.push(describe(action));
107
+ const outcome = await dispatcher.executeCommand(action.command, args);
108
+ await runSequence(outcome.isSuccess ? action.onSuccess ?? [] : action.onFailure ?? [], dispatcher, context, run);
109
+ return false;
110
+ }
111
+ case scene_model.InteractionActionKind.Navigate:
112
+ run.ran.push(describe(action));
113
+ await dispatcher.navigate(action.screen, args);
114
+ run.stop = "Navigated";
115
+ return true;
116
+ case scene_model.InteractionActionKind.NavigateBack:
117
+ run.ran.push(describe(action));
118
+ await dispatcher.navigateBack();
119
+ run.stop = "Navigated";
120
+ return true;
121
+ case scene_model.InteractionActionKind.OpenDialog:
122
+ {
123
+ run.ran.push(describe(action));
124
+ const outcome = await dispatcher.openDialog(action.dialogTemplate, args);
125
+ await runSequence(outcome.isConfirmed ? action.onSuccess ?? [] : action.onFailure ?? [], dispatcher, context, run);
126
+ await runSequence(action.onResult ?? [], dispatcher, context, run);
127
+ return false;
128
+ }
129
+ case scene_model.InteractionActionKind.CloseDialog:
130
+ run.ran.push(describe(action));
131
+ await dispatcher.closeDialog();
132
+ return false;
133
+ case scene_model.InteractionActionKind.RefreshQuery:
134
+ {
135
+ run.ran.push(describe(action));
136
+ await dispatcher.refreshQuery(action.query);
137
+ await runSequence(action.onSuccess ?? [], dispatcher, context, run);
138
+ return false;
139
+ }
140
+ case scene_model.InteractionActionKind.SetState:
141
+ run.ran.push(describe(action));
142
+ dispatcher.setState(action.target, context.resolve(action.value));
143
+ return false;
144
+ case scene_model.InteractionActionKind.Notify:
145
+ run.ran.push(describe(action));
146
+ dispatcher.notify(action.level, messageOf(action.message, context, run.findings));
147
+ return false;
148
+ case scene_model.InteractionActionKind.Confirm:
149
+ {
150
+ run.ran.push(describe(action));
151
+ const confirmed = await dispatcher.confirm(messageOf(action.message, context, run.findings));
152
+ if (!confirmed) {
153
+ await runSequence(action.onFailure ?? [], dispatcher, context, run);
154
+ run.stop = "Declined";
155
+ return true;
156
+ }
157
+ await runSequence(action.onSuccess ?? [], dispatcher, context, run);
158
+ return false;
159
+ }
160
+ case scene_model.InteractionActionKind.RaiseTrigger:
161
+ {
162
+ run.ran.push(describe(action));
163
+ await dispatcher.raise(action.trigger, args);
164
+ await runSequence(action.onSuccess ?? [], dispatcher, context, run);
165
+ return false;
166
+ }
167
+ default:
168
+ run.findings.push({
169
+ kind: 'unknownAction',
170
+ detail: `The renderer does not know the action kind '${String(action.kind)}'`
171
+ });
172
+ run.stop = "Reported";
173
+ return true;
174
+ }
175
+ }
176
+ /**
177
+ * Runs the bindings a trigger resolved to, in order, honouring each one's guard.
178
+ *
179
+ * The `where` guard belongs here rather than in a renderer for the same reason the sequencing does: whether a
180
+ * binding applies is a property of the document, not of the event that arrived. A guard that resolves to
181
+ * nothing is treated as false and reported - an interaction that silently does nothing is indistinguishable
182
+ * from one that is broken, and the whole point of a finding is to tell those apart.
183
+ *
184
+ * @param bindings The bindings to run, already resolved and ordered.
185
+ * @param dispatcher The seam that performs the effects.
186
+ * @param context How to resolve bindings and localization.
187
+ * @returns What happened across all of them.
188
+ */ async function runBindings(bindings, dispatcher, context) {
189
+ const run = {
190
+ stop: "Completed",
191
+ findings: [],
192
+ ran: []
193
+ };
194
+ for (const candidate of bindings){
195
+ if (!applies(candidate.binding, context, run)) continue;
196
+ await runSequence(candidate.binding.actions ?? [], dispatcher, context, run);
197
+ // A navigation or a declined confirm ends the interaction, not merely the binding that caused it.
198
+ // The screen the later bindings were attached to is gone, or the gate they sat behind was refused.
199
+ if (run.stop !== "Completed") break;
200
+ }
201
+ return run;
202
+ }
203
+ function applies(binding, context, run) {
204
+ if (!binding.condition) return true;
205
+ const value = context.resolve(binding.condition);
206
+ if (value === undefined || value === null) {
207
+ run.findings.push({
208
+ kind: 'unresolvedCondition',
209
+ detail: `The guard '${binding.condition.path}' resolved to nothing, so the binding did not run`
210
+ });
211
+ return false;
212
+ }
213
+ return Boolean(value);
214
+ }
215
+
216
+ exports.InteractionStop = InteractionStop;
217
+ exports.runActions = runActions;
218
+ exports.runBindings = runBindings;
219
+ //# sourceMappingURL=runActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runActions.js","sources":["../../runActions.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 { InteractionBinding } from '@cratis/scene.model';\nimport { ResolvedBinding } from './resolveBehaviors';\nimport {\n ConfirmAction,\n ExecuteCommandAction,\n InteractionAction,\n InteractionActionKind,\n InteractionArgument,\n InteractionMessage,\n NavigateAction,\n NotifyAction,\n OpenDialogAction,\n RaiseTriggerAction,\n RefreshQueryAction,\n SetStateAction,\n} from '@cratis/scene.model';\n\nimport { ActionDispatcher } from './ActionDispatcher';\nimport { BindingResolver } from './BindingResolver';\n\n/**\n * Why an interaction stopped before running everything it was given.\n */\nexport enum InteractionStop {\n /** Everything ran. */\n Completed = 'Completed',\n\n /** A `confirm` was declined, so the actions it gates did not run. */\n Declined = 'Declined',\n\n /** A navigation happened, so anything after it belonged to a screen that is gone. */\n Navigated = 'Navigated',\n\n /** An action could not be realized and was reported. */\n Reported = 'Reported',\n}\n\n/**\n * Something an interaction could not do.\n *\n * Findings are collected rather than thrown: one unresolvable action must not take down the rest of the\n * application, and 'this application produced no findings' has to be checkable rather than a matter of opinion.\n */\nexport interface InteractionFinding {\n kind: 'unknownAction' | 'unresolvedMessage' | 'unresolvedCondition';\n detail: string;\n}\n\n/**\n * What an interaction did.\n */\nexport interface InteractionRun {\n stop: InteractionStop;\n findings: InteractionFinding[];\n /** The actions that actually ran, in order - the thing a spec asserts on. */\n ran: string[];\n}\n\n/**\n * How to resolve the values an action needs.\n */\nexport interface InteractionContext {\n resolve: BindingResolver;\n /** Looks up a localization key. Returns the key itself when the host has no catalogue for it. */\n localize?: (key: string) => string;\n}\n\nfunction describe(action: InteractionAction): string {\n switch (action.kind) {\n case InteractionActionKind.ExecuteCommand: return `execute ${(action as ExecuteCommandAction).command}`;\n case InteractionActionKind.Navigate: return `navigate to ${(action as NavigateAction).screen}`;\n case InteractionActionKind.NavigateBack: return 'navigate back';\n case InteractionActionKind.OpenDialog: return `open dialog ${(action as OpenDialogAction).dialogTemplate}`;\n case InteractionActionKind.CloseDialog: return 'close dialog';\n case InteractionActionKind.RefreshQuery: return `refresh ${(action as RefreshQueryAction).query}`;\n case InteractionActionKind.SetState: return `set ${(action as SetStateAction).target}`;\n case InteractionActionKind.Notify: return 'notify';\n case InteractionActionKind.Confirm: return 'confirm';\n case InteractionActionKind.RaiseTrigger: return `raise ${(action as RaiseTriggerAction).trigger}`;\n default: return String(action.kind);\n }\n}\n\nfunction argumentsOf(action: InteractionAction, context: InteractionContext): Record<string, unknown> {\n const args: Record<string, unknown> = {};\n for (const argument of (action.arguments ?? []) as InteractionArgument[]) {\n args[argument.name] = context.resolve(argument.value);\n }\n\n return args;\n}\n\nfunction messageOf(message: InteractionMessage, context: InteractionContext, findings: InteractionFinding[]): string {\n if (message.text !== undefined) return message.text;\n if (message.stringsKey !== undefined) return context.localize ? context.localize(message.stringsKey) : message.stringsKey;\n if (message.binding !== undefined) {\n const resolved = context.resolve(message.binding);\n if (resolved === undefined || resolved === null) {\n findings.push({ kind: 'unresolvedMessage', detail: `The message binding '${message.binding.path}' resolved to nothing` });\n return '';\n }\n\n return String(resolved);\n }\n\n findings.push({ kind: 'unresolvedMessage', detail: 'The action carries no message' });\n return '';\n}\n\n/**\n * Runs a sequence of actions, in order, handling continuations.\n *\n * The rules, all of which live here rather than in a renderer so they can be asserted without a DOM:\n *\n * - Actions run in the order they were declared.\n * - A declined `confirm` stops the sequence. Gating what follows is the whole point of it.\n * - A navigation stops the sequence, because the screen the remaining actions were written for is gone. The\n * compiler reports that as unreachable, so reaching it at runtime means the document changed underneath.\n * - An action that can fail branches into `onSuccess` or `onFailure`; a dialog also runs `onResult`.\n * - An action kind the engine does not know is **reported and the sequence abandoned**, never silently skipped.\n * Continuing would half-apply a sequence whose gate may well have been the action this renderer could not\n * understand. This is what lets a newer document be opened by an older renderer without pretending it worked.\n *\n * @param actions The actions to run.\n * @param dispatcher The seam that performs the effects.\n * @param context How to resolve bindings and localization.\n * @returns What happened.\n */\nexport async function runActions(\n actions: InteractionAction[],\n dispatcher: ActionDispatcher,\n context: InteractionContext\n): Promise<InteractionRun> {\n const run: InteractionRun = { stop: InteractionStop.Completed, findings: [], ran: [] };\n await runSequence(actions, dispatcher, context, run);\n return run;\n}\n\nasync function runSequence(\n actions: InteractionAction[],\n dispatcher: ActionDispatcher,\n context: InteractionContext,\n run: InteractionRun\n): Promise<void> {\n for (const action of actions) {\n if (await runOne(action, dispatcher, context, run)) return;\n }\n}\n\nasync function runOne(\n action: InteractionAction,\n dispatcher: ActionDispatcher,\n context: InteractionContext,\n run: InteractionRun\n): Promise<boolean> {\n const args = argumentsOf(action, context);\n\n switch (action.kind) {\n case InteractionActionKind.ExecuteCommand: {\n run.ran.push(describe(action));\n const outcome = await dispatcher.executeCommand((action as ExecuteCommandAction).command, args);\n await runSequence(outcome.isSuccess ? (action.onSuccess ?? []) : (action.onFailure ?? []), dispatcher, context, run);\n return false;\n }\n\n case InteractionActionKind.Navigate:\n run.ran.push(describe(action));\n await dispatcher.navigate((action as NavigateAction).screen, args);\n run.stop = InteractionStop.Navigated;\n return true;\n\n case InteractionActionKind.NavigateBack:\n run.ran.push(describe(action));\n await dispatcher.navigateBack();\n run.stop = InteractionStop.Navigated;\n return true;\n\n case InteractionActionKind.OpenDialog: {\n run.ran.push(describe(action));\n const outcome = await dispatcher.openDialog((action as OpenDialogAction).dialogTemplate, args);\n await runSequence(outcome.isConfirmed ? (action.onSuccess ?? []) : (action.onFailure ?? []), dispatcher, context, run);\n await runSequence((action.onResult ?? []), dispatcher, context, run);\n return false;\n }\n\n case InteractionActionKind.CloseDialog:\n run.ran.push(describe(action));\n await dispatcher.closeDialog();\n return false;\n\n case InteractionActionKind.RefreshQuery: {\n run.ran.push(describe(action));\n await dispatcher.refreshQuery((action as RefreshQueryAction).query);\n await runSequence((action.onSuccess ?? []), dispatcher, context, run);\n return false;\n }\n\n case InteractionActionKind.SetState:\n run.ran.push(describe(action));\n dispatcher.setState((action as SetStateAction).target, context.resolve((action as SetStateAction).value));\n return false;\n\n case InteractionActionKind.Notify:\n run.ran.push(describe(action));\n dispatcher.notify((action as NotifyAction).level, messageOf((action as NotifyAction).message, context, run.findings));\n return false;\n\n case InteractionActionKind.Confirm: {\n run.ran.push(describe(action));\n const confirmed = await dispatcher.confirm(messageOf((action as ConfirmAction).message, context, run.findings));\n if (!confirmed) {\n await runSequence((action.onFailure ?? []), dispatcher, context, run);\n run.stop = InteractionStop.Declined;\n return true;\n }\n\n await runSequence((action.onSuccess ?? []), dispatcher, context, run);\n return false;\n }\n\n case InteractionActionKind.RaiseTrigger: {\n run.ran.push(describe(action));\n await dispatcher.raise((action as RaiseTriggerAction).trigger, args);\n await runSequence((action.onSuccess ?? []), dispatcher, context, run);\n return false;\n }\n\n default:\n run.findings.push({ kind: 'unknownAction', detail: `The renderer does not know the action kind '${String(action.kind)}'` });\n run.stop = InteractionStop.Reported;\n return true;\n }\n}\n\n/**\n * Runs the bindings a trigger resolved to, in order, honouring each one's guard.\n *\n * The `where` guard belongs here rather than in a renderer for the same reason the sequencing does: whether a\n * binding applies is a property of the document, not of the event that arrived. A guard that resolves to\n * nothing is treated as false and reported - an interaction that silently does nothing is indistinguishable\n * from one that is broken, and the whole point of a finding is to tell those apart.\n *\n * @param bindings The bindings to run, already resolved and ordered.\n * @param dispatcher The seam that performs the effects.\n * @param context How to resolve bindings and localization.\n * @returns What happened across all of them.\n */\nexport async function runBindings(\n bindings: ResolvedBinding[],\n dispatcher: ActionDispatcher,\n context: InteractionContext\n): Promise<InteractionRun> {\n const run: InteractionRun = { stop: InteractionStop.Completed, findings: [], ran: [] };\n\n for (const candidate of bindings) {\n if (!applies(candidate.binding, context, run)) continue;\n\n await runSequence(candidate.binding.actions ?? [], dispatcher, context, run);\n\n // A navigation or a declined confirm ends the interaction, not merely the binding that caused it.\n // The screen the later bindings were attached to is gone, or the gate they sat behind was refused.\n if (run.stop !== InteractionStop.Completed) break;\n }\n\n return run;\n}\n\nfunction applies(binding: InteractionBinding, context: InteractionContext, run: InteractionRun): boolean {\n if (!binding.condition) return true;\n\n const value = context.resolve(binding.condition);\n if (value === undefined || value === null) {\n run.findings.push({\n kind: 'unresolvedCondition',\n detail: `The guard '${binding.condition.path}' resolved to nothing, so the binding did not run`,\n });\n return false;\n }\n\n return Boolean(value);\n}\n"],"names":["InteractionStop","describe","action","kind","InteractionActionKind","ExecuteCommand","command","Navigate","screen","NavigateBack","OpenDialog","dialogTemplate","CloseDialog","RefreshQuery","query","SetState","target","Notify","Confirm","RaiseTrigger","trigger","String","argumentsOf","context","args","argument","arguments","name","resolve","value","messageOf","message","findings","text","undefined","stringsKey","localize","binding","resolved","push","detail","path","runActions","actions","dispatcher","run","stop","ran","runSequence","runOne","outcome","executeCommand","isSuccess","onSuccess","onFailure","navigate","navigateBack","openDialog","isConfirmed","onResult","closeDialog","refreshQuery","setState","notify","level","confirmed","confirm","raise","runBindings","bindings","candidate","applies","condition","Boolean"],"mappings":";;;;AAAA;AACA;AAsBA;;IAGO,IAAKA,eAAAA,iBAAAA,SAAAA,eAAAA,EAAAA;2BACY,eAAA,CAAA,WAAA,CAAA,GAAA,WAAA;0EAG+C,eAAA,CAAA,UAAA,CAAA,GAAA,UAAA;0FAGgB,eAAA,CAAA,WAAA,CAAA,GAAA,WAAA;6DAG7B,eAAA,CAAA,UAAA,CAAA,GAAA,UAAA;AAV9CA,IAAAA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jC,OAAO,CAACM,OAAO,IAAI,EAAE,EAAEC,UAAAA,EAAYrB,OAAAA,EAASsB,GAAAA,CAAAA;;;QAIxE,IAAIA,GAAAA,CAAIC,IAAI,KAAA,WAAA,EAAgC;AAChD,IAAA;IAEA,OAAOD,GAAAA;AACX;AAEA,SAAS0B,OAAAA,CAAQlC,OAA2B,EAAEd,OAA2B,EAAEsB,GAAmB,EAAA;AAC1F,IAAA,IAAI,CAACR,OAAAA,CAAQmC,SAAS,EAAE,OAAO,IAAA;AAE/B,IAAA,MAAM3C,KAAAA,GAAQN,OAAAA,CAAQK,OAAO,CAACS,QAAQmC,SAAS,CAAA;IAC/C,IAAI3C,KAAAA,KAAUK,SAAAA,IAAaL,KAAAA,KAAU,IAAA,EAAM;QACvCgB,GAAAA,CAAIb,QAAQ,CAACO,IAAI,CAAC;YACdpC,IAAAA,EAAM,qBAAA;YACNqC,MAAAA,EAAQ,CAAC,WAAW,EAAEH,OAAAA,CAAQmC,SAAS,CAAC/B,IAAI,CAAC,iDAAiD;AAClG,SAAA,CAAA;QACA,OAAO,KAAA;AACX,IAAA;AAEA,IAAA,OAAOgC,OAAAA,CAAQ5C,KAAAA,CAAAA;AACnB;;;;"}
@@ -0,0 +1,27 @@
1
+ import { NotificationLevel } from '@cratis/scene.model';
2
+ export interface CommandOutcome {
3
+ isSuccess: boolean;
4
+ validationErrors?: {
5
+ member: string;
6
+ message: string;
7
+ }[];
8
+ exceptionMessages?: string[];
9
+ response?: unknown;
10
+ }
11
+ export interface DialogOutcome {
12
+ isConfirmed: boolean;
13
+ result?: unknown;
14
+ }
15
+ export interface ActionDispatcher {
16
+ executeCommand(command: string, args: Record<string, unknown>): Promise<CommandOutcome>;
17
+ navigate(screen: string, args: Record<string, unknown>): Promise<void> | void;
18
+ navigateBack(): Promise<void> | void;
19
+ openDialog(dialogTemplate: string, args: Record<string, unknown>): Promise<DialogOutcome>;
20
+ closeDialog(result?: unknown): Promise<void> | void;
21
+ refreshQuery(query: string): Promise<void>;
22
+ setState(target: string, value: unknown): void;
23
+ notify(level: NotificationLevel, message: string): void;
24
+ confirm(message: string): Promise<boolean>;
25
+ raise(trigger: string, args: Record<string, unknown>): Promise<void>;
26
+ }
27
+ //# sourceMappingURL=ActionDispatcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionDispatcher.d.ts","sourceRoot":"","sources":["../../ActionDispatcher.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAQxD,MAAM,WAAW,cAAc;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzD,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAKD,MAAM,WAAW,aAAa;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAYD,MAAM,WAAW,gBAAgB;IAI7B,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAKxF,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAK9E,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAKrC,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAK1F,WAAW,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAKpD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAK3C,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAK/C,MAAM,CAAC,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAKxD,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAK3C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ActionDispatcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionDispatcher.js","sourceRoot":"","sources":["../../ActionDispatcher.ts"],"names":[],"mappings":""}
@@ -1,3 +1,3 @@
1
- import { SizeClass, UiProfile, UiStarter } from '@cratis/scene.model';
2
- export declare function buildStarterProfile(starter: UiStarter, targetPlatform: string, defaultSizeClass?: SizeClass): UiProfile;
1
+ import { TargetSizeClass, UiProfile, UiStarter } from '@cratis/scene.model';
2
+ export declare function buildStarterProfile(starter: UiStarter, targetPlatform: string, defaultSizeClass?: TargetSizeClass): UiProfile;
3
3
  //# sourceMappingURL=buildStarterProfile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildStarterProfile.d.ts","sourceRoot":"","sources":["../../buildStarterProfile.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAetE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,SAAS,GAAG,SAAS,CAEvH"}
1
+ {"version":3,"file":"buildStarterProfile.d.ts","sourceRoot":"","sources":["../../buildStarterProfile.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAe5E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,eAAe,GAAG,SAAS,CAE7H"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildStarterProfile.js","sources":["../../buildStarterProfile.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 { SizeClass, UiProfile, UiStarter } from '@cratis/scene.model';\n\n/**\n * Builds the sandboxed {@link UiProfile} a {@link UiStarter}'s gallery boots through - part of\n * Cratis/Scene#6. Studio runs a starter's gallery screens as a working mini-app rather than a simulated\n * preview, so the gallery needs a real profile scoped to exactly the starter's own package list, not the\n * consuming project's eventual profile. Studio's design-time tooling and Stage's build-time resolution\n * use the C# twin of this function in `Cratis.Scene.Engine`; both sides are asserted against the same\n * shared fixture corpus so they cannot drift apart.\n *\n * @param starter The {@link UiStarter} to build the profile for.\n * @param targetPlatform The platform the gallery runs on (e.g. `web`).\n * @param defaultSizeClass The size class assumed when the renderer cannot otherwise determine one.\n * @returns A {@link UiProfile} named after the starter, scoped to exactly its own `packages`.\n */\nexport function buildStarterProfile(starter: UiStarter, targetPlatform: string, defaultSizeClass?: SizeClass): UiProfile {\n return { name: starter.name, targetPlatform, packages: starter.packages, defaultSizeClass };\n}\n"],"names":["buildStarterProfile","starter","targetPlatform","defaultSizeClass","name","packages"],"mappings":"AAAA;AACA;AAIA;;;;;;;;;;;;AAYC,IACM,SAASA,mBAAAA,CAAoBC,OAAkB,EAAEC,cAAsB,EAAEC,gBAA4B,EAAA;IACxG,OAAO;AAAEC,QAAAA,IAAAA,EAAMH,QAAQG,IAAI;AAAEF,QAAAA,cAAAA;AAAgBG,QAAAA,QAAAA,EAAUJ,QAAQI,QAAQ;AAAEF,QAAAA;AAAiB,KAAA;AAC9F;;"}
1
+ {"version":3,"file":"buildStarterProfile.js","sources":["../../buildStarterProfile.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 { TargetSizeClass, UiProfile, UiStarter } from '@cratis/scene.model';\n\n/**\n * Builds the sandboxed {@link UiProfile} a {@link UiStarter}'s gallery boots through - part of\n * Cratis/Scene#6. Studio runs a starter's gallery screens as a working mini-app rather than a simulated\n * preview, so the gallery needs a real profile scoped to exactly the starter's own package list, not the\n * consuming project's eventual profile. Studio's design-time tooling and Stage's build-time resolution\n * use the C# twin of this function in `Cratis.Scene.Engine`; both sides are asserted against the same\n * shared fixture corpus so they cannot drift apart.\n *\n * @param starter The {@link UiStarter} to build the profile for.\n * @param targetPlatform The platform the gallery runs on (e.g. `web`).\n * @param defaultSizeClass The size class assumed when the renderer cannot otherwise determine one.\n * @returns A {@link UiProfile} named after the starter, scoped to exactly its own `packages`.\n */\nexport function buildStarterProfile(starter: UiStarter, targetPlatform: string, defaultSizeClass?: TargetSizeClass): UiProfile {\n return { name: starter.name, targetPlatform, packages: starter.packages, defaultSizeClass };\n}\n"],"names":["buildStarterProfile","starter","targetPlatform","defaultSizeClass","name","packages"],"mappings":"AAAA;AACA;AAIA;;;;;;;;;;;;AAYC,IACM,SAASA,mBAAAA,CAAoBC,OAAkB,EAAEC,cAAsB,EAAEC,gBAAkC,EAAA;IAC9G,OAAO;AAAEC,QAAAA,IAAAA,EAAMH,QAAQG,IAAI;AAAEF,QAAAA,cAAAA;AAAgBG,QAAAA,QAAAA,EAAUJ,QAAQI,QAAQ;AAAEF,QAAAA;AAAiB,KAAA;AAC9F;;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=when_resolving_additive_attachments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"when_resolving_additive_attachments.d.ts","sourceRoot":"","sources":["../../../for_resolveBehaviors/when_resolving_additive_attachments.ts"],"names":[],"mappings":""}