@ifc-lite/viewer 1.14.2 → 1.14.4

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 (80) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/assets/{Arrow.dom-CSgnLhN4.js → Arrow.dom-_vGzMMKs.js} +1 -1
  3. package/dist/assets/basketViewActivator-BZcoCL3V.js +1 -0
  4. package/dist/assets/{browser-qSKWrKQW.js → browser-Czmf34bo.js} +1 -1
  5. package/dist/assets/ifc-lite_bg-DyBKoGgk.wasm +0 -0
  6. package/dist/assets/index-CMQ_Dgkr.css +1 -0
  7. package/dist/assets/index-D7nEDctQ.js +229 -0
  8. package/dist/assets/{index-4Y4XaV8N.js → index-DX-Qf5fA.js} +72669 -61673
  9. package/dist/assets/{native-bridge-CSFDsEkg.js → native-bridge-DAOWftxE.js} +1 -1
  10. package/dist/assets/{wasm-bridge-Zf90ysEm.js → wasm-bridge-D7jYpn8a.js} +1 -1
  11. package/dist/index.html +2 -2
  12. package/package.json +21 -20
  13. package/src/App.tsx +17 -1
  14. package/src/components/viewer/BasketPresentationDock.tsx +8 -4
  15. package/src/components/viewer/ChatPanel.tsx +1402 -0
  16. package/src/components/viewer/CodeEditor.tsx +70 -4
  17. package/src/components/viewer/CommandPalette.tsx +1 -0
  18. package/src/components/viewer/HierarchyPanel.tsx +28 -13
  19. package/src/components/viewer/MainToolbar.tsx +113 -95
  20. package/src/components/viewer/ScriptPanel.tsx +351 -184
  21. package/src/components/viewer/UpgradePage.tsx +69 -0
  22. package/src/components/viewer/Viewport.tsx +23 -0
  23. package/src/components/viewer/chat/ChatMessage.tsx +144 -0
  24. package/src/components/viewer/chat/ExecutableCodeBlock.tsx +416 -0
  25. package/src/components/viewer/chat/ModelSelector.tsx +102 -0
  26. package/src/components/viewer/chat/renderTextContent.test.ts +23 -0
  27. package/src/components/viewer/chat/renderTextContent.ts +19 -0
  28. package/src/components/viewer/hierarchy/HierarchyNode.tsx +10 -3
  29. package/src/components/viewer/hierarchy/treeDataBuilder.test.ts +126 -0
  30. package/src/components/viewer/hierarchy/treeDataBuilder.ts +139 -38
  31. package/src/components/viewer/hierarchy/types.ts +6 -1
  32. package/src/components/viewer/hierarchy/useHierarchyTree.ts +27 -12
  33. package/src/hooks/useIfcCache.ts +1 -2
  34. package/src/hooks/useSandbox.ts +122 -6
  35. package/src/index.css +10 -0
  36. package/src/lib/attachments.ts +46 -0
  37. package/src/lib/llm/ClerkChatSync.tsx +74 -0
  38. package/src/lib/llm/clerk-auth.ts +62 -0
  39. package/src/lib/llm/code-extractor.ts +50 -0
  40. package/src/lib/llm/context-builder.test.ts +18 -0
  41. package/src/lib/llm/context-builder.ts +305 -0
  42. package/src/lib/llm/free-models.test.ts +118 -0
  43. package/src/lib/llm/message-capabilities.test.ts +131 -0
  44. package/src/lib/llm/message-capabilities.ts +94 -0
  45. package/src/lib/llm/models.ts +197 -0
  46. package/src/lib/llm/repair-loop.test.ts +91 -0
  47. package/src/lib/llm/repair-loop.ts +76 -0
  48. package/src/lib/llm/script-diagnostics.ts +445 -0
  49. package/src/lib/llm/script-edit-ops.test.ts +399 -0
  50. package/src/lib/llm/script-edit-ops.ts +954 -0
  51. package/src/lib/llm/script-preflight.test.ts +513 -0
  52. package/src/lib/llm/script-preflight.ts +990 -0
  53. package/src/lib/llm/script-preservation.test.ts +128 -0
  54. package/src/lib/llm/script-preservation.ts +152 -0
  55. package/src/lib/llm/stream-client.test.ts +97 -0
  56. package/src/lib/llm/stream-client.ts +410 -0
  57. package/src/lib/llm/system-prompt.test.ts +181 -0
  58. package/src/lib/llm/system-prompt.ts +665 -0
  59. package/src/lib/llm/types.ts +150 -0
  60. package/src/lib/scripts/templates/bim-globals.d.ts +226 -7
  61. package/src/lib/scripts/templates/create-building.ts +12 -12
  62. package/src/main.tsx +10 -1
  63. package/src/sdk/adapters/export-adapter.test.ts +24 -0
  64. package/src/sdk/adapters/export-adapter.ts +40 -16
  65. package/src/sdk/adapters/files-adapter.ts +39 -0
  66. package/src/sdk/adapters/model-compat.ts +1 -1
  67. package/src/sdk/adapters/mutate-adapter.ts +20 -6
  68. package/src/sdk/adapters/mutation-view.ts +112 -0
  69. package/src/sdk/adapters/query-adapter.ts +100 -4
  70. package/src/sdk/local-backend.ts +4 -0
  71. package/src/store/index.ts +15 -1
  72. package/src/store/slices/chatSlice.test.ts +325 -0
  73. package/src/store/slices/chatSlice.ts +468 -0
  74. package/src/store/slices/scriptSlice.test.ts +75 -0
  75. package/src/store/slices/scriptSlice.ts +256 -9
  76. package/src/vite-env.d.ts +10 -0
  77. package/vite.config.ts +21 -2
  78. package/dist/assets/ifc-lite_bg-BOvNXJA_.wasm +0 -0
  79. package/dist/assets/index-ByrFvN5A.css +0 -1
  80. package/dist/assets/index-CN7qDq7G.js +0 -216
