@operato/board 10.29.106 → 10.29.107

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.
@@ -1,5 +1,5 @@
1
1
  import { create } from '@hatiolab/things-scene';
2
- import type { SceneCreateOptions } from '@hatiolab/things-scene';
2
+ import type { DomainTheme, SceneCreateOptions } from '@hatiolab/things-scene';
3
3
  /**
4
4
  * Tells whether the caller still wants this scene after the await.
5
5
  *
@@ -17,7 +17,7 @@ export type ItemTypesProvider = () => Promise<unknown>;
17
17
  */
18
18
  export declare function useItemTypes(provider: ItemTypesProvider | null): void;
19
19
  /** Answers the domain's themes -- its legends among them -- for a scene about to open: name → value, the active ones. */
20
- export type ThemesProvider = () => Promise<Record<string, unknown>>;
20
+ export type ThemesProvider = () => Promise<Record<string, unknown> | readonly DomainTheme[]>;
21
21
  /**
22
22
  * An app whose boards show legends (ADR-0166 7) gives this package what answers its domain's active themes, once, from
23
23
  * its bootstrap. Every scene this package opens is then given them as its `style`, name → value, where a figure's table
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
- import { create, resolveUnknownTypes } from '@hatiolab/things-scene';
4
+ import { create, resolveUnknownTypes, sceneLookSelection } from '@hatiolab/things-scene';
5
5
  let itemTypesProvider = null;
6
6
  /**
7
7
  * An app that uses item types (ADR-0155) gives this package what answers its domain's table, once, from its bootstrap
@@ -26,8 +26,23 @@ export async function createResolvedScene(options, stillWanted) {
26
26
  var _a;
27
27
  if (itemTypesProvider && options.itemTypes === undefined)
28
28
  options = { ...options, itemTypes: await itemTypesProvider() };
29
- if (themesProvider && options.style === undefined)
30
- options = { ...options, style: await themesProvider() };
29
+ if (themesProvider && options.style === undefined && options.domainThemes === undefined) {
30
+ const themes = await themesProvider();
31
+ if (Array.isArray(themes)) {
32
+ const domainThemes = themes;
33
+ const style = Object.fromEntries(domainThemes.filter(theme => theme.type !== 'scene-look').map(theme => [theme.name, theme.value]));
34
+ const model = options.model;
35
+ const selection = model && !Object.prototype.hasOwnProperty.call(model, 'sceneLookId') && sceneLookSelection(model, domainThemes);
36
+ options = { ...options, style, domainThemes };
37
+ if (model && selection && selection.theme) {
38
+ const { sceneLook: _legacyName, ...saved } = model;
39
+ options.model = { ...saved, sceneLookId: selection.theme.id };
40
+ }
41
+ }
42
+ else {
43
+ options = { ...options, style: themes };
44
+ }
45
+ }
31
46
  const resolution = await resolveUnknownTypes(options.model);
32
47
  const { unresolved, failed } = resolution;
33
48
  /* The reason a resolver gave for each type it refused (ADR-0114 A3); older scenes report none. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/board",
3
- "version": "10.29.106",
3
+ "version": "10.29.107",
4
4
  "description": "Webcomponent for board following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "type": "module",
@@ -152,7 +152,7 @@
152
152
  "@operato/markdown": "^10.29.83",
153
153
  "@operato/popup": "^10.29.96",
154
154
  "@operato/property-editor": "^10.29.103",
155
- "@operato/property-panel": "^10.29.105",
155
+ "@operato/property-panel": "^10.29.107",
156
156
  "@operato/styles": "^10.29.83",
157
157
  "@operato/utils": "^10.29.85",
158
158
  "@types/file-saver": "^2.0.4",
@@ -167,7 +167,7 @@
167
167
  "@custom-elements-manifest/analyzer": "^0.10.0",
168
168
  "@hatiolab/figure-model": "^0.12.20",
169
169
  "@hatiolab/prettier-config": "^1.0.0",
170
- "@hatiolab/things-scene": "^10.1.123",
170
+ "@hatiolab/things-scene": "^10.1.139",
171
171
  "@open-wc/eslint-config": "^12.0.3",
172
172
  "@open-wc/testing": "^4.0.0",
173
173
  "@rollup/plugin-image": "^3.0.3",
@@ -203,5 +203,5 @@
203
203
  "prettier --write"
204
204
  ]
205
205
  },
206
- "gitHead": "cd7f9a987a820cd82f4980cc2cf3230b68397962"
206
+ "gitHead": "20bec12e1116c3891eeaeedc5f6462fb222d6645"
207
207
  }