@cratis/scene.react 3.2.0 → 3.3.1

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 (59) hide show
  1. package/core/ScreenplayCoreComponents.tsx +72 -0
  2. package/core/coreComponents.ts +24 -0
  3. package/core/corePackage.ts +16 -1
  4. package/core/index.ts +1 -0
  5. package/dist/cjs/NavBar/NavBar.js.map +1 -1
  6. package/dist/cjs/NavBar/extractNavigationItem.js.map +1 -1
  7. package/dist/cjs/SceneElementView.js.map +1 -1
  8. package/dist/cjs/core/CoreButton.js.map +1 -1
  9. package/dist/cjs/core/CoreCard.js.map +1 -1
  10. package/dist/cjs/core/CoreText.js.map +1 -1
  11. package/dist/cjs/core/ScreenplayCoreComponents.js +128 -0
  12. package/dist/cjs/core/ScreenplayCoreComponents.js.map +1 -0
  13. package/dist/cjs/core/coreComponents.js +13 -1
  14. package/dist/cjs/core/coreComponents.js.map +1 -1
  15. package/dist/cjs/core/corePackage.js +12 -1
  16. package/dist/cjs/core/corePackage.js.map +1 -1
  17. package/dist/cjs/index.js +12 -0
  18. package/dist/cjs/index.js.map +1 -1
  19. package/dist/cjs/packages/ScenePackageBundle.js.map +1 -1
  20. package/dist/cjs/renderer/UnresolvedComponent.js.map +1 -1
  21. package/dist/cjs/renderer/createReactRenderer.js.map +1 -1
  22. package/dist/cjs/renderer/panelLayout.js.map +1 -1
  23. package/dist/cjs/theme/SceneThemeProvider.js.map +1 -1
  24. package/dist/cjs/theme/themeTokens.js.map +1 -1
  25. package/dist/esm/NavBar/NavBar.js.map +1 -1
  26. package/dist/esm/NavBar/extractNavigationItem.js.map +1 -1
  27. package/dist/esm/SceneElementView.js.map +1 -1
  28. package/dist/esm/core/CoreButton.js.map +1 -1
  29. package/dist/esm/core/CoreCard.js.map +1 -1
  30. package/dist/esm/core/CoreText.js.map +1 -1
  31. package/dist/esm/core/ScreenplayCoreComponents.d.ts +13 -0
  32. package/dist/esm/core/ScreenplayCoreComponents.d.ts.map +1 -0
  33. package/dist/esm/core/ScreenplayCoreComponents.js +116 -0
  34. package/dist/esm/core/ScreenplayCoreComponents.js.map +1 -0
  35. package/dist/esm/core/coreComponents.d.ts.map +1 -1
  36. package/dist/esm/core/coreComponents.js +13 -1
  37. package/dist/esm/core/coreComponents.js.map +1 -1
  38. package/dist/esm/core/corePackage.d.ts.map +1 -1
  39. package/dist/esm/core/corePackage.js +12 -1
  40. package/dist/esm/core/corePackage.js.map +1 -1
  41. package/dist/esm/core/index.d.ts +1 -0
  42. package/dist/esm/core/index.d.ts.map +1 -1
  43. package/dist/esm/core/index.js +1 -0
  44. package/dist/esm/core/index.js.map +1 -1
  45. package/dist/esm/for_ScreenplayCoreComponents/when_rendering_a_translated_screen.d.ts +2 -0
  46. package/dist/esm/for_ScreenplayCoreComponents/when_rendering_a_translated_screen.d.ts.map +1 -0
  47. package/dist/esm/for_ScreenplayCoreComponents/when_rendering_a_translated_screen.js +46 -0
  48. package/dist/esm/for_ScreenplayCoreComponents/when_rendering_a_translated_screen.js.map +1 -0
  49. package/dist/esm/index.js +1 -0
  50. package/dist/esm/index.js.map +1 -1
  51. package/dist/esm/packages/ScenePackageBundle.js.map +1 -1
  52. package/dist/esm/renderer/UnresolvedComponent.js.map +1 -1
  53. package/dist/esm/renderer/createReactRenderer.js.map +1 -1
  54. package/dist/esm/renderer/panelLayout.js.map +1 -1
  55. package/dist/esm/theme/SceneThemeProvider.js.map +1 -1
  56. package/dist/esm/theme/themeTokens.js.map +1 -1
  57. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  58. package/for_ScreenplayCoreComponents/when_rendering_a_translated_screen.tsx +60 -0
  59. package/package.json +11 -11
@@ -0,0 +1,72 @@
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 { RegisteredComponentProps } from '../renderer';
5
+
6
+ function textProperty(properties: Record<string, unknown>, name: string, fallback = ''): string {
7
+ return typeof properties[name] === 'string' ? properties[name] : fallback;
8
+ }
9
+
10
+ /** Carries a Screenplay data declaration without adding visual chrome. */
11
+ export function CoreData({ element }: RegisteredComponentProps) {
12
+ return <span hidden data-scene-id={element.id} data-scene-data={textProperty(element.properties, 'typeName')} />;
13
+ }
14
+
15
+ /** Renders a modeled command action and emits a host-neutral command event when invoked. */
16
+ export function CoreAction({ element }: RegisteredComponentProps) {
17
+ const command = textProperty(element.properties, 'command');
18
+ const label = textProperty(element.properties, 'label', command);
19
+ const invoke = () => globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', { detail: { command, element } }));
20
+ return <button type='button' data-scene-id={element.id} onClick={invoke}>{label}</button>;
21
+ }
22
+
23
+ /** Groups the nested content of a Screenplay section. */
24
+ export function CoreSection({ element, slots }: RegisteredComponentProps) {
25
+ const name = textProperty(element.properties, 'name');
26
+ return <section data-scene-id={element.id}>{name && <h2>{name}</h2>}{slots.content}</section>;
27
+ }
28
+
29
+ /** Renders navigation intent and emits a host-neutral navigation event. */
30
+ export function CoreNavigate({ element }: RegisteredComponentProps) {
31
+ const targetScreen = textProperty(element.properties, 'targetScreen');
32
+ const navigate = () => globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', { detail: { targetScreen, element } }));
33
+ return <button type='button' data-scene-id={element.id} onClick={navigate}>{targetScreen}</button>;
34
+ }
35
+
36
+ /** Renders a Screenplay title directive. */
37
+ export function CoreTitle({ element }: RegisteredComponentProps) {
38
+ return <h1 data-scene-id={element.id}>{textProperty(element.properties, 'text')}</h1>;
39
+ }
40
+
41
+ /** Renders the structural shell of a Screenplay table. Query data is supplied by the host. */
42
+ export function CoreTable({ element, slots }: RegisteredComponentProps) {
43
+ return <section data-scene-id={element.id} role='table'><header role='row'>{slots.columns}</header></section>;
44
+ }
45
+
46
+ /** Renders a Screenplay table-column heading. */
47
+ export function CoreColumn({ element }: RegisteredComponentProps) {
48
+ const property = textProperty(element.properties, 'property');
49
+ return <span data-scene-id={element.id} role='columnheader'>{textProperty(element.properties, 'label', property)}</span>;
50
+ }
51
+
52
+ /** Renders the structural shell of a Screenplay summary. Query data is supplied by the host. */
53
+ export function CoreSummary({ element, slots }: RegisteredComponentProps) {
54
+ return <dl data-scene-id={element.id}>{slots.fields}</dl>;
55
+ }
56
+
57
+ /** Renders a Screenplay summary field label. */
58
+ export function CoreField({ element }: RegisteredComponentProps) {
59
+ const property = textProperty(element.properties, 'property');
60
+ return <dt data-scene-id={element.id}>{textProperty(element.properties, 'label', property)}</dt>;
61
+ }
62
+
63
+ /** Renders a Screenplay code block. */
64
+ export function CoreCode({ element }: RegisteredComponentProps) {
65
+ const language = textProperty(element.properties, 'language');
66
+ return <pre data-scene-id={element.id}><code data-language={language}>{textProperty(element.properties, 'code')}</code></pre>;
67
+ }
68
+
69
+ /** Makes an external screen-file reference visible until a host supplies that file. */
70
+ export function CoreFile({ element }: RegisteredComponentProps) {
71
+ return <p data-scene-id={element.id}>Screen source: {textProperty(element.properties, 'path')}</p>;
72
+ }
@@ -6,6 +6,19 @@ import { componentRegistryKey } from '../packages';
6
6
  import { CoreText } from './CoreText';
7
7
  import { CoreButton } from './CoreButton';
8
8
  import { CoreCard } from './CoreCard';
9
+ import {
10
+ CoreAction,
11
+ CoreCode,
12
+ CoreColumn,
13
+ CoreData,
14
+ CoreField,
15
+ CoreFile,
16
+ CoreNavigate,
17
+ CoreSection,
18
+ CoreSummary,
19
+ CoreTable,
20
+ CoreTitle,
21
+ } from './ScreenplayCoreComponents';
9
22
 
