@operato/board 10.29.8 → 10.29.9

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.
@@ -4,102 +4,107 @@
4
4
  import gql from 'graphql-tag';
5
5
  import { Component, registerFigure, registerTypeResolver } from '@hatiolab/things-scene';
6
6
  import { client, gqlContext } from '@operato/graphql';
7
- /*
8
- * Where a board gets the figures somebody authored.
9
- *
10
- * ── Why the seat is filled here ─────────────────────────────────────────────
11
- * things-scene keeps the seat (`registerTypeResolver`) and knows nothing about figures, GraphQL or
12
- * who published what. The board package is where a saved model already gets its values from the
13
- * server — `board-provider.ts` reads a board by id the same way — so this is where the types a
14
- * model names, and nobody has registered, get fetched. Putting it in the authoring package would
15
- * make every consumer drag the modeller along, and putting it in each app would make every app
16
- * build the same thing (ADR-0063 결정 2 · ADR-0045).
17
- *
18
- * ── What it asks for, and what it does not ──────────────────────────────────
19
- * Uppercase names are the figure namespace, so those are the only ones asked about: a model that
20
- * names `rect` or a mistyped `Conveyor` never reaches the server. A type that is already
21
- * registered is left alone — a figure never replaces a component that is already drawing.
22
- *
23
- * ── An answer of "nobody published this" is not a failure ───────────────────
24
- * `figureBlueprint` returns null for a type that has no released figure, and that type stays
25
- * unregistered on purpose: the scene draws it as a stand-in and saves it back untouched
26
- * (ADR-0063 결정 1). Being unable to ask at all is a different fact, so a transport or server
27
- * error rejects — `resolveUnknownTypes` reports those in `failed` and the board still opens.
28
- */
29
- /** The figure namespace: `EQ_MIXER`, `CONVEYOR`, `VEH_AGV_01`. */
30
- const FIGURE_TYPE = /^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$/;
31
- /** Registers one released figure with the scene. Anything but a figure asset is refused by name. */
32
- export function registerFigurePayload(type, payload) {
33
- var _a;
34
- if (!(payload === null || payload === void 0 ? void 0 : payload.asset) || typeof payload.asset !== 'object')
35
- throw new Error(`not a figure asset: ${type}`);
36
- registerFigure((_a = payload.type) !== null && _a !== void 0 ? _a : type, payload.asset);
37
- }
38
- const FETCH_FIGURE_BLUEPRINT = gql `
39
- query FetchFigureBlueprint($type: String!) {
40
- figureBlueprint(type: $type)
7
+ import { i18next } from '@operato/i18n';
8
+ export const FIGURE_TYPE_MAP_CHANGED = 'figure-type-map-changed';
9
+ const FETCH_FIGURE_BLUEPRINTS = gql `
10
+ query FetchFigureBlueprints($types: [String!]!, $map: FigureTypeMapState) {
11
+ figureBlueprints(types: $types, map: $map)
41
12
  }
