@buerli.io/core 1.2.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.
- package/build/cjs/geometry/ThreeGeometryCreator.js +17 -7
- package/build/cjs/store/index.js +7 -7
- package/build/cjs/store/states/geometry.js +17 -7
- package/build/cjs/store/states/immutablePatch.js +1 -2
- package/build/cjs/store/states/plugin.js +2 -2
- package/build/cjs/store/states/structure.js +17 -7
- package/build/cjs/store/store.js +2 -5
- package/build/cjs/store/subscribtion/selection.js +3 -3
- package/build/cjs/store/subscribtion/subscribeToDrawing.js +1 -2
- package/build/cjs/utils/Math.js +17 -7
- package/build/cjs/utils/Measure.js +18 -9
- package/build/esm/store/store.js +2 -2
- package/build/esm/utils/Measure.js +0 -1
- package/build/types/geometry/ThreeGeometryCreator.d.ts +42 -42
- package/build/types/index.d.ts +17 -17
- package/build/types/re-export.d.ts +23 -23
- package/build/types/store/states/buerli.d.ts +3 -3
- package/build/types/store/states/cad.d.ts +5 -5
- package/build/types/store/states/drawing.d.ts +4 -4
- package/build/types/store/states/geometry.d.ts +6 -6
- package/build/types/store/states/graphic.d.ts +3 -3
- package/build/types/store/states/immutablePatch.d.ts +1 -1
- package/build/types/store/states/interaction.d.ts +3 -3
- package/build/types/store/states/message.d.ts +6 -6
- package/build/types/store/states/plugin.d.ts +10 -10
- package/build/types/store/states/selection.d.ts +13 -13
- package/build/types/store/states/structure.d.ts +3 -3
- package/build/types/store/store.d.ts +1 -1
- package/build/types/types/InteractionInfo.d.ts +3 -3
- package/build/types/utils/Measure.d.ts +8 -8
- package/build/types/utils/Timing.d.ts +1 -1
- package/package.json +17 -19
- 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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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"));
|
package/build/cjs/store/index.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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"));
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* jsonpatch behavior.
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.applyPatchImmutable =
|
|
26
|
+
exports.applyPatchImmutable = applyPatchImmutable;
|
|
27
27
|
/** '/a/b~1c/0' → ['a', 'b/c', '0'] with RFC 6901 unescaping (~1 → '/', ~0 → '~'). */
|
|
28
28
|
const parsePointer = (path) => {
|
|
29
29
|
if (path === '')
|
|
@@ -163,4 +163,3 @@ function applyPatchImmutable(doc, ops) {
|
|
|
163
163
|
applyOne(op);
|
|
164
164
|
return root;
|
|
165
165
|
}
|
|
166
|
-
exports.applyPatchImmutable = applyPatchImmutable;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
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,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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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.structureApi = exports.structureData = void 0;
|
|
27
37
|
const THREE = __importStar(require("three"));
|
package/build/cjs/store/store.js
CHANGED
|
@@ -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 =
|
|
4
|
+
const vanilla_1 = require("zustand/vanilla");
|
|
8
5
|
const buerli_1 = require("./states/buerli");
|
|
9
|
-
exports.api = (0, vanilla_1.
|
|
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.
|
|
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 =
|
|
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;
|
package/build/cjs/utils/Math.js
CHANGED
|
@@ -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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|
48
|
+
})(MeasureResultType || (exports.MeasureResultType = MeasureResultType = {}));
|
|
40
49
|
const tolerance = 1e-3;
|
|
41
50
|
exports.Measure = {
|
|
42
51
|
transform(items, drawingId) {
|
package/build/esm/store/store.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createStore } from 'zustand/vanilla';
|
|
2
2
|
import { createState } from './states/buerli';
|
|
3
|
-
export const api =
|
|
3
|
+
export const api = createStore()(createState);
|
|
@@ -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
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
214
|
+
type CommonProps = {
|
|
215
215
|
graphicId: GraphicID;
|
|
216
216
|
type: GraphicType;
|
|
217
217
|
};
|
|
218
|
-
export
|
|
219
|
-
export
|
|
220
|
-
export
|
|
221
|
-
export
|
|
222
|
-
export
|
|
223
|
-
export
|
|
224
|
-
export
|
|
225
|
-
export
|
|
226
|
-
export
|
|
227
|
-
export
|
|
228
|
-
export
|
|
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
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
export
|
|
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
|
|
252
|
-
export
|
|
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;
|
package/build/types/index.d.ts
CHANGED
|
@@ -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
|
|
17
|
+
export type BuerliState = BS;
|
|
18
18
|
import { DrawingAPI as DrawingAPI1, DrawingID as DrawingID1, DrawingState as DrawingState1 } from './store/states/drawing';
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
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
|
|
24
|
-
export
|
|
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
|
|
27
|
-
export
|
|
28
|
-
export
|
|
29
|
-
export
|
|
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
|
|
32
|
-
export
|
|
33
|
-
export
|
|
34
|
-
export
|
|
35
|
-
export
|
|
36
|
-
export
|
|
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
|
|
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
|
|
26
|
+
export type IStructureTree = ScgTree;
|
|
27
27
|
/** @deprecated */
|
|
28
|
-
export
|
|
28
|
+
export type IStructureProtocol = ScgStructure;
|
|
29
29
|
/** @deprecated */
|
|
30
|
-
export
|
|
30
|
+
export type IStructureObject = ScgObject;
|
|
31
31
|
/** @deprecated */
|
|
32
|
-
export
|
|
32
|
+
export type IStructureMember = ScgMember;
|
|
33
33
|
/** @deprecated */
|
|
34
|
-
export
|
|
34
|
+
export type IStructurePatch = ScgStructurePatchOp;
|
|
35
35
|
/** @deprecated */
|
|
36
|
-
export
|
|
36
|
+
export type IGraphicPackage = ScgGraphicPackage;
|
|
37
37
|
/** @deprecated */
|
|
38
|
-
export
|
|
38
|
+
export type IGraphicElement = ScgGraphicElement;
|
|
39
39
|
/** @deprecated */
|
|
40
|
-
export
|
|
40
|
+
export type IGraphicContainer = ScgGraphicContainer;
|
|
41
41
|
/** @deprecated */
|
|
42
|
-
export
|
|
42
|
+
export type IGraphicArc = ScgGraphicArc;
|
|
43
43
|
/** @deprecated */
|
|
44
|
-
export
|
|
44
|
+
export type IGraphicCone = ScgGraphicCone;
|
|
45
45
|
/** @deprecated */
|
|
46
|
-
export
|
|
46
|
+
export type IGraphicCylinder = ScgGraphicCylinder;
|
|
47
47
|
/** @deprecated */
|
|
48
|
-
export
|
|
48
|
+
export type IGraphicEdge = ScgGraphicEdge;
|
|
49
49
|
/** @deprecated */
|
|
50
|
-
export
|
|
50
|
+
export type IGraphicLine = ScgGraphicLine;
|
|
51
51
|
/** @deprecated */
|
|
52
|
-
export
|
|
52
|
+
export type IGraphicMesh = ScgGraphicMesh;
|
|
53
53
|
/** @deprecated */
|
|
54
|
-
export
|
|
54
|
+
export type IGraphicPlane = ScgGraphicPlane;
|
|
55
55
|
/** @deprecated */
|
|
56
|
-
export
|
|
56
|
+
export type IGraphicSphere = ScgGraphicSphere;
|
|
57
57
|
/** @deprecated */
|
|
58
|
-
export
|
|
58
|
+
export type PointMemValue = ScgPoint;
|
|
59
59
|
/** @deprecated */
|
|
60
|
-
export
|
|
60
|
+
export type ArrayMem = ScgArrayMem;
|
|
61
61
|
/** @deprecated */
|
|
62
|
-
export
|
|
62
|
+
export type IdMem = ScgIdMem;
|
|
63
63
|
/** @deprecated */
|
|
64
|
-
export
|
|
64
|
+
export type PointMem = ScgPointMem;
|
|
65
65
|
/** @deprecated */
|
|
66
|
-
export
|
|
66
|
+
export type RealMem = ScgRealMem;
|
|
67
67
|
/** @deprecated */
|
|
68
|
-
export
|
|
68
|
+
export type StringMem = ScgStringMem;
|
|
69
69
|
/** @deprecated */
|
|
70
|
-
export
|
|
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
|
-
|
|
6
|
+
type GeneralApi = {
|
|
7
7
|
init(options?: Partial<BuerliState['options']>): void;
|
|
8
8
|
};
|
|
9
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
28
|
+
export type CadApi = ReturnType<typeof cadApi>;
|
|
29
29
|
export declare const cadData: () => CadData;
|
|
30
|
-
export declare const cadApi: (set: StoreApi<DrawingState>[
|
|
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
|
|
20
|
-
export
|
|
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
|
-
|
|
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
|
|
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;
|
|
@@ -4,18 +4,18 @@ import { ContainerGeometryT, GeometryElement } from '../../geometry/ThreeGeometr
|
|
|
4
4
|
import { GraphicID, ObjectID } from '../../re-export';
|
|
5
5
|
import { BuerliState } from './buerli';
|
|
6
6
|
import { DrawingState } from './drawing';
|
|
7
|
-
export
|
|
7
|
+
export type GeometryBounds = {
|
|
8
8
|
center: THREE.Vector3;
|
|
9
9
|
radius: number;
|
|
10
10
|
max: THREE.Vector3;
|
|
11
11
|
min: THREE.Vector3;
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
type ElementConfig = {
|
|
14
14
|
hidden?: boolean;
|
|
15
15
|
color?: any;
|
|
16
16
|
opacity?: number;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type GeometryConfig = {
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
meshes?: ElementConfig & {
|
|
21
21
|
wireframe?: boolean;
|
|
@@ -24,7 +24,7 @@ export declare type GeometryConfig = {
|
|
|
24
24
|
edges?: ElementConfig;
|
|
25
25
|
points?: ElementConfig;
|
|
26
26
|
};
|
|
27
|
-
export
|
|
27
|
+
export type GeometryData = {
|
|
28
28
|
cache: Record<ObjectID, // The id of the CADEntity
|
|
29
29
|
// The id of the CADEntity
|
|
30
30
|
ContainerGeometryT & {
|
|
@@ -42,9 +42,9 @@ export declare type GeometryData = {
|
|
|
42
42
|
product: Record<ObjectID, GeometryConfig>;
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
|
-
export
|
|
45
|
+
export type GeometryApi = ReturnType<typeof geometryApi>;
|
|
46
46
|
export declare const geometryData: () => GeometryData;
|
|
47
|
-
export declare const geometryApi: (set: StoreApi<DrawingState>[
|
|
47
|
+
export declare const geometryApi: (set: StoreApi<DrawingState>["setState"], get: StoreApi<DrawingState>["getState"], buerliApi: StoreApi<BuerliState>) => {
|
|
48
48
|
/**
|
|
49
49
|
* Updates the @see geometry.bounds depending on all products of the model.
|
|
50
50
|
* The update will only happen, if at least one solid of one product is available.
|
|
@@ -2,12 +2,12 @@ import { StoreApi } from 'zustand';
|
|
|
2
2
|
import { IGraphicContainer, IGraphicElement, IGraphicPackage, ObjectID } from '../../re-export';
|
|
3
3
|
import { BuerliState } from './buerli';
|
|
4
4
|
import { DrawingState } from './drawing';
|
|
5
|
-
export
|
|
5
|
+
export type GraphicData = {
|
|
6
6
|
containers: Record<number, IGraphicContainer>;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type GraphicApi = ReturnType<typeof graphicApi>;
|
|
9
9
|
export declare const graphicData: () => GraphicData;
|
|
10
|
-
export declare const graphicApi: (set: StoreApi<DrawingState>[
|
|
10
|
+
export declare const graphicApi: (set: StoreApi<DrawingState>["setState"], get: StoreApi<DrawingState>["getState"], buerliApi: StoreApi<BuerliState>) => {
|
|
11
11
|
addPackages: (packages: IGraphicPackage | IGraphicPackage[]) => void;
|
|
12
12
|
cleanupGraphicRecords: () => void;
|
|
13
13
|
filter: (cb: (elem: IGraphicElement) => boolean, options?: {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* paths/ops — the caller decides how to recover, exactly like the previous
|
|
22
22
|
* jsonpatch behavior.
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
24
|
+
export type JsonPatchOp = {
|
|
25
25
|
op: 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test';
|
|
26
26
|
path: string;
|
|
27
27
|
value?: unknown;
|
|
@@ -2,13 +2,13 @@ import { StoreApi } from 'zustand';
|
|
|
2
2
|
import { InteractionInfo } from '../../types';
|
|
3
3
|
import { BuerliState } from './buerli';
|
|
4
4
|
import { DrawingState } from './drawing';
|
|
5
|
-
export
|
|
5
|
+
export type InteractionData = {
|
|
6
6
|
hovered?: InteractionInfo | null;
|
|
7
7
|
selected?: InteractionInfo[];
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type InteractionApi = ReturnType<typeof interactionApi>;
|
|
10
10
|
export declare const interactionData: () => InteractionData;
|
|
11
|
-
export declare const interactionApi: (set: StoreApi<DrawingState>[
|
|
11
|
+
export declare const interactionApi: (set: StoreApi<DrawingState>["setState"], get: StoreApi<DrawingState>["getState"], buerliApi: StoreApi<BuerliState>) => {
|
|
12
12
|
/**
|
|
13
13
|
* Sets the hovered item in the store to the given item.
|
|
14
14
|
*
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { StoreApi } from 'zustand';
|
|
2
2
|
import { BuerliState } from './buerli';
|
|
3
3
|
import { DrawingID } from './drawing';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type MessageScope = string | number;
|
|
5
|
+
export type MessageID = string;
|
|
6
6
|
export declare const BuerliMessageScope: MessageScope;
|
|
7
|
-
export
|
|
7
|
+
export type Message = {
|
|
8
8
|
text: string;
|
|
9
9
|
title?: string;
|
|
10
10
|
scope?: MessageScope;
|
|
@@ -14,7 +14,7 @@ export declare type Message = {
|
|
|
14
14
|
drawingId?: DrawingID;
|
|
15
15
|
duration?: number;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type MessageState = {
|
|
18
18
|
message: {
|
|
19
19
|
data: (Message & {
|
|
20
20
|
id: MessageID;
|
|
@@ -23,8 +23,8 @@ export declare type MessageState = {
|
|
|
23
23
|
api: ReturnType<typeof messageApi>;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
export declare const getInitialMessageState: (set: StoreApi<BuerliState>[
|
|
27
|
-
declare const messageApi: (set: StoreApi<BuerliState>[
|
|
26
|
+
export declare const getInitialMessageState: (set: StoreApi<BuerliState>["setState"], get: StoreApi<BuerliState>["getState"], api: StoreApi<BuerliState>) => MessageState;
|
|
27
|
+
declare const messageApi: (set: StoreApi<BuerliState>["setState"], get: StoreApi<BuerliState>["getState"], api: StoreApi<BuerliState>) => {
|
|
28
28
|
show(message: Message): MessageID;
|
|
29
29
|
update(id: MessageID, message: Message): void;
|
|
30
30
|
close(id: MessageID): void;
|
|
@@ -2,7 +2,7 @@ import { StoreApi } from 'zustand';
|
|
|
2
2
|
import { ObjectID } from '../../re-export';
|
|
3
3
|
import { BuerliState } from './buerli';
|
|
4
4
|
import { DrawingID, DrawingState } from './drawing';
|
|
5
|
-
export
|
|
5
|
+
export type PluginDescription<InternalState = any> = {
|
|
6
6
|
name: string;
|
|
7
7
|
version: string;
|
|
8
8
|
author: string;
|
|
@@ -11,7 +11,7 @@ export declare type PluginDescription<InternalState = any> = {
|
|
|
11
11
|
initialState?: ((drawingId: DrawingID, objectId: ObjectID) => InternalState) | InternalState;
|
|
12
12
|
[key: string]: any;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
type StateData<InternalState extends Record<any, any>> = PluginDescription<InternalState> & {
|
|
15
15
|
id: PluginID;
|
|
16
16
|
Root: ((options?: any) => any) | null;
|
|
17
17
|
View: ((options?: any) => any) | null;
|
|
@@ -20,16 +20,16 @@ declare type StateData<InternalState extends Record<any, any>> = PluginDescripti
|
|
|
20
20
|
state: InternalState;
|
|
21
21
|
set: (sel: Partial<InternalState> | ((state: InternalState) => Partial<InternalState>)) => void;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type Plugin = {
|
|
24
24
|
Root?: ((options?: any) => any) | null;
|
|
25
25
|
View?: ((options?: any) => any) | null;
|
|
26
26
|
description: PluginDescription;
|
|
27
27
|
};
|
|
28
|
-
export
|
|
29
|
-
export
|
|
30
|
-
export
|
|
31
|
-
export
|
|
32
|
-
export
|
|
28
|
+
export type PluginDef = Plugin | Promise<Plugin>;
|
|
29
|
+
export type PluginImpl = PluginDef | (() => Plugin) | (() => Promise<Plugin>);
|
|
30
|
+
export type PluginID = ObjectID | string;
|
|
31
|
+
export type PluginState<InternalState extends Record<any, any> = any> = Readonly<StateData<InternalState>>;
|
|
32
|
+
export type PluginData = {
|
|
33
33
|
/** Contains ids of feature-plugins */
|
|
34
34
|
feature: PluginID[];
|
|
35
35
|
/** Contains ids of global-plugins */
|
|
@@ -41,9 +41,9 @@ export declare type PluginData = {
|
|
|
41
41
|
};
|
|
42
42
|
visible: PluginID[];
|
|
43
43
|
};
|
|
44
|
-
export
|
|
44
|
+
export type PluginApi = ReturnType<typeof pluginApi>;
|
|
45
45
|
export declare const pluginData: () => PluginData;
|
|
46
|
-
export declare const pluginApi: (set: StoreApi<DrawingState>[
|
|
46
|
+
export declare const pluginApi: (set: StoreApi<DrawingState>["setState"], get: StoreApi<DrawingState>["getState"], buerliApi: StoreApi<BuerliState>) => {
|
|
47
47
|
setActiveFeature: (id: ObjectID | null) => void;
|
|
48
48
|
setVisiblePlugin: (id: PluginID, visible: boolean) => void;
|
|
49
49
|
setActiveGlobal: (id: PluginID, active: boolean) => void;
|
|
@@ -4,18 +4,18 @@ import { GeometryElement, ProductElement } from './../../geometry/ThreeGeometryC
|
|
|
4
4
|
import { BuerliState } from './buerli';
|
|
5
5
|
import { DrawingState } from './drawing';
|
|
6
6
|
export declare const BuerliScope = "ClassCAD";
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
7
|
+
export type SelectorID = string | number;
|
|
8
|
+
export type SeletedItemData<T> = Record<string, T>;
|
|
9
|
+
export type SelectionScope = string | number;
|
|
10
|
+
export type SelectedItem<T extends SeletedItemData<any> = any> = {
|
|
11
11
|
readonly id: any;
|
|
12
12
|
readonly scope: SelectionScope;
|
|
13
13
|
readonly data: T;
|
|
14
14
|
readonly label?: any;
|
|
15
15
|
readonly removeCondition?: (d: DrawingState) => boolean;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
18
|
-
export
|
|
17
|
+
export type SelectionFilter<T = any> = (scope: SelectionScope, data: T) => boolean;
|
|
18
|
+
export type CustomSelect = (selectorId: SelectorID, newItems: SelectedItem[], diff: SelectedItem[], options?: {
|
|
19
19
|
[key: string]: any;
|
|
20
20
|
}) => void;
|
|
21
21
|
/**
|
|
@@ -27,7 +27,7 @@ export declare type CustomSelect = (selectorId: SelectorID, newItems: SelectedIt
|
|
|
27
27
|
* @property {(selectorId: SelectorID, items: SelectedItem[]) => void} customSelect - if customSelect is provided, it overrides setting of new items in select(..) api method. In this case user is responsible to update selector.items via setItems.
|
|
28
28
|
* @property {(selectorId: SelectorID, items: SelectedItem[]) => void} customUnSelect - if customSelect is provided, it overrides setting of new items in unselect(..) api method. In this case user is responsible to update selector.items via setItems.
|
|
29
29
|
*/
|
|
30
|
-
export
|
|
30
|
+
export type Selector<T extends SeletedItemData<any> = any> = {
|
|
31
31
|
readonly isSelectable: SelectionFilter;
|
|
32
32
|
readonly items: Array<SelectedItem<T>>;
|
|
33
33
|
readonly hoveredItem: SelectedItem<T> | null;
|
|
@@ -35,22 +35,22 @@ export declare type Selector<T extends SeletedItemData<any> = any> = {
|
|
|
35
35
|
readonly customSelect?: CustomSelect;
|
|
36
36
|
readonly customUnSelect?: CustomSelect;
|
|
37
37
|
};
|
|
38
|
-
export
|
|
38
|
+
export type SelectionData = {
|
|
39
39
|
readonly refs: Record<SelectorID, Selector>;
|
|
40
40
|
readonly active: SelectorID | null;
|
|
41
41
|
};
|
|
42
|
-
export
|
|
42
|
+
export type SelectionApi = ReturnType<typeof selectionApi>;
|
|
43
43
|
export declare const selectionData: () => SelectionData;
|
|
44
|
-
export declare const selectionApi: (set: StoreApi<DrawingState>[
|
|
44
|
+
export declare const selectionApi: (set: StoreApi<DrawingState>["setState"], get: StoreApi<DrawingState>["getState"], buerliApi: StoreApi<BuerliState>) => {
|
|
45
45
|
unselectAll(selectorId?: SelectorID, options?: {
|
|
46
46
|
[key: string]: any;
|
|
47
|
-
}
|
|
47
|
+
}): void;
|
|
48
48
|
unselect(items: SelectedItem | SelectedItem[], selectorId?: SelectorID, options?: {
|
|
49
49
|
[key: string]: any;
|
|
50
|
-
}
|
|
50
|
+
}): void;
|
|
51
51
|
select(items: SelectedItem | SelectedItem[], selectorId?: SelectorID, options?: {
|
|
52
52
|
[key: string]: any;
|
|
53
|
-
}
|
|
53
|
+
}): void;
|
|
54
54
|
setHovered(item: SelectedItem | null, selectorId?: SelectorID): void;
|
|
55
55
|
activateSelector(selectorId: SelectorID | null): void;
|
|
56
56
|
createSelector(selectorId: SelectorID, filter: SelectionFilter, activate?: boolean, initialItems?: SelectedItem[], maxLen?: number, customSelect?: CustomSelect, customUnSelect?: CustomSelect): () => void;
|
|
@@ -3,13 +3,13 @@ import { StoreApi } from 'zustand';
|
|
|
3
3
|
import { GraphicID, IStructureObject, IStructurePatch, IStructureProtocol, IStructureTree, ObjectID } from '../../re-export';
|
|
4
4
|
import { BuerliState } from './buerli';
|
|
5
5
|
import { DrawingState } from './drawing';
|
|
6
|
-
export
|
|
6
|
+
export type StructureData = IStructureProtocol & {
|
|
7
7
|
products: ObjectID[];
|
|
8
8
|
visibleContainers: GraphicID[];
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type StructureApi = ReturnType<typeof structureApi>;
|
|
11
11
|
export declare const structureData: () => StructureData;
|
|
12
|
-
export declare const structureApi: (set: StoreApi<DrawingState>[
|
|
12
|
+
export declare const structureApi: (set: StoreApi<DrawingState>["setState"], get: StoreApi<DrawingState>["getState"], buerliApi: StoreApi<BuerliState>) => {
|
|
13
13
|
get: () => StructureData;
|
|
14
14
|
set: (structure: IStructureProtocol) => void;
|
|
15
15
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { BuerliState } from './states/buerli';
|
|
2
|
-
export declare const api: import("zustand
|
|
2
|
+
export declare const api: import("zustand").StoreApi<BuerliState>;
|
|
@@ -2,7 +2,7 @@ import { GraphicID, ObjectID } from '../re-export';
|
|
|
2
2
|
/**
|
|
3
3
|
* It contains general information that can be used to identify CCObjects as well as Brep Elements.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type InteractionInfo<T = any> = {
|
|
6
6
|
/**
|
|
7
7
|
* Unique identifier of the interaction info.
|
|
8
8
|
*/
|
|
@@ -38,5 +38,5 @@ export declare type InteractionInfo<T = any> = {
|
|
|
38
38
|
*/
|
|
39
39
|
userData?: T;
|
|
40
40
|
};
|
|
41
|
-
export declare const createInfo: (data: Omit<InteractionInfo,
|
|
42
|
-
export declare const createUniqueIdent: (data: Omit<InteractionInfo,
|
|
41
|
+
export declare const createInfo: (data: Omit<InteractionInfo, "uniqueIdent">) => InteractionInfo;
|
|
42
|
+
export declare const createUniqueIdent: (data: Omit<InteractionInfo, "uniqueIdent">) => string;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { ArcGeometry, LineGeometry, PlaneGeometry, PointGeometry, ProductElement } from './../geometry';
|
|
3
3
|
import { DrawingID } from './../store/states/drawing';
|
|
4
|
-
export
|
|
4
|
+
export type ValueMeasureData = {
|
|
5
5
|
value: number;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type LinearMeasureData = {
|
|
8
8
|
value: number;
|
|
9
9
|
start: THREE.Vector3;
|
|
10
10
|
end: THREE.Vector3;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type AngularMeasureData = {
|
|
13
13
|
value: number;
|
|
14
14
|
center: THREE.Vector3;
|
|
15
15
|
dir1: THREE.Vector3;
|
|
16
16
|
dir2: THREE.Vector3;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type PositionMeasureData = {
|
|
19
19
|
value: THREE.Vector3;
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type VectorMeasureData = {
|
|
22
22
|
value: THREE.Vector3;
|
|
23
23
|
start: THREE.Vector3;
|
|
24
24
|
end: THREE.Vector3;
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
type MeasureData = LinearMeasureData | AngularMeasureData | PositionMeasureData | VectorMeasureData | ValueMeasureData;
|
|
27
27
|
export declare enum MeasureResultType {
|
|
28
28
|
NONE = "none",
|
|
29
29
|
VALUE = "value",
|
|
@@ -32,12 +32,12 @@ export declare enum MeasureResultType {
|
|
|
32
32
|
VECTOR = "vector",
|
|
33
33
|
POSITION = "position"
|
|
34
34
|
}
|
|
35
|
-
export
|
|
35
|
+
export type MeasureResult = {
|
|
36
36
|
description: string;
|
|
37
37
|
type: MeasureResultType;
|
|
38
38
|
measureData?: MeasureData;
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
type Item = ProductElement;
|
|
41
41
|
export declare const Measure: {
|
|
42
42
|
transform(items: Item[], drawingId: DrawingID): Item[];
|
|
43
43
|
getInfo(objects: Item[], drawingId: DrawingID): MeasureResult[];
|
package/package.json
CHANGED
|
@@ -1,43 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buerli.io/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.20261016085358",
|
|
4
4
|
"description": "buerli state management",
|
|
5
5
|
"author": "AWV Informatik AG <info@awv-informatik.ch>",
|
|
6
6
|
"license": "ISC",
|
|
7
|
-
"repository": {
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/awv-informatik/buerli.git",
|
|
10
|
+
"directory": "packages/core"
|
|
11
|
+
},
|
|
8
12
|
"main": "build/cjs/index.js",
|
|
9
13
|
"module": "build/esm/index.js",
|
|
10
14
|
"types": "build/types/index.d.ts",
|
|
11
15
|
"sideEffects": false,
|
|
12
16
|
"scripts": {
|
|
13
|
-
"ver": "yarn version --no-commit-hooks --no-git-tag-version --new-version",
|
|
14
17
|
"prepack": "npm run clean && npm run build -- --sourceMap false && npm run build:cjs -- --sourceMap false",
|
|
15
18
|
"clean": "rimraf ./build* && rimraf ./coverage && rimraf tsconfig.tsbuildinfo",
|
|
16
19
|
"build": "tsc -v && tsc",
|
|
17
|
-
"build:cjs": "tsc --target es2017 --module commonjs --composite false --declaration false --declarationDir null --outDir ./build/cjs",
|
|
20
|
+
"build:cjs": "tsc --target es2017 --module commonjs --moduleResolution node10 --ignoreDeprecations 6.0 --composite false --declaration false --declarationDir null --outDir ./build/cjs",
|
|
18
21
|
"lint": "eslint \"./src/**/*.ts?(x)\"",
|
|
19
|
-
"test": "
|
|
20
|
-
"coverage": "npm run clean && npm run build && npm run jestLite -- --coverage",
|
|
22
|
+
"test": "vitest run",
|
|
21
23
|
"prettify": "prettier --write \"./{src,tests}/**/*.{js,jsx,ts,tsx,json}\""
|
|
22
24
|
},
|
|
23
25
|
"devDependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"jest": "^26.1.0",
|
|
31
|
-
"rimraf": "^2.6.3",
|
|
32
|
-
"three": "^0.153",
|
|
33
|
-
"typescript": "4.8.4"
|
|
26
|
+
"@types/three": "~0.184.1",
|
|
27
|
+
"rimraf": "^6.1.3",
|
|
28
|
+
"three": "~0.184.0",
|
|
29
|
+
"typescript": "~6.0.3",
|
|
30
|
+
"vite": "^8.3.4",
|
|
31
|
+
"vitest": "^5.0.4"
|
|
34
32
|
},
|
|
35
33
|
"dependencies": {
|
|
36
34
|
"@classcad/api-js": "https://awvstatic.com/classcad/download/release/21.2.0/js/classcad-api-js-21.2.0.tgz",
|
|
37
|
-
"uuid": "^
|
|
38
|
-
"zustand": "^
|
|
35
|
+
"uuid": "^11.1.1",
|
|
36
|
+
"zustand": "^5.0.15"
|
|
39
37
|
},
|
|
40
38
|
"peerDependencies": {
|
|
41
|
-
"three": ">=0.
|
|
39
|
+
"three": ">=0.170"
|
|
42
40
|
}
|
|
43
41
|
}
|