@collabdt/core 0.5.4 → 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 (125) 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 +33 -39
  6. package/dist/core/components/viewers/plugins/src/PluginCard.js.map +1 -1
  7. package/dist/core/plugins/hello-bim/manifest.json +2 -1
  8. package/dist/core/plugins/hello-bim/src/components/SpaceDialog.d.ts.map +1 -0
  9. package/dist/core/plugins/hello-bim/{components → src/components}/SpaceDialog.js +3 -3
  10. package/dist/core/plugins/hello-bim/src/components/SpaceDialog.js.map +1 -0
  11. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesLegend.d.ts +1 -1
  12. package/dist/core/plugins/hello-bim/src/components/SpacesLegend.d.ts.map +1 -0
  13. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesLegend.js +1 -1
  14. package/dist/core/plugins/hello-bim/src/components/SpacesLegend.js.map +1 -0
  15. package/dist/core/plugins/hello-bim/src/components/SpacesTab.d.ts.map +1 -0
  16. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesTab.js +5 -5
  17. package/dist/core/plugins/hello-bim/src/components/SpacesTab.js.map +1 -0
  18. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesTool.d.ts +1 -2
  19. package/dist/core/plugins/hello-bim/src/components/SpacesTool.d.ts.map +1 -0
  20. package/dist/core/plugins/hello-bim/{components → src/components}/SpacesTool.js +2 -2
  21. package/dist/core/plugins/hello-bim/src/components/SpacesTool.js.map +1 -0
  22. package/dist/core/plugins/hello-bim/src/components/icons.d.ts.map +1 -0
  23. package/dist/core/plugins/hello-bim/src/components/icons.js.map +1 -0
  24. package/dist/core/plugins/hello-bim/src/index.d.ts +10 -0
  25. package/dist/core/plugins/hello-bim/src/index.d.ts.map +1 -0
  26. package/dist/core/plugins/hello-bim/{index.js → src/index.js} +2 -3
  27. package/dist/core/plugins/hello-bim/src/index.js.map +1 -0
  28. package/dist/core/plugins/hello-bim/{spaces.d.ts → src/spaces.d.ts} +1 -1
  29. package/dist/core/plugins/hello-bim/src/spaces.d.ts.map +1 -0
  30. package/dist/core/plugins/hello-bim/{spaces.js → src/spaces.js} +4 -4
  31. package/dist/core/plugins/hello-bim/src/spaces.js.map +1 -0
  32. package/dist/core/plugins/hello-map/manifest.json +2 -1
  33. package/dist/core/plugins/hello-map/{components → src/components}/MapTool.d.ts +1 -2
  34. package/dist/core/plugins/hello-map/src/components/MapTool.d.ts.map +1 -0
  35. package/dist/core/plugins/hello-map/{components → src/components}/MapTool.js +3 -3
  36. package/dist/core/plugins/hello-map/src/components/MapTool.js.map +1 -0
  37. package/dist/core/plugins/hello-map/src/components/MarkerDialog.d.ts.map +1 -0
  38. package/dist/core/plugins/hello-map/{components → src/components}/MarkerDialog.js +2 -2
  39. package/dist/core/plugins/hello-map/src/components/MarkerDialog.js.map +1 -0
  40. package/dist/core/plugins/hello-map/{components → src/components}/MarkersLayer.d.ts +1 -1
  41. package/dist/core/plugins/hello-map/src/components/MarkersLayer.d.ts.map +1 -0
  42. package/dist/core/plugins/hello-map/{components → src/components}/MarkersLayer.js +1 -1
  43. package/dist/core/plugins/hello-map/src/components/MarkersLayer.js.map +1 -0
  44. package/dist/core/plugins/hello-map/{components → src/components}/MarkersLegend.d.ts +1 -1
  45. package/dist/core/plugins/hello-map/src/components/MarkersLegend.d.ts.map +1 -0
  46. package/dist/core/plugins/hello-map/{components → src/components}/MarkersLegend.js +1 -1
  47. package/dist/core/plugins/hello-map/src/components/MarkersLegend.js.map +1 -0
  48. package/dist/core/plugins/hello-map/{components → src/components}/MarkersPage.d.ts +1 -1
  49. package/dist/core/plugins/hello-map/src/components/MarkersPage.d.ts.map +1 -0
  50. package/dist/core/plugins/hello-map/{components → src/components}/MarkersPage.js +1 -1
  51. package/dist/core/plugins/hello-map/src/components/MarkersPage.js.map +1 -0
  52. package/dist/core/plugins/hello-map/src/components/MarkersTab.d.ts.map +1 -0
  53. package/dist/core/plugins/hello-map/{components → src/components}/MarkersTab.js +4 -4
  54. package/dist/core/plugins/hello-map/src/components/MarkersTab.js.map +1 -0
  55. package/dist/core/plugins/hello-map/src/index.d.ts +10 -0
  56. package/dist/core/plugins/hello-map/src/index.d.ts.map +1 -0
  57. package/dist/core/plugins/hello-map/{index.js → src/index.js} +2 -3
  58. package/dist/core/plugins/hello-map/src/index.js.map +1 -0
  59. package/dist/core/plugins/hello-map/src/markers.d.ts.map +1 -0
  60. package/dist/core/plugins/hello-map/{markers.js → src/markers.js} +3 -3
  61. package/dist/core/plugins/hello-map/src/markers.js.map +1 -0
  62. package/dist/core/plugins/host/PluginDataPageHost.js +1 -1
  63. package/dist/core/plugins/host/PluginDataPageHost.js.map +1 -1
  64. package/dist/core/plugins/host/context.d.ts.map +1 -1
  65. package/dist/core/plugins/host/context.js +16 -0
  66. package/dist/core/plugins/host/context.js.map +1 -1
  67. package/dist/core/plugins/host/pluginIcon.d.ts +5 -0
  68. package/dist/core/plugins/host/pluginIcon.d.ts.map +1 -0
  69. package/dist/core/plugins/host/pluginIcon.js +15 -0
  70. package/dist/core/plugins/host/pluginIcon.js.map +1 -0
  71. package/dist/core/plugins/host/runtimeShims.js.map +1 -1
  72. package/dist/core/plugins/host/usePluginDataPages.js +1 -1
  73. package/dist/core/plugins/host/usePluginDataPages.js.map +1 -1
  74. package/dist/core/plugins/host/usePluginToolbarTools.d.ts +0 -5
  75. package/dist/core/plugins/host/usePluginToolbarTools.d.ts.map +1 -1
  76. package/dist/core/plugins/host/usePluginToolbarTools.js +1 -12
  77. package/dist/core/plugins/host/usePluginToolbarTools.js.map +1 -1
  78. package/dist/core/plugins/host/usePluginViewerTabs.js +1 -1
  79. package/dist/core/plugins/host/usePluginViewerTabs.js.map +1 -1
  80. package/dist/core/plugins/installed.js +2 -2
  81. package/dist/core/plugins/installed.js.map +1 -1
  82. package/dist/core/plugins/manifests.js.map +1 -1
  83. package/dist/core/plugins/sdk/types.d.ts +11 -4
  84. package/dist/core/plugins/sdk/types.d.ts.map +1 -1
  85. package/dist/core/plugins/sdk/types.js.map +1 -1
  86. package/package.json +2 -1
  87. package/dist/core/plugins/hello-bim/components/SpaceDialog.d.ts.map +0 -1
  88. package/dist/core/plugins/hello-bim/components/SpaceDialog.js.map +0 -1
  89. package/dist/core/plugins/hello-bim/components/SpacesLegend.d.ts.map +0 -1
  90. package/dist/core/plugins/hello-bim/components/SpacesLegend.js.map +0 -1
  91. package/dist/core/plugins/hello-bim/components/SpacesTab.d.ts.map +0 -1
  92. package/dist/core/plugins/hello-bim/components/SpacesTab.js.map +0 -1
  93. package/dist/core/plugins/hello-bim/components/SpacesTool.d.ts.map +0 -1
  94. package/dist/core/plugins/hello-bim/components/SpacesTool.js.map +0 -1
  95. package/dist/core/plugins/hello-bim/components/icons.d.ts.map +0 -1
  96. package/dist/core/plugins/hello-bim/components/icons.js.map +0 -1
  97. package/dist/core/plugins/hello-bim/index.d.ts +0 -7
  98. package/dist/core/plugins/hello-bim/index.d.ts.map +0 -1
  99. package/dist/core/plugins/hello-bim/index.js.map +0 -1
  100. package/dist/core/plugins/hello-bim/spaces.d.ts.map +0 -1
  101. package/dist/core/plugins/hello-bim/spaces.js.map +0 -1
  102. package/dist/core/plugins/hello-map/components/MapTool.d.ts.map +0 -1
  103. package/dist/core/plugins/hello-map/components/MapTool.js.map +0 -1
  104. package/dist/core/plugins/hello-map/components/MarkerDialog.d.ts.map +0 -1
  105. package/dist/core/plugins/hello-map/components/MarkerDialog.js.map +0 -1
  106. package/dist/core/plugins/hello-map/components/MarkersLayer.d.ts.map +0 -1
  107. package/dist/core/plugins/hello-map/components/MarkersLayer.js.map +0 -1
  108. package/dist/core/plugins/hello-map/components/MarkersLegend.d.ts.map +0 -1
  109. package/dist/core/plugins/hello-map/components/MarkersLegend.js.map +0 -1
  110. package/dist/core/plugins/hello-map/components/MarkersPage.d.ts.map +0 -1
  111. package/dist/core/plugins/hello-map/components/MarkersPage.js.map +0 -1
  112. package/dist/core/plugins/hello-map/components/MarkersTab.d.ts.map +0 -1
  113. package/dist/core/plugins/hello-map/components/MarkersTab.js.map +0 -1
  114. package/dist/core/plugins/hello-map/index.d.ts +0 -7
  115. package/dist/core/plugins/hello-map/index.d.ts.map +0 -1
  116. package/dist/core/plugins/hello-map/index.js.map +0 -1
  117. package/dist/core/plugins/hello-map/markers.d.ts.map +0 -1
  118. package/dist/core/plugins/hello-map/markers.js.map +0 -1
  119. /package/dist/core/plugins/hello-bim/{components → src/components}/SpaceDialog.d.ts +0 -0
  120. /package/dist/core/plugins/hello-bim/{components → src/components}/SpacesTab.d.ts +0 -0
  121. /package/dist/core/plugins/hello-bim/{components → src/components}/icons.d.ts +0 -0
  122. /package/dist/core/plugins/hello-bim/{components → src/components}/icons.js +0 -0
  123. /package/dist/core/plugins/hello-map/{components → src/components}/MarkerDialog.d.ts +0 -0
  124. /package/dist/core/plugins/hello-map/{components → src/components}/MarkersTab.d.ts +0 -0
  125. /package/dist/core/plugins/hello-map/{markers.d.ts → src/markers.d.ts} +0 -0
