@genesislcap/foundation-layout 10.3.1 → 11.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 (142) hide show
  1. package/README.md +98 -30
  2. package/dist/dts/index.d.ts +1 -1
  3. package/dist/dts/index.d.ts.map +1 -1
  4. package/dist/dts/main/index.d.ts +0 -1
  5. package/dist/dts/main/index.d.ts.map +1 -1
  6. package/dist/dts/main/layout-components.d.ts +1 -1
  7. package/dist/dts/main/layout-item.d.ts +7 -7
  8. package/dist/dts/main/layout-item.d.ts.map +1 -1
  9. package/dist/dts/main/layout-main.d.ts +71 -16
  10. package/dist/dts/main/layout-main.d.ts.map +1 -1
  11. package/dist/dts/main/layout-region.d.ts +4 -4
  12. package/dist/dts/main/layout-region.d.ts.map +1 -1
  13. package/dist/dts/styles/layout.styles.d.ts +1 -1
  14. package/dist/dts/utils/constants.d.ts +6 -1
  15. package/dist/dts/utils/constants.d.ts.map +1 -1
  16. package/dist/dts/utils/error.d.ts +2 -2
  17. package/dist/dts/utils/events.d.ts +6 -3
  18. package/dist/dts/utils/events.d.ts.map +1 -1
  19. package/dist/dts/utils/index.d.ts +1 -0
  20. package/dist/dts/utils/index.d.ts.map +1 -1
  21. package/dist/dts/utils/logger.d.ts.map +1 -1
  22. package/dist/dts/utils/types.d.ts +8 -4
  23. package/dist/dts/utils/types.d.ts.map +1 -1
  24. package/dist/esm/index.federated.js +0 -1
  25. package/dist/esm/index.js +1 -2
  26. package/dist/esm/main/index.js +0 -2
  27. package/dist/esm/main/layout-components.js +2 -3
  28. package/dist/esm/main/layout-item.js +3 -4
  29. package/dist/esm/main/layout-main.js +148 -39
  30. package/dist/esm/main/layout-region.js +3 -4
  31. package/dist/esm/styles/constants.js +0 -1
  32. package/dist/esm/styles/dragging.styles.js +0 -1
  33. package/dist/esm/styles/index.js +0 -1
  34. package/dist/esm/styles/layout.styles.js +1 -2
  35. package/dist/esm/utils/constants.js +6 -2
  36. package/dist/esm/utils/error.js +2 -3
  37. package/dist/esm/utils/events.js +5 -3
  38. package/dist/esm/utils/index.js +1 -1
  39. package/dist/esm/utils/logger.js +0 -1
  40. package/dist/esm/utils/misc.js +0 -1
  41. package/dist/esm/utils/templates.js +0 -1
  42. package/dist/esm/utils/types.js +0 -1
  43. package/dist/foundation-layout.api.json +180 -73
  44. package/dist/foundation-layout.d.ts +98 -56
  45. package/docs/api/foundation-layout.default_reload_buffer.md +0 -3
  46. package/docs/api/foundation-layout.foundationlayout.additem.md +0 -3
  47. package/docs/api/foundation-layout.foundationlayout.autosavekey.md +13 -0
  48. package/docs/api/foundation-layout.foundationlayout.dragging.md +0 -3
  49. package/docs/api/foundation-layout.foundationlayout.getlayout.md +0 -3
  50. package/docs/api/foundation-layout.foundationlayout.layoutrequiredregistrations.md +0 -3
  51. package/docs/api/foundation-layout.foundationlayout.loadlayout.md +4 -6
  52. package/docs/api/foundation-layout.foundationlayout.md +11 -11
  53. package/docs/api/foundation-layout.foundationlayout.missingitemplaceholder.md +13 -0
  54. package/docs/api/foundation-layout.foundationlayout.registereditems.md +0 -3
  55. package/docs/api/foundation-layout.foundationlayout.registeritem.md +0 -3
  56. package/docs/api/foundation-layout.foundationlayout.reloadbuffer.md +0 -3
  57. package/docs/api/foundation-layout.foundationlayout.tryloadlayoutfromlocalstorage.md +27 -0
  58. package/docs/api/foundation-layout.foundationlayoutcomponents.md +0 -3
  59. package/docs/api/foundation-layout.foundationlayoutitem.closable.md +0 -3
  60. package/docs/api/foundation-layout.foundationlayoutitem.md +4 -7
  61. package/docs/api/foundation-layout.foundationlayoutitem.registration.md +1 -4
  62. package/docs/api/foundation-layout.foundationlayoutitem.size.md +0 -3
  63. package/docs/api/foundation-layout.foundationlayoutitem.title.md +0 -3
  64. package/docs/api/foundation-layout.foundationlayoutregion.md +2 -5
  65. package/docs/api/foundation-layout.foundationlayoutregion.size.md +0 -3
  66. package/docs/api/foundation-layout.foundationlayoutregion.type.md +0 -3
  67. package/docs/api/foundation-layout.layoutemitevents.md +2 -4
  68. package/docs/api/foundation-layout.layoutreceiveevents.md +0 -3
  69. package/docs/api/foundation-layout.layoutreceiveeventsdetail.md +0 -3
  70. package/docs/api/foundation-layout.layoutregiontype.md +0 -3
  71. package/docs/api/foundation-layout.layoutregistrationerror._constructor_.md +0 -3
  72. package/docs/api/foundation-layout.layoutregistrationerror.md +1 -4
  73. package/docs/api/foundation-layout.layoutstyles.md +0 -3
  74. package/docs/api/foundation-layout.layouttemplate.md +0 -3
  75. package/docs/api/foundation-layout.layoutusageerror._constructor_.md +0 -3
  76. package/docs/api/foundation-layout.layoutusageerror.md +1 -4
  77. package/docs/api/foundation-layout.md +16 -16
  78. package/docs/api/foundation-layout.placement.md +0 -3
  79. package/docs/api/foundation-layout.registeredelementconfig.closable.md +0 -3
  80. package/docs/api/foundation-layout.registeredelementconfig.md +4 -7
  81. package/docs/api/foundation-layout.registeredelementconfig.registration.md +0 -3
  82. package/docs/api/foundation-layout.registeredelementconfig.size.md +0 -3
  83. package/docs/api/foundation-layout.registeredelementconfig.title.md +0 -3
  84. package/docs/api/foundation-layout.serialisedlayout.md +0 -3
  85. package/docs/api-report.md +23 -65
  86. package/docs/img/foundation-layout-example.png +0 -0
  87. package/jsdom.setup.ts +1 -0
  88. package/package.json +22 -8
  89. package/playwright.config.ts +23 -0
  90. package/test/unit/setupRegisterForTests.ts +30 -0
  91. package/test/unit/test.ts +1 -0
  92. package/dist/1.0.0.remoteEntry.js +0 -1
  93. package/dist/191.191.106ece7a41ded6731029.js +0 -2
  94. package/dist/191.9a61143c2afb6057ad1bae886d5d1a6e.js.map +0 -1
  95. package/dist/259.09c601e5288d875caab4df1e2354c0ea.js.map +0 -1
  96. package/dist/259.259.216fcad43e9a38888e08.js +0 -2
  97. package/dist/415.415.094780a1a1162c7e5f1c.js +0 -3
  98. package/dist/415.415.094780a1a1162c7e5f1c.js.LICENSE.txt +0 -4
  99. package/dist/415.fcfb4f02eaecbfa31fc322639f244245.js.map +0 -1
  100. package/dist/459.459.6afc33f49546607f9227.js +0 -515
  101. package/dist/459.57760bcb7fc239af5b5953687ad192ff.js.map +0 -1
  102. package/dist/623.623.0e7e8f23454ee96ed9c8.js +0 -3
  103. package/dist/623.623.0e7e8f23454ee96ed9c8.js.LICENSE.txt +0 -4
  104. package/dist/623.e8f211473f9034c4157d362efb017821.js.map +0 -1
  105. package/dist/755.718e14af7194fb741f98580b24b2bb8f.js.map +0 -1
  106. package/dist/755.755.f93ee58c2b836a669ec4.js +0 -2
  107. package/dist/dashboard.json +0 -1
  108. package/dist/esm/index.federated.js.map +0 -1
  109. package/dist/esm/index.js.map +0 -1
  110. package/dist/esm/main/index.js.map +0 -1
  111. package/dist/esm/main/layout-components.js.map +0 -1
  112. package/dist/esm/main/layout-item.js.map +0 -1
  113. package/dist/esm/main/layout-main.js.map +0 -1
  114. package/dist/esm/main/layout-region.js.map +0 -1
  115. package/dist/esm/styles/constants.js.map +0 -1
  116. package/dist/esm/styles/dragging.styles.js.map +0 -1
  117. package/dist/esm/styles/index.js.map +0 -1
  118. package/dist/esm/styles/layout.styles.js.map +0 -1
  119. package/dist/esm/utils/constants.js.map +0 -1
  120. package/dist/esm/utils/error.js.map +0 -1
  121. package/dist/esm/utils/events.js.map +0 -1
  122. package/dist/esm/utils/index.js.map +0 -1
  123. package/dist/esm/utils/logger.js.map +0 -1
  124. package/dist/esm/utils/misc.js.map +0 -1
  125. package/dist/esm/utils/templates.js.map +0 -1
  126. package/dist/esm/utils/types.js.map +0 -1
  127. package/dist/favicon.ico +0 -0
  128. package/dist/foundationLayout.3cfa4a65fd1f4b6b3ab7671e3356db59.js.map +0 -1
  129. package/dist/index.ejs +0 -23
  130. package/dist/index.html +0 -15
  131. package/dist/info.ejs +0 -13
  132. package/dist/main.b0ddbf415137dc7a9e92.js +0 -2
  133. package/dist/main.f141788ee57f3820f1f4f0fc27368847.js.map +0 -1
  134. package/dist/npm.consola.713.b1e4073e73c71572987a.js +0 -2
  135. package/dist/npm.consola.a0d3324d3e61dcc430c3029da5f4dcc7.js.map +0 -1
  136. package/dist/npm.genesis-community.248.9c9900001dbc5ba9c3ed.js +0 -2
  137. package/dist/npm.genesis-community.2e0cc159dabe113d6fb29bb505c1a0d4.js.map +0 -1
  138. package/dist/npm.microsoft.127.00f16f24d8da8fd89263.js +0 -1469
  139. package/dist/npm.microsoft.127.00f16f24d8da8fd89263.js.LICENSE.txt +0 -14
  140. package/dist/npm.microsoft.be43958facd28231e770c1307660f64d.js.map +0 -1
  141. package/dist/remoteEntry.js +0 -2
  142. package/dist/serve.json +0 -3