10
23
  /**
11
24
  * The `core` package's component registry - the final fallback every `ui profile` resolves against
@@ -15,4 +28,15 @@ export const coreComponents: ComponentRegistry = {
15
28
  [componentRegistryKey('core', 'text')]: CoreText,
16
29
  [componentRegistryKey('core', 'button')]: CoreButton,
17
30
  [componentRegistryKey('core', 'card')]: CoreCard,
31
+ [componentRegistryKey('core', 'data')]: CoreData,
32
+ [componentRegistryKey('core', 'action')]: CoreAction,
33
+ [componentRegistryKey('core', 'section')]: CoreSection,
34
+ [componentRegistryKey('core', 'navigate')]: CoreNavigate,
35
+ [componentRegistryKey('core', 'title')]: CoreTitle,
36
+ [componentRegistryKey('core', 'table')]: CoreTable,
37
+ [componentRegistryKey('core', 'column')]: CoreColumn,
38
+ [componentRegistryKey('core', 'summary')]: CoreSummary,
39
+ [componentRegistryKey('core', 'field')]: CoreField,
40
+ [componentRegistryKey('core', 'code')]: CoreCode,
41
+ [componentRegistryKey('core', 'file')]: CoreFile,
18
42
  };
@@ -17,7 +17,22 @@ export const corePackageManifest: ScenePackage = {
17
17
  version: '1.0.0',
18
18
  kind: PackageKind.ComponentLibrary,
19
19
  dependencies: [],
20
- components: ['text', 'button', 'card'],
20
+ components: [
21
+ 'text',
22
+ 'button',
23
+ 'card',
24
+ 'data',
25
+ 'action',
26
+ 'section',
27
+ 'navigate',
28
+ 'title',
29
+ 'table',
30
+ 'column',
31
+ 'summary',
32
+ 'field',
33
+ 'code',
34
+ 'file',
35
+ ],
21
36
  layouts: [],
22
37
  screenTemplates: [],
23
38
  dialogTemplates: [],
package/core/index.ts CHANGED
@@ -4,5 +4,6 @@
4
4
  export * from './CoreText';
5
5
  export * from './CoreButton';
6
6
  export * from './CoreCard';
7
+ export * from './ScreenplayCoreComponents';
7
8
  export * from './coreComponents';
8
9
  export * from './corePackage';
@@ -1 +1 @@
1
- {"version":3,"file":"NavBar.js","sources":["../../../NavBar/NavBar.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 { Contribution, NavigationItem } from '@cratis/scene.model';\nimport { aggregateContributions } from '@cratis/scene.engine';\nimport { extractNavigationItem } from './extractNavigationItem';\n\nexport interface NavBarProps {\n /** Every contribution in scope - `NavBar` aggregates the ones targeting `Navigation` itself. */\n contributions: Contribution[];\n\n /**\n * Turns a {@link NavigationItem}'s target screen and route parameters into a concrete route - a URL\n * path, a query string, or a native deep link. Owning this as a caller-supplied function, rather than\n * a fixed URL scheme, is what makes `NavBar` usable unmodified across renderers (Cratis/Scene#2).\n */\n renderRoute: (item: NavigationItem) => string;\n}\n\n/**\n * Renders the aggregated `Navigation` contributions from across the current element tree - part of\n * Cratis/Scene#2. `NavBar` is not wired to a fixed source: pass it whatever contributions are currently\n * in scope and it recomputes, the same way any contribution-point consumer does.\n */\nexport function NavBar({ contributions, renderRoute }: NavBarProps) {\n const items = aggregateContributions(contributions, 'Navigation')\n .map(extractNavigationItem)\n .filter((item): item is NavigationItem => item !== undefined);\n\n const hasGroups = items.some(item => item.group !== undefined);\n if (!hasGroups) {\n return (\n <nav data-scene-navbar=\"\">\n {items.map(item => <NavBarItem key={item.targetScreen} item={item} href={renderRoute(item)} />)}\n </nav>\n );\n }\n\n const groupNames = [...new Set(items.map(item => item.group ?? ''))];\n return (\n <nav data-scene-navbar=\"\">\n {groupNames.map(groupName => (\n <section key={groupName} data-scene-navbar-group={groupName}>\n {items.filter(item => (item.group ?? '') === groupName).map(item => <NavBarItem key={item.targetScreen} item={item} href={renderRoute(item)} />)}\n </section>\n ))}\n </nav>\n );\n}\n\nfunction NavBarItem({ item, href }: { item: NavigationItem; href: string }) {\n return <a href={href}>{item.label}</a>;\n}\n"],"names":["NavBar","contributions","renderRoute","items","aggregateContributions","map","extractNavigationItem","filter","item","undefined","hasGroups","some","group","_jsx","nav","data-scene-navbar","NavBarItem","href","targetScreen","groupNames","Set","groupName","section","data-scene-navbar-group","a","label"],"mappings":";;;;;;AAAA;AACA;AAkBA;;;;AAIC,IACM,SAASA,MAAAA,CAAO,EAAEC,aAAa,EAAEC,WAAW,EAAe,EAAA;IAC9D,MAAMC,KAAAA,GAAQC,mCAAAA,CAAuBH,aAAAA,EAAe,YAAA,CAAA,CAC/CI,GAAG,CAACC,2CAAAA,CAAAA,CACJC,MAAM,CAAC,CAACC,IAAAA,GAAiCA,IAAAA,KAASC,SAAAA,CAAAA;IAEvD,MAAMC,SAAAA,GAAYP,MAAMQ,IAAI,CAACH,CAAAA,IAAAA,GAAQA,IAAAA,CAA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,CAACW,GAAAA,EAAAA;QAAEP,IAAAA,EAAMA,IAAAA;AAAOT,QAAAA,QAAAA,EAAAA,IAAAA,CAAKiB;;AAChC;;;;"}
1
+ {"version":3,"file":"NavBar.js","sources":["../../../NavBar/NavBar.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 { Contribution, NavigationItem } from '@cratis/scene.model';\nimport { aggregateContributions } from '@cratis/scene.engine';\nimport { extractNavigationItem } from './extractNavigationItem';\n\nexport interface NavBarProps {\n /** Every contribution in scope - `NavBar` aggregates the ones targeting `Navigation` itself. */\n contributions: Contribution[];\n\n /**\n * Turns a {@link NavigationItem}'s target screen and route parameters into a concrete route - a URL\n * path, a query string, or a native deep link. Owning this as a caller-supplied function, rather than\n * a fixed URL scheme, is what makes `NavBar` usable unmodified across renderers (Cratis/Scene#2).\n */\n renderRoute: (item: NavigationItem) => string;\n}\n\n/**\n * Renders the aggregated `Navigation` contributions from across the current element tree - part of\n * Cratis/Scene#2. `NavBar` is not wired to a fixed source: pass it whatever contributions are currently\n * in scope and it recomputes, the same way any contribution-point consumer does.\n */\nexport function NavBar({ contributions, renderRoute }: NavBarProps) {\n const items = aggregateContributions(contributions, 'Navigation')\n .map(extractNavigationItem)\n .filter((item): item is NavigationItem => item !== undefined);\n\n const hasGroups = items.some(item => item.group !== undefined);\n if (!hasGroups) {\n return (\n <nav data-scene-navbar=\"\">\n {items.map(item => <NavBarItem key={item.targetScreen} item={item} href={renderRoute(item)} />)}\n </nav>\n );\n }\n\n const groupNames = [...new Set(items.map(item => item.group ?? ''))];\n return (\n <nav data-scene-navbar=\"\">\n {groupNames.map(groupName => (\n <section key={groupName} data-scene-navbar-group={groupName}>\n {items.filter(item => (item.group ?? '') === groupName).map(item => <NavBarItem key={item.targetScreen} item={item} href={renderRoute(item)} />)}\n </section>\n ))}\n </nav>\n );\n}\n\nfunction NavBarItem({ item, href }: { item: NavigationItem; href: string }) {\n return <a href={href}>{item.label}</a>;\n}\n"],"names":["NavBar","contributions","renderRoute","items","aggregateContributions","map","extractNavigationItem","filter","item","undefined","hasGroups","some","group","_jsx","nav","data-scene-navbar","NavBarItem","href","targetScreen","groupNames","Set","groupName","section","data-scene-navbar-group","a","label"],"mappings":";;;;;;AAAA;AACA;AAkBA;;;;AAIC,IACM,SAASA,MAAAA,CAAO,EAAEC,aAAa,EAAEC,WAAW,EAAe,EAAA;IAC9D,MAAMC,KAAAA,GAAQC,mCAAAA,CAAuBH,aAAAA,EAAe,YAAA,CAAA,CAC/CI,GAAG,CAACC,2CAAAA,CAAAA,CACJC,MAAM,CAAC,CAACC,IAAAA,GAAiCA,IAAAA,KAASC,SAAAA,CAAAA;IAEvD,MAAMC,SAAAA,GAAYP,MAAMQ,IAAI,CAACH,CAAAA,IAAAA,GAAQA,IAAAA,CAAKI,KAAK,KAAKH,SAAAA,CAAAA;AACpD,IAAA,IAAI,CAACC,SAAAA,EAAW;AACZ,QAAA,qBACIG,cAAA,CAACC,KAAAA,EAAAA;YAAIC,mBAAAA,EAAkB,EAAA;AAClBZ,YAAAA,QAAAA,EAAAA,KAAAA,CAAME,GAAG,CAACG,CAAAA,IAAAA,iBAAQK,cAAA,CAACG,UAAAA,EAAAA;oBAAmCR,IAAAA,EAAMA,IAAAA;AAAMS,oBAAAA,IAAAA,EAAMf,WAAAA,CAAYM,IAAAA;AAAjDA,iBAAAA,EAAAA,IAAAA,CAAKU,YAAY,CAAA;;AAGjE,IAAA;AAEA,IAAA,MAAMC,UAAAA,GAAa;WAAI,IAAIC,GAAAA,CAAIjB,MAAME,GAAG,CAACG,CAAAA,IAAAA,GAAQA,IAAAA,CAAKI,KAAK,IAAI,EAAA,CAAA;AAAK,KAAA;AACpE,IAAA,qBACIC,cAAA,CAACC,KAAAA,EAAAA;QAAIC,mBAAAA,EAAkB,EAAA;AAClBI,QAAAA,QAAAA,EAAAA,UAAAA,CAAWd,GAAG,CAACgB,CAAAA,SAAAA,iBACZR,cAAA,CAACS,SAAAA,EAAAA;gBAAwBC,yBAAAA,EAAyBF,SAAAA;AAC7ClB,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMI,MAAM,CAACC,CAAAA,IAAAA,GAASA,CAAAA,IAAAA,CAAKI,KAAK,IAAI,EAAC,MAAOS,SAAAA,CAAAA,CAAWhB,GAAG,CAACG,CAAAA,qBAAQK,cAAA,CAACG,UAAAA,EAAAA;wBAAmCR,IAAAA,EAAMA,IAAAA;AAAMS,wBAAAA,IAAAA,EAAMf,WAAAA,CAAYM,IAAAA;AAAjDA,qBAAAA,EAAAA,IAAAA,CAAKU,YAAY,CAAA;AAD5FG,aAAAA,EAAAA,SAAAA,CAAAA;;AAM9B;AAEA,SAASL,UAAAA,CAAW,EAAER,IAAI,EAAES,IAAI,EAA0C,EAAA;AACtE,IAAA,qBAAOJ,cAAA,CAACW,GAAAA,EAAAA;QAAEP,IAAAA,EAAMA,IAAAA;AAAOT,QAAAA,QAAAA,EAAAA,IAAAA,CAAKiB;;AAChC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"extractNavigationItem.js","sources":["../../../NavBar/extractNavigationItem.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 { BindingExpression, Contribution, ExternalComponent, NavigationItem } from '@cratis/scene.model';\n\n/**\n * Reads a {@link NavigationItem} out of a {@link Contribution} to the built-in `Navigation` contribution\n * point. `Contribution.content` carries an {@link ExternalComponent} whose open `properties` bag holds the\n * navigation-specific values (`label`, `targetScreen`, `routeParameterBindings`, `order`, `group`) - the\n * same names as {@link NavigationItem}'s own fields. This property-bag contract is Scene#2's own choice,\n * made without a real Screenplay-to-Scene translation to confirm it against (Stage#37 hasn't been built\n * yet) - whoever builds that seam should either produce contributions matching this contract or this\n * function should move to match whatever Stage#37 actually emits.\n *\n * @param contribution The contribution to read.\n * @returns The extracted {@link NavigationItem}, or `undefined` when `contribution.content` isn't an {@link ExternalComponent} or is missing a required property.\n */\nexport function extractNavigationItem(contribution: Contribution): NavigationItem | undefined {\n const content = contribution.content as Partial<ExternalComponent>;\n if (!content.properties) {\n return undefined;\n }\n\n const { label, targetScreen, routeParameterBindings, order, group } = content.properties as Record<string, unknown>;\n if (typeof label !== 'string' || typeof targetScreen !== 'string') {\n return undefined;\n }\n\n return {\n label,\n targetScreen,\n routeParameterBindings: isBindingExpressionRecord(routeParameterBindings) ? routeParameterBindings : {},\n order: typeof order === 'number' ? order : contribution.order,\n group: typeof group === 'string' ? group : undefined,\n };\n}\n\nfunction isBindingExpressionRecord(value: unknown): value is Record<string, BindingExpression> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n"],"names":["extractNavigationItem","contribution","content","properties","undefined","label","targetScreen","routeParameterBindings","order","group","isBindingExpressionRecord","value","Array","isArray"],"mappings":";;AAAA;AACA;AAIA;;;;;;;;;;;IAYO,SAASA,qBAAAA,CAAsBC,YAA0B,EAAA;IAC5D,MAAMC,OAAAA,GAAUD,aAAaC,OAAO;IACpC,IAAI,CAACA,OAAAA,CAAQC,UAAU,EAAE;QACrB,OAAOC,SAAAA;AACX,IAAA;AAEA,IAAA,MAAM,EAAEC,KAAK,EAAEC,YAAY,EAAEC,sBAAsB,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGP,QAAQC,UAAU;AACxF,IAAA,IAAI,OAAOE,KAAAA,KAAU,QAAA,IAAY,OAAOC,iBAAiB,QAAA,EAAU;QAC/D,OAAOF,SAAAA;AACX,IAAA;IAEA,OAAO;AACHC,QAAAA,KAAAA;AACAC,QAAAA,YAAAA;QACAC,sBAAAA,EAAwBG,yBAAAA,CAA0BH,sBAAAA,CAAAA,GAA0BA,sBAAAA,GAAyB,EAAC;AACtGC,QAAAA,KAAAA,EAAO,OAAOA,KAAAA,KAAU,QAAA,GAAWA,KAAAA,GAAQP,aAAaO,KAAK;QAC7DC,KAAAA,EAAO,OAAOA,KAAAA,KAAU,QAAA,GAAWA,KAAAA,GAAQL;AAC/C,KAAA;AACJ;AAEA,SAASM,0BAA0BC,KAAc,EAAA;IAC7C,OAAO,OAAOA,UAAU,QAAA,IAAYA,KAAAA,KAAU,QAAQ,CAACC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA;AACzE;;;;"}
1
+ {"version":3,"file":"extractNavigationItem.js","sources":["../../../NavBar/extractNavigationItem.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 { BindingExpression, Contribution, ExternalComponent, NavigationItem } from '@cratis/scene.model';\n\n/**\n * Reads a {@link NavigationItem} out of a {@link Contribution} to the built-in `Navigation` contribution\n * point. `Contribution.content` carries an {@link ExternalComponent} whose open `properties` bag holds the\n * navigation-specific values (`label`, `targetScreen`, `routeParameterBindings`, `order`, `group`) - the\n * same names as {@link NavigationItem}'s own fields. This property-bag contract is Scene#2's own choice,\n * made without a real Screenplay-to-Scene translation to confirm it against (Stage#37 hasn't been built\n * yet) - whoever builds that seam should either produce contributions matching this contract or this\n * function should move to match whatever Stage#37 actually emits.\n *\n * @param contribution The contribution to read.\n * @returns The extracted {@link NavigationItem}, or `undefined` when `contribution.content` isn't an {@link ExternalComponent} or is missing a required property.\n */\nexport function extractNavigationItem(contribution: Contribution): NavigationItem | undefined {\n const content = contribution.content as Partial<ExternalComponent>;\n if (!content.properties) {\n return undefined;\n }\n\n const { label, targetScreen, routeParameterBindings, order, group } = content.properties as Record<string, unknown>;\n if (typeof label !== 'string' || typeof targetScreen !== 'string') {\n return undefined;\n }\n\n return {\n label,\n targetScreen,\n routeParameterBindings: isBindingExpressionRecord(routeParameterBindings) ? routeParameterBindings : {},\n order: typeof order === 'number' ? order : contribution.order,\n group: typeof group === 'string' ? group : undefined,\n };\n}\n\nfunction isBindingExpressionRecord(value: unknown): value is Record<string, BindingExpression> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n"],"names":["extractNavigationItem","contribution","content","properties","undefined","label","targetScreen","routeParameterBindings","order","group","isBindingExpressionRecord","value","Array","isArray"],"mappings":";;AAAA;AACA;AAIA;;;;;;;;;;;IAYO,SAASA,qBAAAA,CAAsBC,YAA0B,EAAA;IAC5D,MAAMC,OAAAA,GAAUD,aAAaC,OAAO;IACpC,IAAI,CAACA,OAAAA,CAAQC,UAAU,EAAE;QACrB,OAAOC,SAAAA;AACX,IAAA;AAEA,IAAA,MAAM,EAAEC,KAAK,EAAEC,YAAY,EAAEC,sBAAsB,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGP,QAAQC,UAAU;AACxF,IAAA,IAAI,OAAOE,KAAAA,KAAU,QAAA,IAAY,OAAOC,iBAAiB,QAAA,EAAU;QAC/D,OAAOF,SAAAA;AACX,IAAA;IAEA,OAAO;AACHC,QAAAA,KAAAA;AACAC,QAAAA,YAAAA;QACAC,sBAAAA,EAAwBG,yBAAAA,CAA0BH,sBAAAA,CAAAA,GAA0BA,sBAAAA,GAAyB,EAAC;AACtGC,QAAAA,KAAAA,EAAO,OAAOA,KAAAA,KAAU,QAAA,GAAWA,KAAAA,GAAQP,aAAaO,KAAK;QAC7DC,KAAAA,EAAO,OAAOA,KAAAA,KAAU,QAAA,GAAWA,KAAAA,GAAQL;AAC/C,KAAA;AACJ;AAEA,SAASM,0BAA0BC,KAAc,EAAA;IAC7C,OAAO,OAAOA,UAAU,QAAA,IAAYA,KAAAA,KAAU,QAAQ,CAACC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA;AACzE;;"}
@@ -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 { renderElement, BindingResolver } from '@cratis/scene.engine';\nimport { SceneElement } from '@cratis/scene.model';\nimport { ComponentRegistry, createReactRenderer } from './renderer';\n\nexport interface SceneElementViewProps {\n element: SceneElement;\n registry: ComponentRegistry;\n resolveBinding: BindingResolver;\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({ element, registry, resolveBinding }: SceneElementViewProps) {\n const renderer = useMemo(() => createReactRenderer(registry), [registry]);\n return <>{renderElement(element, renderer, resolveBinding)}</>;\n}\n"],"names":["SceneElementView","element","registry","resolveBinding","renderer","useMemo","createReactRenderer","_jsx","_Fragment","renderElement"],"mappings":";;;;;;;AAcA;;;IAIO,SAASA,gBAAAA,CAAiB,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,cAAc,EAAyB,EAAA;AACzF,IAAA,MAAMC,QAAAA,GAAWC,aAAAA,CAAQ,IAAMC,uCAAAA,CAAoBJ,QAAAA,CAAAA,EAAW;AAACA,QAAAA;AAAS,KAAA,CAAA;IACxE,qBAAOK,cAAA,CAAAC,mBAAA,EAAA;AAAGC,QAAAA,QAAAA,EAAAA,0BAAAA,CAAcR,SAASG,QAAAA,EAAUD,cAAAA;;AAC/C;;;;"}
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 { renderElement, BindingResolver } from '@cratis/scene.engine';\nimport { SceneElement } from '@cratis/scene.model';\nimport { ComponentRegistry, createReactRenderer } from './renderer';\n\nexport interface SceneElementViewProps {\n element: SceneElement;\n registry: ComponentRegistry;\n resolveBinding: BindingResolver;\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({ element, registry, resolveBinding }: SceneElementViewProps) {\n const renderer = useMemo(() => createReactRenderer(registry), [registry]);\n return <>{renderElement(element, renderer, resolveBinding)}</>;\n}\n"],"names":["SceneElementView","element","registry","resolveBinding","renderer","useMemo","createReactRenderer","_jsx","_Fragment","renderElement"],"mappings":";;;;;;;AAcA;;;IAIO,SAASA,gBAAAA,CAAiB,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,cAAc,EAAyB,EAAA;AACzF,IAAA,MAAMC,QAAAA,GAAWC,aAAAA,CAAQ,IAAMC,uCAAAA,CAAoBJ,QAAAA,CAAAA,EAAW;AAACA,QAAAA;AAAS,KAAA,CAAA;IACxE,qBAAOK,cAAA,CAAAC,mBAAA,EAAA;AAAGC,QAAAA,QAAAA,EAAAA,0BAAAA,CAAcR,SAASG,QAAAA,EAAUD,cAAAA;;AAC/C;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CoreButton.js","sources":["../../../core/CoreButton.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 { RegisteredComponentProps } from '../renderer';\n\n/**\n * The `core:button` component - part of the minimum vocabulary a `ui profile` can always fall back to.\n */\nexport function CoreButton({ element, slots }: RegisteredComponentProps) {\n const label = typeof element.properties.label === 'string' ? element.properties.label : '';\n return (\n <button type=\"button\" data-scene-id={element.id}>\n {label}\n {slots.content}\n </button>\n );\n}\n"],"names":["CoreButton","element","slots","label","properties","_jsxs","button","type","data-scene-id","id","content"],"mappings":";;;;AAAA;AACA;AAIA;;AAEC,IACM,SAASA,UAAAA,CAAW,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;AACnE,IAAA,MAAMC,KAAAA,GAAQ,OAAOF,OAAAA,CAAQG,UAAU,CAACD,KAAK,KAAK,QAAA,GAAWF,OAAAA,CAAQG,UAAU,CAACD,KAAK,GAAG,EAAA;AACxF,IAAA,qBACIE,eAAA,CAACC,QAAAA,EAAAA;QAAOC,IAAAA,EAAK,QAAA;AAASC,QAAAA,eAAAA,EAAeP,QAAQQ,EAAE;;AAC1CN,YAAAA,KAAAA;AACAD,YAAAA,KAAAA,CAAMQ;;;AAGnB;;;;"}
1
+ {"version":3,"file":"CoreButton.js","sources":["../../../core/CoreButton.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 { RegisteredComponentProps } from '../renderer';\n\n/**\n * The `core:button` component - part of the minimum vocabulary a `ui profile` can always fall back to.\n */\nexport function CoreButton({ element, slots }: RegisteredComponentProps) {\n const label = typeof element.properties.label === 'string' ? element.properties.label : '';\n return (\n <button type=\"button\" data-scene-id={element.id}>\n {label}\n {slots.content}\n </button>\n );\n}\n"],"names":["CoreButton","element","slots","label","properties","_jsxs","button","type","data-scene-id","id","content"],"mappings":";;;;AAAA;AACA;AAIA;;AAEC,IACM,SAASA,UAAAA,CAAW,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;AACnE,IAAA,MAAMC,KAAAA,GAAQ,OAAOF,OAAAA,CAAQG,UAAU,CAACD,KAAK,KAAK,QAAA,GAAWF,OAAAA,CAAQG,UAAU,CAACD,KAAK,GAAG,EAAA;AACxF,IAAA,qBACIE,eAAA,CAACC,QAAAA,EAAAA;QAAOC,IAAAA,EAAK,QAAA;AAASC,QAAAA,eAAAA,EAAeP,QAAQQ,EAAE;;AAC1CN,YAAAA,KAAAA;AACAD,YAAAA,KAAAA,CAAMQ;;;AAGnB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CoreCard.js","sources":["../../../core/CoreCard.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 { RegisteredComponentProps } from '../renderer';\n\n/**\n * The `core:card` component - part of the minimum vocabulary a `ui profile` can always fall back to.\n */\nexport function CoreCard({ element, slots }: RegisteredComponentProps) {\n return (\n <section data-scene-id={element.id} style={{ border: '1px solid #ccc', borderRadius: 4, padding: '0.75rem' }}>\n {slots.content}\n </section>\n );\n}\n"],"names":["CoreCard","element","slots","_jsx","section","data-scene-id","id","style","border","borderRadius","padding","content"],"mappings":";;;;AAAA;AACA;AAIA;;AAEC,IACM,SAASA,QAAAA,CAAS,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;AACjE,IAAA,qBACIC,cAAA,CAACC,SAAAA,EAAAA;AAAQC,QAAAA,eAAAA,EAAeJ,QAAQK,EAAE;QAAEC,KAAAA,EAAO;YAAEC,MAAAA,EAAQ,gBAAA;YAAkBC,YAAAA,EAAc,CAAA;YAAGC,OAAAA,EAAS;AAAU,SAAA;AACtGR,QAAAA,QAAAA,EAAAA,KAAAA,CAAMS;;AAGnB;;;;"}
1
+ {"version":3,"file":"CoreCard.js","sources":["../../../core/CoreCard.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 { RegisteredComponentProps } from '../renderer';\n\n/**\n * The `core:card` component - part of the minimum vocabulary a `ui profile` can always fall back to.\n */\nexport function CoreCard({ element, slots }: RegisteredComponentProps) {\n return (\n <section data-scene-id={element.id} style={{ border: '1px solid #ccc', borderRadius: 4, padding: '0.75rem' }}>\n {slots.content}\n </section>\n );\n}\n"],"names":["CoreCard","element","slots","_jsx","section","data-scene-id","id","style","border","borderRadius","padding","content"],"mappings":";;;;AAAA;AACA;AAIA;;AAEC,IACM,SAASA,QAAAA,CAAS,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;AACjE,IAAA,qBACIC,cAAA,CAACC,SAAAA,EAAAA;AAAQC,QAAAA,eAAAA,EAAeJ,QAAQK,EAAE;QAAEC,KAAAA,EAAO;YAAEC,MAAAA,EAAQ,gBAAA;YAAkBC,YAAAA,EAAc,CAAA;YAAGC,OAAAA,EAAS;AAAU,SAAA;AACtGR,QAAAA,QAAAA,EAAAA,KAAAA,CAAMS;;AAGnB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CoreText.js","sources":["../../../core/CoreText.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 { RegisteredComponentProps } from '../renderer';\n\n/**\n * The `core:text` component - the minimum vocabulary a `ui profile` can always fall back to, regardless\n * of which packages it lists, per Scene#3's `core` fallback guarantee.\n */\nexport function CoreText({ element }: RegisteredComponentProps) {\n const text = typeof element.properties.text === 'string' ? element.properties.text : '';\n return <span data-scene-id={element.id}>{text}</span>;\n}\n"],"names":["CoreText","element","text","properties","_jsx","span","data-scene-id","id"],"mappings":";;;;AAAA;AACA;AAIA;;;AAGC,IACM,SAASA,QAAAA,CAAS,EAAEC,OAAO,EAA4B,EAAA;AAC1D,IAAA,MAAMC,IAAAA,GAAO,OAAOD,OAAAA,CAAQE,UAAU,CAACD,IAAI,KAAK,QAAA,GAAWD,OAAAA,CAAQE,UAAU,CAACD,IAAI,GAAG,EAAA;AACrF,IAAA,qBAAOE,cAAA,CAACC,MAAAA,EAAAA;AAAKC,QAAAA,eAAAA,EAAeL,QAAQM,EAAE;AAAGL,QAAAA,QAAAA,EAAAA;;AAC7C;;;;"}
1
+ {"version":3,"file":"CoreText.js","sources":["../../../core/CoreText.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 { RegisteredComponentProps } from '../renderer';\n\n/**\n * The `core:text` component - the minimum vocabulary a `ui profile` can always fall back to, regardless\n * of which packages it lists, per Scene#3's `core` fallback guarantee.\n */\nexport function CoreText({ element }: RegisteredComponentProps) {\n const text = typeof element.properties.text === 'string' ? element.properties.text : '';\n return <span data-scene-id={element.id}>{text}</span>;\n}\n"],"names":["CoreText","element","text","properties","_jsx","span","data-scene-id","id"],"mappings":";;;;AAAA;AACA;AAIA;;;AAGC,IACM,SAASA,QAAAA,CAAS,EAAEC,OAAO,EAA4B,EAAA;AAC1D,IAAA,MAAMC,IAAAA,GAAO,OAAOD,OAAAA,CAAQE,UAAU,CAACD,IAAI,KAAK,QAAA,GAAWD,OAAAA,CAAQE,UAAU,CAACD,IAAI,GAAG,EAAA;AACrF,IAAA,qBAAOE,cAAA,CAACC,MAAAA,EAAAA;AAAKC,QAAAA,eAAAA,EAAeL,QAAQM,EAAE;AAAGL,QAAAA,QAAAA,EAAAA;;AAC7C;;"}
@@ -0,0 +1,128 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
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
+ function textProperty(properties, name, fallback = '') {
8
+ return typeof properties[name] === 'string' ? properties[name] : fallback;
9
+ }
10
+ /** Carries a Screenplay data declaration without adding visual chrome. */ function CoreData({ element }) {
11
+ return /*#__PURE__*/ jsxRuntime.jsx("span", {
12
+ hidden: true,
13
+ "data-scene-id": element.id,
14
+ "data-scene-data": textProperty(element.properties, 'typeName')
15
+ });
16
+ }
17
+ /** Renders a modeled command action and emits a host-neutral command event when invoked. */ function CoreAction({ element }) {
18
+ const command = textProperty(element.properties, 'command');
19
+ const label = textProperty(element.properties, 'label', command);
20
+ const invoke = ()=>globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', {
21
+ detail: {
22
+ command,
23
+ element
24
+ }
25
+ }));
26
+ return /*#__PURE__*/ jsxRuntime.jsx("button", {
27
+ type: "button",
28
+ "data-scene-id": element.id,
29
+ onClick: invoke,
30
+ children: label
31
+ });
32
+ }
33
+ /** Groups the nested content of a Screenplay section. */ function CoreSection({ element, slots }) {
34
+ const name = textProperty(element.properties, 'name');
35
+ return /*#__PURE__*/ jsxRuntime.jsxs("section", {
36
+ "data-scene-id": element.id,
37
+ children: [
38
+ name && /*#__PURE__*/ jsxRuntime.jsx("h2", {
39
+ children: name
40
+ }),
41
+ slots.content
42
+ ]
43
+ });
44
+ }
45
+ /** Renders navigation intent and emits a host-neutral navigation event. */ function CoreNavigate({ element }) {
46
+ const targetScreen = textProperty(element.properties, 'targetScreen');
47
+ const navigate = ()=>globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', {
48
+ detail: {
49
+ targetScreen,
50
+ element
51
+ }
52
+ }));
53
+ return /*#__PURE__*/ jsxRuntime.jsx("button", {
54
+ type: "button",
55
+ "data-scene-id": element.id,
56
+ onClick: navigate,
57
+ children: targetScreen
58
+ });
59
+ }
60
+ /** Renders a Screenplay title directive. */ function CoreTitle({ element }) {
61
+ return /*#__PURE__*/ jsxRuntime.jsx("h1", {
62
+ "data-scene-id": element.id,
63
+ children: textProperty(element.properties, 'text')
64
+ });
65
+ }
66
+ /** Renders the structural shell of a Screenplay table. Query data is supplied by the host. */ function CoreTable({ element, slots }) {
67
+ return /*#__PURE__*/ jsxRuntime.jsx("section", {
68
+ "data-scene-id": element.id,
69
+ role: "table",
70
+ children: /*#__PURE__*/ jsxRuntime.jsx("header", {
71
+ role: "row",
72
+ children: slots.columns
73
+ })
74
+ });
75
+ }
76
+ /** Renders a Screenplay table-column heading. */ function CoreColumn({ element }) {
77
+ const property = textProperty(element.properties, 'property');
78
+ return /*#__PURE__*/ jsxRuntime.jsx("span", {
79
+ "data-scene-id": element.id,
80
+ role: "columnheader",
81
+ children: textProperty(element.properties, 'label', property)
82
+ });
83
+ }
84
+ /** Renders the structural shell of a Screenplay summary. Query data is supplied by the host. */ function CoreSummary({ element, slots }) {
85
+ return /*#__PURE__*/ jsxRuntime.jsx("dl", {
86
+ "data-scene-id": element.id,
87
+ children: slots.fields
88
+ });
89
+ }
90
+ /** Renders a Screenplay summary field label. */ function CoreField({ element }) {
91
+ const property = textProperty(element.properties, 'property');
92
+ return /*#__PURE__*/ jsxRuntime.jsx("dt", {
93
+ "data-scene-id": element.id,
94
+ children: textProperty(element.properties, 'label', property)
95
+ });
96
+ }
97
+ /** Renders a Screenplay code block. */ function CoreCode({ element }) {
98
+ const language = textProperty(element.properties, 'language');
99
+ return /*#__PURE__*/ jsxRuntime.jsx("pre", {
100
+ "data-scene-id": element.id,
101
+ children: /*#__PURE__*/ jsxRuntime.jsx("code", {
102
+ "data-language": language,
103
+ children: textProperty(element.properties, 'code')
104
+ })
105
+ });
106
+ }
107
+ /** Makes an external screen-file reference visible until a host supplies that file. */ function CoreFile({ element }) {
108
+ return /*#__PURE__*/ jsxRuntime.jsxs("p", {
109
+ "data-scene-id": element.id,
110
+ children: [
111
+ "Screen source: ",
112
+ textProperty(element.properties, 'path')
113
+ ]
114
+ });
115
+ }
116
+
117
+ exports.CoreAction = CoreAction;
118
+ exports.CoreCode = CoreCode;
119
+ exports.CoreColumn = CoreColumn;
120
+ exports.CoreData = CoreData;
121
+ exports.CoreField = CoreField;
122
+ exports.CoreFile = CoreFile;
123
+ exports.CoreNavigate = CoreNavigate;
124
+ exports.CoreSection = CoreSection;
125
+ exports.CoreSummary = CoreSummary;
126
+ exports.CoreTable = CoreTable;
127
+ exports.CoreTitle = CoreTitle;
128
+ //# sourceMappingURL=ScreenplayCoreComponents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScreenplayCoreComponents.js","sources":["../../../core/ScreenplayCoreComponents.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 { RegisteredComponentProps } from '../renderer';\n\nfunction textProperty(properties: Record<string, unknown>, name: string, fallback = ''): string {\n return typeof properties[name] === 'string' ? properties[name] : fallback;\n}\n\n/** Carries a Screenplay data declaration without adding visual chrome. */\nexport function CoreData({ element }: RegisteredComponentProps) {\n return <span hidden data-scene-id={element.id} data-scene-data={textProperty(element.properties, 'typeName')} />;\n}\n\n/** Renders a modeled command action and emits a host-neutral command event when invoked. */\nexport function CoreAction({ element }: RegisteredComponentProps) {\n const command = textProperty(element.properties, 'command');\n const label = textProperty(element.properties, 'label', command);\n const invoke = () => globalThis.dispatchEvent(new CustomEvent('cratis.scene.command', { detail: { command, element } }));\n return <button type='button' data-scene-id={element.id} onClick={invoke}>{label}</button>;\n}\n\n/** Groups the nested content of a Screenplay section. */\nexport function CoreSection({ element, slots }: RegisteredComponentProps) {\n const name = textProperty(element.properties, 'name');\n return <section data-scene-id={element.id}>{name && <h2>{name}</h2>}{slots.content}</section>;\n}\n\n/** Renders navigation intent and emits a host-neutral navigation event. */\nexport function CoreNavigate({ element }: RegisteredComponentProps) {\n const targetScreen = textProperty(element.properties, 'targetScreen');\n const navigate = () => globalThis.dispatchEvent(new CustomEvent('cratis.scene.navigate', { detail: { targetScreen, element } }));\n return <button type='button' data-scene-id={element.id} onClick={navigate}>{targetScreen}</button>;\n}\n\n/** Renders a Screenplay title directive. */\nexport function CoreTitle({ element }: RegisteredComponentProps) {\n return <h1 data-scene-id={element.id}>{textProperty(element.properties, 'text')}</h1>;\n}\n\n/** Renders the structural shell of a Screenplay table. Query data is supplied by the host. */\nexport function CoreTable({ element, slots }: RegisteredComponentProps) {\n return <section data-scene-id={element.id} role='table'><header role='row'>{slots.columns}</header></section>;\n}\n\n/** Renders a Screenplay table-column heading. */\nexport function CoreColumn({ element }: RegisteredComponentProps) {\n const property = textProperty(element.properties, 'property');\n return <span data-scene-id={element.id} role='columnheader'>{textProperty(element.properties, 'label', property)}</span>;\n}\n\n/** Renders the structural shell of a Screenplay summary. Query data is supplied by the host. */\nexport function CoreSummary({ element, slots }: RegisteredComponentProps) {\n return <dl data-scene-id={element.id}>{slots.fields}</dl>;\n}\n\n/** Renders a Screenplay summary field label. */\nexport function CoreField({ element }: RegisteredComponentProps) {\n const property = textProperty(element.properties, 'property');\n return <dt data-scene-id={element.id}>{textProperty(element.properties, 'label', property)}</dt>;\n}\n\n/** Renders a Screenplay code block. */\nexport function CoreCode({ element }: RegisteredComponentProps) {\n const language = textProperty(element.properties, 'language');\n return <pre data-scene-id={element.id}><code data-language={language}>{textProperty(element.properties, 'code')}</code></pre>;\n}\n\n/** Makes an external screen-file reference visible until a host supplies that file. */\nexport function CoreFile({ element }: RegisteredComponentProps) {\n return <p data-scene-id={element.id}>Screen source: {textProperty(element.properties, 'path')}</p>;\n}\n"],"names":["textProperty","properties","name","fallback","CoreData","element","_jsx","span","hidden","data-scene-id","id","data-scene-data","CoreAction","command","label","invoke","globalThis","dispatchEvent","CustomEvent","detail","button","type","onClick","CoreSection","slots","_jsxs","section","h2","content","CoreNavigate","targetScreen","navigate","CoreTitle","h1","CoreTable","role","header","columns","CoreColumn","property","CoreSummary","dl","fields","CoreField","dt","CoreCode","language","pre","code","data-language","CoreFile","p"],"mappings":";;;;AAAA;AACA;AAIA,SAASA,aAAaC,UAAmC,EAAEC,IAAY,EAAEC,WAAW,EAAE,EAAA;IAClF,OAAO,OAAOF,UAAU,CAACC,IAAAA,CAAK,KAAK,QAAA,GAAWD,UAAU,CAACC,IAAAA,CAAK,GAAGC,QAAAA;AACrE;AAEA,2EACO,SAASC,QAAAA,CAAS,EAAEC,OAAO,EAA4B,EAAA;AAC1D,IAAA,qBAAOC,cAAA,CAACC,MAAAA,EAAAA;QAAKC,MAAM,EAAA,IAAA;AAACC,QAAAA,eAAAA,EAAeJ,QAAQK,EAAE;QAAEC,iBAAAA,EAAiBX,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,UAAA;;AACrG;AAEA,6FACO,SAASW,UAAAA,CAAW,EAAEP,OAAO,EAA4B,EAAA;AAC5D,IAAA,MAAMQ,OAAAA,GAAUb,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,SAAA,CAAA;AACjD,IAAA,MAAMa,KAAAA,GAAQd,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,OAAA,EAASY,OAAAA,CAAAA;AACxD,IAAA,MAAME,SAAS,IAAMC,UAAAA,CAAWC,aAAa,CAAC,IAAIC,YAAY,sBAAA,EAAwB;YAAEC,MAAAA,EAAQ;AAAEN,gBAAAA,OAAAA;AAASR,gBAAAA;AAAQ;AAAE,SAAA,CAAA,CAAA;AACrH,IAAA,qBAAOC,cAAA,CAACc,QAAAA,EAAAA;QAAOC,IAAAA,EAAK,QAAA;AAASZ,QAAAA,eAAAA,EAAeJ,QAAQK,EAAE;QAAEY,OAAAA,EAASP,MAAAA;AAASD,QAAAA,QAAAA,EAAAA;;AAC9E;A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AU,EAAE,UAAA,CAAA;AAClD,IAAA,qBAAOK,cAAA,CAACyC,KAAAA,EAAAA;AAAItC,QAAAA,eAAAA,EAAeJ,QAAQK,EAAE;AAAE,QAAA,QAAA,gBAAAJ,cAAA,CAAC0C,MAAAA,EAAAA;YAAKC,eAAAA,EAAeH,QAAAA;sBAAW9C,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,MAAA;;;AAC5G;AAEA,wFACO,SAASiD,QAAAA,CAAS,EAAE7C,OAAO,EAA4B,EAAA;AAC1D,IAAA,qBAAOoB,eAAA,CAAC0B,GAAAA,EAAAA;AAAE1C,QAAAA,eAAAA,EAAeJ,QAAQK,EAAE;;AAAE,YAAA,iBAAA;YAAgBV,YAAAA,CAAaK,OAAAA,CAAQJ,UAAU,EAAE,MAAA;;;AAC1F;;;;;;;;;;;;"}
@@ -4,6 +4,7 @@ var ScenePackageBundle = require('../packages/ScenePackageBundle.js');
4
4
  var CoreText = require('./CoreText.js');
