@genesislcap/foundation-layout 14.368.0 → 14.369.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 (32) hide show
  1. package/dist/custom-elements.json +142 -3
  2. package/dist/dts/index.d.ts +2 -1
  3. package/dist/dts/index.d.ts.map +1 -1
  4. package/dist/dts/main/layout-item.d.ts +20 -0
  5. package/dist/dts/main/layout-item.d.ts.map +1 -1
  6. package/dist/dts/main/layout-main.d.ts +36 -8
  7. package/dist/dts/main/layout-main.d.ts.map +1 -1
  8. package/dist/dts/utils/factory-registry.d.ts +63 -0
  9. package/dist/dts/utils/factory-registry.d.ts.map +1 -0
  10. package/dist/dts/utils/index.d.ts +1 -0
  11. package/dist/dts/utils/index.d.ts.map +1 -1
  12. package/dist/dts/utils/types.d.ts +44 -3
  13. package/dist/dts/utils/types.d.ts.map +1 -1
  14. package/dist/esm/index.js +1 -0
  15. package/dist/esm/main/layout-item.js +26 -4
  16. package/dist/esm/main/layout-main.js +169 -46
  17. package/dist/esm/utils/factory-registry.js +88 -0
  18. package/dist/esm/utils/index.js +1 -0
  19. package/dist/foundation-layout.api.json +206 -9
  20. package/dist/foundation-layout.d.ts +156 -9
  21. package/docs/FRAMEWORK_COMPONENTS.md +568 -0
  22. package/docs/api/foundation-layout.componentfactory.md +46 -0
  23. package/docs/api/foundation-layout.foundationlayout.md +2 -2
  24. package/docs/api/foundation-layout.foundationlayout.registeritem.md +31 -7
  25. package/docs/api/foundation-layout.foundationlayoutitem.md +2 -0
  26. package/docs/api/foundation-layout.foundationlayoutitem.registration.md +18 -0
  27. package/docs/api/foundation-layout.getfactory.md +56 -0
  28. package/docs/api/foundation-layout.md +59 -0
  29. package/docs/api/foundation-layout.registerfactory.md +94 -0
  30. package/docs/api/foundation-layout.unregisterfactory.md +63 -0
  31. package/docs/api-report.md.api.md +20 -7
  32. package/package.json +12 -12
@@ -21,6 +21,8 @@ This element is used to wrap html elements and configure their layout settings a
21
21
 
22
22
  This is a simple component which is only used to define the layout splits; any JavaScript API interactions or custom styling is used via [FoundationLayout](./foundation-layout.foundationlayout.md)<!-- -->.
23
23
 
24
+ The item can either use slotted content or a factory function registered via [registerFactory()](./foundation-layout.registerfactory.md)<!-- -->. When a factory is registered with the same name as the registration attribute, it takes precedence over slotted content.
25
+
24
26
  ## Properties
25
27
 
26
28
  <table><thead><tr><th>
@@ -16,3 +16,21 @@ registration: string;
16
16
 
17
17
  Items added via the JavaScript API and HTML API share the same pool of registration names. Using a duplicate registration name is a runtime error. This registration name defaults to the number of the window it is. It is highly recommended if you are using the JavaScript API that you set a registration name here manually.
18
18
 
19
+ When using the declarative API with framework components, register a factory function via [registerFactory()](./foundation-layout.registerfactory.md) using the same name as this registration attribute.
20
+
21
+ ## Example
22
+
23
+
24
+ ```typescript
25
+ import { registerFactory } from '@genesislcap/foundation-layout';
26
+ import { reactFactory } from './utils/react-layout-factory';
27
+
28
+ // Register factory with the same name as the registration
29
+ registerFactory('my-component', reactFactory(MyComponent));
30
+ ```
31
+ Then in JSX/HTML:
32
+
33
+ ```tsx
34
+ <rapid-layout-item registration="my-component" title="My Component" />
35
+ ```
36
+
@@ -0,0 +1,56 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-layout](./foundation-layout.md) &gt; [getFactory](./foundation-layout.getfactory.md)
4
+
5
+ ## getFactory() function
6
+
7
+ Retrieves a factory function by its key.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function getFactory(key: string): ComponentFactory | undefined;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ key
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+ The unique identifier for the factory.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+
51
+ **Returns:**
52
+
53
+ [ComponentFactory](./foundation-layout.componentfactory.md) \| undefined
54
+
55
+ The factory function, or undefined if not found.
56
+
@@ -69,6 +69,54 @@ Top level web component which is used to initialise a custom layout
69
69
 
