three-slicer 0.1.1 → 0.1.3

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 (39) hide show
  1. package/components/dist/SettingsPanel.js +112 -112
  2. package/components/styles.css +9 -9
  3. package/data/config-schema.json +999 -900
  4. package/data/invalidation-map.json +6 -5
  5. package/data/printers.json +1 -0
  6. package/data/processes.js +2 -0
  7. package/data/toggle-rules.json +44 -44
  8. package/data/ui-tree.json +170 -494
  9. package/engine/examples/headless.mjs +2 -2
  10. package/engine/index.js +2 -2
  11. package/engine/src/data.js +13 -7
  12. package/engine/src/settings.js +120 -35
  13. package/engine/src/slicer.worker.js +23 -21
  14. package/engine/src/slicer_core.js +0 -0
  15. package/engine/src/slicer_core.mt.js +0 -0
  16. package/engine/src/toggle_eval.js +11 -11
  17. package/package.json +4 -2
  18. package/types/components.d.ts +5 -5
  19. package/types/data/config-schema.json.d.ts +6 -6
  20. package/types/data/invalidation-map.json.d.ts +5 -5
  21. package/types/data/printers.json.d.ts +23 -0
  22. package/types/data/processes.js.d.ts +21 -0
  23. package/types/data/toggle-rules.json.d.ts +5 -5
  24. package/types/data/ui-tree.json.d.ts +3 -3
  25. package/types/data.d.ts +10 -7
  26. package/types/gen_settings_types.mjs +10 -10
  27. package/types/settings-keys.d.ts +18 -7
  28. package/types/settings.d.ts +6 -6
  29. package/types/toggle.d.ts +6 -6
  30. package/types/viewer-loaders.d.ts +8 -8
  31. package/types/viewer-toolpath.d.ts +17 -17
  32. package/types/viewer.d.ts +3 -3
  33. package/types/wasm.d.ts +3 -3
  34. package/types/worker.d.ts +2 -2
  35. package/viewer/dist/Viewport.js +1760 -966
  36. package/viewer/dist/make_worker.js +6 -6
  37. package/viewer/dist/model_loaders.js +35 -35
  38. package/viewer/dist/toolpath_gpu.js +146 -147
  39. package/viewer/styles.css +46 -25
@@ -0,0 +1,21 @@
1
+ // processes.js — print (process) presets extracted from OrcaSlicer's resources/profiles/<Vendor>/process/.
2
+ // Emitted as a JS module rather than JSON because it is loaded dynamically: see engine/src/data.js for why.
3
+ // Column layout, same as printers.json — `keys` names the columns once and each row in `sets` is positional.
4
+ // Prefer `processPresets()` from three-slicer/settings over decoding this by hand.
5
+
6
+ /** A positional row aligned to `keys`; `null` where the profile chain never set that option. */
7
+ export type ProcessRow = (unknown | null)[]
8
+
9
+ export interface ProcessData {
10
+ /** Option keys, in column order — the keys the kernel consumes, read out of engine/src/settings.js */
11
+ keys: string[]
12
+ /** Deduplicated value rows */
13
+ sets: ProcessRow[]
14
+ /** `[preset name, index into sets]`, indexed by the numbers in `byPrinter` */
15
+ presets: [string, number][]
16
+ /** Printer profile name -> indices into `presets` */
17
+ byPrinter: Record<string, number[]>
18
+ }
19
+
20
+ declare const processes: ProcessData
21
+ export default processes
@@ -1,16 +1,16 @@
1
- // three-slicer/data/toggle-rules.json — 원본 toggle_options() 의 enable_if 조건식 추출.
2
- // 최상위 키 = 그룹명(예: 'toggle_print_fff_options', 'TabPrinter::toggle_options').
1
+ // three-slicer/data/toggle-rules.json — enable_if expressions extracted from upstream toggle_options().
2
+ // Top-level key = group name (e.g. 'toggle_print_fff_options', 'TabPrinter::toggle_options').
3
3
 