5
5
  var CoreButton = require('./CoreButton.js');
6
6
  var CoreCard = require('./CoreCard.js');
7
+ var ScreenplayCoreComponents = require('./ScreenplayCoreComponents.js');
7
8
 
8
9
  // Copyright (c) Cratis. All rights reserved.
9
10
  // Licensed under the MIT license. See LICENSE file in the project root for full license information.
@@ -13,7 +14,18 @@ var CoreCard = require('./CoreCard.js');
13
14
  */ const coreComponents = {
14
15
  [ScenePackageBundle.componentRegistryKey('core', 'text')]: CoreText.CoreText,
15
16
  [ScenePackageBundle.componentRegistryKey('core', 'button')]: CoreButton.CoreButton,
16
- [ScenePackageBundle.componentRegistryKey('core', 'card')]: CoreCard.CoreCard
17
+ [ScenePackageBundle.componentRegistryKey('core', 'card')]: CoreCard.CoreCard,
18
+ [ScenePackageBundle.componentRegistryKey('core', 'data')]: ScreenplayCoreComponents.CoreData,
19
+ [ScenePackageBundle.componentRegistryKey('core', 'action')]: ScreenplayCoreComponents.CoreAction,
20
+ [ScenePackageBundle.componentRegistryKey('core', 'section')]: ScreenplayCoreComponents.CoreSection,
21
+ [ScenePackageBundle.componentRegistryKey('core', 'navigate')]: ScreenplayCoreComponents.CoreNavigate,
22
+ [ScenePackageBundle.componentRegistryKey('core', 'title')]: ScreenplayCoreComponents.CoreTitle,
23
+ [ScenePackageBundle.componentRegistryKey('core', 'table')]: ScreenplayCoreComponents.CoreTable,
24
+ [ScenePackageBundle.componentRegistryKey('core', 'column')]: ScreenplayCoreComponents.CoreColumn,
25
+ [ScenePackageBundle.componentRegistryKey('core', 'summary')]: ScreenplayCoreComponents.CoreSummary,
26
+ [ScenePackageBundle.componentRegistryKey('core', 'field')]: ScreenplayCoreComponents.CoreField,
27
+ [ScenePackageBundle.componentRegistryKey('core', 'code')]: ScreenplayCoreComponents.CoreCode,
28
+ [ScenePackageBundle.componentRegistryKey('core', 'file')]: ScreenplayCoreComponents.CoreFile
17
29
  };