@@ -11,22 +11,22 @@ import { ViewTemplate } from '@microsoft/fast-element';
11
11
  * Used to key what type of LayoutComponent an object is
12
12
  * @internal
13
13
  */
14
- export declare const componentType: unique symbol;
14
+ declare const componentType: unique symbol;
15
15
 
16
16
  /** @internal */
17
- export declare type ComponentTypes = LayoutRegionType | 'root' | 'item';
17
+ declare type ComponentTypes = LayoutRegionType | 'root' | 'item';
18
18
 
19
19
  /**
20
20
  * Default time in milliseconds for the layout to buffer calls to reloading
21
21
  * the layout while the declarative API is loading.
22
22
  *
23
23
  * During the first load of the layout, a loading spinner will be shown.
24
- * @beta
24
+ * @public
25
25
  */
26
26
  export declare const DEFAULT_RELOAD_BUFFER = 500;
27
27
 
28
28
  /**
29
- * @beta
29
+ * @public
30
30
  * Top level web component which is used to initialise a custom layout
31
31
  * @remarks
32
32
  * Can be used in a composition to customise the styles of the layout.
@@ -41,17 +41,34 @@ export declare class FoundationLayout extends FoundationElement implements Layou
41
41
  /**
42
42
  * Number describing how long to wait in ms before reloading the config when adding items
43
43
  * declaratively by the html API. Default 500 (ms).
44
- * @beta
44
+ * @public
45
45
  */