@@ -1 +1 @@
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 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\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 // `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":";;;;;;;;;;;;;;;;;;;AAiBO,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;AAIA,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":[]}
@@ -0,0 +1,5 @@
1
+ import type { LucideProps } from 'lucide-react';
2
+ import type * as React from 'react';
3
+ /** A plugin may pass a lucide component, or its name as a string — JSON manifests only carry the string. */
4
+ export declare function resolvePluginIcon(icon: string | React.ComponentType<LucideProps>): React.ComponentType<LucideProps>;
5
+ //# sourceMappingURL=pluginIcon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginIcon.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/pluginIcon.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAQnC,4GAA4G;AAC5G,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,GAC9C,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAKlC"}
@@ -0,0 +1,15 @@
1
+ import * as LR from "lucide-react";
2
+ const FALLBACK_ICON = LR.Puzzle;
3
+ function resolvePluginIcon(icon) {
4
+ if (typeof icon !== "string") return icon;
5
+ const candidate = LR[icon];
6
+ return isComponent(candidate) ? candidate : FALLBACK_ICON;
7
+ }
8
+ function isComponent(value) {
9
+ if (typeof value === "function") return true;
10
+ return typeof value === "object" && value !== null && "$$typeof" in value;
11
+ }
12
+ export {
13
+ resolvePluginIcon
14
+ };
15
+ //# sourceMappingURL=pluginIcon.js.map
@@ -0,0 +1 @@
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,QA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E,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":[]}
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,I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E,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,SAAS;AAAA,MACP;AAAA,MAAgB;AAAA,MAAe;AAAA,MAAqB;AAAA,MACpD;AAAA,MAAY;AAAA,MACZ;AAAA,MAAsB;AAAA,MACtB;AAAA,MAAmB;AAAA,MACnB;AAAA,MAAY;AAAA,MAAW;AAAA,MAAwB;AAAA,MAAoB;AAAA,MACnE;AAAA,MAAc;AAAA,MAAa;AAAA,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":[]}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import * as React from "react";
3
3
  import { usePluginMessageLookup } from "../sdk/messages";
4
+ import { resolvePluginIcon } from "./pluginIcon";
4
5
  import { pluginViewerKey } from "./pluginViewerKey";
5
6
  import { usePluginContributions } from "./provider";
