@operato/board 10.29.105 → 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,7 +1,7 @@
1
1
  import '@material/web/icon/icon.js';
2
2
  import '@material/web/fab/fab.js';
3
3
  import { LitElement, PropertyValues } from 'lit';
4
- import { Component, LoadTracker, ReferenceProvider } from '@hatiolab/things-scene';
4
+ import { Component, DataSubscriptionProvider, LoadTracker, ReferenceProvider } from '@hatiolab/things-scene';
5
5
  import './ox-playback-controls.js';
6
6
  export declare class BoardViewer extends LitElement {
7
7
  static styles: import("lit").CSSResult[];
@@ -13,6 +13,11 @@ export declare class BoardViewer extends LitElement {
13
13
  history: boolean;
14
14
  /** 앱에서 미리 생성한 LoadTracker. fetch 시작 전에 생성하면 네트워크 시간도 추적. */
15
15
  loadTracker?: LoadTracker;
16
+ /**
17
+ * tag 컴포넌트가 데이터를 받는 곳. 지정하지 않으면 실시간 `data(tag)` 구독이다.
18
+ * 보드 모델로 장면을 만들 때 쓰인다 — 지정한 공급자로 연 장면은 실시간 데이터를 구독하지 않는다.
19
+ */
20
+ dataSubscriptionProvider?: DataSubscriptionProvider;
16
21
  hideFullscreen: boolean;
17
22
  hideNavigation: boolean;
18
23
  playbackEnabled: boolean;
@@ -202,6 +202,7 @@ let BoardViewer = class BoardViewer extends LitElement {
202
202
  this.setupScene({ id: this.board.id, scene: this._scene });
203
203
  }
204
204
  async initScene() {
205
+ var _a;
205
206
  if (!this.board || !this.board.id)
206
207
  return;
207
208
  /* Resolving the model's types is a wait, and `board` can be replaced while it runs. */
@@ -213,7 +214,7 @@ let BoardViewer = class BoardViewer extends LitElement {
213
214
  mode: SCENE_MODE.VIEW,
214
215
  refProvider: this.provider,
215
216
  dataStorage: board.id !== 'preview' ? new BoardDataStorage(board.id) : undefined,
216
- dataSubscriptionProvider: new DataSubscriptionProviderImpl(),
217
+ dataSubscriptionProvider: (_a = this.dataSubscriptionProvider) !== null && _a !== void 0 ? _a : new DataSubscriptionProviderImpl(),
217
218
  handlers: ['waypoint-handler'],
218
219
  loading: { tracker: this.loadTracker }
219
220
  }, () => this.board === board && this.isConnected);
@@ -870,6 +871,9 @@ __decorate([
870
871
  __decorate([
871
872
  property({ type: Object })
872
873
  ], BoardViewer.prototype, "loadTracker", void 0);
874
+ __decorate([
875
+ property({ type: Object })
876
+ ], BoardViewer.prototype, "dataSubscriptionProvider", void 0);
873
877
  __decorate([
874
878
  property({ type: Boolean, reflect: true, attribute: 'hide-fullscreen' })
875
879
  ], BoardViewer.prototype, "hideFullscreen", void 0);
@@ -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. */
@@ -51,101 +51,152 @@ let BoardSelector = class BoardSelector extends InfiniteScrollable(localize(i18n
51
51
  return [
52
52
  ScrollbarStyles,
53
53
  css `
54
+ /*
55
+ * The same look as the board list: white cards with a thin border, the thumbnail on a quiet
56
+ * ground and the name under it, and one plain row of filters above (2026-11-29).
57
+ */
54
58
  :host {
55
59
  display: grid;
56
- grid-template-rows: auto auto 1fr;
60
+ grid-template-rows: auto 1fr;
57
61
  overflow: hidden;
58
62
  color: var(--md-sys-color-on-surface);
63
+ background-color: var(--md-sys-color-surface-container-low, var(--md-sys-color-surface));
64
+ }
65
+
66
+ #filter {
67
+ display: flex;
68
+ align-items: center;
69
+ flex-wrap: wrap;
70
+ gap: 8px 16px;
71
+ padding: 12px 20px;
72
+ border-bottom: 1px solid var(--md-sys-color-outline-variant);
59
73
  background-color: var(--md-sys-color-surface);
60
74
  }
61
75
 
62
- #main {
63
- overflow: auto;
64
- padding: var(--popup-content-padding);
65
- display: grid;
66
- grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
67
- grid-auto-rows: var(--card-list-rows-height);
68
- grid-gap: 20px;
76
+ #filter ox-input-search {
77
+ flex: 0 1 260px;
78
+ padding: 4px 10px;
79
+ border: 1px solid var(--md-sys-color-outline-variant);
80
+ border-radius: 999px;
81
+ color: var(--md-sys-color-on-surface-variant);
82
+ font-size: 13px;
69
83
  }
70
84
 
71
- .card {
85
+ .types {
86
+ display: flex;
87
+ gap: 6px;
88
+ }
89
+
90
+ .types button {
91
+ font: inherit;
92
+ font-size: 12.5px;
93
+ padding: 3px 12px;
94
+ border: 1px solid var(--md-sys-color-outline-variant);
95
+ border-radius: 999px;
96
+ background: transparent;
97
+ color: var(--md-sys-color-on-surface-variant);
98
+ cursor: pointer;
99
+ }
100
+
101
+ .types button[aria-pressed='true'] {
102
+ border-color: transparent;
103
+ background: var(--md-sys-color-secondary-container);
104
+ color: var(--md-sys-color-on-secondary-container);
105
+ font-weight: 600;
106
+ }
107
+
108
+ label.group {
72
109
  display: flex;
73
- flex-direction: column;
74
110
  align-items: center;
75
- overflow: hidden;
76
- border-radius: var(--card-list-border-radius);
77
- background-color: var(--card-list-background-color);
111
+ gap: 6px;
112
+ margin-left: auto;
113
+ font-size: 12.5px;
114
+ color: var(--md-sys-color-on-surface-variant);
78
115
  }
79
116
 
80
- .card[selected] {
81
- border: 3px solid var(--md-sys-color-primary, #6750a4);
82
- box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary, #6750a4) 30%, transparent), 0 4px 12px rgba(0, 0, 0, 0.25);
83
- transform: scale(1.02);
84
- transition: all 0.2s ease;
117
+ select {
118
+ font: inherit;
119
+ max-width: 200px;
120
+ padding: 3px 6px;
121
+ border: 1px solid var(--md-sys-color-outline-variant);
122
+ border-radius: 6px;
123
+ background-color: var(--md-sys-color-surface);
124
+ color: var(--md-sys-color-on-surface);
85
125
  }
86
126
 
87
- .card.create {
88
- overflow: visible;
127
+ #main {
128
+ overflow: auto;
129
+ padding: 16px 20px 20px;
130
+ display: grid;
131
+ grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
132
+ grid-auto-rows: 196px;
133
+ gap: 14px;
134
+ align-content: start;
89
135
  }
90
136
 
91
- .card:hover {
137
+ .card {
138
+ display: grid;
139
+ grid-template-rows: 1fr auto;
140
+ overflow: hidden;
141
+ box-sizing: border-box;
142
+ border: 1px solid var(--md-sys-color-outline-variant);
143
+ border-radius: 8px;
144
+ background-color: var(--md-sys-color-surface);
92
145
  cursor: pointer;
93
146
  }
94
147
 
95
- .card > .name {
96
- color: var(--md-sys-color-on-secondary);
97
- background-color: var(--md-sys-color-secondary);
98
- opacity: 0.9;
99
- margin-top: -35px;
100
- width: 100%;
101
- font-weight: bolder;
102
- font-size: 13px;
103
- text-indent: 7px;
148
+ .card:hover {
149
+ border-color: var(--md-sys-color-outline);
104
150
  }
105
151
 
106
- .card > .description {
107
- color: var(--md-sys-color-on-secondary);
108
- background-color: var(--md-sys-color-secondary);
109
- width: 100%;
110
- min-height: 16px;
111
- font-size: 0.6rem;
112
- text-indent: 7px;
152
+ .card[selected] {
153
+ border: 2px solid var(--md-sys-color-primary);
113
154
  }
114
- .card img {
115
- max-height: 100%;
116
- min-height: 100%;
155
+
156
+ .card.create {
157
+ overflow: visible;
158
+ border: none;
159
+ background-color: transparent;
117
160
  }
118
161
 
119
- #filter {
162
+ .card .thumb {
120
163
  display: flex;
121
164
  align-items: center;
122
- padding: var(--popup-content-padding);
123
- color: var(--md-sys-color-on-surface-variant);
124
- background-color: var(--md-sys-color-surface-variant);
125
- box-shadow: var(--box-shadow);
165
+ justify-content: center;
166
+ min-height: 0;
167
+ padding: 8px;
168
+ background-color: var(--md-sys-color-surface-container);
126
169
  }
127
170
 
128
- #filter > ox-input-search {
129
- margin-right: auto;
130
- border: var(--md-sys-color-primary) 1px solid;
131
- padding: var(--spacing-small) var(--spacing-small);
132
- border-radius: 999px;
133
- color: var(--md-sys-color-primary);
171
+ .card img {
172
+ max-width: 100%;
173
+ max-height: 100%;
174
+ object-fit: contain;
134
175
  }
135
176
 
136
- #filter > div {
137
- float: right;
138
- margin-left: 10px;
177
+ .card .caption {
178
+ padding: 8px 12px 10px;
179
+ min-width: 0;
139
180
  }
140
181
 
141
- #filter * {
142
- font-size: 15px;
182
+ .card .name,
183
+ .card .description {
184
+ overflow: hidden;
185
+ text-overflow: ellipsis;
186
+ white-space: nowrap;
143
187
  }
144
188
 
145
- select {
146
- background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));
147
- color: var(--input-field-color, var(--md-sys-color-on-surface));
148
- text-transform: capitalize;
189
+ .card .name {
190
+ font-size: 13.5px;
191
+ font-weight: 600;
192
+ color: var(--md-sys-color-on-surface);
193
+ }
194
+
195
+ .card .description {
196
+ margin-top: 2px;
197
+ min-height: 1.4em;
198
+ font-size: 12px;
199
+ color: var(--md-sys-color-on-surface-variant);
149
200
  }
150
201
  `
151
202
  ];
@@ -161,59 +212,43 @@ let BoardSelector = class BoardSelector extends InfiniteScrollable(localize(i18n
161
212
  this._infiniteScrollOptions.limit = 50;
162
213
  }
163
214
  render() {
215
+ const types = [
216
+ { value: '', label: i18next.t('label.all') },
217
+ { value: 'main', label: 'Main' },
218
+ { value: 'sub', label: 'Sub' },
219
+ { value: 'popup', label: 'Popup' }
220
+ ];
164
221
  return html `
165
222
  <div id="filter">
166
223
  <ox-input-search
224
+ .placeholder=${i18next.t('text.search boards by name')}
167
225
  @change=${(e) => {
168
226
  var _a;
169
227
  this.search = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value;
170
228
  }}
171
229
  ></ox-input-search>
172
- <div>
173
- <label for="type">Type</label>
174
- <select
175
- id="type"
176
- @change=${(e) => {
177
- var _a;
178
- this.type = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value;
179
- this.requestUpdate();
180
- }}
181
- >
182
- <option value="">${i18next.t('label.all')}</option>
183
- ${['main', 'sub', 'popup'].map(type => html ` <option value=${type}>${type}</option> `)}
184
- </select>
230
+
231
+ <div class="types" role="group" aria-label=${i18next.t('label.type')}>
232
+ ${types.map(type => html `<button
233
+ aria-pressed=${String((this.type || '') === type.value)}
234
+ @click=${() => (this.type = type.value)}
235
+ >
236
+ ${type.label}
237
+ </button>`)}
185
238
  </div>
186
239
 
187
- <div>
188
- <label for="group">Group</label>
240
+ <label class="group">
241
+ ${i18next.t('label.group')}
189
242
  <select
190
- id="group"
191
243
  @change=${(e) => {
192
244
  var _a;
193
245
  this.group = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value;
194
- this.requestUpdate();
195
246
  }}
196
247
  >
197
248
  <option value="">${i18next.t('label.all')}</option>
198
- ${this.groups.map(group => html ` <option value=${group.id}>${group.description}</option> `)}
249
+ ${this.groups.map(group => html ` <option value=${group.id} ?selected=${group.id === this.group}>${group.description || group.name}</option> `)}
199
250
  </select>
200
- </div>
201
-
202
- <div>
203
- <label for="inherited">Inherited</label>
204
- <select
205
- id="inherited"
206
- @change=${(e) => {
207
- var _a;
208
- this.inherited = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value;
209
- this.requestUpdate();
210
- }}
211
- >
212
- <option value="Include">Include</option>
213
- <option value="Only">Only</option>
214
- <option value="None">None</option>
215
- </select>
216
- </div>
251
+ </label>
217
252
  </div>
218
253
 
219
254
  <div
@@ -234,9 +269,11 @@ let BoardSelector = class BoardSelector extends InfiniteScrollable(localize(i18n
234
269
  : html ``}
235
270
  ${this.boards.map(board => html `
236
271
  <div class="card" @click=${(e) => this.onClickSelect(board)} ?selected=${this.value === board.id}>
237
- <img src=${board.thumbnail} />
238
- <div class="name">${board.name}</div>
239
- <div class="description">${board.description}</div>
272
+ <div class="thumb">${board.thumbnail ? html `<img src=${board.thumbnail} alt="" />` : ''}</div>
273
+ <div class="caption">
274
+ <div class="name">${board.name}</div>
275
+ <div class="description">${board.description || ''}</div>
276
+ </div>
240
277
  </div>
241
278
  `)}
242
279
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/board",
3
- "version": "10.29.105",
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": "1ea7fe9913ad043c9a345f8e96e4546faa6d412c"
206
+ "gitHead": "20bec12e1116c3891eeaeedc5f6462fb222d6645"
207
207
  }