46
46
  reloadBuffer: number;
47
47
  private reloadPending;
48
48
  private registeredComponents;
49
49
  /** @internal */
50
+ private uuid;
51
+ /** @internal */
52
+ private session;
53
+ /**
54
+ * Attribute which if set will auto save and load the layout as the user changes it.
55
+ * Omit this attribute to disable this feature.
56
+ * Set attribute using `auto-save-key`.
57
+ * @public
58
+ */
59
+ autoSaveKey?: string;
60
+ /**
61
+ * Function which is used to generate the placeholder text when a layout is loaded
62
+ * with a missing item.
63
+ * @public
64
+ */
65
+ missingItemPlaceholder: (missingItem: string) => string;
66
+ /** @internal */
50
67
  hasFirstLoaded: boolean;
51
68
  /** @internal */
52
69
  usingDeclerativeAPI: boolean;
53
70
  /**
54
- * @beta
71
+ * @public
55
72
  * Set to true when the user is currently dragging the panes inside of the layout
56
73
  */
57
74
  dragging: boolean;
@@ -69,11 +86,13 @@ export declare class FoundationLayout extends FoundationElement implements Layou
69
86
  private onItemAdded;
70
87
  /** @internal */
71
88
  private onItemRemoved;
89
+ /** @internal */
90
+ private onItemResized;
72
91
  /**
73
92
  * JS API, public
74
93
  */
75
94
  /**
76
- * @beta
95
+ * @public
77
96
  * Gets all of the required registration function names for a set of config
78
97
  * @remarks
79
98
  * You can use this with {@link FoundationLayout.registeredItems | registeredItems} to work out what items you need to register with {@link FoundationLayout.registerItem | registerItem()}
@@ -85,7 +104,7 @@ export declare class FoundationLayout extends FoundationElement implements Layou
85
104
  */
86
105
  static layoutRequiredRegistrations(layout: SerialisedLayout): string[];
87
106
  /**
88
- * @beta
107
+ * @public
89
108
  * Gets all of the currently registered names
90
109
  * @remarks
91
110
  * You can use this with {@link FoundationLayout.layoutRequiredRegistrations | layoutRequiredRegistrations} to work out what items you need to register with {@link FoundationLayout.registerItem | registerItem()}
@@ -95,25 +114,40 @@ export declare class FoundationLayout extends FoundationElement implements Layou
95
114
  */
96
115
  registeredItems(): string[];
97
116
  /**
98
- * @beta
117
+ * @public
99
118
  * Gets a minified string containing the config describing the current layout of the layout object to later restore in {@link FoundationLayout.loadLayout | function}
100
119
  * @returns - latest version of {@link SerialisedLayout} describing the layout
101
120
  */
102
121
  getLayout(): SerialisedLayout;