42
13
  `;
43
- export const fetchFigureBlueprint = async (type) => {
44
- var _a, _b;
14
+ const FETCH_FIGURE_BLUEPRINTS_LATEST = gql `
15
+ query FetchFigureBlueprintsLatest($types: [String!]!) {
16
+ figureBlueprints(types: $types)
17
+ }
18
+ `;
19
+ /**
20
+ * Asks the server. An active map is asked without the argument, so an authoring server whose door
21
+ * has no `map` (it serves the latest release) answers the same query shape.
22
+ */
23
+ export const fetchFigureBlueprints = async (types, map) => {
45
24
  const response = await client.query({
46
- query: FETCH_FIGURE_BLUEPRINT,
47
- variables: { type },
48
- context: gqlContext()
25
+ query: map === 'CANDIDATE' ? FETCH_FIGURE_BLUEPRINTS : FETCH_FIGURE_BLUEPRINTS_LATEST,
26
+ variables: map === 'CANDIDATE' ? { types: [...types], map } : { types: [...types] },
27
+ context: gqlContext(),
28
+ fetchPolicy: 'network-only'
49
29
  });
50
30
  /*
51
31
  The client runs with errorPolicy 'all', so a rejected query comes back as a resolved response
52
- carrying `errors` and a null field. Without this the caller cannot tell "no such figure" from
53
- "the door said no".
32
+ carrying `errors`. Without this the caller cannot tell "the door said no" from an empty answer.
54
33
  */
55
34
  const errors = response.errors;
56
35
  if (errors === null || errors === void 0 ? void 0 : errors.length) {
57
36
  throw new Error(errors.map(e => { var _a; return (_a = e === null || e === void 0 ? void 0 : e.message) !== null && _a !== void 0 ? _a : String(e); }).join('\n'));
58
37
  }
59
- return (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.figureBlueprint) !== null && _b !== void 0 ? _b : null;
38
+ return response.data.figureBlueprints;
60
39
  };
40
+ let choice = 'ACTIVE';
41
+ let pageRelease = null;
42
+ /** Sets which map this page draws from. A preview page sets CANDIDATE before its board opens. */
43
+ export function setFigureMapChoice(next) {
44
+ choice = next;
45
+ }
46
+ /** The map release this page registered its figures from, or null before any (or from an authoring server). */
47
+ export function figureMapReleaseOfPage() {
48
+ return pageRelease;
49
+ }
50
+ /** For tests: forget the page's map release and draw from the active map again. */
51
+ export function resetFigureMapPage() {
52
+ pageRelease = null;
53
+ choice = 'ACTIVE';
54
+ }
55
+ const sameRelease = (a, b) => a.map === b.map && a.version === b.version && a.revision === b.revision;
61
56
  /**
62
57
  * Builds the resolver that fills things-scene's seat.
63
58
  *
64
59
  * `fetch` is a seam for tests — the default one talks to the server.
65
60
  */
66
- export function createFigureResolver(fetch = fetchFigureBlueprint) {
61
+ export function createFigureResolver(fetch = fetchFigureBlueprints) {
67
62
  return async function resolveFigureTypes(types) {
68
- const asking = types.filter(type => FIGURE_TYPE.test(type) && !Component.register(type));
63
+ const asking = types.filter(type => !Component.register(type));
69
64
  if (asking.length === 0) {
70
65
  return;
71
66
  }
72
- const failures = [];
73
- await Promise.all(asking.map(async (type) => {
67
+ const map = choice;
68
+ const answer = await fetch(asking, map);
69
+ if (answer.release) {
70
+ const now = { map, version: answer.release.version, revision: answer.release.revision };
71
+ if (pageRelease && !sameRelease(pageRelease, now)) {
72
+ /* Another map release than the figures drawn here: none is registered, the app offers a reopen. */
73
+ window.dispatchEvent(new CustomEvent(FIGURE_TYPE_MAP_CHANGED, { detail: { was: pageRelease, now } }));
74
+ const message = i18next.t('text.figure-type-map-changed', { defaultValue: 'the type map changed. reopen to draw it.' });
75
+ return { refused: asking.map(type => ({ type, message })) };
76
+ }
77
+ pageRelease = pageRelease !== null && pageRelease !== void 0 ? pageRelease : now;
78
+ }
79
+ const refused = answer.refused
80
+ .filter(refusal => asking.includes(refusal.type))
81
+ .map(refusal => ({ type: refusal.type, message: refusal.message }));
82
+ for (const item of answer.items) {
83
+ if (!asking.includes(item.type))
84
+ continue;
74
85
  try {
75
- const payload = await fetch(type);
76
- if (!payload) {
77
- /* Nobody published this type. It stays a stand-in. */
78
- return;
79
- }
80
- registerFigurePayload(type, payload);
86
+ registerFigurePayload(item.type, item);
81
87
  }
82
88
  catch (error) {
83
- failures.push({ type, error });
89
+ refused.push({ type: item.type, message: error instanceof Error ? error.message : String(error) });
84
90
  }
85
- }));
86
- if (failures.length > 0) {
87
- /*
88
- What did register stays registered — the seat reads the registry back, not what this says.
89
- The throw is how "could not ask" reaches `TypeResolution.failed`.
90
- */
91
- throw new Error(`Figure 를 가져오지 못했다:\n${failures
92
- .map(({ type, error }) => ` - ${type}: ${error instanceof Error ? error.message : String(error)}`)
93
- .join('\n')}`);
94
91
  }
92
+ return { refused };
95
93
  };
96
94
  }
95
+ /** Registers one figure under the name the board asked. Anything but a figure asset is refused by name. */
96
+ export function registerFigurePayload(type, payload) {
97
+ if (!(payload === null || payload === void 0 ? void 0 : payload.asset) || typeof payload.asset !== 'object') {
98
+ throw new Error(`not a figure asset: ${type}`);
99
+ }
100
+ registerFigure(type, payload.asset);
101
+ }
97
102
  /**
98
103
  * Takes the seat. The package entry (`index.ts`) calls this, so an app that has `@operato/board`
99
- * gets published figures on its boards without registering anything itself. Returns the function
100
- * that takes the seat back.
104
+ * gets figures on its boards without registering anything itself. Returns the function that takes
105
+ * the seat back.
101
106
  */
102
- export function installFigureResolver(fetch = fetchFigureBlueprint) {
107
+ export function installFigureResolver(fetch = fetchFigureBlueprints) {
103
108
  return registerTypeResolver(createFigureResolver(fetch));
104
109
  }
105
110
  //# sourceMappingURL=figure-provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"figure-provider.js","sourceRoot":"","sources":["../../src/figure-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CA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,CAAA;QACH,CAAC;IACH,CAAC,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAwB,oBAAoB;IAChF,OAAO,oBAAoB,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAA;AAC1D,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport gql from 'graphql-tag'\n\nimport { Component, registerFigure, registerTypeResolver } from '@hatiolab/things-scene'\nimport { client, gqlContext } from '@operato/graphql'\n\n/*\n * Where a board gets the figures somebody authored.\n *\n * ── Why the seat is filled here ─────────────────────────────────────────────\n * things-scene keeps the seat (`registerTypeResolver`) and knows nothing about figures, GraphQL or\n * who published what. The board package is where a saved model already gets its values from the\n * server — `board-provider.ts` reads a board by id the same way — so this is where the types a\n * model names, and nobody has registered, get fetched. Putting it in the authoring package would\n * make every consumer drag the modeller along, and putting it in each app would make every app\n * build the same thing (ADR-0063 결정 2 · ADR-0045).\n *\n * ── What it asks for, and what it does not ──────────────────────────────────\n * Uppercase names are the figure namespace, so those are the only ones asked about: a model that\n * names `rect` or a mistyped `Conveyor` never reaches the server. A type that is already\n * registered is left alone — a figure never replaces a component that is already drawing.\n *\n * ── An answer of \"nobody published this\" is not a failure ───────────────────\n * `figureBlueprint` returns null for a type that has no released figure, and that type stays\n * unregistered on purpose: the scene draws it as a stand-in and saves it back untouched\n * (ADR-0063 결정 1). Being unable to ask at all is a different fact, so a transport or server\n * error rejects — `resolveUnknownTypes` reports those in `failed` and the board still opens.\n */\n\n/** The figure namespace: `EQ_MIXER`, `CONVEYOR`, `VEH_AGV_01`. */\nconst FIGURE_TYPE = /^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$/\n\n/**\n * What the server hands over for one released type: the figure asset. The board does not read the asset; the scene's\n * own registration compiles it with the kernel (ADR-0087 decision 5), which refuses an asset of any other format by\n * its version. A payload without an asset is not a figure this board can draw.\n */\nexport type FigurePayload = { type: string; asset: any }\n\n/** Asks for one type's payload. Null when no released figure carries that name. */\nexport type BlueprintFetch = (type: string) => Promise<FigurePayload | null>\n\n/** Registers one released figure with the scene. Anything but a figure asset is refused by name. */\nexport function registerFigurePayload(type: string, payload: FigurePayload): void {\n if (!(payload as { asset?: unknown })?.asset || typeof payload.asset !== 'object') throw new Error(`not a figure asset: ${type}`)\n registerFigure(payload.type ?? type, payload.asset)\n}\n\nconst FETCH_FIGURE_BLUEPRINT = gql`\n query FetchFigureBlueprint($type: String!) {\n figureBlueprint(type: $type)\n }\n`\n\nexport const fetchFigureBlueprint: BlueprintFetch = async (type: string) => {\n const response = await client.query({\n query: FETCH_FIGURE_BLUEPRINT,\n variables: { type },\n context: gqlContext()\n })\n\n /*\n The client runs with errorPolicy 'all', so a rejected query comes back as a resolved response\n carrying `errors` and a null field. Without this the caller cannot tell \"no such figure\" from\n \"the door said no\".\n */\n const errors = (response as { errors?: readonly { message?: string }[] }).errors\n if (errors?.length) {\n throw new Error(errors.map(e => e?.message ?? String(e)).join('\\n'))\n }\n\n return response.data?.figureBlueprint ?? null\n}\n\n/**\n * Builds the resolver that fills things-scene's seat.\n *\n * `fetch` is a seam for tests — the default one talks to the server.\n */\nexport function createFigureResolver(fetch: BlueprintFetch = fetchFigureBlueprint) {\n return async function resolveFigureTypes(types: readonly string[]): Promise<void> {\n const asking = types.filter(type => FIGURE_TYPE.test(type) && !Component.register(type))\n if (asking.length === 0) {\n return\n }\n\n const failures: { type: string; error: unknown }[] = []\n\n await Promise.all(\n asking.map(async type => {\n try {\n const payload = await fetch(type)\n if (!payload) {\n /* Nobody published this type. It stays a stand-in. */\n return\n }\n\n registerFigurePayload(type, payload)\n } catch (error) {\n failures.push({ type, error })\n }\n })\n )\n\n if (failures.length > 0) {\n /*\n What did register stays registered — the seat reads the registry back, not what this says.\n The throw is how \"could not ask\" reaches `TypeResolution.failed`.\n */\n throw new Error(\n `Figure 를 가져오지 못했다:\\n${failures\n .map(({ type, error }) => ` - ${type}: ${error instanceof Error ? error.message : String(error)}`)\n .join('\\n')}`\n )\n }\n }\n}\n\n/**\n * Takes the seat. The package entry (`index.ts`) calls this, so an app that has `@operato/board`\n * gets published figures on its boards without registering anything itself. Returns the function\n * that takes the seat back.\n */\nexport function installFigureResolver(fetch: BlueprintFetch = fetchFigureBlueprint): () => void {\n return registerTypeResolver(createFigureResolver(fetch))\n}\n"]}
1
+ {"version":3,"file":"figure-provider.js","sourceRoot":"","sources":["../../src/figure-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AACxF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAiDvC,MAAM,CAAC,MAAM,uBAAuB,GAAG,yBAAyB,CAAA;AAEhE,MAAM,uBAAuB,GAAG,GAAG,CAAA;;;;CAIlC,CAAA;AAED,MAAM,8BAA8B,GAAG,GAAG,CAAA;;;;CAIzC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAoB,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;IACzE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;QAClC,KAAK,EAAE,GAAG,KAAK,WAAW,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,8BAA8B;QACrF,SAAS,EAAE,GAAG,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE;QACnF,OAAO,EAAE,UAAU,EAAE;QACrB,WAAW,EAAE,cAAc;KAC5B,CAAC,CAAA;IACF;;;MAGE;IACF,MAAM,MAAM,GAAI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AK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YAChC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,SAAQ;YACzC,IAAI,CAAC;gBACH,qBAAqB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;YACxC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;YACpG,CAAC;QACH,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,CAAA;IACpB,CAAC,CAAA;AACH,CAAC;AAED,2GAA2G;AAC3G,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,OAA4B;IAC9E,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAA,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAA;IAChD,CAAC;IACD,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,KAAY,CAAC,CAAA;AAC5C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAyB,qBAAqB;IAClF,OAAO,oBAAoB,CAAC,oBAAoB,CAAC,KAAK,CAAQ,CAAC,CAAA;AACjE,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport gql from 'graphql-tag'\n\nimport { Component, registerFigure, registerTypeResolver } from '@hatiolab/things-scene'\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\n\n/*\n * Where a board gets the figures it names.\n *\n * ── Why the seat is filled here ─────────────────────────────────────────────\n * things-scene keeps the seat (`registerTypeResolver`) and knows nothing about figures, GraphQL or\n * who published what. The board package is where a saved model already gets its values from the\n * server, so this is where the types a model names, and nobody has registered, get fetched\n * (ADR-0063 결정 2 · ADR-0045).\n *\n * ── One question per board, by full name ─────────────────────────────────────\n * A board names a figure by its full name `{namespace}/{type}` (ADR-0114 결정 2). Every type the\n * model names that nobody registered is asked in one `figureBlueprints` query; a type already\n * registered -- a built-in component, a figure already drawing -- is never asked. The server answers\n * each name with an item or a refusal with its reason; items are registered under the name asked,\n * refusals go back to the seat so the stand-in shows why (ADR-0114 A3). Being unable to ask at all\n * rejects, and `resolveUnknownTypes` reports it in `failed`; the board still opens.\n *\n * ── One map release per page ─────────────────────────────────────────────────\n * A board server answers from one type map release `{ version, revision }` (ADR-0114 결정 12). The\n * page keeps the first release it registered from, together with which map it asked (active, or the\n * candidate in a preview). An answer from another release is not registered -- figures already drawn\n * would otherwise mix two maps -- and `figure-type-map-changed` tells the app to offer a reopen. An\n * authoring server answers with no release (its latest-release policy); then nothing is kept.\n */\n\n/** Which type map a page draws from: the active one, or the candidate in a preview. */\nexport type FigureMapChoice = 'ACTIVE' | 'CANDIDATE'\n\n/** The type map release a page registered its figures from. */\nexport interface FigureMapRelease {\n map: FigureMapChoice\n version: number\n revision: number\n}\n\n/** What `figureBlueprints` answers: one map release, an item or a refusal per name asked. */\nexport interface FigureBlueprintsAnswer {\n release: { version: number; revision: number } | null\n items: { type: string; ref: string; asset: unknown }[]\n refused: { type: string; code: string; message: string }[]\n}\n\nexport type BlueprintsFetch = (types: readonly string[], map: FigureMapChoice) => Promise<FigureBlueprintsAnswer>\n\n/** Why a type was not registered, for the stand-in. The shape things-scene's seat reads. */\ntype Refusals = { refused: { type: string; message: string }[] }\n\nexport const FIGURE_TYPE_MAP_CHANGED = 'figure-type-map-changed'\n\nconst FETCH_FIGURE_BLUEPRINTS = gql`\n query FetchFigureBlueprints($types: [String!]!, $map: FigureTypeMapState) {\n figureBlueprints(types: $types, map: $map)\n }\n`\n\nconst FETCH_FIGURE_BLUEPRINTS_LATEST = gql`\n query FetchFigureBlueprintsLatest($types: [String!]!) {\n figureBlueprints(types: $types)\n }\n`\n\n/**\n * Asks the server. An active map is asked without the argument, so an authoring server whose door\n * has no `map` (it serves the latest release) answers the same query shape.\n */\nexport const fetchFigureBlueprints: BlueprintsFetch = async (types, map) => {\n const response = await client.query({\n query: map === 'CANDIDATE' ? FETCH_FIGURE_BLUEPRINTS : FETCH_FIGURE_BLUEPRINTS_LATEST,\n variables: map === 'CANDIDATE' ? { types: [...types], map } : { types: [...types] },\n context: gqlContext(),\n fetchPolicy: 'network-only'\n })\n /*\n The client runs with errorPolicy 'all', so a rejected query comes back as a resolved response\n carrying `errors`. Without this the caller cannot tell \"the door said no\" from an empty answer.\n */\n const errors = (response as any).errors as { message?: string }[] | undefined\n if (errors?.length) {\n throw new Error(errors.map(e => e?.message ?? String(e)).join('\\n'))\n }\n return response.data.figureBlueprints as FigureBlueprintsAnswer\n}\n\nlet choice: FigureMapChoice = 'ACTIVE'\nlet pageRelease: FigureMapRelease | null = null\n\n/** Sets which map this page draws from. A preview page sets CANDIDATE before its board opens. */\nexport function setFigureMapChoice(next: FigureMapChoice): void {\n choice = next\n}\n\n/** The map release this page registered its figures from, or null before any (or from an authoring server). */\nexport function figureMapReleaseOfPage(): FigureMapRelease | null {\n return pageRelease\n}\n\n/** For tests: forget the page's map release and draw from the active map again. */\nexport function resetFigureMapPage(): void {\n pageRelease = null\n choice = 'ACTIVE'\n}\n\nconst sameRelease = (a: FigureMapRelease, b: FigureMapRelease) => a.map === b.map && a.version === b.version && a.revision === b.revision\n\n/**\n * Builds the resolver that fills things-scene's seat.\n *\n * `fetch` is a seam for tests — the default one talks to the server.\n */\nexport function createFigureResolver(fetch: BlueprintsFetch = fetchFigureBlueprints) {\n return async function resolveFigureTypes(types: readonly string[]): Promise<Refusals | undefined> {\n const asking = types.filter(type => !Component.register(type))\n if (asking.length === 0) {\n return\n }\n\n const map = choice\n const answer = await fetch(asking, map)\n\n if (answer.release) {\n const now: FigureMapRelease = { map, version: answer.release.version, revision: answer.release.revision }\n if (pageRelease && !sameRelease(pageRelease, now)) {\n /* Another map release than the figures drawn here: none is registered, the app offers a reopen. */\n window.dispatchEvent(new CustomEvent(FIGURE_TYPE_MAP_CHANGED, { detail: { was: pageRelease, now } }))\n const message = i18next.t('text.figure-type-map-changed', { defaultValue: 'the type map changed. reopen to draw it.' })\n return { refused: asking.map(type => ({ type, message })) }\n }\n pageRelease = pageRelease ?? now\n }\n\n const refused: Refusals['refused'] = answer.refused\n .filter(refusal => asking.includes(refusal.type))\n .map(refusal => ({ type: refusal.type, message: refusal.message }))\n\n for (const item of answer.items) {\n if (!asking.includes(item.type)) continue\n try {\n registerFigurePayload(item.type, item)\n } catch (error) {\n refused.push({ type: item.type, message: error instanceof Error ? error.message : String(error) })\n }\n }\n\n return { refused }\n }\n}\n\n/** Registers one figure under the name the board asked. Anything but a figure asset is refused by name. */\nexport function registerFigurePayload(type: string, payload: { asset?: unknown }): void {\n if (!payload?.asset || typeof payload.asset !== 'object') {\n throw new Error(`not a figure asset: ${type}`)\n }\n registerFigure(type, payload.asset as any)\n}\n\n/**\n * Takes the seat. The package entry (`index.ts`) calls this, so an app that has `@operato/board`\n * gets figures on its boards without registering anything itself. Returns the function that takes\n * the seat back.\n */\nexport function installFigureResolver(fetch: BlueprintsFetch = fetchFigureBlueprints): () => void {\n return registerTypeResolver(createFigureResolver(fetch) as any)\n}\n"]}
@@ -39,7 +39,9 @@ export class ComponentMenu extends ScopedElementsMixin(LitElement) {
39
39
  const { type } = template;
40
40
  return html `
