three-slicer 0.1.6 → 0.1.7
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/README.md +253 -21
- package/data/filaments.js +1 -1
- package/data/preset-keys.json +1 -0
- package/data/processes.js +1 -1
- package/engine/README.md +259 -3
- package/engine/index.d.ts +74 -5
- package/engine/index.js +9 -4
- package/engine/src/client.js +136 -0
- package/engine/src/data.js +3 -0
- package/engine/src/preset_file.js +99 -0
- package/engine/src/settings.js +75 -0
- package/engine/src/slicer.worker.js +13 -3
- package/package.json +20 -10
- package/types/client.d.ts +74 -0
- package/types/components.d.ts +10 -0
- package/types/data/preset-keys.json.d.ts +20 -0
- package/types/data/printers.json.d.ts +2 -2
- package/types/data.d.ts +4 -0
- package/types/settings.d.ts +82 -1
- package/types/viewer.d.ts +57 -1
- package/types/worker.d.ts +87 -0
- package/viewer/README.md +156 -2
- package/viewer/dist/Viewport.js +2937 -2757
- package/viewer/styles.css +5 -0
- package/types/gen_settings_types.mjs +0 -70
package/viewer/styles.css
CHANGED
|
@@ -329,3 +329,8 @@
|
|
|
329
329
|
border-radius: 4px; padding: 2px 3px; font-size: 11px; }
|
|
330
330
|
.sc-num input { width: 62px; background: #1a2027; border: 1px solid #2c353d; color: #cdd6dd; border-radius: 4px;
|
|
331
331
|
padding: 2px 5px; font-size: 12px; margin-left: 4px; }
|
|
332
|
+
|
|
333
|
+
/* A panel shown but not editable (panels={{ printerCard: 'readonly' }}). `inert` on the wrapper already blocks
|
|
334
|
+
pointer, keyboard and focus — this only has to make that legible, or the card reads as broken rather than locked. */
|
|
335
|
+
.vp-readonly { opacity: .62; cursor: default; }
|
|
336
|
+
.vp-readonly * { cursor: default !important; }
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// config-schema.json -> types/settings-keys.d.ts (the SlicerSettings interface, 907 keys).
|
|
2
|
-
// Regenerate: node types/gen_settings_types.mjs (do not hand-edit — fix this script instead)
|
|
3
|
-
//
|
|
4
|
-
// ponytail: mapping is driven purely by the schema's coXxx type. min/max and nullable are not reflected in types
|
|
5
|
-
// (they are runtime validation, not type validation, and 907 keys x branded number slows tsc down).
|
|
6
|
-
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs'
|
|
7
|
-
import { dirname, resolve } from 'node:path'
|
|
8
|
-
import { fileURLToPath } from 'node:url'
|
|
9
|
-
|
|
10
|
-
const here = dirname(fileURLToPath(import.meta.url))
|
|
11
|
-
const schema = JSON.parse(readFileSync(resolve(here, '../data/config-schema.json'), 'utf8'))
|
|
12
|
-
|
|
13
|
-
const lit = (v) => "'" + String(v).replace(/\\/g, '\\\\').replace(/'/g, "\\'") + "'"
|
|
14
|
-
// Some coEnum entries have no enum_values (70/64 mismatch) -> fail open to string.
|
|
15
|
-
const enumOf = (o) => (Array.isArray(o.enum_values) && o.enum_values.length)
|
|
16
|
-
? o.enum_values.map(lit).join(' | ')
|
|
17
|
-
: 'string'
|
|
18
|
-
|
|
19
|
-
// Vector types are `T[] | T` — settingScalar() accepts both, and the UI edits only the first element (settings.js:9).
|
|
20
|
-
const vec = (t) => `${/\|/.test(t) ? `(${t})` : t}[] | ${/\|/.test(t) ? `(${t})` : t}`
|
|
21
|
-
|
|
22
|
-
function tsType(o) {
|
|
23
|
-
switch (o.type) {
|
|
24
|
-
case 'coBool': return 'boolean'
|
|
25
|
-
case 'coBools': return vec('boolean')
|
|
26
|
-
case 'coInt': case 'coFloat': case 'coPercent': return 'number'
|
|
27
|
-
case 'coInts': case 'coFloats': case 'coPercents': return vec('number')
|
|
28
|
-
case 'coFloatOrPercent': return 'number | string'
|
|
29
|
-
case 'coFloatsOrPercents': return vec('number | string')
|
|
30
|
-
case 'coString': return 'string'
|
|
31
|
-
case 'coStrings': return vec('string')
|
|
32
|
-
case 'coEnum': return enumOf(o)
|
|
33
|
-
case 'coEnums': return vec(enumOf(o))
|
|
34
|
-
case 'coPoint': return 'Point'
|
|
35
|
-
case 'coPoints': return 'Point[]'
|
|
36
|
-
case 'coPointsGroups': return 'Point[][]'
|
|
37
|
-
default: return 'unknown'
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const esc = (s) => String(s).replace(/\*\//g, '*\\/')
|
|
42
|
-
const ident = (k) => /^[A-Za-z_$][\w$]*$/.test(k) ? k : lit(k).replace(/^'|'$/g, (m) => m === "'" ? "'" : m)
|
|
43
|
-
|
|
44
|
-
const lines = []
|
|
45
|
-
for (const key of Object.keys(schema).sort()) {
|
|
46
|
-
const o = schema[key]
|
|
47
|
-
const doc = [o.label, o.sidetext ? `(${o.sidetext})` : '', o.tooltip].filter(Boolean).join(' — ')
|
|
48
|
-
if (doc) lines.push(` /** ${esc(doc).replace(/\s*\n\s*/g, ' ')} */`)
|
|
49
|
-
const name = /^[A-Za-z_$][\w$]*$/.test(key) ? key : lit(key)
|
|
50
|
-
lines.push(` ${name}?: ${tsType(o)}`)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
writeFileSync(resolve(here, 'settings-keys.d.ts'), `// AUTO-GENERATED by types/gen_settings_types.mjs — DO NOT EDIT.
|
|
54
|
-
// Source: data/config-schema.json (${Object.keys(schema).length} keys)
|
|
55
|
-
|
|
56
|
-
/** [x, y] — coPoint family */
|
|
57
|
-
export type Point = [number, number]
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Slicer settings map. Sparse — it holds only edited keys; missing keys use the config-schema default.
|
|
61
|
-
* If you need arbitrary key extension, widen it with \`SlicerSettings & Record<string, unknown>\`.
|
|
62
|
-
*/
|
|
63
|
-
export interface SlicerSettings {
|
|
64
|
-
${lines.join('\n')}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** Setting keys that exist in config-schema */
|
|
68
|
-
export type SettingKey = keyof SlicerSettings & string
|
|
69
|
-
`)
|
|
70
|
-
console.log(`settings-keys.d.ts written — ${Object.keys(schema).length} keys`)
|