@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
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.isEqualGeometry = exports.EMPTY_CONTAINER_GEOMETRY = exports.ThreeGeometryCreator = void 0;
27
37
  const THREE = __importStar(require("three"));
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.closeMessage = exports.updateMessage = exports.showMessage = exports.init = exports.getPlugin = exports.getDrawing = exports.api = exports.createGraphicItem = exports.BuerliScope = exports.BuerliMessageScope = void 0;
3
+ exports.api = exports.createGraphicItem = exports.BuerliScope = exports.BuerliMessageScope = void 0;
4
+ exports.getDrawing = getDrawing;
5
+ exports.getPlugin = getPlugin;
6
+ exports.init = init;
7
+ exports.showMessage = showMessage;
8
+ exports.updateMessage = updateMessage;
9
+ exports.closeMessage = closeMessage;
4
10
  const store_1 = require("./store");
5
11
  function getDrawing(id) {
6
12
  const { drawing } = store_1.api.getState();
7
13
  return drawing.refs[id];
8
14
  }
9
- exports.getDrawing = getDrawing;
10
15
  /**
11
16
  * @returns PluginState or undefined if either drawing or plugin don't exist
12
17
  */
@@ -15,23 +20,18 @@ function getPlugin(drawingId, pluginId) {
15
20
  const { drawing } = store_1.api.getState();
16
21
  return (_a = drawing.refs[drawingId]) === null || _a === void 0 ? void 0 : _a.plugin.refs[pluginId];
17
22
  }
18
- exports.getPlugin = getPlugin;
19
23
  function init(options) {
20
24
  store_1.api.getState().api.init(options);
21
25
  }
22
- exports.init = init;
23
26
  function showMessage(message) {
24
27
  return store_1.api.getState().message.api.show(message);
25
28
  }
26
- exports.showMessage = showMessage;
27
29
  function updateMessage(id, message) {
28
30
  store_1.api.getState().message.api.update(id, message);
29
31
  }
30
- exports.updateMessage = updateMessage;
31
32
  function closeMessage(id) {
32
33
  store_1.api.getState().message.api.close(id);
33
34
  }
34
- exports.closeMessage = closeMessage;
35
35
  var message_1 = require("./states/message");
36
36
  Object.defineProperty(exports, "BuerliMessageScope", { enumerable: true, get: function () { return message_1.BuerliMessageScope; } });