103
122
  /**
104
- * @beta
123
+ * Try to load a layout from local storage, or return false. Only required if manually calling {@link FoundationLayout.registerItem}
124
+ * @remarks
125
+ * Attempt to load an autosaved layout from local storage, keyed on the `auto-save-key` attribute.
126
+ * If `auto-save-key` attribute is not set or there is no autosaved layout yet, this will return false. Else, true.
127
+ *
128
+ * This function is automatically called when loading the layout via the declarative API so if you're not registering components via
129
+ * the JavaScript API then you don't need to call this function. If you *are* calling {@link FoundationLayout.registerItem} then you should call this function immediately afterwards.
130
+ *
131
+ * Will load the layout with `handleMissingItem = 'placeholder` so placeholder text will be shown for any missing items.
132
+ * @returns boolean - true if a layout was loaded, false if not
133
+ * @public
134
+ */
135
+ tryLoadLayoutFromLocalStorage(): boolean;
136
+ /**
137
+ * @public
105
138
  * Restores a layout described in the config from {@link FoundationLayout.getLayout | getLayout()}
106
139
  *
107
140
  * @remarks
108
- * In order to restore a layout you must have registered all of the required panes with the layout system before restoring it. If you are just setting the layout using the declarative API then all of the same components will be registered. <br/ >If you have added any elements using {@link FoundationLayout.registerItem} then you must ensure all of the same items have been added again. To make tracking what items are registered easier it is recommended in this case you explicitly name your registrations using the `id` parameter available on the {@link RegisteredElementConfig} and `foundation-layout-item` APIs. <br/> You can use {@link FoundationLayout.layoutRequiredRegistrations} to check which items are registered in a current layout in order to dynamically add any missing items before you can restore the layout
141
+ * In order to restore a layout you must have registered all of the required panes with the layout system before restoring it. If you are just setting the layout using the declarative API then all of the same components will be registered. If you have added any elements using {@link FoundationLayout.registerItem} then you must ensure all of the same items have been added again. To make tracking what items are registered easier it is recommended in this case you explicitly name your registrations using the `id` parameter available on the {@link RegisteredElementConfig} and `foundation-layout-item` APIs. You can use {@link FoundationLayout.layoutRequiredRegistrations} to check which items are registered in a current layout in order to dynamically add any missing items before you can restore the layout
109
142
  *
110
143
  * @param layout - any version of {@link SerialisedLayout} object describing the layout
111
- * @throws {@link LayoutUsageError} if you attempt to load a layout with registered items that are not currently registered with the layout system
144
+ * @param handleMissingItem - what to do if the layout contains items that are not currently registered with the layout system. Defaults to 'error' which will throw an error. If set to 'placeholder' then any missing items will be replaced with a placeholder element. You can control the text of the placeholder element with {@link FoundationLayout.missingItemPlaceholder}.
145
+ * @throws {@link LayoutUsageError} if you attempt to load a layout with registered items that are not currently registered with the layout system, and handleMissingItem is set to 'error' (default).
112
146
  * @throws various errors if the layout string is malformed and cannot be parsed
113
147
  */
114
- loadLayout(layout: SerialisedLayout): void;
148
+ loadLayout(layout: SerialisedLayout, handleMissingItem?: 'placeholder' | 'error'): void;
115
149
  /**
116
- * @beta
150
+ * @public
117
151
  * Dynamically add a new item to the layout. The user can move the new plane to whenever they want once it has been added.
118
152
  * @remarks
119
153
  * Adding a new item invokes the registration previously made explicitly via {@link FoundationLayout.registerItem | registerItem()} or implicitly via the html declerative API.
@@ -126,7 +160,7 @@ export declare class FoundationLayout extends FoundationElement implements Layou
126
160
  */
127
161
  addItem(config: RegisteredElementConfig, placement?: Placement): void;
128
162
  /**
129
- * @beta
163
+ * @public
130
164
  * Register a collection of `Element` and associate them with an `ID` with the layout system for later use.
131
165
  * @remarks
132
166
  * You would use this to register elements that you later want to load when using {@link FoundationLayout.loadLayout}.
@@ -176,10 +210,31 @@ export declare class FoundationLayout extends FoundationElement implements Layou
176
210
  private setupLayoutReceiveEvents;
177
211
  /**
178
212
  * Saves the stored layout config according to the Golden Layout provider.
179
- * Needs to be called when the layout is updated outside of using addItemFromChild.
213
+ * And caches the layout in local storage if {@link FoundationLayout.autoSaveKey} is set.
180
214
  * @internal
181
215
  * */
182
- private cacheLayout;
216
+ private cacheAndSaveLayout;
217
+ /**
218
+ * Used when we are trying to load a layout with missing registrations and we want to add placeholder items
219
+ * @remarks
220
+ * This function will register the items with placeholder text, and set them to be closeable if they were not already
221
+ * As config is passed by reference it is updated directly
222
+ * @param config - The layout config to update
223
+ * @param missingRegisteredItems - The items which were missing from the registrations
224
+ * @internal
225
+ */
226
+ private registerPlaceholdersAndSetClosable;
227
+ /**
228
+ * Loads the provided config into Golden Layout and does other setup
229
+ * @remarks
230
+ * Loads the config into Golden Layout, and then sets up the event listeners for the layout
231
+ * When loading the layout the visual configuration is loaded
232
+ * Event listeners are added to the drag handles to emulate resizing events
233
+ *
234
+ * **This is the only function which should call this.layout.loadLayout() directly.**
235
+ * @internal
236
+ */
237
+ private loadGLConfigAndSetup;
183
238
  }
184
239
 
185
240
  /**
@@ -194,7 +249,7 @@ export declare class FoundationLayout extends FoundationElement implements Layou
194
249
  * @example
195
250
  * `<zero-layout></zero-layout>` if you are using the layout with the `zero` design-system.
196
251
  *
197
- * @beta
252
+ * @public
198
253
  */