@@ -1,4 +1,4 @@
1
- import { _ as c, __tla as __tla_0 } from "./index-4Y4XaV8N.js";
1
+ import { _ as c, __tla as __tla_0 } from "./index-DX-Qf5fA.js";
2
2
  let m;
3
3
  let __tla = Promise.all([
4
4
  (()=>{
@@ -1 +1 @@
1
- import{I as f,a as m}from"./index-4Y4XaV8N.js";class u{bridge;initialized=!1;constructor(){this.bridge=new f}async init(){this.initialized||(await this.bridge.init(),this.initialized=!0)}isInitialized(){return this.initialized}async processGeometry(s){this.initialized||await this.init(),performance.now();const i=new m(this.bridge.getApi(),s),n=i.collectMeshes(),r=i.getBuildingRotation();performance.now();let e=0,o=0;for(const c of n)e+=c.positions.length/3,o+=c.indices.length/3;return{meshes:n,totalVertices:e,totalTriangles:o,coordinateInfo:{originShift:{x:0,y:0,z:0},originalBounds:{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}},shiftedBounds:{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}},hasLargeCoordinates:!1,buildingRotation:r}}}async processGeometryStreaming(s,i){this.initialized||await this.init();const n=performance.now(),r=new m(this.bridge.getApi(),s);let e=0,o=0,a=0;try{for await(const t of r.collectMeshesStreaming(50)){if(t&&typeof t=="object"&&"type"in t&&t.type==="colorUpdate")continue;const l=t;e+=l.length;for(const d of l)o+=d.positions.length/3,a+=d.indices.length/3;i.onBatch?.({meshes:l,progress:{processed:e,total:e,currentType:"processing"}})}}catch(t){throw i.onError?.(t instanceof Error?t:new Error(String(t))),t}const h=performance.now()-n,g={totalMeshes:e,totalVertices:o,totalTriangles:a,parseTimeMs:h*.3,geometryTimeMs:h*.7};return i.onComplete?.(g),g}getApi(){return this.bridge.getApi()}}export{u as WasmBridge};
1
+ import{I as f,a as m}from"./index-DX-Qf5fA.js";class u{bridge;initialized=!1;constructor(){this.bridge=new f}async init(){this.initialized||(await this.bridge.init(),this.initialized=!0)}isInitialized(){return this.initialized}async processGeometry(s){this.initialized||await this.init(),performance.now();const i=new m(this.bridge.getApi(),s),n=i.collectMeshes(),r=i.getBuildingRotation();performance.now();let e=0,o=0;for(const c of n)e+=c.positions.length/3,o+=c.indices.length/3;return{meshes:n,totalVertices:e,totalTriangles:o,coordinateInfo:{originShift:{x:0,y:0,z:0},originalBounds:{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}},shiftedBounds:{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}},hasLargeCoordinates:!1,buildingRotation:r}}}async processGeometryStreaming(s,i){this.initialized||await this.init();const n=performance.now(),r=new m(this.bridge.getApi(),s);let e=0,o=0,a=0;try{for await(const t of r.collectMeshesStreaming(50)){if(t&&typeof t=="object"&&"type"in t&&t.type==="colorUpdate")continue;const l=t;e+=l.length;for(const d of l)o+=d.positions.length/3,a+=d.indices.length/3;i.onBatch?.({meshes:l,progress:{processed:e,total:e,currentType:"processing"}})}}catch(t){throw i.onError?.(t instanceof Error?t:new Error(String(t))),t}const h=performance.now()-n,g={totalMeshes:e,totalVertices:o,totalTriangles:a,parseTimeMs:h*.3,geometryTimeMs:h*.7};return i.onComplete?.(g),g}getApi(){return this.bridge.getApi()}}export{u as WasmBridge};
package/dist/index.html CHANGED
@@ -44,8 +44,8 @@
44
44
  <meta name="theme-color" content="#7aa2f7">