37
37
  var selection_1 = require("./states/selection");
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.geometryApi = exports.geometryData = void 0;
27
37
  const THREE = __importStar(require("three"));
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ /**
3
+ * applyPatchImmutable — RFC 6902 (JSON Patch) applied with structural sharing.
4
+ *
5
+ * Never mutates the input document. Copies exactly the containers on the path
6
+ * of each operation (copy-on-write); untouched siblings keep their identity,
7
+ * so store subscribers with reference-equality selectors only wake where
8
+ * something actually changed.
9
+ *
10
+ * The speed trick: a per-batch `cloned` set tracks containers that are already
11
+ * fresh copies owned by this batch — those are mutated in place. A batch of
12
+ * N ops therefore costs one shallow copy per DISTINCT touched container (plus
13
+ * the walk), not one copy chain per op. No full deep clone, ever.
14
+ *
15
+ * This replaces the previous two-library setup (jsonpatch for small blocks,
16
+ * fast-json-patch with a full deep clone for blocks > 100 ops): it is faster
17
+ * than either in its own domain AND keeps identities correct, so the 100-op
18
+ * threshold and its discontinuous identity behavior are gone.
19
+ *
20
+ * Supported ops: add, remove, replace, move, copy, test (the full RFC set;
21
+ * the engine's json::diff emits only add/remove/replace). Throws on invalid
22
+ * paths/ops — the caller decides how to recover, exactly like the previous
23
+ * jsonpatch behavior.
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.applyPatchImmutable = applyPatchImmutable;
27
+ /** '/a/b~1c/0' → ['a', 'b/c', '0'] with RFC 6901 unescaping (~1 → '/', ~0 → '~'). */
28
+ const parsePointer = (path) => {
29
+ if (path === '')
30
+ return [];
31
+ if (path[0] !== '/')
32
+ throw new Error(`invalid JSON pointer: ${path}`);
33
+ return path
34
+ .slice(1)
35
+ .split('/')
36
+ .map(s => s.replace(/~1/g, '/').replace(/~0/g, '~'));
37
+ };
38
+ const toIndex = (seg, arr, allowEnd) => {
39
+ const idx = seg === '-' ? arr.length : Number(seg);
40
+ if (!Number.isInteger(idx) || idx < 0 || idx > arr.length - (allowEnd ? 0 : 1)) {
41
+ throw new Error(`array index out of bounds: ${seg}`);
42
+ }
43
+ return idx;
44
+ };
45
+ const deepEqual = (a, b) => {
46
+ if (a === b)
47
+ return true;
48
+ if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null)
49
+ return false;
50
+ if (Array.isArray(a) !== Array.isArray(b))
51
+ return false;
52
+ const ka = Object.keys(a);
53
+ if (ka.length !== Object.keys(b).length)
54
+ return false;
55
+ return ka.every(k => deepEqual(a[k], b[k]));
56
+ };
57
+ const getAtPath = (doc, segs) => {
58
+ let cur = doc;
59
+ for (const seg of segs) {
60
+ if (cur === null || typeof cur !== 'object')
61
+ throw new Error('path not found');
62
+ cur = Array.isArray(cur) ? cur[toIndex(seg, cur, false)] : cur[seg];
63
+ if (cur === undefined)
64
+ throw new Error('path not found');
65
+ }
66
+ return cur;
67
+ };
68
+ /** Portable deep clone for the rare `copy` op (structuredClone needs node >= 17). */
69
+ const deepClone = (v) => typeof structuredClone === 'function' ? structuredClone(v) : JSON.parse(JSON.stringify(v));
70
+ function applyPatchImmutable(doc, ops) {
71
+ // Containers created by THIS batch — safe to mutate in place. Keyed by the
72
+ // copies themselves, so shared history from the input doc is never touched.
73
+ const cloned = new Set();
74
+ /** Return a batch-owned version of `container` (copying it if needed). */
75
+ const own = (container) => {
76
+ if (cloned.has(container))
77
+ return container;
78
+ const copy = (Array.isArray(container) ? container.slice() : Object.assign({}, container));
79
+ cloned.add(copy);
80
+ return copy;
81
+ };
82
+ let root = doc;
83
+ const applyOne = (op) => {
84
+ var _a, _b, _c;
85
+ const segs = parsePointer(op.path);
86
+ // Whole-document operations.
87
+ if (segs.length === 0) {
88
+ switch (op.op) {
89
+ case 'replace':
90
+ case 'add':
91
+ root = op.value;
92
+ return;
93
+ case 'test':
94
+ if (!deepEqual(root, op.value))
95
+ throw new Error('test failed at root');
96
+ return;
97
+ default:
98
+ throw new Error(`op "${op.op}" not allowed on document root`);
99
+ }
100
+ }
101
+ // move/copy decompose into get + remove/add. Reusing the moved reference
102
+ // is safe (it ends up at exactly one location); copy inserts a detached
103
+ // clone so a later op on one copy can never alias into the other.
104
+ if (op.op === 'move') {
105
+ const value = getAtPath(root, parsePointer((_a = op.from) !== null && _a !== void 0 ? _a : ''));
106
+ applyOne({ op: 'remove', path: (_b = op.from) !== null && _b !== void 0 ? _b : '' });
107
+ applyOne({ op: 'add', path: op.path, value });
108
+ return;
109
+ }
110
+ if (op.op === 'copy') {
111
+ applyOne({ op: 'add', path: op.path, value: deepClone(getAtPath(root, parsePointer((_c = op.from) !== null && _c !== void 0 ? _c : ''))) });
112
+ return;
113
+ }
114
+ // Copy-on-write walk: own every container from the root down to the
115
+ // operation's parent, re-linking each owned copy into its (owned) parent.
116
+ root = own(root);
117
+ let parent = root;
118
+ for (let i = 0; i < segs.length - 1; i++) {
119
+ const key = Array.isArray(parent) ? toIndex(segs[i], parent, false) : segs[i];
120
+ const child = parent[key];
121
+ if (child === null || typeof child !== 'object')
122
+ throw new Error(`path not found: ${op.path}`);
123
+ const owned = own(child);
124
+ if (owned !== child)
125
+ parent[key] = owned; // parent is owned → safe
126
+ parent = owned;
127
+ }
128
+ const last = segs[segs.length - 1];
129
+ switch (op.op) {
130
+ case 'replace':
131
+ if (Array.isArray(parent))
132
+ parent[toIndex(last, parent, false)] = op.value;
133
+ else if (last in parent)
134
+ parent[last] = op.value;
135
+ else
136
+ throw new Error(`replace target missing: ${op.path}`);
137
+ return;
138
+ case 'add':
139
+ if (Array.isArray(parent))
140
+ parent.splice(toIndex(last, parent, true), 0, op.value);
141
+ else
142
+ parent[last] = op.value;
143
+ return;
144
+ case 'remove':
145
+ if (Array.isArray(parent))
146
+ parent.splice(toIndex(last, parent, false), 1);
147
+ else if (last in parent)
148
+ delete parent[last];
149
+ else
150
+ throw new Error(`remove target missing: ${op.path}`);
151
+ return;
152
+ case 'test': {
153
+ const actual = Array.isArray(parent) ? parent[toIndex(last, parent, false)] : parent[last];
154
+ if (!deepEqual(actual, op.value))
155
+ throw new Error(`test failed: ${op.path}`);
156
+ return;
157
+ }
158
+ default:
159
+ throw new Error(`unknown op: ${op.op}`);
160
+ }
161
+ };
162
+ for (const op of ops)
163
+ applyOne(op);
164
+ return root;
165
+ }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isPromisePlugin = exports.pluginApi = exports.pluginData = void 0;
3
+ exports.pluginApi = exports.pluginData = void 0;
4
+ exports.isPromisePlugin = isPromisePlugin;
4
5
  const uuid_1 = require("uuid");
