@cratis/scene.react 4.2.0 → 4.3.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 (111) hide show
  1. package/SceneElementView.tsx +13 -4
  2. package/core/CoreNavigationBar.tsx +53 -0
  3. package/core/coreComponents.ts +2 -0
  4. package/core/coreDescriptors.ts +75 -0
  5. package/core/corePackage.ts +3 -0
  6. package/core/index.ts +2 -0
  7. package/dist/cjs/SceneElementView.js +6 -2
  8. package/dist/cjs/SceneElementView.js.map +1 -1
  9. package/dist/cjs/core/CoreNavigationBar.js +49 -0
  10. package/dist/cjs/core/CoreNavigationBar.js.map +1 -0
  11. package/dist/cjs/core/coreComponents.js +3 -1
  12. package/dist/cjs/core/coreComponents.js.map +1 -1
  13. package/dist/cjs/core/coreDescriptors.js +162 -0
  14. package/dist/cjs/core/coreDescriptors.js.map +1 -0
  15. package/dist/cjs/core/corePackage.js +5 -2
  16. package/dist/cjs/core/corePackage.js.map +1 -1
  17. package/dist/cjs/index.js +4 -0
  18. package/dist/cjs/index.js.map +1 -1
  19. package/dist/cjs/packages/ScenePackageBundle.js +33 -1
  20. package/dist/cjs/packages/ScenePackageBundle.js.map +1 -1
  21. package/dist/esm/SceneElementView.d.ts +3 -2
  22. package/dist/esm/SceneElementView.d.ts.map +1 -1
  23. package/dist/esm/SceneElementView.js +7 -3
  24. package/dist/esm/SceneElementView.js.map +1 -1
  25. package/dist/esm/core/CoreNavigationBar.d.ts +3 -0
  26. package/dist/esm/core/CoreNavigationBar.d.ts.map +1 -0
  27. package/dist/esm/core/CoreNavigationBar.js +47 -0
  28. package/dist/esm/core/CoreNavigationBar.js.map +1 -0
  29. package/dist/esm/core/coreComponents.d.ts.map +1 -1
  30. package/dist/esm/core/coreComponents.js +3 -1
  31. package/dist/esm/core/coreComponents.js.map +1 -1
  32. package/dist/esm/core/coreDescriptors.d.ts +3 -0
  33. package/dist/esm/core/coreDescriptors.d.ts.map +1 -0
  34. package/dist/esm/core/coreDescriptors.js +160 -0
  35. package/dist/esm/core/coreDescriptors.js.map +1 -0
  36. package/dist/esm/core/corePackage.d.ts.map +1 -1
  37. package/dist/esm/core/corePackage.js +5 -2
  38. package/dist/esm/core/corePackage.js.map +1 -1
  39. package/dist/esm/core/index.d.ts +2 -0
  40. package/dist/esm/core/index.d.ts.map +1 -1
  41. package/dist/esm/core/index.js +2 -0
  42. package/dist/esm/core/index.js.map +1 -1
  43. package/dist/esm/index.js +2 -0
  44. package/dist/esm/index.js.map +1 -1
  45. package/dist/esm/packages/ScenePackageBundle.d.ts +2 -1
  46. package/dist/esm/packages/ScenePackageBundle.d.ts.map +1 -1
  47. package/dist/esm/packages/ScenePackageBundle.js +33 -1
  48. package/dist/esm/packages/ScenePackageBundle.js.map +1 -1
  49. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  50. package/package.json +11 -10
  51. package/packages/ScenePackageBundle.ts +49 -2
  52. package/NavBar/for_NavBar/when_rendering_navigation_contributions.tsx +0 -62
  53. package/NavBar/for_extractNavigationItem/when_extracting_from_a_navigation_contribution.ts +0 -53
  54. package/dist/esm/NavBar/for_NavBar/when_rendering_navigation_contributions.d.ts +0 -2
  55. package/dist/esm/NavBar/for_NavBar/when_rendering_navigation_contributions.d.ts.map +0 -1
  56. package/dist/esm/NavBar/for_NavBar/when_rendering_navigation_contributions.js +0 -53
  57. package/dist/esm/NavBar/for_NavBar/when_rendering_navigation_contributions.js.map +0 -1
  58. package/dist/esm/NavBar/for_extractNavigationItem/when_extracting_from_a_navigation_contribution.d.ts +0 -2
  59. package/dist/esm/NavBar/for_extractNavigationItem/when_extracting_from_a_navigation_contribution.d.ts.map +0 -1
  60. package/dist/esm/NavBar/for_extractNavigationItem/when_extracting_from_a_navigation_contribution.js +0 -45
  61. package/dist/esm/NavBar/for_extractNavigationItem/when_extracting_from_a_navigation_contribution.js.map +0 -1
  62. package/dist/esm/for_SceneElementView/when_rendering_a_tree.d.ts +0 -2
  63. package/dist/esm/for_SceneElementView/when_rendering_a_tree.d.ts.map +0 -1
  64. package/dist/esm/for_SceneElementView/when_rendering_a_tree.js +0 -44
  65. package/dist/esm/for_SceneElementView/when_rendering_a_tree.js.map +0 -1
  66. package/dist/esm/for_ScreenplayCoreComponents/when_rendering_a_translated_screen.d.ts +0 -2
  67. package/dist/esm/for_ScreenplayCoreComponents/when_rendering_a_translated_screen.d.ts.map +0 -1
  68. package/dist/esm/for_ScreenplayCoreComponents/when_rendering_a_translated_screen.js +0 -46
  69. package/dist/esm/for_ScreenplayCoreComponents/when_rendering_a_translated_screen.js.map +0 -1
  70. package/dist/esm/for_applyThemeTokens/when_switching_themes.d.ts +0 -2
  71. package/dist/esm/for_applyThemeTokens/when_switching_themes.d.ts.map +0 -1
  72. package/dist/esm/for_applyThemeTokens/when_switching_themes.js +0 -59
  73. package/dist/esm/for_applyThemeTokens/when_switching_themes.js.map +0 -1
  74. package/dist/esm/for_panelLayout/when_arranging_a_panel.d.ts +0 -2
  75. package/dist/esm/for_panelLayout/when_arranging_a_panel.d.ts.map +0 -1
  76. package/dist/esm/for_panelLayout/when_arranging_a_panel.js +0 -110
  77. package/dist/esm/for_panelLayout/when_arranging_a_panel.js.map +0 -1
  78. package/dist/esm/for_themeTokens/when_converting_a_token_name.d.ts +0 -2
  79. package/dist/esm/for_themeTokens/when_converting_a_token_name.d.ts.map +0 -1
  80. package/dist/esm/for_themeTokens/when_converting_a_token_name.js +0 -16
  81. package/dist/esm/for_themeTokens/when_converting_a_token_name.js.map +0 -1
  82. package/dist/esm/for_useInteractionHosts/when_a_document_asks_the_user_something.d.ts +0 -2
  83. package/dist/esm/for_useInteractionHosts/when_a_document_asks_the_user_something.d.ts.map +0 -1
  84. package/dist/esm/for_useInteractionHosts/when_a_document_asks_the_user_something.js +0 -73
  85. package/dist/esm/for_useInteractionHosts/when_a_document_asks_the_user_something.js.map +0 -1
  86. package/dist/esm/for_useInteractionHosts/when_the_host_cannot_do_what_was_asked.d.ts +0 -2
  87. package/dist/esm/for_useInteractionHosts/when_the_host_cannot_do_what_was_asked.d.ts.map +0 -1
  88. package/dist/esm/for_useInteractionHosts/when_the_host_cannot_do_what_was_asked.js +0 -43
  89. package/dist/esm/for_useInteractionHosts/when_the_host_cannot_do_what_was_asked.js.map +0 -1
  90. package/dist/esm/for_useInteractions/when_clicking_an_element_that_executes_a_command.d.ts +0 -2
  91. package/dist/esm/for_useInteractions/when_clicking_an_element_that_executes_a_command.d.ts.map +0 -1
  92. package/dist/esm/for_useInteractions/when_clicking_an_element_that_executes_a_command.js +0 -94
  93. package/dist/esm/for_useInteractions/when_clicking_an_element_that_executes_a_command.js.map +0 -1
  94. package/dist/esm/for_validatePackageBundle/when_the_bundle_and_manifest_disagree.d.ts +0 -2
  95. package/dist/esm/for_validatePackageBundle/when_the_bundle_and_manifest_disagree.d.ts.map +0 -1
  96. package/dist/esm/for_validatePackageBundle/when_the_bundle_and_manifest_disagree.js +0 -59
  97. package/dist/esm/for_validatePackageBundle/when_the_bundle_and_manifest_disagree.js.map +0 -1
  98. package/dist/esm/for_validatePackageBundle/when_the_bundle_matches_its_manifest.d.ts +0 -2
  99. package/dist/esm/for_validatePackageBundle/when_the_bundle_matches_its_manifest.d.ts.map +0 -1
  100. package/dist/esm/for_validatePackageBundle/when_the_bundle_matches_its_manifest.js +0 -8
  101. package/dist/esm/for_validatePackageBundle/when_the_bundle_matches_its_manifest.js.map +0 -1
  102. package/for_SceneElementView/when_rendering_a_tree.tsx +0 -53
  103. package/for_ScreenplayCoreComponents/when_rendering_a_translated_screen.tsx +0 -60
  104. package/for_applyThemeTokens/when_switching_themes.ts +0 -74
  105. package/for_panelLayout/when_arranging_a_panel.ts +0 -135
  106. package/for_themeTokens/when_converting_a_token_name.ts +0 -22
  107. package/for_useInteractionHosts/when_a_document_asks_the_user_something.tsx +0 -106
  108. package/for_useInteractionHosts/when_the_host_cannot_do_what_was_asked.tsx +0 -66
  109. package/for_useInteractions/when_clicking_an_element_that_executes_a_command.tsx +0 -141
  110. package/for_validatePackageBundle/when_the_bundle_and_manifest_disagree.ts +0 -72
  111. package/for_validatePackageBundle/when_the_bundle_matches_its_manifest.ts +0 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/scene.react",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "The React renderer implementing Scene.Engine's Renderer contract against real React/DOM.",