45
45
  <meta name="msapplication-TileColor" content="#1a1b26">
46
46
  <meta name="msapplication-TileImage" content="/favicon-192x192-cropped.png">
47
- <script type="module" crossorigin src="/assets/index-4Y4XaV8N.js"></script>
48
- <link rel="stylesheet" crossorigin href="/assets/index-ByrFvN5A.css">
47
+ <script type="module" crossorigin src="/assets/index-DX-Qf5fA.js"></script>
48
+ <link rel="stylesheet" crossorigin href="/assets/index-CMQ_Dgkr.css">
49
49
  </head>
50
50
  <body>
51
51
  <div id="root"></div>
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@ifc-lite/viewer",
3
- "version": "1.14.2",
3
+ "version": "1.14.4",
4
4
  "description": "IFC-Lite viewer application",
5
5
  "type": "module",
6
6
  "dependencies": {
7
+ "@clerk/clerk-react": "^5.61.3",
7
8
  "@codemirror/autocomplete": "^6.20.0",
8
9
  "@codemirror/commands": "^6.10.2",
9
10
  "@codemirror/lang-javascript": "^6.2.4",
@@ -41,24 +42,24 @@
41
42
  "tailwind-merge": "^3.4.0",
42
43
  "tailwindcss": "^4.1.18",
43
44
  "zustand": "^4.4.0",
44
- "@ifc-lite/bcf": "^1.14.2",
45
- "@ifc-lite/cache": "^1.14.2",
46
- "@ifc-lite/data": "^1.14.2",
47
- "@ifc-lite/drawing-2d": "^1.14.2",
48
- "@ifc-lite/encoding": "^1.14.2",
49
- "@ifc-lite/export": "^1.14.2",
50
- "@ifc-lite/geometry": "^1.14.2",
51
- "@ifc-lite/ids": "^1.14.2",
52
- "@ifc-lite/lens": "^1.14.2",
53
- "@ifc-lite/lists": "^1.14.2",
54
- "@ifc-lite/mutations": "^1.14.2",
55
- "@ifc-lite/parser": "^1.14.2",
56
- "@ifc-lite/query": "^1.14.2",
57
- "@ifc-lite/renderer": "^1.14.2",
58
- "@ifc-lite/sandbox": "^1.14.2",
59
- "@ifc-lite/server-client": "^1.14.2",
60
- "@ifc-lite/spatial": "^1.14.2",
61
- "@ifc-lite/wasm": "^1.14.2"
45
+ "@ifc-lite/bcf": "^1.14.3",
46
+ "@ifc-lite/cache": "^1.14.3",
47
+ "@ifc-lite/data": "^1.14.3",
48
+ "@ifc-lite/drawing-2d": "^1.14.3",
49
+ "@ifc-lite/encoding": "^1.14.3",
50
+ "@ifc-lite/export": "^1.14.4",
51
+ "@ifc-lite/geometry": "^1.14.3",
52
+ "@ifc-lite/ids": "^1.14.3",
53
+ "@ifc-lite/lists": "^1.14.3",
54
+ "@ifc-lite/lens": "^1.14.3",
55
+ "@ifc-lite/mutations": "^1.14.3",
56
+ "@ifc-lite/parser": "^2.0.0",
57
+ "@ifc-lite/query": "^1.14.4",
58
+ "@ifc-lite/renderer": "^1.14.3",
59
+ "@ifc-lite/server-client": "^1.14.3",
60
+ "@ifc-lite/spatial": "^1.14.3",
61
+ "@ifc-lite/sandbox": "^1.14.3",
62
+ "@ifc-lite/wasm": "^1.14.3"
62
63
  },