5
6
  const pluginData = () => ({
6
7
  feature: [],
@@ -112,4 +113,3 @@ exports.pluginApi = pluginApi;
112
113
  function isPromisePlugin(def) {
113
114
  return def.then !== undefined;
114
115
  }
115
- exports.isPromisePlugin = isPromisePlugin;
@@ -15,23 +15,29 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
28
35
  Object.defineProperty(exports, "__esModule", { value: true });
29
36
  exports.structureApi = exports.structureData = void 0;
30
- const fast_json_patch_1 = __importDefault(require("fast-json-patch"));
31
- const jsonpatch_1 = __importDefault(require("jsonpatch"));
32
37
  const THREE = __importStar(require("three"));
33
38
  const types_1 = require("../../types");
34
39
  const Math_1 = require("../../utils/Math");
40
+ const immutablePatch_1 = require("./immutablePatch");
35
41
  ////////////////////////////////////////////////////
36
42
  // DATA
37
43
  ////////////////////////////////////////////////////
@@ -58,28 +64,33 @@ const structureApi = (set, get, buerliApi) => ({
58
64
  // console.log('cleanup')
59
65
  api.structure.postProcessStructureUpdate();
60
66
  },
67
+ /**
68
+ * Applies structure patches to the tree. Returns `false` when a patch block
69
+ * failed to apply — the tree is then diverged from the server's baseline and
70
+ * stays diverged (patches are relative), so the caller should recover by
71
+ * re-fetching the full tree.
72
+ */
61
73
  applyPatches: (patches) => {
62
74
  const before = get().structure.products.concat(get().structure.visibleContainers);
75
+ let ok = true;
63
76
  const applyBlock = (block) => {
64
77
  if (block.length === 0)
65
78
  return;
66
79
  set(state => {
67
80
  let structure = state.structure;
68
81
  try {
69
- // TODO: keep an eye on the patch behaviour in general.
70
- // For large changes 'fast-json-patch' is much more performant than 'jsonpatch'.
71
- // However, for smaller changes 'jsonpatch' is more performant than 'fast-json-patch'.
72
- if (block.length > 100) {
73
- structure = fast_json_patch_1.default.applyPatch(state.structure, block, false, false).newDocument;
74
- }
75
- else {
76
- structure = jsonpatch_1.default.apply_patch(state.structure, block);
77
- }
82
+ // Structural-sharing patch application: only containers on a patched
83
+ // path get new identities, untouched subtrees stay reference-equal —
84
+ // so identity-sensitive subscribers/effects only react to genuine
85
+ // changes. Replaces the former jsonpatch/fast-json-patch split (the
86
+ // > 100 ops fast-json-patch path deep-cloned the WHOLE document and
87
+ // gave every node a new identity on every large block).
88
+ structure = (0, immutablePatch_1.applyPatchImmutable)(state.structure, block);
78
89
  }
79
90
  catch (e) {
91
+ ok = false;
80
92
  console.error(e);
81
93
  }
82
- // console.info('currentProduct in new patched structure: ', structure.currentProduct)
83
94
  return { structure: Object.assign(Object.assign({}, state.structure), structure) };
84
95
  });
85
96
  };
@@ -111,6 +122,7 @@ const structureApi = (set, get, buerliApi) => ({
111
122
  if (before.sort().join() !== after.sort().join()) {
112
123
  api.geometry.updateBounds();
113
124
  }
125
+ return ok;
114
126
  },
115
127
  filterTree: (tree, filter) => {
116
128
  const objs = [];
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.api = void 0;
7
- const vanilla_1 = __importDefault(require("zustand/vanilla"));
4
+ const vanilla_1 = require("zustand/vanilla");
8
5
  const buerli_1 = require("./states/buerli");
9
- exports.api = (0, vanilla_1.default)()(buerli_1.createState);
6
+ exports.api = (0, vanilla_1.createStore)()(buerli_1.createState);
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  // This is the solution for cases when object was deleted from tree and we need to remove corresponding selectedItem.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.unsubscribeItems = exports.subscribeItems = exports.unsubs = void 0;
4
+ exports.unsubs = void 0;
5
+ exports.subscribeItems = subscribeItems;
6
+ exports.unsubscribeItems = unsubscribeItems;
5
7
  const subscribeToDrawing_1 = require("./subscribeToDrawing");
6
8
  // This object contains unsubscibe function for all existing selections in all drawings
7
9
  exports.unsubs = {};
@@ -14,7 +16,6 @@ function subscribeItems(buerliApi, drawingId, selectorId, items) {
14
16
  subscribeItem(buerliApi, drawingId, selectorId, item);
15
17
  });
16
18
  }
17
- exports.subscribeItems = subscribeItems;
18
19
  function subscribeItem(buerliApi, drawingId, selectorId, item) {
19
20
  if (item.removeCondition && !exports.unsubs[getId(selectorId, item.id)]) {
20
21
  const selApi = buerliApi.getState().drawing.refs[drawingId].api.selection;
@@ -37,7 +38,6 @@ function unsubscribeItems(buerliApi, drawingId, selectorId, items) {
37
38
  unsubscribeItem(selectorId, item);
38
39
  });
39
40
  }
40
- exports.unsubscribeItems = unsubscribeItems;
41
41
  function unsubscribeItem(selectorId, item) {
42
42
  if (item.removeCondition) {
43
43
  const id = getId(selectorId, item.id);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.subscribeToDrawing = void 0;
3
+ exports.subscribeToDrawing = subscribeToDrawing;
4
4
  function subscribeToDrawing(buerliApi, drawingId, sel, callback) {
5
5
  const unsub = buerliApi.subscribe((state, prev) => {
6
6
  const curDrawing = state.drawing.refs[drawingId] && sel(state.drawing.refs[drawingId]);
@@ -10,4 +10,3 @@ function subscribeToDrawing(buerliApi, drawingId, sel, callback) {
10
10
  });
11
11
  return unsub;
12
12
  }
13
- exports.subscribeToDrawing = subscribeToDrawing;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.MathUtils = void 0;
27
37
  const THREE = __importStar(require("three"));
@@ -15,16 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.Measure = exports.MeasureResultType = void 0;
27
- /* eslint-disable max-lines */
28
37
  const THREE = __importStar(require("three"));
29
38
  const re_export_1 = require("../re-export");
30
39
  const store_1 = require("./../store");
@@ -36,7 +45,7 @@ var MeasureResultType;
36
45
  MeasureResultType["ANGLE"] = "angular";
37
46
  MeasureResultType["VECTOR"] = "vector";
38
47
  MeasureResultType["POSITION"] = "position";
39
- })(MeasureResultType = exports.MeasureResultType || (exports.MeasureResultType = {}));
48
+ })(MeasureResultType || (exports.MeasureResultType = MeasureResultType = {}));
40
49
  const tolerance = 1e-3;
41
50
  exports.Measure = {
42
51
  transform(items, drawingId) {