41
41
  <div @click=${this.onClickTemplate} data-type=${type} template>
42
- <img src=${String(this.templateIcon(template))} />${i18next.t(`component.${type}`)}
42
+ <img src=${String(this.templateIcon(template))} />${i18next.exists(`component.${type}`)
43
+ ? i18next.t(`component.${type}`)
44
+ : template.description || type}
43
45
  </div>
44
46
  `;
45
47
  })}
@@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C,CAAC,CAAC,CAAA;QAC3F,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;IACnB,CAAC;IAED,YAAY,CAAC,QAAoB;QAC/B,OAAO,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAA;IACjC,CAAC;;AAxLM,oBAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiFF;CACF,AApFY,CAoFZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAA0B;AAE5C;IAAR,KAAK,EAAE;gDAA6B;AAC5B;IAAR,KAAK,EAAE;+CAA2B;AAER;IAA1B,KAAK,CAAC,kBAAkB,CAAC;6CAAqB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { property, query, state } from 'lit/decorators.js'\n\nimport { Scene } from '@hatiolab/things-scene'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { i18next } from '@operato/i18n'\n\nimport { Pallet, PalletItem } from '../../types.js'\nimport { ComponentDetail } from './component-detail.js'\n\nconst noImage = new URL('../../../../icons/components/no-image.png', import.meta.url).href\n\nexport class ComponentMenu extends ScopedElementsMixin(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n align-content: stretch;\n\n background-color: var(--component-menu-background-color, var(--md-sys-color-secondary-container));\n color: var(--component-menu-color, var(--md-sys-color-on-secondary-container));\n margin: 0px;\n padding: 0px;\n\n width: 180px;\n height: 100%;\n\n overflow: visible;\n\n border: 1px solid var(--component-menu-border-color, var(--md-sys-color-outline-variant));\n box-sizing: border-box;\n\n position: absolute;\n top: 0px;\n\n z-index: 1;\n }\n\n h2 {\n background-color: var(--component-menu-title-background, var(--md-sys-color-surface-container-highest));\n padding: 4px 8px;\n margin: 0;\n font: var(--component-menu-title);\n color: var(--component-menu-title-color, var(--md-sys-color-on-surface));\n text-transform: capitalize;\n }\n\n [templates] {\n flex: 1;\n\n display: block;\n margin: 0;\n padding: 0;\n overflow-y: auto;\n\n background-color: var(--component-menu-background-color, var(--md-sys-color-secondary-container));\n color: var(--component-menu-color, var(--md-sys-color-on-secondary-container));\n }\n\n [template] {\n display: flex;\n align-items: center;\n min-height: var(--component-menu-item-icon-size);\n padding: 0 5px 0 0;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n font-size: 11px;\n color: var(--component-menu-item-color, var(--md-sys-color-on-secondary-container));\n text-transform: capitalize;\n }\n\n [template]:hover,\n [template]:focus {\n color: var(--component-menu-item-hover-color, var(--md-sys-color-secondary));\n font-weight: bold;\n cursor: pointer;\n }\n\n [template] img {\n margin: 5px;\n width: var(--component-menu-item-icon-size);\n height: var(--component-menu-item-icon-size);\n }\n\n component-detail {\n position: absolute;\n top: 0;\n left: 180px;\n height: 100%;\n outline: none;\n }\n\n component-detail[hidden] {\n display: none;\n }\n `\n ]\n\n @property({ type: Object }) groups: Pallet[] = []\n @property({ type: Object }) scene: Scene | null = null\n @property({ type: String }) group: string | null = ''\n\n @state() templates: PalletItem[] = []\n @state() template: PalletItem | any\n\n @query('component-detail') detail!: HTMLElement\n\n static get scopedElements() {\n return {\n 'component-detail': ComponentDetail\n }\n }\n\n render() {\n return this.group\n ? html`\n <h2 onclick=${(e: MouseEvent) => e.stopPropagation()}>\n ${/* group label — translate via group.<name> key, fall back to the\n raw group name so untranslated groups keep working.\n \"list\" is also translatable; defaults to the literal \"list\"\n which is what users have been seeing all along. */ ''}\n ${i18next.t(`group.${this.group}`, { defaultValue: this.group })}\n ${i18next.t('label.list', { defaultValue: 'list' })}\n </h2>\n\n <div templates @mouseover=${(e: MouseEvent) => this.onHoverComponent(e)}>\n ${(this.templates || []).map(template => {\n const { type } = template\n\n return html`\n <div @click=${this.onClickTemplate} data-type=${type} template>\n <img src=${String(this.templateIcon(template))} />${i18next.t(`component.${type}`)}\n </div>\n `\n })}\n </div>\n\n <component-detail\n tabindex=\"-1\"\n @focusout=${() => {\n this.template = null\n }}\n .template=${this.template}\n hidden\n >\n </component-detail>\n `\n : html``\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('group')) {\n if (!this.group) {\n this.templates = []\n this.setAttribute('hidden', '')\n } else {\n this.templates = this.groups.find((g: Pallet) => g.name === this.group)?.templates || []\n this.removeAttribute('active')\n }\n }\n\n if (changes.has('template')) {\n this.template && this.template.about\n ? this.detail.removeAttribute('hidden')\n : this.detail.setAttribute('hidden', '')\n }\n }\n\n findTemplate(type: string | null | undefined) {\n this.template = type && this.templates.find(template => template.type == type)\n }\n\n onHoverComponent(e: MouseEvent) {\n const button = e.target as HTMLElement\n this.findTemplate(button!.closest('[data-type]')?.getAttribute('data-type'))\n }\n\n onClickTemplate(e: MouseEvent) {\n var item = e.target as HTMLElement\n var type = item.closest('[data-type]')?.getAttribute('data-type')\n\n if (!type) {\n return\n }\n\n if (this.scene) {\n this.scene.rootContainer?.trigger('addstop') // 새로운 컴포넌트 클릭시 이전 추가 모드 정지\n this.template = this.templates.find(template => template.type == type)\n this.template && this.scene.startAddMode(JSON.parse(JSON.stringify(this.template.model)))\n }\n\n this.group = null\n }\n\n templateIcon(template: PalletItem) {\n return template.icon || noImage\n }\n}\n"]}
1
+ {"version":3,"file":"component-menu.js","sourceRoot":"","sources":["../../../../src/modeller/component-toolbar/component-menu.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,QA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IAED,YAAY,CAAC,QAAoB;QAC/B,OAAO,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAA;IACjC,CAAC;;AA1LM,oBAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiFF;CACF,AApFY,CAoFZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAA0B;AAE5C;IAAR,KAAK,EAAE;gDAA6B;AAC5B;IAAR,KAAK,EAAE;+CAA2B;AAER;IAA1B,KAAK,CAAC,kBAAkB,CAAC;6CAAqB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { property, query, state } from 'lit/decorators.js'\n\nimport { Scene } from '@hatiolab/things-scene'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { i18next } from '@operato/i18n'\n\nimport { Pallet, PalletItem } from '../../types.js'\nimport { ComponentDetail } from './component-detail.js'\n\nconst noImage = new URL('../../../../icons/components/no-image.png', import.meta.url).href\n\nexport class ComponentMenu extends ScopedElementsMixin(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n align-content: stretch;\n\n background-color: var(--component-menu-background-color, var(--md-sys-color-secondary-container));\n color: var(--component-menu-color, var(--md-sys-color-on-secondary-container));\n margin: 0px;\n padding: 0px;\n\n width: 180px;\n height: 100%;\n\n overflow: visible;\n\n border: 1px solid var(--component-menu-border-color, var(--md-sys-color-outline-variant));\n box-sizing: border-box;\n\n position: absolute;\n top: 0px;\n\n z-index: 1;\n }\n\n h2 {\n background-color: var(--component-menu-title-background, var(--md-sys-color-surface-container-highest));\n padding: 4px 8px;\n margin: 0;\n font: var(--component-menu-title);\n color: var(--component-menu-title-color, var(--md-sys-color-on-surface));\n text-transform: capitalize;\n }\n\n [templates] {\n flex: 1;\n\n display: block;\n margin: 0;\n padding: 0;\n overflow-y: auto;\n\n background-color: var(--component-menu-background-color, var(--md-sys-color-secondary-container));\n color: var(--component-menu-color, var(--md-sys-color-on-secondary-container));\n }\n\n [template] {\n display: flex;\n align-items: center;\n min-height: var(--component-menu-item-icon-size);\n padding: 0 5px 0 0;\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n font-size: 11px;\n color: var(--component-menu-item-color, var(--md-sys-color-on-secondary-container));\n text-transform: capitalize;\n }\n\n [template]:hover,\n [template]:focus {\n color: var(--component-menu-item-hover-color, var(--md-sys-color-secondary));\n font-weight: bold;\n cursor: pointer;\n }\n\n [template] img {\n margin: 5px;\n width: var(--component-menu-item-icon-size);\n height: var(--component-menu-item-icon-size);\n }\n\n component-detail {\n position: absolute;\n top: 0;\n left: 180px;\n height: 100%;\n outline: none;\n }\n\n component-detail[hidden] {\n display: none;\n }\n `\n ]\n\n @property({ type: Object }) groups: Pallet[] = []\n @property({ type: Object }) scene: Scene | null = null\n @property({ type: String }) group: string | null = ''\n\n @state() templates: PalletItem[] = []\n @state() template: PalletItem | any\n\n @query('component-detail') detail!: HTMLElement\n\n static get scopedElements() {\n return {\n 'component-detail': ComponentDetail\n }\n }\n\n render() {\n return this.group\n ? html`\n <h2 onclick=${(e: MouseEvent) => e.stopPropagation()}>\n ${/* group label — translate via group.<name> key, fall back to the\n raw group name so untranslated groups keep working.\n \"list\" is also translatable; defaults to the literal \"list\"\n which is what users have been seeing all along. */ ''}\n ${i18next.t(`group.${this.group}`, { defaultValue: this.group })}\n ${i18next.t('label.list', { defaultValue: 'list' })}\n </h2>\n\n <div templates @mouseover=${(e: MouseEvent) => this.onHoverComponent(e)}>\n ${(this.templates || []).map(template => {\n const { type } = template\n\n return html`\n <div @click=${this.onClickTemplate} data-type=${type} template>\n <img src=${String(this.templateIcon(template))} />${i18next.exists(`component.${type}`)\n ? i18next.t(`component.${type}`)\n : template.description || type}\n </div>\n `\n })}\n </div>\n\n <component-detail\n tabindex=\"-1\"\n @focusout=${() => {\n this.template = null\n }}\n .template=${this.template}\n hidden\n >\n </component-detail>\n `\n : html``\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('group')) {\n if (!this.group) {\n this.templates = []\n this.setAttribute('hidden', '')\n } else {\n this.templates = this.groups.find((g: Pallet) => g.name === this.group)?.templates || []\n this.removeAttribute('active')\n }\n }\n\n if (changes.has('template')) {\n this.template && this.template.about\n ? this.detail.removeAttribute('hidden')\n : this.detail.setAttribute('hidden', '')\n }\n }\n\n findTemplate(type: string | null | undefined) {\n this.template = type && this.templates.find(template => template.type == type)\n }\n\n onHoverComponent(e: MouseEvent) {\n const button = e.target as HTMLElement\n this.findTemplate(button!.closest('[data-type]')?.getAttribute('data-type'))\n }\n\n onClickTemplate(e: MouseEvent) {\n var item = e.target as HTMLElement\n var type = item.closest('[data-type]')?.getAttribute('data-type')\n\n if (!type) {\n return\n }\n\n if (this.scene) {\n this.scene.rootContainer?.trigger('addstop') // 새로운 컴포넌트 클릭시 이전 추가 모드 정지\n this.template = this.templates.find(template => template.type == type)\n this.template && this.scene.startAddMode(JSON.parse(JSON.stringify(this.template.model)))\n }\n\n this.group = null\n }\n\n templateIcon(template: PalletItem) {\n return template.icon || noImage\n }\n}\n"]}
@@ -17,6 +17,11 @@ import { ComponentGroup, ComponentTemplate } from './types.js';
17
17
  declare const BoardModeller_base: typeof LitElement & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types.js").ScopedElementsHost>;
18
18
  export declare class BoardModeller extends BoardModeller_base {
19
19
  static styles: import("lit").CSSResult[];
20
+ /**
21
+ * Registers a group, or replaces what a group of that name holds. A group filled from a server -- the figures of
22
+ * the active type map (ADR-0114 결정 10) -- registers again when its list changes; this used to assign to a local
23
+ * variable and change nothing.
24
+ */
20
25
  static registerGroup(group: ComponentGroup): void;
21
26
  static registerTemplate(templates: ComponentTemplate[]): void;
22
27
  static get groups(): ComponentGroup[];
@@ -28,13 +28,15 @@ const ICON_COLLAPSE = new URL('../../icons/icon-collapse.png', import.meta.url).
28
28
  const ICON_COLLAPSE_ACTIVE = new URL('../../icons/icon-collapse-active.png', import.meta.url).href;
29
29
  var Registry = [];
30
30
  let BoardModeller = class BoardModeller extends ScopedElementsMixin(LitElement) {
31
+ /**
32
+ * Registers a group, or replaces what a group of that name holds. A group filled from a server -- the figures of
33
+ * the active type map (ADR-0114 결정 10) -- registers again when its list changes; this used to assign to a local
34
+ * variable and change nothing.
35
+ */
31
36
  static registerGroup(group) {
32
- var found = Registry.find(inRegisterGroup => inRegisterGroup.name == group.name);
37
+ const found = Registry.find(inRegisterGroup => inRegisterGroup.name == group.name);
33
38
  if (found) {
34
- found = {
35
- ...found,
36
- ...group
37
- };
39
+ Object.assign(found, group);
38
40
  }
39
41
  else {
40
42
  Registry.push(group);
@@ -1 +1 @@
1
- {"version":3,"file":"ox-board-modeller.js","sourceRoot":"","sources":["../../src/ox-board-modeller.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,0BAA0B,CAAA;AACjC,OAAO,wBAAwB,CAAA;AAC/B,OAAO,6CAA6C,CAAA;AACpD,OAAO,2CAA2C,CAAA;AAClD,OAAO,8CAA8C,CAAA;AACrD,OAAO,4CAA4C,CAAA;AACnD,OAAO,sBAAsB,CAAA;AAC7B,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB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E,OAAO,EAAE,CAAC;mDAA8B;AAG7B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDAAkC;AAGlC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAA+D;AAC9D;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAA0B;AAC1B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;yDAA+B;AAC9B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;4CAAkB;AACjB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;qDAA2B;AAEtB;IAA9B,KAAK,CAAC,cAAc,CAAC;kDAAkC;AACtB;IAAjC,KAAK,CAAC,iBAAiB,CAAC;6CAA+B;AAlI7C,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CAsfzB","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/fab/fab.js'\nimport '@hatiolab/things-scene'\nimport './modeller/scene-viewer/ox-scene-handler.js'\nimport './modeller/scene-viewer/ox-scene-layer.js'\nimport './modeller/scene-viewer/ox-scene-property.js'\nimport './modeller/scene-viewer/ox-scene-viewer.js'\nimport './ox-board-viewer.js'\nimport '@operato/input/ox-input-code.js'\n\nimport { saveAs } from 'file-saver'\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { LoadTracker, LoadingOverlay, MODE_EDIT, Scene, SCENE_MODE, SceneMode } from '@hatiolab/things-scene'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { OxPopup } from '@operato/popup'\nimport { openPopup } from '@operato/layout'\nimport { i18next } from '@operato/i18n'\nimport { isMacOS, togglefullscreen } from '@operato/utils'\n\nimport { ComponentToolbar } from './modeller/component-toolbar/component-toolbar.js'\nimport { EditToolbar } from './modeller/edit-toolbar.js'\nimport { SelectionToolbar } from './modeller/selection-toolbar.js'\nimport { PropertySidebar } from './modeller/property-sidebar.js'\nimport { ComponentGroup, ComponentTemplate } from './types.js'\nimport OxSceneViewer from './modeller/scene-viewer/ox-scene-viewer.js'\n\nconst MACOS = isMacOS()\n\nconst ICON_HTOOLBAR = new URL('../../icons/icon-htoolbar.png', import.meta.url).href\nconst ICON_FULLSCREEN = new URL('../../icons/icon-fullscreen.png', import.meta.url).href\nconst ICON_COLLAPSE = new URL('../../icons/icon-collapse.png', import.meta.url).href\nconst ICON_COLLAPSE_ACTIVE = new URL('../../icons/icon-collapse-active.png', import.meta.url).href\n\nvar Registry: ComponentGroup[] = []\n\n@customElement('ox-board-modeller')\nexport class BoardModeller extends ScopedElementsMixin(LitElement) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n height: 100%;\n overflow: hidden;\n }\n\n edit-toolbar {\n flex: 45px;\n max-height: 45px;\n }\n\n div[content] {\n flex: 1;\n max-height: calc(100% - 45px);\n\n display: flex;\n flex-direction: row;\n }\n\n component-toolbar {\n max-height: 100%;\n }\n\n property-sidebar {\n overflow: hidden;\n }\n\n #scene-wrap {\n position: relative;\n\n flex: 1;\n display: flex;\n flex-direction: row;\n }\n\n ox-scene-viewer {\n flex: 1;\n width: 100%;\n height: 100%;\n }\n\n md-fab {\n position: absolute;\n right: 15px;\n bottom: 15px;\n z-index: 1000;\n }\n\n ox-popup {\n width: 90%;\n height: 90%;\n left: 50%;\n top: 50%;\n transform: translateX(-50%) translateY(-50%);\n background: var(--md-sys-color-on-secondary-container, black);\n\n display: flex;\n justify-content: center;\n flex-direction: column;\n }\n\n ox-board-viewer {\n width: 98%;\n height: 98%;\n margin: auto;\n padding: 0;\n }\n `\n ]\n\n static registerGroup(group: ComponentGroup) {\n var found = Registry.find(inRegisterGroup => inRegisterGroup.name == group.name)\n\n if (found) {\n found = {\n ...found,\n ...group\n }\n } else {\n Registry.push(group)\n }\n }\n\n static registerTemplate(templates: ComponentTemplate[]): void {\n templates &&\n templates.forEach(template => {\n var groups: string[] = typeof template.group == 'string' ? [template.group] : template.group\n\n Registry.filter(group => groups.includes(group.name)).forEach(group => {\n if (!group.templates.find(inGroupTemplate => inGroupTemplate.type == template.type)) {\n group.templates.push(template)\n }\n })\n })\n }\n\n static get groups(): ComponentGroup[] {\n return Registry\n }\n\n static getGroup(name: string) {\n return Registry.find(group => group.name === name)\n }\n\n @property({ type: String }) boardName: string = ''\n @property({ type: Object }) model: any = null\n @property({ type: String }) baseUrl: string = ''\n @property({ type: Array }) selected: any[] = []\n @property({ type: Number }) mode: SceneMode = SCENE_MODE.EDIT\n @property({ type: Object }) provider: any = null\n @property({ type: Boolean }) hideProperty: boolean = false\n /* Selection verbs float next to the selection (SelectionToolbar) and the top bar keeps only\n * the board verbs. Set false to get the old one-row-of-everything toolbar back. */\n @property({ type: Boolean }) contextualToolbar: boolean = true\n /* Where the contextual bar lives when it is on: floating by the selection, or docked at the\n * top of the canvas. */\n @property({ type: String }) contextualToolbarPlacement: 'floating' | 'docked' = 'floating'\n @property({ type: String }) overlay: string = ''\n @property({ type: Object }) scene?: Scene\n @property({ type: Object }) loadTracker?: LoadTracker\n @property({ type: Array }) componentGroupList: any[] = []\n @property({ type: Array }) fonts: any[] = []\n @property({ type: Array }) propertyEditor: any[] = []\n\n @query('edit-toolbar') private editToolbar!: EditToolbar\n @query('ox-scene-viewer') private viewer!: OxSceneViewer\n\n private group: string = ''\n private shortcutHandler?: (e: KeyboardEvent) => void\n private _loadingOverlay?: LoadingOverlay\n\n constructor() {\n super()\n\n document.addEventListener('get-all-scene-component-ids', (e: Event) => {\n var { component, callback } = (e as CustomEvent).detail\n\n if (!this.scene) return\n\n var ids\n if (component) {\n ids = this.scene.findAll(component).map((c: any) => c.model.id)\n } else {\n // @ts-ignore\n ids = this.scene.ids.map(({ key }) => key)\n }\n\n ids = ids.filter(Boolean).sort()\n callback(ids)\n })\n\n this.style.setProperty('--url-icon-htoolbar', `url(${ICON_HTOOLBAR})`)\n this.style.setProperty('--url-icon-fullscreen', `url(${ICON_FULLSCREEN})`)\n this.style.setProperty('--url-icon-collapse', `url(${ICON_COLLAPSE})`)\n this.style.setProperty('--url-icon-collapse-active', `url(${ICON_COLLAPSE_ACTIVE})`)\n }\n\n static get scopedElements() {\n return {\n 'edit-toolbar': EditToolbar,\n 'selection-toolbar': SelectionToolbar,\n 'property-sidebar': PropertySidebar,\n 'component-toolbar': ComponentToolbar\n }\n }\n\n render() {\n return html`\n <edit-toolbar\n .scene=${this.scene}\n .selected=${this.selected}\n .compact=${this.contextualToolbar}\n @hide-property-changed=${(e: CustomEvent) => (this.hideProperty = e.detail.value)}\n @open-preview=${() => this.preview()}\n @open-data-binding=${() => this.openDataBinding()}\n @download-model=${() => this.downloadModel()}\n @edit-model=${() => this.editModel()}\n @modeller-fullscreen=${() => togglefullscreen(this)}\n >\n ${this.renderBrandingZone()}\n </edit-toolbar>\n\n <div content>\n <component-toolbar\n .scene=${this.scene}\n .mode=${this.mode}\n @mode-changed=${(e: CustomEvent) => {\n this.mode = e.detail.value\n }}\n .componentGroupList=${this.componentGroupList}\n .group=${this.group}\n >\n </component-toolbar>\n\n <div id=\"scene-wrap\">\n <ox-scene-viewer\n id=\"scene\"\n .scene=${this.scene}\n .loadTracker=${this.loadTracker}\n @scene-changed=${(e: CustomEvent) => {\n this.scene = e.detail.value\n }}\n .model=${this.model}\n .selected=${this.selected}\n @selected-changed=${(e: CustomEvent) => {\n this.selected = e.detail.value\n }}\n .mode=${this.mode}\n @mode-changed=${(e: CustomEvent) => {\n this.mode = e.detail.value\n }}\n fit=\"ratio\"\n .baseUrl=${this.baseUrl}\n @contextmenu=${() => this.onContextMenu()}\n .provider=${this.provider}\n name=\"modeller\"\n >\n <ox-scene-layer type=\"snap-guide-layer\"></ox-scene-layer>\n <ox-scene-layer type=\"selection-layer\"></ox-scene-layer>\n <ox-scene-layer type=\"modeling-layer\"></ox-scene-layer>\n <ox-scene-layer type=\"add-layer\"> </ox-scene-layer>\n <ox-scene-layer type=\"shift-layer\">\n <ox-scene-property name=\"text\" value=\"${this.overlay}\"></ox-scene-property>\n <ox-scene-property name=\"alpha\" value=\"0.3\"></ox-scene-property>\n <ox-scene-property name=\"fontFamily\" value=\"arial\"></ox-scene-property>\n <ox-scene-property name=\"fontSize\" value=\"30\" type=\"number\"></ox-scene-property>\n <ox-scene-property name=\"fontColor\" value=\"navy\"></ox-scene-property>\n <ox-scene-property name=\"textBaseline\" value=\"top\"></ox-scene-property>\n <ox-scene-property name=\"textAlign\" value=\"left\"></ox-scene-property>\n <ox-scene-property name=\"paddingTop\" value=\"50\" type=\"number\"></ox-scene-property>\n <ox-scene-property name=\"paddingLeft\" value=\"50\" type=\"number\"></ox-scene-property>\n </ox-scene-layer>\n <ox-scene-handler type=\"text-editor\"></ox-scene-handler>\n <ox-scene-handler type=\"move-handler\"></ox-scene-handler>\n <ox-scene-handler type=\"paste-handler\"></ox-scene-handler>\n </ox-scene-viewer>\n\n ${this.contextualToolbar\n ? html`<selection-toolbar\n .scene=${this.scene}\n .selected=${this.selected}\n .placement=${this.contextualToolbarPlacement}\n ></selection-toolbar>`\n : ''}\n\n <md-fab @click=${() => this.onTapSave()} title=\"save\">\n <md-icon slot=\"icon\">save</md-icon>\n </md-fab>\n </div>\n\n <property-sidebar\n .scene=${this.scene}\n .selected=${this.selected}\n .heading=${this.boardName}\n .collapsed=${this.hideProperty}\n .fonts=${this.fonts}\n .propertyEditor=${this.propertyEditor}\n >\n </property-sidebar>\n </div>\n `\n }\n\n connectedCallback(): void {\n super.connectedCallback()\n this.bindShortcutEvent()\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback()\n this.unbindShortcutEvent()\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('loadTracker') && this.loadTracker) {\n if (!this._loadingOverlay) {\n this._loadingOverlay = new LoadingOverlay()\n }\n this._loadingOverlay.attach(this.renderRoot as HTMLElement, this.loadTracker)\n }\n\n if (changes.has('scene') && this.scene) {\n this.scene.mode = MODE_EDIT\n ;(this.scene as any).onDataBindingToggle = () => this.openDataBinding()\n }\n }\n\n close() {\n this.model = null\n this.requestUpdate()\n }\n\n onShortcut(e: KeyboardEvent) {\n if (MACOS) var ctrlKey = e.metaKey\n else var ctrlKey = e.ctrlKey\n\n switch (e.code) {\n case 'KeyS':\n if (ctrlKey) {\n this.onTapSave()\n e.preventDefault()\n }\n break\n }\n }\n\n preview() {\n const board = {\n id: 'preview',\n model: this.scene?.model ? JSON.parse(JSON.stringify(this.scene.model)) : null\n }\n\n OxPopup.open({\n template: html` <ox-board-viewer style=\"flex: 1;\" .provider=${this.provider} .board=${board}></ox-board-viewer> `,\n style: 'width: 80vw; height: 80vh;',\n backdrop: true,\n preventCloseOnBlur: true\n })\n\n requestAnimationFrame(() => {\n dispatchEvent(new Event('resize'))\n })\n }\n\n private _dataBindingPopup?: any\n\n openDataBinding() {\n // 토글: 이미 열려있으면 닫기\n if (this._dataBindingPopup) {\n this._dataBindingPopup.close()\n this._dataBindingPopup = null\n return\n }\n\n if (!this.scene) return\n\n const selected = this.scene.selected?.[0]\n if (!selected) return\n\n import('@operato/property-panel/data-binding-popup.js')\n\n const PROPS = [\n '',\n 'text',\n 'fillStyle',\n 'strokeStyle',\n 'fontColor',\n 'value',\n 'data',\n 'source',\n 'hidden',\n 'started',\n 'play',\n 'ref',\n 'action',\n 'options',\n 'rotate',\n 'dimension',\n 'location',\n 'accessor',\n 'appendum',\n 'tag',\n 'tap',\n '(action)'\n ].map(p => ({ name: p, label: p }))\n\n const template = html`\n <data-binding-popup\n .mappings=${[...(selected.model.mappings || [])]}\n .properties=${PROPS}\n .selected=${selected}\n ></data-binding-popup>\n `\n\n // document 레벨에서 mappings-change 이벤트 수신 (openPopup 컨텍스트에서 Lit 이벤트 바인딩 불가)\n const onMappingsChange = (e: Event) => {\n const detail = (e as CustomEvent).detail\n if (detail?.mappings) {\n selected.set('mappings', detail.mappings)\n }\n }\n document.addEventListener('mappings-change', onMappingsChange)\n\n this._dataBindingPopup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: `${i18next.t('label.data-spread')} — ${selected.get('id') || selected.get('type')}`\n })\n\n // 팝업이 외부에서 닫힐 때 참조 정리\n this._dataBindingPopup?.addEventListener?.('closed', () => {\n document.removeEventListener('mappings-change', onMappingsChange)\n this._dataBindingPopup = null\n })\n }\n\n downloadModel() {\n if (!this.scene) return\n\n var model = JSON.stringify(this.model, null, 2)\n var filename = (this.boardName || 'NONAME') + '-' + Date.now() + '.json'\n saveAs(new Blob([model], { type: 'application/octet-stream' }), filename)\n }\n\n private _modelEditorHandle?: any\n\n editModel() {\n if (this._modelEditorHandle && !this._modelEditorHandle.closed) {\n this._modelEditorHandle.close()\n this._modelEditorHandle = undefined\n return\n }\n\n if (!this.scene) return\n\n const modelJson = JSON.stringify(this.scene.model, null, 2)\n let currentValue = modelJson\n\n const handle = this._modelEditorHandle = openPopup(html`\n <div style=\"display:flex;flex-direction:column;height:100%;\">\n <ox-input-code\n .value=${modelJson}\n language=\"json\"\n show-line-numbers\n style=\"flex:1;overflow:auto;\"\n @change=${(e: CustomEvent) => { currentValue = e.detail }}\n ></ox-input-code>\n <div style=\"display:flex;justify-content:flex-end;gap:8px;padding:8px;background:var(--md-sys-color-surface-container, #f0f0f0);\">\n <button @click=${() => {\n try {\n const model = JSON.parse(currentValue)\n this.scene!.model = model\n this.requestUpdate()\n handle.close()\n } catch (err) {\n alert('Invalid JSON: ' + (err as Error).message)\n }\n }} style=\"padding:4px 16px;cursor:pointer;\">Apply</button>\n </div>\n </div>\n `, {\n backdrop: true,\n title: 'Edit Board Model',\n size: 'large'\n })\n handle.onclosed = () => { this._modelEditorHandle = undefined }\n }\n\n renderBrandingZone() {\n return html``\n }\n\n onTapSave() {\n this.dispatchEvent(new CustomEvent('save-model', { bubbles: true, composed: true, detail: { model: this.model } }))\n }\n\n bindShortcutEvent() {\n // TODO: Global Hotkey에 대한 정의를 edit-toolbar에서 가져올 수 있도록 수정해야 함.\n const GLOBAL_HOTKEYS = ['Digit1', 'Digit2', 'F10', 'F11', 'KeyD', 'KeyP', 'KeyS']\n\n this.shortcutHandler = (e: KeyboardEvent) => {\n const target = e.composedPath()[0] as HTMLElement\n var tagName = target.tagName\n var isInput = target.isContentEditable || tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA'\n var isGlobalHotkey = GLOBAL_HOTKEYS.includes(e.code)\n\n if (!isGlobalHotkey && isInput) return\n if (!this.editToolbar.onShortcut(e)) this.onShortcut(e)\n }\n\n document.addEventListener('keydown', this.shortcutHandler)\n }\n\n unbindShortcutEvent() {\n if (this.shortcutHandler) {\n document.removeEventListener('keydown', this.shortcutHandler)\n delete this.shortcutHandler\n }\n }\n\n undoable(): boolean {\n return !!this.scene?.undoable()\n }\n\n redoable(): boolean {\n return !!this.scene?.redoable()\n }\n\n preserve(): void {\n this.scene?.preserve()\n }\n\n hasUnpreservedChanges(): boolean {\n return !!this.scene?.hasUnpreservedChanges()\n }\n\n onContextMenu() {}\n}\n"]}
1
+ {"version":3,"file":"ox-board-modeller.js","sourceRoot":"","sources":["../../src/ox-board-modeller.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,0BAA0B,CAAA;AACjC,OAAO,wBAAwB,CAAA;AAC/B,OAAO,6CAA6C,CAAA;AACpD,OAAO,2CAA2C,CAAA;AAClD,OAAO,8CAA8C,CAAA;AACrD,OAAO,4CAA4C,CAAA;AACnD,OAAO,sBAAsB,CAAA;AAC7B,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,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,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAqB;AACnB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAA8B;AAG7B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDAAkC;AAGlC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAA+D;AAC9D;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAA0B;AAC1B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;yDAA+B;AAC9B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;4CAAkB;AACjB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;qDAA2B;AAEtB;IAA9B,KAAK,CAAC,cAAc,CAAC;kDAAkC;AACtB;IAAjC,KAAK,CAAC,iBAAiB,CAAC;6CAA+B;AApI7C,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CAwfzB","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/fab/fab.js'\nimport '@hatiolab/things-scene'\nimport './modeller/scene-viewer/ox-scene-handler.js'\nimport './modeller/scene-viewer/ox-scene-layer.js'\nimport './modeller/scene-viewer/ox-scene-property.js'\nimport './modeller/scene-viewer/ox-scene-viewer.js'\nimport './ox-board-viewer.js'\nimport '@operato/input/ox-input-code.js'\n\nimport { saveAs } from 'file-saver'\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { LoadTracker, LoadingOverlay, MODE_EDIT, Scene, SCENE_MODE, SceneMode } from '@hatiolab/things-scene'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { OxPopup } from '@operato/popup'\nimport { openPopup } from '@operato/layout'\nimport { i18next } from '@operato/i18n'\nimport { isMacOS, togglefullscreen } from '@operato/utils'\n\nimport { ComponentToolbar } from './modeller/component-toolbar/component-toolbar.js'\nimport { EditToolbar } from './modeller/edit-toolbar.js'\nimport { SelectionToolbar } from './modeller/selection-toolbar.js'\nimport { PropertySidebar } from './modeller/property-sidebar.js'\nimport { ComponentGroup, ComponentTemplate } from './types.js'\nimport OxSceneViewer from './modeller/scene-viewer/ox-scene-viewer.js'\n\nconst MACOS = isMacOS()\n\nconst ICON_HTOOLBAR = new URL('../../icons/icon-htoolbar.png', import.meta.url).href\nconst ICON_FULLSCREEN = new URL('../../icons/icon-fullscreen.png', import.meta.url).href\nconst ICON_COLLAPSE = new URL('../../icons/icon-collapse.png', import.meta.url).href\nconst ICON_COLLAPSE_ACTIVE = new URL('../../icons/icon-collapse-active.png', import.meta.url).href\n\nvar Registry: ComponentGroup[] = []\n\n@customElement('ox-board-modeller')\nexport class BoardModeller extends ScopedElementsMixin(LitElement) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n height: 100%;\n overflow: hidden;\n }\n\n edit-toolbar {\n flex: 45px;\n max-height: 45px;\n }\n\n div[content] {\n flex: 1;\n max-height: calc(100% - 45px);\n\n display: flex;\n flex-direction: row;\n }\n\n component-toolbar {\n max-height: 100%;\n }\n\n property-sidebar {\n overflow: hidden;\n }\n\n #scene-wrap {\n position: relative;\n\n flex: 1;\n display: flex;\n flex-direction: row;\n }\n\n ox-scene-viewer {\n flex: 1;\n width: 100%;\n height: 100%;\n }\n\n md-fab {\n position: absolute;\n right: 15px;\n bottom: 15px;\n z-index: 1000;\n }\n\n ox-popup {\n width: 90%;\n height: 90%;\n left: 50%;\n top: 50%;\n transform: translateX(-50%) translateY(-50%);\n background: var(--md-sys-color-on-secondary-container, black);\n\n display: flex;\n justify-content: center;\n flex-direction: column;\n }\n\n ox-board-viewer {\n width: 98%;\n height: 98%;\n margin: auto;\n padding: 0;\n }\n `\n ]\n\n /**\n * Registers a group, or replaces what a group of that name holds. A group filled from a server -- the figures of\n * the active type map (ADR-0114 결정 10) -- registers again when its list changes; this used to assign to a local\n * variable and change nothing.\n */\n static registerGroup(group: ComponentGroup) {\n const found = Registry.find(inRegisterGroup => inRegisterGroup.name == group.name)\n\n if (found) {\n Object.assign(found, group)\n } else {\n Registry.push(group)\n }\n }\n\n static registerTemplate(templates: ComponentTemplate[]): void {\n templates &&\n templates.forEach(template => {\n var groups: string[] = typeof template.group == 'string' ? [template.group] : template.group\n\n Registry.filter(group => groups.includes(group.name)).forEach(group => {\n if (!group.templates.find(inGroupTemplate => inGroupTemplate.type == template.type)) {\n group.templates.push(template)\n }\n })\n })\n }\n\n static get groups(): ComponentGroup[] {\n return Registry\n }\n\n static getGroup(name: string) {\n return Registry.find(group => group.name === name)\n }\n\n @property({ type: String }) boardName: string = ''\n @property({ type: Object }) model: any = null\n @property({ type: String }) baseUrl: string = ''\n @property({ type: Array }) selected: any[] = []\n @property({ type: Number }) mode: SceneMode = SCENE_MODE.EDIT\n @property({ type: Object }) provider: any = null\n @property({ type: Boolean }) hideProperty: boolean = false\n /* Selection verbs float next to the selection (SelectionToolbar) and the top bar keeps only\n * the board verbs. Set false to get the old one-row-of-everything toolbar back. */\n @property({ type: Boolean }) contextualToolbar: boolean = true\n /* Where the contextual bar lives when it is on: floating by the selection, or docked at the\n * top of the canvas. */\n @property({ type: String }) contextualToolbarPlacement: 'floating' | 'docked' = 'floating'\n @property({ type: String }) overlay: string = ''\n @property({ type: Object }) scene?: Scene\n @property({ type: Object }) loadTracker?: LoadTracker\n @property({ type: Array }) componentGroupList: any[] = []\n @property({ type: Array }) fonts: any[] = []\n @property({ type: Array }) propertyEditor: any[] = []\n\n @query('edit-toolbar') private editToolbar!: EditToolbar\n @query('ox-scene-viewer') private viewer!: OxSceneViewer\n\n private group: string = ''\n private shortcutHandler?: (e: KeyboardEvent) => void\n private _loadingOverlay?: LoadingOverlay\n\n constructor() {\n super()\n\n document.addEventListener('get-all-scene-component-ids', (e: Event) => {\n var { component, callback } = (e as CustomEvent).detail\n\n if (!this.scene) return\n\n var ids\n if (component) {\n ids = this.scene.findAll(component).map((c: any) => c.model.id)\n } else {\n // @ts-ignore\n ids = this.scene.ids.map(({ key }) => key)\n }\n\n ids = ids.filter(Boolean).sort()\n callback(ids)\n })\n\n this.style.setProperty('--url-icon-htoolbar', `url(${ICON_HTOOLBAR})`)\n this.style.setProperty('--url-icon-fullscreen', `url(${ICON_FULLSCREEN})`)\n this.style.setProperty('--url-icon-collapse', `url(${ICON_COLLAPSE})`)\n this.style.setProperty('--url-icon-collapse-active', `url(${ICON_COLLAPSE_ACTIVE})`)\n }\n\n static get scopedElements() {\n return {\n 'edit-toolbar': EditToolbar,\n 'selection-toolbar': SelectionToolbar,\n 'property-sidebar': PropertySidebar,\n 'component-toolbar': ComponentToolbar\n }\n }\n\n render() {\n return html`\n <edit-toolbar\n .scene=${this.scene}\n .selected=${this.selected}\n .compact=${this.contextualToolbar}\n @hide-property-changed=${(e: CustomEvent) => (this.hideProperty = e.detail.value)}\n @open-preview=${() => this.preview()}\n @open-data-binding=${() => this.openDataBinding()}\n @download-model=${() => this.downloadModel()}\n @edit-model=${() => this.editModel()}\n @modeller-fullscreen=${() => togglefullscreen(this)}\n >\n ${this.renderBrandingZone()}\n </edit-toolbar>\n\n <div content>\n <component-toolbar\n .scene=${this.scene}\n .mode=${this.mode}\n @mode-changed=${(e: CustomEvent) => {\n this.mode = e.detail.value\n }}\n .componentGroupList=${this.componentGroupList}\n .group=${this.group}\n >\n </component-toolbar>\n\n <div id=\"scene-wrap\">\n <ox-scene-viewer\n id=\"scene\"\n .scene=${this.scene}\n .loadTracker=${this.loadTracker}\n @scene-changed=${(e: CustomEvent) => {\n this.scene = e.detail.value\n }}\n .model=${this.model}\n .selected=${this.selected}\n @selected-changed=${(e: CustomEvent) => {\n this.selected = e.detail.value\n }}\n .mode=${this.mode}\n @mode-changed=${(e: CustomEvent) => {\n this.mode = e.detail.value\n }}\n fit=\"ratio\"\n .baseUrl=${this.baseUrl}\n @contextmenu=${() => this.onContextMenu()}\n .provider=${this.provider}\n name=\"modeller\"\n >\n <ox-scene-layer type=\"snap-guide-layer\"></ox-scene-layer>\n <ox-scene-layer type=\"selection-layer\"></ox-scene-layer>\n <ox-scene-layer type=\"modeling-layer\"></ox-scene-layer>\n <ox-scene-layer type=\"add-layer\"> </ox-scene-layer>\n <ox-scene-layer type=\"shift-layer\">\n <ox-scene-property name=\"text\" value=\"${this.overlay}\"></ox-scene-property>\n <ox-scene-property name=\"alpha\" value=\"0.3\"></ox-scene-property>\n <ox-scene-property name=\"fontFamily\" value=\"arial\"></ox-scene-property>\n <ox-scene-property name=\"fontSize\" value=\"30\" type=\"number\"></ox-scene-property>\n <ox-scene-property name=\"fontColor\" value=\"navy\"></ox-scene-property>\n <ox-scene-property name=\"textBaseline\" value=\"top\"></ox-scene-property>\n <ox-scene-property name=\"textAlign\" value=\"left\"></ox-scene-property>\n <ox-scene-property name=\"paddingTop\" value=\"50\" type=\"number\"></ox-scene-property>\n <ox-scene-property name=\"paddingLeft\" value=\"50\" type=\"number\"></ox-scene-property>\n </ox-scene-layer>\n <ox-scene-handler type=\"text-editor\"></ox-scene-handler>\n <ox-scene-handler type=\"move-handler\"></ox-scene-handler>\n <ox-scene-handler type=\"paste-handler\"></ox-scene-handler>\n </ox-scene-viewer>\n\n ${this.contextualToolbar\n ? html`<selection-toolbar\n .scene=${this.scene}\n .selected=${this.selected}\n .placement=${this.contextualToolbarPlacement}\n ></selection-toolbar>`\n : ''}\n\n <md-fab @click=${() => this.onTapSave()} title=\"save\">\n <md-icon slot=\"icon\">save</md-icon>\n </md-fab>\n </div>\n\n <property-sidebar\n .scene=${this.scene}\n .selected=${this.selected}\n .heading=${this.boardName}\n .collapsed=${this.hideProperty}\n .fonts=${this.fonts}\n .propertyEditor=${this.propertyEditor}\n >\n </property-sidebar>\n </div>\n `\n }\n\n connectedCallback(): void {\n super.connectedCallback()\n this.bindShortcutEvent()\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback()\n this.unbindShortcutEvent()\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('loadTracker') && this.loadTracker) {\n if (!this._loadingOverlay) {\n this._loadingOverlay = new LoadingOverlay()\n }\n this._loadingOverlay.attach(this.renderRoot as HTMLElement, this.loadTracker)\n }\n\n if (changes.has('scene') && this.scene) {\n this.scene.mode = MODE_EDIT\n ;(this.scene as any).onDataBindingToggle = () => this.openDataBinding()\n }\n }\n\n close() {\n this.model = null\n this.requestUpdate()\n }\n\n onShortcut(e: KeyboardEvent) {\n if (MACOS) var ctrlKey = e.metaKey\n else var ctrlKey = e.ctrlKey\n\n switch (e.code) {\n case 'KeyS':\n if (ctrlKey) {\n this.onTapSave()\n e.preventDefault()\n }\n break\n }\n }\n\n preview() {\n const board = {\n id: 'preview',\n model: this.scene?.model ? JSON.parse(JSON.stringify(this.scene.model)) : null\n }\n\n OxPopup.open({\n template: html` <ox-board-viewer style=\"flex: 1;\" .provider=${this.provider} .board=${board}></ox-board-viewer> `,\n style: 'width: 80vw; height: 80vh;',\n backdrop: true,\n preventCloseOnBlur: true\n })\n\n requestAnimationFrame(() => {\n dispatchEvent(new Event('resize'))\n })\n }\n\n private _dataBindingPopup?: any\n\n openDataBinding() {\n // 토글: 이미 열려있으면 닫기\n if (this._dataBindingPopup) {\n this._dataBindingPopup.close()\n this._dataBindingPopup = null\n return\n }\n\n if (!this.scene) return\n\n const selected = this.scene.selected?.[0]\n if (!selected) return\n\n import('@operato/property-panel/data-binding-popup.js')\n\n const PROPS = [\n '',\n 'text',\n 'fillStyle',\n 'strokeStyle',\n 'fontColor',\n 'value',\n 'data',\n 'source',\n 'hidden',\n 'started',\n 'play',\n 'ref',\n 'action',\n 'options',\n 'rotate',\n 'dimension',\n 'location',\n 'accessor',\n 'appendum',\n 'tag',\n 'tap',\n '(action)'\n ].map(p => ({ name: p, label: p }))\n\n const template = html`\n <data-binding-popup\n .mappings=${[...(selected.model.mappings || [])]}\n .properties=${PROPS}\n .selected=${selected}\n ></data-binding-popup>\n `\n\n // document 레벨에서 mappings-change 이벤트 수신 (openPopup 컨텍스트에서 Lit 이벤트 바인딩 불가)\n const onMappingsChange = (e: Event) => {\n const detail = (e as CustomEvent).detail\n if (detail?.mappings) {\n selected.set('mappings', detail.mappings)\n }\n }\n document.addEventListener('mappings-change', onMappingsChange)\n\n this._dataBindingPopup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: `${i18next.t('label.data-spread')} — ${selected.get('id') || selected.get('type')}`\n })\n\n // 팝업이 외부에서 닫힐 때 참조 정리\n this._dataBindingPopup?.addEventListener?.('closed', () => {\n document.removeEventListener('mappings-change', onMappingsChange)\n this._dataBindingPopup = null\n })\n }\n\n downloadModel() {\n if (!this.scene) return\n\n var model = JSON.stringify(this.model, null, 2)\n var filename = (this.boardName || 'NONAME') + '-' + Date.now() + '.json'\n saveAs(new Blob([model], { type: 'application/octet-stream' }), filename)\n }\n\n private _modelEditorHandle?: any\n\n editModel() {\n if (this._modelEditorHandle && !this._modelEditorHandle.closed) {\n this._modelEditorHandle.close()\n this._modelEditorHandle = undefined\n return\n }\n\n if (!this.scene) return\n\n const modelJson = JSON.stringify(this.scene.model, null, 2)\n let currentValue = modelJson\n\n const handle = this._modelEditorHandle = openPopup(html`\n <div style=\"display:flex;flex-direction:column;height:100%;\">\n <ox-input-code\n .value=${modelJson}\n language=\"json\"\n show-line-numbers\n style=\"flex:1;overflow:auto;\"\n @change=${(e: CustomEvent) => { currentValue = e.detail }}\n ></ox-input-code>\n <div style=\"display:flex;justify-content:flex-end;gap:8px;padding:8px;background:var(--md-sys-color-surface-container, #f0f0f0);\">\n <button @click=${() => {\n try {\n const model = JSON.parse(currentValue)\n this.scene!.model = model\n this.requestUpdate()\n handle.close()\n } catch (err) {\n alert('Invalid JSON: ' + (err as Error).message)\n }\n }} style=\"padding:4px 16px;cursor:pointer;\">Apply</button>\n </div>\n </div>\n `, {\n backdrop: true,\n title: 'Edit Board Model',\n size: 'large'\n })\n handle.onclosed = () => { this._modelEditorHandle = undefined }\n }\n\n renderBrandingZone() {\n return html``\n }\n\n onTapSave() {\n this.dispatchEvent(new CustomEvent('save-model', { bubbles: true, composed: true, detail: { model: this.model } }))\n }\n\n bindShortcutEvent() {\n // TODO: Global Hotkey에 대한 정의를 edit-toolbar에서 가져올 수 있도록 수정해야 함.\n const GLOBAL_HOTKEYS = ['Digit1', 'Digit2', 'F10', 'F11', 'KeyD', 'KeyP', 'KeyS']\n\n this.shortcutHandler = (e: KeyboardEvent) => {\n const target = e.composedPath()[0] as HTMLElement\n var tagName = target.tagName\n var isInput = target.isContentEditable || tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA'\n var isGlobalHotkey = GLOBAL_HOTKEYS.includes(e.code)\n\n if (!isGlobalHotkey && isInput) return\n if (!this.editToolbar.onShortcut(e)) this.onShortcut(e)\n }\n\n document.addEventListener('keydown', this.shortcutHandler)\n }\n\n unbindShortcutEvent() {\n if (this.shortcutHandler) {\n document.removeEventListener('keydown', this.shortcutHandler)\n delete this.shortcutHandler\n }\n }\n\n undoable(): boolean {\n return !!this.scene?.undoable()\n }\n\n redoable(): boolean {\n return !!this.scene?.redoable()\n }\n\n preserve(): void {\n this.scene?.preserve()\n }\n\n hasUnpreservedChanges(): boolean {\n return !!this.scene?.hasUnpreservedChanges()\n }\n\n onContextMenu() {}\n}\n"]}
@@ -3,14 +3,17 @@
3
3
  */
4
4
  import { create, resolveUnknownTypes } from '@hatiolab/things-scene';
5
5
  export async function createResolvedScene(options, stillWanted) {
6
- const { unresolved, failed } = await resolveUnknownTypes(options.model);
6
+ var _a;
7
+ const resolution = await resolveUnknownTypes(options.model);
8
+ const { unresolved, failed } = resolution;
9
+ /* The reason a resolver gave for each type it refused (ADR-0114 A3); older scenes report none. */
10
+ const refused = (_a = resolution.refused) !== null && _a !== void 0 ? _a : [];
7
11
  if (failed.length > 0 || unresolved.length > 0) {
8
12
  const asked = new Set(failed.flatMap(({ types }) => types));
13
+ const said = new Map(refused.map(({ type, message }) => [type, message]));
9
14
  const reasons = [
10
15
  ...failed.map(({ types, error }) => `${types.join(', ')}: ${error instanceof Error ? error.message : String(error)}`),
11
- ...(unresolved.some(type => !asked.has(type))
12
- ? [`${unresolved.filter(type => !asked.has(type)).join(', ')}: 발행된 것이 없다`]
13
- : [])
16
+ ...unresolved.filter(type => !asked.has(type)).map(type => { var _a; return `${type}: ${(_a = said.get(type)) !== null && _a !== void 0 ? _a : '해석되지 않았다'}`; })
14
17
  ];
15
18
  console.warn(`[board] 그리지 못한 type — ${reasons.join(' | ')}`);
16
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"resolved-scene.js","sourceRoot":"","sources":["../../src/resolved-scene.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAiCpE,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAA2B,EAC3B,WAAyB;IAEzB,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAEvE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/C,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;QAC3D,MAAM,OAAO,GAAG;YACd,GAAG,MAAM,CAAC,GAAG,CACX,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACvG;YACD,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAC3C,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;gBAC1E,CAAC,CAAC,EAAE,CAAC;SACR,CAAA;QACD,OAAO,CAAC,IAAI,CAAC,yBAAyB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC9D,CAAC;IAED,IAAI,WAAW,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QAClC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,CAAA;AACxB,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { create, resolveUnknownTypes } from '@hatiolab/things-scene'\nimport type { SceneCreateOptions } from '@hatiolab/things-scene'\n\n/*\n * The one place this package turns a model into a scene.\n *\n * ── Why it is one place ─────────────────────────────────────────────────────\n * `create()` is synchronous and compiles what is registered at that moment, so the types a model\n * names and nobody has registered have to be fetched first (`figure-provider.ts` fetches them).\n * Written at each scene site, that \"first\" is six lines that drift apart, and the seventh site\n * forgets it. So every site in this package calls this function instead, and a test counts that\n * nobody else imports `create` (test/scene-create-single-door.test.ts).\n *\n * ── It costs nothing when there is nothing to resolve ───────────────────────\n * `resolveUnknownTypes` collects the model's unregistered types first and only wakes a resolver if\n * there are any. A board of plain scene components asks no server anything — every board-opening\n * screen goes through here, so that has to stay true.\n *\n * ── A scene opens even when the figures do not ──────────────────────────────\n * Resolution never throws: a resolver that rejects is reported in `failed`, and a type nobody\n * published stays in `unresolved`. Both draw as stand-ins and are saved back untouched (ADR-0063\n * 결정 1). They are not the same fact, so the warning says which happened to which type — silence\n * would leave \"the server said no\" looking exactly like \"there is no such figure\".\n */\n\n/**\n * Tells whether the caller still wants this scene after the await.\n *\n * The wait makes the caller re-entrant: an element can be detached, or handed a new model, while\n * the types are being fetched. Without this, the late scene overwrites the current one.\n */\nexport type StillWanted = () => boolean\n\nexport async function createResolvedScene(\n options: SceneCreateOptions,\n stillWanted?: StillWanted\n): Promise<ReturnType<typeof create> | null> {\n const { unresolved, failed } = await resolveUnknownTypes(options.model)\n\n if (failed.length > 0 || unresolved.length > 0) {\n const asked = new Set(failed.flatMap(({ types }) => types))\n const reasons = [\n ...failed.map(\n ({ types, error }) => `${types.join(', ')}: ${error instanceof Error ? error.message : String(error)}`\n ),\n ...(unresolved.some(type => !asked.has(type))\n ? [`${unresolved.filter(type => !asked.has(type)).join(', ')}: 발행된 것이 없다`]\n : [])\n ]\n console.warn(`[board] 그리지 못한 type — ${reasons.join(' | ')}`)\n }\n\n if (stillWanted && !stillWanted()) {\n return null\n }\n\n return create(options)\n}\n"]}
1
+ {"version":3,"file":"resolved-scene.js","sourceRoot":"","sources":["../../src/resolved-scene.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAiCpE,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAA2B,EAC3B,WAAyB;;IAEzB,MAAM,UAAU,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC3D,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,UAAU,CAAA;IACzC,kGAAkG;IAClG,MAAM,OAAO,GAAwC,MAAC,UAAkB,CAAC,OAAO,mCAAI,EAAE,CAAA;IAEtF,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/C,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;QAC3D,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;QACzE,MAAM,OAAO,GAAG;YACd,GAAG,MAAM,CAAC,GAAG,CACX,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACvG;YACD,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,WAAC,OAAA,GAAG,IAAI,KAAK,MAAA,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAI,UAAU,EAAE,CAAA,EAAA,CAAC;SACvG,CAAA;QACD,OAAO,CAAC,IAAI,CAAC,yBAAyB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC9D,CAAC;IAED,IAAI,WAAW,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QAClC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,CAAA;AACxB,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { create, resolveUnknownTypes } from '@hatiolab/things-scene'\nimport type { SceneCreateOptions } from '@hatiolab/things-scene'\n\n/*\n * The one place this package turns a model into a scene.\n *\n * ── Why it is one place ─────────────────────────────────────────────────────\n * `create()` is synchronous and compiles what is registered at that moment, so the types a model\n * names and nobody has registered have to be fetched first (`figure-provider.ts` fetches them).\n * Written at each scene site, that \"first\" is six lines that drift apart, and the seventh site\n * forgets it. So every site in this package calls this function instead, and a test counts that\n * nobody else imports `create` (test/scene-create-single-door.test.ts).\n *\n * ── It costs nothing when there is nothing to resolve ───────────────────────\n * `resolveUnknownTypes` collects the model's unregistered types first and only wakes a resolver if\n * there are any. A board of plain scene components asks no server anything — every board-opening\n * screen goes through here, so that has to stay true.\n *\n * ── A scene opens even when the figures do not ──────────────────────────────\n * Resolution never throws: a resolver that rejects is reported in `failed`, and a type nobody\n * published stays in `unresolved`. Both draw as stand-ins and are saved back untouched (ADR-0063\n * 결정 1). They are not the same fact, so the warning says which happened to which type — silence\n * would leave \"the server said no\" looking exactly like \"there is no such figure\".\n */\n\n/**\n * Tells whether the caller still wants this scene after the await.\n *\n * The wait makes the caller re-entrant: an element can be detached, or handed a new model, while\n * the types are being fetched. Without this, the late scene overwrites the current one.\n */\nexport type StillWanted = () => boolean\n\nexport async function createResolvedScene(\n options: SceneCreateOptions,\n stillWanted?: StillWanted\n): Promise<ReturnType<typeof create> | null> {\n const resolution = await resolveUnknownTypes(options.model)\n const { unresolved, failed } = resolution\n /* The reason a resolver gave for each type it refused (ADR-0114 A3); older scenes report none. */\n const refused: { type: string; message: string }[] = (resolution as any).refused ?? []\n\n if (failed.length > 0 || unresolved.length > 0) {\n const asked = new Set(failed.flatMap(({ types }) => types))\n const said = new Map(refused.map(({ type, message }) => [type, message]))\n const reasons = [\n ...failed.map(\n ({ types, error }) => `${types.join(', ')}: ${error instanceof Error ? error.message : String(error)}`\n ),\n ...unresolved.filter(type => !asked.has(type)).map(type => `${type}: ${said.get(type) ?? '해석되지 않았다'}`)\n ]\n console.warn(`[board] 그리지 못한 type — ${reasons.join(' | ')}`)\n }\n\n if (stillWanted && !stillWanted()) {\n return null\n }\n\n return create(options)\n}\n"]}