@thatopen/services 0.37.0 → 0.37.2
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/dist/cli.js +15 -0
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/templates/app/src/main.history.ts +5 -5
- package/src/cli/templates/app/src/main.ts +7 -6
- package/src/cli/templates/app/src/webgpu/web-ifc-light.mjs +35 -0
- package/src/cli/templates/app/vite.config.js +18 -0
package/package.json
CHANGED
|
@@ -113,20 +113,20 @@ async function main() {
|
|
|
113
113
|
tree: () => BUI.html`<top-model-tree></top-model-tree>`,
|
|
114
114
|
properties: () => BUI.html`<top-properties-panel></top-properties-panel>`,
|
|
115
115
|
// The project's documents, as every platform app lists them: a click opens one in the viewer.
|
|
116
|
-
files: () => BUI.html`<top-documents-panel reads-project></top-documents-panel>`,
|
|
116
|
+
files: () => BUI.html`<top-documents-panel reads-project opens-drops></top-documents-panel>`,
|
|
117
117
|
dataTable: () => BUI.html`<top-data-table-panel></top-data-table-panel>`,
|
|
118
118
|
settings: () => BUI.html`<top-settings-panel></top-settings-panel>`,
|
|
119
119
|
history: () => BUI.html`<top-git-history></top-git-history>`,
|
|
120
120
|
};
|
|
121
121
|
app.layouts = {
|
|
122
|
-
Explorer: {
|
|
123
|
-
icon: "mdi:file-tree",
|
|
124
|
-
template: `"tree viewer" 1fr "properties viewer" 1fr / 22rem 1fr`,
|
|
125
|
-
},
|
|
126
122
|
Assets: {
|
|
127
123
|
icon: "mdi:folder-multiple-outline",
|
|
128
124
|
template: `"files viewer" 1fr "properties viewer" 1fr / 22rem 1fr`,
|
|
129
125
|
},
|
|
126
|
+
Explorer: {
|
|
127
|
+
icon: "mdi:file-tree",
|
|
128
|
+
template: `"tree viewer" 1fr "properties viewer" 1fr / 22rem 1fr`,
|
|
129
|
+
},
|
|
130
130
|
Data: {
|
|
131
131
|
icon: "mdi:table",
|
|
132
132
|
template: `"dataTable viewer" 1fr / 22rem 1fr`,
|
|
@@ -122,21 +122,21 @@ async function main() {
|
|
|
122
122
|
tree: () => BUI.html`<top-model-tree></top-model-tree>`,
|
|
123
123
|
properties: () => BUI.html`<top-properties-panel></top-properties-panel>`,
|
|
124
124
|
// The project's documents, as every platform app lists them: a click opens one in the viewer.
|
|
125
|
-
files: () => BUI.html`<top-documents-panel reads-project></top-documents-panel>`,
|
|
125
|
+
files: () => BUI.html`<top-documents-panel reads-project opens-drops></top-documents-panel>`,
|
|
126
126
|
dataTable: () => BUI.html`<top-data-table-panel></top-data-table-panel>`,
|
|
127
127
|
settings: () => BUI.html`<top-settings-panel></top-settings-panel>`,
|
|
128
128
|
};
|
|
129
129
|
// No `label` → the sidebar renders icon-only activity-bar buttons (matching
|
|
130
130
|
// the pre-A2 look), background only on the active one.
|
|
131
131
|
app.layouts = {
|
|
132
|
-
Explorer: {
|
|
133
|
-
icon: "mdi:file-tree",
|
|
134
|
-
template: `"tree viewer" 1fr "properties viewer" 1fr / 22rem 1fr`,
|
|
135
|
-
},
|
|
136
132
|
Assets: {
|
|
137
133
|
icon: "mdi:folder-multiple-outline",
|
|
138
134
|
template: `"files viewer" 1fr "properties viewer" 1fr / 22rem 1fr`,
|
|
139
135
|
},
|
|
136
|
+
Explorer: {
|
|
137
|
+
icon: "mdi:file-tree",
|
|
138
|
+
template: `"tree viewer" 1fr "properties viewer" 1fr / 22rem 1fr`,
|
|
139
|
+
},
|
|
140
140
|
Data: {
|
|
141
141
|
icon: "mdi:table",
|
|
142
142
|
template: `"dataTable viewer" 1fr / 22rem 1fr`,
|
|
@@ -146,7 +146,8 @@ async function main() {
|
|
|
146
146
|
template: `"settings viewer" 1fr / 22rem 1fr`,
|
|
147
147
|
},
|
|
148
148
|
};
|
|
149
|
-
app.
|
|
149
|
+
// (The project's documents first: where a file dropped on the app goes and opens. Antonio 24-11.)
|
|
150
|
+
app.layout = "Assets";
|
|
150
151
|
app.sidebar = true;
|
|
151
152
|
|
|
152
153
|
// No auto-load: the viewer opens empty. A document clicked in the Assets panel opens in it.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// 🔴 web-ifc WITHOUT ITS IFC READER (Antonio 24-11: IFC files are converted by the platform when uploaded, never in the browser).
|
|
2
|
+
// The engine libraries import web-ifc whole (5.8 MB of the app's bundle) and use, from it, its constants (an IFC class's code,
|
|
3
|
+
// enums such as the log levels) and the reader, which this app never runs. `thatopen serve` and the vite build answer `web-ifc`
|
|
4
|
+
// with the module this writes: every constant of the installed web-ifc with its own value, read from it at build time (so it
|
|
5
|
+
// follows a new web-ifc by itself), and in place of everything else (the reader, the schemas' classes) a stand-in that says why
|
|
6
|
+
// when it is used. Not imported by the app: run at build time only.
|
|
7
|
+
import { createRequire } from "node:module";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
|
|
10
|
+
const isPlain = (value) => value === null || ["number", "string", "boolean"].includes(typeof value);
|
|
11
|
+
|
|
12
|
+
/** The source of the light web-ifc, from the one installed in the app at `cwd`. */
|
|
13
|
+
export function lightWebIfc(cwd) {
|
|
14
|
+
const require = createRequire(join(cwd, "package.json"));
|
|
15
|
+
const real = require("web-ifc");
|
|
16
|
+
const lines = [
|
|
17
|
+
`const unavailable = (what) => { throw new Error(\`\${what}: IFC files are converted by the platform when uploaded, not in this app.\`); };`,
|
|
18
|
+
// (Anything but a constant: made, read into and called freely; it says why only when it is asked to do something.)
|
|
19
|
+
`const standIn = (what) => new Proxy(function () {}, {`,
|
|
20
|
+
` get: (_, key) => (key === "then" || typeof key === "symbol" ? undefined : key === "prototype" ? {} : standIn(\`\${what}.\${key}\`)),`,
|
|
21
|
+
` apply: () => unavailable(what),`,
|
|
22
|
+
` construct: () => new Proxy({}, { get: (_, key) => (key === "then" || typeof key === "symbol" ? undefined : (...args) => unavailable(\`\${what}.\${String(key)}\`)) }),`,
|
|
23
|
+
`});`,
|
|
24
|
+
];
|
|
25
|
+
for (const name of Object.keys(real)) {
|
|
26
|
+
if (name === "default" || !/^[A-Za-z_$][\w$]*$/.test(name)) continue;
|
|
27
|
+
const value = real[name];
|
|
28
|
+
if (isPlain(value)) lines.push(`export const ${name} = ${JSON.stringify(value)};`);
|
|
29
|
+
// (An enum, as the log levels: its values as they are.)
|
|
30
|
+
else if (value && typeof value === "object" && !Array.isArray(value) && Object.values(value).every(isPlain))
|
|
31
|
+
lines.push(`export const ${name} = ${JSON.stringify(value)};`);
|
|
32
|
+
else lines.push(`export const ${name} = standIn(${JSON.stringify(name)});`);
|
|
33
|
+
}
|
|
34
|
+
return lines.join("\n");
|
|
35
|
+
}
|
|
@@ -42,7 +42,25 @@ const webgpuAliases = existsSync('src/webgpu/webgpu-lines.mjs')
|
|
|
42
42
|
]
|
|
43
43
|
: [];
|
|
44
44
|
|
|
45
|
+
// web-ifc without its IFC reader, as `thatopen serve` builds it: the platform converts IFC files on upload, and this app only
|
|
46
|
+
// uses web-ifc's constants (`src/webgpu/web-ifc-light.mjs` writes them from the web-ifc installed).
|
|
47
|
+
const LIGHT_WEB_IFC = '\0web-ifc-light';
|
|
48
|
+
const webIfcLight = existsSync('src/webgpu/web-ifc-light.mjs')
|
|
49
|
+
? [{
|
|
50
|
+
// (The plugin's name kept in a constant: `thatopen serve` takes the first quoted name in this file as the app's.)
|
|
51
|
+
name: LIGHT_WEB_IFC.slice(1),
|
|
52
|
+
enforce: 'pre',
|
|
53
|
+
resolveId: (source) => (source === 'web-ifc' ? LIGHT_WEB_IFC : null),
|
|
54
|
+
async load(id) {
|
|
55
|
+
if (id !== LIGHT_WEB_IFC) return null;
|
|
56
|
+
const { lightWebIfc } = await import('./src/webgpu/web-ifc-light.mjs');
|
|
57
|
+
return lightWebIfc(process.cwd());
|
|
58
|
+
},
|
|
59
|
+
}]
|
|
60
|
+
: [];
|
|
61
|
+
|
|
45
62
|
export default defineConfig({
|
|
63
|
+
plugins: webIfcLight,
|
|
46
64
|
resolve: {
|
|
47
65
|
alias: [
|
|
48
66
|
...webgpuAliases,
|