@buerli.io/core 1.1.0 → 2.0.0-beta.20261016085358

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 (35) hide show
  1. package/build/cjs/geometry/ThreeGeometryCreator.js +17 -7
  2. package/build/cjs/store/index.js +7 -7
  3. package/build/cjs/store/states/geometry.js +17 -7
  4. package/build/cjs/store/states/immutablePatch.js +165 -0
  5. package/build/cjs/store/states/plugin.js +2 -2
  6. package/build/cjs/store/states/structure.js +34 -22
  7. package/build/cjs/store/store.js +2 -5
  8. package/build/cjs/store/subscribtion/selection.js +3 -3
  9. package/build/cjs/store/subscribtion/subscribeToDrawing.js +1 -2
  10. package/build/cjs/utils/Math.js +17 -7
  11. package/build/cjs/utils/Measure.js +18 -9
  12. package/build/esm/store/states/immutablePatch.js +162 -0
  13. package/build/esm/store/states/structure.js +17 -12
  14. package/build/esm/store/store.js +2 -2
  15. package/build/esm/utils/Measure.js +0 -1
  16. package/build/types/geometry/ThreeGeometryCreator.d.ts +42 -42
  17. package/build/types/index.d.ts +17 -17
  18. package/build/types/re-export.d.ts +23 -23
  19. package/build/types/store/states/buerli.d.ts +3 -3
  20. package/build/types/store/states/cad.d.ts +5 -5
  21. package/build/types/store/states/drawing.d.ts +4 -4
  22. package/build/types/store/states/geometry.d.ts +6 -6
  23. package/build/types/store/states/graphic.d.ts +3 -3
  24. package/build/types/store/states/immutablePatch.d.ts +30 -0
  25. package/build/types/store/states/interaction.d.ts +3 -3
  26. package/build/types/store/states/message.d.ts +6 -6
  27. package/build/types/store/states/plugin.d.ts +10 -10
  28. package/build/types/store/states/selection.d.ts +13 -13
  29. package/build/types/store/states/structure.d.ts +10 -4
  30. package/build/types/store/store.d.ts +1 -1
  31. package/build/types/types/InteractionInfo.d.ts +3 -3
  32. package/build/types/utils/Measure.d.ts +8 -8
  33. package/build/types/utils/Timing.d.ts +1 -1
  34. package/package.json +17 -21
  35. package/vitest.config.mts +5 -0
