@things-factory/figure-viewer 0.0.0-stage → 10.1.155

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 (68) hide show
  1. package/client/capability-rung.ts +22 -0
  2. package/client/controls.ts +54 -0
  3. package/client/detail-facts.ts +87 -0
  4. package/client/detail-motion.ts +11 -0
  5. package/client/figure-asset-viewer.ts +284 -0
  6. package/client/figure-facts-list.ts +59 -0
  7. package/client/figure-thumb-mark.ts +34 -0
  8. package/client/figure-view.ts +151 -0
  9. package/client/index.ts +14 -0
  10. package/client/preview-model.ts +89 -0
  11. package/client/side-panel-styles.ts +374 -0
  12. package/client/tsconfig.json +19 -0
  13. package/dist-client/capability-rung.d.ts +5 -0
  14. package/dist-client/capability-rung.js +16 -0
  15. package/dist-client/capability-rung.js.map +1 -0
  16. package/dist-client/controls.d.ts +28 -0
  17. package/dist-client/controls.js +28 -0
  18. package/dist-client/controls.js.map +1 -0
  19. package/dist-client/detail-facts.d.ts +37 -0
  20. package/dist-client/detail-facts.js +58 -0
  21. package/dist-client/detail-facts.js.map +1 -0
  22. package/dist-client/detail-motion.d.ts +6 -0
  23. package/dist-client/detail-motion.js +9 -0
  24. package/dist-client/detail-motion.js.map +1 -0
  25. package/dist-client/figure-asset-viewer.d.ts +51 -0
  26. package/dist-client/figure-asset-viewer.js +313 -0
  27. package/dist-client/figure-asset-viewer.js.map +1 -0
  28. package/dist-client/figure-facts-list.d.ts +17 -0
  29. package/dist-client/figure-facts-list.js +63 -0
  30. package/dist-client/figure-facts-list.js.map +1 -0
  31. package/dist-client/figure-thumb-mark.d.ts +12 -0
  32. package/dist-client/figure-thumb-mark.js +42 -0
  33. package/dist-client/figure-thumb-mark.js.map +1 -0
  34. package/dist-client/figure-view.d.ts +117 -0
  35. package/dist-client/figure-view.js +78 -0
  36. package/dist-client/figure-view.js.map +1 -0
  37. package/dist-client/index.d.ts +10 -0
  38. package/dist-client/index.js +15 -0
  39. package/dist-client/index.js.map +1 -0
  40. package/dist-client/preview-model.d.ts +54 -0
  41. package/dist-client/preview-model.js +79 -0
  42. package/dist-client/preview-model.js.map +1 -0
  43. package/dist-client/side-panel-styles.d.ts +27 -0
  44. package/dist-client/side-panel-styles.js +374 -0
  45. package/dist-client/side-panel-styles.js.map +1 -0
  46. package/dist-client/tsconfig.tsbuildinfo +1 -0
  47. package/dist-server/index.d.ts +1 -0
  48. package/dist-server/index.js +3 -0
  49. package/dist-server/index.js.map +1 -0
  50. package/dist-server/tsconfig.tsbuildinfo +1 -0
  51. package/package.json +35 -4
  52. package/server/index.ts +4 -0
  53. package/server/tsconfig.json +10 -0
  54. package/test/controls.test.ts +51 -0
  55. package/test/detail-facts.test.ts +79 -0
  56. package/test/detail-motion.test.ts +26 -0
  57. package/test/joints.ts +35 -0
  58. package/test/preview.test.ts +53 -0
  59. package/test/resolve-ts-siblings.mjs +85 -0
  60. package/test/view.test.ts +13 -0
  61. package/things-factory.config.js +5 -0
  62. package/translations/en.json +37 -0
  63. package/translations/es.json +37 -0
  64. package/translations/ja.json +37 -0
  65. package/translations/ko.json +37 -0
  66. package/translations/ms.json +37 -0
  67. package/translations/zh.json +37 -0
  68. package/README.md +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"figure-asset-viewer.js","sourceRoot":"","sources":["../client/figure-asset-viewer.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,2BAA2B,EAAoB,MAAM,wBAAwB,CAAA;AAC1G,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EA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AC7C;IAAhB,KAAK,EAAE;;gDAA2D;AAClD;IAAhB,KAAK,EAAE;;iDAA4C;AACnC;IAAhB,KAAK,EAAE;;kDAAqB;AACZ;IAAhB,KAAK,EAAE;;gDAAmB;AAnDhB,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAgQ7B","sourcesContent":["import '@material/web/icon/icon.js'\nimport { css, html, LitElement, nothing, type PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { i18next, localize } from '@operato/i18n'\nimport { compileFigureAsset, FIGURE_INSTANCE_SIZE_INPUTS, type FigureAsset } from '@hatiolab/figure-model'\nimport { create, registerFigure, unregisterFigure } from '@hatiolab/things-scene'\nimport { authoredSizeOf } from './preview-model.js'\nimport { controlsOf } from './controls.js'\nimport { DEFAULT_VIEW, previewBoardDepth, sceneLook } from './figure-view.js'\nimport { SidePanelStyles } from './side-panel-styles.js'\nimport { clipForControl, parametersForClip } from './detail-motion.js'\n\ntype Axis = 'x' | 'y' | 'z'\ninterface Scene {\n dispose?(): void\n resize?(): void\n fit?(type?: string): void\n root?: {\n fitCameraToModel?(): void\n snapshot3d?(width?: number, height?: number, type?: string, quality?: number): Promise<string | undefined>\n\n components?: Array<{ model?: { width?: number; height?: number }; set(props: string | Record<string, unknown>, value?: unknown): void }>\n }\n}\n\n/** A single board instance. Sizes and poses are transient, and never change the asset or call a mutation. */\n@customElement('figure-asset-viewer')\nexport class FigureAssetViewer extends localize(i18next)(LitElement) {\n /* The modeller's side panel look (SidePanelStyles); only the viewport and the slider rows are this element's. */\n static styles = [SidePanelStyles, css`\n :host { display: block; min-width: 0; }\n /* The card's own 4:3, so the picture taken is what is seen. */\n [viewport] { aspect-ratio: 4 / 3; position: relative; background: #858585; }\n [stage] { position: absolute; inset: 0; width: 100%; height: 100%; }\n /*\n The view's own marks in its corner, not buttons beside it: fit the whole figure in view (the modeller's fit, the\n same icon and words), and taking the picture when the screen keeps one.\n */\n div[marks] { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }\n div[marks] button { display: inline-grid; place-items: center; width: 28px; height: 28px;\n padding: 0; border: none; border-radius: 50%; background: rgb(0 0 0 / 22%); color: rgb(255 255 255 / 85%); cursor: pointer; }\n div[marks] button:hover:not(:disabled) { background: rgb(0 0 0 / 45%); color: #fff; }\n div[marks] button:disabled { cursor: default; }\n div[marks] md-icon { --md-icon-size: 16px; }\n section { gap: 4px; padding: 10px 16px; }\n section + section { border-top: 1px solid var(--md-sys-color-outline-variant); }\n section:last-child { border-bottom: none; }\n h3 { justify-content: space-between; margin: 0 0 2px; }\n /* A slider row: its name, the line to drag, and the number -- one 22px line, the number read as text. */\n /*\n A slider row: its name, the line to drag, the number, and a play mark. The name column is wide enough for a joint's\n name and unit (「j2-shoulder · deg」) and wraps rather than cutting it; a row grows with its name.\n */\n div[slide] { display: grid; grid-template-columns: 120px minmax(64px, 1fr) 52px 22px; align-items: center; gap: 8px; min-height: 22px; }\n div[slide] > span { color: var(--md-sys-color-on-surface-variant); overflow-wrap: anywhere; line-height: 1.3; }\n div[slide] input[type='number'] { min-height: 0; height: 20px; padding: 0 2px; border: none; border-bottom: 1px solid transparent; border-radius: 0;\n background: none; text-align: right; font-family: var(--mono-font, monospace); -moz-appearance: textfield; }\n div[slide] input[type='number']::-webkit-inner-spin-button, div[slide] input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }\n div[slide] input[type='number']:hover:not(:disabled) { border-bottom-color: var(--md-sys-color-outline-variant); }\n div[slide] input[type='number']:focus { outline: none; border-bottom-color: var(--md-sys-color-primary); }\n div[slide] input:disabled { opacity: 0.45; }\n div[slide] output { text-align: right; color: var(--md-sys-color-on-surface-variant); font-variant-numeric: tabular-nums; }\n button[icon] { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: none; border-radius: 4px;\n background: transparent; color: var(--md-sys-color-on-surface-variant); cursor: pointer; }\n button[icon]:hover { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); }\n button[icon] md-icon { --md-icon-size: 16px; }\n button[icon][aria-pressed='true'] { color: var(--md-sys-color-primary); }\n p[hint] { margin: 0; }\n p[error] { margin: 0; padding: 8px 16px; color: var(--md-sys-color-error); }\n `]\n @property({ attribute: false }) asset?: FigureAsset\n /** Keeps a picture of the view as the figure's thumbnail. Without it there is no picture to take. */\n @property({ attribute: false }) keepShot?: (dataUrl: string) => Promise<unknown>\n @query('[stage]') private stage!: HTMLElement\n @state() private shot: '' | 'saving' | 'saved' | 'failed' = ''\n @state() private sizes: Record<Axis, number> = { x: 1, y: 1, z: 1 }\n @state() private values: Record<string, number> = {}\n @state() private playing = ''\n @state() private error = ''\n private scene?: Scene\n private registered?: string\n private observer?: ResizeObserver\n private needsScene = false\n private played = new Set<string>()\n /** The board the instance stands on, set when the scene is built; its centre is the grid's origin. */\n private board = { x: 0, z: 0 }\n\n connectedCallback() {\n super.connectedCallback()\n this.needsScene = true\n if (this.hasUpdated) this.observer?.observe(this.stage)\n this.requestUpdate()\n }\n\n protected updated(changed: PropertyValues) {\n // Reconnection and a new asset can arrive in the same update. Build exactly once.\n if (changed.has('asset') || this.needsScene) {\n this.needsScene = false\n this.standUp()\n }\n }\n firstUpdated() {\n this.observer = new ResizeObserver(() => this.scene?.resize?.())\n this.observer.observe(this.stage)\n }\n disconnectedCallback() {\n super.disconnectedCallback()\n this.observer?.disconnect()\n this.teardown()\n }\n\n render() {\n const asset = this.asset\n const clips = asset ? [...new Set((asset.drivers ?? []).map(d => d.clip))] : []\n const controls = asset ? controlsOf(asset, this.values) : []\n const shotLabel = this.shot === 'saved' ? i18next.t('figure.text.detail-thumbnail-saved') : i18next.t('figure.button.detail-save-thumbnail')\n const fitLabel = i18next.t('button.fit-view')\n return html`<div viewport><div stage></div>\n ${this.asset && !this.error\n ? html`<div marks>\n <button fit aria-label=${fitLabel} title=${fitLabel} @click=${() => this.fit()}><md-icon>fit_screen</md-icon></button>\n ${this.keepShot\n ? html`<button shoot aria-label=${shotLabel} title=${shotLabel} ?disabled=${this.shot === 'saving'}\n @click=${() => this.takeShot()}><md-icon>${this.shot === 'saved' ? 'check' : 'photo_camera'}</md-icon></button>`\n : nothing}\n </div>`\n : nothing}\n </div>\n ${this.error ? html`<p error role=\"alert\">${this.error}</p>` : nothing}\n ${this.shot === 'failed' ? html`<p error role=\"alert\">${i18next.t('figure.text.detail-thumbnail-failed')}</p>` : nothing}\n <slot name=\"facts\"></slot>\n ${asset ? html`<section>\n <h3>${i18next.t('figure.label.detail-size')} · mm\n <button icon reset aria-label=${i18next.t('figure.button.detail-reset')} title=${i18next.t('figure.button.detail-reset')}\n @click=${() => this.reset()}><md-icon>restart_alt</md-icon></button></h3>\n ${(['x', 'y', 'z'] as const).map(axis => {\n const input = asset.document.model.inputs.find(input => input.id === FIGURE_INSTANCE_SIZE_INPUTS[axis])\n const fixed = !input || input.min === input.max\n return html`<div slide><span>${axis.toUpperCase()}</span>\n <input type=\"range\" aria-label=${`${axis.toUpperCase()} mm`} min=${input?.min ?? this.sizes[axis]} max=${input?.max ?? this.sizes[axis]} step=\"any\"\n .value=${String(this.sizes[axis])} ?disabled=${fixed}\n @input=${(e: Event) => this.resize(axis, (e.target as HTMLInputElement).valueAsNumber)}>\n <input type=\"number\" aria-label=${`${axis.toUpperCase()} mm value`} min=${input?.min ?? this.sizes[axis]} max=${input?.max ?? this.sizes[axis]} step=\"any\"\n .value=${String(this.sizes[axis])} ?disabled=${fixed}\n @change=${(e: Event) => this.resize(axis, (e.target as HTMLInputElement).valueAsNumber)}>\n <span></span>\n </div>`\n })}\n <p hint>${i18next.t('figure.text.detail-transient')}</p>\n </section>\n <section><h3>${i18next.t('figure.label.motion')}</h3>\n ${controls.map(c => {\n const clip = clipForControl(asset, c.id)\n const on = !!clip && this.playing === clip\n return html`<div slide><span title=${`${c.label} · ${c.unit}`}>${c.label} · ${c.unit}</span>\n <input type=\"range\" aria-label=${c.label} min=${c.min} max=${c.max} step=${c.step || 'any'} .value=${String(c.value)} ?disabled=${on}\n @input=${(e: Event) => this.pose(c.id, (e.target as HTMLInputElement).valueAsNumber)}>\n <output>${on ? i18next.t('figure.text.detail-playing')\n : this.played.has(clip ?? '') && !(c.id in this.values) ? i18next.t('figure.text.detail-paused') : Math.round(c.value * 100) / 100}</output>\n ${clip ? this.playButton(clip) : html`<span></span>`}</div>`\n })}\n ${/* A clip that drives no control shown here still gets its line. */ ''}\n ${clips.filter(name => !controls.some(c => clipForControl(asset, c.id) === name)).map(name => html`<div slide>\n <span title=${name}>${name}</span><span></span>\n <output>${this.playing === name ? i18next.t('figure.text.detail-playing') : ''}</output>${this.playButton(name)}</div>`)}\n ${!controls.length && !clips.length ? html`<p hint>${i18next.t('figure.text.detail-no-motion')}</p>` : nothing}\n </section>` : nothing}`\n }\n\n /**\n * The view as it stands -- turned, zoomed and sized by the person -- as the card's picture, at the size and in the\n * format the modeller's own picture uses (`thumbnail.ts`). Nothing is taken when the view cannot be drawn.\n */\n private async takeShot() {\n const layer = this.scene?.root\n if (!this.keepShot || !layer?.snapshot3d) return\n this.shot = 'saving'\n try {\n const url = await layer.snapshot3d(480, 360, 'image/webp', 0.85)\n if (typeof url !== 'string' || !url.startsWith('data:')) throw Error('no picture')\n await this.keepShot(url)\n this.shot = 'saved'\n setTimeout(() => this.shot === 'saved' && (this.shot = ''), 1500)\n } catch {\n this.shot = 'failed'\n }\n }\n /** The whole figure in view: the board's fit, then the 3D camera's own (as the modeller canvas fits). */\n fit() {\n this.scene?.fit?.('ratio')\n this.scene?.root?.fitCameraToModel?.()\n }\n /** Play or pause a clip, at the end of the line it moves. */\n private playButton(clip: string) {\n const on = this.playing === clip\n return html`<button icon play aria-pressed=${String(on)} aria-label=${clip} title=${clip} @click=${() => this.play(clip)}>\n <md-icon>${on ? 'pause' : 'play_arrow'}</md-icon></button>`\n }\n private tell(key: string, value: unknown) {\n this.scene?.root?.components?.[0]?.set(key, value)\n }\n private resize(axis: Axis, value: number) {\n const input = this.asset?.document.model.inputs.find(input => input.id === FIGURE_INSTANCE_SIZE_INPUTS[axis])\n if (!input || !Number.isFinite(value)) { this.requestUpdate(); return }\n const used = Math.min(input.max, Math.max(input.min, value))\n this.sizes = { ...this.sizes, [axis]: used }\n /*\n The model grows about its own centre, which stays on the board's centre -- the origin of the ground grid. A\n board instance is placed by its corner, so the corner moves with the size. The camera stays where the person\n turned it: refitting on every step slid the grid under the model as if the axes had moved.\n */\n this.scene?.root?.components?.[0]?.set(axis === 'x' ? { width: used } : axis === 'y' ? { depth: used } : { height: used })\n this.centre()\n }\n /**\n * The instance's box on the board's centre. The figure fits its box to the room it declares (its motion included),\n * which can be wider than the size asked, so the box is read back rather than computed here.\n */\n private centre() {\n const instance = this.scene?.root?.components?.[0]\n if (!instance?.model) return\n const { width = 0, height = 0 } = instance.model\n instance.set({ left: this.board.x / 2 - width / 2, top: this.board.z / 2 - height / 2 })\n }\n private pose(id: string, value: number) {\n if (!Number.isFinite(value)) return\n this.values = { ...this.values, [id]: value }\n this.tell('parameters', this.values)\n }\n private play(name: string) {\n this.playing = this.playing === name ? '' : name\n if (this.playing && this.asset) {\n this.played.add(name)\n this.values = parametersForClip(this.asset, this.values, name)\n this.tell('parameters', this.values)\n }\n this.tell('clips', Object.fromEntries([...new Set((this.asset?.drivers ?? []).map(d => d.clip))].map(key => [key, key === this.playing ? 1 : 0])))\n }\n private reset() {\n if (!this.asset) return\n // A new instance also resets driver clocks. Clearing speeds alone freezes the last pose.\n this.standUp()\n }\n private standUp() {\n this.teardown()\n this.error = ''\n const asset = this.asset\n if (!asset) return\n this.values = {}\n this.playing = ''\n this.shot = ''\n this.played.clear()\n try {\n compileFigureAsset(asset)\n if (!asset.appearance.length) throw Error(i18next.t('figure.text.preview-needs-a-part'))\n this.sizes = authoredSizeOf(asset)\n const type = `figure-detail-${crypto.randomUUID()}`\n registerFigure(type, asset)\n this.registered = type\n const size = this.sizes\n this.board = { x: size.x * 2, z: size.z * 2 }\n this.scene = create({ target: this.stage, mode: 0, model: {\n type: 'model-layer', width: size.x * 2, height: size.z * 2,\n depth: previewBoardDepth({ placement: asset.placement, base: { y: size.y } }, DEFAULT_VIEW.ceilingHeight, 1),\n threed: true, sky: 'color', ...sceneLook(DEFAULT_VIEW),\n placement: DEFAULT_VIEW.placement, heights: { floor: 0, ceiling: DEFAULT_VIEW.ceilingHeight },\n pixelRatio: Math.min(3, (window.devicePixelRatio || 1) * 2),\n components: [{ type, id: 'detail-instance', left: size.x / 2, top: size.z / 2, width: size.x, height: size.z, depth: size.y }]\n } }) as Scene\n this.centre()\n this.scene.resize?.()\n this.fit()\n } catch (error) {\n this.error = (error as Error).message\n this.teardown()\n }\n }\n private teardown() {\n this.scene?.dispose?.()\n this.scene = undefined\n if (this.registered) unregisterFigure(this.registered)\n this.registered = undefined\n }\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { LitElement, nothing } from 'lit';
2
+ import type { FigureAsset } from '@hatiolab/figure-model';
3
+ import { type DetailFactsRow } from './detail-facts.js';
4
+ declare const FigureFactsList_base: (new (...args: any[]) => LitElement) & typeof LitElement;
5
+ /**
6
+ * What a figure is, as labelled lines under its live canvas: category, tags, placement, the sizes a board may give it,
7
+ * what it does, its places (one line each: name · role · accepts · how many), joints, extensions, and the score and the
8
+ * last change when the row keeps them. operato-figure's catalogue preview and a board server's release compare show it
9
+ * alike; it goes into figure-asset-viewer's `facts` slot.
10
+ */
11
+ export declare class FigureFactsList extends FigureFactsList_base {
12
+ static styles: import("lit").CSSResult;
13
+ asset?: FigureAsset;
14
+ row?: DetailFactsRow;
15
+ render(): import("lit-html").TemplateResult<1> | typeof nothing;
16
+ }
17
+ export {};
@@ -0,0 +1,63 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { css, html, LitElement, nothing } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import { i18next, localize } from '@operato/i18n';
5
+ import { detailFactsOf } from './detail-facts.js';
6
+ /**
7
+ * What a figure is, as labelled lines under its live canvas: category, tags, placement, the sizes a board may give it,
8
+ * what it does, its places (one line each: name · role · accepts · how many), joints, extensions, and the score and the
9
+ * last change when the row keeps them. operato-figure's catalogue preview and a board server's release compare show it
10
+ * alike; it goes into figure-asset-viewer's `facts` slot.
11
+ */
12
+ let FigureFactsList = class FigureFactsList extends localize(i18next)(LitElement) {
13
+ static { this.styles = css `
14
+ :host {
15
+ display: block;
16
+ border-bottom: 1px solid var(--md-sys-color-outline-variant);
17
+ }
18
+ dl {
19
+ display: grid;
20
+ grid-template-columns: 96px minmax(0, 1fr);
21
+ gap: 3px 12px;
22
+ margin: 0;
23
+ padding: 10px 16px;
24
+ line-height: 1.45;
25
+ }
26
+ dt {
27
+ overflow: hidden;
28
+ text-overflow: ellipsis;
29
+ white-space: nowrap;
30
+ color: var(--md-sys-color-on-surface-variant);
31
+ }
32
+ dd {
33
+ margin: 0;
34
+ overflow-wrap: anywhere;
35
+ }
36
+ dd small {
37
+ display: block;
38
+ color: var(--md-sys-color-on-surface-variant);
39
+ }
40
+ `; }
41
+ render() {
42
+ if (!this.asset || !this.row)
43
+ return nothing;
44
+ const facts = detailFactsOf(this.asset, this.row, (key, params) => i18next.t(key, params));
45
+ return html `<dl>
46
+ ${facts.map(fact => html `<dt title=${fact.label}>${fact.label}</dt>
47
+ <dd>${fact.value}${fact.lines?.map(line => html `<small>${line}</small>`)}</dd>`)}
48
+ </dl>`;
49
+ }
50
+ };
51
+ __decorate([
52
+ property({ attribute: false }),
53
+ __metadata("design:type", Object)
54
+ ], FigureFactsList.prototype, "asset", void 0);
55
+ __decorate([
56
+ property({ attribute: false }),
57
+ __metadata("design:type", Object)
58
+ ], FigureFactsList.prototype, "row", void 0);
59
+ FigureFactsList = __decorate([
60
+ customElement('figure-facts-list')
61
+ ], FigureFactsList);
62
+ export { FigureFactsList };
63
+ //# sourceMappingURL=figure-facts-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"figure-facts-list.js","sourceRoot":"","sources":["../client/figure-facts-list.ts"],"names":[],"m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AAmB,CAAC;GACtB,eAAe,CA2C3B","sourcesContent":["import { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport type { FigureAsset } from '@hatiolab/figure-model'\n\nimport { detailFactsOf, type DetailFactsRow } from './detail-facts.js'\n\n/**\n * What a figure is, as labelled lines under its live canvas: category, tags, placement, the sizes a board may give it,\n * what it does, its places (one line each: name · role · accepts · how many), joints, extensions, and the score and the\n * last change when the row keeps them. operato-figure's catalogue preview and a board server's release compare show it\n * alike; it goes into figure-asset-viewer's `facts` slot.\n */\n@customElement('figure-facts-list')\nexport class FigureFactsList extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n display: block;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n }\n dl {\n display: grid;\n grid-template-columns: 96px minmax(0, 1fr);\n gap: 3px 12px;\n margin: 0;\n padding: 10px 16px;\n line-height: 1.45;\n }\n dt {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--md-sys-color-on-surface-variant);\n }\n dd {\n margin: 0;\n overflow-wrap: anywhere;\n }\n dd small {\n display: block;\n color: var(--md-sys-color-on-surface-variant);\n }\n `\n\n @property({ attribute: false }) asset?: FigureAsset\n @property({ attribute: false }) row?: DetailFactsRow\n\n render() {\n if (!this.asset || !this.row) return nothing\n const facts = detailFactsOf(this.asset, this.row, (key, params) => i18next.t(key, params))\n return html`<dl>\n ${facts.map(\n fact => html`<dt title=${fact.label}>${fact.label}</dt>\n <dd>${fact.value}${fact.lines?.map(line => html`<small>${line}</small>`)}</dd>`\n )}\n </dl>`\n }\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import '@material/web/icon/icon.js';
2
+ import { LitElement } from 'lit';
3
+ /**
4
+ * A figure without a thumbnail: a faint 3D mark filling most of the picture's height, no text (the sentence is the
5
+ * label a screen reader reads). Its own element because a card draws its picture inside the card, out of the page's
6
+ * styles. operato-figure's catalog card (figure-ui figure-thumb) draws the same mark at the same size.
7
+ */
8
+ export declare class FigureThumbMark extends LitElement {
9
+ static styles: import("lit").CSSResult;
10
+ label: string;
11
+ render(): import("lit-html").TemplateResult<1>;
12
+ }
@@ -0,0 +1,42 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@material/web/icon/icon.js';
3
+ import { css, html, LitElement } from 'lit';
4
+ import { customElement, property } from 'lit/decorators.js';
5
+ /**
6
+ * A figure without a thumbnail: a faint 3D mark filling most of the picture's height, no text (the sentence is the
7
+ * label a screen reader reads). Its own element because a card draws its picture inside the card, out of the page's
8
+ * styles. operato-figure's catalog card (figure-ui figure-thumb) draws the same mark at the same size.
9
+ */
10
+ let FigureThumbMark = class FigureThumbMark extends LitElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.label = '';
14
+ }
15
+ static { this.styles = css `
16
+ :host {
17
+ display: grid;
18
+ place-items: center;
19
+ width: 100%;
20
+ height: 100%;
21
+ container-type: size;
22
+ }
23
+
24
+ md-icon {
25
+ --md-icon-size: 60cqh;
26
+ color: var(--md-sys-color-on-surface);
27
+ opacity: 0.12;
28
+ }
29
+ `; }
30
+ render() {
31
+ return html `<md-icon role="img" aria-label=${this.label}>deployed_code</md-icon>`;
32
+ }
33
+ };
34
+ __decorate([
35
+ property(),
36
+ __metadata("design:type", Object)
37
+ ], FigureThumbMark.prototype, "label", void 0);
38
+ FigureThumbMark = __decorate([
39
+ customElement('figure-thumb-mark')
40
+ ], FigureThumbMark);
41
+ export { FigureThumbMark };
42
+ //# sourceMappingURL=figure-thumb-mark.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"figure-thumb-mark.js","sourceRoot":"","sources":["../client/figure-thumb-mark.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D;;;;GAIG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QAiBO,UAAK,GAAG,EAAE,CAAA;IAKxB,CAAC;aArBQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;GAclB,AAdY,CAcZ;IAID,MAAM;QACJ,OAAO,IAAI,CAAA,kCAAkC,IAAI,CAAC,KAAK,0BAA0B,CAAA;IACnF,CAAC;;AAJW;IAAX,QAAQ,EAAE;;8CAAW;AAjBX,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAsB3B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\n/**\n * A figure without a thumbnail: a faint 3D mark filling most of the picture's height, no text (the sentence is the\n * label a screen reader reads). Its own element because a card draws its picture inside the card, out of the page's\n * styles. operato-figure's catalog card (figure-ui figure-thumb) draws the same mark at the same size.\n */\n@customElement('figure-thumb-mark')\nexport class FigureThumbMark extends LitElement {\n static styles = css`\n :host {\n display: grid;\n place-items: center;\n width: 100%;\n height: 100%;\n container-type: size;\n }\n\n md-icon {\n --md-icon-size: 60cqh;\n color: var(--md-sys-color-on-surface);\n opacity: 0.12;\n }\n `\n\n @property() label = ''\n\n render() {\n return html`<md-icon role=\"img\" aria-label=${this.label}>deployed_code</md-icon>`\n }\n}\n"]}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * 저작 화면의 **보기 설정**.
3
+ *
4
+ * ## 저장되지 않는다
5
+ *
6
+ * 이것은 자산이 아니라 **작업대**다. 조명을 밝게 하고 바닥을 켠 것은 그 사람이 지금
7
+ * 보기 편한 상태일 뿐, 그 자산의 성질이 아니다. 그래서 자산에 안 들어가고, 보는 사람의
8
+ * 브라우저에 남는다.
9
+ *
10
+ * 다른 사람이 같은 자산을 열면 자기 설정으로 본다. 그것이 맞다.
11
+ *
12
+ * ## 씬이 아는 이름을 그대로 쓴다
13
+ *
14
+ * 여기 이름은 전부 `model-layer` 의 상태 이름이다. 옮겨 적는 표를 두지 않는다 — 표를
15
+ * 두면 씬이 새 설정을 받아도 이쪽이 모른다.
16
+ *
17
+ * 값이 바뀌면 씬이 스스로 반영한다(`three-capability` 의 `onchange`). 다만 `grid` 는
18
+ * 한동안 3D 를 세울 때만 읽혔다 — things-scene 10.1.5 에서 고쳤다.
19
+ */
20
+ export interface ViewSettings {
21
+ /**
22
+ * 어떤 도면에 놓인 것으로 보나 — 씬 전체의 좌표 모드.
23
+ *
24
+ * **도형의 `placement` 와 다른 것이다.** 도형의 것은 「이 종류는 바닥에 서나, 천장에
25
+ * 매달리나」이고, 이것은 「지금 보고 있는 도면이 어느 쪽을 기준으로 재나」다. 바닥
26
+ * 기준 도면에 천정 기반 OHT 를 놓으면 도면은 안 뒤집히고 OHT 가 천장 높이에 매달린다.
27
+ *
28
+ * 한동안 도형의 `placement` 를 이 자리에 흘려 넣었다. 모델러에 도형이 하나뿐이라
29
+ * 그럴듯해 보였지만, 그러면 도형의 성질이 씬 전체를 뒤집는다 — 도면에서는 성립할 수가
30
+ * 없고(도면에는 도형이 여럿이다), 저작 중에는 배치를 고를 때마다 저작자가 적어 둔
31
+ * 높이가 전부 다른 숫자로 보였다.
32
+ *
33
+ * 씬의 낱말 그대로다: `floor` 바닥 기준 · `space` 중심 기준(바닥 없음) · `inverted`
34
+ * 천장 기준. **미리보기에만 먹인다** — 편집 캔버스의 `zPos` 는 저작자가 직접 적는
35
+ * 숫자라 그 뜻이 보기 설정에 따라 바뀌면 안 된다.
36
+ */
37
+ placement: 'floor' | 'space' | 'inverted';
38
+ /**
39
+ * 천장 높이 (mm). 천정 기반 도형을 미리보기에서 어디에 매달 것인가.
40
+ *
41
+ * 도형은 제가 놓일 방의 높이를 모른다. 도면은 알지만 미리보기에는 도면이 없으므로,
42
+ * 저작자가 가정할 값을 여기서 정한다.
43
+ */
44
+ ceilingHeight: number;
45
+ /** 좌표 바탕(축 가이드). 원점과 눈금을 보인다. */
46
+ grid: boolean;
47
+ /** 축 이름표(X · Y · Z). 눈금만 두고 글자를 끌 수 있다. */
48
+ gridLabels: boolean;
49
+ /** 판의 바닥면. 좌표 바탕과 겹치므로 기본은 끈다. */
50
+ floor: boolean;
51
+ /** Environment — 반사(IBL). 금속 재질이 무엇을 비출지 정한다. */
52
+ environment: EnvironmentName;
53
+ /** Sky Color — 배경색. */
54
+ skyColor: string;
55
+ /** Key Light Intensity. */
56
+ dirLightIntensity: number;
57
+ /** Key Light — Follow Camera. 끄면 그림자 방향이 고정된다. */
58
+ dirLightFollowCamera: boolean;
59
+ /** Key Light — Cast Shadow. */
60
+ dirShadowEnabled: boolean;
61
+ /** Hemisphere Light Intensity — 그늘진 면을 들어올린다. */
62
+ hemiIntensity: number;
63
+ }
64
+ /**
65
+ * 환경 프리셋 — **`scene-manager` 의 `SkyPreset` 과 같은 여덟이다.**
66
+ *
67
+ * 한동안 다섯만 적었다. 씬은 여덟을 다 받는데 이쪽이 셋을 몰라서 고를 수 없었다.
68
+ * operato-board 의 3D 씬 속성 패널도 같은 여덟을 보인다.
69
+ */
70
+ export declare const ENVIRONMENTS: readonly ["studio", "warehouse", "factory", "office", "home", "sunny", "cloudy", "rainy"];
71
+ export type EnvironmentName = (typeof ENVIRONMENTS)[number];
72
+ /**
73
+ * 씬에 그대로 넣는 보기 설정 — **좌표 기준과 천장 높이는 빼고.**
74
+ *
75
+ * 나머지는 전부 `model-layer` 의 상태 이름이라 그대로 넣으면 씬이 알아서 반응한다.
76
+ * 그런데 `placement` 는 편집 캔버스에 들어가면 안 되고(거기는 늘 상자 기준이다),
77
+ * `ceilingHeight` 는 씬이 모르는 이름이다.
78
+ *
79
+ * **rest spread 로 넘기지 않으려고 이 함수가 있다.** 캔버스가 한동안
80
+ * `const { grid, ..., ...light } = view` 로 나머지를 통째로 넘겼는데, 그러면 설정을
81
+ * 하나 더할 때마다 그것이 두 화면에 **말없이** 실린다. 새로 더한 좌표 기준이 바로
82
+ * 그 길로 캔버스에 들어갈 뻔했다.
83
+ */
84
+ export declare function sceneLook(view: ViewSettings): Record<string, unknown>;
85
+ /**
86
+ * 씬의 좌표 기준 — **씬의 낱말 그대로 셋이다.**
87
+ *
88
+ * 형식의 `floor` · `center` · `ceiling` 과 짝이 맞지만 철자가 다르다. 옮겨 적는 표를 두지
89
+ * 않는 것이 이 파일의 규칙이므로 씬 쪽을 쓴다. 화면에는 둘 다 보인다 — 「천장 기준
90
+ * (inverted)」.
91
+ */
92
+ export declare const SCENE_REFERENCES: readonly ["floor", "space", "inverted"];
93
+ /** 배경색 기본값. 회색이라 부품 색이 제 색으로 보인다. */
94
+ export declare const WORKBENCH = "#7c7c7c";
95
+ /**
96
+ * 처음 값.
97
+ *
98
+ * **지금 저작 화면이 실제로 쓰던 값 그대로다.** 설정을 만들면서 화면이 달라지면
99
+ * 무엇이 설정 때문이고 무엇이 원래 그랬는지 갈리지 않는다.
100
+ */
101
+ export declare const DEFAULT_VIEW: ViewSettings;
102
+ /**
103
+ * How tall the preview board is: enough room for the tallest instance where the figure actually stands.
104
+ *
105
+ * A floor or center figure stands on the floor, so the tallest instance is the whole height. Only a
106
+ * ceiling figure needs the room up to the ceiling. The board used to reach the ceiling for every figure,
107
+ * which made a 920 tall AGV preview 4400 tall.
108
+ *
109
+ * This is an envelope, not a placement rule: where each instance goes is still the scene's
110
+ * (`FigureRealObject.effectiveZPos`), and the camera fits what the scene drew.
111
+ */
112
+ export declare function previewBoardDepth(figure: {
113
+ placement?: 'floor' | 'ceiling' | 'center' | 'wall';
114
+ base: {
115
+ y: number;
116
+ };
117
+ }, ceilingHeight: number, factor: number): number;
@@ -0,0 +1,78 @@
1
+ /**
2
+ * 환경 프리셋 — **`scene-manager` 의 `SkyPreset` 과 같은 여덟이다.**
3
+ *
4
+ * 한동안 다섯만 적었다. 씬은 여덟을 다 받는데 이쪽이 셋을 몰라서 고를 수 없었다.
5
+ * operato-board 의 3D 씬 속성 패널도 같은 여덟을 보인다.
6
+ */
7
+ export const ENVIRONMENTS = [
8
+ 'studio',
9
+ 'warehouse',
10
+ 'factory',
11
+ 'office',
12
+ 'home',
13
+ 'sunny',
14
+ 'cloudy',
15
+ 'rainy'
16
+ ];
17
+ /**
18
+ * 씬에 그대로 넣는 보기 설정 — **좌표 기준과 천장 높이는 빼고.**
19
+ *
20
+ * 나머지는 전부 `model-layer` 의 상태 이름이라 그대로 넣으면 씬이 알아서 반응한다.
21
+ * 그런데 `placement` 는 편집 캔버스에 들어가면 안 되고(거기는 늘 상자 기준이다),
22
+ * `ceilingHeight` 는 씬이 모르는 이름이다.
23
+ *
24
+ * **rest spread 로 넘기지 않으려고 이 함수가 있다.** 캔버스가 한동안
25
+ * `const { grid, ..., ...light } = view` 로 나머지를 통째로 넘겼는데, 그러면 설정을
26
+ * 하나 더할 때마다 그것이 두 화면에 **말없이** 실린다. 새로 더한 좌표 기준이 바로
27
+ * 그 길로 캔버스에 들어갈 뻔했다.
28
+ */
29
+ export function sceneLook(view) {
30
+ const { placement, ceilingHeight, ...look } = view;
31
+ return look;
32
+ }
33
+ /**
34
+ * 씬의 좌표 기준 — **씬의 낱말 그대로 셋이다.**
35
+ *
36
+ * 형식의 `floor` · `center` · `ceiling` 과 짝이 맞지만 철자가 다르다. 옮겨 적는 표를 두지
37
+ * 않는 것이 이 파일의 규칙이므로 씬 쪽을 쓴다. 화면에는 둘 다 보인다 — 「천장 기준
38
+ * (inverted)」.
39
+ */
40
+ export const SCENE_REFERENCES = ['floor', 'space', 'inverted'];
41
+ /** 배경색 기본값. 회색이라 부품 색이 제 색으로 보인다. */
42
+ export const WORKBENCH = '#7c7c7c';
43
+ /**
44
+ * 처음 값.
45
+ *
46
+ * **지금 저작 화면이 실제로 쓰던 값 그대로다.** 설정을 만들면서 화면이 달라지면
47
+ * 무엇이 설정 때문이고 무엇이 원래 그랬는지 갈리지 않는다.
48
+ */
49
+ export const DEFAULT_VIEW = {
50
+ placement: 'floor',
51
+ /* 공장 천장의 흔한 높이. 반도체 fab 의 OHT 레일이 대체로 이 언저리다. */
52
+ ceilingHeight: 4000,
53
+ grid: true,
54
+ gridLabels: true,
55
+ floor: false,
56
+ environment: 'studio',
57
+ skyColor: WORKBENCH,
58
+ dirLightIntensity: 2.0,
59
+ dirLightFollowCamera: true,
60
+ dirShadowEnabled: true,
61
+ hemiIntensity: 4.0
62
+ };
63
+ /**
64
+ * How tall the preview board is: enough room for the tallest instance where the figure actually stands.
65
+ *
66
+ * A floor or center figure stands on the floor, so the tallest instance is the whole height. Only a
67
+ * ceiling figure needs the room up to the ceiling. The board used to reach the ceiling for every figure,
68
+ * which made a 920 tall AGV preview 4400 tall.
69
+ *
70
+ * This is an envelope, not a placement rule: where each instance goes is still the scene's
71
+ * (`FigureRealObject.effectiveZPos`), and the camera fits what the scene drew.
72
+ */
73
+ export function previewBoardDepth(figure, ceilingHeight, factor) {
74
+ const tallest = figure.base.y * factor;
75
+ const reach = figure.placement === 'ceiling' ? Math.max(ceilingHeight, tallest) : tallest;
76
+ return Math.round(reach * 1.1);
77
+ }
78
+ //# sourceMappingURL=figure-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"figure-view.js","sourceRoot":"","sources":["../client/figure-view.ts"],"names":[],"mappings":"AAgEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,QAAQ;IACR,WAAW;IACX,SAAS;IACT,QAAQ;IACR,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;CACC,CAAA;AAGV;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,SAAS,CAAC,IAAkB;IAC1C,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAA;IAClD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAU,CAAA;AAEvE,qCAAqC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAA;AAElC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,SAAS,EAAE,OAAO;IAClB,iDAAiD;IACjD,aAAa,EAAE,IAAI;IACnB,IAAI,EAAE,IAAI;IACV,UAAU,EAAE,IAAI;IAChB,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,QAAQ;IACrB,QAAQ,EAAE,SAAS;IACnB,iBAAiB,EAAE,GAAG;IACtB,oBAAoB,EAAE,IAAI;IAC1B,gBAAgB,EAAE,IAAI;IACtB,aAAa,EAAE,GAAG;CACnB,CAAA;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAoF,EACpF,aAAqB,EACrB,MAAc;IAEd,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,CAAA;IACtC,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IACzF,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,CAAA;AAChC,CAAC","sourcesContent":["/**\n * 저작 화면의 **보기 설정**.\n *\n * ## 저장되지 않는다\n *\n * 이것은 자산이 아니라 **작업대**다. 조명을 밝게 하고 바닥을 켠 것은 그 사람이 지금\n * 보기 편한 상태일 뿐, 그 자산의 성질이 아니다. 그래서 자산에 안 들어가고, 보는 사람의\n * 브라우저에 남는다.\n *\n * 다른 사람이 같은 자산을 열면 자기 설정으로 본다. 그것이 맞다.\n *\n * ## 씬이 아는 이름을 그대로 쓴다\n *\n * 여기 이름은 전부 `model-layer` 의 상태 이름이다. 옮겨 적는 표를 두지 않는다 — 표를\n * 두면 씬이 새 설정을 받아도 이쪽이 모른다.\n *\n * 값이 바뀌면 씬이 스스로 반영한다(`three-capability` 의 `onchange`). 다만 `grid` 는\n * 한동안 3D 를 세울 때만 읽혔다 — things-scene 10.1.5 에서 고쳤다.\n */\nexport interface ViewSettings {\n /**\n * 어떤 도면에 놓인 것으로 보나 — 씬 전체의 좌표 모드.\n *\n * **도형의 `placement` 와 다른 것이다.** 도형의 것은 「이 종류는 바닥에 서나, 천장에\n * 매달리나」이고, 이것은 「지금 보고 있는 도면이 어느 쪽을 기준으로 재나」다. 바닥\n * 기준 도면에 천정 기반 OHT 를 놓으면 도면은 안 뒤집히고 OHT 가 천장 높이에 매달린다.\n *\n * 한동안 도형의 `placement` 를 이 자리에 흘려 넣었다. 모델러에 도형이 하나뿐이라\n * 그럴듯해 보였지만, 그러면 도형의 성질이 씬 전체를 뒤집는다 — 도면에서는 성립할 수가\n * 없고(도면에는 도형이 여럿이다), 저작 중에는 배치를 고를 때마다 저작자가 적어 둔\n * 높이가 전부 다른 숫자로 보였다.\n *\n * 씬의 낱말 그대로다: `floor` 바닥 기준 · `space` 중심 기준(바닥 없음) · `inverted`\n * 천장 기준. **미리보기에만 먹인다** — 편집 캔버스의 `zPos` 는 저작자가 직접 적는\n * 숫자라 그 뜻이 보기 설정에 따라 바뀌면 안 된다.\n */\n placement: 'floor' | 'space' | 'inverted'\n /**\n * 천장 높이 (mm). 천정 기반 도형을 미리보기에서 어디에 매달 것인가.\n *\n * 도형은 제가 놓일 방의 높이를 모른다. 도면은 알지만 미리보기에는 도면이 없으므로,\n * 저작자가 가정할 값을 여기서 정한다.\n */\n ceilingHeight: number\n /** 좌표 바탕(축 가이드). 원점과 눈금을 보인다. */\n grid: boolean\n /** 축 이름표(X · Y · Z). 눈금만 두고 글자를 끌 수 있다. */\n gridLabels: boolean\n /** 판의 바닥면. 좌표 바탕과 겹치므로 기본은 끈다. */\n floor: boolean\n /** Environment — 반사(IBL). 금속 재질이 무엇을 비출지 정한다. */\n environment: EnvironmentName\n /** Sky Color — 배경색. */\n skyColor: string\n /** Key Light Intensity. */\n dirLightIntensity: number\n /** Key Light — Follow Camera. 끄면 그림자 방향이 고정된다. */\n dirLightFollowCamera: boolean\n /** Key Light — Cast Shadow. */\n dirShadowEnabled: boolean\n /** Hemisphere Light Intensity — 그늘진 면을 들어올린다. */\n hemiIntensity: number\n}\n\n/**\n * 환경 프리셋 — **`scene-manager` 의 `SkyPreset` 과 같은 여덟이다.**\n *\n * 한동안 다섯만 적었다. 씬은 여덟을 다 받는데 이쪽이 셋을 몰라서 고를 수 없었다.\n * operato-board 의 3D 씬 속성 패널도 같은 여덟을 보인다.\n */\nexport const ENVIRONMENTS = [\n 'studio',\n 'warehouse',\n 'factory',\n 'office',\n 'home',\n 'sunny',\n 'cloudy',\n 'rainy'\n] as const\nexport type EnvironmentName = (typeof ENVIRONMENTS)[number]\n\n/**\n * 씬에 그대로 넣는 보기 설정 — **좌표 기준과 천장 높이는 빼고.**\n *\n * 나머지는 전부 `model-layer` 의 상태 이름이라 그대로 넣으면 씬이 알아서 반응한다.\n * 그런데 `placement` 는 편집 캔버스에 들어가면 안 되고(거기는 늘 상자 기준이다),\n * `ceilingHeight` 는 씬이 모르는 이름이다.\n *\n * **rest spread 로 넘기지 않으려고 이 함수가 있다.** 캔버스가 한동안\n * `const { grid, ..., ...light } = view` 로 나머지를 통째로 넘겼는데, 그러면 설정을\n * 하나 더할 때마다 그것이 두 화면에 **말없이** 실린다. 새로 더한 좌표 기준이 바로\n * 그 길로 캔버스에 들어갈 뻔했다.\n */\nexport function sceneLook(view: ViewSettings): Record<string, unknown> {\n const { placement, ceilingHeight, ...look } = view\n return look\n}\n\n/**\n * 씬의 좌표 기준 — **씬의 낱말 그대로 셋이다.**\n *\n * 형식의 `floor` · `center` · `ceiling` 과 짝이 맞지만 철자가 다르다. 옮겨 적는 표를 두지\n * 않는 것이 이 파일의 규칙이므로 씬 쪽을 쓴다. 화면에는 둘 다 보인다 — 「천장 기준\n * (inverted)」.\n */\nexport const SCENE_REFERENCES = ['floor', 'space', 'inverted'] as const\n\n/** 배경색 기본값. 회색이라 부품 색이 제 색으로 보인다. */\nexport const WORKBENCH = '#7c7c7c'\n\n/**\n * 처음 값.\n *\n * **지금 저작 화면이 실제로 쓰던 값 그대로다.** 설정을 만들면서 화면이 달라지면\n * 무엇이 설정 때문이고 무엇이 원래 그랬는지 갈리지 않는다.\n */\nexport const DEFAULT_VIEW: ViewSettings = {\n placement: 'floor',\n /* 공장 천장의 흔한 높이. 반도체 fab 의 OHT 레일이 대체로 이 언저리다. */\n ceilingHeight: 4000,\n grid: true,\n gridLabels: true,\n floor: false,\n environment: 'studio',\n skyColor: WORKBENCH,\n dirLightIntensity: 2.0,\n dirLightFollowCamera: true,\n dirShadowEnabled: true,\n hemiIntensity: 4.0\n}\n\n/**\n * How tall the preview board is: enough room for the tallest instance where the figure actually stands.\n *\n * A floor or center figure stands on the floor, so the tallest instance is the whole height. Only a\n * ceiling figure needs the room up to the ceiling. The board used to reach the ceiling for every figure,\n * which made a 920 tall AGV preview 4400 tall.\n *\n * This is an envelope, not a placement rule: where each instance goes is still the scene's\n * (`FigureRealObject.effectiveZPos`), and the camera fits what the scene drew.\n */\nexport function previewBoardDepth(\n figure: { placement?: 'floor' | 'ceiling' | 'center' | 'wall'; base: { y: number } },\n ceilingHeight: number,\n factor: number\n): number {\n const tallest = figure.base.y * factor\n const reach = figure.placement === 'ceiling' ? Math.max(ceilingHeight, tallest) : tallest\n return Math.round(reach * 1.1)\n}\n"]}
@@ -0,0 +1,10 @@
1
+ export * from './capability-rung.js';
2
+ export * from './controls.js';
3
+ export * from './detail-facts.js';
4
+ export * from './detail-motion.js';
5
+ export * from './figure-asset-viewer.js';
6
+ export * from './figure-facts-list.js';
7
+ export * from './figure-thumb-mark.js';
8
+ export * from './figure-view.js';
9
+ export * from './preview-model.js';
10
+ export * from './side-panel-styles.js';
@@ -0,0 +1,15 @@
1
+ /*
2
+ * A released figure on a live canvas, shared by figure-ui (the authoring catalogue) and figure-library (a board
3
+ * server's library). Importers use the files by path (`@things-factory/figure-viewer/dist-client/<file>.js`).
4
+ */
5
+ export * from './capability-rung.js';
6
+ export * from './controls.js';
7
+ export * from './detail-facts.js';
8
+ export * from './detail-motion.js';
9
+ export * from './figure-asset-viewer.js';
10
+ export * from './figure-facts-list.js';
11
+ export * from './figure-thumb-mark.js';
12
+ export * from './figure-view.js';
13
+ export * from './preview-model.js';
14
+ export * from './side-panel-styles.js';
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,sBAAsB,CAAA;AACpC,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA","sourcesContent":["/*\n * A released figure on a live canvas, shared by figure-ui (the authoring catalogue) and figure-library (a board\n * server's library). Importers use the files by path (`@things-factory/figure-viewer/dist-client/<file>.js`).\n */\nexport * from './capability-rung.js'\nexport * from './controls.js'\nexport * from './detail-facts.js'\nexport * from './detail-motion.js'\nexport * from './figure-asset-viewer.js'\nexport * from './figure-facts-list.js'\nexport * from './figure-thumb-mark.js'\nexport * from './figure-view.js'\nexport * from './preview-model.js'\nexport * from './side-panel-styles.js'\n"]}
@@ -0,0 +1,54 @@
1
+ import type { FigureAsset } from '@hatiolab/figure-model';
2
+ export declare const PREVIEW_FACTOR = 2;
3
+ /** The type the preview registers the figure under: this figure's own, never a real type a board uses. */
4
+ export declare function previewTypeOf(context: string): string;
5
+ export declare const PREVIEW_WAYS: readonly {
6
+ name: string;
7
+ axes: readonly ('x' | 'y' | 'z')[];
8
+ }[];
9
+ /** The size the figure was made at: its instance size when it declares one, else the room its bodies take. */
10
+ export declare function authoredSizeOf(asset: FigureAsset): {
11
+ x: number;
12
+ y: number;
13
+ z: number;
14
+ };
15
+ /** The eight instances: where each stands on the board and how large, in the scene's words. */
16
+ export declare function previewInstances(type: string, size: {
17
+ x: number;
18
+ y: number;
19
+ z: number;
20
+ }): {
21
+ components: {
22
+ type: string;
23
+ id: string;
24
+ left: number;
25
+ top: number;
26
+ width: number;
27
+ height: number;
28
+ depth: number;
29
+ }[];
30
+ board: {
31
+ width: number;
32
+ height: number;
33
+ };
34
+ };
35
+ /**
36
+ * Where a variant asks a size the figure does not declare, the size it is drawn at instead -- as the board draws it
37
+ * (things-scene clamps each axis to the declared range; chief architect's ruling 2026-09-25). Per variant, empty when
38
+ * it is drawn as asked. A figure that follows its height only is drawn at its one width in the wider variants, and
39
+ * the preview says so rather than drawing them as though they grew.
40
+ */
41
+ export declare function previewClampsOf(asset: FigureAsset, size: {
42
+ x: number;
43
+ y: number;
44
+ z: number;
45
+ }): Record<string, Array<{
46
+ axis: 'x' | 'y' | 'z';
47
+ asked: number;
48
+ used: number;
49
+ }>>;
50
+ /**
51
+ * The part the preview's size help speaks of: the one picked in the help, else the one chosen in the editor, else the
52
+ * first that has a size rule. A choice that is not among the parts (removed, or a part with no rule) is passed over.
53
+ */
54
+ export declare function setupPartOf(picked: string, chosen: string, targets: string[]): string;
@@ -0,0 +1,79 @@
1
+ import { compileFigureAsset, figureOccupiedBoxesOf, figureWritersOf, FIGURE_INSTANCE_SIZE_INPUTS } from '@hatiolab/figure-model';
2
+ /* The preview's arithmetic, apart from the element so it is tested without a browser (see figure-preview.ts). */
3
+ export const PREVIEW_FACTOR = 2;
4
+ /** The type the preview registers the figure under: this figure's own, never a real type a board uses. */
5
+ export function previewTypeOf(context) {
6
+ return `figure-preview-${context || 'new'}`;
7
+ }
8
+ export const PREVIEW_WAYS = [
9
+ { name: 'base', axes: [] },
10
+ { name: 'x', axes: ['x'] },
11
+ { name: 'y', axes: ['y'] },
12
+ { name: 'z', axes: ['z'] },
13
+ { name: 'x·y', axes: ['x', 'y'] },
14
+ { name: 'x·z', axes: ['x', 'z'] },
15
+ { name: 'y·z', axes: ['y', 'z'] },
16
+ { name: 'x·y·z', axes: ['x', 'y', 'z'] }
17
+ ];
18
+ /** The size the figure was made at: its instance size when it declares one, else the room its bodies take. */
19
+ export function authoredSizeOf(asset) {
20
+ const d = asset.designInputs;
21
+ const declared = ['x', 'y', 'z'].map(axis => d[FIGURE_INSTANCE_SIZE_INPUTS[axis]]);
22
+ if (declared.every(v => typeof v === 'number' && v > 0))
23
+ return { x: declared[0], y: declared[1], z: declared[2] };
24
+ /* No declared size: the room its bodies take up, so the instance is placed at the size it draws. */
25
+ const boxes = figureOccupiedBoxesOf(compileFigureAsset(asset).evaluate().geometry, figureWritersOf(asset));
26
+ const span = (axis) => boxes.length ? Math.max(...boxes.map(b => b.centre[axis] + b.extent[axis] / 2)) - Math.min(...boxes.map(b => b.centre[axis] - b.extent[axis] / 2)) : 0;
27
+ return { x: Math.max(1, Math.round(span('x'))), y: Math.max(1, Math.round(span('y'))), z: Math.max(1, Math.round(span('z'))) };
28
+ }
29
+ /** The eight instances: where each stands on the board and how large, in the scene's words. */
30
+ export function previewInstances(type, size) {
31
+ const COLUMNS = 4;
32
+ const cell = { x: size.x * PREVIEW_FACTOR * 1.25, z: size.z * PREVIEW_FACTOR * 1.25 };
33
+ const components = PREVIEW_WAYS.map((way, at) => {
34
+ const grow = (axis) => (way.axes.includes(axis) ? PREVIEW_FACTOR : 1);
35
+ const width = Math.round(size.x * grow('x'));
36
+ const height = Math.round(size.z * grow('z'));
37
+ const column = at % COLUMNS;
38
+ const row = Math.floor(at / COLUMNS);
39
+ return {
40
+ type,
41
+ id: `at-${way.name}`,
42
+ left: Math.round(column * cell.x + (cell.x - width) / 2),
43
+ top: Math.round(row * cell.z + (cell.z - height) / 2),
44
+ width,
45
+ height,
46
+ /* Always written: without it the height is taken as the plan's mean and "grow y only" would not grow it. */
47
+ depth: Math.round(size.y * grow('y'))
48
+ };
49
+ });
50
+ return { components, board: { width: Math.round(cell.x * COLUMNS), height: Math.round(cell.z * Math.ceil(PREVIEW_WAYS.length / COLUMNS)) } };
51
+ }
52
+ /**
53
+ * Where a variant asks a size the figure does not declare, the size it is drawn at instead -- as the board draws it
54
+ * (things-scene clamps each axis to the declared range; chief architect's ruling 2026-09-25). Per variant, empty when
55
+ * it is drawn as asked. A figure that follows its height only is drawn at its one width in the wider variants, and
56
+ * the preview says so rather than drawing them as though they grew.
57
+ */
58
+ export function previewClampsOf(asset, size) {
59
+ const inputs = asset.document.model.inputs;
60
+ return Object.fromEntries(PREVIEW_WAYS.map(way => [
61
+ way.name,
62
+ ['x', 'y', 'z'].flatMap(axis => {
63
+ const input = inputs.find(i => i.id === FIGURE_INSTANCE_SIZE_INPUTS[axis]);
64
+ if (!input)
65
+ return [];
66
+ const asked = Math.round(size[axis] * (way.axes.includes(axis) ? PREVIEW_FACTOR : 1));
67
+ const used = Math.round(Math.min(Math.max(asked, input.min ?? -Infinity), input.max ?? Infinity));
68
+ return used === asked ? [] : [{ axis, asked, used }];
69
+ })
70
+ ]));
71
+ }
72
+ /**
73
+ * The part the preview's size help speaks of: the one picked in the help, else the one chosen in the editor, else the
74
+ * first that has a size rule. A choice that is not among the parts (removed, or a part with no rule) is passed over.
75
+ */
76
+ export function setupPartOf(picked, chosen, targets) {
77
+ return [picked, chosen].find(id => !!id && targets.includes(id)) ?? targets[0] ?? '';
78
+ }
79
+ //# sourceMappingURL=preview-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview-model.js","sourceRoot":"","sources":["../client/preview-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAA;AAGhI,iHAAiH;AAEjH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAA;AAE/B,0GAA0G;AAC1G,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO,kBAAkB,OAAO,IAAI,KAAK,EAAE,CAAA;AA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I,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QACtD,CAAC,CAAC;KACH,CAAC,CACH,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,MAAc,EAAE,OAAiB;IAC3E,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AACtF,CAAC","sourcesContent":["import { compileFigureAsset, figureOccupiedBoxesOf, figureWritersOf, FIGURE_INSTANCE_SIZE_INPUTS } from '@hatiolab/figure-model'\nimport type { FigureAsset } from '@hatiolab/figure-model'\n\n/* The preview's arithmetic, apart from the element so it is tested without a browser (see figure-preview.ts). */\n\nexport const PREVIEW_FACTOR = 2\n\n/** The type the preview registers the figure under: this figure's own, never a real type a board uses. */\nexport function previewTypeOf(context: string): string {\n return `figure-preview-${context || 'new'}`\n}\n\nexport const PREVIEW_WAYS: readonly { name: string; axes: readonly ('x' | 'y' | 'z')[] }[] = [\n { name: 'base', axes: [] },\n { name: 'x', axes: ['x'] },\n { name: 'y', axes: ['y'] },\n { name: 'z', axes: ['z'] },\n { name: 'x·y', axes: ['x', 'y'] },\n { name: 'x·z', axes: ['x', 'z'] },\n { name: 'y·z', axes: ['y', 'z'] },\n { name: 'x·y·z', axes: ['x', 'y', 'z'] }\n]\n\n/** The size the figure was made at: its instance size when it declares one, else the room its bodies take. */\nexport function authoredSizeOf(asset: FigureAsset): { x: number; y: number; z: number } {\n const d = asset.designInputs\n const declared = (['x', 'y', 'z'] as const).map(axis => d[FIGURE_INSTANCE_SIZE_INPUTS[axis]])\n if (declared.every(v => typeof v === 'number' && v > 0)) return { x: declared[0]!, y: declared[1]!, z: declared[2]! }\n /* No declared size: the room its bodies take up, so the instance is placed at the size it draws. */\n const boxes = figureOccupiedBoxesOf(compileFigureAsset(asset).evaluate().geometry, figureWritersOf(asset))\n const span = (axis: 'x' | 'y' | 'z') =>\n boxes.length ? Math.max(...boxes.map(b => b.centre[axis] + b.extent[axis] / 2)) - Math.min(...boxes.map(b => b.centre[axis] - b.extent[axis] / 2)) : 0\n return { x: Math.max(1, Math.round(span('x'))), y: Math.max(1, Math.round(span('y'))), z: Math.max(1, Math.round(span('z'))) }\n}\n\n/** The eight instances: where each stands on the board and how large, in the scene's words. */\nexport function previewInstances(type: string, size: { x: number; y: number; z: number }) {\n const COLUMNS = 4\n const cell = { x: size.x * PREVIEW_FACTOR * 1.25, z: size.z * PREVIEW_FACTOR * 1.25 }\n const components = PREVIEW_WAYS.map((way, at) => {\n const grow = (axis: 'x' | 'y' | 'z') => (way.axes.includes(axis) ? PREVIEW_FACTOR : 1)\n const width = Math.round(size.x * grow('x'))\n const height = Math.round(size.z * grow('z'))\n const column = at % COLUMNS\n const row = Math.floor(at / COLUMNS)\n return {\n type,\n id: `at-${way.name}`,\n left: Math.round(column * cell.x + (cell.x - width) / 2),\n top: Math.round(row * cell.z + (cell.z - height) / 2),\n width,\n height,\n /* Always written: without it the height is taken as the plan's mean and \"grow y only\" would not grow it. */\n depth: Math.round(size.y * grow('y'))\n }\n })\n return { components, board: { width: Math.round(cell.x * COLUMNS), height: Math.round(cell.z * Math.ceil(PREVIEW_WAYS.length / COLUMNS)) } }\n}\n\n\n/**\n * Where a variant asks a size the figure does not declare, the size it is drawn at instead -- as the board draws it\n * (things-scene clamps each axis to the declared range; chief architect's ruling 2026-09-25). Per variant, empty when\n * it is drawn as asked. A figure that follows its height only is drawn at its one width in the wider variants, and\n * the preview says so rather than drawing them as though they grew.\n */\nexport function previewClampsOf(asset: FigureAsset, size: { x: number; y: number; z: number }): Record<string, Array<{ axis: 'x' | 'y' | 'z'; asked: number; used: number }>> {\n const inputs = asset.document.model.inputs\n return Object.fromEntries(\n PREVIEW_WAYS.map(way => [\n way.name,\n (['x', 'y', 'z'] as const).flatMap(axis => {\n const input = inputs.find(i => i.id === FIGURE_INSTANCE_SIZE_INPUTS[axis])\n if (!input) return []\n const asked = Math.round(size[axis] * (way.axes.includes(axis) ? PREVIEW_FACTOR : 1))\n const used = Math.round(Math.min(Math.max(asked, input.min ?? -Infinity), input.max ?? Infinity))\n return used === asked ? [] : [{ axis, asked, used }]\n })\n ])\n )\n}\n\n/**\n * The part the preview's size help speaks of: the one picked in the help, else the one chosen in the editor, else the\n * first that has a size rule. A choice that is not among the parts (removed, or a part with no rule) is passed over.\n */\nexport function setupPartOf(picked: string, chosen: string, targets: string[]): string {\n return [picked, chosen].find(id => !!id && targets.includes(id)) ?? targets[0] ?? ''\n}\n"]}