@kruschdev/pascal-plugin-mit-assets 0.0.0-stage → 0.1.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 (78) hide show
  1. package/ASSETS.md +298 -0
  2. package/LICENSE +21 -0
  3. package/README.md +71 -2
  4. package/dist/agent-operations.d.ts +8 -0
  5. package/dist/agent-operations.js +305 -0
  6. package/dist/agent-tools.d.ts +7 -0
  7. package/dist/agent-tools.js +128 -0
  8. package/dist/audit.d.ts +78 -0
  9. package/dist/bin/pascal-mit-assets.js +5238 -0
  10. package/dist/bom.d.ts +123 -0
  11. package/dist/cad/appliance-mep-builders.d.ts +7 -0
  12. package/dist/cad/furniture-builders.d.ts +9 -0
  13. package/dist/cad/index.d.ts +48 -0
  14. package/dist/cad/index.js +23 -0
  15. package/dist/cad/kitchen-bath-builders.d.ts +9 -0
  16. package/dist/cad/outdoor-fenestration-builders.d.ts +8 -0
  17. package/dist/cad/primitives.d.ts +56 -0
  18. package/dist/cad/props-vehicles-builders.d.ts +8 -0
  19. package/dist/chunk-2qgndrap.js +5200 -0
  20. package/dist/chunk-6hzyh6qv.js +346 -0
  21. package/dist/chunk-f72r2bmp.js +84 -0
  22. package/dist/chunk-hqgm57dv.js +310 -0
  23. package/dist/chunk-kgwk6kan.js +150 -0
  24. package/dist/chunk-raafkn3w.js +286 -0
  25. package/dist/chunk-vzmjt9dz.js +4380 -0
  26. package/dist/chunk-xhkwv6t4.js +5080 -0
  27. package/dist/hdri/index.d.ts +1 -0
  28. package/dist/hdri/index.js +322 -0
  29. package/dist/hdri/sky.d.ts +26 -0
  30. package/dist/index.d.ts +30 -0
  31. package/dist/index.js +198 -0
  32. package/dist/manifest.d.ts +46 -0
  33. package/dist/materials/index.d.ts +10 -0
  34. package/dist/materials/index.js +1464 -0
  35. package/dist/materials/ktx2.d.ts +10 -0
  36. package/dist/materials/noise.d.ts +89 -0
  37. package/dist/materials/patterns.d.ts +15 -0
  38. package/dist/nodes/mit-item.d.ts +76 -0
  39. package/dist/render.d.ts +10 -0
  40. package/dist/render.js +24 -0
  41. package/dist/scripts/build-assets.js +17129 -0
  42. package/dist/sfx/index.d.ts +1 -0
  43. package/dist/sfx/index.js +1223 -0
  44. package/dist/sfx/synth.d.ts +25 -0
  45. package/dist/sku-crosswalk.d.ts +46 -0
  46. package/dist/ui/chat-card.d.ts +7 -0
  47. package/dist/ui/host-panel.d.ts +1 -0
  48. package/dist/ui/inspector-card.d.ts +4 -0
  49. package/dist/ui/schedule-view.d.ts +1 -0
  50. package/package.json +135 -4
  51. package/src/agent-operations.ts +373 -0
  52. package/src/agent-tools.ts +136 -0
  53. package/src/audit.ts +356 -0
  54. package/src/bom.ts +512 -0
  55. package/src/cad/appliance-mep-builders.ts +1336 -0
  56. package/src/cad/furniture-builders.ts +1622 -0
  57. package/src/cad/index.ts +993 -0
  58. package/src/cad/kitchen-bath-builders.ts +1189 -0
  59. package/src/cad/outdoor-fenestration-builders.ts +1499 -0
  60. package/src/cad/primitives.ts +286 -0
  61. package/src/cad/props-vehicles-builders.ts +1065 -0
  62. package/src/hdri/index.ts +5 -0
  63. package/src/hdri/sky.ts +481 -0
  64. package/src/index.ts +127 -0
  65. package/src/manifest.ts +5296 -0
  66. package/src/materials/index.ts +56 -0
  67. package/src/materials/ktx2.ts +138 -0
  68. package/src/materials/noise.ts +417 -0
  69. package/src/materials/patterns.ts +1507 -0
  70. package/src/nodes/mit-item.ts +163 -0
  71. package/src/render.ts +25 -0
  72. package/src/sfx/index.ts +6 -0
  73. package/src/sfx/synth.ts +1495 -0
  74. package/src/sku-crosswalk.ts +3868 -0
  75. package/src/ui/chat-card.tsx +93 -0
  76. package/src/ui/host-panel.tsx +330 -0
  77. package/src/ui/inspector-card.tsx +213 -0
  78. package/src/ui/schedule-view.tsx +188 -0