18
30
 
19
31
  exports.coreComponents = coreComponents;
@@ -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';\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};\n"],"names":["coreComponents","componentRegistryKey","CoreText","CoreButton","CoreCard"],"mappings":";;;;;;;AAAA;AACA;AAQA;;;UAIaA,cAAAA,GAAoC;IAC7C,CAACC,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUC,iBAAAA;IACxC,CAACD,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYE,qBAAAA;IAC1C,CAACF,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUG;AAC5C;;;;"}
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 {\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};\n"],"names":["coreComponents","componentRegistryKey","CoreText","CoreButton","CoreCard","CoreData","CoreAction","CoreSection","CoreNavigate","CoreTitle","CoreTable","CoreColumn","CoreSummary","CoreField","CoreCode","CoreFile"],"mappings":";;;;;;;;AAAA;AACA;AAqBA;;;UAIaA,cAAAA,GAAoC;IAC7C,CAACC,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUC,iBAAAA;IACxC,CAACD,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYE,qBAAAA;IAC1C,CAACF,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUG,iBAAAA;IACxC,CAACH,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUI,iCAAAA;IACxC,CAACJ,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYK,mCAAAA;IAC1C,CAACL,uCAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaM,oCAAAA;IAC3C,CAACN,uCAAAA,CAAqB,MAAA,EAAQ,UAAA,CAAA,GAAcO,qCAAAA;IAC5C,CAACP,uCAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWQ,kCAAAA;IACzC,CAACR,uCAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWS,kCAAAA;IACzC,CAACT,uCAAAA,CAAqB,MAAA,EAAQ,QAAA,CAAA,GAAYU,mCAAAA;IAC1C,CAACV,uCAAAA,CAAqB,MAAA,EAAQ,SAAA,CAAA,GAAaW,oCAAAA;IAC3C,CAACX,uCAAAA,CAAqB,MAAA,EAAQ,OAAA,CAAA,GAAWY,kCAAAA;IACzC,CAACZ,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUa,iCAAAA;IACxC,CAACb,uCAAAA,CAAqB,MAAA,EAAQ,MAAA,CAAA,GAAUc;AAC5C;;"}
@@ -19,7 +19,18 @@ var coreComponents = require('./coreComponents.js');
19
19
  components: [
20
20
  'text',
21
21
  'button',
22
- 'card'
22
+ 'card',
23
+ 'data',
24
+ 'action',
25
+ 'section',
26
+ 'navigate',
27
+ 'title',
28
+ 'table',
29
+ 'column',
30
+ 'summary',
31
+ 'field',
32
+ 'code',
33
+ 'file'
23
34
  ],