6
- import { resolvePluginIcon } from "./usePluginToolbarTools";
7
7
  function usePluginDataPages() {
8
8
  const registrations = usePluginContributions("data.pages");
9
9
  const message = usePluginMessageLookup();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/host/usePluginDataPages.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 { usePluginMessageLookup } from '../sdk/messages'\r\n\r\nimport { pluginViewerKey } from './pluginViewerKey'\r\nimport { usePluginContributions } from './provider'\r\nimport { resolvePluginIcon } from './usePluginToolbarTools'\r\n\r\nimport type { ViewerKey } from '../../types/dbTypes'\r\nimport type { LucideProps } from 'lucide-react'\r\n\r\nexport interface PluginNavItem {\r\n /** The `viewer` key this item switches to. */\r\n id: ViewerKey\r\n title: string\r\n icon: React.ComponentType<LucideProps>\r\n}\r\n\r\n/**\r\n * The `data.pages` contributions as nav items. They sit in Datasets beside Buildings, so a\r\n * contributed page reads as part of the platform.\r\n */\r\nexport function usePluginDataPages(): PluginNavItem[] {\r\n const registrations = usePluginContributions('data.pages')\r\n const message = usePluginMessageLookup()\r\n\r\n return React.useMemo(\r\n () => registrations.map(registration => ({\r\n id: pluginViewerKey(registration.pluginId, registration.id),\r\n title: message(registration.pluginId, registration.titleKey, registration.titleKey),\r\n icon: resolvePluginIcon(registration.icon),\r\n })),\r\n [registrations, message],\r\n )\r\n}\r\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,8BAA8B;AAEvC,SAAS,uBAAuB;AAChC,SAAS,8BAA8B;AACvC,SAAS,yBAAyB;AAgB3B,SAAS,qBAAsC;AACpD,QAAM,gBAAgB,uBAAuB,YAAY;AACzD,QAAM,UAAU,uBAAuB;AAEvC,SAAO,MAAM;AAAA,IACX,MAAM,cAAc,IAAI,mBAAiB;AAAA,MACvC,IAAI,gBAAgB,aAAa,UAAU,aAAa,EAAE;AAAA,MAC1D,OAAO,QAAQ,aAAa,UAAU,aAAa,UAAU,aAAa,QAAQ;AAAA,MAClF,MAAM,kBAAkB,aAAa,IAAI;AAAA,IAC3C,EAAE;AAAA,IACF,CAAC,eAAe,OAAO;AAAA,EACzB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/plugins/host/usePluginDataPages.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 { usePluginMessageLookup } from '../sdk/messages'\r\n\r\nimport { resolvePluginIcon } from './pluginIcon'\r\nimport { pluginViewerKey } from './pluginViewerKey'\r\nimport { usePluginContributions } from './provider'\r\n\r\nimport type { ViewerKey } from '../../types/dbTypes'\r\nimport type { LucideProps } from 'lucide-react'\r\n\r\nexport interface PluginNavItem {\r\n /** The `viewer` key this item switches to. */\r\n id: ViewerKey\r\n title: string\r\n icon: React.ComponentType<LucideProps>\r\n}\r\n\r\n/**\r\n * The `data.pages` contributions as nav items. They sit in Datasets beside Buildings, so a\r\n * contributed page reads as part of the platform.\r\n */\r\nexport function usePluginDataPages(): PluginNavItem[] {\r\n const registrations = usePluginContributions('data.pages')\r\n const message = usePluginMessageLookup()\r\n\r\n return React.useMemo(\r\n () => registrations.map(registration => ({\r\n id: pluginViewerKey(registration.pluginId, registration.id),\r\n title: message(registration.pluginId, registration.titleKey, registration.titleKey),\r\n icon: resolvePluginIcon(registration.icon),\r\n })),\r\n [registrations, message],\r\n )\r\n}\r\n"],"mappings":";AAKA,YAAY,WAAW;AAEvB,SAAS,8BAA8B;AAEvC,SAAS,yBAAyB;AAClC,SAAS,uBAAuB;AAChC,SAAS,8BAA8B;AAgBhC,SAAS,qBAAsC;AACpD,QAAM,gBAAgB,uBAAuB,YAAY;AACzD,QAAM,UAAU,uBAAuB;AAEvC,SAAO,MAAM;AAAA,IACX,MAAM,cAAc,IAAI,mBAAiB;AAAA,MACvC,IAAI,gBAAgB,aAAa,UAAU,aAAa,EAAE;AAAA,MAC1D,OAAO,QAAQ,aAAa,UAAU,aAAa,UAAU,aAAa,QAAQ;AAAA,MAClF,MAAM,kBAAkB,aAAa,IAAI;AAAA,IAC3C,EAAE;AAAA,IACF,CAAC,eAAe,OAAO;AAAA,EACzB;AACF;","names":[]}
@@ -1,11 +1,6 @@
1
- import * as React from 'react';
2
1
  import type { Tool } from '../../types/tools';
3
- import type { ToolbarRegistration } from '../sdk/types';
4
- import type { LucideProps } from 'lucide-react';
5
2
  /** The three toolbar capabilities. All share `ToolbarRegistration`. */
6
3
  export type ToolbarCapability = 'map.tools' | 'bim.tools' | 'pointcloud.tools';
7
- /** A plugin may pass a lucide component, or its name as a string — JSON manifests only carry the string. */
8
- export declare function resolvePluginIcon(icon: ToolbarRegistration['icon']): React.ComponentType<LucideProps>;
9
4
  /**
10
5
  * Plugin contributions for one toolbar, as `Tool` objects the toolbars already
11
6
  * render: `[...coreTools, ...usePluginToolbarTools('bim.tools', viewerProps)]`.
@@ -1 +1 @@
1
- {"version":3,"file":"usePluginToolbarTools.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/usePluginToolbarTools.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,uEAAuE;AACvE,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,WAAW,GAAG,kBAAkB,CAAA;AAQ9E,4GAA4G;AAC5G,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAChC,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAKlC;AASD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,iBAAiB,EAC7B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,IAAI,EAAE,CAyCR"}
1
+ {"version":3,"file":"usePluginToolbarTools.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/host/usePluginToolbarTools.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAK7C,uEAAuE;AACvE,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,WAAW,GAAG,kBAAkB,CAAA;AAK9E;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,iBAAiB,EAC7B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,IAAI,EAAE,CAyCR"}
@@ -28,21 +28,11 @@ var __objRest = (source, exclude) => {
28
28
  return target;
29
29
  };
30
30
  import { jsx } from "react/jsx-runtime";
31
- import * as LR from "lucide-react";
32
31
  import * as React from "react";
33
32
  import { ToolbarSubmenu } from "../../components/ToolbarSubmenu";
33
+ import { resolvePluginIcon } from "./pluginIcon";
34
34
  import { usePluginConfigs, usePluginContributions } from "./provider";
35
35
  import { PluginScopeProvider } from "./scope";
36
- const FALLBACK_ICON = LR.Puzzle;
37
- function resolvePluginIcon(icon) {
38
- if (typeof icon !== "string") return icon;
39
- const candidate = LR[icon];
40
- return isComponent(candidate) ? candidate : FALLBACK_ICON;
41
- }
42
- function isComponent(value) {
43
- if (typeof value === "function") return true;
44
- return typeof value === "object" && value !== null && "$$typeof" in value;
45
- }
46
36
  function usePluginToolbarTools(capability, extraProps) {
47
37
  const contributions = usePluginContributions(capability);
48
38
  const configs = usePluginConfigs();
@@ -87,7 +77,6 @@ function wrapPluginComponent(contribution, readConfig) {
87
77
  return PluginToolboxItem;
88
78
  }
89
79
  export {
90
- resolvePluginIcon,
91
80
  usePluginToolbarTools
92
81
  };
93
82
  //# sourceMappingURL=usePluginToolbarTools.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/host/usePluginToolbarTools.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 LR from 'lucide-react'\r\nimport * as React from 'react'\r\n\r\nimport { ToolbarSubmenu } from '../../components/ToolbarSubmenu'\r\n\r\nimport { usePluginConfigs, usePluginContributions, type PluginContribution } from './provider'\r\nimport { PluginScopeProvider } from './scope'\r\n\r\nimport type { CursorType } from '../../types/global'\r\nimport type { Tool } from '../../types/tools'\r\nimport type { ToolbarRegistration } from '../sdk/types'\r\nimport type { LucideProps } from 'lucide-react'\r\n\r\n/** The three toolbar capabilities. All share `ToolbarRegistration`. */\r\nexport type ToolbarCapability = 'map.tools' | 'bim.tools' | 'pointcloud.tools'\r\n\r\n/** What `ToolbarButton` renders for a tool that supplies its own component. */\r\ntype ToolComponent = NonNullable<Tool['component']>\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: ToolbarRegistration['icon'],\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\r\n/**\r\n * Plugin contributions for one toolbar, as `Tool` objects the toolbars already\r\n * render: `[...coreTools, ...usePluginToolbarTools('bim.tools', viewerProps)]`.\r\n *\r\n * `extraProps` is spread onto the plugin's component by `ToolbarButton` — how a BIM\r\n * tool gets its viewer handles. Each viewer passes its own, keeping this module free\r\n * of viewer-engine imports that would pull three into the map bundle.\r\n */\r\nexport function usePluginToolbarTools(\r\n capability: ToolbarCapability,\r\n extraProps?: Record<string, unknown>,\r\n): Tool[] {\r\n const contributions = usePluginContributions(capability)\r\n const configs = usePluginConfigs()\r\n\r\n // Cached by tool id to keep component identity stable. `extraProps` changes on\r\n // most renders (it carries live viewer handles), and rebuilding on each would\r\n // remount the plugin's panel and lose its state on every camera move.\r\n const wrapped = React.useRef(new Map<string, ToolComponent>())\r\n\r\n return React.useMemo(() => {\r\n const live = new Set<string>()\r\n\r\n const tools = contributions.map(contribution => {\r\n const id = pluginToolId(contribution)\r\n live.add(id)\r\n\r\n let Component = wrapped.current.get(id)\r\n if (!Component) {\r\n Component = wrapPluginComponent(contribution, () => configs[contribution.pluginId])\r\n wrapped.current.set(id, Component)\r\n }\r\n\r\n return {\r\n id,\r\n title: contribution.label,\r\n icon: resolvePluginIcon(contribution.icon),\r\n // An invented cursor is a CSS no-op, not a crash, so it goes unvalidated.\r\n cursor: contribution.cursor as CursorType | undefined,\r\n stayActive: contribution.stayActive,\r\n component: Component,\r\n extraProps,\r\n } satisfies Tool\r\n })\r\n\r\n // Drop cache entries for plugins that have since been disabled.\r\n for (const id of wrapped.current.keys()) {\r\n if (!live.has(id)) wrapped.current.delete(id)\r\n }\r\n\r\n return tools\r\n }, [contributions, extraProps])\r\n}\r\n\r\nfunction pluginToolId(contribution: PluginContribution<ToolbarCapability>) {\r\n return `plugin:${contribution.pluginId}:${contribution.id}` as const\r\n}\r\n\r\n/**\r\n * Wrap a plugin's component into a real toolbar entry.\r\n *\r\n * `ToolbarButton` renders `tool.component` *instead of* a button, so a plugin\r\n * returning a panel would render it inline and blow the strip out of the viewport.\r\n * `ToolbarSubmenu` gives it the same ghost button and dropdown every core tool has,\r\n * built from the `label` and `icon` it already declared. The wrapper also supplies\r\n * the plugin scope the scoped SDK hooks read.\r\n */\r\nfunction wrapPluginComponent(\r\n contribution: PluginContribution<ToolbarCapability>,\r\n // Lazily, because the component identity is cached: capturing the config by value\r\n // would freeze it at whatever it was on first render.\r\n readConfig: () => Record<string, unknown> | undefined,\r\n): ToolComponent {\r\n // Props are typed per capability at `ctx.register`. This wrapper forwards whatever\r\n // the hosting toolbar passed, so the shape is erased here on purpose.\r\n const Component = contribution.component as unknown as React.ComponentType<Record<string, unknown>>\r\n\r\n function PluginToolboxItem({ tool, ...rest }: React.ComponentProps<ToolComponent>) {\r\n return (\r\n <ToolbarSubmenu tool={tool}>\r\n <PluginScopeProvider pluginId={contribution.pluginId} config={readConfig()}>\r\n <Component tool={tool} {...rest} />\r\n </PluginScopeProvider>\r\n </ToolbarSubmenu>\r\n )\r\n }\r\n\r\n PluginToolboxItem.displayName = `PluginTool(${contribution.pluginId}/${contribution.id})`\r\n return PluginToolboxItem\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HU;AAxHV,YAAY,QAAQ;AACpB,YAAY,WAAW;AAEvB,SAAS,sBAAsB;AAE/B,SAAS,kBAAkB,8BAAuD;AAClF,SAAS,2BAA2B;AAcpC,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;AAUO,SAAS,sBACd,YACA,YACQ;AACR,QAAM,gBAAgB,uBAAuB,UAAU;AACvD,QAAM,UAAU,iBAAiB;AAKjC,QAAM,UAAU,MAAM,OAAO,oBAAI,IAA2B,CAAC;AAE7D,SAAO,MAAM,QAAQ,MAAM;AACzB,UAAM,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Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as LR from 'lucide-react'\r\nimport * as React from 'react'\r\n\r\nimport { ToolbarSubmenu } from '../../components/ToolbarSubmenu'\r\n\r\nimport { resolvePluginIcon } from './pluginIcon'\r\nimport { usePluginConfigs, usePluginContributions, type PluginContribution } from './provider'\r\nimport { PluginScopeProvider } from './scope'\r\n\r\nimport type { CursorType } from '../../types/global'\r\nimport type { Tool } from '../../types/tools'\r\nimport type { ToolbarRegistration } from '../sdk/types'\r\n\r\nimport type { LucideProps } from 'lucide-react'\r\n\r\n/** The three toolbar capabilities. All share `ToolbarRegistration`. */\r\nexport type ToolbarCapability = 'map.tools' | 'bim.tools' | 'pointcloud.tools'\r\n\r\n/** What `ToolbarButton` renders for a tool that supplies its own component. */\r\ntype ToolComponent = NonNullable<Tool['component']>\r\n\r\n/**\r\n * Plugin contributions for one toolbar, as `Tool` objects the toolbars already\r\n * render: `[...coreTools, ...usePluginToolbarTools('bim.tools', viewerProps)]`.\r\n *\r\n * `extraProps` is spread onto the plugin's component by `ToolbarButton` — how a BIM\r\n * tool gets its viewer handles. Each viewer passes its own, keeping this module free\r\n * of viewer-engine imports that would pull three into the map bundle.\r\n */\r\nexport function usePluginToolbarTools(\r\n capability: ToolbarCapability,\r\n extraProps?: Record<string, unknown>,\r\n): Tool[] {\r\n const contributions = usePluginContributions(capability)\r\n const configs = usePluginConfigs()\r\n\r\n // Cached by tool id to keep component identity stable. `extraProps` changes on\r\n // most renders (it carries live viewer handles), and rebuilding on each would\r\n // remount the plugin's panel and lose its state on every camera move.\r\n const wrapped = React.useRef(new Map<string, ToolComponent>())\r\n\r\n return React.useMemo(() => {\r\n const live = new Set<string>()\r\n\r\n const tools = contributions.map(contribution => {\r\n const id = pluginToolId(contribution)\r\n live.add(id)\r\n\r\n let Component = wrapped.current.get(id)\r\n if (!Component) {\r\n Component = wrapPluginComponent(contribution, () => configs[contribution.pluginId])\r\n wrapped.current.set(id, Component)\r\n }\r\n\r\n return {\r\n id,\r\n title: contribution.label,\r\n icon: resolvePluginIcon(contribution.icon),\r\n // An invented cursor is a CSS no-op, not a crash, so it goes unvalidated.\r\n cursor: contribution.cursor as CursorType | undefined,\r\n stayActive: contribution.stayActive,\r\n component: Component,\r\n extraProps,\r\n } satisfies Tool\r\n })\r\n\r\n // Drop cache entries for plugins that have since been disabled.\r\n for (const id of wrapped.current.keys()) {\r\n if (!live.has(id)) wrapped.current.delete(id)\r\n }\r\n\r\n return tools\r\n }, [contributions, extraProps])\r\n}\r\n\r\nfunction pluginToolId(contribution: PluginContribution<ToolbarCapability>) {\r\n return `plugin:${contribution.pluginId}:${contribution.id}` as const\r\n}\r\n\r\n/**\r\n * Wrap a plugin's component into a real toolbar entry.\r\n *\r\n * `ToolbarButton` renders `tool.component` *instead of* a button, so a plugin\r\n * returning a panel would render it inline and blow the strip out of the viewport.\r\n * `ToolbarSubmenu` gives it the same ghost button and dropdown every core tool has,\r\n * built from the `label` and `icon` it already declared. The wrapper also supplies\r\n * the plugin scope the scoped SDK hooks read.\r\n */\r\nfunction wrapPluginComponent(\r\n contribution: PluginContribution<ToolbarCapability>,\r\n // Lazily, because the component identity is cached: capturing the config by value\r\n // would freeze it at whatever it was on first render.\r\n readConfig: () => Record<string, unknown> | undefined,\r\n): ToolComponent {\r\n // Props are typed per capability at `ctx.register`. This wrapper forwards whatever\r\n // the hosting toolbar passed, so the shape is erased here on purpose.\r\n const Component = contribution.component as unknown as React.ComponentType<Record<string, unknown>>\r\n\r\n function PluginToolboxItem({ tool, ...rest }: React.ComponentProps<ToolComponent>) {\r\n return (\r\n <ToolbarSubmenu tool={tool}>\r\n <PluginScopeProvider pluginId={contribution.pluginId} config={readConfig()}>\r\n <Component tool={tool} {...rest} />\r\n </PluginScopeProvider>\r\n </ToolbarSubmenu>\r\n )\r\n }\r\n\r\n PluginToolboxItem.displayName = `PluginTool(${contribution.pluginId}/${contribution.id})`\r\n return PluginToolboxItem\r\n}\r\n"],"mappings":";;;;;;;;;;;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WACE,oBAAC,kBAAe,MACd,8BAAC,uBAAoB,UAAU,aAAa,UAAU,QAAQ,WAAW,GACvE,8BAAC,4BAAU,QAAgB,KAAM,GACnC,GACF;AAAA,EAEJ;AAEA,oBAAkB,cAAc,cAAc,aAAa,QAAQ,IAAI,aAAa,EAAE;AACtF,SAAO;AACT;","names":[]}
@@ -2,9 +2,9 @@
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { usePluginMessageLookup } from "../sdk/messages";
5
+ import { resolvePluginIcon } from "./pluginIcon";
5
6
  import { usePluginConfigs, usePluginContributions } from "./provider";
6
7
  import { PluginScopeProvider } from "./scope";
7
- import { resolvePluginIcon } from "./usePluginToolbarTools";
8
8
  function pluginTabId(pluginId, tabId) {
9
9
  return `plugin:${pluginId}:${tabId}`;
10
10
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/host/usePluginViewerTabs.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 { usePluginMessageLookup } from '../sdk/messages'\r\n\r\nimport { usePluginConfigs, usePluginContributions } from './provider'\r\nimport { PluginScopeProvider } from './scope'\r\nimport { resolvePluginIcon } from './usePluginToolbarTools'\r\n\r\nimport type { ViewerSidebarTab } from '../../components/ui/ViewerSidebar/sidebarTabs'\r\nimport type { SidebarTabKey } from '../../store/Menus/reducer'\r\nimport type { ViewerNames } from '../../types/dbTypes'\r\n\r\n/** Namespaced so a plugin tab can never collide with a built-in one, or with another plugin's. */\r\nexport function pluginTabId(pluginId: string, tabId: string): SidebarTabKey {\r\n return `plugin:${pluginId}:${tabId}`\r\n}\r\n\r\n/**\r\n * The `viewer.tabs` contributions for this viewer; no `viewers` means every viewer. The panel\r\n * is wrapped in the plugin scope, which is what lets the component inside reach the SDK hooks.\r\n */\r\nexport function usePluginViewerTabs(viewer: ViewerNames): ViewerSidebarTab[] {\r\n const registrations = usePluginContributions('viewer.tabs')\r\n const configs = usePluginConfigs()\r\n const message = usePluginMessageLookup()\r\n\r\n return React.useMemo(\r\n () => registrations\r\n .filter(registration => !registration.viewers || registration.viewers.includes(viewer))\r\n .map((registration) => {\r\n const Panel = registration.component\r\n\r\n return {\r\n id: pluginTabId(registration.pluginId, registration.id),\r\n meta: {\r\n icon: resolvePluginIcon(registration.icon),\r\n label: message(registration.pluginId, registration.labelKey, registration.labelKey),\r\n },\r\n content: (\r\n <PluginScopeProvider\r\n pluginId={registration.pluginId}\r\n config={configs[registration.pluginId]}\r\n >\r\n <Panel />\r\n </PluginScopeProvider>\r\n ),\r\n }\r\n }),\r\n [registrations, viewer, configs, message],\r\n )\r\n}\r\n"],"mappings":";AAgDc;AA3Cd,YAAY,WAAW;AAEvB,SAAS,8BAA8B;AAEvC,SAAS,kBAAkB,8BAA8B;AACzD,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAO3B,SAAS,YAAY,UAAkB,OAA8B;AAC1E,SAAO,UAAU,QAAQ,IAAI,KAAK;AACpC;AAMO,SAAS,oBAAoB,QAAyC;AAC3E,QAAM,gBAAgB,uBAAuB,aAAa;AAC1D,QAAM,UAAU,iBAAiB;AACjC,QAAM,UAAU,uBAAuB;AAEvC,SAAO,MAAM;AAAA,IACX,MAAM,cACH,OAAO,kBAAgB,CAAC,aAAa,WAAW,aAAa,QAAQ,SAAS,MAAM,CAAC,EACrF,IAAI,CAAC,iBAAiB;AACrB,YAAM,QAAQ,aAAa;AAE3B,aAAO;AAAA,QACL,IAAI,YAAY,aAAa,UAAU,aAAa,EAAE;AAAA,QACtD,MAAM;AAAA,UACJ,MAAM,kBAAkB,aAAa,IAAI;AAAA,UACzC,OAAO,QAAQ,aAAa,UAAU,aAAa,UAAU,aAAa,QAAQ;AAAA,QACpF;AAAA,QACA,SACE;AAAA,UAAC;AAAA;AAAA,YACC,UAAU,aAAa;AAAA,YACvB,QAAQ,QAAQ,aAAa,QAAQ;AAAA,YAErC,8BAAC,SAAM;AAAA;AAAA,QACT;AAAA,MAEJ;AAAA,IACF,CAAC;AAAA,IACH,CAAC,eAAe,QAAQ,SAAS,OAAO;AAAA,EAC1C;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/plugins/host/usePluginViewerTabs.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 { usePluginMessageLookup } from '../sdk/messages'\r\n\r\nimport { resolvePluginIcon } from './pluginIcon'\r\nimport { usePluginConfigs, usePluginContributions } from './provider'\r\nimport { PluginScopeProvider } from './scope'\r\n\r\nimport type { ViewerSidebarTab } from '../../components/ui/ViewerSidebar/sidebarTabs'\r\nimport type { SidebarTabKey } from '../../store/Menus/reducer'\r\nimport type { ViewerNames } from '../../types/dbTypes'\r\n\r\n/** Namespaced so a plugin tab can never collide with a built-in one, or with another plugin's. */\r\nexport function pluginTabId(pluginId: string, tabId: string): SidebarTabKey {\r\n return `plugin:${pluginId}:${tabId}`\r\n}\r\n\r\n/**\r\n * The `viewer.tabs` contributions for this viewer; no `viewers` means every viewer. The panel\r\n * is wrapped in the plugin scope, which is what lets the component inside reach the SDK hooks.\r\n */\r\nexport function usePluginViewerTabs(viewer: ViewerNames): ViewerSidebarTab[] {\r\n const registrations = usePluginContributions('viewer.tabs')\r\n const configs = usePluginConfigs()\r\n const message = usePluginMessageLookup()\r\n\r\n return React.useMemo(\r\n () => registrations\r\n .filter(registration => !registration.viewers || registration.viewers.includes(viewer))\r\n .map((registration) => {\r\n const Panel = registration.component\r\n\r\n return {\r\n id: pluginTabId(registration.pluginId, registration.id),\r\n meta: {\r\n icon: resolvePluginIcon(registration.icon),\r\n label: message(registration.pluginId, registration.labelKey, registration.labelKey),\r\n },\r\n content: (\r\n <PluginScopeProvider\r\n pluginId={registration.pluginId}\r\n config={configs[registration.pluginId]}\r\n >\r\n <Panel />\r\n </PluginScopeProvider>\r\n ),\r\n }\r\n }),\r\n [registrations, viewer, configs, message],\r\n )\r\n}\r\n"],"mappings":";AAgDc;AA3Cd,YAAY,WAAW;AAEvB,SAAS,8BAA8B;AAEvC,SAAS,yBAAyB;AAClC,SAAS,kBAAkB,8BAA8B;AACzD,SAAS,2BAA2B;AAO7B,SAAS,YAAY,UAAkB,OAA8B;AAC1E,SAAO,UAAU,QAAQ,IAAI,KAAK;AACpC;AAMO,SAAS,oBAAoB,QAAyC;AAC3E,QAAM,gBAAgB,uBAAuB,aAAa;AAC1D,QAAM,UAAU,iBAAiB;AACjC,QAAM,UAAU,uBAAuB;AAEvC,SAAO,MAAM;AAAA,IACX,MAAM,cACH,OAAO,kBAAgB,CAAC,aAAa,WAAW,aAAa,QAAQ,SAAS,MAAM,CAAC,EACrF,IAAI,CAAC,iBAAiB;AACrB,YAAM,QAAQ,aAAa;AAE3B,aAAO;AAAA,QACL,IAAI,YAAY,aAAa,UAAU,aAAa,EAAE;AAAA,QACtD,MAAM;AAAA,UACJ,MAAM,kBAAkB,aAAa,IAAI;AAAA,UACzC,OAAO,QAAQ,aAAa,UAAU,aAAa,UAAU,aAAa,QAAQ;AAAA,QACpF;AAAA,QACA,SACE;AAAA,UAAC;AAAA;AAAA,YACC,UAAU,aAAa;AAAA,YACvB,QAAQ,QAAQ,aAAa,QAAQ;AAAA,YAErC,8BAAC,SAAM;AAAA;AAAA,QACT;AAAA,MAEJ;AAAA,IACF,CAAC;AAAA,IACH,CAAC,eAAe,QAAQ,SAAS,OAAO;AAAA,EAC1C;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];
@@ -14,6 +19,8 @@ export interface PluginManifest {
14
19
  hostApi?: number;
15
20
  description?: string;
16
21
  author?: string;
22
+ /** A lucide icon name shown beside the plugin's name. Unset or unknown shows a puzzle piece. */
23
+ icon?: string;
17
24
  capabilities: PluginCapability[];
18
25
  requiredPermissions?: string[];
19
26
  configSchema?: Record<string, unknown>;
@@ -77,7 +84,7 @@ export interface ViewerTabRegistration {
77
84
  icon: string | React.ComponentType<LucideProps>;
78
85
  component: React.ComponentType;
79
86
  /** Which viewers this tab appears in. Omit for all of them. */
80
- viewers?: ViewerNames[];
87
+ viewers?: Array<PluginViewerTarget | ViewerNames>;
81
88
  }
82
89
  /**
83
90
  * A modal core owns. Registered here, opened by id from any of the plugin's surfaces via
@@ -108,7 +115,7 @@ export interface LegendRegistration {
108
115
  id: string;
109
116
  title: string;
110
117
  /** Which viewers this legend appears in. Omit for all of them. */
111
- viewers?: ViewerNames[];
118
+ viewers?: Array<PluginViewerTarget | ViewerNames>;
112
119
  useLegend: () => {
113
120
  active: boolean;
114
121
  title?: string;
@@ -132,8 +139,8 @@ export interface PluginContext {
132
139
  config: Record<string, unknown>;
133
140
  }
134
141
  export interface PluginEntry {
135
- activate(ctx: PluginContext): void | Promise<void>;
136
- deactivate?(ctx: PluginContext): void | Promise<void>;
142
+ activate(ctx: any): void | Promise<void>;
143
+ deactivate?(ctx: any): void | Promise<void>;
137
144
  }
138
145
  /**
139
146
  * One loadable plugin: its manifest plus its module, or a thunk returning it.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/sdk/types.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE7D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAM/C,eAAO,MAAM,kBAAkB,oIASrB,CAAA;AAEV,MAAM,MAAM,gBAAgB,GAAG,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAA;AAIhE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,kGAAkG;IAClG,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,gBAAgB,EAAE,CAAA;IAChC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;I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W,YAAY;IAC3B,QAAQ,EAAE,cAAc,CAAA;IACxB,KAAK,EAAE,WAAW,GAAG,CAAC,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC,CAAA;CAClD;AAED,kEAAkE;AAClE,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,GAC3B,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED,sFAAsF;AACtF,MAAM,MAAM,YAAY,GAAG,YAAY,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/sdk/types.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\n// Type-only: keeps the viewer modules' runtime deps (@thatopen, three, maplibre)\r\n// out of the host's module graph.\r\nimport type { BimToolProps } from './bimViewer'\r\nimport type { MapToolProps } from './mapViewer'\r\nimport type { PointCloudToolProps } from './pointCloudViewer'\r\n// A value, not just a type: a `viewer.tabs` contribution names the viewers it belongs in.\r\nexport { ViewerNames } from '../../types/dbTypes'\r\n\r\nimport type { ViewerNames } from '../../types/dbTypes'\r\nimport type { LucideProps } from 'lucide-react'\r\n\r\n// --- Capability definitions ---\r\n\r\n// Only capabilities core actually renders. One with no consumer registers fine,\r\n// shows nothing, and leaves nothing to debug.\r\nexport const VALID_CAPABILITIES = [\r\n 'data.pages',\r\n 'viewer.tabs',\r\n 'ui.dialogs',\r\n 'map.tools',\r\n 'bim.tools',\r\n 'pointcloud.tools',\r\n 'viewer.legends',\r\n 'map.layers',\r\n] as const\r\n\r\nexport type PluginCapability = typeof VALID_CAPABILITIES[number]\r\n\r\n// --- Manifest ---\r\n\r\nexport interface PluginManifest {\r\n slug: string\r\n name: string\r\n version: string\r\n /** The `PLUGIN_HOST_API` this plugin was built against. Omitted is warned about, not rejected. */\r\n hostApi?: number\r\n description?: string\r\n author?: string\r\n capabilities: PluginCapability[]\r\n requiredPermissions?: string[]\r\n configSchema?: Record<string, unknown>\r\n /**\r\n * Strings keyed by locale then message key, e.g. `{ en: { title: 'Hello' } }`.\r\n * Core folds them under `plugins.<slug>`, so `t('title')` resolves and no plugin\r\n * can collide with another. Values may nest, addressed as `t('spaces.title')`.\r\n */\r\n messages?: Record<string, Record<string, unknown>>\r\n}\r\n\r\nexport function validateManifest(manifest: unknown): { valid: boolean; errors: string[] } {\r\n const errors: string[] = []\r\n\r\n if (typeof manifest !== 'object' || manifest === null) {\r\n return { valid: false, errors: ['manifest must be an object'] }\r\n }\r\n\r\n const m = manifest as Record<string, unknown>\r\n\r\n if (!m.slug || typeof m.slug !== 'string') errors.push('slug is required')\r\n if (!m.name || typeof m.name !== 'string') errors.push('name is required')\r\n if (!m.version || typeof m.version !== 'string') errors.push('version is required')\r\n\r\n if (m.hostApi !== undefined && !Number.isInteger(m.hostApi)) {\r\n errors.push('hostApi must be an integer when present')\r\n }\r\n\r\n if (!Array.isArray(m.capabilities) || m.capabilities.length === 0) {\r\n errors.push('at least one capability is required')\r\n } else {\r\n for (const cap of m.capabilities) {\r\n if (!VALID_CAPABILITIES.includes(cap as PluginCapability)) {\r\n errors.push(`invalid capability: \"${cap}\"`)\r\n }\r\n }\r\n }\r\n\r\n return { valid: errors.length === 0, errors }\r\n}\r\n\r\n// --- Registration shapes (one per capability) ---\r\n\r\nexport interface DataPageColumn<Row> {\r\n key: string\r\n /** Resolved in the plugin's own namespace, falling back to the literal string. */\r\n labelKey: string\r\n render?: (row: Row) => React.ReactNode\r\n}\r\n\r\n/**\r\n * A full page in the Datasets nav, rendered by core. The plugin declares rows and columns; a\r\n * row click opens one of its own `ui.dialogs` rather than a detail view of its own.\r\n */\r\nexport interface DataPageRows<Row> {\r\n rows: Row[]\r\n isLoading?: boolean\r\n /** From the hook, not the registration, so it can close over `usePluginDialogs`. */\r\n onRowClick?: (row: Row) => void\r\n}\r\n\r\nexport interface DataPageRegistration<Row = Record<string, unknown>> {\r\n id: string\r\n titleKey: string\r\n icon: string | React.ComponentType<LucideProps>\r\n useRows: () => DataPageRows<Row>\r\n columns: DataPageColumn<Row>[]\r\n /** Column keys the search box filters on. Omit to search every column. */\r\n searchKeys?: string[]\r\n emptyKey?: string\r\n}\r\n\r\n/** Every toolbar component receives the toolbar entry core built for it. */\r\nexport interface ToolbarToolProps {\r\n tool: unknown\r\n}\r\n\r\n/**\r\n * A toolbar contribution. `P` is the viewer surface the hosting toolbar passes as\r\n * props, bound per capability by `CapabilityRegistry` — so a BIM component\r\n * registered under `map.tools` is a compile error.\r\n */\r\nexport interface ToolbarRegistration<P = Record<string, unknown>> {\r\n id: string\r\n label: string\r\n icon: string | React.ComponentType<LucideProps>\r\n component: React.ComponentType<ToolbarToolProps & P>\r\n cursor?: string\r\n stayActive?: boolean\r\n}\r\n\r\nexport interface ViewerTabRegistration {\r\n id: string\r\n labelKey: string\r\n icon: string | React.ComponentType<LucideProps>\r\n component: React.ComponentType\r\n /** Which viewers this tab appears in. Omit for all of them. */\r\n viewers?: ViewerNames[]\r\n}\r\n\r\n/**\r\n * A modal core owns. Registered here, opened by id from any of the plugin's surfaces via\r\n * `usePluginDialogs()`, so it outlives whichever one opened it.\r\n */\r\nexport interface DialogRegistration<P = Record<string, unknown>> {\r\n id: string\r\n titleKey: string\r\n size?: 'sm' | 'md' | 'lg' | 'xl'\r\n component: React.ComponentType<P & { close: () => void }>\r\n}\r\n\r\n/**\r\n * Something drawn on the map, mounted for as long as the map. Separate from `map.tools`,\r\n * whose panel unmounts when its dropdown closes and would take the layer with it.\r\n */\r\nexport interface MapLayerRegistration {\r\n id: string\r\n component: React.ComponentType<MapToolProps>\r\n}\r\n\r\nexport interface LegendRow {\r\n label: string\r\n color: string\r\n count?: number\r\n}\r\n\r\nexport interface LegendRegistration {\r\n id: string\r\n title: string\r\n /** Which viewers this legend appears in. Omit for all of them. */\r\n viewers?: ViewerNames[]\r\n // Called by <MapLegendHost> on each render; active:false omits the section.\r\n useLegend: () => {\r\n active: boolean\r\n // Overrides registration.title when set, e.g. a city-scoped label.\r\n title?: string\r\n unavailable?: boolean\r\n rows: LegendRow[]\r\n }\r\n}\r\n\r\n// --- Capability → registration type map ---\r\n// A new contribution point needs one entry here, its type above, and a consumer\r\n// calling `registry.getAll('your.key')`. No host changes.\r\n\r\nexport interface CapabilityRegistry {\r\n 'data.pages': DataPageRegistration\r\n 'viewer.tabs': ViewerTabRegistration\r\n 'ui.dialogs': DialogRegistration\r\n 'map.tools': ToolbarRegistration<MapToolProps>\r\n 'bim.tools': ToolbarRegistration<BimToolProps>\r\n 'pointcloud.tools': ToolbarRegistration<PointCloudToolProps>\r\n 'viewer.legends': LegendRegistration\r\n 'map.layers': MapLayerRegistration\r\n}\r\n\r\n// Errors if VALID_CAPABILITIES and keyof CapabilityRegistry drift apart.\r\ntype _CapabilityParity =\r\n PluginCapability extends keyof CapabilityRegistry\r\n ? keyof CapabilityRegistry extends PluginCapability\r\n ? true\r\n : never\r\n : never\r\nconst _capabilityParity: _CapabilityParity = true\r\nvoid _capabilityParity\r\n\r\n// --- Plugin Context ---\r\n\r\nexport interface PluginContext {\r\n pluginId: string\r\n register<K extends keyof CapabilityRegistry>(key: K, item: CapabilityRegistry[K]): void\r\n config: Record<string, unknown>\r\n}\r\n\r\n// --- Plugin entry point type ---\r\n\r\nexport interface PluginEntry {\r\n activate(ctx: PluginContext): void | Promise<void>\r\n deactivate?(ctx: PluginContext): void | Promise<void>\r\n}\r\n\r\n/**\r\n * One loadable plugin: its manifest plus its module, or a thunk returning it.\r\n * Prefer the thunk when compiled in — a static import pulls the plugin's\r\n * components into every route that reaches `installed.ts`.\r\n */\r\nexport interface PluginSource {\r\n manifest: PluginManifest\r\n entry: PluginEntry | (() => Promise<PluginEntry>)\r\n}\r\n\r\n/** Resolves either form of `PluginSource.entry` to the module. */\r\nexport async function resolvePluginEntry(\r\n entry: PluginSource['entry'],\r\n): Promise<PluginEntry> {\r\n return typeof entry === 'function' ? entry() : entry\r\n}\r\n\r\n/** An array for compiled-in plugins; a thunk when the list itself must be fetched. */\r\nexport type PluginsInput = PluginSource[] | (() => Promise<PluginSource[]>)\r\n"],"mappings":"AASA,SAAS,mBAAmB;AASrB,MAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAyBO,SAAS,iBAAiB,UAAyD;AACxF,QAAM,SAAmB,CAAC;AAE1B,MAAI,OAAO,aAAa,YAAY,aAAa,MAAM;AACrD,WAAO,EAAE,OAAO,OAAO,QAAQ,CAAC,4BAA4B,EAAE;AAAA,EAChE;AAEA,QAAM,IAAI;AAEV,MAAI,CAAC,EAAE,QAAQ,OAAO,EAAE,SAAS,SAAU,QAAO,KAAK,kBAAkB;AACzE,MAAI,CAAC,EAAE,QAAQ,OAAO,EAAE,SAAS,SAAU,QAAO,KAAK,kBAAkB;AACzE,MAAI,CAAC,EAAE,WAAW,OAAO,EAAE,YAAY,SAAU,QAAO,KAAK,qBAAqB;AAElF,MAAI,EAAE,YAAY,UAAa,CAAC,OAAO,UAAU,EAAE,OAAO,GAAG;AAC3D,WAAO,KAAK,yCAAyC;AAAA,EACvD;AAEA,MAAI,CAAC,MAAM,QAAQ,EAAE,YAAY,KAAK,EAAE,aAAa,WAAW,GAAG;AACjE,WAAO,KAAK,qCAAqC;AAAA,EACnD,OAAO;AACL,eAAW,OAAO,EAAE,cAAc;AAChC,UAAI,CAAC,mBAAmB,SAAS,GAAuB,GAAG;AACzD,eAAO,KAAK,wBAAwB,GAAG,GAAG;AAAA,MAC5C;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,OAAO,OAAO,WAAW,GAAG,OAAO;AAC9C;AA4HA,MAAM,oBAAuC;AAC7C,KAAK;AA4BL,eAAsB,mBACpB,OACsB;AACtB,SAAO,OAAO,UAAU,aAAa,MAAM,IAAI;AACjD;","names":[]}
1
+ {"version":3,"sources":["../../../../src/core/plugins/sdk/types.ts"],"sourcesContent":["// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\n// Type-only: keeps the viewer modules' runtime deps (@thatopen, three, maplibre)\r\n// out of the host's module graph.\r\nimport type { BimToolProps } from './bimViewer'\r\nimport type { MapToolProps } from './mapViewer'\r\nimport type { PointCloudToolProps } from './pointCloudViewer'\r\n// A value, not just a type: a `viewer.tabs` contribution names the viewers it belongs in.\r\nexport { ViewerNames } from '../../types/dbTypes'\r\n\r\nimport type { ViewerNames } from '../../types/dbTypes'\r\n\r\n/**\r\n * The viewers that can host a tab or a legend, spelled as plain strings. Derived from\r\n * `ViewerNames` so the two cannot drift, and the form `@collabdt/plugin-kit` publishes.\r\n */\r\nexport type PluginViewerTarget = `${ViewerNames.map | ViewerNames.bim | ViewerNames.pointcloud}`\r\nimport type { LucideProps } from 'lucide-react'\r\n\r\n// --- Capability definitions ---\r\n\r\n// Only capabilities core actually renders. One with no consumer registers fine,\r\n// shows nothing, and leaves nothing to debug.\r\nexport const VALID_CAPABILITIES = [\r\n 'data.pages',\r\n 'viewer.tabs',\r\n 'ui.dialogs',\r\n 'map.tools',\r\n 'bim.tools',\r\n 'pointcloud.tools',\r\n 'viewer.legends',\r\n 'map.layers',\r\n] as const\r\n\r\nexport type PluginCapability = typeof VALID_CAPABILITIES[number]\r\n\r\n// --- Manifest ---\r\n\r\nexport interface PluginManifest {\r\n slug: string\r\n name: string\r\n version: string\r\n /** The `PLUGIN_HOST_API` this plugin was built against. Omitted is warned about, not rejected. */\r\n hostApi?: number\r\n description?: string\r\n author?: string\r\n /** A lucide icon name shown beside the plugin's name. Unset or unknown shows a puzzle piece. */\r\n icon?: string\r\n capabilities: PluginCapability[]\r\n requiredPermissions?: string[]\r\n configSchema?: Record<string, unknown>\r\n /**\r\n * Strings keyed by locale then message key, e.g. `{ en: { title: 'Hello' } }`.\r\n * Core folds them under `plugins.<slug>`, so `t('title')` resolves and no plugin\r\n * can collide with another. Values may nest, addressed as `t('spaces.title')`.\r\n */\r\n messages?: Record<string, Record<string, unknown>>\r\n}\r\n\r\nexport function validateManifest(manifest: unknown): { valid: boolean; errors: string[] } {\r\n const errors: string[] = []\r\n\r\n if (typeof manifest !== 'object' || manifest === null) {\r\n return { valid: false, errors: ['manifest must be an object'] }\r\n }\r\n\r\n const m = manifest as Record<string, unknown>\r\n\r\n if (!m.slug || typeof m.slug !== 'string') errors.push('slug is required')\r\n if (!m.name || typeof m.name !== 'string') errors.push('name is required')\r\n if (!m.version || typeof m.version !== 'string') errors.push('version is required')\r\n\r\n if (m.hostApi !== undefined && !Number.isInteger(m.hostApi)) {\r\n errors.push('hostApi must be an integer when present')\r\n }\r\n\r\n if (!Array.isArray(m.capabilities) || m.capabilities.length === 0) {\r\n errors.push('at least one capability is required')\r\n } else {\r\n for (const cap of m.capabilities) {\r\n if (!VALID_CAPABILITIES.includes(cap as PluginCapability)) {\r\n errors.push(`invalid capability: \"${cap}\"`)\r\n }\r\n }\r\n }\r\n\r\n return { valid: errors.length === 0, errors }\r\n}\r\n\r\n// --- Registration shapes (one per capability) ---\r\n\r\nexport interface DataPageColumn<Row> {\r\n key: string\r\n /** Resolved in the plugin's own namespace, falling back to the literal string. */\r\n labelKey: string\r\n render?: (row: Row) => React.ReactNode\r\n}\r\n\r\n/**\r\n * A full page in the Datasets nav, rendered by core. The plugin declares rows and columns; a\r\n * row click opens one of its own `ui.dialogs` rather than a detail view of its own.\r\n */\r\nexport interface DataPageRows<Row> {\r\n rows: Row[]\r\n isLoading?: boolean\r\n /** From the hook, not the registration, so it can close over `usePluginDialogs`. */\r\n onRowClick?: (row: Row) => void\r\n}\r\n\r\nexport interface DataPageRegistration<Row = Record<string, unknown>> {\r\n id: string\r\n titleKey: string\r\n icon: string | React.ComponentType<LucideProps>\r\n useRows: () => DataPageRows<Row>\r\n columns: DataPageColumn<Row>[]\r\n /** Column keys the search box filters on. Omit to search every column. */\r\n searchKeys?: string[]\r\n emptyKey?: string\r\n}\r\n\r\n/** Every toolbar component receives the toolbar entry core built for it. */\r\nexport interface ToolbarToolProps {\r\n tool: unknown\r\n}\r\n\r\n/**\r\n * A toolbar contribution. `P` is the viewer surface the hosting toolbar passes as\r\n * props, bound per capability by `CapabilityRegistry` — so a BIM component\r\n * registered under `map.tools` is a compile error.\r\n */\r\nexport interface ToolbarRegistration<P = Record<string, unknown>> {\r\n id: string\r\n label: string\r\n icon: string | React.ComponentType<LucideProps>\r\n component: React.ComponentType<ToolbarToolProps & P>\r\n cursor?: string\r\n stayActive?: boolean\r\n}\r\n\r\nexport interface ViewerTabRegistration {\r\n id: string\r\n labelKey: string\r\n icon: string | React.ComponentType<LucideProps>\r\n component: React.ComponentType\r\n /** Which viewers this tab appears in. Omit for all of them. */\r\n viewers?: Array<PluginViewerTarget | ViewerNames>\r\n}\r\n\r\n/**\r\n * A modal core owns. Registered here, opened by id from any of the plugin's surfaces via\r\n * `usePluginDialogs()`, so it outlives whichever one opened it.\r\n */\r\nexport interface DialogRegistration<P = Record<string, unknown>> {\r\n id: string\r\n titleKey: string\r\n size?: 'sm' | 'md' | 'lg' | 'xl'\r\n component: React.ComponentType<P & { close: () => void }>\r\n}\r\n\r\n/**\r\n * Something drawn on the map, mounted for as long as the map. Separate from `map.tools`,\r\n * whose panel unmounts when its dropdown closes and would take the layer with it.\r\n */\r\nexport interface MapLayerRegistration {\r\n id: string\r\n component: React.ComponentType<MapToolProps>\r\n}\r\n\r\nexport interface LegendRow {\r\n label: string\r\n color: string\r\n count?: number\r\n}\r\n\r\nexport interface LegendRegistration {\r\n id: string\r\n title: string\r\n /** Which viewers this legend appears in. Omit for all of them. */\r\n viewers?: Array<PluginViewerTarget | ViewerNames>\r\n // Called by <MapLegendHost> on each render; active:false omits the section.\r\n useLegend: () => {\r\n active: boolean\r\n // Overrides registration.title when set, e.g. a city-scoped label.\r\n title?: string\r\n unavailable?: boolean\r\n rows: LegendRow[]\r\n }\r\n}\r\n\r\n// --- Capability → registration type map ---\r\n// A new contribution point needs one entry here, its type above, and a consumer\r\n// calling `registry.getAll('your.key')`. No host changes.\r\n\r\nexport interface CapabilityRegistry {\r\n 'data.pages': DataPageRegistration\r\n 'viewer.tabs': ViewerTabRegistration\r\n 'ui.dialogs': DialogRegistration\r\n 'map.tools': ToolbarRegistration<MapToolProps>\r\n 'bim.tools': ToolbarRegistration<BimToolProps>\r\n 'pointcloud.tools': ToolbarRegistration<PointCloudToolProps>\r\n 'viewer.legends': LegendRegistration\r\n 'map.layers': MapLayerRegistration\r\n}\r\n\r\n// Errors if VALID_CAPABILITIES and keyof CapabilityRegistry drift apart.\r\ntype _CapabilityParity =\r\n PluginCapability extends keyof CapabilityRegistry\r\n ? keyof CapabilityRegistry extends PluginCapability\r\n ? true\r\n : never\r\n : never\r\nconst _capabilityParity: _CapabilityParity = true\r\nvoid _capabilityParity\r\n\r\n// --- Plugin Context ---\r\n\r\nexport interface PluginContext {\r\n pluginId: string\r\n register<K extends keyof CapabilityRegistry>(key: K, item: CapabilityRegistry[K]): void\r\n config: Record<string, unknown>\r\n}\r\n\r\n// --- Plugin entry point type ---\r\n\r\nexport interface PluginEntry {\r\n // `any`: each plugin binds only the slots it uses, so no one context type fits them all.\r\n activate(ctx: any): void | Promise<void>\r\n deactivate?(ctx: any): void | Promise<void>\r\n}\r\n\r\n/**\r\n * One loadable plugin: its manifest plus its module, or a thunk returning it.\r\n * Prefer the thunk when compiled in — a static import pulls the plugin's\r\n * components into every route that reaches `installed.ts`.\r\n */\r\nexport interface PluginSource {\r\n manifest: PluginManifest\r\n entry: PluginEntry | (() => Promise<PluginEntry>)\r\n}\r\n\r\n/** Resolves either form of `PluginSource.entry` to the module. */\r\nexport async function resolvePluginEntry(\r\n entry: PluginSource['entry'],\r\n): Promise<PluginEntry> {\r\n return typeof entry === 'function' ? entry() : entry\r\n}\r\n\r\n/** An array for compiled-in plugins; a thunk when the list itself must be fetched. */\r\nexport type PluginsInput = PluginSource[] | (() => Promise<PluginSource[]>)\r\n"],"mappings":"AASA,SAAS,mBAAmB;AAerB,MAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA2BO,SAAS,iBAAiB,UAAyD;AACxF,QAAM,SAAmB,CAAC;AAE1B,MAAI,OAAO,aAAa,YAAY,aAAa,MAAM;AACrD,WAAO,EAAE,OAAO,OAAO,QAAQ,CAAC,4BAA4B,EAAE;AAAA,EAChE;AAEA,QAAM,IAAI;AAEV,MAAI,CAAC,EAAE,QAAQ,OAAO,EAAE,SAAS,SAAU,QAAO,KAAK,kBAAkB;AACzE,MAAI,CAAC,EAAE,QAAQ,OAAO,EAAE,SAAS,SAAU,QAAO,KAAK,kBAAkB;AACzE,MAAI,CAAC,EAAE,WAAW,OAAO,EAAE,YAAY,SAAU,QAAO,KAAK,qBAAqB;AAElF,MAAI,EAAE,YAAY,UAAa,CAAC,OAAO,UAAU,EAAE,OAAO,GAAG;AAC3D,WAAO,KAAK,yCAAyC;AAAA,EACvD;AAEA,MAAI,CAAC,MAAM,QAAQ,EAAE,YAAY,KAAK,EAAE,aAAa,WAAW,GAAG;AACjE,WAAO,KAAK,qCAAqC;AAAA,EACnD,OAAO;AACL,eAAW,OAAO,EAAE,cAAc;AAChC,UAAI,CAAC,mBAAmB,SAAS,GAAuB,GAAG;AACzD,eAAO,KAAK,wBAAwB,GAAG,GAAG;AAAA,MAC5C;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,OAAO,OAAO,WAAW,GAAG,OAAO;AAC9C;AA4HA,MAAM,oBAAuC;AAC7C,KAAK;AA6BL,eAAsB,mBACpB,OACsB;AACtB,SAAO,OAAO,UAAU,aAAa,MAAM,IAAI;AACjD;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@collabdt/core",
3
- "version": "0.5.4",
3
+ "version": "0.7.0",
4
4
  "description": "CDT Core contains all the core technology for your CDT platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -118,6 +118,7 @@
118
118
  },
119
119
  "dependencies": {
120
120
  "@casl/ability": "^6.7.5",
121
+ "@collabdt/plugin-kit": "^0.5.0",
121
122
  "@dnd-kit/core": "^6.3.1",
122
123
  "@dnd-kit/sortable": "^10.0.0",
123
124
  "@dnd-kit/utilities": "^3.2.2",
@@ -1 +0,0 @@
1
- {"version":3,"file":"SpaceDialog.d.ts","sourceRoot":"","sources":["../../../../../src/core/plugins/hello-bim/components/SpaceDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,yFAAyF;IACzF,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,qBAyErD"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/core/plugins/hello-bim/components/SpaceDialog.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 { useBimViewer } from '../../sdk/bimViewer'\r\nimport { Button } from '../../sdk/components'\r\nimport { usePluginTranslations } from '../../sdk/messages'\r\nimport { toModelIdMap, useSpaces } from '../spaces'\r\n\r\ninterface Props {\r\n close: () => void\r\n /** Supplied by whichever surface opened this — the sidebar tab, or the toolbar panel. */\r\n spaceKey?: string\r\n}\r\n\r\n/**\r\n * One space in full, including the IFC attributes the plugin does not store. Core owns the\r\n * overlay and Escape; this renders the body, and outlives whatever opened it.\r\n */\r\nexport function SpaceDialog({ close, spaceKey }: Props) {\r\n const t = usePluginTranslations()\r\n const { getProperties } = useBimViewer()\r\n const { spaces, selected } = useSpaces()\r\n\r\n const space = spaceKey\r\n ? spaces.find(candidate => candidate.key === spaceKey) ?? null\r\n : selected\r\n\r\n const [attributes, setAttributes] = React.useState<Record<string, unknown> | null>(null)\r\n\r\n React.useEffect(() => {\r\n if (!space) return\r\n let cancelled = false\r\n\r\n void getProperties(toModelIdMap([space]))\r\n .then((results) => {\r\n if (!cancelled) setAttributes(results[0] ?? {})\r\n })\r\n .catch(() => {\r\n if (!cancelled) setAttributes({})\r\n })\r\n\r\n return () => {\r\n cancelled = true\r\n }\r\n }, [space, getProperties])\r\n\r\n if (!space) {\r\n return (\r\n <div className=\"flex flex-col gap-4\">\r\n <p className=\"text-sm text-muted-foreground\">{t('gone', 'That space is no longer loaded.')}</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: space.colour }}\r\n />\r\n <p className=\"font-medium\">{space.name}</p>\r\n </div>\r\n\r\n <dl className=\"text-sm\">\r\n <Row label={t('ifcNameLabel', 'Name in the model')} value={space.ifcName} />\r\n <Row label={t('modelLabel', 'Model')} value={space.modelId} />\r\n <Row label={t('idLabel', 'Element id')} value={String(space.localId)} />\r\n <Row label={t('colour', 'Colour')} value={space.colour} />\r\n </dl>\r\n\r\n <div>\r\n <p className=\"mb-1 text-xs font-medium\">{t('attributes', 'IFC attributes')}</p>\r\n {attributes === null ? (\r\n <p className=\"text-xs text-muted-foreground\">{t('loading', 'Reading the model…')}</p>\r\n ) : (\r\n <dl className=\"max-h-48 overflow-y-auto text-xs\">\r\n {Object.entries(attributes)\r\n .filter(([key]) => key !== 'modelId' && key !== 'localId')\r\n .map(([key, value]) => (\r\n <Row key={key} label={key} value={readable(value)} />\r\n ))}\r\n </dl>\r\n )}\r\n </div>\r\n\r\n <Button className=\"self-end\" onClick={close}>{t('close', 'Close')}</Button>\r\n </div>\r\n )\r\n}\r\n\r\n/** Only primitives render; nested objects would come out as `[object Object]`. */\r\nfunction readable(value: unknown): string {\r\n const unwrapped = value && typeof value === 'object' && 'value' in value\r\n ? (value as { value: unknown }).value\r\n : value\r\n\r\n switch (typeof unwrapped) {\r\n case 'string': return unwrapped\r\n case 'number':\r\n case 'boolean': return String(unwrapped)\r\n default: return ''\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=\"shrink-0 text-muted-foreground\">{label}</dt>\r\n <dd className=\"truncate text-right\">{value}</dd>\r\n </div>\r\n )\r\n}\r\n"],"mappings":";AAoDM,SACE,KADF;AA/CN,YAAY,WAAW;AAEvB,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AACvB,SAAS,6BAA6B;AACtC,SAAS,cAAc,iBAAiB;AAYjC,SAAS,YAAY,EAAE,OAAO,SAAS,GAAU;AAtBxD;AAuBE,QAAM,IAAI,sBAAsB;AAChC,QAAM,EAAE,cAAc,IAAI,aAAa;AACvC,QAAM,EAAE,QAAQ,SAAS,IAAI,UAAU;AAEvC,QAAM,QAAQ,YACV,YAAO,KAAK,eAAa,UAAU,QAAQ,QAAQ,MAAnD,YAAwD,OACxD;AAEJ,QAAM,CAAC,YAAY,aAAa,IAAI,MAAM,SAAyC,IAAI;AAEvF,QAAM,UAAU,MAAM;AACpB,QAAI,CAAC,MAAO;AACZ,QAAI,YAAY;AAEhB,SAAK,cAAc,aAAa,CAAC,KAAK,CAAC,CAAC,EACrC,KAAK,CAAC,YAAY;AAtCzB,UAAAA;AAuCQ,UAAI,CAAC,UAAW,gBAAcA,MAAA,QAAQ,CAAC,MAAT,OAAAA,MAAc,CAAC,CAAC;AAAA,IAChD,CAAC,EACA,MAAM,MAAM;AACX,UAAI,CAAC,UAAW,eAAc,CAAC,CAAC;AAAA,IAClC,CAAC;AAEH,WAAO,MAAM;AACX,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K,OAAO,SAAS,KAAK,KAAtC,GAAyC,CACpD,GACL;AAAA,OAEJ;AAAA,IAEA,oBAAC,UAAO,WAAU,YAAW,SAAS,OAAQ,YAAE,SAAS,OAAO,GAAE;AAAA,KACpE;AAEJ;AAGA,SAAS,SAAS,OAAwB;AACxC,QAAM,YAAY,SAAS,OAAO,UAAU,YAAY,WAAW,QAC9D,MAA6B,QAC9B;AAEJ,UAAQ,OAAO,WAAW;AAAA,IACxB,KAAK;AAAU,aAAO;AAAA,IACtB,KAAK;AAAA,IACL,KAAK;AAAW,aAAO,OAAO,SAAS;AAAA,IACvC;AAAS,aAAO;AAAA,EAClB;AACF;AAEA,SAAS,IAAI,EAAE,OAAO,MAAM,GAAqC;AAC/D,SACE,qBAAC,SAAI,WAAU,oDACb;AAAA,wBAAC,QAAG,WAAU,kCAAkC,iBAAM;AAAA,IACtD,oBAAC,QAAG,WAAU,uBAAuB,iBAAM;AAAA,KAC7C;AAEJ;","names":["_a"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SpacesLegend.d.ts","sourceRoot":"","sources":["../../../../../src/core/plugins/hello-bim/components/SpacesLegend.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD;;;GAGG;AACH,wBAAgB,eAAe,IAAI;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,EAAE,CAAA;CAAE,CASxF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/core/plugins/hello-bim/components/SpacesLegend.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 '../../sdk/messages'\r\nimport { useSpaces } from '../spaces'\r\n\r\nimport type { LegendRow } from '../../sdk/types'\r\n\r\n/**\r\n * One row per space, live as they are renamed and recoloured. The legend probe is mounted for\r\n * as long as the viewer, so this is also what discovers the model's spaces.\r\n */\r\nexport function useSpacesLegend(): { active: boolean; title?: string; rows: LegendRow[] } {\r\n const t = usePluginTranslations()\r\n const { spaces } = useSpaces()\r\n\r\n return {\r\n active: spaces.length > 0,\r\n title: t('legendTitle', 'Spaces'),\r\n rows: spaces.map<LegendRow>(space => ({ label: space.name, color: space.colour })),\r\n }\r\n}\r\n"],"mappings":";AAKA,SAAS,6BAA6B;AACtC,SAAS,iBAAiB;AAQnB,SAAS,kBAA0E;AACxF,QAAM,IAAI,sBAAsB;AAChC,QAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,SAAO;AAAA,IACL,QAAQ,OAAO,SAAS;AAAA,IACxB,OAAO,EAAE,eAAe,QAAQ;AAAA,IAChC,MAAM,OAAO,IAAe,YAAU,EAAE,OAAO,MAAM,MAAM,OAAO,MAAM,OAAO,EAAE;AAAA,EACnF;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SpacesTab.d.ts","sourceRoot":"","sources":["../../../../../src/core/plugins/hello-bim/components/SpacesTab.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAc9B,4FAA4F;AAC5F,wBAAgB,SAAS,sBAgJxB"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/core/plugins/hello-bim/components/SpacesTab.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 '../../sdk'\r\nimport { useBimViewer } from '../../sdk/bimViewer'\r\nimport { Button, Input, Separator } from '../../sdk/components'\r\nimport { usePluginTranslations } from '../../sdk/messages'\r\nimport { usePluginDialogs } from '../../sdk/ui'\r\nimport { toModelIdMap, useSpacePainting, useSpaces } from '../spaces'\r\n\r\nimport { CheckIcon, Glyph, PlusIcon, XIcon } from './icons'\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/** The spaces in the BIM sidebar. Renaming and colouring live here, not in the dropdown. */\r\nexport function SpacesTab() {\r\n const t = usePluginTranslations()\r\n const { select, isolate, showAll, fitToSelection, setItemsVisible } = useBimViewer()\r\n const { spaces, isLoading, lastError, selected, select: choose, rename, setColour, reset } = useSpaces()\r\n const { open: openDialog } = usePluginDialogs()\r\n const { painted, setPainted } = useSpacePainting()\r\n\r\n const showOnly = async (key: string) => {\r\n const space = spaces.find(candidate => candidate.key === key)\r\n if (!space) return\r\n\r\n const items = toModelIdMap([space])\r\n await setItemsVisible(items, true)\r\n await isolate(items)\r\n await select(items)\r\n await fitToSelection()\r\n }\r\n\r\n if (isLoading && spaces.length === 0) {\r\n return <p className=\"p-4 text-sm text-muted-foreground\">{t('loading', 'Reading the model…')}</p>\r\n }\r\n\r\n if (spaces.length === 0) {\r\n return (\r\n <p className=\"p-4 text-sm text-muted-foreground\">\r\n {t('empty', 'This model has no IfcSpaces.')}\r\n </p>\r\n )\r\n }\r\n\r\n return (\r\n <div className=\"flex flex-col gap-3 p-4\">\r\n <div className=\"flex gap-2\">\r\n <Button\r\n size=\"sm\"\r\n variant={painted ? 'default' : 'outline'}\r\n aria-pressed={painted}\r\n className=\"flex-1\"\r\n onClick={() => setPainted(current => !current)}\r\n >\r\n {painted ? t('clearColours', 'Clear colours') : t('colourSpaces', 'Colour the spaces')}\r\n </Button>\r\n </div>\r\n\r\n <Button size=\"sm\" variant=\"outline\" onClick={() => { void showAll() }}>\r\n {t('showAllElements', 'Show all elements')}\r\n </Button>\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 <ul className=\"flex flex-col gap-1\">\r\n {spaces.map(space => (\r\n <li key={space.key}>\r\n <button\r\n type=\"button\"\r\n onClick={() => { choose(space.key); void select(toModelIdMap([space])) }}\r\n className={`flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm ${\r\n selected?.key === space.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: space.colour }}\r\n />\r\n <span className=\"flex-1 truncate\">{space.name}</span>\r\n </button>\r\n </li>\r\n ))}\r\n </ul>\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 <p className=\"text-xs text-muted-foreground\">\r\n {t('ifcName', 'In the model: ')}{selected.ifcName}\r\n </p>\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 <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 <div className=\"flex gap-2\">\r\n <Button size=\"sm\" variant=\"outline\" className=\"flex-1\" onClick={() => { void showOnly(selected.key) }}>\r\n {t('isolateSpace', 'Isolate space')}\r\n </Button>\r\n <Button size=\"sm\" variant=\"outline\" onClick={() => openDialog('detail', { spaceKey: selected.key })}>\r\n {t('details', 'Details')}\r\n </Button>\r\n </div>\r\n\r\n {selected.annotated && (\r\n <Button size=\"sm\" variant=\"ghost\" className=\"self-start\" onClick={() => { void reset(selected.key) }}>\r\n {t('reset', 'Reset to the model\\'s name and colour')}\r\n </Button>\r\n )}\r\n </>\r\n )}\r\n </div>\r\n )\r\n}\r\n\r\n/**\r\n * The name, edited locally and saved only when confirmed. Laid out like the app's other\r\n * inline text edits: the field takes the row, then a confirm and a revert.\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 <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 <Glyph><CheckIcon /></Glyph>\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 <Glyph><XIcon /></Glyph>\r\n </Button>\r\n </div>\r\n </div>\r\n )\r\n}\r\n"],"mappings":";AAuCW,SAyDH,UAzDG,KA8BH,YA9BG;AAlCX,YAAY,WAAW;AAEvB,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,SAAS,QAAQ,OAAO,iBAAiB;AACzC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,cAAc,kBAAkB,iBAAiB;AAE1D,SAAS,WAAW,OAAO,UAAU,aAAa;AAGlD,MAAM,WAAW;AAGV,SAAS,YAAY;AAC1B,QAAM,IAAI,sBAAsB;AAChC,QAAM,EAAE,QAAQ,SAAS,SAAS,gBAAgB,gBAAgB,IAAI,aAAa;AACnF,QAAM,EAAE,QAAQ,WAAW,WAAW,UAAU,QAAQ,QAAQ,QAAQ,WAAW,MAAM,IAAI,UAAU;AACvG,QAAM,EAAE,MAAM,WAAW,IAAI,iBAAiB;AAC9C,QAAM,EAAE,SAAS,WAAW,IAAI,iBAAiB;AAEjD,QAAM,WAAW,OAAO,QAAgB;AACtC,UAAM,QAAQ,OAAO,KAAK,eAAa,UAAU,QAAQ,GAAG;AAC5D,QAAI,CAAC,MAAO;AAEZ,UAAM,QAAQ,aAAa,CAAC,KAAK,CAAC;AAClC,UAAM,gBAAgB,OAAO,IAAI;AACjC,UAAM,QAAQ,KAAK;AACnB,UAAM,OAAO,KAAK;AAClB,UAAM,eAAe;AAAA,EACvB;AAEA,MAAI,aAAa,OAAO,WAAW,GAAG;AACpC,WAAO,oBAAC,OAAE,WAAU,qCAAqC,YAAE,WAAW,yBAAoB,GAAE;AAAA,EAC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AAI;AAAA,UAC3C;AAAA,UACA,WAAU;AAAA;AAAA,MACZ;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACV,UAAU,CAAC;AAAA,UACX,cAAY;AAAA,UACZ,OAAO;AAAA,UACP,SAAS;AAAA,UAET,8BAAC,SAAM,8BAAC,aAAU,GAAE;AAAA;AAAA,MACtB;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,WAAU;AAAA,UACV,UAAU,CAAC;AAAA,UACX,cAAY;AAAA,UACZ,OAAO;AAAA,UACP,SAAS,MAAM,SAAS,IAAI;AAAA,UAE5B,8BAAC,SAAM,8BAAC,SAAM,GAAE;AAAA;AAAA,MAClB;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SpacesTool.d.ts","sourceRoot":"","sources":["../../../../../src/core/plugins/hello-bim/components/SpacesTool.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEvD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,OAAO,EACP,eAAe,EACf,OAAO,EACP,cAAc,EACd,MAAM,GACP,EAAE,gBAAgB,GAAG,YAAY,+BAsDjC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/core/plugins/hello-bim/components/SpacesTool.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, Separator } from '../../sdk/components'\r\nimport { usePluginTranslations } from '../../sdk/messages'\r\nimport { toModelIdMap, useSpacePainting, useSpaces } from '../spaces'\r\n\r\nimport type { BimToolProps } from '../../sdk/bimViewer'\r\nimport type { ToolbarToolProps } from '../../sdk/types'\r\n\r\n/**\r\n * Three things worth one click. Renaming and colouring live in the sidebar tab: this panel is\r\n * a dropdown that closes on the next click. The viewer arrives as props, as the host intends.\r\n */\r\nexport function SpacesTool({\r\n modelIds,\r\n isolate,\r\n setItemsVisible,\r\n showAll,\r\n fitToSelection,\r\n select,\r\n}: ToolbarToolProps & BimToolProps) {\r\n const t = usePluginTranslations()\r\n const { spaces, isLoading } = useSpaces()\r\n const { painted, setPainted } = useSpacePainting()\r\n\r\n const items = () => toModelIdMap(spaces)\r\n\r\n const isolateSpaces = async () => {\r\n if (spaces.length === 0) return\r\n\r\n await setItemsVisible(items(), true)\r\n await isolate(items())\r\n await select(items())\r\n await fitToSelection()\r\n }\r\n\r\n const reset = async () => {\r\n setPainted(false)\r\n await showAll()\r\n }\r\n\r\n return (\r\n <div className=\"w-60 p-1\">\r\n <p className=\"px-2 py-1 text-sm font-medium\">{t('title', 'Spaces')}</p>\r\n <Separator className=\"my-1\" />\r\n\r\n {modelIds.length === 0 ? (\r\n <p className=\"px-2 py-1 text-sm text-muted-foreground\">\r\n {t('noModel', 'Load a model to see its spaces.')}\r\n </p>\r\n ) : isLoading && spaces.length === 0 ? (\r\n <p className=\"px-2 py-1 text-sm text-muted-foreground\">\r\n {t('loading', 'Reading the model…')}\r\n </p>\r\n ) : spaces.length === 0 ? (\r\n <p className=\"px-2 py-1 text-sm text-muted-foreground\">\r\n {t('empty', 'This model has no IfcSpaces.')}\r\n </p>\r\n ) : (\r\n <>\r\n <p className=\"px-2 pb-1 text-xs text-muted-foreground\">\r\n {t('count', 'Spaces in this model: ')}{spaces.length}\r\n </p>\r\n\r\n <Item\r\n label={painted ? t('clearColours', 'Clear colours') : t('colourSpaces', 'Colour the spaces')}\r\n onClick={() => setPainted(current => !current)}\r\n />\r\n <Item label={t('isolateSpaces', 'Isolate spaces')} onClick={() => { void isolateSpaces() }} />\r\n <Item label={t('resetView', 'Reset the view')} onClick={() => { void reset() }} />\r\n </>\r\n )}\r\n </div>\r\n )\r\n}\r\n\r\nfunction Item({ label, onClick }: { label: string; onClick: () => void }) {\r\n return (\r\n <Button\r\n size=\"sm\"\r\n variant=\"ghost\"\r\n className=\"w-full justify-start truncate font-normal\"\r\n onClick={onClick}\r\n >\r\n {label}\r\n </Button>\r\n )\r\n}\r\n"],"mappings":";AA8CM,SAgBE,UAhBF,KAiBI,YAjBJ;AAzCN,SAAS,QAAQ,iBAAiB;AAClC,SAAS,6BAA6B;AACtC,SAAS,cAAc,kBAAkB,iBAAiB;AASnD,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAoC;AAClC,QAAM,IAAI,sBAAsB;AAChC,QAAM,EAAE,QAAQ,UAAU,IAAI,UAAU;AACxC,QAAM,EAAE,SAAS,WAAW,IAAI,iBAAiB;AAEjD,QAAM,QAAQ,MAAM,aAAa,MAAM;AAEvC,QAAM,gBAAgB,YAAY;AAChC,QAAI,OAAO,WAAW,EAAG;AAEzB,UAAM,gBAAgB,MAAM,GAAG,IAAI;AACnC,UAAM,QAAQ,MAAM,CAAC;AACrB,UAAM,OAAO,MAAM,CAAC;AACpB,UAAM,eAAe;AAAA,EACvB;AAEA,QAAM,QAAQ,YAAY;AACxB,eAAW,KAAK;AAChB,UAAM,QAAQ;AAAA,EAChB;AAEA,SACE,qBAAC,SAAI,WAAU,YACb;AAAA,wBAAC,OAAE,WAAU,iCAAiC,YAAE,SAAS,QAAQ,GAAE;AAAA,IACnE,oBAAC,aAAU,WAAU,QAAO;AAAA,IAE3B,SAAS,WAAW,IACnB,oBAAC,OAAE,WAAU,2CACV,YAAE,WAAW,iCAAiC,GACjD,IACE,aAAa,OAAO,WAAW,IACjC,oBAAC,OAAE,WAAU,2CACV,YAAE,WAAW,yBAAoB,GACpC,IACE,OAAO,WAAW,IACpB,oBAAC,OAAE,WAAU,2CACV,YAAE,SAAS,8BAA8B,GAC5C,IAEA,iCACE;AAAA,2BAAC,OAAE,WAAU,2CACV;AAAA,UAAE,SAAS,wBAAwB;AAAA,QAAG,OAAO;AAAA,SAChD;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,UAAU,EAAE,gBAAgB,eAAe,IAAI,EAAE,gBAAgB,mBAAmB;AAAA,UAC3F,SAAS,MAAM,WAAW,aAAW,CAAC,OAAO;AAAA;AAAA,MAC/C;AAAA,MACA,oBAAC,QAAK,OAAO,EAAE,iBAAiB,gBAAgB,GAAG,SAAS,MAAM;AAAE,aAAK,cAAc;AAAA,MAAE,GAAG;AAAA,MAC5F,oBAAC,QAAK,OAAO,EAAE,aAAa,gBAAgB,GAAG,SAAS,MAAM;AAAE,aAAK,MAAM;AAAA,MAAE,GAAG;AAAA,OAClF;AAAA,KAEJ;AAEJ;AAEA,SAAS,KAAK,EAAE,OAAO,QAAQ,GAA2C;AACxE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,WAAU;AAAA,MACV;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../../../src/core/plugins/hello-bim/components/icons.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAehE;AAED,wBAAgB,SAAS,sBAExB;AAED,wBAAgB,KAAK,sBAEpB;AAED,wFAAwF;AACxF,wBAAgB,QAAQ,sBAevB"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/core/plugins/hello-bim/components/icons.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\n/**\r\n * Drawn here: `lucide-react` is unshimmed, so a plugin cannot import it. Icon *names* work in\r\n * registrations, where the host resolves them. Labels live on each button's aria-label.\r\n */\r\nexport function 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\nexport function CheckIcon() {\r\n return <path d=\"M20 6 9 17l-5-5\" />\r\n}\r\n\r\nexport function XIcon() {\r\n return <><path d=\"M18 6 6 18\" /><path d=\"m6 6 12 12\" /></>\r\n}\r\n\r\n/** Smaller than the button glyphs — it sits inside a 24px swatch, not a 32px button. */\r\nexport function 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"],"mappings":";AAaI,SAoBK,UApBL,KAoBK,YApBL;AAFG,SAAS,MAAM,EAAE,SAAS,GAAkC;AACjE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,WAAU;AAAA,MACV,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,eAAY;AAAA,MAEX;AAAA;AAAA,EACH;AAEJ;AAEO,SAAS,YAAY;AAC1B,SAAO,oBAAC,UAAK,GAAE,mBAAkB;AACnC;AAEO,SAAS,QAAQ;AACtB,SAAO,iCAAE;AAAA,wBAAC,UAAK,GAAE,cAAa;AAAA,IAAE,oBAAC,UAAK,GAAE,cAAa;AAAA,KAAE;AACzD;AAGO,SAAS,WAAW;AACzB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,WAAU;AAAA,MACV,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,eAAY;AAAA,MAEZ;AAAA,4BAAC,UAAK,GAAE,YAAW;AAAA,QACnB,oBAAC,UAAK,GAAE,YAAW;AAAA;AAAA;AAAA,EACrB;AAEJ;","names":[]}
@@ -1,7 +0,0 @@
1
- import type { PluginContext } from '../sdk/types';
2
- /**
3
- * Four surfaces over the model IfcSpaces, all reading one hook. The IFC is never written to:
4
- * a renamed space is an annotation this plugin stores, and the dialog shows both names.
5
- */
6
- export declare function activate(ctx: PluginContext): void;
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/hello-bim/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CA+BjD"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/core/plugins/hello-bim/index.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 { 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 { PluginContext } from '../sdk/types'\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: PluginContext): 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: [ViewerNames.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: [ViewerNames.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;AAE5B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAQpB,SAAS,SAAS,KAA0B;AACjD,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,YAAY,GAAG;AAAA,IACzB,WAAW;AAAA,EACb,CAAC;AAED,MAAI,SAAS,kBAAkB;AAAA,IAC7B,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,SAAS,CAAC,YAAY,GAAG;AAAA,IACzB,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 +0,0 @@
1
- {"version":3,"file":"spaces.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/hello-bim/spaces.ts"],"names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