@things-factory/figure-library 10.1.273 → 10.1.274

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.
@@ -0,0 +1,2 @@
1
+ export declare function setFigureLibraryFileUrl(resolver: ((hash: string) => string) | undefined): void;
2
+ export declare function figureLibraryFileUrl(hash: string): string;
@@ -0,0 +1,14 @@
1
+ import { getPathInfo } from '@operato/utils';
2
+ /*
3
+ * Where a library file -- a figure's thumbnail or mesh -- is fetched by its hash. This server serves them at
4
+ * `/figure-library-file/:hash`; an app whose figure library lives on another server says where with
5
+ * `setFigureLibraryFileUrl` (fmsim on the customer's REST server).
6
+ */
7
+ let resolve;
8
+ export function setFigureLibraryFileUrl(resolver) {
9
+ resolve = resolver;
10
+ }
11
+ export function figureLibraryFileUrl(hash) {
12
+ return resolve ? resolve(hash) : `${getPathInfo(location.pathname).contextPath}/figure-library-file/${hash}`;
13
+ }
14
+ //# sourceMappingURL=figure-library-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"figure-library-file.js","sourceRoot":"","sources":["../client/figure-library-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C;;;;GAIG;AACH,IAAI,OAA+C,CAAA;AAEnD,MAAM,UAAU,uBAAuB,CAAC,QAAgD;IACtF,OAAO,GAAG,QAAQ,CAAA;AACpB,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,WAAW,wBAAwB,IAAI,EAAE,CAAA;AAC9G,CAAC","sourcesContent":["import { getPathInfo } from '@operato/utils'\n\n/*\n * Where a library file -- a figure's thumbnail or mesh -- is fetched by its hash. This server serves them at\n * `/figure-library-file/:hash`; an app whose figure library lives on another server says where with\n * `setFigureLibraryFileUrl` (fmsim on the customer's REST server).\n */\nlet resolve: ((hash: string) => string) | undefined\n\nexport function setFigureLibraryFileUrl(resolver: ((hash: string) => string) | undefined): void {\n resolve = resolver\n}\n\nexport function figureLibraryFileUrl(hash: string): string {\n return resolve ? resolve(hash) : `${getPathInfo(location.pathname).contextPath}/figure-library-file/${hash}`\n}\n"]}
@@ -48,10 +48,10 @@ export interface FigurePaletteGroup {
48
48
  /** The lines a board can place now: those with a release in a format this server reads. */
49
49
  export declare function placeableFigureTypes(lines: readonly FigureTypeMapLine[]): string[];
50
50
  /**
51
- * The tray group. `contextPath` is where this server's figure files are served from; `t` the app's translator.
51
+ * The tray group. `fileUrl` is where a figure file is fetched by its hash; `t` the app's translator.
52
52
  * A line with no release has nothing to draw and is left out.
53
53
  */
54
- export declare function figurePaletteGroupOf(lines: readonly FigureTypeMapLine[], { contextPath, t }: {
55
- contextPath: string;
54
+ export declare function figurePaletteGroupOf(lines: readonly FigureTypeMapLine[], { fileUrl, t }: {
55
+ fileUrl: (hash: string) => string;
56
56
  t: (key: string, options?: Record<string, unknown>) => string;
57
57
  }): FigurePaletteGroup;
@@ -8,10 +8,10 @@ export function placeableFigureTypes(lines) {
8
8
  return lines.filter(line => line.release?.formatSupported).map(line => line.name);
9
9
  }
10
10
  /**
11
- * The tray group. `contextPath` is where this server's figure files are served from; `t` the app's translator.
11
+ * The tray group. `fileUrl` is where a figure file is fetched by its hash; `t` the app's translator.
12
12
  * A line with no release has nothing to draw and is left out.
13
13
  */
14
- export function figurePaletteGroupOf(lines, { contextPath, t }) {
14
+ export function figurePaletteGroupOf(lines, { fileUrl, t }) {
15
15
  return {
16
16
  name: 'figure',
17
17
  description: t('figure-library.palette.description'),
@@ -26,7 +26,7 @@ export function figurePaletteGroupOf(lines, { contextPath, t }) {
26
26
  type: line.name,
27
27
  description: release.name,
28
28
  group: 'figure',
29
- icon: thumbnail ? `${contextPath}/figure-library-file/${thumbnail}` : undefined,
29
+ icon: thumbnail ? fileUrl(thumbnail) : undefined,
30
30
  /* No box: placed, the figure takes the size it is made at through the drawing's scale (ADR-0144 2.3). */
31
31
  model: { type: line.name, left: 0, top: 0 },
32
32
  item: !!release.item,
@@ -1 +1 @@
1
- {"version":3,"file":"figure-palette-group.js","sourceRoot":"","sources":["../client/figure-palette-group.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA6CH,2FAA2F;AAC3F,MAAM,UAAU,oBAAoB,CAAC,KAAmC;IACtE,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACnF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAmC,EACnC,EAAE,WAAW,EAAE,CAAC,EAA0F;IAE1G,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,CAAC,CAAC,oCAAoC,CAAC;QACpD,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,KAAK;aACb,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;aAC5B,GAAG,CAAC,IAAI,CAAC,EAAE;YACV,MAAM,OAAO,GAAG,IAAI,CAAC,OAAQ,CAAA;YAC7B,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,EAAE,IAAI,CAAA;YACtF,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,WAAW,EAAE,OAAO,CAAC,IAAI;gBACzB,KAAK,EAAE,QAAiB;gBACxB,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,WAAW,wBAAwB,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS;gBAC/E,yGAAyG;gBACzG,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;gBAC3C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI;gBACpB,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM;gBACxB,GAAG,CAAC,CAAC,OAAO,CAAC,eAAe,IAAI;oBAC9B,gBAAgB,EAAE,CAAC,CAAC,wCAAwC,CAAC;oBAC7D,iBAAiB,EAAE,CAAC,CAAC,uCAAuC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;iBAC/F,CAAC;aACH,CAAA;QACH,CAAC,CAAC;KACL,CAAA;AACH,CAAC","sourcesContent":["/*\n * The modeller tray's \"Figure\" group, from the domain's figure type map (ADR-0114): one template per line, with the\n * release it draws with. A line whose format this server cannot read is shown dimmed with its reason and cannot be\n * placed. Pure: the lines and the words come in, the group goes out -- `figure-palette.ts` asks the server.\n */\n\n/** One line of the domain's type map, as the tray reads it. */\nexport interface FigureTypeMapLine {\n name: string\n release?: {\n ref: string\n name: string\n formatSupported: boolean\n /** Whether the release is tagged as the look of an item a holder holds (ADR-0155 amendment 2). */\n item?: boolean | null\n /** Whether the figure holds things itself. */\n holder?: boolean | null\n assetFormat?: string\n dependencies?: Array<{ role: string; hash: string }>\n } | null\n}\n\nexport interface FigurePaletteTemplate {\n type: string\n description: string\n group: 'figure'\n /** The release's thumbnail; a modeller's tray template always has the field, undefined when there is none. */\n icon: string | undefined\n model: { type: string; left: number; top: number }\n unavailableLabel?: string\n unavailableReason?: string\n /**\n * The release is tagged as the look of an item a holder holds (ADR-0155 amendment 2). The platform tray offers it all\n * the same (ADR-0123 결정 11); a modeller whose boards place items only by data leaves out an item that holds nothing\n * (fmsim's, where items are carriers). An item that holds -- a reel cart an AGV carries -- is still placed by hand.\n */\n item: boolean\n /** The figure holds things itself. */\n holder: boolean\n}\n\nexport interface FigurePaletteGroup {\n name: 'figure'\n description: string\n icon: string\n symbol: string\n templates: FigurePaletteTemplate[]\n}\n\n/** The lines a board can place now: those with a release in a format this server reads. */\nexport function placeableFigureTypes(lines: readonly FigureTypeMapLine[]): string[] {\n return lines.filter(line => line.release?.formatSupported).map(line => line.name)\n}\n\n/**\n * The tray group. `contextPath` is where this server's figure files are served from; `t` the app's translator.\n * A line with no release has nothing to draw and is left out.\n */\nexport function figurePaletteGroupOf(\n lines: readonly FigureTypeMapLine[],\n { contextPath, t }: { contextPath: string; t: (key: string, options?: Record<string, unknown>) => string }\n): FigurePaletteGroup {\n return {\n name: 'figure',\n description: t('figure-library.palette.description'),\n icon: '',\n symbol: 'deployed_code',\n templates: lines\n .filter(line => line.release)\n .map(line => {\n const release = line.release!\n const thumbnail = (release.dependencies ?? []).find(d => d.role === 'thumbnail')?.hash\n return {\n type: line.name,\n description: release.name,\n group: 'figure' as const,\n icon: thumbnail ? `${contextPath}/figure-library-file/${thumbnail}` : undefined,\n /* No box: placed, the figure takes the size it is made at through the drawing's scale (ADR-0144 2.3). */\n model: { type: line.name, left: 0, top: 0 },\n item: !!release.item,\n holder: !!release.holder,\n ...(!release.formatSupported && {\n unavailableLabel: t('figure-library.text.format-unsupported'),\n unavailableReason: t('figure-library.text.cannot-use-format', { format: release.assetFormat })\n })\n }\n })\n }\n}\n"]}
1
+ {"version":3,"file":"figure-palette-group.js","sourceRoot":"","sources":["../client/figure-palette-group.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA6CH,2FAA2F;AAC3F,MAAM,UAAU,oBAAoB,CAAC,KAAmC;IACtE,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACnF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAmC,EACnC,EA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-0114): one template per line, with the\n * release it draws with. A line whose format this server cannot read is shown dimmed with its reason and cannot be\n * placed. Pure: the lines and the words come in, the group goes out -- `figure-palette.ts` asks the server.\n */\n\n/** One line of the domain's type map, as the tray reads it. */\nexport interface FigureTypeMapLine {\n name: string\n release?: {\n ref: string\n name: string\n formatSupported: boolean\n /** Whether the release is tagged as the look of an item a holder holds (ADR-0155 amendment 2). */\n item?: boolean | null\n /** Whether the figure holds things itself. */\n holder?: boolean | null\n assetFormat?: string\n dependencies?: Array<{ role: string; hash: string }>\n } | null\n}\n\nexport interface FigurePaletteTemplate {\n type: string\n description: string\n group: 'figure'\n /** The release's thumbnail; a modeller's tray template always has the field, undefined when there is none. */\n icon: string | undefined\n model: { type: string; left: number; top: number }\n unavailableLabel?: string\n unavailableReason?: string\n /**\n * The release is tagged as the look of an item a holder holds (ADR-0155 amendment 2). The platform tray offers it all\n * the same (ADR-0123 결정 11); a modeller whose boards place items only by data leaves out an item that holds nothing\n * (fmsim's, where items are carriers). An item that holds -- a reel cart an AGV carries -- is still placed by hand.\n */\n item: boolean\n /** The figure holds things itself. */\n holder: boolean\n}\n\nexport interface FigurePaletteGroup {\n name: 'figure'\n description: string\n icon: string\n symbol: string\n templates: FigurePaletteTemplate[]\n}\n\n/** The lines a board can place now: those with a release in a format this server reads. */\nexport function placeableFigureTypes(lines: readonly FigureTypeMapLine[]): string[] {\n return lines.filter(line => line.release?.formatSupported).map(line => line.name)\n}\n\n/**\n * The tray group. `fileUrl` is where a figure file is fetched by its hash; `t` the app's translator.\n * A line with no release has nothing to draw and is left out.\n */\nexport function figurePaletteGroupOf(\n lines: readonly FigureTypeMapLine[],\n { fileUrl, t }: { fileUrl: (hash: string) => string; t: (key: string, options?: Record<string, unknown>) => string }\n): FigurePaletteGroup {\n return {\n name: 'figure',\n description: t('figure-library.palette.description'),\n icon: '',\n symbol: 'deployed_code',\n templates: lines\n .filter(line => line.release)\n .map(line => {\n const release = line.release!\n const thumbnail = (release.dependencies ?? []).find(d => d.role === 'thumbnail')?.hash\n return {\n type: line.name,\n description: release.name,\n group: 'figure' as const,\n icon: thumbnail ? fileUrl(thumbnail) : undefined,\n /* No box: placed, the figure takes the size it is made at through the drawing's scale (ADR-0144 2.3). */\n model: { type: line.name, left: 0, top: 0 },\n item: !!release.item,\n holder: !!release.holder,\n ...(!release.formatSupported && {\n unavailableLabel: t('figure-library.text.format-unsupported'),\n unavailableReason: t('figure-library.text.cannot-use-format', { format: release.assetFormat })\n })\n }\n })\n }\n}\n"]}
@@ -7,9 +7,9 @@ import gql from 'graphql-tag';
7
7
  import { resolveUnknownTypes } from '@hatiolab/things-scene';
8
8
  import { client } from '@operato/graphql';
9
9
  import { i18next } from '@operato/i18n';
10
- import { getPathInfo } from '@operato/utils';
11
10
  import { figurePaletteGroupOf, placeableFigureTypes } from './figure-palette-group.js';
12
11
  import { keepCurrentWithLibrary } from './figure-library-changed.js';
12
+ import { figureLibraryFileUrl } from './figure-library-file.js';
13
13
  export * from './figure-palette-group.js';
14
14
  const TYPE_MAP = gql `
15
15
  query {
@@ -44,9 +44,8 @@ export async function registerFigurePalette(registerGroup) {
44
44
  const placeable = placeableFigureTypes(lines);
45
45
  if (placeable.length)
46
46
  await resolveUnknownTypes({ components: placeable.map(type => ({ type })) });
47
- const { contextPath } = getPathInfo(location.pathname);
48
47
  /* The modeller replaces a group registered under the same name, so a second read updates the tray in place. */
49
- registerGroup(figurePaletteGroupOf(lines, { contextPath, t: (key, options) => i18next.t(key, options) }));
48
+ registerGroup(figurePaletteGroupOf(lines, { fileUrl: figureLibraryFileUrl, t: (key, options) => i18next.t(key, options) }));
50
49
  }
51
50
  catch {
52
51
  /* No figure library on this server or no right to read it: the tray has no Figure group. */
@@ -1 +1 @@
1
- {"version":3,"file":"figure-palette.js","sourceRoot":"","sources":["../client/figure-palette.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,mBAAmB,EAAE,MAA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AC,MAAM,CAAC;YACP,4FAA4F;QAC9F,CAAC;IACH,CAAC,CAAA;IACD,MAAM,IAAI,EAAE,CAAA;IACZ,sBAAsB,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC","sourcesContent":["/*\n * The figures this board server imported (ADR-0114), in a board modeller's tray. Every app whose boards place library\n * figures calls this once from its bootstrap and hands it its modeller's `registerGroup` -- the tray belongs to the\n * modeller the app uses, and an app may carry its own (fmsim).\n */\nimport gql from 'graphql-tag'\n\nimport { resolveUnknownTypes } from '@hatiolab/things-scene'\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { getPathInfo } from '@operato/utils'\n\nimport { figurePaletteGroupOf, placeableFigureTypes, type FigurePaletteGroup, type FigureTypeMapLine } from './figure-palette-group.js'\nimport { keepCurrentWithLibrary } from './figure-library-changed.js'\n\nexport * from './figure-palette-group.js'\n\nconst TYPE_MAP = gql`\n query {\n figureTypeMap {\n name\n release {\n ref\n name\n formatSupported\n item\n holder\n assetFormat\n dependencies\n }\n }\n }\n`\n\n/**\n * Asks the type map, registers the figures that can be placed, and gives the tray its \"Figure\" group -- now, and again\n * whenever the library changes (an import, an archive, another release chosen), so a figure imported while the app is\n * open is in the tray without a reload. A server with no figure library, or a user with no right to read it, gets no\n * group and no error: the tray simply has none.\n */\nexport async function registerFigurePalette(registerGroup: (group: FigurePaletteGroup) => void): Promise<void> {\n const read = async () => {\n try {\n const lines: FigureTypeMapLine[] = (await client.query({ query: TYPE_MAP, fetchPolicy: 'network-only' })).data?.figureTypeMap ?? []\n /*\n A figure placed from the tray must already be registered: the scene resolves types only when a board opens, and\n a type nobody registered is placed as the stand-in that cannot move. The figure provider registers them now.\n */\n const placeable = placeableFigureTypes(lines)\n if (placeable.length) await resolveUnknownTypes({ components: placeable.map(type => ({ type })) })\n\n const { contextPath } = getPathInfo(location.pathname)\n /* The modeller replaces a group registered under the same name, so a second read updates the tray in place. */\n registerGroup(figurePaletteGroupOf(lines, { contextPath, t: (key, options) => i18next.t(key, options) }))\n } catch {\n /* No figure library on this server or no right to read it: the tray has no Figure group. */\n }\n }\n await read()\n keepCurrentWithLibrary(read)\n}\n"]}
1
+ {"version":3,"file":"figure-palette.js","sourceRoot":"","sources":["../client/figure-palette.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAmD,MAAM,2BAA2B,CAAA;AACvI,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAE/D,cAAc,2BAA2B,CAAA;AAEzC,MAAM,QAAQ,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;CAenB,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,aAAkD;IAC5F,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;QACtB,IAAI,CAAC;YACH,MAAM,KAAK,GAAwB,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,aAAa,IAAI,EAAE,CAAA;YACnI;;;cAGE;YACF,MAAM,SAAS,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAA;YAC7C,IAAI,SAAS,CAAC,MAAM;gBAAE,MAAM,mBAAmB,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAA;YAElG,+GAA+G;YAC/G,aAAa,CAAC,oBAAoB,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAA;QAC7H,CAAC;QAAC,MAAM,CAAC;YACP,4FAA4F;QAC9F,CAAC;IACH,CAAC,CAAA;IACD,MAAM,IAAI,EAAE,CAAA;IACZ,sBAAsB,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC","sourcesContent":["/*\n * The figures this board server imported (ADR-0114), in a board modeller's tray. Every app whose boards place library\n * figures calls this once from its bootstrap and hands it its modeller's `registerGroup` -- the tray belongs to the\n * modeller the app uses, and an app may carry its own (fmsim).\n */\nimport gql from 'graphql-tag'\n\nimport { resolveUnknownTypes } from '@hatiolab/things-scene'\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\n\nimport { figurePaletteGroupOf, placeableFigureTypes, type FigurePaletteGroup, type FigureTypeMapLine } from './figure-palette-group.js'\nimport { keepCurrentWithLibrary } from './figure-library-changed.js'\nimport { figureLibraryFileUrl } from './figure-library-file.js'\n\nexport * from './figure-palette-group.js'\n\nconst TYPE_MAP = gql`\n query {\n figureTypeMap {\n name\n release {\n ref\n name\n formatSupported\n item\n holder\n assetFormat\n dependencies\n }\n }\n }\n`\n\n/**\n * Asks the type map, registers the figures that can be placed, and gives the tray its \"Figure\" group -- now, and again\n * whenever the library changes (an import, an archive, another release chosen), so a figure imported while the app is\n * open is in the tray without a reload. A server with no figure library, or a user with no right to read it, gets no\n * group and no error: the tray simply has none.\n */\nexport async function registerFigurePalette(registerGroup: (group: FigurePaletteGroup) => void): Promise<void> {\n const read = async () => {\n try {\n const lines: FigureTypeMapLine[] = (await client.query({ query: TYPE_MAP, fetchPolicy: 'network-only' })).data?.figureTypeMap ?? []\n /*\n A figure placed from the tray must already be registered: the scene resolves types only when a board opens, and\n a type nobody registered is placed as the stand-in that cannot move. The figure provider registers them now.\n */\n const placeable = placeableFigureTypes(lines)\n if (placeable.length) await resolveUnknownTypes({ components: placeable.map(type => ({ type })) })\n\n /* The modeller replaces a group registered under the same name, so a second read updates the tray in place. */\n registerGroup(figurePaletteGroupOf(lines, { fileUrl: figureLibraryFileUrl, t: (key, options) => i18next.t(key, options) }))\n } catch {\n /* No figure library on this server or no right to read it: the tray has no Figure group. */\n }\n }\n await read()\n keepCurrentWithLibrary(read)\n}\n"]}
@@ -1 +1,2 @@
1
1
  export * from './pages/figure-library-page';
2
+ export * from './figure-library-file';
@@ -1,2 +1,3 @@
1
1
  export * from './pages/figure-library-page';
2
+ export * from './figure-library-file';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA","sourcesContent":["export * from './pages/figure-library-page'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,uBAAuB,CAAA","sourcesContent":["export * from './pages/figure-library-page'\nexport * from './figure-library-file'\n"]}
@@ -19,8 +19,8 @@ import { QueryController } from '@operato/graphql';
19
19
  import { i18next } from '@operato/i18n';
20
20
  import { closePopup } from '@operato/popup';
21
21
  import { CommonPopupStyles, FormFieldStyles, PopupBodyStyles } from '@operato/styles';
22
- import { getPathInfo } from '@operato/utils';
23
22
  import { emptyRow, figureChoiceLabels, rowIssues } from './item-types-rows.js';
23
+ import { figureLibraryFileUrl } from '../figure-library-file.js';
24
24
  /* The names the domain draws as items, with the name and thumbnail of the release each draws with. */
25
25
  const ITEM_FIGURES = gql `
26
26
  query ($filters: [Filter!], $pagination: Pagination) {
@@ -276,13 +276,12 @@ let OxItemTypesInput = class OxItemTypesInput extends LitElement {
276
276
  if (!data)
277
277
  return null;
278
278
  if (this.choices?.of !== data) {
279
- const { contextPath } = getPathInfo(location.pathname);
280
279
  const items = data.figureLibraryFigures?.items ?? [];
281
280
  const labels = figureChoiceLabels(items.map((item) => ({ name: item.name, display: item.release?.name })));
282
281
  const figures = items
283
282
  .map((item) => {
284
283
  const hash = item.release?.dependencies?.find((d) => d.role === 'thumbnail')?.hash;
285
- return { name: item.name, label: labels.get(item.name), thumbnail: hash ? `${contextPath}/figure-library-file/${hash}` : '' };
284
+ return { name: item.name, label: labels.get(item.name), thumbnail: hash ? figureLibraryFileUrl(hash) : '' };
286
285
  })
287
286
  .sort((a, b) => a.label.localeCompare(b.label));
288
287
  this.choices = { of: data, figures };
@@ -1 +1 @@
1
- {"version":3,"file":"ox-item-types-input.js","sourceRoot":"","sources":["../../client/item-types/ox-item-types-input.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;AACH,OAAO,uCAAuC,CAAA;AAC9C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,4BAA4B,CAAA;AACnC,OAAO,oCAAoC,CAAA;AAE3C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAG5C,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAoB,MAAM,sBAAsB,CAAA;AAEhG,sGAAsG;AACtG,MAAM,YAAY,GAAG,GAAG,CAAA;;;;;;;;;;;;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,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;8CAAyB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAAgD;AAQ1D;IAAhB,KAAK,EAAE;;0DAA6C;AAxH1C,gBAAgB;IAD5B,aAAa,CAAC,qBAAqB,CAAC;GACxB,gBAAgB,CA6P5B","sourcesContent":["/*\n * The item type table of a domain (ADR-0155), edited in a popup from a theme of type item-types (fmsim: carrier-types):\n * one row per type -- code, name, the figure it is drawn by. A type has no size; an item is drawn at the size of the\n * place it sits in (amendment 1). The figure is chosen from the names the domain's library marks as items (amendment\n * 1 E · F), shown with their thumbnails. What does not hold is said on its row by things-scene's rule and the table is\n * not confirmed until it holds; a figure written before that is no longer marked is told on its row and does not stop it.\n *\n * The words are the module's translations; an app whose items are called otherwise (fmsim: carriers) says them its own way.\n */\nimport '@material/web/button/filled-button.js'\nimport '@material/web/button/text-button.js'\nimport '@material/web/icon/icon.js'\nimport '@operato/popup/ox-popup-actions.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { QueryController } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { closePopup } from '@operato/popup'\nimport { CommonPopupStyles, FormFieldStyles, PopupBodyStyles } from '@operato/styles'\nimport { getPathInfo } from '@operato/utils'\nimport type { ItemTypeIssue } from '@hatiolab/things-scene'\n\nimport { emptyRow, figureChoiceLabels, rowIssues, type ItemTypeRow } from './item-types-rows.js'\n\n/* The names the domain draws as items, with the name and thumbnail of the release each draws with. */\nconst ITEM_FIGURES = gql`\n query ($filters: [Filter!], $pagination: Pagination) {\n figureLibraryFigures(filters: $filters, pagination: $pagination) {\n items {\n name\n release {\n name\n dependencies\n }\n }\n }\n }\n`\n\n/** As many item figures as one domain is expected to have; the picker lists them all. */\nconst ITEM_FIGURE_LIMIT = 500\n\ninterface ItemFigure {\n name: string\n label: string\n thumbnail: string\n}\n\nconst t = (key: string, options?: Record<string, unknown>) => i18next.t(`figure-library.item-types.${key}`, options)\n\n/*\n * The house popup (operato-application design/ui/page-standard.md 7 · 8): CommonPopupStyles' card, only the body\n * scrolls (PopupBodyStyles), native fields at the table height (FormFieldStyles small), each row's problems right under\n * it, the row's own button at its end, and cancel · confirm in ox-popup-actions.\n */\n@customElement('ox-item-types-input')\nexport class OxItemTypesInput extends LitElement {\n static styles = [\n CommonPopupStyles,\n PopupBodyStyles,\n FormFieldStyles,\n css`\n :host {\n width: 100%;\n height: 100%;\n max-height: none;\n --popup-min-width: 0;\n }\n table {\n width: 100%;\n border-collapse: collapse;\n }\n th {\n position: sticky;\n top: 0;\n z-index: 1;\n background: var(--ui-bg, #ffffff);\n text-align: left;\n font-weight: normal;\n font-size: var(--popup-font-size-small);\n color: var(--ui-muted, #57676f);\n padding: 0 var(--spacing-small, 4px) var(--spacing-small, 4px);\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n white-space: nowrap;\n }\n td {\n padding: var(--spacing-small, 4px);\n vertical-align: middle;\n }\n tr[type] td {\n border-top: 1px solid var(--ui-line-soft, #eef1f3);\n }\n tr[issues] td {\n padding-top: 0;\n }\n /*\n Widths by what they hold (page-standard 7): a code is an identifier such as FORMATION_TRAY, wider than a\n quantity; a type's name is a few words; the figure takes the rest.\n */\n th[code],\n td[code] {\n width: 160px;\n }\n th[name],\n td[name] {\n width: 200px;\n }\n input,\n select {\n width: 100%;\n }\n td[thumb] {\n width: 32px;\n padding-right: 0;\n }\n [thumb] img,\n [thumb] [no-thumb] {\n display: grid;\n place-items: center;\n box-sizing: border-box;\n width: 32px;\n height: 32px;\n object-fit: contain;\n border-radius: var(--md-sys-shape-corner-small, 4px);\n background: var(--md-sys-color-surface-container, #eef1f3);\n color: var(--ui-muted, #57676f);\n --md-icon-size: 16px;\n }\n td[end] {\n width: 1%;\n text-align: right;\n }\n /* A row's own button: quiet, an icon with its name in the tooltip (page-standard 8). */\n button[quiet] {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-small, 4px);\n height: var(--form-element-height-small, 26px);\n padding: 0 var(--spacing-small, 4px);\n border: 0;\n border-radius: var(--md-sys-shape-corner-small, 4px);\n background: transparent;\n color: var(--ui-muted, #57676f);\n font: inherit;\n font-weight: 600;\n cursor: pointer;\n --md-icon-size: 16px;\n }\n button[quiet]:hover {\n background: var(--ui-line-soft, #eef1f3);\n color: var(--ui-ink, #17242c);\n }\n button[quiet][add] md-icon {\n color: var(--md-sys-color-primary);\n }\n [issue] {\n color: var(--ui-crit, var(--md-sys-color-error));\n font-size: var(--popup-font-size-small);\n }\n [warning] {\n color: var(--ui-muted, #57676f);\n font-size: var(--popup-font-size-small);\n }\n `\n ]\n\n /** The rows as typed; the popup's own copy (see the note in ox-popup-value-map-input on re-rendered popups). */\n @property({ type: Array }) rows: ItemTypeRow[] = []\n @property({ type: Object }) confirmCallback?: (rows: ItemTypeRow[]) => void\n\n /* The domain's item figures (ADR-0190). */\n private itemFigures = new QueryController(this, ITEM_FIGURES, {\n variables: () => ({ filters: [{ name: 'item', operator: 'eq', value: true }], pagination: { page: 1, limit: ITEM_FIGURE_LIMIT } })\n })\n private choices?: { of: unknown; figures: ItemFigure[] }\n /** Thumbnails that could not be drawn: the empty mark in their place, not a broken image. */\n @state() private unreadThumbnails = new Set<string>()\n\n render() {\n const issues = rowIssues(this.rows)\n return html`\n <div class=\"body\">\n ${this.figures?.length === 0 ? html`<div class=\"note\">${t('no-item-figures')}</div>` : nothing}\n <table>\n <thead>\n <tr>\n <th></th>\n <th code>${t('code')}</th>\n <th name>${t('name')}</th>\n <th>${t('figure')}</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n ${this.rows.map((row, i) => this.renderRow(row, i, issues.get(i) ?? []))}\n <tr>\n <td></td>\n <td colspan=\"4\"><button quiet add @click=${this.onAdd}><md-icon>add</md-icon>${t('add')}</button></td>\n </tr>\n </tbody>\n </table>\n ${issues.size ? html`<div class=\"failure\">${t('fix-rows', { count: issues.size })}</div>` : nothing}\n </div>\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${this.onCancel}>${i18next.t('button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" ?disabled=${issues.size > 0} @click=${this.onConfirm}>${i18next.t('button.confirm')}</md-filled-button>\n </ox-popup-actions>\n `\n }\n\n private renderRow(row: ItemTypeRow, i: number, issues: ItemTypeIssue[]) {\n const figures = this.figures ?? []\n const chosen = figures.find(f => f.name === row.figure)\n /* A figure written before that the library no longer marks as an item: kept as written, and told. */\n const unmarked = !!row.figure && this.figures !== null && !chosen\n const thumbnail = chosen?.thumbnail && !this.unreadThumbnails.has(chosen.thumbnail) ? chosen.thumbnail : ''\n return html`\n <tr type>\n <td thumb>\n ${thumbnail\n ? html`<img src=${thumbnail} alt=\"\" @error=${() => (this.unreadThumbnails = new Set([...this.unreadThumbnails, thumbnail]))} />`\n : html`<span no-thumb title=${row.figure ? t('no-thumbnail') : t('figure-none')}>\n <md-icon>${row.figure ? 'image_not_supported' : 'inventory_2'}</md-icon>\n </span>`}\n </td>\n <td code><input small .value=${row.code} data-row=${i} data-key=\"code\" @input=${this.onInput} /></td>\n <td name><input small .value=${row.name} data-row=${i} data-key=\"name\" @input=${this.onInput} /></td>\n <td>\n <select small data-row=${i} data-key=\"figure\" title=${row.figure} @change=${this.onInput}>\n <option value=\"\" ?selected=${!row.figure}>${t('figure-none')}</option>\n ${unmarked ? html`<option value=${row.figure} selected>${row.figure}</option>` : nothing}\n ${figures.map(f => html`<option value=${f.name} ?selected=${f.name === row.figure}>${f.label}</option>`)}\n </select>\n </td>\n <td end>\n <button quiet remove title=${t('remove')} aria-label=${t('remove')} data-row=${i} @click=${this.onRemove}><md-icon>delete</md-icon></button>\n </td>\n </tr>\n ${issues.length || unmarked\n ? html`<tr issues>\n <td></td>\n <td colspan=\"4\">\n ${issues.map(issue => html`<div issue>${this.issueText(issue)}</div>`)}\n ${unmarked ? html`<div warning>${t('figure-not-item')}</div>` : nothing}\n </td>\n </tr>`\n : nothing}\n `\n }\n\n /* A code that does not hold is invalid to the browser too: the shared field style outlines it once it is typed in (:user-invalid). */\n updated() {\n const issues = rowIssues(this.rows)\n this.renderRoot.querySelectorAll<HTMLInputElement>('input[data-key=\"code\"]').forEach(input => {\n const row = issues.get(Number(input.dataset.row))\n input.setCustomValidity(row?.length ? this.issueText(row[0]) : '')\n })\n }\n\n private issueText(issue: ItemTypeIssue): string {\n if (issue.code === 'item-type-duplicate') return t('issue.duplicate', { rows: issue.at.map(n => n + 1).join(', ') })\n return t(`issue.${issue.code.replace('item-type-', '')}`)\n }\n\n private onInput(e: Event) {\n const input = e.target as HTMLInputElement | HTMLSelectElement\n const i = Number(input.dataset.row)\n const key = input.dataset.key as keyof ItemTypeRow\n this.rows = this.rows.map((r, n) => (n === i ? { ...r, [key]: input.value } : r))\n }\n\n private onAdd() {\n this.rows = [...this.rows, emptyRow()]\n }\n\n private onRemove(e: Event) {\n const i = Number((e.currentTarget as HTMLElement).dataset.row)\n this.rows = this.rows.filter((_, n) => n !== i)\n }\n\n private onCancel() {\n closePopup(this)\n }\n\n private onConfirm() {\n if (rowIssues(this.rows).size) return\n this.confirmCallback?.(this.rows)\n closePopup(this)\n }\n\n /** The domain's item figures by display name; null until they are read, empty when the library cannot be read or marks none. */\n private get figures(): ItemFigure[] | null {\n if (this.itemFigures.error) return []\n const data = this.itemFigures.data\n if (!data) return null\n if (this.choices?.of !== data) {\n const { contextPath } = getPathInfo(location.pathname)\n const items = data.figureLibraryFigures?.items ?? []\n const labels = figureChoiceLabels(items.map((item: any) => ({ name: item.name, display: item.release?.name })))\n const figures = items\n .map((item: any) => {\n const hash = item.release?.dependencies?.find((d: any) => d.role === 'thumbnail')?.hash\n return { name: item.name, label: labels.get(item.name)!, thumbnail: hash ? `${contextPath}/figure-library-file/${hash}` : '' }\n })\n .sort((a: ItemFigure, b: ItemFigure) => a.label.localeCompare(b.label))\n this.choices = { of: data, figures }\n }\n return this.choices!.figures\n }\n}\n"]}
1
+ {"version":3,"file":"ox-item-types-input.js","sourceRoot":"","sources":["../../client/item-types/ox-item-types-input.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;AACH,OAAO,uCAAuC,CAAA;AAC9C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,4BAA4B,CAAA;AACnC,OAAO,oCAAoC,CAAA;AAE3C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGrF,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAoB,MAAM,sBAAsB,CAAA;AAChG,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAEhE,sGAAsG;AACtG,MAAM,YAAY,GAAG,GAAG,CAAA;;;;;;;;;;;;CAYvB,CAAA;AAED,yFAAyF;AACzF,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAQ7B,MAAM,CAAC,GAAG,CAAC,GAAW,EAAE,OAAiC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,6BAA6B,GAAG,EAAE,EAAE,OAAO,CAAC,CAAA;AAEpH;;;;GAIG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,UAAU;IAAzC;;QA8GL,gHAAgH;QACrF,SAAI,GAAkB,EAAE,CAAA;QAGnD,2CAA2C;QACnC,gBAAW,GAAG,IAAI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AAA;YAC/G,MAAM,OAAO,GAAG,KAAK;iBAClB,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE;gBACjB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,EAAE,IAAI,CAAA;gBACvF,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAE,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;YAC9G,CAAC,CAAC;iBACD,IAAI,CAAC,CAAC,CAAa,EAAE,CAAa,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;YACzE,IAAI,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;QACtC,CAAC;QACD,OAAO,IAAI,CAAC,OAAQ,CAAC,OAAO,CAAA;IAC9B,CAAC;;AA5I0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;8CAAyB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAAgD;AAQ1D;IAAhB,KAAK,EAAE;;0DAA6C;AAxH1C,gBAAgB;IAD5B,aAAa,CAAC,qBAAqB,CAAC;GACxB,gBAAgB,CA4P5B","sourcesContent":["/*\n * The item type table of a domain (ADR-0155), edited in a popup from a theme of type item-types (fmsim: carrier-types):\n * one row per type -- code, name, the figure it is drawn by. A type has no size; an item is drawn at the size of the\n * place it sits in (amendment 1). The figure is chosen from the names the domain's library marks as items (amendment\n * 1 E · F), shown with their thumbnails. What does not hold is said on its row by things-scene's rule and the table is\n * not confirmed until it holds; a figure written before that is no longer marked is told on its row and does not stop it.\n *\n * The words are the module's translations; an app whose items are called otherwise (fmsim: carriers) says them its own way.\n */\nimport '@material/web/button/filled-button.js'\nimport '@material/web/button/text-button.js'\nimport '@material/web/icon/icon.js'\nimport '@operato/popup/ox-popup-actions.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { QueryController } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { closePopup } from '@operato/popup'\nimport { CommonPopupStyles, FormFieldStyles, PopupBodyStyles } from '@operato/styles'\nimport type { ItemTypeIssue } from '@hatiolab/things-scene'\n\nimport { emptyRow, figureChoiceLabels, rowIssues, type ItemTypeRow } from './item-types-rows.js'\nimport { figureLibraryFileUrl } from '../figure-library-file.js'\n\n/* The names the domain draws as items, with the name and thumbnail of the release each draws with. */\nconst ITEM_FIGURES = gql`\n query ($filters: [Filter!], $pagination: Pagination) {\n figureLibraryFigures(filters: $filters, pagination: $pagination) {\n items {\n name\n release {\n name\n dependencies\n }\n }\n }\n }\n`\n\n/** As many item figures as one domain is expected to have; the picker lists them all. */\nconst ITEM_FIGURE_LIMIT = 500\n\ninterface ItemFigure {\n name: string\n label: string\n thumbnail: string\n}\n\nconst t = (key: string, options?: Record<string, unknown>) => i18next.t(`figure-library.item-types.${key}`, options)\n\n/*\n * The house popup (operato-application design/ui/page-standard.md 7 · 8): CommonPopupStyles' card, only the body\n * scrolls (PopupBodyStyles), native fields at the table height (FormFieldStyles small), each row's problems right under\n * it, the row's own button at its end, and cancel · confirm in ox-popup-actions.\n */\n@customElement('ox-item-types-input')\nexport class OxItemTypesInput extends LitElement {\n static styles = [\n CommonPopupStyles,\n PopupBodyStyles,\n FormFieldStyles,\n css`\n :host {\n width: 100%;\n height: 100%;\n max-height: none;\n --popup-min-width: 0;\n }\n table {\n width: 100%;\n border-collapse: collapse;\n }\n th {\n position: sticky;\n top: 0;\n z-index: 1;\n background: var(--ui-bg, #ffffff);\n text-align: left;\n font-weight: normal;\n font-size: var(--popup-font-size-small);\n color: var(--ui-muted, #57676f);\n padding: 0 var(--spacing-small, 4px) var(--spacing-small, 4px);\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n white-space: nowrap;\n }\n td {\n padding: var(--spacing-small, 4px);\n vertical-align: middle;\n }\n tr[type] td {\n border-top: 1px solid var(--ui-line-soft, #eef1f3);\n }\n tr[issues] td {\n padding-top: 0;\n }\n /*\n Widths by what they hold (page-standard 7): a code is an identifier such as FORMATION_TRAY, wider than a\n quantity; a type's name is a few words; the figure takes the rest.\n */\n th[code],\n td[code] {\n width: 160px;\n }\n th[name],\n td[name] {\n width: 200px;\n }\n input,\n select {\n width: 100%;\n }\n td[thumb] {\n width: 32px;\n padding-right: 0;\n }\n [thumb] img,\n [thumb] [no-thumb] {\n display: grid;\n place-items: center;\n box-sizing: border-box;\n width: 32px;\n height: 32px;\n object-fit: contain;\n border-radius: var(--md-sys-shape-corner-small, 4px);\n background: var(--md-sys-color-surface-container, #eef1f3);\n color: var(--ui-muted, #57676f);\n --md-icon-size: 16px;\n }\n td[end] {\n width: 1%;\n text-align: right;\n }\n /* A row's own button: quiet, an icon with its name in the tooltip (page-standard 8). */\n button[quiet] {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-small, 4px);\n height: var(--form-element-height-small, 26px);\n padding: 0 var(--spacing-small, 4px);\n border: 0;\n border-radius: var(--md-sys-shape-corner-small, 4px);\n background: transparent;\n color: var(--ui-muted, #57676f);\n font: inherit;\n font-weight: 600;\n cursor: pointer;\n --md-icon-size: 16px;\n }\n button[quiet]:hover {\n background: var(--ui-line-soft, #eef1f3);\n color: var(--ui-ink, #17242c);\n }\n button[quiet][add] md-icon {\n color: var(--md-sys-color-primary);\n }\n [issue] {\n color: var(--ui-crit, var(--md-sys-color-error));\n font-size: var(--popup-font-size-small);\n }\n [warning] {\n color: var(--ui-muted, #57676f);\n font-size: var(--popup-font-size-small);\n }\n `\n ]\n\n /** The rows as typed; the popup's own copy (see the note in ox-popup-value-map-input on re-rendered popups). */\n @property({ type: Array }) rows: ItemTypeRow[] = []\n @property({ type: Object }) confirmCallback?: (rows: ItemTypeRow[]) => void\n\n /* The domain's item figures (ADR-0190). */\n private itemFigures = new QueryController(this, ITEM_FIGURES, {\n variables: () => ({ filters: [{ name: 'item', operator: 'eq', value: true }], pagination: { page: 1, limit: ITEM_FIGURE_LIMIT } })\n })\n private choices?: { of: unknown; figures: ItemFigure[] }\n /** Thumbnails that could not be drawn: the empty mark in their place, not a broken image. */\n @state() private unreadThumbnails = new Set<string>()\n\n render() {\n const issues = rowIssues(this.rows)\n return html`\n <div class=\"body\">\n ${this.figures?.length === 0 ? html`<div class=\"note\">${t('no-item-figures')}</div>` : nothing}\n <table>\n <thead>\n <tr>\n <th></th>\n <th code>${t('code')}</th>\n <th name>${t('name')}</th>\n <th>${t('figure')}</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n ${this.rows.map((row, i) => this.renderRow(row, i, issues.get(i) ?? []))}\n <tr>\n <td></td>\n <td colspan=\"4\"><button quiet add @click=${this.onAdd}><md-icon>add</md-icon>${t('add')}</button></td>\n </tr>\n </tbody>\n </table>\n ${issues.size ? html`<div class=\"failure\">${t('fix-rows', { count: issues.size })}</div>` : nothing}\n </div>\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${this.onCancel}>${i18next.t('button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" ?disabled=${issues.size > 0} @click=${this.onConfirm}>${i18next.t('button.confirm')}</md-filled-button>\n </ox-popup-actions>\n `\n }\n\n private renderRow(row: ItemTypeRow, i: number, issues: ItemTypeIssue[]) {\n const figures = this.figures ?? []\n const chosen = figures.find(f => f.name === row.figure)\n /* A figure written before that the library no longer marks as an item: kept as written, and told. */\n const unmarked = !!row.figure && this.figures !== null && !chosen\n const thumbnail = chosen?.thumbnail && !this.unreadThumbnails.has(chosen.thumbnail) ? chosen.thumbnail : ''\n return html`\n <tr type>\n <td thumb>\n ${thumbnail\n ? html`<img src=${thumbnail} alt=\"\" @error=${() => (this.unreadThumbnails = new Set([...this.unreadThumbnails, thumbnail]))} />`\n : html`<span no-thumb title=${row.figure ? t('no-thumbnail') : t('figure-none')}>\n <md-icon>${row.figure ? 'image_not_supported' : 'inventory_2'}</md-icon>\n </span>`}\n </td>\n <td code><input small .value=${row.code} data-row=${i} data-key=\"code\" @input=${this.onInput} /></td>\n <td name><input small .value=${row.name} data-row=${i} data-key=\"name\" @input=${this.onInput} /></td>\n <td>\n <select small data-row=${i} data-key=\"figure\" title=${row.figure} @change=${this.onInput}>\n <option value=\"\" ?selected=${!row.figure}>${t('figure-none')}</option>\n ${unmarked ? html`<option value=${row.figure} selected>${row.figure}</option>` : nothing}\n ${figures.map(f => html`<option value=${f.name} ?selected=${f.name === row.figure}>${f.label}</option>`)}\n </select>\n </td>\n <td end>\n <button quiet remove title=${t('remove')} aria-label=${t('remove')} data-row=${i} @click=${this.onRemove}><md-icon>delete</md-icon></button>\n </td>\n </tr>\n ${issues.length || unmarked\n ? html`<tr issues>\n <td></td>\n <td colspan=\"4\">\n ${issues.map(issue => html`<div issue>${this.issueText(issue)}</div>`)}\n ${unmarked ? html`<div warning>${t('figure-not-item')}</div>` : nothing}\n </td>\n </tr>`\n : nothing}\n `\n }\n\n /* A code that does not hold is invalid to the browser too: the shared field style outlines it once it is typed in (:user-invalid). */\n updated() {\n const issues = rowIssues(this.rows)\n this.renderRoot.querySelectorAll<HTMLInputElement>('input[data-key=\"code\"]').forEach(input => {\n const row = issues.get(Number(input.dataset.row))\n input.setCustomValidity(row?.length ? this.issueText(row[0]) : '')\n })\n }\n\n private issueText(issue: ItemTypeIssue): string {\n if (issue.code === 'item-type-duplicate') return t('issue.duplicate', { rows: issue.at.map(n => n + 1).join(', ') })\n return t(`issue.${issue.code.replace('item-type-', '')}`)\n }\n\n private onInput(e: Event) {\n const input = e.target as HTMLInputElement | HTMLSelectElement\n const i = Number(input.dataset.row)\n const key = input.dataset.key as keyof ItemTypeRow\n this.rows = this.rows.map((r, n) => (n === i ? { ...r, [key]: input.value } : r))\n }\n\n private onAdd() {\n this.rows = [...this.rows, emptyRow()]\n }\n\n private onRemove(e: Event) {\n const i = Number((e.currentTarget as HTMLElement).dataset.row)\n this.rows = this.rows.filter((_, n) => n !== i)\n }\n\n private onCancel() {\n closePopup(this)\n }\n\n private onConfirm() {\n if (rowIssues(this.rows).size) return\n this.confirmCallback?.(this.rows)\n closePopup(this)\n }\n\n /** The domain's item figures by display name; null until they are read, empty when the library cannot be read or marks none. */\n private get figures(): ItemFigure[] | null {\n if (this.itemFigures.error) return []\n const data = this.itemFigures.data\n if (!data) return null\n if (this.choices?.of !== data) {\n const items = data.figureLibraryFigures?.items ?? []\n const labels = figureChoiceLabels(items.map((item: any) => ({ name: item.name, display: item.release?.name })))\n const figures = items\n .map((item: any) => {\n const hash = item.release?.dependencies?.find((d: any) => d.role === 'thumbnail')?.hash\n return { name: item.name, label: labels.get(item.name)!, thumbnail: hash ? figureLibraryFileUrl(hash) : '' }\n })\n .sort((a: ItemFigure, b: ItemFigure) => a.label.localeCompare(b.label))\n this.choices = { of: data, figures }\n }\n return this.choices!.figures\n }\n}\n"]}
@@ -14,7 +14,7 @@ import { i18next, localize } from '@operato/i18n';
14
14
  import { openPopup } from '@operato/popup';
15
15
  import { PageView } from '@operato/shell';
16
16
  import { CardCatalogStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
17
- import { getPathInfo } from '@operato/utils';
17
+ import { figureLibraryFileUrl } from '../figure-library-file.js';
18
18
  /*
19
19
  * The board server's figures (ADR-0114, amended 2026-10-12), as a card catalogue with the board catalog's card: the
20
20
  * thumbnail, the name, and one line - the full name and the version it draws with. The one thing to know before opening
@@ -226,10 +226,9 @@ let FigureLibraryPage = class FigureLibraryPage extends localize(i18next)(PageVi
226
226
  /** The picture cell every catalog card draws, with the one marker this figure needs. */
227
227
  thumbnailOf(record) {
228
228
  const hash = (record?.release ?? record?.latest)?.dependencies?.find((d) => d.role === 'thumbnail')?.hash;
229
- const { contextPath } = getPathInfo(location.pathname);
230
229
  const [badge, tone] = this.markerOf(record);
231
230
  return html `<ox-card-thumb
232
- src=${hash ? `${contextPath}/figure-library-file/${hash}` : ''}
231
+ src=${hash ? figureLibraryFileUrl(hash) : ''}
233
232
  alt=${(record?.release ?? record?.latest)?.name ?? ''}
234
233
  badge=${badge}
235
234
  tone=${tone}
@@ -1 +1 @@
1
- {"version":3,"file":"figure-library-page.js","sourceRoot":"","sources":["../../client/pages/figure-library-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,sCAAsC,CAAA;AAC7C,OAAO,gEAAgE,CAAA;AACvE,OAAO,uCAAuC,CAAA;AAC9C,OAAO,uCAAuC,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAE5D,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAW,MAAM,KAAK,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAClI,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C;;;;;;;;;GASG;AAEH,MA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BAAiB,CA+N7B","sourcesContent":["import '@operato/data-grist'\nimport '@operato/data-grist/ox-card-thumb.js'\nimport '@things-factory/figure-viewer/dist-client/figure-thumb-mark.js'\nimport '../viewparts/figure-releases-popup.js'\nimport '../viewparts/figure-package-import.js'\nimport { versionText } from '../viewparts/figure-version.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, nothing } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/popup'\nimport { PageView } from '@operato/shell'\nimport { CardCatalogStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { getPathInfo } from '@operato/utils'\n\n/*\n * The board server's figures (ADR-0114, amended 2026-10-12), as a card catalogue with the board catalog's card: the\n * thumbnail, the name, and one line - the full name and the version it draws with. The one thing to know before opening\n * a card is its corner marker: cannot be read here, not drawing the latest, or deprecated. Clicking a card opens its\n * releases side by side to compare them and choose the one it draws with.\n *\n * The library is expected to grow to many figures, so the list pages from the server and the filters (category,\n * capability) are drop-down lists in the filter bar beside the name search. Upload, the screen's one primary action, is\n * the FAB; it opens a popup whose drop box takes the package and says what it came to.\n */\n\nconst FIGURES = gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: figureLibraryFigures(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n name\n archivedAt\n item\n latestVersion\n releaseCount\n release {\n id\n name\n version\n category\n capabilities\n formatSupported\n deprecated\n dependencies\n }\n latest {\n id\n name\n version\n formatSupported\n dependencies\n }\n }\n total\n }\n }\n`\n\nconst FACETS = gql`\n query {\n figureLibraryFacets {\n categories\n uncategorized\n capabilities\n incapable\n }\n }\n`\n\n/** The filter value for a figure with no category, or one that declares no capability. */\nconst NONE = '-'\n\n@customElement('figure-library-page')\nexport class FigureLibraryPage extends localize(i18next)(PageView) {\n static styles = [\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n /* The card, its picture cell and the upload FAB: every card catalog's (ADR-0117 amendment 2026-10-13). */\n CardCatalogStyles,\n css`\n ox-filters-form {\n flex: 1;\n }\n `\n ]\n\n @state() private gristConfig: any\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('figure-library.title'),\n search: {\n placeholder: i18next.t('figure-library.text.search'),\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n }\n }\n }\n\n render() {\n return html`\n <ox-grist class=\"page-fill\" mode=\"CARD\" .config=${this.gristConfig} .fetchHandler=${this.fetchHandler}>\n <div slot=\"headroom\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n </div>\n </ox-grist>\n\n <button fab @click=${() => this.openImport()}>\n <md-icon>upload_file</md-icon>${i18next.t('figure-library.button.upload')}\n </button>\n `\n }\n\n async pageInitialized() {\n await this.configure()\n }\n\n /*\n * The filter options are read once here (and again after an import), never per render: an async options function\n * runs on every render of the filter bar and replaces the open list's options under the pointer.\n */\n private async configure() {\n const { categories, capabilities } = await this.facets()\n this.gristConfig = {\n list: {\n thumbnail: 'thumbnail',\n fields: ['title', 'meta'],\n details: []\n },\n columns: [\n {\n type: 'image',\n name: 'thumbnail',\n record: { editable: false, renderEmpty: true, renderer: (_value, _column, record) => this.thumbnailOf(record) }\n },\n {\n type: 'string',\n name: 'title',\n record: {\n editable: false,\n renderer: (_value, _column, record) => (record.release ?? record.latest).name\n }\n },\n {\n type: 'string',\n name: 'meta',\n record: { editable: false, renderer: (_value, _column, record) => this.metaOf(record) }\n },\n { type: 'string', name: 'name', hidden: true, record: { editable: false }, filter: 'search' },\n {\n type: 'select',\n name: 'category',\n header: i18next.t('figure-library.label.category'),\n hidden: true,\n record: { editable: false },\n filter: { operator: 'eq', options: categories }\n },\n {\n type: 'select',\n name: 'capability',\n header: i18next.t('figure-library.label.capability'),\n hidden: true,\n record: { editable: false },\n filter: { operator: 'eq', options: capabilities }\n },\n /* Only the names this domain draws as items (ADR-0155 개정 1 E): what an item type table picks a look from. */\n {\n type: 'boolean',\n name: 'item',\n header: i18next.t('figure-library.label.item-only'),\n hidden: true,\n record: { editable: false },\n filter: { operator: 'eq' }\n },\n /* Archived figures are left out unless this box is checked (ADR-0114 결정 18, 화면; user 2026-10-22). */\n {\n type: 'boolean',\n name: 'archived',\n header: i18next.t('figure-library.label.archived'),\n hidden: true,\n record: { editable: false },\n filter: { operator: 'eq' }\n }\n ],\n rows: {\n selectable: false,\n appendable: false,\n handlers: {\n click: (_columns, _data, _column, record) => record && this.openReleases(record)\n }\n },\n pagination: { pages: [24, 48, 96] }\n }\n }\n\n async pageUpdated() {\n if (this.active) this.grist?.fetch()\n }\n\n private fetchHandler = async ({ page = 1, limit = 24, filters = [] }: FetchOption) => {\n const response = await client.query({\n query: FIGURES,\n variables: {\n /* The name search arrives as %text%; the server matches parts itself. */\n filters: filters\n .filter(filter => filter.value !== undefined && filter.value !== '' && !(Array.isArray(filter.value) && !filter.value.length))\n .map(filter => ({ ...filter, value: typeof filter.value === 'string' ? filter.value.replace(/^%|%$/g, '') : filter.value })),\n pagination: { page, limit }\n },\n fetchPolicy: 'network-only'\n })\n return { total: response.data.responses.total || 0, records: response.data.responses.items || [] }\n }\n\n /** The filter options, from what the figures that draw carry. */\n private async facets() {\n const response = await client.query({ query: FACETS, fetchPolicy: 'network-only' })\n const facets = response.data?.figureLibraryFacets ?? { categories: [], capabilities: [] }\n return {\n categories: [\n ...facets.categories.map((value: string) => ({ display: value, value })),\n ...(facets.uncategorized ? [{ display: i18next.t('figure-library.text.no-category'), value: NONE }] : [])\n ],\n capabilities: [\n ...facets.capabilities.map((value: string) => ({ display: i18next.t(`figure.label.role-${value}`, { defaultValue: value }), value })),\n ...(facets.incapable ? [{ display: i18next.t('figure-library.text.no-capability'), value: NONE }] : [])\n ]\n }\n }\n\n /** The picture cell every catalog card draws, with the one marker this figure needs. */\n private thumbnailOf(record: any) {\n const hash = (record?.release ?? record?.latest)?.dependencies?.find((d: any) => d.role === 'thumbnail')?.hash\n const { contextPath } = getPathInfo(location.pathname)\n const [badge, tone] = this.markerOf(record)\n return html`<ox-card-thumb\n src=${hash ? `${contextPath}/figure-library-file/${hash}` : ''}\n alt=${(record?.release ?? record?.latest)?.name ?? ''}\n badge=${badge}\n tone=${tone}\n >\n <figure-thumb-mark slot=\"empty\" .label=${i18next.t('figure-library.text.no-thumbnail')}></figure-thumb-mark>\n </ox-card-thumb>`\n }\n\n /**\n * The one thing a card says before it is opened, the gravest first: it is archived, nothing here can draw it, it does\n * not draw its latest release, or the release it draws is deprecated. A figure drawing its latest says nothing.\n */\n private markerOf(record: any): [string, 'plain' | 'warn' | 'crit'] {\n if (record?.archivedAt) return [i18next.t('figure-library.text.archived'), 'plain']\n const release = record?.release\n if (!release) return [i18next.t('figure-library.text.format-unsupported'), 'crit']\n if (release.version !== record.latestVersion) return [i18next.t('figure-library.text.not-latest'), 'warn']\n if (release.deprecated) return [i18next.t('figure-library.text.deprecated'), 'plain']\n return ['', 'plain']\n }\n\n /** The line under the name: the full name and the version it draws with, as a board card's 「v1 · 3일 전」, and whether it is an item. */\n private metaOf(record: any): string {\n const line = record?.release ? `${record.name} · ${versionText(record.release.version)}` : record?.name ?? ''\n return record?.item ? `${line} · ${i18next.t('figure-library.text.item')}` : line\n }\n\n private openReleases(record: any) {\n openPopup(\n html`<figure-releases-popup\n .name=${record.name}\n .drawing=${record.release?.id ?? ''}\n .archived=${!!record.archivedAt}\n @saved=${() => this.grist.fetch()}\n ></figure-releases-popup>`,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('figure-library.title.releases-of', { name: (record.release ?? record.latest).name, count: record.releaseCount })\n }\n )\n }\n\n private openImport() {\n openPopup(\n html`<figure-package-import\n @imported=${async () => {\n await this.configure()\n this.grist.fetch()\n }}\n ></figure-package-import>`,\n { backdrop: true, size: 'small', closable: true, title: i18next.t('figure-library.button.upload') }\n )\n }\n}\n"]}
1
+ {"version":3,"file":"figure-library-page.js","sourceRoot":"","sources":["../../client/pages/figure-library-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,sCAAsC,CAAA;AAC7C,OAAO,gEAAgE,CAAA;AACvE,OAAO,uCAAuC,CAAA;AAC9C,OAAO,uCAAuC,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAE5D,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAW,MAAM,KAAK,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAElI,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAEhE;;;;;;;;;GASG;AAEH,MAAM,OAAO,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BlB,CAAA;AAED,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;CASjB,CAAA;AAED,0FAA0F;AAC1F,MAAM,IAAI,GAAG,GAAG,CAAA;AAGT,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IAA3D;;QAmIG,iBAAY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,CAAC,UAAU;iBACtB,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;gCACT,EAC1B;YACE,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,kCAAkC,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC;SACnI,CACF,CAAA;IACH,CAAC;IAEO,UAAU;QAChB,SAAS,CACP,IAAI,CAAA;oBACU,KAAK,IAAI,EAAE;YACrB,MAAM,IAAI,CAAC,SAAS,EAAE,CAAA;YACtB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC;gCACuB,EAC1B,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,8BAA8B,CAAC,EAAE,CACpG,CAAA;IACH,CAAC;;AA9MgB;IAAhB,KAAK,EAAE;;sDAAyB;AACN;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;gDAAA;AAhBjC,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CA8N7B","sourcesContent":["import '@operato/data-grist'\nimport '@operato/data-grist/ox-card-thumb.js'\nimport '@things-factory/figure-viewer/dist-client/figure-thumb-mark.js'\nimport '../viewparts/figure-releases-popup.js'\nimport '../viewparts/figure-package-import.js'\nimport { versionText } from '../viewparts/figure-version.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, nothing } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/popup'\nimport { PageView } from '@operato/shell'\nimport { CardCatalogStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\n\nimport { figureLibraryFileUrl } from '../figure-library-file.js'\n\n/*\n * The board server's figures (ADR-0114, amended 2026-10-12), as a card catalogue with the board catalog's card: the\n * thumbnail, the name, and one line - the full name and the version it draws with. The one thing to know before opening\n * a card is its corner marker: cannot be read here, not drawing the latest, or deprecated. Clicking a card opens its\n * releases side by side to compare them and choose the one it draws with.\n *\n * The library is expected to grow to many figures, so the list pages from the server and the filters (category,\n * capability) are drop-down lists in the filter bar beside the name search. Upload, the screen's one primary action, is\n * the FAB; it opens a popup whose drop box takes the package and says what it came to.\n */\n\nconst FIGURES = gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: figureLibraryFigures(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n name\n archivedAt\n item\n latestVersion\n releaseCount\n release {\n id\n name\n version\n category\n capabilities\n formatSupported\n deprecated\n dependencies\n }\n latest {\n id\n name\n version\n formatSupported\n dependencies\n }\n }\n total\n }\n }\n`\n\nconst FACETS = gql`\n query {\n figureLibraryFacets {\n categories\n uncategorized\n capabilities\n incapable\n }\n }\n`\n\n/** The filter value for a figure with no category, or one that declares no capability. */\nconst NONE = '-'\n\n@customElement('figure-library-page')\nexport class FigureLibraryPage extends localize(i18next)(PageView) {\n static styles = [\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n /* The card, its picture cell and the upload FAB: every card catalog's (ADR-0117 amendment 2026-10-13). */\n CardCatalogStyles,\n css`\n ox-filters-form {\n flex: 1;\n }\n `\n ]\n\n @state() private gristConfig: any\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('figure-library.title'),\n search: {\n placeholder: i18next.t('figure-library.text.search'),\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n }\n }\n }\n\n render() {\n return html`\n <ox-grist class=\"page-fill\" mode=\"CARD\" .config=${this.gristConfig} .fetchHandler=${this.fetchHandler}>\n <div slot=\"headroom\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n </div>\n </ox-grist>\n\n <button fab @click=${() => this.openImport()}>\n <md-icon>upload_file</md-icon>${i18next.t('figure-library.button.upload')}\n </button>\n `\n }\n\n async pageInitialized() {\n await this.configure()\n }\n\n /*\n * The filter options are read once here (and again after an import), never per render: an async options function\n * runs on every render of the filter bar and replaces the open list's options under the pointer.\n */\n private async configure() {\n const { categories, capabilities } = await this.facets()\n this.gristConfig = {\n list: {\n thumbnail: 'thumbnail',\n fields: ['title', 'meta'],\n details: []\n },\n columns: [\n {\n type: 'image',\n name: 'thumbnail',\n record: { editable: false, renderEmpty: true, renderer: (_value, _column, record) => this.thumbnailOf(record) }\n },\n {\n type: 'string',\n name: 'title',\n record: {\n editable: false,\n renderer: (_value, _column, record) => (record.release ?? record.latest).name\n }\n },\n {\n type: 'string',\n name: 'meta',\n record: { editable: false, renderer: (_value, _column, record) => this.metaOf(record) }\n },\n { type: 'string', name: 'name', hidden: true, record: { editable: false }, filter: 'search' },\n {\n type: 'select',\n name: 'category',\n header: i18next.t('figure-library.label.category'),\n hidden: true,\n record: { editable: false },\n filter: { operator: 'eq', options: categories }\n },\n {\n type: 'select',\n name: 'capability',\n header: i18next.t('figure-library.label.capability'),\n hidden: true,\n record: { editable: false },\n filter: { operator: 'eq', options: capabilities }\n },\n /* Only the names this domain draws as items (ADR-0155 개정 1 E): what an item type table picks a look from. */\n {\n type: 'boolean',\n name: 'item',\n header: i18next.t('figure-library.label.item-only'),\n hidden: true,\n record: { editable: false },\n filter: { operator: 'eq' }\n },\n /* Archived figures are left out unless this box is checked (ADR-0114 결정 18, 화면; user 2026-10-22). */\n {\n type: 'boolean',\n name: 'archived',\n header: i18next.t('figure-library.label.archived'),\n hidden: true,\n record: { editable: false },\n filter: { operator: 'eq' }\n }\n ],\n rows: {\n selectable: false,\n appendable: false,\n handlers: {\n click: (_columns, _data, _column, record) => record && this.openReleases(record)\n }\n },\n pagination: { pages: [24, 48, 96] }\n }\n }\n\n async pageUpdated() {\n if (this.active) this.grist?.fetch()\n }\n\n private fetchHandler = async ({ page = 1, limit = 24, filters = [] }: FetchOption) => {\n const response = await client.query({\n query: FIGURES,\n variables: {\n /* The name search arrives as %text%; the server matches parts itself. */\n filters: filters\n .filter(filter => filter.value !== undefined && filter.value !== '' && !(Array.isArray(filter.value) && !filter.value.length))\n .map(filter => ({ ...filter, value: typeof filter.value === 'string' ? filter.value.replace(/^%|%$/g, '') : filter.value })),\n pagination: { page, limit }\n },\n fetchPolicy: 'network-only'\n })\n return { total: response.data.responses.total || 0, records: response.data.responses.items || [] }\n }\n\n /** The filter options, from what the figures that draw carry. */\n private async facets() {\n const response = await client.query({ query: FACETS, fetchPolicy: 'network-only' })\n const facets = response.data?.figureLibraryFacets ?? { categories: [], capabilities: [] }\n return {\n categories: [\n ...facets.categories.map((value: string) => ({ display: value, value })),\n ...(facets.uncategorized ? [{ display: i18next.t('figure-library.text.no-category'), value: NONE }] : [])\n ],\n capabilities: [\n ...facets.capabilities.map((value: string) => ({ display: i18next.t(`figure.label.role-${value}`, { defaultValue: value }), value })),\n ...(facets.incapable ? [{ display: i18next.t('figure-library.text.no-capability'), value: NONE }] : [])\n ]\n }\n }\n\n /** The picture cell every catalog card draws, with the one marker this figure needs. */\n private thumbnailOf(record: any) {\n const hash = (record?.release ?? record?.latest)?.dependencies?.find((d: any) => d.role === 'thumbnail')?.hash\n const [badge, tone] = this.markerOf(record)\n return html`<ox-card-thumb\n src=${hash ? figureLibraryFileUrl(hash) : ''}\n alt=${(record?.release ?? record?.latest)?.name ?? ''}\n badge=${badge}\n tone=${tone}\n >\n <figure-thumb-mark slot=\"empty\" .label=${i18next.t('figure-library.text.no-thumbnail')}></figure-thumb-mark>\n </ox-card-thumb>`\n }\n\n /**\n * The one thing a card says before it is opened, the gravest first: it is archived, nothing here can draw it, it does\n * not draw its latest release, or the release it draws is deprecated. A figure drawing its latest says nothing.\n */\n private markerOf(record: any): [string, 'plain' | 'warn' | 'crit'] {\n if (record?.archivedAt) return [i18next.t('figure-library.text.archived'), 'plain']\n const release = record?.release\n if (!release) return [i18next.t('figure-library.text.format-unsupported'), 'crit']\n if (release.version !== record.latestVersion) return [i18next.t('figure-library.text.not-latest'), 'warn']\n if (release.deprecated) return [i18next.t('figure-library.text.deprecated'), 'plain']\n return ['', 'plain']\n }\n\n /** The line under the name: the full name and the version it draws with, as a board card's 「v1 · 3일 전」, and whether it is an item. */\n private metaOf(record: any): string {\n const line = record?.release ? `${record.name} · ${versionText(record.release.version)}` : record?.name ?? ''\n return record?.item ? `${line} · ${i18next.t('figure-library.text.item')}` : line\n }\n\n private openReleases(record: any) {\n openPopup(\n html`<figure-releases-popup\n .name=${record.name}\n .drawing=${record.release?.id ?? ''}\n .archived=${!!record.archivedAt}\n @saved=${() => this.grist.fetch()}\n ></figure-releases-popup>`,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('figure-library.title.releases-of', { name: (record.release ?? record.latest).name, count: record.releaseCount })\n }\n )\n }\n\n private openImport() {\n openPopup(\n html`<figure-package-import\n @imported=${async () => {\n await this.configure()\n this.grist.fetch()\n }}\n ></figure-package-import>`,\n { backdrop: true, size: 'small', closable: true, title: i18next.t('figure-library.button.upload') }\n )\n }\n}\n"]}