24
35
  layouts: [],
25
36
  screenTemplates: [],
@@ -1 +1 @@
1
- {"version":3,"file":"corePackage.js","sources":["../../../core/corePackage.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 { PackageKind, ScenePackage } from '@cratis/scene.model';\nimport { ScenePackageBundle } from '../packages';\nimport { coreComponents } from './coreComponents';\n\n/**\n * The `core` package's declaration. Every other package is loaded by a host that reads its manifest;\n * `core` ships inside the renderer itself, because Scene#3 guarantees a bare name always has somewhere to\n * resolve regardless of which packages a profile lists. It is still declared the same way as any other -\n * a package picker should be able to show it, and the dependency resolver should be able to reason about\n * it, without a special case.\n */\nexport const corePackageManifest: ScenePackage = {\n name: 'core',\n version: '1.0.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [],\n components: ['text', 'button', 'card'],\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n themes: [],\n displayName: 'Core',\n description: 'The built-in fallback vocabulary every ui profile resolves against.',\n module: '@cratis/scene.react',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n};\n\n/**\n * The `core` package as a loadable bundle.\n */\nexport const corePackage: ScenePackageBundle = {\n manifest: corePackageManifest,\n components: coreComponents,\n};\n"],"names":["corePackageManifest","name","version","kind","PackageKind","ComponentLibrary","dependencies","components","layouts","screenTemplates","dialogTemplates","themes","displayName","description","module","license","licenseUrl","corePackage","manifest","coreComponents"],"mappings":";;;;;AAAA;AACA;AAMA;;;;;;UAOaA,mBAAAA,GAAoC;IAC7CC,IAAAA,EAAM,MAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,wBAAYC,gBAAgB;AAClCC,IAAAA,YAAAA,EAAc,EAAE;IAChBC,UAAAA,EAAY;AAAC,QAAA,MAAA;AAAQ,QAAA,QAAA;AAAU,QAAA;AAAO,KAAA;AACtCC,IAAAA,OAAAA,EAAS,EAAE;AACXC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,MAAAA,EAAQ,EAAE;IACVC,WAAAA,EAAa,MAAA;IACbC,WAAAA,EAAa,qEAAA;IACbC,MAAAA,EAAQ,qBAAA;IACRC,OAAAA,EAAS,KAAA;IACTC,UAAAA,EAAY;AAChB;AAEA;;UAGaC,WAAAA,GAAkC;IAC3CC,QAAAA,EAAUlB,mBAAAA;IACVO,UAAAA,EAAYY;AAChB;;;;;"}
1
+ {"version":3,"file":"corePackage.js","sources":["../../../core/corePackage.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 { PackageKind, ScenePackage } from '@cratis/scene.model';\nimport { ScenePackageBundle } from '../packages';\nimport { coreComponents } from './coreComponents';\n\n/**\n * The `core` package's declaration. Every other package is loaded by a host that reads its manifest;\n * `core` ships inside the renderer itself, because Scene#3 guarantees a bare name always has somewhere to\n * resolve regardless of which packages a profile lists. It is still declared the same way as any other -\n * a package picker should be able to show it, and the dependency resolver should be able to reason about\n * it, without a special case.\n */\nexport const corePackageManifest: ScenePackage = {\n name: 'core',\n version: '1.0.0',\n kind: PackageKind.ComponentLibrary,\n dependencies: [],\n components: [\n 'text',\n 'button',\n 'card',\n 'data',\n 'action',\n 'section',\n 'navigate',\n 'title',\n 'table',\n 'column',\n 'summary',\n 'field',\n 'code',\n 'file',\n ],\n layouts: [],\n screenTemplates: [],\n dialogTemplates: [],\n themes: [],\n displayName: 'Core',\n description: 'The built-in fallback vocabulary every ui profile resolves against.',\n module: '@cratis/scene.react',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n};\n\n/**\n * The `core` package as a loadable bundle.\n */\nexport const corePackage: ScenePackageBundle = {\n manifest: corePackageManifest,\n components: coreComponents,\n};\n"],"names":["corePackageManifest","name","version","kind","PackageKind","ComponentLibrary","dependencies","components","layouts","screenTemplates","dialogTemplates","themes","displayName","description","module","license","licenseUrl","corePackage","manifest","coreComponents"],"mappings":";;;;;AAAA;AACA;AAMA;;;;;;UAOaA,mBAAAA,GAAoC;IAC7CC,IAAAA,EAAM,MAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,wBAAYC,gBAAgB;AAClCC,IAAAA,YAAAA,EAAc,EAAE;IAChBC,UAAAA,EAAY;AACR,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,MAAA;AACA,QAAA,MAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,UAAA;AACA,QAAA,OAAA;AACA,QAAA,OAAA;AACA,QAAA,QAAA;AACA,QAAA,SAAA;AACA,QAAA,OAAA;AACA,QAAA,MAAA;AACA,QAAA;AACH,KAAA;AACDC,IAAAA,OAAAA,EAAS,EAAE;AACXC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,eAAAA,EAAiB,EAAE;AACnBC,IAAAA,MAAAA,EAAQ,EAAE;IACVC,WAAAA,EAAa,MAAA;IACbC,WAAAA,EAAa,qEAAA;IACbC,MAAAA,EAAQ,qBAAA;IACRC,OAAAA,EAAS,KAAA;IACTC,UAAAA,EAAY;AAChB;AAEA;;UAGaC,WAAAA,GAAkC;IAC3CC,QAAAA,EAAUlB,mBAAAA;IACVO,UAAAA,EAAYY;AAChB;;;"}
package/dist/cjs/index.js CHANGED
@@ -6,6 +6,7 @@ var createReactRenderer = require('./renderer/createReactRenderer.js');
6
6
  var CoreText = require('./core/CoreText.js');
