ducjs 2.3.0 → 3.0.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/README.md +2 -2
- package/dist/enums.d.ts +135 -0
- package/dist/enums.js +155 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.js +8 -4
- package/dist/lazy-files.d.ts +44 -0
- package/dist/lazy-files.js +129 -0
- package/dist/parse.d.ts +21 -55
- package/dist/parse.js +58 -1445
- package/dist/restore/index.d.ts +0 -1
- package/dist/restore/index.js +0 -1
- package/dist/restore/restoreDataState.d.ts +6 -10
- package/dist/restore/restoreDataState.js +117 -127
- package/dist/restore/restoreElements.d.ts +1 -1
- package/dist/restore/restoreElements.js +37 -494
- package/dist/serialize.d.ts +11 -4
- package/dist/serialize.js +58 -2545
- package/dist/technical/index.d.ts +0 -1
- package/dist/technical/index.js +0 -1
- package/dist/technical/scopes.d.ts +1 -1
- package/dist/technical/scopes.js +1 -1
- package/dist/transform.d.ts +12 -0
- package/dist/transform.js +442 -0
- package/dist/types/elements/index.d.ts +120 -693
- package/dist/types/elements/typeChecks.d.ts +6 -3
- package/dist/types/elements/typeChecks.js +9 -8
- package/dist/types/geometryTypes.d.ts +1 -1
- package/dist/types/index.d.ts +38 -305
- package/dist/utils/constants.d.ts +21 -100
- package/dist/utils/constants.js +29 -212
- package/dist/utils/elements/freedrawElement.d.ts +6 -0
- package/dist/utils/elements/freedrawElement.js +28 -11
- package/dist/utils/elements/index.d.ts +3 -14
- package/dist/utils/elements/index.js +7 -99
- package/dist/utils/elements/linearElement.d.ts +2 -2
- package/dist/utils/elements/newElement.d.ts +2 -12
- package/dist/utils/elements/newElement.js +32 -52
- package/dist/utils/elements/textElement.d.ts +3 -3
- package/dist/utils/elements/textElement.js +44 -17
- package/dist/utils/math/index.d.ts +5 -4
- package/dist/utils/math/index.js +3 -3
- package/dist/utils/shape.js +2 -2
- package/dist/utils/state/index.d.ts +0 -1
- package/dist/utils/state/index.js +5 -71
- package/dist/utils/traverse.d.ts +8 -0
- package/dist/utils/traverse.js +37 -0
- package/dist/version-control.d.ts +61 -0
- package/dist/version-control.js +84 -0
- package/dist/wasm.d.ts +20 -0
- package/dist/wasm.js +52 -0
- package/package.json +2 -2
- package/dist/flatbuffers/duc/alternate-units.d.ts +0 -21
- package/dist/flatbuffers/duc/alternate-units.js +0 -66
- package/dist/flatbuffers/duc/angular-unit-system.d.ts +0 -17
- package/dist/flatbuffers/duc/angular-unit-system.js +0 -50
- package/dist/flatbuffers/duc/angular-units-format.d.ts +0 -7
- package/dist/flatbuffers/duc/angular-units-format.js +0 -10
- package/dist/flatbuffers/duc/axis.d.ts +0 -5
- package/dist/flatbuffers/duc/axis.js +0 -8
- package/dist/flatbuffers/duc/bezier-mirroring.d.ts +0 -5
- package/dist/flatbuffers/duc/bezier-mirroring.js +0 -8
- package/dist/flatbuffers/duc/blending.d.ts +0 -9
- package/dist/flatbuffers/duc/blending.js +0 -12
- package/dist/flatbuffers/duc/block-attachment.d.ts +0 -4
- package/dist/flatbuffers/duc/block-attachment.js +0 -7
- package/dist/flatbuffers/duc/boolean-operation.d.ts +0 -6
- package/dist/flatbuffers/duc/boolean-operation.js +0 -9
- package/dist/flatbuffers/duc/bound-element.d.ts +0 -17
- package/dist/flatbuffers/duc/bound-element.js +0 -48
- package/dist/flatbuffers/duc/checkpoint.d.ts +0 -22
- package/dist/flatbuffers/duc/checkpoint.js +0 -75
- package/dist/flatbuffers/duc/column-layout.d.ts +0 -22
- package/dist/flatbuffers/duc/column-layout.js +0 -72
- package/dist/flatbuffers/duc/column-type.d.ts +0 -5
- package/dist/flatbuffers/duc/column-type.js +0 -8
- package/dist/flatbuffers/duc/custom-hatch-pattern.d.ts +0 -23
- package/dist/flatbuffers/duc/custom-hatch-pattern.js +0 -71
- package/dist/flatbuffers/duc/datum-bracket-style.d.ts +0 -5
- package/dist/flatbuffers/duc/datum-bracket-style.js +0 -8
- package/dist/flatbuffers/duc/datum-reference.d.ts +0 -17
- package/dist/flatbuffers/duc/datum-reference.js +0 -49
- package/dist/flatbuffers/duc/datum-target-type.d.ts +0 -6
- package/dist/flatbuffers/duc/datum-target-type.js +0 -9
- package/dist/flatbuffers/duc/decimal-separator.d.ts +0 -4
- package/dist/flatbuffers/duc/decimal-separator.js +0 -7
- package/dist/flatbuffers/duc/delta.d.ts +0 -22
- package/dist/flatbuffers/duc/delta.js +0 -75
- package/dist/flatbuffers/duc/dictionary-entry.d.ts +0 -17
- package/dist/flatbuffers/duc/dictionary-entry.js +0 -49
- package/dist/flatbuffers/duc/dimension-baseline-data.d.ts +0 -14
- package/dist/flatbuffers/duc/dimension-baseline-data.js +0 -40
- package/dist/flatbuffers/duc/dimension-bindings.d.ts +0 -17
- package/dist/flatbuffers/duc/dimension-bindings.js +0 -50
- package/dist/flatbuffers/duc/dimension-continue-data.d.ts +0 -14
- package/dist/flatbuffers/duc/dimension-continue-data.js +0 -40
- package/dist/flatbuffers/duc/dimension-definition-points.d.ts +0 -21
- package/dist/flatbuffers/duc/dimension-definition-points.js +0 -64
- package/dist/flatbuffers/duc/dimension-ext-line-style.d.ts +0 -18
- package/dist/flatbuffers/duc/dimension-ext-line-style.js +0 -57
- package/dist/flatbuffers/duc/dimension-fit-rule.d.ts +0 -6
- package/dist/flatbuffers/duc/dimension-fit-rule.js +0 -9
- package/dist/flatbuffers/duc/dimension-fit-style.d.ts +0 -19
- package/dist/flatbuffers/duc/dimension-fit-style.js +0 -58
- package/dist/flatbuffers/duc/dimension-line-style.d.ts +0 -16
- package/dist/flatbuffers/duc/dimension-line-style.js +0 -49
- package/dist/flatbuffers/duc/dimension-symbol-style.d.ts +0 -22
- package/dist/flatbuffers/duc/dimension-symbol-style.js +0 -72
- package/dist/flatbuffers/duc/dimension-text-placement.d.ts +0 -5
- package/dist/flatbuffers/duc/dimension-text-placement.js +0 -8
- package/dist/flatbuffers/duc/dimension-tolerance-style.d.ts +0 -24
- package/dist/flatbuffers/duc/dimension-tolerance-style.js +0 -71
- package/dist/flatbuffers/duc/dimension-type.d.ts +0 -15
- package/dist/flatbuffers/duc/dimension-type.js +0 -18
- package/dist/flatbuffers/duc/dimension-units-format.d.ts +0 -7
- package/dist/flatbuffers/duc/dimension-units-format.js +0 -10
- package/dist/flatbuffers/duc/dimension-validation-rules.d.ts +0 -25
- package/dist/flatbuffers/duc/dimension-validation-rules.js +0 -74
- package/dist/flatbuffers/duc/document-grid-align-items.d.ts +0 -5
- package/dist/flatbuffers/duc/document-grid-align-items.js +0 -8
- package/dist/flatbuffers/duc/document-grid-config.d.ts +0 -22
- package/dist/flatbuffers/duc/document-grid-config.js +0 -73
- package/dist/flatbuffers/duc/duc-arrow-element.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-arrow-element.js +0 -49
- package/dist/flatbuffers/duc/duc-block-attribute-definition-entry.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-block-attribute-definition-entry.js +0 -44
- package/dist/flatbuffers/duc/duc-block-attribute-definition.d.ts +0 -22
- package/dist/flatbuffers/duc/duc-block-attribute-definition.js +0 -64
- package/dist/flatbuffers/duc/duc-block-collection-entry.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-block-collection-entry.js +0 -48
- package/dist/flatbuffers/duc/duc-block-collection.d.ts +0 -31
- package/dist/flatbuffers/duc/duc-block-collection.js +0 -97
- package/dist/flatbuffers/duc/duc-block-duplication-array.d.ts +0 -19
- package/dist/flatbuffers/duc/duc-block-duplication-array.js +0 -64
- package/dist/flatbuffers/duc/duc-block-instance-element.d.ts +0 -10
- package/dist/flatbuffers/duc/duc-block-instance-element.js +0 -28
- package/dist/flatbuffers/duc/duc-block-instance.d.ts +0 -32
- package/dist/flatbuffers/duc/duc-block-instance.js +0 -100
- package/dist/flatbuffers/duc/duc-block-metadata.d.ts +0 -26
- package/dist/flatbuffers/duc/duc-block-metadata.js +0 -90
- package/dist/flatbuffers/duc/duc-block.d.ts +0 -36
- package/dist/flatbuffers/duc/duc-block.js +0 -112
- package/dist/flatbuffers/duc/duc-common-style.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-common-style.js +0 -44
- package/dist/flatbuffers/duc/duc-dimension-element.d.ts +0 -45
- package/dist/flatbuffers/duc/duc-dimension-element.js +0 -120
- package/dist/flatbuffers/duc/duc-dimension-style.d.ts +0 -28
- package/dist/flatbuffers/duc/duc-dimension-style.js +0 -76
- package/dist/flatbuffers/duc/duc-doc-element.d.ts +0 -39
- package/dist/flatbuffers/duc/duc-doc-element.js +0 -110
- package/dist/flatbuffers/duc/duc-doc-style.d.ts +0 -19
- package/dist/flatbuffers/duc/duc-doc-style.js +0 -52
- package/dist/flatbuffers/duc/duc-element-base.d.ts +0 -100
- package/dist/flatbuffers/duc/duc-element-base.js +0 -315
- package/dist/flatbuffers/duc/duc-element-styles-base.d.ts +0 -30
- package/dist/flatbuffers/duc/duc-element-styles-base.js +0 -103
- package/dist/flatbuffers/duc/duc-ellipse-element.d.ts +0 -22
- package/dist/flatbuffers/duc/duc-ellipse-element.js +0 -73
- package/dist/flatbuffers/duc/duc-embeddable-element.d.ts +0 -14
- package/dist/flatbuffers/duc/duc-embeddable-element.js +0 -41
- package/dist/flatbuffers/duc/duc-external-file-data.d.ts +0 -27
- package/dist/flatbuffers/duc/duc-external-file-data.js +0 -92
- package/dist/flatbuffers/duc/duc-external-file-entry.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-external-file-entry.js +0 -44
- package/dist/flatbuffers/duc/duc-feature-control-frame-element.d.ts +0 -31
- package/dist/flatbuffers/duc/duc-feature-control-frame-element.js +0 -89
- package/dist/flatbuffers/duc/duc-feature-control-frame-style.d.ts +0 -22
- package/dist/flatbuffers/duc/duc-feature-control-frame-style.js +0 -60
- package/dist/flatbuffers/duc/duc-frame-element.d.ts +0 -14
- package/dist/flatbuffers/duc/duc-frame-element.js +0 -41
- package/dist/flatbuffers/duc/duc-free-draw-element.d.ts +0 -52
- package/dist/flatbuffers/duc/duc-free-draw-element.js +0 -154
- package/dist/flatbuffers/duc/duc-free-draw-ends.d.ts +0 -18
- package/dist/flatbuffers/duc/duc-free-draw-ends.js +0 -56
- package/dist/flatbuffers/duc/duc-global-state.d.ts +0 -37
- package/dist/flatbuffers/duc/duc-global-state.js +0 -121
- package/dist/flatbuffers/duc/duc-group.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-group.js +0 -44
- package/dist/flatbuffers/duc/duc-hatch-style.d.ts +0 -28
- package/dist/flatbuffers/duc/duc-hatch-style.js +0 -79
- package/dist/flatbuffers/duc/duc-head.d.ts +0 -19
- package/dist/flatbuffers/duc/duc-head.js +0 -57
- package/dist/flatbuffers/duc/duc-image-element.d.ts +0 -35
- package/dist/flatbuffers/duc/duc-image-element.js +0 -91
- package/dist/flatbuffers/duc/duc-image-filter.d.ts +0 -15
- package/dist/flatbuffers/duc/duc-image-filter.js +0 -48
- package/dist/flatbuffers/duc/duc-layer-overrides.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-layer-overrides.js +0 -44
- package/dist/flatbuffers/duc/duc-layer.d.ts +0 -21
- package/dist/flatbuffers/duc/duc-layer.js +0 -59
- package/dist/flatbuffers/duc/duc-leader-element.d.ts +0 -22
- package/dist/flatbuffers/duc/duc-leader-element.js +0 -60
- package/dist/flatbuffers/duc/duc-leader-style.d.ts +0 -27
- package/dist/flatbuffers/duc/duc-leader-style.js +0 -79
- package/dist/flatbuffers/duc/duc-line-reference.d.ts +0 -15
- package/dist/flatbuffers/duc/duc-line-reference.js +0 -43
- package/dist/flatbuffers/duc/duc-line.d.ts +0 -15
- package/dist/flatbuffers/duc/duc-line.js +0 -43
- package/dist/flatbuffers/duc/duc-linear-element-base.d.ts +0 -38
- package/dist/flatbuffers/duc/duc-linear-element-base.js +0 -124
- package/dist/flatbuffers/duc/duc-linear-element.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-linear-element.js +0 -49
- package/dist/flatbuffers/duc/duc-local-state.d.ts +0 -68
- package/dist/flatbuffers/duc/duc-local-state.js +0 -206
- package/dist/flatbuffers/duc/duc-mermaid-element.d.ts +0 -23
- package/dist/flatbuffers/duc/duc-mermaid-element.js +0 -65
- package/dist/flatbuffers/duc/duc-model-element.d.ts +0 -26
- package/dist/flatbuffers/duc/duc-model-element.js +0 -79
- package/dist/flatbuffers/duc/duc-parametric-element.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-parametric-element.js +0 -44
- package/dist/flatbuffers/duc/duc-path.d.ts +0 -26
- package/dist/flatbuffers/duc/duc-path.js +0 -69
- package/dist/flatbuffers/duc/duc-pdf-element.d.ts +0 -19
- package/dist/flatbuffers/duc/duc-pdf-element.js +0 -51
- package/dist/flatbuffers/duc/duc-plot-element.d.ts +0 -19
- package/dist/flatbuffers/duc/duc-plot-element.js +0 -52
- package/dist/flatbuffers/duc/duc-plot-style.d.ts +0 -11
- package/dist/flatbuffers/duc/duc-plot-style.js +0 -32
- package/dist/flatbuffers/duc/duc-point-binding.d.ts +0 -26
- package/dist/flatbuffers/duc/duc-point-binding.js +0 -73
- package/dist/flatbuffers/duc/duc-point.d.ts +0 -18
- package/dist/flatbuffers/duc/duc-point.js +0 -57
- package/dist/flatbuffers/duc/duc-polygon-element.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-polygon-element.js +0 -49
- package/dist/flatbuffers/duc/duc-rectangle-element.d.ts +0 -14
- package/dist/flatbuffers/duc/duc-rectangle-element.js +0 -41
- package/dist/flatbuffers/duc/duc-region.d.ts +0 -19
- package/dist/flatbuffers/duc/duc-region.js +0 -51
- package/dist/flatbuffers/duc/duc-stack-base.d.ts +0 -27
- package/dist/flatbuffers/duc/duc-stack-base.js +0 -78
- package/dist/flatbuffers/duc/duc-stack-element-base.d.ts +0 -23
- package/dist/flatbuffers/duc/duc-stack-element-base.js +0 -65
- package/dist/flatbuffers/duc/duc-stack-like-styles.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-stack-like-styles.js +0 -48
- package/dist/flatbuffers/duc/duc-table-auto-size.d.ts +0 -15
- package/dist/flatbuffers/duc/duc-table-auto-size.js +0 -48
- package/dist/flatbuffers/duc/duc-table-cell-entry.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-table-cell-entry.js +0 -44
- package/dist/flatbuffers/duc/duc-table-cell-span.d.ts +0 -15
- package/dist/flatbuffers/duc/duc-table-cell-span.js +0 -48
- package/dist/flatbuffers/duc/duc-table-cell-style.d.ts +0 -22
- package/dist/flatbuffers/duc/duc-table-cell-style.js +0 -59
- package/dist/flatbuffers/duc/duc-table-cell.d.ts +0 -27
- package/dist/flatbuffers/duc/duc-table-cell.js +0 -72
- package/dist/flatbuffers/duc/duc-table-column-entry.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-table-column-entry.js +0 -44
- package/dist/flatbuffers/duc/duc-table-column.d.ts +0 -18
- package/dist/flatbuffers/duc/duc-table-column.js +0 -51
- package/dist/flatbuffers/duc/duc-table-element.d.ts +0 -51
- package/dist/flatbuffers/duc/duc-table-element.js +0 -167
- package/dist/flatbuffers/duc/duc-table-row-entry.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-table-row-entry.js +0 -44
- package/dist/flatbuffers/duc/duc-table-row.d.ts +0 -18
- package/dist/flatbuffers/duc/duc-table-row.js +0 -51
- package/dist/flatbuffers/duc/duc-table-style.d.ts +0 -20
- package/dist/flatbuffers/duc/duc-table-style.js +0 -57
- package/dist/flatbuffers/duc/duc-text-dynamic-dictionary-source.d.ts +0 -14
- package/dist/flatbuffers/duc/duc-text-dynamic-dictionary-source.js +0 -40
- package/dist/flatbuffers/duc/duc-text-dynamic-element-source.d.ts +0 -17
- package/dist/flatbuffers/duc/duc-text-dynamic-element-source.js +0 -49
- package/dist/flatbuffers/duc/duc-text-dynamic-part.d.ts +0 -22
- package/dist/flatbuffers/duc/duc-text-dynamic-part.js +0 -58
- package/dist/flatbuffers/duc/duc-text-dynamic-source-data.d.ts +0 -9
- package/dist/flatbuffers/duc/duc-text-dynamic-source-data.js +0 -26
- package/dist/flatbuffers/duc/duc-text-dynamic-source.d.ts +0 -19
- package/dist/flatbuffers/duc/duc-text-dynamic-source.js +0 -58
- package/dist/flatbuffers/duc/duc-text-element.d.ts +0 -33
- package/dist/flatbuffers/duc/duc-text-element.js +0 -94
- package/dist/flatbuffers/duc/duc-text-style.d.ts +0 -41
- package/dist/flatbuffers/duc/duc-text-style.js +0 -120
- package/dist/flatbuffers/duc/duc-ucs.d.ts +0 -16
- package/dist/flatbuffers/duc/duc-ucs.js +0 -49
- package/dist/flatbuffers/duc/duc-view.d.ts +0 -24
- package/dist/flatbuffers/duc/duc-view.js +0 -71
- package/dist/flatbuffers/duc/duc-viewport-element.d.ts +0 -36
- package/dist/flatbuffers/duc/duc-viewport-element.js +0 -102
- package/dist/flatbuffers/duc/duc-viewport-style.d.ts +0 -13
- package/dist/flatbuffers/duc/duc-viewport-style.js +0 -40
- package/dist/flatbuffers/duc/duc-xray-element.d.ts +0 -23
- package/dist/flatbuffers/duc/duc-xray-element.js +0 -66
- package/dist/flatbuffers/duc/duc-xray-style.d.ts +0 -14
- package/dist/flatbuffers/duc/duc-xray-style.js +0 -40
- package/dist/flatbuffers/duc/dynamic-snap-settings.d.ts +0 -17
- package/dist/flatbuffers/duc/dynamic-snap-settings.js +0 -56
- package/dist/flatbuffers/duc/element-background.d.ts +0 -14
- package/dist/flatbuffers/duc/element-background.js +0 -41
- package/dist/flatbuffers/duc/element-content-base.d.ts +0 -29
- package/dist/flatbuffers/duc/element-content-base.js +0 -80
- package/dist/flatbuffers/duc/element-content-preference.d.ts +0 -8
- package/dist/flatbuffers/duc/element-content-preference.js +0 -11
- package/dist/flatbuffers/duc/element-stroke.d.ts +0 -24
- package/dist/flatbuffers/duc/element-stroke.js +0 -66
- package/dist/flatbuffers/duc/element-wrapper.d.ts +0 -16
- package/dist/flatbuffers/duc/element-wrapper.js +0 -49
- package/dist/flatbuffers/duc/element.d.ts +0 -51
- package/dist/flatbuffers/duc/element.js +0 -110
- package/dist/flatbuffers/duc/exported-data-state.d.ts +0 -102
- package/dist/flatbuffers/duc/exported-data-state.js +0 -341
- package/dist/flatbuffers/duc/fcfbetween-modifier.d.ts +0 -17
- package/dist/flatbuffers/duc/fcfbetween-modifier.js +0 -48
- package/dist/flatbuffers/duc/fcfdatum-definition.d.ts +0 -16
- package/dist/flatbuffers/duc/fcfdatum-definition.js +0 -43
- package/dist/flatbuffers/duc/fcfdatum-style.d.ts +0 -14
- package/dist/flatbuffers/duc/fcfdatum-style.js +0 -41
- package/dist/flatbuffers/duc/fcfframe-modifiers.d.ts +0 -22
- package/dist/flatbuffers/duc/fcfframe-modifiers.js +0 -65
- package/dist/flatbuffers/duc/fcflayout-style.d.ts +0 -17
- package/dist/flatbuffers/duc/fcflayout-style.js +0 -56
- package/dist/flatbuffers/duc/fcfprojected-zone-modifier.d.ts +0 -13
- package/dist/flatbuffers/duc/fcfprojected-zone-modifier.js +0 -40
- package/dist/flatbuffers/duc/fcfsegment-row.d.ts +0 -17
- package/dist/flatbuffers/duc/fcfsegment-row.js +0 -55
- package/dist/flatbuffers/duc/fcfsymbol-style.d.ts +0 -13
- package/dist/flatbuffers/duc/fcfsymbol-style.js +0 -40
- package/dist/flatbuffers/duc/feature-control-frame-segment.d.ts +0 -22
- package/dist/flatbuffers/duc/feature-control-frame-segment.js +0 -65
- package/dist/flatbuffers/duc/feature-modifier.d.ts +0 -18
- package/dist/flatbuffers/duc/feature-modifier.js +0 -21
- package/dist/flatbuffers/duc/gdt-symbol.d.ts +0 -22
- package/dist/flatbuffers/duc/gdt-symbol.js +0 -25
- package/dist/flatbuffers/duc/geometric-point.d.ts +0 -10
- package/dist/flatbuffers/duc/geometric-point.js +0 -27
- package/dist/flatbuffers/duc/grid-display-type.d.ts +0 -6
- package/dist/flatbuffers/duc/grid-display-type.js +0 -9
- package/dist/flatbuffers/duc/grid-settings.d.ts +0 -54
- package/dist/flatbuffers/duc/grid-settings.js +0 -165
- package/dist/flatbuffers/duc/grid-style.d.ts +0 -26
- package/dist/flatbuffers/duc/grid-style.js +0 -74
- package/dist/flatbuffers/duc/grid-type.d.ts +0 -7
- package/dist/flatbuffers/duc/grid-type.js +0 -10
- package/dist/flatbuffers/duc/handle-type.d.ts +0 -4
- package/dist/flatbuffers/duc/handle-type.js +0 -7
- package/dist/flatbuffers/duc/hatch-pattern-line.d.ts +0 -35
- package/dist/flatbuffers/duc/hatch-pattern-line.js +0 -93
- package/dist/flatbuffers/duc/hatch-style.d.ts +0 -5
- package/dist/flatbuffers/duc/hatch-style.js +0 -8
- package/dist/flatbuffers/duc/identified-common-style.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-common-style.js +0 -44
- package/dist/flatbuffers/duc/identified-dimension-style.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-dimension-style.js +0 -44
- package/dist/flatbuffers/duc/identified-doc-style.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-doc-style.js +0 -44
- package/dist/flatbuffers/duc/identified-fcfstyle.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-fcfstyle.js +0 -44
- package/dist/flatbuffers/duc/identified-grid-settings.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-grid-settings.js +0 -44
- package/dist/flatbuffers/duc/identified-hatch-style.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-hatch-style.js +0 -44
- package/dist/flatbuffers/duc/identified-leader-style.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-leader-style.js +0 -44
- package/dist/flatbuffers/duc/identified-snap-settings.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-snap-settings.js +0 -44
- package/dist/flatbuffers/duc/identified-stack-like-style.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-stack-like-style.js +0 -44
- package/dist/flatbuffers/duc/identified-table-style.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-table-style.js +0 -44
- package/dist/flatbuffers/duc/identified-text-style.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-text-style.js +0 -44
- package/dist/flatbuffers/duc/identified-ucs.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-ucs.js +0 -44
- package/dist/flatbuffers/duc/identified-view.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-view.js +0 -44
- package/dist/flatbuffers/duc/identified-viewport-style.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-viewport-style.js +0 -44
- package/dist/flatbuffers/duc/identified-xray-style.d.ts +0 -16
- package/dist/flatbuffers/duc/identified-xray-style.js +0 -44
- package/dist/flatbuffers/duc/identifier.d.ts +0 -20
- package/dist/flatbuffers/duc/identifier.js +0 -57
- package/dist/flatbuffers/duc/image-crop.d.ts +0 -23
- package/dist/flatbuffers/duc/image-crop.js +0 -80
- package/dist/flatbuffers/duc/image-status.d.ts +0 -5
- package/dist/flatbuffers/duc/image-status.js +0 -8
- package/dist/flatbuffers/duc/isometric-grid-settings.d.ts +0 -15
- package/dist/flatbuffers/duc/isometric-grid-settings.js +0 -48
- package/dist/flatbuffers/duc/jsonpatch-operation.d.ts +0 -23
- package/dist/flatbuffers/duc/jsonpatch-operation.js +0 -64
- package/dist/flatbuffers/duc/layer-snap-filters.d.ts +0 -23
- package/dist/flatbuffers/duc/layer-snap-filters.js +0 -76
- package/dist/flatbuffers/duc/layer-validation-rules.d.ts +0 -17
- package/dist/flatbuffers/duc/layer-validation-rules.js +0 -54
- package/dist/flatbuffers/duc/leader-block-content.d.ts +0 -25
- package/dist/flatbuffers/duc/leader-block-content.js +0 -85
- package/dist/flatbuffers/duc/leader-content-data.d.ts +0 -9
- package/dist/flatbuffers/duc/leader-content-data.js +0 -26
- package/dist/flatbuffers/duc/leader-content-type.d.ts +0 -4
- package/dist/flatbuffers/duc/leader-content-type.js +0 -7
- package/dist/flatbuffers/duc/leader-content.d.ts +0 -19
- package/dist/flatbuffers/duc/leader-content.js +0 -58
- package/dist/flatbuffers/duc/leader-text-block-content.d.ts +0 -14
- package/dist/flatbuffers/duc/leader-text-block-content.js +0 -40
- package/dist/flatbuffers/duc/line-head.d.ts +0 -17
- package/dist/flatbuffers/duc/line-head.js +0 -20
- package/dist/flatbuffers/duc/line-spacing-type.d.ts +0 -5
- package/dist/flatbuffers/duc/line-spacing-type.js +0 -8
- package/dist/flatbuffers/duc/line-spacing.d.ts +0 -16
- package/dist/flatbuffers/duc/line-spacing.js +0 -49
- package/dist/flatbuffers/duc/linear-unit-system.d.ts +0 -24
- package/dist/flatbuffers/duc/linear-unit-system.js +0 -75
- package/dist/flatbuffers/duc/margins.d.ts +0 -19
- package/dist/flatbuffers/duc/margins.js +0 -64
- package/dist/flatbuffers/duc/mark-ellipse-center.d.ts +0 -4
- package/dist/flatbuffers/duc/mark-ellipse-center.js +0 -7
- package/dist/flatbuffers/duc/material-condition.d.ts +0 -5
- package/dist/flatbuffers/duc/material-condition.js +0 -8
- package/dist/flatbuffers/duc/object-snap-mode.d.ts +0 -22
- package/dist/flatbuffers/duc/object-snap-mode.js +0 -25
- package/dist/flatbuffers/duc/paragraph-formatting.d.ts +0 -33
- package/dist/flatbuffers/duc/paragraph-formatting.js +0 -106
- package/dist/flatbuffers/duc/parametric-source-type.d.ts +0 -4
- package/dist/flatbuffers/duc/parametric-source-type.js +0 -7
- package/dist/flatbuffers/duc/parametric-source.d.ts +0 -20
- package/dist/flatbuffers/duc/parametric-source.js +0 -57
- package/dist/flatbuffers/duc/plot-layout.d.ts +0 -14
- package/dist/flatbuffers/duc/plot-layout.js +0 -41
- package/dist/flatbuffers/duc/point-binding-point.d.ts +0 -15
- package/dist/flatbuffers/duc/point-binding-point.js +0 -48
- package/dist/flatbuffers/duc/polar-grid-settings.d.ts +0 -17
- package/dist/flatbuffers/duc/polar-grid-settings.js +0 -56
- package/dist/flatbuffers/duc/polar-tracking-settings.d.ts +0 -29
- package/dist/flatbuffers/duc/polar-tracking-settings.js +0 -90
- package/dist/flatbuffers/duc/primary-units.d.ts +0 -16
- package/dist/flatbuffers/duc/primary-units.js +0 -44
- package/dist/flatbuffers/duc/pruning-level.d.ts +0 -5
- package/dist/flatbuffers/duc/pruning-level.js +0 -8
- package/dist/flatbuffers/duc/snap-marker-settings.d.ts +0 -23
- package/dist/flatbuffers/duc/snap-marker-settings.js +0 -79
- package/dist/flatbuffers/duc/snap-marker-shape.d.ts +0 -6
- package/dist/flatbuffers/duc/snap-marker-shape.js +0 -9
- package/dist/flatbuffers/duc/snap-marker-style-entry.d.ts +0 -16
- package/dist/flatbuffers/duc/snap-marker-style-entry.js +0 -43
- package/dist/flatbuffers/duc/snap-marker-style.d.ts +0 -17
- package/dist/flatbuffers/duc/snap-marker-style.js +0 -49
- package/dist/flatbuffers/duc/snap-mode.d.ts +0 -4
- package/dist/flatbuffers/duc/snap-mode.js +0 -7
- package/dist/flatbuffers/duc/snap-override-behavior.d.ts +0 -5
- package/dist/flatbuffers/duc/snap-override-behavior.js +0 -8
- package/dist/flatbuffers/duc/snap-override.d.ts +0 -17
- package/dist/flatbuffers/duc/snap-override.js +0 -49
- package/dist/flatbuffers/duc/snap-settings.d.ts +0 -75
- package/dist/flatbuffers/duc/snap-settings.js +0 -245
- package/dist/flatbuffers/duc/stack-format-properties.d.ts +0 -18
- package/dist/flatbuffers/duc/stack-format-properties.js +0 -57
- package/dist/flatbuffers/duc/stack-format.d.ts +0 -21
- package/dist/flatbuffers/duc/stack-format.js +0 -64
- package/dist/flatbuffers/duc/stacked-text-align.d.ts +0 -5
- package/dist/flatbuffers/duc/stacked-text-align.js +0 -8
- package/dist/flatbuffers/duc/standard-overrides.d.ts +0 -63
- package/dist/flatbuffers/duc/standard-overrides.js +0 -162
- package/dist/flatbuffers/duc/standard-styles.d.ts +0 -77
- package/dist/flatbuffers/duc/standard-styles.js +0 -285
- package/dist/flatbuffers/duc/standard-units.d.ts +0 -16
- package/dist/flatbuffers/duc/standard-units.js +0 -44
- package/dist/flatbuffers/duc/standard-validation.d.ts +0 -16
- package/dist/flatbuffers/duc/standard-validation.js +0 -44
- package/dist/flatbuffers/duc/standard-view-settings.d.ts +0 -35
- package/dist/flatbuffers/duc/standard-view-settings.js +0 -124
- package/dist/flatbuffers/duc/standard.d.ts +0 -33
- package/dist/flatbuffers/duc/standard.js +0 -90
- package/dist/flatbuffers/duc/string-value-entry.d.ts +0 -17
- package/dist/flatbuffers/duc/string-value-entry.js +0 -49
- package/dist/flatbuffers/duc/stroke-cap.d.ts +0 -5
- package/dist/flatbuffers/duc/stroke-cap.js +0 -8
- package/dist/flatbuffers/duc/stroke-join.d.ts +0 -5
- package/dist/flatbuffers/duc/stroke-join.js +0 -8
- package/dist/flatbuffers/duc/stroke-placement.d.ts +0 -5
- package/dist/flatbuffers/duc/stroke-placement.js +0 -8
- package/dist/flatbuffers/duc/stroke-preference.d.ts +0 -6
- package/dist/flatbuffers/duc/stroke-preference.js +0 -9
- package/dist/flatbuffers/duc/stroke-side-preference.d.ts +0 -8
- package/dist/flatbuffers/duc/stroke-side-preference.js +0 -11
- package/dist/flatbuffers/duc/stroke-sides.d.ts +0 -24
- package/dist/flatbuffers/duc/stroke-sides.js +0 -67
- package/dist/flatbuffers/duc/stroke-style.d.ts +0 -37
- package/dist/flatbuffers/duc/stroke-style.js +0 -111
- package/dist/flatbuffers/duc/stroke-width.d.ts +0 -5
- package/dist/flatbuffers/duc/stroke-width.js +0 -8
- package/dist/flatbuffers/duc/table-cell-alignment.d.ts +0 -11
- package/dist/flatbuffers/duc/table-cell-alignment.js +0 -14
- package/dist/flatbuffers/duc/table-flow-direction.d.ts +0 -4
- package/dist/flatbuffers/duc/table-flow-direction.js +0 -7
- package/dist/flatbuffers/duc/text-align.d.ts +0 -5
- package/dist/flatbuffers/duc/text-align.js +0 -8
- package/dist/flatbuffers/duc/text-column.d.ts +0 -15
- package/dist/flatbuffers/duc/text-column.js +0 -48
- package/dist/flatbuffers/duc/text-field-source-property.d.ts +0 -13
- package/dist/flatbuffers/duc/text-field-source-property.js +0 -16
- package/dist/flatbuffers/duc/text-field-source-type.d.ts +0 -4
- package/dist/flatbuffers/duc/text-field-source-type.js +0 -7
- package/dist/flatbuffers/duc/text-flow-direction.d.ts +0 -6
- package/dist/flatbuffers/duc/text-flow-direction.js +0 -9
- package/dist/flatbuffers/duc/tiling-properties.d.ts +0 -21
- package/dist/flatbuffers/duc/tiling-properties.js +0 -75
- package/dist/flatbuffers/duc/tolerance-clause.d.ts +0 -27
- package/dist/flatbuffers/duc/tolerance-clause.js +0 -84
- package/dist/flatbuffers/duc/tolerance-display.d.ts +0 -7
- package/dist/flatbuffers/duc/tolerance-display.js +0 -10
- package/dist/flatbuffers/duc/tolerance-type.d.ts +0 -5
- package/dist/flatbuffers/duc/tolerance-type.js +0 -8
- package/dist/flatbuffers/duc/tolerance-zone-type.d.ts +0 -7
- package/dist/flatbuffers/duc/tolerance-zone-type.js +0 -10
- package/dist/flatbuffers/duc/tracking-line-style.d.ts +0 -26
- package/dist/flatbuffers/duc/tracking-line-style.js +0 -74
- package/dist/flatbuffers/duc/unit-precision.d.ts +0 -19
- package/dist/flatbuffers/duc/unit-precision.js +0 -64
- package/dist/flatbuffers/duc/unit-system-base.d.ts +0 -20
- package/dist/flatbuffers/duc/unit-system-base.js +0 -65
- package/dist/flatbuffers/duc/unit-system.d.ts +0 -4
- package/dist/flatbuffers/duc/unit-system.js +0 -7
- package/dist/flatbuffers/duc/version-base.d.ts +0 -27
- package/dist/flatbuffers/duc/version-base.js +0 -80
- package/dist/flatbuffers/duc/version-graph-metadata.d.ts +0 -15
- package/dist/flatbuffers/duc/version-graph-metadata.js +0 -48
- package/dist/flatbuffers/duc/version-graph.d.ts +0 -31
- package/dist/flatbuffers/duc/version-graph.js +0 -94
- package/dist/flatbuffers/duc/vertical-align.d.ts +0 -5
- package/dist/flatbuffers/duc/vertical-align.js +0 -8
- package/dist/flatbuffers/duc/viewport-shade-plot.d.ts +0 -6
- package/dist/flatbuffers/duc/viewport-shade-plot.js +0 -9
- package/dist/flatbuffers/duc/youtube-states.d.ts +0 -8
- package/dist/flatbuffers/duc/youtube-states.js +0 -11
- package/dist/flatbuffers/duc.d.ts +0 -234
- package/dist/flatbuffers/duc.js +0 -236
- package/dist/restore/restoreStandards.d.ts +0 -8
- package/dist/restore/restoreStandards.js +0 -224
- package/dist/technical/standards.d.ts +0 -124
- package/dist/technical/standards.js +0 -10
- package/dist/utils/elements/viewportElement.d.ts +0 -6
- package/dist/utils/elements/viewportElement.js +0 -9
- package/dist/utils/state/grid.d.ts +0 -7
- package/dist/utils/state/grid.js +0 -25
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isValidColor, isValidDucHead, isValidEnumValue, isValidFunction, isValidImageScaleValue, isValidImageStatusValue, isValidPercentageValue, isValidPolygonSides, isValidRadianValue, isValidString, isValidTextAlignValue, isValidVerticalAlignValue, restoreDucStackProperties, restorePrecisionValue, validateBackground, validateStroke } from "./restoreDataState";
|
|
3
|
-
import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, getScaledZoomValueForScope, getScopedBezierPointFromDucPoint, getScopedZoomValue, NEUTRAL_SCOPE, ScaleFactors, } from "../technical/scopes";
|
|
1
|
+
import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, getScopedBezierPointFromDucPoint, NEUTRAL_SCOPE, ScaleFactors } from "../technical/scopes";
|
|
4
2
|
import { isElbowArrow, isLinearElement, isTextElement, } from "../types";
|
|
5
|
-
import { arrayToMap, bumpVersion, DEFAULT_ELEMENT_PROPS, DEFAULT_ELLIPSE_ELEMENT, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FREEDRAW_ELEMENT, detectLineHeight, FONT_FAMILY, getContainerElement,
|
|
6
|
-
import {
|
|
3
|
+
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
|
+
import { isValidBezierMirroringValue, isValidBlendingValue, isValidBoolean, isValidBoolean as isValidBooleanValue, // Renaming to avoid conflict
|
|
5
|
+
isValidColor, isValidDucHead, isValidFunction, isValidImageScaleValue, isValidImageStatusValue, isValidPercentageValue, isValidPolygonSides, isValidRadianValue, isValidString, isValidTextAlignValue, isValidVerticalAlignValue, restoreDucStackProperties, restorePrecisionValue, validateBackground, validateStroke } from "./restoreDataState";
|
|
6
|
+
import { LINE_SPACING_TYPE, } from "../enums";
|
|
7
|
+
const PARAMETRIC_SOURCE_TYPE = { CODE: 10, FILE: 11 };
|
|
7
8
|
import tinycolor from "tinycolor2";
|
|
8
9
|
const restoreElementWithProperties = (element, extra, localState, globalState) => {
|
|
9
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
10
11
|
const _element = Object.assign(Object.assign({}, element), extra);
|
|
11
12
|
const elementScope = isValidElementScopeValue(_element.scope, globalState === null || globalState === void 0 ? void 0 : globalState.mainScope);
|
|
12
13
|
const currentScope = isValidElementScopeValue(localState === null || localState === void 0 ? void 0 : localState.scope, globalState === null || globalState === void 0 ? void 0 : globalState.mainScope);
|
|
@@ -52,20 +53,21 @@ const restoreElementWithProperties = (element, extra, localState, globalState) =
|
|
|
52
53
|
label: (_c = _element.label) !== null && _c !== void 0 ? _c : "Lost Element Label",
|
|
53
54
|
isVisible: isValidBoolean(_element.isVisible, DEFAULT_ELEMENT_PROPS.isVisible),
|
|
54
55
|
isPlot: isValidBoolean(_element.isPlot, DEFAULT_ELEMENT_PROPS.isPlot),
|
|
55
|
-
isAnnotative: isValidBoolean(_element.isAnnotative, DEFAULT_ELEMENT_PROPS.isAnnotative),
|
|
56
56
|
layerId: (_d = _element.layerId) !== null && _d !== void 0 ? _d : null,
|
|
57
57
|
regionIds: Array.isArray(_element.regionIds) ? _element.regionIds : [],
|
|
58
58
|
width: restorePrecisionValue(_element.width, elementScope, currentScope, 0),
|
|
59
59
|
height: restorePrecisionValue(_element.height, elementScope, currentScope, 0),
|
|
60
60
|
seed: (_e = _element.seed) !== null && _e !== void 0 ? _e : 1,
|
|
61
61
|
groupIds: (_f = _element.groupIds) !== null && _f !== void 0 ? _f : [],
|
|
62
|
-
|
|
62
|
+
blockIds: Array.isArray(_element.blockIds) ? _element.blockIds : [],
|
|
63
|
+
instanceId: (_g = _element.instanceId) !== null && _g !== void 0 ? _g : null,
|
|
64
|
+
frameId: (_h = _element.frameId) !== null && _h !== void 0 ? _h : null,
|
|
63
65
|
roundness: restorePrecisionValue(_element.roundness, elementScope, currentScope, DEFAULT_ELEMENT_PROPS.roundness.value),
|
|
64
|
-
boundElements: (
|
|
65
|
-
updated: (
|
|
66
|
+
boundElements: (_j = _element.boundElements) !== null && _j !== void 0 ? _j : undefined,
|
|
67
|
+
updated: (_k = _element.updated) !== null && _k !== void 0 ? _k : getUpdatedTimestamp(),
|
|
66
68
|
link: _element.link ? normalizeLink(_element.link) : undefined,
|
|
67
69
|
locked: isValidBooleanValue(_element.locked, false),
|
|
68
|
-
description: (
|
|
70
|
+
description: (_l = _element.description) !== null && _l !== void 0 ? _l : undefined,
|
|
69
71
|
};
|
|
70
72
|
if ("customData" in element || "customData" in extra) {
|
|
71
73
|
base.customData = _element.customData;
|
|
@@ -80,7 +82,7 @@ const restoreElementWithProperties = (element, extra, localState, globalState) =
|
|
|
80
82
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, _element), base), normalized), { type: _element.type });
|
|
81
83
|
};
|
|
82
84
|
const restoreElement = (element, currentScope, restoredBlocks, localState, globalState) => {
|
|
83
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
85
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
84
86
|
// Migration: convert deprecated 'diamond' to 'polygon' with 4 sides
|
|
85
87
|
if (element.type === "diamond") {
|
|
86
88
|
const migrated = Object.assign(Object.assign({}, element), { type: "polygon", sides: 4 });
|
|
@@ -90,6 +92,10 @@ const restoreElement = (element, currentScope, restoredBlocks, localState, globa
|
|
|
90
92
|
case "text": {
|
|
91
93
|
let fontSize = element.fontSize;
|
|
92
94
|
let fontFamily = element.fontFamily;
|
|
95
|
+
// Restore condition: if font family is "10", change to DEFAULT_FONT_FAMILY
|
|
96
|
+
if (fontFamily === "10") {
|
|
97
|
+
fontFamily = DEFAULT_FONT_FAMILY;
|
|
98
|
+
}
|
|
93
99
|
if ("font" in element) {
|
|
94
100
|
try {
|
|
95
101
|
const fontParts = String(element.font).split(" ");
|
|
@@ -118,7 +124,6 @@ const restoreElement = (element, currentScope, restoredBlocks, localState, globa
|
|
|
118
124
|
const restoredTextElement = restoreElementWithProperties(element, {
|
|
119
125
|
// DucTextElement specific
|
|
120
126
|
text,
|
|
121
|
-
dynamic: restoreTextDynamicParts(element.dynamic),
|
|
122
127
|
autoResize: isValidBooleanValue(element.autoResize, true),
|
|
123
128
|
containerId: (_a = element.containerId) !== null && _a !== void 0 ? _a : null,
|
|
124
129
|
originalText: element.originalText || text,
|
|
@@ -132,9 +137,6 @@ const restoreElement = (element, currentScope, restoredBlocks, localState, globa
|
|
|
132
137
|
lineSpacing: restoredLineSpacing,
|
|
133
138
|
obliqueAngle: isValidRadianValue(element.obliqueAngle, 0),
|
|
134
139
|
fontSize: finalFontSize,
|
|
135
|
-
paperTextHeight: element.paperTextHeight
|
|
136
|
-
? restorePrecisionValue(element.paperTextHeight, textElementScope, currentScope)
|
|
137
|
-
: undefined,
|
|
138
140
|
widthFactor: typeof element.widthFactor === "number"
|
|
139
141
|
? element.widthFactor
|
|
140
142
|
: 1,
|
|
@@ -298,180 +300,39 @@ const restoreElement = (element, currentScope, restoredBlocks, localState, globa
|
|
|
298
300
|
};
|
|
299
301
|
return restoreElementWithProperties(plotElement, Object.assign(Object.assign({}, stackProperties), { layout }), localState, globalState);
|
|
300
302
|
}
|
|
301
|
-
case "viewport": {
|
|
302
|
-
const viewportElement = element;
|
|
303
|
-
const elementScope = isValidElementScopeValue(viewportElement.scope, globalState === null || globalState === void 0 ? void 0 : globalState.mainScope);
|
|
304
|
-
// A viewport has both linear and stack properties
|
|
305
|
-
const { points, lines } = restoreLinearElementPointsAndLines({
|
|
306
|
-
points: viewportElement.points,
|
|
307
|
-
lines: viewportElement.lines,
|
|
308
|
-
x: viewportElement.x,
|
|
309
|
-
y: viewportElement.y,
|
|
310
|
-
width: viewportElement.width,
|
|
311
|
-
height: viewportElement.height,
|
|
312
|
-
elementScope,
|
|
313
|
-
currentScope,
|
|
314
|
-
skipNormalization: false, // Viewports are typically non-binding polygons
|
|
315
|
-
});
|
|
316
|
-
const stackProperties = restoreStackElementProperties(viewportElement, currentScope);
|
|
317
|
-
const defaults = getDefaultLocalState();
|
|
318
|
-
const zoomValue = getNormalizedZoom(isFiniteNumber((_l = localState === null || localState === void 0 ? void 0 : localState.zoom) === null || _l === void 0 ? void 0 : _l.value)
|
|
319
|
-
? localState.zoom.value
|
|
320
|
-
: defaults.zoom.value);
|
|
321
|
-
const scopedZoom = getScopedZoomValue(zoomValue, currentScope);
|
|
322
|
-
const view = {
|
|
323
|
-
scrollX: restorePrecisionValue((_m = viewportElement.view) === null || _m === void 0 ? void 0 : _m.scrollX, NEUTRAL_SCOPE, currentScope, 0),
|
|
324
|
-
scrollY: restorePrecisionValue((_o = viewportElement.view) === null || _o === void 0 ? void 0 : _o.scrollY, NEUTRAL_SCOPE, currentScope, 0),
|
|
325
|
-
zoom: {
|
|
326
|
-
value: zoomValue,
|
|
327
|
-
scoped: scopedZoom,
|
|
328
|
-
scaled: getScaledZoomValueForScope(scopedZoom, currentScope),
|
|
329
|
-
},
|
|
330
|
-
twistAngle: isValidRadianValue((_p = viewportElement.view) === null || _p === void 0 ? void 0 : _p.twistAngle, 0),
|
|
331
|
-
centerPoint: restorePoint((_q = viewportElement.view) === null || _q === void 0 ? void 0 : _q.centerPoint, NEUTRAL_SCOPE, currentScope), // Assuming centerPoint is always present
|
|
332
|
-
scope: isValidElementScopeValue((_r = viewportElement.view) === null || _r === void 0 ? void 0 : _r.scope, globalState === null || globalState === void 0 ? void 0 : globalState.mainScope),
|
|
333
|
-
};
|
|
334
|
-
return restoreElementWithProperties(viewportElement, Object.assign(Object.assign({}, stackProperties), { points,
|
|
335
|
-
lines,
|
|
336
|
-
view, scale: (typeof viewportElement.scale === "number"
|
|
337
|
-
? viewportElement.scale
|
|
338
|
-
: 1), shadePlot: isValidEnumValue(viewportElement.shadePlot, VIEWPORT_SHADE_PLOT, VIEWPORT_SHADE_PLOT.AS_DISPLAYED), frozenGroupIds: Array.isArray(viewportElement.frozenGroupIds)
|
|
339
|
-
? viewportElement.frozenGroupIds
|
|
340
|
-
: [],
|
|
341
|
-
// viewport-specific style
|
|
342
|
-
scaleIndicatorVisible: isValidBoolean(viewportElement.scaleIndicatorVisible, true) }), localState, globalState);
|
|
343
|
-
}
|
|
344
303
|
// Other elements
|
|
345
304
|
case "pdf":
|
|
346
305
|
return restoreElementWithProperties(element, {
|
|
347
306
|
fileId: isValidString(element.fileId) || null,
|
|
348
307
|
gridConfig: restoreDocumentGridConfig(element.gridConfig),
|
|
349
308
|
}, localState);
|
|
350
|
-
case "mermaid":
|
|
351
|
-
return restoreElementWithProperties(element, {
|
|
352
|
-
source: isValidString(element.source),
|
|
353
|
-
theme: isValidString(element.theme) || undefined,
|
|
354
|
-
svgPath: isValidString(element.svgPath) || null,
|
|
355
|
-
}, localState);
|
|
356
309
|
// Complex elements requiring specific restore logic
|
|
357
310
|
case "table": {
|
|
358
311
|
const tableElement = element;
|
|
359
312
|
const defaultData = getDefaultTableData(currentScope);
|
|
360
313
|
return restoreElementWithProperties(tableElement, {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
: defaultData.columnOrder,
|
|
364
|
-
rowOrder: Array.isArray(tableElement.rowOrder)
|
|
365
|
-
? tableElement.rowOrder
|
|
366
|
-
: defaultData.rowOrder,
|
|
367
|
-
columns: restoreTableColumns(tableElement.columns, currentScope, defaultData.columns),
|
|
368
|
-
rows: restoreTableRows(tableElement.rows, currentScope, defaultData.rows),
|
|
369
|
-
cells: restoreTableCells(tableElement.cells, defaultData.cells),
|
|
370
|
-
headerRowCount: typeof tableElement.headerRowCount === "number"
|
|
371
|
-
? tableElement.headerRowCount
|
|
372
|
-
: defaultData.headerRowCount,
|
|
373
|
-
autoSize: tableElement.autoSize || defaultData.autoSize,
|
|
374
|
-
// DucTableStyle properties
|
|
375
|
-
flowDirection: (Object.values(TABLE_FLOW_DIRECTION)).includes(tableElement.flowDirection)
|
|
376
|
-
? tableElement.flowDirection
|
|
377
|
-
: defaultData.flowDirection,
|
|
378
|
-
headerRowStyle: restoreTableCellStyle(tableElement.headerRowStyle, currentScope, defaultData.headerRowStyle),
|
|
379
|
-
dataRowStyle: restoreTableCellStyle(tableElement.dataRowStyle, currentScope, defaultData.dataRowStyle),
|
|
380
|
-
dataColumnStyle: restoreTableCellStyle(tableElement.dataColumnStyle, currentScope, defaultData.dataColumnStyle),
|
|
314
|
+
fileId: isValidString(tableElement.fileId) ||
|
|
315
|
+
defaultData.fileId,
|
|
381
316
|
}, localState);
|
|
382
317
|
}
|
|
383
318
|
case "doc": {
|
|
384
319
|
const docElement = element;
|
|
385
|
-
return restoreElementWithProperties(element,
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
const xrayElement = element;
|
|
391
|
-
const elementScope = isValidElementScopeValue(xrayElement.scope, globalState === null || globalState === void 0 ? void 0 : globalState.mainScope);
|
|
392
|
-
return restoreElementWithProperties(xrayElement, {
|
|
393
|
-
origin: restorePoint(xrayElement.origin, elementScope, currentScope),
|
|
394
|
-
direction: restorePoint(xrayElement.direction, elementScope, currentScope),
|
|
395
|
-
startFromOrigin: isValidBoolean(xrayElement.startFromOrigin, false),
|
|
396
|
-
color: isValidColor(xrayElement.color, "#FF00FF"),
|
|
397
|
-
}, localState, globalState);
|
|
320
|
+
return restoreElementWithProperties(element, {
|
|
321
|
+
text: isValidString(docElement.text),
|
|
322
|
+
fileId: isValidString(docElement.fileId) || null,
|
|
323
|
+
gridConfig: restoreDocumentGridConfig(docElement.gridConfig),
|
|
324
|
+
}, localState);
|
|
398
325
|
}
|
|
399
326
|
case "model": {
|
|
400
327
|
const modelElement = element;
|
|
401
328
|
return restoreElementWithProperties(modelElement, {
|
|
402
|
-
|
|
329
|
+
modelType: isValidString(modelElement.modelType) || null,
|
|
330
|
+
code: isValidString(modelElement.code) || null,
|
|
403
331
|
fileIds: modelElement.fileIds || [],
|
|
404
332
|
svgPath: modelElement.svgPath || null,
|
|
333
|
+
viewerState: (modelElement.viewerState || null),
|
|
405
334
|
}, localState, globalState);
|
|
406
335
|
}
|
|
407
|
-
case "featurecontrolframe": {
|
|
408
|
-
const fcfElement = element;
|
|
409
|
-
const elementScope = isValidElementScopeValue(fcfElement.scope, globalState === null || globalState === void 0 ? void 0 : globalState.mainScope);
|
|
410
|
-
return restoreElementWithProperties(fcfElement, {
|
|
411
|
-
// Restore style properties
|
|
412
|
-
textStyle: restoreTextStyle(fcfElement.textStyle, currentScope),
|
|
413
|
-
layout: {
|
|
414
|
-
padding: restorePrecisionValue((_s = fcfElement.layout) === null || _s === void 0 ? void 0 : _s.padding, elementScope, currentScope, 2),
|
|
415
|
-
segmentSpacing: restorePrecisionValue((_t = fcfElement.layout) === null || _t === void 0 ? void 0 : _t.segmentSpacing, elementScope, currentScope, 2),
|
|
416
|
-
rowSpacing: restorePrecisionValue((_u = fcfElement.layout) === null || _u === void 0 ? void 0 : _u.rowSpacing, elementScope, currentScope, 2),
|
|
417
|
-
},
|
|
418
|
-
symbols: {
|
|
419
|
-
scale: (_w = (_v = fcfElement.symbols) === null || _v === void 0 ? void 0 : _v.scale) !== null && _w !== void 0 ? _w : 1,
|
|
420
|
-
},
|
|
421
|
-
datumStyle: {
|
|
422
|
-
bracketStyle: isValidEnumValue((_x = fcfElement.datumStyle) === null || _x === void 0 ? void 0 : _x.bracketStyle, DATUM_BRACKET_STYLE, DATUM_BRACKET_STYLE.SQUARE),
|
|
423
|
-
},
|
|
424
|
-
// Restore data properties
|
|
425
|
-
rows: restoreFcfRows(fcfElement.rows),
|
|
426
|
-
frameModifiers: restoreFcfFrameModifiers(fcfElement.frameModifiers, elementScope, currentScope),
|
|
427
|
-
leaderElementId: isValidString(fcfElement.leaderElementId) || null,
|
|
428
|
-
datumDefinition: restoreFcfDatumDefinition(fcfElement.datumDefinition, elementScope, currentScope, restoredBlocks),
|
|
429
|
-
}, localState, globalState);
|
|
430
|
-
}
|
|
431
|
-
case "leader": {
|
|
432
|
-
const leaderElement = element;
|
|
433
|
-
const elementScope = isValidElementScopeValue(leaderElement.scope, globalState === null || globalState === void 0 ? void 0 : globalState.mainScope);
|
|
434
|
-
// A leader is a linear element
|
|
435
|
-
const { points, lines } = restoreLinearElementPointsAndLines({
|
|
436
|
-
points: leaderElement.points,
|
|
437
|
-
lines: leaderElement.lines,
|
|
438
|
-
x: leaderElement.x,
|
|
439
|
-
y: leaderElement.y,
|
|
440
|
-
width: leaderElement.width,
|
|
441
|
-
height: leaderElement.height,
|
|
442
|
-
elementScope,
|
|
443
|
-
currentScope,
|
|
444
|
-
skipNormalization: !!(leaderElement.startBinding || leaderElement.endBinding),
|
|
445
|
-
});
|
|
446
|
-
return restoreElementWithProperties(leaderElement, {
|
|
447
|
-
points,
|
|
448
|
-
lines,
|
|
449
|
-
// DucLeaderStyle properties
|
|
450
|
-
headsOverride: restoreHeadsOverride(leaderElement.headsOverride, restoredBlocks, elementScope, currentScope),
|
|
451
|
-
dogleg: restorePrecisionValue(leaderElement.dogleg, elementScope, currentScope, 10),
|
|
452
|
-
textStyle: restoreTextStyle(leaderElement.textStyle, currentScope),
|
|
453
|
-
textAttachment: isValidEnumValue(leaderElement.textAttachment, VERTICAL_ALIGN, VERTICAL_ALIGN.TOP),
|
|
454
|
-
blockAttachment: isValidEnumValue(leaderElement.blockAttachment, BLOCK_ATTACHMENT, BLOCK_ATTACHMENT.CENTER_EXTENTS),
|
|
455
|
-
// Leader data
|
|
456
|
-
leaderContent: restoreLeaderContent(leaderElement.leaderContent),
|
|
457
|
-
contentAnchor: leaderElement.contentAnchor || { x: 0, y: 0 },
|
|
458
|
-
}, localState, globalState);
|
|
459
|
-
}
|
|
460
|
-
case "dimension": {
|
|
461
|
-
const dimElement = element;
|
|
462
|
-
const elementScope = isValidElementScopeValue(dimElement.scope, globalState === null || globalState === void 0 ? void 0 : globalState.mainScope);
|
|
463
|
-
return restoreElementWithProperties(dimElement, Object.assign(Object.assign({}, restoreDimensionStyle(dimElement, currentScope)), {
|
|
464
|
-
// Dimension data
|
|
465
|
-
dimensionType: isValidEnumValue(dimElement.dimensionType, DIMENSION_TYPE, DIMENSION_TYPE.LINEAR), definitionPoints: restoreDimensionDefinitionPoints(dimElement.definitionPoints), obliqueAngle: isValidRadianValue(dimElement.obliqueAngle, 0), ordinateAxis: isValidEnumValue(dimElement.ordinateAxis, AXIS, null), bindings: restoreDimensionBindings(dimElement.bindings, elementScope, currentScope, restoredBlocks), textOverride: isValidString(dimElement.textOverride) || null, textPosition: dimElement.textPosition || null, toleranceOverride: restoreDimensionToleranceStyle(dimElement.toleranceOverride, currentScope), baselineData: dimElement.baselineData
|
|
466
|
-
? {
|
|
467
|
-
baseDimensionId: isValidString(dimElement.baselineData.baseDimensionId),
|
|
468
|
-
}
|
|
469
|
-
: undefined, continueData: dimElement.continueData
|
|
470
|
-
? {
|
|
471
|
-
continueFromDimensionId: isValidString(dimElement.continueData.continueFromDimensionId),
|
|
472
|
-
}
|
|
473
|
-
: undefined }), localState, globalState);
|
|
474
|
-
}
|
|
475
336
|
}
|
|
476
337
|
return null;
|
|
477
338
|
};
|
|
@@ -707,6 +568,12 @@ export const restoreElements = (elements, currentScope, restoredBlocks, opts) =>
|
|
|
707
568
|
const restored = (elements || []).reduce((elements, element) => {
|
|
708
569
|
if (element.type !== "selection") {
|
|
709
570
|
let migratedElement = restoreElement(element, currentScope, restoredBlocks, opts === null || opts === void 0 ? void 0 : opts.localState);
|
|
571
|
+
if (!migratedElement) {
|
|
572
|
+
// element failed to restore — skip
|
|
573
|
+
}
|
|
574
|
+
else if (isInvisiblySmallElement(migratedElement)) {
|
|
575
|
+
// element too small to be visible — will be filtered below
|
|
576
|
+
}
|
|
710
577
|
// Allow forced pass-through for specific element ids
|
|
711
578
|
const isPassThrough = Array.isArray(opts === null || opts === void 0 ? void 0 : opts.passThroughElementIds) &&
|
|
712
579
|
migratedElement &&
|
|
@@ -814,19 +681,6 @@ export const isValidElementScopeValue = (value, mainScope = NEUTRAL_SCOPE) => {
|
|
|
814
681
|
}
|
|
815
682
|
return mainScope;
|
|
816
683
|
};
|
|
817
|
-
const restoreTextDynamicParts = (dynamic) => {
|
|
818
|
-
if (!Array.isArray(dynamic)) {
|
|
819
|
-
return [];
|
|
820
|
-
}
|
|
821
|
-
return dynamic
|
|
822
|
-
.map((part) => ({
|
|
823
|
-
tag: isValidString(part.tag),
|
|
824
|
-
source: part.source, // Assuming source is valid, could be further validated
|
|
825
|
-
formatting: part.formatting, // Assuming valid
|
|
826
|
-
cachedValue: isValidString(part.cachedValue),
|
|
827
|
-
}))
|
|
828
|
-
.filter((part) => part.tag);
|
|
829
|
-
};
|
|
830
684
|
const restoreLineSpacing = (lineSpacing, legacyLineHeight, currentScope) => {
|
|
831
685
|
if (lineSpacing && lineSpacing.type && lineSpacing.value) {
|
|
832
686
|
return {
|
|
@@ -840,151 +694,22 @@ const restoreLineSpacing = (lineSpacing, legacyLineHeight, currentScope) => {
|
|
|
840
694
|
value: legacyLineHeight,
|
|
841
695
|
};
|
|
842
696
|
};
|
|
843
|
-
const restoreTableCellStyle = (style, currentScope, defaultStyle) => {
|
|
844
|
-
if (!style || typeof style !== "object") {
|
|
845
|
-
return defaultStyle;
|
|
846
|
-
}
|
|
847
|
-
return Object.assign(Object.assign(Object.assign({}, defaultStyle), style), { alignment: Object.values(TABLE_CELL_ALIGNMENT).includes(style.alignment)
|
|
848
|
-
? style.alignment
|
|
849
|
-
: defaultStyle.alignment });
|
|
850
|
-
};
|
|
851
|
-
const restoreTableColumns = (columns, currentScope, defaultColumns) => {
|
|
852
|
-
if (!columns || typeof columns !== "object") {
|
|
853
|
-
return defaultColumns;
|
|
854
|
-
}
|
|
855
|
-
const restored = {};
|
|
856
|
-
for (const id in columns) {
|
|
857
|
-
const col = columns[id];
|
|
858
|
-
if (col && typeof col === "object" && isValidString(col.id)) {
|
|
859
|
-
restored[id] = {
|
|
860
|
-
id: col.id,
|
|
861
|
-
width: restorePrecisionValue(col.width, currentScope, currentScope, 100),
|
|
862
|
-
styleOverrides: col.styleOverrides
|
|
863
|
-
? restoreTableCellStyle(col.styleOverrides, currentScope, {})
|
|
864
|
-
: undefined,
|
|
865
|
-
};
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
return restored;
|
|
869
|
-
};
|
|
870
|
-
const restoreTableRows = (rows, currentScope, defaultRows) => {
|
|
871
|
-
if (!rows || typeof rows !== "object") {
|
|
872
|
-
return defaultRows;
|
|
873
|
-
}
|
|
874
|
-
const restored = {};
|
|
875
|
-
for (const id in rows) {
|
|
876
|
-
const row = rows[id];
|
|
877
|
-
if (row && typeof row === "object" && isValidString(row.id)) {
|
|
878
|
-
restored[id] = {
|
|
879
|
-
id: row.id,
|
|
880
|
-
height: restorePrecisionValue(row.height, currentScope, currentScope, 40),
|
|
881
|
-
styleOverrides: row.styleOverrides
|
|
882
|
-
? restoreTableCellStyle(row.styleOverrides, currentScope, {})
|
|
883
|
-
: undefined,
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
return restored;
|
|
888
|
-
};
|
|
889
|
-
const restoreTableCells = (cells, defaultCells) => {
|
|
890
|
-
if (!cells || typeof cells !== "object") {
|
|
891
|
-
return defaultCells;
|
|
892
|
-
}
|
|
893
|
-
const restored = {};
|
|
894
|
-
for (const id in cells) {
|
|
895
|
-
const cell = cells[id];
|
|
896
|
-
if (cell &&
|
|
897
|
-
typeof cell === "object" &&
|
|
898
|
-
isValidString(cell.rowId) &&
|
|
899
|
-
isValidString(cell.columnId)) {
|
|
900
|
-
restored[id] = {
|
|
901
|
-
rowId: cell.rowId,
|
|
902
|
-
columnId: cell.columnId,
|
|
903
|
-
data: isValidString(cell.data),
|
|
904
|
-
locked: isValidBooleanValue(cell.locked, false),
|
|
905
|
-
span: cell.span
|
|
906
|
-
? {
|
|
907
|
-
columns: typeof cell.span.columns === "number" ? cell.span.columns : 1,
|
|
908
|
-
rows: typeof cell.span.rows === "number" ? cell.span.rows : 1,
|
|
909
|
-
}
|
|
910
|
-
: undefined,
|
|
911
|
-
styleOverrides: cell.styleOverrides, // Not deeply restored for now
|
|
912
|
-
};
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
return restored;
|
|
916
|
-
};
|
|
917
|
-
const restoreDocStyleProperties = (doc, currentScope) => {
|
|
918
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
919
|
-
const elementScope = isValidElementScopeValue(doc.scope, currentScope);
|
|
920
|
-
// Use the new helper to restore all properties from DucTextStyle
|
|
921
|
-
const restoredTextStyle = restoreTextStyle(doc, currentScope);
|
|
922
|
-
// Restore properties specific to DucDocStyle
|
|
923
|
-
const paragraph = {
|
|
924
|
-
firstLineIndent: restorePrecisionValue((_a = doc.paragraph) === null || _a === void 0 ? void 0 : _a.firstLineIndent, elementScope, currentScope, 0),
|
|
925
|
-
hangingIndent: restorePrecisionValue((_b = doc.paragraph) === null || _b === void 0 ? void 0 : _b.hangingIndent, elementScope, currentScope, 0),
|
|
926
|
-
leftIndent: restorePrecisionValue((_c = doc.paragraph) === null || _c === void 0 ? void 0 : _c.leftIndent, elementScope, currentScope, 0),
|
|
927
|
-
rightIndent: restorePrecisionValue((_d = doc.paragraph) === null || _d === void 0 ? void 0 : _d.rightIndent, elementScope, currentScope, 0),
|
|
928
|
-
spaceBefore: restorePrecisionValue((_e = doc.paragraph) === null || _e === void 0 ? void 0 : _e.spaceBefore, elementScope, currentScope, 0),
|
|
929
|
-
spaceAfter: restorePrecisionValue((_f = doc.paragraph) === null || _f === void 0 ? void 0 : _f.spaceAfter, elementScope, currentScope, 0),
|
|
930
|
-
tabStops: Array.isArray((_g = doc.paragraph) === null || _g === void 0 ? void 0 : _g.tabStops)
|
|
931
|
-
? doc.paragraph.tabStops.map(ts => restorePrecisionValue(ts, elementScope, currentScope, 0))
|
|
932
|
-
: [],
|
|
933
|
-
};
|
|
934
|
-
const stackFormat = {
|
|
935
|
-
autoStack: isValidBoolean((_h = doc.stackFormat) === null || _h === void 0 ? void 0 : _h.autoStack, false),
|
|
936
|
-
stackChars: Array.isArray((_j = doc.stackFormat) === null || _j === void 0 ? void 0 : _j.stackChars) ? doc.stackFormat.stackChars.map(String) : [],
|
|
937
|
-
properties: {
|
|
938
|
-
upperScale: typeof ((_l = (_k = doc.stackFormat) === null || _k === void 0 ? void 0 : _k.properties) === null || _l === void 0 ? void 0 : _l.upperScale) === 'number' ? doc.stackFormat.properties.upperScale : 0.7,
|
|
939
|
-
lowerScale: typeof ((_o = (_m = doc.stackFormat) === null || _m === void 0 ? void 0 : _m.properties) === null || _o === void 0 ? void 0 : _o.lowerScale) === 'number' ? doc.stackFormat.properties.lowerScale : 0.7,
|
|
940
|
-
alignment: isValidEnumValue((_q = (_p = doc.stackFormat) === null || _p === void 0 ? void 0 : _p.properties) === null || _q === void 0 ? void 0 : _q.alignment, STACKED_TEXT_ALIGN, STACKED_TEXT_ALIGN.CENTER),
|
|
941
|
-
},
|
|
942
|
-
};
|
|
943
|
-
return Object.assign(Object.assign({}, restoredTextStyle), { paragraph,
|
|
944
|
-
stackFormat });
|
|
945
|
-
};
|
|
946
|
-
const restoreTextColumns = (columns, currentScope) => {
|
|
947
|
-
const defaultGutter = getPrecisionValueFromRaw(5, currentScope, currentScope);
|
|
948
|
-
const defaultWidth = getPrecisionValueFromRaw(100, currentScope, currentScope);
|
|
949
|
-
if (!columns || typeof columns !== "object") {
|
|
950
|
-
return {
|
|
951
|
-
type: COLUMN_TYPE.NO_COLUMNS,
|
|
952
|
-
definitions: [],
|
|
953
|
-
autoHeight: true,
|
|
954
|
-
};
|
|
955
|
-
}
|
|
956
|
-
const definitions = Array.isArray(columns.definitions)
|
|
957
|
-
? columns.definitions.map((def) => ({
|
|
958
|
-
width: restorePrecisionValue(def === null || def === void 0 ? void 0 : def.width, currentScope, currentScope, defaultWidth.value),
|
|
959
|
-
gutter: restorePrecisionValue(def === null || def === void 0 ? void 0 : def.gutter, currentScope, currentScope, defaultGutter.value),
|
|
960
|
-
}))
|
|
961
|
-
: [];
|
|
962
|
-
return {
|
|
963
|
-
type: Object.values(COLUMN_TYPE).includes(columns.type)
|
|
964
|
-
? columns.type
|
|
965
|
-
: COLUMN_TYPE.NO_COLUMNS,
|
|
966
|
-
definitions,
|
|
967
|
-
autoHeight: isValidBooleanValue(columns.autoHeight, true),
|
|
968
|
-
};
|
|
969
|
-
};
|
|
970
697
|
const restoreDocumentGridConfig = (gridConfig) => {
|
|
971
698
|
if (!gridConfig || typeof gridConfig !== "object") {
|
|
972
699
|
return {
|
|
973
700
|
columns: 1,
|
|
974
701
|
gapX: 0,
|
|
975
702
|
gapY: 0,
|
|
976
|
-
alignItems: "start",
|
|
977
703
|
firstPageAlone: false,
|
|
704
|
+
scale: 1,
|
|
978
705
|
};
|
|
979
706
|
}
|
|
980
707
|
return {
|
|
981
708
|
columns: typeof gridConfig.columns === "number" ? gridConfig.columns : 1,
|
|
982
709
|
gapX: typeof gridConfig.gapX === "number" ? gridConfig.gapX : 0,
|
|
983
710
|
gapY: typeof gridConfig.gapY === "number" ? gridConfig.gapY : 0,
|
|
984
|
-
alignItems: (typeof gridConfig.alignItems === "string" && ["start", "center", "end"].includes(gridConfig.alignItems))
|
|
985
|
-
? gridConfig.alignItems
|
|
986
|
-
: "start",
|
|
987
711
|
firstPageAlone: typeof gridConfig.firstPageAlone === "boolean" ? gridConfig.firstPageAlone : false,
|
|
712
|
+
scale: typeof gridConfig.scale === "number" ? gridConfig.scale : 1,
|
|
988
713
|
};
|
|
989
714
|
};
|
|
990
715
|
const getFontFamilyByName = (fontFamilyName) => {
|
|
@@ -1116,187 +841,5 @@ const isValidLineSpacingTypeValue = (value) => {
|
|
|
1116
841
|
* Restore properties specific to Stack-like elements (_DucStackElementBase)
|
|
1117
842
|
*/
|
|
1118
843
|
const restoreStackElementProperties = (element, currentScope) => {
|
|
1119
|
-
return Object.assign(Object.assign({}, restoreDucStackProperties(element)), { clip: isValidBooleanValue(element.clip, false), labelVisible: isValidBooleanValue(element.labelVisible, true)
|
|
1120
|
-
};
|
|
1121
|
-
// --- Dimension Restoration Helpers ---
|
|
1122
|
-
const restoreDimensionStyle = (dim, currentScope) => {
|
|
1123
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
1124
|
-
const defaultTextStyle = restoreTextStyle(undefined, currentScope);
|
|
1125
|
-
return {
|
|
1126
|
-
dimLine: {
|
|
1127
|
-
stroke: ((_a = dim.dimLine) === null || _a === void 0 ? void 0 : _a.stroke)
|
|
1128
|
-
? validateStroke(dim.dimLine.stroke, dim.scope, currentScope)
|
|
1129
|
-
: DEFAULT_ELEMENT_PROPS.stroke,
|
|
1130
|
-
textGap: restorePrecisionValue((_b = dim.dimLine) === null || _b === void 0 ? void 0 : _b.textGap, dim.scope, currentScope, 2),
|
|
1131
|
-
},
|
|
1132
|
-
extLine: {
|
|
1133
|
-
stroke: ((_c = dim.extLine) === null || _c === void 0 ? void 0 : _c.stroke)
|
|
1134
|
-
? validateStroke(dim.extLine.stroke, dim.scope, currentScope)
|
|
1135
|
-
: DEFAULT_ELEMENT_PROPS.stroke,
|
|
1136
|
-
overshoot: restorePrecisionValue((_d = dim.extLine) === null || _d === void 0 ? void 0 : _d.overshoot, dim.scope, currentScope, 2),
|
|
1137
|
-
offset: restorePrecisionValue((_e = dim.extLine) === null || _e === void 0 ? void 0 : _e.offset, dim.scope, currentScope, 2),
|
|
1138
|
-
},
|
|
1139
|
-
textStyle: restoreTextStyle(dim.textStyle, currentScope),
|
|
1140
|
-
symbols: {
|
|
1141
|
-
headsOverride: restoreHeadsOverride((_f = dim.symbols) === null || _f === void 0 ? void 0 : _f.headsOverride, [], dim.scope, currentScope), // Assuming no blocks initially
|
|
1142
|
-
centerMark: {
|
|
1143
|
-
type: isValidEnumValue((_h = (_g = dim.symbols) === null || _g === void 0 ? void 0 : _g.centerMark) === null || _h === void 0 ? void 0 : _h.type, MARK_ELLIPSE_CENTER, MARK_ELLIPSE_CENTER.MARK),
|
|
1144
|
-
size: restorePrecisionValue((_k = (_j = dim.symbols) === null || _j === void 0 ? void 0 : _j.centerMark) === null || _k === void 0 ? void 0 : _k.size, dim.scope, currentScope, 5),
|
|
1145
|
-
},
|
|
1146
|
-
},
|
|
1147
|
-
tolerance: restoreDimensionToleranceStyle(dim.tolerance, currentScope, defaultTextStyle),
|
|
1148
|
-
fit: {
|
|
1149
|
-
rule: isValidEnumValue((_l = dim.fit) === null || _l === void 0 ? void 0 : _l.rule, DIMENSION_FIT_RULE, DIMENSION_FIT_RULE.BEST_FIT),
|
|
1150
|
-
textPlacement: isValidEnumValue((_m = dim.fit) === null || _m === void 0 ? void 0 : _m.textPlacement, DIMENSION_TEXT_PLACEMENT, DIMENSION_TEXT_PLACEMENT.BESIDE_LINE),
|
|
1151
|
-
forceTextInside: isValidBoolean((_o = dim.fit) === null || _o === void 0 ? void 0 : _o.forceTextInside, false),
|
|
1152
|
-
},
|
|
1153
|
-
};
|
|
1154
|
-
};
|
|
1155
|
-
const restoreDimensionToleranceStyle = (tol, currentScope, defaultTextStyle) => {
|
|
1156
|
-
var _a, _b, _c;
|
|
1157
|
-
return {
|
|
1158
|
-
enabled: isValidBoolean(tol === null || tol === void 0 ? void 0 : tol.enabled, false),
|
|
1159
|
-
displayMethod: isValidEnumValue(tol === null || tol === void 0 ? void 0 : tol.displayMethod, TOLERANCE_DISPLAY, TOLERANCE_DISPLAY.NONE),
|
|
1160
|
-
upperValue: (_a = tol === null || tol === void 0 ? void 0 : tol.upperValue) !== null && _a !== void 0 ? _a : 0,
|
|
1161
|
-
lowerValue: (_b = tol === null || tol === void 0 ? void 0 : tol.lowerValue) !== null && _b !== void 0 ? _b : 0,
|
|
1162
|
-
precision: (_c = tol === null || tol === void 0 ? void 0 : tol.precision) !== null && _c !== void 0 ? _c : 2,
|
|
1163
|
-
textStyle: (tol === null || tol === void 0 ? void 0 : tol.textStyle)
|
|
1164
|
-
? restoreTextStyle(tol.textStyle, currentScope)
|
|
1165
|
-
: defaultTextStyle || restoreTextStyle(undefined, currentScope),
|
|
1166
|
-
};
|
|
1167
|
-
};
|
|
1168
|
-
const restoreDimensionDefinitionPoints = (points) => {
|
|
1169
|
-
return {
|
|
1170
|
-
origin1: (points === null || points === void 0 ? void 0 : points.origin1) || { x: 0, y: 0 },
|
|
1171
|
-
origin2: points === null || points === void 0 ? void 0 : points.origin2,
|
|
1172
|
-
location: (points === null || points === void 0 ? void 0 : points.location) || { x: 0, y: 0 },
|
|
1173
|
-
center: points === null || points === void 0 ? void 0 : points.center,
|
|
1174
|
-
jog: points === null || points === void 0 ? void 0 : points.jog,
|
|
1175
|
-
};
|
|
1176
|
-
};
|
|
1177
|
-
const restoreDimensionBindings = (bindings, elementScope, currentScope, restoredBlocks) => {
|
|
1178
|
-
var _a, _b, _c;
|
|
1179
|
-
if (!bindings)
|
|
1180
|
-
return undefined;
|
|
1181
|
-
return {
|
|
1182
|
-
origin1: bindings.origin1
|
|
1183
|
-
? repairBinding(undefined, (_a = bindings.origin1) !== null && _a !== void 0 ? _a : null, currentScope, restoredBlocks)
|
|
1184
|
-
: null,
|
|
1185
|
-
origin2: bindings.origin2
|
|
1186
|
-
? repairBinding(undefined, (_b = bindings.origin2) !== null && _b !== void 0 ? _b : null, currentScope, restoredBlocks)
|
|
1187
|
-
: null,
|
|
1188
|
-
center: bindings.center
|
|
1189
|
-
? repairBinding(undefined, (_c = bindings.center) !== null && _c !== void 0 ? _c : null, currentScope, restoredBlocks)
|
|
1190
|
-
: null,
|
|
1191
|
-
};
|
|
1192
|
-
};
|
|
1193
|
-
// --- Leader Restoration Helpers ---
|
|
1194
|
-
const restoreLeaderContent = (content) => {
|
|
1195
|
-
var _a, _b;
|
|
1196
|
-
if (!content)
|
|
1197
|
-
return null;
|
|
1198
|
-
const type = isValidEnumValue(content.type, LEADER_CONTENT_TYPE, null);
|
|
1199
|
-
if (type === LEADER_CONTENT_TYPE.TEXT) {
|
|
1200
|
-
// Only access text if type is "text"
|
|
1201
|
-
if ('text' in content) {
|
|
1202
|
-
return { type: "text", text: isValidString(content.text) };
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
if (type === LEADER_CONTENT_TYPE.BLOCK) {
|
|
1206
|
-
// Only access blockId and instanceData if type is "block"
|
|
1207
|
-
if ('blockId' in content && 'instanceData' in content) {
|
|
1208
|
-
return {
|
|
1209
|
-
type: "block",
|
|
1210
|
-
blockId: isValidString(content.blockId),
|
|
1211
|
-
instanceData: {
|
|
1212
|
-
attributeValues: (_a = content.instanceData) === null || _a === void 0 ? void 0 : _a.attributeValues,
|
|
1213
|
-
elementOverrides: (_b = content.instanceData) === null || _b === void 0 ? void 0 : _b.elementOverrides,
|
|
1214
|
-
},
|
|
1215
|
-
};
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
return null;
|
|
1219
|
-
};
|
|
1220
|
-
// --- FCF Restoration Helpers ---
|
|
1221
|
-
const restoreFcfRows = (rows) => {
|
|
1222
|
-
return rows ? rows.map((row) => row ? row.map((segment) => {
|
|
1223
|
-
var _a, _b, _c, _d;
|
|
1224
|
-
return ({
|
|
1225
|
-
symbol: isValidEnumValue(segment.symbol, GDT_SYMBOL, GDT_SYMBOL.POSITION),
|
|
1226
|
-
tolerance: {
|
|
1227
|
-
value: isValidString((_a = segment.tolerance) === null || _a === void 0 ? void 0 : _a.value),
|
|
1228
|
-
zoneType: isValidEnumValue((_b = segment.tolerance) === null || _b === void 0 ? void 0 : _b.zoneType, TOLERANCE_ZONE_TYPE, undefined),
|
|
1229
|
-
featureModifiers: Array.isArray((_c = segment.tolerance) === null || _c === void 0 ? void 0 : _c.featureModifiers)
|
|
1230
|
-
? segment.tolerance.featureModifiers
|
|
1231
|
-
: [],
|
|
1232
|
-
materialCondition: isValidEnumValue((_d = segment.tolerance) === null || _d === void 0 ? void 0 : _d.materialCondition, MATERIAL_CONDITION, undefined),
|
|
1233
|
-
},
|
|
1234
|
-
datums: (Array.isArray(segment.datums)
|
|
1235
|
-
? segment.datums.map((datum) => ({
|
|
1236
|
-
letters: isValidString(datum === null || datum === void 0 ? void 0 : datum.letters),
|
|
1237
|
-
modifier: isValidEnumValue(datum === null || datum === void 0 ? void 0 : datum.modifier, MATERIAL_CONDITION, undefined),
|
|
1238
|
-
}))
|
|
1239
|
-
: []),
|
|
1240
|
-
});
|
|
1241
|
-
})
|
|
1242
|
-
: []) : [];
|
|
1243
|
-
};
|
|
1244
|
-
const restoreFcfFrameModifiers = (mods, elementScope, currentScope) => {
|
|
1245
|
-
if (!mods)
|
|
1246
|
-
return undefined;
|
|
1247
|
-
return {
|
|
1248
|
-
allAround: isValidBoolean(mods.allAround),
|
|
1249
|
-
allOver: isValidBoolean(mods.allOver),
|
|
1250
|
-
continuousFeature: isValidBoolean(mods.continuousFeature),
|
|
1251
|
-
between: mods.between
|
|
1252
|
-
? {
|
|
1253
|
-
start: isValidString(mods.between.start),
|
|
1254
|
-
end: isValidString(mods.between.end),
|
|
1255
|
-
}
|
|
1256
|
-
: undefined,
|
|
1257
|
-
projectedToleranceZone: mods.projectedToleranceZone
|
|
1258
|
-
? restorePrecisionValue(mods.projectedToleranceZone.value, elementScope, currentScope)
|
|
1259
|
-
: undefined,
|
|
1260
|
-
};
|
|
1261
|
-
};
|
|
1262
|
-
const restoreFcfDatumDefinition = (def, elementScope, currentScope, restoredBlocks) => {
|
|
1263
|
-
var _a, _b;
|
|
1264
|
-
if (!def || !isValidString(def.letter))
|
|
1265
|
-
return undefined;
|
|
1266
|
-
return {
|
|
1267
|
-
letter: isValidString(def.letter, ""),
|
|
1268
|
-
featureBinding: (_b = repairBinding(undefined, (_a = def.featureBinding) !== null && _a !== void 0 ? _a : null, currentScope, restoredBlocks)) !== null && _b !== void 0 ? _b : undefined,
|
|
1269
|
-
};
|
|
1270
|
-
};
|
|
1271
|
-
// --- Shared & Generic Style Helpers ---
|
|
1272
|
-
const restoreTextStyle = (style, currentScope) => {
|
|
1273
|
-
var _a, _b, _c;
|
|
1274
|
-
const defaultLineHeight = 1.15;
|
|
1275
|
-
return {
|
|
1276
|
-
// Text-specific styles
|
|
1277
|
-
isLtr: isValidBoolean(style === null || style === void 0 ? void 0 : style.isLtr, true),
|
|
1278
|
-
fontFamily: getFontFamilyByName(style === null || style === void 0 ? void 0 : style.fontFamily),
|
|
1279
|
-
bigFontFamily: isValidString(style === null || style === void 0 ? void 0 : style.bigFontFamily, "sans-serif"),
|
|
1280
|
-
textAlign: isValidTextAlignValue(style === null || style === void 0 ? void 0 : style.textAlign),
|
|
1281
|
-
verticalAlign: isValidVerticalAlignValue(style === null || style === void 0 ? void 0 : style.verticalAlign),
|
|
1282
|
-
lineHeight: (_a = style === null || style === void 0 ? void 0 : style.lineHeight) !== null && _a !== void 0 ? _a : defaultLineHeight,
|
|
1283
|
-
lineSpacing: restoreLineSpacing(style === null || style === void 0 ? void 0 : style.lineSpacing, (_b = style === null || style === void 0 ? void 0 : style.lineHeight) !== null && _b !== void 0 ? _b : defaultLineHeight.valueOf(), currentScope),
|
|
1284
|
-
obliqueAngle: isValidRadianValue(style === null || style === void 0 ? void 0 : style.obliqueAngle, 0),
|
|
1285
|
-
fontSize: restorePrecisionValue(style === null || style === void 0 ? void 0 : style.fontSize, NEUTRAL_SCOPE, currentScope, DEFAULT_FONT_SIZE),
|
|
1286
|
-
paperTextHeight: (style === null || style === void 0 ? void 0 : style.paperTextHeight)
|
|
1287
|
-
? restorePrecisionValue(style.paperTextHeight, NEUTRAL_SCOPE, currentScope)
|
|
1288
|
-
: undefined,
|
|
1289
|
-
widthFactor: (_c = style === null || style === void 0 ? void 0 : style.widthFactor) !== null && _c !== void 0 ? _c : 1,
|
|
1290
|
-
isUpsideDown: isValidBoolean(style === null || style === void 0 ? void 0 : style.isUpsideDown, false),
|
|
1291
|
-
isBackwards: isValidBoolean(style === null || style === void 0 ? void 0 : style.isBackwards, false),
|
|
1292
|
-
};
|
|
1293
|
-
};
|
|
1294
|
-
const restoreHeadsOverride = (heads, restoredBlocks, elementScope, currentScope) => {
|
|
1295
|
-
if (!Array.isArray(heads) || heads.length !== 2)
|
|
1296
|
-
return undefined;
|
|
1297
|
-
const startHead = isValidDucHead(heads[0], restoredBlocks, elementScope, currentScope);
|
|
1298
|
-
const endHead = isValidDucHead(heads[1], restoredBlocks, elementScope, currentScope);
|
|
1299
|
-
if (!startHead || !endHead)
|
|
1300
|
-
return undefined;
|
|
1301
|
-
return [startHead, endHead];
|
|
844
|
+
return Object.assign(Object.assign({}, restoreDucStackProperties(element)), { clip: isValidBooleanValue(element.clip, false), labelVisible: isValidBooleanValue(element.labelVisible, true) });
|
|
1302
845
|
};
|