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
package/dist/restore/index.d.ts
CHANGED
package/dist/restore/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { BLENDING } from "../
|
|
2
|
-
import {
|
|
3
|
-
import type { Dictionary, DucExternalFiles, DucGlobalState, ImportedDataState, LibraryItems, PrecisionValue, Scope, VersionGraph } from "../types";
|
|
1
|
+
import { BLENDING } from "../enums";
|
|
2
|
+
import type { Checkpoint, Delta, Dictionary, DucExternalFiles, DucGlobalState, ImportedDataState, LibraryItems, PrecisionValue, Scope, VersionGraph } from "../types";
|
|
4
3
|
import { DucLocalState } from "../types";
|
|
5
4
|
import type { _DucStackBase, BezierMirroring, DucBlock, DucBlockCollection, DucBlockInstance, DucElement, DucGroup, DucHead, DucLayer, DucRegion, ElementBackground, ElementContentBase, ElementStroke, ExternalFileId, FillStyle, ImageStatus, LineHead, OrderedDucElement, StrokeCap, StrokeJoin, StrokePreference, StrokeSidePreference, StrokeStyle, TextAlign, VerticalAlign } from "../types/elements";
|
|
6
5
|
import { Percentage, Radian } from "../types/geometryTypes";
|
|
@@ -20,7 +19,6 @@ export type RestoredDataState = {
|
|
|
20
19
|
groups: DucGroup[];
|
|
21
20
|
regions: DucRegion[];
|
|
22
21
|
layers: DucLayer[];
|
|
23
|
-
standards: Standard[];
|
|
24
22
|
versionGraph: VersionGraph | undefined;
|
|
25
23
|
id: string;
|
|
26
24
|
};
|
|
@@ -115,8 +113,10 @@ export declare const restoreGlobalState: (importedState?: Partial<DucGlobalState
|
|
|
115
113
|
* @param restoredGlobalState - The complete and valid global state for the document.
|
|
116
114
|
* @returns A complete and valid DucLocalState object.
|
|
117
115
|
*/
|
|
118
|
-
export declare const restoreLocalState: (importedState: Partial<DucLocalState> | undefined, restoredGlobalState: RestoredDataState["globalState"],
|
|
116
|
+
export declare const restoreLocalState: (importedState: Partial<DucLocalState> | undefined, restoredGlobalState: RestoredDataState["globalState"], forceScope?: Scope) => DucLocalState;
|
|
119
117
|
export declare const restoreVersionGraph: (importedGraph: any) => RestoredDataState["versionGraph"];
|
|
118
|
+
export declare const restoreCheckpoint: (importedCheckpoint: unknown) => Checkpoint | undefined;
|
|
119
|
+
export declare const restoreDelta: (importedDelta: unknown) => Delta | undefined;
|
|
120
120
|
/**
|
|
121
121
|
* Restores common properties for elements leveraging _DucStackBase.
|
|
122
122
|
*/
|
|
@@ -135,6 +135,7 @@ export declare const isValidFillStyleValue: (value: FillStyle | undefined) => Fi
|
|
|
135
135
|
export declare const isValidStrokePreferenceValue: (value: StrokePreference | undefined) => StrokePreference;
|
|
136
136
|
export declare const isValidVerticalAlignValue: (value: VerticalAlign | undefined) => VerticalAlign;
|
|
137
137
|
export declare const isValidTextAlignValue: (value: TextAlign | undefined) => TextAlign;
|
|
138
|
+
export declare const isValidDecimalPlacesValue: (value: number | undefined, fallback: number) => number;
|
|
138
139
|
export declare const isValidScopeValue: (value: string | undefined, localState?: Readonly<Partial<DucLocalState>> | null, mainScope?: Scope) => Scope;
|
|
139
140
|
export declare const isValidImageStatusValue: (value: ImageStatus | undefined) => ImageStatus;
|
|
140
141
|
export declare const isValidDucHead: (value: DucHead | null | undefined, blocks: RestoredDataState["blocks"], elementScope: Scope, currentScope: Scope) => DucHead | null;
|
|
@@ -193,11 +194,6 @@ export declare const isValidExternalFileId: (value: any, defaultValue?: External
|
|
|
193
194
|
* @returns A valid, non-empty `Uint8Array` if the conversion is successful, otherwise `undefined`.
|
|
194
195
|
*/
|
|
195
196
|
export declare const isValidUint8Array: (value: unknown) => Uint8Array | undefined;
|
|
196
|
-
/**
|
|
197
|
-
* Validates a Standard id.
|
|
198
|
-
* Returns the id if valid and present in standards, otherwise returns the default DUC standard id.
|
|
199
|
-
*/
|
|
200
|
-
export declare const isValidStandardId: (id: any, standards: Standard[], defaultId?: string) => string;
|
|
201
197
|
/**
|
|
202
198
|
* Validates a block id.
|
|
203
199
|
* Returns the id if present in restored blocks, otherwise returns null.
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { nanoid } from "nanoid";
|
|
2
2
|
import tinycolor from "tinycolor2";
|
|
3
|
-
import { BEZIER_MIRRORING, BLENDING, BOOLEAN_OPERATION, ELEMENT_CONTENT_PREFERENCE, IMAGE_STATUS, LINE_HEAD, PRUNING_LEVEL, STROKE_CAP, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, STROKE_SIDE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN, } from "../
|
|
3
|
+
import { BEZIER_MIRRORING, BLENDING, BOOLEAN_OPERATION, ELEMENT_CONTENT_PREFERENCE, IMAGE_STATUS, LINE_HEAD, PRUNING_LEVEL, STROKE_CAP, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, STROKE_SIDE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN, } from "../enums";
|
|
4
4
|
import { getPrecisionScope } from "../technical/measurements";
|
|
5
5
|
import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, NEUTRAL_SCOPE, ScaleFactors } from "../technical/scopes";
|
|
6
|
-
import { PREDEFINED_STANDARDS } from "../technical/standards";
|
|
7
6
|
import { base64ToUint8Array, getDefaultGlobalState, getDefaultLocalState, getZoom, isEncodedFunctionString, isFiniteNumber, reviveEncodedFunction, } from "../utils";
|
|
8
7
|
import { DEFAULT_ELEMENT_PROPS, DEFAULT_POLYGON_SIDES, DEFAULT_TEXT_ALIGN, DEFAULT_VERTICAL_ALIGN, DEFAULT_ZOOM_STEP, MAX_ZOOM_STEP, MIN_ZOOM_STEP, } from "../utils/constants";
|
|
9
8
|
import { getDefaultStackProperties } from "../utils/elements";
|
|
10
9
|
import { restoreElements } from "./restoreElements";
|
|
11
|
-
import { isStandardIdPresent, restoreStandards, } from "./restoreStandards";
|
|
12
10
|
export const restore = (data, elementsConfig, restoreConfig = {}) => {
|
|
13
|
-
const restoredStandards = restoreStandards(data === null || data === void 0 ? void 0 : data.standards);
|
|
14
11
|
const restoredDictionary = restoreDictionary(data === null || data === void 0 ? void 0 : data.dictionary);
|
|
15
12
|
const restoredGlobalState = restoreGlobalState(data === null || data === void 0 ? void 0 : data.globalState);
|
|
16
|
-
const restoredLocalState = restoreLocalState(data === null || data === void 0 ? void 0 : data.localState, restoredGlobalState,
|
|
13
|
+
const restoredLocalState = restoreLocalState(data === null || data === void 0 ? void 0 : data.localState, restoredGlobalState, restoreConfig.forceScope);
|
|
17
14
|
const restoredElementsConfig = Object.assign(Object.assign({}, elementsConfig), { localState: restoredLocalState });
|
|
18
15
|
const restoredBlocks = restoreBlocks(data === null || data === void 0 ? void 0 : data.blocks, restoredLocalState.scope, restoredElementsConfig);
|
|
19
16
|
const restoredBlockCollections = restoreBlockCollections(data === null || data === void 0 ? void 0 : data.blockCollections);
|
|
@@ -36,7 +33,6 @@ export const restore = (data, elementsConfig, restoreConfig = {}) => {
|
|
|
36
33
|
groups: restoredGroups,
|
|
37
34
|
regions: restoredRegions,
|
|
38
35
|
layers: restoredLayers,
|
|
39
|
-
standards: restoredStandards,
|
|
40
36
|
versionGraph: restoredVersionGraph,
|
|
41
37
|
localState: restoredLocalState,
|
|
42
38
|
globalState: restoredGlobalState,
|
|
@@ -144,10 +140,11 @@ export const restoreLayers = (layers, currentScope) => {
|
|
|
144
140
|
return typeof g.id === "string";
|
|
145
141
|
})
|
|
146
142
|
.map((l) => {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
const overridesSource = l.overrides && typeof l.overrides === "object" ? l.overrides : null;
|
|
144
|
+
return Object.assign(Object.assign({ id: l.id }, restoreDucStackProperties(l)), { readonly: isValidBoolean(l.readonly, false), overrides: overridesSource ? {
|
|
145
|
+
stroke: validateStroke(overridesSource.stroke, currentScope, currentScope),
|
|
146
|
+
background: validateBackground(overridesSource.background),
|
|
147
|
+
} : null });
|
|
151
148
|
});
|
|
152
149
|
};
|
|
153
150
|
/**
|
|
@@ -198,10 +195,6 @@ export const restoreBlocks = (blocks, currentScope, elementsConfig) => {
|
|
|
198
195
|
label: typeof obj.label === "string" ? obj.label : "",
|
|
199
196
|
description: typeof obj.description === "string" ? obj.description : undefined,
|
|
200
197
|
version: typeof obj.version === "number" ? obj.version : 1,
|
|
201
|
-
attributes: obj.attributes || undefined,
|
|
202
|
-
attributeDefinitions: obj.attributeDefinitions && typeof obj.attributeDefinitions === "object"
|
|
203
|
-
? obj.attributeDefinitions
|
|
204
|
-
: {},
|
|
205
198
|
metadata,
|
|
206
199
|
thumbnail: isValidUint8Array(obj.thumbnail),
|
|
207
200
|
};
|
|
@@ -276,27 +269,11 @@ export const restoreBlockInstances = (blockInstances, currentScope) => {
|
|
|
276
269
|
elementOverrides = obj.elementOverrides;
|
|
277
270
|
}
|
|
278
271
|
}
|
|
279
|
-
// Handle attributeValues - same logic
|
|
280
|
-
let attributeValues;
|
|
281
|
-
if (obj.attributeValues && typeof obj.attributeValues === "object") {
|
|
282
|
-
if (Array.isArray(obj.attributeValues)) {
|
|
283
|
-
// Legacy format: array of {key, value} entries
|
|
284
|
-
attributeValues = Object.fromEntries(obj.attributeValues.map((entry) => [
|
|
285
|
-
typeof entry.key === "string" ? entry.key : "",
|
|
286
|
-
typeof entry.value === "string" ? entry.value : "",
|
|
287
|
-
]));
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
// Current format: already a Record<string, string>
|
|
291
|
-
attributeValues = obj.attributeValues;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
272
|
return {
|
|
295
273
|
id: isValidString(obj.id),
|
|
296
274
|
blockId: isValidString(obj.blockId),
|
|
297
275
|
version: isValidNumber(obj.version, 1),
|
|
298
276
|
elementOverrides,
|
|
299
|
-
attributeValues,
|
|
300
277
|
duplicationArray: dupArray && typeof dupArray === "object"
|
|
301
278
|
? {
|
|
302
279
|
rows: typeof dupArray.rows === "number" ? dupArray.rows : 1,
|
|
@@ -345,13 +322,9 @@ const restoreBlockMetadata = (metadata) => {
|
|
|
345
322
|
* @returns A complete and valid DucGlobalState object.
|
|
346
323
|
*/
|
|
347
324
|
export const restoreGlobalState = (importedState = {}) => {
|
|
348
|
-
var _a, _b, _c
|
|
325
|
+
var _a, _b, _c;
|
|
349
326
|
const defaults = getDefaultGlobalState();
|
|
350
|
-
|
|
351
|
-
return Object.assign(Object.assign({}, defaults), { name: (_b = importedState === null || importedState === void 0 ? void 0 : importedState.name) !== null && _b !== void 0 ? _b : defaults.name, viewBackgroundColor: (_c = importedState === null || importedState === void 0 ? void 0 : importedState.viewBackgroundColor) !== null && _c !== void 0 ? _c : defaults.viewBackgroundColor, mainScope: (_d = isValidAppStateScopeValue(importedState === null || importedState === void 0 ? void 0 : importedState.mainScope)) !== null && _d !== void 0 ? _d : defaults.mainScope, scopeExponentThreshold: isValidAppStateScopeExponentThresholdValue(importedState === null || importedState === void 0 ? void 0 : importedState.scopeExponentThreshold, defaults.scopeExponentThreshold), dashSpacingScale: (_e = importedState === null || importedState === void 0 ? void 0 : importedState.dashSpacingScale) !== null && _e !== void 0 ? _e : defaults.dashSpacingScale, isDashSpacingAffectedByViewportScale: (_f = importedState === null || importedState === void 0 ? void 0 : importedState.isDashSpacingAffectedByViewportScale) !== null && _f !== void 0 ? _f : defaults.isDashSpacingAffectedByViewportScale, dimensionsAssociativeByDefault: (_g = importedState === null || importedState === void 0 ? void 0 : importedState.dimensionsAssociativeByDefault) !== null && _g !== void 0 ? _g : defaults.dimensionsAssociativeByDefault, useAnnotativeScaling: (_h = importedState === null || importedState === void 0 ? void 0 : importedState.useAnnotativeScaling) !== null && _h !== void 0 ? _h : defaults.useAnnotativeScaling, displayPrecision: {
|
|
352
|
-
linear: linearPrecision,
|
|
353
|
-
angular: (_k = (_j = importedState === null || importedState === void 0 ? void 0 : importedState.displayPrecision) === null || _j === void 0 ? void 0 : _j.angular) !== null && _k !== void 0 ? _k : defaults.displayPrecision.angular,
|
|
354
|
-
}, pruningLevel: (importedState === null || importedState === void 0 ? void 0 : importedState.pruningLevel) &&
|
|
327
|
+
return Object.assign(Object.assign({}, defaults), { name: (_a = importedState === null || importedState === void 0 ? void 0 : importedState.name) !== null && _a !== void 0 ? _a : defaults.name, viewBackgroundColor: (_b = importedState === null || importedState === void 0 ? void 0 : importedState.viewBackgroundColor) !== null && _b !== void 0 ? _b : defaults.viewBackgroundColor, mainScope: (_c = isValidAppStateScopeValue(importedState === null || importedState === void 0 ? void 0 : importedState.mainScope)) !== null && _c !== void 0 ? _c : defaults.mainScope, scopeExponentThreshold: isValidAppStateScopeExponentThresholdValue(importedState === null || importedState === void 0 ? void 0 : importedState.scopeExponentThreshold, defaults.scopeExponentThreshold), pruningLevel: (importedState === null || importedState === void 0 ? void 0 : importedState.pruningLevel) &&
|
|
355
328
|
Object.values(PRUNING_LEVEL).includes(importedState.pruningLevel)
|
|
356
329
|
? importedState.pruningLevel
|
|
357
330
|
: PRUNING_LEVEL.BALANCED });
|
|
@@ -365,18 +338,25 @@ export const restoreGlobalState = (importedState = {}) => {
|
|
|
365
338
|
* @param restoredGlobalState - The complete and valid global state for the document.
|
|
366
339
|
* @returns A complete and valid DucLocalState object.
|
|
367
340
|
*/
|
|
368
|
-
export const restoreLocalState = (importedState = {}, restoredGlobalState,
|
|
369
|
-
var _a, _b, _c, _d, _e
|
|
341
|
+
export const restoreLocalState = (importedState = {}, restoredGlobalState, forceScope) => {
|
|
342
|
+
var _a, _b, _c, _d, _e;
|
|
370
343
|
const defaults = getDefaultLocalState();
|
|
371
|
-
|
|
344
|
+
// Rust sends zoom as a plain f64, TS stores it as { value, scoped, scaled }.
|
|
345
|
+
// Handle both formats.
|
|
346
|
+
const rawZoom = typeof (importedState === null || importedState === void 0 ? void 0 : importedState.zoom) === "number"
|
|
347
|
+
? importedState.zoom
|
|
348
|
+
: (_a = importedState === null || importedState === void 0 ? void 0 : importedState.zoom) === null || _a === void 0 ? void 0 : _a.value;
|
|
349
|
+
const zoom = getZoom(rawZoom !== null && rawZoom !== void 0 ? rawZoom : defaults.zoom.value, restoredGlobalState.mainScope, restoredGlobalState.scopeExponentThreshold);
|
|
372
350
|
const scope = forceScope
|
|
373
351
|
? isValidScopeValue(forceScope)
|
|
374
352
|
: isValidPrecisionScopeValue(zoom.value, restoredGlobalState.mainScope, restoredGlobalState.scopeExponentThreshold);
|
|
375
|
-
return Object.assign(Object.assign(Object.assign({}, defaults), importedState), { scope,
|
|
353
|
+
return Object.assign(Object.assign(Object.assign({}, defaults), importedState), { scope, isBindingEnabled: isValidBoolean(importedState === null || importedState === void 0 ? void 0 : importedState.isBindingEnabled, defaults.isBindingEnabled), penMode: isValidBoolean(importedState === null || importedState === void 0 ? void 0 : importedState.penMode, defaults.penMode), scrollX: (importedState === null || importedState === void 0 ? void 0 : importedState.scrollX) != null
|
|
376
354
|
? restorePrecisionValue(importedState.scrollX, NEUTRAL_SCOPE, scope)
|
|
377
|
-
: getPrecisionValueFromRaw(defaults.scrollX.value, NEUTRAL_SCOPE, scope), scrollY: (importedState === null || importedState === void 0 ? void 0 : importedState.scrollY)
|
|
355
|
+
: getPrecisionValueFromRaw(defaults.scrollX.value, NEUTRAL_SCOPE, scope), scrollY: (importedState === null || importedState === void 0 ? void 0 : importedState.scrollY) != null
|
|
378
356
|
? restorePrecisionValue(importedState.scrollY, NEUTRAL_SCOPE, scope)
|
|
379
|
-
: getPrecisionValueFromRaw(defaults.scrollY.value, NEUTRAL_SCOPE, scope), zoom,
|
|
357
|
+
: getPrecisionValueFromRaw(defaults.scrollY.value, NEUTRAL_SCOPE, scope), zoom, currentItemStroke: (_b = validateStroke(importedState === null || importedState === void 0 ? void 0 : importedState.currentItemStroke, scope, scope)) !== null && _b !== void 0 ? _b : defaults.currentItemStroke, currentItemBackground: (_c = validateBackground(importedState === null || importedState === void 0 ? void 0 : importedState.currentItemBackground)) !== null && _c !== void 0 ? _c : defaults.currentItemBackground, currentItemFontFamily: typeof (importedState === null || importedState === void 0 ? void 0 : importedState.currentItemFontFamily) === "string"
|
|
358
|
+
? importedState.currentItemFontFamily
|
|
359
|
+
: defaults.currentItemFontFamily, currentItemFontSize: restorePrecisionValue(importedState === null || importedState === void 0 ? void 0 : importedState.currentItemFontSize, scope, scope, defaults.currentItemFontSize.value), currentItemTextAlign: isValidTextAlignValue(importedState === null || importedState === void 0 ? void 0 : importedState.currentItemTextAlign), currentItemOpacity: isValidPercentageValue(importedState === null || importedState === void 0 ? void 0 : importedState.currentItemOpacity, defaults.currentItemOpacity), currentItemRoundness: restorePrecisionValue(importedState === null || importedState === void 0 ? void 0 : importedState.currentItemRoundness, scope, scope, defaults.currentItemRoundness.value), currentItemStartLineHead: (_d = isValidLineHeadValue(importedState === null || importedState === void 0 ? void 0 : importedState.currentItemStartLineHead)) !== null && _d !== void 0 ? _d : defaults.currentItemStartLineHead, currentItemEndLineHead: (_e = isValidLineHeadValue(importedState === null || importedState === void 0 ? void 0 : importedState.currentItemEndLineHead)) !== null && _e !== void 0 ? _e : defaults.currentItemEndLineHead, viewModeEnabled: isValidBoolean(importedState === null || importedState === void 0 ? void 0 : importedState.viewModeEnabled, defaults.viewModeEnabled), objectsSnapModeEnabled: isValidBoolean(importedState === null || importedState === void 0 ? void 0 : importedState.objectsSnapModeEnabled, defaults.objectsSnapModeEnabled), gridModeEnabled: isValidBoolean(importedState === null || importedState === void 0 ? void 0 : importedState.gridModeEnabled, defaults.gridModeEnabled), outlineModeEnabled: isValidBoolean(importedState === null || importedState === void 0 ? void 0 : importedState.outlineModeEnabled, defaults.outlineModeEnabled), manualSaveMode: isValidBoolean(importedState === null || importedState === void 0 ? void 0 : importedState.manualSaveMode, defaults.manualSaveMode), decimalPlaces: isValidDecimalPlacesValue(importedState === null || importedState === void 0 ? void 0 : importedState.decimalPlaces, defaults.decimalPlaces) });
|
|
380
360
|
};
|
|
381
361
|
export const restoreVersionGraph = (importedGraph) => {
|
|
382
362
|
if (!importedGraph || typeof importedGraph !== "object") {
|
|
@@ -387,82 +367,27 @@ export const restoreVersionGraph = (importedGraph) => {
|
|
|
387
367
|
if (!userCheckpointVersionId || !latestVersionId) {
|
|
388
368
|
return undefined;
|
|
389
369
|
}
|
|
390
|
-
const checkpoints =
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
const parentId = typeof c.parentId === "string" ? c.parentId : null;
|
|
401
|
-
const timestamp = isFiniteNumber(c.timestamp) ? c.timestamp : 0;
|
|
402
|
-
const isManualSave = isValidBoolean(c.isManualSave, false);
|
|
403
|
-
const sizeBytes = isFiniteNumber(c.sizeBytes) && c.sizeBytes >= 0 ? c.sizeBytes : 0;
|
|
404
|
-
const data = isValidUint8Array(c.data);
|
|
405
|
-
if (!data) {
|
|
406
|
-
continue;
|
|
407
|
-
}
|
|
408
|
-
checkpoints.push({
|
|
409
|
-
type: "checkpoint",
|
|
410
|
-
id,
|
|
411
|
-
parentId,
|
|
412
|
-
timestamp,
|
|
413
|
-
isManualSave,
|
|
414
|
-
sizeBytes,
|
|
415
|
-
data,
|
|
416
|
-
description: isValidString(c.description) || undefined,
|
|
417
|
-
userId: isValidString(c.userId) || undefined,
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
const deltas = [];
|
|
422
|
-
if (Array.isArray(importedGraph.deltas)) {
|
|
423
|
-
for (const d of importedGraph.deltas) {
|
|
424
|
-
if (!d || typeof d !== "object" || d.type !== "delta") {
|
|
425
|
-
continue;
|
|
426
|
-
}
|
|
427
|
-
const id = isValidString(d.id);
|
|
428
|
-
if (!id) {
|
|
429
|
-
continue;
|
|
430
|
-
}
|
|
431
|
-
const parentId = typeof d.parentId === "string" ? d.parentId : null;
|
|
432
|
-
const timestamp = isFiniteNumber(d.timestamp) ? d.timestamp : 0;
|
|
433
|
-
const isManualSave = isValidBoolean(d.isManualSave, false);
|
|
434
|
-
if (!Array.isArray(d.patch)) {
|
|
435
|
-
continue;
|
|
436
|
-
}
|
|
437
|
-
const patch = [];
|
|
438
|
-
let isPatchValid = true;
|
|
439
|
-
for (const op of d.patch) {
|
|
440
|
-
if (!op ||
|
|
441
|
-
typeof op !== "object" ||
|
|
442
|
-
!isValidString(op.op) ||
|
|
443
|
-
!isValidString(op.path)) {
|
|
444
|
-
isPatchValid = false;
|
|
445
|
-
break;
|
|
446
|
-
}
|
|
447
|
-
patch.push({ op: op.op, path: op.path, value: op.value });
|
|
448
|
-
}
|
|
449
|
-
if (!isPatchValid) {
|
|
450
|
-
continue;
|
|
451
|
-
}
|
|
452
|
-
deltas.push({
|
|
453
|
-
type: "delta",
|
|
454
|
-
id,
|
|
455
|
-
parentId,
|
|
456
|
-
timestamp,
|
|
457
|
-
isManualSave,
|
|
458
|
-
patch,
|
|
459
|
-
description: isValidString(d.description) || undefined,
|
|
460
|
-
userId: isValidString(d.userId) || undefined,
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
}
|
|
370
|
+
const checkpoints = Array.isArray(importedGraph.checkpoints)
|
|
371
|
+
? importedGraph.checkpoints
|
|
372
|
+
.map((checkpoint) => restoreCheckpoint(checkpoint))
|
|
373
|
+
.filter((checkpoint) => Boolean(checkpoint))
|
|
374
|
+
: [];
|
|
375
|
+
const deltas = Array.isArray(importedGraph.deltas)
|
|
376
|
+
? importedGraph.deltas
|
|
377
|
+
.map((delta) => restoreDelta(delta))
|
|
378
|
+
.filter((delta) => Boolean(delta))
|
|
379
|
+
: [];
|
|
464
380
|
const importedMetadata = importedGraph.metadata;
|
|
465
381
|
const metadata = {
|
|
382
|
+
currentVersion: isFiniteNumber(importedMetadata === null || importedMetadata === void 0 ? void 0 : importedMetadata.currentVersion) && importedMetadata.currentVersion >= 0
|
|
383
|
+
? importedMetadata.currentVersion
|
|
384
|
+
: 0,
|
|
385
|
+
currentSchemaVersion: isFiniteNumber(importedMetadata === null || importedMetadata === void 0 ? void 0 : importedMetadata.currentSchemaVersion) && importedMetadata.currentSchemaVersion >= 1
|
|
386
|
+
? importedMetadata.currentSchemaVersion
|
|
387
|
+
: 1,
|
|
388
|
+
chainCount: isFiniteNumber(importedMetadata === null || importedMetadata === void 0 ? void 0 : importedMetadata.chainCount) && importedMetadata.chainCount >= 1
|
|
389
|
+
? importedMetadata.chainCount
|
|
390
|
+
: 1,
|
|
466
391
|
lastPruned: isFiniteNumber(importedMetadata === null || importedMetadata === void 0 ? void 0 : importedMetadata.lastPruned)
|
|
467
392
|
? importedMetadata.lastPruned
|
|
468
393
|
: 0,
|
|
@@ -474,11 +399,77 @@ export const restoreVersionGraph = (importedGraph) => {
|
|
|
474
399
|
return {
|
|
475
400
|
userCheckpointVersionId,
|
|
476
401
|
latestVersionId,
|
|
402
|
+
chains: Array.isArray(importedGraph.chains) ? importedGraph.chains : [],
|
|
477
403
|
checkpoints,
|
|
478
404
|
deltas,
|
|
479
405
|
metadata,
|
|
480
406
|
};
|
|
481
407
|
};
|
|
408
|
+
export const restoreCheckpoint = (importedCheckpoint) => {
|
|
409
|
+
if (!importedCheckpoint || typeof importedCheckpoint !== "object") {
|
|
410
|
+
return undefined;
|
|
411
|
+
}
|
|
412
|
+
const checkpoint = importedCheckpoint;
|
|
413
|
+
if (checkpoint.type !== "checkpoint") {
|
|
414
|
+
return undefined;
|
|
415
|
+
}
|
|
416
|
+
const id = isValidString(checkpoint.id);
|
|
417
|
+
const data = isValidUint8Array(checkpoint.data);
|
|
418
|
+
if (!id || !data) {
|
|
419
|
+
return undefined;
|
|
420
|
+
}
|
|
421
|
+
return {
|
|
422
|
+
type: "checkpoint",
|
|
423
|
+
id,
|
|
424
|
+
parentId: typeof checkpoint.parentId === "string" ? checkpoint.parentId : null,
|
|
425
|
+
timestamp: isFiniteNumber(checkpoint.timestamp) ? checkpoint.timestamp : 0,
|
|
426
|
+
isManualSave: isValidBoolean(checkpoint.isManualSave, false),
|
|
427
|
+
versionNumber: isFiniteNumber(checkpoint.versionNumber) ? checkpoint.versionNumber : 0,
|
|
428
|
+
schemaVersion: isFiniteNumber(checkpoint.schemaVersion) && checkpoint.schemaVersion >= 1
|
|
429
|
+
? checkpoint.schemaVersion
|
|
430
|
+
: 1,
|
|
431
|
+
isSchemaBoundary: isValidBoolean(checkpoint.isSchemaBoundary, false),
|
|
432
|
+
data,
|
|
433
|
+
sizeBytes: isFiniteNumber(checkpoint.sizeBytes) && checkpoint.sizeBytes >= 0
|
|
434
|
+
? checkpoint.sizeBytes
|
|
435
|
+
: data.byteLength,
|
|
436
|
+
description: isValidString(checkpoint.description) || undefined,
|
|
437
|
+
userId: isValidString(checkpoint.userId) || undefined,
|
|
438
|
+
};
|
|
439
|
+
};
|
|
440
|
+
export const restoreDelta = (importedDelta) => {
|
|
441
|
+
if (!importedDelta || typeof importedDelta !== "object") {
|
|
442
|
+
return undefined;
|
|
443
|
+
}
|
|
444
|
+
const delta = importedDelta;
|
|
445
|
+
if (delta.type !== "delta") {
|
|
446
|
+
return undefined;
|
|
447
|
+
}
|
|
448
|
+
const id = isValidString(delta.id);
|
|
449
|
+
const payload = isValidUint8Array(delta.payload);
|
|
450
|
+
const baseCheckpointId = isValidString(delta.baseCheckpointId);
|
|
451
|
+
if (!id || !payload || !baseCheckpointId) {
|
|
452
|
+
return undefined;
|
|
453
|
+
}
|
|
454
|
+
return {
|
|
455
|
+
type: "delta",
|
|
456
|
+
id,
|
|
457
|
+
parentId: typeof delta.parentId === "string" ? delta.parentId : null,
|
|
458
|
+
timestamp: isFiniteNumber(delta.timestamp) ? delta.timestamp : 0,
|
|
459
|
+
isManualSave: isValidBoolean(delta.isManualSave, false),
|
|
460
|
+
versionNumber: isFiniteNumber(delta.versionNumber) ? delta.versionNumber : 0,
|
|
461
|
+
schemaVersion: isFiniteNumber(delta.schemaVersion) && delta.schemaVersion >= 1
|
|
462
|
+
? delta.schemaVersion
|
|
463
|
+
: 1,
|
|
464
|
+
baseCheckpointId,
|
|
465
|
+
payload,
|
|
466
|
+
sizeBytes: isFiniteNumber(delta.sizeBytes) && delta.sizeBytes >= 0
|
|
467
|
+
? delta.sizeBytes
|
|
468
|
+
: payload.byteLength,
|
|
469
|
+
description: isValidString(delta.description) || undefined,
|
|
470
|
+
userId: isValidString(delta.userId) || undefined,
|
|
471
|
+
};
|
|
472
|
+
};
|
|
482
473
|
/**
|
|
483
474
|
* Restores common properties for elements leveraging _DucStackBase.
|
|
484
475
|
*/
|
|
@@ -492,7 +483,6 @@ export const restoreDucStackProperties = (stack) => {
|
|
|
492
483
|
isVisible: isValidBoolean(stack.isVisible, defaultStackProperties.isVisible),
|
|
493
484
|
isPlot: isValidBoolean(stack.isPlot, defaultStackProperties.isPlot),
|
|
494
485
|
opacity: isValidPercentageValue(stack.opacity, defaultStackProperties.opacity),
|
|
495
|
-
labelingColor: isValidColor(stack.labelingColor, defaultStackProperties.labelingColor),
|
|
496
486
|
};
|
|
497
487
|
};
|
|
498
488
|
export const isValidAppStateScopeValue = (value) => {
|
|
@@ -553,6 +543,16 @@ export const isValidTextAlignValue = (value) => {
|
|
|
553
543
|
return DEFAULT_TEXT_ALIGN;
|
|
554
544
|
return value;
|
|
555
545
|
};
|
|
546
|
+
export const isValidDecimalPlacesValue = (value, fallback) => {
|
|
547
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
548
|
+
return fallback;
|
|
549
|
+
}
|
|
550
|
+
const truncated = Math.trunc(value);
|
|
551
|
+
if (truncated < 0 || truncated > 20) {
|
|
552
|
+
return fallback;
|
|
553
|
+
}
|
|
554
|
+
return truncated;
|
|
555
|
+
};
|
|
556
556
|
export const isValidScopeValue = (value, localState, mainScope) => {
|
|
557
557
|
if (value !== undefined && Object.keys(ScaleFactors).includes(value)) {
|
|
558
558
|
return value;
|
|
@@ -836,16 +836,6 @@ export const isValidUint8Array = (value) => {
|
|
|
836
836
|
}
|
|
837
837
|
return undefined;
|
|
838
838
|
};
|
|
839
|
-
/**
|
|
840
|
-
* Validates a Standard id.
|
|
841
|
-
* Returns the id if valid and present in standards, otherwise returns the default DUC standard id.
|
|
842
|
-
*/
|
|
843
|
-
export const isValidStandardId = (id, standards, defaultId = PREDEFINED_STANDARDS.DUC) => {
|
|
844
|
-
const validId = isValidString(id);
|
|
845
|
-
if (isStandardIdPresent(validId, standards))
|
|
846
|
-
return validId;
|
|
847
|
-
return defaultId;
|
|
848
|
-
};
|
|
849
839
|
/**
|
|
850
840
|
* Validates a block id.
|
|
851
841
|
* Returns the id if present in restored blocks, otherwise returns null.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ElementsConfig, RestoredDataState } from "./restoreDataState";
|
|
2
1
|
import { BezierMirroring, DucElement, DucFreeDrawEasing, DucLocalState, DucPoint, ImportedDataState, OrderedDucElement, PrecisionValue, Scope } from "../types";
|
|
2
|
+
import { ElementsConfig, RestoredDataState } from "./restoreDataState";
|
|
3
3
|
/**
|
|
4
4
|
* Restores a point that might have legacy format (x,y as numbers)
|
|
5
5
|
* @param point - The point to restore
|