70
70
 
71
71
 
72
+ </td></tr>
73
+ </tbody></table>
74
+
75
+ ## Functions
76
+
77
+ <table><thead><tr><th>
78
+
79
+ Function
80
+
81
+
82
+ </th><th>
83
+
84
+ Description
85
+
86
+
87
+ </th></tr></thead>
88
+ <tbody><tr><td>
89
+
90
+ [getFactory(key)](./foundation-layout.getfactory.md)
91
+
92
+
93
+ </td><td>
94
+
95
+ Retrieves a factory function by its key.
96
+
97
+
98
+ </td></tr>
99
+ <tr><td>
100
+
101
+ [registerFactory(key, factory)](./foundation-layout.registerfactory.md)
102
+
103
+
104
+ </td><td>
105
+
106
+ Registers a factory function with a unique key. This allows framework components to be used in the declarative layout API without needing to pass function references through HTML attributes.
107
+
108
+
109
+ </td></tr>
110
+ <tr><td>
111
+
112
+ [unregisterFactory(key)](./foundation-layout.unregisterfactory.md)
113
+
114
+
115
+ </td><td>
116
+
117
+ Removes a factory from the registry. This is useful for cleanup when a component is unmounted or no longer needed.
118
+
119
+
72
120
  </td></tr>
73
121
  </tbody></table>
74
122
 
@@ -233,6 +281,17 @@ Description
233
281
  </th></tr></thead>
234
282
  <tbody><tr><td>
235
283
 
284
+ [ComponentFactory](./foundation-layout.componentfactory.md)
285
+
286
+
287
+ </td><td>
288
+
289
+ Factory function for creating component instances in the layout.
290
+
291
+
292
+ </td></tr>
293
+ <tr><td>
294
+
236
295
  [CustomButton](./foundation-layout.custombutton.md)
237
296
 
238
297
 
@@ -0,0 +1,94 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-layout](./foundation-layout.md) &gt; [registerFactory](./foundation-layout.registerfactory.md)
4
+
5
+ ## registerFactory() function
6
+
7
+ Registers a factory function with a unique key. This allows framework components to be used in the declarative layout API without needing to pass function references through HTML attributes.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function registerFactory(key: string, factory: ComponentFactory): void;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ key
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+ Unique identifier for the factory. Should be descriptive and unique across the application.
46
+
47
+
48
+ </td></tr>
49
+ <tr><td>
50
+
51
+ factory
52
+
53
+
54
+ </td><td>
55
+
56
+ [ComponentFactory](./foundation-layout.componentfactory.md)
57
+
58
+
59
+ </td><td>
60
+
61
+ The factory function that creates the component.
62
+
63
+
64
+ </td></tr>
65
+ </tbody></table>
66
+
67
+ **Returns:**
68
+
69
+ void
70
+
71
+ ## Exceptions
72
+
73
+ {<!-- -->Error<!-- -->} If a factory with the same key is already registered.
74
+
75
+ ## Example
76
+
77
+
78
+ ```typescript
79
+ // React example
80
+ import { registerFactory } from '@genesislcap/foundation-layout';
81
+ import { reactFactory } from './utils/react-layout-factory';
82
+ import { MyComponent } from './components/MyComponent';
83
+
84
+ registerFactory('my-component', reactFactory(MyComponent, { someProp: 'value' }));
85
+ ```
86
+ Then in your JSX:
87
+
88
+ ```tsx
89
+ <rapid-layout-item
90
+ registration="my-item"
91
+ title="My Component"
92
+ />
93
+ ```
94
+
@@ -0,0 +1,63 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-layout](./foundation-layout.md) &gt; [unregisterFactory](./foundation-layout.unregisterfactory.md)
4
+
5
+ ## unregisterFactory() function
6
+
7
+ Removes a factory from the registry. This is useful for cleanup when a component is unmounted or no longer needed.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function unregisterFactory(key: string): boolean;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ key
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+ The unique identifier for the factory to remove.
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+
51
+ **Returns:**
52
+
53
+ boolean
54
+
55
+ True if the factory was found and removed, false otherwise.
56
+
57
+ ## Example
58
+
59
+
60
+ ```typescript
61
+ unregisterFactory('my-component');
62
+ ```
63
+
@@ -14,6 +14,9 @@ import { ResolvedLayoutConfig } from '@genesis-community/golden-layout';
14
14
  import { RootItemConfig } from '@genesis-community/golden-layout';