@@ -0,0 +1,93 @@
1
+ 'use client'
2
+
3
+ import type { ChatToolCardProps } from '@pascal-app/editor'
4
+ import { MIT_ASSETS_SCHEDULE_VIEW_ID } from '../render'
5
+
6
+ type MitAssetsChatCardProps = Partial<ChatToolCardProps> & {
7
+ /** Legacy fallback for standalone test callers */
8
+ result?: Record<string, unknown>
9
+ }
10
+
11
+ export default function MitAssetsChatCard({
12
+ toolName,
13
+ output,
14
+ state,
15
+ actions,
16
+ result,
17
+ }: MitAssetsChatCardProps) {
18
+ const payload = output?.data ?? result
19
+ const text = output?.text
20
+ const error = output?.error
21
+ const statusLabel =
22
+ state === 'running'
23
+ ? 'Running…'
24
+ : state === 'error' || error
25
+ ? 'Error'
26
+ : state === 'cancelled'
27
+ ? 'Cancelled'
28
+ : 'MIT'
29
+ const statusColor =
30
+ state === 'error' || error ? '#ef4444' : state === 'running' ? '#f59e0b' : '#22c55e'
31
+
32
+ return (
33
+ <div style={{ padding: 10, borderRadius: 6, border: '1px solid #27272a', fontSize: 12 }}>
34
+ <div
35
+ style={{
36
+ display: 'flex',
37
+ justifyContent: 'space-between',
38
+ alignItems: 'center',
39
+ marginBottom: 6,
40
+ gap: 8,
41
+ }}
42
+ >
43
+ <strong>{toolName ?? 'MIT Assets'}</strong>
44
+ <span style={{ color: statusColor, fontWeight: 600, fontSize: 11 }}>{statusLabel}</span>
45
+ </div>
46
+
47
+ {error && (
48
+ <div style={{ color: '#ef4444', marginBottom: 6, fontSize: 11 }}>{error}</div>
49
+ )}
50
+
51
+ {text && (
52
+ <div style={{ marginBottom: payload ? 6 : 0, opacity: 0.9, whiteSpace: 'pre-wrap' }}>
53
+ {text}
54
+ </div>
55
+ )}
56
+
57
+ {payload && (
58
+ <pre
59
+ style={{
60
+ margin: 0,
61
+ whiteSpace: 'pre-wrap',
62
+ fontSize: 11,
63
+ opacity: 0.85,
64
+ maxHeight: 220,
65
+ overflowY: 'auto',
66
+ }}
67
+ >
68
+ {JSON.stringify(payload, null, 2)}
69
+ </pre>
70
+ )}
71
+
72
+ {actions && state === 'done' && (
73
+ <div style={{ display: 'flex', gap: 6, marginTop: 8 }}>
74
+ <button
75
+ type="button"
76
+ onClick={() => actions.openView(MIT_ASSETS_SCHEDULE_VIEW_ID, { beside: true })}
77
+ style={{
78
+ padding: '3px 8px',
79
+ borderRadius: 4,
80
+ border: '1px solid #3f3f46',
81
+ background: 'transparent',
82
+ color: 'inherit',
83
+ fontSize: 11,
84
+ cursor: 'pointer',
85
+ }}
86
+ >
87
+ Open Audit &amp; BOM View
88
+ </button>
89
+ </div>
90
+ )}
91
+ </div>
92
+ )
93
+ }
@@ -0,0 +1,330 @@
1
+ 'use client'
2
+
3
+ import { type AnyNode, runAsSingleSceneHistoryStep } from '@pascal-app/core'
4
+ import { openEditorView, useScene, useViewer } from '@pascal-app/editor'
5
+ import { useMemo, useState } from 'react'
6
+ import { auditSceneMitProvenance, searchMitItems } from '../audit'
7
+ import {
8
+ MIT_ITEM_SPECS,
9
+ MIT_MATERIAL_SPECS,
10
+ MIT_SFX_SPECS,
11
+ type MitItemCategory,
12
+ } from '../manifest'
13
+ import { MitAssetsItemNode } from '../nodes/mit-item'
14
+ import { MIT_ASSETS_SCHEDULE_VIEW_ID } from '../render'
15
+
16
+ const CATEGORIES: readonly (MitItemCategory | 'all')[] = [
17
+ 'all',
18
+ 'furniture',
19
+ 'appliance',
20
+ 'kitchen',
21
+ 'bathroom',
22
+ 'outdoor',
23
+ 'architectural',
24
+ ]
25
+
26
+ export default function MitAssetsHostPanel() {
27
+ const nodes = useScene((s) => s.nodes)
28
+ const createNodes = useScene((s) => s.createNodes)
29
+ const activeLevelId = useViewer((s) => s.selection.levelId)
30
+ const [query, setQuery] = useState('')
31
+ const [category, setCategory] = useState<MitItemCategory | 'all'>('all')
32
+ const [tab, setTab] = useState<'items' | 'materials' | 'sfx'>('items')
33
+
34
+ const audit = useMemo(
35
+ () => auditSceneMitProvenance(nodes as unknown as Record<string, unknown>),
36
+ [nodes],
37
+ )
38
+
39
+ const filteredItems = useMemo(
40
+ () => searchMitItems(query, category === 'all' ? undefined : category, 200),
41
+ [query, category],
42
+ )
43
+
44
+ const filteredMaterials = useMemo(() => {
45
+ const q = query.trim().toLowerCase()
46
+ return MIT_MATERIAL_SPECS.filter((m) =>
47
+ !q ? true : `${m.id} ${m.category} ${m.pattern}`.toLowerCase().includes(q),
48
+ )
49
+ }, [query])
50
+
51
+ const filteredSfx = useMemo(() => {
52
+ const q = query.trim().toLowerCase()
53
+ return MIT_SFX_SPECS.filter((s) =>
54
+ !q ? true : `${s.id} ${s.file} ${s.group}`.toLowerCase().includes(q),
55
+ )
56
+ }, [query])
57
+
58
+ const targetLevelId = useMemo(() => {
59
+ if (activeLevelId && Object.hasOwn(nodes, activeLevelId)) {
60
+ return activeLevelId as AnyNode['id']
61
+ }
62
+ const entry = Object.entries(nodes).find(
63
+ ([, n]) => n && typeof n === 'object' && (n as { type?: string }).type === 'level',
64
+ )
65
+ return entry ? (entry[0] as AnyNode['id']) : null
66
+ }, [activeLevelId, nodes])
67
+
68
+ const placeItem = (slug: string) => {
69
+ const spec = MIT_ITEM_SPECS.find((s) => s.slug === slug)
70
+ if (!spec || !targetLevelId) return
71
+ const levelId = targetLevelId
72
+ let idx = 1
73
+ while (Object.hasOwn(nodes, `mititm_${idx}`)) idx += 1
74
+
75
+ const widthM = Math.min(20, Math.max(0.04, spec.dimensions[0]))
76
+ const heightM = Math.min(20, Math.max(0.01, spec.dimensions[1]))
77
+ const depthM = Math.min(20, Math.max(0.02, spec.dimensions[2]))
78
+
79
+ const existingMitNodes = (Object.values(nodes) as unknown[]).filter(
80
+ (n): n is { type: string; parentId?: unknown; position?: number[]; widthM?: number } =>
81
+ Boolean(
82
+ n &&
83
+ typeof n === 'object' &&
84
+ (n as { type?: string }).type === 'mit-assets:item' &&
85
+ (n as { parentId?: unknown }).parentId === levelId,
86
+ ),
87
+ )
88
+
89
+ let placeX = 0
90
+ if (existingMitNodes.length > 0) {
91
+ let maxRightEdge = -Infinity
92
+ for (const existing of existingMitNodes) {
93
+ const ex = Array.isArray(existing.position) && typeof existing.position[0] === 'number' ? existing.position[0] : 0
94
+ const ew = typeof existing.widthM === 'number' && Number.isFinite(existing.widthM) ? existing.widthM : 1
95
+ maxRightEdge = Math.max(maxRightEdge, ex + ew / 2)
96
+ }
97
+ placeX = Math.round((maxRightEdge + widthM / 2 + 0.65) * 100) / 100
98
+ }
99
+
100
+ const newNode = MitAssetsItemNode.parse({
101
+ object: 'node',
102
+ id: `mititm_${idx}`,
103
+ type: 'mit-assets:item',
104
+ name: spec.name,
105
+ parentId: levelId,
106
+ visible: true,
107
+ metadata: {},
108
+ slug: spec.slug,
109
+ category: spec.category,
110
+ position: [placeX, 0, 0],
111
+ rotation: 0,
112
+ widthM,
113
+ heightM,
114
+ depthM,
115
+ accentColor: '#5c7285',
116
+ quantity: 1,
117
+ license: 'MIT',
118
+ }) as unknown as AnyNode
119
+
120
+ runAsSingleSceneHistoryStep(useScene, () => {
121
+ createNodes([{ node: newNode, parentId: levelId }])
122
+ })
123
+ useViewer.getState().setSelection({ selectedIds: [newNode.id] })
124
+ }
125
+
126
+ return (
127
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 10, padding: 10, fontSize: 12, height: '100%', minHeight: 0 }}>
128
+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 6 }}>
129
+ <strong>MIT Assets Pack (#1327)</strong>
130
+ <button
131
+ type="button"
132
+ onClick={() => openEditorView(MIT_ASSETS_SCHEDULE_VIEW_ID, { beside: true })}
133
+ style={{
134
+ fontSize: 10,
135
+ padding: '2px 6px',
136
+ borderRadius: 4,
137
+ border: 'none',
138
+ background: audit.commercialReady ? '#166534' : '#92400e',
139
+ color: '#fff',
140
+ cursor: 'pointer',
141
+ }}
142
+ title="Open MIT Provenance Audit & Priced SKU BOM View"
143
+ >
144
+ {audit.commercialReady
145
+ ? '100% MIT · BOM'
146
+ : `${audit.replaceableCount + audit.unmappedCount} Non-MIT · Audit`}
147
+ </button>
148
+ </div>
149
+
150
+ <div style={{ display: 'flex', gap: 4 }}>
151
+ {(['items', 'materials', 'sfx'] as const).map((t) => (
152
+ <button
153
+ key={t}
154
+ type="button"
155
+ onClick={() => setTab(t)}
156
+ style={{
157
+ flex: 1,
158
+ padding: '4px 6px',
159
+ borderRadius: 4,
160
+ border: '1px solid #3f3f46',
161
+ background: tab === t ? '#2563eb' : 'transparent',
162
+ color: tab === t ? '#fff' : 'inherit',
163
+ cursor: 'pointer',
164
+ }}
165
+ >
166
+ {t === 'items'
167
+ ? `Items (${MIT_ITEM_SPECS.length})`
168
+ : t === 'materials'
169
+ ? `Materials (${MIT_MATERIAL_SPECS.length})`
170
+ : `SFX (${MIT_SFX_SPECS.length})`}
171
+ </button>
172
+ ))}
173
+ </div>
174
+
175
+ <input
176
+ type="text"
177
+ aria-label={`Filter ${tab}`}
178
+ placeholder={`Filter ${tab}...`}
179
+ value={query}
180
+ onChange={(e) => setQuery(e.target.value)}
181
+ style={{
182
+ padding: 6,
183
+ borderRadius: 4,
184
+ border: '1px solid #3f3f46',
185
+ background: 'transparent',
186
+ color: 'inherit',
187
+ }}
188
+ />
189
+
190
+ {tab === 'items' && (
191
+ <>
192
+ <div style={{ display: 'flex', flexWrap: 'wrap', gap: 4 }}>
193
+ {CATEGORIES.map((c) => (
194
+ <button
195
+ key={c}
196
+ type="button"
197
+ onClick={() => setCategory(c)}
198
+ style={{
199
+ padding: '2px 6px',
200
+ fontSize: 10,
201
+ borderRadius: 4,
202
+ border: '1px solid #3f3f46',
203
+ background: category === c ? '#3b82f6' : 'transparent',
204
+ color: category === c ? '#fff' : 'inherit',
205
+ cursor: 'pointer',
206
+ }}
207
+ >
208
+ {c}
209
+ </button>
210
+ ))}
211
+ </div>
212
+
213
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 4, flex: 1, minHeight: 0, overflowY: 'auto' }}>
214
+ {filteredItems.length === 0 ? (
215
+ <div style={{ padding: 12, textAlign: 'center', opacity: 0.7 }}>
216
+ No matching MIT items.
217
+ </div>
218
+ ) : (
219
+ filteredItems.map((item) => (
220
+ <div
221
+ key={item.slug}
222
+ style={{
223
+ display: 'flex',
224
+ justifyContent: 'space-between',
225
+ alignItems: 'center',
226
+ padding: '5px 8px',
227
+ borderRadius: 4,
228
+ border: '1px solid #27272a',
229
+ }}
230
+ >
231
+ <div>
232
+ <div style={{ fontWeight: 600 }}>{item.name}</div>
233
+ <div style={{ fontSize: 10, opacity: 0.7 }}>
234
+ {item.slug} · {item.dimensions.map((n) => n.toFixed(2)).join('×')}m
235
+ </div>
236
+ </div>
237
+ <button
238
+ type="button"
239
+ disabled={!targetLevelId}
240
+ title={targetLevelId ? `Place ${item.name}` : 'Add a level to the scene first'}
241
+ onClick={() => placeItem(item.slug)}
242
+ style={{
243
+ padding: '3px 8px',
244
+ borderRadius: 4,
245
+ border: 'none',
246
+ background: targetLevelId ? '#16a34a' : '#52525b',
247
+ color: '#fff',
248
+ cursor: targetLevelId ? 'pointer' : 'not-allowed',
249
+ opacity: targetLevelId ? 1 : 0.65,
250
+ fontSize: 11,
251
+ }}
252
+ >
253
+ Place
254
+ </button>
255
+ </div>
256
+ ))
257
+ )}
258
+ </div>
259
+ </>
260
+ )}
261
+
262
+ {tab === 'materials' && (
263
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 4, flex: 1, minHeight: 0, overflowY: 'auto' }}>
264
+ {filteredMaterials.length === 0 ? (
265
+ <div style={{ padding: 12, textAlign: 'center', opacity: 0.7 }}>
266
+ No matching MIT materials.
267
+ </div>
268
+ ) : (
269
+ filteredMaterials.map((mat) => (
270
+ <div
271
+ key={mat.id}
272
+ style={{
273
+ display: 'flex',
274
+ alignItems: 'center',
275
+ gap: 8,
276
+ padding: '5px 8px',
277
+ borderRadius: 4,
278
+ border: '1px solid #27272a',
279
+ }}
280
+ >
281
+ <span
282
+ style={{
283
+ width: 18,
284
+ height: 18,
285
+ borderRadius: 3,
286
+ background: mat.previewColor,
287
+ border: '1px solid #52525b',
288
+ flexShrink: 0,
289
+ }}
290
+ />
291
+ <div>
292
+ <div style={{ fontWeight: 600 }}>{mat.id}</div>
293
+ <div style={{ fontSize: 10, opacity: 0.7 }}>
294
+ {mat.pattern} · {mat.ktx2Files.length} KTX2 / {mat.webpFiles.length} WebP · MIT
295
+ </div>
296
+ </div>
297
+ </div>
298
+ ))
299
+ )}
300
+ </div>
301
+ )}
302
+
303
+ {tab === 'sfx' && (
304
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 4, flex: 1, minHeight: 0, overflowY: 'auto' }}>
305
+ {filteredSfx.length === 0 ? (
306
+ <div style={{ padding: 12, textAlign: 'center', opacity: 0.7 }}>
307
+ No matching MIT SFX cues.
308
+ </div>
309
+ ) : (
310
+ filteredSfx.map((sfx) => (
311
+ <div
312
+ key={sfx.id}
313
+ style={{
314
+ display: 'flex',
315
+ justifyContent: 'space-between',
316
+ padding: '4px 8px',
317
+ borderRadius: 4,
318
+ border: '1px solid #27272a',
319
+ }}
320
+ >
321
+ <span>{sfx.file}</span>
322
+ <span style={{ opacity: 0.7, fontSize: 10 }}>{sfx.group}{sfx.loop ? ' (loop)' : ''}</span>
323
+ </div>
324
+ ))
325
+ )}
326
+ </div>
327
+ )}
328
+ </div>
329
+ )
330
+ }
@@ -0,0 +1,213 @@
1
+ 'use client'
2
+
3
+ import type { AnyNode } from '@pascal-app/core'
4
+ import { useScene } from '@pascal-app/editor'
5
+ import { useEffect, useState } from 'react'
6
+ import { MIT_ITEM_SPECS, getMitItemSpec } from '../manifest'
7
+ import { getMitItemSku } from '../sku-crosswalk'
8
+
9
+ function safeFiniteDim(value: unknown, fallback: number, min: number, max: number): number {
10
+ const n = typeof value === 'number' ? value : Number(value)
11
+ if (!Number.isFinite(n)) return Math.min(max, Math.max(min, fallback))
12
+ return Math.min(max, Math.max(min, n))
13
+ }
14
+
15
+ export default function MitAssetsInspectorCard({ node }: { node?: AnyNode }) {
16
+ const updateNodes = useScene((s) => s.updateNodes)
17
+ const raw = node as unknown as Record<string, unknown> | undefined
18
+ const isMitItem = Boolean(raw && raw.type === 'mit-assets:item')
19
+ const nodeId = isMitItem ? String(raw?.id ?? '') : ''
20
+
21
+ const slug = isMitItem ? String(raw?.slug ?? 'sofa') : 'sofa'
22
+ const spec = getMitItemSpec(slug)
23
+ const skuRec = getMitItemSku(slug)
24
+ const widthM = safeFiniteDim(raw?.widthM, spec?.dimensions[0] ?? 1, 0.04, 20)
25
+ const heightM = safeFiniteDim(raw?.heightM, spec?.dimensions[1] ?? 1, 0.01, 20)
26
+ const depthM = safeFiniteDim(raw?.depthM, spec?.dimensions[2] ?? 1, 0.02, 20)
27
+ const rawAccent = typeof raw?.accentColor === 'string' ? raw.accentColor : ''
28
+ const accentColor = /^#[0-9a-fA-F]{6}$/.test(rawAccent) ? rawAccent : '#5c7285'
29
+
30
+ const [draftW, setDraftW] = useState(() => String(widthM))
31
+ const [draftH, setDraftH] = useState(() => String(heightM))
32
+ const [draftD, setDraftD] = useState(() => String(depthM))
33
+
34
+ useEffect(() => {
35
+ setDraftW(String(widthM))
36
+ setDraftH(String(heightM))
37
+ setDraftD(String(depthM))
38
+ // Reset drafts unconditionally only when switching selected node
39
+ // eslint-disable-next-line react-hooks/exhaustive-deps
40
+ }, [nodeId])
41
+
42
+ useEffect(() => {
43
+ setDraftW((prev) => (prev.trim() !== '' && Number(prev) === widthM ? prev : String(widthM)))
44
+ }, [widthM])
45
+
46
+ useEffect(() => {
47
+ setDraftH((prev) => (prev.trim() !== '' && Number(prev) === heightM ? prev : String(heightM)))
48
+ }, [heightM])
49
+
50
+ useEffect(() => {
51
+ setDraftD((prev) => (prev.trim() !== '' && Number(prev) === depthM ? prev : String(depthM)))
52
+ }, [depthM])
53
+
54
+ if (!isMitItem || !raw) return null
55
+
56
+ const patch = (updates: Record<string, unknown>) => {
57
+ updateNodes([{ id: nodeId as AnyNode['id'], data: updates as Partial<AnyNode> }])
58
+ }
59
+
60
+ const inputStyle = {
61
+ padding: 4,
62
+ borderRadius: 4,
63
+ border: '1px solid #3f3f46',
64
+ background: 'transparent',
65
+ color: 'inherit',
66
+ } as const
67
+
68
+ return (
69
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 10, padding: '6px 10px 10px', fontSize: 12 }}>
70
+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
71
+ <strong>Clean-Room MIT Asset</strong>
72
+ <span
73
+ style={{
74
+ padding: '2px 6px',
75
+ borderRadius: 4,
76
+ background: '#166534',
77
+ color: '#dcfce7',
78
+ fontWeight: 600,
79
+ fontSize: 10,
80
+ }}
81
+ >
82
+ MIT LICENSE
83
+ </span>
84
+ </div>
85
+
86
+ <label style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
87
+ <span>Item Slug ({MIT_ITEM_SPECS.length} available)</span>
88
+ <select
89
+ value={slug}
90
+ onChange={(e) => {
91
+ const next = getMitItemSpec(e.target.value)
92
+ if (!next) return
93
+ patch({
94
+ slug: next.slug,
95
+ name: next.name,
96
+ category: next.category,
97
+ widthM: Math.min(20, Math.max(0.04, next.dimensions[0])),
98
+ heightM: Math.min(20, Math.max(0.01, next.dimensions[1])),
99
+ depthM: Math.min(20, Math.max(0.02, next.dimensions[2])),
100
+ })
101
+ }}
102
+ style={inputStyle}
103
+ >
104
+ {!spec && <option value={slug}>{slug} (custom)</option>}
105
+ {MIT_ITEM_SPECS.map((item) => (
106
+ <option key={item.slug} value={item.slug}>
107
+ {item.name} ({item.slug})
108
+ </option>
109
+ ))}
110
+ </select>
111
+ </label>
112
+
113
+ <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: 6 }}>
114
+ <label style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
115
+ <span>W (m)</span>
116
+ <input
117
+ type="number"
118
+ step={0.05}
119
+ min={0.04}
120
+ max={20}
121
+ value={draftW}
122
+ onChange={(e) => {
123
+ const str = e.target.value
124
+ setDraftW(str)
125
+ if (str.trim() === '') return
126
+ const v = Number(str)
127
+ if (Number.isFinite(v) && v >= 0.04 && v <= 20) patch({ widthM: v })
128
+ }}
129
+ onBlur={() => setDraftW(String(widthM))}
130
+ style={inputStyle}
131
+ />
132
+ </label>
133
+ <label style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
134
+ <span>H (m)</span>
135
+ <input
136
+ type="number"
137
+ step={0.05}
138
+ min={0.01}
139
+ max={20}
140
+ value={draftH}
141
+ onChange={(e) => {
142
+ const str = e.target.value
143
+ setDraftH(str)
144
+ if (str.trim() === '') return
145
+ const v = Number(str)
146
+ if (Number.isFinite(v) && v >= 0.01 && v <= 20) patch({ heightM: v })
147
+ }}
148
+ onBlur={() => setDraftH(String(heightM))}
149
+ style={inputStyle}
150
+ />
151
+ </label>
152
+ <label style={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
153
+ <span>D (m)</span>
154
+ <input
155
+ type="number"
156
+ step={0.05}
157
+ min={0.02}
158
+ max={20}
159
+ value={draftD}
160
+ onChange={(e) => {
161
+ const str = e.target.value
162
+ setDraftD(str)
163
+ if (str.trim() === '') return
164
+ const v = Number(str)
165
+ if (Number.isFinite(v) && v >= 0.02 && v <= 20) patch({ depthM: v })
166
+ }}
167
+ onBlur={() => setDraftD(String(depthM))}
168
+ style={inputStyle}
169
+ />
170
+ </label>
171
+ </div>
172
+
173
+ <label style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8 }}>
174
+ <span>Accent Finish</span>
175
+ <input
176
+ type="color"
177
+ value={accentColor}
178
+ onChange={(e) => {
179
+ if (/^#[0-9a-fA-F]{6}$/.test(e.target.value)) {
180
+ patch({ accentColor: e.target.value })
181
+ }
182
+ }}
183
+ />
184
+ </label>
185
+
186
+ {skuRec && (
187
+ <div
188
+ style={{
189
+ padding: 8,
190
+ borderRadius: 4,
191
+ border: '1px solid #27272a',
192
+ display: 'flex',
193
+ flexDirection: 'column',
194
+ gap: 2,
195
+ }}
196
+ >
197
+ <div style={{ display: 'flex', justifyContent: 'space-between', fontWeight: 600 }}>
198
+ <span>{skuRec.manufacturer} · {skuRec.sku}</span>
199
+ <span style={{ color: '#22c55e' }}>${skuRec.estUnitPriceUsd.toFixed(2)}/{skuRec.unitOfMeasure}</span>
200
+ </div>
201
+ <div style={{ fontSize: 11, opacity: 0.8 }}>{skuRec.productName}</div>
202
+ <div style={{ fontSize: 10, opacity: 0.65 }}>
203
+ CSI {skuRec.csiDivision} · {skuRec.catalogSku ? 'Linked to @kruschdev/pascal-plugin-catalog' : 'MIT SKU Crosswalk'}
204
+ </div>
205
+ </div>
206
+ )}
207
+
208
+ <div style={{ opacity: 0.75, fontSize: 11 }}>
209
+ Procedural Three.js geometry — zero third-party GLB dependencies. Commercial SaaS ready.
210
+ </div>
211
+ </div>
212
+ )
213
+ }