ducjs 4.0.4 → 4.2.0
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/dist/duc_locator_wasm.d.ts +48 -0
- package/dist/duc_locator_wasm.js +296 -0
- package/dist/duc_locator_wasm_bg.wasm +0 -0
- package/dist/duc_locator_wasm_bg.wasm.d.ts +13 -0
- package/dist/ducjs_wasi.wasm +0 -0
- package/dist/ducjs_wasm.d.ts +14 -2
- package/dist/ducjs_wasm.js +96 -8
- package/dist/ducjs_wasm_bg.wasm +0 -0
- package/dist/ducjs_wasm_bg.wasm.d.ts +6 -2
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/locator-runtime.d.ts +4 -0
- package/dist/locator-runtime.js +7 -0
- package/dist/restore/index.d.ts +1 -0
- package/dist/restore/index.js +1 -0
- package/dist/restore/restoreDataState.d.ts +13 -24
- package/dist/restore/restoreDataState.js +49 -83
- package/dist/restore/restoreElements.d.ts +10 -15
- package/dist/restore/restoreElements.js +128 -125
- package/dist/restore/updateModelCode.d.ts +11 -0
- package/dist/restore/updateModelCode.js +63 -0
- package/dist/thumbnails/bounds.d.ts +21 -0
- package/dist/thumbnails/bounds.js +84 -0
- package/dist/thumbnails/browserRunner.d.ts +60 -0
- package/dist/thumbnails/browserRunner.js +446 -0
- package/dist/thumbnails/cameraPresets.d.ts +47 -0
- package/dist/thumbnails/cameraPresets.js +222 -0
- package/dist/thumbnails/cli.d.ts +2 -0
- package/dist/thumbnails/cli.js +102 -0
- package/dist/thumbnails/index.d.ts +11 -0
- package/dist/thumbnails/index.js +11 -0
- package/dist/thumbnails/lib/clientBundle.min.js +10427 -0
- package/dist/thumbnails/lib/clientEntry.d.ts +3 -0
- package/dist/thumbnails/lib/clientEntry.js +8 -0
- package/dist/thumbnails/lib/clippingUtils.d.ts +10 -0
- package/dist/thumbnails/lib/clippingUtils.js +3 -0
- package/dist/thumbnails/lib/defaultModelColor.d.ts +3 -0
- package/dist/thumbnails/lib/defaultModelColor.js +22 -0
- package/dist/thumbnails/lib/index.d.ts +12 -0
- package/dist/thumbnails/lib/index.js +12 -0
- package/dist/thumbnails/lib/mapViewerStateToOptions.d.ts +34 -0
- package/dist/thumbnails/lib/mapViewerStateToOptions.js +69 -0
- package/dist/thumbnails/lib/offscreen-dxf-thumbnail.d.ts +16 -0
- package/dist/thumbnails/lib/offscreen-dxf-thumbnail.js +173 -0
- package/dist/thumbnails/lib/offscreen-model-thumbnail.d.ts +16 -0
- package/dist/thumbnails/lib/offscreen-model-thumbnail.js +209 -0
- package/dist/thumbnails/lib/parametricClip.d.ts +18 -0
- package/dist/thumbnails/lib/parametricClip.js +177 -0
- package/dist/thumbnails/lib/parametricShapes.d.ts +1 -0
- package/dist/thumbnails/lib/parametricShapes.js +75 -0
- package/dist/thumbnails/lib/parametricViewerState.d.ts +26 -0
- package/dist/thumbnails/lib/parametricViewerState.js +198 -0
- package/dist/thumbnails/lib/thumbnail-camera-fit.d.ts +6 -0
- package/dist/thumbnails/lib/thumbnail-camera-fit.js +292 -0
- package/dist/thumbnails/lib/thumbnail-capture.d.ts +23 -0
- package/dist/thumbnails/lib/thumbnail-capture.js +161 -0
- package/dist/thumbnails/lib/thumbnail-visibility.d.ts +12 -0
- package/dist/thumbnails/lib/thumbnail-visibility.js +97 -0
- package/dist/thumbnails/lib/viewerGrid.d.ts +13 -0
- package/dist/thumbnails/lib/viewerGrid.js +57 -0
- package/dist/thumbnails/modelCache.d.ts +56 -0
- package/dist/thumbnails/modelCache.js +165 -0
- package/dist/thumbnails/modelOutputArtifact.d.ts +19 -0
- package/dist/thumbnails/modelOutputArtifact.js +87 -0
- package/dist/thumbnails/render.d.ts +45 -0
- package/dist/thumbnails/render.js +162 -0
- package/dist/thumbnails/templates.d.ts +16 -0
- package/dist/thumbnails/templates.js +786 -0
- package/dist/thumbnails/tessellator.d.ts +33 -0
- package/dist/thumbnails/tessellator.js +349 -0
- package/dist/thumbnails/types.d.ts +233 -0
- package/dist/thumbnails/types.js +1 -0
- package/dist/thumbnails/worker.d.ts +10 -0
- package/dist/thumbnails/worker.js +119 -0
- package/dist/transform.d.ts +1 -1
- package/dist/transform.js +20 -22
- package/dist/types/elements/index.d.ts +22 -28
- package/dist/types/elements/index.js +0 -1
- package/dist/types/geometry.types.d.ts +5 -5
- package/dist/types/index.d.ts +13 -59
- package/dist/types/index.js +0 -1
- package/dist/types/issues.types.d.ts +1 -2
- package/dist/utils/bounds.d.ts +10 -11
- package/dist/utils/bounds.js +105 -84
- package/dist/utils/constants.d.ts +5 -7
- package/dist/utils/constants.js +10 -15
- package/dist/utils/elements/freedrawElement.js +6 -3
- package/dist/utils/elements/index.d.ts +2 -6
- package/dist/utils/elements/index.js +4 -9
- package/dist/utils/elements/linearElement.d.ts +12 -14
- package/dist/utils/elements/linearElement.js +81 -66
- package/dist/utils/elements/newElement.d.ts +37 -22
- package/dist/utils/elements/newElement.js +70 -64
- package/dist/utils/elements/textElement.d.ts +34 -35
- package/dist/utils/elements/textElement.js +79 -83
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/locator.d.ts +43 -0
- package/dist/utils/locator.js +112 -0
- package/dist/utils/math/bbox.d.ts +1 -2
- package/dist/utils/math/geometry.js +5 -4
- package/dist/utils/math/index.d.ts +13 -17
- package/dist/utils/math/index.js +53 -41
- package/dist/utils/math/random.js +7 -2
- package/dist/utils/normalize.d.ts +5 -5
- package/dist/utils/normalize.js +15 -10
- package/dist/utils/shape.d.ts +3 -4
- package/dist/utils/shape.js +64 -48
- package/dist/utils/state/index.d.ts +3 -4
- package/dist/utils/state/index.js +8 -23
- package/dist/wasi.js +38 -12
- package/package.json +23 -9
- package/dist/technical/index.d.ts +0 -2
- package/dist/technical/index.js +0 -2
- package/dist/technical/measurements.d.ts +0 -31
- package/dist/technical/measurements.js +0 -64
- package/dist/technical/scopes.d.ts +0 -261
- package/dist/technical/scopes.js +0 -676
- package/dist/types/typeChecks.d.ts +0 -5
- package/dist/types/typeChecks.js +0 -10
- package/dist/utils/traverse.d.ts +0 -30
- package/dist/utils/traverse.js +0 -124
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, getScopedBezierPointFromDucPoint, NEUTRAL_SCOPE, ScaleFactors } from "../technical/scopes";
|
|
2
1
|
import { isElbowArrow, isLinearElement, isTextElement, } from "../types";
|
|
3
2
|
import { arrayToMap, bumpVersion, DEFAULT_ELEMENT_PROPS, DEFAULT_ELLIPSE_ELEMENT, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FREEDRAW_ELEMENT, detectLineHeight, FONT_FAMILY, getContainerElement, getDefaultTableData, getNormalizedDimensions, getNormalizedPoints, getSizeFromPoints, getUpdatedTimestamp, isInvisiblySmallElement, LINE_CONFIRM_THRESHOLD, mergeOverlappingPoints, migratePoints, normalizeFixedPoint, normalizeLink, randomId, refreshTextDimensions, validateClosedPath } from "../utils";
|
|
4
3
|
import { isValidBezierMirroringValue, isValidBlendingValue, isValidBoolean, isValidBoolean as isValidBooleanValue, // Renaming to avoid conflict
|
|
5
|
-
isValidColor, isValidDucHead, isValidFunction, isValidImageScaleValue, isValidImageStatusValue, isValidPercentageValue, isValidPolygonSides, isValidRadianValue, isValidString, isValidTextAlignValue, isValidVerticalAlignValue, restoreDucStackProperties,
|
|
4
|
+
isValidColor, isValidDucHead, isValidFunction, isValidImageScaleValue, isValidImageStatusValue, isValidPercentageValue, isValidPolygonSides, isValidRadianValue, isValidString, isValidTextAlignValue, isValidVerticalAlignValue, restoreDucStackProperties, restoreNumber, validateBackground, validateStroke } from "./restoreDataState";
|
|
5
|
+
import { updateModelCodeElementIds } from "./updateModelCode";
|
|
6
6
|
import { LINE_SPACING_TYPE, } from "../enums";
|
|
7
7
|
const PARAMETRIC_SOURCE_TYPE = { CODE: 10, FILE: 11 };
|
|
8
8
|
import tinycolor from "tinycolor2";
|
|
9
9
|
const restoreElementWithProperties = (element, extra, localState, globalState) => {
|
|
10
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
11
11
|
const _element = Object.assign(Object.assign({}, element), extra);
|
|
12
|
-
const elementScope = isValidElementScopeValue(_element.scope, globalState === null || globalState === void 0 ? void 0 : globalState.mainScope);
|
|
13
|
-
const currentScope = isValidElementScopeValue(localState === null || localState === void 0 ? void 0 : localState.scope, globalState === null || globalState === void 0 ? void 0 : globalState.mainScope);
|
|
14
12
|
// Handle legacy stroke properties first
|
|
15
13
|
let stroke = [DEFAULT_ELEMENT_PROPS.stroke];
|
|
16
14
|
if (_element.strokeColor) {
|
|
17
15
|
// Legacy strokeColor property
|
|
18
16
|
stroke = [
|
|
19
|
-
Object.assign(Object.assign({}, DEFAULT_ELEMENT_PROPS.stroke), { content: validateDeprecatedElementContent(_element.strokeColor, DEFAULT_ELEMENT_PROPS.stroke.content), width:
|
|
20
|
-
DEFAULT_ELEMENT_PROPS.stroke.width.value, elementScope, currentScope, DEFAULT_ELEMENT_PROPS.stroke.width.value) }),
|
|
17
|
+
Object.assign(Object.assign({}, DEFAULT_ELEMENT_PROPS.stroke), { content: validateDeprecatedElementContent(_element.strokeColor, DEFAULT_ELEMENT_PROPS.stroke.content), width: restoreNumber((_a = _element.strokeWidth) !== null && _a !== void 0 ? _a : DEFAULT_ELEMENT_PROPS.stroke.width, DEFAULT_ELEMENT_PROPS.stroke.width) }),
|
|
21
18
|
];
|
|
22
19
|
}
|
|
23
20
|
else if (_element.stroke) {
|
|
24
21
|
// New stroke array property
|
|
25
|
-
stroke = _element.stroke.map((s) => validateStroke(s
|
|
22
|
+
stroke = _element.stroke.map((s) => validateStroke(s));
|
|
26
23
|
}
|
|
27
24
|
// Handle legacy background properties
|
|
28
25
|
let background = [DEFAULT_ELEMENT_PROPS.background];
|
|
@@ -39,54 +36,57 @@ const restoreElementWithProperties = (element, extra, localState, globalState) =
|
|
|
39
36
|
const base = {
|
|
40
37
|
id: _element.id || randomId(),
|
|
41
38
|
version: _element.version || 1,
|
|
42
|
-
versionNonce: (
|
|
43
|
-
index: (
|
|
39
|
+
versionNonce: (_b = _element.versionNonce) !== null && _b !== void 0 ? _b : 0,
|
|
40
|
+
index: (_c = _element.index) !== null && _c !== void 0 ? _c : null,
|
|
44
41
|
isDeleted: isValidBooleanValue(_element.isDeleted, false),
|
|
45
42
|
blending: isValidBlendingValue(_element.blending),
|
|
46
43
|
stroke,
|
|
47
44
|
background,
|
|
48
45
|
opacity: isValidPercentageValue(_element.opacity, DEFAULT_ELEMENT_PROPS.opacity),
|
|
49
46
|
angle: isValidRadianValue(_element.angle, DEFAULT_ELEMENT_PROPS.angle),
|
|
50
|
-
x:
|
|
51
|
-
y:
|
|
52
|
-
|
|
53
|
-
label: (_c = _element.label) !== null && _c !== void 0 ? _c : "Lost Element Label",
|
|
47
|
+
x: restoreNumber(_element.x, 0),
|
|
48
|
+
y: restoreNumber(_element.y, 0),
|
|
49
|
+
label: (_d = _element.label) !== null && _d !== void 0 ? _d : "Lost Element Label",
|
|
54
50
|
isVisible: isValidBoolean(_element.isVisible, DEFAULT_ELEMENT_PROPS.isVisible),
|
|
55
51
|
isPlot: isValidBoolean(_element.isPlot, DEFAULT_ELEMENT_PROPS.isPlot),
|
|
56
|
-
layerId: (
|
|
52
|
+
layerId: (_e = _element.layerId) !== null && _e !== void 0 ? _e : null,
|
|
57
53
|
regionIds: Array.isArray(_element.regionIds) ? _element.regionIds : [],
|
|
58
|
-
width:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
width: ((_element.type === "doc" || _element.type === "pdf") && restoreNumber(_element.width, 0) > 50000)
|
|
55
|
+
? restoreNumber(_element.width, 0) / 1000
|
|
56
|
+
: restoreNumber(_element.width, 0),
|
|
57
|
+
height: ((_element.type === "doc" || _element.type === "pdf") && restoreNumber(_element.height, 0) > 50000)
|
|
58
|
+
? restoreNumber(_element.height, 0) / 1000
|
|
59
|
+
: restoreNumber(_element.height, 0),
|
|
60
|
+
seed: (_f = _element.seed) !== null && _f !== void 0 ? _f : 1,
|
|
61
|
+
groupIds: (_g = _element.groupIds) !== null && _g !== void 0 ? _g : [],
|
|
62
62
|
blockIds: Array.isArray(_element.blockIds) ? _element.blockIds : [],
|
|
63
|
-
instanceId: (
|
|
64
|
-
frameId: (
|
|
65
|
-
roundness:
|
|
66
|
-
boundElements: (
|
|
67
|
-
updated: (
|
|
63
|
+
instanceId: (_h = _element.instanceId) !== null && _h !== void 0 ? _h : null,
|
|
64
|
+
frameId: (_j = _element.frameId) !== null && _j !== void 0 ? _j : null,
|
|
65
|
+
roundness: restoreNumber(_element.roundness, DEFAULT_ELEMENT_PROPS.roundness),
|
|
66
|
+
boundElements: (_k = _element.boundElements) !== null && _k !== void 0 ? _k : undefined,
|
|
67
|
+
updated: (_l = _element.updated) !== null && _l !== void 0 ? _l : getUpdatedTimestamp(),
|
|
68
68
|
link: _element.link ? normalizeLink(_element.link) : undefined,
|
|
69
69
|
locked: isValidBooleanValue(_element.locked, false),
|
|
70
|
-
description: (
|
|
70
|
+
description: (_m = _element.description) !== null && _m !== void 0 ? _m : undefined,
|
|
71
71
|
};
|
|
72
72
|
if ("customData" in element || "customData" in extra) {
|
|
73
73
|
base.customData = _element.customData;
|
|
74
74
|
}
|
|
75
75
|
const normalizedRaw = getNormalizedDimensions(base);
|
|
76
76
|
const normalized = {
|
|
77
|
-
x:
|
|
78
|
-
y:
|
|
79
|
-
width:
|
|
80
|
-
height:
|
|
77
|
+
x: normalizedRaw.x,
|
|
78
|
+
y: normalizedRaw.y,
|
|
79
|
+
width: normalizedRaw.width,
|
|
80
|
+
height: normalizedRaw.height,
|
|
81
81
|
};
|
|
82
82
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, _element), base), normalized), { type: _element.type });
|
|
83
83
|
};
|
|
84
|
-
const restoreElement = (element,
|
|
84
|
+
const restoreElement = (element, restoredBlocks, localState, globalState) => {
|
|
85
85
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
86
86
|
// Migration: convert deprecated 'diamond' to 'polygon' with 4 sides
|
|
87
87
|
if (element.type === "diamond") {
|
|
88
88
|
const migrated = Object.assign(Object.assign({}, element), { type: "polygon", sides: 4 });
|
|
89
|
-
return restoreElement(migrated,
|
|
89
|
+
return restoreElement(migrated, restoredBlocks, localState);
|
|
90
90
|
}
|
|
91
91
|
switch (element.type) {
|
|
92
92
|
case "text": {
|
|
@@ -118,9 +118,8 @@ const restoreElement = (element, currentScope, restoredBlocks, localState, globa
|
|
|
118
118
|
const lineHeight = (element.lineHeight && Number.isFinite(element.lineHeight)
|
|
119
119
|
? element.lineHeight
|
|
120
120
|
: detectLineHeight(element));
|
|
121
|
-
const restoredLineSpacing = restoreLineSpacing(element.lineSpacing, lineHeight
|
|
122
|
-
const
|
|
123
|
-
const finalFontSize = restorePrecisionValue(fontSize, textElementScope, currentScope, DEFAULT_FONT_SIZE);
|
|
121
|
+
const restoredLineSpacing = restoreLineSpacing(element.lineSpacing, lineHeight);
|
|
122
|
+
const finalFontSize = restoreNumber(fontSize, DEFAULT_FONT_SIZE);
|
|
124
123
|
const restoredTextElement = restoreElementWithProperties(element, {
|
|
125
124
|
// DucTextElement specific
|
|
126
125
|
text,
|
|
@@ -152,21 +151,18 @@ const restoreElement = (element, currentScope, restoredBlocks, localState, globa
|
|
|
152
151
|
return restoredTextElement;
|
|
153
152
|
}
|
|
154
153
|
case "freedraw": {
|
|
155
|
-
const elementScope = isValidElementScopeValue(element.scope, globalState === null || globalState === void 0 ? void 0 : globalState.mainScope);
|
|
156
154
|
const points = restoreElementPoints({
|
|
157
155
|
points: element.points,
|
|
158
156
|
x: element.x,
|
|
159
157
|
y: element.y,
|
|
160
158
|
width: element.width,
|
|
161
159
|
height: element.height,
|
|
162
|
-
elementScope,
|
|
163
|
-
currentScope,
|
|
164
160
|
});
|
|
165
161
|
return restoreElementWithProperties(element, {
|
|
166
162
|
points,
|
|
167
|
-
size:
|
|
163
|
+
size: restoreNumber(element.size, DEFAULT_FREEDRAW_ELEMENT.size),
|
|
168
164
|
lastCommittedPoint: element.lastCommittedPoint
|
|
169
|
-
? restorePoint(element.lastCommittedPoint
|
|
165
|
+
? restorePoint(element.lastCommittedPoint)
|
|
170
166
|
: null,
|
|
171
167
|
simulatePressure: isValidBoolean(element.simulatePressure, false),
|
|
172
168
|
pressures: Array.isArray(element.pressures) ? element.pressures : [],
|
|
@@ -190,7 +186,6 @@ const restoreElement = (element, currentScope, restoredBlocks, localState, globa
|
|
|
190
186
|
case "line": {
|
|
191
187
|
// Don't normalize points if there are bindings
|
|
192
188
|
const hasBindings = !!(element.startBinding || element.endBinding);
|
|
193
|
-
const elementScope = isValidElementScopeValue(element.scope, globalState === null || globalState === void 0 ? void 0 : globalState.mainScope);
|
|
194
189
|
const { points, lines } = restoreLinearElementPointsAndLines({
|
|
195
190
|
points: element.points,
|
|
196
191
|
lines: element.lines,
|
|
@@ -198,20 +193,18 @@ const restoreElement = (element, currentScope, restoredBlocks, localState, globa
|
|
|
198
193
|
y: element.y,
|
|
199
194
|
width: element.width,
|
|
200
195
|
height: element.height,
|
|
201
|
-
elementScope,
|
|
202
|
-
currentScope,
|
|
203
196
|
skipNormalization: hasBindings,
|
|
204
197
|
});
|
|
205
198
|
const isEditing = false; // TODO: Handle editingLinearElement properly
|
|
206
199
|
let finalPoints = points;
|
|
207
200
|
// Ensure we have at least 2 points for visibility check
|
|
208
201
|
if (finalPoints.length < 2 && !isEditing) {
|
|
209
|
-
const elementWidth =
|
|
210
|
-
const elementHeight =
|
|
202
|
+
const elementWidth = restoreNumber(element.width, 0);
|
|
203
|
+
const elementHeight = restoreNumber(element.height, 0);
|
|
211
204
|
finalPoints = [
|
|
212
205
|
{
|
|
213
|
-
x:
|
|
214
|
-
y:
|
|
206
|
+
x: 0,
|
|
207
|
+
y: 0,
|
|
215
208
|
mirroring: undefined,
|
|
216
209
|
},
|
|
217
210
|
{
|
|
@@ -228,16 +221,16 @@ const restoreElement = (element, currentScope, restoredBlocks, localState, globa
|
|
|
228
221
|
const processedStartBinding = startBinding &&
|
|
229
222
|
startBinding.head !== undefined &&
|
|
230
223
|
(!startBinding.elementId || startBinding.elementId === "")
|
|
231
|
-
? createHeadOnlyBinding(startBinding.head, restoredBlocks
|
|
224
|
+
? createHeadOnlyBinding(startBinding.head, restoredBlocks)
|
|
232
225
|
: startBinding
|
|
233
|
-
? repairBinding(element, startBinding,
|
|
226
|
+
? repairBinding(element, startBinding, restoredBlocks)
|
|
234
227
|
: null;
|
|
235
228
|
const processedEndBinding = endBinding &&
|
|
236
229
|
endBinding.head !== undefined &&
|
|
237
230
|
(!endBinding.elementId || endBinding.elementId === "")
|
|
238
|
-
? createHeadOnlyBinding(endBinding.head, restoredBlocks
|
|
231
|
+
? createHeadOnlyBinding(endBinding.head, restoredBlocks)
|
|
239
232
|
: endBinding
|
|
240
|
-
? repairBinding(element, endBinding,
|
|
233
|
+
? repairBinding(element, endBinding, restoredBlocks)
|
|
241
234
|
: null;
|
|
242
235
|
// Create the base restored element
|
|
243
236
|
// Skip sizeFromPoints override for block instance elements: their stored
|
|
@@ -245,24 +238,24 @@ const restoreElement = (element, currentScope, restoredBlocks, localState, globa
|
|
|
245
238
|
const isBlockInstanceElement = !!element.instanceId;
|
|
246
239
|
const sizeFromPoints = !hasBindings &&
|
|
247
240
|
!isBlockInstanceElement &&
|
|
248
|
-
getSizeFromPoints(finalPoints.map(
|
|
241
|
+
getSizeFromPoints(finalPoints.map((p) => ({ x: p.x, y: p.y })));
|
|
249
242
|
let restoredElement = restoreElementWithProperties(element, Object.assign({ points: finalPoints, lines, lastCommittedPoint: element.lastCommittedPoint
|
|
250
|
-
? restorePoint(element.lastCommittedPoint
|
|
243
|
+
? restorePoint(element.lastCommittedPoint)
|
|
251
244
|
: null, startBinding: processedStartBinding, wipeoutBelow: isValidBooleanValue(element.wipeoutBelow, false), endBinding: processedEndBinding, x: element.x, y: element.y }, (!sizeFromPoints
|
|
252
245
|
? {}
|
|
253
246
|
: {
|
|
254
|
-
width:
|
|
255
|
-
height:
|
|
247
|
+
width: sizeFromPoints.width,
|
|
248
|
+
height: sizeFromPoints.height,
|
|
256
249
|
})), localState);
|
|
257
250
|
const { points: updatedPoints, lines: updatedLines } = mergeOverlappingPoints(finalPoints, lines, LINE_CONFIRM_THRESHOLD);
|
|
258
251
|
restoredElement = Object.assign(Object.assign({}, restoredElement), { points: updatedPoints, lines: updatedLines });
|
|
259
252
|
// Validate path overrides after we have the final points and lines
|
|
260
|
-
const validatedPathOverrides = validatePathOverrides(element.pathOverrides, restoredElement
|
|
253
|
+
const validatedPathOverrides = validatePathOverrides(element.pathOverrides, restoredElement);
|
|
261
254
|
return Object.assign(Object.assign({}, restoredElement), { pathOverrides: validatedPathOverrides });
|
|
262
255
|
}
|
|
263
256
|
case "arrow": {
|
|
264
257
|
// since arrow is deprecated, we convert it to line
|
|
265
|
-
return restoreElement(Object.assign(Object.assign({}, element), { type: "line", wipeoutBelow: false }),
|
|
258
|
+
return restoreElement(Object.assign(Object.assign({}, element), { type: "line", wipeoutBelow: false }), restoredBlocks, localState);
|
|
266
259
|
}
|
|
267
260
|
case "ellipse": {
|
|
268
261
|
const ratio = isValidPercentageValue(element.ratio, DEFAULT_ELLIPSE_ELEMENT.ratio);
|
|
@@ -286,20 +279,19 @@ const restoreElement = (element, currentScope, restoredBlocks, localState, globa
|
|
|
286
279
|
// Stack-like elements
|
|
287
280
|
case "frame": {
|
|
288
281
|
const frameElement = element;
|
|
289
|
-
return restoreElementWithProperties(frameElement, Object.assign({}, restoreStackElementProperties(frameElement
|
|
282
|
+
return restoreElementWithProperties(frameElement, Object.assign({}, restoreStackElementProperties(frameElement)), localState);
|
|
290
283
|
}
|
|
291
284
|
case "plot": {
|
|
292
285
|
const plotElement = element;
|
|
293
|
-
const elementScope = isValidElementScopeValue(plotElement.scope, globalState === null || globalState === void 0 ? void 0 : globalState.mainScope);
|
|
294
286
|
// Restore base stack element properties (label, visibility, etc.)
|
|
295
|
-
const stackProperties = restoreStackElementProperties(plotElement
|
|
287
|
+
const stackProperties = restoreStackElementProperties(plotElement);
|
|
296
288
|
// Restore layout-specific properties
|
|
297
289
|
const layout = {
|
|
298
290
|
margins: {
|
|
299
|
-
top:
|
|
300
|
-
right:
|
|
301
|
-
bottom:
|
|
302
|
-
left:
|
|
291
|
+
top: restoreNumber((_d = (_c = plotElement.layout) === null || _c === void 0 ? void 0 : _c.margins) === null || _d === void 0 ? void 0 : _d.top, 0),
|
|
292
|
+
right: restoreNumber((_f = (_e = plotElement.layout) === null || _e === void 0 ? void 0 : _e.margins) === null || _f === void 0 ? void 0 : _f.right, 0),
|
|
293
|
+
bottom: restoreNumber((_h = (_g = plotElement.layout) === null || _g === void 0 ? void 0 : _g.margins) === null || _h === void 0 ? void 0 : _h.bottom, 0),
|
|
294
|
+
left: restoreNumber((_k = (_j = plotElement.layout) === null || _j === void 0 ? void 0 : _j.margins) === null || _k === void 0 ? void 0 : _k.left, 0),
|
|
303
295
|
},
|
|
304
296
|
};
|
|
305
297
|
return restoreElementWithProperties(plotElement, Object.assign(Object.assign({}, stackProperties), { layout }), localState, globalState);
|
|
@@ -313,7 +305,7 @@ const restoreElement = (element, currentScope, restoredBlocks, localState, globa
|
|
|
313
305
|
// Complex elements requiring specific restore logic
|
|
314
306
|
case "table": {
|
|
315
307
|
const tableElement = element;
|
|
316
|
-
const defaultData = getDefaultTableData(
|
|
308
|
+
const defaultData = getDefaultTableData();
|
|
317
309
|
return restoreElementWithProperties(tableElement, {
|
|
318
310
|
fileId: isValidString(tableElement.fileId) ||
|
|
319
311
|
defaultData.fileId,
|
|
@@ -363,19 +355,15 @@ const restoreElement = (element, currentScope, restoredBlocks, localState, globa
|
|
|
363
355
|
/**
|
|
364
356
|
* Restores a point that might have legacy format (x,y as numbers)
|
|
365
357
|
* @param point - The point to restore
|
|
366
|
-
* @param elementScope - The scope to use for the precision values
|
|
367
358
|
* @returns A properly formatted DucPoint
|
|
368
359
|
*/
|
|
369
|
-
export const restorePoint = (point
|
|
360
|
+
export const restorePoint = (point) => {
|
|
370
361
|
if (!point) {
|
|
371
362
|
return null;
|
|
372
363
|
}
|
|
373
364
|
// Handle x and y conversion
|
|
374
|
-
const xValue =
|
|
375
|
-
const yValue =
|
|
376
|
-
if (!xValue || !yValue) {
|
|
377
|
-
return null;
|
|
378
|
-
}
|
|
365
|
+
const xValue = restoreNumber(point.x, 0);
|
|
366
|
+
const yValue = restoreNumber(point.y, 0);
|
|
379
367
|
// Only keep the new DucPoint structure, ignore legacy properties
|
|
380
368
|
return {
|
|
381
369
|
x: xValue,
|
|
@@ -383,17 +371,17 @@ export const restorePoint = (point, elementScope, currentScope) => {
|
|
|
383
371
|
mirroring: isValidBezierMirroringValue(point.mirroring),
|
|
384
372
|
};
|
|
385
373
|
};
|
|
386
|
-
const restoreElementPoints = ({ points: oldPoints, x, y, width, height,
|
|
387
|
-
// Convert input parameters to plain numbers
|
|
388
|
-
const validatedWidth =
|
|
389
|
-
const validatedHeight =
|
|
374
|
+
const restoreElementPoints = ({ points: oldPoints, x, y, width, height, }) => {
|
|
375
|
+
// Convert input parameters to plain numbers
|
|
376
|
+
const validatedWidth = restoreNumber(width, 0);
|
|
377
|
+
const validatedHeight = restoreNumber(height, 0);
|
|
390
378
|
// Process the points array with proper conversion
|
|
391
379
|
let points = [];
|
|
392
380
|
if (typeof oldPoints === "object" && Array.isArray(oldPoints)) {
|
|
393
381
|
const migratedPoints = migratePoints(oldPoints);
|
|
394
382
|
points = migratedPoints
|
|
395
383
|
.map((point) => {
|
|
396
|
-
const restoredPoint = restorePoint(point
|
|
384
|
+
const restoredPoint = restorePoint(point);
|
|
397
385
|
if (!restoredPoint) {
|
|
398
386
|
return null;
|
|
399
387
|
}
|
|
@@ -413,8 +401,8 @@ const restoreElementPoints = ({ points: oldPoints, x, y, width, height, elementS
|
|
|
413
401
|
// Default two points
|
|
414
402
|
points = [
|
|
415
403
|
{
|
|
416
|
-
x:
|
|
417
|
-
y:
|
|
404
|
+
x: 0,
|
|
405
|
+
y: 0,
|
|
418
406
|
mirroring: undefined,
|
|
419
407
|
},
|
|
420
408
|
{
|
|
@@ -425,27 +413,25 @@ const restoreElementPoints = ({ points: oldPoints, x, y, width, height, elementS
|
|
|
425
413
|
];
|
|
426
414
|
}
|
|
427
415
|
if (points.length === 2 &&
|
|
428
|
-
points[1] &&
|
|
429
|
-
points[1].x
|
|
430
|
-
points[1].y
|
|
431
|
-
(validatedWidth
|
|
416
|
+
points[1] &&
|
|
417
|
+
points[1].x === 0 &&
|
|
418
|
+
points[1].y === 0 &&
|
|
419
|
+
(validatedWidth !== 0 || validatedHeight !== 0)) {
|
|
432
420
|
points[1] = Object.assign(Object.assign({}, points[1]), { x: validatedWidth, y: validatedHeight });
|
|
433
421
|
}
|
|
434
422
|
return points;
|
|
435
423
|
};
|
|
436
|
-
const restoreLinearElementPointsAndLines = ({ points: oldPoints, lines: oldLines, x, y, width, height,
|
|
437
|
-
const validatedX =
|
|
438
|
-
const validatedY =
|
|
439
|
-
const validatedWidth =
|
|
440
|
-
const validatedHeight =
|
|
424
|
+
const restoreLinearElementPointsAndLines = ({ points: oldPoints, lines: oldLines, x, y, width, height, skipNormalization, }) => {
|
|
425
|
+
const validatedX = restoreNumber(x, 0);
|
|
426
|
+
const validatedY = restoreNumber(y, 0);
|
|
427
|
+
const validatedWidth = restoreNumber(width, 0);
|
|
428
|
+
const validatedHeight = restoreNumber(height, 0);
|
|
441
429
|
let points = restoreElementPoints({
|
|
442
430
|
points: oldPoints,
|
|
443
431
|
x,
|
|
444
432
|
y,
|
|
445
433
|
width,
|
|
446
434
|
height,
|
|
447
|
-
elementScope,
|
|
448
|
-
currentScope,
|
|
449
435
|
});
|
|
450
436
|
let lines = oldLines;
|
|
451
437
|
if (lines === undefined || lines === null) {
|
|
@@ -463,13 +449,13 @@ const restoreLinearElementPointsAndLines = ({ points: oldPoints, lines: oldLines
|
|
|
463
449
|
{
|
|
464
450
|
index: line[0].index,
|
|
465
451
|
handle: line[0].handle
|
|
466
|
-
? restorePoint(line[0].handle
|
|
452
|
+
? restorePoint(line[0].handle)
|
|
467
453
|
: null,
|
|
468
454
|
},
|
|
469
455
|
{
|
|
470
456
|
index: line[1].index,
|
|
471
457
|
handle: line[1].handle
|
|
472
|
-
? restorePoint(line[1].handle
|
|
458
|
+
? restorePoint(line[1].handle)
|
|
473
459
|
: null,
|
|
474
460
|
},
|
|
475
461
|
];
|
|
@@ -477,24 +463,23 @@ const restoreLinearElementPointsAndLines = ({ points: oldPoints, lines: oldLines
|
|
|
477
463
|
}
|
|
478
464
|
if (!skipNormalization &&
|
|
479
465
|
points.length >= 2 &&
|
|
480
|
-
(points[0].x
|
|
466
|
+
(points[0].x !== 0 || points[0].y !== 0)) {
|
|
481
467
|
const normalizedResult = getNormalizedPoints({
|
|
482
468
|
points,
|
|
483
469
|
lines,
|
|
484
470
|
x: validatedX,
|
|
485
471
|
y: validatedY,
|
|
486
|
-
|
|
487
|
-
}, currentScope);
|
|
472
|
+
});
|
|
488
473
|
const firstPoint = points[0];
|
|
489
474
|
const lastPoint = points[points.length - 1];
|
|
490
475
|
points = normalizedResult.points;
|
|
491
476
|
lines = normalizedResult.lines;
|
|
492
477
|
if (oldPoints && oldPoints.length === points.length) {
|
|
493
|
-
if (firstPoint.x
|
|
478
|
+
if (firstPoint.x !== 0 || firstPoint.y !== 0) {
|
|
494
479
|
points[0] = Object.assign({}, points[0]);
|
|
495
480
|
}
|
|
496
|
-
if (lastPoint.x
|
|
497
|
-
lastPoint.y
|
|
481
|
+
if (lastPoint.x !== validatedWidth ||
|
|
482
|
+
lastPoint.y !== validatedHeight) {
|
|
498
483
|
points[points.length - 1] = Object.assign({}, points[points.length - 1]);
|
|
499
484
|
}
|
|
500
485
|
}
|
|
@@ -586,12 +571,29 @@ export const migrateArrayOrderToZIndex = (elements) => {
|
|
|
586
571
|
return element;
|
|
587
572
|
});
|
|
588
573
|
};
|
|
589
|
-
export const restoreElements = (elements,
|
|
574
|
+
export const restoreElements = (elements, second, third, fourth) => {
|
|
575
|
+
let restoredBlocks = [];
|
|
576
|
+
let opts;
|
|
577
|
+
if (Array.isArray(second)) {
|
|
578
|
+
restoredBlocks = second;
|
|
579
|
+
opts = third;
|
|
580
|
+
}
|
|
581
|
+
else if (second && typeof second === "object" && ("syncInvalidIndices" in second || "localState" in second || "passThroughElementIds" in second)) {
|
|
582
|
+
opts = second;
|
|
583
|
+
}
|
|
584
|
+
else if (Array.isArray(third)) {
|
|
585
|
+
restoredBlocks = third;
|
|
586
|
+
opts = fourth;
|
|
587
|
+
}
|
|
588
|
+
else if (third && typeof third === "object") {
|
|
589
|
+
opts = third;
|
|
590
|
+
}
|
|
590
591
|
const existingIds = new Set();
|
|
592
|
+
const idMap = new Map();
|
|
591
593
|
// First restore all elements with their original properties
|
|
592
594
|
const restored = (elements || []).reduce((elements, element) => {
|
|
593
595
|
if (element.type !== "selection") {
|
|
594
|
-
let migratedElement = restoreElement(element,
|
|
596
|
+
let migratedElement = restoreElement(element, restoredBlocks, opts === null || opts === void 0 ? void 0 : opts.localState);
|
|
595
597
|
if (!migratedElement) {
|
|
596
598
|
// element failed to restore — skip
|
|
597
599
|
}
|
|
@@ -606,7 +608,10 @@ export const restoreElements = (elements, currentScope, restoredBlocks, opts) =>
|
|
|
606
608
|
if (migratedElement &&
|
|
607
609
|
(isPassThrough || !isInvisiblySmallElement(migratedElement))) {
|
|
608
610
|
if (existingIds.has(migratedElement.id)) {
|
|
609
|
-
|
|
611
|
+
const oldId = migratedElement.id;
|
|
612
|
+
const newId = randomId();
|
|
613
|
+
migratedElement = Object.assign(Object.assign({}, migratedElement), { id: newId });
|
|
614
|
+
idMap.set(oldId, newId);
|
|
610
615
|
}
|
|
611
616
|
existingIds.add(migratedElement.id);
|
|
612
617
|
elements.push(migratedElement);
|
|
@@ -614,8 +619,15 @@ export const restoreElements = (elements, currentScope, restoredBlocks, opts) =>
|
|
|
614
619
|
}
|
|
615
620
|
return elements;
|
|
616
621
|
}, []);
|
|
622
|
+
if (idMap.size > 0) {
|
|
623
|
+
for (const el of restored) {
|
|
624
|
+
if (el.type === "model" && typeof el.code === "string" && el.code) {
|
|
625
|
+
el.code = updateModelCodeElementIds(el.code, idMap);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
617
629
|
let restoredElements = (opts === null || opts === void 0 ? void 0 : opts.syncInvalidIndices)
|
|
618
|
-
? opts.syncInvalidIndices(restored
|
|
630
|
+
? opts.syncInvalidIndices(restored)
|
|
619
631
|
: restored;
|
|
620
632
|
// Migrate array ordering to explicit z-index values if needed
|
|
621
633
|
restoredElements = migrateArrayOrderToZIndex(restoredElements);
|
|
@@ -634,7 +646,7 @@ export const restoreElements = (elements, currentScope, restoredBlocks, opts) =>
|
|
|
634
646
|
repairContainerElement(element, restoredElementsMap);
|
|
635
647
|
}
|
|
636
648
|
if (opts.refreshDimensions && isTextElement(element)) {
|
|
637
|
-
Object.assign(element, refreshTextDimensions(element, getContainerElement(element, restoredElementsMap), restoredElementsMap
|
|
649
|
+
Object.assign(element, refreshTextDimensions(element, getContainerElement(element, restoredElementsMap), restoredElementsMap));
|
|
638
650
|
}
|
|
639
651
|
if (isLinearElement(element)) {
|
|
640
652
|
// Helper function to check if we should keep a binding
|
|
@@ -698,18 +710,11 @@ export const restoreElements = (elements, currentScope, restoredBlocks, opts) =>
|
|
|
698
710
|
}
|
|
699
711
|
return restoredElements;
|
|
700
712
|
};
|
|
701
|
-
|
|
702
|
-
// Only check if the provided value is valid
|
|
703
|
-
if (value !== undefined && Object.keys(ScaleFactors).includes(value)) {
|
|
704
|
-
return value;
|
|
705
|
-
}
|
|
706
|
-
return mainScope;
|
|
707
|
-
};
|
|
708
|
-
const restoreLineSpacing = (lineSpacing, legacyLineHeight, currentScope) => {
|
|
713
|
+
const restoreLineSpacing = (lineSpacing, legacyLineHeight) => {
|
|
709
714
|
if (lineSpacing && lineSpacing.type && lineSpacing.value) {
|
|
710
715
|
return {
|
|
711
716
|
type: isValidLineSpacingTypeValue(lineSpacing.type),
|
|
712
|
-
value:
|
|
717
|
+
value: restoreNumber(lineSpacing.value, 1.15),
|
|
713
718
|
};
|
|
714
719
|
}
|
|
715
720
|
// Fallback to legacy lineHeight
|
|
@@ -733,7 +738,7 @@ const restoreDocumentGridConfig = (gridConfig) => {
|
|
|
733
738
|
gapX: typeof gridConfig.gapX === "number" ? gridConfig.gapX : 0,
|
|
734
739
|
gapY: typeof gridConfig.gapY === "number" ? gridConfig.gapY : 0,
|
|
735
740
|
firstPageAlone: typeof gridConfig.firstPageAlone === "boolean" ? gridConfig.firstPageAlone : false,
|
|
736
|
-
scale: typeof gridConfig.scale === "number" ? gridConfig.scale : 1,
|
|
741
|
+
scale: typeof gridConfig.scale === "number" && gridConfig.scale > 0 && gridConfig.scale <= 50 ? gridConfig.scale : 1,
|
|
737
742
|
};
|
|
738
743
|
};
|
|
739
744
|
const getFontFamilyByName = (fontFamilyName) => {
|
|
@@ -742,7 +747,7 @@ const getFontFamilyByName = (fontFamilyName) => {
|
|
|
742
747
|
}
|
|
743
748
|
return DEFAULT_FONT_FAMILY;
|
|
744
749
|
};
|
|
745
|
-
const repairBinding = (element, binding,
|
|
750
|
+
const repairBinding = (element, binding, restoredBlocks) => {
|
|
746
751
|
var _a;
|
|
747
752
|
if (!binding) {
|
|
748
753
|
return null;
|
|
@@ -750,10 +755,8 @@ const repairBinding = (element, binding, currentScope, restoredBlocks) => {
|
|
|
750
755
|
// If this is a head-only binding, normalize it
|
|
751
756
|
if (binding.head !== undefined &&
|
|
752
757
|
(!binding.elementId || binding.elementId === "")) {
|
|
753
|
-
return createHeadOnlyBinding(binding.head, restoredBlocks
|
|
758
|
+
return createHeadOnlyBinding(binding.head, restoredBlocks);
|
|
754
759
|
}
|
|
755
|
-
// Get the element's scope for conversion
|
|
756
|
-
const elementScope = element ? element.scope : NEUTRAL_SCOPE;
|
|
757
760
|
// Ensure we preserve the point attribute for linear-to-linear bindings
|
|
758
761
|
const pointData = binding.point
|
|
759
762
|
? {
|
|
@@ -766,14 +769,14 @@ const repairBinding = (element, binding, currentScope, restoredBlocks) => {
|
|
|
766
769
|
},
|
|
767
770
|
}
|
|
768
771
|
: { point: null };
|
|
769
|
-
return Object.assign({ elementId: binding.elementId || "", focus: typeof binding.focus === "number" ? binding.focus : 0, gap:
|
|
772
|
+
return Object.assign({ elementId: binding.elementId || "", focus: typeof binding.focus === "number" ? binding.focus : 0, gap: restoreNumber(binding.gap, 0), head: isValidDucHead(binding.head, restoredBlocks || []), fixedPoint: element && isElbowArrow(element)
|
|
770
773
|
? normalizeFixedPoint((_a = binding.fixedPoint) !== null && _a !== void 0 ? _a : { x: 0.5, y: 0.5 })
|
|
771
774
|
: null }, pointData);
|
|
772
775
|
};
|
|
773
776
|
/**
|
|
774
777
|
* Validates a DucPath object and ensures its line indices form a valid closed path
|
|
775
778
|
*/
|
|
776
|
-
const validateDucPath = (path, element
|
|
779
|
+
const validateDucPath = (path, element) => {
|
|
777
780
|
if (!path || !path.lineIndices || !Array.isArray(path.lineIndices)) {
|
|
778
781
|
return null;
|
|
779
782
|
}
|
|
@@ -794,21 +797,21 @@ const validateDucPath = (path, element, elementScope, currentScope) => {
|
|
|
794
797
|
lineIndices: validLineIndices,
|
|
795
798
|
background: path.background ? validateBackground(path.background) : null,
|
|
796
799
|
stroke: path.stroke
|
|
797
|
-
? validateStroke(path.stroke
|
|
800
|
+
? validateStroke(path.stroke)
|
|
798
801
|
: null,
|
|
799
802
|
};
|
|
800
803
|
};
|
|
801
804
|
/**
|
|
802
805
|
* Validates and filters path overrides for a linear element
|
|
803
806
|
*/
|
|
804
|
-
const validatePathOverrides = (pathOverrides, element
|
|
807
|
+
const validatePathOverrides = (pathOverrides, element) => {
|
|
805
808
|
if (!pathOverrides || !Array.isArray(pathOverrides)) {
|
|
806
809
|
return [];
|
|
807
810
|
}
|
|
808
811
|
const validPaths = [];
|
|
809
812
|
const usedLineIndices = new Set();
|
|
810
813
|
for (const pathOverride of pathOverrides) {
|
|
811
|
-
const validatedPath = validateDucPath(pathOverride, element
|
|
814
|
+
const validatedPath = validateDucPath(pathOverride, element);
|
|
812
815
|
if (validatedPath) {
|
|
813
816
|
// Check for overlapping line indices with previously validated paths
|
|
814
817
|
const hasOverlap = validatedPath.lineIndices.some((index) => usedLineIndices.has(index));
|
|
@@ -843,14 +846,14 @@ const isValidCutAngleValue = (value, defaultValue) => {
|
|
|
843
846
|
}
|
|
844
847
|
return radian;
|
|
845
848
|
};
|
|
846
|
-
const createHeadOnlyBinding = (head, restoredBlocks
|
|
849
|
+
const createHeadOnlyBinding = (head, restoredBlocks) => {
|
|
847
850
|
return {
|
|
848
851
|
elementId: "",
|
|
849
852
|
focus: 0,
|
|
850
|
-
gap:
|
|
853
|
+
gap: 0,
|
|
851
854
|
fixedPoint: null,
|
|
852
855
|
point: null,
|
|
853
|
-
head: isValidDucHead(head, restoredBlocks),
|
|
856
|
+
head: isValidDucHead(head, restoredBlocks || []),
|
|
854
857
|
};
|
|
855
858
|
};
|
|
856
859
|
const validateDeprecatedElementContent = (color, defaultContent) => {
|
|
@@ -864,6 +867,6 @@ const isValidLineSpacingTypeValue = (value) => {
|
|
|
864
867
|
/**
|
|
865
868
|
* Restore properties specific to Stack-like elements (_DucStackElementBase)
|
|
866
869
|
*/
|
|
867
|
-
const restoreStackElementProperties = (element
|
|
870
|
+
const restoreStackElementProperties = (element) => {
|
|
868
871
|
return Object.assign(Object.assign({}, restoreDucStackProperties(element)), { clip: isValidBooleanValue(element.clip, false), labelVisible: isValidBooleanValue(element.labelVisible, true) });
|
|
869
872
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const getEncodedPythonModelModuleName: (elementId: string) => string;
|
|
2
|
+
export declare const getPythonModelModuleName: (elementId: string) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Updates Python code referencing model element IDs when IDs are restored or duplicated.
|
|
5
|
+
* Replaces references in:
|
|
6
|
+
* - `from duc_model.<id_or_module> import ...`
|
|
7
|
+
* - `import duc_model.<id_or_module>`
|
|
8
|
+
* - `duc_model.<id_or_module>`
|
|
9
|
+
* - `from duc_model import <id_or_module>`
|
|
10
|
+
*/
|
|
11
|
+
export declare const updateModelCodeElementIds: (code: string, idMap: Map<string, string> | Record<string, string>) => string;
|