63
64
  "devDependencies": {
64
65
  "@tailwindcss/postcss": "^4.1.18",
@@ -76,7 +77,7 @@
76
77
  "dev": "vite",
77
78
  "build": "NODE_OPTIONS='--max-old-space-size=4096' bash -c '(tsc || true) && vite build'",
78
79
  "preview": "vite preview",
79
- "test": "bash -c 'shopt -s globstar && tsx --test src/**/*.test.ts'",
80
+ "test": "tsx --test --test-concurrency=1 $(find src -type f \\( -name '*.test.ts' -o -name '*.test.tsx' \\) | sort)",
80
81
  "check:templates": "tsc -p src/lib/scripts/templates/tsconfig.json --noEmit"
81
82
  }
82
83
  }
package/src/App.tsx CHANGED
@@ -7,13 +7,29 @@
7
7
  */
8
8
 
9
9
  import { ViewerLayout } from './components/viewer/ViewerLayout';
10
+ import { UpgradePage } from './components/viewer/UpgradePage';
10
11
  import { BimProvider } from './sdk/BimProvider';
11
12
  import { Toaster } from './components/ui/toast';
13
+ import { ClerkChatSync } from './lib/llm/ClerkChatSync';
14
+ import { isClerkConfigured } from './lib/llm/clerk-auth';
15
+ import { useEffect, useState } from 'react';
12
16
 
13
17
  export function App() {
18
+ const clerkEnabled = isClerkConfigured();
19
+ const [pathname, setPathname] = useState(() => window.location.pathname);
20
+
21
+ useEffect(() => {
22
+ const onRouteChange = () => setPathname(window.location.pathname);
23
+ window.addEventListener('popstate', onRouteChange);
24
+ return () => window.removeEventListener('popstate', onRouteChange);
25
+ }, []);
26
+
27
+ const isUpgradeRoute = pathname === '/upgrade';
28
+
14
29
  return (
15
30
  <BimProvider>
16
- <ViewerLayout />
31
+ {clerkEnabled && <ClerkChatSync />}
32
+ {isUpgradeRoute ? <UpgradePage /> : <ViewerLayout />}
17
33
  <Toaster />
18
34
  </BimProvider>
19
35
  );
@@ -30,7 +30,6 @@ import {
30
30
  executeBasketSaveView,
31
31
  executeBasketClear,
32
32
  } from '@/store/basket/basketCommands';
33
- import { activateBasketViewFromStore } from '@/store/basket/basketViewActivator';
34
33
  import { getSmartBasketInputFromStore, isBasketIsolationActiveFromStore } from '@/store/basketVisibleSet';
35
34
 
36
35
  export function BasketPresentationDock() {
@@ -118,6 +117,11 @@ export function BasketPresentationDock() {
118
117
  setPlayingAll(false);
119
118
  }, []);
120
119
 
120
+ const activateSavedView = useCallback(async (viewId: string) => {
121
+ const { activateBasketViewFromStore } = await import('@/store/basket/basketViewActivator');
122
+ activateBasketViewFromStore(viewId);
123
+ }, []);
124
+
121
125
  const startPlayAll = useCallback(async (loop = false) => {
122
126
  if (playingAll || basketViews.length === 0) return;
123
127
  stopPlayRef.current = false;
@@ -129,7 +133,7 @@ export function BasketPresentationDock() {
129
133
  do {
130
134
  for (const view of orderedViews) {
131
135
  if (stopPlayRef.current) break;
132
- activateBasketViewFromStore(view.id);
136
+ await activateSavedView(view.id);
133
137
  const transitionMs = toTransitionMs(view.transitionMs);
134
138
  await wait(transitionMs + 180);
135
139
  }
@@ -138,7 +142,7 @@ export function BasketPresentationDock() {
138
142
  loopPlayRef.current = false;
139
143
  setPlayingAll(false);
140
144
  }
141
- }, [basketViews, playingAll, toTransitionMs, wait]);
145
+ }, [activateSavedView, basketViews, playingAll, toTransitionMs, wait]);
142
146
 
143
147
  const setViewTransitionDuration = useCallback((viewId: string, currentTransitionMs: number | null) => {
144
148
  const defaultSeconds = currentTransitionMs && currentTransitionMs > 0
@@ -299,7 +303,7 @@ export function BasketPresentationDock() {
299
303
  type="button"
300
304
  onClick={() => {
301
305
  if (editingViewId) return;
302
- activateBasketViewFromStore(view.id);
306
+ void activateSavedView(view.id);
303
307
  }}
304
308
  className={cn(
305
309
  'h-full w-full rounded-md border bg-card text-left overflow-hidden transition-colors',