@things-factory/figure-ui 10.1.84 → 10.1.85

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 +1 @@
1
- {"version":3,"file":"figure-section-panel.js","sourceRoot":"","sources":["../../client/modeller/figure-section-panel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAKlF,4FAA4F;AAC5F,MAAM,QAAQ,GAAsC;IAClD,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE;IAClC,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE;IAClC,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE;CACnC,CAAA;AAED;;;;;;;;GAQG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAA9D;;QAoBwB,WAAM,GAAG,KAAK,CAAA;IA6H7C,CAAC;aAhJQ,WAAM,GAAG,CAAC,eAAe,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;GAgBpC,CAAC,AAhBW,CAgBX;IAKF,MAAM;QACJ,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACtB,MAAM,SAAS,GAAG,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K,CAAC;oBACN,GAAG,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;kBACxD,IAAI,CAAC,MAAM;gBACb,CAAC,CAAQ,EAAE,EAAE;YACrB,MAAM,KAAK,GAAG,CAAC,CAAC,MAA0B,CAAA;YAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YACjC,IAAI,KAAK,CAAC,KAAK,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;gBAClE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAA;gBACnB,OAAM;YACR,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,CAAA;QACf,CAAC;OACA,CAAA;IACL,CAAC;IAEO,OAAO,CAAC,MAA6B;QAC3C,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACvG,CAAC;;AA7H+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;gDAAmD;AACrD;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;kDAAe;AApBhC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAiJ9B","sourcesContent":["import { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { live } from 'lit/directives/live.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport type { FigureAuthoringAction, FigureCavityRequest, FigureEvaluatedShape } from '@hatiolab/figure-model'\nimport { SidePanelStyles } from './side-panel-styles.js'\nimport { cavityRequestOf, defaultWallOf, mm, sameOf } from './section-controls.js'\n\ntype Axis = 'x' | 'y' | 'z'\ntype End = 'start' | 'end'\n\n/** The face each end of a push is, by the axis it runs along: its start is the low side. */\nconst END_FACE: Record<Axis, Record<End, string>> = {\n x: { start: 'left', end: 'right' },\n y: { start: 'bottom', end: 'top' },\n z: { start: 'back', end: 'front' }\n}\n\n/**\n * 단면 — a pushed part's rounded corners and its inside (ADR-0100 stage 1).\n *\n * Only what the part's section has: corners for a rectangle, an inside for a rectangle or an ellipse. A drawn section\n * and a turned body show nothing here. A radius or a wall entered sets every corner or every wall to it; the kernel\n * holds per-axis values, and when they differ the field says so and shows none of them.\n *\n * Every change leaves as one `command`; the editor runs it through the session, one step of the undo history.\n */\n@customElement('figure-section-panel')\nexport class FigureSectionPanel extends localize(i18next)(LitElement) {\n static styles = [SidePanelStyles, css`\n :host {\n display: block;\n }\n div[row] {\n display: flex;\n gap: 6px;\n align-items: center;\n }\n div[row] > * {\n flex: 1;\n min-width: 0;\n }\n div[row] > label {\n flex: 0 0 auto;\n }\n `]\n\n @property({ attribute: false }) body?: { id: string; shape: FigureEvaluatedShape }\n @property({ type: Boolean }) locked = false\n\n render() {\n const body = this.body\n const extrusion = body?.shape?.provider === 'extrude' ? body.shape.extrusion : undefined\n if (!body || !extrusion) return nothing\n const kind = extrusion.section.kind\n if (kind !== 'rectangle' && kind !== 'ellipse') return nothing\n return html`<section>\n <h3>${i18next.t('figure.label.group-section')}</h3>\n ${kind === 'rectangle' ? this.renderCorner(body) : nothing} ${this.renderCavity(body, extrusion.axis)}\n </section>`\n }\n\n private renderCorner(body: { id: string; shape: FigureEvaluatedShape }) {\n const d = body.shape.dimensions\n const reaches = Object.keys(d)\n .filter(k => k.startsWith('corner.'))\n .map(k => d[k])\n const one = reaches.length ? sameOf(reaches) : 0\n return html`<div field>\n <label>${i18next.t('figure.label.section-corner')}</label>\n <input\n type=\"number\"\n min=\"0\"\n step=\"any\"\n .value=${live(one === undefined ? '' : String(mm(one)))}\n placeholder=${one === undefined ? i18next.t('figure.text.section-corner-differs') : ''}\n ?disabled=${this.locked}\n @change=${(e: Event) => {\n const input = e.target as HTMLInputElement\n const value = Number(input.value)\n if (input.value === '' || !Number.isFinite(value) || value < 0) {\n input.value = one === undefined ? '' : String(mm(one))\n return\n }\n /* 0 is a sharp corner: the rounding is taken away rather than kept at nothing. */\n this.command({ kind: 'set-section-corner', part: body.id, corner: value > 0 ? value : null })\n }}\n />\n </div>`\n }\n\n private renderCavity(body: { id: string; shape: FigureEvaluatedShape }, axis: Axis) {\n const cavity = body.shape.cavity\n const request = (patch: Partial<FigureCavityRequest>) => cavityRequestOf(body.shape, patch)\n return html`<div field>\n <label>\n <input\n type=\"checkbox\"\n .checked=${live(!!cavity)}\n ?disabled=${this.locked}\n @change=${(e: Event) => {\n const on = (e.target as HTMLInputElement).checked\n ;(e.target as HTMLInputElement).checked = !!cavity\n this.command({ kind: 'set-cavity', part: body.id, cavity: on ? request({}) : null })\n }}\n />\n ${i18next.t('figure.label.section-cavity')}\n </label>\n </div>\n ${cavity\n ? html`<div field>\n <label>${i18next.t('figure.label.section-wall')}</label>\n ${this.thickness(sameOf(Object.values(cavity.wall)), value => this.command({ kind: 'set-cavity', part: body.id, cavity: request({ wall: value }) }), 'figure.text.section-wall-differs')}\n </div>\n ${(['start', 'end'] as const).map(end => this.renderEnd(body.id, axis, end, cavity[end], request))}`\n : nothing}`\n }\n\n private renderEnd(\n part: string,\n axis: Axis,\n end: End,\n now: 'open' | { closed: number },\n request: (patch: Partial<FigureCavityRequest>) => FigureCavityRequest\n ) {\n const closed = now !== 'open'\n const set = (value: 'open' | { closed: number }) => this.command({ kind: 'set-cavity', part, cavity: request({ [end]: value }) })\n return html`<div field>\n <label>${i18next.t('figure.label.face-' + END_FACE[axis][end])}</label>\n <div row>\n <select\n .value=${live(closed ? 'closed' : 'open')}\n ?disabled=${this.locked}\n @change=${(e: Event) => {\n const select = e.target as HTMLSelectElement\n const want = select.value\n select.value = closed ? 'closed' : 'open'\n set(want === 'open' ? 'open' : { closed: defaultWallOf(this.body!.shape) })\n }}\n >\n <option value=\"closed\">${i18next.t('figure.label.section-end-closed')}</option>\n <option value=\"open\">${i18next.t('figure.label.section-end-open')}</option>\n </select>\n ${closed ? this.thickness(now.closed, value => set({ closed: value })) : html`<span></span>`}\n </div>\n </div>`\n }\n\n /** A thickness field: a positive number, committed on change; anything else puts the old value back. */\n private thickness(now: number | undefined, commit: (value: number) => void, differs?: string) {\n const shown = now === undefined ? '' : String(mm(now))\n return html`<input\n type=\"number\"\n min=\"0\"\n step=\"any\"\n .value=${live(shown)}\n placeholder=${now === undefined && differs ? i18next.t(differs) : ''}\n ?disabled=${this.locked}\n @change=${(e: Event) => {\n const input = e.target as HTMLInputElement\n const value = Number(input.value)\n if (input.value === '' || !Number.isFinite(value) || !(value > 0)) {\n input.value = shown\n return\n }\n commit(value)\n }}\n />`\n }\n\n private command(action: FigureAuthoringAction) {\n this.dispatchEvent(new CustomEvent('command', { detail: { action }, bubbles: true, composed: true }))\n }\n}\n"]}
1
+ {"version":3,"file":"figure-section-panel.js","sourceRoot":"","sources":["../../client/modeller/figure-section-panel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EACL,QAAQ,EACR,SAAS,EACT,aAAa,EACb,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EACf,aAAa,EACb,EAAE,EACF,MAAM,EACN,OAAO,EACP,eAAe,EACf,WAAW,EAEZ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IAAhB,KAAK,EAAE;;iDAA2C;AAElC;IAAhB,KAAK,EAAE;;mDAAwB;AAxCrB,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAsQ9B","sourcesContent":["import { css, html, LitElement, nothing, type PropertyValues } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { live } from 'lit/directives/live.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport type { FigureAuthoringAction, FigureCavityRequest, FigureEvaluatedShape } from '@hatiolab/figure-model'\nimport { SidePanelStyles } from './side-panel-styles.js'\nimport {\n END_FACE,\n SIDE_FACE,\n cavityDepthOf,\n cavityRefusalOf,\n cavityRequestOf,\n cavityResultOf,\n cornerLimitOf,\n cornerRefusalOf,\n defaultWallOf,\n mm,\n sameOf,\n sidesOf,\n sideWallLimitOf,\n wallLimitOf,\n type FigureCavityAsk\n} from './section-controls.js'\n\ntype Axis = 'x' | 'y' | 'z'\ntype End = 'start' | 'end'\ntype Body = { id: string; shape: FigureEvaluatedShape }\n\n/**\n * 단면 — a pushed part's rounded corners and its inside (ADR-0100 §3.3).\n *\n * Corners for a rectangle; an inside for a rectangle or an ellipse, with its walls (one thickness, or one per side when\n * asked for), its two ends open or closed, and what that makes of the part and how deep. A drawn section says beside\n * the inside why it has none. A turned body shows nothing here.\n *\n * A value being typed is drawn at once and recorded nowhere (`command-live`); a value the kernel would refuse is said\n * under its field with the most it can be, and is not sent. Enter or leaving the field sends the one `command`, one step\n * of the undo history; Esc puts the value back.\n */\n@customElement('figure-section-panel')\nexport class FigureSectionPanel extends localize(i18next)(LitElement) {\n static styles = [SidePanelStyles, css`\n :host {\n display: block;\n }\n div[row] {\n display: flex;\n gap: 6px;\n align-items: center;\n }\n div[row] > * {\n flex: 1;\n min-width: 0;\n }\n div[sides] {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 6px;\n /* A side's refusal under its field lengthens its cell only: the field beside it stays level. */\n align-items: start;\n }\n div[sides] > label {\n display: grid;\n gap: 2px;\n }\n small[refusal] {\n color: var(--md-sys-color-error);\n }\n input[aria-invalid='true'] {\n outline: 2px solid var(--md-sys-color-error);\n }\n `]\n\n @property({ attribute: false }) body?: Body\n @property({ type: Boolean }) locked = false\n /** What each field would not take, by field, said under it. */\n @state() private refusals: Record<string, string> = {}\n /** What is typed in a field and not yet sent, by field: the figure drawn with it must not type over it. */\n @state() private typed: Record<string, string> = {}\n /** Walls one per side, asked for or because they already differ. */\n @state() private perSide = false\n\n protected willUpdate(changed: PropertyValues<this>) {\n const before = changed.get('body') as Body | undefined\n if (changed.has('body') && before?.id !== this.body?.id) {\n this.refusals = {}\n this.typed = {}\n /* A part whose walls already differ opens with them one per side. */\n const walls = this.body?.shape.cavity?.wall\n this.perSide = !!walls && sameOf(Object.values(walls)) === undefined\n }\n }\n\n render() {\n const body = this.body\n const e = body?.shape?.provider === 'extrude' ? body.shape.extrusion : undefined\n if (!body || !e) return nothing\n const kind = e.section.kind\n return html`<section>\n <h3>${i18next.t('figure.label.group-section')}</h3>\n ${kind === 'rectangle' ? this.renderCorner(body) : nothing}\n ${kind === 'rectangle' || kind === 'ellipse'\n ? this.renderCavity(body, e.axis)\n : html`<div field>\n <small>${i18next.t('figure.text.section-cavity-unavailable')}</small>\n </div>`}\n </section>`\n }\n\n private renderCorner(body: Body) {\n const d = body.shape.dimensions\n const reaches = Object.keys(d)\n .filter(k => k.startsWith('corner.'))\n .map(k => d[k])\n const now = reaches.length ? sameOf(reaches) : 0\n const max = cornerLimitOf(body.shape)\n return html`<div field>\n <label for=\"corner\">${i18next.t('figure.label.section-corner')}</label>\n ${this.number('corner', now, {\n min: 0,\n ask: value => {\n const r = cornerRefusalOf(body.shape, value)\n return r ? i18next.t('figure.text.section-corner-over', { max: String(mm(r.max)) }) : ''\n },\n action: value => ({ kind: 'set-section-corner', part: body.id, corner: value > 0 ? value : null }),\n placeholder: now === undefined ? i18next.t('figure.text.section-corner-differs') : ''\n })}\n ${this.refusals.corner ? nothing : max !== undefined ? html`<small>${i18next.t('figure.text.section-at-most', { max: String(mm(max)) })}</small>` : nothing}\n </div>`\n }\n\n private renderCavity(body: Body, axis: Axis) {\n const cavity = body.shape.cavity\n const request = (patch: Partial<FigureCavityRequest>) => cavityRequestOf(body.shape, patch)\n const said = (ask: FigureCavityAsk | null) =>\n !ask\n ? ''\n : ask.code === 'not-positive'\n ? i18next.t('figure.text.section-not-positive')\n : i18next.t(`figure.text.section-${ask.code === 'wall-too-thick' ? 'wall' : 'ends'}-over`, { max: String(ask.max) })\n const cavityField = (key: string, now: number | undefined, patch: (value: number) => Partial<FigureCavityRequest>) =>\n this.number(key, now, {\n min: 0,\n ask: value => {\n if (!(value > 0)) return i18next.t('figure.text.section-not-positive')\n const ask = cavityRefusalOf(body.shape, request(patch(value)))\n /* One side too thick: the most it can be is the width across less the wall opposite, not the even limit. */\n const side = key.startsWith('wall.') ? key.slice(5) : undefined\n if (ask?.code === 'wall-too-thick' && side && cavity)\n return said({ code: 'wall-too-thick', max: mm(sideWallLimitOf(body.shape, cavity.wall, side)) })\n return said(ask)\n },\n action: value => ({ kind: 'set-cavity', part: body.id, cavity: request(patch(value)) })\n })\n return html`<div field>\n <label>\n <input\n type=\"checkbox\"\n .checked=${live(!!cavity)}\n ?disabled=${this.locked}\n @change=${(ev: Event) => {\n const on = (ev.target as HTMLInputElement).checked\n ;(ev.target as HTMLInputElement).checked = !!cavity\n this.command({ kind: 'set-cavity', part: body.id, cavity: on ? request({}) : null })\n }}\n />\n ${i18next.t('figure.label.section-cavity')}\n </label>\n ${cavity\n ? html`<small result>\n ${i18next.t('figure.text.section-depth', {\n result: i18next.t(`figure.label.section-result-${cavityResultOf(cavity)}`),\n depth: String(cavityDepthOf(body.shape))\n })}\n </small>`\n : nothing}\n </div>\n ${cavity\n ? html`<div field>\n <label>${i18next.t('figure.label.section-wall')}</label>\n ${this.perSide\n ? html`<div sides>\n ${[...sidesOf(axis)].sort((a, b) => a[0]!.localeCompare(b[0]!) || (a[1] === '-' ? -1 : 1)).map(\n side => html`<label>\n <span>${i18next.t('figure.label.face-' + SIDE_FACE[side])}</span>\n ${cavityField(`wall.${side}`, cavity.wall[side], value => ({ wall: { ...cavity.wall, [side]: value } }))}\n </label>`\n )}\n </div>`\n : cavityField('wall', sameOf(Object.values(cavity.wall)), value => ({ wall: value }))}\n ${this.perSide || this.refusals.wall\n ? nothing\n : html`<small>${i18next.t('figure.text.section-wall-at-most', { max: String(mm(wallLimitOf(body.shape))) })}</small>`}\n <label>\n <input\n type=\"checkbox\"\n .checked=${live(this.perSide)}\n ?disabled=${this.locked}\n @change=${(ev: Event) => (this.perSide = (ev.target as HTMLInputElement).checked)}\n />\n ${i18next.t('figure.label.section-wall-per-side')}\n </label>\n </div>\n ${(['start', 'end'] as const).map(end => this.renderEnd(body, axis, end, cavity[end], request, cavityField))}`\n : nothing}`\n }\n\n private renderEnd(\n body: Body,\n axis: Axis,\n end: End,\n now: 'open' | { closed: number },\n request: (patch: Partial<FigureCavityRequest>) => FigureCavityRequest,\n cavityField: (key: string, now: number | undefined, patch: (value: number) => Partial<FigureCavityRequest>) => unknown\n ) {\n const closed = now !== 'open'\n return html`<div field>\n <label>${i18next.t('figure.label.face-' + END_FACE(axis, end))}</label>\n <div row>\n <select\n .value=${live(closed ? 'closed' : 'open')}\n ?disabled=${this.locked}\n @change=${(ev: Event) => {\n const select = ev.target as HTMLSelectElement\n const want = select.value\n select.value = closed ? 'closed' : 'open'\n this.command({ kind: 'set-cavity', part: body.id, cavity: request({ [end]: want === 'open' ? 'open' : { closed: defaultWallOf(body.shape) } }) })\n }}\n >\n <option value=\"closed\">${i18next.t('figure.label.section-end-closed')}</option>\n <option value=\"open\">${i18next.t('figure.label.section-end-open')}</option>\n </select>\n ${closed ? cavityField(`closed.${end}`, now.closed, value => ({ [end]: { closed: value } })) : html`<span></span>`}\n </div>\n </div>`\n }\n\n /**\n * A millimetre field. Typing draws the value (or, if the kernel would refuse it, says why under the field and draws the\n * figure as it stands); Enter or leaving sends it once; Esc puts the value back.\n */\n private number(\n key: string,\n now: number | undefined,\n o: { min: number; ask: (value: number) => string; action: (value: number) => FigureAuthoringAction; placeholder?: string }\n ) {\n const shown = now === undefined ? '' : String(mm(now))\n const done = () => {\n const { [key]: _, ...rest } = this.typed\n this.typed = rest\n }\n const read = (input: HTMLInputElement) => (input.value === '' ? NaN : Number(input.value))\n const judge = (input: HTMLInputElement) => {\n const value = read(input)\n const refusal = !Number.isFinite(value) || value < o.min ? '' : o.ask(value)\n this.refusals = { ...this.refusals, [key]: refusal }\n return Number.isFinite(value) && value >= o.min && !refusal ? value : undefined\n }\n return html`<input\n id=${key}\n type=\"number\"\n min=${o.min}\n step=\"any\"\n inputmode=\"decimal\"\n .value=${live(this.typed[key] ?? shown)}\n placeholder=${o.placeholder ?? ''}\n aria-invalid=${this.refusals[key] ? 'true' : 'false'}\n aria-describedby=${`${key}-refusal`}\n ?disabled=${this.locked}\n @input=${(ev: Event) => {\n this.typed = { ...this.typed, [key]: (ev.target as HTMLInputElement).value }\n const value = judge(ev.target as HTMLInputElement)\n this.preview(value === undefined ? null : o.action(value))\n }}\n @change=${(ev: Event) => {\n const input = ev.target as HTMLInputElement\n if (input.value === shown) return done(), this.preview(null)\n const value = judge(input)\n /* A refused value stays typed with its reason under it, to be corrected; nothing is sent. */\n if (value === undefined) return this.preview(null)\n done()\n this.command(o.action(value))\n }}\n @keydown=${(ev: KeyboardEvent) => {\n if (ev.key !== 'Escape') return\n const input = ev.target as HTMLInputElement\n input.value = shown\n done()\n this.refusals = { ...this.refusals, [key]: '' }\n this.preview(null)\n }}\n />\n ${this.refusals[key] ? html`<small refusal id=${`${key}-refusal`} role=\"alert\">${this.refusals[key]}</small>` : nothing}`\n }\n\n private preview(action: FigureAuthoringAction | null) {\n this.dispatchEvent(new CustomEvent('command-live', { detail: { action }, bubbles: true, composed: true }))\n }\n\n private command(action: FigureAuthoringAction) {\n this.dispatchEvent(new CustomEvent('command', { detail: { action }, bubbles: true, composed: true }))\n }\n}\n"]}
@@ -1,10 +1,12 @@
1
- import type { FigureAsset, FigurePartEdit } from '@hatiolab/figure-model';
1
+ import type { FigureAsset, FigureAuthoringAction, FigurePartEdit } from '@hatiolab/figure-model';
2
2
  import { type FigureRenderPart } from './renderer.js';
3
3
  export interface LiveValues {
4
4
  /** Input values in hand, design or state, by input id. */
5
5
  values: Record<string, number>;
6
6
  /** A part edit in hand, not yet committed. */
7
7
  edit?: FigurePartEdit;
8
+ /** An authoring command in hand (a corner radius, an inside, being typed), not yet committed (ADR-0100 §3.3). */
9
+ action?: FigureAuthoringAction;
8
10
  }
9
11
  export declare const NOTHING_LIVE: LiveValues;
10
12
  /** Known inputs with a number, split by what they are. An id the figure does not declare is dropped. */
@@ -1,4 +1,4 @@
1
- import { compileFigureAsset, editFigurePart } from '@hatiolab/figure-model';
1
+ import { applyFigureAuthoring, compileFigureAsset, editFigurePart } from '@hatiolab/figure-model';
2
2
  import { drawableFigureParts } from './renderer.js';
3
3
  export const NOTHING_LIVE = { values: {} };
4
4
  /** Known inputs with a number, split by what they are. An id the figure does not declare is dropped. */
@@ -17,7 +17,7 @@ export function liveOverridesOf(asset, values) {
17
17
  return { design, state };
18
18
  }
19
19
  export function isLive(live) {
20
- return !!live.edit || Object.keys(live.values).length > 0;
20
+ return !!live.edit || !!live.action || Object.keys(live.values).length > 0;
21
21
  }
22
22
  /**
23
23
  * The bodies to draw with what is in hand, or null when nothing is -- then the evaluation as it stands is drawn.
@@ -29,9 +29,12 @@ export function isLive(live) {
29
29
  export function livePartsOf(asset, live) {
30
30
  if (!isLive(live))
31
31
  return null;
32
- const { design, state } = liveOverridesOf(asset, live.values);
33
32
  try {
34
33
  let next = live.edit ? editFigurePart(asset, live.edit) : asset;
34
+ if (live.action)
35
+ next = applyFigureAuthoring(next, live.action);
36
+ /* Read against the figure the edit makes: a command can take an input away (one wall becomes one per side). */
37
+ const { design, state } = liveOverridesOf(next, live.values);
35
38
  if (Object.keys(design).length)
36
39
  next = { ...next, designInputs: { ...next.designInputs, ...design } };
37
40
  return drawableFigureParts(compileFigureAsset(next).evaluate(state).geometry);
@@ -1 +1 @@
1
- {"version":3,"file":"live.js","sourceRoot":"","sources":["../../client/modeller/live.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAG3E,OAAO,EAAE,mBAAmB,EAAyB,MAAM,eAAe,CAAA;AAoB1E,MAAM,CAAC,MAAM,YAAY,GAAe,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;AAEtD,wGAAwG;AACxG,MAAM,UAAU,eAAe,CAAC,KAAkB,EAAE,MAA8B;IAChF,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC3E,MAAM,MAAM,GAA2B,EAAE,EACvC,KAAK,GAA2B,EAAE,CAAA;IACpC,KAAK,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,SAAQ;QACrC,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QAC1B,IAAI,IAAI,KAAK,OAAO;YAAE,KAAK,CAAC,EAAE,CAAC,GAAG,KAAK,CAAA;aAClC,IAAI,IAAI,KAAK,SAAS;YAAE,MAAM,CAAC,EAAE,CAAC,GAAG,KAAK,CAAA;IACjD,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;AAC1B,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAAgB;IACrC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,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AAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IACpI,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AAChC,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,QAAQ,CAAC,KAAa,EAAE,MAAc,EAAE,IAAY;IAClE,MAAM,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,IAAI,CAAA;IACnC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACzD,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;AACtC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAkB,EAAE,OAA+B,EAAE,IAAgB;IACnG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAC9B,OAAO,WAAW,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AAChF,CAAC","sourcesContent":["import { compileFigureAsset, editFigurePart } from '@hatiolab/figure-model'\nimport type { FigureAsset, FigurePartEdit } from '@hatiolab/figure-model'\n\nimport { drawableFigureParts, type FigureRenderPart } from './renderer.js'\n\n/*\n * The figure while a value is in hand: evaluated with the values being typed or dragged, drawn at once and written\n * nowhere. The panels committed on release only, so the canvas stood still while a number was typed, a spinner held,\n * a label scrubbed, a slider or the glow dragged (user, 2026-09-24: \"make the editor move naturally while the value\n * changes\"). The value in hand shows here; the release is the one step of the history.\n *\n * What is in hand is either input values -- a design value (a size, a position) or a pose -- or one part edit (the\n * glow of a material). A design value is a change of the figure's design, so it is shown by evaluating a copy with\n * that value; a pose is a state override, as the preview gives it.\n */\n\nexport interface LiveValues {\n /** Input values in hand, design or state, by input id. */\n values: Record<string, number>\n /** A part edit in hand, not yet committed. */\n edit?: FigurePartEdit\n}\n\nexport const NOTHING_LIVE: LiveValues = { values: {} }\n\n/** Known inputs with a number, split by what they are. An id the figure does not declare is dropped. */\nexport function liveOverridesOf(asset: FigureAsset, values: Record<string, number>): { design: Record<string, number>; state: Record<string, number> } {\n const roles = new Map(asset.document.model.inputs.map(i => [i.id, i.role]))\n const design: Record<string, number> = {},\n state: Record<string, number> = {}\n for (const [id, value] of Object.entries(values)) {\n if (!Number.isFinite(value)) continue\n const role = roles.get(id)\n if (role === 'state') state[id] = value\n else if (role !== undefined) design[id] = value\n }\n return { design, state }\n}\n\nexport function isLive(live: LiveValues): boolean {\n return !!live.edit || Object.keys(live.values).length > 0\n}\n\n/**\n * The bodies to draw with what is in hand, or null when nothing is -- then the evaluation as it stands is drawn.\n *\n * Also null when the figure cannot take the value in hand (a size of 0 on the way to typing 0.5, a glow the material\n * refuses): the canvas keeps the figure as it stands until the release, and the release reports why through the same\n * refusal every committed edit gets. A preview never invents a figure the commit would not make.\n */\nexport function livePartsOf(asset: FigureAsset, live: LiveValues): FigureRenderPart[] | null {\n if (!isLive(live)) return null\n const { design, state } = liveOverridesOf(asset, live.values)\n try {\n let next = live.edit ? editFigurePart(asset, live.edit) : asset\n if (Object.keys(design).length) next = { ...next, designInputs: { ...next.designInputs, ...design } }\n return drawableFigureParts(compileFigureAsset(next).evaluate(state).geometry)\n } catch {\n return null\n }\n}\n\n/**\n * How much one pixel of a label drag moves a value: a degree for an angle, a hundredth for a ratio, and for a length a\n * step that suits its size -- a millimetre under 100, ten over 1,000 -- so a 12 m wall and a 5 mm pin both scrub at a\n * usable pace. Shift makes it ten times finer.\n */\nexport function scrubStep(unit: string, value: number, fine = false): number {\n const base =\n unit === 'deg' ? 1 : unit === 'ratio' ? 0.01 : Math.max(1, Math.pow(10, Math.floor(Math.log10(Math.max(1, Math.abs(value)))) - 2))\n return fine ? base / 10 : base\n}\n\n/** A scrubbed value on the step's grid, so a drag does not leave 1203.0000000002 behind. */\nexport function scrubbed(start: number, pixels: number, step: number): number {\n const value = start + pixels * step\n const digits = Math.max(0, -Math.floor(Math.log10(step)))\n return Number(value.toFixed(digits))\n}\n\n/**\n * The bodies to draw while a value is in hand, over every input as the session holds it now (`current`): the pose the\n * author has already set with the other controls, and the design values. Drawing over the asset's saved defaults put\n * every other joint back to its saved angle while one slider moved (user, 2026-09-24: the arm jumped on release).\n */\nexport function liveOverSession(asset: FigureAsset, current: Record<string, number>, live: LiveValues): FigureRenderPart[] | null {\n if (!isLive(live)) return null\n return livePartsOf(asset, { ...live, values: { ...current, ...live.values } })\n}\n\n"]}
1
+ {"version":3,"file":"live.js","sourceRoot":"","sources":["../../client/modeller/live.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAGjG,OAAO,EAAE,mBAAmB,EAAyB,MAAM,eAAe,CAAA;AAsB1E,MAAM,CAAC,MAAM,YAAY,GAAe,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;AAEtD,wGAAwG;AACxG,MAAM,UAAU,eAAe,CAAC,KAAkB,EAAE,MAA8B;IAChF,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC3E,MAAM,MAAM,GAA2B,EAAE,EACvC,KAAK,GAA2B,EAAE,CAAA;IACpC,KAAK,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACjD,IAAI,CAAC,MA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AAM,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAA;IAC9B,OAAO,WAAW,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AAChF,CAAC","sourcesContent":["import { applyFigureAuthoring, compileFigureAsset, editFigurePart } from '@hatiolab/figure-model'\nimport type { FigureAsset, FigureAuthoringAction, FigurePartEdit } from '@hatiolab/figure-model'\n\nimport { drawableFigureParts, type FigureRenderPart } from './renderer.js'\n\n/*\n * The figure while a value is in hand: evaluated with the values being typed or dragged, drawn at once and written\n * nowhere. The panels committed on release only, so the canvas stood still while a number was typed, a spinner held,\n * a label scrubbed, a slider or the glow dragged (user, 2026-09-24: \"make the editor move naturally while the value\n * changes\"). The value in hand shows here; the release is the one step of the history.\n *\n * What is in hand is either input values -- a design value (a size, a position) or a pose -- or one part edit (the\n * glow of a material). A design value is a change of the figure's design, so it is shown by evaluating a copy with\n * that value; a pose is a state override, as the preview gives it.\n */\n\nexport interface LiveValues {\n /** Input values in hand, design or state, by input id. */\n values: Record<string, number>\n /** A part edit in hand, not yet committed. */\n edit?: FigurePartEdit\n /** An authoring command in hand (a corner radius, an inside, being typed), not yet committed (ADR-0100 §3.3). */\n action?: FigureAuthoringAction\n}\n\nexport const NOTHING_LIVE: LiveValues = { values: {} }\n\n/** Known inputs with a number, split by what they are. An id the figure does not declare is dropped. */\nexport function liveOverridesOf(asset: FigureAsset, values: Record<string, number>): { design: Record<string, number>; state: Record<string, number> } {\n const roles = new Map(asset.document.model.inputs.map(i => [i.id, i.role]))\n const design: Record<string, number> = {},\n state: Record<string, number> = {}\n for (const [id, value] of Object.entries(values)) {\n if (!Number.isFinite(value)) continue\n const role = roles.get(id)\n if (role === 'state') state[id] = value\n else if (role !== undefined) design[id] = value\n }\n return { design, state }\n}\n\nexport function isLive(live: LiveValues): boolean {\n return !!live.edit || !!live.action || Object.keys(live.values).length > 0\n}\n\n/**\n * The bodies to draw with what is in hand, or null when nothing is -- then the evaluation as it stands is drawn.\n *\n * Also null when the figure cannot take the value in hand (a size of 0 on the way to typing 0.5, a glow the material\n * refuses): the canvas keeps the figure as it stands until the release, and the release reports why through the same\n * refusal every committed edit gets. A preview never invents a figure the commit would not make.\n */\nexport function livePartsOf(asset: FigureAsset, live: LiveValues): FigureRenderPart[] | null {\n if (!isLive(live)) return null\n try {\n let next = live.edit ? editFigurePart(asset, live.edit) : asset\n if (live.action) next = applyFigureAuthoring(next, live.action)\n /* Read against the figure the edit makes: a command can take an input away (one wall becomes one per side). */\n const { design, state } = liveOverridesOf(next, live.values)\n if (Object.keys(design).length) next = { ...next, designInputs: { ...next.designInputs, ...design } }\n return drawableFigureParts(compileFigureAsset(next).evaluate(state).geometry)\n } catch {\n return null\n }\n}\n\n/**\n * How much one pixel of a label drag moves a value: a degree for an angle, a hundredth for a ratio, and for a length a\n * step that suits its size -- a millimetre under 100, ten over 1,000 -- so a 12 m wall and a 5 mm pin both scrub at a\n * usable pace. Shift makes it ten times finer.\n */\nexport function scrubStep(unit: string, value: number, fine = false): number {\n const base =\n unit === 'deg' ? 1 : unit === 'ratio' ? 0.01 : Math.max(1, Math.pow(10, Math.floor(Math.log10(Math.max(1, Math.abs(value)))) - 2))\n return fine ? base / 10 : base\n}\n\n/** A scrubbed value on the step's grid, so a drag does not leave 1203.0000000002 behind. */\nexport function scrubbed(start: number, pixels: number, step: number): number {\n const value = start + pixels * step\n const digits = Math.max(0, -Math.floor(Math.log10(step)))\n return Number(value.toFixed(digits))\n}\n\n/**\n * The bodies to draw while a value is in hand, over every input as the session holds it now (`current`): the pose the\n * author has already set with the other controls, and the design values. Drawing over the asset's saved defaults put\n * every other joint back to its saved angle while one slider moved (user, 2026-09-24: the arm jumped on release).\n */\nexport function liveOverSession(asset: FigureAsset, current: Record<string, number>, live: LiveValues): FigureRenderPart[] | null {\n if (!isLive(live)) return null\n return livePartsOf(asset, { ...live, values: { ...current, ...live.values } })\n}\n\n"]}
@@ -1,7 +1,14 @@
1
1
  import type { FigureCavityRequest, FigureEvaluatedShape } from '@hatiolab/figure-model';
2
+ type Axis = 'x' | 'y' | 'z';
3
+ type End = 'start' | 'end';
4
+ /** The face each side of a section is, and each end of a push: a push's start is its low side. */
5
+ export declare const SIDE_FACE: Record<string, string>;
6
+ export declare const END_FACE: (axis: Axis, end: End) => string;
2
7
  /** The one value every entry holds, or undefined when they differ (or there are none). */
3
8
  export declare const sameOf: (values: readonly (number | undefined)[]) => number | undefined;
4
9
  export declare const mm: (value: number) => number;
10
+ /** The four sides of a push's section, in the kernel's order: the first plane axis low and high, then the second. */
11
+ export declare const sidesOf: (axis: Axis) => string[];
5
12
  /** The wall a new inside starts with: a tenth of the section's narrower side, at least 1 mm. */
6
13
  export declare function defaultWallOf(shape: FigureEvaluatedShape): number;
7
14
  /**
@@ -9,3 +16,29 @@ export declare function defaultWallOf(shape: FigureEvaluatedShape): number;
9
16
  * wall all round, a closed start as thick as the wall and an open end -- a tray standing on its floor.
10
17
  */
11
18
  export declare function cavityRequestOf(shape: FigureEvaluatedShape, patch?: Partial<FigureCavityRequest>): FigureCavityRequest;
19
+ /** The most a rectangle's corners can reach: half its narrower side (the kernel's CORNER_TOO_LARGE says where). */
20
+ export declare function cornerLimitOf(shape: FigureEvaluatedShape): number | undefined;
21
+ /** Whether a corner radius can be taken; if not, the most it can be. */
22
+ export declare function cornerRefusalOf(shape: FigureEvaluatedShape, radius: number): {
23
+ max: number;
24
+ } | null;
25
+ /** One side's wall, the others kept: it must leave room inside, so under the width across it less the opposite wall. */
26
+ export declare function sideWallLimitOf(shape: FigureEvaluatedShape, wall: Record<string, number>, side: string): number;
27
+ /** A wall must leave room inside: under half the narrower width the section has. */
28
+ export declare const wallLimitOf: (shape: FigureEvaluatedShape) => number;
29
+ export type FigureCavityAsk = {
30
+ code: 'wall-too-thick';
31
+ max: number;
32
+ } | {
33
+ code: 'ends-too-thick';
34
+ max: number;
35
+ } | {
36
+ code: 'not-positive';
37
+ };
38
+ /** Whether an inside can be taken, asked of the kernel; if not, what to change and the most it can be. */
39
+ export declare function cavityRefusalOf(shape: FigureEvaluatedShape, request: FigureCavityRequest): FigureCavityAsk | null;
40
+ /** What the inside makes of the part (§3.3): open at both ends a pipe, at one a container, at neither a closed space. */
41
+ export declare function cavityResultOf(cavity: NonNullable<FigureEvaluatedShape['cavity']>): 'pipe' | 'container' | 'sealed';
42
+ /** How deep the inside is along the push: the length less the closed ends. */
43
+ export declare function cavityDepthOf(shape: FigureEvaluatedShape): number;
44
+ export {};
@@ -1,15 +1,24 @@
1
+ import { FIGURE_SECTION_PLANE, checkFigureSection, figureExtrusionFeaturesOf } from '@hatiolab/figure-model';
2
+ /** The face each side of a section is, and each end of a push: a push's start is its low side. */
3
+ export const SIDE_FACE = { 'x-': 'left', 'x+': 'right', 'y-': 'bottom', 'y+': 'top', 'z-': 'back', 'z+': 'front' };
4
+ export const END_FACE = (axis, end) => SIDE_FACE[`${axis}${end === 'start' ? '-' : '+'}`];
1
5
  /** The one value every entry holds, or undefined when they differ (or there are none). */
2
6
  export const sameOf = (values) => values.length && values.every(v => v !== undefined && Math.abs(v - values[0]) < 1e-6) ? values[0] : undefined;
3
7
  export const mm = (value) => Math.round(value * 1000) / 1000;
8
+ /** The four sides of a push's section, in the kernel's order: the first plane axis low and high, then the second. */
9
+ export const sidesOf = (axis) => FIGURE_SECTION_PLANE[axis].flatMap(a => [`${a}-`, `${a}+`]);
10
+ /** The section's widths across, one per plane axis: a rectangle's sides, an ellipse's diameters. */
11
+ function acrossOf(e) {
12
+ const s = e.section;
13
+ if (s.kind === 'rectangle')
14
+ return FIGURE_SECTION_PLANE[e.axis].map(a => s.size[a]);
15
+ if (s.kind === 'ellipse')
16
+ return FIGURE_SECTION_PLANE[e.axis].map(a => 2 * s.radius[a]);
17
+ return [];
18
+ }
4
19
  /** The wall a new inside starts with: a tenth of the section's narrower side, at least 1 mm. */
5
20
  export function defaultWallOf(shape) {
6
- const section = shape.extrusion.section;
7
- const across = section.kind === 'rectangle'
8
- ? Object.values(section.size)
9
- : section.kind === 'ellipse'
10
- ? Object.values(section.radius).map(r => 2 * r)
11
- : [];
12
- return Math.max(1, Math.round(Math.min(...across) / 10));
21
+ return Math.max(1, Math.round(Math.min(...acrossOf(shape.extrusion)) / 10));
13
22
  }
14
23
  /**
15
24
  * The inside as the panel asks for it: the part's own, with one thing changed. A part with none yet gets a default
@@ -24,4 +33,59 @@ export function cavityRequestOf(shape, patch = {}) {
24
33
  ...patch
25
34
  };
26
35
  }
36
+ /** The most a rectangle's corners can reach: half its narrower side (the kernel's CORNER_TOO_LARGE says where). */
37
+ export function cornerLimitOf(shape) {
38
+ const e = shape.extrusion;
39
+ if (e?.section.kind !== 'rectangle')
40
+ return undefined;
41
+ const [u, v] = FIGURE_SECTION_PLANE[e.axis];
42
+ const far = 2 * Math.max(...acrossOf(e));
43
+ const issues = checkFigureSection({ kind: 'rectangle', size: e.section.size, corner: { [u]: far, [v]: far } }, e.axis);
44
+ const maxes = issues.flatMap(i => (i.code === 'CORNER_TOO_LARGE' ? [i.max] : []));
45
+ return maxes.length ? Math.min(...maxes) : undefined;
46
+ }
47
+ /** Whether a corner radius can be taken; if not, the most it can be. */
48
+ export function cornerRefusalOf(shape, radius) {
49
+ const e = shape.extrusion;
50
+ if (e?.section.kind !== 'rectangle' || !(radius > 0))
51
+ return null;
52
+ const [u, v] = FIGURE_SECTION_PLANE[e.axis];
53
+ const issues = checkFigureSection({ kind: 'rectangle', size: e.section.size, corner: { [u]: radius, [v]: radius } }, e.axis);
54
+ return issues.some(i => i.code === 'CORNER_TOO_LARGE') ? { max: cornerLimitOf(shape) } : null;
55
+ }
56
+ /** One side's wall, the others kept: it must leave room inside, so under the width across it less the opposite wall. */
57
+ export function sideWallLimitOf(shape, wall, side) {
58
+ const e = shape.extrusion;
59
+ const axis = side[0];
60
+ const across = acrossOf(e)[FIGURE_SECTION_PLANE[e.axis].indexOf(axis)];
61
+ return across - (wall[`${axis}${side[1] === '-' ? '+' : '-'}`] ?? 0);
62
+ }
63
+ /** A wall must leave room inside: under half the narrower width the section has. */
64
+ export const wallLimitOf = (shape) => Math.min(...acrossOf(shape.extrusion)) / 2;
65
+ /** Whether an inside can be taken, asked of the kernel; if not, what to change and the most it can be. */
66
+ export function cavityRefusalOf(shape, request) {
67
+ const e = shape.extrusion;
68
+ const sides = sidesOf(e.axis);
69
+ const wall = typeof request.wall === 'number' ? Object.fromEntries(sides.map(s => [s, request.wall])) : request.wall;
70
+ const made = figureExtrusionFeaturesOf(e, [{ id: 'inside', wall: wall, start: request.start, end: request.end }]);
71
+ if (!('refused' in made))
72
+ return null;
73
+ const r = made.refused;
74
+ if (r.code === 'CAVITY' && r.refused === 'NO_ROOM_INSIDE')
75
+ return { code: 'wall-too-thick', max: mm(wallLimitOf(shape)) };
76
+ if (r.code === 'CAVITY_NO_LENGTH')
77
+ return { code: 'ends-too-thick', max: mm(e.end - e.start) };
78
+ return { code: 'not-positive' };
79
+ }
80
+ /** What the inside makes of the part (§3.3): open at both ends a pipe, at one a container, at neither a closed space. */
81
+ export function cavityResultOf(cavity) {
82
+ const open = [cavity.start, cavity.end].filter(e => e === 'open').length;
83
+ return open === 2 ? 'pipe' : open === 1 ? 'container' : 'sealed';
84
+ }
85
+ /** How deep the inside is along the push: the length less the closed ends. */
86
+ export function cavityDepthOf(shape) {
87
+ const e = shape.extrusion, c = shape.cavity;
88
+ const closed = (x) => (x === 'open' ? 0 : x.closed);
89
+ return mm(e.end - e.start - closed(c.start) - closed(c.end));
90
+ }
27
91
  //# sourceMappingURL=section-controls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"section-controls.js","sourceRoot":"","sources":["../../client/modeller/section-controls.ts"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAuC,EAAE,EAAE,CAChE,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,KAA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E,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC;QAChG,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE;QACxD,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,MAAM;QAC1B,GAAG,KAAK;KACT,CAAA;AACH,CAAC","sourcesContent":["import type { FigureCavityRequest, FigureEvaluatedShape } from '@hatiolab/figure-model'\n\n/** The one value every entry holds, or undefined when they differ (or there are none). */\nexport const sameOf = (values: readonly (number | undefined)[]) =>\n values.length && values.every(v => v !== undefined && Math.abs(v - values[0]!) < 1e-6) ? values[0] : undefined\n\nexport const mm = (value: number) => Math.round(value * 1000) / 1000\n\n/** The wall a new inside starts with: a tenth of the section's narrower side, at least 1 mm. */\nexport function defaultWallOf(shape: FigureEvaluatedShape): number {\n const section = shape.extrusion!.section\n const across =\n section.kind === 'rectangle'\n ? Object.values(section.size)\n : section.kind === 'ellipse'\n ? Object.values(section.radius).map(r => 2 * r!)\n : []\n return Math.max(1, Math.round(Math.min(...(across as number[])) / 10))\n}\n\n/**\n * The inside as the panel asks for it: the part's own, with one thing changed. A part with none yet gets a default\n * wall all round, a closed start as thick as the wall and an open end -- a tray standing on its floor.\n */\nexport function cavityRequestOf(shape: FigureEvaluatedShape, patch: Partial<FigureCavityRequest> = {}): FigureCavityRequest {\n const cavity = shape.cavity\n return {\n wall: cavity ? (sameOf(Object.values(cavity.wall)) ?? { ...cavity.wall }) : defaultWallOf(shape),\n start: cavity?.start ?? { closed: defaultWallOf(shape) },\n end: cavity?.end ?? 'open',\n ...patch\n }\n}\n\n"]}
1
+ {"version":3,"file":"section-controls.js","sourceRoot":"","sources":["../../client/modeller/section-controls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAa5G,kGAAkG;AAClG,MAAM,CAAC,MAAM,SAAS,GAA2B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CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAA;AAClE,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,aAAa,CAAC,KAA2B;IACvD,MAAM,CAAC,GAAG,KAAK,CAAC,SAAU,EACxB,CAAC,GAAG,KAAK,CAAC,MAAO,CAAA;IACnB,MAAM,MAAM,GAAG,CAAC,CAAiB,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IACnE,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;AAC9D,CAAC","sourcesContent":["import { FIGURE_SECTION_PLANE, checkFigureSection, figureExtrusionFeaturesOf } from '@hatiolab/figure-model'\nimport type { FigureCavityRequest, FigureEvaluatedShape } from '@hatiolab/figure-model'\n\n/*\n * What the 단면 section of the properties tab reads and asks (ADR-0100 §3.3): a pushed part's corners and its inside.\n * Whether a value can be taken is asked of the kernel's own section checks -- the screen keeps no rule of its own -- and\n * the most it can take is said beside the field, so a refusal names the value to type rather than only that it failed.\n */\n\ntype Axis = 'x' | 'y' | 'z'\ntype End = 'start' | 'end'\ntype Extrusion = NonNullable<FigureEvaluatedShape['extrusion']>\n\n/** The face each side of a section is, and each end of a push: a push's start is its low side. */\nexport const SIDE_FACE: Record<string, string> = { 'x-': 'left', 'x+': 'right', 'y-': 'bottom', 'y+': 'top', 'z-': 'back', 'z+': 'front' }\nexport const END_FACE = (axis: Axis, end: End) => SIDE_FACE[`${axis}${end === 'start' ? '-' : '+'}`]!\n\n/** The one value every entry holds, or undefined when they differ (or there are none). */\nexport const sameOf = (values: readonly (number | undefined)[]) =>\n values.length && values.every(v => v !== undefined && Math.abs(v - values[0]!) < 1e-6) ? values[0] : undefined\n\nexport const mm = (value: number) => Math.round(value * 1000) / 1000\n\n/** The four sides of a push's section, in the kernel's order: the first plane axis low and high, then the second. */\nexport const sidesOf = (axis: Axis) => FIGURE_SECTION_PLANE[axis].flatMap(a => [`${a}-`, `${a}+`])\n\n/** The section's widths across, one per plane axis: a rectangle's sides, an ellipse's diameters. */\nfunction acrossOf(e: Extrusion): number[] {\n const s = e.section\n if (s.kind === 'rectangle') return FIGURE_SECTION_PLANE[e.axis].map(a => s.size[a]!)\n if (s.kind === 'ellipse') return FIGURE_SECTION_PLANE[e.axis].map(a => 2 * s.radius[a]!)\n return []\n}\n\n/** The wall a new inside starts with: a tenth of the section's narrower side, at least 1 mm. */\nexport function defaultWallOf(shape: FigureEvaluatedShape): number {\n return Math.max(1, Math.round(Math.min(...acrossOf(shape.extrusion!)) / 10))\n}\n\n/**\n * The inside as the panel asks for it: the part's own, with one thing changed. A part with none yet gets a default\n * wall all round, a closed start as thick as the wall and an open end -- a tray standing on its floor.\n */\nexport function cavityRequestOf(shape: FigureEvaluatedShape, patch: Partial<FigureCavityRequest> = {}): FigureCavityRequest {\n const cavity = shape.cavity\n return {\n wall: cavity ? (sameOf(Object.values(cavity.wall)) ?? { ...cavity.wall }) : defaultWallOf(shape),\n start: cavity?.start ?? { closed: defaultWallOf(shape) },\n end: cavity?.end ?? 'open',\n ...patch\n }\n}\n\n/** The most a rectangle's corners can reach: half its narrower side (the kernel's CORNER_TOO_LARGE says where). */\nexport function cornerLimitOf(shape: FigureEvaluatedShape): number | undefined {\n const e = shape.extrusion\n if (e?.section.kind !== 'rectangle') return undefined\n const [u, v] = FIGURE_SECTION_PLANE[e.axis]\n const far = 2 * Math.max(...acrossOf(e))\n const issues = checkFigureSection({ kind: 'rectangle', size: e.section.size, corner: { [u]: far, [v]: far } }, e.axis)\n const maxes = issues.flatMap(i => (i.code === 'CORNER_TOO_LARGE' ? [i.max] : []))\n return maxes.length ? Math.min(...maxes) : undefined\n}\n\n/** Whether a corner radius can be taken; if not, the most it can be. */\nexport function cornerRefusalOf(shape: FigureEvaluatedShape, radius: number): { max: number } | null {\n const e = shape.extrusion\n if (e?.section.kind !== 'rectangle' || !(radius > 0)) return null\n const [u, v] = FIGURE_SECTION_PLANE[e.axis]\n const issues = checkFigureSection({ kind: 'rectangle', size: e.section.size, corner: { [u]: radius, [v]: radius } }, e.axis)\n return issues.some(i => i.code === 'CORNER_TOO_LARGE') ? { max: cornerLimitOf(shape)! } : null\n}\n\n/** One side's wall, the others kept: it must leave room inside, so under the width across it less the opposite wall. */\nexport function sideWallLimitOf(shape: FigureEvaluatedShape, wall: Record<string, number>, side: string): number {\n const e = shape.extrusion!\n const axis = side[0] as Axis\n const across = acrossOf(e)[FIGURE_SECTION_PLANE[e.axis].indexOf(axis)]!\n return across - (wall[`${axis}${side[1] === '-' ? '+' : '-'}`] ?? 0)\n}\n\n/** A wall must leave room inside: under half the narrower width the section has. */\nexport const wallLimitOf = (shape: FigureEvaluatedShape) => Math.min(...acrossOf(shape.extrusion!)) / 2\n\nexport type FigureCavityAsk =\n | { code: 'wall-too-thick'; max: number }\n | { code: 'ends-too-thick'; max: number }\n | { code: 'not-positive' }\n\n/** Whether an inside can be taken, asked of the kernel; if not, what to change and the most it can be. */\nexport function cavityRefusalOf(shape: FigureEvaluatedShape, request: FigureCavityRequest): FigureCavityAsk | null {\n const e = shape.extrusion!\n const sides = sidesOf(e.axis)\n const wall = typeof request.wall === 'number' ? Object.fromEntries(sides.map(s => [s, request.wall as number])) : request.wall\n const made = figureExtrusionFeaturesOf(e, [{ id: 'inside', wall: wall as Record<string, number>, start: request.start, end: request.end }])\n if (!('refused' in made)) return null\n const r = made.refused\n if (r.code === 'CAVITY' && r.refused === 'NO_ROOM_INSIDE') return { code: 'wall-too-thick', max: mm(wallLimitOf(shape)) }\n if (r.code === 'CAVITY_NO_LENGTH') return { code: 'ends-too-thick', max: mm(e.end - e.start) }\n return { code: 'not-positive' }\n}\n\n/** What the inside makes of the part (§3.3): open at both ends a pipe, at one a container, at neither a closed space. */\nexport function cavityResultOf(cavity: NonNullable<FigureEvaluatedShape['cavity']>): 'pipe' | 'container' | 'sealed' {\n const open = [cavity.start, cavity.end].filter(e => e === 'open').length\n return open === 2 ? 'pipe' : open === 1 ? 'container' : 'sealed'\n}\n\n/** How deep the inside is along the push: the length less the closed ends. */\nexport function cavityDepthOf(shape: FigureEvaluatedShape): number {\n const e = shape.extrusion!,\n c = shape.cavity!\n const closed = (x: typeof c.start) => (x === 'open' ? 0 : x.closed)\n return mm(e.end - e.start - closed(c.start) - closed(c.end))\n}\n"]}