three-slicer-viewer 0.4.0 → 0.4.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.
@@ -1,72 +1,134 @@
1
- import { r as u, p } from "./parse_3mf-CpbA-6Iq.js";
1
+ import { c as M, s as w, r as k, i as I, a as g, p as P, b as S } from "./parse_3mf-BCD9FIz5.js";
2
2
  function b(r) {
3
3
  if (!r) return [];
4
- const t = [r.tris.buffer, ...r.modifiers.map((s) => s.tris.buffer)];
5
- return r.baked && t.push(r.baked.localPos.buffer, r.baked.normals.buffer), t;
4
+ const t = [r.tris.buffer, ...r.modifiers.map((a) => a.tris.buffer)];
5
+ return r.baked && t.push(r.baked.localPos.buffer), t;
6
6
  }
7
- const g = 8;
8
- let i = null, h = 0;
9
- const c = /* @__PURE__ */ new Map();
10
- function w() {
11
- if (i) return i;
12
- i = [];
13
- const r = Math.min(g, Math.max(1, (self.navigator?.hardwareConcurrency || 2) - 1));
7
+ const j = 8;
8
+ let c = null, x = 0;
9
+ const u = /* @__PURE__ */ new Map();
10
+ function h() {
11
+ if (c) return c;
12
+ c = [];
13
+ const r = Math.min(j, Math.max(1, (self.navigator?.hardwareConcurrency || 2) - 1));
14
14
  try {
15
15
  for (let t = 0; t < r; t++) {
16
- const s = new Worker(self.location.href, { type: "module" }), n = { worker: s, failed: !1 };
17
- s.onmessage = (o) => {
18
- const { id: e, result: f, error: a } = o.data || {}, l = c.get(e);
19
- l && (c.delete(e), a ? l.reject(new Error(a)) : l.resolve(f));
20
- }, s.onerror = () => {
16
+ const a = new Worker(self.location.href, { type: "module" }), n = { worker: a, failed: !1 };
17
+ a.onmessage = (i) => {
18
+ const { id: e, result: s, error: o, batch: f } = i.data || {}, l = u.get(e);
19
+ if (l) {
20
+ if (f) {
21
+ l.onBatch(f);
22
+ return;
23
+ }
24
+ u.delete(e), o ? l.reject(new Error(o)) : l.resolve(s);
25
+ }
26
+ }, a.onerror = () => {
21
27
  n.failed = !0;
22
- for (const [o, e] of c) e.helper === n && (c.delete(o), e.reject(new Error("3MF helper failed")));
23
- }, i.push(n);
28
+ for (const [i, e] of u) e.helper === n && (u.delete(i), e.reject(new Error("3MF helper failed")));
29
+ }, c.push(n);
24
30
  }
25
31
  } catch {
26
- for (const t of i) t.worker.terminate();
27
- i = [];
32
+ for (const t of c) t.worker.terminate();
33
+ c = [];
28
34
  }
29
- return i;
35
+ return c;
30
36
  }
31
- function M(r, t) {
32
- const s = ++h;
33
- return new Promise((n, o) => {
34
- c.set(s, { resolve: n, reject: o, helper: r }), r.worker.postMessage({ type: "item-job", id: s, job: t }, t.members.map((e) => e.data.buffer));
37
+ function B(r, t) {
38
+ return m(r, { type: "item-job", job: t }, t.members.map((a) => a.data.buffer));
39
+ }
40
+ function m(r, t, a, n = null) {
41
+ const i = ++x;
42
+ return new Promise((e, s) => {
43
+ u.set(i, { resolve: e, reject: s, helper: r, onBatch: n }), r.worker.postMessage({ ...t, id: i }, a);
35
44
  });
36
45
  }
37
- async function k(r) {
38
- const t = w().filter((e) => !e.failed);
39
- if (!t.length) return Promise.all(r.map(u));
40
- const s = new Array(r.length);
46
+ let E = 0;
47
+ function J() {
48
+ const r = h().filter((e) => !e.failed);
49
+ if (r.length < 2) return null;
50
+ const t = ++E, [a, ...n] = r, i = (e, s, o) => {
51
+ const f = S(s, o);
52
+ let l = e, d = [];
53
+ return e instanceof Blob || (l = e.slice(), d = [l.buffer]), m(a, { type: "inflate", data: l, entry: { method: s.method, size: s.size } }, d, (y) => f.push(y)).then(() => f.finish());
54
+ };
55
+ return n.length < 1 ? null : {
56
+ inflate: i,
57
+ size: n.length,
58
+ scan: (e, s, o) => m(n[e], { type: "scan", parseId: t, data: s, options: o }, [s.buffer]),
59
+ build: (e, s) => m(n[e], { type: "build", parseId: t, job: s }, s.members.map((o) => o.data.buffer)),
60
+ release: () => {
61
+ for (const e of n) e.worker.postMessage({ type: "release", parseId: t });
62
+ }
63
+ };
64
+ }
65
+ async function H(r) {
66
+ const t = h().filter((e) => !e.failed);
67
+ if (!t.length) return Promise.all(r.map(g));
68
+ const a = new Array(r.length);
41
69
  let n = 0;
42
- const o = async (e) => {
70
+ const i = async (e) => {
43
71
  for (; n < r.length; ) {
44
- const f = n++, a = r[f], l = a.members.map((m) => m.data.slice());
72
+ const s = n++, o = r[s], f = o.members.map((l) => l.data.slice());
45
73
  try {
46
- s[f] = await M(e, a);
74
+ a[s] = await B(e, o);
47
75
  } catch {
48
- s[f] = await u({ ...a, members: a.members.map((m, d) => ({ ...m, data: l[d] })) });
76
+ a[s] = await g({ ...o, members: o.members.map((l, d) => ({ ...l, data: f[d] })) });
49
77
  }
50
78
  }
51
79
  };
52
- return await Promise.all(t.slice(0, r.length).map(o)), s;
80
+ return await Promise.all(t.slice(0, r.length).map(i)), a;
53
81
  }
82
+ const p = /* @__PURE__ */ new Map();
54
83
  self.onmessage = async (r) => {
55
84
  const t = r.data || {};
85
+ if (t.type === "scan") {
86
+ try {
87
+ p.has(t.parseId) || p.set(t.parseId, M()), w(t.data, p.get(t.parseId), t.options), self.postMessage({ id: t.id, result: !0 });
88
+ } catch (e) {
89
+ self.postMessage({ id: t.id, error: e && e.message || String(e) });
90
+ }
91
+ return;
92
+ }
93
+ if (t.type === "build") {
94
+ try {
95
+ const e = await k(t.job, p.get(t.parseId));
96
+ self.postMessage({ id: t.id, result: e }, e.items.flatMap((s) => b(s.built)));
97
+ } catch (e) {
98
+ self.postMessage({ id: t.id, error: e && e.message || String(e) });
99
+ }
100
+ return;
101
+ }
102
+ if (t.type === "release") {
103
+ p.delete(t.parseId);
104
+ return;
105
+ }
106
+ if (t.type === "inflate") {
107
+ try {
108
+ await I(t.data, t.entry, (e) => self.postMessage({ id: t.id, batch: e }, [e.buffer])), self.postMessage({ id: t.id, result: !0 });
109
+ } catch (e) {
110
+ self.postMessage({ id: t.id, error: e && e.message || String(e) });
111
+ }
112
+ return;
113
+ }
56
114
  if (t.type === "item-job") {
57
115
  try {
58
- const e = await u(t.job);
59
- self.postMessage({ id: t.id, result: e }, e.items.flatMap((f) => b(f.built)));
116
+ const e = await g(t.job);
117
+ self.postMessage({ id: t.id, result: e }, e.items.flatMap((s) => b(s.built)));
60
118
  } catch (e) {
61
119
  self.postMessage({ id: t.id, error: e && e.message || String(e) });
62
120
  }
63
121
  return;
64
122
  }
65
- const { id: s, buffer: n, baseName: o } = t;
123
+ if (t.type === "warm") {
124
+ h();
125
+ return;
126
+ }
127
+ const { id: a, source: n, baseName: i } = t;
66
128
  try {
67
- const { objects: e, project: f } = await p(n, o, { runJobs: k, bake: !0 });
68
- self.postMessage({ id: s, objects: e, project: f }, e.flatMap((a) => [a.tris.buffer, a.baked.localPos.buffer, a.baked.normals.buffer]));
129
+ const { objects: e, project: s } = await P(n, i, { runJobs: H, bake: !0, pool: J() });
130
+ self.postMessage({ id: a, objects: e, project: s }, e.flatMap((o) => [o.tris.buffer, o.baked.localPos.buffer]));
69
131
  } catch (e) {
70
- self.postMessage({ id: s, error: e && e.message || String(e) });
132
+ self.postMessage({ id: a, error: e && e.message || String(e) });
71
133
  }
72
134
  };
@@ -1,4 +1,4 @@
1
- import { T as V, h as ht } from "./theme-2oyfMuvf.js";
1
+ import { T as V, h as ht } from "./theme-BwyYoVl6.js";
2
2
  import { R as at } from "./toolpath_encoding-BuYs95qZ.js";
3
3
  const U = new Int8Array(8), q = new Int8Array(8), H = new Int8Array(8);
4
4
  for (let t = 0; t < 8; t++)
@@ -1,4 +1,4 @@
1
- import { m as c } from "./sla_reconstruct-CRZ3TrI1.js";
1
+ import { m as c } from "./sla_reconstruct-MtrOJRWL.js";
2
2
  let e = null, o = { nets: 0, finish: 0 };
3
3
  self.onmessage = (m) => {
4
4
  const s = m.data;
@@ -1,4 +1,4 @@
1
- import { f as q } from "./sla_reconstruct-CRZ3TrI1.js";
1
+ import { f as q } from "./sla_reconstruct-MtrOJRWL.js";
2
2
  import { d as D } from "./sl1_write-B6nWmCUu.js";
3
3
  import { R as H, S as T, r as E } from "./toolpath_encoding-BuYs95qZ.js";
4
4
  let i = 6;
@@ -1,4 +1,4 @@
1
- const t = Object.freeze({
1
+ const o = Object.freeze({
2
2
  accent: "#00ae42",
3
3
  // selection: the object, the selected plate, the scale handles, the box-select band
4
4
  accentHover: "#1f5c34",
@@ -19,17 +19,19 @@ const t = Object.freeze({
19
19
  slaModel: "#d7862a",
20
20
  slaSupport: "#9b78d8",
21
21
  slaPad: "#b0a06a",
22
+ negativePart: "#e23b3b",
23
+ // a negative part: what is cut away where it overlaps
22
24
  inkOnLight: "#10141a",
23
25
  // label text on a light swatch
24
26
  inkOnDark: "#ffffff"
25
27
  });
26
- function i(r) {
28
+ function b(r) {
27
29
  const e = (a) => a <= 0.04045 ? a / 12.92 : ((a + 0.055) / 1.055) ** 2.4;
28
30
  return [1, 3, 5].map((a) => e(parseInt(r.slice(a, a + 2), 16) / 255));
29
31
  }
30
- const c = Object.freeze({
32
+ const i = Object.freeze({
31
33
  // the brand green and its family
32
- accent: t.accent,
34
+ accent: o.accent,
33
35
  accentHover: "#06c04d",
34
36
  accentDeep: "#23402c",
35
37
  // the busy pulse on a dark control
@@ -52,7 +54,7 @@ const c = Object.freeze({
52
54
  darkText: "#cdd6dd",
53
55
  darkTextMuted: "#aebcc6",
54
56
  darkTextFaint: "#8b98a2",
55
- darkTextDisabled: t.plateLabel,
57
+ darkTextDisabled: o.plateLabel,
56
58
  // the light sidebar and the settings panel
57
59
  lightBg: "#eef0f2",
58
60
  lightSurface: "#ffffff",
@@ -84,14 +86,15 @@ const c = Object.freeze({
84
86
  warnOnDark: "#f0c060",
85
87
  warnDeep: "#3a2a10",
86
88
  warnDeepBorder: "#7a5a1e"
87
- }), o = (r) => r.replace(/[A-Z]/g, (e) => "-" + e.toLowerCase()), d = ["accent", "darkBase", "darkSurface", "warnDeep"], f = (r) => [1, 3, 5].map((e) => parseInt(r.slice(e, e + 2), 16)).join(", "), l = (r, e) => `rgba(${f(r)}, ${e})`, b = `:host{${Object.entries(c).map(([r, e]) => {
88
- const a = o(r), n = `--_${a}:var(--vp-${a},${e});`;
89
- return d.includes(r) ? n + `--_${a}-rgb:var(--vp-${a}-rgb,${f(e)});` : n;
89
+ }), c = (r) => r.replace(/[A-Z]/g, (e) => "-" + e.toLowerCase()), f = ["accent", "darkBase", "darkSurface", "warnDeep"], d = (r) => [1, 3, 5].map((e) => parseInt(r.slice(e, e + 2), 16)).join(", "), l = (r, e) => `rgba(${d(r)}, ${e})`, t = ":is(.sidebar,.settings-panel) :where(select,textarea,input:not([type=checkbox],[type=color],[type=range],[type=radio]))", s = `${t}{box-sizing:border-box;height:26px;padding:0 6px;font:inherit;font-size:12.5px;color:var(--_light-text);background:var(--_light-surface);border:1px solid var(--_light-border);border-radius:5px;}${t}:focus-visible{outline:2px solid var(--_accent);outline-offset:-1px;}${t}:disabled{background:var(--_light-subtle);color:var(--_light-text-faint);}:is(.sidebar,.settings-panel) textarea{height:auto;padding:4px 6px;}:is(.sidebar,.settings-panel) input[type=checkbox]{width:15px;height:15px;margin:0;accent-color:var(--_accent);}:is(.sidebar,.settings-panel) input[type=color]{box-sizing:border-box;width:26px;height:26px;padding:1px;border:1px solid var(--_light-border);border-radius:5px;background:none;cursor:pointer;}
90
+ `, g = `:host{${Object.entries(i).map(([r, e]) => {
91
+ const a = c(r), n = `--_${a}:var(--vp-${a},${e});`;
92
+ return f.includes(r) ? n + `--_${a}-rgb:var(--vp-${a}-rgb,${d(e)});` : n;
90
93
  }).join("")}}
91
- `;
94
+ ${s}`;
92
95
  export {
93
- t as T,
94
- b as a,
95
- i as h,
96
+ o as T,
97
+ g as a,
98
+ b as h,
96
99
  l as w
97
100
  };
package/dist/toolpath.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as R, b as Bt, p as lt, h as _t, T as wt, r as kt, D as Ot } from "./toolpath_palette-B8xEl-qa.js";
2
2
  import { b as Vt, a as jt } from "./viewer_defaults-B7UUZ582.js";
3
3
  import { r as At, S as ct, R as ot, t as Tt } from "./toolpath_encoding-BuYs95qZ.js";
4
- import { T as Ut } from "./theme-2oyfMuvf.js";
4
+ import { T as Ut } from "./theme-BwyYoVl6.js";
5
5
  const ft = {};
6
6
  for (const t of Object.keys(R)) ft[t] = lt(R[t]);
7
7
  function Wt(t) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-slicer-viewer",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "The three-slicer viewer without the slicer — model loading, G-code parsing, GPU toolpath rendering and the settings transforms, under MIT. Plug a slicer in through the `slicer` prop.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22,6 +22,10 @@
22
22
  "types": "./types/loaders.d.ts",
23
23
  "default": "./dist/model_loaders.js"
24
24
  },
25
+ "./workers": {
26
+ "types": "./types/workers.d.ts",
27
+ "default": "./dist/make_worker.js"
28
+ },
25
29
  "./settings": {
26
30
  "types": "./types/settings.d.ts",
27
31
  "default": "./src/settings/index.js"
@@ -573,7 +573,11 @@ export function deriveKernelParams(settings, opts) {
573
573
  })
574
574
  }
575
575
 
576
+ const bands = settings?.variable_layer_heights
577
+ const layerBands = {}
578
+ if (Array.isArray(bands) && bands.length) layerBands.variable_layer_heights = bands
576
579
  return {
580
+ ...layerBands,
577
581
  ...widths,
578
582
  ...machine,
579
583
  ...passthrough, // present only for keys the settings map actually holds (see PASSTHROUGH_* above)
@@ -13,11 +13,20 @@ export function makeToggle(toggles = {}, schema = leanSchema) {
13
13
  // Settings value accessor (settings map first, schema default otherwise). Percentages ("15%") become numbers.
14
14
  function makeCfg(settings) {
15
15
  const val = k => {
16
- let v = settings ? settings[k] : undefined
17
- if (v === undefined || v === '') { const d = schema[k]?.default; v = Array.isArray(d) ? d[0] : d }
16
+ let v
17
+ if (settings) v = settings[k]
18
+ if (v === undefined || v === '') {
19
+ const d = schema[k]?.default
20
+ v = d
21
+ if (Array.isArray(d)) v = d[0]
22
+ }
18
23
  return v
19
24
  }
20
- const num = k => { const v = val(k); const n = parseFloat(v); return Number.isFinite(n) ? n : 0 }
25
+ const num = k => {
26
+ const n = parseFloat(val(k))
27
+ if (!Number.isFinite(n)) return 0
28
+ return n
29
+ }
21
30
  return {
22
31
  bool: k => { const v = val(k); return v === true || v === 1 || v === '1' || v === 'true' },
23
32
  int: k => Math.trunc(num(k)),
@@ -69,19 +78,116 @@ return { makeCfg, disabledKeys, evalEnableIf }
69
78
 
70
79
  // Evaluates enable_if (up to the first comma) to a boolean. Returns null (= stays enabled) when not fully translatable.
71
80
  export function evalEnableIf(expr, locals, cfg) {
81
+ const substituted = substituteEnableIf(expr, locals, cfg)
82
+ if (substituted === null) return null
83
+ return evaluateBooleanExpression(substituted)
84
+ }
85
+
86
+ // enable_if with every config read and local replaced by its value, or null when something is left that is not a
87
+ // boolean expression of values.
88
+ export function substituteEnableIf(expr, locals, cfg) {
72
89
  let s = String(expr).split(',')[0].trim()
73
90
  if (!s) return null
74
91
  // Direct config access pattern -> value substitution
75
- s = s.replace(/config->opt_bool\(\s*"([^"]+)"\s*\)/g, (_, k) => cfg.bool(k) ? 'true' : 'false')
92
+ s = s.replace(/config->opt_bool\(\s*"([^"]+)"\s*\)/g, (_, k) => String(cfg.bool(k)))
76
93
  s = s.replace(/config->opt_int\(\s*"([^"]+)"\s*\)/g, (_, k) => String(cfg.int(k)))
77
94
  s = s.replace(/config->opt_float\(\s*"([^"]+)"\s*\)/g, (_, k) => String(cfg.float(k)))
78
95
  // Substitute known locals (longest name first — prevents partial matches)
79
96
  for (const name of Object.keys(locals).sort((a, b) => b.length - a.length))
80
- s = s.replace(new RegExp('\\b' + name + '\\b', 'g'), locals[name] ? 'true' : 'false')
97
+ s = s.replace(new RegExp('\\b' + name + '\\b', 'g'), String(!!locals[name]))
81
98
  // Check the remaining string is a safe boolean expression (only true/false/numbers/operators/parens) — otherwise unknown -> null
82
99
  const stripped = s.replace(/\btrue\b|\bfalse\b/g, '1')
83
100
  if (!/^[\s()!<>=&|0-9.]*$/.test(stripped)) return null
84
- try { return !!Function('"use strict";return (' + s + ')')() } catch { return null }
101
+ return s
102
+ }
103
+
104
+ // After substitution an enable_if is a C++ boolean expression over true/false and numbers, which the check above
105
+ // narrows to ! && || == != < > <= >= and parentheses. It is parsed here rather than handed to Function(): a page whose
106
+ // CSP has no 'unsafe-eval' refuses Function, and the browser extension's does, so every option stayed enabled there
107
+ // (measured: 3 fields disabled on the site, 0 in the extension, 564 CSP violations). The operators keep JavaScript's
108
+ // semantics, loose == included, so the result is the one Function gave (test_toggle_parity.mjs, every upstream rule).
109
+ // Anything else the check lets through (a lone = & |, a malformed number) is not translatable: null, as before.
110
+ const EXPRESSION_TOKEN = /\s*(\d+\.?\d*|\.\d+|true|false|&&|\|\||==|!=|<=|>=|[()!<>])/y
111
+ const COMPARE = {
112
+ '==': (left, right) => left == right, // eslint-disable-line eqeqeq
113
+ '!=': (left, right) => left != right, // eslint-disable-line eqeqeq
114
+ '<': (left, right) => left < right,
115
+ '>': (left, right) => left > right,
116
+ '<=': (left, right) => left <= right,
117
+ '>=': (left, right) => left >= right,
118
+ }
119
+ const EQUALITY = ['==', '!=']
120
+ const RELATIONAL = ['<', '>', '<=', '>=']
121
+
122
+ function tokenize(source) {
123
+ const tokens = []
124
+ EXPRESSION_TOKEN.lastIndex = 0
125
+ while (EXPRESSION_TOKEN.lastIndex < source.length) {
126
+ if (!source.slice(EXPRESSION_TOKEN.lastIndex).trim()) break
127
+ const match = EXPRESSION_TOKEN.exec(source)
128
+ if (!match) return null
129
+ tokens.push(match[1])
130
+ }
131
+ return tokens
132
+ }
133
+
134
+ // Recursive descent in C++ precedence: || < && < == != < relational < unary !.
135
+ export function evaluateBooleanExpression(source) {
136
+ const tokens = tokenize(source)
137
+ if (!tokens?.length) return null
138
+ let position = 0
139
+ const peek = () => tokens[position]
140
+ const take = () => tokens[position++]
141
+ function primary() {
142
+ const token = take()
143
+ if (token === '(') {
144
+ const value = either()
145
+ if (take() !== ')') throw new SyntaxError('unclosed (')
146
+ return value
147
+ }
148
+ if (token === '!') return !primary()
149
+ if (token === 'true') return true
150
+ if (token === 'false') return false
151
+ if (token !== undefined && /^[\d.]/.test(token)) return Number(token)
152
+ throw new SyntaxError(`unexpected ${token}`)
153
+ }
154
+ function binary(operand, operators) {
155
+ return () => {
156
+ let left = operand()
157
+ while (operators.includes(peek())) {
158
+ const operator = take()
159
+ left = COMPARE[operator](left, operand())
160
+ }
161
+ return left
162
+ }
163
+ }
164
+ const relational = binary(primary, RELATIONAL)
165
+ const equality = binary(relational, EQUALITY)
166
+ function both() {
167
+ let left = equality()
168
+ while (peek() === '&&') {
169
+ take()
170
+ const right = equality()
171
+ left = left && right
172
+ }
173
+ return left
174
+ }
175
+ function either() {
176
+ let left = both()
177
+ while (peek() === '||') {
178
+ take()
179
+ const right = both()
180
+ left = left || right
181
+ }
182
+ return left
183
+ }
184
+ try {
185
+ const value = either()
186
+ if (position !== tokens.length) return null
187
+ return !!value
188
+ } catch {
189
+ return null
190
+ }
85
191
  }
86
192
 
87
193
  // The unbound default: nothing disables. `three-slicer/toggle` is the bound one.
@@ -3,6 +3,15 @@
3
3
  /** The 5 built-ins plus any extension registered via `registerLoader()`, which pushes onto this array. */
4
4
  export const SUPPORTED_EXT: string[]
5
5
 
6
+ /** G-code extensions: print jobs, opened as a preview instead of a mesh. */
7
+ export const GCODE_EXTS: string[]
8
+
9
+ /** The resin archive extension (`sl1`). */
10
+ export const SL1_EXT: string
11
+
12
+ /** Every extension the viewport opens: `SUPPORTED_EXT`, `SL1_EXT` and `GCODE_EXTS`, read at call time. */
13
+ export function openableExtensions(): string[]
14
+
6
15
  /** Lowercased extension. Empty string when there is no dot. */
7
16
  export function fileExt(name: string): string
8
17
 
@@ -13,7 +22,20 @@ export interface LoadedObject {
13
22
  }
14
23
 
15
24
  /** A single file may contain several objects (3mf/amf/step) -> always an array. */
16
- export function loadModel(name: string, buffer: ArrayBuffer): Promise<LoadedObject[]>
25
+ /** Parses one model file. `source` may be the File (or Blob) itself; a 3mf is then read by its worker, not this thread. */
26
+ export function loadModel(name: string, source: ArrayBuffer | Blob): Promise<LoadedObject[]>
27
+
28
+ /** Starts the workers that will read a file of this name (a 3mf's parse worker and helpers) before it arrives. */
29
+ export function warmLoaderFor(name: string): void
30
+
31
+ /**
32
+ * Uses `worker` (from three-slicer-viewer/workers makeParse3mfWorker) as the 3mf parse worker, so a host can start it
33
+ * before this module has loaded. Ignored, and the worker terminated, when one is already in use.
34
+ */
35
+ export function adoptParseWorker(worker: Worker): void
36
+
37
+ /** Starts parsing `source` now; the viewport's own load of that same File then takes the result instead of parsing. */
38
+ export function preloadModel(name: string, source: ArrayBuffer | Blob): void
17
39
 
18
40
  /**
19
41
  * Registers an extra format. Formats needing heavy dependencies (STEP=OCCT WASM, etc.) are not bundled here,