5
5
  "keywords": [
6
6
  "cratis",
@@ -24,7 +24,8 @@
24
24
  "files": [
25
25
  "dist",
26
26
  "**/*.ts",
27
- "**/*.tsx"
27
+ "**/*.tsx",
28
+ "!**/for_*/**"
28
29
  ],
29
30
  "main": "dist/cjs/index.js",
30
31
  "module": "dist/esm/index.js",
@@ -50,18 +51,18 @@
50
51
  "build-storybook": "storybook build"
51
52
  },
52
53
  "dependencies": {
53
- "@cratis/scene.engine": "4.2.0",
54
- "@cratis/scene.model": "4.2.0"
54
+ "@cratis/scene.engine": "4.3.0",
55
+ "@cratis/scene.model": "4.3.0"
55
56
  },
56
57
  "devDependencies": {
57
- "@cratis/scene.engine": "4.2.0",
58
- "@cratis/scene.model": "4.2.0",
59
- "@storybook/addon-links": "^10.6.0",
60
- "@storybook/react": "^10.6.0",
61
- "@storybook/react-vite": "^10.6.0",
58
+ "@cratis/scene.engine": "4.3.0",
59
+ "@cratis/scene.model": "4.3.0",
60
+ "@storybook/addon-links": "^10.6.1",
61
+ "@storybook/react": "^10.6.1",
62
+ "@storybook/react-vite": "^10.6.1",
62
63
  "react": "^19.3.0",
63
64
  "react-dom": "^19.3.0",
64
- "storybook": "^10.6.0"
65
+ "storybook": "^10.6.1"
65
66
  },