@@ -0,0 +1,162 @@
1
+ /**
2
+ * applyPatchImmutable — RFC 6902 (JSON Patch) applied with structural sharing.
3
+ *
4
+ * Never mutates the input document. Copies exactly the containers on the path
5
+ * of each operation (copy-on-write); untouched siblings keep their identity,
6
+ * so store subscribers with reference-equality selectors only wake where
7
+ * something actually changed.
8
+ *
9
+ * The speed trick: a per-batch `cloned` set tracks containers that are already
10
+ * fresh copies owned by this batch — those are mutated in place. A batch of
11
+ * N ops therefore costs one shallow copy per DISTINCT touched container (plus
12
+ * the walk), not one copy chain per op. No full deep clone, ever.
13
+ *
14
+ * This replaces the previous two-library setup (jsonpatch for small blocks,
15
+ * fast-json-patch with a full deep clone for blocks > 100 ops): it is faster
16
+ * than either in its own domain AND keeps identities correct, so the 100-op
17
+ * threshold and its discontinuous identity behavior are gone.
18
+ *
19
+ * Supported ops: add, remove, replace, move, copy, test (the full RFC set;
20
+ * the engine's json::diff emits only add/remove/replace). Throws on invalid
21
+ * paths/ops — the caller decides how to recover, exactly like the previous
22
+ * jsonpatch behavior.
23
+ */
24
+ /** '/a/b~1c/0' → ['a', 'b/c', '0'] with RFC 6901 unescaping (~1 → '/', ~0 → '~'). */
25
+ const parsePointer = (path) => {
26
+ if (path === '')
27
+ return [];
28
+ if (path[0] !== '/')
29
+ throw new Error(`invalid JSON pointer: ${path}`);
30
+ return path
31
+ .slice(1)
32
+ .split('/')
33
+ .map(s => s.replace(/~1/g, '/').replace(/~0/g, '~'));
34
+ };
35
+ const toIndex = (seg, arr, allowEnd) => {
36
+ const idx = seg === '-' ? arr.length : Number(seg);
37
+ if (!Number.isInteger(idx) || idx < 0 || idx > arr.length - (allowEnd ? 0 : 1)) {
38
+ throw new Error(`array index out of bounds: ${seg}`);
39
+ }
40
+ return idx;
41
+ };
42
+ const deepEqual = (a, b) => {
43
+ if (a === b)
44
+ return true;
45
+ if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null)
46
+ return false;
47
+ if (Array.isArray(a) !== Array.isArray(b))
48
+ return false;
49
+ const ka = Object.keys(a);
50
+ if (ka.length !== Object.keys(b).length)
51
+ return false;
52
+ return ka.every(k => deepEqual(a[k], b[k]));
53
+ };
54
+ const getAtPath = (doc, segs) => {
55
+ let cur = doc;
56
+ for (const seg of segs) {
57
+ if (cur === null || typeof cur !== 'object')
58
+ throw new Error('path not found');
59
+ cur = Array.isArray(cur) ? cur[toIndex(seg, cur, false)] : cur[seg];
60
+ if (cur === undefined)
61
+ throw new Error('path not found');
62
+ }
63
+ return cur;
64
+ };
65
+ /** Portable deep clone for the rare `copy` op (structuredClone needs node >= 17). */
66
+ const deepClone = (v) => typeof structuredClone === 'function' ? structuredClone(v) : JSON.parse(JSON.stringify(v));
67
+ export function applyPatchImmutable(doc, ops) {
68
+ // Containers created by THIS batch — safe to mutate in place. Keyed by the
69
+ // copies themselves, so shared history from the input doc is never touched.
70
+ const cloned = new Set();
71
+ /** Return a batch-owned version of `container` (copying it if needed). */
72
+ const own = (container) => {
73
+ if (cloned.has(container))
74
+ return container;
75
+ const copy = (Array.isArray(container) ? container.slice() : Object.assign({}, container));
76
+ cloned.add(copy);
77
+ return copy;
78
+ };
79
+ let root = doc;
80
+ const applyOne = (op) => {
81
+ var _a, _b, _c;
82
+ const segs = parsePointer(op.path);
83
+ // Whole-document operations.
84
+ if (segs.length === 0) {
85
+ switch (op.op) {
86
+ case 'replace':
87
+ case 'add':
88
+ root = op.value;
89
+ return;
90
+ case 'test':
91
+ if (!deepEqual(root, op.value))
92
+ throw new Error('test failed at root');
93
+ return;
94
+ default:
95
+ throw new Error(`op "${op.op}" not allowed on document root`);
96
+ }
97
+ }
98
+ // move/copy decompose into get + remove/add. Reusing the moved reference
99
+ // is safe (it ends up at exactly one location); copy inserts a detached
100
+ // clone so a later op on one copy can never alias into the other.
101
+ if (op.op === 'move') {
102
+ const value = getAtPath(root, parsePointer((_a = op.from) !== null && _a !== void 0 ? _a : ''));
103
+ applyOne({ op: 'remove', path: (_b = op.from) !== null && _b !== void 0 ? _b : '' });
104
+ applyOne({ op: 'add', path: op.path, value });
105
+ return;
106
+ }
107
+ if (op.op === 'copy') {
108
+ applyOne({ op: 'add', path: op.path, value: deepClone(getAtPath(root, parsePointer((_c = op.from) !== null && _c !== void 0 ? _c : ''))) });
109
+ return;
110
+ }
111
+ // Copy-on-write walk: own every container from the root down to the
112
+ // operation's parent, re-linking each owned copy into its (owned) parent.
113
+ root = own(root);
114
+ let parent = root;
115
+ for (let i = 0; i < segs.length - 1; i++) {
116
+ const key = Array.isArray(parent) ? toIndex(segs[i], parent, false) : segs[i];
117
+ const child = parent[key];
118
+ if (child === null || typeof child !== 'object')
119
+ throw new Error(`path not found: ${op.path}`);
120
+ const owned = own(child);
121
+ if (owned !== child)
122
+ parent[key] = owned; // parent is owned → safe
123
+ parent = owned;
124
+ }
125
+ const last = segs[segs.length - 1];
126
+ switch (op.op) {
127
+ case 'replace':
128
+ if (Array.isArray(parent))
129
+ parent[toIndex(last, parent, false)] = op.value;
130
+ else if (last in parent)
131
+ parent[last] = op.value;
132
+ else
133
+ throw new Error(`replace target missing: ${op.path}`);
134
+ return;
135
+ case 'add':
136
+ if (Array.isArray(parent))
137
+ parent.splice(toIndex(last, parent, true), 0, op.value);
138
+ else
139
+ parent[last] = op.value;
140
+ return;
141
+ case 'remove':
142
+ if (Array.isArray(parent))
143
+ parent.splice(toIndex(last, parent, false), 1);
144
+ else if (last in parent)
145
+ delete parent[last];
146
+ else
147
+ throw new Error(`remove target missing: ${op.path}`);
148
+ return;
149
+ case 'test': {
150
+ const actual = Array.isArray(parent) ? parent[toIndex(last, parent, false)] : parent[last];
151
+ if (!deepEqual(actual, op.value))
152
+ throw new Error(`test failed: ${op.path}`);
153
+ return;
154
+ }
155
+ default:
156
+ throw new Error(`unknown op: ${op.op}`);
157
+ }
158
+ };
159
+ for (const op of ops)
160
+ applyOne(op);
161
+ return root;
162
+ }
@@ -1,8 +1,7 @@
1
- import fastpatch from 'fast-json-patch';
2
- import jsonpatch from 'jsonpatch';
3
1
  import * as THREE from 'three';
