@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.
- package/ASSETS.md +298 -0
- package/LICENSE +21 -0
- package/README.md +71 -2
- package/dist/agent-operations.d.ts +8 -0
- package/dist/agent-operations.js +305 -0
- package/dist/agent-tools.d.ts +7 -0
- package/dist/agent-tools.js +128 -0
- package/dist/audit.d.ts +78 -0
- package/dist/bin/pascal-mit-assets.js +5238 -0
- package/dist/bom.d.ts +123 -0
- package/dist/cad/appliance-mep-builders.d.ts +7 -0
- package/dist/cad/furniture-builders.d.ts +9 -0
- package/dist/cad/index.d.ts +48 -0
- package/dist/cad/index.js +23 -0
- package/dist/cad/kitchen-bath-builders.d.ts +9 -0
- package/dist/cad/outdoor-fenestration-builders.d.ts +8 -0
- package/dist/cad/primitives.d.ts +56 -0
- package/dist/cad/props-vehicles-builders.d.ts +8 -0
- package/dist/chunk-2qgndrap.js +5200 -0
- package/dist/chunk-6hzyh6qv.js +346 -0
- package/dist/chunk-f72r2bmp.js +84 -0
- package/dist/chunk-hqgm57dv.js +310 -0
- package/dist/chunk-kgwk6kan.js +150 -0
- package/dist/chunk-raafkn3w.js +286 -0
- package/dist/chunk-vzmjt9dz.js +4380 -0
- package/dist/chunk-xhkwv6t4.js +5080 -0
- package/dist/hdri/index.d.ts +1 -0
- package/dist/hdri/index.js +322 -0
- package/dist/hdri/sky.d.ts +26 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +198 -0
- package/dist/manifest.d.ts +46 -0
- package/dist/materials/index.d.ts +10 -0
- package/dist/materials/index.js +1464 -0
- package/dist/materials/ktx2.d.ts +10 -0
- package/dist/materials/noise.d.ts +89 -0
- package/dist/materials/patterns.d.ts +15 -0
- package/dist/nodes/mit-item.d.ts +76 -0
- package/dist/render.d.ts +10 -0
- package/dist/render.js +24 -0
- package/dist/scripts/build-assets.js +17129 -0
- package/dist/sfx/index.d.ts +1 -0
- package/dist/sfx/index.js +1223 -0
- package/dist/sfx/synth.d.ts +25 -0
- package/dist/sku-crosswalk.d.ts +46 -0
- package/dist/ui/chat-card.d.ts +7 -0
- package/dist/ui/host-panel.d.ts +1 -0
- package/dist/ui/inspector-card.d.ts +4 -0
- package/dist/ui/schedule-view.d.ts +1 -0
- package/package.json +135 -4
- package/src/agent-operations.ts +373 -0
- package/src/agent-tools.ts +136 -0
- package/src/audit.ts +356 -0
- package/src/bom.ts +512 -0
- package/src/cad/appliance-mep-builders.ts +1336 -0
- package/src/cad/furniture-builders.ts +1622 -0
- package/src/cad/index.ts +993 -0
- package/src/cad/kitchen-bath-builders.ts +1189 -0
- package/src/cad/outdoor-fenestration-builders.ts +1499 -0
- package/src/cad/primitives.ts +286 -0
- package/src/cad/props-vehicles-builders.ts +1065 -0
- package/src/hdri/index.ts +5 -0
- package/src/hdri/sky.ts +481 -0
- package/src/index.ts +127 -0
- package/src/manifest.ts +5296 -0
- package/src/materials/index.ts +56 -0
- package/src/materials/ktx2.ts +138 -0
- package/src/materials/noise.ts +417 -0
- package/src/materials/patterns.ts +1507 -0
- package/src/nodes/mit-item.ts +163 -0
- package/src/render.ts +25 -0
- package/src/sfx/index.ts +6 -0
- package/src/sfx/synth.ts +1495 -0
- package/src/sku-crosswalk.ts +3868 -0
- package/src/ui/chat-card.tsx +93 -0
- package/src/ui/host-panel.tsx +330 -0
- package/src/ui/inspector-card.tsx +213 -0
- package/src/ui/schedule-view.tsx +188 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
MIT_ITEM_SPECS2,
|
|
4
|
+
MIT_MATERIAL_SPECS2,
|
|
5
|
+
MIT_SFX_SPECS2
|
|
6
|
+
} from "./chunk-2qgndrap.js";
|
|
7
|
+
import {
|
|
8
|
+
searchMitItems2,
|
|
9
|
+
auditSceneMitProvenance2
|
|
10
|
+
} from "./chunk-vzmjt9dz.js";
|
|
11
|
+
import"./chunk-xhkwv6t4.js";
|
|
12
|
+
import {
|
|
13
|
+
MitAssetsItemNode2,
|
|
14
|
+
MIT_ASSETS_SCHEDULE_VIEW_ID2
|
|
15
|
+
} from "./chunk-kgwk6kan.js";
|
|
16
|
+
|
|
17
|
+
// src/ui/host-panel.tsx
|
|
18
|
+
import { runAsSingleSceneHistoryStep } from "@pascal-app/core";
|
|
19
|
+
import { openEditorView, useScene, useViewer } from "@pascal-app/editor";
|
|
20
|
+
import { useMemo, useState } from "react";
|
|
21
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
22
|
+
var CATEGORIES = [
|
|
23
|
+
"all",
|
|
24
|
+
"furniture",
|
|
25
|
+
"appliance",
|
|
26
|
+
"kitchen",
|
|
27
|
+
"bathroom",
|
|
28
|
+
"outdoor",
|
|
29
|
+
"architectural"
|
|
30
|
+
];
|
|
31
|
+
function MitAssetsHostPanel() {
|
|
32
|
+
const nodes = useScene((s) => s.nodes);
|
|
33
|
+
const createNodes = useScene((s) => s.createNodes);
|
|
34
|
+
const activeLevelId = useViewer((s) => s.selection.levelId);
|
|
35
|
+
const [query, setQuery] = useState("");
|
|
36
|
+
const [category, setCategory] = useState("all");
|
|
37
|
+
const [tab, setTab] = useState("items");
|
|
38
|
+
const audit = useMemo(() => auditSceneMitProvenance2(nodes), [nodes]);
|
|
39
|
+
const filteredItems = useMemo(() => searchMitItems2(query, category === "all" ? undefined : category, 200), [query, category]);
|
|
40
|
+
const filteredMaterials = useMemo(() => {
|
|
41
|
+
const q = query.trim().toLowerCase();
|
|
42
|
+
return MIT_MATERIAL_SPECS2.filter((m) => !q ? true : `${m.id} ${m.category} ${m.pattern}`.toLowerCase().includes(q));
|
|
43
|
+
}, [query]);
|
|
44
|
+
const filteredSfx = useMemo(() => {
|
|
45
|
+
const q = query.trim().toLowerCase();
|
|
46
|
+
return MIT_SFX_SPECS2.filter((s) => !q ? true : `${s.id} ${s.file} ${s.group}`.toLowerCase().includes(q));
|
|
47
|
+
}, [query]);
|
|
48
|
+
const targetLevelId = useMemo(() => {
|
|
49
|
+
if (activeLevelId && Object.hasOwn(nodes, activeLevelId)) {
|
|
50
|
+
return activeLevelId;
|
|
51
|
+
}
|
|
52
|
+
const entry = Object.entries(nodes).find(([, n]) => n && typeof n === "object" && n.type === "level");
|
|
53
|
+
return entry ? entry[0] : null;
|
|
54
|
+
}, [activeLevelId, nodes]);
|
|
55
|
+
const placeItem = (slug) => {
|
|
56
|
+
const spec = MIT_ITEM_SPECS2.find((s) => s.slug === slug);
|
|
57
|
+
if (!spec || !targetLevelId)
|
|
58
|
+
return;
|
|
59
|
+
const levelId = targetLevelId;
|
|
60
|
+
let idx = 1;
|
|
61
|
+
while (Object.hasOwn(nodes, `mititm_${idx}`))
|
|
62
|
+
idx += 1;
|
|
63
|
+
const widthM = Math.min(20, Math.max(0.04, spec.dimensions[0]));
|
|
64
|
+
const heightM = Math.min(20, Math.max(0.01, spec.dimensions[1]));
|
|
65
|
+
const depthM = Math.min(20, Math.max(0.02, spec.dimensions[2]));
|
|
66
|
+
const existingMitNodes = Object.values(nodes).filter((n) => Boolean(n && typeof n === "object" && n.type === "mit-assets:item" && n.parentId === levelId));
|
|
67
|
+
let placeX = 0;
|
|
68
|
+
if (existingMitNodes.length > 0) {
|
|
69
|
+
let maxRightEdge = -Infinity;
|
|
70
|
+
for (const existing of existingMitNodes) {
|
|
71
|
+
const ex = Array.isArray(existing.position) && typeof existing.position[0] === "number" ? existing.position[0] : 0;
|
|
72
|
+
const ew = typeof existing.widthM === "number" && Number.isFinite(existing.widthM) ? existing.widthM : 1;
|
|
73
|
+
maxRightEdge = Math.max(maxRightEdge, ex + ew / 2);
|
|
74
|
+
}
|
|
75
|
+
placeX = Math.round((maxRightEdge + widthM / 2 + 0.65) * 100) / 100;
|
|
76
|
+
}
|
|
77
|
+
const newNode = MitAssetsItemNode2.parse({
|
|
78
|
+
object: "node",
|
|
79
|
+
id: `mititm_${idx}`,
|
|
80
|
+
type: "mit-assets:item",
|
|
81
|
+
name: spec.name,
|
|
82
|
+
parentId: levelId,
|
|
83
|
+
visible: true,
|
|
84
|
+
metadata: {},
|
|
85
|
+
slug: spec.slug,
|
|
86
|
+
category: spec.category,
|
|
87
|
+
position: [placeX, 0, 0],
|
|
88
|
+
rotation: 0,
|
|
89
|
+
widthM,
|
|
90
|
+
heightM,
|
|
91
|
+
depthM,
|
|
92
|
+
accentColor: "#5c7285",
|
|
93
|
+
quantity: 1,
|
|
94
|
+
license: "MIT"
|
|
95
|
+
});
|
|
96
|
+
runAsSingleSceneHistoryStep(useScene, () => {
|
|
97
|
+
createNodes([{ node: newNode, parentId: levelId }]);
|
|
98
|
+
});
|
|
99
|
+
useViewer.getState().setSelection({ selectedIds: [newNode.id] });
|
|
100
|
+
};
|
|
101
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
102
|
+
style: { display: "flex", flexDirection: "column", gap: 10, padding: 10, fontSize: 12, height: "100%", minHeight: 0 },
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ jsxs("div", {
|
|
105
|
+
style: { display: "flex", justifyContent: "space-between", alignItems: "center", gap: 6 },
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ jsx("strong", {
|
|
108
|
+
children: "MIT Assets Pack (#1327)"
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ jsx("button", {
|
|
111
|
+
type: "button",
|
|
112
|
+
onClick: () => openEditorView(MIT_ASSETS_SCHEDULE_VIEW_ID2, { beside: true }),
|
|
113
|
+
style: {
|
|
114
|
+
fontSize: 10,
|
|
115
|
+
padding: "2px 6px",
|
|
116
|
+
borderRadius: 4,
|
|
117
|
+
border: "none",
|
|
118
|
+
background: audit.commercialReady ? "#166534" : "#92400e",
|
|
119
|
+
color: "#fff",
|
|
120
|
+
cursor: "pointer"
|
|
121
|
+
},
|
|
122
|
+
title: "Open MIT Provenance Audit & Priced SKU BOM View",
|
|
123
|
+
children: audit.commercialReady ? "100% MIT · BOM" : `${audit.replaceableCount + audit.unmappedCount} Non-MIT · Audit`
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
}),
|
|
127
|
+
/* @__PURE__ */ jsx("div", {
|
|
128
|
+
style: { display: "flex", gap: 4 },
|
|
129
|
+
children: ["items", "materials", "sfx"].map((t) => /* @__PURE__ */ jsx("button", {
|
|
130
|
+
type: "button",
|
|
131
|
+
onClick: () => setTab(t),
|
|
132
|
+
style: {
|
|
133
|
+
flex: 1,
|
|
134
|
+
padding: "4px 6px",
|
|
135
|
+
borderRadius: 4,
|
|
136
|
+
border: "1px solid #3f3f46",
|
|
137
|
+
background: tab === t ? "#2563eb" : "transparent",
|
|
138
|
+
color: tab === t ? "#fff" : "inherit",
|
|
139
|
+
cursor: "pointer"
|
|
140
|
+
},
|
|
141
|
+
children: t === "items" ? `Items (${MIT_ITEM_SPECS2.length})` : t === "materials" ? `Materials (${MIT_MATERIAL_SPECS2.length})` : `SFX (${MIT_SFX_SPECS2.length})`
|
|
142
|
+
}, t))
|
|
143
|
+
}),
|
|
144
|
+
/* @__PURE__ */ jsx("input", {
|
|
145
|
+
type: "text",
|
|
146
|
+
"aria-label": `Filter ${tab}`,
|
|
147
|
+
placeholder: `Filter ${tab}...`,
|
|
148
|
+
value: query,
|
|
149
|
+
onChange: (e) => setQuery(e.target.value),
|
|
150
|
+
style: {
|
|
151
|
+
padding: 6,
|
|
152
|
+
borderRadius: 4,
|
|
153
|
+
border: "1px solid #3f3f46",
|
|
154
|
+
background: "transparent",
|
|
155
|
+
color: "inherit"
|
|
156
|
+
}
|
|
157
|
+
}),
|
|
158
|
+
tab === "items" && /* @__PURE__ */ jsxs(Fragment, {
|
|
159
|
+
children: [
|
|
160
|
+
/* @__PURE__ */ jsx("div", {
|
|
161
|
+
style: { display: "flex", flexWrap: "wrap", gap: 4 },
|
|
162
|
+
children: CATEGORIES.map((c) => /* @__PURE__ */ jsx("button", {
|
|
163
|
+
type: "button",
|
|
164
|
+
onClick: () => setCategory(c),
|
|
165
|
+
style: {
|
|
166
|
+
padding: "2px 6px",
|
|
167
|
+
fontSize: 10,
|
|
168
|
+
borderRadius: 4,
|
|
169
|
+
border: "1px solid #3f3f46",
|
|
170
|
+
background: category === c ? "#3b82f6" : "transparent",
|
|
171
|
+
color: category === c ? "#fff" : "inherit",
|
|
172
|
+
cursor: "pointer"
|
|
173
|
+
},
|
|
174
|
+
children: c
|
|
175
|
+
}, c))
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ jsx("div", {
|
|
178
|
+
style: { display: "flex", flexDirection: "column", gap: 4, flex: 1, minHeight: 0, overflowY: "auto" },
|
|
179
|
+
children: filteredItems.length === 0 ? /* @__PURE__ */ jsx("div", {
|
|
180
|
+
style: { padding: 12, textAlign: "center", opacity: 0.7 },
|
|
181
|
+
children: "No matching MIT items."
|
|
182
|
+
}) : filteredItems.map((item) => /* @__PURE__ */ jsxs("div", {
|
|
183
|
+
style: {
|
|
184
|
+
display: "flex",
|
|
185
|
+
justifyContent: "space-between",
|
|
186
|
+
alignItems: "center",
|
|
187
|
+
padding: "5px 8px",
|
|
188
|
+
borderRadius: 4,
|
|
189
|
+
border: "1px solid #27272a"
|
|
190
|
+
},
|
|
191
|
+
children: [
|
|
192
|
+
/* @__PURE__ */ jsxs("div", {
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ jsx("div", {
|
|
195
|
+
style: { fontWeight: 600 },
|
|
196
|
+
children: item.name
|
|
197
|
+
}),
|
|
198
|
+
/* @__PURE__ */ jsxs("div", {
|
|
199
|
+
style: { fontSize: 10, opacity: 0.7 },
|
|
200
|
+
children: [
|
|
201
|
+
item.slug,
|
|
202
|
+
" · ",
|
|
203
|
+
item.dimensions.map((n) => n.toFixed(2)).join("×"),
|
|
204
|
+
"m"
|
|
205
|
+
]
|
|
206
|
+
})
|
|
207
|
+
]
|
|
208
|
+
}),
|
|
209
|
+
/* @__PURE__ */ jsx("button", {
|
|
210
|
+
type: "button",
|
|
211
|
+
disabled: !targetLevelId,
|
|
212
|
+
title: targetLevelId ? `Place ${item.name}` : "Add a level to the scene first",
|
|
213
|
+
onClick: () => placeItem(item.slug),
|
|
214
|
+
style: {
|
|
215
|
+
padding: "3px 8px",
|
|
216
|
+
borderRadius: 4,
|
|
217
|
+
border: "none",
|
|
218
|
+
background: targetLevelId ? "#16a34a" : "#52525b",
|
|
219
|
+
color: "#fff",
|
|
220
|
+
cursor: targetLevelId ? "pointer" : "not-allowed",
|
|
221
|
+
opacity: targetLevelId ? 1 : 0.65,
|
|
222
|
+
fontSize: 11
|
|
223
|
+
},
|
|
224
|
+
children: "Place"
|
|
225
|
+
})
|
|
226
|
+
]
|
|
227
|
+
}, item.slug))
|
|
228
|
+
})
|
|
229
|
+
]
|
|
230
|
+
}),
|
|
231
|
+
tab === "materials" && /* @__PURE__ */ jsx("div", {
|
|
232
|
+
style: { display: "flex", flexDirection: "column", gap: 4, flex: 1, minHeight: 0, overflowY: "auto" },
|
|
233
|
+
children: filteredMaterials.length === 0 ? /* @__PURE__ */ jsx("div", {
|
|
234
|
+
style: { padding: 12, textAlign: "center", opacity: 0.7 },
|
|
235
|
+
children: "No matching MIT materials."
|
|
236
|
+
}) : filteredMaterials.map((mat) => /* @__PURE__ */ jsxs("div", {
|
|
237
|
+
style: {
|
|
238
|
+
display: "flex",
|
|
239
|
+
alignItems: "center",
|
|
240
|
+
gap: 8,
|
|
241
|
+
padding: "5px 8px",
|
|
242
|
+
borderRadius: 4,
|
|
243
|
+
border: "1px solid #27272a"
|
|
244
|
+
},
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ jsx("span", {
|
|
247
|
+
style: {
|
|
248
|
+
width: 18,
|
|
249
|
+
height: 18,
|
|
250
|
+
borderRadius: 3,
|
|
251
|
+
background: mat.previewColor,
|
|
252
|
+
border: "1px solid #52525b",
|
|
253
|
+
flexShrink: 0
|
|
254
|
+
}
|
|
255
|
+
}),
|
|
256
|
+
/* @__PURE__ */ jsxs("div", {
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ jsx("div", {
|
|
259
|
+
style: { fontWeight: 600 },
|
|
260
|
+
children: mat.id
|
|
261
|
+
}),
|
|
262
|
+
/* @__PURE__ */ jsxs("div", {
|
|
263
|
+
style: { fontSize: 10, opacity: 0.7 },
|
|
264
|
+
children: [
|
|
265
|
+
mat.pattern,
|
|
266
|
+
" · ",
|
|
267
|
+
mat.ktx2Files.length,
|
|
268
|
+
" KTX2 / ",
|
|
269
|
+
mat.webpFiles.length,
|
|
270
|
+
" WebP · MIT"
|
|
271
|
+
]
|
|
272
|
+
})
|
|
273
|
+
]
|
|
274
|
+
})
|
|
275
|
+
]
|
|
276
|
+
}, mat.id))
|
|
277
|
+
}),
|
|
278
|
+
tab === "sfx" && /* @__PURE__ */ jsx("div", {
|
|
279
|
+
style: { display: "flex", flexDirection: "column", gap: 4, flex: 1, minHeight: 0, overflowY: "auto" },
|
|
280
|
+
children: filteredSfx.length === 0 ? /* @__PURE__ */ jsx("div", {
|
|
281
|
+
style: { padding: 12, textAlign: "center", opacity: 0.7 },
|
|
282
|
+
children: "No matching MIT SFX cues."
|
|
283
|
+
}) : filteredSfx.map((sfx) => /* @__PURE__ */ jsxs("div", {
|
|
284
|
+
style: {
|
|
285
|
+
display: "flex",
|
|
286
|
+
justifyContent: "space-between",
|
|
287
|
+
padding: "4px 8px",
|
|
288
|
+
borderRadius: 4,
|
|
289
|
+
border: "1px solid #27272a"
|
|
290
|
+
},
|
|
291
|
+
children: [
|
|
292
|
+
/* @__PURE__ */ jsx("span", {
|
|
293
|
+
children: sfx.file
|
|
294
|
+
}),
|
|
295
|
+
/* @__PURE__ */ jsxs("span", {
|
|
296
|
+
style: { opacity: 0.7, fontSize: 10 },
|
|
297
|
+
children: [
|
|
298
|
+
sfx.group,
|
|
299
|
+
sfx.loop ? " (loop)" : ""
|
|
300
|
+
]
|
|
301
|
+
})
|
|
302
|
+
]
|
|
303
|
+
}, sfx.id))
|
|
304
|
+
})
|
|
305
|
+
]
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
export {
|
|
309
|
+
MitAssetsHostPanel as default
|
|
310
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getMitItemSpec2
|
|
3
|
+
} from "./chunk-2qgndrap.js";
|
|
4
|
+
import {
|
|
5
|
+
buildMitItemCad2
|
|
6
|
+
} from "./chunk-xhkwv6t4.js";
|
|
7
|
+
|
|
8
|
+
// src/nodes/mit-item.ts
|
|
9
|
+
import {
|
|
10
|
+
BaseNode,
|
|
11
|
+
nodeType,
|
|
12
|
+
objectId
|
|
13
|
+
} from "@pascal-app/core";
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
var MitAssetsItemNode2 = BaseNode.extend({
|
|
16
|
+
id: objectId("mititm"),
|
|
17
|
+
type: nodeType("mit-assets:item"),
|
|
18
|
+
slug: z.string().min(1).default("sofa"),
|
|
19
|
+
category: z.enum(["furniture", "appliance", "bathroom", "kitchen", "outdoor", "architectural"]).default("furniture"),
|
|
20
|
+
position: z.tuple([z.number().finite(), z.number().finite(), z.number().finite()]).default([0, 0, 0]),
|
|
21
|
+
rotation: z.number().finite().default(0),
|
|
22
|
+
widthM: z.number().finite().min(0.04).max(20).default(2.06),
|
|
23
|
+
heightM: z.number().finite().min(0.01).max(20).default(0.74),
|
|
24
|
+
depthM: z.number().finite().min(0.02).max(20).default(1.01),
|
|
25
|
+
accentColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).default("#5c7285"),
|
|
26
|
+
quantity: z.number().int().min(1).max(500).default(1),
|
|
27
|
+
unitPriceOverrideUsd: z.number().finite().min(0).optional(),
|
|
28
|
+
license: z.literal("MIT").default("MIT")
|
|
29
|
+
});
|
|
30
|
+
function getMitAssetsItemPorts2(node) {
|
|
31
|
+
const [x, y, zPos] = node.position;
|
|
32
|
+
return [{ id: "base-center", position: [x, y, zPos], direction: [0, 1, 0], diameter: 0.05 }];
|
|
33
|
+
}
|
|
34
|
+
function hexStringToInt(hex) {
|
|
35
|
+
const cleaned = hex.replace(/^#/, "");
|
|
36
|
+
const parsed = Number.parseInt(cleaned, 16);
|
|
37
|
+
return Number.isFinite(parsed) ? parsed : 6058629;
|
|
38
|
+
}
|
|
39
|
+
function buildMitAssetsItemGeometry2(node, _ctx) {
|
|
40
|
+
const spec = getMitItemSpec2(node.slug);
|
|
41
|
+
const slug = spec?.slug ?? "sofa";
|
|
42
|
+
return buildMitItemCad2(slug, {
|
|
43
|
+
widthM: node.widthM,
|
|
44
|
+
heightM: node.heightM,
|
|
45
|
+
depthM: node.depthM,
|
|
46
|
+
accentHex: hexStringToInt(node.accentColor)
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function buildMitAssetsItemFloorplan2(node, _ctx) {
|
|
50
|
+
const cx = node.position[0];
|
|
51
|
+
const cz = node.position[2];
|
|
52
|
+
const cos = Math.cos(node.rotation);
|
|
53
|
+
const sin = Math.sin(node.rotation);
|
|
54
|
+
const hw = node.widthM / 2;
|
|
55
|
+
const hd = node.depthM / 2;
|
|
56
|
+
const stroke = "#16a34a";
|
|
57
|
+
const localCorners = [
|
|
58
|
+
[-hw, -hd],
|
|
59
|
+
[hw, -hd],
|
|
60
|
+
[hw, hd],
|
|
61
|
+
[-hw, hd]
|
|
62
|
+
];
|
|
63
|
+
const corners = localCorners.map(([lx, lz]) => [
|
|
64
|
+
cx + lx * cos + lz * sin,
|
|
65
|
+
cz - lx * sin + lz * cos
|
|
66
|
+
]);
|
|
67
|
+
return {
|
|
68
|
+
kind: "group",
|
|
69
|
+
children: [{ kind: "polygon", points: corners, stroke, strokeWidth: 0.025, fill: "#16a34a22" }]
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
var mitAssetsItemParametrics = {
|
|
73
|
+
groups: [
|
|
74
|
+
{
|
|
75
|
+
label: "Dimensions",
|
|
76
|
+
fields: [
|
|
77
|
+
{ key: "widthM", kind: "number", label: "Width", unit: "m", min: 0.04, max: 20, step: 0.05 },
|
|
78
|
+
{ key: "heightM", kind: "number", label: "Height", unit: "m", min: 0.01, max: 20, step: 0.05 },
|
|
79
|
+
{ key: "depthM", kind: "number", label: "Depth", unit: "m", min: 0.02, max: 20, step: 0.05 }
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
label: "Appearance & BOM",
|
|
84
|
+
fields: [
|
|
85
|
+
{ key: "accentColor", kind: "color", label: "Accent Finish" },
|
|
86
|
+
{ key: "quantity", kind: "number", label: "Quantity", min: 1, max: 500, step: 1 }
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
label: "Position",
|
|
91
|
+
fields: [{ key: "position", kind: "vec3", label: "Position" }]
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
};
|
|
95
|
+
var mitAssetsItemRenderDefinition2 = {
|
|
96
|
+
kind: "mit-assets:item",
|
|
97
|
+
schemaVersion: 1,
|
|
98
|
+
schema: MitAssetsItemNode2,
|
|
99
|
+
category: "furnish",
|
|
100
|
+
defaults: () => ({
|
|
101
|
+
object: "node",
|
|
102
|
+
parentId: null,
|
|
103
|
+
visible: true,
|
|
104
|
+
metadata: {},
|
|
105
|
+
name: "Sofa",
|
|
106
|
+
slug: "sofa",
|
|
107
|
+
category: "furniture",
|
|
108
|
+
position: [0, 0, 0],
|
|
109
|
+
rotation: 0,
|
|
110
|
+
widthM: 2.06,
|
|
111
|
+
heightM: 0.74,
|
|
112
|
+
depthM: 1.01,
|
|
113
|
+
accentColor: "#5c7285",
|
|
114
|
+
quantity: 1,
|
|
115
|
+
license: "MIT"
|
|
116
|
+
}),
|
|
117
|
+
capabilities: {
|
|
118
|
+
selectable: { hitVolume: "bbox" },
|
|
119
|
+
movable: { axes: ["x", "y", "z"], gridSnap: true },
|
|
120
|
+
rotatable: { axes: ["y"], snapAngles: [Math.PI / 4] },
|
|
121
|
+
duplicable: true,
|
|
122
|
+
deletable: true,
|
|
123
|
+
snappable: {}
|
|
124
|
+
},
|
|
125
|
+
geometry: buildMitAssetsItemGeometry2,
|
|
126
|
+
geometryKey: (n) => JSON.stringify([n.slug, n.widthM, n.heightM, n.depthM, n.accentColor]),
|
|
127
|
+
floorplan: buildMitAssetsItemFloorplan2,
|
|
128
|
+
parametrics: mitAssetsItemParametrics,
|
|
129
|
+
presentation: {
|
|
130
|
+
label: "Clean-Room MIT 3D Item",
|
|
131
|
+
description: "100% clean-room MIT procedural 3D item replacing bundled Pascal Editor items/ & CATALOG_ITEMS with real-world SKU pricing.",
|
|
132
|
+
icon: { kind: "iconify", name: "lucide:shield-check" },
|
|
133
|
+
paletteSection: "furnish"
|
|
134
|
+
},
|
|
135
|
+
mcp: {
|
|
136
|
+
description: "Clean-room MIT procedural 3D item supporting all 155 Pascal Editor item slugs with real-world SKU & BOM pricing."
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// src/render.ts
|
|
141
|
+
var MIT_ASSETS_PLUGIN_ID2 = "krusch:mit-assets";
|
|
142
|
+
var MIT_ASSETS_SCHEDULE_VIEW_ID2 = "krusch:mit-assets:audit";
|
|
143
|
+
var mitAssetsRenderPlugin2 = {
|
|
144
|
+
id: MIT_ASSETS_PLUGIN_ID2,
|
|
145
|
+
apiVersion: 1,
|
|
146
|
+
nodes: [mitAssetsItemRenderDefinition2]
|
|
147
|
+
};
|
|
148
|
+
var render_default = mitAssetsRenderPlugin2;
|
|
149
|
+
|
|
150
|
+
export { MitAssetsItemNode2, getMitAssetsItemPorts2, buildMitAssetsItemGeometry2, buildMitAssetsItemFloorplan2, mitAssetsItemRenderDefinition2, MIT_ASSETS_PLUGIN_ID2, MIT_ASSETS_SCHEDULE_VIEW_ID2, mitAssetsRenderPlugin2, render_default };
|