66
67
  "peerDependencies": {
67
68
  "react": "^18.0.0 || ^19.0.0",
@@ -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 { DialogTemplate, Layout, ScenePackage, Screen, ScreenTemplate, Theme } from '@cratis/scene.model';
4
+ import { ComponentDescriptor, DialogTemplate, Layout, PropertyValueType, ScenePackage, Screen, ScreenTemplate, Theme } from '@cratis/scene.model';
5
5
  import { ComponentRegistry } from '../renderer';
6
6
 
7
7
  /**
@@ -50,6 +50,14 @@ export interface ScenePackageBundle {
50
50
  */
51
51
  screens?: Screen[];
52
52
 
53
+ /**
54
+ * What can be edited on this package's components - one {@link ComponentDescriptor} per component that is
55
+ * editable at design time. They are data, so Studio reads them without rendering anything, and they travel with
56
+ * the components they describe rather than in a registry of their own. {@link validatePackageBundle} checks
57
+ * that every descriptor names a component the manifest declares.
58
+ */
59
+ descriptors?: ComponentDescriptor[];
60
+
53
61
  /**
54
62
  * The themes this package ships, if any.
55
63
  */
@@ -71,7 +79,8 @@ export function componentRegistryKey(packageName: string, componentName: string)
71
79
  }
72
80
 