15
15
  import { ViewTemplate } from '@microsoft/fast-element';
16
16
 
17
+ // @public
18
+ export type ComponentFactory = (container: HTMLElement) => void | (() => void);
19
+
17
20
  // @public
18
21
  export type CustomButton = {
19
22
  svg: string;
@@ -36,7 +39,7 @@ export class FoundationLayout extends FoundationElement implements LayoutCompone
36
39
  addItemFromChild<T extends RootItemConfig>(item: T): T;
37
40
  autoSaveKey?: string;
38
41
  // @internal
39
- cacheElementsAndRegister({ elements, id }: RegistrationConfig): string;
42
+ cacheElementsAndRegister(config: RegistrationConfig): string;
40
43
  class: "FoundationLayoutMain";
41
44
  clearAutosaveAndRevertToDefault(): boolean;
42
45
  // @internal (undocumented)
@@ -57,7 +60,7 @@ export class FoundationLayout extends FoundationElement implements LayoutCompone
57
60
  // @beta
58
61
  popoutConfig: string | undefined;
59
62
  registeredItems(): string[];
60
- registerItem(registration: string, elements: Element[]): string;
63
+ registerItem(registration: string, elementsOrFactory: Element[] | ComponentFactory): string;
61
64
  reloadBuffer: number;
62
65
  removeItems(registration: string, force?: boolean): number;
63
66
  // @internal
@@ -129,6 +132,9 @@ export class FoundationLayoutRegion extends FoundationElement implements LayoutC
129
132
  type: LayoutRegionType;
130
133
  }
131
134
 
135
+ // @public
136
+ export function getFactory(key: string): ComponentFactory | undefined;
137
+
132
138
  // @public