4
4
  export interface ToggleRule {
5
- /** 원본 C++ 조건식 문자열. 평가는 three-slicer/toggle 의 evalEnableIf. */
5
+ /** The raw C++ expression string. Evaluated by evalEnableIf in three-slicer/toggle. */
6
6
  enable_if?: string
7
- /** 이 조건이 지배하는 config-schema 키들 */
7
+ /** The config-schema keys governed by this condition */
8
8
  fields?: string[]
9
9
  line?: number
10
10
  }
11
11
 
12
12
  export interface ToggleGroup {
13
- /** 로컬 변수명 → 원본 C++ 표현식(문자열). 번역은 toggle_eval.js 가 하드코딩으로 한다. */
13
+ /** Local variable name -> the upstream C++ expression (string). Translation is hardcoded in toggle_eval.js. */
14
14
  locals: Record<string, string>
15
15
  rules: ToggleRule[]
16
16
  stats?: { toggle_calls_in_source: number; rules_extracted: number }
@@ -1,10 +1,10 @@
1
- // three-slicer/data/ui-tree.json — 원본 Tab.cpp 의 페이지/그룹 트리.
2
- // 최상위 키 = 빌더명(예: 'TabPrint::build'), 값 = 그 빌더가 만드는 페이지들.
1
+ // three-slicer/data/ui-tree.json — the page/group tree from upstream Tab.cpp.
2
+ // Top-level key = builder name (e.g. 'TabPrint::build'), value = the pages that builder creates.
3
3
 
4
4
  export interface UIGroup {
5
5
  group: string
6
6
  line?: number
7
- /** config-schema 의 옵션 키들 */
7
+ /** The config-schema option keys */
8
8
  options: string[]
9
9
  }
10
10
 
package/types/data.d.ts CHANGED
@@ -1,17 +1,20 @@
1
- // three-slicer/data — 추출 JSON 4종. 원본 JSON 을 직접 import 하는 것보다 이쪽을 권한다:
2
- // import attribute(`with { type: 'json' }`)가 이미 붙어 있어 Node·번들러 양쪽에서 그대로 돌아간다.
1
+ // three-slicer/data — the extracted JSON files. Prefer this over importing the raw JSON:
2
+ // the import attribute (`with { type: 'json' }`) is already applied, so it works in Node and bundlers alike.
3
3
  import type { ConfigOption } from './data/config-schema.json.d.ts'
4
4
  import type { UIPage } from './data/ui-tree.json.d.ts'
5
5
  import type { ToggleGroup } from './data/toggle-rules.json.d.ts'
6
6
  import type { InvalidationRule } from './data/invalidation-map.json.d.ts'
7
+ import type { PrinterData, PrinterRow, PrinterEntry } from './data/printers.json.d.ts'
7
8
 
8
- export type { ConfigOption, UIPage, ToggleGroup, InvalidationRule }
9
+ export type { ConfigOption, UIPage, ToggleGroup, InvalidationRule, PrinterData, PrinterRow, PrinterEntry }
9
10
 
10
- /** 907개 옵션 정의 */
11
+ /** The 907 option definitions */
11
12
  export const schema: Record<string, ConfigOption>
12
- /** 빌더명 → 페이지 트리 */
13
+ /** Builder name -> page tree */
13
14
  export const uiTree: Record<string, UIPage[]>
14
- /** 그룹명 → enable_if 규칙 */
15
+ /** Group name -> enable_if rules */
15
16
  export const toggleRules: Record<string, ToggleGroup>
16
- /** 설정 키 변경 → 무효화 단계 */
17
+ /** Setting key change -> invalidated steps */
17
18
  export const invalidationMap: Record<string, InvalidationRule[]>
19
+ /** Machine limits per printer, from the upstream vendor profiles */
20
+ export const printers: PrinterData
@@ -1,8 +1,8 @@
1
- // config-schema.json → types/settings-keys.d.ts (SlicerSettings 인터페이스, 907키).
2
- // 재생성: node types/gen_settings_types.mjs (수동 편집 금지 — 이 스크립트만 고칠 것)
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
3
  //
4
- // ponytail: 스키마의 coXxx 타입만 보고 매핑한다. min/max·nullable 은 타입에 반영하지 않음
5
- // (런타임 검증이지 타입 검증이 아니고, 907키 × branded number 는 tsc 를 느리게 만든다).
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
6
  import { readFileSync, writeFileSync, mkdirSync } from 'node:fs'
7
7
  import { dirname, resolve } from 'node:path'
8
8
  import { fileURLToPath } from 'node:url'
@@ -11,12 +11,12 @@ const here = dirname(fileURLToPath(import.meta.url))
11
11
  const schema = JSON.parse(readFileSync(resolve(here, '../data/config-schema.json'), 'utf8'))
12
12
 
13
13
  const lit = (v) => "'" + String(v).replace(/\\/g, '\\\\').replace(/'/g, "\\'") + "'"
14
- // enum_values 가 없는 coEnum 도 있다(70/64 불일치) → string 으로 fail-open.
14
+ // Some coEnum entries have no enum_values (70/64 mismatch) -> fail open to string.
15
15
  const enumOf = (o) => (Array.isArray(o.enum_values) && o.enum_values.length)
16
16
  ? o.enum_values.map(lit).join(' | ')
17
17
  : 'string'
18
18
 
19
- // 벡터형은 `T[] | T` — settingScalar() 가 둘 다 받고, UI 는 첫 원소만 편집한다(settings.js:9).
19
+ // Vector types are `T[] | T` — settingScalar() accepts both, and the UI edits only the first element (settings.js:9).
20
20
  const vec = (t) => `${/\|/.test(t) ? `(${t})` : t}[] | ${/\|/.test(t) ? `(${t})` : t}`
21
21
 
22
22
  function tsType(o) {
@@ -53,18 +53,18 @@ for (const key of Object.keys(schema).sort()) {
53
53
  writeFileSync(resolve(here, 'settings-keys.d.ts'), `// AUTO-GENERATED by types/gen_settings_types.mjs — DO NOT EDIT.
54
54
  // Source: data/config-schema.json (${Object.keys(schema).length} keys)
55
55
 
56
- /** [x, y] — coPoint 계열 */
56
+ /** [x, y] — coPoint family */
57
57
  export type Point = [number, number]
58
58
 
59
59
  /**
60
- * 슬라이서 설정 맵. sparse — 편집한 키만 담고, 없는 키는 config-schema 의 default 가 쓰인다.
61
- * 임의 키 확장이 필요하면 \`SlicerSettings & Record<string, unknown>\` 로 넓혀서 쓸 것.
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
62
  */
63
63
  export interface SlicerSettings {
64
64
  ${lines.join('\n')}
65
65
  }
66
66
 
67
- /** config-schema 에 존재하는 설정 키 */
67
+ /** Setting keys that exist in config-schema */
68
68
  export type SettingKey = keyof SlicerSettings & string
69
69
  `)
70
70
  console.log(`settings-keys.d.ts written — ${Object.keys(schema).length} keys`)
@@ -1,12 +1,12 @@
1
1
  // AUTO-GENERATED by types/gen_settings_types.mjs — DO NOT EDIT.
2
- // Source: data/config-schema.json (907 keys)
2
+ // Source: data/config-schema.json (906 keys)
3
3
 
4
- /** [x, y] — coPoint 계열 */
4
+ /** [x, y] — coPoint family */
5
5
  export type Point = [number, number]
6
6
 
7
7
  /**
8
- * 슬라이서 설정 맵. sparse — 편집한 키만 담고, 없는 키는 config-schema 의 default 가 쓰인다.
9
- * 임의 키 확장이 필요하면 `SlicerSettings & Record<string, unknown>` 로 넓혀서 쓸 것.
8
+ * Slicer settings map. Sparse — it holds only edited keys; missing keys use the config-schema default.
9
+ * If you need arbitrary key extension, widen it with `SlicerSettings & Record<string, unknown>`.
10
10
  */
11
11
  export interface SlicerSettings {
12
12
  absolute_correction?: number
@@ -831,6 +831,7 @@ export interface SlicerSettings {
831
831
  machine_hotend_change_time?: number
832
832
  /** Filament load time — (s) — Time to load new filament when switch filament. It's usually applicable for single-extruder multi-material machines. For tool changers or multi-tool machines, it's typically 0. For statistics only. */
833
833
  machine_load_filament_time?: number
834
+ /** (mm/s²) — Maximum acceleration of the E axis */
834
835
  machine_max_acceleration_e?: number[] | number
835
836
  /** (mm/s²) — Maximum acceleration for extruding (M204 P) */
836
837
  machine_max_acceleration_extruding?: number[] | number
@@ -838,22 +839,33 @@ export interface SlicerSettings {
838
839
  machine_max_acceleration_retracting?: number[] | number
839
840
  /** (mm/s²) — Maximum acceleration for travel (M204 T), it only applies to Marlin 2. */
840
841
  machine_max_acceleration_travel?: number[] | number
842
+ /** (mm/s²) — Maximum acceleration of the X axis */
841
843
  machine_max_acceleration_x?: number[] | number
844
+ /** (mm/s²) — Maximum acceleration of the Y axis */
842
845
  machine_max_acceleration_y?: number[] | number
846
+ /** (mm/s²) — Maximum acceleration of the Z axis */
843
847
  machine_max_acceleration_z?: number[] | number
844
848
  /** (N) — The allowed maximum output force of Y axis */
845
849
  machine_max_force_Y?: number
850
+ /** (mm/s) — Maximum jerk of the E axis */
846
851
  machine_max_jerk_e?: number[] | number
852
+ /** (mm/s) — Maximum jerk of the X axis */
847
853
  machine_max_jerk_x?: number[] | number
854
+ /** (mm/s) — Maximum jerk of the Y axis */
848
855
  machine_max_jerk_y?: number[] | number
856
+ /** (mm/s) — Maximum jerk of the Z axis */
849
857
  machine_max_jerk_z?: number[] | number
850
858
  /** (mm) — Maximum junction deviation (M205 J, only apply if JD > 0 for Marlin Firmware If your Marlin 2 printer uses Classic Jerk set this value to 0.) */
851
859
  machine_max_junction_deviation?: number[] | number
852
860
  /** (g) — The allowed max printed mass on a plate */
853
861
  machine_max_printed_mass?: number
862
+ /** (mm/s) — Maximum speed of E axis */
854
863
  machine_max_speed_e?: number[] | number
864
+ /** (mm/s) — Maximum speed of X axis */
855
865
  machine_max_speed_x?: number[] | number
866
+ /** (mm/s) — Maximum speed of Y axis */
856
867
  machine_max_speed_y?: number[] | number
868
+ /** (mm/s) — Maximum speed of Z axis */
857
869
  machine_max_speed_z?: number[] | number
858
870
  /** (mm/s) — Minimum speed for extruding (M205 S) */
859
871
  machine_min_extruding_rate?: number[] | number
@@ -1056,8 +1068,6 @@ export interface SlicerSettings {
1056
1068
  physical_printer_preset?: string
1057
1069
  /** Send progress to pipe — Send progress to pipe. */
1058
1070
  pipe?: string
1059
- /** Capabilities — Configuration for the plugin capabilities this preset uses, overriding the global Capabilities configuration. Stored as a raw JSON array and edited through the dialog behind the button, never typed in directly. */
1060
- plugin_config_overrides?: string
1061
1071
  /** Plugins Used — Plugin capabilities referenced by this preset, stored as name;uuid;capability. */
1062
1072
  plugins?: string[] | string
1063
1073
  /** Position — Position of the extruder at the beginning of the custom G-code block. If the custom G-code travels somewhere else, it should write to this variable so OrcaSlicer knows where it travels from when it gets control back. */
@@ -1074,6 +1084,7 @@ export interface SlicerSettings {
1074
1084
  preheat_steps?: number
1075
1085
  /** Preheat time — (s) — To reduce the waiting time after tool change, Orca can preheat the next tool while the current tool is still in use. This setting specifies the time in seconds to preheat the next tool. Orca will insert a M104 command to preheat the tool in advance. */
1076
1086
  preheat_time?: number
1087
+ /** Capabilities — Configuration for the plugin capabilities this preset uses, overriding the global Capabilities configuration. Stored as a raw JSON array and edited through the dialog behind the button, never typed in directly. */
1077
1088
  preset_name?: string
1078
1089
  /** Printer preset names — Names of presets related to the physical printer. */
1079
1090
  preset_names?: string[] | string
@@ -1700,5 +1711,5 @@ export interface SlicerSettings {
1700
1711
  zhop?: number
1701
1712
  }
1702
1713
 
1703
- /** config-schema 에 존재하는 설정 키 */
1714
+ /** Setting keys that exist in config-schema */
1704
1715
  export type SettingKey = keyof SlicerSettings & string
@@ -2,18 +2,18 @@
2
2
  import type { SlicerSettings, SettingKey, Point } from './settings-keys.d.ts'
3
3
  export type { SlicerSettings, SettingKey, Point }
4
4
 
5
- /** config-schema 의 default 값 (없는 키면 undefined) */
5
+ /** The config-schema default value (undefined for unknown keys) */
6
6
  export function schemaDefault(key: string): unknown
7
7
 
8
- /** settings 맵 우선, 없으면 스키마 default. 벡터형은 벡터 그대로 돌려준다. */
8
+ /** Settings map first, schema default otherwise. Vector types are returned as-is. */
9
9
  export function settingRaw(settings: SlicerSettings | null | undefined, key: string): unknown
10
10
 
11
- /** settingRaw 를 스칼라로 정규화 — 벡터면 [0]. */
11
+ /** Normalizes settingRaw to a scalar — [0] for vectors. */
12
12
  export function settingScalar(settings: SlicerSettings | null | undefined, key: string): unknown
13
13
 
14
14
  /**
15
- * 설정 맵 → 커널 슬라이스 파라미터. 스키마 키에서 유도하며 누락 키는 내부 기본값으로 채운다.
16
- * ponytail: 반환 키가 53개라 개별 나열 대신 Record — 커널 파라미터는 slice() 에 그대로 넘기는 용도지
17
- * 소비자가 필드 단위로 읽는 API 가 아니다. 필드 접근이 필요해지면 그때 펼칠 것.
15
+ * Settings map -> kernel slice params. Derived from schema keys; missing keys are filled with internal defaults.
16
+ * ponytail: 53 returned keys, so Record instead of listing each — kernel params are passed straight to slice(),
17
+ * not an API consumers read field by field. Expand it when field access is actually needed.
18
18
  */
19
19
  export function deriveKernelParams(settings: SlicerSettings | null | undefined): Record<string, unknown>
package/types/toggle.d.ts CHANGED
@@ -1,22 +1,22 @@
1
- // three-slicer/toggle — toggle-rules.json 의 enable_if 조건식 부분 평가.
1
+ // three-slicer/toggle — partial evaluation of the enable_if expressions in toggle-rules.json.
2
2
  import type { SlicerSettings } from './settings-keys.d.ts'
3
3
 
4
- /** 설정 접근기 — 값이 없으면 스키마 default, 벡터형은 [0]. */
4
+ /** Settings accessor — schema default when a value is missing, [0] for vector types. */
5
5
  export interface ToggleCfg {
6
6
  bool(key: string): boolean
7
7
  int(key: string): number
8
8
  float(key: string): number
9
- /** 키가 config-schema 에 존재하는가 */
9
+ /** Whether the key exists in config-schema */
10
10
  has(key: string): boolean
11
11
  }
12
12
 
13
13
  export function makeCfg(settings: SlicerSettings | null | undefined): ToggleCfg
14
14
 
15
15
  /**
16
- * enable_if 조건식 1개 평가. 번역 불가한 식은 `null`(= fail-open, 활성 유지) 을 돌려준다 —
17
- * `false` 와 반드시 구분해서 다룰 것.
16
+ * Evaluates a single enable_if expression. Untranslatable expressions return `null` (= fail-open, stays enabled) —
17
+ * make sure to treat that as distinct from `false`.
18
18
  */
19
19
  export function evalEnableIf(expr: string, locals: Record<string, unknown>, cfg: ToggleCfg): boolean | null
20
20
 
21
- /** 현재 설정에서 비활성이어야 하는 키 → 그렇게 만든 enable_if 조건식. 조건이 명확히 false 인 규칙만. */
21
+ /** Keys that must be disabled under the current settings -> the enable_if expression that disabled them. Only rules that are unambiguously false. */
22
22
  export function disabledKeys(cfg: ToggleCfg): Record<string, string>
@@ -1,23 +1,23 @@
1
- // three-slicer/viewer/loaders — 커널 무관 순수 로더.
1
+ // three-slicer/viewer/loaders — pure loaders, independent of the kernel.
2
2
 
3
- /** 내장 5종 + `registerLoader()` 로 등록된 확장자. 등록 시 이 배열에 push 된다. */
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
- /** 소문자 확장자. 점이 없으면 빈 문자열. */
6
+ /** Lowercased extension. Empty string when there is no dot. */
7
7
  export function fileExt(name: string): string
8
8
 
9
9
  export interface LoadedObject {
10
10
  name: string
11
- /** 삼각형 정점 좌표 (N*9, model z-up) */
11
+ /** Triangle vertex coordinates (N*9, model z-up) */
12
12
  modelPos: Float32Array
13
13
  }
14
14
 
15
- /** 파일 1개에 여러 오브젝트가 들어있을 수 있다(3mf/amf/step) → 항상 배열. */
15
+ /** A single file may contain several objects (3mf/amf/step) -> always an array. */
16
16
  export function loadModel(name: string, buffer: ArrayBuffer): Promise<LoadedObject[]>
17
17
 
18
18
  /**
19
- * 확장 포맷 등록. 무거운 의존성이 필요한 포맷(STEP=OCCT WASM 등)은 패키지에 넣지 않으므로
20
- * 앱에서 직접 붙인다. `<Viewport/>` 의 파일 대화상자·드래그앤드롭 필터에 자동 반영된다.
19
+ * Registers an extra format. Formats needing heavy dependencies (STEP=OCCT WASM, etc.) are not bundled here,
20
+ * so the app wires them up itself. The `<Viewport/>` file dialog and drag-and-drop filters pick them up automatically.
21
21
  *
22
22
  * ```js
23
23
  * import { registerLoader } from 'three-slicer/viewer/loaders'
@@ -29,5 +29,5 @@ export function registerLoader(
29
29
  fn: (buffer: ArrayBuffer, name: string) => LoadedObject[] | Promise<LoadedObject[]>,
30
30
  ): void
31
31
 
32
- /** 연결 성분 분리. 성분이 1개뿐이면 `null`(분리 불가) — 빈 배열이 아니다. */
32
+ /** Connected-component split. Returns `null` when there is only one component (cannot split) — not an empty array. */
33
33
  export function splitConnectedComponents(localPos: Float32Array): Float32Array[] | null
@@ -1,26 +1,26 @@
1
- // three-slicer/viewer/toolpath — 커널 레이어 → GPU 인스턴싱 툴패스.
2
- // three 를 import 하지 않는다: makeToolpath 가 THREE 네임스페이스를 인자로 받는다(단일 인스턴스 보장).
1
+ // three-slicer/viewer/toolpath — kernel layers -> GPU-instanced toolpath.
2
+ // Does not import three: makeToolpath takes the THREE namespace as an argument (guaranteeing a single instance).
3
3
 
4
- /** 8정점 다이아몬드 단면의 24 삼각형 인덱스 (SegmentTemplate.cpp:18 원본) */
4
+ /** The 24 triangle indices of the 8-vertex diamond cross-section (from SegmentTemplate.cpp:18) */
5
5
  export const VERTEX_DATA: number[]
6
6
 
7
- /** 툴패스 타입 → 색. 0=travel, 1=wall … 11=prime */
7
+ /** Toolpath type -> color. 0=travel, 1=wall … 11=prime */
8
8
  export const TYPE_COLOR: Record<number, number[]>
9
9
  export const TYPE_LABEL: Record<number, string>
10
10
 
11
- /** 파랑→빨강 11색 히트맵 (libvgcode ColorRange.hpp:14) */
11
+ /** Blue-to-red 11-color heatmap (libvgcode ColorRange.hpp:14) */
12
12
  export const DEFAULT_RANGES_COLORS: number[][]
13
13
 
14
14
  export interface ViewTypeDef {
15
15
  key: 'feature' | 'speed' | 'height' | 'width' | 'fan' | 'temp'
16
16
  label: string
17
- /** 연속값(히트맵)인가. false 면 고정색. */
17
+ /** Whether values are continuous (heatmap). False means a fixed color. */
18
18
  cont: boolean
19
19
  unit: string
20
20
  }
21
21
  export const VIEW_TYPES: ViewTypeDef[]
22
22
 
23
- /** per-vertex 부가 정보 */
23
+ /** Per-vertex extra data */
24
24
  export interface SegmentMeta {
25
25
  vType: Uint8Array
26
26
  vWidth: Float32Array
@@ -42,16 +42,16 @@ export interface SegmentData {
42
42
  maxAbs: number
43
43
  hasNaN: boolean
44
44
  meta: SegmentMeta
45
- /** 타입별 총 압출 길이 (index = 툴패스 타입, 길이 16) */
45
+ /** Total extruded length per type (index = toolpath type, length 16) */
46
46
  typeLengths: Float64Array
47
- /** 정점이 하나도 없으면 null */
47
+ /** Null when there is not a single vertex */
48
48
  bbox: { min: [number, number, number]; max: [number, number, number] } | null
49
49
  }
50
50
 
51
- /** 커널 layers[{z, paths(stride8), widths[]}] → GPU 스트림. */
51
+ /** Kernel layers[{z, paths(stride8), widths[]}] -> GPU stream. */
52
52
  export function buildSegmentData(layers: unknown[], defaultLineWidth: number): SegmentData
53
53
 
54
- /** 타입별 길이 비율(%), pct 내림차순. 시간은 커널이 role 별로 노출하지 않아 길이로 근사한다. */
54
+ /** Length share per type (%), descending by pct. The kernel does not expose time per role, so length is used as an approximation. */
55
55
  export function roleRatios(typeLengths: Float64Array | number[]): Array<{
56
56
  type: number
57
57
  label: string
@@ -60,7 +60,7 @@ export function roleRatios(typeLengths: Float64Array | number[]): Array<{
60
60
  }>
61
61
 
62
62
  /**
63
- * speed/fan/temp 는 커널 툴패스에 없어 설정값에서 유도한다 — 그 유도에 쓰는 값들.
63
+ * speed/fan/temp are absent from the kernel toolpath and derived from settings — these are the values used for that.
64
64
  */
65
65
  export interface ColorContext {
66
66
  speedByType?: Record<number, number>
@@ -73,26 +73,26 @@ export interface ColorContext {
73
73
  }
74
74
 
75
75
  export interface ColorResult {
76
- /** per-vertex RGBA (nV*4). `.r` 에 색이 packed 돼 있다. */
76
+ /** Per-vertex RGBA (nV*4). The color is packed into `.r`. */
77
77
  color: Float32Array
78
78
  min: number
79
79
  max: number
80
80
  viewType: ViewTypeDef['key']
81
81
  label: string
82
82
  unit: string
83
- /** false 면 고정색 — min/max 는 0 이고 범례를 그리면 안 된다. */
83
+ /** False means fixed colors — min/max are 0 and no legend should be drawn. */
84
84
  cont: boolean
85
85
  }
86
86
 
87
87
  export function computeColors(data: SegmentData, viewType: ViewTypeDef['key'], ctx: ColorContext): ColorResult
88
88
 
89
89
  export interface ToolpathHandle {
90
- /** THREE.Mesh — 인자로 넘긴 THREE 네임스페이스의 타입 */
90
+ /** THREE.Mesh — typed by the THREE namespace passed in */
91
91
  mesh: any
92
92
  /** THREE.LineSegments (travel) */
93
93
  travLines: any
94
94
  setLayerRange(lo: number, hi: number): void
95
- /** 하위호환 — setLayerRange(0, n-1) 과 같다. */
95
+ /** Backwards compatible — same as setLayerRange(0, n-1). */
96
96
  setVisibleLayers(n: number): void
97
97
  setTravelVisible(visible: boolean): void
98
98
  setColors(color: Float32Array): void
@@ -101,5 +101,5 @@ export interface ToolpathHandle {
101
101
  layerCount: number
102
102
  }
103
103
 
104
- /** @param THREE - `import * as THREE from 'three'` 네임스페이스. 소비자 인스턴스를 그대로 쓴다. */
104
+ /** @param THREE - the `import * as THREE from 'three'` namespace. The consumer's instance is used as-is. */
105
105
  export function makeToolpath(THREE: any, data: SegmentData): ToolpathHandle
package/types/viewer.d.ts CHANGED
@@ -3,11 +3,11 @@ import type * as React from 'react'
3
3
  import type { SlicerSettings } from './settings-keys.d.ts'
4
4
 
5
5
  export interface ViewportProps {
6
- /** sparse 설정 맵. 기본 `{}`. */
6
+ /** Sparse settings map. Defaults to `{}`. */
7
7
  settings?: SlicerSettings
8
- /** React setState 형태. 기본 no-op. */
8
+ /** React setState shape. Defaults to a no-op. */
9
9
  setSettings?: React.Dispatch<React.SetStateAction<SlicerSettings>>
10
- /** 좌측 프로세스 패널 슬롯 — 보통 `<SettingsPanel embedded/>`. 기본 null. */
10
+ /** Left process-panel slot — usually `<SettingsPanel embedded/>`. Defaults to null. */
11
11
  processPanel?: React.ReactNode
12
12
  }
13
13
 
package/types/wasm.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- // three-slicer/wasm, three-slicer/wasm-mt — emscripten 글루(생성물, 3.5MB+).
2
- // ponytail: 여기에 정확한 타입을 쓰지 않는다. 글루는 재빌드 때마다 바뀌고, 공개 API 는
3
- // three-slicer 의 createSlicer() 다. 직접 쓰는 쪽은 이미 커널 내부를 아는 쪽.
1
+ // three-slicer/wasm, three-slicer/wasm-mt — emscripten glue (generated, 3.5MB+).
2
+ // ponytail: no precise types here. The glue changes on every rebuild, and the public API is
3
+ // createSlicer() from three-slicer. Anyone using this directly already knows the kernel internals.
4
4
  declare const factory: (opts?: Record<string, unknown>) => Promise<any>
5
5
  export default factory
package/types/worker.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- // three-slicer/worker — 슬라이스 워커 스크립트. import 해서 쓰는 모듈이 아니라
2
- // `new Worker(new URL('three-slicer/worker', import.meta.url), { type: 'module' })` 의 대상.
1
+ // three-slicer/worker — the slice worker script. Not a module you import, but the target of
2
+ // `new Worker(new URL('three-slicer/worker', import.meta.url), { type: 'module' })`.
3
3
  export {}