73
81
  /**
74
- * Checks that a bundle provides everything its manifest declares, and declares everything it provides.
82
+ * Checks that a bundle provides everything its manifest declares, and declares everything it provides, and that
83
+ * every descriptor it ships is for a component it declares and is well formed.
75
84
  *
76
85
  * A manifest that promises a component the bundle does not register renders as `UnresolvedComponent` at
77
86
  * runtime — a blank box, far from where the mistake was made. A component registered but not declared is
@@ -123,6 +132,44 @@ export function validatePackageBundle(bundle: ScenePackageBundle): string[] {
123
132
  }
124
133
  }
125
134
 
135
+ problems.push(...validateDescriptors(bundle));
136
+ return problems;
137
+ }
138
+
139
+ function validateDescriptors(bundle: ScenePackageBundle): string[] {
140
+ const problems: string[] = [];
141
+ const declared = new Set(bundle.manifest.components.map((name) => componentRegistryKey(bundle.manifest.name, name)));
142
+ const described = new Set<string>();
143
+
144
+ for (const descriptor of bundle.descriptors ?? []) {
145
+ if (!declared.has(descriptor.component)) {
146
+ problems.push(`describes '${descriptor.component}', which the manifest does not declare as a component`);
147
+ }
148
+
149
+ if (described.has(descriptor.component)) {
150
+ problems.push(`describes '${descriptor.component}' more than once`);
151
+ }
152
+
153
+ described.add(descriptor.component);
154
+
155
+ const paths = new Set<string>();
156
+ for (const property of descriptor.properties) {
157
+ if (paths.has(property.path)) {
158
+ problems.push(`'${descriptor.component}' describes the property '${property.path}' more than once`);
159
+ }
160
+
161
+ paths.add(property.path);
162
+
163
+ if (property.valueType === PropertyValueType.Collection && property.item === undefined) {
164
+ problems.push(`'${descriptor.component}' describes the collection '${property.path}' without describing its items`);
165
+ }
166
+
167
+ if (property.valueType === PropertyValueType.Enum && (property.choices ?? []).length === 0) {
168
+ problems.push(`'${descriptor.component}' describes the enum '${property.path}' without choices`);
169
+ }
170
+ }
171
+ }
172
+
126
173
  return problems;
127
174
  }
128
175
 
@@ -1,62 +0,0 @@
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 { render, screen } from '@testing-library/react';
5
- import { Contribution, ExternalComponent, HorizontalAlignment, VerticalAlignment, Visibility } from '@cratis/scene.model';
6
- import { NavBar } from '../NavBar';
7
-
8
- function navigationContribution(id: string, properties: Record<string, unknown>, order?: number): Contribution {
9
- const content: ExternalComponent = {
10
- id,
11
- name: id,
12
- properties,
13
- visibility: Visibility.Visible,
14
- isEnabled: true,
15
- opacity: 1,
16
- size: {},
17
- zIndex: 0,
18
- minimumSize: {},
19
- maximumSize: {},
20
- margin: { left: 0, top: 0, right: 0, bottom: 0 },
21
- horizontalAlignment: HorizontalAlignment.Stretch,
22
- verticalAlignment: VerticalAlignment.Stretch,
23
- componentName: 'core:navigation-item',
24
- slots: {},
25
- };
26
- return { contributionPointName: 'Navigation', content, order };
27
- }
28
-
29
- describe('when rendering navigation contributions', () => {
30
- describe('and no item declares a group', () => {
31
- const contributions = [
32
- navigationContribution('adjustments', { label: 'Adjustments', targetScreen: 'Adjustments' }, 20),
33
- navigationContribution('invoices', { label: 'Invoices', targetScreen: 'InvoiceList' }, 10),
34
- ];
35
-
36
- beforeEach(() => {
37
- render(<NavBar contributions={contributions} renderRoute={item => `/${item.targetScreen}`} />);
38
- });
39
-
40
- it('should render every item as a link to its rendered route', () => {
41
- screen.getByRole('link', { name: 'Invoices' }).getAttribute('href')!.should.equal('/InvoiceList');
42
- screen.getByRole('link', { name: 'Adjustments' }).getAttribute('href')!.should.equal('/Adjustments');
43
- });
44
-
45
- it('should render items in aggregated order', () => {
46
- const links = screen.getAllByRole('link').map(link => link.textContent);
47
- links.should.deep.equal(['Invoices', 'Adjustments']);
48
- });
49
- });
50
-
51
- describe('and a contribution cannot be extracted into a navigation item', () => {
52
- const contributions = [navigationContribution('broken', { label: 'Broken' })];
53
-
54
- beforeEach(() => {
55
- render(<NavBar contributions={contributions} renderRoute={item => `/${item.targetScreen}`} />);
56
- });
57
-
58
- it('should skip it rather than render a broken link', () => {
59
- screen.queryAllByRole('link').should.have.lengthOf(0);
60
- });
61
- });
62
- });
@@ -1,53 +0,0 @@
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 { Contribution, ExternalComponent, HorizontalAlignment, NavigationItem, VerticalAlignment, Visibility } from '@cratis/scene.model';
5
- import { extractNavigationItem } from '../extractNavigationItem';
6
-
7
- function navigationContribution(properties: Record<string, unknown>, order?: number): Contribution {
8
- const content: ExternalComponent = {
9
- id: 'nav-item',
10
- name: 'nav-item',
11
- properties,
12
- visibility: Visibility.Visible,
13
- isEnabled: true,
14
- opacity: 1,
15
- size: {},
16
- zIndex: 0,
17
- minimumSize: {},
18
- maximumSize: {},
19
- margin: { left: 0, top: 0, right: 0, bottom: 0 },
20
- horizontalAlignment: HorizontalAlignment.Stretch,
21
- verticalAlignment: VerticalAlignment.Stretch,
22
- componentName: 'core:navigation-item',
23
- slots: {},
24
- };
25
- return { contributionPointName: 'Navigation', content, order };
26
- }
27
-
28
- describe('when extracting from a navigation contribution', () => {
29
- describe('and the required properties are present', () => {
30
- let result: NavigationItem | undefined;
31
-
32
- beforeEach(() => {
33
- result = extractNavigationItem(navigationContribution({ label: 'Invoices', targetScreen: 'InvoiceList', group: 'Sales' }, 10));
34
- });
35
-
36
- it('should extract the label', () => result!.label.should.equal('Invoices'));
37
- it('should extract the target screen', () => result!.targetScreen.should.equal('InvoiceList'));
38
- it('should extract the group', () => result!.group!.should.equal('Sales'));
39
- it('should fall back to the contribution order when the properties bag has none', () => result!.order!.should.equal(10));
40
- });
41
-
42
- describe('and the label is missing', () => {
43
- it('should return undefined', () => {
44
- (extractNavigationItem(navigationContribution({ targetScreen: 'InvoiceList' })) === undefined).should.be.true;
45
- });
46
- });
47
-
48
- describe('and the target screen is missing', () => {
49
- it('should return undefined', () => {
50
- (extractNavigationItem(navigationContribution({ label: 'Invoices' })) === undefined).should.be.true;
51
- });
52
- });
53
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=when_rendering_navigation_contributions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_rendering_navigation_contributions.d.ts","sourceRoot":"","sources":["../../../../NavBar/for_NavBar/when_rendering_navigation_contributions.tsx"],"names":[],"mappings":""}
@@ -1,53 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render, screen } from '@testing-library/react';
3
- import { HorizontalAlignment, VerticalAlignment, Visibility } from '@cratis/scene.model';
4
- import { NavBar } from '../NavBar';
5
- function navigationContribution(id, properties, order) {
6
- const content = {
7
- id,
8
- name: id,
9
- properties,
10
- visibility: Visibility.Visible,
11
- isEnabled: true,
12
- opacity: 1,
13
- size: {},
14
- zIndex: 0,
15
- minimumSize: {},
16
- maximumSize: {},
17
- margin: { left: 0, top: 0, right: 0, bottom: 0 },
18
- horizontalAlignment: HorizontalAlignment.Stretch,
19
- verticalAlignment: VerticalAlignment.Stretch,
20
- componentName: 'core:navigation-item',
21
- slots: {},
22
- };
23
- return { contributionPointName: 'Navigation', content, order };
24
- }
25
- describe('when rendering navigation contributions', () => {
26
- describe('and no item declares a group', () => {
27
- const contributions = [
28
- navigationContribution('adjustments', { label: 'Adjustments', targetScreen: 'Adjustments' }, 20),
29
- navigationContribution('invoices', { label: 'Invoices', targetScreen: 'InvoiceList' }, 10),
30
- ];
31
- beforeEach(() => {
32
- render(_jsx(NavBar, { contributions: contributions, renderRoute: item => `/${item.targetScreen}` }));
33
- });
34
- it('should render every item as a link to its rendered route', () => {
35
- screen.getByRole('link', { name: 'Invoices' }).getAttribute('href').should.equal('/InvoiceList');
36
- screen.getByRole('link', { name: 'Adjustments' }).getAttribute('href').should.equal('/Adjustments');
37
- });
38
- it('should render items in aggregated order', () => {
39
- const links = screen.getAllByRole('link').map(link => link.textContent);
40
- links.should.deep.equal(['Invoices', 'Adjustments']);
41
- });
42
- });
43
- describe('and a contribution cannot be extracted into a navigation item', () => {
44
- const contributions = [navigationContribution('broken', { label: 'Broken' })];
45
- beforeEach(() => {
46
- render(_jsx(NavBar, { contributions: contributions, renderRoute: item => `/${item.targetScreen}` }));
47
- });
48
- it('should skip it rather than render a broken link', () => {
49
- screen.queryAllByRole('link').should.have.lengthOf(0);
50
- });
51
- });
52
- });
53
- //# sourceMappingURL=when_rendering_navigation_contributions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_rendering_navigation_contributions.js","sourceRoot":"","sources":["../../../../NavBar/for_NavBar/when_rendering_navigation_contributions.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAmC,mBAAmB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC1H,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,SAAS,sBAAsB,CAAC,EAAU,EAAE,UAAmC,EAAE,KAAc;IAC3F,MAAM,OAAO,GAAsB;QAC/B,EAAE;QACF,IAAI,EAAE,EAAE;QACR,UAAU;QACV,UAAU,EAAE,UAAU,CAAC,OAAO;QAC9B,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,CAAC;QACT,WAAW,EAAE,EAAE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CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACzG,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;YAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACxE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,+DAA+D,EAAE,GAAG,EAAE;QAC3E,MAAM,aAAa,GAAG,CAAC,sBAAsB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;QAE9E,UAAU,CAAC,GAAG,EAAE;YACZ,MAAM,CAAC,KAAC,MAAM,IAAC,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE,GAAI,CAAC,CAAC;QACnG,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;YACvD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=when_extracting_from_a_navigation_contribution.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_extracting_from_a_navigation_contribution.d.ts","sourceRoot":"","sources":["../../../../NavBar/for_extractNavigationItem/when_extracting_from_a_navigation_contribution.ts"],"names":[],"mappings":""}
@@ -1,45 +0,0 @@
1
- import { HorizontalAlignment, VerticalAlignment, Visibility } from '@cratis/scene.model';
2
- import { extractNavigationItem } from '../extractNavigationItem';
3
- function navigationContribution(properties, order) {
4
- const content = {
5
- id: 'nav-item',
6
- name: 'nav-item',
7
- properties,
8
- visibility: Visibility.Visible,
9
- isEnabled: true,
10
- opacity: 1,
11
- size: {},
12
- zIndex: 0,
13
- minimumSize: {},
14
- maximumSize: {},
15
- margin: { left: 0, top: 0, right: 0, bottom: 0 },
16
- horizontalAlignment: HorizontalAlignment.Stretch,
17
- verticalAlignment: VerticalAlignment.Stretch,
18
- componentName: 'core:navigation-item',
19
- slots: {},
20
- };
21
- return { contributionPointName: 'Navigation', content, order };
22
- }
23
- describe('when extracting from a navigation contribution', () => {
24
- describe('and the required properties are present', () => {
25
- let result;
26
- beforeEach(() => {
27
- result = extractNavigationItem(navigationContribution({ label: 'Invoices', targetScreen: 'InvoiceList', group: 'Sales' }, 10));
28
- });
29
- it('should extract the label', () => result.label.should.equal('Invoices'));
30
- it('should extract the target screen', () => result.targetScreen.should.equal('InvoiceList'));
31
- it('should extract the group', () => result.group.should.equal('Sales'));
32
- it('should fall back to the contribution order when the properties bag has none', () => result.order.should.equal(10));
33
- });
34
- describe('and the label is missing', () => {
35
- it('should return undefined', () => {
36
- (extractNavigationItem(navigationContribution({ targetScreen: 'InvoiceList' })) === undefined).should.be.true;
37
- });
38
- });
39
- describe('and the target screen is missing', () => {
40
- it('should return undefined', () => {
41
- (extractNavigationItem(navigationContribution({ label: 'Invoices' })) === undefined).should.be.true;
42
- });
43
- });
44
- });
45
- //# sourceMappingURL=when_extracting_from_a_navigation_contribution.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_extracting_from_a_navigation_contribution.js","sourceRoot":"","sources":["../../../../NavBar/for_extractNavigationItem/when_extracting_from_a_navigation_contribution.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmC,mBAAmB,EAAkB,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC1I,OAAO,EAAE,qBAAqB,EAAE,MAAM,0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,CAAC,CAAC;QAC/F,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE,CAAC,MAAO,CAAC,KAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3E,EAAE,CAAC,6EAA6E,EAAE,GAAG,EAAE,CAAC,MAAO,CAAC,KAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7H,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACtC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;YAC/B,CAAC,qBAAqB,CAAC,sBAAsB,CAAC,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;QAClH,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC9C,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;YAC/B,CAAC,qBAAqB,CAAC,sBAAsB,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;QACxG,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=when_rendering_a_tree.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_rendering_a_tree.d.ts","sourceRoot":"","sources":["../../../for_SceneElementView/when_rendering_a_tree.tsx"],"names":[],"mappings":""}
@@ -1,44 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { expect } from 'chai';
3
- import { render, screen } from '@testing-library/react';
4
- import { HorizontalAlignment, VerticalAlignment, Visibility } from '@cratis/scene.model';
5
- import { SceneElementView } from '../SceneElementView';
6
- import { coreComponents } from '../core';
7
- function control(id) {
8
- return {
9
- id,
10
- name: id,
11
- properties: {},
12
- visibility: Visibility.Visible,
13
- isEnabled: true,
14
- opacity: 1,
15
- size: {},
16
- zIndex: 0,
17
- minimumSize: {},
18
- maximumSize: {},
19
- margin: { left: 0, top: 0, right: 0, bottom: 0 },
20
- horizontalAlignment: HorizontalAlignment.Stretch,
21
- verticalAlignment: VerticalAlignment.Stretch,
22
- borderThickness: { left: 0, top: 0, right: 0, bottom: 0 },
23
- padding: { left: 0, top: 0, right: 0, bottom: 0 },
24
- tabIndex: 0,
25
- };
26
- }
27
- describe('when rendering a tree', () => {
28
- describe('and every component resolves', () => {
29
- const text = { ...control('greeting'), componentName: 'core:text', properties: { text: 'Hello Scene' }, slots: {} };
30
- const card = { ...control('card'), componentName: 'core:card', slots: { content: [text] } };
31
- beforeEach(() => {
32
- render(_jsx(SceneElementView, { element: card, registry: coreComponents, resolveBinding: () => undefined }));
33
- });
34
- it('should render the nested core:text content', () => expect(screen.getByText('Hello Scene')).to.exist);
35
- });
36
- describe('and a component does not resolve', () => {
37
- const missing = { ...control('missing'), componentName: 'vendor:fancy-widget', slots: {} };
38
- beforeEach(() => {
39
- render(_jsx(SceneElementView, { element: missing, registry: coreComponents, resolveBinding: () => undefined }));
40
- });
41
- it('should render a visible unresolved-component placeholder', () => expect(screen.getByText('Unresolved component: vendor:fancy-widget')).to.exist);
42
- });
43
- });
44
- //# sourceMappingURL=when_rendering_a_tree.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_rendering_a_tree.js","sourceRoot":"","sources":["../../../for_SceneElementView/when_rendering_a_tree.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAA8B,mBAAmB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACrH,OA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,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QAE/G,UAAU,CAAC,GAAG,EAAE;YACZ,MAAM,CAAC,KAAC,gBAAgB,IAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,SAAS,GAAI,CAAC,CAAC;QAC3G,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAC7G,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC9C,MAAM,OAAO,GAAsB,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;QAE9G,UAAU,CAAC,GAAG,EAAE;YACZ,MAAM,CAAC,KAAC,gBAAgB,IAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,SAAS,GAAI,CAAC,CAAC;QAC9G,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE,CAChE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,2CAA2C,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACxF,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=when_rendering_a_translated_screen.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_rendering_a_translated_screen.d.ts","sourceRoot":"","sources":["../../../for_ScreenplayCoreComponents/when_rendering_a_translated_screen.tsx"],"names":[],"mappings":""}
@@ -1,46 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { expect } from 'chai';
3
- import { fireEvent, render, screen } from '@testing-library/react';
4
- import { HorizontalAlignment, VerticalAlignment, Visibility } from '@cratis/scene.model';
5
- import { SceneElementView } from '../SceneElementView';
6
- import { coreComponents } from '../core';
7
- function control(id) {
8
- return {
9
- id,
10
- name: id,
11
- properties: {},
12
- visibility: Visibility.Visible,
13
- isEnabled: true,
14
- opacity: 1,
15
- size: {},
16
- zIndex: 0,
17
- minimumSize: {},
18
- maximumSize: {},
19
- margin: { left: 0, top: 0, right: 0, bottom: 0 },
20
- horizontalAlignment: HorizontalAlignment.Stretch,
21
- verticalAlignment: VerticalAlignment.Stretch,
22
- borderThickness: { left: 0, top: 0, right: 0, bottom: 0 },
23
- padding: { left: 0, top: 0, right: 0, bottom: 0 },
24
- tabIndex: 0,
25
- };
26
- }
27
- const component = (id, componentName, properties = {}, slots = {}) => ({ ...control(id), componentName, properties, slots });
28
- describe('when rendering a translated Screenplay screen', () => {
29
- const title = component('title', 'core:title', { text: 'Invoices' });
30
- const action = component('create', 'core:action', { command: 'CreateInvoice', label: 'Create invoice' });
31
- const section = component('section', 'core:section', { name: 'Open invoices' }, { content: [title, action] });
32
- beforeEach(() => {
33
- render(_jsx(SceneElementView, { element: section, registry: coreComponents, resolveBinding: () => undefined }));
34
- });
35
- it('should render the section heading', () => expect(screen.getByRole('heading', { name: 'Open invoices' })).to.exist);
36
- it('should render the translated title', () => expect(screen.getByRole('heading', { name: 'Invoices' })).to.exist);
37
- it('should render the modeled action', () => expect(screen.getByRole('button', { name: 'Create invoice' })).to.exist);
38
- it('should announce the modeled command to the host', () => {
39
- let command = '';
40
- const listener = (event) => { command = event.detail.command; };
41
- globalThis.addEventListener('cratis.scene.command', listener, { once: true });
42
- fireEvent.click(screen.getByRole('button', { name: 'Create invoice' }));
43
- command.should.equal('CreateInvoice');
44
- });
45
- });
46
- //# sourceMappingURL=when_rendering_a_translated_screen.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_rendering_a_translated_screen.js","sourceRo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AAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IAEtH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACvD,IAAI,OAAO,GAAG,EAAE,CAAC;QACjB,MAAM,QAAQ,GAAG,CAAC,KAAY,EAAE,EAAE,GAAG,OAAO,GAAI,KAAqB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACxF,UAAU,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAE9E,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC;QAExE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=when_switching_themes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_switching_themes.d.ts","sourceRoot":"","sources":["../../../for_applyThemeTokens/when_switching_themes.ts"],"names":[],"mappings":""}
@@ -1,59 +0,0 @@
1
- import { JSDOM } from 'jsdom';
2
- import { applyThemeTokens } from '../index';
3
- const light = {
4
- name: 'Daylight',
5
- compatibleWith: ['core'],
6
- tokens: { 'primary.color': '#2563eb', 'surface.background': '#ffffff' },
7
- };
8
- const dark = {
9
- name: 'Midnight',
10
- compatibleWith: ['core'],
11
- isDark: true,
12
- tokens: { 'primary.color': '#60a5fa' },
13
- };
14
- describe('when switching themes', () => {
15
- const dom = new JSDOM('<div id="root"></div>');
16
- const element = dom.window.document.getElementById('root');
17
- applyThemeTokens(element, light);
18
- const afterLight = {
19
- primary: element.style.getPropertyValue('--scene-primary-color'),
20
- surface: element.style.getPropertyValue('--scene-surface-background'),
21
- theme: element.getAttribute('data-scene-theme'),
22
- scheme: element.getAttribute('data-scene-color-scheme'),
23
- };
24
- applyThemeTokens(element, dark, light);
25
- const afterDark = {
26
- primary: element.style.getPropertyValue('--scene-primary-color'),
27
- surface: element.style.getPropertyValue('--scene-surface-background'),
28
- theme: element.getAttribute('data-scene-theme'),
29
- scheme: element.getAttribute('data-scene-color-scheme'),
30
- };
31
- applyThemeTokens(element, undefined, dark);
32
- const afterClearing = {
33
- primary: element.style.getPropertyValue('--scene-primary-color'),
34
- theme: element.getAttribute('data-scene-theme'),
35
- };
36
- it('should write the first theme tokens as custom properties', () => {
37
- afterLight.primary.should.equal('#2563eb');
38
- afterLight.surface.should.equal('#ffffff');
39
- });
40
- it('should mark the element with the first theme name and scheme', () => {
41
- afterLight.theme.should.equal('Daylight');
42
- afterLight.scheme.should.equal('light');
43
- });
44
- it('should overwrite a token the next theme also defines', () => {
45
- afterDark.primary.should.equal('#60a5fa');
46
- });
47
- it('should remove a token the next theme does not define, rather than leaving it stale', () => {
48
- afterDark.surface.should.equal('');
49
- });
50
- it('should mark the element as dark for a dark theme', () => {
51
- afterDark.theme.should.equal('Midnight');
52
- afterDark.scheme.should.equal('dark');
53
- });
54
- it('should clear every token and marker when the theme is removed', () => {
55
- afterClearing.primary.should.equal('');
56
- (afterClearing.theme === null).should.be.true;
57
- });
58
- });
59
- //# sourceMappingURL=when_switching_themes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_switching_themes.js","sourceRoot":"","sources":["../../../for_applyThemeTokens/when_switching_themes.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,KAAK,GAAU;IACjB,IAAI,EAAE,UAAU;IAChB,cAAc,EAAE,CAAC,MAAM,CAAC;IACxB,MAAM,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,oBAAoB,EAAE,SAAS,EAAE;CAC1E,CAAC;AAEF,MAA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,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=when_arranging_a_panel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_arranging_a_panel.d.ts","sourceRoot":"","sources":["../../../for_panelLayout/when_arranging_a_panel.ts"],"names":[],"mappings":""}