@things-factory/figure-ui 10.1.223 → 10.1.225
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.
- package/client/modeller/canvas.ts +2 -2
- package/client/modeller/consumer-capabilities.ts +66 -0
- package/client/modeller/data-interface.ts +230 -80
- package/client/modeller/editor-styles.ts +3 -2
- package/client/modeller/editor.ts +17 -8
- package/client/modeller/figure-capability-panel.ts +151 -1
- package/client/modeller/figure-clips.ts +1 -1
- package/client/modeller/figure-data-panel.ts +509 -199
- package/client/modeller/figure-links.ts +130 -12
- package/client/modeller/figure-preview.ts +65 -8
- package/client/modeller/figure-slot-layout-panel.ts +7 -3
- package/client/modeller/links.ts +58 -0
- package/client/modeller/product-session.ts +3 -2
- package/client/modeller/refusals.ts +12 -4
- package/client/modeller/slot-layout-host.ts +76 -5
- package/client/pages/figure-modeller-page.ts +2 -2
- package/dist-client/modeller/canvas.js +2 -2
- package/dist-client/modeller/canvas.js.map +1 -1
- package/dist-client/modeller/consumer-capabilities.d.ts +29 -0
- package/dist-client/modeller/consumer-capabilities.js +60 -0
- package/dist-client/modeller/consumer-capabilities.js.map +1 -0
- package/dist-client/modeller/data-interface.d.ts +83 -17
- package/dist-client/modeller/data-interface.js +194 -82
- package/dist-client/modeller/data-interface.js.map +1 -1
- package/dist-client/modeller/editor-styles.js +3 -2
- package/dist-client/modeller/editor-styles.js.map +1 -1
- package/dist-client/modeller/editor.d.ts +5 -2
- package/dist-client/modeller/editor.js +21 -8
- package/dist-client/modeller/editor.js.map +1 -1
- package/dist-client/modeller/figure-capability-panel.d.ts +12 -0
- package/dist-client/modeller/figure-capability-panel.js +129 -1
- package/dist-client/modeller/figure-capability-panel.js.map +1 -1
- package/dist-client/modeller/figure-clips.js +1 -1
- package/dist-client/modeller/figure-clips.js.map +1 -1
- package/dist-client/modeller/figure-data-panel.d.ts +57 -13
- package/dist-client/modeller/figure-data-panel.js +476 -191
- package/dist-client/modeller/figure-data-panel.js.map +1 -1
- package/dist-client/modeller/figure-links.d.ts +11 -0
- package/dist-client/modeller/figure-links.js +137 -16
- package/dist-client/modeller/figure-links.js.map +1 -1
- package/dist-client/modeller/figure-preview.d.ts +4 -0
- package/dist-client/modeller/figure-preview.js +65 -7
- package/dist-client/modeller/figure-preview.js.map +1 -1
- package/dist-client/modeller/figure-slot-layout-panel.js +6 -4
- package/dist-client/modeller/figure-slot-layout-panel.js.map +1 -1
- package/dist-client/modeller/links.d.ts +22 -0
- package/dist-client/modeller/links.js +48 -0
- package/dist-client/modeller/links.js.map +1 -1
- package/dist-client/modeller/product-session.d.ts +4 -2
- package/dist-client/modeller/product-session.js +3 -2
- package/dist-client/modeller/product-session.js.map +1 -1
- package/dist-client/modeller/refusals.js +14 -6
- package/dist-client/modeller/refusals.js.map +1 -1
- package/dist-client/modeller/slot-layout-host.d.ts +28 -3
- package/dist-client/modeller/slot-layout-host.js +68 -6
- package/dist-client/modeller/slot-layout-host.js.map +1 -1
- package/dist-client/pages/figure-modeller-page.js +2 -2
- package/dist-client/pages/figure-modeller-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/test/ai-proposal.test.ts +2 -2
- package/test/browser/data-table-page.js +9 -0
- package/test/browser/links.check.mjs +25 -3
- package/test/browser/product-page.check.mjs +25 -0
- package/test/browser/side-panel-sweep.check.mjs +182 -0
- package/test/consumer-capabilities.test.ts +116 -0
- package/test/data-motion.test.ts +94 -27
- package/test/figure-assistant-surface.test.ts +1 -1
- package/test/first-save.test.ts +2 -2
- package/test/links.test.ts +15 -0
- package/test/product-session.test.ts +5 -5
- package/test/proposal-record.test.ts +3 -3
- package/test/revert-keeping.test.ts +1 -1
- package/test/slot-layout-host.test.ts +63 -5
- package/translations/en.json +82 -23
- package/translations/es.json +82 -23
- package/translations/ja.json +82 -23
- package/translations/ko.json +82 -23
- package/translations/ms.json +82 -23
- package/translations/zh.json +82 -23
|
@@ -1 +1 @@
|
|
|
1
|
-
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C,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,QAAQ,CAAC,IAAI;oBACzE,MAAM,KAAK,CAAC,wCAAwC,CAAC,CAAA;gBACvD,yFAAyF;gBACzF,EAAE,GAAG,MAAM,CAAC,EAAE,CAAA;gBACd,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAA;gBACxB,WAAW,CAAC,KAAK,EAAE,CAAA;gBACnB;;;kBAGE;gBACF,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ;oBAAE,SAAS,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAA;YAC3F,CAAC;oBAAS,CAAC;gBACT,IAAI,YAAY,KAAK,KAAK;oBAAE,MAAM,GAAG,KAAK,CAAA;YAC5C,CAAC;YACD,OAAO,IAAI,EAAE,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { thumbnailHashOf } from './thumbnail-hash.js'\nimport { revisionFromView, type FigureRevision } from './revision.js'\nimport {\n createFigureAsset,\n createFigureEditorWorkspace,\n serializeFigureAsset,\n parseFigureAsset,\n figureSizeRangeFitsOf,\n type FigureSizeRangeFit,\n type FigureInputChange,\n type FigurePrimitiveCreation,\n type FigurePartEdit,\n type FigureAuthoringAction,\n type FigureProposalStep,\n type FigureClipConsent\n} from '@hatiolab/figure-model'\n\n/** Consent to let clips go, and the figure and version it was given on. */\n\n/**\n * A request the session refuses, with its code: a screen says it from the code (`sessionRefusalOf`), never from the\n * message, which stays for logs (ADR-0054; figure audit 2026-10-16 N6 -- an AI card put the message in its note).\n */\nfunction refusal(code: string, message: string): Error & { code: string } {\n return Object.assign(Error(message), { code })\n}\n\nexport interface FigureClipConsentFor extends FigureClipConsent {\n context: string\n revision: number\n}\n\nexport interface FigureProductRecord {\n id: string\n source: string\n}\n\n/** Persistence is injected; neither the model engine nor the renderer owns the product ID. */\nexport interface FigureProductStore {\n load(id: string): Promise<FigureProductRecord>\n /** Every field a save writes, as the server holds it now: to tell whether a save whose answer was lost landed. */\n readBack?(id: string): Promise<FigureProductRecord & { thumbnailHash?: string; type?: string }>\n save(request: {\n id?: string\n source: string\n expectedSource?: string\n creationId?: string\n /** The card's picture. Absent when the browser could not draw one; the source is saved either way. */\n thumbnail?: string\n /** The type name a new figure is created under (the first save asks for it). Not sent for an existing one. */\n type?: string\n /** The namespace a new figure is created under, when the first save chose one. Not sent for an existing one. */\n namespace?: string\n /** Keys of the AI proposals whose steps the source holds: the server records them with the save. */\n proposalKeys?: string[]\n }): Promise<FigureProductRecord>\n}\n\n/** Product lifecycle boundary. A late response can never change another editor's asset or ID. */\nexport function createFigureProductSession(store: FigureProductStore) {\n const workspace = createFigureEditorWorkspace()\n let epoch = 0,\n id: string | undefined,\n baseline: string | undefined\n let loading = false,\n saving = false,\n error: string | undefined\n let creationId: string | undefined\n /*\n The history as steps, each tagged with the AI proposal it came from (or nothing): mirrored here, since the\n workspace's history does not say where a step came from. A proposal is in the model while its step is on `done` --\n undone, it is not; undone and written past, it never comes back. What a save sends as `proposalKeys`.\n */\n let done: Array<string | undefined> = [],\n undone: Array<string | undefined> = []\n /* The author's size ends the last step moved without being asked (ADR-0087 decision 6), told once. */\n let fitted: FigureSizeRangeFit[] = []\n function tracked<T>(kind: 'do' | 'undo' | 'redo', run: () => T, tag?: string, setsRange = false): T {\n const was = workspace.read()\n const result = run()\n const now = workspace.read()\n if (now.revision === was.revision) return result\n fitted = kind === 'do' && !setsRange && was.asset && now.asset ? figureSizeRangeFitsOf(was.asset, now.asset) : []\n if (kind === 'do') {\n done.push(tag)\n undone = []\n } else if (kind === 'undo') undone.push(done.pop())\n else done.push(undone.pop())\n return result\n }\n const inEffect = () => [...new Set(done.filter((tag): tag is string => !!tag))]\n /*\n The creation id is read with the rest: a figure not saved yet is named by it (ADR-0061 decision 3) -- its AI\n conversation is anchored on it, and its first save inserts the row under it, so the name holds across that save.\n */\n function read() {\n return { ...workspace.read(), id, creationId, loading, saving, error }\n }\n /*\n The version on screen, one object for as long as it is the version: the workspace hands out one asset per version\n (and another once a save is acknowledged, or the figure moves on), so that object says whether the last one holds.\n */\n let shown: FigureRevision | undefined\n function revisionNow(): FigureRevision | undefined {\n const view = workspace.read()\n if (!view.context || view.revision === null) return (shown = undefined)\n const context = view.context\n if (shown?.asset !== view.asset) shown = revisionFromView(view, () => workspace.export({ context }).text)\n return shown\n }\n /* Texts sent whose save was never answered: found on the server, the server is confirmed to hold what was sent. */\n const unconfirmed = new Map<string, { thumbnail?: string }>()\n /*\n Consent to let clips go: given for one edit, on the figure and the version it was asked on. The first edit made under\n it takes it; an edit on another figure or another version is refused rather than let clips go that were never named\n for it (designer 2026-09-27).\n */\n let consent: FigureClipConsentFor | undefined\n const consented = () => {\n if (!consent) return {}\n const given = consent\n consent = undefined\n const view = workspace.read()\n if (view.context !== given.context || view.revision !== given.revision) {\n const stale = Object.assign(Error('확인한 뒤 모델이 바뀌어 적용하지 않았습니다. 다시 해 주세요.'), { code: 'CONSENT_STALE' })\n throw stale\n }\n return { dropClips: given.dropClips }\n }\n /* A model open to read: the draft is read during a save too -- the dock reads it when the person sends (audit N5). */\n function readable() {\n const view = workspace.read()\n if (loading || error || !view.context || view.revision === null) throw refusal('SESSION_NOT_OPEN', '먼저 모델을 정상적으로 열어 주세요.')\n return { context: view.context, expectedRevision: view.revision, origin: 'ui' as const }\n }\n function writable() {\n const open = readable()\n // Serializing writes also makes create retries safe: no second create while the first is pending.\n if (saving) throw refusal('SESSION_SAVING', '저장이 끝난 뒤 편집해 주세요.')\n return open\n }\n function clear() {\n workspace.close({ discardDesignChanges: true })\n id = undefined\n baseline = undefined\n error = undefined\n saving = false\n creationId = undefined\n done = []\n undone = []\n }\n function canLeave(discard: boolean) {\n if (saving) throw Error('저장이 끝난 뒤 모델을 전환해 주세요.')\n if (workspace.read().dirty && !discard) throw Error('저장하지 않은 변경이 있습니다.')\n }\n return {\n read,\n /** The figure on screen at its version, for every panel and helper to read; none while nothing is open. Readable while saving. */\n revisionNow,\n /**\n * The source the server is confirmed to hold: loaded, or answered by a save. What a revert sends as `expectedSource`\n * -- the server writes over it only while it still holds this. Nothing for a figure not saved yet.\n */\n confirmedSource: () => (id ? baseline : undefined),\n startNew({ discard = false } = {}) {\n canLeave(discard)\n ++epoch\n clear()\n loading = false\n workspace.open(serializeFigureAsset(createFigureAsset('새 Figure')))\n creationId = crypto.randomUUID()\n return read()\n },\n async open(nextId: string, { discard = false } = {}) {\n canLeave(discard)\n const requestEpoch = ++epoch\n clear()\n loading = true\n try {\n const record = await store.load(nextId)\n if (requestEpoch !== epoch) return read()\n if (record.id !== nextId) throw Error('요청한 Figure와 응답의 대상이 다릅니다.')\n workspace.open(record.source)\n id = nextId\n baseline = record.source\n } catch (cause) {\n if (requestEpoch === epoch) error = cause instanceof Error ? cause.message : String(cause)\n } finally {\n if (requestEpoch === epoch) loading = false\n }\n return read()\n },\n close({ discard = false } = {}) {\n canLeave(discard)\n ++epoch\n clear()\n loading = false\n return read()\n },\n apply(changes: FigureInputChange[], origin: 'ui' | 'ai' = 'ui', expectedRevision?: number, context?: string) {\n const control = writable()\n // AI must supply the context AND revision captured when it started. Never substitute current values.\n if (origin === 'ai' && (context === undefined || expectedRevision === undefined))\n throw refusal('SESSION_VERSION_MISSING', 'AI 편집에는 요청 당시의 모델 문맥과 리비전이 필요합니다.')\n return tracked('do', () =>\n workspace.apply({\n ...control,\n origin,\n context: context ?? control.context,\n expectedRevision: expectedRevision ?? control.expectedRevision,\n changes\n })\n )\n },\n /**\n * An AI proposal (ADR-0094): the modeller's commands, as one step of the history, on the version the model saw.\n * Never on the current one instead -- a person's edit in between makes the proposal stale, and it is refused.\n */\n applyProposal(steps: readonly FigureProposalStep[], expectedRevision: number, context: string, key?: string) {\n writable()\n /* Never with consent: only the person may let a clip go, and an AI proposal is not the person (designer 2026-09-27). */\n return tracked('do', () => workspace.applyProposal({ origin: 'ai', context, expectedRevision, steps }), key)\n },\n /**\n * A new figure opened for an AI proposal from another screen is created under the proposal's key (ADR-0097 §5.6\n * item 5). Only before the modeller names the figure to the AI dock: once a conversation is anchored on the creation\n * id it stays (ADR-0061 decision 3), and the save's record of the proposal keeps one proposal one figure. Only on a\n * new figure not yet touched -- one being made is the person's, and keeps its own.\n */\n createUnder(key: string) {\n if (id || workspace.read().dirty) throw refusal('SESSION_NEW_FIGURE_TOUCHED', '손대지 않은 새 모델에만 쓸 수 있습니다.')\n if (!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(key)) throw refusal('SESSION_PROPOSAL_KEY', '제안 식별자가 올바르지 않습니다.')\n creationId = key\n },\n /** The AI proposals whose steps are in the model now, each once. */\n proposalsInEffect: inEffect,\n /**\n * A recipe put in by the person (ADR-0095): its resolved commands, as one step of the history, on the version open\n * now. The same path as a proposal; the person is its origin.\n */\n applyRecipe(steps: readonly FigureProposalStep[]) {\n const at = writable()\n return tracked('do', () => workspace.applyProposal({ origin: 'ui', context: at.context, expectedRevision: at.expectedRevision, steps, ...consented() }))\n },\n add(part: FigurePrimitiveCreation) {\n return tracked('do', () => workspace.addPrimitive({ ...writable(), part }))\n },\n edit(edit: FigurePartEdit) {\n return tracked('do', () => workspace.editPart({ ...writable(), edit, ...consented() }))\n },\n /** What a command would do, on a copy (ADR-0097 §5.5): nothing is written, and the answer names its version. */\n previewCommand(action: FigureAuthoringAction) {\n const view = workspace.read()\n if (loading || error || !view.context || view.revision === null) throw refusal('SESSION_NOT_OPEN', '먼저 모델을 정상적으로 열어 주세요.')\n return workspace.previewCommand({ context: view.context, action })\n },\n /** One authoring command — what a person means, not a graph edit — as one step of the same history. */\n command(action: FigureAuthoringAction) {\n return tracked('do', () => workspace.command({ ...writable(), action, ...consented() }), undefined, action.kind === 'declare-instance-size')\n },\n /** The ends of the size on a drawing the last step moved in to what the parts allow, once: then nothing until the next. */\n takeSizeRangeFits(): FigureSizeRangeFit[] {\n const out = fitted\n fitted = []\n return out\n },\n /**\n * The first edit made inside `run` may let go of exactly these clips -- the ones a CLIPS_DROPPED refusal named and\n * the person agreed to -- on the figure and version they were named on (designer 2026-09-27). Any other edit that\n * would stop a clip is refused and asked about.\n */\n withConsent<T>(given: FigureClipConsentFor, run: () => T): T {\n consent = given\n try {\n return run()\n } finally {\n consent = undefined\n }\n },\n undo() {\n return tracked('undo', () => workspace.undo(writable()))\n },\n redo() {\n return tracked('redo', () => workspace.redo(writable()))\n },\n source() {\n const { context } = readable()\n return workspace.export({ context }).text\n },\n /**\n * Saves the model, and the card's picture when the caller managed to take one.\n *\n * The picture is the caller's because taking it needs a canvas, and this session is the place that knows\n * nothing about drawing. A save with no picture is a save: a tab in the background cannot draw, and the\n * source matters more than the card (see `thumbnail.ts`).\n */\n async save({ thumbnail, type, namespace }: { thumbnail?: string; type?: string; namespace?: string } = {}) {\n const control = writable(),\n requestEpoch = epoch\n const exported = workspace.export(control)\n /* Read with the text it goes with: an edit while saving is not what this save holds. */\n const proposalKeys = inEffect()\n saving = true\n try {\n let record: FigureProductRecord\n try {\n record = await store.save({ id, source: exported.text, expectedSource: baseline, creationId, thumbnail, proposalKeys, ...(id || !type ? {} : { type }), ...(id || !namespace ? {} : { namespace }) })\n } catch (error) {\n /*\n A save that failed may still have landed: the answer lost on the way back (SAVE_UNREACHABLE), or a second\n try refused because the first did land -- its expected source is the old one (FIGURE_SOURCE_CONFLICT). Only\n those are read back; a refusal on grounds -- permission, validation -- stays a failure whatever the row\n holds. Read back, every field the save writes must be what was sent: the source, the picture, the type\n (designer 2026-09-27: a network failure alone does not say nothing was saved; nor does a matching source\n alone say it was).\n */\n const code = (error as { code?: string })?.code\n const unknown = code === 'SAVE_UNREACHABLE' || code === 'FIGURE_SOURCE_CONFLICT'\n const landed = unknown && id !== undefined && requestEpoch === epoch && store.readBack ? await store.readBack(id).catch(() => undefined) : undefined\n const held = landed ? serializeFigureAsset(parseFigureAsset(landed.source)) : undefined\n /* The picture is compared by the name the server keeps it under: the hash of its bytes (ADR-0104). */\n const holds = async (sent?: string) => sent === undefined || (!!landed && landed.thumbnailHash !== undefined && landed.thumbnailHash === (await thumbnailHashOf(sent)))\n const same = !!landed && held === exported.text && (await holds(thumbnail)) && (type === undefined || landed.type === type)\n if (same) record = landed!\n else if (\n code === 'FIGURE_SOURCE_CONFLICT' &&\n landed &&\n held !== undefined &&\n unconfirmed.has(held) &&\n /* Every field that earlier save wrote, not the source alone: nothing not compared is written over. */\n (await holds(unconfirmed.get(held)!.thumbnail))\n ) {\n /*\n The row holds a text this session sent and never heard back about -- edited further since, the new text\n is not it. The server is known to hold what was sent: this save is sent again, once, conditional on that\n server text as the expected source (designer 2026-09-27: \"the sent content is confirmed on the server\").\n */\n baseline = landed.source\n unconfirmed.clear()\n record = await store.save({ id, source: exported.text, expectedSource: baseline, creationId, thumbnail, proposalKeys, ...(id || !type ? {} : { type }), ...(id || !namespace ? {} : { namespace }) })\n } else {\n if (code === 'SAVE_UNREACHABLE') unconfirmed.set(exported.text, { thumbnail })\n throw error\n }\n }\n if (requestEpoch !== epoch) return read()\n if (!record.id || (id !== undefined && record.id !== id)) throw Error('저장 응답의 Figure 대상이 다릅니다.')\n if (serializeFigureAsset(parseFigureAsset(record.source)) !== exported.text)\n throw Error('저장 응답이 보낸 모델과 다릅니다. 저장 상태를 다시 확인해 주세요.')\n /* The server has it: the next save expects it, whatever happened on screen meanwhile. */\n id = record.id\n baseline = record.source\n unconfirmed.clear()\n /*\n Edited while it was saving: what was sent is saved, the edits since are not -- they stay, and the model stays\n unsaved (the workspace refuses a stale acknowledgement). Never marked saved, never wiped.\n */\n if (workspace.read().revision === exported.revision) workspace.acknowledgeSaved(exported)\n } finally {\n if (requestEpoch === epoch) saving = false\n }\n return read()\n }\n }\n}\nexport type FigureProductSession = ReturnType<typeof createFigureProductSession>\n"]}
|
|
1
|
+
{"version":3,"file":"product-session.js","sourceRoot":"","sources":["../../client/modeller/product-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAA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AAwC,CAAC,CAAA;gBACvD,yFAAyF;gBACzF,EAAE,GAAG,MAAM,CAAC,EAAE,CAAA;gBACd,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAA;gBACxB,WAAW,CAAC,KAAK,EAAE,CAAA;gBACnB;;;kBAGE;gBACF,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ;oBAAE,SAAS,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAA;YAC3F,CAAC;oBAAS,CAAC;gBACT,IAAI,YAAY,KAAK,KAAK;oBAAE,MAAM,GAAG,KAAK,CAAA;YAC5C,CAAC;YACD,OAAO,IAAI,EAAE,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { thumbnailHashOf } from './thumbnail-hash.js'\nimport { revisionFromView, type FigureRevision } from './revision.js'\nimport {\n createFigureAsset,\n createFigureEditorWorkspace,\n serializeFigureAsset,\n parseFigureAsset,\n figureSizeRangeFitsOf,\n type FigureSizeRangeFit,\n type FigureInputChange,\n type FigurePrimitiveCreation,\n type FigurePartEdit,\n type FigureAuthoringAction,\n type FigureProposalStep,\n type FigureClipConsent\n} from '@hatiolab/figure-model'\n\n/** Consent to let clips go, and the figure and version it was given on. */\n\n/**\n * A request the session refuses, with its code: a screen says it from the code (`sessionRefusalOf`), never from the\n * message, which stays for logs (ADR-0054; figure audit 2026-10-16 N6 -- an AI card put the message in its note).\n */\nfunction refusal(code: string, message: string): Error & { code: string } {\n return Object.assign(Error(message), { code })\n}\n\nexport interface FigureClipConsentFor extends FigureClipConsent {\n context: string\n revision: number\n}\n\nexport interface FigureProductRecord {\n id: string\n source: string\n}\n\n/** Persistence is injected; neither the model engine nor the renderer owns the product ID. */\nexport interface FigureProductStore {\n load(id: string): Promise<FigureProductRecord>\n /** Every field a save writes, as the server holds it now: to tell whether a save whose answer was lost landed. */\n readBack?(id: string): Promise<FigureProductRecord & { thumbnailHash?: string; type?: string }>\n save(request: {\n id?: string\n source: string\n expectedSource?: string\n creationId?: string\n /** The card's picture. Absent when the browser could not draw one; the source is saved either way. */\n thumbnail?: string\n /** The type name a new figure is created under (the first save asks for it). Not sent for an existing one. */\n type?: string\n /** The namespace a new figure is created under, when the first save chose one. Not sent for an existing one. */\n namespace?: string\n /** Keys of the AI proposals whose steps the source holds: the server records them with the save. */\n proposalKeys?: string[]\n }): Promise<FigureProductRecord>\n}\n\n/** Product lifecycle boundary. A late response can never change another editor's asset or ID. */\nexport function createFigureProductSession(store: FigureProductStore) {\n const workspace = createFigureEditorWorkspace()\n let epoch = 0,\n id: string | undefined,\n baseline: string | undefined\n let loading = false,\n saving = false,\n error: string | undefined\n let creationId: string | undefined\n /*\n The history as steps, each tagged with the AI proposal it came from (or nothing): mirrored here, since the\n workspace's history does not say where a step came from. A proposal is in the model while its step is on `done` --\n undone, it is not; undone and written past, it never comes back. What a save sends as `proposalKeys`.\n */\n let done: Array<string | undefined> = [],\n undone: Array<string | undefined> = []\n /* The author's size ends the last step moved without being asked (ADR-0087 decision 6), told once. */\n let fitted: FigureSizeRangeFit[] = []\n function tracked<T>(kind: 'do' | 'undo' | 'redo', run: () => T, tag?: string, setsRange = false): T {\n const was = workspace.read()\n const result = run()\n const now = workspace.read()\n if (now.revision === was.revision) return result\n fitted = kind === 'do' && !setsRange && was.asset && now.asset ? figureSizeRangeFitsOf(was.asset, now.asset) : []\n if (kind === 'do') {\n done.push(tag)\n undone = []\n } else if (kind === 'undo') undone.push(done.pop())\n else done.push(undone.pop())\n return result\n }\n const inEffect = () => [...new Set(done.filter((tag): tag is string => !!tag))]\n /*\n The creation id is read with the rest: a figure not saved yet is named by it (ADR-0061 decision 3) -- its AI\n conversation is anchored on it, and its first save inserts the row under it, so the name holds across that save.\n */\n function read() {\n return { ...workspace.read(), id, creationId, loading, saving, error }\n }\n /*\n The version on screen, one object for as long as it is the version: the workspace hands out one asset per version\n (and another once a save is acknowledged, or the figure moves on), so that object says whether the last one holds.\n */\n let shown: FigureRevision | undefined\n function revisionNow(): FigureRevision | undefined {\n const view = workspace.read()\n if (!view.context || view.revision === null) return (shown = undefined)\n const context = view.context\n if (shown?.asset !== view.asset) shown = revisionFromView(view, () => workspace.export({ context }).text)\n return shown\n }\n /* Texts sent whose save was never answered: found on the server, the server is confirmed to hold what was sent. */\n const unconfirmed = new Map<string, { thumbnail?: string }>()\n /*\n Consent to let clips go: given for one edit, on the figure and the version it was asked on. The first edit made under\n it takes it; an edit on another figure or another version is refused rather than let clips go that were never named\n for it (designer 2026-09-27).\n */\n let consent: FigureClipConsentFor | undefined\n const consented = () => {\n if (!consent) return {}\n const given = consent\n consent = undefined\n const view = workspace.read()\n if (view.context !== given.context || view.revision !== given.revision) {\n const stale = Object.assign(Error('확인한 뒤 모델이 바뀌어 적용하지 않았습니다. 다시 해 주세요.'), { code: 'CONSENT_STALE' })\n throw stale\n }\n return { dropClips: given.dropClips }\n }\n /* A model open to read: the draft is read during a save too -- the dock reads it when the person sends (audit N5). */\n function readable() {\n const view = workspace.read()\n if (loading || error || !view.context || view.revision === null) throw refusal('SESSION_NOT_OPEN', '먼저 모델을 정상적으로 열어 주세요.')\n return { context: view.context, expectedRevision: view.revision, origin: 'ui' as const }\n }\n function writable() {\n const open = readable()\n // Serializing writes also makes create retries safe: no second create while the first is pending.\n if (saving) throw refusal('SESSION_SAVING', '저장이 끝난 뒤 편집해 주세요.')\n return open\n }\n function clear() {\n workspace.close({ discardDesignChanges: true })\n id = undefined\n baseline = undefined\n error = undefined\n saving = false\n creationId = undefined\n done = []\n undone = []\n }\n function canLeave(discard: boolean) {\n if (saving) throw Error('저장이 끝난 뒤 모델을 전환해 주세요.')\n if (workspace.read().dirty && !discard) throw Error('저장하지 않은 변경이 있습니다.')\n }\n return {\n read,\n /** The figure on screen at its version, for every panel and helper to read; none while nothing is open. Readable while saving. */\n revisionNow,\n /**\n * The source the server is confirmed to hold: loaded, or answered by a save. What a revert sends as `expectedSource`\n * -- the server writes over it only while it still holds this. Nothing for a figure not saved yet.\n */\n confirmedSource: () => (id ? baseline : undefined),\n /** A new figure, named in the screen's language by the page: the session has no words of its own. */\n startNew({ discard = false, name }: { discard?: boolean; name: string }) {\n canLeave(discard)\n ++epoch\n clear()\n loading = false\n workspace.open(serializeFigureAsset(createFigureAsset(name)))\n creationId = crypto.randomUUID()\n return read()\n },\n async open(nextId: string, { discard = false } = {}) {\n canLeave(discard)\n const requestEpoch = ++epoch\n clear()\n loading = true\n try {\n const record = await store.load(nextId)\n if (requestEpoch !== epoch) return read()\n if (record.id !== nextId) throw Error('요청한 Figure와 응답의 대상이 다릅니다.')\n workspace.open(record.source)\n id = nextId\n baseline = record.source\n } catch (cause) {\n if (requestEpoch === epoch) error = cause instanceof Error ? cause.message : String(cause)\n } finally {\n if (requestEpoch === epoch) loading = false\n }\n return read()\n },\n close({ discard = false } = {}) {\n canLeave(discard)\n ++epoch\n clear()\n loading = false\n return read()\n },\n apply(changes: FigureInputChange[], origin: 'ui' | 'ai' = 'ui', expectedRevision?: number, context?: string) {\n const control = writable()\n // AI must supply the context AND revision captured when it started. Never substitute current values.\n if (origin === 'ai' && (context === undefined || expectedRevision === undefined))\n throw refusal('SESSION_VERSION_MISSING', 'AI 편집에는 요청 당시의 모델 문맥과 리비전이 필요합니다.')\n return tracked('do', () =>\n workspace.apply({\n ...control,\n origin,\n context: context ?? control.context,\n expectedRevision: expectedRevision ?? control.expectedRevision,\n changes\n })\n )\n },\n /**\n * An AI proposal (ADR-0094): the modeller's commands, as one step of the history, on the version the model saw.\n * Never on the current one instead -- a person's edit in between makes the proposal stale, and it is refused.\n */\n applyProposal(steps: readonly FigureProposalStep[], expectedRevision: number, context: string, key?: string) {\n writable()\n /* Never with consent: only the person may let a clip go, and an AI proposal is not the person (designer 2026-09-27). */\n return tracked('do', () => workspace.applyProposal({ origin: 'ai', context, expectedRevision, steps }), key)\n },\n /**\n * A new figure opened for an AI proposal from another screen is created under the proposal's key (ADR-0097 §5.6\n * item 5). Only before the modeller names the figure to the AI dock: once a conversation is anchored on the creation\n * id it stays (ADR-0061 decision 3), and the save's record of the proposal keeps one proposal one figure. Only on a\n * new figure not yet touched -- one being made is the person's, and keeps its own.\n */\n createUnder(key: string) {\n if (id || workspace.read().dirty) throw refusal('SESSION_NEW_FIGURE_TOUCHED', '손대지 않은 새 모델에만 쓸 수 있습니다.')\n if (!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(key)) throw refusal('SESSION_PROPOSAL_KEY', '제안 식별자가 올바르지 않습니다.')\n creationId = key\n },\n /** The AI proposals whose steps are in the model now, each once. */\n proposalsInEffect: inEffect,\n /**\n * A recipe put in by the person (ADR-0095): its resolved commands, as one step of the history, on the version open\n * now. The same path as a proposal; the person is its origin.\n */\n applyRecipe(steps: readonly FigureProposalStep[]) {\n const at = writable()\n return tracked('do', () => workspace.applyProposal({ origin: 'ui', context: at.context, expectedRevision: at.expectedRevision, steps, ...consented() }))\n },\n add(part: FigurePrimitiveCreation) {\n return tracked('do', () => workspace.addPrimitive({ ...writable(), part }))\n },\n edit(edit: FigurePartEdit) {\n return tracked('do', () => workspace.editPart({ ...writable(), edit, ...consented() }))\n },\n /** What a command would do, on a copy (ADR-0097 §5.5): nothing is written, and the answer names its version. */\n previewCommand(action: FigureAuthoringAction) {\n const view = workspace.read()\n if (loading || error || !view.context || view.revision === null) throw refusal('SESSION_NOT_OPEN', '먼저 모델을 정상적으로 열어 주세요.')\n return workspace.previewCommand({ context: view.context, action })\n },\n /** One authoring command — what a person means, not a graph edit — as one step of the same history. */\n command(action: FigureAuthoringAction) {\n return tracked('do', () => workspace.command({ ...writable(), action, ...consented() }), undefined, action.kind === 'declare-instance-size')\n },\n /** The ends of the size on a drawing the last step moved in to what the parts allow, once: then nothing until the next. */\n takeSizeRangeFits(): FigureSizeRangeFit[] {\n const out = fitted\n fitted = []\n return out\n },\n /**\n * The first edit made inside `run` may let go of exactly these clips -- the ones a CLIPS_DROPPED refusal named and\n * the person agreed to -- on the figure and version they were named on (designer 2026-09-27). Any other edit that\n * would stop a clip is refused and asked about.\n */\n withConsent<T>(given: FigureClipConsentFor, run: () => T): T {\n consent = given\n try {\n return run()\n } finally {\n consent = undefined\n }\n },\n undo() {\n return tracked('undo', () => workspace.undo(writable()))\n },\n redo() {\n return tracked('redo', () => workspace.redo(writable()))\n },\n source() {\n const { context } = readable()\n return workspace.export({ context }).text\n },\n /**\n * Saves the model, and the card's picture when the caller managed to take one.\n *\n * The picture is the caller's because taking it needs a canvas, and this session is the place that knows\n * nothing about drawing. A save with no picture is a save: a tab in the background cannot draw, and the\n * source matters more than the card (see `thumbnail.ts`).\n */\n async save({ thumbnail, type, namespace }: { thumbnail?: string; type?: string; namespace?: string } = {}) {\n const control = writable(),\n requestEpoch = epoch\n const exported = workspace.export(control)\n /* Read with the text it goes with: an edit while saving is not what this save holds. */\n const proposalKeys = inEffect()\n saving = true\n try {\n let record: FigureProductRecord\n try {\n record = await store.save({ id, source: exported.text, expectedSource: baseline, creationId, thumbnail, proposalKeys, ...(id || !type ? {} : { type }), ...(id || !namespace ? {} : { namespace }) })\n } catch (error) {\n /*\n A save that failed may still have landed: the answer lost on the way back (SAVE_UNREACHABLE), or a second\n try refused because the first did land -- its expected source is the old one (FIGURE_SOURCE_CONFLICT). Only\n those are read back; a refusal on grounds -- permission, validation -- stays a failure whatever the row\n holds. Read back, every field the save writes must be what was sent: the source, the picture, the type\n (designer 2026-09-27: a network failure alone does not say nothing was saved; nor does a matching source\n alone say it was).\n */\n const code = (error as { code?: string })?.code\n const unknown = code === 'SAVE_UNREACHABLE' || code === 'FIGURE_SOURCE_CONFLICT'\n const landed = unknown && id !== undefined && requestEpoch === epoch && store.readBack ? await store.readBack(id).catch(() => undefined) : undefined\n const held = landed ? serializeFigureAsset(parseFigureAsset(landed.source)) : undefined\n /* The picture is compared by the name the server keeps it under: the hash of its bytes (ADR-0104). */\n const holds = async (sent?: string) => sent === undefined || (!!landed && landed.thumbnailHash !== undefined && landed.thumbnailHash === (await thumbnailHashOf(sent)))\n const same = !!landed && held === exported.text && (await holds(thumbnail)) && (type === undefined || landed.type === type)\n if (same) record = landed!\n else if (\n code === 'FIGURE_SOURCE_CONFLICT' &&\n landed &&\n held !== undefined &&\n unconfirmed.has(held) &&\n /* Every field that earlier save wrote, not the source alone: nothing not compared is written over. */\n (await holds(unconfirmed.get(held)!.thumbnail))\n ) {\n /*\n The row holds a text this session sent and never heard back about -- edited further since, the new text\n is not it. The server is known to hold what was sent: this save is sent again, once, conditional on that\n server text as the expected source (designer 2026-09-27: \"the sent content is confirmed on the server\").\n */\n baseline = landed.source\n unconfirmed.clear()\n record = await store.save({ id, source: exported.text, expectedSource: baseline, creationId, thumbnail, proposalKeys, ...(id || !type ? {} : { type }), ...(id || !namespace ? {} : { namespace }) })\n } else {\n if (code === 'SAVE_UNREACHABLE') unconfirmed.set(exported.text, { thumbnail })\n throw error\n }\n }\n if (requestEpoch !== epoch) return read()\n if (!record.id || (id !== undefined && record.id !== id)) throw Error('저장 응답의 Figure 대상이 다릅니다.')\n if (serializeFigureAsset(parseFigureAsset(record.source)) !== exported.text)\n throw Error('저장 응답이 보낸 모델과 다릅니다. 저장 상태를 다시 확인해 주세요.')\n /* The server has it: the next save expects it, whatever happened on screen meanwhile. */\n id = record.id\n baseline = record.source\n unconfirmed.clear()\n /*\n Edited while it was saving: what was sent is saved, the edits since are not -- they stay, and the model stays\n unsaved (the workspace refuses a stale acknowledgement). Never marked saved, never wiped.\n */\n if (workspace.read().revision === exported.revision) workspace.acknowledgeSaved(exported)\n } finally {\n if (requestEpoch === epoch) saving = false\n }\n return read()\n }\n }\n}\nexport type FigureProductSession = ReturnType<typeof createFigureProductSession>\n"]}
|
|
@@ -276,12 +276,20 @@ export function dataMotionRefusalOf(error, say) {
|
|
|
276
276
|
high: domain.within ? numberOf(domain.within[1]) : '',
|
|
277
277
|
value: domain.value === undefined ? '' : String(domain.value)
|
|
278
278
|
});
|
|
279
|
-
const
|
|
280
|
-
if (
|
|
281
|
-
return say('figure.text.data-
|
|
282
|
-
const
|
|
283
|
-
if (
|
|
284
|
-
return say('figure.text.data-
|
|
279
|
+
const target = detailsOf(error, 'data-table-target');
|
|
280
|
+
if (target)
|
|
281
|
+
return say('figure.text.data-table-target-' + target.what, { binding: target.binding, id: target.id ?? '' });
|
|
282
|
+
const entry = detailsOf(error, 'data-table-entry');
|
|
283
|
+
if (entry)
|
|
284
|
+
return say('figure.text.data-table-entry-' + entry.what, {
|
|
285
|
+
binding: entry.binding,
|
|
286
|
+
key: entry.key === 'default' ? say('figure.label.data-otherwise', {}) : entry.key,
|
|
287
|
+
id: entry.id ?? '',
|
|
288
|
+
value: entry.value === undefined ? '' : String(typeof entry.value === 'object' ? JSON.stringify(entry.value) : entry.value)
|
|
289
|
+
});
|
|
290
|
+
const legend = detailsOf(error, 'data-legend-invalid');
|
|
291
|
+
if (legend)
|
|
292
|
+
return say('figure.text.data-legend-invalid', { role: legend.role });
|
|
285
293
|
const clipAbsent = detailsOf(error, 'motion-clip-absent');
|
|
286
294
|
if (clipAbsent)
|
|
287
295
|
return say('figure.text.motion-clip-absent', { clip: clipAbsent.clip, group: clipAbsent.group });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refusals.js","sourceRoot":"","sources":["../../client/modeller/refusals.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,2BAA2B,EAA2E,MAAM,wBAAwB,CAAA;AAK7I,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,EAAE,CAAE,KAA8C,EAAE,IAAI,CAAA;AACxF,sEAAsE;AACtE,SAAS,SAAS,CAAmB,KAAc,EAAE,MAAS;IAC5D,MAAM,OAAO,GAAI,KAA+D,EAAE,OAAO,CAAA;IACzF,OAAO,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC,CAAE,OAAwD,CAAC,CAAC,CAAC,SAAS,CAAA;AAC3G,CAAC;AACD,M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AAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IACnI,OAAO,GAAG,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;AAChE,CAAC","sourcesContent":["/*\n * A command figure-model refused, in the author's words with the numbers and where to put it right -- not the kernel's\n * English (user, 2026-09-24: 「what is this warning message means?」). Kept apart from the element so it is tested\n * without a browser.\n *\n * Every sentence here is made from the refusal's `code` and `details` (ADR-0127), never from its message: the kernel's\n * English is for logs and readers of the kernel, and a screen that read it went quiet whenever a sentence changed or a\n * new one came under the same code (ADR-0054). A refusal with no details the screen knows is said with its code.\n */\nimport { FIGURE_INSTANCE_SIZE_INPUTS, type FigureClipLoss, type FigureRefusalDetails, type FigureSizeRangeFit } from '@hatiolab/figure-model'\n\ntype Say = (key: string, params: Record<string, string>) => string\ntype Reason = FigureRefusalDetails['reason']\n\nconst codeOf = (error: unknown) => (error as { code?: string } | null | undefined)?.code\n/** The refusal's details when they are of this reason, or nothing. */\nfunction detailsOf<R extends Reason>(error: unknown, reason: R): Extract<FigureRefusalDetails, { reason: R }> | undefined {\n const details = (error as { details?: FigureRefusalDetails } | null | undefined)?.details\n return details?.reason === reason ? (details as Extract<FigureRefusalDetails, { reason: R }>) : undefined\n}\nconst mmOf = (mm: number) => mm.toLocaleString(undefined, { maximumFractionDigits: 1 })\nconst numberOf = (value: number) => value.toLocaleString(undefined, { maximumFractionDigits: 3 })\n/** Bytes in KiB, rounded up: a figure a few bytes over its limit is not said to be at it. */\nconst kibOf = (bytes: number) => Math.ceil(bytes / 1024).toLocaleString()\n\n/**\n * The ends an author typed for the size on a drawing, refused: they leave out the size the figure is drawn at, or start\n * at zero. The only refusals the size range has left (ADR-0087 decision 6); nothing for any other refusal.\n */\nexport function sizeRangeRefusalOf(error: unknown, say: Say): string | null {\n if (codeOf(error) !== 'INSTANCE_SIZE_RANGE') return null\n const outside = detailsOf(error, 'size-outside-range')\n if (outside)\n return say('figure.text.size-range-leaves-out-size', {\n axis: say(`figure.label.resize-${outside.axis}`, {}),\n range: `${mmOf(outside.min ?? 0)} – ${outside.max === undefined ? '∞' : mmOf(outside.max)}`,\n at: mmOf(outside.at)\n })\n const zero = detailsOf(error, 'size-min-not-positive')\n if (zero) return say('figure.text.size-range-from-zero', { axis: say(`figure.label.resize-${zero.axis}`, {}) })\n return null\n}\n\n/** What a command did to the ends the author typed, in one line each: what moved, from what to what. */\nexport function sizeRangeFitsOf(fits: readonly FigureSizeRangeFit[], say: Say): string {\n return fits\n .map(f => say(`figure.text.size-range-moved-${f.bound}`, { axis: say(`figure.label.resize-${f.axis}`, {}), from: mmOf(f.from), to: mmOf(f.to) }))\n .join(' ')\n}\n\n/**\n * A placement refused because a part is fastened to the mounting plane in a way the new plane does not take (standing\n * on the floor, when the figure is to hang on a wall), said in the author's words with the parts it names.\n */\nexport function placementRefusalOf(error: unknown, say: Say): string | null {\n if (codeOf(error) !== 'PLACEMENT_PLANE') return null\n const misfit = detailsOf(error, 'placement-face')\n if (!misfit) return null\n return say('figure.text.placement-plane-refused', { parts: misfit.parts.map(p => p.part).join(', ') })\n}\n\n/** A refusal carried on in a record (an AI proposal's outcome) in figure-model's own shape: its code and details. */\nexport interface FigureRefusalRecord {\n code?: string\n details?: FigureRefusalDetails\n}\n\n/** The record of a refusal: figure-model's code and details, copied as they are. */\nexport function refusalRecordOf(error: unknown): FigureRefusalRecord {\n const { details } = (error ?? {}) as FigureRefusalRecord\n return { code: codeOf(error), ...(details ? { details } : {}) }\n}\n\n/** The clips an edit would stop, as figure-model named them (CLIPS_DROPPED) -- the person is asked before any go; nothing for any other refusal. */\nexport function clipLossOf(error: unknown): FigureClipLoss[] | null {\n return codeOf(error) === 'CLIPS_DROPPED' ? (detailsOf(error, 'clips-dropped')?.clips ?? []) : null\n}\n\n/**\n * Why a part cannot be deleted, in the author's words. Since the chief architect's ruling of 2026-09-27 a part that\n * holds others, leads a motion or is followed goes, and what depended on it is let go of (`removalNoticeOf`); what is\n * left is a row -- one laid along the part, or hanging in its row.\n */\nexport function partRefusalOf(error: unknown, part: string, say: Say): string | null {\n const code = codeOf(error)\n if (code !== 'PART_REFERENCED' && code !== 'PART_ROW') return null\n const along = detailsOf(error, 'row-along')\n if (along) return say('figure.text.part-row-along', { part, rows: along.rows.join(', ') })\n const carried = detailsOf(error, 'hangs-in-row')\n if (carried) return say('figure.text.part-row-carries', { part, others: carried.parts.join(', ') })\n return say('figure.text.part-is-referenced', { part })\n}\n\n/** A part the gizmo cannot move because a joint or a fastening places it, named as the author knows it (`part`). */\nexport function placedRefusalOf(error: unknown, part: string, say: Say): string | null {\n if (codeOf(error) !== 'EDIT_TARGET') return null\n if (detailsOf(error, 'placed-by-joint')) return say('figure.text.gizmo-joint-places', { part })\n if (detailsOf(error, 'placed-by-fastening')) return say('figure.text.gizmo-fastening-places', { part })\n return null\n}\n\n/** A part name refused: not a name, already used, or another part is named under the part. The rule is the kernel's. */\nexport function partNameRefusalOf(error: unknown, say: Say): string | null {\n /* A new part named as one already is: the same sentence as a part renamed so. */\n const takenId = detailsOf(error, 'part-id-taken')\n if (takenId) return say('figure.text.part-name-taken', { name: takenId.part })\n if (codeOf(error) !== 'PART_ID') return null\n const invalid = detailsOf(error, 'name-invalid')\n if (invalid) return say('figure.text.part-name-invalid', { name: invalid.name })\n const taken = detailsOf(error, 'name-taken')\n if (taken) return say('figure.text.part-name-taken', { name: taken.name })\n const nested = detailsOf(error, 'name-has-nested')\n if (nested) return say('figure.text.part-name-has-nested', { nested: nested.nested })\n return null\n}\n\n/** What removing a part let go of (figure-model's `RemovalNotice`), said in one line, or nothing when it let go of nothing. */\nexport function removalNoticeOf(\n notice:\n | {\n released: Array<{ part: string; control?: string }>\n fixed: Array<{ part: string }>\n controls: Array<{ part: string; control: string; min: number; max: number }>\n mountingFace?: boolean\n bindings?: Array<{ id: string; label?: string }>\n }\n | undefined,\n say: Say\n): string | null {\n if (!notice) return null\n const lines: string[] = []\n const still = notice.released.filter(r => !r.control).map(r => r.part)\n if (still.length) lines.push(say('figure.text.removal-released', { parts: still.join(', ') }))\n for (const r of notice.released.filter(r => r.control)) lines.push(say('figure.text.removal-released-motion', { part: r.part, control: r.control! }))\n for (const c of notice.controls) lines.push(say('figure.text.removal-own-control', { part: c.part, control: c.control, min: numberOf(c.min), max: numberOf(c.max) }))\n const fixed = [...new Set(notice.fixed.map(f => f.part))]\n if (fixed.length) lines.push(say('figure.text.removal-fixed', { parts: fixed.join(', ') }))\n if (notice.bindings?.length) lines.push(say('figure.text.removal-bindings', { places: notice.bindings.map(b => b.label ?? b.id).join(', ') }))\n if (notice.mountingFace) lines.push(say('figure.text.removal-mounting-face', {}))\n return lines.length ? lines.join(' ') : null\n}\n\n/**\n * A recipe refused at one of its steps: which step, and why -- the particular sentence when there is one (a size\n * range, a value's range, a placement), otherwise the kernel's code. The step is the refusal's path, `steps[2]`: the\n * contract's path grammar, not its English (ADR-0127 decision 6).\n */\nexport function recipeRefusalOf(error: unknown, say: Say): string | null {\n const step = /^steps\\[(\\d+)\\]$/.exec((error as { path?: string })?.path ?? '')\n if (!step) return null\n const why = sizeRangeRefusalOf(error, say) ?? inputRangeRefusalOf(error, say) ?? placementRefusalOf(error, say)\n return say('figure.text.recipe-step-refused', { step: String(Number(step[1]) + 1), why: why ?? '', code: codeOf(error) ?? '' })\n}\n\n/**\n * A corner or an inside the part cannot take (ADR-0100 stage 1): what was too large or too thick, or what holds on\n * to what the edit would take away.\n */\nfunction sectionRefusalOf(error: unknown, say: Say): string | null {\n const mapping = detailsOf(error, 'faces-taken-away')\n if (mapping) return say('figure.text.section-face-in-use', { faces: mapping.lost.map(l => say('figure.label.face-' + l.face, {})).join(', ') })\n if (codeOf(error) === 'DIMENSION_LINKED') return say('figure.text.section-dimension-linked', {})\n if (detailsOf(error, 'section-invalid')?.issues.some(i => i.code === 'CORNER_TOO_LARGE')) return say('figure.text.section-corner-too-large', {})\n const inside = detailsOf(error, 'inside-invalid')?.refusal\n if (inside?.code === 'CAVITY' && inside.refused === 'NO_ROOM_INSIDE') return say('figure.text.section-wall-too-thick', {})\n if (inside?.code === 'CAVITY_NO_LENGTH') return say('figure.text.section-ends-too-thick', {})\n return null\n}\n\n/**\n * A slot layout refused (ADR-0118): the anchor, slot or value it was refused for. The layout's own findings are named\n * by where they are; the editor checks them before Apply, so they rarely reach here.\n */\nexport function slotLayoutRefusalOf(error: unknown, say: Say): string | null {\n if (detailsOf(error, 'slot-layout-label-missing')) return say('figure.text.slot-layout-label-missing', {})\n if (detailsOf(error, 'slot-anchors-missing')) return say('figure.text.slot-anchors-missing', {})\n const twice = detailsOf(error, 'slot-anchor-duplicate')\n if (twice) return say('figure.text.slot-anchor-duplicate', { anchor: twice.anchor })\n const flat = detailsOf(error, 'slot-anchor-not-flat')\n if (flat) return say('figure.text.slot-anchor-not-flat', { anchor: flat.anchor, part: flat.part })\n const gone = detailsOf(error, 'slot-anchor-no-part')\n if (gone) return say('figure.text.slot-anchor-no-part', { anchor: gone.anchor, part: gone.part })\n const issues = detailsOf(error, 'slot-layout-issues')\n if (issues) return say('figure.text.slot-layout-issues', { path: issues.issues[0]?.path ?? '' })\n const empty = detailsOf(error, 'slot-accepts-empty')\n if (empty) return say('figure.text.slot-accepts-empty', { slot: empty.slot })\n const taken = detailsOf(error, 'slot-id-taken')\n if (taken) return say('figure.text.slot-id-taken', { slot: taken.slot })\n return null\n}\n\n/** The figure's limits: its nodes, its size saved, how deep it nests. */\nfunction documentLimitRefusalOf(error: unknown, say: Say): string | null {\n if (codeOf(error) !== 'DOCUMENT_LIMIT') return null\n const nodes = detailsOf(error, 'node-limit')\n if (nodes) return say('figure.text.edit-refused-node-limit', { max: String(nodes.max) })\n const large = detailsOf(error, 'document-too-large')\n if (large)\n return large.at === undefined\n ? say('figure.text.document-too-large-unmeasured', { max: kibOf(large.max) })\n : say('figure.text.document-too-large', { max: kibOf(large.max), at: kibOf(large.at) })\n const deep = detailsOf(error, 'nesting-too-deep')\n if (deep) return say('figure.text.document-nesting-too-deep', { max: String(deep.max), at: String(deep.at) })\n return null\n}\n\n/**\n * A refusal in the author's words when the screen has words for it, otherwise said as a refusal with its code -- never\n * the kernel's English on the screen (the duplicate of a row's part showed 「EDIT_TARGET: … not a repeated template」,\n * 2026-09-27).\n */\n/** The modeller session's own refusals (`product-session.ts`), by their code. Nothing for any other refusal. */\nconst SESSION_REFUSALS: Record<string, string> = {\n SESSION_NOT_OPEN: 'figure.text.session-not-open',\n SESSION_SAVING: 'figure.text.session-saving',\n SESSION_VERSION_MISSING: 'figure.text.session-version-missing',\n SESSION_NEW_FIGURE_TOUCHED: 'figure.text.session-new-figure-touched',\n SESSION_PROPOSAL_KEY: 'figure.text.session-proposal-key'\n}\nexport function sessionRefusalOf(error: unknown, say: Say): string | null {\n const key = SESSION_REFUSALS[codeOf(error) ?? '']\n return key ? say(key, {}) : null\n}\n\nexport function editRefusalOf(error: unknown, say: Say): string {\n return (\n sessionRefusalOf(error, say) ??\n sizeRangeRefusalOf(error, say) ??\n inputRangeRefusalOf(error, say) ??\n repeatPitchRefusalOf(error, say) ??\n rowLimitRefusalOf(error, say) ??\n placementRefusalOf(error, say) ??\n partNameRefusalOf(error, say) ??\n documentLimitRefusalOf(error, say) ??\n sectionRefusalOf(error, say) ??\n slotLayoutRefusalOf(error, say) ??\n dataMotionRefusalOf(error, say) ??\n say('figure.text.edit-refused', { code: codeOf(error) ?? '' })\n )\n}\n\n/**\n * A data field, a binding, a status port, a motion group or a clip's tracks refused (ADR-0051 §8, §3.2), said with the ids\n * and numbers the kernel gave. Nothing for any other refusal.\n */\nexport function dataMotionRefusalOf(error: unknown, say: Say): string | null {\n const invalidId = detailsOf(error, 'data-id-invalid')\n if (invalidId) return say('figure.text.data-id-invalid', { id: invalidId.id })\n const twice = detailsOf(error, 'data-id-duplicate')\n if (twice) return say('figure.text.data-id-duplicate', { id: twice.id })\n const field = detailsOf(error, 'data-field-invalid')\n if (field) return say('figure.text.data-field-invalid-' + field.what, {})\n const fieldTwice = detailsOf(error, 'data-field-duplicate')\n if (fieldTwice) return say('figure.text.data-field-duplicate', { name: fieldTwice.name })\n const accessor = detailsOf(error, 'data-accessor-invalid')\n if (accessor) return say('figure.text.data-accessor-invalid-' + accessor.why, { accessor: accessor.accessor })\n const behavior = detailsOf(error, 'data-behavior-absent')\n if (behavior) return say('figure.text.data-behavior-absent-' + behavior.behavior, { id: behavior.id })\n const writers = detailsOf(error, 'data-behavior-duplicate')\n if (writers) return say('figure.text.data-behavior-duplicate', { a: writers.bindings[0], b: writers.bindings[1], id: writers.id })\n const domain = detailsOf(error, 'data-rule-domain')\n if (domain)\n return say('figure.text.data-rule-' + domain.why, {\n from: domain.from ?? '',\n to: domain.to ?? '',\n min: domain.min === undefined ? '' : numberOf(domain.min),\n max: domain.max === undefined ? '' : numberOf(domain.max),\n low: domain.within ? numberOf(domain.within[0]) : '',\n high: domain.within ? numberOf(domain.within[1]) : '',\n value: domain.value === undefined ? '' : String(domain.value)\n })\n const port = detailsOf(error, 'data-port-invalid')\n if (port) return say('figure.text.data-port-invalid-' + port.what, { port: port.port, id: port.id ?? '' })\n const bound = detailsOf(error, 'data-port-bound')\n if (bound) return say('figure.text.data-port-bound', { port: bound.port, bindings: bound.bindings.join(', ') })\n const clipAbsent = detailsOf(error, 'motion-clip-absent')\n if (clipAbsent) return say('figure.text.motion-clip-absent', { clip: clipAbsent.clip, group: clipAbsent.group })\n const shared = detailsOf(error, 'motion-clip-shared')\n if (shared) return say('figure.text.motion-clip-shared', { clip: shared.clip, group: shared.groups[0] })\n const many = detailsOf(error, 'driver-writers')\n if (many) return say('figure.text.driver-writers', { state: many.state, clips: many.clips.join(', ') })\n const which = detailsOf(error, 'driver-clip-required')\n if (which) return say('figure.text.driver-clip-required', { state: which.state, clips: which.clips.join(', ') })\n const setting = detailsOf(error, 'motion-setting')\n if (setting) return say('figure.text.motion-setting-' + setting.why, { group: setting.group, clip: setting.clip ?? '' })\n const key = codeOf(error) === 'MOTION_GROUP' ? detailsOf(error, 'value-outside-range') : undefined\n if (key) return say('figure.text.motion-key-outside-range', { input: key.input, value: numberOf(key.value), min: numberOf(key.min!), max: numberOf(key.max!) })\n return null\n}\n\n/**\n * A value outside the range its input declares, with the range and the value given. The figure's own size is named by\n * its axis; any other input by its range only.\n */\nexport function inputRangeRefusalOf(error: unknown, say: Say): string | null {\n if (codeOf(error) !== 'INPUT_RANGE') return null\n const range = detailsOf(error, 'value-outside-range')\n if (!range) return null\n const axis = (Object.entries(FIGURE_INSTANCE_SIZE_INPUTS) as Array<[string, string]>).find(([, id]) => id === range.input)?.[0]\n const params = { value: numberOf(range.value), min: range.min === undefined ? '−∞' : numberOf(range.min), max: range.max === undefined ? '∞' : numberOf(range.max) }\n return axis ? say('figure.text.input-range-size', { ...params, axis: axis.toUpperCase() }) : say('figure.text.input-range', params)\n}\n\n/**\n * A row past its limits: a pitch so fine it would hold more copies than a row takes, a row that would expand to more\n * bodies than a figure draws, a number of copies outside what a row may have or more than its length holds apart, a\n * row inside a row along the same axis, or a part whose face something holds made into a row.\n */\nexport function rowLimitRefusalOf(error: unknown, say: Say): string | null {\n const copies = detailsOf(error, 'copies-over-limit')\n if (copies) return say('figure.text.row-copies-over-limit', { count: copies.count.toLocaleString(), limit: copies.limit.toLocaleString() })\n const bodies = detailsOf(error, 'geometry-over-limit')\n if (bodies) return say('figure.text.row-geometry-over-limit', { count: bodies.count.toLocaleString(), limit: bodies.limit.toLocaleString() })\n const count = detailsOf(error, 'row-copies-out-of-range')\n if (count) return say('figure.text.row-copies-out-of-range', { count: count.count.toLocaleString(), min: String(count.min), max: String(count.max) })\n const fit = detailsOf(error, 'row-does-not-fit')\n if (fit) return say('figure.text.row-does-not-fit', { count: fit.count.toLocaleString(), length: mmOf(fit.length), extent: mmOf(fit.extent) })\n const axis = detailsOf(error, 'row-same-axis')\n if (axis) return say('figure.text.row-same-axis', { part: axis.part, outer: axis.outer, axis: axis.axis.toUpperCase() })\n const held = detailsOf(error, 'surface-on-row')\n if (held) return say(`figure.text.row-face-held-${heldByOf(held.at)}`, { part: held.part })\n return null\n}\n\n/* What holds a face, from the contract path the kernel names it by: the slot layout, a place, the footprint. */\nconst heldByOf = (at: string) => (at.startsWith('slotLayout') ? 'slot-layout' : at.startsWith('bindings') ? 'place' : at.startsWith('occupancy') ? 'footprint' : 'other')\n\n/** A row's pitch under which the figure, at the length it is authored, would hold more copies than a row takes. */\nexport function repeatPitchRefusalOf(error: unknown, say: Say): string | null {\n if (codeOf(error) !== 'INPUT_RANGE') return null\n const pitch = detailsOf(error, 'pitch-too-many-copies')\n if (!pitch) return null\n return say('figure.text.repeat-pitch-too-small', { length: pitch.length.toLocaleString(), min: String(pitch.least), limit: String(pitch.limit) })\n}\n\n/**\n * Why \"follow the size and keep where the figure is placed\" was not applied, in the author's words (ADR-0097): the plan\n * says what it would have had to overwrite, and for a part through the plane how far. A code the screen has no words\n * for is said as a refusal with its code, never in the kernel's English.\n */\nexport function resizeRefusalOf(plan: { mode: string; refusal?: { code: string; axis?: string; mm?: number } }, part: string, say: Say): string {\n const refusal = plan.refusal\n if (!refusal) return ''\n const place = say(`figure.label.resize-place-${plan.mode}`, {})\n const params = { part, place, axis: (refusal.axis ?? '').toUpperCase(), mm: refusal.mm === undefined ? '' : String(Math.round(refusal.mm)) }\n const known = ['HELD', 'TURNED', 'UNIFORM_POLICY', 'SHAPE_EDIT', 'DIMENSION_RULE', 'POSITION_RULE', 'GAP_CHOICE', 'NO_FACE']\n if (known.includes(refusal.code)) return say(`figure.text.resize-refused-${refusal.code.toLowerCase().replace(/_/g, '-')}`, params)\n return say('figure.text.edit-refused', { code: refusal.code })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"refusals.js","sourceRoot":"","sources":["../../client/modeller/refusals.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,2BAA2B,EAA2E,MAAM,wBAAwB,CAAA;AAK7I,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,EA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H,MAAM,UAAU,eAAe,CAAC,IAA8E,EAAE,IAAY,EAAE,GAAQ;IACpI,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;IAC5B,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAA;IACvB,MAAM,KAAK,GAAG,GAAG,CAAC,6BAA6B,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAA;IAC/D,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAA;IAC5I,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,CAAC,CAAA;IAC5H,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,GAAG,CAAC,8BAA8B,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IACnI,OAAO,GAAG,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;AAChE,CAAC","sourcesContent":["/*\n * A command figure-model refused, in the author's words with the numbers and where to put it right -- not the kernel's\n * English (user, 2026-09-24: 「what is this warning message means?」). Kept apart from the element so it is tested\n * without a browser.\n *\n * Every sentence here is made from the refusal's `code` and `details` (ADR-0127), never from its message: the kernel's\n * English is for logs and readers of the kernel, and a screen that read it went quiet whenever a sentence changed or a\n * new one came under the same code (ADR-0054). A refusal with no details the screen knows is said with its code.\n */\nimport { FIGURE_INSTANCE_SIZE_INPUTS, type FigureClipLoss, type FigureRefusalDetails, type FigureSizeRangeFit } from '@hatiolab/figure-model'\n\ntype Say = (key: string, params: Record<string, string>) => string\ntype Reason = FigureRefusalDetails['reason']\n\nconst codeOf = (error: unknown) => (error as { code?: string } | null | undefined)?.code\n/** The refusal's details when they are of this reason, or nothing. */\nfunction detailsOf<R extends Reason>(error: unknown, reason: R): Extract<FigureRefusalDetails, { reason: R }> | undefined {\n const details = (error as { details?: FigureRefusalDetails } | null | undefined)?.details\n return details?.reason === reason ? (details as Extract<FigureRefusalDetails, { reason: R }>) : undefined\n}\nconst mmOf = (mm: number) => mm.toLocaleString(undefined, { maximumFractionDigits: 1 })\nconst numberOf = (value: number) => value.toLocaleString(undefined, { maximumFractionDigits: 3 })\n/** Bytes in KiB, rounded up: a figure a few bytes over its limit is not said to be at it. */\nconst kibOf = (bytes: number) => Math.ceil(bytes / 1024).toLocaleString()\n\n/**\n * The ends an author typed for the size on a drawing, refused: they leave out the size the figure is drawn at, or start\n * at zero. The only refusals the size range has left (ADR-0087 decision 6); nothing for any other refusal.\n */\nexport function sizeRangeRefusalOf(error: unknown, say: Say): string | null {\n if (codeOf(error) !== 'INSTANCE_SIZE_RANGE') return null\n const outside = detailsOf(error, 'size-outside-range')\n if (outside)\n return say('figure.text.size-range-leaves-out-size', {\n axis: say(`figure.label.resize-${outside.axis}`, {}),\n range: `${mmOf(outside.min ?? 0)} – ${outside.max === undefined ? '∞' : mmOf(outside.max)}`,\n at: mmOf(outside.at)\n })\n const zero = detailsOf(error, 'size-min-not-positive')\n if (zero) return say('figure.text.size-range-from-zero', { axis: say(`figure.label.resize-${zero.axis}`, {}) })\n return null\n}\n\n/** What a command did to the ends the author typed, in one line each: what moved, from what to what. */\nexport function sizeRangeFitsOf(fits: readonly FigureSizeRangeFit[], say: Say): string {\n return fits\n .map(f => say(`figure.text.size-range-moved-${f.bound}`, { axis: say(`figure.label.resize-${f.axis}`, {}), from: mmOf(f.from), to: mmOf(f.to) }))\n .join(' ')\n}\n\n/**\n * A placement refused because a part is fastened to the mounting plane in a way the new plane does not take (standing\n * on the floor, when the figure is to hang on a wall), said in the author's words with the parts it names.\n */\nexport function placementRefusalOf(error: unknown, say: Say): string | null {\n if (codeOf(error) !== 'PLACEMENT_PLANE') return null\n const misfit = detailsOf(error, 'placement-face')\n if (!misfit) return null\n return say('figure.text.placement-plane-refused', { parts: misfit.parts.map(p => p.part).join(', ') })\n}\n\n/** A refusal carried on in a record (an AI proposal's outcome) in figure-model's own shape: its code and details. */\nexport interface FigureRefusalRecord {\n code?: string\n details?: FigureRefusalDetails\n}\n\n/** The record of a refusal: figure-model's code and details, copied as they are. */\nexport function refusalRecordOf(error: unknown): FigureRefusalRecord {\n const { details } = (error ?? {}) as FigureRefusalRecord\n return { code: codeOf(error), ...(details ? { details } : {}) }\n}\n\n/** The clips an edit would stop, as figure-model named them (CLIPS_DROPPED) -- the person is asked before any go; nothing for any other refusal. */\nexport function clipLossOf(error: unknown): FigureClipLoss[] | null {\n return codeOf(error) === 'CLIPS_DROPPED' ? (detailsOf(error, 'clips-dropped')?.clips ?? []) : null\n}\n\n/**\n * Why a part cannot be deleted, in the author's words. Since the chief architect's ruling of 2026-09-27 a part that\n * holds others, leads a motion or is followed goes, and what depended on it is let go of (`removalNoticeOf`); what is\n * left is a row -- one laid along the part, or hanging in its row.\n */\nexport function partRefusalOf(error: unknown, part: string, say: Say): string | null {\n const code = codeOf(error)\n if (code !== 'PART_REFERENCED' && code !== 'PART_ROW') return null\n const along = detailsOf(error, 'row-along')\n if (along) return say('figure.text.part-row-along', { part, rows: along.rows.join(', ') })\n const carried = detailsOf(error, 'hangs-in-row')\n if (carried) return say('figure.text.part-row-carries', { part, others: carried.parts.join(', ') })\n return say('figure.text.part-is-referenced', { part })\n}\n\n/** A part the gizmo cannot move because a joint or a fastening places it, named as the author knows it (`part`). */\nexport function placedRefusalOf(error: unknown, part: string, say: Say): string | null {\n if (codeOf(error) !== 'EDIT_TARGET') return null\n if (detailsOf(error, 'placed-by-joint')) return say('figure.text.gizmo-joint-places', { part })\n if (detailsOf(error, 'placed-by-fastening')) return say('figure.text.gizmo-fastening-places', { part })\n return null\n}\n\n/** A part name refused: not a name, already used, or another part is named under the part. The rule is the kernel's. */\nexport function partNameRefusalOf(error: unknown, say: Say): string | null {\n /* A new part named as one already is: the same sentence as a part renamed so. */\n const takenId = detailsOf(error, 'part-id-taken')\n if (takenId) return say('figure.text.part-name-taken', { name: takenId.part })\n if (codeOf(error) !== 'PART_ID') return null\n const invalid = detailsOf(error, 'name-invalid')\n if (invalid) return say('figure.text.part-name-invalid', { name: invalid.name })\n const taken = detailsOf(error, 'name-taken')\n if (taken) return say('figure.text.part-name-taken', { name: taken.name })\n const nested = detailsOf(error, 'name-has-nested')\n if (nested) return say('figure.text.part-name-has-nested', { nested: nested.nested })\n return null\n}\n\n/** What removing a part let go of (figure-model's `RemovalNotice`), said in one line, or nothing when it let go of nothing. */\nexport function removalNoticeOf(\n notice:\n | {\n released: Array<{ part: string; control?: string }>\n fixed: Array<{ part: string }>\n controls: Array<{ part: string; control: string; min: number; max: number }>\n mountingFace?: boolean\n bindings?: Array<{ id: string; label?: string }>\n }\n | undefined,\n say: Say\n): string | null {\n if (!notice) return null\n const lines: string[] = []\n const still = notice.released.filter(r => !r.control).map(r => r.part)\n if (still.length) lines.push(say('figure.text.removal-released', { parts: still.join(', ') }))\n for (const r of notice.released.filter(r => r.control)) lines.push(say('figure.text.removal-released-motion', { part: r.part, control: r.control! }))\n for (const c of notice.controls) lines.push(say('figure.text.removal-own-control', { part: c.part, control: c.control, min: numberOf(c.min), max: numberOf(c.max) }))\n const fixed = [...new Set(notice.fixed.map(f => f.part))]\n if (fixed.length) lines.push(say('figure.text.removal-fixed', { parts: fixed.join(', ') }))\n if (notice.bindings?.length) lines.push(say('figure.text.removal-bindings', { places: notice.bindings.map(b => b.label ?? b.id).join(', ') }))\n if (notice.mountingFace) lines.push(say('figure.text.removal-mounting-face', {}))\n return lines.length ? lines.join(' ') : null\n}\n\n/**\n * A recipe refused at one of its steps: which step, and why -- the particular sentence when there is one (a size\n * range, a value's range, a placement), otherwise the kernel's code. The step is the refusal's path, `steps[2]`: the\n * contract's path grammar, not its English (ADR-0127 decision 6).\n */\nexport function recipeRefusalOf(error: unknown, say: Say): string | null {\n const step = /^steps\\[(\\d+)\\]$/.exec((error as { path?: string })?.path ?? '')\n if (!step) return null\n const why = sizeRangeRefusalOf(error, say) ?? inputRangeRefusalOf(error, say) ?? placementRefusalOf(error, say)\n return say('figure.text.recipe-step-refused', { step: String(Number(step[1]) + 1), why: why ?? '', code: codeOf(error) ?? '' })\n}\n\n/**\n * A corner or an inside the part cannot take (ADR-0100 stage 1): what was too large or too thick, or what holds on\n * to what the edit would take away.\n */\nfunction sectionRefusalOf(error: unknown, say: Say): string | null {\n const mapping = detailsOf(error, 'faces-taken-away')\n if (mapping) return say('figure.text.section-face-in-use', { faces: mapping.lost.map(l => say('figure.label.face-' + l.face, {})).join(', ') })\n if (codeOf(error) === 'DIMENSION_LINKED') return say('figure.text.section-dimension-linked', {})\n if (detailsOf(error, 'section-invalid')?.issues.some(i => i.code === 'CORNER_TOO_LARGE')) return say('figure.text.section-corner-too-large', {})\n const inside = detailsOf(error, 'inside-invalid')?.refusal\n if (inside?.code === 'CAVITY' && inside.refused === 'NO_ROOM_INSIDE') return say('figure.text.section-wall-too-thick', {})\n if (inside?.code === 'CAVITY_NO_LENGTH') return say('figure.text.section-ends-too-thick', {})\n return null\n}\n\n/**\n * A slot layout refused (ADR-0118): the anchor, slot or value it was refused for. The layout's own findings are named\n * by where they are; the editor checks them before Apply, so they rarely reach here.\n */\nexport function slotLayoutRefusalOf(error: unknown, say: Say): string | null {\n if (detailsOf(error, 'slot-layout-label-missing')) return say('figure.text.slot-layout-label-missing', {})\n if (detailsOf(error, 'slot-anchors-missing')) return say('figure.text.slot-anchors-missing', {})\n const twice = detailsOf(error, 'slot-anchor-duplicate')\n if (twice) return say('figure.text.slot-anchor-duplicate', { anchor: twice.anchor })\n const flat = detailsOf(error, 'slot-anchor-not-flat')\n if (flat) return say('figure.text.slot-anchor-not-flat', { anchor: flat.anchor, part: flat.part })\n const gone = detailsOf(error, 'slot-anchor-no-part')\n if (gone) return say('figure.text.slot-anchor-no-part', { anchor: gone.anchor, part: gone.part })\n const issues = detailsOf(error, 'slot-layout-issues')\n if (issues) return say('figure.text.slot-layout-issues', { path: issues.issues[0]?.path ?? '' })\n const empty = detailsOf(error, 'slot-accepts-empty')\n if (empty) return say('figure.text.slot-accepts-empty', { slot: empty.slot })\n const taken = detailsOf(error, 'slot-id-taken')\n if (taken) return say('figure.text.slot-id-taken', { slot: taken.slot })\n return null\n}\n\n/** The figure's limits: its nodes, its size saved, how deep it nests. */\nfunction documentLimitRefusalOf(error: unknown, say: Say): string | null {\n if (codeOf(error) !== 'DOCUMENT_LIMIT') return null\n const nodes = detailsOf(error, 'node-limit')\n if (nodes) return say('figure.text.edit-refused-node-limit', { max: String(nodes.max) })\n const large = detailsOf(error, 'document-too-large')\n if (large)\n return large.at === undefined\n ? say('figure.text.document-too-large-unmeasured', { max: kibOf(large.max) })\n : say('figure.text.document-too-large', { max: kibOf(large.max), at: kibOf(large.at) })\n const deep = detailsOf(error, 'nesting-too-deep')\n if (deep) return say('figure.text.document-nesting-too-deep', { max: String(deep.max), at: String(deep.at) })\n return null\n}\n\n/**\n * A refusal in the author's words when the screen has words for it, otherwise said as a refusal with its code -- never\n * the kernel's English on the screen (the duplicate of a row's part showed 「EDIT_TARGET: … not a repeated template」,\n * 2026-09-27).\n */\n/** The modeller session's own refusals (`product-session.ts`), by their code. Nothing for any other refusal. */\nconst SESSION_REFUSALS: Record<string, string> = {\n SESSION_NOT_OPEN: 'figure.text.session-not-open',\n SESSION_SAVING: 'figure.text.session-saving',\n SESSION_VERSION_MISSING: 'figure.text.session-version-missing',\n SESSION_NEW_FIGURE_TOUCHED: 'figure.text.session-new-figure-touched',\n SESSION_PROPOSAL_KEY: 'figure.text.session-proposal-key'\n}\nexport function sessionRefusalOf(error: unknown, say: Say): string | null {\n const key = SESSION_REFUSALS[codeOf(error) ?? '']\n return key ? say(key, {}) : null\n}\n\nexport function editRefusalOf(error: unknown, say: Say): string {\n return (\n sessionRefusalOf(error, say) ??\n sizeRangeRefusalOf(error, say) ??\n inputRangeRefusalOf(error, say) ??\n repeatPitchRefusalOf(error, say) ??\n rowLimitRefusalOf(error, say) ??\n placementRefusalOf(error, say) ??\n partNameRefusalOf(error, say) ??\n documentLimitRefusalOf(error, say) ??\n sectionRefusalOf(error, say) ??\n slotLayoutRefusalOf(error, say) ??\n dataMotionRefusalOf(error, say) ??\n say('figure.text.edit-refused', { code: codeOf(error) ?? '' })\n )\n}\n\n/**\n * A data field, a binding, a status port, a motion group or a clip's tracks refused (ADR-0051 §8, §3.2), said with the ids\n * and numbers the kernel gave. Nothing for any other refusal.\n */\nexport function dataMotionRefusalOf(error: unknown, say: Say): string | null {\n const invalidId = detailsOf(error, 'data-id-invalid')\n if (invalidId) return say('figure.text.data-id-invalid', { id: invalidId.id })\n const twice = detailsOf(error, 'data-id-duplicate')\n if (twice) return say('figure.text.data-id-duplicate', { id: twice.id })\n const field = detailsOf(error, 'data-field-invalid')\n if (field) return say('figure.text.data-field-invalid-' + field.what, {})\n const fieldTwice = detailsOf(error, 'data-field-duplicate')\n if (fieldTwice) return say('figure.text.data-field-duplicate', { name: fieldTwice.name })\n const accessor = detailsOf(error, 'data-accessor-invalid')\n if (accessor) return say('figure.text.data-accessor-invalid-' + accessor.why, { accessor: accessor.accessor })\n const behavior = detailsOf(error, 'data-behavior-absent')\n if (behavior) return say('figure.text.data-behavior-absent-' + behavior.behavior, { id: behavior.id })\n const writers = detailsOf(error, 'data-behavior-duplicate')\n if (writers) return say('figure.text.data-behavior-duplicate', { a: writers.bindings[0], b: writers.bindings[1], id: writers.id })\n const domain = detailsOf(error, 'data-rule-domain')\n if (domain)\n return say('figure.text.data-rule-' + domain.why, {\n from: domain.from ?? '',\n to: domain.to ?? '',\n min: domain.min === undefined ? '' : numberOf(domain.min),\n max: domain.max === undefined ? '' : numberOf(domain.max),\n low: domain.within ? numberOf(domain.within[0]) : '',\n high: domain.within ? numberOf(domain.within[1]) : '',\n value: domain.value === undefined ? '' : String(domain.value)\n })\n const target = detailsOf(error, 'data-table-target')\n if (target) return say('figure.text.data-table-target-' + target.what, { binding: target.binding, id: target.id ?? '' })\n const entry = detailsOf(error, 'data-table-entry')\n if (entry)\n return say('figure.text.data-table-entry-' + entry.what, {\n binding: entry.binding,\n key: entry.key === 'default' ? say('figure.label.data-otherwise', {}) : entry.key,\n id: entry.id ?? '',\n value: entry.value === undefined ? '' : String(typeof entry.value === 'object' ? JSON.stringify(entry.value) : entry.value)\n })\n const legend = detailsOf(error, 'data-legend-invalid')\n if (legend) return say('figure.text.data-legend-invalid', { role: legend.role })\n const clipAbsent = detailsOf(error, 'motion-clip-absent')\n if (clipAbsent) return say('figure.text.motion-clip-absent', { clip: clipAbsent.clip, group: clipAbsent.group })\n const shared = detailsOf(error, 'motion-clip-shared')\n if (shared) return say('figure.text.motion-clip-shared', { clip: shared.clip, group: shared.groups[0] })\n const many = detailsOf(error, 'driver-writers')\n if (many) return say('figure.text.driver-writers', { state: many.state, clips: many.clips.join(', ') })\n const which = detailsOf(error, 'driver-clip-required')\n if (which) return say('figure.text.driver-clip-required', { state: which.state, clips: which.clips.join(', ') })\n const setting = detailsOf(error, 'motion-setting')\n if (setting) return say('figure.text.motion-setting-' + setting.why, { group: setting.group, clip: setting.clip ?? '' })\n const key = codeOf(error) === 'MOTION_GROUP' ? detailsOf(error, 'value-outside-range') : undefined\n if (key) return say('figure.text.motion-key-outside-range', { input: key.input, value: numberOf(key.value), min: numberOf(key.min!), max: numberOf(key.max!) })\n return null\n}\n\n/**\n * A value outside the range its input declares, with the range and the value given. The figure's own size is named by\n * its axis; any other input by its range only.\n */\nexport function inputRangeRefusalOf(error: unknown, say: Say): string | null {\n if (codeOf(error) !== 'INPUT_RANGE') return null\n const range = detailsOf(error, 'value-outside-range')\n if (!range) return null\n const axis = (Object.entries(FIGURE_INSTANCE_SIZE_INPUTS) as Array<[string, string]>).find(([, id]) => id === range.input)?.[0]\n const params = { value: numberOf(range.value), min: range.min === undefined ? '−∞' : numberOf(range.min), max: range.max === undefined ? '∞' : numberOf(range.max) }\n return axis ? say('figure.text.input-range-size', { ...params, axis: axis.toUpperCase() }) : say('figure.text.input-range', params)\n}\n\n/**\n * A row past its limits: a pitch so fine it would hold more copies than a row takes, a row that would expand to more\n * bodies than a figure draws, a number of copies outside what a row may have or more than its length holds apart, a\n * row inside a row along the same axis, or a part whose face something holds made into a row.\n */\nexport function rowLimitRefusalOf(error: unknown, say: Say): string | null {\n const copies = detailsOf(error, 'copies-over-limit')\n if (copies) return say('figure.text.row-copies-over-limit', { count: copies.count.toLocaleString(), limit: copies.limit.toLocaleString() })\n const bodies = detailsOf(error, 'geometry-over-limit')\n if (bodies) return say('figure.text.row-geometry-over-limit', { count: bodies.count.toLocaleString(), limit: bodies.limit.toLocaleString() })\n const count = detailsOf(error, 'row-copies-out-of-range')\n if (count) return say('figure.text.row-copies-out-of-range', { count: count.count.toLocaleString(), min: String(count.min), max: String(count.max) })\n const fit = detailsOf(error, 'row-does-not-fit')\n if (fit) return say('figure.text.row-does-not-fit', { count: fit.count.toLocaleString(), length: mmOf(fit.length), extent: mmOf(fit.extent) })\n const axis = detailsOf(error, 'row-same-axis')\n if (axis) return say('figure.text.row-same-axis', { part: axis.part, outer: axis.outer, axis: axis.axis.toUpperCase() })\n const held = detailsOf(error, 'surface-on-row')\n if (held) return say(`figure.text.row-face-held-${heldByOf(held.at)}`, { part: held.part })\n return null\n}\n\n/* What holds a face, from the contract path the kernel names it by: the slot layout, a place, the footprint. */\nconst heldByOf = (at: string) => (at.startsWith('slotLayout') ? 'slot-layout' : at.startsWith('bindings') ? 'place' : at.startsWith('occupancy') ? 'footprint' : 'other')\n\n/** A row's pitch under which the figure, at the length it is authored, would hold more copies than a row takes. */\nexport function repeatPitchRefusalOf(error: unknown, say: Say): string | null {\n if (codeOf(error) !== 'INPUT_RANGE') return null\n const pitch = detailsOf(error, 'pitch-too-many-copies')\n if (!pitch) return null\n return say('figure.text.repeat-pitch-too-small', { length: pitch.length.toLocaleString(), min: String(pitch.least), limit: String(pitch.limit) })\n}\n\n/**\n * Why \"follow the size and keep where the figure is placed\" was not applied, in the author's words (ADR-0097): the plan\n * says what it would have had to overwrite, and for a part through the plane how far. A code the screen has no words\n * for is said as a refusal with its code, never in the kernel's English.\n */\nexport function resizeRefusalOf(plan: { mode: string; refusal?: { code: string; axis?: string; mm?: number } }, part: string, say: Say): string {\n const refusal = plan.refusal\n if (!refusal) return ''\n const place = say(`figure.label.resize-place-${plan.mode}`, {})\n const params = { part, place, axis: (refusal.axis ?? '').toUpperCase(), mm: refusal.mm === undefined ? '' : String(Math.round(refusal.mm)) }\n const known = ['HELD', 'TURNED', 'UNIFORM_POLICY', 'SHAPE_EDIT', 'DIMENSION_RULE', 'POSITION_RULE', 'GAP_CHOICE', 'NO_FACE']\n if (known.includes(refusal.code)) return say(`figure.text.resize-refused-${refusal.code.toLowerCase().replace(/_/g, '-')}`, params)\n return say('figure.text.edit-refused', { code: refusal.code })\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FigureAsset, type SlotLayout, type SlotPresetSize } from '@hatiolab/figure-model';
|
|
1
|
+
import { figureShapeBoundsOf, type FigureAsset, type SlotLayout, type SlotPresetSize } from '@hatiolab/figure-model';
|
|
2
2
|
import type { FigureRenderPart } from './renderer.js';
|
|
3
3
|
export type SlotAnchorFace = 'top' | 'bottom';
|
|
4
4
|
export interface SlotAnchor {
|
|
@@ -23,8 +23,17 @@ export declare function slotLayoutFormOf(asset: FigureAsset, part: string): {
|
|
|
23
23
|
form: SlotLayoutForm;
|
|
24
24
|
layout?: SlotLayout;
|
|
25
25
|
};
|
|
26
|
-
/** How big each anchor's face is: things-scene's, the
|
|
27
|
-
export { figureAnchorFacesOf as anchorFacesOf } from '@hatiolab/things-scene';
|
|
26
|
+
/** How big each anchor's face is, and the room the figure leaves over it: things-scene's, the ones a board's placed figure is measured with too. */
|
|
27
|
+
export { figureAnchorFacesOf as anchorFacesOf, figureAnchorRoomOf as anchorRoomOf } from '@hatiolab/things-scene';
|
|
28
|
+
/**
|
|
29
|
+
* Where an author starts with no numbers to type (slot layout drawn on the face, step 1): the first anchor's face, and a
|
|
30
|
+
* slot as high as the room the figure leaves over it (a forklift's forks: up to its mast) -- the face's shorter side when
|
|
31
|
+
* the face is the figure's top. Nothing when the face is not known: the editor then asks for the size.
|
|
32
|
+
*/
|
|
33
|
+
export declare function startSizeOf(anchors: readonly SlotAnchor[], faces: Record<string, {
|
|
34
|
+
width: number;
|
|
35
|
+
depth: number;
|
|
36
|
+
}>, room: Record<string, number>): Partial<SlotPresetSize>;
|
|
28
37
|
/**
|
|
29
38
|
* Where an author starts: the equipment presets (figure-model, ADR-0118 decision 8), laid out on this figure's anchors --
|
|
30
39
|
* a one-anchor preset on the first, a twin fork on the first two. A single slot stands on a top and hangs from a bottom.
|
|
@@ -54,6 +63,7 @@ export declare function slotLayoutCommandOf(form: SlotLayoutForm, layout: SlotLa
|
|
|
54
63
|
/** A new anchor's id: the part's, or the part's with a number when that is taken. */
|
|
55
64
|
export declare function anchorIdFor(part: string, taken: readonly string[]): string;
|
|
56
65
|
export declare const SLOT_MARK = "__slot";
|
|
66
|
+
export declare const SLOT_MARK_CHOSEN = "__slot_chosen";
|
|
57
67
|
type Evaluated = {
|
|
58
68
|
id: string;
|
|
59
69
|
pose: {
|
|
@@ -69,3 +79,18 @@ type Evaluated = {
|
|
|
69
79
|
* place -- or hanging from it, for a tier that hangs things -- so an author sees where every slot of the rule falls.
|
|
70
80
|
*/
|
|
71
81
|
export declare function slotMarksOf(places: readonly Evaluated[], layout: SlotLayout | undefined): FigureRenderPart[];
|
|
82
|
+
type Body = {
|
|
83
|
+
id: string;
|
|
84
|
+
shape?: Parameters<typeof figureShapeBoundsOf>[0];
|
|
85
|
+
pose?: {
|
|
86
|
+
r: number[][];
|
|
87
|
+
t: number[];
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* The places held one by one -- a forklift's fork, a lift's plate -- drawn where they are, as the slot layout's are: a
|
|
92
|
+
* place given a size as a box of that size out of its face, one without as its part's face raised as high as a slot
|
|
93
|
+
* would start there (the room over it, else the face's shorter side), so an author sees which face things sit on or
|
|
94
|
+
* hang from and about how much room they have. The selected part's places in the primary colour.
|
|
95
|
+
*/
|
|
96
|
+
export declare function placeMarksOf(places: readonly Evaluated[], asset: FigureAsset, geometry: readonly Body[], selected?: string): FigureRenderPart[];
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Kept free of Lit, i18n and the editor's element so node tests read it directly.
|
|
10
10
|
*/
|
|
11
|
-
import { figureSlotLayoutOf, figureSlotLayoutIssues, slotLayoutPreset, SLOT_LAYOUT_PRESET_KEYS, SLOT_LAYOUT_PRESET_PARAMS } from '@hatiolab/figure-model';
|
|
11
|
+
import { figureBindingsOf, figureShapeBoundsOf, figureSlotLayoutOf, figureSlotLayoutIssues, slotLayoutPreset, SLOT_LAYOUT_PRESET_KEYS, SLOT_LAYOUT_PRESET_PARAMS } from '@hatiolab/figure-model';
|
|
12
12
|
/** The figure's layout as the form and the layout, or a form to start one from on the selected part's top. */
|
|
13
13
|
export function slotLayoutFormOf(asset, part) {
|
|
14
14
|
const had = figureSlotLayoutOf(asset);
|
|
@@ -16,8 +16,23 @@ export function slotLayoutFormOf(asset, part) {
|
|
|
16
16
|
return { form: { label: had.label, role: had.role, anchors: had.anchors.map(a => ({ ...a, face: a.face })) }, layout: had.layout };
|
|
17
17
|
return { form: { label: '', role: 'seat', anchors: part ? [{ id: part, part, face: 'top' }] : [] } };
|
|
18
18
|
}
|
|
19
|
-
/** How big each anchor's face is: things-scene's, the
|
|
20
|
-
export { figureAnchorFacesOf as anchorFacesOf } from '@hatiolab/things-scene';
|
|
19
|
+
/** How big each anchor's face is, and the room the figure leaves over it: things-scene's, the ones a board's placed figure is measured with too. */
|
|
20
|
+
export { figureAnchorFacesOf as anchorFacesOf, figureAnchorRoomOf as anchorRoomOf } from '@hatiolab/things-scene';
|
|
21
|
+
import { figureAnchorRoomOf } from '@hatiolab/things-scene';
|
|
22
|
+
/* How high a place over a face is when nobody said: the room the figure leaves over it, else the face's shorter side. */
|
|
23
|
+
const heightOver = (room, width, depth) => ((room ?? 0) > 0 ? room : Math.min(width, depth));
|
|
24
|
+
/**
|
|
25
|
+
* Where an author starts with no numbers to type (slot layout drawn on the face, step 1): the first anchor's face, and a
|
|
26
|
+
* slot as high as the room the figure leaves over it (a forklift's forks: up to its mast) -- the face's shorter side when
|
|
27
|
+
* the face is the figure's top. Nothing when the face is not known: the editor then asks for the size.
|
|
28
|
+
*/
|
|
29
|
+
export function startSizeOf(anchors, faces, room) {
|
|
30
|
+
const first = anchors[0];
|
|
31
|
+
const face = first && faces[first.id];
|
|
32
|
+
if (!face)
|
|
33
|
+
return {};
|
|
34
|
+
return { width: face.width, depth: face.depth, slotHeight: heightOver(room[first.id], face.width, face.depth) };
|
|
35
|
+
}
|
|
21
36
|
/**
|
|
22
37
|
* Where an author starts: the equipment presets (figure-model, ADR-0118 decision 8), laid out on this figure's anchors --
|
|
23
38
|
* a one-anchor preset on the first, a twin fork on the first two. A single slot stands on a top and hangs from a bottom.
|
|
@@ -35,13 +50,13 @@ export function slotPresetsOf(anchors) {
|
|
|
35
50
|
}));
|
|
36
51
|
}
|
|
37
52
|
/*
|
|
38
|
-
* What figure-model asks beyond the editor's own checks:
|
|
39
|
-
*
|
|
53
|
+
* What figure-model asks beyond the editor's own checks: a slot names the types it takes or takes any item, never an
|
|
54
|
+
* empty list (ADR-0051 §4.1 decision 5, 2026-10-27). The kernel's own check (`figureSlotLayoutIssues`, the one a
|
|
40
55
|
* placement's override is held to as well), said before Apply rather than refused after it; the editor already shows the
|
|
41
56
|
* common findings, so only the figure's own are added.
|
|
42
57
|
*/
|
|
43
58
|
export function figureSlotIssues(layout, anchors = layout.tiers.map(t => t.anchorId)) {
|
|
44
|
-
return figureSlotLayoutIssues(layout, anchors).filter(issue => issue.code === '
|
|
59
|
+
return figureSlotLayoutIssues(layout, anchors).filter(issue => issue.code === 'ACCEPTS_EMPTY');
|
|
45
60
|
}
|
|
46
61
|
/** The command the panel sends: the whole layout, its anchors and its name, as one step of the history. */
|
|
47
62
|
export function slotLayoutCommandOf(form, layout, fallbackLabel) {
|
|
@@ -64,6 +79,8 @@ export function anchorIdFor(part, taken) {
|
|
|
64
79
|
}
|
|
65
80
|
/* The token the canvas draws slots in: translucent, never picked, never saved. */
|
|
66
81
|
export const SLOT_MARK = '__slot';
|
|
82
|
+
/* The token the selected part's places are drawn in: the same box, in the primary colour, so the list and the canvas meet. */
|
|
83
|
+
export const SLOT_MARK_CHOSEN = '__slot_chosen';
|
|
67
84
|
/**
|
|
68
85
|
* The unfolded slots as boxes the canvas draws (ADR-0118 decision 4): each as big as what it allows, standing on its
|
|
69
86
|
* place -- or hanging from it, for a tier that hangs things -- so an author sees where every slot of the rule falls.
|
|
@@ -92,4 +109,49 @@ export function slotMarksOf(places, layout) {
|
|
|
92
109
|
}
|
|
93
110
|
return marks;
|
|
94
111
|
}
|
|
112
|
+
/* Which way each face looks out of its part: the axis and the side. */
|
|
113
|
+
const OUTWARD = { top: ['y', 1], bottom: ['y', -1], right: ['x', 1], left: ['x', -1], front: ['z', 1], back: ['z', -1] };
|
|
114
|
+
/* The two axes a face lies along. */
|
|
115
|
+
const ACROSS = { x: ['y', 'z'], y: ['x', 'z'], z: ['x', 'y'] };
|
|
116
|
+
/**
|
|
117
|
+
* The places held one by one -- a forklift's fork, a lift's plate -- drawn where they are, as the slot layout's are: a
|
|
118
|
+
* place given a size as a box of that size out of its face, one without as its part's face raised as high as a slot
|
|
119
|
+
* would start there (the room over it, else the face's shorter side), so an author sees which face things sit on or
|
|
120
|
+
* hang from and about how much room they have. The selected part's places in the primary colour.
|
|
121
|
+
*/
|
|
122
|
+
export function placeMarksOf(places, asset, geometry, selected) {
|
|
123
|
+
const at = new Map(places.map(p => [p.id, p]));
|
|
124
|
+
const marks = [];
|
|
125
|
+
for (const one of figureBindingsOf(asset)) {
|
|
126
|
+
const p = at.get(one.id);
|
|
127
|
+
if (one.slot || !one.face || !p)
|
|
128
|
+
continue;
|
|
129
|
+
const [axis, side] = OUTWARD[one.face];
|
|
130
|
+
const [u, v] = ACROSS[axis];
|
|
131
|
+
let size;
|
|
132
|
+
if (one.region)
|
|
133
|
+
size = one.region;
|
|
134
|
+
else {
|
|
135
|
+
const shape = geometry.find(g => g.id === one.part)?.shape;
|
|
136
|
+
if (!shape)
|
|
137
|
+
continue;
|
|
138
|
+
const b = figureShapeBoundsOf(shape);
|
|
139
|
+
const face = { x: b.x.max - b.x.min, y: b.y.max - b.y.min, z: b.z.max - b.z.min };
|
|
140
|
+
const room = axis === 'y' ? figureAnchorRoomOf([{ id: one.id, part: one.part, face: one.face }], geometry)[one.id] : 0;
|
|
141
|
+
size = { ...face, [axis]: heightOver(room, face[u], face[v]) };
|
|
142
|
+
}
|
|
143
|
+
const out = size[axis];
|
|
144
|
+
marks.push({
|
|
145
|
+
id: `${SLOT_MARK}:${one.id}`,
|
|
146
|
+
shape: {
|
|
147
|
+
provider: 'extrude',
|
|
148
|
+
dimensions: { width: size.x, height: size.y, depth: size.z },
|
|
149
|
+
extrusion: { axis, section: { kind: 'rectangle', size: { [u]: size[u], [v]: size[v] } }, start: side > 0 ? 0 : -out, end: side > 0 ? out : 0 }
|
|
150
|
+
},
|
|
151
|
+
pose: p.pose,
|
|
152
|
+
material: { token: one.part === selected ? SLOT_MARK_CHOSEN : SLOT_MARK, transparent: true }
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return marks;
|
|
156
|
+
}
|
|
95
157
|
//# source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B,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;QACvC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM;YAAE,SAAQ;QAChC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,UAAsC,CAAA;QAC9E,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAA;QACpD,KAAK,CAAC,IAAI,CAAC;YACT,EAAE,EAAE,GAAG,SAAS,IAAI,CAAC,CAAC,EAAE,EAAE;YAC1B,KAAK,EAAE;gBACL,QAAQ,EAAE,SAAS;gBACnB,UAAU,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;gBACpC,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE;aAC1I;YACD,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,QAAQ,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE;SAClD,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["/*\n * What the Figure modeller gives the shared slot layout editor (`@operato/slot-layout-editor`, the one fmsim hosts too),\n * and what it makes of the editor's result (ADR-0118). The editor edits tiers and slots; the modeller owns the anchors\n * -- a part's top or bottom face, named -- and sends the whole layout as one `set-slot-layout` command.\n *\n * A figure's released slot layout is the only one there is (ADR-0118 decision 8, user): no scene or run overrides it, so\n * this host offers no \"use default\" and no per-instance value.\n *\n * Kept free of Lit, i18n and the editor's element so node tests read it directly.\n */\nimport {\n figureSlotLayoutOf,\n figureSlotLayoutIssues,\n slotLayoutPreset,\n SLOT_LAYOUT_PRESET_KEYS,\n SLOT_LAYOUT_PRESET_PARAMS,\n type FigureAsset,\n type SlotLayout,\n type SlotPresetSize\n} from '@hatiolab/figure-model'\nimport type { FigureRenderPart } from './renderer.js'\n\nexport type SlotAnchorFace = 'top' | 'bottom'\nexport interface SlotAnchor {\n id: string\n part: string\n face: SlotAnchorFace\n}\n/** What the panel edits besides the tiers: the layout's name, what its slots are, and the anchors they stand on. */\nexport interface SlotLayoutForm {\n label: string\n role: 'seat' | 'grip'\n anchors: SlotAnchor[]\n}\n/** A layout problem as the editor shows it: a code, where, and its values. */\nexport interface SlotEditorIssue {\n code: string\n path: string\n params?: Record<string, string | number>\n}\n\n/** The figure's layout as the form and the layout, or a form to start one from on the selected part's top. */\nexport function slotLayoutFormOf(asset: FigureAsset, part: string): { form: SlotLayoutForm; layout?: SlotLayout } {\n const had = figureSlotLayoutOf(asset as never)\n if (had) return { form: { label: had.label, role: had.role, anchors: had.anchors.map(a => ({ ...a, face: a.face as SlotAnchorFace })) }, layout: had.layout }\n return { form: { label: '', role: 'seat', anchors: part ? [{ id: part, part, face: 'top' }] : [] } }\n}\n\n/** How big each anchor's face is: things-scene's, the one a board's placed figure is measured with too. */\nexport { figureAnchorFacesOf as anchorFacesOf } from '@hatiolab/things-scene'\n\n/**\n * Where an author starts: the equipment presets (figure-model, ADR-0118 decision 8), laid out on this figure's anchors --\n * a one-anchor preset on the first, a twin fork on the first two. A single slot stands on a top and hangs from a bottom.\n * The editor's own controls then make it what the equipment is.\n */\nexport function slotPresetsOf(anchors: readonly SlotAnchor[]) {\n const first = anchors[0]\n const on = { ...(first ? { anchor: first.id } : {}), ...(anchors.length >= 2 ? { forks: [anchors[0]!.id, anchors[1]!.id] as [string, string] } : {}) }\n const mount = first?.face === 'bottom' ? ('HANG' as const) : ('ON' as const)\n return SLOT_LAYOUT_PRESET_KEYS.map(key => ({\n key,\n /* The editor names a preset and its values from their keys (@operato/slot-layout-editor's own words). */\n params: SLOT_LAYOUT_PRESET_PARAMS[key].map(p => ({ key: p.key, integer: p.integer })),\n build: (size: SlotPresetSize, params: Record<string, number>) => slotLayoutPreset(key, size, params, { ...on, mount })\n }))\n}\n\n/*\n * What figure-model asks beyond the editor's own checks: every slot names the types it takes (ADR-0118 decision 5) -- the\n * editor's \"any type\" is a board's, not a figure's. The kernel's own check (`figureSlotLayoutIssues`, the one a\n * placement's override is held to as well), said before Apply rather than refused after it; the editor already shows the\n * common findings, so only the figure's own are added.\n */\nexport function figureSlotIssues(layout: SlotLayout, anchors: readonly string[] = layout.tiers.map(t => t.anchorId)): SlotEditorIssue[] {\n return figureSlotLayoutIssues(layout, anchors).filter(issue => issue.code === 'ACCEPTS_REQUIRED')\n}\n\n/** The command the panel sends: the whole layout, its anchors and its name, as one step of the history. */\nexport function slotLayoutCommandOf(form: SlotLayoutForm, layout: SlotLayout, fallbackLabel: string) {\n return {\n kind: 'set-slot-layout' as const,\n label: form.label.trim() || fallbackLabel,\n role: form.role,\n anchors: form.anchors.map(a => ({ id: a.id.trim(), part: a.part, face: a.face })),\n layout: structuredClone(layout)\n }\n}\n\n/** A new anchor's id: the part's, or the part's with a number when that is taken. */\nexport function anchorIdFor(part: string, taken: readonly string[]): string {\n if (!taken.includes(part)) return part\n let n = 2\n while (taken.includes(`${part}_${n}`)) n++\n return `${part}_${n}`\n}\n\n/* The token the canvas draws slots in: translucent, never picked, never saved. */\nexport const SLOT_MARK = '__slot'\n\ntype Evaluated = { id: string; pose: { r: number[][]; t: number[] }; region: { dimensions: number[] } | null }\n\n/**\n * The unfolded slots as boxes the canvas draws (ADR-0118 decision 4): each as big as what it allows, standing on its\n * place -- or hanging from it, for a tier that hangs things -- so an author sees where every slot of the rule falls.\n */\nexport function slotMarksOf(places: readonly Evaluated[], layout: SlotLayout | undefined) {\n if (!layout) return []\n const mountOf = new Map(layout.tiers.map(t => [t.tierNo, t.mount]))\n const marks: FigureRenderPart[] = []\n for (const p of places) {\n const slot = /^t(\\d+)_s\\d+$/.exec(p.id)\n if (!slot || !p.region) continue\n const [width, height, depth] = p.region.dimensions as [number, number, number]\n const down = mountOf.get(Number(slot[1])) === 'HANG'\n marks.push({\n id: `${SLOT_MARK}:${p.id}`,\n shape: {\n provider: 'extrude',\n dimensions: { width, height, depth },\n extrusion: { axis: 'y', section: { kind: 'rectangle', size: { x: width, z: depth } }, start: down ? -height : 0, end: down ? 0 : height }\n },\n pose: p.pose,\n material: { token: SLOT_MARK, transparent: true }\n })\n }\n return marks\n}\n"]}
|
|
1
|
+
{"version":3,"file":"slot-layout-host.js","sourceRoot":"","sources":["../../client/modeller/slot-layout-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,EAK1B,MAAM,wBAAwB,CAAA;AAsB/B,8GAA8G;AAC9G,MAAM,UAAU,gBAAgB,CAAC,KAAkB,EAAE,IAAY;IAC/D,MAAM,GAAG,GAAG,kBAAkB,CAAC,KAAc,CAAC,CAAA;IAC9C,IAAI,GAAG;QAAE,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAsB,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAA;IAC7J,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK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AAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,EAAE;gBAC5D,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;aAC/I;YACD,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE;SAC7F,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["/*\n * What the Figure modeller gives the shared slot layout editor (`@operato/slot-layout-editor`, the one fmsim hosts too),\n * and what it makes of the editor's result (ADR-0118). The editor edits tiers and slots; the modeller owns the anchors\n * -- a part's top or bottom face, named -- and sends the whole layout as one `set-slot-layout` command.\n *\n * A figure's released slot layout is the only one there is (ADR-0118 decision 8, user): no scene or run overrides it, so\n * this host offers no \"use default\" and no per-instance value.\n *\n * Kept free of Lit, i18n and the editor's element so node tests read it directly.\n */\nimport {\n figureBindingsOf,\n figureShapeBoundsOf,\n figureSlotLayoutOf,\n figureSlotLayoutIssues,\n slotLayoutPreset,\n SLOT_LAYOUT_PRESET_KEYS,\n SLOT_LAYOUT_PRESET_PARAMS,\n type FigureAsset,\n type FigureFace,\n type SlotLayout,\n type SlotPresetSize\n} from '@hatiolab/figure-model'\nimport type { FigureRenderPart } from './renderer.js'\n\nexport type SlotAnchorFace = 'top' | 'bottom'\nexport interface SlotAnchor {\n id: string\n part: string\n face: SlotAnchorFace\n}\n/** What the panel edits besides the tiers: the layout's name, what its slots are, and the anchors they stand on. */\nexport interface SlotLayoutForm {\n label: string\n role: 'seat' | 'grip'\n anchors: SlotAnchor[]\n}\n/** A layout problem as the editor shows it: a code, where, and its values. */\nexport interface SlotEditorIssue {\n code: string\n path: string\n params?: Record<string, string | number>\n}\n\n/** The figure's layout as the form and the layout, or a form to start one from on the selected part's top. */\nexport function slotLayoutFormOf(asset: FigureAsset, part: string): { form: SlotLayoutForm; layout?: SlotLayout } {\n const had = figureSlotLayoutOf(asset as never)\n if (had) return { form: { label: had.label, role: had.role, anchors: had.anchors.map(a => ({ ...a, face: a.face as SlotAnchorFace })) }, layout: had.layout }\n return { form: { label: '', role: 'seat', anchors: part ? [{ id: part, part, face: 'top' }] : [] } }\n}\n\n/** How big each anchor's face is, and the room the figure leaves over it: things-scene's, the ones a board's placed figure is measured with too. */\nexport { figureAnchorFacesOf as anchorFacesOf, figureAnchorRoomOf as anchorRoomOf } from '@hatiolab/things-scene'\nimport { figureAnchorRoomOf } from '@hatiolab/things-scene'\n\n/* How high a place over a face is when nobody said: the room the figure leaves over it, else the face's shorter side. */\nconst heightOver = (room: number | undefined, width: number, depth: number) => ((room ?? 0) > 0 ? room! : Math.min(width, depth))\n\n/**\n * Where an author starts with no numbers to type (slot layout drawn on the face, step 1): the first anchor's face, and a\n * slot as high as the room the figure leaves over it (a forklift's forks: up to its mast) -- the face's shorter side when\n * the face is the figure's top. Nothing when the face is not known: the editor then asks for the size.\n */\nexport function startSizeOf(\n anchors: readonly SlotAnchor[],\n faces: Record<string, { width: number; depth: number }>,\n room: Record<string, number>\n): Partial<SlotPresetSize> {\n const first = anchors[0]\n const face = first && faces[first.id]\n if (!face) return {}\n return { width: face.width, depth: face.depth, slotHeight: heightOver(room[first.id], face.width, face.depth) }\n}\n\n/**\n * Where an author starts: the equipment presets (figure-model, ADR-0118 decision 8), laid out on this figure's anchors --\n * a one-anchor preset on the first, a twin fork on the first two. A single slot stands on a top and hangs from a bottom.\n * The editor's own controls then make it what the equipment is.\n */\nexport function slotPresetsOf(anchors: readonly SlotAnchor[]) {\n const first = anchors[0]\n const on = { ...(first ? { anchor: first.id } : {}), ...(anchors.length >= 2 ? { forks: [anchors[0]!.id, anchors[1]!.id] as [string, string] } : {}) }\n const mount = first?.face === 'bottom' ? ('HANG' as const) : ('ON' as const)\n return SLOT_LAYOUT_PRESET_KEYS.map(key => ({\n key,\n /* The editor names a preset and its values from their keys (@operato/slot-layout-editor's own words). */\n params: SLOT_LAYOUT_PRESET_PARAMS[key].map(p => ({ key: p.key, integer: p.integer })),\n build: (size: SlotPresetSize, params: Record<string, number>) => slotLayoutPreset(key, size, params, { ...on, mount })\n }))\n}\n\n/*\n * What figure-model asks beyond the editor's own checks: a slot names the types it takes or takes any item, never an\n * empty list (ADR-0051 §4.1 decision 5, 2026-10-27). The kernel's own check (`figureSlotLayoutIssues`, the one a\n * placement's override is held to as well), said before Apply rather than refused after it; the editor already shows the\n * common findings, so only the figure's own are added.\n */\nexport function figureSlotIssues(layout: SlotLayout, anchors: readonly string[] = layout.tiers.map(t => t.anchorId)): SlotEditorIssue[] {\n return figureSlotLayoutIssues(layout, anchors).filter(issue => issue.code === 'ACCEPTS_EMPTY')\n}\n\n/** The command the panel sends: the whole layout, its anchors and its name, as one step of the history. */\nexport function slotLayoutCommandOf(form: SlotLayoutForm, layout: SlotLayout, fallbackLabel: string) {\n return {\n kind: 'set-slot-layout' as const,\n label: form.label.trim() || fallbackLabel,\n role: form.role,\n anchors: form.anchors.map(a => ({ id: a.id.trim(), part: a.part, face: a.face })),\n layout: structuredClone(layout)\n }\n}\n\n/** A new anchor's id: the part's, or the part's with a number when that is taken. */\nexport function anchorIdFor(part: string, taken: readonly string[]): string {\n if (!taken.includes(part)) return part\n let n = 2\n while (taken.includes(`${part}_${n}`)) n++\n return `${part}_${n}`\n}\n\n/* The token the canvas draws slots in: translucent, never picked, never saved. */\nexport const SLOT_MARK = '__slot'\n/* The token the selected part's places are drawn in: the same box, in the primary colour, so the list and the canvas meet. */\nexport const SLOT_MARK_CHOSEN = '__slot_chosen'\n\ntype Evaluated = { id: string; pose: { r: number[][]; t: number[] }; region: { dimensions: number[] } | null }\n\n/**\n * The unfolded slots as boxes the canvas draws (ADR-0118 decision 4): each as big as what it allows, standing on its\n * place -- or hanging from it, for a tier that hangs things -- so an author sees where every slot of the rule falls.\n */\nexport function slotMarksOf(places: readonly Evaluated[], layout: SlotLayout | undefined) {\n if (!layout) return []\n const mountOf = new Map(layout.tiers.map(t => [t.tierNo, t.mount]))\n const marks: FigureRenderPart[] = []\n for (const p of places) {\n const slot = /^t(\\d+)_s\\d+$/.exec(p.id)\n if (!slot || !p.region) continue\n const [width, height, depth] = p.region.dimensions as [number, number, number]\n const down = mountOf.get(Number(slot[1])) === 'HANG'\n marks.push({\n id: `${SLOT_MARK}:${p.id}`,\n shape: {\n provider: 'extrude',\n dimensions: { width, height, depth },\n extrusion: { axis: 'y', section: { kind: 'rectangle', size: { x: width, z: depth } }, start: down ? -height : 0, end: down ? 0 : height }\n },\n pose: p.pose,\n material: { token: SLOT_MARK, transparent: true }\n })\n }\n return marks\n}\n\n/* Which way each face looks out of its part: the axis and the side. */\nconst OUTWARD: Record<FigureFace, ['x' | 'y' | 'z', 1 | -1]> = { top: ['y', 1], bottom: ['y', -1], right: ['x', 1], left: ['x', -1], front: ['z', 1], back: ['z', -1] }\n/* The two axes a face lies along. */\nconst ACROSS = { x: ['y', 'z'], y: ['x', 'z'], z: ['x', 'y'] } as const\n\ntype Body = { id: string; shape?: Parameters<typeof figureShapeBoundsOf>[0]; pose?: { r: number[][]; t: number[] } }\n\n/**\n * The places held one by one -- a forklift's fork, a lift's plate -- drawn where they are, as the slot layout's are: a\n * place given a size as a box of that size out of its face, one without as its part's face raised as high as a slot\n * would start there (the room over it, else the face's shorter side), so an author sees which face things sit on or\n * hang from and about how much room they have. The selected part's places in the primary colour.\n */\nexport function placeMarksOf(places: readonly Evaluated[], asset: FigureAsset, geometry: readonly Body[], selected?: string) {\n const at = new Map(places.map(p => [p.id, p] as const))\n const marks: FigureRenderPart[] = []\n for (const one of figureBindingsOf(asset)) {\n const p = at.get(one.id)\n if (one.slot || !one.face || !p) continue\n const [axis, side] = OUTWARD[one.face]\n const [u, v] = ACROSS[axis]\n let size: Record<'x' | 'y' | 'z', number>\n if (one.region) size = one.region\n else {\n const shape = geometry.find(g => g.id === one.part)?.shape\n if (!shape) continue\n const b = figureShapeBoundsOf(shape)\n const face = { x: b.x.max - b.x.min, y: b.y.max - b.y.min, z: b.z.max - b.z.min }\n const room = axis === 'y' ? figureAnchorRoomOf([{ id: one.id, part: one.part!, face: one.face }], geometry as never)[one.id] : 0\n size = { ...face, [axis]: heightOver(room, face[u], face[v]) }\n }\n const out = size[axis]\n marks.push({\n id: `${SLOT_MARK}:${one.id}`,\n shape: {\n provider: 'extrude',\n dimensions: { width: size.x, height: size.y, depth: size.z },\n extrusion: { axis, section: { kind: 'rectangle', size: { [u]: size[u], [v]: size[v] } }, start: side > 0 ? 0 : -out, end: side > 0 ? out : 0 }\n },\n pose: p.pose,\n material: { token: one.part === selected ? SLOT_MARK_CHOSEN : SLOT_MARK, transparent: true }\n })\n }\n return marks\n}\n"]}
|