@collabdt/core 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/core/components/AppSidebarContent.d.ts.map +1 -1
  2. package/dist/core/components/AppSidebarContent.js +3 -2
  3. package/dist/core/components/AppSidebarContent.js.map +1 -1
  4. package/dist/core/components/viewers/plugins/src/PluginCard.d.ts.map +1 -1
  5. package/dist/core/components/viewers/plugins/src/PluginCard.js +19 -36
  6. package/dist/core/components/viewers/plugins/src/PluginCard.js.map +1 -1
  7. package/dist/core/plugins/hello-bim/src/components/SpaceDialog.d.ts.map +1 -0
  8. package/dist/core/plugins/hello-bim/{components → src/components}/SpaceDialog.js +3 -3
  9. package/dist/core/plugins/hello-bim/src/components/SpaceDialog.js.map +1 -0
  10. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesLegend.d.ts +1 -1
  11. package/dist/core/plugins/hello-bim/src/components/SpacesLegend.d.ts.map +1 -0
  12. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesLegend.js +1 -1
  13. package/dist/core/plugins/hello-bim/src/components/SpacesLegend.js.map +1 -0
  14. package/dist/core/plugins/hello-bim/src/components/SpacesTab.d.ts.map +1 -0
  15. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesTab.js +5 -5
  16. package/dist/core/plugins/hello-bim/src/components/SpacesTab.js.map +1 -0
  17. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesTool.d.ts +1 -2
  18. package/dist/core/plugins/hello-bim/src/components/SpacesTool.d.ts.map +1 -0
  19. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesTool.js +2 -2
  20. package/dist/core/plugins/hello-bim/src/components/SpacesTool.js.map +1 -0
  21. package/dist/core/plugins/hello-bim/src/components/icons.d.ts.map +1 -0
  22. package/dist/core/plugins/hello-bim/src/components/icons.js.map +1 -0
  23. package/dist/core/plugins/hello-bim/src/index.d.ts +10 -0
  24. package/dist/core/plugins/hello-bim/src/index.d.ts.map +1 -0
  25. package/dist/core/plugins/hello-bim/{index.js → src/index.js} +2 -3
  26. package/dist/core/plugins/hello-bim/src/index.js.map +1 -0
  27. package/dist/core/plugins/hello-bim/{spaces.d.ts → src/spaces.d.ts} +1 -1
  28. package/dist/core/plugins/hello-bim/src/spaces.d.ts.map +1 -0
  29. package/dist/core/plugins/hello-bim/{spaces.js → src/spaces.js} +4 -4
  30. package/dist/core/plugins/hello-bim/src/spaces.js.map +1 -0
  31. package/dist/core/plugins/hello-map/{components → src/components}/MapTool.d.ts +1 -2
  32. package/dist/core/plugins/hello-map/src/components/MapTool.d.ts.map +1 -0
  33. package/dist/core/plugins/hello-map/{components → src/components}/MapTool.js +3 -3
  34. package/dist/core/plugins/hello-map/src/components/MapTool.js.map +1 -0
  35. package/dist/core/plugins/hello-map/src/components/MarkerDialog.d.ts.map +1 -0
  36. package/dist/core/plugins/hello-map/{components → src/components}/MarkerDialog.js +2 -2
  37. package/dist/core/plugins/hello-map/src/components/MarkerDialog.js.map +1 -0
  38. package/dist/core/plugins/hello-map/{components → src/components}/MarkersLayer.d.ts +1 -1
  39. package/dist/core/plugins/hello-map/src/components/MarkersLayer.d.ts.map +1 -0
  40. package/dist/core/plugins/hello-map/{components → src/components}/MarkersLayer.js +1 -1
  41. package/dist/core/plugins/hello-map/src/components/MarkersLayer.js.map +1 -0
  42. package/dist/core/plugins/hello-map/{components → src/components}/MarkersLegend.d.ts +1 -1
  43. package/dist/core/plugins/hello-map/src/components/MarkersLegend.d.ts.map +1 -0
  44. package/dist/core/plugins/hello-map/{components → src/components}/MarkersLegend.js +1 -1
  45. package/dist/core/plugins/hello-map/src/components/MarkersLegend.js.map +1 -0
  46. package/dist/core/plugins/hello-map/{components → src/components}/MarkersPage.d.ts +1 -1
  47. package/dist/core/plugins/hello-map/src/components/MarkersPage.d.ts.map +1 -0
  48. package/dist/core/plugins/hello-map/{components → src/components}/MarkersPage.js +1 -1
  49. package/dist/core/plugins/hello-map/src/components/MarkersPage.js.map +1 -0
  50. package/dist/core/plugins/hello-map/src/components/MarkersTab.d.ts.map +1 -0
  51. package/dist/core/plugins/hello-map/{components → src/components}/MarkersTab.js +4 -4
  52. package/dist/core/plugins/hello-map/src/components/MarkersTab.js.map +1 -0
  53. package/dist/core/plugins/hello-map/src/index.d.ts +10 -0
  54. package/dist/core/plugins/hello-map/src/index.d.ts.map +1 -0
  55. package/dist/core/plugins/hello-map/{index.js → src/index.js} +2 -3
  56. package/dist/core/plugins/hello-map/src/index.js.map +1 -0
  57. package/dist/core/plugins/hello-map/src/markers.d.ts.map +1 -0
  58. package/dist/core/plugins/hello-map/{markers.js → src/markers.js} +3 -3
  59. package/dist/core/plugins/hello-map/src/markers.js.map +1 -0
  60. package/dist/core/plugins/host/context.js.map +1 -1
  61. package/dist/core/plugins/host/pluginIcon.js.map +1 -1
  62. package/dist/core/plugins/host/runtimeShims.js.map +1 -1
  63. package/dist/core/plugins/installed.js +2 -2
  64. package/dist/core/plugins/installed.js.map +1 -1
  65. package/dist/core/plugins/manifests.js.map +1 -1
  66. package/dist/core/plugins/sdk/types.d.ts +9 -4
  67. package/dist/core/plugins/sdk/types.d.ts.map +1 -1
  68. package/dist/core/plugins/sdk/types.js.map +1 -1
  69. package/package.json +2 -1
  70. package/dist/core/plugins/hello-bim/components/SpaceDialog.d.ts.map +0 -1
  71. package/dist/core/plugins/hello-bim/components/SpaceDialog.js.map +0 -1
  72. package/dist/core/plugins/hello-bim/components/SpacesLegend.d.ts.map +0 -1
  73. package/dist/core/plugins/hello-bim/components/SpacesLegend.js.map +0 -1
  74. package/dist/core/plugins/hello-bim/components/SpacesTab.d.ts.map +0 -1
  75. package/dist/core/plugins/hello-bim/components/SpacesTab.js.map +0 -1
  76. package/dist/core/plugins/hello-bim/components/SpacesTool.d.ts.map +0 -1
  77. package/dist/core/plugins/hello-bim/components/SpacesTool.js.map +0 -1
  78. package/dist/core/plugins/hello-bim/components/icons.d.ts.map +0 -1
  79. package/dist/core/plugins/hello-bim/components/icons.js.map +0 -1
  80. package/dist/core/plugins/hello-bim/index.d.ts +0 -7
  81. package/dist/core/plugins/hello-bim/index.d.ts.map +0 -1
  82. package/dist/core/plugins/hello-bim/index.js.map +0 -1
  83. package/dist/core/plugins/hello-bim/spaces.d.ts.map +0 -1
  84. package/dist/core/plugins/hello-bim/spaces.js.map +0 -1
  85. package/dist/core/plugins/hello-map/components/MapTool.d.ts.map +0 -1
  86. package/dist/core/plugins/hello-map/components/MapTool.js.map +0 -1
  87. package/dist/core/plugins/hello-map/components/MarkerDialog.d.ts.map +0 -1
  88. package/dist/core/plugins/hello-map/components/MarkerDialog.js.map +0 -1
  89. package/dist/core/plugins/hello-map/components/MarkersLayer.d.ts.map +0 -1
  90. package/dist/core/plugins/hello-map/components/MarkersLayer.js.map +0 -1
  91. package/dist/core/plugins/hello-map/components/MarkersLegend.d.ts.map +0 -1
  92. package/dist/core/plugins/hello-map/components/MarkersLegend.js.map +0 -1
  93. package/dist/core/plugins/hello-map/components/MarkersPage.d.ts.map +0 -1
  94. package/dist/core/plugins/hello-map/components/MarkersPage.js.map +0 -1
  95. package/dist/core/plugins/hello-map/components/MarkersTab.d.ts.map +0 -1
  96. package/dist/core/plugins/hello-map/components/MarkersTab.js.map +0 -1
  97. package/dist/core/plugins/hello-map/index.d.ts +0 -7
  98. package/dist/core/plugins/hello-map/index.d.ts.map +0 -1
  99. package/dist/core/plugins/hello-map/index.js.map +0 -1
  100. package/dist/core/plugins/hello-map/markers.d.ts.map +0 -1
  101. package/dist/core/plugins/hello-map/markers.js.map +0 -1
  102. /package/dist/core/plugins/hello-bim/{components → src/components}/SpaceDialog.d.ts +0 -0
  103. /package/dist/core/plugins/hello-bim/{components → src/components}/SpacesTab.d.ts +0 -0
  104. /package/dist/core/plugins/hello-bim/{components → src/components}/icons.d.ts +0 -0
  105. /package/dist/core/plugins/hello-bim/{components → src/components}/icons.js +0 -0
  106. /package/dist/core/plugins/hello-map/{components → src/components}/MarkerDialog.d.ts +0 -0
  107. /package/dist/core/plugins/hello-map/{components → src/components}/MarkersTab.d.ts +0 -0
  108. /package/dist/core/plugins/hello-map/{markers.d.ts → src/markers.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/core/plugins/hello-bim/src/index.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { SpaceDialog } from './components/SpaceDialog'\r\nimport { useSpacesLegend } from './components/SpacesLegend'\r\nimport { SpacesTab } from './components/SpacesTab'\r\nimport { SpacesTool } from './components/SpacesTool'\r\n\r\nimport type { BimToolProps, PluginContext } from '@collabdt/plugin-kit/types/bim'\r\nimport type { LegendRegistration } from '@collabdt/plugin-kit/types/legend'\r\n\r\ntype Ctx = PluginContext<unknown, BimToolProps, unknown, LegendRegistration>\r\n\r\n/**\r\n * Four surfaces over the model IfcSpaces, all reading one hook. The IFC is never written to:\r\n * a renamed space is an annotation this plugin stores, and the dialog shows both names.\r\n */\r\nexport function activate(ctx: Ctx): void {\r\n ctx.register('bim.tools', {\r\n id: 'hello-bim',\r\n label: 'Spaces',\r\n icon: 'Boxes',\r\n component: SpacesTool,\r\n stayActive: true,\r\n })\r\n\r\n ctx.register('viewer.tabs', {\r\n id: 'spaces',\r\n labelKey: 'tabTitle',\r\n icon: 'Boxes',\r\n // BIM only: there are no IfcSpaces to annotate on the map or in a point cloud.\r\n viewers: ['bim'],\r\n component: SpacesTab,\r\n })\r\n\r\n ctx.register('viewer.legends', {\r\n id: 'spaces',\r\n title: 'Spaces',\r\n viewers: ['bim'],\r\n useLegend: useSpacesLegend,\r\n })\r\n\r\n ctx.register('ui.dialogs', {\r\n id: 'detail',\r\n titleKey: 'dialogTitle',\r\n size: 'md',\r\n component: SpaceDialog,\r\n })\r\n}\r\n"],"mappings":"AAGA,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAWpB,SAAS,SAAS,KAAgB;AACvC,MAAI,SAAS,aAAa;AAAA,IACxB,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA,EACd,CAAC;AAED,MAAI,SAAS,eAAe;AAAA,IAC1B,IAAI;AAAA,IACJ,UAAU;AAAA,IACV,MAAM;AAAA;AAAA,IAEN,SAAS,CAAC,KAAK;AAAA,IACf,WAAW;AAAA,EACb,CAAC;AAED,MAAI,SAAS,kBAAkB;AAAA,IAC7B,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,SAAS,CAAC,KAAK;AAAA,IACf,WAAW;AAAA,EACb,CAAC;AAED,MAAI,SAAS,cAAc;AAAA,IACzB,IAAI;AAAA,IACJ,UAAU;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
@@ -1,4 +1,4 @@
1
- import type { ModelIdMap } from '../sdk/bimViewer';
1
+ import type { ModelIdMap } from '@collabdt/plugin-kit/types/bim';
2
2
  /** What the plugin stores about one space. The IFC model itself is never written to. */
3
3
  export interface SpaceAnnotation extends Record<string, unknown> {
4
4
  /** Replaces the IFC name in this plugin's own surfaces. */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spaces.d.ts","sourceRoot":"","sources":["../../../../../src/core/plugins/hello-bim/src/spaces.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAEhE,wFAAwF;AACxF,MAAM,WAAW,eAAgB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC9D,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,KAAK;IACpB,6FAA6F;IAC7F,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAA;IACf,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,6DAA6D;IAC7D,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAMxD;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB;AAKD,wBAAgB,iBAAiB,IAAI;IAAE,UAAU,EAAE,eAAe,EAAE,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAiDxF;AAgBD;;;GAGG;AACH,wBAAgB,SAAS;;;;;;kBAoET,MAAM,QAAQ,MAAM;qBAS1B,MAAM,UAAU,MAAM;iBAMhB,MAAM;EAiBrB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB;;;EAuB/B;AAED,4DAA4D;AAC5D,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/C"}
@@ -16,10 +16,10 @@ var __spreadValues = (a, b) => {
16
16
  return a;
17
17
  };
18
18
  import * as React from "react";
19
- import { stringToColour } from "../sdk";
20
- import { usePluginBimAppearance, useBimViewer } from "../sdk/bimViewer";
21
- import { usePluginState } from "../sdk/state";
22
- import { usePluginStore } from "../sdk/store";
19
+ import { stringToColour } from "@collabdt/core/plugins-sdk";
20
+ import { usePluginBimAppearance, useBimViewer } from "@collabdt/core/plugins-sdk/bimViewer";
21
+ import { usePluginState } from "@collabdt/core/plugins-sdk/state";
22
+ import { usePluginStore } from "@collabdt/core/plugins-sdk/store";
23
23
  function spaceKey(modelId, localId) {
24
24
  return `${modelId}::${localId}`;
25
25
  }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/core/plugins/hello-bim/src/spaces.ts"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\nimport { stringToColour } from '@collabdt/core/plugins-sdk'\r\nimport { usePluginBimAppearance, useBimViewer } from '@collabdt/core/plugins-sdk/bimViewer'\r\nimport { usePluginState } from '@collabdt/core/plugins-sdk/state'\r\nimport { usePluginStore } from '@collabdt/core/plugins-sdk/store'\r\n\r\nimport type { ModelIdMap } from '@collabdt/plugin-kit/types/bim'\r\n\r\n/** What the plugin stores about one space. The IFC model itself is never written to. */\r\nexport interface SpaceAnnotation extends Record<string, unknown> {\r\n /** Replaces the IFC name in this plugin's own surfaces. */\r\n name: string\r\n colour: string\r\n}\r\n\r\nexport interface Space {\r\n /** `<modelId>::<localId>` — stable for as long as the model is, and safe as a record key. */\r\n key: string\r\n modelId: string\r\n localId: number\r\n /** From the IFC, and never changed. */\r\n ifcName: string\r\n /** The annotation's name when there is one, otherwise the IFC's. */\r\n name: string\r\n colour: string\r\n /** Whether the plugin has stored anything for this space. */\r\n annotated: boolean\r\n}\r\n\r\nexport function spaceKey(modelId: string, localId: number): string {\r\n return `${modelId}::${localId}`\r\n}\r\n\r\n/** Sets, not arrays: `ModelIdMap` is `Record<string, Set<number>>`. */\r\nexport function toModelIdMap(spaces: Space[]): ModelIdMap {\r\n const items: ModelIdMap = {}\r\n for (const space of spaces) {\r\n (items[space.modelId] ??= new Set<number>()).add(space.localId)\r\n }\r\n return items\r\n}\r\n\r\nexport interface DiscoveredSpace {\r\n modelId: string\r\n localId: number\r\n ifcName: string\r\n}\r\n\r\n// Module scope, not plugin state: a state claim is an effect dep, so it cancels its own scan.\r\nconst scans = new Map<string, Promise<DiscoveredSpace[]>>()\r\n\r\nexport function useSpaceDiscovery(): { discovered: DiscoveredSpace[]; scanning: boolean } {\r\n const { components, modelIds, getItemsOfCategory, getProperties } = useBimViewer()\r\n const [discovered, setDiscovered] = usePluginState<DiscoveredSpace[]>('discovered', [])\r\n const [scannedFor, setScannedFor] = usePluginState<string | null>('scannedFor', null)\r\n\r\n const modelKey = modelIds.join('|')\r\n\r\n React.useEffect(() => {\r\n if (!components || modelKey === scannedFor) return\r\n\r\n if (modelIds.length === 0) {\r\n setDiscovered([])\r\n setScannedFor(modelKey)\r\n return\r\n }\r\n\r\n let cancelled = false\r\n\r\n const scan = scans.get(modelKey) ?? (async () => {\r\n const items = await getItemsOfCategory('IFCSPACE')\r\n const properties = await getProperties(items, ['Name', 'LongName'])\r\n\r\n return properties.map(entry => ({\r\n modelId: entry.modelId,\r\n localId: entry.localId,\r\n ifcName: readName(entry) ?? `Space ${entry.localId}`,\r\n }))\r\n })()\r\n\r\n scans.set(modelKey, scan)\r\n\r\n void scan\r\n .then((found) => {\r\n if (cancelled) return\r\n setDiscovered(found)\r\n // Only once there is a result, or a cancelled surface marks it looked-at.\r\n setScannedFor(modelKey)\r\n })\r\n .catch((error) => {\r\n console.error('[hello-bim] could not read the model\\'s spaces:', error)\r\n scans.delete(modelKey)\r\n })\r\n\r\n return () => {\r\n cancelled = true\r\n }\r\n }, [components, modelKey, modelIds, scannedFor, getItemsOfCategory, getProperties, setDiscovered, setScannedFor])\r\n\r\n return { discovered, scanning: components !== null && modelKey !== scannedFor }\r\n}\r\n\r\n/** IFC attributes arrive bare or wrapped in `{ value }`, depending on the model. */\r\nfunction readName(entry: Record<string, unknown>): string | null {\r\n for (const key of ['LongName', 'Name']) {\r\n const raw = entry[key]\r\n if (typeof raw === 'string' && raw.trim()) return raw.trim()\r\n\r\n if (raw && typeof raw === 'object' && 'value' in raw) {\r\n const value = (raw as { value: unknown }).value\r\n if (typeof value === 'string' && value.trim()) return value.trim()\r\n }\r\n }\r\n return null\r\n}\r\n\r\n/**\r\n * The spaces, plus the annotations this plugin stores against them. The IFC is read-only, so\r\n * a rename is an annotation, never a write to the model.\r\n */\r\nexport function useSpaces() {\r\n const { discovered, scanning } = useSpaceDiscovery()\r\n const store = usePluginStore<SpaceAnnotation>('spaces')\r\n const [selectedKey, setSelectedKey] = usePluginState<string | null>('selected', null)\r\n const [lastError, setLastError] = usePluginState<string | null>('lastError', null)\r\n\r\n const attempt = React.useCallback(\r\n async (action: () => Promise<void>) => {\r\n try {\r\n await action()\r\n setLastError(null)\r\n return true\r\n }\r\n catch (error) {\r\n const message = error instanceof Error ? error.message : String(error)\r\n console.error('[hello-bim] save failed:', error)\r\n setLastError(message)\r\n return false\r\n }\r\n },\r\n [setLastError],\r\n )\r\n\r\n const annotations = React.useMemo(\r\n () => new Map(store.items.map(item => [item.key, item.data])),\r\n [store.items],\r\n )\r\n\r\n const spaces = React.useMemo<Space[]>(\r\n () => discovered.map((found) => {\r\n const key = spaceKey(found.modelId, found.localId)\r\n const annotation = annotations.get(key)\r\n\r\n return {\r\n key,\r\n modelId: found.modelId,\r\n localId: found.localId,\r\n ifcName: found.ifcName,\r\n name: annotation?.name ?? found.ifcName,\r\n // Hashed, so an unpicked colour is stable per space rather than shuffling.\r\n colour: annotation?.colour ?? stringToColour(key),\r\n annotated: annotation !== undefined,\r\n }\r\n }),\r\n [discovered, annotations],\r\n )\r\n\r\n const byKey = React.useMemo(\r\n () => new Map(spaces.map(space => [space.key, space])),\r\n [spaces],\r\n )\r\n\r\n /** One edit path, so a field added to the annotation cannot be dropped by a rename. */\r\n const patch = React.useCallback(\r\n async (key: string, changes: Partial<SpaceAnnotation>) => {\r\n const current = byKey.get(key)\r\n if (!current) return\r\n\r\n await attempt(() => store.put(key, {\r\n name: current.name,\r\n colour: current.colour,\r\n ...changes,\r\n }))\r\n },\r\n [store, byKey, attempt],\r\n )\r\n\r\n const rename = React.useCallback(\r\n async (key: string, name: string) => {\r\n const trimmed = name.trim()\r\n if (!trimmed || trimmed === byKey.get(key)?.name) return\r\n await patch(key, { name: trimmed })\r\n },\r\n [patch, byKey],\r\n )\r\n\r\n const setColour = React.useCallback(\r\n (key: string, colour: string) => patch(key, { colour }),\r\n [patch],\r\n )\r\n\r\n /** Drops the annotation, so the space goes back to its IFC name and a hashed colour. */\r\n const reset = React.useCallback(\r\n async (key: string) => {\r\n if (!byKey.get(key)?.annotated) return\r\n await attempt(() => store.remove(key))\r\n },\r\n [store, byKey, attempt],\r\n )\r\n\r\n return {\r\n spaces,\r\n isLoading: store.isLoading || scanning,\r\n lastError,\r\n selected: selectedKey === null ? null : byKey.get(selectedKey) ?? null,\r\n select: setSelectedKey,\r\n rename,\r\n setColour,\r\n reset,\r\n }\r\n}\r\n\r\n/**\r\n * Whether the spaces are painted, applied from an effect so a recolour repaints at once.\r\n * The flag is plugin state, so the toolbar and the tab agree on it.\r\n */\r\nexport function useSpacePainting() {\r\n const { spaces } = useSpaces()\r\n const { setItemsVisible } = useBimViewer()\r\n const { setAppearance, clearAppearance } = usePluginBimAppearance()\r\n const [painted, setPainted] = usePluginState('painted', false)\r\n\r\n React.useEffect(() => {\r\n if (!painted) {\r\n clearAppearance()\r\n return\r\n }\r\n if (spaces.length === 0) return\r\n\r\n // IfcSpaces start hidden, so painting them without this colours nothing visible.\r\n void setItemsVisible(toModelIdMap(spaces), true)\r\n\r\n setAppearance(spaces.map(space => ({\r\n items: toModelIdMap([space]),\r\n appearance: { color: hexToInt(space.colour) },\r\n })))\r\n }, [painted, spaces, setAppearance, clearAppearance, setItemsVisible])\r\n\r\n return { painted, setPainted }\r\n}\r\n\r\n/** `#rrggbb` to the `0xRRGGBB` the appearance API takes. */\r\nexport function hexToInt(colour: string): number {\r\n return Number.parseInt(colour.replace('#', ''), 16)\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;AAKA,YAAY,WAAW;AAEvB,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB,oBAAoB;AACrD,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAyBxB,SAAS,SAAS,SAAiB,SAAyB;AACjE,SAAO,GAAG,OAAO,KAAK,OAAO;AAC/B;A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,EAAE,GAAG,EAAE;AACpD;","names":["_a"]}
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { MapToolProps } from '../../sdk/mapViewer';
3
- import type { ToolbarToolProps } from '../../sdk/types';
2
+ import type { MapToolProps, ToolbarToolProps } from '@collabdt/plugin-kit/types/map';
4
3
  /**
5
4
  * Where the map is, and a button to record it. The marker itself is drawn by `MarkersLayer`,
6
5
  * because this panel unmounts as soon as the dropdown closes.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapTool.d.ts","sourceRoot":"","sources":["../../../../../../src/core/plugins/hello-map/src/components/MapTool.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAMpF;;;GAGG;AACH,wBAAgB,OAAO,CAAC,EAAE,GAAG,EAAE,EAAE,gBAAgB,GAAG,YAAY,qBA4E/D"}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
- import { Button, Separator } from "../../sdk/components";
5
- import { usePluginConfig } from "../../sdk/config";
6
- import { usePluginTranslations } from "../../sdk/messages";
4
+ import { Button, Separator } from "@collabdt/core/plugins-sdk/components";
5
+ import { usePluginConfig } from "@collabdt/core/plugins-sdk/config";
6
+ import { usePluginTranslations } from "@collabdt/core/plugins-sdk/messages";
7
7
  import { useMarkers } from "../markers";
8
8
  function MapTool({ map }) {
9
9
  const t = usePluginTranslations();
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/core/plugins/hello-map/src/components/MapTool.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\nimport { Button, Separator } from '@collabdt/core/plugins-sdk/components'\r\nimport { usePluginConfig } from '@collabdt/core/plugins-sdk/config'\r\nimport { usePluginTranslations } from '@collabdt/core/plugins-sdk/messages'\n\r\nimport { useMarkers } from '../markers'\r\n\r\nimport type { MapToolProps, ToolbarToolProps } from '@collabdt/plugin-kit/types/map'\r\n\r\ninterface Config extends Record<string, unknown> {\r\n decimals?: number\r\n}\r\n\r\n/**\r\n * Where the map is, and a button to record it. The marker itself is drawn by `MarkersLayer`,\r\n * because this panel unmounts as soon as the dropdown closes.\r\n */\r\nexport function MapTool({ map }: ToolbarToolProps & MapToolProps) {\r\n const t = usePluginTranslations()\r\n const { decimals = 5 } = usePluginConfig<Config>()\r\n const { add, markers, lastError } = useMarkers()\r\n\r\n const [view, setView] = React.useState<{ lng: number; lat: number; zoom: number } | null>(null)\r\n const [saving, setSaving] = React.useState(false)\r\n\r\n React.useEffect(() => {\r\n if (!map) return\r\n\r\n const read = () => {\r\n const centre = map.getCenter()\r\n setView({ lng: centre.lng, lat: centre.lat, zoom: map.getZoom() })\r\n }\r\n\r\n read()\r\n map.on('move', read)\r\n return () => {\r\n map.off('move', read)\r\n }\r\n }, [map])\r\n\r\n const record = async () => {\r\n if (!view || saving) return\r\n\r\n setSaving(true)\r\n try {\r\n await add(view.lat, view.lng, view.zoom)\r\n } finally {\r\n setSaving(false)\r\n }\r\n }\r\n\r\n return (\r\n <div className=\"w-64 p-1\">\r\n <p className=\"px-2 py-1 text-sm font-medium\">{t('title', 'Hello Map')}</p>\r\n <Separator className=\"my-1\" />\r\n\r\n {view ? (\r\n <>\r\n <dl className=\"px-2 py-1 text-sm\">\r\n <Row label={t('latitude', 'Latitude')} value={view.lat.toFixed(decimals)} />\r\n <Row label={t('longitude', 'Longitude')} value={view.lng.toFixed(decimals)} />\r\n <Row label={t('zoom', 'Zoom')} value={view.zoom.toFixed(2)} />\r\n </dl>\r\n\r\n <Separator className=\"my-1\" />\r\n\r\n <Button\r\n size=\"sm\"\r\n variant=\"ghost\"\r\n className=\"w-full justify-start font-normal\"\r\n disabled={saving}\r\n onClick={() => { void record() }}\r\n >\r\n {saving ? t('recording', 'Recording…') : t('record', 'Record a marker here')}\r\n </Button>\r\n\r\n <p className=\"px-2 py-1 text-xs text-muted-foreground\">\r\n {t('markerCount', 'Markers: ')}{markers.length}\r\n </p>\r\n\r\n {lastError && (\r\n <p className=\"px-2 py-1 text-xs text-destructive\">\r\n {t('saveFailed', 'Could not save: ')}{lastError}\r\n </p>\r\n )}\r\n </>\r\n ) : (\r\n <p className=\"px-2 py-1 text-sm text-muted-foreground\">\r\n {t('waiting', 'Waiting for the map…')}\r\n </p>\r\n )}\r\n </div>\r\n )\r\n}\r\n\r\nfunction Row({ label, value }: { label: string; value: string }) {\r\n return (\r\n <div className=\"flex items-baseline justify-between gap-3 py-0.5\">\r\n <dt className=\"text-muted-foreground\">{label}</dt>\r\n <dd className=\"tabular-nums\">{value}</dd>\r\n </div>\r\n )\r\n}\r\n"],"mappings":";AA2DM,SAIE,UAJF,KAKI,YALJ;AAtDN,YAAY,WAAW;AAEvB,SAAS,QAAQ,iBAAiB;AAClC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AAEtC,SAAS,kBAAkB;AAYpB,SAAS,QAAQ,EAAE,IAAI,GAAoC;AAChE,QAAM,IAAI,sBAAsB;AAChC,QAAM,EAAE,WAAW,EAAE,IAAI,gBAAwB;AACjD,QAAM,EAAE,KAAK,SAAS,UAAU,IAAI,WAAW;AAE/C,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAA4D,IAAI;AAC9F,QAAM,CAAC,QAAQ,SAAS,IAAI,MAAM,SAAS,KAAK;AAEhD,QAAM,UAAU,MAAM;AACpB,QAAI,CAAC,IAAK;AAEV,UAAM,OAAO,MAAM;AACjB,YAAM,SAAS,IAAI,UAAU;AAC7B,cAAQ,EAAE,KAAK,OAAO,KAAK,KAAK,OAAO,KAAK,MAAM,IAAI,QAAQ,EAAE,CAAC;AAAA,IACnE;AAEA,SAAK;AACL,QAAI,GAAG,QAAQ,IAAI;AACnB,WAAO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,IAEA,oBAAC,OAAE,WAAU,2CACV,YAAE,WAAW,2BAAsB,GACtC;AAAA,KAEJ;AAEJ;AAEA,SAAS,IAAI,EAAE,OAAO,MAAM,GAAqC;AAC/D,SACE,qBAAC,SAAI,WAAU,oDACb;AAAA,wBAAC,QAAG,WAAU,yBAAyB,iBAAM;AAAA,IAC7C,oBAAC,QAAG,WAAU,gBAAgB,iBAAM;AAAA,KACtC;AAEJ;","names":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkerDialog.d.ts","sourceRoot":"","sources":["../../../../../../src/core/plugins/hello-map/src/components/MarkerDialog.tsx"],"names":[],"mappings":"AAUA,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,8FAA8F;AAC9F,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,+BAwCvD"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Button } from "../../sdk/components";
4
- import { usePluginTranslations } from "../../sdk/messages";
3
+ import { Button } from "@collabdt/core/plugins-sdk/components";
4
+ import { usePluginTranslations } from "@collabdt/core/plugins-sdk/messages";
5
5
  import { useMarkers } from "../markers";
6
6
  function MarkerDialog({ close, markerKey }) {
7
7
  var _a;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/core/plugins/hello-map/src/components/MarkerDialog.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { Button } from '@collabdt/core/plugins-sdk/components'\r\nimport { usePluginTranslations } from '@collabdt/core/plugins-sdk/messages'\n\r\nimport { useMarkers } from '../markers'\r\n\r\ninterface Props {\r\n close: () => void\r\n /** Supplied by whichever surface opened this — the sidebar tab, or a row on the page. */\r\n markerKey?: string\r\n}\r\n\r\n/** One marker in full. Core owns the overlay and Escape; this outlives whatever opened it. */\r\nexport function MarkerDialog({ close, markerKey }: Props) {\r\n const t = usePluginTranslations()\r\n const { markers, selected } = useMarkers()\r\n\r\n const marker = markerKey\r\n ? markers.find(candidate => candidate.key === markerKey) ?? null\r\n : selected\r\n\r\n if (!marker) {\r\n return (\r\n <div className=\"flex flex-col gap-4\">\r\n <p className=\"text-sm text-muted-foreground\">\r\n {t('gone', 'That marker no longer exists.')}\r\n </p>\r\n <Button className=\"self-end\" onClick={close}>{t('close', 'Close')}</Button>\r\n </div>\r\n )\r\n }\r\n\r\n return (\r\n <div className=\"flex flex-col gap-4\">\r\n <div className=\"flex items-center gap-2\">\r\n <span\r\n aria-hidden=\"true\"\r\n className=\"inline-block h-4 w-4 rounded-full border border-white\"\r\n style={{ backgroundColor: marker.colour }}\r\n />\r\n <p className=\"font-medium\">{marker.name}</p>\r\n </div>\r\n\r\n <dl className=\"text-sm\">\r\n <Row label={t('columnLatitude', 'Latitude')} value={marker.latitude.toFixed(5)} />\r\n <Row label={t('columnLongitude', 'Longitude')} value={marker.longitude.toFixed(5)} />\r\n <Row label={t('zoom', 'Zoom')} value={marker.zoom.toFixed(2)} />\r\n <Row label={t('colour', 'Colour')} value={marker.colour} />\r\n </dl>\r\n\r\n <Button className=\"self-end\" onClick={close}>{t('close', 'Close')}</Button>\r\n </div>\r\n )\r\n}\r\n\r\nfunction Row({ label, value }: { label: string; value: string }) {\r\n return (\r\n <div className=\"flex items-baseline justify-between gap-3 py-0.5\">\r\n <dt className=\"text-muted-foreground\">{label}</dt>\r\n <dd className=\"tabular-nums\">{value}</dd>\r\n </div>\r\n )\r\n}\r\n"],"mappings":";AA2BM,SACE,KADF;AAtBN,SAAS,cAAc;AACvB,SAAS,6BAA6B;AAEtC,SAAS,kBAAkB;AASpB,SAAS,aAAa,EAAE,OAAO,UAAU,GAAU;AAjB1D;AAkBE,QAAM,IAAI,sBAAsB;AAChC,QAAM,EAAE,SA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AAgB,iBAAM;AAAA,KACtC;AAEJ;","names":[]}
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { MapToolProps } from '../../sdk/mapViewer';
2
+ import type { MapToolProps } from '@collabdt/plugin-kit/types/map';
3
3
  /**
4
4
  * The markers and the open popup. A `map.layers` contribution, not part of the tool, whose
5
5
  * panel unmounts. A GeoJSON source, because a plugin cannot import `maplibre-gl`.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkersLayer.d.ts","sourceRoot":"","sources":["../../../../../../src/core/plugins/hello-map/src/components/MarkersLayer.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAKlE;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,GAAG,EAAE,EAAE,YAAY,qBAmEjD"}
@@ -2,7 +2,7 @@
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { createPortal } from "react-dom";
5
- import { usePluginTranslations } from "../../sdk/messages";
5
+ import { usePluginTranslations } from "@collabdt/core/plugins-sdk/messages";
6
6
  import { useMarkers } from "../markers";
7
7
  const SOURCE = "hello-map-markers";
8
8
  const LAYER = "hello-map-markers";
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/core/plugins/hello-map/src/components/MarkersLayer.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\nimport { createPortal } from 'react-dom'\r\n\r\nimport { usePluginTranslations } from '@collabdt/core/plugins-sdk/messages'\n\r\nimport { useMarkers } from '../markers'\r\n\r\nimport type { Marker } from '../markers'\r\nimport type { MapToolProps } from '@collabdt/plugin-kit/types/map'\r\n\r\nconst SOURCE = 'hello-map-markers'\r\nconst LAYER = 'hello-map-markers'\r\n\r\n/**\r\n * The markers and the open popup. A `map.layers` contribution, not part of the tool, whose\r\n * panel unmounts. A GeoJSON source, because a plugin cannot import `maplibre-gl`.\r\n */\r\nexport function MarkersLayer({ map }: MapToolProps) {\r\n const { markers, open } = useMarkers()\r\n\r\n const featuresRef = React.useRef<Marker[]>(markers)\r\n featuresRef.current = markers\r\n\r\n React.useEffect(() => {\r\n if (!map) return\r\n\r\n // Re-run on every style change: the basemap switcher drops every source and layer.\r\n const ensureLayer = () => {\r\n if (!map.getStyle() || map.getSource(SOURCE)) return\r\n\r\n map.addSource(SOURCE, { type: 'geojson', data: toFeatureCollection(featuresRef.current) })\r\n\r\n map.addLayer({\r\n id: LAYER,\r\n type: 'circle',\r\n source: SOURCE,\r\n paint: {\r\n // Read per feature, so recolouring one marker needs no layer change.\r\n 'circle-color': ['get', 'colour'],\r\n 'circle-radius': 7,\r\n 'circle-stroke-width': 2,\r\n 'circle-stroke-color': '#ffffff',\r\n },\r\n })\r\n }\r\n\r\n const openFeature = (event: { features?: Array<{ properties?: Record<string, unknown> }> }) => {\r\n const key = event.features?.[0]?.properties?.key\r\n if (typeof key === 'string') open(key)\r\n }\r\n\r\n const pointer = () => { map.getCanvas().style.cursor = 'pointer' }\r\n const clearPointer = () => { map.getCanvas().style.cursor = '' }\r\n\r\n if (map.isStyleLoaded()) ensureLayer()\r\n map.on('styledata', ensureLayer)\r\n map.on('click', LAYER, openFeature)\r\n map.on('mouseenter', LAYER, pointer)\r\n map.on('mouseleave', LAYER, clearPointer)\r\n\r\n return () => {\r\n map.off('styledata', ensureLayer)\r\n map.off('click', LAYER, openFeature)\r\n map.off('mouseenter', LAYER, pointer)\r\n map.off('mouseleave', LAYER, clearPointer)\r\n\r\n // Guarded: the style may be gone, and removing what is already gone throws.\r\n if (map.getLayer(LAYER)) map.removeLayer(LAYER)\r\n if (map.getSource(SOURCE)) map.removeSource(SOURCE)\r\n clearPointer()\r\n }\r\n }, [map, open])\r\n\r\n // setData, not a teardown: re-adding the layer would make the markers flicker.\r\n React.useEffect(() => {\r\n if (!map) return\r\n\r\n const source = map.getSource(SOURCE)\r\n if (source && 'setData' in source) {\r\n (source as { setData: (data: unknown) => void }).setData(toFeatureCollection(markers))\r\n }\r\n }, [map, markers])\r\n\r\n return <MarkerPopup map={map} />\r\n}\r\n\r\nfunction toFeatureCollection(markers: Marker[]) {\r\n return {\r\n type: 'FeatureCollection' as const,\r\n features: markers.map(marker => ({\r\n type: 'Feature' as const,\r\n geometry: { type: 'Point' as const, coordinates: [marker.longitude, marker.latitude] },\r\n // Only what the layer and the click handler read. Everything else stays in the store.\r\n properties: { key: marker.key, colour: marker.colour },\r\n })),\r\n }\r\n}\r\n\r\n/**\r\n * The popup for the open marker, portalled into the map's own container so it sits over the\r\n * canvas. Positioned with `map.project`, which is why it has to follow every move.\r\n */\r\nfunction MarkerPopup({ map }: MapToolProps) {\r\n const t = usePluginTranslations()\r\n const { openMarker, open } = useMarkers()\r\n const [, forceReposition] = React.useState(0)\r\n\r\n React.useEffect(() => {\r\n if (!map || !openMarker) return\r\n\r\n const reposition = () => forceReposition(tick => tick + 1)\r\n\r\n map.on('move', reposition)\r\n return () => {\r\n map.off('move', reposition)\r\n }\r\n }, [map, openMarker])\r\n\r\n if (!map || !openMarker) return null\r\n\r\n const { x, y } = map.project([openMarker.longitude, openMarker.latitude])\r\n\r\n return createPortal(\r\n <div\r\n className=\"absolute z-10 -translate-x-1/2 -translate-y-full pb-3\"\r\n style={{ left: x, top: y }}\r\n >\r\n <div className=\"rounded-md border bg-background px-3 py-2 shadow-lg\">\r\n <div className=\"flex items-start gap-2\">\r\n <span\r\n aria-hidden=\"true\"\r\n className=\"mt-1 inline-block h-3 w-3 shrink-0 rounded-full border border-white\"\r\n style={{ backgroundColor: openMarker.colour }}\r\n />\r\n <div className=\"text-xs\">\r\n <p className=\"font-medium\">{openMarker.name}</p>\r\n <p className=\"tabular-nums text-muted-foreground\">\r\n {openMarker.latitude.toFixed(5)}, {openMarker.longitude.toFixed(5)}\r\n </p>\r\n </div>\r\n <button\r\n type=\"button\"\r\n className=\"ml-2 text-muted-foreground hover:text-foreground\"\r\n aria-label={t('close', 'Close')}\r\n onClick={() => open(null)}\r\n >\r\n ×\r\n </button>\r\n </div>\r\n </div>\r\n </div>,\r\n map.getContainer(),\r\n )\r\n}\r\n"],"mappings":";AAwFS,cAqDG,YArDH;AAnFT,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAE7B,SAAS,6BAA6B;AAEtC,SAAS,kBAAkB;AAK3B,MAAM,SAAS;AACf,MAAM,QAAQ;AAMP,SAAS,aAAa,EAAE,IAAI,GAAiB;AAClD,QAAM,EAAE,SAAS,KAAK,IAAI,WAAW;AAErC,QAAM,cAAc,MAAM,OAAiB,OAAO;AAClD,cAAY,UAAU;AAEtB,QAAM,UAAU,MAAM;AACpB,QAAI,CAAC,IAAK;AAGV,UAAM,cAAc,MAAM;AACxB,UAAI,CAAC,IAAI,SAAS,KAAK,IAAI,UAAU,MAAM,EAAG;AAE9C,UAAI,UAAU,QAAQ,EAAE,MAAM,WAAW,MAAM,oBAAoB,YAAY,OAAO,EAAE,CAAC;AAEzF,UAAI,SAAS;AAAA,QACX,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,OAAO;AAAA;AAAA,UAEL,gBAAgB,CAAC,OAAO,QAAQ;AAAA,UAChC,iBAAiB;AAAA,UACjB,uBAAuB;AAAA,UACvB,uBAAuB;AAAA,QACzB;AAAA,MACF,CAAC;AAAA,IACH;AAEA,UAAM,cAAc,CAAC,UAA0E;AAnDnG;AAoDM,YAAM,OAAM,uBAAM,aAAN,mBAAiB,OAAjB,mBAAqB,eAArB,mBAAiC;AAC7C,UAAI,OAAO,QAAQ,SAAU,MAAK,GAAG;AAAA,IACvC;AAEA,UAAM,UAAU,MAAM;AAAE,UAAI,UAAU,EAAE,MAAM,SAAS;AAAA,IAAU;AACjE,UAAM,eAAe,MAAM;AAAE,UAAI,UAAU,EAAE,MAAM,SAAS;AAAA,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* One row per marker, live as they are added, renamed and recoloured. Every marker gets a row;
4
4
  * the host's card caps its body at 40vh and scrolls.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkersLegend.d.ts","sourceRoot":"","sources":["../../../../../../src/core/plugins/hello-map/src/components/MarkersLegend.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAA;AAElE;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,EAAE,CAAA;CAAE,CAczF"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { usePluginTranslations } from "../../sdk/messages";
2
+ import { usePluginTranslations } from "@collabdt/core/plugins-sdk/messages";
3
3
  import { useMarkers } from "../markers";
4
4
  function useMarkersLegend() {
5
5
  const t = usePluginTranslations();
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/core/plugins/hello-map/src/components/MarkersLegend.ts"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { usePluginTranslations } from '@collabdt/core/plugins-sdk/messages'\n\r\nimport { useMarkers } from '../markers'\r\n\r\nimport type { LegendRow } from '@collabdt/plugin-kit/types/legend'\r\n\r\n/**\r\n * One row per marker, live as they are added, renamed and recoloured. Every marker gets a row;\r\n * the host's card caps its body at 40vh and scrolls.\r\n */\r\nexport function useMarkersLegend(): { active: boolean; title?: string; rows: LegendRow[] } {\r\n const t = usePluginTranslations()\r\n const { markers } = useMarkers()\r\n\r\n const rows: LegendRow[] = markers.map(marker => ({\r\n label: marker.name,\r\n color: marker.colour,\r\n }))\r\n\r\n return {\r\n active: rows.length > 0,\r\n title: t('legendTitle', 'Markers'),\r\n rows,\r\n }\r\n}\r\n"],"mappings":";AAKA,SAAS,6BAA6B;AAEtC,SAAS,kBAAkB;AAQpB,SAAS,mBAA2E;AACzF,QAAM,IAAI,sBAAsB;AAChC,QAAM,EAAE,QAAQ,IAAI,WAAW;AAE/B,QAAM,OAAoB,QAAQ,IAAI,aAAW;AAAA,IAC/C,OAAO,OAAO;AAAA,IACd,OAAO,OAAO;AAAA,EAChB,EAAE;AAEF,SAAO;AAAA,IACL,QAAQ,KAAK,SAAS;AAAA,IACtB,OAAO,EAAE,eAAe,SAAS;AAAA,IACjC;AAAA,EACF;AACF;","names":[]}
@@ -1,5 +1,5 @@
1
- import type { DataPageColumn, DataPageRows } from '../../sdk/types';
2
1
  import type { Marker } from '../markers';
2
+ import type { DataPageColumn, DataPageRows } from '@collabdt/plugin-kit/types/ui';
3
3
  /** Rows and the click handler both need hooks, so both come from here. */
4
4
  export declare function useMarkerRows(): DataPageRows<Marker>;
5
5
  export declare const markerColumns: DataPageColumn<Marker>[];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkersPage.d.ts","sourceRoot":"","sources":["../../../../../../src/core/plugins/hello-map/src/components/MarkersPage.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjF,0EAA0E;AAC1E,wBAAgB,aAAa,IAAI,YAAY,CAAC,MAAM,CAAC,CAapD;AAGD,eAAO,MAAM,aAAa,EAAE,cAAc,CAAC,MAAM,CAAC,EAgBjD,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { usePluginDialogs } from "../../sdk/ui";
3
+ import { usePluginDialogs } from "@collabdt/core/plugins-sdk/ui";
4
4
  import { useMarkers } from "../markers";
5
5
  function useMarkerRows() {
6
6
  const { markers, isLoading, select, open } = useMarkers();
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/core/plugins/hello-map/src/components/MarkersPage.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { usePluginDialogs } from '@collabdt/core/plugins-sdk/ui'\n\r\nimport { useMarkers } from '../markers'\r\n\r\nimport type { Marker } from '../markers'\r\nimport type { DataPageColumn, DataPageRows } from '@collabdt/plugin-kit/types/ui'\r\n\r\n/** Rows and the click handler both need hooks, so both come from here. */\r\nexport function useMarkerRows(): DataPageRows<Marker> {\r\n const { markers, isLoading, select, open } = useMarkers()\r\n const { open: openDialog } = usePluginDialogs()\r\n\r\n return {\r\n rows: markers,\r\n isLoading,\r\n onRowClick: (row) => {\r\n select(row.key)\r\n open(row.key)\r\n openDialog('detail', { markerKey: row.key })\r\n },\r\n }\r\n}\r\n\r\n// `labelKey` falls back to the literal, so this reads before any translation exists.\r\nexport const markerColumns: DataPageColumn<Marker>[] = [\r\n {\r\n key: 'colour',\r\n labelKey: 'colour',\r\n render: row => (\r\n <span\r\n aria-label={row.colour}\r\n className=\"inline-block h-3 w-3 rounded-full border border-white\"\r\n style={{ backgroundColor: row.colour }}\r\n />\r\n ),\r\n },\r\n { key: 'name', labelKey: 'columnName' },\r\n { key: 'latitude', labelKey: 'columnLatitude', render: row => row.latitude.toFixed(5) },\r\n { key: 'longitude', labelKey: 'columnLongitude', render: row => row.longitude.toFixed(5) },\r\n { key: 'zoom', labelKey: 'zoom', render: row => row.zoom.toFixed(2) },\r\n]\r\n"],"mappings":";AAkCM;AA7BN,SAAS,wBAAwB;AAEjC,SAAS,kBAAkB;AAMpB,SAAS,gBAAsC;AACpD,QAAM,EAAE,SAAS,WAAW,QAAQ,KAAK,IAAI,WAAW;AACxD,QAAM,EAAE,MAAM,WAAW,IAAI,iBAAiB;AAE9C,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA,YAAY,CAAC,QAAQ;AACnB,aAAO,IAAI,GAAG;AACd,WAAK,IAAI,GAAG;AACZ,iBAAW,UAAU,EAAE,WAAW,IAAI,IAAI,CAAC;AAAA,IAC7C;AAAA,EACF;AACF;AAGO,MAAM,gBAA0C;AAAA,EACrD;AAAA,IACE,KAAK;AAAA,IACL,UAAU;AAAA,IACV,QAAQ,SACN;AAAA,MAAC;AAAA;AAAA,QACC,cAAY,IAAI;AAAA,QAChB,WAAU;AAAA,QACV,OAAO,EAAE,iBAAiB,IAAI,OAAO;AAAA;AAAA,IACvC;AAAA,EAEJ;AAAA,EACA,EAAE,KAAK,QAAQ,UAAU,aAAa;AAAA,EACtC,EAAE,KAAK,YAAY,UAAU,kBAAkB,QAAQ,SAAO,IAAI,SAAS,QAAQ,CAAC,EAAE;AAAA,EACtF,EAAE,KAAK,aAAa,UAAU,mBAAmB,QAAQ,SAAO,IAAI,UAAU,QAAQ,CAAC,EAAE;AAAA,EACzF,EAAE,KAAK,QAAQ,UAAU,QAAQ,QAAQ,SAAO,IAAI,KAAK,QAAQ,CAAC,EAAE;AACtE;","names":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkersTab.d.ts","sourceRoot":"","sources":["../../../../../../src/core/plugins/hello-map/src/components/MarkersTab.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA6I9B,2EAA2E;AAC3E,wBAAgB,UAAU,sBAoJzB"}
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
- import { MAP_COLOUR_PALETTE } from "../../sdk";
5
- import { Button, Input, Separator } from "../../sdk/components";
6
- import { useMapViewer } from "../../sdk/mapViewer";
7
- import { usePluginTranslations } from "../../sdk/messages";
4
+ import { MAP_COLOUR_PALETTE } from "@collabdt/core/plugins-sdk";
5
+ import { Button, Input, Separator } from "@collabdt/core/plugins-sdk/components";
6
+ import { useMapViewer } from "@collabdt/core/plugins-sdk/mapViewer";
7
+ import { usePluginTranslations } from "@collabdt/core/plugins-sdk/messages";
8
8
  import { useMarkers } from "../markers";
9
9
  const SWATCHES = 8;
10
10
  function NameField({
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/core/plugins/hello-map/src/components/MarkersTab.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\nimport { MAP_COLOUR_PALETTE } from '@collabdt/core/plugins-sdk'\r\nimport { Button, Input, Separator } from '@collabdt/core/plugins-sdk/components'\r\nimport { useMapViewer } from '@collabdt/core/plugins-sdk/mapViewer'\r\nimport { usePluginTranslations } from '@collabdt/core/plugins-sdk/messages'\n\r\nimport { useMarkers } from '../markers'\r\n\r\n/** How many palette entries to offer as swatches before the free colour input. */\r\nconst SWATCHES = 8\r\n\r\n/**\r\n * The name, saved only when confirmed. Not on blur: with a confirm button, blurring to reach\r\n * it would save first, and blurring elsewhere would commit an unconfirmed edit.\r\n */\r\nfunction NameField({\r\n name,\r\n label,\r\n saveLabel,\r\n revertLabel,\r\n onCommit,\r\n}: {\r\n name: string\r\n label: string\r\n saveLabel: string\r\n revertLabel: string\r\n onCommit: (name: string) => void\r\n}) {\r\n const [draft, setDraft] = React.useState(name)\r\n const inputId = React.useId()\r\n\r\n const trimmed = draft.trim()\r\n const canSave = trimmed.length > 0 && trimmed !== name\r\n\r\n const commit = () => {\r\n if (!canSave) return\r\n onCommit(trimmed)\r\n }\r\n\r\n return (\r\n <div className=\"flex flex-col gap-1\">\r\n <label className=\"text-xs font-medium\" htmlFor={inputId}>{label}</label>\r\n\r\n {/* Laid out like the app's other inline text edits (see the comment editor): the field\r\n takes the row, then a confirm and a revert, both h-8 w-8 icon buttons. */}\r\n <div className=\"flex items-center gap-1\">\r\n <Input\r\n id={inputId}\r\n value={draft}\r\n onChange={event => setDraft(event.target.value)}\r\n onKeyDown={(event) => {\r\n if (event.key === 'Enter') { event.preventDefault(); commit() }\r\n if (event.key === 'Escape') setDraft(name)\r\n }}\r\n className=\"h-8 flex-1\"\r\n />\r\n\r\n <Button\r\n size=\"icon\"\r\n className=\"h-8 w-8 shrink-0 p-0\"\r\n disabled={!canSave}\r\n aria-label={saveLabel}\r\n title={saveLabel}\r\n onClick={commit}\r\n >\r\n <CheckIcon />\r\n </Button>\r\n\r\n <Button\r\n size=\"icon\"\r\n variant=\"ghost\"\r\n className=\"h-8 w-8 shrink-0 p-0\"\r\n disabled={!canSave}\r\n aria-label={revertLabel}\r\n title={revertLabel}\r\n onClick={() => setDraft(name)}\r\n >\r\n <XIcon />\r\n </Button>\r\n </div>\r\n </div>\r\n )\r\n}\r\n\r\n// Drawn here: `lucide-react` is unshimmed, so a plugin cannot import it.\r\nfunction Glyph({ children }: { children: React.ReactNode }) {\r\n return (\r\n <svg\r\n viewBox=\"0 0 24 24\"\r\n className=\"h-4 w-4\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"2\"\r\n strokeLinecap=\"round\"\r\n strokeLinejoin=\"round\"\r\n aria-hidden=\"true\"\r\n >\r\n {children}\r\n </svg>\r\n )\r\n}\r\n\r\nfunction CheckIcon() {\r\n return <Glyph><path d=\"M20 6 9 17l-5-5\" /></Glyph>\r\n}\r\n\r\nfunction XIcon() {\r\n return <Glyph><path d=\"M18 6 6 18\" /><path d=\"m6 6 12 12\" /></Glyph>\r\n}\r\n\r\n/** Smaller than the button glyphs — it sits inside a 24px swatch, not a 32px button. */\r\nfunction PlusIcon() {\r\n return (\r\n <svg\r\n viewBox=\"0 0 24 24\"\r\n className=\"h-3 w-3\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n strokeWidth=\"2.5\"\r\n strokeLinecap=\"round\"\r\n aria-hidden=\"true\"\r\n >\r\n <path d=\"M5 12h14\" />\r\n <path d=\"M12 5v14\" />\r\n </svg>\r\n )\r\n}\r\n\r\n/** Traces lucide's `map-pin-plus`, the same icon the toolbar registration names. */\r\nfunction MarkerPlusIcon() {\r\n return (\r\n <Glyph>\r\n <path d=\"M19.914 11.105A7.298 7.298 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738\" />\r\n <circle cx=\"12\" cy=\"10\" r=\"3\" />\r\n <path d=\"M16 18h6\" />\r\n <path d=\"M19 15v6\" />\r\n </Glyph>\r\n )\r\n}\r\n\r\n/** The markers in the viewer sidebar, in the map and BIM viewers alike. */\r\nexport function MarkersTab() {\r\n const t = usePluginTranslations()\r\n const { map } = useMapViewer()\r\n const {\r\n markers, isLoading, lastError, selected,\r\n select, open, add, setColour, rename, remove,\r\n } = useMarkers()\r\n\r\n const addHere = async () => {\r\n if (!map) return\r\n const centre = map.getCenter()\r\n await add(centre.lat, centre.lng, map.getZoom())\r\n }\r\n\r\n /** Back to exactly the view the marker was recorded at, zoom included. */\r\n const flyTo = () => {\r\n if (!map || !selected) return\r\n\r\n map.flyTo({ center: [selected.longitude, selected.latitude], zoom: selected.zoom })\r\n open(selected.key)\r\n }\r\n\r\n if (isLoading && markers.length === 0) {\r\n return <p className=\"p-4 text-sm text-muted-foreground\">{t('loading', 'Loading…')}</p>\r\n }\r\n\r\n return (\r\n <div className=\"flex flex-col gap-3 p-4\">\r\n <Button\r\n size=\"sm\"\r\n variant=\"outline\"\r\n className=\"gap-2\"\r\n disabled={!map}\r\n onClick={() => { void addHere() }}\r\n >\r\n <MarkerPlusIcon />\r\n {t('addHere', 'Add a marker at the map centre')}\r\n </Button>\r\n\r\n {!map && (\r\n <p className=\"text-xs text-muted-foreground\">\r\n {t('mapOnly', 'Switch to the map to add a marker.')}\r\n </p>\r\n )}\r\n\r\n {lastError && (\r\n <p className=\"rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive\">\r\n {t('saveFailed', 'Could not save: ')}{lastError}\r\n </p>\r\n )}\r\n\r\n {markers.length === 0 ? (\r\n <p className=\"text-sm text-muted-foreground\">\r\n {t('empty', 'No markers yet. Record one from the map toolbar.')}\r\n </p>\r\n ) : (\r\n <ul className=\"flex flex-col gap-1\">\r\n {markers.map(marker => (\r\n <li key={marker.key}>\r\n <button\r\n type=\"button\"\r\n onClick={() => { select(marker.key); open(marker.key) }}\r\n className={`flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm ${\r\n selected?.key === marker.key ? 'bg-accent' : 'hover:bg-accent/50'\r\n }`}\r\n >\r\n <span\r\n aria-hidden=\"true\"\r\n className=\"inline-block h-3 w-3 shrink-0 rounded-full border border-white\"\r\n style={{ backgroundColor: marker.colour }}\r\n />\r\n <span className=\"flex-1 truncate\">{marker.name}</span>\r\n <span className=\"tabular-nums text-xs text-muted-foreground\">\r\n {marker.latitude.toFixed(2)}, {marker.longitude.toFixed(2)}\r\n </span>\r\n </button>\r\n </li>\r\n ))}\r\n </ul>\r\n )}\r\n\r\n {selected && (\r\n <>\r\n <Separator />\r\n\r\n <NameField\r\n key={selected.key}\r\n name={selected.name}\r\n label={t('nameLabel', 'Name')}\r\n saveLabel={t('saveName', 'Save name')}\r\n revertLabel={t('revertName', 'Discard the change')}\r\n onCommit={name => { void rename(selected.key, name) }}\r\n />\r\n\r\n <Button size=\"sm\" variant=\"outline\" disabled={!map} onClick={flyTo}>\r\n {t('flyTo', 'Fly to on the map')}\r\n </Button>\r\n\r\n <div className=\"flex flex-col gap-2\">\r\n <p className=\"text-xs font-medium\">{t('colour', 'Colour')}</p>\r\n\r\n <div className=\"flex flex-wrap items-center gap-1\">\r\n {MAP_COLOUR_PALETTE.slice(0, SWATCHES).map(colour => (\r\n <button\r\n key={colour}\r\n type=\"button\"\r\n aria-label={colour}\r\n aria-pressed={selected.colour === colour}\r\n onClick={() => { void setColour(selected.key, colour) }}\r\n className={`h-6 w-6 rounded-full border-2 ${\r\n selected.colour === colour ? 'border-foreground' : 'border-transparent'\r\n }`}\r\n style={{ backgroundColor: colour }}\r\n />\r\n ))}\r\n\r\n {/* Last in the row, set apart by a border and a margin: the palette is the\r\n default, not a limit. A plus rather than a swatch — a swatch of the current\r\n colour was indistinguishable from the presets beside it. The native input\r\n cannot be made round reliably across browsers, so it sits invisible on top. */}\r\n <label\r\n title={t('customColour', 'Pick any colour')}\r\n className=\"relative ml-1 flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded-full border border-input bg-background text-muted-foreground hover:text-foreground\"\r\n >\r\n <PlusIcon />\r\n <input\r\n type=\"color\"\r\n value={selected.colour}\r\n onChange={event => { void setColour(selected.key, event.target.value) }}\r\n className=\"absolute inset-0 h-full w-full cursor-pointer opacity-0\"\r\n />\r\n <span className=\"sr-only\">{t('customColour', 'Pick any colour')}</span>\r\n </label>\r\n </div>\r\n </div>\r\n\r\n <Button\r\n size=\"sm\"\r\n variant=\"ghost\"\r\n className=\"self-start\"\r\n onClick={() => { void remove(selected.key) }}\r\n >\r\n {t('delete', 'Delete')}\r\n </Button>\r\n </>\r\n )}\r\n </div>\r\n )\r\n}\r\n"],"mappings":";AA+CM,SAsLE,UAtLF,KAIA,YAJA;AA1CN,YAAY,WAAW;AAEvB,SAAS,0BAA0B;AACnC,SAAS,QAAQ,OAAO,iBAAiB;AACzC,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AAEtC,SAAS,kBAAkB;AAG3B,MAAM,WAAW;AAMjB,SAAS,UAAU;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMG;AACD,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAS,IAAI;AAC7C,QAAM,UAAU,MAAM,MAAM;AAE5B,QAAM,UAAU,MAAM,KAAK;AAC3B,QAAM,UAAU,QAAQ,SAAS,KAAK,YAAY;AAElD,QAAM,SAAS,MAAM;AACnB,QAAI,CAAC,QAAS;AACd,aAAS,OAAO;AAAA,EAClB;AAEA,SACE,qBAAC,SAAI,WAAU,uBACb;AAAA,wBAAC,WAAM,WAAU,uBAAsB,SAAS,SAAU,iBAAM;AAAA,IAIhE,qBAAC,SAAI,WAAU,2BACb;AAAA;AAA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AAA,UACL,SAAQ;AAAA,UACR,WAAU;AAAA,UACV,SAAS,MAAM;AAAE,iBAAK,OAAO,SAAS,GAAG;AAAA,UAAE;AAAA,UAE1C,YAAE,UAAU,QAAQ;AAAA;AAAA,MACvB;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
@@ -0,0 +1,10 @@
1
+ import type { LegendRegistration } from '@collabdt/plugin-kit/types/legend';
2
+ import type { MapToolProps, PluginContext } from '@collabdt/plugin-kit/types/map';
3
+ type Ctx = PluginContext<MapToolProps, unknown, unknown, LegendRegistration>;
4
+ /**
5
+ * Six surfaces over one store and one selection, in React subtrees with no common ancestor.
6
+ * Without that shared state this would be six unrelated widgets in one bundle.
7
+ */
8
+ export declare function activate(ctx: Ctx): void;
9
+ export {};
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/plugins/hello-map/src/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAEjF,KAAK,GAAG,GAAG,aAAa,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAA;AAE5E;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAgDvC"}
@@ -1,4 +1,3 @@
1
- import { ViewerNames } from "../sdk/types";
2
1
  import { MapTool } from "./components/MapTool";
3
2
  import { MarkerDialog } from "./components/MarkerDialog";
4
3
  import { MarkersLayer } from "./components/MarkersLayer";
@@ -21,7 +20,7 @@ function activate(ctx) {
21
20
  id: "markers",
22
21
  title: "Markers",
23
22
  // Map only: a list of map markers means nothing in BIM.
24
- viewers: [ViewerNames.map],
23
+ viewers: ["map"],
25
24
  useLegend: useMarkersLegend
26
25
  });
27
26
  ctx.register("viewer.tabs", {
@@ -29,7 +28,7 @@ function activate(ctx) {
29
28
  labelKey: "tabTitle",
30
29
  icon: "MapPin",
31
30
  // Recorded on the map, read in BIM; the point cloud has nothing to do with it.
32
- viewers: [ViewerNames.map, ViewerNames.bim],
31
+ viewers: ["map", "bim"],
33
32
  component: MarkersTab
34
33
  });
35
34
  ctx.register("data.pages", {
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/core/plugins/hello-map/src/index.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { MapTool } from './components/MapTool'\r\nimport { MarkerDialog } from './components/MarkerDialog'\r\nimport { MarkersLayer } from './components/MarkersLayer'\r\nimport { useMarkersLegend } from './components/MarkersLegend'\r\nimport { markerColumns, useMarkerRows } from './components/MarkersPage'\r\nimport { MarkersTab } from './components/MarkersTab'\r\n\r\nimport type { LegendRegistration } from '@collabdt/plugin-kit/types/legend'\r\nimport type { MapToolProps, PluginContext } from '@collabdt/plugin-kit/types/map'\r\n\r\ntype Ctx = PluginContext<MapToolProps, unknown, unknown, LegendRegistration>\r\n\r\n/**\r\n * Six surfaces over one store and one selection, in React subtrees with no common ancestor.\r\n * Without that shared state this would be six unrelated widgets in one bundle.\r\n */\r\nexport function activate(ctx: Ctx): void {\r\n ctx.register('map.tools', {\r\n id: 'hello-map',\r\n label: 'Hello Map',\r\n icon: 'MapPinPlus',\r\n component: MapTool,\r\n stayActive: true,\r\n })\r\n\r\n // Separate from the tool, whose panel unmounts when its dropdown closes.\r\n ctx.register('map.layers', {\r\n id: 'markers',\r\n component: MarkersLayer,\r\n })\r\n\r\n ctx.register('viewer.legends', {\r\n id: 'markers',\r\n title: 'Markers',\r\n // Map only: a list of map markers means nothing in BIM.\r\n viewers: ['map'],\r\n useLegend: useMarkersLegend,\r\n })\r\n\r\n ctx.register('viewer.tabs', {\r\n id: 'markers',\r\n labelKey: 'tabTitle',\r\n icon: 'MapPin',\r\n // Recorded on the map, read in BIM; the point cloud has nothing to do with it.\r\n viewers: ['map', 'bim'],\r\n component: MarkersTab,\r\n })\r\n\r\n ctx.register('data.pages', {\r\n id: 'markers',\r\n titleKey: 'pageTitle',\r\n icon: 'MapPinned',\r\n useRows: useMarkerRows,\r\n columns: markerColumns,\r\n emptyKey: 'empty',\r\n searchKeys: ['name'],\r\n })\r\n\r\n ctx.register('ui.dialogs', {\r\n id: 'detail',\r\n titleKey: 'dialogTitle',\r\n size: 'md',\r\n component: MarkerDialog,\r\n })\r\n}\r\n"],"mappings":"AAGA,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,eAAe,qBAAqB;AAC7C,SAAS,kBAAkB;AAWpB,SAAS,SAAS,KAAgB;AACvC,MAAI,SAAS,aAAa;AAAA,IACxB,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,WAAW;AAAA,IACX,YAAY;AAAA,EACd,CAAC;AAGD,MAAI,SAAS,cAAc;AAAA,IACzB,IAAI;AAAA,IACJ,WAAW;AAAA,EACb,CAAC;AAED,MAAI,SAAS,kBAAkB;AAAA,IAC7B,IAAI;AAAA,IACJ,OAAO;AAAA;AAAA,IAEP,SAAS,CAAC,KAAK;AAAA,IACf,WAAW;AAAA,EACb,CAAC;AAED,MAAI,SAAS,eAAe;AAAA,IAC1B,IAAI;AAAA,IACJ,UAAU;AAAA,IACV,MAAM;AAAA;AAAA,IAEN,SAAS,CAAC,OAAO,KAAK;AAAA,IACtB,WAAW;AAAA,EACb,CAAC;AAED,MAAI,SAAS,cAAc;AAAA,IACzB,IAAI;AAAA,IACJ,UAAU;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,UAAU;AAAA,IACV,YAAY,CAAC,MAAM;AAAA,EACrB,CAAC;AAED,MAAI,SAAS,cAAc;AAAA,IACzB,IAAI;AAAA,IACJ,UAAU;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markers.d.ts","sourceRoot":"","sources":["../../../../../src/core/plugins/hello-map/src/markers.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzD,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,kFAAkF;IAClF,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,MAAO,SAAQ,UAAU;IACxC,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,oGAAoG;AACpG,eAAO,MAAM,YAAY,KAAK,CAAA;AAY9B;;;GAGG;AACH,wBAAgB,UAAU;;;IAmGtB,0EAA0E;;;;;;oBA3DzD,MAAM,aAAa,MAAM,QAAQ,MAAM;qBA8BlD,MAAM,UAAU,MAAM;kBAKhB,MAAM,QAAQ,MAAM;kBAWpB,MAAM;EAwBrB"}
@@ -31,9 +31,9 @@ var __objRest = (source, exclude) => {
31
31
  return target;
32
32
  };
33
33
  import * as React from "react";
34
- import { stringToColour } from "../sdk";
35
- import { usePluginState } from "../sdk/state";
36
- import { usePluginStore } from "../sdk/store";
34
+ import { stringToColour } from "@collabdt/core/plugins-sdk";
35
+ import { usePluginState } from "@collabdt/core/plugins-sdk/state";
36
+ import { usePluginStore } from "@collabdt/core/plugins-sdk/store";
37
37
  const DEFAULT_ZOOM = 15;
38
38
  function toData(_a) {
39
39
  var _b = _a, { key: _key } = _b, data = __objRest(_b, ["key"]);
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/core/plugins/hello-map/src/markers.ts"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\nimport { stringToColour } from '@collabdt/core/plugins-sdk'\r\nimport { usePluginState } from '@collabdt/core/plugins-sdk/state'\r\nimport { usePluginStore } from '@collabdt/core/plugins-sdk/store'\r\n\r\nexport interface MarkerData extends Record<string, unknown> {\r\n name: string\r\n latitude: number\r\n longitude: number\r\n /** The zoom the marker was recorded at, so flying back restores the same view. */\r\n zoom: number\r\n colour: string\r\n}\r\n\r\nexport interface Marker extends MarkerData {\r\n key: string\r\n}\r\n\r\n/** Used when a record was written before `zoom` existed — `T` is a declaration, not a guarantee. */\r\nexport const DEFAULT_ZOOM = 15\r\n\r\n/** One edit path, so a field added to `MarkerData` cannot be dropped by a rename. */\r\nfunction toData({ key: _key, ...data }: Marker): MarkerData {\r\n return data\r\n}\r\n\r\n/** Unique without a counter to keep, so two quick clicks cannot collide. */\r\nfunction nextKey(): string {\r\n return `m-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 7)}`\r\n}\r\n\r\n/**\r\n * Everything every surface reads. Markers are records, so they survive a reload; the selection\r\n * and the open popup are session state, so they do not belong in the database.\r\n */\r\nexport function useMarkers() {\r\n const store = usePluginStore<MarkerData>('markers')\r\n const [selectedKey, setSelectedKey] = usePluginState<string | null>('selected', null)\r\n const [openKey, setOpenKey] = usePluginState<string | null>('open', null)\r\n // Every write goes through `attempt`, or a rejected save looks like a dead button.\r\n const [lastError, setLastError] = usePluginState<string | null>('lastError', null)\r\n\r\n const attempt = React.useCallback(\r\n async (action: () => Promise<void>) => {\r\n try {\r\n await action()\r\n setLastError(null)\r\n return true\r\n }\r\n catch (error) {\r\n const message = error instanceof Error ? error.message : String(error)\r\n console.error('[hello-map] save failed:', error)\r\n setLastError(message)\r\n return false\r\n }\r\n },\r\n [setLastError],\r\n )\r\n\r\n const markers = React.useMemo<Marker[]>(\r\n () => store.items.map(item => ({\r\n key: item.key,\r\n ...item.data,\r\n // Records written before `zoom` existed have none, and flyTo would get NaN.\r\n zoom: typeof item.data.zoom === 'number' ? item.data.zoom : DEFAULT_ZOOM,\r\n })),\r\n [store.items],\r\n )\r\n\r\n const byKey = React.useMemo(\r\n () => new Map(markers.map(marker => [marker.key, marker])),\r\n [markers],\r\n )\r\n\r\n const add = React.useCallback(\r\n async (latitude: number, longitude: number, zoom: number) => {\r\n const key = nextKey()\r\n\r\n // A palette colour, so a page of markers stays readable and colourblind-safe.\r\n const saved = await attempt(() => store.put(key, {\r\n name: `Marker ${store.items.length + 1}`,\r\n latitude,\r\n longitude,\r\n zoom,\r\n colour: stringToColour(key),\r\n }))\r\n\r\n if (saved) setSelectedKey(key)\r\n return saved ? key : null\r\n },\r\n [store, setSelectedKey, attempt],\r\n )\r\n\r\n /** One edit path, so a field added to `MarkerData` cannot be dropped by a rename. */\r\n const patch = React.useCallback(\r\n async (key: string, changes: Partial<MarkerData>) => {\r\n const current = byKey.get(key)\r\n if (!current) return\r\n\r\n await attempt(() => store.put(key, { ...toData(current), ...changes }))\r\n },\r\n [store, byKey, attempt],\r\n )\r\n\r\n const setColour = React.useCallback(\r\n (key: string, colour: string) => patch(key, { colour }),\r\n [patch],\r\n )\r\n\r\n const rename = React.useCallback(\r\n async (key: string, name: string) => {\r\n const trimmed = name.trim()\r\n // An empty name would leave an unlabelled row and legend entry.\r\n if (!trimmed || trimmed === byKey.get(key)?.name) return\r\n\r\n await patch(key, { name: trimmed })\r\n },\r\n [patch, byKey],\r\n )\r\n\r\n const remove = React.useCallback(\r\n async (key: string) => {\r\n const removed = await attempt(() => store.remove(key))\r\n if (!removed) return\r\n\r\n setSelectedKey(current => (current === key ? null : current))\r\n setOpenKey(current => (current === key ? null : current))\r\n },\r\n [store, setSelectedKey, setOpenKey, attempt],\r\n )\r\n\r\n return {\r\n markers,\r\n isLoading: store.isLoading,\r\n /** The last write that failed, or null. Shown by the tool and the tab. */\r\n lastError,\r\n selected: selectedKey === null ? null : byKey.get(selectedKey) ?? null,\r\n openMarker: openKey === null ? null : byKey.get(openKey) ?? null,\r\n select: setSelect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AK;AAAA,EACf;AAEA,QAAM,SAAS,MAAM;AAAA,IACnB,OAAO,QAAgB;AACrB,YAAM,UAAU,MAAM,QAAQ,MAAM,MAAM,OAAO,GAAG,CAAC;AACrD,UAAI,CAAC,QAAS;AAEd,qBAAe,aAAY,YAAY,MAAM,OAAO,OAAQ;AAC5D,iBAAW,aAAY,YAAY,MAAM,OAAO,OAAQ;AAAA,IAC1D;AAAA,IACA,CAAC,OAAO,gBAAgB,YAAY,OAAO;AAAA,EAC7C;AAEA,SAAO;AAAA,IACL;AAAA,IACA,WAAW,MAAM;AAAA;AAAA,IAEjB;AAAA,IACA,UAAU,gBAAgB,OAAO,QAAO,WAAM,IAAI,WAAW,MAArB,YAA0B;AAAA,IAClE,YAAY,YAAY,OAAO,QAAO,WAAM,IAAI,OAAO,MAAjB,YAAsB;AAAA,IAC5D,QAAQ;AAAA,IACR,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["_a"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/host/context.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { ViewerNames } from '../sdk/types'\n\nimport type { PluginRegistry } from './registry'\nimport type {\n PluginContext,\n PluginCapability,\n CapabilityRegistry,\n} from '../sdk/types'\n\ninterface CreateContextOptions {\n pluginId: string\n capabilities: PluginCapability[]\n config: Record<string, unknown>\n registry: PluginRegistry\n}\n\n// `ViewerNames` also names routes like settings and users; only these three host contributions.\nconst TARGETABLE_VIEWERS = new Set<string>([\n ViewerNames.map,\n ViewerNames.bim,\n ViewerNames.pointcloud,\n])\n\n// A viewer name outside the three renders nowhere and throws nothing, so say so once here.\nfunction warnOnUnknownViewers(pluginId: string, key: string, item: unknown): void {\n const { viewers } = item as { viewers?: unknown }\n if (!Array.isArray(viewers)) return\n\n const unknown = viewers.filter(viewer => !TARGETABLE_VIEWERS.has(viewer as string))\n if (unknown.length === 0) return\n\n console.warn(\n `Plugin \"${pluginId}\" targets unknown viewer(s) ${unknown.map(v => JSON.stringify(v)).join(', ')} `\n + `in its \"${key}\" contribution, so it renders nowhere. Valid viewers: `\n + `${[...TARGETABLE_VIEWERS].join(', ')}.`,\n )\n}\n\nexport function createPluginContext(options: CreateContextOptions): PluginContext {\n const { pluginId, capabilities, config, registry } = options\n const declared = new Set<string>(capabilities)\n\n return {\n pluginId,\n config,\n register<K extends keyof CapabilityRegistry>(key: K, item: CapabilityRegistry[K]): void {\n if (!declared.has(key)) {\n throw new Error(\n `Plugin \"${pluginId}\" did not declare capability \"${key}\" in its manifest`,\n )\n }\n\n warnOnUnknownViewers(pluginId, key, item)\n\n // `pluginId` last, so a plugin cannot pass one and claim to be another. The\n // double cast is because the registration types have no index signature and\n // `RegistryEntry` needs one to store shapes keyed by capability.\n registry.register(key, { ...(item as unknown as Record<string, unknown>), pluginId })\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAGA,SAAS,mBAAmB;AAiB5B,MAAM,qBAAqB,oBAAI,IAAY;AAAA,EACzC,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AACd,CAAC;AAGD,SAAS,qBAAqB,UAAkB,KAAa,MAAqB;AAChF,QAAM,EAAE,QAAQ,IAAI;AACpB,MAAI,CAAC,MAAM,QAAQ,OAAO,EAAG;AAE7B,QAAM,UAAU,QAAQ,OAAO,YAAU,CAAC,mBAAmB,IAAI,MAAgB,CAAC;AAClF,MAAI,QAAQ,WAAW,EAAG;AAE1B,UAAQ;AAAA,IACN,WAAW,QAAQ,+BAA+B,QAAQ,IAAI,OAAK,KAAK,UAAU,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,YACnF,GAAG,yDACX,CAAC,GAAG,kBAAkB,EAAE,KAAK,IAAI,CAAC;AAAA,EACzC;AACF;AAEO,SAAS,oBAAoB,SAA8C;AAChF,QAAM,EAAE,UAAU,cAAc,QAAQ,SAAS,IAAI;AACrD,QAAM,WAAW,IAAI,IAAY,YAAY;AAE7C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,SAA6C,KAAQ,MAAmC;AACtF,UAAI,CAAC,SAAS,IAAI,GAAG,GAAG;AACtB,cAAM,IAAI;AAAA,UACR,WAAW,QAAQ,iCAAiC,GAAG;AAAA,QACzD;AAAA,MACF;AAEA,2BAAqB,UAAU,KAAK,IAAI;AAKxC,eAAS,SAAS,KAAK,iCAAM,OAAN,EAAmD,SAAS,EAAC;AAAA,IACtF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/plugins/host/context.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { ViewerNames } from '../sdk/types'\r\n\r\nimport type { PluginRegistry } from './registry'\r\nimport type {\r\n PluginContext,\r\n PluginCapability,\r\n CapabilityRegistry,\r\n} from '../sdk/types'\r\n\r\ninterface CreateContextOptions {\r\n pluginId: string\r\n capabilities: PluginCapability[]\r\n config: Record<string, unknown>\r\n registry: PluginRegistry\r\n}\r\n\r\n// `ViewerNames` also names routes like settings and users; only these three host contributions.\r\nconst TARGETABLE_VIEWERS = new Set<string>([\r\n ViewerNames.map,\r\n ViewerNames.bim,\r\n ViewerNames.pointcloud,\r\n])\r\n\r\n// A viewer name outside the three renders nowhere and throws nothing, so say so once here.\r\nfunction warnOnUnknownViewers(pluginId: string, key: string, item: unknown): void {\r\n const { viewers } = item as { viewers?: unknown }\r\n if (!Array.isArray(viewers)) return\r\n\r\n const unknown = viewers.filter(viewer => !TARGETABLE_VIEWERS.has(viewer as string))\r\n if (unknown.length === 0) return\r\n\r\n console.warn(\r\n `Plugin \"${pluginId}\" targets unknown viewer(s) ${unknown.map(v => JSON.stringify(v)).join(', ')} `\r\n + `in its \"${key}\" contribution, so it renders nowhere. Valid viewers: `\r\n + `${[...TARGETABLE_VIEWERS].join(', ')}.`,\r\n )\r\n}\r\n\r\nexport function createPluginContext(options: CreateContextOptions): PluginContext {\r\n const { pluginId, capabilities, config, registry } = options\r\n const declared = new Set<string>(capabilities)\r\n\r\n return {\r\n pluginId,\r\n config,\r\n register<K extends keyof CapabilityRegistry>(key: K, item: CapabilityRegistry[K]): void {\r\n if (!declared.has(key)) {\r\n throw new Error(\r\n `Plugin \"${pluginId}\" did not declare capability \"${key}\" in its manifest`,\r\n )\r\n }\r\n\r\n warnOnUnknownViewers(pluginId, key, item)\r\n\r\n // `pluginId` last, so a plugin cannot pass one and claim to be another. The\r\n // double cast is because the registration types have no index signature and\r\n // `RegistryEntry` needs one to store shapes keyed by capability.\r\n registry.register(key, { ...(item as unknown as Record<string, unknown>), pluginId })\r\n },\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAGA,SAAS,mBAAmB;AAiB5B,MAAM,qBAAqB,oBAAI,IAAY;AAAA,EACzC,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,YAAY;AACd,CAAC;AAGD,SAAS,qBAAqB,UAAkB,KAAa,MAAqB;AAChF,QAAM,EAAE,QAAQ,IAAI;AACpB,MAAI,CAAC,MAAM,QAAQ,OAAO,EAAG;AAE7B,QAAM,UAAU,QAAQ,OAAO,YAAU,CAAC,mBAAmB,IAAI,MAAgB,CAAC;AAClF,MAAI,QAAQ,WAAW,EAAG;AAE1B,UAAQ;AAAA,IACN,WAAW,QAAQ,+BAA+B,QAAQ,IAAI,OAAK,KAAK,UAAU,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,YACnF,GAAG,yDACX,CAAC,GAAG,kBAAkB,EAAE,KAAK,IAAI,CAAC;AAAA,EACzC;AACF;AAEO,SAAS,oBAAoB,SAA8C;AAChF,QAAM,EAAE,UAAU,cAAc,QAAQ,SAAS,IAAI;AACrD,QAAM,WAAW,IAAI,IAAY,YAAY;AAE7C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,SAA6C,KAAQ,MAAmC;AACtF,UAAI,CAAC,SAAS,IAAI,GAAG,GAAG;AACtB,cAAM,IAAI;AAAA,UACR,WAAW,QAAQ,iCAAiC,GAAG;AAAA,QACzD;AAAA,MACF;AAEA,2BAAqB,UAAU,KAAK,IAAI;AAKxC,eAAS,SAAS,KAAK,iCAAM,OAAN,EAAmD,SAAS,EAAC;AAAA,IACtF;AAAA,EACF;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/host/pluginIcon.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport * as LR from 'lucide-react'\n\nimport type { LucideProps } from 'lucide-react'\nimport type * as React from 'react'\n\n// A leaf module on purpose: the Plugins page resolves an icon too, and importing a hook to\n// get this pulled the store barrel into a card that has no business with it.\n\n/** Shown when a plugin names an icon that does not exist, so the button still appears. */\nconst FALLBACK_ICON = LR.Puzzle\n\n/** A plugin may pass a lucide component, or its name as a string — JSON manifests only carry the string. */\nexport function resolvePluginIcon(\n icon: string | React.ComponentType<LucideProps>,\n): React.ComponentType<LucideProps> {\n if (typeof icon !== 'string') return icon\n\n const candidate = (LR as unknown as Record<string, unknown>)[icon]\n return isComponent(candidate) ? candidate : FALLBACK_ICON\n}\n\n// Lucide icons are `forwardRef` objects, so a bare `typeof === 'function'` check\n// rejects every real icon. Anything renderable is callable or carries `$$typeof`.\nfunction isComponent(value: unknown): value is React.ComponentType<LucideProps> {\n if (typeof value === 'function') return true\n return typeof value === 'object' && value !== null && '$$typeof' in value\n}\n"],"mappings":"AAGA,YAAY,QAAQ;AASpB,MAAM,gBAAgB,GAAG;AAGlB,SAAS,kBACd,MACkC;AAClC,MAAI,OAAO,SAAS,SAAU,QAAO;AAErC,QAAM,YAAa,GAA0C,IAAI;AACjE,SAAO,YAAY,SAAS,IAAI,YAAY;AAC9C;AAIA,SAAS,YAAY,OAA2D;AAC9E,MAAI,OAAO,UAAU,WAAY,QAAO;AACxC,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,cAAc;AACtE;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/plugins/host/pluginIcon.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as LR from 'lucide-react'\r\n\r\nimport type { LucideProps } from 'lucide-react'\r\nimport type * as React from 'react'\r\n\r\n// A leaf module on purpose: the Plugins page resolves an icon too, and importing a hook to\r\n// get this pulled the store barrel into a card that has no business with it.\r\n\r\n/** Shown when a plugin names an icon that does not exist, so the button still appears. */\r\nconst FALLBACK_ICON = LR.Puzzle\r\n\r\n/** A plugin may pass a lucide component, or its name as a string — JSON manifests only carry the string. */\r\nexport function resolvePluginIcon(\r\n icon: string | React.ComponentType<LucideProps>,\r\n): React.ComponentType<LucideProps> {\r\n if (typeof icon !== 'string') return icon\r\n\r\n const candidate = (LR as unknown as Record<string, unknown>)[icon]\r\n return isComponent(candidate) ? candidate : FALLBACK_ICON\r\n}\r\n\r\n// Lucide icons are `forwardRef` objects, so a bare `typeof === 'function'` check\r\n// rejects every real icon. Anything renderable is callable or carries `$$typeof`.\r\nfunction isComponent(value: unknown): value is React.ComponentType<LucideProps> {\r\n if (typeof value === 'function') return true\r\n return typeof value === 'object' && value !== null && '$$typeof' in value\r\n}\r\n"],"mappings":"AAGA,YAAY,QAAQ;AASpB,MAAM,gBAAgB,GAAG;AAGlB,SAAS,kBACd,MACkC;AAClC,MAAI,OAAO,SAAS,SAAU,QAAO;AAErC,QAAM,YAAa,GAA0C,IAAI;AACjE,SAAO,YAAY,SAAS,IAAI,YAAY;AAC9C;AAIA,SAAS,YAAY,OAA2D;AAC9E,MAAI,OAAO,UAAU,WAAY,QAAO;AACxC,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,cAAc;AACtE;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/host/runtimeShims.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\n/** One bare specifier a runtime-loaded plugin may import, and the shim the host serves. */\nexport interface RuntimeShim {\n /** Filename served under `/plugin-runtime/`. */\n file: string\n /** Key on `globalThis.__CDT_RUNTIME__` that the host bridge populates. */\n bridge: string\n /** The bare specifier the plugin writes. */\n specifier: string\n /** Re-exported by name, because an import map cannot rewrite a namespace. */\n exports: string[]\n}\n\n// Part of the host contract, so it lives beside `PLUGIN_HOST_API` rather than in the\n// app. Three consumers derive from it — the app's shim generator, the published import\n// map, and `@collabdt/plugin-kit`'s build preset — and when they disagree a plugin\n// either bundles a second copy of a singleton or dies on an unmapped specifier.\n//\n// Absent on purpose: `@thatopen/components`, `three`, `maplibre-gl`, `lucide-react`. A\n// plugin gets viewer instances as props and names icons by string, so it never imports\n// those at runtime — which is what stops a second copy of three.js loading.\nexport const PLUGIN_RUNTIME_SHIMS: readonly RuntimeShim[] = [\n {\n file: 'react.js',\n bridge: 'react',\n specifier: 'react',\n exports: [\n 'Children', 'Component', 'Fragment', 'Profiler', 'PureComponent',\n 'StrictMode', 'Suspense', 'cloneElement', 'createContext',\n 'createElement', 'createRef', 'forwardRef', 'isValidElement', 'lazy',\n 'memo', 'startTransition', 'useCallback', 'useContext', 'useDebugValue',\n 'useDeferredValue', 'useEffect', 'useId', 'useImperativeHandle',\n 'useInsertionEffect', 'useLayoutEffect', 'useMemo', 'useReducer',\n 'useRef', 'useState', 'useSyncExternalStore', 'useTransition', 'version',\n ],\n },\n {\n file: 'react-dom.js',\n bridge: 'reactDom',\n specifier: 'react-dom',\n exports: ['createPortal', 'flushSync', 'version'],\n },\n {\n file: 'jsx-runtime.js',\n bridge: 'jsxRuntime',\n specifier: 'react/jsx-runtime',\n exports: ['Fragment', 'jsx', 'jsxs'],\n },\n {\n file: 'sdk.js',\n bridge: 'sdk',\n specifier: '@collabdt/core/plugins-sdk',\n exports: [\n 'VALID_CAPABILITIES', 'validateManifest', 'PLUGIN_HOST_API', 'resolvePluginEntry',\n // A value, not just a type: a `viewer.tabs` contribution names the viewers it belongs in.\n 'ViewerNames',\n // So a plugin colouring something on the map uses the platform's palette.\n 'MAP_COLOUR_PALETTE', 'stringToColour',\n ],\n },\n {\n file: 'sdk-config.js',\n bridge: 'sdkConfig',\n specifier: '@collabdt/core/plugins-sdk/config',\n exports: ['usePluginConfig', 'usePluginId'],\n },\n {\n file: 'sdk-messages.js',\n bridge: 'sdkMessages',\n specifier: '@collabdt/core/plugins-sdk/messages',\n exports: ['usePluginMessage', 'usePluginTranslations', 'useCoreTranslations'],\n },\n {\n file: 'sdk-store.js',\n bridge: 'sdkStore',\n specifier: '@collabdt/core/plugins-sdk/store',\n exports: ['usePluginStore'],\n },\n {\n file: 'sdk-data.js',\n bridge: 'sdkData',\n specifier: '@collabdt/core/plugins-sdk/data',\n exports: [\n 'useBuildings', 'useBuilding', 'useBuildingsByOsm', 'useBuildingOsmIds',\n 'useSites', 'useSite',\n 'useInfrastructures', 'useInfrastructure',\n 'useOrganization', 'useOrganizationByName',\n 'useFiles', 'useFile', 'useFilesByBuildingId', 'useFilesBySiteId', 'useDownloadFile',\n 'useSensors', 'useSensor', 'useSensorsByBuilding', 'useSensorsByAuthor', 'useCreateSensor',\n 'useSensorTypes', 'useSensorType',\n 'useComments', 'useComment', 'useCommentsByBuilding', 'useCommentsByAuthor',\n 'useCreateComment', 'useDeleteComments',\n // Re-exported by the module, so a plugin reaching for data finds both here too.\n 'usePluginConfig', 'usePluginPermissions',\n ],\n },\n {\n file: 'sdk-state.js',\n bridge: 'sdkState',\n specifier: '@collabdt/core/plugins-sdk/state',\n exports: ['usePluginState'],\n },\n {\n file: 'sdk-ui.js',\n bridge: 'sdkUi',\n specifier: '@collabdt/core/plugins-sdk/ui',\n exports: ['usePluginDialogs'],\n },\n {\n file: 'sdk-components.js',\n bridge: 'sdkComponents',\n specifier: '@collabdt/core/plugins-sdk/components',\n exports: [\n 'Badge', 'Button', 'Input', 'Separator',\n 'Card', 'CardContent', 'CardDescription', 'CardFooter', 'CardHeader', 'CardTitle',\n 'Dialog', 'DialogClose', 'DialogContent', 'DialogDescription',\n 'DialogFooter', 'DialogHeader', 'DialogTitle', 'DialogTrigger',\n ],\n },\n]\n\n/** Just the specifiers, which is what a bundler's `external` option wants. */\nexport const PLUGIN_EXTERNALS: readonly string[] = PLUGIN_RUNTIME_SHIMS.map(\n shim => shim.specifier,\n)\n"],"mappings":"AAuBO,MAAM,uBAA+C;AAAA,EAC1D;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAY;AAAA,MAAa;AAAA,MAAY;AAAA,MAAY;AAAA,MACjD;AAAA,MAAc;AAAA,MAAY;AAAA,MAAgB;AAAA,MAC1C;AAAA,MAAiB;AAAA,MAAa;AAAA,MAAc;AAAA,MAAkB;AAAA,MAC9D;AAAA,MAAQ;AAAA,MAAmB;AAAA,MAAe;AAAA,MAAc;AAAA,MACxD;AAAA,MAAoB;AAAA,MAAa;AAAA,MAAS;AAAA,MAC1C;AAAA,MAAsB;AAAA,MAAmB;AAAA,MAAW;AAAA,MACpD;AAAA,MAAU;AAAA,MAAY;AAAA,MAAwB;AAAA,MAAiB;AAAA,IACjE;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,gBAAgB,aAAa,SAAS;AAAA,EAClD;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,YAAY,OAAO,MAAM;AAAA,EACrC;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAsB;AAAA,MAAoB;AAAA,MAAmB;AAAA;AAAA,MAE7D;AAAA;AAAA,MAEA;AAAA,MAAsB;AAAA,IACxB;AAAA,EACF;AAAA,E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AAc;AAAA,MACtE;AAAA,MAAU;AAAA,MAAe;AAAA,MAAiB;AAAA,MAC1C;AAAA,MAAgB;AAAA,MAAgB;AAAA,MAAe;AAAA,IACjD;AAAA,EACF;AACF;AAGO,MAAM,mBAAsC,qBAAqB;AAAA,EACtE,UAAQ,KAAK;AACf;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/plugins/host/runtimeShims.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\n/** One bare specifier a runtime-loaded plugin may import, and the shim the host serves. */\r\nexport interface RuntimeShim {\r\n /** Filename served under `/plugin-runtime/`. */\r\n file: string\r\n /** Key on `globalThis.__CDT_RUNTIME__` that the host bridge populates. */\r\n bridge: string\r\n /** The bare specifier the plugin writes. */\r\n specifier: string\r\n /** Re-exported by name, because an import map cannot rewrite a namespace. */\r\n exports: string[]\r\n}\r\n\r\n// Part of the host contract, so it lives beside `PLUGIN_HOST_API` rather than in the\r\n// app. Three consumers derive from it — the app's shim generator, the published import\r\n// map, and `@collabdt/plugin-kit`'s build preset — and when they disagree a plugin\r\n// either bundles a second copy of a singleton or dies on an unmapped specifier.\r\n//\r\n// Absent on purpose: `@thatopen/components`, `three`, `maplibre-gl`, `lucide-react`. A\r\n// plugin gets viewer instances as props and names icons by string, so it never imports\r\n// those at runtime — which is what stops a second copy of three.js loading.\r\nexport const PLUGIN_RUNTIME_SHIMS: readonly RuntimeShim[] = [\r\n {\r\n file: 'react.js',\r\n bridge: 'react',\r\n specifier: 'react',\r\n exports: [\r\n 'Children', 'Component', 'Fragment', 'Profiler', 'PureComponent',\r\n 'StrictMode', 'Suspense', 'cloneElement', 'createContext',\r\n 'createElement', 'createRef', 'forwardRef', 'isValidElement', 'lazy',\r\n 'memo', 'startTransition', 'useCallback', 'useContext', 'useDebugValue',\r\n 'useDeferredValue', 'useEffect', 'useId', 'useImperativeHandle',\r\n 'useInsertionEffect', 'useLayoutEffect', 'useMemo', 'useReducer',\r\n 'useRef', 'useState', 'useSyncExternalStore', 'useTransition', 'version',\r\n ],\r\n },\r\n {\r\n file: 'react-dom.js',\r\n bridge: 'reactDom',\r\n specifier: 'react-dom',\r\n exports: ['createPortal', 'flushSync', 'version'],\r\n },\r\n {\r\n file: 'jsx-runtime.js',\r\n bridge: 'jsxRuntime',\r\n specifier: 'react/jsx-runtime',\r\n exports: ['Fragment', 'jsx', 'jsxs'],\r\n },\r\n {\r\n file: 'sdk.js',\r\n bridge: 'sdk',\r\n specifier: '@collabdt/core/plugins-sdk',\r\n exports: [\r\n 'VALID_CAPABILITIES', 'validateManifest', 'PLUGIN_HOST_API', 'resolvePluginEntry',\r\n // A value, not just a type: a `viewer.tabs` contribution names the viewers it belongs in.\r\n 'ViewerNames',\r\n // So a plugin colouring something on the map uses the platform's palette.\r\n 'MAP_COLOUR_PALETTE', 'stringToColour',\r\n ],\r\n },\r\n {\r\n file: 'sdk-config.js',\r\n bridge: 'sdkConfig',\r\n specifier: '@collabdt/core/plugins-sdk/config',\r\n exports: ['usePluginConfig', 'usePluginId'],\r\n },\r\n {\r\n file: 'sdk-messages.js',\r\n bridge: 'sdkMessages',\r\n specifier: '@collabdt/core/plugins-sdk/messages',\r\n exports: ['usePluginMessage', 'usePluginTranslations', 'useCoreTranslations'],\r\n },\r\n {\r\n file: 'sdk-store.js',\r\n bridge: 'sdkStore',\r\n specifier: '@collabdt/core/plugins-sdk/store',\r\n exports: ['usePluginStore'],\r\n },\r\n {\r\n file: 'sdk-data.js',\r\n bridge: 'sdkData',\r\n specifier: '@collabdt/core/plugins-sdk/data',\r\n exports: [\r\n 'useBuildings', 'useBuilding', 'useBuildingsByOsm', 'useBuildingOsmIds',\r\n 'useSites', 'useSite',\r\n 'useInfrastructures', 'useInfrastructure',\r\n 'useOrganization', 'useOrganizationByName',\r\n 'useFiles', 'useFile', 'useFilesByBuildingId', 'useFilesBySiteId', 'useDownloadFile',\r\n 'useSensors', 'useSensor', 'useSensorsByBuilding', 'useSensorsByAuthor', 'useCreateSensor',\r\n 'useSensorTypes', 'useSensorType',\r\n 'useComments', 'useComment', 'useCommentsByBuilding', 'useCommentsByAuthor',\r\n 'useCreateComment', 'useDeleteComments',\r\n // Re-exported by the module, so a plugin reaching for data finds both here too.\r\n 'usePluginConfig', 'usePluginPermissions',\r\n ],\r\n },\r\n {\r\n file: 'sdk-state.js',\r\n bridge: 'sdkState',\r\n specifier: '@collabdt/core/plugins-sdk/state',\r\n exports: ['usePluginState'],\r\n },\r\n {\r\n file: 'sdk-ui.js',\r\n bridge: 'sdkUi',\r\n specifier: '@collabdt/core/plugins-sdk/ui',\r\n exports: ['usePluginDialogs'],\r\n },\r\n {\r\n file: 'sdk-components.js',\r\n bridge: 'sdkComponents',\r\n specifier: '@collabdt/core/plugins-sdk/components',\r\n exports: [\r\n 'Badge', 'Button', 'Input', 'Separator',\r\n 'Card', 'CardContent', 'CardDescription', 'CardFooter', 'CardHeader', 'CardTitle',\r\n 'Dialog', 'DialogClose', 'DialogContent', 'DialogDescription',\r\n 'DialogFooter', 'DialogHeader', 'DialogTitle', 'DialogTrigger',\r\n ],\r\n },\r\n]\r\n\r\n/** Just the specifiers, which is what a bundler's `external` option wants. */\r\nexport const PLUGIN_EXTERNALS: readonly string[] = PLUGIN_RUNTIME_SHIMS.map(\r\n shim => shim.specifier,\r\n)\r\n"],"mappings":"AAuBO,MAAM,uBAA+C;AAAA,EAC1D;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAY;AAAA,MAAa;AAAA,MAAY;AAAA,MAAY;AAAA,MACjD;AAAA,MAAc;AAAA,MAAY;AAAA,MAAgB;AAAA,MAC1C;AAAA,MAAiB;AAAA,MAAa;AAAA,MAAc;AAAA,MAAkB;AAAA,MAC9D;AAAA,MAAQ;AAAA,MAAmB;AAAA,MAAe;AAAA,MAAc;AAAA,MACxD;AAAA,MAAoB;AAAA,MAAa;AA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AA,MAAwB;AAAA,MAAsB;AAAA,MACzE;AAAA,MAAkB;AAAA,MAClB;AAAA,MAAe;AAAA,MAAc;AAAA,MAAyB;AAAA,MACtD;AAAA,MAAoB;AAAA;AAAA,MAEpB;AAAA,MAAmB;AAAA,IACrB;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,gBAAgB;AAAA,EAC5B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS,CAAC,kBAAkB;AAAA,EAC9B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAS;AAAA,MAAU;AAAA,MAAS;AAAA,MAC5B;AAAA,MAAQ;AAAA,MAAe;AAAA,MAAmB;AAAA,MAAc;AAAA,MAAc;AAAA,MACtE;AAAA,MAAU;AAAA,MAAe;AAAA,MAAiB;AAAA,MAC1C;AAAA,MAAgB;AAAA,MAAgB;AAAA,MAAe;AAAA,IACjD;AAAA,EACF;AACF;AAGO,MAAM,mBAAsC,qBAAqB;AAAA,EACtE,UAAQ,KAAK;AACf;","names":[]}
@@ -5,8 +5,8 @@ function manifestFor(slug) {
5
5
  return manifest;
6
6
  }
7
7
  const INSTALLED_PLUGINS = [
8
- { manifest: manifestFor("hello-map"), entry: () => import("./hello-map") },
9
- { manifest: manifestFor("hello-bim"), entry: () => import("./hello-bim") }
8
+ { manifest: manifestFor("hello-map"), entry: () => import("./hello-map/src") },
9
+ { manifest: manifestFor("hello-bim"), entry: () => import("./hello-bim/src") }
10
10
  ];
11
11
  export {
12
12
  INSTALLED_PLUGINS
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/plugins/installed.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport { PLUGIN_MANIFESTS } from './manifests'\r\n\r\nimport type { PluginManifest, PluginSource } from './sdk/types'\r\n\r\n/** Looked up by slug, not by position: reordering `manifests.ts` must not mispair. */\r\nfunction manifestFor(slug: string): PluginManifest {\r\n const manifest = PLUGIN_MANIFESTS.find(candidate => candidate.slug === slug)\r\n if (!manifest) throw new Error(`No manifest registered in manifests.ts for plugin \"${slug}\"`)\r\n return manifest\r\n}\r\n\r\n/**\r\n * The plugins compiled into this build of core, in load order. To add one: put its\r\n * manifest in `manifests.ts`, then pair that slug with a dynamic import here.\r\n *\r\n * Entries must stay dynamic imports. `installed.ts` is reachable from\r\n * `PluginHostProvider`, which sits in every route's provider tree, so a static\r\n * import would put every plugin's components — `@thatopen` and three among them —\r\n * in the eager bundle. Resolved at activation time instead, one chunk each.\r\n *\r\n * A default only: a consumer can pass its own list via\r\n * `<PluginHostProvider plugins={...}>` and gate it with `enabledSlugs`.\r\n *\r\n * The `hello-*` pair are the documentation's worked examples and the boundary's\r\n * regression test — they import nothing outside `sdk/`, so an insufficient plugin\r\n * surface stops them compiling.\r\n */\r\nexport const INSTALLED_PLUGINS: PluginSource[] = [\r\n { manifest: manifestFor('hello-map'), entry: () => import('./hello-map') },\r\n { manifest: manifestFor('hello-bim'), entry: () => import('./hello-bim') },\r\n]\r\n"],"mappings":"AAGA,SAAS,wBAAwB;AAKjC,SAAS,YAAY,MAA8B;AACjD,QAAM,WAAW,iBAAiB,KAAK,eAAa,UAAU,SAAS,IAAI;AAC3E,MAAI,CAAC,SAAU,OAAM,IAAI,MAAM,sDAAsD,IAAI,GAAG;AAC5F,SAAO;AACT;AAkBO,MAAM,oBAAoC;AAAA,EAC/C,EAAE,UAAU,YAAY,WAAW,GAAG,OAAO,MAAM,OAAO,aAAa,EAAE;AAAA,EACzE,EAAE,UAAU,YAAY,WAAW,GAAG,OAAO,MAAM,OAAO,aAAa,EAAE;AAC3E;","names":[]}
1
+ {"version":3,"sources":["../../../src/core/plugins/installed.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport { PLUGIN_MANIFESTS } from './manifests'\n\nimport type { PluginManifest, PluginSource } from './sdk/types'\n\n/** Looked up by slug, not by position: reordering `manifests.ts` must not mispair. */\nfunction manifestFor(slug: string): PluginManifest {\n const manifest = PLUGIN_MANIFESTS.find(candidate => candidate.slug === slug)\n if (!manifest) throw new Error(`No manifest registered in manifests.ts for plugin \"${slug}\"`)\n return manifest\n}\n\n/**\n * The plugins compiled into this build of core, in load order. To add one: put its\n * manifest in `manifests.ts`, then pair that slug with a dynamic import here.\n *\n * Entries must stay dynamic imports. `installed.ts` is reachable from\n * `PluginHostProvider`, which sits in every route's provider tree, so a static\n * import would put every plugin's components — `@thatopen` and three among them —\n * in the eager bundle. Resolved at activation time instead, one chunk each.\n *\n * A default only: a consumer can pass its own list via\n * `<PluginHostProvider plugins={...}>` and gate it with `enabledSlugs`.\n *\n * The `hello-*` pair are the documentation's worked examples and the boundary's\n * regression test — they import nothing outside `sdk/`, so an insufficient plugin\n * surface stops them compiling.\n */\nexport const INSTALLED_PLUGINS: PluginSource[] = [\n { manifest: manifestFor('hello-map'), entry: () => import('./hello-map/src') },\n { manifest: manifestFor('hello-bim'), entry: () => import('./hello-bim/src') },\n]\n"],"mappings":"AAGA,SAAS,wBAAwB;AAKjC,SAAS,YAAY,MAA8B;AACjD,QAAM,WAAW,iBAAiB,KAAK,eAAa,UAAU,SAAS,IAAI;AAC3E,MAAI,CAAC,SAAU,OAAM,IAAI,MAAM,sDAAsD,IAAI,GAAG;AAC5F,SAAO;AACT;AAkBO,MAAM,oBAAoC;AAAA,EAC/C,EAAE,UAAU,YAAY,WAAW,GAAG,OAAO,MAAM,OAAO,iBAAiB,EAAE;AAAA,EAC7E,EAAE,UAAU,YAAY,WAAW,GAAG,OAAO,MAAM,OAAO,iBAAiB,EAAE;AAC/E;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/plugins/manifests.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport helloBimManifest from './hello-bim/manifest.json'\r\nimport helloMapManifest from './hello-map/manifest.json'\r\n\r\nimport type { PluginManifest } from './sdk/types'\r\n\r\n/**\r\n * The manifests of the plugins compiled into this build, separate from\r\n * `installed.ts` so they can be read without their entry modules.\r\n *\r\n * `i18n/index.ts` collects plugin strings and is reachable from the server graph\r\n * through the `./messages` export, so it must read manifests without dragging in a\r\n * plugin's components and, with them, a viewer engine. Plain JSON, no runtime deps.\r\n */\r\nexport const PLUGIN_MANIFESTS: PluginManifest[] = [\r\n helloMapManifest as PluginManifest,\r\n helloBimManifest as PluginManifest,\r\n]\r\n"],"mappings":"AAGA,OAAO,sBAAsB;AAC7B,OAAO,sBAAsB;AAYtB,MAAM,mBAAqC;AAAA,EAChD;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/core/plugins/manifests.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\n// Copyright (C) 2025 Collab Digital Twins\n\nimport helloBimManifest from './hello-bim/manifest.json'\nimport helloMapManifest from './hello-map/manifest.json'\n\nimport type { PluginManifest } from './sdk/types'\n\n/**\n * The manifests of the plugins compiled into this build, separate from\n * `installed.ts` so they can be read without their entry modules.\n *\n * `i18n/index.ts` collects plugin strings and is reachable from the server graph\n * through the `./messages` export, so it must read manifests without dragging in a\n * plugin's components and, with them, a viewer engine. Plain JSON, no runtime deps.\n */\nexport const PLUGIN_MANIFESTS: PluginManifest[] = [\n helloMapManifest as PluginManifest,\n helloBimManifest as PluginManifest,\n]\n"],"mappings":"AAGA,OAAO,sBAAsB;AAC7B,OAAO,sBAAsB;AAYtB,MAAM,mBAAqC;AAAA,EAChD;AAAA,EACA;AACF;","names":[]}
@@ -3,6 +3,11 @@ import type { MapToolProps } from './mapViewer';
3
3
  import type { PointCloudToolProps } from './pointCloudViewer';
4
4
  export { ViewerNames } from '../../types/dbTypes';
5
5
  import type { ViewerNames } from '../../types/dbTypes';
6
+ /**
7
+ * The viewers that can host a tab or a legend, spelled as plain strings. Derived from
8
+ * `ViewerNames` so the two cannot drift, and the form `@collabdt/plugin-kit` publishes.
9
+ */
10
+ export type PluginViewerTarget = `${ViewerNames.map | ViewerNames.bim | ViewerNames.pointcloud}`;
6
11
  import type { LucideProps } from 'lucide-react';
7
12
  export declare const VALID_CAPABILITIES: readonly ["data.pages", "viewer.tabs", "ui.dialogs", "map.tools", "bim.tools", "pointcloud.tools", "viewer.legends", "map.layers"];
8
13
  export type PluginCapability = typeof VALID_CAPABILITIES[number];
@@ -79,7 +84,7 @@ export interface ViewerTabRegistration {
79
84
  icon: string | React.ComponentType<LucideProps>;
80
85
  component: React.ComponentType;
81
86
  /** Which viewers this tab appears in. Omit for all of them. */
82
- viewers?: ViewerNames[];
87
+ viewers?: Array<PluginViewerTarget | ViewerNames>;
83
88
  }
84
89
  /**
85
90
  * A modal core owns. Registered here, opened by id from any of the plugin's surfaces via
@@ -110,7 +115,7 @@ export interface LegendRegistration {
110
115
  id: string;
111
116
  title: string;
112
117
  /** Which viewers this legend appears in. Omit for all of them. */
113
- viewers?: ViewerNames[];
118
+ viewers?: Array<PluginViewerTarget | ViewerNames>;
114
119
  useLegend: () => {
115
120
  active: boolean;
116
121
  title?: string;
@@ -134,8 +139,8 @@ export interface PluginContext {
134
139
  config: Record<string, unknown>;
135
140
  }
136
141
  export interface PluginEntry {
137
- activate(ctx: PluginContext): void | Promise<void>;
138
- deactivate?(ctx: PluginContext): void | Promise<void>;
142
+ activate(ctx: any): void | Promise<void>;
143
+ deactivate?(ctx: any): void | Promise<void>;
139
144
  }
140
145
  /**
141
146
  * One loadable plugin: its manifest plus its module, or a thunk returning it.