7
7
  var CoreButton = require('./core/CoreButton.js');
8
8
  var CoreCard = require('./core/CoreCard.js');
9
+ var ScreenplayCoreComponents = require('./core/ScreenplayCoreComponents.js');
9
10
  var coreComponents = require('./core/coreComponents.js');
10
11
  var corePackage = require('./core/corePackage.js');
11
12
  var NavBar = require('./NavBar/NavBar.js');
@@ -22,6 +23,17 @@ exports.createReactRenderer = createReactRenderer.createReactRenderer;
22
23
  exports.CoreText = CoreText.CoreText;
23
24
  exports.CoreButton = CoreButton.CoreButton;
24
25
  exports.CoreCard = CoreCard.CoreCard;
26
+ exports.CoreAction = ScreenplayCoreComponents.CoreAction;
27
+ exports.CoreCode = ScreenplayCoreComponents.CoreCode;
28
+ exports.CoreColumn = ScreenplayCoreComponents.CoreColumn;
29
+ exports.CoreData = ScreenplayCoreComponents.CoreData;
30
+ exports.CoreField = ScreenplayCoreComponents.CoreField;
31
+ exports.CoreFile = ScreenplayCoreComponents.CoreFile;
32
+ exports.CoreNavigate = ScreenplayCoreComponents.CoreNavigate;
33
+ exports.CoreSection = ScreenplayCoreComponents.CoreSection;
34
+ exports.CoreSummary = ScreenplayCoreComponents.CoreSummary;
35
+ exports.CoreTable = ScreenplayCoreComponents.CoreTable;
36
+ exports.CoreTitle = ScreenplayCoreComponents.CoreTitle;
25
37
  exports.coreComponents = coreComponents.coreComponents;
26
38
  exports.corePackage = corePackage.corePackage;
