@buerli.io/core 0.0.34-beta.0 → 0.0.35-beta.1

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 (74) hide show
  1. package/build/cjs/geometry/ThreeGeometryCreator.js +284 -0
  2. package/build/cjs/geometry/index.js +13 -0
  3. package/build/cjs/index.js +20 -0
  4. package/build/cjs/store/index.js +46 -0
  5. package/build/cjs/store/states/buerli.js +97 -0
  6. package/build/cjs/store/states/canvas.js +18 -0
  7. package/build/cjs/store/states/drawing.js +44 -0
  8. package/build/cjs/store/states/geometry.js +110 -0
  9. package/build/cjs/store/states/graphic.js +87 -0
  10. package/build/cjs/store/states/message.js +25 -0
  11. package/build/cjs/store/states/plugin.js +113 -0
  12. package/build/cjs/store/states/selection.js +226 -0
  13. package/build/cjs/store/states/structure.js +203 -0
  14. package/build/cjs/store/store.js +14 -0
  15. package/build/cjs/store/subscribtion/selection.js +47 -0
  16. package/build/cjs/store/subscribtion/subscribeToDrawing.js +9 -0
  17. package/build/cjs/types/ErrorTypes.js +2 -0
  18. package/build/cjs/types/IGraphicPackage.js +24 -0
  19. package/build/cjs/types/IStructurePatch.js +2 -0
  20. package/build/cjs/types/IStructureTree.js +27 -0
  21. package/build/cjs/types/index.js +16 -0
  22. package/build/cjs/utils/Math.js +33 -0
  23. package/build/cjs/utils/Measure.js +576 -0
  24. package/build/cjs/utils/Timing.js +34 -0
  25. package/build/{geometry → esm/geometry}/ThreeGeometryCreator.js +0 -0
  26. package/build/{geometry → esm/geometry}/index.js +0 -0
  27. package/build/{index.js → esm/index.js} +1 -0
  28. package/build/{store → esm/store}/index.js +5 -1
  29. package/build/{store → esm/store}/states/buerli.js +0 -0
  30. package/build/{store → esm/store}/states/canvas.js +0 -0
  31. package/build/{store → esm/store}/states/drawing.js +0 -0
  32. package/build/{store → esm/store}/states/geometry.js +0 -0
  33. package/build/{store → esm/store}/states/graphic.js +0 -0
  34. package/build/{store → esm/store}/states/message.js +0 -0
  35. package/build/{store → esm/store}/states/plugin.js +1 -8
  36. package/build/{store → esm/store}/states/selection.js +35 -12
  37. package/build/{store → esm/store}/states/structure.js +0 -0
  38. package/build/{store → esm/store}/store.js +0 -0
  39. package/build/esm/store/subscribtion/selection.js +42 -0
  40. package/build/esm/store/subscribtion/subscribeToDrawing.js +5 -0
  41. package/build/{types → esm/types}/ErrorTypes.js +0 -0
  42. package/build/{types → esm/types}/IGraphicPackage.js +0 -0
  43. package/build/{types → esm/types}/IStructurePatch.js +0 -0
  44. package/build/{types → esm/types}/IStructureTree.js +0 -0
  45. package/build/{types → esm/types}/index.js +0 -0
  46. package/build/{utils → esm/utils}/Math.js +0 -0
  47. package/build/{utils → esm/utils}/Measure.js +0 -0
  48. package/build/{utils → esm/utils}/Timing.js +4 -0
  49. package/build/{geometry → types/geometry}/ThreeGeometryCreator.d.ts +0 -0
  50. package/build/{geometry → types/geometry}/index.d.ts +0 -0
  51. package/build/types/index.d.ts +36 -4
  52. package/build/{store → types/store}/index.d.ts +3 -0
  53. package/build/{store → types/store}/states/buerli.d.ts +0 -0
  54. package/build/{store → types/store}/states/canvas.d.ts +0 -0
  55. package/build/{store → types/store}/states/drawing.d.ts +0 -0
  56. package/build/{store → types/store}/states/geometry.d.ts +0 -0
  57. package/build/{store → types/store}/states/graphic.d.ts +0 -0
  58. package/build/{store → types/store}/states/message.d.ts +0 -0
  59. package/build/{store → types/store}/states/plugin.d.ts +1 -1
  60. package/build/{store → types/store}/states/selection.d.ts +1 -0
  61. package/build/{store → types/store}/states/structure.d.ts +0 -0
  62. package/build/{store → types/store}/store.d.ts +0 -0
  63. package/build/types/store/subscribtion/selection.d.ts +5 -0
  64. package/build/types/store/subscribtion/subscribeToDrawing.d.ts +2 -0
  65. package/build/types/{ErrorTypes.d.ts → types/ErrorTypes.d.ts} +0 -0
  66. package/build/types/{IGraphicPackage.d.ts → types/IGraphicPackage.d.ts} +0 -0
  67. package/build/types/{IStructurePatch.d.ts → types/IStructurePatch.d.ts} +0 -0
  68. package/build/types/{IStructureTree.d.ts → types/IStructureTree.d.ts} +0 -1
  69. package/build/types/types/index.d.ts +4 -0
  70. package/build/{utils → types/utils}/Math.d.ts +0 -0
  71. package/build/{utils → types/utils}/Measure.d.ts +0 -0
  72. package/build/{utils → types/utils}/Timing.d.ts +0 -0
  73. package/package.json +9 -6
  74. package/build/index.d.ts +0 -35
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ // This is the solution for cases when object was deleted from tree and we need to remove corresponding selectedItem.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.unsubscribeItems = exports.subscribeItems = exports.unsubs = void 0;
5
+ const __1 = require("../..");
6
+ const subscribeToDrawing_1 = require("./subscribeToDrawing");
7
+ // This object contains unsubscibe function for all existing selections in all drawings
8
+ exports.unsubs = {};
9
+ function getId(selectorId, itemId) {
10
+ return `${selectorId}_${itemId}`;
11
+ }
12
+ function subscribeItems(drawingId, selectorId, items) {
13
+ const items_ = items || __1.getDrawing(drawingId).selection.refs[selectorId].items;
14
+ items_.forEach(item => {
15
+ subscribeItem(drawingId, selectorId, item);
16
+ });
17
+ }
18
+ exports.subscribeItems = subscribeItems;
19
+ function subscribeItem(drawingId, selectorId, item) {
20
+ if (item.removeCondition && !exports.unsubs[getId(selectorId, item.id)]) {
21
+ const selApi = __1.getDrawing(drawingId).api.selection;
22
+ exports.unsubs[getId(selectorId, item.id)] = subscribeToDrawing_1.subscribeToDrawing(drawingId, (d) => item.removeCondition && item.removeCondition(d), (removeCond) => {
23
+ var _a;
24
+ // Unselect item whose removeCondition got true
25
+ if (removeCond) {
26
+ const newItems = ((_a = __1.getDrawing(drawingId).selection.refs[selectorId]) === null || _a === void 0 ? void 0 : _a.items) || [];
27
+ selApi.setItems(selectorId, newItems.filter(item_ => item_.id !== item.id));
28
+ }
29
+ });
30
+ }
31
+ }
32
+ function unsubscribeItems(drawingId, selectorId, items) {
33
+ const items_ = items || __1.getDrawing(drawingId).selection.refs[selectorId].items;
34
+ items_.forEach(item => {
35
+ unsubscribeItem(selectorId, item);
36
+ });
37
+ }
38
+ exports.unsubscribeItems = unsubscribeItems;
39
+ function unsubscribeItem(selectorId, item) {
40
+ if (item.removeCondition) {
41
+ const id = getId(selectorId, item.id);
42
+ if (exports.unsubs[id]) {
43
+ exports.unsubs[id]();
44
+ delete exports.unsubs[id];
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.subscribeToDrawing = void 0;
4
+ const store_1 = require("../store");
5
+ function subscribeToDrawing(drawingId, sel, callback) {
6
+ const unsub = store_1.api.subscribe(callback, state => state.drawing.refs[drawingId] && sel(state.drawing.refs[drawingId]));
7
+ return unsub;
8
+ }
9
+ exports.subscribeToDrawing = subscribeToDrawing;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Primitives = exports.LineSegments = exports.Surfaces = exports.AllTypes = exports.GraphicType = void 0;
4
+ var GraphicType;
5
+ (function (GraphicType) {
6
+ GraphicType["POINT"] = "point";
7
+ GraphicType["LINE"] = "line";
8
+ GraphicType["EDGE"] = "edge";
9
+ GraphicType["ARC"] = "arc";
10
+ GraphicType["CIRCLE"] = "circle";
11
+ GraphicType["PLANE"] = "plane";
12
+ GraphicType["CYLINDER"] = "cylinder";
13
+ GraphicType["CONE"] = "cone";
14
+ GraphicType["SPHERE"] = "sphere";
15
+ GraphicType["NURBS"] = "nurbs";
16
+ GraphicType["NURBSSURFACE"] = "nurbsSurface";
17
+ GraphicType["LOOP"] = "loop";
18
+ GraphicType["SOLID"] = "solid";
19
+ })(GraphicType = exports.GraphicType || (exports.GraphicType = {}));
20
+ const G = GraphicType;
21
+ exports.AllTypes = Object.keys(G).map(key => G[key]);
22
+ exports.Surfaces = [G.PLANE, G.CYLINDER, G.CONE, G.SPHERE, G.NURBS, G.NURBSSURFACE];
23
+ exports.LineSegments = [G.LINE, G.EDGE, G.ARC, G.CIRCLE];
24
+ exports.Primitives = exports.Surfaces.concat(exports.LineSegments).concat([G.POINT]);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MemberType = exports.NOID = exports.DEFAULT_STRUCTURE_TREE = void 0;
4
+ /**
5
+ * Defines the default structure tree.
6
+ * Should be used to initialize a new structure tree.
7
+ */
8
+ const DEFAULT_STRUCTURE_TREE = () => {
9
+ return {
10
+ tree: {},
11
+ root: exports.NOID,
12
+ currentProduct: exports.NOID,
13
+ currentNode: exports.NOID,
14
+ testRoot: exports.NOID,
15
+ };
16
+ };
17
+ exports.DEFAULT_STRUCTURE_TREE = DEFAULT_STRUCTURE_TREE;
18
+ /** Zero is no Id in classcad, and no object will exist in the CCDatabase for Id === 0! */
19
+ exports.NOID = 0;
20
+ var MemberType;
21
+ (function (MemberType) {
22
+ MemberType["ARRAY"] = "array";
23
+ MemberType["ID"] = "id";
24
+ MemberType["POINT"] = "point";
25
+ MemberType["REAL"] = "real";
26
+ MemberType["STRING"] = "string";
27
+ })(MemberType = exports.MemberType || (exports.MemberType = {}));
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./ErrorTypes"), exports);
14
+ __exportStar(require("./IGraphicPackage"), exports);
15
+ __exportStar(require("./IStructurePatch"), exports);
16
+ __exportStar(require("./IStructureTree"), exports);
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.MathUtils = void 0;
23
+ const THREE = __importStar(require("three"));
24
+ exports.MathUtils = {
25
+ convertToMatrix4: function (coordinateSystem) {
26
+ const [orig, vx, vy, vz] = coordinateSystem.map(row => new THREE.Vector3().fromArray(row));
27
+ return new THREE.Matrix4().makeBasis(vx, vy, vz).setPosition(orig);
28
+ },
29
+ convertToMatrix3: function (coordinateSystem) {
30
+ const [, vx, vy, vz] = coordinateSystem;
31
+ return new THREE.Matrix3().fromArray([...vx, ...vy, ...vz]);
32
+ },
33
+ };