133
139
  export const LAYOUT_ICONS: {
134
140
  readonly renameSVG: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHdpZHRoPSI0NTAiIGhlaWdodD0iNDUwIiB2aWV3Qm94PSIwIDAgNDUwIDQ1MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PGcgdHJhbnNmb3JtPSJtYXRyaXgoMTguNjEgMCAwIDE4LjYxIDIyMi44MSAyMjIuODEpIiBpZD0iT3V0bGluZSIgID48cGF0aCBzdHlsZT0ic3Ryb2tlOiBub25lOyBzdHJva2Utd2lkdGg6IDE7IHN0cm9rZS1kYXNoYXJyYXk6IG5vbmU7IHN0cm9rZS1saW5lY2FwOiBidXR0OyBzdHJva2UtZGFzaG9mZnNldDogMDsgc3Ryb2tlLWxpbmVqb2luOiBtaXRlcjsgc3Ryb2tlLW1pdGVybGltaXQ6IDQ7IGZpbGw6IHJnYigxMTEsMTI2LDEzNSk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiICB0cmFuc2Zvcm09IiB0cmFuc2xhdGUoLTExLjk2LCAtMTIuMDQpIiBkPSJNIDIyLjg1MyAxLjE0OCBhIDMuNjI2IDMuNjI2IDAgMCAwIC01LjEyNCAwIEwgMS40NjUgMTcuNDEyIEEgNC45NjggNC45NjggMCAwIDAgMCAyMC45NDcgViAyMyBhIDEgMSAwIDAgMCAxIDEgSCAzLjA1MyBhIDQuOTY2IDQuOTY2IDAgMCAwIDMuNTM1IC0xLjQ2NCBMIDIyLjg1MyA2LjI3MSBBIDMuNjI2IDMuNjI2IDAgMCAwIDIyLjg1MyAxLjE0OCBaIE0gNS4xNzQgMjEuMTIyIEEgMy4wMjIgMy4wMjIgMCAwIDEgMy4wNTMgMjIgSCAyIFYgMjAuOTQ3IGEgMi45OCAyLjk4IDAgMCAxIDAuODc5IC0yLjEyMSBMIDE1LjIyMiA2LjQ4MyBsIDIuMyAyLjMgWiBNIDIxLjQzOCA0Ljg1NyBMIDE4LjkzMiA3LjM2NCBsIC0yLjMgLTIuMjk1IGwgMi41MDcgLTIuNTA3IGEgMS42MjMgMS42MjMgMCAxIDEgMi4yOTUgMi4zIFoiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgLz48L2c+PC9zdmc+Cg==";
@@ -215,15 +221,19 @@ export interface RegisteredElementConfig {
215
221
  title?: string;
216
222
  }
217
223
 
224
+ // @public
225
+ export function registerFactory(key: string, factory: ComponentFactory): void;
226
+
218
227
  // Warning: (ae-internal-missing-underscore) The name "RegistrationConfig" should be prefixed with an underscore because the declaration is marked as @internal
219
228
  //
220
229
  // @internal (undocumented)
221
- export interface RegistrationConfig {
222
- // (undocumented)
223
- elements: Element[];
224
- // (undocumented)
230
+ export type RegistrationConfig = {
225
231
  id?: string;
226
- }
232
+ } & ({
233
+ elements: Element[];
234
+ } | {
235
+ factory: ComponentFactory;
236
+ });
227
237
 
228
238
  // @public
229
239
  export type SerialisedLayout = {
@@ -231,6 +241,9 @@ export type SerialisedLayout = {
231
241
  c: ResolvedLayoutConfig;
232
242
  };
233
243
 
244
+ // @public
245
+ export function unregisterFactory(key: string): boolean;
246
+
234
247
  // (No @packageDocumentation comment for this package)
235
248
 
236
249
  ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-layout",
3
3
  "description": "Genesis Foundation UI App Layout",
4
- "version": "14.368.0",
4
+ "version": "14.369.0",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/esm/index.js",
7
7
  "types": "dist/foundation-layout.d.ts",
@@ -36,19 +36,19 @@
36
36
  }
37
37
  },
38
38
  "devDependencies": {
39
- "@genesislcap/foundation-testing": "14.368.0",
40
- "@genesislcap/genx": "14.368.0",
41
- "@genesislcap/rollup-builder": "14.368.0",
42
- "@genesislcap/ts-builder": "14.368.0",
43
- "@genesislcap/uvu-playwright-builder": "14.368.0",
44
- "@genesislcap/vite-builder": "14.368.0",
45
- "@genesislcap/webpack-builder": "14.368.0"
39
+ "@genesislcap/foundation-testing": "14.369.0",
40
+ "@genesislcap/genx": "14.369.0",
41
+ "@genesislcap/rollup-builder": "14.369.0",
42
+ "@genesislcap/ts-builder": "14.369.0",
43
+ "@genesislcap/uvu-playwright-builder": "14.369.0",
44
+ "@genesislcap/vite-builder": "14.369.0",
45
+ "@genesislcap/webpack-builder": "14.369.0"
46
46
  },
47
47
  "dependencies": {
48
48
  "@genesis-community/golden-layout": "^2.11.0",
49
- "@genesislcap/foundation-comms": "14.368.0",
50
- "@genesislcap/foundation-logger": "14.368.0",
51
- "@genesislcap/foundation-utils": "14.368.0",
49
+ "@genesislcap/foundation-comms": "14.369.0",
50
+ "@genesislcap/foundation-logger": "14.369.0",
51
+ "@genesislcap/foundation-utils": "14.369.0",
52
52
  "@microsoft/fast-components": "2.30.6",
53
53
  "@microsoft/fast-element": "1.14.0",
54
54
  "@microsoft/fast-foundation": "2.49.6"
@@ -62,5 +62,5 @@
62
62
  "access": "public"
63
63
  },
64
64
  "customElements": "dist/custom-elements.json",
65
- "gitHead": "698eab45797054e3c04d32edb44aecadcbb0095e"
65
+ "gitHead": "f733a868a4f3e947a51564b5f3fcc592804bd917"
66
66
  }