27
39
  exports.corePackageManifest = corePackage.corePackageManifest;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScenePackageBundle.js","sources":["../../../packages/ScenePackageBundle.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogTemplate, Layout, ScenePackage, Screen, ScreenTemplate, Theme } from '@cratis/scene.model';\nimport { ComponentRegistry } from '../renderer';\n\n/**\n * What a package actually ships to a React renderer, as opposed to what it *declares*.\n *\n * `ScenePackage` is the declaration — a name, a kind, dependencies, and the names of what it\n * contributes. It is deliberately platform-agnostic and lives in `Scene.Model`, because Stage's build and\n * Studio's design-time queries both read it without ever loading a component. A bundle is the other half:\n * the real React components, layouts, screens and themes behind those names, which only a renderer needs.\n *\n * A package publishes exactly one bundle, as a named export following its own name —\n * `primeReactPackage`, `cratisComponentsPackage`, `corePackage`. A host loads it from the module the\n * declaration's `ScenePackage.module` names.\n */\nexport interface ScenePackageBundle {\n /**\n * The package's own declaration. Its `components`, `layouts` and `themes` name lists must agree with\n * what this bundle actually provides — {@link validatePackageBundle} is what proves they do.\n */\n manifest: ScenePackage;\n\n /**\n * The components this package provides, keyed by {@link componentRegistryKey}.\n */\n components: ComponentRegistry;\n\n /**\n * The application shells this package provides, if any. Only a blueprint has these.\n */\n layouts?: Layout[];\n\n /**\n * The screen templates this package provides — the shapes that go inside a layout, each declaring\n * which of its parent's slots it fills.\n */\n screenTemplates?: ScreenTemplate[];\n\n /**\n * The dialog templates this package provides.\n */\n dialogTemplates?: DialogTemplate[];\n\n /**\n * Sample screens this package ships — a layout package's gallery, so a preview has real content to\n * put through the real engine rather than a mockup.\n */\n screens?: Screen[];\n\n /**\n * The themes this package ships, if any.\n */\n themes?: Theme[];\n}\n\n/**\n * The key a component is registered and looked up under: the package that provides it, then the bare name\n * a screen refers to it by.\n *\n * A screen writes a bare name (`button`) or a package-qualified one (`PrimeReact.button`);\n * `resolveComponentName` turns either into a `{ name, package }` pair, and this turns that pair into the\n * registry key. Nothing should build this string by hand — the separator is an implementation detail of\n * the registry, deliberately not the `.` used for qualification in a screen, so a package name containing\n * dots stays unambiguous.\n */\nexport function componentRegistryKey(packageName: string, componentName: string): string {\n return `${packageName}:${componentName}`;\n}\n\n/**\n * Checks that a bundle provides everything its manifest declares, and declares everything it provides.\n *\n * A manifest that promises a component the bundle does not register renders as `UnresolvedComponent` at\n * runtime — a blank box, far from where the mistake was made. A component registered but not declared is\n * invisible to `resolveComponentName`, so a screen can never name it. Both are silent failures, which is\n * why every package's specs run this.\n */\nexport function validatePackageBundle(bundle: ScenePackageBundle): string[] {\n const problems: string[] = [];\n const { manifest } = bundle;\n\n for (const name of manifest.components) {\n if (!(componentRegistryKey(manifest.name, name) in bundle.components)) {\n problems.push(`declares the component '${name}' but registers no implementation for it`);\n }\n }\n\n const declared = new Set(manifest.components.map((name) => componentRegistryKey(manifest.name, name)));\n for (const key of Object.keys(bundle.components)) {\n if (!declared.has(key)) {\n problems.push(`registers '${key}', which the manifest does not declare`);\n }\n }\n\n const providedLayouts = new Set((bundle.layouts ?? []).map((layout) => layout.name));\n for (const name of manifest.layouts) {\n if (!providedLayouts.has(name)) {\n problems.push(`declares the layout '${name}' but provides no definition for it`);\n }\n }\n\n const providedScreenTemplates = new Set((bundle.screenTemplates ?? []).map((template) => template.name));\n for (const name of manifest.screenTemplates) {\n if (!providedScreenTemplates.has(name)) {\n problems.push(`declares the screen template '${name}' but provides no definition for it`);\n }\n }\n\n const providedDialogTemplates = new Set((bundle.dialogTemplates ?? []).map((template) => template.name));\n for (const name of manifest.dialogTemplates) {\n if (!providedDialogTemplates.has(name)) {\n problems.push(`declares the dialog template '${name}' but provides no definition for it`);\n }\n }\n\n const providedThemes = new Set((bundle.themes ?? []).map((theme) => theme.name));\n for (const name of manifest.themes) {\n if (!providedThemes.has(name)) {\n problems.push(`declares the theme '${name}' but provides no definition for it`);\n }\n }\n\n return problems;\n}\n\n/**\n * Merges the component registries of several bundles into the single registry a renderer consumes.\n *\n * Keys carry their package name, so nothing collides and merge order does not matter — which package wins\n * a *bare* name is decided earlier, by `resolveComponentName` walking the profile's priority order.\n */\nexport function mergePackageRegistries(bundles: ScenePackageBundle[]): ComponentRegistry {\n return Object.assign({}, ...bundles.map((bundle) => bundle.components)) as ComponentRegistry;\n}\n"],"names":["componentRegistryKey","packageName","componentName","validatePackageBundle","bundle","problems","manifest","name","components","push","declared","Set","map","key","Object","keys","has","providedLayouts","layouts","layout","providedScreenTemplates","screenTemplates","template","providedDialogTemplates","dialogTemplates","providedThemes","themes","theme","mergePackageRegistries","bundles","assign"],"mappings":";;AAAA;AACA;AAyDA;;;;;;;;;AASC,IACM,SAASA,oBAAAA,CAAqBC,WAAmB,EAAEC,aAAqB,EAAA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GAAG,CAACT,IAAAA,CAAAA,EAAO;AAC3BF,YAAAA,QAAAA,CAASI,IAAI,CAAC,CAAC,oBAAoB,EAAEF,IAAAA,CAAK,mCAAmC,CAAC,CAAA;AAClF,QAAA;AACJ,IAAA;IAEA,OAAOF,QAAAA;AACX;AAEA;;;;;IAMO,SAASuB,sBAAAA,CAAuBC,OAA6B,EAAA;IAChE,OAAOf,MAAAA,CAAOgB,MAAM,CAAC,EAAC,EAAA,GAAMD,OAAAA,CAAQjB,GAAG,CAAC,CAACR,MAAAA,GAAWA,MAAAA,CAAOI,UAAU,CAAA,CAAA;AACzE;;;;;;"}