199
254
  export declare const foundationLayoutComponents: {
200
255
  foundationLayout: (overrideDefinition?: OverrideFoundationElementDefinition< {
@@ -224,7 +279,7 @@ export declare const foundationLayoutComponents: {
224
279
  };
225
280
 
226
281
  /**
227
- * @beta
282
+ * @public
228
283
  * `FoundationLayoutItem` is a custom element that represents an item in the layout.
229
284
  * @remarks
230
285
  * This element is used to wrap html elements and configure their layout settings as part of the layout system.
@@ -236,28 +291,28 @@ export declare class FoundationLayoutItem extends FoundationElement implements L
236
291
  * Sets the title of the item which is displayed on the tab.
237
292
  * @remarks
238
293
  * Defaults to `Item ` + {@link FoundationLayoutItem.registration}
239
- * @beta
294
+ * @public
240
295
  */
241
296
  title: string;
242
297
  /**
243
298
  * Boolean attribute controls whether the window can be closed in the GUI.
244
299
  * Defaults to `false`.
245
- * @beta
300
+ * @public
246
301
  */
247
302
  closable: boolean;
248
303
  /**
249
304
  * optional string describing the size of the new item (see the written documentation for more info)
250
- * @beta
305
+ * @public
251
306
  */
252
307
  size: string;
253
308
  /**
254
- * Sets the registration name for the item, which can be used later to add the item via the JavaScript API using {@link FoundationLayout.addItem()}.
309
+ * Sets the registration name for the item, which can be used later to add the item via the JavaScript API using {@link FoundationLayout.addItem}.
255
310
  * @remarks
256
311
  * Items added via the JavaScript API and HTML API share the same pool of registration names.
257
312
  * Using a duplicate registration name is a runtime error.
258
313
  * This registration name defaults to the number of the window it is.
259
314
  * It is highly recommended if you are using the JavaScript API that you set a registration name here manually.
260
- * @beta
315
+ * @public
261
316
  */
262
317
  registration: string;
263
318
  /** @internal */
@@ -275,7 +330,7 @@ export declare class FoundationLayoutItem extends FoundationElement implements L
275
330
  }
276
331
 
277
332
  /**
278
- * @beta
333
+ * @public
279
334
  * `FoundationLayoutRegion` is a custom element that represents a region in the layout.
280
335
  * @remarks
281
336
  * This element is used to create a region in the layout. It can be used to create a horizontal or vertical split, or a tabbed region.
@@ -285,13 +340,13 @@ export declare class FoundationLayoutItem extends FoundationElement implements L
285
340
  export declare class FoundationLayoutRegion extends FoundationElement implements LayoutComponent {
286
341
  /**
287
342
  * optional string describing the size of the new item (see the written documentation for more info)
288
- * @beta
343
+ * @public
289
344
  */
290
345
  size: string;
291
346
  /**
292
347
  * Defines the {@link LayoutRegionType | type} of the region.
293
348
  * Defaults to `horizontal`.
294
- * @beta
349
+ * @public
295
350
  */
296
351
  type: LayoutRegionType;
297
352
  /** @internal */
@@ -324,18 +379,8 @@ export declare class FoundationLayoutRegion extends FoundationElement implements
324
379
  cacheElementsAndRegister(config: RegistrationConfig): string;
325
380
  }
326
381
 
327
- /**
328
- * Returns an array of values of the array a which are missing in b
329
- * An empty array is returned if every value of a is in b
330
- * @internal
331
- */
332
- export declare function getMissingArrayItems<T>(a: T[], b: T[]): T[];
333
-
334
- /** @internal */
335
- export declare function getParentLayoutComponent(): FoundationLayout | FoundationLayoutRegion;
336
-
337
382
  /** @internal */
338
- export declare interface LayoutComponent {
383
+ declare interface LayoutComponent {
339
384
  [componentType]: ComponentTypes;
340
385
  cacheElementsAndRegister(config: RegistrationConfig): string;
341
386
  requestLayoutReload(): void;
@@ -350,19 +395,22 @@ export declare interface LayoutComponent {
350
395
  * 'itemAdded' - emitted when an item is added to the layout'
351
396
  * <br/>
352
397
  * 'itemRemoved' - emitted when an item is removed from the layout'
353
- * @beta
398
+ * <br/>
399
+ * 'itemResized' - emitted when the user drags the divider to resize elements
400
+ * @public
354
401
  */
355
402
  export declare const LayoutEmitEvents: {
356
403
  readonly firstLoaded: "first-loaded";
357
404
  readonly itemAdded: "item-added";
358
405
  readonly itemRemoved: "item-removed";
406
+ readonly itemResized: "item-resized";
359
407
  };
360
408
 
361
409
  /**
362
410
  * Defines events that the layout system listens for
363
411
  *
364
412
  * 'changeTitle' - emit this from a contained item to update the title of the window that contains it.
365
- * @beta
413
+ * @public
366
414
  */
367
415
  export declare const LayoutReceiveEvents: {
368
416
  readonly changeTitle: "change-title";
@@ -372,7 +420,7 @@ export declare const LayoutReceiveEvents: {
372
420
  * Defines the shape of the detail that the layout listens works with for events it listens on
373
421
  *
374
422
  * 'changeTitle' - `title` is the string you want to set. For `mode`: `replace` will set the title to be `title`, `suffix` will append `title` to the end of the existing title.
375
- * @beta
423
+ * @public
376
424
  */
377
425
  export declare type LayoutReceiveEventsDetail = {
378
426
  changeTitle: {
@@ -382,17 +430,17 @@ export declare type LayoutReceiveEventsDetail = {
382
430
  };
383
431
 
384
432
  /**
385
- * @beta
433
+ * @public
386
434
  * Union type describing the three different types of region splits.
387
435
  * Set on the `type` attribute on {@link FoundationLayoutRegion}.
388
436
  */
389
437
  export declare type LayoutRegionType = (typeof layoutRegionValue)[number];
390
438
 
391
439
  /** @internal */
392
- export declare const layoutRegionValue: readonly ["horizontal", "vertical", "tabs"];
440
+ declare const layoutRegionValue: readonly ["horizontal", "vertical", "tabs"];
393
441
 
394
442
  /**
395
- * @beta
443
+ * @public
396
444
  */
397
445
  export declare class LayoutRegistrationError extends Error {
398
446
  constructor(message: string);
@@ -402,7 +450,7 @@ export declare class LayoutRegistrationError extends Error {
402
450
  * `ElementStyles` which defines the css for {@link FoundationLayout}.
403
451
  * @remarks
404
452
  * Can be used in a composition to customise the styles of the layout.
405
- * @beta
453
+ * @public
406
454
  */
407
455
  export declare const layoutStyles: ElementStyles;
408
456
 
@@ -410,19 +458,19 @@ export declare const layoutStyles: ElementStyles;
410
458
  * `ViewTemplate` which defines the html for {@link FoundationLayout}.
411
459
  * @remarks
412
460
  * Can be used in a composition to customise the styles of the layout.
413
- * @beta
461
+ * @public
414
462
  */
415
463
  export declare const layoutTemplate: ViewTemplate<FoundationLayout, any>;
416
464
 
417
465
  /**
418
- * @beta
466
+ * @public
419
467
  */
420
468
  export declare class LayoutUsageError extends Error {
421
469
  constructor(message: string);
422
470
  }
423
471
 
424
472
  /**
425
- * @beta
473
+ * @public
426
474
  * Where to add the new item into the layout when using the {@link FoundationLayout.addItem} API
427
475
  */
428
476
  export declare type Placement = {
@@ -430,7 +478,7 @@ export declare type Placement = {
430
478
  };
431
479
 
432
480
  /**
433
- * @beta
481
+ * @public
434
482
  * The parameters that can be set on a new item when being added by the {@link FoundationLayout.addItem} API
435
483
  *
436
484
  * @remarks
@@ -454,7 +502,7 @@ export declare interface RegistrationConfig {
454
502
  }
455
503
 
456
504
  /**
457
- * @beta
505
+ * @public
458
506
  * Versioned layout config objects. `v` is the version and `c` contains the layout config.
459
507
  * @remarks
460
508
  * Versioning the layout config in this way allows changes to the config schema while
@@ -469,10 +517,4 @@ export declare type SerialisedLayout = {
469
517
  c: ResolvedLayoutConfig;
470
518
  };
471
519
 
472
- /**
473
- * template for the child layout elements
474
- * @internal
475
- */
476
- export declare const wrapperTemplate: ViewTemplate<any, any>;
477
-
478
520
  export { }
@@ -4,9 +4,6 @@
4
4
 
5
5
  ## DEFAULT\_RELOAD\_BUFFER variable
6
6
 
7
- > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
- >
9
-
10
7
  Default time in milliseconds for the layout to buffer calls to reloading the layout while the declarative API is loading.
11
8
 
12
9
  During the first load of the layout, a loading spinner will be shown.
@@ -4,9 +4,6 @@
4
4
 
5
5
  ## FoundationLayout.addItem() method
6
6
 
7
- > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
- >
9
-
10
7
  Dynamically add a new item to the layout. The user can move the new plane to whenever they want once it has been added.
11
8
 
12
9
  **Signature:**
@@ -0,0 +1,13 @@
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; [FoundationLayout](./foundation-layout.foundationlayout.md) &gt; [autoSaveKey](./foundation-layout.foundationlayout.autosavekey.md)
4
+
5
+ ## FoundationLayout.autoSaveKey property
6
+
7
+ Attribute which if set will auto save and load the layout as the user changes it. Omit this attribute to disable this feature. Set attribute using `auto-save-key`<!-- -->.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ autoSaveKey?: string;
13
+ ```
@@ -4,9 +4,6 @@
4
4
 
5
5
  ## FoundationLayout.dragging property
6
6
 
7
- > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
- >
9
-
10
7
  Set to true when the user is currently dragging the panes inside of the layout
11
8
 
12
9
  **Signature:**
@@ -4,9 +4,6 @@
4
4
 
5
5
  ## FoundationLayout.getLayout() method
6
6
 
7
- > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
- >
9
-
10
7
  Gets a minified string containing the config describing the current layout of the layout object to later restore in [function](./foundation-layout.foundationlayout.loadlayout.md)
11
8
 
12
9
  **Signature:**
@@ -4,9 +4,6 @@
4
4
 
5
5
  ## FoundationLayout.layoutRequiredRegistrations() method
6
6
 
7
- > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
- >
9
-
10
7
  Gets all of the required registration function names for a set of config
11
8
 
12
9
  **Signature:**
@@ -4,15 +4,12 @@
4
4
 
5
5
  ## FoundationLayout.loadLayout() method
6
6
 
7
- > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
- >
9
-
10
7
  Restores a layout described in the config from [getLayout()](./foundation-layout.foundationlayout.getlayout.md)
11
8
 
12
9
  **Signature:**
13
10
 
14
11
  ```typescript
15
- loadLayout(layout: SerialisedLayout): void;
12
+ loadLayout(layout: SerialisedLayout, handleMissingItem?: 'placeholder' | 'error'): void;
16
13
  ```
17
14
 
18
15
  ## Parameters
@@ -20,6 +17,7 @@ loadLayout(layout: SerialisedLayout): void;
20
17
  | Parameter | Type | Description |
21
18
  | --- | --- | --- |
22
19
  | layout | [SerialisedLayout](./foundation-layout.serialisedlayout.md) | any version of [SerialisedLayout](./foundation-layout.serialisedlayout.md) object describing the layout |
20
+ | handleMissingItem | 'placeholder' \| 'error' | _(Optional)_ what to do if the layout contains items that are not currently registered with the layout system. Defaults to 'error' which will throw an error. If set to 'placeholder' then any missing items will be replaced with a placeholder element. You can control the text of the placeholder element with [FoundationLayout.missingItemPlaceholder](./foundation-layout.foundationlayout.missingitemplaceholder.md)<!-- -->. |
23
21
 
24
22
  **Returns:**
25
23
 
@@ -27,11 +25,11 @@ void
27
25
 
28
26
  ## Exceptions
29
27
 
30
- [LayoutUsageError](./foundation-layout.layoutusageerror.md) if you attempt to load a layout with registered items that are not currently registered with the layout system
28
+ [LayoutUsageError](./foundation-layout.layoutusageerror.md) if you attempt to load a layout with registered items that are not currently registered with the layout system, and handleMissingItem is set to 'error' (default).
31
29
 
32
30
  various errors if the layout string is malformed and cannot be parsed
33
31
 
34
32
  ## Remarks
35
33
 
36
- In order to restore a layout you must have registered all of the required panes with the layout system before restoring it. If you are just setting the layout using the declarative API then all of the same components will be registered. &lt;<!-- -->br/ &gt;<!-- -->If you have added any elements using [FoundationLayout.registerItem()](./foundation-layout.foundationlayout.registeritem.md) then you must ensure all of the same items have been added again. To make tracking what items are registered easier it is recommended in this case you explicitly name your registrations using the `id` parameter available on the [RegisteredElementConfig](./foundation-layout.registeredelementconfig.md) and `foundation-layout-item` APIs. <br/> You can use [FoundationLayout.layoutRequiredRegistrations()](./foundation-layout.foundationlayout.layoutrequiredregistrations.md) to check which items are registered in a current layout in order to dynamically add any missing items before you can restore the layout
34
+ In order to restore a layout you must have registered all of the required panes with the layout system before restoring it. If you are just setting the layout using the declarative API then all of the same components will be registered. If you have added any elements using [FoundationLayout.registerItem()](./foundation-layout.foundationlayout.registeritem.md) then you must ensure all of the same items have been added again. To make tracking what items are registered easier it is recommended in this case you explicitly name your registrations using the `id` parameter available on the [RegisteredElementConfig](./foundation-layout.registeredelementconfig.md) and `foundation-layout-item` APIs. You can use [FoundationLayout.layoutRequiredRegistrations()](./foundation-layout.foundationlayout.layoutrequiredregistrations.md) to check which items are registered in a current layout in order to dynamically add any missing items before you can restore the layout
37
35
 
@@ -4,9 +4,6 @@
4
4
 
5
5
  ## FoundationLayout class
6
6
 
7
- > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
- >
9
-
10
7
  Top level web component which is used to initialise a custom layout
11
8
 
12
9
  **Signature:**
@@ -28,17 +25,20 @@ The constructor for this class is marked as internal. Third-party code should no
28
25
 
29
26
  | Property | Modifiers | Type | Description |
30
27
  | --- | --- | --- | --- |
31
- | [dragging](./foundation-layout.foundationlayout.dragging.md) | | boolean | **_(BETA)_** Set to true when the user is currently dragging the panes inside of the layout |
32
- | [reloadBuffer](./foundation-layout.foundationlayout.reloadbuffer.md) | | number | **_(BETA)_** Number describing how long to wait in ms before reloading the config when adding items declaratively by the html API. Default 500 (ms). |
28
+ | [autoSaveKey?](./foundation-layout.foundationlayout.autosavekey.md) | | string | _(Optional)_ Attribute which if set will auto save and load the layout as the user changes it. Omit this attribute to disable this feature. Set attribute using <code>auto-save-key</code>. |
29
+ | [dragging](./foundation-layout.foundationlayout.dragging.md) | | boolean | Set to true when the user is currently dragging the panes inside of the layout |
30
+ | [missingItemPlaceholder](./foundation-layout.foundationlayout.missingitemplaceholder.md) | | (missingItem: string) =&gt; string | Function which is used to generate the placeholder text when a layout is loaded with a missing item. |
31
+ | [reloadBuffer](./foundation-layout.foundationlayout.reloadbuffer.md) | | number | Number describing how long to wait in ms before reloading the config when adding items declaratively by the html API. Default 500 (ms). |
33
32
 
34
33
  ## Methods
35
34
 
36
35
  | Method | Modifiers | Description |
37
36
  | --- | --- | --- |
38
- | [addItem(config, placement)](./foundation-layout.foundationlayout.additem.md) | | **_(BETA)_** Dynamically add a new item to the layout. The user can move the new plane to whenever they want once it has been added. |
39
- | [getLayout()](./foundation-layout.foundationlayout.getlayout.md) | | **_(BETA)_** Gets a minified string containing the config describing the current layout of the layout object to later restore in [function](./foundation-layout.foundationlayout.loadlayout.md) |
40
- | [layoutRequiredRegistrations(layout)](./foundation-layout.foundationlayout.layoutrequiredregistrations.md) | <code>static</code> | **_(BETA)_** Gets all of the required registration function names for a set of config |
41
- | [loadLayout(layout)](./foundation-layout.foundationlayout.loadlayout.md) | | **_(BETA)_** Restores a layout described in the config from [getLayout()](./foundation-layout.foundationlayout.getlayout.md) |
42
- | [registeredItems()](./foundation-layout.foundationlayout.registereditems.md) | | **_(BETA)_** Gets all of the currently registered names |
43
- | [registerItem(registration, elements)](./foundation-layout.foundationlayout.registeritem.md) | | **_(BETA)_** Register a collection of <code>Element</code> and associate them with an <code>ID</code> with the layout system for later use. |
37
+ | [addItem(config, placement)](./foundation-layout.foundationlayout.additem.md) | | Dynamically add a new item to the layout. The user can move the new plane to whenever they want once it has been added. |
38
+ | [getLayout()](./foundation-layout.foundationlayout.getlayout.md) | | Gets a minified string containing the config describing the current layout of the layout object to later restore in [function](./foundation-layout.foundationlayout.loadlayout.md) |
39
+ | [layoutRequiredRegistrations(layout)](./foundation-layout.foundationlayout.layoutrequiredregistrations.md) | <code>static</code> | Gets all of the required registration function names for a set of config |
40
+ | [loadLayout(layout, handleMissingItem)](./foundation-layout.foundationlayout.loadlayout.md) | | Restores a layout described in the config from [getLayout()](./foundation-layout.foundationlayout.getlayout.md) |
41
+ | [registeredItems()](./foundation-layout.foundationlayout.registereditems.md) | | Gets all of the currently registered names |
42
+ | [registerItem(registration, elements)](./foundation-layout.foundationlayout.registeritem.md) | | Register a collection of <code>Element</code> and associate them with an <code>ID</code> with the layout system for later use. |
43
+ | [tryLoadLayoutFromLocalStorage()](./foundation-layout.foundationlayout.tryloadlayoutfromlocalstorage.md) | | Try to load a layout from local storage, or return false. Only required if manually calling [FoundationLayout.registerItem()](./foundation-layout.foundationlayout.registeritem.md) |
44
44
 
@@ -0,0 +1,13 @@
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; [FoundationLayout](./foundation-layout.foundationlayout.md) &gt; [missingItemPlaceholder](./foundation-layout.foundationlayout.missingitemplaceholder.md)
4
+
5
+ ## FoundationLayout.missingItemPlaceholder property
6
+
7
+ Function which is used to generate the placeholder text when a layout is loaded with a missing item.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ missingItemPlaceholder: (missingItem: string) => string;
13
+ ```
@@ -4,9 +4,6 @@
4
4
 
5
5
  ## FoundationLayout.registeredItems() method
6
6
 
7
- > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
- >
9
-
10
7
  Gets all of the currently registered names
11
8
 
12
9
  **Signature:**
@@ -4,9 +4,6 @@
4
4
 
5
5
  ## FoundationLayout.registerItem() method
6
6
 
7
- > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
- >
9
-
10
7
  Register a collection of `Element` and associate them with an `ID` with the layout system for later use.
11
8
 
12
9
  **Signature:**
@@ -4,9 +4,6 @@
4
4
 
5
5
  ## FoundationLayout.reloadBuffer property
6
6
 
7
- > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
- >
9
-
10
7
  Number describing how long to wait in ms before reloading the config when adding items declaratively by the html API. Default 500 (ms).
11
8
 
12
9
  **Signature:**
@@ -0,0 +1,27 @@
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; [FoundationLayout](./foundation-layout.foundationlayout.md) &gt; [tryLoadLayoutFromLocalStorage](./foundation-layout.foundationlayout.tryloadlayoutfromlocalstorage.md)
4
+
5
+ ## FoundationLayout.tryLoadLayoutFromLocalStorage() method
6
+
7
+ Try to load a layout from local storage, or return false. Only required if manually calling [FoundationLayout.registerItem()](./foundation-layout.foundationlayout.registeritem.md)
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ tryLoadLayoutFromLocalStorage(): boolean;
13
+ ```
14
+ **Returns:**
15
+
16
+ boolean
17
+
18
+ boolean - true if a layout was loaded, false if not
19
+
20
+ ## Remarks
21
+
22
+ Attempt to load an autosaved layout from local storage, keyed on the `auto-save-key` attribute. If `auto-save-key` attribute is not set or there is no autosaved layout yet, this will return false. Else, true.
23
+
24
+ This function is automatically called when loading the layout via the declarative API so if you're not registering components via the JavaScript API then you don't need to call this function. If you \*are\* calling [FoundationLayout.registerItem()](./foundation-layout.foundationlayout.registeritem.md) then you should call this function immediately afterwards.
25
+
26
+ Will load the layout with `handleMissingItem = 'placeholder` so placeholder text will be shown for any missing items.
27
+
@@ -4,9 +4,6 @@
4
4
 
5
5
  ## foundationLayoutComponents variable
6
6
 
7
- > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
- >
9
-
10
7
  Registration object to register the layout with your design system.
11
8
 
12
9
  **Signature:**
@@ -4,9 +4,6 @@
4
4
 
5
5
  ## FoundationLayoutItem.closable property
6
6
 
7
- > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
8
- >
9
-
10
7
  Boolean attribute controls whether the window can be closed in the GUI. Defaults to `false`<!-- -->.
11
8
 
12
9
  **Signature:**