4
2
  import { DEFAULT_STRUCTURE_TREE } from '../../types';
5
3
  import { MathUtils } from '../../utils/Math';
4
+ import { applyPatchImmutable } from './immutablePatch';
6
5
  ////////////////////////////////////////////////////
7
6
  // DATA
8
7
  ////////////////////////////////////////////////////
@@ -28,28 +27,33 @@ export const structureApi = (set, get, buerliApi) => ({
28
27
  // console.log('cleanup')
29
28
  api.structure.postProcessStructureUpdate();
30
29
  },
30
+ /**
31
+ * Applies structure patches to the tree. Returns `false` when a patch block
32
+ * failed to apply — the tree is then diverged from the server's baseline and
33
+ * stays diverged (patches are relative), so the caller should recover by
34
+ * re-fetching the full tree.
35
+ */
31
36
  applyPatches: (patches) => {
32
37
  const before = get().structure.products.concat(get().structure.visibleContainers);
38
+ let ok = true;
33
39
  const applyBlock = (block) => {
34
40
  if (block.length === 0)
35
41
  return;
36
42
  set(state => {
37
43
  let structure = state.structure;
38
44
  try {
39
- // TODO: keep an eye on the patch behaviour in general.
40
- // For large changes 'fast-json-patch' is much more performant than 'jsonpatch'.
41
- // However, for smaller changes 'jsonpatch' is more performant than 'fast-json-patch'.
42
- if (block.length > 100) {
43
- structure = fastpatch.applyPatch(state.structure, block, false, false).newDocument;
44
- }
45
- else {
46
- structure = jsonpatch.apply_patch(state.structure, block);
47
- }
45
+ // Structural-sharing patch application: only containers on a patched
46
+ // path get new identities, untouched subtrees stay reference-equal —
47
+ // so identity-sensitive subscribers/effects only react to genuine
48
+ // changes. Replaces the former jsonpatch/fast-json-patch split (the
49
+ // > 100 ops fast-json-patch path deep-cloned the WHOLE document and
50
+ // gave every node a new identity on every large block).
51
+ structure = applyPatchImmutable(state.structure, block);
48
52
  }
49
53
  catch (e) {
54
+ ok = false;
50
55
  console.error(e);
51
56
  }
52
- // console.info('currentProduct in new patched structure: ', structure.currentProduct)
53
57
  return { structure: Object.assign(Object.assign({}, state.structure), structure) };
54
58
  });
55
59
  };
@@ -81,6 +85,7 @@ export const structureApi = (set, get, buerliApi) => ({
81
85
  if (before.sort().join() !== after.sort().join()) {
82
86
  api.geometry.updateBounds();
83
87
  }
88
+ return ok;
84
89
  },
85
90
  filterTree: (tree, filter) => {
86
91
  const objs = [];
@@ -1,3 +1,3 @@
1
- import vanillaCreate from 'zustand/vanilla';
1
+ import { createStore } from 'zustand/vanilla';
2
2
  import { createState } from './states/buerli';
3
- export const api = vanillaCreate()(createState);
3
+ export const api = createStore()(createState);
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-lines */
2
1
  import * as THREE from 'three';
3
2
  import { GraphicType } from '../re-export';
4
3
  import { getDrawing } from './../store';
@@ -15,7 +15,7 @@ export declare class ThreeGeometryCreator {
15
15
  type: GraphicType.NONE | GraphicType.BREP | GraphicType.POLYBREP | GraphicType.CURVEARRAY;
16
16
  };
17
17
  operationId: any;
18
- rawGraphic: import("@classcad/api-js/build/types/scg/Scg").ScgGraphicElement | null;
18
+ rawGraphic: import("@classcad/api-js").ScgGraphicElement | null;
19
19
  };
20
20
  createGeometry(container: IGraphicContainer, color?: number[]): ContainerGeometryT;
21
21
  createSurface(mesh: IGraphicMesh, container: IGraphicContainer, color?: number[]): {
@@ -28,9 +28,9 @@ export declare class ThreeGeometryCreator {
28
28
  type: GraphicType.NONE | GraphicType.BREP | GraphicType.POLYBREP | GraphicType.CURVEARRAY;
29
29
  };
30
30
  operationId: any;
31
- rawGraphic: import("@classcad/api-js/build/types/scg/Scg").ScgGraphicElement | null;
31
+ rawGraphic: import("@classcad/api-js").ScgGraphicElement | null;
32
32
  isValid: boolean;
33
- geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
33
+ geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;
34
34
  graphicId: number;
35
35
  type: GraphicType;
36
36
  loops: number[][];
@@ -45,9 +45,9 @@ export declare class ThreeGeometryCreator {
45
45
  type: GraphicType.NONE | GraphicType.BREP | GraphicType.POLYBREP | GraphicType.CURVEARRAY;
46
46
  };
47
47
  operationId: any;
48
- rawGraphic: import("@classcad/api-js/build/types/scg/Scg").ScgGraphicElement | null;
48
+ rawGraphic: import("@classcad/api-js").ScgGraphicElement | null;
49
49
  isValid: boolean;
50
- geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
50
+ geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;
51
51
  graphicId: number;
52
52
  type: GraphicType;
53
53
  loops: number[][];
@@ -56,7 +56,7 @@ export declare class ThreeGeometryCreator {
56
56
  type: GraphicType;
57
57
  pointOnPlane: THREE.Vector3;
58
58
  normal: THREE.Vector3;
59
- graphicId: number;
59
+ graphicId: GraphicID;
60
60
  color: THREE.Color | undefined;
61
61
  opacity: number;
62
62
  layer: any;
@@ -66,9 +66,9 @@ export declare class ThreeGeometryCreator {
66
66
  type: GraphicType.NONE | GraphicType.BREP | GraphicType.POLYBREP | GraphicType.CURVEARRAY;
67
67
  };
68
68
  operationId: any;
69
- rawGraphic: import("@classcad/api-js/build/types/scg/Scg").ScgGraphicElement | null;
69
+ rawGraphic: import("@classcad/api-js").ScgGraphicElement | null;
70
70
  isValid: boolean;
71
- geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
71
+ geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;
72
72
  loops: number[][];
73
73
  };
74
74
  createCylinder(mesh: IGraphicMesh, meshGeom: MeshGeometry): {
@@ -77,7 +77,7 @@ export declare class ThreeGeometryCreator {
77
77
  axis: THREE.Vector3;
78
78
  height: number;
79
79
  radius: number;
80
- graphicId: number;
80
+ graphicId: GraphicID;
81
81
  color: THREE.Color | undefined;
82
82
  opacity: number;
83
83
  layer: any;
@@ -87,9 +87,9 @@ export declare class ThreeGeometryCreator {
87
87
  type: GraphicType.NONE | GraphicType.BREP | GraphicType.POLYBREP | GraphicType.CURVEARRAY;
88
88
  };
89
89
  operationId: any;
90
- rawGraphic: import("@classcad/api-js/build/types/scg/Scg").ScgGraphicElement | null;
90
+ rawGraphic: import("@classcad/api-js").ScgGraphicElement | null;
91
91
  isValid: boolean;
92
- geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
92
+ geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;
93
93
  loops: number[][];
94
94
  };
95
95
  createCone(mesh: IGraphicMesh, meshGeom: MeshGeometry): {
@@ -99,7 +99,7 @@ export declare class ThreeGeometryCreator {
99
99
  height: number;
100
100
  radiusBottom: number;
101
101
  radiusTop: number;
102
- graphicId: number;
102
+ graphicId: GraphicID;
103
103
  color: THREE.Color | undefined;
104
104
  opacity: number;
105
105
  layer: any;
@@ -109,15 +109,15 @@ export declare class ThreeGeometryCreator {
109
109
  type: GraphicType.NONE | GraphicType.BREP | GraphicType.POLYBREP | GraphicType.CURVEARRAY;
110
110
  };
111
111
  operationId: any;
112
- rawGraphic: import("@classcad/api-js/build/types/scg/Scg").ScgGraphicElement | null;
112
+ rawGraphic: import("@classcad/api-js").ScgGraphicElement | null;
113
113
  isValid: boolean;
114
- geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
114
+ geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;
115
115
  loops: number[][];
116
116
  };
117
117
  createSphere(mesh: IGraphicMesh, meshGeom: MeshGeometry): {
118
118
  type: GraphicType;
119
119
  radius: number;
120
- graphicId: number;
120
+ graphicId: GraphicID;
121
121
  color: THREE.Color | undefined;
122
122
  opacity: number;
123
123
  layer: any;
@@ -127,9 +127,9 @@ export declare class ThreeGeometryCreator {
127
127
  type: GraphicType.NONE | GraphicType.BREP | GraphicType.POLYBREP | GraphicType.CURVEARRAY;
128
128
  };
129
129
  operationId: any;
130
- rawGraphic: import("@classcad/api-js/build/types/scg/Scg").ScgGraphicElement | null;
130
+ rawGraphic: import("@classcad/api-js").ScgGraphicElement | null;
131
131
  isValid: boolean;
132
- geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
132
+ geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;
133
133
  loops: number[][];
134
134
  };
135
135
  createLine(line: IGraphicLine, container: IGraphicContainer, points: PointMap, color?: number[]): {
@@ -144,8 +144,8 @@ export declare class ThreeGeometryCreator {
144
144
  type: GraphicType.NONE | GraphicType.BREP | GraphicType.POLYBREP | GraphicType.CURVEARRAY;
145
145
  };
146
146
  operationId: any;
147
- rawGraphic: import("@classcad/api-js/build/types/scg/Scg").ScgGraphicElement | null;
148
- geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
147
+ rawGraphic: import("@classcad/api-js").ScgGraphicElement | null;
148
+ geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;
149
149
  graphicId: number;
150
150
  type: GraphicType;
151
151
  };
@@ -161,8 +161,8 @@ export declare class ThreeGeometryCreator {
161
161
  type: GraphicType.NONE | GraphicType.BREP | GraphicType.POLYBREP | GraphicType.CURVEARRAY;
162
162
  };
163
163
  operationId: any;
164
- rawGraphic: import("@classcad/api-js/build/types/scg/Scg").ScgGraphicElement | null;
165
- geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
164
+ rawGraphic: import("@classcad/api-js").ScgGraphicElement | null;
165
+ geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;
166
166
  graphicId: number;
167
167
  type: GraphicType;
168
168
  };
@@ -182,8 +182,8 @@ export declare class ThreeGeometryCreator {
182
182
  type: GraphicType.NONE | GraphicType.BREP | GraphicType.POLYBREP | GraphicType.CURVEARRAY;
183
183
  };
184
184
  operationId: any;
185
- rawGraphic: import("@classcad/api-js/build/types/scg/Scg").ScgGraphicElement | null;
186
- geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
185
+ rawGraphic: import("@classcad/api-js").ScgGraphicElement | null;
186
+ geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>;
187
187
  graphicId: number;
188
188
  type: GraphicType;
189
189
  };
@@ -203,7 +203,7 @@ export declare class ThreeGeometryCreator {
203
203
  type: GraphicType.NONE | GraphicType.BREP | GraphicType.POLYBREP | GraphicType.CURVEARRAY;
204
204
  };
205
205
  operationId: any;
206
- rawGraphic: import("@classcad/api-js/build/types/scg/Scg").ScgGraphicElement | null;
206
+ rawGraphic: import("@classcad/api-js").ScgGraphicElement | null;
207
207
  key: string;
208
208
  graphicId: number;
209
209
  type: GraphicType;
@@ -211,30 +211,30 @@ export declare class ThreeGeometryCreator {
211
211
  private insertPoint;
212
212
  }
213
213
  export declare const EMPTY_CONTAINER_GEOMETRY: () => ContainerGeometryT;
214
- declare type CommonProps = {
214
+ type CommonProps = {
215
215
  graphicId: GraphicID;
216
216
  type: GraphicType;
217
217
  };
218
- export declare type Metadata = ReturnType<ThreeGeometryCreator['getMetadata']>;
219
- export declare type MeshGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createMesh']>;
220
- export declare type PlaneGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createPlane']>;
221
- export declare type CylinderGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createCylinder']>;
222
- export declare type ConeGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createCone']>;
223
- export declare type SphereGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createSphere']>;
224
- export declare type LineGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createLine']>;
225
- export declare type EdgeGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createEdge']>;
226
- export declare type ArcGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createArc']>;
227
- export declare type CircleGeometry = ArcGeometry;
228
- export declare type PointGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createPoint']> & {
218
+ export type Metadata = ReturnType<ThreeGeometryCreator['getMetadata']>;
219
+ export type MeshGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createMesh']>;
220
+ export type PlaneGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createPlane']>;
221
+ export type CylinderGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createCylinder']>;
222
+ export type ConeGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createCone']>;
223
+ export type SphereGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createSphere']>;
224
+ export type LineGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createLine']>;
225
+ export type EdgeGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createEdge']>;
226
+ export type ArcGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createArc']>;
227
+ export type CircleGeometry = ArcGeometry;
228
+ export type PointGeometry = CommonProps & ReturnType<ThreeGeometryCreator['createPoint']> & {
229
229
  owners: Array<{
230
230
  ownerId: GraphicID;
231
231
  type: PointType;
232
232
  }>;
233
233
  };
234
- declare type PointMap = Record<string, PointGeometry>;
235
- declare type PointKey = string;
236
- declare type PointType = 'start' | 'end' | 'center';
237
- export declare type ContainerGeometryT = {
234
+ type PointMap = Record<string, PointGeometry>;
235
+ type PointKey = string;
236
+ type PointType = 'start' | 'end' | 'center';
237
+ export type ContainerGeometryT = {
238
238
  graphicId: GraphicID;
239
239
  type: GraphicType;
240
240
  map: Record<GraphicID, GeometryElement>;
@@ -248,8 +248,8 @@ export declare type ContainerGeometryT = {
248
248
  max: THREE.Vector3;
249
249
  };
250
250
  } & ReturnType<ThreeGeometryCreator['getMetadata']>;
251
- export declare type GeometryElement = MeshGeometry | PlaneGeometry | CylinderGeometry | ConeGeometry | SphereGeometry | LineGeometry | EdgeGeometry | ArcGeometry | CircleGeometry | PointGeometry;
252
- export declare type ProductElement = GeometryElement & {
251
+ export type GeometryElement = MeshGeometry | PlaneGeometry | CylinderGeometry | ConeGeometry | SphereGeometry | LineGeometry | EdgeGeometry | ArcGeometry | CircleGeometry | PointGeometry;
252
+ export type ProductElement = GeometryElement & {
253
253
  productId: ObjectID;
254
254
  };
255
255
  export declare const isEqualGeometry: (a: GeometryElement, b: GeometryElement) => boolean;
@@ -14,25 +14,25 @@ export * from './re-export';
14
14
  * Please have a look at https://github.com/awv-informatik/buerli/pull/129 for more information.
15
15
  */
16
16
  import { BuerliState as BS } from './store/states/buerli';
17
- export declare type BuerliState = BS;
17
+ export type BuerliState = BS;
18
18
  import { DrawingAPI as DrawingAPI1, DrawingID as DrawingID1, DrawingState as DrawingState1 } from './store/states/drawing';
19
- export declare type DrawingID = DrawingID1;
20
- export declare type DrawingState = DrawingState1;
21
- export declare type DrawingAPI = DrawingAPI1;
19
+ export type DrawingID = DrawingID1;
20
+ export type DrawingState = DrawingState1;
21
+ export type DrawingAPI = DrawingAPI1;
22
22
  import { GeometryConfig as GeometryConfig1, GeometryBounds as GeometryBounds1 } from './store/states/geometry';
23
- export declare type GeometryConfig = GeometryConfig1;
24
- export declare type GeometryBounds = GeometryBounds1;
23
+ export type GeometryConfig = GeometryConfig1;
24
+ export type GeometryBounds = GeometryBounds1;
25
25
  import { Plugin as Plugin1, PluginDescription as PluginDescription1, PluginID as PluginID1, PluginState as PluginState1 } from './store/states/plugin';
26
- export declare type Plugin = Plugin1;
27
- export declare type PluginDescription<InternalState = any> = PluginDescription1<InternalState>;
28
- export declare type PluginID = PluginID1;
29
- export declare type PluginState<InternalState extends Record<any, any> = any> = PluginState1<InternalState>;
26
+ export type Plugin = Plugin1;
27
+ export type PluginDescription<InternalState = any> = PluginDescription1<InternalState>;
28
+ export type PluginID = PluginID1;
29
+ export type PluginState<InternalState extends Record<any, any> = any> = PluginState1<InternalState>;
30
30
  import { SeletedItemData, SelectedItem as SelectedItem1, SelectionFilter as SelectionFilter1, SelectionScope as SelectionScope1, Selector as Selector1, SelectorID as SelectorID1, CustomSelect as CustomSelect1 } from './store/states/selection';
31
- export declare type SelectedItem<T extends SeletedItemData<any> = any> = SelectedItem1<T>;
32
- export declare type SelectionFilter = SelectionFilter1;
33
- export declare type SelectionScope = SelectionScope1;
34
- export declare type Selector<T extends SeletedItemData<any> = any> = Selector1<T>;
35
- export declare type SelectorID = SelectorID1;
36
- export declare type CustomSelect = CustomSelect1;
31
+ export type SelectedItem<T extends SeletedItemData<any> = any> = SelectedItem1<T>;
32
+ export type SelectionFilter = SelectionFilter1;
33
+ export type SelectionScope = SelectionScope1;
34
+ export type Selector<T extends SeletedItemData<any> = any> = Selector1<T>;
35
+ export type SelectorID = SelectorID1;
36
+ export type CustomSelect = CustomSelect1;
37
37
  import { Message as Message1 } from './store/states/message';
38
- export declare type Message = Message1;
38
+ export type Message = Message1;
@@ -23,48 +23,48 @@ ScgMeshTypes as MeshTypes,
23
23
  /** @deprecated */
24
24
  ScgPointTypes as PointTypes, };
25
25
  /** @deprecated */
26
- export declare type IStructureTree = ScgTree;
26
+ export type IStructureTree = ScgTree;
27
27
  /** @deprecated */
28
- export declare type IStructureProtocol = ScgStructure;
28
+ export type IStructureProtocol = ScgStructure;
29
29
  /** @deprecated */
30
- export declare type IStructureObject = ScgObject;
30
+ export type IStructureObject = ScgObject;
31
31
  /** @deprecated */
32
- export declare type IStructureMember = ScgMember;
32
+ export type IStructureMember = ScgMember;
33
33
  /** @deprecated */
34
- export declare type IStructurePatch = ScgStructurePatchOp;
34
+ export type IStructurePatch = ScgStructurePatchOp;
35
35
  /** @deprecated */
36
- export declare type IGraphicPackage = ScgGraphicPackage;
36
+ export type IGraphicPackage = ScgGraphicPackage;
37
37
  /** @deprecated */
38
- export declare type IGraphicElement = ScgGraphicElement;
38
+ export type IGraphicElement = ScgGraphicElement;
39
39
  /** @deprecated */
40
- export declare type IGraphicContainer = ScgGraphicContainer;
40
+ export type IGraphicContainer = ScgGraphicContainer;
41
41
  /** @deprecated */
42
- export declare type IGraphicArc = ScgGraphicArc;
42
+ export type IGraphicArc = ScgGraphicArc;
43
43
  /** @deprecated */
44
- export declare type IGraphicCone = ScgGraphicCone;
44
+ export type IGraphicCone = ScgGraphicCone;
45
45
  /** @deprecated */
46
- export declare type IGraphicCylinder = ScgGraphicCylinder;
46
+ export type IGraphicCylinder = ScgGraphicCylinder;
47
47
  /** @deprecated */
48
- export declare type IGraphicEdge = ScgGraphicEdge;
48
+ export type IGraphicEdge = ScgGraphicEdge;
49
49
  /** @deprecated */
50
- export declare type IGraphicLine = ScgGraphicLine;
50
+ export type IGraphicLine = ScgGraphicLine;
51
51
  /** @deprecated */
52
- export declare type IGraphicMesh = ScgGraphicMesh;
52
+ export type IGraphicMesh = ScgGraphicMesh;
53
53
  /** @deprecated */
54
- export declare type IGraphicPlane = ScgGraphicPlane;
54
+ export type IGraphicPlane = ScgGraphicPlane;
55
55
  /** @deprecated */
56
- export declare type IGraphicSphere = ScgGraphicSphere;
56
+ export type IGraphicSphere = ScgGraphicSphere;
57
57
  /** @deprecated */
58
- export declare type PointMemValue = ScgPoint;
58
+ export type PointMemValue = ScgPoint;
59
59
  /** @deprecated */
60
- export declare type ArrayMem = ScgArrayMem;
60
+ export type ArrayMem = ScgArrayMem;
61
61
  /** @deprecated */
62
- export declare type IdMem = ScgIdMem;
62
+ export type IdMem = ScgIdMem;
63
63
  /** @deprecated */
64
- export declare type PointMem = ScgPointMem;
64
+ export type PointMem = ScgPointMem;
65
65
  /** @deprecated */
66
- export declare type RealMem = ScgRealMem;
66
+ export type RealMem = ScgRealMem;
67
67
  /** @deprecated */
68
- export declare type StringMem = ScgStringMem;
68
+ export type StringMem = ScgStringMem;
69
69
  /** @deprecated */
70
- export declare type APIOptions = FacadeOptions;
70
+ export type APIOptions = FacadeOptions;
@@ -3,15 +3,15 @@ import { DrawingID, DrawingState } from './drawing';
3
3
  import { GeometryConfig } from './geometry';
4
4
  import { MessageState } from './message';
5
5
  import { PluginDef, PluginImpl } from './plugin';
6
- declare type GeneralApi = {
6
+ type GeneralApi = {
7
7
  init(options?: Partial<BuerliState['options']>): void;
8
8
  };
9
- declare type DrawingManagementApi = {
9
+ type DrawingManagementApi = {
10
10
  createDrawing(name?: string): Promise<DrawingState>;
11
11
  removeDrawing(id: DrawingID): void;
12
12
  setActiveDrawing(id: DrawingID | null): void;
13
13
  };
14
- export declare type BuerliState = Readonly<{
14
+ export type BuerliState = Readonly<{
15
15
  initDone: boolean;
16
16
  options: {
17
17
  elements: any;
@@ -1,7 +1,7 @@
1
1
  import { StoreApi } from 'zustand';
2
2
  import { BuerliState } from './buerli';
3
3
  import { DrawingState } from './drawing';
4
- declare type States = {
4
+ type States = {
5
5
  current: number;
6
6
  stack: string[];
7
7
  captionMap: Record<string, {
@@ -10,14 +10,14 @@ declare type States = {
10
10
  undoable?: boolean;
11
11
  }>;
12
12
  };
13
- declare type Pending = {
13
+ type Pending = {
14
14
  id: string;
15
15
  name: string;
16
16
  stamp: number;
17
17
  args?: any;
18
18
  promise?: Promise<any>;
19
19
  };
20
- export declare type CadData = {
20
+ export type CadData = {
21
21
  connection: {
22
22
  active: boolean;
23
23
  connected: boolean;
@@ -25,9 +25,9 @@ export declare type CadData = {
25
25
  states: States;
26
26
  pending: Pending[];
27
27
  };
28
- export declare type CadApi = ReturnType<typeof cadApi>;
28
+ export type CadApi = ReturnType<typeof cadApi>;
29
29
  export declare const cadData: () => CadData;
30
- export declare const cadApi: (set: StoreApi<DrawingState>['setState'], get: StoreApi<DrawingState>['getState'], buerliApi: StoreApi<BuerliState>) => {
30
+ export declare const cadApi: (set: StoreApi<DrawingState>["setState"], get: StoreApi<DrawingState>["getState"], buerliApi: StoreApi<BuerliState>) => {
31
31
  setStates: (current: number, stack: string[], captionMap: Record<string, {
32
32
  stateName: string;
33
33
  caption: string;
@@ -16,8 +16,8 @@ import { InteractionApi, InteractionData } from './interaction';
16
16
  import { PluginApi, PluginData } from './plugin';
17
17
  import { SelectionApi, SelectionData } from './selection';
18
18
  import { StructureApi, StructureData } from './structure';
19
- export declare type DrawingID = string | number;
20
- export declare type DrawingAPI = {
19
+ export type DrawingID = string | number;
20
+ export type DrawingAPI = {
21
21
  structure: StructureApi;
22
22
  selection: SelectionApi;
23
23
  interaction: InteractionApi;
@@ -27,7 +27,7 @@ export declare type DrawingAPI = {
27
27
  cad: CadApi;
28
28
  reset: () => void;
29
29
  };
30
- declare type StateData = {
30
+ type StateData = {
31
31
  id: DrawingID;
32
32
  name: string;
33
33
  structure: StructureData;
@@ -38,7 +38,7 @@ declare type StateData = {
38
38
  plugin: PluginData;
39
39
  cad: CadData;
40
40
  };
41
- export declare type DrawingState = Readonly<StateData> & Readonly<{
41
+ export type DrawingState = Readonly<StateData> & Readonly<{
42
42
  api: DrawingAPI;
43
43
  }>;
44
44
  export declare const createDrawingState: (set: StoreApi<DrawingState>['setState'], get: StoreApi<DrawingState>['getState'], buerliApi: StoreApi<BuerliState>, drawingNumber: number, name?: string) => DrawingState;