1
+ {"version":3,"file":"ScenePackageBundle.js","sources":["../../../packages/ScenePackageBundle.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogTemplate, Layout, ScenePackage, Screen, ScreenTemplate, Theme } from '@cratis/scene.model';\nimport { ComponentRegistry } from '../renderer';\n\n/**\n * What a package actually ships to a React renderer, as opposed to what it *declares*.\n *\n * `ScenePackage` is the declaration — a name, a kind, dependencies, and the names of what it\n * contributes. It is deliberately platform-agnostic and lives in `Scene.Model`, because Stage's build and\n * Studio's design-time queries both read it without ever loading a component. A bundle is the other half:\n * the real React components, layouts, screens and themes behind those names, which only a renderer needs.\n *\n * A package publishes exactly one bundle, as a named export following its own name —\n * `primeReactPackage`, `cratisComponentsPackage`, `corePackage`. A host loads it from the module the\n * declaration's `ScenePackage.module` names.\n */\nexport interface ScenePackageBundle {\n /**\n * The package's own declaration. Its `components`, `layouts` and `themes` name lists must agree with\n * what this bundle actually provides — {@link validatePackageBundle} is what proves they do.\n */\n manifest: ScenePackage;\n\n /**\n * The components this package provides, keyed by {@link componentRegistryKey}.\n */\n components: ComponentRegistry;\n\n /**\n * The application shells this package provides, if any. Only a blueprint has these.\n */\n layouts?: Layout[];\n\n /**\n * The screen templates this package provides — the shapes that go inside a layout, each declaring\n * which of its parent's slots it fills.\n */\n screenTemplates?: ScreenTemplate[];\n\n /**\n * The dialog templates this package provides.\n */\n dialogTemplates?: DialogTemplate[];\n\n /**\n * Sample screens this package ships — a layout package's gallery, so a preview has real content to\n * put through the real engine rather than a mockup.\n */\n screens?: Screen[];\n\n /**\n * The themes this package ships, if any.\n */\n themes?: Theme[];\n}\n\n/**\n * The key a component is registered and looked up under: the package that provides it, then the bare name\n * a screen refers to it by.\n *\n * A screen writes a bare name (`button`) or a package-qualified one (`PrimeReact.button`);\n * `resolveComponentName` turns either into a `{ name, package }` pair, and this turns that pair into the\n * registry key. Nothing should build this string by hand — the separator is an implementation detail of\n * the registry, deliberately not the `.` used for qualification in a screen, so a package name containing\n * dots stays unambiguous.\n */\nexport function componentRegistryKey(packageName: string, componentName: string): string {\n return `${packageName}:${componentName}`;\n}\n\n/**\n * Checks that a bundle provides everything its manifest declares, and declares everything it provides.\n *\n * A manifest that promises a component the bundle does not register renders as `UnresolvedComponent` at\n * runtime — a blank box, far from where the mistake was made. A component registered but not declared is\n * invisible to `resolveComponentName`, so a screen can never name it. Both are silent failures, which is\n * why every package's specs run this.\n */\nexport function validatePackageBundle(bundle: ScenePackageBundle): string[] {\n const problems: string[] = [];\n const { manifest } = bundle;\n\n for (const name of manifest.components) {\n if (!(componentRegistryKey(manifest.name, name) in bundle.components)) {\n problems.push(`declares the component '${name}' but registers no implementation for it`);\n }\n }\n\n const declared = new Set(manifest.components.map((name) => componentRegistryKey(manifest.name, name)));\n for (const key of Object.keys(bundle.components)) {\n if (!declared.has(key)) {\n problems.push(`registers '${key}', which the manifest does not declare`);\n }\n }\n\n const providedLayouts = new Set((bundle.layouts ?? []).map((layout) => layout.name));\n for (const name of manifest.layouts) {\n if (!providedLayouts.has(name)) {\n problems.push(`declares the layout '${name}' but provides no definition for it`);\n }\n }\n\n const providedScreenTemplates = new Set((bundle.screenTemplates ?? []).map((template) => template.name));\n for (const name of manifest.screenTemplates) {\n if (!providedScreenTemplates.has(name)) {\n problems.push(`declares the screen template '${name}' but provides no definition for it`);\n }\n }\n\n const providedDialogTemplates = new Set((bundle.dialogTemplates ?? []).map((template) => template.name));\n for (const name of manifest.dialogTemplates) {\n if (!providedDialogTemplates.has(name)) {\n problems.push(`declares the dialog template '${name}' but provides no definition for it`);\n }\n }\n\n const providedThemes = new Set((bundle.themes ?? []).map((theme) => theme.name));\n for (const name of manifest.themes) {\n if (!providedThemes.has(name)) {\n problems.push(`declares the theme '${name}' but provides no definition for it`);\n }\n }\n\n return problems;\n}\n\n/**\n * Merges the component registries of several bundles into the single registry a renderer consumes.\n *\n * Keys carry their package name, so nothing collides and merge order does not matter — which package wins\n * a *bare* name is decided earlier, by `resolveComponentName` walking the profile's priority order.\n */\nexport function mergePackageRegistries(bundles: ScenePackageBundle[]): ComponentRegistry {\n return Object.assign({}, ...bundles.map((bundle) => bundle.components)) as ComponentRegistry;\n}\n"],"names":["componentRegistryKey","packageName","componentName","validatePackageBundle","bundle","problems","manifest","name","components","push","declared","Set","map","key","Object","keys","has","providedLayouts","layouts","layout","providedScreenTemplates","screenTemplates","template","providedDialogTemplates","dialogTemplates","providedThemes","themes","theme","mergePackageRegistries","bundles","assign"],"mappings":";;AAAA;AACA;AAyDA;;;;;;;;;AASC,IACM,SAASA,oBAAAA,CAAqBC,WAAmB,EAAEC,aAAqB,EAAA;AAC3E,IAAA,OAAO,CAAA,EAAGD,WAAAA,CAAY,CAAC,EAAEC,aAAAA,CAAAA,CAAe;AAC5C;AAEA;;;;;;;IAQO,SAASC,qBAAAA,CAAsBC,MAA0B,EAAA;AAC5D,IAAA,MAAMC,WAAqB,EAAE;IAC7B,MAAM,EAAEC,QAAQ,EAAE,GAAGF,MAAAA;AAErB,IAAA,KAAK,MAAMG,IAAAA,IAAQD,QAAAA,CAASE,UAAU,CAAE;QACpC,IAAI,EAAER,oBAAAA,CAAqBM,QAAAA,CAASC,IAAI,EAAEA,IAAAA,CAAAA,IAASH,MAAAA,CAAOI,UAAS,CAAA,EAAI;AACnEH,YAAAA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nresolvedComponent.js","sources":["../../../renderer/UnresolvedComponent.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 { RegisteredComponentProps } from './ComponentRegistry';\n\n/**\n * The fallback rendered for an {@link ExternalComponent} whose `componentName` is not in the active\n * {@link ComponentRegistry} - a visibly broken placeholder, never a silent blank, since a missing\n * component is a real configuration gap the renderer should surface, not hide.\n */\nexport function UnresolvedComponent({ element }: RegisteredComponentProps) {\n return (\n <div\n data-scene-unresolved-component={element.componentName}\n style={{ border: '1px dashed red', color: 'red', padding: '0.25rem 0.5rem', fontFamily: 'monospace' }}\n >\n Unresolved component: {element.componentName}\n </div>\n );\n}\n"],"names":["UnresolvedComponent","element","_jsxs","div","data-scene-unresolved-component","componentName","style","border","color","padding","fontFamily"],"mappings":";;;;AAAA;AACA;AAIA;;;;AAIC,IACM,SAASA,mBAAAA,CAAoB,EAAEC,OAAO,EAA4B,EAAA;AACrE,IAAA,qBACIC,eAAA,CAACC,KAAAA,EAAAA;AACGC,QAAAA,iCAAAA,EAAiCH,QAAQI,aAAa;QACtDC,KAAAA,EAAO;YAAEC,MAAAA,EAAQ,gBAAA;YAAkBC,KAAAA,EAAO,KAAA;YAAOC,OAAAA,EAAS,gBAAA;YAAkBC,UAAAA,EAAY;AAAY,SAAA;;AACvG,YAAA,wBAAA;AAC0BT,YAAAA,OAAAA,CAAQI;;;AAG3C;;;;"}
1
+ {"version":3,"file":"UnresolvedComponent.js","sources":["../../../renderer/UnresolvedComponent.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 { RegisteredComponentProps } from './ComponentRegistry';\n\n/**\n * The fallback rendered for an {@link ExternalComponent} whose `componentName` is not in the active\n * {@link ComponentRegistry} - a visibly broken placeholder, never a silent blank, since a missing\n * component is a real configuration gap the renderer should surface, not hide.\n */\nexport function UnresolvedComponent({ element }: RegisteredComponentProps) {\n return (\n <div\n data-scene-unresolved-component={element.componentName}\n style={{ border: '1px dashed red', color: 'red', padding: '0.25rem 0.5rem', fontFamily: 'monospace' }}\n >\n Unresolved component: {element.componentName}\n </div>\n );\n}\n"],"names":["UnresolvedComponent","element","_jsxs","div","data-scene-unresolved-component","componentName","style","border","color","padding","fontFamily"],"mappings":";;;;AAAA;AACA;AAIA;;;;AAIC,IACM,SAASA,mBAAAA,CAAoB,EAAEC,OAAO,EAA4B,EAAA;AACrE,IAAA,qBACIC,eAAA,CAACC,KAAAA,EAAAA;AACGC,QAAAA,iCAAAA,EAAiCH,QAAQI,aAAa;QACtDC,KAAAA,EAAO;YAAEC,MAAAA,EAAQ,gBAAA;YAAkBC,KAAAA,EAAO,KAAA;YAAOC,OAAAA,EAAS,gBAAA;YAAkBC,UAAAA,EAAY;AAAY,SAAA;;AACvG,YAAA,wBAAA;AAC0BT,YAAAA,OAAAA,CAAQI;;;AAG3C;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"createReactRenderer.js","sources":["../../../renderer/createReactRenderer.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, createElement } from 'react';\nimport { Renderer } from '@cratis/scene.engine';\nimport { ContentControl, ExternalComponent, ItemsControl, Panel } from '@cratis/scene.model';\nimport { ComponentRegistry } from './ComponentRegistry';\nimport { childStyle, panelStyle } from './panelLayout';\nimport { UnresolvedComponent } from './UnresolvedComponent';\n\n/**\n * Creates a {@link Renderer} that turns a Scene element tree into React elements.\n *\n * `ItemsControl` and `ContentControl` render as plain wrapping `div`s. A `Panel` renders as the\n * arrangement it declares - a grid, a stack, a wrap or a dock - because that is what those panels are\n * for; see `panelLayout` for the mapping. Arranging a *layout's slots* by `flow`/`freeform` is a\n * different thing and stays Scene#4's, layered on top of this renderer rather than folded into it.\n */\nexport function createReactRenderer(registry: ComponentRegistry): Renderer<ReactNode> {\n return {\n renderContentControl(element: ContentControl, content: ReactNode): ReactNode {\n return createElement('div', { key: element.id, 'data-scene-id': element.id, 'data-scene-kind': 'ContentControl' }, content);\n },\n\n renderItemsControl(element: ItemsControl, items: ReactNode[]): ReactNode {\n return createElement('div', { key: element.id, 'data-scene-id': element.id, 'data-scene-kind': 'ItemsControl' }, items);\n },\n\n renderExternalComponent(element: ExternalComponent, slots: Record<string, ReactNode[]>): ReactNode {\n const Component = registry[element.componentName] ?? UnresolvedComponent;\n return createElement(Component, { key: element.id, element, slots });\n },\n\n renderPanel(element: Panel, children: ReactNode[]): ReactNode {\n // The rendered children arrive in the same order as `element.children`, so a panel that places\n // its children individually - a grid cell, a docked edge - can wrap each one in the box that\n // places it without needing to re-render anything.\n const placed = children.map((child, index) => {\n const style = childStyle(element, element.children[index], index);\n return style\n ? createElement('div', { key: `${element.id}-${index}`, 'data-scene-placement': index, style }, child)\n : child;\n });\n\n return createElement(\n 'div',\n { key: element.id, 'data-scene-id': element.id, 'data-scene-kind': 'Panel', style: panelStyle(element) },\n placed);\n },\n };\n}\n"],"names":["createReactRenderer","registry","renderContentControl","element","content","createElement","key","id","renderItemsControl","items","renderExternalComponent","slots","Component","componentName","UnresolvedComponent","renderPanel","children","placed","map","child","index","style","childStyle","panelStyle"],"mappings":";;;;;;AAAA;AACA;AASA;;;;;;;IAQO,SAASA,mBAAAA,CAAoBC,QAA2B,EAAA;IAC3D,OAAO;QACHC,oBAAAA,CAAAA,CAAqBC,OAAuB,EAAEC,OAAkB,EAAA;AAC5D,YAAA,qBAAOC,oBAAc,KAAA,EAAO;AAAEC,gBAAAA,GAAAA,EAAKH,QAAQI,EAAE;AAAE,gBAAA,eAAA,EAAiBJ,QAAQI,EAAE;gBAAE,iBAAA,EAAmB;aAAiB,EAAGH,OAAAA,CAAAA;AACvH,QAAA,CAAA;QAEAI,kBAAAA,CAAAA,CAAmBL,OAAqB,EAAEM,KAAkB,EAAA;AACxD,YAAA,qBAAOJ,oBAAc,KAAA,EAAO;AAAEC,gBAA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;"}
1
+ {"version":3,"file":"createReactRenderer.js","sources":["../../../renderer/createReactRenderer.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, createElement } from 'react';\nimport { Renderer } from '@cratis/scene.engine';\nimport { ContentControl, ExternalComponent, ItemsControl, Panel } from '@cratis/scene.model';\nimport { ComponentRegistry } from './ComponentRegistry';\nimport { childStyle, panelStyle } from './panelLayout';\nimport { UnresolvedComponent } from './UnresolvedComponent';\n\n/**\n * Creates a {@link Renderer} that turns a Scene element tree into React elements.\n *\n * `ItemsControl` and `ContentControl` render as plain wrapping `div`s. A `Panel` renders as the\n * arrangement it declares - a grid, a stack, a wrap or a dock - because that is what those panels are\n * for; see `panelLayout` for the mapping. Arranging a *layout's slots* by `flow`/`freeform` is a\n * different thing and stays Scene#4's, layered on top of this renderer rather than folded into it.\n */\nexport function createReactRenderer(registry: ComponentRegistry): Renderer<ReactNode> {\n return {\n renderContentControl(element: ContentControl, content: ReactNode): ReactNode {\n return createElement('div', { key: element.id, 'data-scene-id': element.id, 'data-scene-kind': 'ContentControl' }, content);\n },\n\n renderItemsControl(element: ItemsControl, items: ReactNode[]): ReactNode {\n return createElement('div', { key: element.id, 'data-scene-id': element.id, 'data-scene-kind': 'ItemsControl' }, items);\n },\n\n renderExternalComponent(element: ExternalComponent, slots: Record<string, ReactNode[]>): ReactNode {\n const Component = registry[element.componentName] ?? UnresolvedComponent;\n return createElement(Component, { key: element.id, element, slots });\n },\n\n renderPanel(element: Panel, children: ReactNode[]): ReactNode {\n // The rendered children arrive in the same order as `element.children`, so a panel that places\n // its children individually - a grid cell, a docked edge - can wrap each one in the box that\n // places it without needing to re-render anything.\n const placed = children.map((child, index) => {\n const style = childStyle(element, element.children[index], index);\n return style\n ? createElement('div', { key: `${element.id}-${index}`, 'data-scene-placement': index, style }, child)\n : child;\n });\n\n return createElement(\n 'div',\n { key: element.id, 'data-scene-id': element.id, 'data-scene-kind': 'Panel', style: panelStyle(element) },\n placed);\n },\n };\n}\n"],"names":["createReactRenderer","registry","renderContentControl","element","content","createElement","key","id","renderItemsControl","items","renderExternalComponent","slots","Component","componentName","UnresolvedComponent","renderPanel","children","placed","map","child","index","style","childStyle","panelStyle"],"mappings":";;;;;;AAAA;AACA;AASA;;;;;;;IAQO,SAASA,mBAAAA,CAAoBC,QAA2B,EAAA;IAC3D,OAAO;QACHC,oBAAAA,CAAAA,CAAqBC,OAAuB,EAAEC,OAAkB,EAAA;AAC5D,YAAA,qBAAOC,oBAAc,KAAA,EAAO;AAAEC,gBAAAA,GAAAA,EAAKH,QAAQI,EAAE;AAAE,gBAAA,eAAA,EAAiBJ,QAAQI,EAAE;gBAAE,iBAAA,EAAmB;aAAiB,EAAGH,OAAAA,CAAAA;AACvH,QAAA,CAAA;QAEAI,kBAAAA,CAAAA,CAAmBL,OAAqB,EAAEM,KAAkB,EAAA;AACxD,YAAA,qBAAOJ,oBAAc,KAAA,EAAO;AAAEC,gBAAAA,GAAAA,EAAKH,QAAQI,EAAE;AAAE,gBAAA,eAAA,EAAiBJ,QAAQI,EAAE;gBAAE,iBAAA,EAAmB;aAAe,EAAGE,KAAAA,CAAAA;AACrH,QAAA,CAAA;QAEAC,uBAAAA,CAAAA,CAAwBP,OAA0B,EAAEQ,KAAkC,EAAA;AAClF,YAAA,MAAMC,YAAYX,QAAQ,CAACE,OAAAA,CAAQU,aAAa,CAAC,IAAIC,uCAAAA;AACrD,YAAA,qBAAOT,oBAAcO,SAAAA,EAAW;AAAEN,gBAAAA,GAAAA,EAAKH,QAAQI,EAAE;AAAEJ,gBAAAA,OAAAA;AAASQ,gBAAAA;AAAM,aAAA,CAAA;AACtE,QAAA,CAAA;QAEAI,WAAAA,CAAAA,CAAYZ,OAAc,EAAEa,QAAqB,EAAA;;;;AAI7C,YAAA,MAAMC,MAAAA,GAASD,QAAAA,CAASE,GAAG,CAAC,CAACC,KAAAA,EAAOC,KAAAA,GAAAA;AACh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