ducjs 1.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/LICENSE +21 -0
- package/README.md +42 -0
- package/dist/flatbuffers/duc/alternate-units.d.ts +21 -0
- package/dist/flatbuffers/duc/alternate-units.js +66 -0
- package/dist/flatbuffers/duc/angular-unit-system.d.ts +17 -0
- package/dist/flatbuffers/duc/angular-unit-system.js +50 -0
- package/dist/flatbuffers/duc/angular-units-format.d.ts +7 -0
- package/dist/flatbuffers/duc/angular-units-format.js +10 -0
- package/dist/flatbuffers/duc/axis.d.ts +5 -0
- package/dist/flatbuffers/duc/axis.js +8 -0
- package/dist/flatbuffers/duc/bezier-mirroring.d.ts +5 -0
- package/dist/flatbuffers/duc/bezier-mirroring.js +8 -0
- package/dist/flatbuffers/duc/blending.d.ts +9 -0
- package/dist/flatbuffers/duc/blending.js +12 -0
- package/dist/flatbuffers/duc/block-attachment.d.ts +4 -0
- package/dist/flatbuffers/duc/block-attachment.js +7 -0
- package/dist/flatbuffers/duc/boolean-operation.d.ts +6 -0
- package/dist/flatbuffers/duc/boolean-operation.js +9 -0
- package/dist/flatbuffers/duc/bound-element.d.ts +17 -0
- package/dist/flatbuffers/duc/bound-element.js +48 -0
- package/dist/flatbuffers/duc/checkpoint.d.ts +22 -0
- package/dist/flatbuffers/duc/checkpoint.js +75 -0
- package/dist/flatbuffers/duc/column-layout.d.ts +22 -0
- package/dist/flatbuffers/duc/column-layout.js +72 -0
- package/dist/flatbuffers/duc/column-type.d.ts +5 -0
- package/dist/flatbuffers/duc/column-type.js +8 -0
- package/dist/flatbuffers/duc/custom-hatch-pattern.d.ts +23 -0
- package/dist/flatbuffers/duc/custom-hatch-pattern.js +71 -0
- package/dist/flatbuffers/duc/datum-bracket-style.d.ts +5 -0
- package/dist/flatbuffers/duc/datum-bracket-style.js +8 -0
- package/dist/flatbuffers/duc/datum-reference.d.ts +17 -0
- package/dist/flatbuffers/duc/datum-reference.js +49 -0
- package/dist/flatbuffers/duc/datum-target-type.d.ts +6 -0
- package/dist/flatbuffers/duc/datum-target-type.js +9 -0
- package/dist/flatbuffers/duc/decimal-separator.d.ts +4 -0
- package/dist/flatbuffers/duc/decimal-separator.js +7 -0
- package/dist/flatbuffers/duc/delta.d.ts +20 -0
- package/dist/flatbuffers/duc/delta.js +64 -0
- package/dist/flatbuffers/duc/dictionary-entry.d.ts +17 -0
- package/dist/flatbuffers/duc/dictionary-entry.js +49 -0
- package/dist/flatbuffers/duc/dimension-baseline-data.d.ts +14 -0
- package/dist/flatbuffers/duc/dimension-baseline-data.js +40 -0
- package/dist/flatbuffers/duc/dimension-bindings.d.ts +17 -0
- package/dist/flatbuffers/duc/dimension-bindings.js +50 -0
- package/dist/flatbuffers/duc/dimension-continue-data.d.ts +14 -0
- package/dist/flatbuffers/duc/dimension-continue-data.js +40 -0
- package/dist/flatbuffers/duc/dimension-definition-points.d.ts +21 -0
- package/dist/flatbuffers/duc/dimension-definition-points.js +64 -0
- package/dist/flatbuffers/duc/dimension-ext-line-style.d.ts +18 -0
- package/dist/flatbuffers/duc/dimension-ext-line-style.js +57 -0
- package/dist/flatbuffers/duc/dimension-fit-rule.d.ts +6 -0
- package/dist/flatbuffers/duc/dimension-fit-rule.js +9 -0
- package/dist/flatbuffers/duc/dimension-fit-style.d.ts +19 -0
- package/dist/flatbuffers/duc/dimension-fit-style.js +58 -0
- package/dist/flatbuffers/duc/dimension-line-style.d.ts +16 -0
- package/dist/flatbuffers/duc/dimension-line-style.js +49 -0
- package/dist/flatbuffers/duc/dimension-symbol-style.d.ts +22 -0
- package/dist/flatbuffers/duc/dimension-symbol-style.js +72 -0
- package/dist/flatbuffers/duc/dimension-text-placement.d.ts +5 -0
- package/dist/flatbuffers/duc/dimension-text-placement.js +8 -0
- package/dist/flatbuffers/duc/dimension-tolerance-style.d.ts +24 -0
- package/dist/flatbuffers/duc/dimension-tolerance-style.js +71 -0
- package/dist/flatbuffers/duc/dimension-type.d.ts +15 -0
- package/dist/flatbuffers/duc/dimension-type.js +18 -0
- package/dist/flatbuffers/duc/dimension-units-format.d.ts +7 -0
- package/dist/flatbuffers/duc/dimension-units-format.js +10 -0
- package/dist/flatbuffers/duc/dimension-validation-rules.d.ts +25 -0
- package/dist/flatbuffers/duc/dimension-validation-rules.js +74 -0
- package/dist/flatbuffers/duc/duc-arrow-element.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-arrow-element.js +49 -0
- package/dist/flatbuffers/duc/duc-block-attribute-definition-entry.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-block-attribute-definition-entry.js +44 -0
- package/dist/flatbuffers/duc/duc-block-attribute-definition.d.ts +22 -0
- package/dist/flatbuffers/duc/duc-block-attribute-definition.js +64 -0
- package/dist/flatbuffers/duc/duc-block-duplication-array.d.ts +19 -0
- package/dist/flatbuffers/duc/duc-block-duplication-array.js +64 -0
- package/dist/flatbuffers/duc/duc-block-instance-element.d.ts +30 -0
- package/dist/flatbuffers/duc/duc-block-instance-element.js +94 -0
- package/dist/flatbuffers/duc/duc-block.d.ts +34 -0
- package/dist/flatbuffers/duc/duc-block.js +111 -0
- package/dist/flatbuffers/duc/duc-common-style.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-common-style.js +44 -0
- package/dist/flatbuffers/duc/duc-dimension-element.d.ts +45 -0
- package/dist/flatbuffers/duc/duc-dimension-element.js +120 -0
- package/dist/flatbuffers/duc/duc-dimension-style.d.ts +28 -0
- package/dist/flatbuffers/duc/duc-dimension-style.js +76 -0
- package/dist/flatbuffers/duc/duc-doc-element.d.ts +33 -0
- package/dist/flatbuffers/duc/duc-doc-element.js +95 -0
- package/dist/flatbuffers/duc/duc-doc-style.d.ts +19 -0
- package/dist/flatbuffers/duc/duc-doc-style.js +52 -0
- package/dist/flatbuffers/duc/duc-element-base.d.ts +88 -0
- package/dist/flatbuffers/duc/duc-element-base.js +269 -0
- package/dist/flatbuffers/duc/duc-element-styles-base.d.ts +30 -0
- package/dist/flatbuffers/duc/duc-element-styles-base.js +103 -0
- package/dist/flatbuffers/duc/duc-ellipse-element.d.ts +22 -0
- package/dist/flatbuffers/duc/duc-ellipse-element.js +73 -0
- package/dist/flatbuffers/duc/duc-embeddable-element.d.ts +14 -0
- package/dist/flatbuffers/duc/duc-embeddable-element.js +41 -0
- package/dist/flatbuffers/duc/duc-external-file-data.d.ts +27 -0
- package/dist/flatbuffers/duc/duc-external-file-data.js +92 -0
- package/dist/flatbuffers/duc/duc-external-file-entry.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-external-file-entry.js +44 -0
- package/dist/flatbuffers/duc/duc-feature-control-frame-element.d.ts +31 -0
- package/dist/flatbuffers/duc/duc-feature-control-frame-element.js +89 -0
- package/dist/flatbuffers/duc/duc-feature-control-frame-style.d.ts +25 -0
- package/dist/flatbuffers/duc/duc-feature-control-frame-style.js +68 -0
- package/dist/flatbuffers/duc/duc-frame-element.d.ts +14 -0
- package/dist/flatbuffers/duc/duc-frame-element.js +41 -0
- package/dist/flatbuffers/duc/duc-free-draw-element.d.ts +52 -0
- package/dist/flatbuffers/duc/duc-free-draw-element.js +154 -0
- package/dist/flatbuffers/duc/duc-free-draw-ends.d.ts +18 -0
- package/dist/flatbuffers/duc/duc-free-draw-ends.js +56 -0
- package/dist/flatbuffers/duc/duc-global-state.d.ts +37 -0
- package/dist/flatbuffers/duc/duc-global-state.js +121 -0
- package/dist/flatbuffers/duc/duc-group.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-group.js +44 -0
- package/dist/flatbuffers/duc/duc-hatch-style.d.ts +28 -0
- package/dist/flatbuffers/duc/duc-hatch-style.js +79 -0
- package/dist/flatbuffers/duc/duc-head.d.ts +19 -0
- package/dist/flatbuffers/duc/duc-head.js +57 -0
- package/dist/flatbuffers/duc/duc-image-element.d.ts +35 -0
- package/dist/flatbuffers/duc/duc-image-element.js +91 -0
- package/dist/flatbuffers/duc/duc-image-filter.d.ts +15 -0
- package/dist/flatbuffers/duc/duc-image-filter.js +48 -0
- package/dist/flatbuffers/duc/duc-layer-overrides.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-layer-overrides.js +44 -0
- package/dist/flatbuffers/duc/duc-layer.d.ts +21 -0
- package/dist/flatbuffers/duc/duc-layer.js +59 -0
- package/dist/flatbuffers/duc/duc-leader-element.d.ts +22 -0
- package/dist/flatbuffers/duc/duc-leader-element.js +60 -0
- package/dist/flatbuffers/duc/duc-leader-style.d.ts +30 -0
- package/dist/flatbuffers/duc/duc-leader-style.js +87 -0
- package/dist/flatbuffers/duc/duc-line-reference.d.ts +15 -0
- package/dist/flatbuffers/duc/duc-line-reference.js +43 -0
- package/dist/flatbuffers/duc/duc-line.d.ts +15 -0
- package/dist/flatbuffers/duc/duc-line.js +43 -0
- package/dist/flatbuffers/duc/duc-linear-element-base.d.ts +38 -0
- package/dist/flatbuffers/duc/duc-linear-element-base.js +124 -0
- package/dist/flatbuffers/duc/duc-linear-element.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-linear-element.js +49 -0
- package/dist/flatbuffers/duc/duc-local-state.d.ts +68 -0
- package/dist/flatbuffers/duc/duc-local-state.js +206 -0
- package/dist/flatbuffers/duc/duc-mermaid-element.d.ts +23 -0
- package/dist/flatbuffers/duc/duc-mermaid-element.js +65 -0
- package/dist/flatbuffers/duc/duc-parametric-element.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-parametric-element.js +44 -0
- package/dist/flatbuffers/duc/duc-path.d.ts +26 -0
- package/dist/flatbuffers/duc/duc-path.js +69 -0
- package/dist/flatbuffers/duc/duc-pdf-element.d.ts +17 -0
- package/dist/flatbuffers/duc/duc-pdf-element.js +49 -0
- package/dist/flatbuffers/duc/duc-plot-element.d.ts +19 -0
- package/dist/flatbuffers/duc/duc-plot-element.js +52 -0
- package/dist/flatbuffers/duc/duc-plot-style.d.ts +14 -0
- package/dist/flatbuffers/duc/duc-plot-style.js +41 -0
- package/dist/flatbuffers/duc/duc-point-binding.d.ts +26 -0
- package/dist/flatbuffers/duc/duc-point-binding.js +73 -0
- package/dist/flatbuffers/duc/duc-point.d.ts +18 -0
- package/dist/flatbuffers/duc/duc-point.js +57 -0
- package/dist/flatbuffers/duc/duc-polygon-element.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-polygon-element.js +49 -0
- package/dist/flatbuffers/duc/duc-rectangle-element.d.ts +14 -0
- package/dist/flatbuffers/duc/duc-rectangle-element.js +41 -0
- package/dist/flatbuffers/duc/duc-region.d.ts +19 -0
- package/dist/flatbuffers/duc/duc-region.js +51 -0
- package/dist/flatbuffers/duc/duc-stack-base.d.ts +27 -0
- package/dist/flatbuffers/duc/duc-stack-base.js +78 -0
- package/dist/flatbuffers/duc/duc-stack-element-base.d.ts +23 -0
- package/dist/flatbuffers/duc/duc-stack-element-base.js +65 -0
- package/dist/flatbuffers/duc/duc-stack-like-styles.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-stack-like-styles.js +48 -0
- package/dist/flatbuffers/duc/duc-table-auto-size.d.ts +15 -0
- package/dist/flatbuffers/duc/duc-table-auto-size.js +48 -0
- package/dist/flatbuffers/duc/duc-table-cell-entry.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-table-cell-entry.js +44 -0
- package/dist/flatbuffers/duc/duc-table-cell-span.d.ts +15 -0
- package/dist/flatbuffers/duc/duc-table-cell-span.js +48 -0
- package/dist/flatbuffers/duc/duc-table-cell-style.d.ts +22 -0
- package/dist/flatbuffers/duc/duc-table-cell-style.js +59 -0
- package/dist/flatbuffers/duc/duc-table-cell.d.ts +27 -0
- package/dist/flatbuffers/duc/duc-table-cell.js +72 -0
- package/dist/flatbuffers/duc/duc-table-column-entry.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-table-column-entry.js +44 -0
- package/dist/flatbuffers/duc/duc-table-column.d.ts +18 -0
- package/dist/flatbuffers/duc/duc-table-column.js +51 -0
- package/dist/flatbuffers/duc/duc-table-element.d.ts +51 -0
- package/dist/flatbuffers/duc/duc-table-element.js +167 -0
- package/dist/flatbuffers/duc/duc-table-row-entry.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-table-row-entry.js +44 -0
- package/dist/flatbuffers/duc/duc-table-row.d.ts +18 -0
- package/dist/flatbuffers/duc/duc-table-row.js +51 -0
- package/dist/flatbuffers/duc/duc-table-style.d.ts +23 -0
- package/dist/flatbuffers/duc/duc-table-style.js +65 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-dictionary-source.d.ts +14 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-dictionary-source.js +40 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-element-source.d.ts +17 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-element-source.js +49 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-part.d.ts +22 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-part.js +58 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-source-data.d.ts +9 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-source-data.js +26 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-source.d.ts +19 -0
- package/dist/flatbuffers/duc/duc-text-dynamic-source.js +58 -0
- package/dist/flatbuffers/duc/duc-text-element.d.ts +33 -0
- package/dist/flatbuffers/duc/duc-text-element.js +94 -0
- package/dist/flatbuffers/duc/duc-text-style.d.ts +44 -0
- package/dist/flatbuffers/duc/duc-text-style.js +128 -0
- package/dist/flatbuffers/duc/duc-ucs.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-ucs.js +49 -0
- package/dist/flatbuffers/duc/duc-view.d.ts +24 -0
- package/dist/flatbuffers/duc/duc-view.js +71 -0
- package/dist/flatbuffers/duc/duc-viewport-element.d.ts +36 -0
- package/dist/flatbuffers/duc/duc-viewport-element.js +102 -0
- package/dist/flatbuffers/duc/duc-viewport-style.d.ts +16 -0
- package/dist/flatbuffers/duc/duc-viewport-style.js +49 -0
- package/dist/flatbuffers/duc/duc-xray-element.d.ts +23 -0
- package/dist/flatbuffers/duc/duc-xray-element.js +66 -0
- package/dist/flatbuffers/duc/duc-xray-style.d.ts +17 -0
- package/dist/flatbuffers/duc/duc-xray-style.js +49 -0
- package/dist/flatbuffers/duc/dynamic-snap-settings.d.ts +17 -0
- package/dist/flatbuffers/duc/dynamic-snap-settings.js +56 -0
- package/dist/flatbuffers/duc/element-background.d.ts +14 -0
- package/dist/flatbuffers/duc/element-background.js +41 -0
- package/dist/flatbuffers/duc/element-content-base.d.ts +29 -0
- package/dist/flatbuffers/duc/element-content-base.js +80 -0
- package/dist/flatbuffers/duc/element-content-preference.d.ts +8 -0
- package/dist/flatbuffers/duc/element-content-preference.js +11 -0
- package/dist/flatbuffers/duc/element-stroke.d.ts +24 -0
- package/dist/flatbuffers/duc/element-stroke.js +66 -0
- package/dist/flatbuffers/duc/element-wrapper.d.ts +16 -0
- package/dist/flatbuffers/duc/element-wrapper.js +49 -0
- package/dist/flatbuffers/duc/element.d.ts +49 -0
- package/dist/flatbuffers/duc/element.js +106 -0
- package/dist/flatbuffers/duc/exported-data-state.d.ts +87 -0
- package/dist/flatbuffers/duc/exported-data-state.js +290 -0
- package/dist/flatbuffers/duc/fcfbetween-modifier.d.ts +17 -0
- package/dist/flatbuffers/duc/fcfbetween-modifier.js +48 -0
- package/dist/flatbuffers/duc/fcfdatum-definition.d.ts +16 -0
- package/dist/flatbuffers/duc/fcfdatum-definition.js +43 -0
- package/dist/flatbuffers/duc/fcfdatum-style.d.ts +14 -0
- package/dist/flatbuffers/duc/fcfdatum-style.js +41 -0
- package/dist/flatbuffers/duc/fcfframe-modifiers.d.ts +22 -0
- package/dist/flatbuffers/duc/fcfframe-modifiers.js +65 -0
- package/dist/flatbuffers/duc/fcflayout-style.d.ts +17 -0
- package/dist/flatbuffers/duc/fcflayout-style.js +56 -0
- package/dist/flatbuffers/duc/fcfprojected-zone-modifier.d.ts +13 -0
- package/dist/flatbuffers/duc/fcfprojected-zone-modifier.js +40 -0
- package/dist/flatbuffers/duc/fcfsegment-row.d.ts +17 -0
- package/dist/flatbuffers/duc/fcfsegment-row.js +55 -0
- package/dist/flatbuffers/duc/fcfsymbol-style.d.ts +13 -0
- package/dist/flatbuffers/duc/fcfsymbol-style.js +40 -0
- package/dist/flatbuffers/duc/feature-control-frame-segment.d.ts +22 -0
- package/dist/flatbuffers/duc/feature-control-frame-segment.js +65 -0
- package/dist/flatbuffers/duc/feature-modifier.d.ts +18 -0
- package/dist/flatbuffers/duc/feature-modifier.js +21 -0
- package/dist/flatbuffers/duc/gdt-symbol.d.ts +22 -0
- package/dist/flatbuffers/duc/gdt-symbol.js +25 -0
- package/dist/flatbuffers/duc/geometric-point.d.ts +10 -0
- package/dist/flatbuffers/duc/geometric-point.js +27 -0
- package/dist/flatbuffers/duc/grid-display-type.d.ts +6 -0
- package/dist/flatbuffers/duc/grid-display-type.js +9 -0
- package/dist/flatbuffers/duc/grid-settings.d.ts +54 -0
- package/dist/flatbuffers/duc/grid-settings.js +165 -0
- package/dist/flatbuffers/duc/grid-style.d.ts +26 -0
- package/dist/flatbuffers/duc/grid-style.js +74 -0
- package/dist/flatbuffers/duc/grid-type.d.ts +7 -0
- package/dist/flatbuffers/duc/grid-type.js +10 -0
- package/dist/flatbuffers/duc/handle-type.d.ts +4 -0
- package/dist/flatbuffers/duc/handle-type.js +7 -0
- package/dist/flatbuffers/duc/hatch-pattern-line.d.ts +35 -0
- package/dist/flatbuffers/duc/hatch-pattern-line.js +93 -0
- package/dist/flatbuffers/duc/hatch-style.d.ts +5 -0
- package/dist/flatbuffers/duc/hatch-style.js +8 -0
- package/dist/flatbuffers/duc/identified-common-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-common-style.js +44 -0
- package/dist/flatbuffers/duc/identified-dimension-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-dimension-style.js +44 -0
- package/dist/flatbuffers/duc/identified-doc-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-doc-style.js +44 -0
- package/dist/flatbuffers/duc/identified-fcfstyle.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-fcfstyle.js +44 -0
- package/dist/flatbuffers/duc/identified-grid-settings.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-grid-settings.js +44 -0
- package/dist/flatbuffers/duc/identified-hatch-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-hatch-style.js +44 -0
- package/dist/flatbuffers/duc/identified-leader-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-leader-style.js +44 -0
- package/dist/flatbuffers/duc/identified-snap-settings.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-snap-settings.js +44 -0
- package/dist/flatbuffers/duc/identified-stack-like-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-stack-like-style.js +44 -0
- package/dist/flatbuffers/duc/identified-table-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-table-style.js +44 -0
- package/dist/flatbuffers/duc/identified-text-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-text-style.js +44 -0
- package/dist/flatbuffers/duc/identified-ucs.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-ucs.js +44 -0
- package/dist/flatbuffers/duc/identified-view.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-view.js +44 -0
- package/dist/flatbuffers/duc/identified-viewport-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-viewport-style.js +44 -0
- package/dist/flatbuffers/duc/identified-xray-style.d.ts +16 -0
- package/dist/flatbuffers/duc/identified-xray-style.js +44 -0
- package/dist/flatbuffers/duc/identifier.d.ts +20 -0
- package/dist/flatbuffers/duc/identifier.js +57 -0
- package/dist/flatbuffers/duc/image-crop.d.ts +23 -0
- package/dist/flatbuffers/duc/image-crop.js +80 -0
- package/dist/flatbuffers/duc/image-status.d.ts +5 -0
- package/dist/flatbuffers/duc/image-status.js +8 -0
- package/dist/flatbuffers/duc/isometric-grid-settings.d.ts +15 -0
- package/dist/flatbuffers/duc/isometric-grid-settings.js +48 -0
- package/dist/flatbuffers/duc/jsonpatch-operation.d.ts +23 -0
- package/dist/flatbuffers/duc/jsonpatch-operation.js +64 -0
- package/dist/flatbuffers/duc/layer-snap-filters.d.ts +23 -0
- package/dist/flatbuffers/duc/layer-snap-filters.js +76 -0
- package/dist/flatbuffers/duc/layer-validation-rules.d.ts +17 -0
- package/dist/flatbuffers/duc/layer-validation-rules.js +54 -0
- package/dist/flatbuffers/duc/leader-block-content.d.ts +25 -0
- package/dist/flatbuffers/duc/leader-block-content.js +85 -0
- package/dist/flatbuffers/duc/leader-content-data.d.ts +9 -0
- package/dist/flatbuffers/duc/leader-content-data.js +26 -0
- package/dist/flatbuffers/duc/leader-content-type.d.ts +4 -0
- package/dist/flatbuffers/duc/leader-content-type.js +7 -0
- package/dist/flatbuffers/duc/leader-content.d.ts +19 -0
- package/dist/flatbuffers/duc/leader-content.js +58 -0
- package/dist/flatbuffers/duc/leader-text-block-content.d.ts +14 -0
- package/dist/flatbuffers/duc/leader-text-block-content.js +40 -0
- package/dist/flatbuffers/duc/line-head.d.ts +17 -0
- package/dist/flatbuffers/duc/line-head.js +20 -0
- package/dist/flatbuffers/duc/line-spacing-type.d.ts +5 -0
- package/dist/flatbuffers/duc/line-spacing-type.js +8 -0
- package/dist/flatbuffers/duc/line-spacing.d.ts +16 -0
- package/dist/flatbuffers/duc/line-spacing.js +49 -0
- package/dist/flatbuffers/duc/linear-unit-system.d.ts +24 -0
- package/dist/flatbuffers/duc/linear-unit-system.js +75 -0
- package/dist/flatbuffers/duc/margins.d.ts +19 -0
- package/dist/flatbuffers/duc/margins.js +64 -0
- package/dist/flatbuffers/duc/mark-ellipse-center.d.ts +4 -0
- package/dist/flatbuffers/duc/mark-ellipse-center.js +7 -0
- package/dist/flatbuffers/duc/material-condition.d.ts +5 -0
- package/dist/flatbuffers/duc/material-condition.js +8 -0
- package/dist/flatbuffers/duc/object-snap-mode.d.ts +22 -0
- package/dist/flatbuffers/duc/object-snap-mode.js +25 -0
- package/dist/flatbuffers/duc/paragraph-formatting.d.ts +33 -0
- package/dist/flatbuffers/duc/paragraph-formatting.js +106 -0
- package/dist/flatbuffers/duc/parametric-source-type.d.ts +4 -0
- package/dist/flatbuffers/duc/parametric-source-type.js +7 -0
- package/dist/flatbuffers/duc/parametric-source.d.ts +20 -0
- package/dist/flatbuffers/duc/parametric-source.js +57 -0
- package/dist/flatbuffers/duc/plot-layout.d.ts +14 -0
- package/dist/flatbuffers/duc/plot-layout.js +41 -0
- package/dist/flatbuffers/duc/point-binding-point.d.ts +15 -0
- package/dist/flatbuffers/duc/point-binding-point.js +48 -0
- package/dist/flatbuffers/duc/polar-grid-settings.d.ts +17 -0
- package/dist/flatbuffers/duc/polar-grid-settings.js +56 -0
- package/dist/flatbuffers/duc/polar-tracking-settings.d.ts +29 -0
- package/dist/flatbuffers/duc/polar-tracking-settings.js +90 -0
- package/dist/flatbuffers/duc/primary-units.d.ts +16 -0
- package/dist/flatbuffers/duc/primary-units.js +44 -0
- package/dist/flatbuffers/duc/pruning-level.d.ts +5 -0
- package/dist/flatbuffers/duc/pruning-level.js +8 -0
- package/dist/flatbuffers/duc/snap-marker-settings.d.ts +23 -0
- package/dist/flatbuffers/duc/snap-marker-settings.js +79 -0
- package/dist/flatbuffers/duc/snap-marker-shape.d.ts +6 -0
- package/dist/flatbuffers/duc/snap-marker-shape.js +9 -0
- package/dist/flatbuffers/duc/snap-marker-style-entry.d.ts +16 -0
- package/dist/flatbuffers/duc/snap-marker-style-entry.js +43 -0
- package/dist/flatbuffers/duc/snap-marker-style.d.ts +17 -0
- package/dist/flatbuffers/duc/snap-marker-style.js +49 -0
- package/dist/flatbuffers/duc/snap-mode.d.ts +4 -0
- package/dist/flatbuffers/duc/snap-mode.js +7 -0
- package/dist/flatbuffers/duc/snap-override-behavior.d.ts +5 -0
- package/dist/flatbuffers/duc/snap-override-behavior.js +8 -0
- package/dist/flatbuffers/duc/snap-override.d.ts +17 -0
- package/dist/flatbuffers/duc/snap-override.js +49 -0
- package/dist/flatbuffers/duc/snap-settings.d.ts +75 -0
- package/dist/flatbuffers/duc/snap-settings.js +245 -0
- package/dist/flatbuffers/duc/stack-format-properties.d.ts +18 -0
- package/dist/flatbuffers/duc/stack-format-properties.js +57 -0
- package/dist/flatbuffers/duc/stack-format.d.ts +21 -0
- package/dist/flatbuffers/duc/stack-format.js +64 -0
- package/dist/flatbuffers/duc/stacked-text-align.d.ts +5 -0
- package/dist/flatbuffers/duc/stacked-text-align.js +8 -0
- package/dist/flatbuffers/duc/standard-overrides.d.ts +63 -0
- package/dist/flatbuffers/duc/standard-overrides.js +162 -0
- package/dist/flatbuffers/duc/standard-styles.d.ts +77 -0
- package/dist/flatbuffers/duc/standard-styles.js +285 -0
- package/dist/flatbuffers/duc/standard-units.d.ts +16 -0
- package/dist/flatbuffers/duc/standard-units.js +44 -0
- package/dist/flatbuffers/duc/standard-validation.d.ts +16 -0
- package/dist/flatbuffers/duc/standard-validation.js +44 -0
- package/dist/flatbuffers/duc/standard-view-settings.d.ts +35 -0
- package/dist/flatbuffers/duc/standard-view-settings.js +124 -0
- package/dist/flatbuffers/duc/standard.d.ts +33 -0
- package/dist/flatbuffers/duc/standard.js +90 -0
- package/dist/flatbuffers/duc/string-value-entry.d.ts +17 -0
- package/dist/flatbuffers/duc/string-value-entry.js +49 -0
- package/dist/flatbuffers/duc/stroke-cap.d.ts +5 -0
- package/dist/flatbuffers/duc/stroke-cap.js +8 -0
- package/dist/flatbuffers/duc/stroke-join.d.ts +5 -0
- package/dist/flatbuffers/duc/stroke-join.js +8 -0
- package/dist/flatbuffers/duc/stroke-placement.d.ts +5 -0
- package/dist/flatbuffers/duc/stroke-placement.js +8 -0
- package/dist/flatbuffers/duc/stroke-preference.d.ts +6 -0
- package/dist/flatbuffers/duc/stroke-preference.js +9 -0
- package/dist/flatbuffers/duc/stroke-side-preference.d.ts +8 -0
- package/dist/flatbuffers/duc/stroke-side-preference.js +11 -0
- package/dist/flatbuffers/duc/stroke-sides.d.ts +24 -0
- package/dist/flatbuffers/duc/stroke-sides.js +67 -0
- package/dist/flatbuffers/duc/stroke-style.d.ts +37 -0
- package/dist/flatbuffers/duc/stroke-style.js +111 -0
- package/dist/flatbuffers/duc/stroke-width.d.ts +5 -0
- package/dist/flatbuffers/duc/stroke-width.js +8 -0
- package/dist/flatbuffers/duc/table-cell-alignment.d.ts +11 -0
- package/dist/flatbuffers/duc/table-cell-alignment.js +14 -0
- package/dist/flatbuffers/duc/table-flow-direction.d.ts +4 -0
- package/dist/flatbuffers/duc/table-flow-direction.js +7 -0
- package/dist/flatbuffers/duc/text-align.d.ts +5 -0
- package/dist/flatbuffers/duc/text-align.js +8 -0
- package/dist/flatbuffers/duc/text-column.d.ts +15 -0
- package/dist/flatbuffers/duc/text-column.js +48 -0
- package/dist/flatbuffers/duc/text-field-source-property.d.ts +13 -0
- package/dist/flatbuffers/duc/text-field-source-property.js +16 -0
- package/dist/flatbuffers/duc/text-field-source-type.d.ts +4 -0
- package/dist/flatbuffers/duc/text-field-source-type.js +7 -0
- package/dist/flatbuffers/duc/text-flow-direction.d.ts +6 -0
- package/dist/flatbuffers/duc/text-flow-direction.js +9 -0
- package/dist/flatbuffers/duc/tiling-properties.d.ts +21 -0
- package/dist/flatbuffers/duc/tiling-properties.js +75 -0
- package/dist/flatbuffers/duc/tolerance-clause.d.ts +27 -0
- package/dist/flatbuffers/duc/tolerance-clause.js +84 -0
- package/dist/flatbuffers/duc/tolerance-display.d.ts +7 -0
- package/dist/flatbuffers/duc/tolerance-display.js +10 -0
- package/dist/flatbuffers/duc/tolerance-type.d.ts +5 -0
- package/dist/flatbuffers/duc/tolerance-type.js +8 -0
- package/dist/flatbuffers/duc/tolerance-zone-type.d.ts +7 -0
- package/dist/flatbuffers/duc/tolerance-zone-type.js +10 -0
- package/dist/flatbuffers/duc/tracking-line-style.d.ts +26 -0
- package/dist/flatbuffers/duc/tracking-line-style.js +74 -0
- package/dist/flatbuffers/duc/unit-precision.d.ts +19 -0
- package/dist/flatbuffers/duc/unit-precision.js +64 -0
- package/dist/flatbuffers/duc/unit-system-base.d.ts +20 -0
- package/dist/flatbuffers/duc/unit-system-base.js +65 -0
- package/dist/flatbuffers/duc/unit-system.d.ts +4 -0
- package/dist/flatbuffers/duc/unit-system.js +7 -0
- package/dist/flatbuffers/duc/version-base.d.ts +27 -0
- package/dist/flatbuffers/duc/version-base.js +80 -0
- package/dist/flatbuffers/duc/version-graph-metadata.d.ts +15 -0
- package/dist/flatbuffers/duc/version-graph-metadata.js +48 -0
- package/dist/flatbuffers/duc/version-graph.d.ts +31 -0
- package/dist/flatbuffers/duc/version-graph.js +94 -0
- package/dist/flatbuffers/duc/vertical-align.d.ts +5 -0
- package/dist/flatbuffers/duc/vertical-align.js +8 -0
- package/dist/flatbuffers/duc/viewport-shade-plot.d.ts +6 -0
- package/dist/flatbuffers/duc/viewport-shade-plot.js +9 -0
- package/dist/flatbuffers/duc/youtube-states.d.ts +8 -0
- package/dist/flatbuffers/duc/youtube-states.js +11 -0
- package/dist/flatbuffers/duc.d.ts +227 -0
- package/dist/flatbuffers/duc.js +229 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/legacy/index.d.ts +1 -0
- package/dist/legacy/index.js +1 -0
- package/dist/legacy/v1/duc/app-state.d.ts +124 -0
- package/dist/legacy/v1/duc/app-state.js +388 -0
- package/dist/legacy/v1/duc/binary-file-data.d.ts +27 -0
- package/dist/legacy/v1/duc/binary-file-data.js +90 -0
- package/dist/legacy/v1/duc/binary-files-entry.d.ts +16 -0
- package/dist/legacy/v1/duc/binary-files-entry.js +43 -0
- package/dist/legacy/v1/duc/binary-files.d.ts +17 -0
- package/dist/legacy/v1/duc/binary-files.js +55 -0
- package/dist/legacy/v1/duc/binding-point.d.ts +15 -0
- package/dist/legacy/v1/duc/binding-point.js +48 -0
- package/dist/legacy/v1/duc/bound-element.d.ts +17 -0
- package/dist/legacy/v1/duc/bound-element.js +48 -0
- package/dist/legacy/v1/duc/duc-block-attribute-details.d.ts +22 -0
- package/dist/legacy/v1/duc/duc-block-attribute-details.js +57 -0
- package/dist/legacy/v1/duc/duc-block-attribute.d.ts +16 -0
- package/dist/legacy/v1/duc/duc-block-attribute.js +43 -0
- package/dist/legacy/v1/duc/duc-block-instance-element-override.d.ts +17 -0
- package/dist/legacy/v1/duc/duc-block-instance-element-override.js +48 -0
- package/dist/legacy/v1/duc/duc-block.d.ts +34 -0
- package/dist/legacy/v1/duc/duc-block.js +110 -0
- package/dist/legacy/v1/duc/duc-element.d.ts +273 -0
- package/dist/legacy/v1/duc/duc-element.js +865 -0
- package/dist/legacy/v1/duc/duc-group.d.ts +40 -0
- package/dist/legacy/v1/duc/duc-group.js +114 -0
- package/dist/legacy/v1/duc/duc-line-reference.d.ts +15 -0
- package/dist/legacy/v1/duc/duc-line-reference.js +43 -0
- package/dist/legacy/v1/duc/duc-line.d.ts +15 -0
- package/dist/legacy/v1/duc/duc-line.js +43 -0
- package/dist/legacy/v1/duc/duc-path.d.ts +26 -0
- package/dist/legacy/v1/duc/duc-path.js +69 -0
- package/dist/legacy/v1/duc/duc-table-cell.d.ts +22 -0
- package/dist/legacy/v1/duc/duc-table-cell.js +57 -0
- package/dist/legacy/v1/duc/duc-table-column.d.ts +18 -0
- package/dist/legacy/v1/duc/duc-table-column.js +50 -0
- package/dist/legacy/v1/duc/duc-table-row.d.ts +18 -0
- package/dist/legacy/v1/duc/duc-table-row.js +50 -0
- package/dist/legacy/v1/duc/duc-table-style-props.d.ts +39 -0
- package/dist/legacy/v1/duc/duc-table-style-props.js +114 -0
- package/dist/legacy/v1/duc/duc-table-style.d.ts +14 -0
- package/dist/legacy/v1/duc/duc-table-style.js +41 -0
- package/dist/legacy/v1/duc/element-background.d.ts +14 -0
- package/dist/legacy/v1/duc/element-background.js +41 -0
- package/dist/legacy/v1/duc/element-content-base.d.ts +22 -0
- package/dist/legacy/v1/duc/element-content-base.js +64 -0
- package/dist/legacy/v1/duc/element-stroke.d.ts +23 -0
- package/dist/legacy/v1/duc/element-stroke.js +66 -0
- package/dist/legacy/v1/duc/exported-data-state.d.ts +51 -0
- package/dist/legacy/v1/duc/exported-data-state.js +155 -0
- package/dist/legacy/v1/duc/image-crop.d.ts +23 -0
- package/dist/legacy/v1/duc/image-crop.js +80 -0
- package/dist/legacy/v1/duc/linear-element-editor.d.ts +44 -0
- package/dist/legacy/v1/duc/linear-element-editor.js +119 -0
- package/dist/legacy/v1/duc/point-binding.d.ts +25 -0
- package/dist/legacy/v1/duc/point-binding.js +72 -0
- package/dist/legacy/v1/duc/point.d.ts +20 -0
- package/dist/legacy/v1/duc/point.js +63 -0
- package/dist/legacy/v1/duc/pointer-down-state.d.ts +32 -0
- package/dist/legacy/v1/duc/pointer-down-state.js +90 -0
- package/dist/legacy/v1/duc/renderer-state.d.ts +17 -0
- package/dist/legacy/v1/duc/renderer-state.js +54 -0
- package/dist/legacy/v1/duc/segment-midpoint-state.d.ts +18 -0
- package/dist/legacy/v1/duc/segment-midpoint-state.js +57 -0
- package/dist/legacy/v1/duc/simple-point.d.ts +15 -0
- package/dist/legacy/v1/duc/simple-point.js +48 -0
- package/dist/legacy/v1/duc/stroke-sides.d.ts +23 -0
- package/dist/legacy/v1/duc/stroke-sides.js +66 -0
- package/dist/legacy/v1/duc/stroke-style.d.ts +31 -0
- package/dist/legacy/v1/duc/stroke-style.js +102 -0
- package/dist/legacy/v1/duc/tiling-properties.d.ts +21 -0
- package/dist/legacy/v1/duc/tiling-properties.js +75 -0
- package/dist/legacy/v1/duc.d.ts +35 -0
- package/dist/legacy/v1/duc.js +37 -0
- package/dist/legacy/v1/index.d.ts +1 -0
- package/dist/legacy/v1/index.js +1 -0
- package/dist/legacy/v1/parse/index.d.ts +67 -0
- package/dist/legacy/v1/parse/index.js +101 -0
- package/dist/legacy/v1/parse/parseAppStateFromBinary.d.ts +3 -0
- package/dist/legacy/v1/parse/parseAppStateFromBinary.js +139 -0
- package/dist/legacy/v1/parse/parseBinaryFilesFromBinary.d.ts +4 -0
- package/dist/legacy/v1/parse/parseBinaryFilesFromBinary.js +32 -0
- package/dist/legacy/v1/parse/parseBlockFromBinary.d.ts +3 -0
- package/dist/legacy/v1/parse/parseBlockFromBinary.js +70 -0
- package/dist/legacy/v1/parse/parseElementFromBinary.d.ts +8 -0
- package/dist/legacy/v1/parse/parseElementFromBinary.js +387 -0
- package/dist/legacy/v1/parse/parseGroupFromBinary.d.ts +4 -0
- package/dist/legacy/v1/parse/parseGroupFromBinary.js +36 -0
- package/dist/legacy/v1/parse/parseRendererStateFromBinary.d.ts +4 -0
- package/dist/legacy/v1/parse/parseRendererStateFromBinary.js +15 -0
- package/dist/legacy/v1/serialize/index.d.ts +5 -0
- package/dist/legacy/v1/serialize/index.js +81 -0
- package/dist/legacy/v1/serialize/serializationUtils.d.ts +17 -0
- package/dist/legacy/v1/serialize/serializationUtils.js +27 -0
- package/dist/legacy/v1/serialize/serializeAppStateFromDuc.d.ts +4 -0
- package/dist/legacy/v1/serialize/serializeAppStateFromDuc.js +145 -0
- package/dist/legacy/v1/serialize/serializeBinaryFilesFromDuc.d.ts +4 -0
- package/dist/legacy/v1/serialize/serializeBinaryFilesFromDuc.js +46 -0
- package/dist/legacy/v1/serialize/serializeBlockFromDuc.d.ts +3 -0
- package/dist/legacy/v1/serialize/serializeBlockFromDuc.js +60 -0
- package/dist/legacy/v1/serialize/serializeElementFromDuc.d.ts +8 -0
- package/dist/legacy/v1/serialize/serializeElementFromDuc.js +435 -0
- package/dist/legacy/v1/serialize/serializeGroupFromDuc.d.ts +3 -0
- package/dist/legacy/v1/serialize/serializeGroupFromDuc.js +37 -0
- package/dist/legacy/v1/serialize/serializeRendererStateFromDuc.d.ts +4 -0
- package/dist/legacy/v1/serialize/serializeRendererStateFromDuc.js +7 -0
- package/dist/legacy/v1/types/elements/index.d.ts +480 -0
- package/dist/legacy/v1/types/elements/index.js +1 -0
- package/dist/legacy/v1/types/elements/typeChecks.d.ts +40 -0
- package/dist/legacy/v1/types/elements/typeChecks.js +179 -0
- package/dist/legacy/v1/types/geometryTypes.d.ts +78 -0
- package/dist/legacy/v1/types/geometryTypes.js +1 -0
- package/dist/legacy/v1/types/index.d.ts +496 -0
- package/dist/legacy/v1/types/index.js +1 -0
- package/dist/legacy/v1/types/utility-types.d.ts +31 -0
- package/dist/legacy/v1/types/utility-types.js +1 -0
- package/dist/legacy/v1/utils/bounds.d.ts +76 -0
- package/dist/legacy/v1/utils/bounds.js +415 -0
- package/dist/legacy/v1/utils/constants.d.ts +370 -0
- package/dist/legacy/v1/utils/constants.js +571 -0
- package/dist/legacy/v1/utils/elements/index.d.ts +26 -0
- package/dist/legacy/v1/utils/elements/index.js +108 -0
- package/dist/legacy/v1/utils/elements/linearElement.d.ts +133 -0
- package/dist/legacy/v1/utils/elements/linearElement.js +544 -0
- package/dist/legacy/v1/utils/elements/textElement.d.ts +89 -0
- package/dist/legacy/v1/utils/elements/textElement.js +563 -0
- package/dist/legacy/v1/utils/index.d.ts +26 -0
- package/dist/legacy/v1/utils/index.js +40 -0
- package/dist/legacy/v1/utils/math/algebra/ga.d.ts +63 -0
- package/dist/legacy/v1/utils/math/algebra/ga.js +268 -0
- package/dist/legacy/v1/utils/math/algebra/gadirections.d.ts +9 -0
- package/dist/legacy/v1/utils/math/algebra/gadirections.js +18 -0
- package/dist/legacy/v1/utils/math/algebra/galines.d.ts +23 -0
- package/dist/legacy/v1/utils/math/algebra/galines.js +32 -0
- package/dist/legacy/v1/utils/math/algebra/gapoints.d.ts +8 -0
- package/dist/legacy/v1/utils/math/algebra/gapoints.js +30 -0
- package/dist/legacy/v1/utils/math/algebra/gatransforms.d.ts +10 -0
- package/dist/legacy/v1/utils/math/algebra/gatransforms.js +23 -0
- package/dist/legacy/v1/utils/math/bbox.d.ts +10 -0
- package/dist/legacy/v1/utils/math/bbox.js +42 -0
- package/dist/legacy/v1/utils/math/geometry.d.ts +102 -0
- package/dist/legacy/v1/utils/math/geometry.js +790 -0
- package/dist/legacy/v1/utils/math/index.d.ts +309 -0
- package/dist/legacy/v1/utils/math/index.js +1140 -0
- package/dist/legacy/v1/utils/math/random.d.ts +4 -0
- package/dist/legacy/v1/utils/math/random.js +25 -0
- package/dist/legacy/v1/utils/measurements.d.ts +33 -0
- package/dist/legacy/v1/utils/measurements.js +65 -0
- package/dist/legacy/v1/utils/normalize.d.ts +14 -0
- package/dist/legacy/v1/utils/normalize.js +49 -0
- package/dist/legacy/v1/utils/restore.d.ts +197 -0
- package/dist/legacy/v1/utils/restore.js +1255 -0
- package/dist/legacy/v1/utils/scopes.d.ts +260 -0
- package/dist/legacy/v1/utils/scopes.js +661 -0
- package/dist/legacy/v1/utils/standards.d.ts +12 -0
- package/dist/legacy/v1/utils/standards.js +10 -0
- package/dist/legacy/v1/utils/state/index.d.ts +2 -0
- package/dist/legacy/v1/utils/state/index.js +68 -0
- package/dist/legacy/v1/utils/url.d.ts +8 -0
- package/dist/legacy/v1/utils/url.js +33 -0
- package/dist/parse.d.ts +54 -0
- package/dist/parse.js +1318 -0
- package/dist/restore/index.d.ts +3 -0
- package/dist/restore/index.js +3 -0
- package/dist/restore/restoreDataState.d.ts +191 -0
- package/dist/restore/restoreDataState.js +716 -0
- package/dist/restore/restoreElements.d.ts +34 -0
- package/dist/restore/restoreElements.js +1281 -0
- package/dist/restore/restoreStandards.d.ts +8 -0
- package/dist/restore/restoreStandards.js +224 -0
- package/dist/serialize.d.ts +3 -0
- package/dist/serialize.js +2465 -0
- package/dist/technical/index.d.ts +3 -0
- package/dist/technical/index.js +3 -0
- package/dist/technical/measurements.d.ts +31 -0
- package/dist/technical/measurements.js +64 -0
- package/dist/technical/scopes.d.ts +261 -0
- package/dist/technical/scopes.js +661 -0
- package/dist/technical/standards.d.ts +124 -0
- package/dist/technical/standards.js +10 -0
- package/dist/types/elements/index.d.ts +1356 -0
- package/dist/types/elements/index.js +1 -0
- package/dist/types/elements/typeChecks.d.ts +40 -0
- package/dist/types/elements/typeChecks.js +188 -0
- package/dist/types/geometryTypes.d.ts +90 -0
- package/dist/types/geometryTypes.js +1 -0
- package/dist/types/index.d.ts +591 -0
- package/dist/types/index.js +3 -0
- package/dist/types/utility-types.d.ts +31 -0
- package/dist/types/utility-types.js +1 -0
- package/dist/utils/bounds.d.ts +75 -0
- package/dist/utils/bounds.js +414 -0
- package/dist/utils/constants.d.ts +288 -0
- package/dist/utils/constants.js +529 -0
- package/dist/utils/elements/frameElement.d.ts +4 -0
- package/dist/utils/elements/frameElement.js +16 -0
- package/dist/utils/elements/freedrawElement.d.ts +2 -0
- package/dist/utils/elements/freedrawElement.js +46 -0
- package/dist/utils/elements/index.d.ts +51 -0
- package/dist/utils/elements/index.js +215 -0
- package/dist/utils/elements/linearElement.d.ts +53 -0
- package/dist/utils/elements/linearElement.js +539 -0
- package/dist/utils/elements/newElement.d.ts +72 -0
- package/dist/utils/elements/newElement.js +268 -0
- package/dist/utils/elements/textElement.d.ts +89 -0
- package/dist/utils/elements/textElement.js +565 -0
- package/dist/utils/elements/viewportElement.d.ts +6 -0
- package/dist/utils/elements/viewportElement.js +9 -0
- package/dist/utils/filebyte.d.ts +39 -0
- package/dist/utils/filebyte.js +117 -0
- package/dist/utils/functionCodec.d.ts +5 -0
- package/dist/utils/functionCodec.js +86 -0
- package/dist/utils/index.d.ts +32 -0
- package/dist/utils/index.js +53 -0
- package/dist/utils/math/algebra/ga.d.ts +63 -0
- package/dist/utils/math/algebra/ga.js +268 -0
- package/dist/utils/math/algebra/gadirections.d.ts +9 -0
- package/dist/utils/math/algebra/gadirections.js +18 -0
- package/dist/utils/math/algebra/galines.d.ts +23 -0
- package/dist/utils/math/algebra/galines.js +32 -0
- package/dist/utils/math/algebra/gapoints.d.ts +8 -0
- package/dist/utils/math/algebra/gapoints.js +30 -0
- package/dist/utils/math/algebra/gatransforms.d.ts +10 -0
- package/dist/utils/math/algebra/gatransforms.js +23 -0
- package/dist/utils/math/algebra/index.d.ts +5 -0
- package/dist/utils/math/algebra/index.js +5 -0
- package/dist/utils/math/bbox.d.ts +10 -0
- package/dist/utils/math/bbox.js +42 -0
- package/dist/utils/math/geometry.d.ts +102 -0
- package/dist/utils/math/geometry.js +790 -0
- package/dist/utils/math/index.d.ts +323 -0
- package/dist/utils/math/index.js +1188 -0
- package/dist/utils/math/random.d.ts +4 -0
- package/dist/utils/math/random.js +25 -0
- package/dist/utils/normalize.d.ts +14 -0
- package/dist/utils/normalize.js +49 -0
- package/dist/utils/shape.d.ts +15 -0
- package/dist/utils/shape.js +254 -0
- package/dist/utils/state/grid.d.ts +7 -0
- package/dist/utils/state/grid.js +25 -0
- package/dist/utils/state/index.d.ts +9 -0
- package/dist/utils/state/index.js +131 -0
- package/dist/utils/url.d.ts +8 -0
- package/dist/utils/url.js +33 -0
- package/dist/utils/version.d.ts +1 -0
- package/dist/utils/version.js +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,2465 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/* eslint-disable @typescript-eslint/consistent-type-definitions */
|
|
11
|
+
/* IMPORTANT:
|
|
12
|
+
- Single-file serializer for DUC FlatBuffers schema.
|
|
13
|
+
- No enum remapping tables: use enums directly from ducjs/flatbuffers/duc.
|
|
14
|
+
- No defaults added: only write what's present in TS objects.
|
|
15
|
+
- PrecisionValue, Radian, Percentage, ScaleFactor, etc. are branded numbers:
|
|
16
|
+
cast to number at the final write site (e.g. pv.value).
|
|
17
|
+
- Keep args strongly typed. Never use any for function args.
|
|
18
|
+
*/
|
|
19
|
+
import * as Duc from "ducjs/flatbuffers/duc";
|
|
20
|
+
import * as flatbuffers from "flatbuffers";
|
|
21
|
+
import { restore } from "ducjs/restore";
|
|
22
|
+
import { encodeFunctionString, EXPORT_DATA_TYPES } from "ducjs/utils";
|
|
23
|
+
/**
|
|
24
|
+
* Basic helpers
|
|
25
|
+
*/
|
|
26
|
+
const str = (b, v) => v == null ? undefined : b.createString(v);
|
|
27
|
+
function writeString(builder, str) {
|
|
28
|
+
if (str === null || str === undefined)
|
|
29
|
+
return undefined;
|
|
30
|
+
return builder.createString(str);
|
|
31
|
+
}
|
|
32
|
+
function getPrecisionValue(value, useScopedValues) {
|
|
33
|
+
return useScopedValues ? value.scoped : value.value;
|
|
34
|
+
}
|
|
35
|
+
function writeStringVector(builder, items) {
|
|
36
|
+
if (!items || items.length === 0)
|
|
37
|
+
return undefined;
|
|
38
|
+
const arr = Array.isArray(items) ? items.slice() : Array.from(items);
|
|
39
|
+
const offsets = arr.map(item => (item ? builder.createString(item) : 0)).filter((offset) => offset !== 0);
|
|
40
|
+
if (offsets.length === 0)
|
|
41
|
+
return undefined;
|
|
42
|
+
// This helper is used for multiple vector fields; return a builder vector; caller decides which create*Vector to use.
|
|
43
|
+
// For current callers that expect createGroupIdsVector specifically, fallback to generic createVector via builder.start/endVector
|
|
44
|
+
builder.startVector(4, offsets.length, 4);
|
|
45
|
+
for (let i = offsets.length - 1; i >= 0; i--) {
|
|
46
|
+
builder.addOffset(offsets[i]);
|
|
47
|
+
}
|
|
48
|
+
return builder.endVector();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Element style/content serializers
|
|
52
|
+
*/
|
|
53
|
+
function writeTiling(b, t, usv) {
|
|
54
|
+
if (!t)
|
|
55
|
+
return undefined;
|
|
56
|
+
Duc.TilingProperties.startTilingProperties(b);
|
|
57
|
+
Duc.TilingProperties.addSizeInPercent(b, t.sizeInPercent);
|
|
58
|
+
Duc.TilingProperties.addAngle(b, t.angle);
|
|
59
|
+
if (t.spacing !== undefined)
|
|
60
|
+
Duc.TilingProperties.addSpacing(b, t.spacing);
|
|
61
|
+
if (t.offsetX !== undefined)
|
|
62
|
+
Duc.TilingProperties.addOffsetX(b, t.offsetX);
|
|
63
|
+
if (t.offsetY !== undefined)
|
|
64
|
+
Duc.TilingProperties.addOffsetY(b, t.offsetY);
|
|
65
|
+
return Duc.TilingProperties.endTilingProperties(b);
|
|
66
|
+
}
|
|
67
|
+
function writeHatchPatternLine(b, l, usv) {
|
|
68
|
+
const origin = writeDucPoint(b, l.origin, usv);
|
|
69
|
+
const offsetVec = Duc.HatchPatternLine.createOffsetVector(b, [getPrecisionValue(l.offset[0], usv), getPrecisionValue(l.offset[1], usv)]);
|
|
70
|
+
const dashVec = Duc.HatchPatternLine.createDashPatternVector(b, l.dashPattern.map(Number));
|
|
71
|
+
Duc.HatchPatternLine.startHatchPatternLine(b);
|
|
72
|
+
Duc.HatchPatternLine.addAngle(b, l.angle);
|
|
73
|
+
if (origin)
|
|
74
|
+
Duc.HatchPatternLine.addOrigin(b, origin);
|
|
75
|
+
Duc.HatchPatternLine.addOffset(b, offsetVec);
|
|
76
|
+
if (dashVec)
|
|
77
|
+
Duc.HatchPatternLine.addDashPattern(b, dashVec);
|
|
78
|
+
return Duc.HatchPatternLine.endHatchPatternLine(b);
|
|
79
|
+
}
|
|
80
|
+
function writeCustomHatch(b, p, usv) {
|
|
81
|
+
if (!p)
|
|
82
|
+
return undefined;
|
|
83
|
+
const name = str(b, p.name);
|
|
84
|
+
const desc = str(b, p.description);
|
|
85
|
+
const lines = Duc.CustomHatchPattern.createLinesVector(b, p.lines.map((ln) => writeHatchPatternLine(b, ln, usv)));
|
|
86
|
+
Duc.CustomHatchPattern.startCustomHatchPattern(b);
|
|
87
|
+
if (name)
|
|
88
|
+
Duc.CustomHatchPattern.addName(b, name);
|
|
89
|
+
if (desc)
|
|
90
|
+
Duc.CustomHatchPattern.addDescription(b, desc);
|
|
91
|
+
Duc.CustomHatchPattern.addLines(b, lines);
|
|
92
|
+
return Duc.CustomHatchPattern.endCustomHatchPattern(b);
|
|
93
|
+
}
|
|
94
|
+
function writeHatchStyle(b, h, usv) {
|
|
95
|
+
if (!h)
|
|
96
|
+
return undefined;
|
|
97
|
+
const pattName = str(b, h.pattern.name);
|
|
98
|
+
const pattOrigin = writeDucPoint(b, h.pattern.origin, usv);
|
|
99
|
+
const custom = writeCustomHatch(b, h.customPattern, usv);
|
|
100
|
+
Duc.DucHatchStyle.startDucHatchStyle(b);
|
|
101
|
+
if (h.hatchStyle !== undefined)
|
|
102
|
+
Duc.DucHatchStyle.addHatchStyle(b, h.hatchStyle);
|
|
103
|
+
if (pattName)
|
|
104
|
+
Duc.DucHatchStyle.addPatternName(b, pattName);
|
|
105
|
+
Duc.DucHatchStyle.addPatternScale(b, h.pattern.scale);
|
|
106
|
+
Duc.DucHatchStyle.addPatternAngle(b, h.pattern.angle);
|
|
107
|
+
if (pattOrigin)
|
|
108
|
+
Duc.DucHatchStyle.addPatternOrigin(b, pattOrigin);
|
|
109
|
+
Duc.DucHatchStyle.addPatternDouble(b, h.pattern.double);
|
|
110
|
+
if (custom)
|
|
111
|
+
Duc.DucHatchStyle.addCustomPattern(b, custom);
|
|
112
|
+
return Duc.DucHatchStyle.endDucHatchStyle(b);
|
|
113
|
+
}
|
|
114
|
+
function writeImageFilter(b, f, usv) {
|
|
115
|
+
if (!f)
|
|
116
|
+
return undefined;
|
|
117
|
+
Duc.DucImageFilter.startDucImageFilter(b);
|
|
118
|
+
Duc.DucImageFilter.addBrightness(b, f.brightness);
|
|
119
|
+
Duc.DucImageFilter.addContrast(b, f.contrast);
|
|
120
|
+
return Duc.DucImageFilter.endDucImageFilter(b);
|
|
121
|
+
}
|
|
122
|
+
function writeContentBase(b, c, usv) {
|
|
123
|
+
if (!c)
|
|
124
|
+
return undefined;
|
|
125
|
+
const s = str(b, c.src);
|
|
126
|
+
const til = writeTiling(b, c.tiling, usv);
|
|
127
|
+
const hatch = writeHatchStyle(b, c.hatch, usv);
|
|
128
|
+
const filt = writeImageFilter(b, c.imageFilter, usv);
|
|
129
|
+
Duc.ElementContentBase.startElementContentBase(b);
|
|
130
|
+
if (c.preference !== undefined)
|
|
131
|
+
Duc.ElementContentBase.addPreference(b, c.preference);
|
|
132
|
+
if (s)
|
|
133
|
+
Duc.ElementContentBase.addSrc(b, s);
|
|
134
|
+
Duc.ElementContentBase.addVisible(b, c.visible);
|
|
135
|
+
Duc.ElementContentBase.addOpacity(b, c.opacity);
|
|
136
|
+
if (til)
|
|
137
|
+
Duc.ElementContentBase.addTiling(b, til);
|
|
138
|
+
if (hatch)
|
|
139
|
+
Duc.ElementContentBase.addHatch(b, hatch);
|
|
140
|
+
if (filt)
|
|
141
|
+
Duc.ElementContentBase.addImageFilter(b, filt);
|
|
142
|
+
return Duc.ElementContentBase.endElementContentBase(b);
|
|
143
|
+
}
|
|
144
|
+
function writeStrokeStyle(b, s, usv) {
|
|
145
|
+
var _a;
|
|
146
|
+
if (!s)
|
|
147
|
+
return undefined;
|
|
148
|
+
const dashVec = ((_a = s.dash) === null || _a === void 0 ? void 0 : _a.length) ? Duc.StrokeStyle.createDashVector(b, s.dash) : undefined;
|
|
149
|
+
const dashLineOverride = str(b, s.dashLineOverride);
|
|
150
|
+
Duc.StrokeStyle.startStrokeStyle(b);
|
|
151
|
+
if (s.preference !== undefined)
|
|
152
|
+
Duc.StrokeStyle.addPreference(b, s.preference);
|
|
153
|
+
if (s.cap != null)
|
|
154
|
+
Duc.StrokeStyle.addCap(b, s.cap);
|
|
155
|
+
if (s.join != null)
|
|
156
|
+
Duc.StrokeStyle.addJoin(b, s.join);
|
|
157
|
+
if (dashVec)
|
|
158
|
+
Duc.StrokeStyle.addDash(b, dashVec);
|
|
159
|
+
if (dashLineOverride)
|
|
160
|
+
Duc.StrokeStyle.addDashLineOverride(b, dashLineOverride);
|
|
161
|
+
if (s.dashCap != null)
|
|
162
|
+
Duc.StrokeStyle.addDashCap(b, s.dashCap);
|
|
163
|
+
if (s.miterLimit !== undefined)
|
|
164
|
+
Duc.StrokeStyle.addMiterLimit(b, s.miterLimit);
|
|
165
|
+
return Duc.StrokeStyle.endStrokeStyle(b);
|
|
166
|
+
}
|
|
167
|
+
function writeStrokeSides(b, ss, usv) {
|
|
168
|
+
var _a;
|
|
169
|
+
if (!ss)
|
|
170
|
+
return undefined;
|
|
171
|
+
const valuesVec = ((_a = ss.values) === null || _a === void 0 ? void 0 : _a.length) ? Duc.StrokeSides.createValuesVector(b, ss.values) : undefined;
|
|
172
|
+
Duc.StrokeSides.startStrokeSides(b);
|
|
173
|
+
if (ss.preference !== undefined)
|
|
174
|
+
Duc.StrokeSides.addPreference(b, ss.preference);
|
|
175
|
+
if (valuesVec)
|
|
176
|
+
Duc.StrokeSides.addValues(b, valuesVec);
|
|
177
|
+
return Duc.StrokeSides.endStrokeSides(b);
|
|
178
|
+
}
|
|
179
|
+
function writeElementStroke(b, s, usv) {
|
|
180
|
+
if (!s)
|
|
181
|
+
return undefined;
|
|
182
|
+
const c = writeContentBase(b, s.content, usv);
|
|
183
|
+
const st = writeStrokeStyle(b, s.style, usv);
|
|
184
|
+
const sides = writeStrokeSides(b, s.strokeSides, usv);
|
|
185
|
+
Duc.ElementStroke.startElementStroke(b);
|
|
186
|
+
if (c)
|
|
187
|
+
Duc.ElementStroke.addContent(b, c);
|
|
188
|
+
if (s.width) {
|
|
189
|
+
Duc.ElementStroke.addWidth(b, getPrecisionValue(s.width, usv));
|
|
190
|
+
}
|
|
191
|
+
if (st)
|
|
192
|
+
Duc.ElementStroke.addStyle(b, st);
|
|
193
|
+
if (s.placement)
|
|
194
|
+
Duc.ElementStroke.addPlacement(b, s.placement);
|
|
195
|
+
if (sides)
|
|
196
|
+
Duc.ElementStroke.addStrokeSides(b, sides);
|
|
197
|
+
return Duc.ElementStroke.endElementStroke(b);
|
|
198
|
+
}
|
|
199
|
+
function writeElementBackground(b, bg, usv) {
|
|
200
|
+
if (!bg)
|
|
201
|
+
return undefined;
|
|
202
|
+
const c = writeContentBase(b, bg.content, usv);
|
|
203
|
+
Duc.ElementBackground.startElementBackground(b);
|
|
204
|
+
if (c)
|
|
205
|
+
Duc.ElementBackground.addContent(b, c);
|
|
206
|
+
return Duc.ElementBackground.endElementBackground(b);
|
|
207
|
+
}
|
|
208
|
+
function writeStylesBase(b, s, usv) {
|
|
209
|
+
if (!s)
|
|
210
|
+
return null;
|
|
211
|
+
const bgArrRaw = s.background;
|
|
212
|
+
const stArrRaw = s.stroke;
|
|
213
|
+
if (bgArrRaw === undefined || stArrRaw === undefined) {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
const bgArr = Array.isArray(bgArrRaw)
|
|
217
|
+
? bgArrRaw
|
|
218
|
+
: (bgArrRaw ? [bgArrRaw] : []);
|
|
219
|
+
const stArr = Array.isArray(stArrRaw)
|
|
220
|
+
? stArrRaw
|
|
221
|
+
: (stArrRaw ? [stArrRaw] : []);
|
|
222
|
+
const bgOffsets = bgArr
|
|
223
|
+
.map((x) => (x ? writeElementBackground(b, x, usv) : undefined))
|
|
224
|
+
.filter((o) => o !== undefined);
|
|
225
|
+
const stOffsets = stArr
|
|
226
|
+
.map((x) => (x ? writeElementStroke(b, x, usv) : undefined))
|
|
227
|
+
.filter((o) => o !== undefined);
|
|
228
|
+
const bgs = Duc._DucElementStylesBase.createBackgroundVector(b, bgOffsets);
|
|
229
|
+
const strokes = Duc._DucElementStylesBase.createStrokeVector(b, stOffsets);
|
|
230
|
+
Duc._DucElementStylesBase.start_DucElementStylesBase(b);
|
|
231
|
+
if (s.roundness) {
|
|
232
|
+
Duc._DucElementStylesBase.addRoundness(b, getPrecisionValue(s.roundness, usv));
|
|
233
|
+
}
|
|
234
|
+
if (s.blending)
|
|
235
|
+
Duc._DucElementStylesBase.addBlending(b, s.blending);
|
|
236
|
+
Duc._DucElementStylesBase.addBackground(b, bgs);
|
|
237
|
+
Duc._DucElementStylesBase.addStroke(b, strokes);
|
|
238
|
+
if (s.opacity) {
|
|
239
|
+
Duc._DucElementStylesBase.addOpacity(b, s.opacity);
|
|
240
|
+
}
|
|
241
|
+
return Duc._DucElementStylesBase.end_DucElementStylesBase(b);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Generic helpers
|
|
245
|
+
*/
|
|
246
|
+
function writeStringEntry(b, k, v) {
|
|
247
|
+
const ko = b.createString(k);
|
|
248
|
+
const vo = b.createString(v);
|
|
249
|
+
Duc.StringValueEntry.startStringValueEntry(b);
|
|
250
|
+
Duc.StringValueEntry.addKey(b, ko);
|
|
251
|
+
Duc.StringValueEntry.addValue(b, vo);
|
|
252
|
+
return Duc.StringValueEntry.endStringValueEntry(b);
|
|
253
|
+
}
|
|
254
|
+
function writeIdentifier(b, id) {
|
|
255
|
+
var _a;
|
|
256
|
+
const io = b.createString(id.id);
|
|
257
|
+
const no = b.createString(id.name);
|
|
258
|
+
const doff = b.createString((_a = id.description) !== null && _a !== void 0 ? _a : "");
|
|
259
|
+
Duc.Identifier.startIdentifier(b);
|
|
260
|
+
Duc.Identifier.addId(b, io);
|
|
261
|
+
Duc.Identifier.addName(b, no);
|
|
262
|
+
Duc.Identifier.addDescription(b, doff);
|
|
263
|
+
return Duc.Identifier.endIdentifier(b);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Geometry and bindings
|
|
267
|
+
*/
|
|
268
|
+
function writeDucPoint(b, p, usv) {
|
|
269
|
+
if (!p)
|
|
270
|
+
return undefined;
|
|
271
|
+
Duc.DucPoint.startDucPoint(b);
|
|
272
|
+
Duc.DucPoint.addX(b, getPrecisionValue(p.x, usv));
|
|
273
|
+
Duc.DucPoint.addY(b, getPrecisionValue(p.y, usv));
|
|
274
|
+
if (p.mirroring != null)
|
|
275
|
+
Duc.DucPoint.addMirroring(b, p.mirroring);
|
|
276
|
+
return Duc.DucPoint.endDucPoint(b);
|
|
277
|
+
}
|
|
278
|
+
function writeGeomPoint(b, p, usv) {
|
|
279
|
+
if (!p)
|
|
280
|
+
return undefined;
|
|
281
|
+
return Duc.GeometricPoint.createGeometricPoint(b, p.x, p.y);
|
|
282
|
+
}
|
|
283
|
+
function writeHead(b, h, usv) {
|
|
284
|
+
if (!h)
|
|
285
|
+
return undefined;
|
|
286
|
+
const blockId = str(b, h.blockId);
|
|
287
|
+
Duc.DucHead.startDucHead(b);
|
|
288
|
+
Duc.DucHead.addType(b, h.type);
|
|
289
|
+
if (blockId)
|
|
290
|
+
Duc.DucHead.addBlockId(b, blockId);
|
|
291
|
+
Duc.DucHead.addSize(b, getPrecisionValue(h.size, usv));
|
|
292
|
+
return Duc.DucHead.endDucHead(b);
|
|
293
|
+
}
|
|
294
|
+
function writeBindingPoint(b, p, usv) {
|
|
295
|
+
if (!p)
|
|
296
|
+
return undefined;
|
|
297
|
+
Duc.PointBindingPoint.startPointBindingPoint(b);
|
|
298
|
+
Duc.PointBindingPoint.addIndex(b, p.index);
|
|
299
|
+
Duc.PointBindingPoint.addOffset(b, p.offset);
|
|
300
|
+
return Duc.PointBindingPoint.endPointBindingPoint(b);
|
|
301
|
+
}
|
|
302
|
+
function writePointBinding(b, pb, usv) {
|
|
303
|
+
if (!pb)
|
|
304
|
+
return undefined;
|
|
305
|
+
const el = str(b, pb.elementId);
|
|
306
|
+
const fixed = pb.fixedPoint ? writeGeomPoint(b, pb.fixedPoint, usv) : undefined;
|
|
307
|
+
const point = writeBindingPoint(b, pb.point, usv);
|
|
308
|
+
const head = writeHead(b, pb.head, usv);
|
|
309
|
+
Duc.DucPointBinding.startDucPointBinding(b);
|
|
310
|
+
if (el)
|
|
311
|
+
Duc.DucPointBinding.addElementId(b, el);
|
|
312
|
+
Duc.DucPointBinding.addFocus(b, pb.focus);
|
|
313
|
+
Duc.DucPointBinding.addGap(b, getPrecisionValue(pb.gap, usv));
|
|
314
|
+
if (fixed)
|
|
315
|
+
Duc.DucPointBinding.addFixedPoint(b, fixed);
|
|
316
|
+
if (point)
|
|
317
|
+
Duc.DucPointBinding.addPoint(b, point);
|
|
318
|
+
if (head)
|
|
319
|
+
Duc.DucPointBinding.addHead(b, head);
|
|
320
|
+
return Duc.DucPointBinding.endDucPointBinding(b);
|
|
321
|
+
}
|
|
322
|
+
function writeLineRef(b, r, usv) {
|
|
323
|
+
Duc.DucLineReference.startDucLineReference(b);
|
|
324
|
+
Duc.DucLineReference.addIndex(b, r.index);
|
|
325
|
+
if (r.handle) {
|
|
326
|
+
const hx = getPrecisionValue(r.handle.x, usv);
|
|
327
|
+
const hy = getPrecisionValue(r.handle.y, usv);
|
|
328
|
+
const gp = Duc.GeometricPoint.createGeometricPoint(b, hx, hy);
|
|
329
|
+
Duc.DucLineReference.addHandle(b, gp);
|
|
330
|
+
}
|
|
331
|
+
return Duc.DucLineReference.endDucLineReference(b);
|
|
332
|
+
}
|
|
333
|
+
function writeLine(b, l, usv) {
|
|
334
|
+
const s = writeLineRef(b, l[0], usv);
|
|
335
|
+
const e = writeLineRef(b, l[1], usv);
|
|
336
|
+
Duc.DucLine.startDucLine(b);
|
|
337
|
+
Duc.DucLine.addStart(b, s);
|
|
338
|
+
Duc.DucLine.addEnd(b, e);
|
|
339
|
+
return Duc.DucLine.endDucLine(b);
|
|
340
|
+
}
|
|
341
|
+
function writePath(b, p, usv) {
|
|
342
|
+
const lineIndices = Duc.DucPath.createLineIndicesVector(b, p.lineIndices.map((x) => x));
|
|
343
|
+
const bg = p.background ? writeElementBackground(b, p.background, usv) : undefined;
|
|
344
|
+
const st = p.stroke ? writeElementStroke(b, p.stroke, usv) : undefined;
|
|
345
|
+
Duc.DucPath.startDucPath(b);
|
|
346
|
+
Duc.DucPath.addLineIndices(b, lineIndices);
|
|
347
|
+
if (bg)
|
|
348
|
+
Duc.DucPath.addBackground(b, bg);
|
|
349
|
+
if (st)
|
|
350
|
+
Duc.DucPath.addStroke(b, st);
|
|
351
|
+
return Duc.DucPath.endDucPath(b);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* DucElement bases
|
|
355
|
+
*/
|
|
356
|
+
function writeBoundElement(b, be, usv) {
|
|
357
|
+
const id = str(b, be.id);
|
|
358
|
+
const type = str(b, be.type);
|
|
359
|
+
Duc.BoundElement.startBoundElement(b);
|
|
360
|
+
Duc.BoundElement.addId(b, id);
|
|
361
|
+
Duc.BoundElement.addType(b, type);
|
|
362
|
+
return Duc.BoundElement.endBoundElement(b);
|
|
363
|
+
}
|
|
364
|
+
function writeElementBase(b, e, usv) {
|
|
365
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
366
|
+
const id = str(b, e.id);
|
|
367
|
+
const styles = writeStylesBase(b, e, usv);
|
|
368
|
+
const scope = str(b, e.scope);
|
|
369
|
+
const label = str(b, (_a = e.label) !== null && _a !== void 0 ? _a : undefined);
|
|
370
|
+
const desc = str(b, (_b = e.description) !== null && _b !== void 0 ? _b : undefined);
|
|
371
|
+
const index = str(b, (_c = e.index) !== null && _c !== void 0 ? _c : undefined);
|
|
372
|
+
const groupIds = ((_d = e.groupIds) === null || _d === void 0 ? void 0 : _d.length) ? Duc._DucElementBase.createGroupIdsVector(b, e.groupIds.map((g) => b.createString(g))) : undefined;
|
|
373
|
+
const regionIds = ((_e = e.regionIds) === null || _e === void 0 ? void 0 : _e.length) ? Duc._DucElementBase.createRegionIdsVector(b, e.regionIds.map((r) => b.createString(r))) : undefined;
|
|
374
|
+
const layerId = str(b, (_f = e.layerId) !== null && _f !== void 0 ? _f : undefined);
|
|
375
|
+
const frameId = str(b, (_g = e.frameId) !== null && _g !== void 0 ? _g : undefined);
|
|
376
|
+
const bound = ((_h = e.boundElements) === null || _h === void 0 ? void 0 : _h.length) ? Duc._DucElementBase.createBoundElementsVector(b, e.boundElements.map((x) => writeBoundElement(b, x, usv))) : undefined;
|
|
377
|
+
const link = str(b, (_j = e.link) !== null && _j !== void 0 ? _j : undefined);
|
|
378
|
+
const custom = e.customData != null ? str(b, JSON.stringify(e.customData)) : undefined;
|
|
379
|
+
Duc._DucElementBase.start_DucElementBase(b);
|
|
380
|
+
if (id)
|
|
381
|
+
Duc._DucElementBase.addId(b, id);
|
|
382
|
+
if (styles)
|
|
383
|
+
Duc._DucElementBase.addStyles(b, styles);
|
|
384
|
+
Duc._DucElementBase.addX(b, getPrecisionValue(e.x, usv));
|
|
385
|
+
Duc._DucElementBase.addY(b, getPrecisionValue(e.y, usv));
|
|
386
|
+
Duc._DucElementBase.addWidth(b, getPrecisionValue(e.width, usv));
|
|
387
|
+
Duc._DucElementBase.addHeight(b, getPrecisionValue(e.height, usv));
|
|
388
|
+
Duc._DucElementBase.addAngle(b, e.angle);
|
|
389
|
+
if (scope)
|
|
390
|
+
Duc._DucElementBase.addScope(b, scope);
|
|
391
|
+
if (label)
|
|
392
|
+
Duc._DucElementBase.addLabel(b, label);
|
|
393
|
+
if (desc)
|
|
394
|
+
Duc._DucElementBase.addDescription(b, desc);
|
|
395
|
+
Duc._DucElementBase.addIsVisible(b, e.isVisible);
|
|
396
|
+
Duc._DucElementBase.addSeed(b, e.seed);
|
|
397
|
+
Duc._DucElementBase.addVersion(b, e.version);
|
|
398
|
+
Duc._DucElementBase.addVersionNonce(b, e.versionNonce);
|
|
399
|
+
Duc._DucElementBase.addUpdated(b, BigInt(e.updated));
|
|
400
|
+
if (index)
|
|
401
|
+
Duc._DucElementBase.addIndex(b, index);
|
|
402
|
+
Duc._DucElementBase.addIsPlot(b, e.isPlot);
|
|
403
|
+
Duc._DucElementBase.addIsAnnotative(b, e.isAnnotative);
|
|
404
|
+
Duc._DucElementBase.addIsDeleted(b, e.isDeleted);
|
|
405
|
+
if (groupIds)
|
|
406
|
+
Duc._DucElementBase.addGroupIds(b, groupIds);
|
|
407
|
+
if (regionIds)
|
|
408
|
+
Duc._DucElementBase.addRegionIds(b, regionIds);
|
|
409
|
+
if (layerId)
|
|
410
|
+
Duc._DucElementBase.addLayerId(b, layerId);
|
|
411
|
+
if (frameId)
|
|
412
|
+
Duc._DucElementBase.addFrameId(b, frameId);
|
|
413
|
+
if (bound)
|
|
414
|
+
Duc._DucElementBase.addBoundElements(b, bound);
|
|
415
|
+
Duc._DucElementBase.addZIndex(b, e.zIndex);
|
|
416
|
+
if (link)
|
|
417
|
+
Duc._DucElementBase.addLink(b, link);
|
|
418
|
+
Duc._DucElementBase.addLocked(b, e.locked);
|
|
419
|
+
if (custom)
|
|
420
|
+
Duc._DucElementBase.addCustomData(b, custom);
|
|
421
|
+
return Duc._DucElementBase.end_DucElementBase(b);
|
|
422
|
+
}
|
|
423
|
+
function writeLinearBase(b, e, usv) {
|
|
424
|
+
var _a, _b, _c;
|
|
425
|
+
const base = writeElementBase(b, e, usv);
|
|
426
|
+
// Type-safe guards without using any: default to empty arrays if undefined
|
|
427
|
+
const pointsArr = (_a = e.points) !== null && _a !== void 0 ? _a : [];
|
|
428
|
+
const linesArr = (_b = e.lines) !== null && _b !== void 0 ? _b : [];
|
|
429
|
+
const pathOverridesArr = (_c = e.pathOverrides) !== null && _c !== void 0 ? _c : [];
|
|
430
|
+
const points = Duc._DucLinearElementBase.createPointsVector(b, pointsArr.map((p) => writeDucPoint(b, p, usv)).filter((v) => v !== undefined));
|
|
431
|
+
const lines = Duc._DucLinearElementBase.createLinesVector(b, linesArr.map((ln) => writeLine(b, ln, usv)));
|
|
432
|
+
const pathOverrides = pathOverridesArr.length
|
|
433
|
+
? Duc._DucLinearElementBase.createPathOverridesVector(b, pathOverridesArr.map((p) => writePath(b, p, usv)))
|
|
434
|
+
: undefined;
|
|
435
|
+
const lastCommitted = writeDucPoint(b, e.lastCommittedPoint, usv);
|
|
436
|
+
const startBinding = writePointBinding(b, e.startBinding, usv);
|
|
437
|
+
const endBinding = writePointBinding(b, e.endBinding, usv);
|
|
438
|
+
Duc._DucLinearElementBase.start_DucLinearElementBase(b);
|
|
439
|
+
Duc._DucLinearElementBase.addBase(b, base);
|
|
440
|
+
Duc._DucLinearElementBase.addPoints(b, points);
|
|
441
|
+
Duc._DucLinearElementBase.addLines(b, lines);
|
|
442
|
+
if (pathOverrides)
|
|
443
|
+
Duc._DucLinearElementBase.addPathOverrides(b, pathOverrides);
|
|
444
|
+
if (lastCommitted)
|
|
445
|
+
Duc._DucLinearElementBase.addLastCommittedPoint(b, lastCommitted);
|
|
446
|
+
if (startBinding)
|
|
447
|
+
Duc._DucLinearElementBase.addStartBinding(b, startBinding);
|
|
448
|
+
if (endBinding)
|
|
449
|
+
Duc._DucLinearElementBase.addEndBinding(b, endBinding);
|
|
450
|
+
return Duc._DucLinearElementBase.end_DucLinearElementBase(b);
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Elements
|
|
454
|
+
*/
|
|
455
|
+
function writeRect(b, e, usv) {
|
|
456
|
+
const base = writeElementBase(b, e, usv);
|
|
457
|
+
Duc.DucRectangleElement.startDucRectangleElement(b);
|
|
458
|
+
Duc.DucRectangleElement.addBase(b, base);
|
|
459
|
+
return Duc.DucRectangleElement.endDucRectangleElement(b);
|
|
460
|
+
}
|
|
461
|
+
function writePolygon(b, e, usv) {
|
|
462
|
+
const base = writeElementBase(b, e, usv);
|
|
463
|
+
Duc.DucPolygonElement.startDucPolygonElement(b);
|
|
464
|
+
Duc.DucPolygonElement.addBase(b, base);
|
|
465
|
+
Duc.DucPolygonElement.addSides(b, e.sides);
|
|
466
|
+
return Duc.DucPolygonElement.endDucPolygonElement(b);
|
|
467
|
+
}
|
|
468
|
+
function writeEllipse(b, e, usv) {
|
|
469
|
+
const base = writeElementBase(b, e, usv);
|
|
470
|
+
Duc.DucEllipseElement.startDucEllipseElement(b);
|
|
471
|
+
Duc.DucEllipseElement.addBase(b, base);
|
|
472
|
+
Duc.DucEllipseElement.addRatio(b, e.ratio);
|
|
473
|
+
Duc.DucEllipseElement.addStartAngle(b, e.startAngle);
|
|
474
|
+
Duc.DucEllipseElement.addEndAngle(b, e.endAngle);
|
|
475
|
+
Duc.DucEllipseElement.addShowAuxCrosshair(b, e.showAuxCrosshair);
|
|
476
|
+
return Duc.DucEllipseElement.endDucEllipseElement(b);
|
|
477
|
+
}
|
|
478
|
+
function writeLinear(b, e, usv) {
|
|
479
|
+
const base = writeLinearBase(b, e, usv);
|
|
480
|
+
Duc.DucLinearElement.startDucLinearElement(b);
|
|
481
|
+
Duc.DucLinearElement.addLinearBase(b, base);
|
|
482
|
+
Duc.DucLinearElement.addWipeoutBelow(b, e.wipeoutBelow);
|
|
483
|
+
return Duc.DucLinearElement.endDucLinearElement(b);
|
|
484
|
+
}
|
|
485
|
+
function writeArrow(b, e, usv) {
|
|
486
|
+
const base = writeLinearBase(b, e, usv);
|
|
487
|
+
Duc.DucArrowElement.startDucArrowElement(b);
|
|
488
|
+
Duc.DucArrowElement.addLinearBase(b, base);
|
|
489
|
+
Duc.DucArrowElement.addElbowed(b, e.elbowed);
|
|
490
|
+
return Duc.DucArrowElement.endDucArrowElement(b);
|
|
491
|
+
}
|
|
492
|
+
function writeFreeDrawEnds(b, ends, usv) {
|
|
493
|
+
if (!ends)
|
|
494
|
+
return undefined;
|
|
495
|
+
const easing = str(b, encodeFunctionString(ends.easing));
|
|
496
|
+
Duc.DucFreeDrawEnds.startDucFreeDrawEnds(b);
|
|
497
|
+
Duc.DucFreeDrawEnds.addCap(b, ends.cap);
|
|
498
|
+
Duc.DucFreeDrawEnds.addTaper(b, ends.taper);
|
|
499
|
+
if (easing)
|
|
500
|
+
Duc.DucFreeDrawEnds.addEasing(b, easing);
|
|
501
|
+
return Duc.DucFreeDrawEnds.endDucFreeDrawEnds(b);
|
|
502
|
+
}
|
|
503
|
+
function writeImageCrop(b, c) {
|
|
504
|
+
if (!c)
|
|
505
|
+
return undefined;
|
|
506
|
+
Duc.ImageCrop.startImageCrop(b);
|
|
507
|
+
Duc.ImageCrop.addX(b, c.x);
|
|
508
|
+
Duc.ImageCrop.addY(b, c.y);
|
|
509
|
+
Duc.ImageCrop.addWidth(b, c.width);
|
|
510
|
+
Duc.ImageCrop.addHeight(b, c.height);
|
|
511
|
+
Duc.ImageCrop.addNaturalWidth(b, c.naturalWidth);
|
|
512
|
+
Duc.ImageCrop.addNaturalHeight(b, c.naturalHeight);
|
|
513
|
+
return Duc.ImageCrop.endImageCrop(b);
|
|
514
|
+
}
|
|
515
|
+
function writeImage(b, e, usv) {
|
|
516
|
+
const base = writeElementBase(b, e, usv);
|
|
517
|
+
const fileId = str(b, e.fileId);
|
|
518
|
+
const scaleVec = e.scaleFlip ? Duc.DucImageElement.createScaleVector(b, [e.scaleFlip[0], e.scaleFlip[1]]) : undefined;
|
|
519
|
+
const crop = writeImageCrop(b, e.crop);
|
|
520
|
+
const filter = writeImageFilter(b, e.filter, usv);
|
|
521
|
+
Duc.DucImageElement.startDucImageElement(b);
|
|
522
|
+
Duc.DucImageElement.addBase(b, base);
|
|
523
|
+
if (fileId)
|
|
524
|
+
Duc.DucImageElement.addFileId(b, fileId);
|
|
525
|
+
if (e.status)
|
|
526
|
+
Duc.DucImageElement.addStatus(b, e.status);
|
|
527
|
+
if (scaleVec)
|
|
528
|
+
Duc.DucImageElement.addScale(b, scaleVec);
|
|
529
|
+
if (crop)
|
|
530
|
+
Duc.DucImageElement.addCrop(b, crop);
|
|
531
|
+
if (filter)
|
|
532
|
+
Duc.DucImageElement.addFilter(b, filter);
|
|
533
|
+
return Duc.DucImageElement.endDucImageElement(b);
|
|
534
|
+
}
|
|
535
|
+
function writeFreeDraw(b, e, usv) {
|
|
536
|
+
const base = writeElementBase(b, e, usv);
|
|
537
|
+
const pointsVec = e.points && e.points.length
|
|
538
|
+
? Duc.DucFreeDrawElement.createPointsVector(b, e.points.map((p) => writeDucPoint(b, p, usv)).filter((v) => v !== undefined))
|
|
539
|
+
: Duc.DucFreeDrawElement.createPointsVector(b, []);
|
|
540
|
+
const pressuresVec = e.pressures && e.pressures.length
|
|
541
|
+
? Duc.DucFreeDrawElement.createPressuresVector(b, e.pressures)
|
|
542
|
+
: undefined;
|
|
543
|
+
const easing = b.createString(encodeFunctionString(e.easing));
|
|
544
|
+
const startEnds = writeFreeDrawEnds(b, e.start, usv);
|
|
545
|
+
const endEnds = writeFreeDrawEnds(b, e.end, usv);
|
|
546
|
+
const lcp = e.lastCommittedPoint ? writeDucPoint(b, e.lastCommittedPoint, usv) : undefined;
|
|
547
|
+
const svgPath = e.svgPath ? b.createString(e.svgPath) : undefined;
|
|
548
|
+
Duc.DucFreeDrawElement.startDucFreeDrawElement(b);
|
|
549
|
+
Duc.DucFreeDrawElement.addBase(b, base);
|
|
550
|
+
Duc.DucFreeDrawElement.addPoints(b, pointsVec);
|
|
551
|
+
Duc.DucFreeDrawElement.addSize(b, getPrecisionValue(e.size, usv));
|
|
552
|
+
Duc.DucFreeDrawElement.addThinning(b, e.thinning);
|
|
553
|
+
Duc.DucFreeDrawElement.addSmoothing(b, e.smoothing);
|
|
554
|
+
Duc.DucFreeDrawElement.addStreamline(b, e.streamline);
|
|
555
|
+
if (easing)
|
|
556
|
+
Duc.DucFreeDrawElement.addEasing(b, easing);
|
|
557
|
+
if (startEnds)
|
|
558
|
+
Duc.DucFreeDrawElement.addStart(b, startEnds);
|
|
559
|
+
if (endEnds)
|
|
560
|
+
Duc.DucFreeDrawElement.addEnd(b, endEnds);
|
|
561
|
+
if (pressuresVec)
|
|
562
|
+
Duc.DucFreeDrawElement.addPressures(b, pressuresVec);
|
|
563
|
+
Duc.DucFreeDrawElement.addSimulatePressure(b, !!e.simulatePressure);
|
|
564
|
+
if (lcp)
|
|
565
|
+
Duc.DucFreeDrawElement.addLastCommittedPoint(b, lcp);
|
|
566
|
+
if (svgPath)
|
|
567
|
+
Duc.DucFreeDrawElement.addSvgPath(b, svgPath);
|
|
568
|
+
return Duc.DucFreeDrawElement.endDucFreeDrawElement(b);
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Text
|
|
572
|
+
*/
|
|
573
|
+
function writeLineSpacing(b, ls, usv) {
|
|
574
|
+
if (!ls)
|
|
575
|
+
return undefined;
|
|
576
|
+
Duc.LineSpacing.startLineSpacing(b);
|
|
577
|
+
if (typeof ls.value === "number") {
|
|
578
|
+
Duc.LineSpacing.addValue(b, ls.value);
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
Duc.LineSpacing.addValue(b, getPrecisionValue(ls.value, usv));
|
|
582
|
+
}
|
|
583
|
+
Duc.LineSpacing.addType(b, ls.type);
|
|
584
|
+
return Duc.LineSpacing.endLineSpacing(b);
|
|
585
|
+
}
|
|
586
|
+
function writeTextStyle(b, s, usv) {
|
|
587
|
+
const base = writeStylesBase(b, s, usv);
|
|
588
|
+
const lineSpacing = writeLineSpacing(b, s.lineSpacing, usv);
|
|
589
|
+
const fontFamily = str(b, s.fontFamily.toString());
|
|
590
|
+
const bigFont = str(b, s.bigFontFamily);
|
|
591
|
+
Duc.DucTextStyle.startDucTextStyle(b);
|
|
592
|
+
if (base)
|
|
593
|
+
Duc.DucTextStyle.addBaseStyle(b, base);
|
|
594
|
+
Duc.DucTextStyle.addIsLtr(b, s.isLtr);
|
|
595
|
+
if (fontFamily)
|
|
596
|
+
Duc.DucTextStyle.addFontFamily(b, fontFamily);
|
|
597
|
+
if (bigFont)
|
|
598
|
+
Duc.DucTextStyle.addBigFontFamily(b, bigFont);
|
|
599
|
+
if (s.textAlign !== undefined)
|
|
600
|
+
Duc.DucTextStyle.addTextAlign(b, s.textAlign);
|
|
601
|
+
if (s.verticalAlign !== undefined)
|
|
602
|
+
Duc.DucTextStyle.addVerticalAlign(b, s.verticalAlign);
|
|
603
|
+
Duc.DucTextStyle.addLineHeight(b, s.lineHeight);
|
|
604
|
+
if (lineSpacing)
|
|
605
|
+
Duc.DucTextStyle.addLineSpacing(b, lineSpacing);
|
|
606
|
+
Duc.DucTextStyle.addObliqueAngle(b, s.obliqueAngle);
|
|
607
|
+
Duc.DucTextStyle.addFontSize(b, getPrecisionValue(s.fontSize, usv));
|
|
608
|
+
if (s.paperTextHeight !== undefined)
|
|
609
|
+
Duc.DucTextStyle.addPaperTextHeight(b, getPrecisionValue(s.paperTextHeight, usv));
|
|
610
|
+
Duc.DucTextStyle.addWidthFactor(b, s.widthFactor);
|
|
611
|
+
Duc.DucTextStyle.addIsUpsideDown(b, s.isUpsideDown);
|
|
612
|
+
Duc.DucTextStyle.addIsBackwards(b, s.isBackwards);
|
|
613
|
+
return Duc.DucTextStyle.endDucTextStyle(b);
|
|
614
|
+
}
|
|
615
|
+
function writePrimaryUnits(b, units, usv) {
|
|
616
|
+
if (!units)
|
|
617
|
+
return undefined;
|
|
618
|
+
// Linear
|
|
619
|
+
Duc._UnitSystemBase.start_UnitSystemBase(b);
|
|
620
|
+
Duc._UnitSystemBase.addSystem(b, units.linear.system);
|
|
621
|
+
Duc._UnitSystemBase.addPrecision(b, units.linear.precision);
|
|
622
|
+
Duc._UnitSystemBase.addSuppressLeadingZeros(b, units.linear.suppressLeadingZeros);
|
|
623
|
+
Duc._UnitSystemBase.addSuppressTrailingZeros(b, units.linear.suppressTrailingZeros);
|
|
624
|
+
const baseLinear = Duc._UnitSystemBase.end_UnitSystemBase(b);
|
|
625
|
+
Duc.LinearUnitSystem.startLinearUnitSystem(b);
|
|
626
|
+
Duc.LinearUnitSystem.addBase(b, baseLinear);
|
|
627
|
+
Duc.LinearUnitSystem.addFormat(b, units.linear.format);
|
|
628
|
+
Duc.LinearUnitSystem.addDecimalSeparator(b, units.linear.decimalSeparator);
|
|
629
|
+
Duc.LinearUnitSystem.addSuppressZeroFeet(b, units.linear.suppressZeroFeet);
|
|
630
|
+
Duc.LinearUnitSystem.addSuppressZeroInches(b, units.linear.suppressZeroInches);
|
|
631
|
+
const linear = Duc.LinearUnitSystem.endLinearUnitSystem(b);
|
|
632
|
+
// Angular
|
|
633
|
+
Duc._UnitSystemBase.start_UnitSystemBase(b);
|
|
634
|
+
Duc._UnitSystemBase.addSystem(b, units.angular.system);
|
|
635
|
+
Duc._UnitSystemBase.addPrecision(b, units.angular.precision);
|
|
636
|
+
Duc._UnitSystemBase.addSuppressLeadingZeros(b, units.angular.suppressLeadingZeros);
|
|
637
|
+
Duc._UnitSystemBase.addSuppressTrailingZeros(b, units.angular.suppressTrailingZeros);
|
|
638
|
+
const baseAngular = Duc._UnitSystemBase.end_UnitSystemBase(b);
|
|
639
|
+
Duc.AngularUnitSystem.startAngularUnitSystem(b);
|
|
640
|
+
Duc.AngularUnitSystem.addBase(b, baseAngular);
|
|
641
|
+
Duc.AngularUnitSystem.addFormat(b, units.angular.format);
|
|
642
|
+
const angular = Duc.AngularUnitSystem.endAngularUnitSystem(b);
|
|
643
|
+
Duc.PrimaryUnits.startPrimaryUnits(b);
|
|
644
|
+
Duc.PrimaryUnits.addLinear(b, linear);
|
|
645
|
+
Duc.PrimaryUnits.addAngular(b, angular);
|
|
646
|
+
return Duc.PrimaryUnits.endPrimaryUnits(b);
|
|
647
|
+
}
|
|
648
|
+
function writeTextDynamicSource(b, s, usv) {
|
|
649
|
+
// discriminate by sourceType union ("element" | "dictionary")
|
|
650
|
+
if (s.sourceType === Duc.TEXT_FIELD_SOURCE_TYPE.ELEMENT) {
|
|
651
|
+
const el = str(b, s.elementId);
|
|
652
|
+
const prop = s.property;
|
|
653
|
+
Duc.DucTextDynamicElementSource.startDucTextDynamicElementSource(b);
|
|
654
|
+
if (el)
|
|
655
|
+
Duc.DucTextDynamicElementSource.addElementId(b, el);
|
|
656
|
+
Duc.DucTextDynamicElementSource.addProperty(b, prop);
|
|
657
|
+
const elem = Duc.DucTextDynamicElementSource.endDucTextDynamicElementSource(b);
|
|
658
|
+
Duc.DucTextDynamicSource.startDucTextDynamicSource(b);
|
|
659
|
+
Duc.DucTextDynamicSource.addTextSourceType(b, Duc.TEXT_FIELD_SOURCE_TYPE.ELEMENT);
|
|
660
|
+
Duc.DucTextDynamicSource.addSourceType(b, Duc.DucTextDynamicSourceData.DucTextDynamicElementSource);
|
|
661
|
+
Duc.DucTextDynamicSource.addSource(b, elem);
|
|
662
|
+
return Duc.DucTextDynamicSource.endDucTextDynamicSource(b);
|
|
663
|
+
}
|
|
664
|
+
const key = str(b, s.key);
|
|
665
|
+
Duc.DucTextDynamicDictionarySource.startDucTextDynamicDictionarySource(b);
|
|
666
|
+
if (key)
|
|
667
|
+
Duc.DucTextDynamicDictionarySource.addKey(b, key);
|
|
668
|
+
const dict = Duc.DucTextDynamicDictionarySource.endDucTextDynamicDictionarySource(b);
|
|
669
|
+
Duc.DucTextDynamicSource.startDucTextDynamicSource(b);
|
|
670
|
+
Duc.DucTextDynamicSource.addTextSourceType(b, Duc.TEXT_FIELD_SOURCE_TYPE.DICTIONARY);
|
|
671
|
+
Duc.DucTextDynamicSource.addSourceType(b, Duc.DucTextDynamicSourceData.DucTextDynamicDictionarySource);
|
|
672
|
+
Duc.DucTextDynamicSource.addSource(b, dict);
|
|
673
|
+
return Duc.DucTextDynamicSource.endDucTextDynamicSource(b);
|
|
674
|
+
}
|
|
675
|
+
function writeTextDynamicPart(b, p, usv) {
|
|
676
|
+
const tag = str(b, p.tag);
|
|
677
|
+
const src = writeTextDynamicSource(b, p.source, usv);
|
|
678
|
+
const fmt = writePrimaryUnits(b, p.formatting, usv);
|
|
679
|
+
const cached = str(b, p.cachedValue);
|
|
680
|
+
Duc.DucTextDynamicPart.startDucTextDynamicPart(b);
|
|
681
|
+
if (tag)
|
|
682
|
+
Duc.DucTextDynamicPart.addTag(b, tag);
|
|
683
|
+
Duc.DucTextDynamicPart.addSource(b, src);
|
|
684
|
+
if (fmt)
|
|
685
|
+
Duc.DucTextDynamicPart.addFormatting(b, fmt);
|
|
686
|
+
if (cached)
|
|
687
|
+
Duc.DucTextDynamicPart.addCachedValue(b, cached);
|
|
688
|
+
return Duc.DucTextDynamicPart.endDucTextDynamicPart(b);
|
|
689
|
+
}
|
|
690
|
+
function writeTextColumn(b, c, usv) {
|
|
691
|
+
Duc.TextColumn.startTextColumn(b);
|
|
692
|
+
Duc.TextColumn.addWidth(b, getPrecisionValue(c.width, usv));
|
|
693
|
+
Duc.TextColumn.addGutter(b, getPrecisionValue(c.gutter, usv));
|
|
694
|
+
return Duc.TextColumn.endTextColumn(b);
|
|
695
|
+
}
|
|
696
|
+
function writeParagraphFormatting(b, p, usv) {
|
|
697
|
+
const tabs = Duc.ParagraphFormatting.createTabStopsVector(b, p.tabStops.map((t) => getPrecisionValue(t, usv)));
|
|
698
|
+
Duc.ParagraphFormatting.startParagraphFormatting(b);
|
|
699
|
+
Duc.ParagraphFormatting.addFirstLineIndent(b, getPrecisionValue(p.firstLineIndent, usv));
|
|
700
|
+
Duc.ParagraphFormatting.addHangingIndent(b, getPrecisionValue(p.hangingIndent, usv));
|
|
701
|
+
Duc.ParagraphFormatting.addLeftIndent(b, getPrecisionValue(p.leftIndent, usv));
|
|
702
|
+
Duc.ParagraphFormatting.addRightIndent(b, getPrecisionValue(p.rightIndent, usv));
|
|
703
|
+
Duc.ParagraphFormatting.addSpaceBefore(b, getPrecisionValue(p.spaceBefore, usv));
|
|
704
|
+
Duc.ParagraphFormatting.addSpaceAfter(b, getPrecisionValue(p.spaceAfter, usv));
|
|
705
|
+
Duc.ParagraphFormatting.addTabStops(b, tabs);
|
|
706
|
+
return Duc.ParagraphFormatting.endParagraphFormatting(b);
|
|
707
|
+
}
|
|
708
|
+
function writeStackFormat(b, s, usv) {
|
|
709
|
+
const chars = Duc.StackFormat.createStackCharsVector(b, [...s.stackChars].map((c) => b.createString(c)));
|
|
710
|
+
Duc.StackFormatProperties.startStackFormatProperties(b);
|
|
711
|
+
Duc.StackFormatProperties.addUpperScale(b, s.properties.upperScale);
|
|
712
|
+
Duc.StackFormatProperties.addLowerScale(b, s.properties.lowerScale);
|
|
713
|
+
Duc.StackFormatProperties.addAlignment(b, s.properties.alignment);
|
|
714
|
+
const props = Duc.StackFormatProperties.endStackFormatProperties(b);
|
|
715
|
+
Duc.StackFormat.startStackFormat(b);
|
|
716
|
+
Duc.StackFormat.addAutoStack(b, s.autoStack);
|
|
717
|
+
Duc.StackFormat.addStackChars(b, chars);
|
|
718
|
+
Duc.StackFormat.addProperties(b, props);
|
|
719
|
+
return Duc.StackFormat.endStackFormat(b);
|
|
720
|
+
}
|
|
721
|
+
function writeDocStyle(b, s, usv) {
|
|
722
|
+
const text = writeTextStyle(b, s, usv);
|
|
723
|
+
const para = writeParagraphFormatting(b, s.paragraph, usv);
|
|
724
|
+
const stack = writeStackFormat(b, s.stackFormat, usv);
|
|
725
|
+
Duc.DucDocStyle.startDucDocStyle(b);
|
|
726
|
+
Duc.DucDocStyle.addTextStyle(b, text);
|
|
727
|
+
Duc.DucDocStyle.addParagraph(b, para);
|
|
728
|
+
Duc.DucDocStyle.addStackFormat(b, stack);
|
|
729
|
+
return Duc.DucDocStyle.endDucDocStyle(b);
|
|
730
|
+
}
|
|
731
|
+
function writeColumnLayout(b, c, usv) {
|
|
732
|
+
const defs = Duc.ColumnLayout.createDefinitionsVector(b, c.definitions.map((d) => writeTextColumn(b, d, usv)));
|
|
733
|
+
Duc.ColumnLayout.startColumnLayout(b);
|
|
734
|
+
Duc.ColumnLayout.addType(b, c.type);
|
|
735
|
+
Duc.ColumnLayout.addDefinitions(b, defs);
|
|
736
|
+
Duc.ColumnLayout.addAutoHeight(b, c.autoHeight);
|
|
737
|
+
return Duc.ColumnLayout.endColumnLayout(b);
|
|
738
|
+
}
|
|
739
|
+
function writeText(b, e, usv) {
|
|
740
|
+
var _a;
|
|
741
|
+
const base = writeElementBase(b, e, usv);
|
|
742
|
+
const style = writeTextStyle(b, e, usv);
|
|
743
|
+
const text = str(b, e.text);
|
|
744
|
+
const dynamic = Duc.DucTextElement.createDynamicVector(b, e.dynamic.map((d) => writeTextDynamicPart(b, d, usv)));
|
|
745
|
+
const containerId = str(b, (_a = e.containerId) !== null && _a !== void 0 ? _a : undefined);
|
|
746
|
+
const original = str(b, e.originalText);
|
|
747
|
+
Duc.DucTextElement.startDucTextElement(b);
|
|
748
|
+
Duc.DucTextElement.addBase(b, base);
|
|
749
|
+
Duc.DucTextElement.addStyle(b, style);
|
|
750
|
+
if (text)
|
|
751
|
+
Duc.DucTextElement.addText(b, text);
|
|
752
|
+
Duc.DucTextElement.addDynamic(b, dynamic);
|
|
753
|
+
Duc.DucTextElement.addAutoResize(b, e.autoResize);
|
|
754
|
+
if (containerId)
|
|
755
|
+
Duc.DucTextElement.addContainerId(b, containerId);
|
|
756
|
+
if (original)
|
|
757
|
+
Duc.DucTextElement.addOriginalText(b, original);
|
|
758
|
+
return Duc.DucTextElement.endDucTextElement(b);
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Blocks
|
|
762
|
+
*/
|
|
763
|
+
function writeBlockAttrDef(b, d, usv) {
|
|
764
|
+
const tag = b.createString(d.tag);
|
|
765
|
+
const prompt = b.createString(d.prompt);
|
|
766
|
+
const defVal = b.createString(d.defaultValue);
|
|
767
|
+
Duc.DucBlockAttributeDefinition.startDucBlockAttributeDefinition(b);
|
|
768
|
+
Duc.DucBlockAttributeDefinition.addTag(b, tag);
|
|
769
|
+
Duc.DucBlockAttributeDefinition.addPrompt(b, prompt);
|
|
770
|
+
Duc.DucBlockAttributeDefinition.addDefaultValue(b, defVal);
|
|
771
|
+
Duc.DucBlockAttributeDefinition.addIsConstant(b, d.isConstant);
|
|
772
|
+
return Duc.DucBlockAttributeDefinition.endDucBlockAttributeDefinition(b);
|
|
773
|
+
}
|
|
774
|
+
function writeBlock(b, bl, usv) {
|
|
775
|
+
var _a, _b;
|
|
776
|
+
const id = b.createString(bl.id);
|
|
777
|
+
const label = b.createString(bl.label);
|
|
778
|
+
const desc = b.createString((_a = bl.description) !== null && _a !== void 0 ? _a : "");
|
|
779
|
+
const elems = Duc.DucBlock.createElementsVector(b, bl.elements.map((el) => writeElementWrapper(b, el, usv)));
|
|
780
|
+
const defs = Duc.DucBlock.createAttributeDefinitionsVector(b, Object.entries((_b = bl.attributeDefinitions) !== null && _b !== void 0 ? _b : {}).map(([k, v]) => {
|
|
781
|
+
const key = b.createString(k);
|
|
782
|
+
const val = writeBlockAttrDef(b, v, usv);
|
|
783
|
+
Duc.DucBlockAttributeDefinitionEntry.startDucBlockAttributeDefinitionEntry(b);
|
|
784
|
+
Duc.DucBlockAttributeDefinitionEntry.addKey(b, key);
|
|
785
|
+
Duc.DucBlockAttributeDefinitionEntry.addValue(b, val);
|
|
786
|
+
return Duc.DucBlockAttributeDefinitionEntry.endDucBlockAttributeDefinitionEntry(b);
|
|
787
|
+
}));
|
|
788
|
+
Duc.DucBlock.startDucBlock(b);
|
|
789
|
+
Duc.DucBlock.addId(b, id);
|
|
790
|
+
Duc.DucBlock.addLabel(b, label);
|
|
791
|
+
Duc.DucBlock.addDescription(b, desc);
|
|
792
|
+
Duc.DucBlock.addVersion(b, bl.version);
|
|
793
|
+
Duc.DucBlock.addElements(b, elems);
|
|
794
|
+
Duc.DucBlock.addAttributeDefinitions(b, defs);
|
|
795
|
+
return Duc.DucBlock.endDucBlock(b);
|
|
796
|
+
}
|
|
797
|
+
function writeBlockInstance(b, e, usv) {
|
|
798
|
+
var _a, _b;
|
|
799
|
+
const base = writeElementBase(b, e, usv);
|
|
800
|
+
const blockId = b.createString(e.blockId);
|
|
801
|
+
const overrides = Duc.DucBlockInstanceElement.createElementOverridesVector(b, Object.entries((_a = e.elementOverrides) !== null && _a !== void 0 ? _a : {}).map(([k, v]) => writeStringEntry(b, k, v)));
|
|
802
|
+
const attrs = Duc.DucBlockInstanceElement.createAttributeValuesVector(b, Object.entries((_b = e.attributeValues) !== null && _b !== void 0 ? _b : {}).map(([k, v]) => writeStringEntry(b, k, v)));
|
|
803
|
+
const dup = e.duplicationArray
|
|
804
|
+
? (() => {
|
|
805
|
+
Duc.DucBlockDuplicationArray.startDucBlockDuplicationArray(b);
|
|
806
|
+
Duc.DucBlockDuplicationArray.addRows(b, e.duplicationArray.rows);
|
|
807
|
+
Duc.DucBlockDuplicationArray.addCols(b, e.duplicationArray.cols);
|
|
808
|
+
Duc.DucBlockDuplicationArray.addRowSpacing(b, getPrecisionValue(e.duplicationArray.rowSpacing, usv));
|
|
809
|
+
Duc.DucBlockDuplicationArray.addColSpacing(b, getPrecisionValue(e.duplicationArray.colSpacing, usv));
|
|
810
|
+
return Duc.DucBlockDuplicationArray.endDucBlockDuplicationArray(b);
|
|
811
|
+
})()
|
|
812
|
+
: undefined;
|
|
813
|
+
Duc.DucBlockInstanceElement.startDucBlockInstanceElement(b);
|
|
814
|
+
Duc.DucBlockInstanceElement.addBase(b, base);
|
|
815
|
+
Duc.DucBlockInstanceElement.addBlockId(b, blockId);
|
|
816
|
+
if (overrides)
|
|
817
|
+
Duc.DucBlockInstanceElement.addElementOverrides(b, overrides);
|
|
818
|
+
if (attrs)
|
|
819
|
+
Duc.DucBlockInstanceElement.addAttributeValues(b, attrs);
|
|
820
|
+
if (dup)
|
|
821
|
+
Duc.DucBlockInstanceElement.addDuplicationArray(b, dup);
|
|
822
|
+
return Duc.DucBlockInstanceElement.endDucBlockInstanceElement(b);
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Stack containers
|
|
826
|
+
*/
|
|
827
|
+
function writeStackLikeStyles(b, s, usv) {
|
|
828
|
+
const color = b.createString(s.labelingColor);
|
|
829
|
+
Duc.DucStackLikeStyles.startDucStackLikeStyles(b);
|
|
830
|
+
Duc.DucStackLikeStyles.addOpacity(b, s.opacity);
|
|
831
|
+
Duc.DucStackLikeStyles.addLabelingColor(b, color);
|
|
832
|
+
return Duc.DucStackLikeStyles.endDucStackLikeStyles(b);
|
|
833
|
+
}
|
|
834
|
+
function writeStackBase(b, s, usv) {
|
|
835
|
+
var _a;
|
|
836
|
+
const label = b.createString(s.label);
|
|
837
|
+
const desc = str(b, (_a = s.description) !== null && _a !== void 0 ? _a : undefined);
|
|
838
|
+
const styles = writeStackLikeStyles(b, s, usv);
|
|
839
|
+
Duc._DucStackBase.start_DucStackBase(b);
|
|
840
|
+
Duc._DucStackBase.addLabel(b, label);
|
|
841
|
+
if (desc)
|
|
842
|
+
Duc._DucStackBase.addDescription(b, desc);
|
|
843
|
+
Duc._DucStackBase.addIsCollapsed(b, s.isCollapsed);
|
|
844
|
+
Duc._DucStackBase.addIsPlot(b, s.isPlot);
|
|
845
|
+
Duc._DucStackBase.addIsVisible(b, s.isVisible);
|
|
846
|
+
Duc._DucStackBase.addLocked(b, s.locked);
|
|
847
|
+
Duc._DucStackBase.addStyles(b, styles);
|
|
848
|
+
return Duc._DucStackBase.end_DucStackBase(b);
|
|
849
|
+
}
|
|
850
|
+
function writeStackElementBase(b, s, usv) {
|
|
851
|
+
const base = writeElementBase(b, s, usv);
|
|
852
|
+
const stackBase = writeStackBase(b, s, usv);
|
|
853
|
+
const std = str(b, s.standardOverride);
|
|
854
|
+
Duc._DucStackElementBase.start_DucStackElementBase(b);
|
|
855
|
+
Duc._DucStackElementBase.addBase(b, base);
|
|
856
|
+
Duc._DucStackElementBase.addStackBase(b, stackBase);
|
|
857
|
+
Duc._DucStackElementBase.addClip(b, s.clip);
|
|
858
|
+
Duc._DucStackElementBase.addLabelVisible(b, s.labelVisible);
|
|
859
|
+
if (std)
|
|
860
|
+
Duc._DucStackElementBase.addStandardOverride(b, std);
|
|
861
|
+
return Duc._DucStackElementBase.end_DucStackElementBase(b);
|
|
862
|
+
}
|
|
863
|
+
function writeFrame(b, e, usv) {
|
|
864
|
+
const base = writeStackElementBase(b, e, usv);
|
|
865
|
+
Duc.DucFrameElement.startDucFrameElement(b);
|
|
866
|
+
Duc.DucFrameElement.addStackElementBase(b, base);
|
|
867
|
+
return Duc.DucFrameElement.endDucFrameElement(b);
|
|
868
|
+
}
|
|
869
|
+
function writePlotLayout(b, l, usv) {
|
|
870
|
+
Duc.Margins.startMargins(b);
|
|
871
|
+
Duc.Margins.addTop(b, getPrecisionValue(l.margins.top, usv));
|
|
872
|
+
Duc.Margins.addRight(b, getPrecisionValue(l.margins.right, usv));
|
|
873
|
+
Duc.Margins.addBottom(b, getPrecisionValue(l.margins.bottom, usv));
|
|
874
|
+
Duc.Margins.addLeft(b, getPrecisionValue(l.margins.left, usv));
|
|
875
|
+
const margins = Duc.Margins.endMargins(b);
|
|
876
|
+
Duc.PlotLayout.startPlotLayout(b);
|
|
877
|
+
Duc.PlotLayout.addMargins(b, margins);
|
|
878
|
+
return Duc.PlotLayout.endPlotLayout(b);
|
|
879
|
+
}
|
|
880
|
+
function writePlot(b, e, usv) {
|
|
881
|
+
const stackBase = writeStackElementBase(b, e, usv);
|
|
882
|
+
const baseStyle = writeStylesBase(b, e, usv);
|
|
883
|
+
const plotStyle = (() => {
|
|
884
|
+
Duc.DucPlotStyle.startDucPlotStyle(b);
|
|
885
|
+
if (baseStyle)
|
|
886
|
+
Duc.DucPlotStyle.addBaseStyle(b, baseStyle);
|
|
887
|
+
return Duc.DucPlotStyle.endDucPlotStyle(b);
|
|
888
|
+
})();
|
|
889
|
+
const layout = writePlotLayout(b, e.layout, usv);
|
|
890
|
+
Duc.DucPlotElement.startDucPlotElement(b);
|
|
891
|
+
Duc.DucPlotElement.addStackElementBase(b, stackBase);
|
|
892
|
+
Duc.DucPlotElement.addStyle(b, plotStyle);
|
|
893
|
+
Duc.DucPlotElement.addLayout(b, layout);
|
|
894
|
+
return Duc.DucPlotElement.endDucPlotElement(b);
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Views / Viewports / XRay
|
|
898
|
+
*/
|
|
899
|
+
function writeView(b, v, usv) {
|
|
900
|
+
const center = writeDucPoint(b, v.centerPoint, usv);
|
|
901
|
+
const scope = b.createString(v.scope);
|
|
902
|
+
Duc.DucView.startDucView(b);
|
|
903
|
+
Duc.DucView.addScrollX(b, getPrecisionValue(v.scrollX, usv));
|
|
904
|
+
Duc.DucView.addScrollY(b, getPrecisionValue(v.scrollY, usv));
|
|
905
|
+
Duc.DucView.addZoom(b, v.zoom.value);
|
|
906
|
+
Duc.DucView.addTwistAngle(b, v.twistAngle);
|
|
907
|
+
if (center)
|
|
908
|
+
Duc.DucView.addCenterPoint(b, center);
|
|
909
|
+
Duc.DucView.addScope(b, scope);
|
|
910
|
+
return Duc.DucView.endDucView(b);
|
|
911
|
+
}
|
|
912
|
+
function writeViewportStyle(b, s, usv) {
|
|
913
|
+
const base = writeStylesBase(b, s, usv);
|
|
914
|
+
Duc.DucViewportStyle.startDucViewportStyle(b);
|
|
915
|
+
if (base)
|
|
916
|
+
Duc.DucViewportStyle.addBaseStyle(b, base);
|
|
917
|
+
Duc.DucViewportStyle.addScaleIndicatorVisible(b, s.scaleIndicatorVisible);
|
|
918
|
+
return Duc.DucViewportStyle.endDucViewportStyle(b);
|
|
919
|
+
}
|
|
920
|
+
function writeViewport(b, e, usv) {
|
|
921
|
+
var _a;
|
|
922
|
+
const linear = writeLinearBase(b, e, usv);
|
|
923
|
+
const stackBase = writeStackBase(b, e, usv);
|
|
924
|
+
const style = writeViewportStyle(b, e, usv);
|
|
925
|
+
const view = writeView(b, e.view, usv);
|
|
926
|
+
const frozen = ((_a = e.frozenGroupIds) === null || _a === void 0 ? void 0 : _a.length) ? Duc.DucViewportElement.createFrozenGroupIdsVector(b, e.frozenGroupIds.map((id) => b.createString(id))) : undefined;
|
|
927
|
+
const std = str(b, e.standardOverride);
|
|
928
|
+
Duc.DucViewportElement.startDucViewportElement(b);
|
|
929
|
+
Duc.DucViewportElement.addLinearBase(b, linear);
|
|
930
|
+
Duc.DucViewportElement.addStackBase(b, stackBase);
|
|
931
|
+
Duc.DucViewportElement.addStyle(b, style);
|
|
932
|
+
Duc.DucViewportElement.addView(b, view);
|
|
933
|
+
Duc.DucViewportElement.addScale(b, e.scale);
|
|
934
|
+
if (e.shadePlot !== undefined)
|
|
935
|
+
Duc.DucViewportElement.addShadePlot(b, e.shadePlot);
|
|
936
|
+
if (frozen)
|
|
937
|
+
Duc.DucViewportElement.addFrozenGroupIds(b, frozen);
|
|
938
|
+
if (std)
|
|
939
|
+
Duc.DucViewportElement.addStandardOverride(b, std);
|
|
940
|
+
return Duc.DucViewportElement.endDucViewportElement(b);
|
|
941
|
+
}
|
|
942
|
+
function writeXRayStyle(b, s, usv) {
|
|
943
|
+
const base = writeStylesBase(b, s, usv);
|
|
944
|
+
const color = b.createString(s.color);
|
|
945
|
+
Duc.DucXRayStyle.startDucXRayStyle(b);
|
|
946
|
+
if (base)
|
|
947
|
+
Duc.DucXRayStyle.addBaseStyle(b, base);
|
|
948
|
+
Duc.DucXRayStyle.addColor(b, color);
|
|
949
|
+
return Duc.DucXRayStyle.endDucXRayStyle(b);
|
|
950
|
+
}
|
|
951
|
+
function writeXRay(b, e, usv) {
|
|
952
|
+
const base = writeElementBase(b, e, usv);
|
|
953
|
+
const style = writeXRayStyle(b, e, usv);
|
|
954
|
+
const origin = writeDucPoint(b, e.origin, usv);
|
|
955
|
+
const direction = writeDucPoint(b, e.direction, usv);
|
|
956
|
+
Duc.DucXRayElement.startDucXRayElement(b);
|
|
957
|
+
Duc.DucXRayElement.addBase(b, base);
|
|
958
|
+
Duc.DucXRayElement.addStyle(b, style);
|
|
959
|
+
if (origin)
|
|
960
|
+
Duc.DucXRayElement.addOrigin(b, origin);
|
|
961
|
+
if (direction)
|
|
962
|
+
Duc.DucXRayElement.addDirection(b, direction);
|
|
963
|
+
Duc.DucXRayElement.addStartFromOrigin(b, e.startFromOrigin);
|
|
964
|
+
return Duc.DucXRayElement.endDucXRayElement(b);
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* Leader & Dimension & FCF
|
|
968
|
+
*/
|
|
969
|
+
function writeLeaderContent(b, c, usv) {
|
|
970
|
+
var _a, _b;
|
|
971
|
+
if (!c)
|
|
972
|
+
return undefined;
|
|
973
|
+
let contentOffset;
|
|
974
|
+
let contentType;
|
|
975
|
+
if (c.type === "text") {
|
|
976
|
+
const text = b.createString(c.text);
|
|
977
|
+
Duc.LeaderTextBlockContent.startLeaderTextBlockContent(b);
|
|
978
|
+
Duc.LeaderTextBlockContent.addText(b, text);
|
|
979
|
+
contentOffset = Duc.LeaderTextBlockContent.endLeaderTextBlockContent(b);
|
|
980
|
+
contentType = Duc.LeaderContentData.LeaderTextBlockContent;
|
|
981
|
+
}
|
|
982
|
+
else {
|
|
983
|
+
const attrs = Duc.LeaderBlockContent.createAttributeValuesVector(b, Object.entries((_a = c.instanceData.attributeValues) !== null && _a !== void 0 ? _a : {}).map(([k, v]) => writeStringEntry(b, k, v)));
|
|
984
|
+
const overrides = Duc.LeaderBlockContent.createElementOverridesVector(b, Object.entries((_b = c.instanceData.elementOverrides) !== null && _b !== void 0 ? _b : {}).map(([k, v]) => writeStringEntry(b, k, v)));
|
|
985
|
+
const blockId = b.createString(c.blockId);
|
|
986
|
+
Duc.LeaderBlockContent.startLeaderBlockContent(b);
|
|
987
|
+
Duc.LeaderBlockContent.addBlockId(b, blockId);
|
|
988
|
+
if (attrs)
|
|
989
|
+
Duc.LeaderBlockContent.addAttributeValues(b, attrs);
|
|
990
|
+
if (overrides)
|
|
991
|
+
Duc.LeaderBlockContent.addElementOverrides(b, overrides);
|
|
992
|
+
contentOffset = Duc.LeaderBlockContent.endLeaderBlockContent(b);
|
|
993
|
+
contentType = Duc.LeaderContentData.LeaderBlockContent;
|
|
994
|
+
}
|
|
995
|
+
Duc.LeaderContent.startLeaderContent(b);
|
|
996
|
+
Duc.LeaderContent.addLeaderContentType(b, Duc.LEADER_CONTENT_TYPE[c.type.toUpperCase()]);
|
|
997
|
+
Duc.LeaderContent.addContentType(b, contentType);
|
|
998
|
+
Duc.LeaderContent.addContent(b, contentOffset);
|
|
999
|
+
return Duc.LeaderContent.endLeaderContent(b);
|
|
1000
|
+
}
|
|
1001
|
+
function writeLeaderStyle(b, s, usv) {
|
|
1002
|
+
const base = writeStylesBase(b, s, usv);
|
|
1003
|
+
const text = writeTextStyle(b, s.textStyle, usv);
|
|
1004
|
+
const heads = s.headsOverride ? Duc.DucLeaderStyle.createHeadsOverrideVector(b, s.headsOverride.map((h) => writeHead(b, h, usv))) : undefined;
|
|
1005
|
+
Duc.DucLeaderStyle.startDucLeaderStyle(b);
|
|
1006
|
+
if (base)
|
|
1007
|
+
Duc.DucLeaderStyle.addBaseStyle(b, base);
|
|
1008
|
+
if (heads)
|
|
1009
|
+
Duc.DucLeaderStyle.addHeadsOverride(b, heads);
|
|
1010
|
+
if (s.dogleg !== undefined)
|
|
1011
|
+
Duc.DucLeaderStyle.addDogleg(b, getPrecisionValue(s.dogleg, usv));
|
|
1012
|
+
Duc.DucLeaderStyle.addTextStyle(b, text);
|
|
1013
|
+
if (s.textAttachment !== undefined)
|
|
1014
|
+
Duc.DucLeaderStyle.addTextAttachment(b, s.textAttachment);
|
|
1015
|
+
if (s.blockAttachment !== undefined)
|
|
1016
|
+
Duc.DucLeaderStyle.addBlockAttachment(b, s.blockAttachment);
|
|
1017
|
+
return Duc.DucLeaderStyle.endDucLeaderStyle(b);
|
|
1018
|
+
}
|
|
1019
|
+
function writeLeader(b, e, usv) {
|
|
1020
|
+
const linear = writeLinearBase(b, e, usv);
|
|
1021
|
+
const style = writeLeaderStyle(b, e, usv);
|
|
1022
|
+
const content = writeLeaderContent(b, e.leaderContent, usv);
|
|
1023
|
+
const anchor = writeGeomPoint(b, e.contentAnchor, usv);
|
|
1024
|
+
Duc.DucLeaderElement.startDucLeaderElement(b);
|
|
1025
|
+
Duc.DucLeaderElement.addLinearBase(b, linear);
|
|
1026
|
+
Duc.DucLeaderElement.addStyle(b, style);
|
|
1027
|
+
if (content)
|
|
1028
|
+
Duc.DucLeaderElement.addContent(b, content);
|
|
1029
|
+
if (anchor)
|
|
1030
|
+
Duc.DucLeaderElement.addContentAnchor(b, anchor);
|
|
1031
|
+
return Duc.DucLeaderElement.endDucLeaderElement(b);
|
|
1032
|
+
}
|
|
1033
|
+
function writeDimDefPoints(b, d, usv) {
|
|
1034
|
+
const o1 = writeGeomPoint(b, d.origin1, usv);
|
|
1035
|
+
const o2 = d.origin2 ? writeGeomPoint(b, d.origin2, usv) : undefined;
|
|
1036
|
+
const loc = writeGeomPoint(b, d.location, usv);
|
|
1037
|
+
const center = d.center ? writeGeomPoint(b, d.center, usv) : undefined;
|
|
1038
|
+
const jog = d.jog ? writeGeomPoint(b, d.jog, usv) : undefined;
|
|
1039
|
+
Duc.DimensionDefinitionPoints.startDimensionDefinitionPoints(b);
|
|
1040
|
+
if (o1)
|
|
1041
|
+
Duc.DimensionDefinitionPoints.addOrigin1(b, o1);
|
|
1042
|
+
if (o2)
|
|
1043
|
+
Duc.DimensionDefinitionPoints.addOrigin2(b, o2);
|
|
1044
|
+
if (loc)
|
|
1045
|
+
Duc.DimensionDefinitionPoints.addLocation(b, loc);
|
|
1046
|
+
if (center)
|
|
1047
|
+
Duc.DimensionDefinitionPoints.addCenter(b, center);
|
|
1048
|
+
if (jog)
|
|
1049
|
+
Duc.DimensionDefinitionPoints.addJog(b, jog);
|
|
1050
|
+
return Duc.DimensionDefinitionPoints.endDimensionDefinitionPoints(b);
|
|
1051
|
+
}
|
|
1052
|
+
function writeDimBindings(b, d, usv) {
|
|
1053
|
+
if (!d)
|
|
1054
|
+
return undefined;
|
|
1055
|
+
const o1 = d.origin1 ? writePointBinding(b, d.origin1, usv) : undefined;
|
|
1056
|
+
const o2 = d.origin2 ? writePointBinding(b, d.origin2, usv) : undefined;
|
|
1057
|
+
const c = d.center ? writePointBinding(b, d.center, usv) : undefined;
|
|
1058
|
+
Duc.DimensionBindings.startDimensionBindings(b);
|
|
1059
|
+
if (o1)
|
|
1060
|
+
Duc.DimensionBindings.addOrigin1(b, o1);
|
|
1061
|
+
if (o2)
|
|
1062
|
+
Duc.DimensionBindings.addOrigin2(b, o2);
|
|
1063
|
+
if (c)
|
|
1064
|
+
Duc.DimensionBindings.addCenter(b, c);
|
|
1065
|
+
return Duc.DimensionBindings.endDimensionBindings(b);
|
|
1066
|
+
}
|
|
1067
|
+
function writeDimTolStyle(b, t, usv) {
|
|
1068
|
+
const textStyle = writeTextStyle(b, t.textStyle, usv);
|
|
1069
|
+
Duc.DimensionToleranceStyle.startDimensionToleranceStyle(b);
|
|
1070
|
+
Duc.DimensionToleranceStyle.addEnabled(b, t.enabled);
|
|
1071
|
+
Duc.DimensionToleranceStyle.addDisplayMethod(b, t.displayMethod);
|
|
1072
|
+
Duc.DimensionToleranceStyle.addUpperValue(b, t.upperValue);
|
|
1073
|
+
Duc.DimensionToleranceStyle.addLowerValue(b, t.lowerValue);
|
|
1074
|
+
Duc.DimensionToleranceStyle.addPrecision(b, t.precision);
|
|
1075
|
+
Duc.DimensionToleranceStyle.addTextStyle(b, textStyle);
|
|
1076
|
+
return Duc.DimensionToleranceStyle.endDimensionToleranceStyle(b);
|
|
1077
|
+
}
|
|
1078
|
+
function writeDimLineStyle(b, s, usv) {
|
|
1079
|
+
const st = writeElementStroke(b, s.stroke, usv);
|
|
1080
|
+
Duc.DimensionLineStyle.startDimensionLineStyle(b);
|
|
1081
|
+
if (st)
|
|
1082
|
+
Duc.DimensionLineStyle.addStroke(b, st);
|
|
1083
|
+
Duc.DimensionLineStyle.addTextGap(b, getPrecisionValue(s.textGap, usv));
|
|
1084
|
+
return Duc.DimensionLineStyle.endDimensionLineStyle(b);
|
|
1085
|
+
}
|
|
1086
|
+
function writeExtLineStyle(b, s, usv) {
|
|
1087
|
+
const st = writeElementStroke(b, s.stroke, usv);
|
|
1088
|
+
Duc.DimensionExtLineStyle.startDimensionExtLineStyle(b);
|
|
1089
|
+
if (st)
|
|
1090
|
+
Duc.DimensionExtLineStyle.addStroke(b, st);
|
|
1091
|
+
Duc.DimensionExtLineStyle.addOvershoot(b, getPrecisionValue(s.overshoot, usv));
|
|
1092
|
+
Duc.DimensionExtLineStyle.addOffset(b, getPrecisionValue(s.offset, usv));
|
|
1093
|
+
return Duc.DimensionExtLineStyle.endDimensionExtLineStyle(b);
|
|
1094
|
+
}
|
|
1095
|
+
function writeDimSymbolStyle(b, s, usv) {
|
|
1096
|
+
const heads = s.headsOverride ? Duc.DimensionSymbolStyle.createHeadsOverrideVector(b, s.headsOverride.map((h) => writeHead(b, h, usv))) : undefined;
|
|
1097
|
+
Duc.DimensionSymbolStyle.startDimensionSymbolStyle(b);
|
|
1098
|
+
if (heads)
|
|
1099
|
+
Duc.DimensionSymbolStyle.addHeadsOverride(b, heads);
|
|
1100
|
+
Duc.DimensionSymbolStyle.addCenterMarkType(b, s.centerMark.type);
|
|
1101
|
+
Duc.DimensionSymbolStyle.addCenterMarkSize(b, getPrecisionValue(s.centerMark.size, usv));
|
|
1102
|
+
return Duc.DimensionSymbolStyle.endDimensionSymbolStyle(b);
|
|
1103
|
+
}
|
|
1104
|
+
function writeDimStyle(b, s, usv) {
|
|
1105
|
+
const dim = writeDimLineStyle(b, s.dimLine, usv);
|
|
1106
|
+
const ext = writeExtLineStyle(b, s.extLine, usv);
|
|
1107
|
+
const text = writeTextStyle(b, s.textStyle, usv);
|
|
1108
|
+
const sym = writeDimSymbolStyle(b, s.symbols, usv);
|
|
1109
|
+
const tol = writeDimTolStyle(b, s.tolerance, usv);
|
|
1110
|
+
const fit = (() => {
|
|
1111
|
+
Duc.DimensionFitStyle.startDimensionFitStyle(b);
|
|
1112
|
+
Duc.DimensionFitStyle.addRule(b, s.fit.rule);
|
|
1113
|
+
Duc.DimensionFitStyle.addTextPlacement(b, s.fit.textPlacement);
|
|
1114
|
+
Duc.DimensionFitStyle.addForceTextInside(b, s.fit.forceTextInside);
|
|
1115
|
+
return Duc.DimensionFitStyle.endDimensionFitStyle(b);
|
|
1116
|
+
})();
|
|
1117
|
+
Duc.DucDimensionStyle.startDucDimensionStyle(b);
|
|
1118
|
+
Duc.DucDimensionStyle.addDimLine(b, dim);
|
|
1119
|
+
Duc.DucDimensionStyle.addExtLine(b, ext);
|
|
1120
|
+
Duc.DucDimensionStyle.addTextStyle(b, text);
|
|
1121
|
+
Duc.DucDimensionStyle.addSymbols(b, sym);
|
|
1122
|
+
Duc.DucDimensionStyle.addTolerance(b, tol);
|
|
1123
|
+
Duc.DucDimensionStyle.addFit(b, fit);
|
|
1124
|
+
return Duc.DucDimensionStyle.endDucDimensionStyle(b);
|
|
1125
|
+
}
|
|
1126
|
+
function writeDimension(b, e, usv) {
|
|
1127
|
+
const base = writeElementBase(b, e, usv);
|
|
1128
|
+
const style = writeDimStyle(b, e, usv);
|
|
1129
|
+
const def = writeDimDefPoints(b, e.definitionPoints, usv);
|
|
1130
|
+
const bindings = writeDimBindings(b, e.bindings, usv);
|
|
1131
|
+
const textOverride = e.textOverride != null ? b.createString(e.textOverride) : undefined;
|
|
1132
|
+
const textPos = e.textPosition ? writeGeomPoint(b, e.textPosition, usv) : undefined;
|
|
1133
|
+
const tolOverride = e.toleranceOverride ? writeDimTolStyle(b, e.toleranceOverride, usv) : undefined;
|
|
1134
|
+
const baseline = e.baselineData
|
|
1135
|
+
? (() => {
|
|
1136
|
+
Duc.DimensionBaselineData.startDimensionBaselineData(b);
|
|
1137
|
+
Duc.DimensionBaselineData.addBaseDimensionId(b, b.createString(e.baselineData.baseDimensionId));
|
|
1138
|
+
return Duc.DimensionBaselineData.endDimensionBaselineData(b);
|
|
1139
|
+
})()
|
|
1140
|
+
: undefined;
|
|
1141
|
+
const cont = e.continueData
|
|
1142
|
+
? (() => {
|
|
1143
|
+
Duc.DimensionContinueData.startDimensionContinueData(b);
|
|
1144
|
+
Duc.DimensionContinueData.addContinueFromDimensionId(b, b.createString(e.continueData.continueFromDimensionId));
|
|
1145
|
+
return Duc.DimensionContinueData.endDimensionContinueData(b);
|
|
1146
|
+
})()
|
|
1147
|
+
: undefined;
|
|
1148
|
+
Duc.DucDimensionElement.startDucDimensionElement(b);
|
|
1149
|
+
Duc.DucDimensionElement.addBase(b, base);
|
|
1150
|
+
Duc.DucDimensionElement.addStyle(b, style);
|
|
1151
|
+
Duc.DucDimensionElement.addDimensionType(b, e.dimensionType);
|
|
1152
|
+
Duc.DucDimensionElement.addDefinitionPoints(b, def);
|
|
1153
|
+
Duc.DucDimensionElement.addObliqueAngle(b, e.obliqueAngle);
|
|
1154
|
+
if (e.ordinateAxis)
|
|
1155
|
+
Duc.DucDimensionElement.addOrdinateAxis(b, e.ordinateAxis);
|
|
1156
|
+
if (bindings)
|
|
1157
|
+
Duc.DucDimensionElement.addBindings(b, bindings);
|
|
1158
|
+
if (textOverride)
|
|
1159
|
+
Duc.DucDimensionElement.addTextOverride(b, textOverride);
|
|
1160
|
+
if (textPos)
|
|
1161
|
+
Duc.DucDimensionElement.addTextPosition(b, textPos);
|
|
1162
|
+
if (tolOverride)
|
|
1163
|
+
Duc.DucDimensionElement.addToleranceOverride(b, tolOverride);
|
|
1164
|
+
if (baseline)
|
|
1165
|
+
Duc.DucDimensionElement.addBaselineData(b, baseline);
|
|
1166
|
+
if (cont)
|
|
1167
|
+
Duc.DucDimensionElement.addContinueData(b, cont);
|
|
1168
|
+
return Duc.DucDimensionElement.endDucDimensionElement(b);
|
|
1169
|
+
}
|
|
1170
|
+
function writeDatumRef(b, d, usv) {
|
|
1171
|
+
const letters = b.createString(d.letters);
|
|
1172
|
+
Duc.DatumReference.startDatumReference(b);
|
|
1173
|
+
Duc.DatumReference.addLetters(b, letters);
|
|
1174
|
+
if (d.modifier)
|
|
1175
|
+
Duc.DatumReference.addModifier(b, d.modifier);
|
|
1176
|
+
return Duc.DatumReference.endDatumReference(b);
|
|
1177
|
+
}
|
|
1178
|
+
function writeToleranceClause(b, t, usv) {
|
|
1179
|
+
var _a;
|
|
1180
|
+
const value = b.createString(t.value);
|
|
1181
|
+
const featureMods = ((_a = t.featureModifiers) === null || _a === void 0 ? void 0 : _a.length)
|
|
1182
|
+
? Duc.ToleranceClause.createFeatureModifiersVector(b, t.featureModifiers.map((f) => f))
|
|
1183
|
+
: undefined;
|
|
1184
|
+
Duc.ToleranceClause.startToleranceClause(b);
|
|
1185
|
+
Duc.ToleranceClause.addValue(b, value);
|
|
1186
|
+
if (t.zoneType)
|
|
1187
|
+
Duc.ToleranceClause.addZoneType(b, t.zoneType);
|
|
1188
|
+
if (featureMods)
|
|
1189
|
+
Duc.ToleranceClause.addFeatureModifiers(b, featureMods);
|
|
1190
|
+
if (t.materialCondition)
|
|
1191
|
+
Duc.ToleranceClause.addMaterialCondition(b, t.materialCondition);
|
|
1192
|
+
return Duc.ToleranceClause.endToleranceClause(b);
|
|
1193
|
+
}
|
|
1194
|
+
function writeFcfSegment(b, s, usv) {
|
|
1195
|
+
var _a;
|
|
1196
|
+
const tol = writeToleranceClause(b, s.tolerance, usv);
|
|
1197
|
+
const datums = ((_a = s.datums) === null || _a === void 0 ? void 0 : _a.length) ? Duc.FeatureControlFrameSegment.createDatumsVector(b, s.datums.filter(Boolean).map((d) => writeDatumRef(b, d, usv))) : undefined;
|
|
1198
|
+
Duc.FeatureControlFrameSegment.startFeatureControlFrameSegment(b);
|
|
1199
|
+
Duc.FeatureControlFrameSegment.addSymbol(b, s.symbol);
|
|
1200
|
+
Duc.FeatureControlFrameSegment.addTolerance(b, tol);
|
|
1201
|
+
if (datums)
|
|
1202
|
+
Duc.FeatureControlFrameSegment.addDatums(b, datums);
|
|
1203
|
+
return Duc.FeatureControlFrameSegment.endFeatureControlFrameSegment(b);
|
|
1204
|
+
}
|
|
1205
|
+
function writeFcfSegmentRow(b, row, usv) {
|
|
1206
|
+
const segs = Duc.FCFSegmentRow.createSegmentsVector(b, row.map((s) => writeFcfSegment(b, s, usv)));
|
|
1207
|
+
Duc.FCFSegmentRow.startFCFSegmentRow(b);
|
|
1208
|
+
Duc.FCFSegmentRow.addSegments(b, segs);
|
|
1209
|
+
return Duc.FCFSegmentRow.endFCFSegmentRow(b);
|
|
1210
|
+
}
|
|
1211
|
+
function writeFcfBetween(b, v, usv) {
|
|
1212
|
+
const s = b.createString(v.start);
|
|
1213
|
+
const e = b.createString(v.end);
|
|
1214
|
+
Duc.FCFBetweenModifier.startFCFBetweenModifier(b);
|
|
1215
|
+
Duc.FCFBetweenModifier.addStart(b, s);
|
|
1216
|
+
Duc.FCFBetweenModifier.addEnd(b, e);
|
|
1217
|
+
return Duc.FCFBetweenModifier.endFCFBetweenModifier(b);
|
|
1218
|
+
}
|
|
1219
|
+
function writeProjectedZone(b, v, usv) {
|
|
1220
|
+
Duc.FCFProjectedZoneModifier.startFCFProjectedZoneModifier(b);
|
|
1221
|
+
Duc.FCFProjectedZoneModifier.addValue(b, getPrecisionValue(v, usv));
|
|
1222
|
+
return Duc.FCFProjectedZoneModifier.endFCFProjectedZoneModifier(b);
|
|
1223
|
+
}
|
|
1224
|
+
function writeFcfFrameModifiers(b, m, usv) {
|
|
1225
|
+
if (!m)
|
|
1226
|
+
return undefined;
|
|
1227
|
+
Duc.FCFFrameModifiers.startFCFFrameModifiers(b);
|
|
1228
|
+
if (m.allAround !== undefined)
|
|
1229
|
+
Duc.FCFFrameModifiers.addAllAround(b, m.allAround);
|
|
1230
|
+
if (m.allOver !== undefined)
|
|
1231
|
+
Duc.FCFFrameModifiers.addAllOver(b, m.allOver);
|
|
1232
|
+
if (m.continuousFeature !== undefined)
|
|
1233
|
+
Duc.FCFFrameModifiers.addContinuousFeature(b, m.continuousFeature);
|
|
1234
|
+
if (m.between)
|
|
1235
|
+
Duc.FCFFrameModifiers.addBetween(b, writeFcfBetween(b, m.between, usv));
|
|
1236
|
+
if (m.projectedToleranceZone)
|
|
1237
|
+
Duc.FCFFrameModifiers.addProjectedToleranceZone(b, writeProjectedZone(b, m.projectedToleranceZone, usv));
|
|
1238
|
+
return Duc.FCFFrameModifiers.endFCFFrameModifiers(b);
|
|
1239
|
+
}
|
|
1240
|
+
function writeFcfDatumDefinition(b, d, usv) {
|
|
1241
|
+
if (!d)
|
|
1242
|
+
return undefined;
|
|
1243
|
+
const letter = b.createString(d.letter);
|
|
1244
|
+
const binding = d.featureBinding ? writePointBinding(b, d.featureBinding, usv) : undefined;
|
|
1245
|
+
Duc.FCFDatumDefinition.startFCFDatumDefinition(b);
|
|
1246
|
+
Duc.FCFDatumDefinition.addLetter(b, letter);
|
|
1247
|
+
if (binding)
|
|
1248
|
+
Duc.FCFDatumDefinition.addFeatureBinding(b, binding);
|
|
1249
|
+
return Duc.FCFDatumDefinition.endFCFDatumDefinition(b);
|
|
1250
|
+
}
|
|
1251
|
+
function writeFcfStyle(b, s, usv) {
|
|
1252
|
+
const base = writeStylesBase(b, s, usv);
|
|
1253
|
+
const text = writeTextStyle(b, s.textStyle, usv);
|
|
1254
|
+
const layout = (() => {
|
|
1255
|
+
Duc.FCFLayoutStyle.startFCFLayoutStyle(b);
|
|
1256
|
+
Duc.FCFLayoutStyle.addPadding(b, getPrecisionValue(s.layout.padding, usv));
|
|
1257
|
+
Duc.FCFLayoutStyle.addSegmentSpacing(b, getPrecisionValue(s.layout.segmentSpacing, usv));
|
|
1258
|
+
Duc.FCFLayoutStyle.addRowSpacing(b, getPrecisionValue(s.layout.rowSpacing, usv));
|
|
1259
|
+
return Duc.FCFLayoutStyle.endFCFLayoutStyle(b);
|
|
1260
|
+
})();
|
|
1261
|
+
const sym = (() => {
|
|
1262
|
+
Duc.FCFSymbolStyle.startFCFSymbolStyle(b);
|
|
1263
|
+
Duc.FCFSymbolStyle.addScale(b, s.symbols.scale);
|
|
1264
|
+
return Duc.FCFSymbolStyle.endFCFSymbolStyle(b);
|
|
1265
|
+
})();
|
|
1266
|
+
const datum = (() => {
|
|
1267
|
+
Duc.FCFDatumStyle.startFCFDatumStyle(b);
|
|
1268
|
+
Duc.FCFDatumStyle.addBracketStyle(b, s.datumStyle.bracketStyle);
|
|
1269
|
+
return Duc.FCFDatumStyle.endFCFDatumStyle(b);
|
|
1270
|
+
})();
|
|
1271
|
+
Duc.DucFeatureControlFrameStyle.startDucFeatureControlFrameStyle(b);
|
|
1272
|
+
if (base)
|
|
1273
|
+
Duc.DucFeatureControlFrameStyle.addBaseStyle(b, base);
|
|
1274
|
+
Duc.DucFeatureControlFrameStyle.addTextStyle(b, text);
|
|
1275
|
+
Duc.DucFeatureControlFrameStyle.addLayout(b, layout);
|
|
1276
|
+
Duc.DucFeatureControlFrameStyle.addSymbols(b, sym);
|
|
1277
|
+
Duc.DucFeatureControlFrameStyle.addDatumStyle(b, datum);
|
|
1278
|
+
return Duc.DucFeatureControlFrameStyle.endDucFeatureControlFrameStyle(b);
|
|
1279
|
+
}
|
|
1280
|
+
function writeFcf(b, e, usv) {
|
|
1281
|
+
const base = writeElementBase(b, e, usv);
|
|
1282
|
+
const style = writeFcfStyle(b, e, usv);
|
|
1283
|
+
const rows = Duc.DucFeatureControlFrameElement.createRowsVector(b, e.rows.map((r) => writeFcfSegmentRow(b, r, usv)));
|
|
1284
|
+
const mods = writeFcfFrameModifiers(b, e.frameModifiers, usv);
|
|
1285
|
+
const leaderId = e.leaderElementId ? b.createString(e.leaderElementId) : undefined;
|
|
1286
|
+
const datumDef = writeFcfDatumDefinition(b, e.datumDefinition, usv);
|
|
1287
|
+
Duc.DucFeatureControlFrameElement.startDucFeatureControlFrameElement(b);
|
|
1288
|
+
Duc.DucFeatureControlFrameElement.addBase(b, base);
|
|
1289
|
+
Duc.DucFeatureControlFrameElement.addStyle(b, style);
|
|
1290
|
+
Duc.DucFeatureControlFrameElement.addRows(b, rows);
|
|
1291
|
+
if (mods)
|
|
1292
|
+
Duc.DucFeatureControlFrameElement.addFrameModifiers(b, mods);
|
|
1293
|
+
if (leaderId)
|
|
1294
|
+
Duc.DucFeatureControlFrameElement.addLeaderElementId(b, leaderId);
|
|
1295
|
+
if (datumDef)
|
|
1296
|
+
Duc.DucFeatureControlFrameElement.addDatumDefinition(b, datumDef);
|
|
1297
|
+
return Duc.DucFeatureControlFrameElement.endDucFeatureControlFrameElement(b);
|
|
1298
|
+
}
|
|
1299
|
+
/**
|
|
1300
|
+
* Doc element
|
|
1301
|
+
*/
|
|
1302
|
+
function writeDoc(b, e, usv) {
|
|
1303
|
+
const base = writeElementBase(b, e, usv);
|
|
1304
|
+
const style = writeDocStyle(b, e, usv);
|
|
1305
|
+
const text = b.createString(e.text);
|
|
1306
|
+
const dynamic = Duc.DucDocElement.createDynamicVector(b, e.dynamic.map((d) => writeTextDynamicPart(b, d, usv)));
|
|
1307
|
+
const columns = (() => {
|
|
1308
|
+
const col = e.columns;
|
|
1309
|
+
const defs = Duc.ColumnLayout.createDefinitionsVector(b, col.definitions.map((d) => writeTextColumn(b, d, usv)));
|
|
1310
|
+
Duc.ColumnLayout.startColumnLayout(b);
|
|
1311
|
+
Duc.ColumnLayout.addType(b, col.type);
|
|
1312
|
+
Duc.ColumnLayout.addDefinitions(b, defs);
|
|
1313
|
+
Duc.ColumnLayout.addAutoHeight(b, col.autoHeight);
|
|
1314
|
+
return Duc.ColumnLayout.endColumnLayout(b);
|
|
1315
|
+
})();
|
|
1316
|
+
Duc.DucDocElement.startDucDocElement(b);
|
|
1317
|
+
Duc.DucDocElement.addBase(b, base);
|
|
1318
|
+
Duc.DucDocElement.addStyle(b, style);
|
|
1319
|
+
Duc.DucDocElement.addText(b, text);
|
|
1320
|
+
Duc.DucDocElement.addDynamic(b, dynamic);
|
|
1321
|
+
Duc.DucDocElement.addFlowDirection(b, e.flowDirection);
|
|
1322
|
+
Duc.DucDocElement.addColumns(b, columns);
|
|
1323
|
+
Duc.DucDocElement.addAutoResize(b, e.autoResize);
|
|
1324
|
+
return Duc.DucDocElement.endDucDocElement(b);
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* Parametric, PDF, Mermaid, Embeddable
|
|
1328
|
+
*/
|
|
1329
|
+
function writeParametricSource(b, s, usv) {
|
|
1330
|
+
Duc.ParametricSource.startParametricSource(b);
|
|
1331
|
+
Duc.ParametricSource.addType(b, s.type);
|
|
1332
|
+
if (s.type === Duc.PARAMETRIC_SOURCE_TYPE.CODE) {
|
|
1333
|
+
Duc.ParametricSource.addCode(b, b.createString(s.code));
|
|
1334
|
+
}
|
|
1335
|
+
else {
|
|
1336
|
+
Duc.ParametricSource.addFileId(b, b.createString(s.fileId));
|
|
1337
|
+
}
|
|
1338
|
+
return Duc.ParametricSource.endParametricSource(b);
|
|
1339
|
+
}
|
|
1340
|
+
function writeParametric(b, e, usv) {
|
|
1341
|
+
const base = writeElementBase(b, e, usv);
|
|
1342
|
+
const src = writeParametricSource(b, e.source, usv);
|
|
1343
|
+
Duc.DucParametricElement.startDucParametricElement(b);
|
|
1344
|
+
Duc.DucParametricElement.addBase(b, base);
|
|
1345
|
+
Duc.DucParametricElement.addSource(b, src);
|
|
1346
|
+
return Duc.DucParametricElement.endDucParametricElement(b);
|
|
1347
|
+
}
|
|
1348
|
+
function writePdf(b, e, usv) {
|
|
1349
|
+
const base = writeElementBase(b, e, usv);
|
|
1350
|
+
const fileId = b.createString(e.fileId);
|
|
1351
|
+
Duc.DucPdfElement.startDucPdfElement(b);
|
|
1352
|
+
Duc.DucPdfElement.addBase(b, base);
|
|
1353
|
+
Duc.DucPdfElement.addFileId(b, fileId);
|
|
1354
|
+
return Duc.DucPdfElement.endDucPdfElement(b);
|
|
1355
|
+
}
|
|
1356
|
+
function writeMermaid(b, e, usv) {
|
|
1357
|
+
const base = writeElementBase(b, e, usv);
|
|
1358
|
+
const src = b.createString(e.source);
|
|
1359
|
+
const theme = e.theme ? b.createString(e.theme) : undefined;
|
|
1360
|
+
const svg = e.svgPath ? b.createString(e.svgPath) : undefined;
|
|
1361
|
+
Duc.DucMermaidElement.startDucMermaidElement(b);
|
|
1362
|
+
Duc.DucMermaidElement.addBase(b, base);
|
|
1363
|
+
Duc.DucMermaidElement.addSource(b, src);
|
|
1364
|
+
if (theme)
|
|
1365
|
+
Duc.DucMermaidElement.addTheme(b, theme);
|
|
1366
|
+
if (svg)
|
|
1367
|
+
Duc.DucMermaidElement.addSvgPath(b, svg);
|
|
1368
|
+
return Duc.DucMermaidElement.endDucMermaidElement(b);
|
|
1369
|
+
}
|
|
1370
|
+
function writeEmbeddable(b, e, usv) {
|
|
1371
|
+
const base = writeElementBase(b, e, usv);
|
|
1372
|
+
Duc.DucEmbeddableElement.startDucEmbeddableElement(b);
|
|
1373
|
+
Duc.DucEmbeddableElement.addBase(b, base);
|
|
1374
|
+
return Duc.DucEmbeddableElement.endDucEmbeddableElement(b);
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* Table
|
|
1378
|
+
*/
|
|
1379
|
+
function writeTableCellStyle(b, s, usv) {
|
|
1380
|
+
const base = writeStylesBase(b, s, usv);
|
|
1381
|
+
const text = writeTextStyle(b, s.textStyle, usv);
|
|
1382
|
+
Duc.Margins.startMargins(b);
|
|
1383
|
+
Duc.Margins.addTop(b, getPrecisionValue(s.margins.top, usv));
|
|
1384
|
+
Duc.Margins.addRight(b, getPrecisionValue(s.margins.right, usv));
|
|
1385
|
+
Duc.Margins.addBottom(b, getPrecisionValue(s.margins.bottom, usv));
|
|
1386
|
+
Duc.Margins.addLeft(b, getPrecisionValue(s.margins.left, usv));
|
|
1387
|
+
const margins = Duc.Margins.endMargins(b);
|
|
1388
|
+
Duc.DucTableCellStyle.startDucTableCellStyle(b);
|
|
1389
|
+
if (base)
|
|
1390
|
+
Duc.DucTableCellStyle.addBaseStyle(b, base);
|
|
1391
|
+
Duc.DucTableCellStyle.addTextStyle(b, text);
|
|
1392
|
+
Duc.DucTableCellStyle.addMargins(b, margins);
|
|
1393
|
+
Duc.DucTableCellStyle.addAlignment(b, s.alignment);
|
|
1394
|
+
return Duc.DucTableCellStyle.endDucTableCellStyle(b);
|
|
1395
|
+
}
|
|
1396
|
+
function writeTableStyle(b, s, usv) {
|
|
1397
|
+
const base = writeStylesBase(b, s, usv);
|
|
1398
|
+
const header = writeTableCellStyle(b, s.headerRowStyle, usv);
|
|
1399
|
+
const dataRow = writeTableCellStyle(b, s.dataRowStyle, usv);
|
|
1400
|
+
const dataCol = writeTableCellStyle(b, s.dataColumnStyle, usv);
|
|
1401
|
+
Duc.DucTableStyle.startDucTableStyle(b);
|
|
1402
|
+
if (base)
|
|
1403
|
+
Duc.DucTableStyle.addBaseStyle(b, base);
|
|
1404
|
+
Duc.DucTableStyle.addFlowDirection(b, s.flowDirection);
|
|
1405
|
+
Duc.DucTableStyle.addHeaderRowStyle(b, header);
|
|
1406
|
+
Duc.DucTableStyle.addDataRowStyle(b, dataRow);
|
|
1407
|
+
Duc.DucTableStyle.addDataColumnStyle(b, dataCol);
|
|
1408
|
+
return Duc.DucTableStyle.endDucTableStyle(b);
|
|
1409
|
+
}
|
|
1410
|
+
function writeTable(b, e, usv) {
|
|
1411
|
+
const base = writeElementBase(b, e, usv);
|
|
1412
|
+
const style = writeTableStyle(b, e, usv);
|
|
1413
|
+
const colOrder = Duc.DucTableElement.createColumnOrderVector(b, e.columnOrder.map((id) => b.createString(id)));
|
|
1414
|
+
const rowOrder = Duc.DucTableElement.createRowOrderVector(b, e.rowOrder.map((id) => b.createString(id)));
|
|
1415
|
+
const columns = Duc.DucTableElement.createColumnsVector(b, Object.entries(e.columns).map(([k, v]) => {
|
|
1416
|
+
const key = b.createString(k);
|
|
1417
|
+
const val = (() => {
|
|
1418
|
+
const id = b.createString(v.id);
|
|
1419
|
+
Duc.DucTableColumn.startDucTableColumn(b);
|
|
1420
|
+
Duc.DucTableColumn.addId(b, id);
|
|
1421
|
+
Duc.DucTableColumn.addWidth(b, getPrecisionValue(v.width, usv));
|
|
1422
|
+
const styleOverrides = v.styleOverrides ? writeTableCellStyle(b, v.styleOverrides, usv) : undefined;
|
|
1423
|
+
if (styleOverrides)
|
|
1424
|
+
Duc.DucTableColumn.addStyleOverrides(b, styleOverrides);
|
|
1425
|
+
return Duc.DucTableColumn.endDucTableColumn(b);
|
|
1426
|
+
})();
|
|
1427
|
+
Duc.DucTableColumnEntry.startDucTableColumnEntry(b);
|
|
1428
|
+
Duc.DucTableColumnEntry.addKey(b, key);
|
|
1429
|
+
Duc.DucTableColumnEntry.addValue(b, val);
|
|
1430
|
+
return Duc.DucTableColumnEntry.endDucTableColumnEntry(b);
|
|
1431
|
+
}));
|
|
1432
|
+
const rows = Duc.DucTableElement.createRowsVector(b, Object.entries(e.rows).map(([k, v]) => {
|
|
1433
|
+
const key = b.createString(k);
|
|
1434
|
+
const val = (() => {
|
|
1435
|
+
const id = b.createString(v.id);
|
|
1436
|
+
Duc.DucTableRow.startDucTableRow(b);
|
|
1437
|
+
Duc.DucTableRow.addId(b, id);
|
|
1438
|
+
Duc.DucTableRow.addHeight(b, getPrecisionValue(v.height, usv));
|
|
1439
|
+
const styleOverrides = v.styleOverrides ? writeTableCellStyle(b, v.styleOverrides, usv) : undefined;
|
|
1440
|
+
if (styleOverrides)
|
|
1441
|
+
Duc.DucTableRow.addStyleOverrides(b, styleOverrides);
|
|
1442
|
+
return Duc.DucTableRow.endDucTableRow(b);
|
|
1443
|
+
})();
|
|
1444
|
+
Duc.DucTableRowEntry.startDucTableRowEntry(b);
|
|
1445
|
+
Duc.DucTableRowEntry.addKey(b, key);
|
|
1446
|
+
Duc.DucTableRowEntry.addValue(b, val);
|
|
1447
|
+
return Duc.DucTableRowEntry.endDucTableRowEntry(b);
|
|
1448
|
+
}));
|
|
1449
|
+
const cells = Duc.DucTableElement.createCellsVector(b, Object.entries(e.cells).map(([k, v]) => {
|
|
1450
|
+
const key = b.createString(k);
|
|
1451
|
+
const val = (() => {
|
|
1452
|
+
const row = b.createString(v.rowId);
|
|
1453
|
+
const col = b.createString(v.columnId);
|
|
1454
|
+
const data = b.createString(v.data);
|
|
1455
|
+
const span = v.span
|
|
1456
|
+
? (() => {
|
|
1457
|
+
Duc.DucTableCellSpan.startDucTableCellSpan(b);
|
|
1458
|
+
Duc.DucTableCellSpan.addColumns(b, v.span.columns);
|
|
1459
|
+
Duc.DucTableCellSpan.addRows(b, v.span.rows);
|
|
1460
|
+
return Duc.DucTableCellSpan.endDucTableCellSpan(b);
|
|
1461
|
+
})()
|
|
1462
|
+
: undefined;
|
|
1463
|
+
const styleOverrides = v.styleOverrides ? writeTableCellStyle(b, v.styleOverrides, usv) : undefined;
|
|
1464
|
+
Duc.DucTableCell.startDucTableCell(b);
|
|
1465
|
+
Duc.DucTableCell.addRowId(b, row);
|
|
1466
|
+
Duc.DucTableCell.addColumnId(b, col);
|
|
1467
|
+
Duc.DucTableCell.addData(b, data);
|
|
1468
|
+
if (span !== undefined)
|
|
1469
|
+
Duc.DucTableCell.addSpan(b, span);
|
|
1470
|
+
Duc.DucTableCell.addLocked(b, v.locked);
|
|
1471
|
+
if (styleOverrides)
|
|
1472
|
+
Duc.DucTableCell.addStyleOverrides(b, styleOverrides);
|
|
1473
|
+
return Duc.DucTableCell.endDucTableCell(b);
|
|
1474
|
+
})();
|
|
1475
|
+
Duc.DucTableCellEntry.startDucTableCellEntry(b);
|
|
1476
|
+
Duc.DucTableCellEntry.addKey(b, key);
|
|
1477
|
+
Duc.DucTableCellEntry.addValue(b, val);
|
|
1478
|
+
return Duc.DucTableCellEntry.endDucTableCellEntry(b);
|
|
1479
|
+
}));
|
|
1480
|
+
const autoSize = (() => {
|
|
1481
|
+
Duc.DucTableAutoSize.startDucTableAutoSize(b);
|
|
1482
|
+
Duc.DucTableAutoSize.addColumns(b, e.autoSize.columns);
|
|
1483
|
+
Duc.DucTableAutoSize.addRows(b, e.autoSize.rows);
|
|
1484
|
+
return Duc.DucTableAutoSize.endDucTableAutoSize(b);
|
|
1485
|
+
})();
|
|
1486
|
+
Duc.DucTableElement.startDucTableElement(b);
|
|
1487
|
+
Duc.DucTableElement.addBase(b, base);
|
|
1488
|
+
Duc.DucTableElement.addStyle(b, style);
|
|
1489
|
+
Duc.DucTableElement.addColumnOrder(b, colOrder);
|
|
1490
|
+
Duc.DucTableElement.addRowOrder(b, rowOrder);
|
|
1491
|
+
Duc.DucTableElement.addColumns(b, columns);
|
|
1492
|
+
Duc.DucTableElement.addRows(b, rows);
|
|
1493
|
+
Duc.DucTableElement.addCells(b, cells);
|
|
1494
|
+
Duc.DucTableElement.addHeaderRowCount(b, e.headerRowCount);
|
|
1495
|
+
Duc.DucTableElement.addAutoSize(b, autoSize);
|
|
1496
|
+
return Duc.DucTableElement.endDucTableElement(b);
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* Element wrapper
|
|
1500
|
+
*/
|
|
1501
|
+
function writeElementWrapper(b, e, usv) {
|
|
1502
|
+
let elem;
|
|
1503
|
+
let type;
|
|
1504
|
+
switch (e.type) {
|
|
1505
|
+
case "rectangle":
|
|
1506
|
+
type = Duc.Element.DucRectangleElement;
|
|
1507
|
+
elem = writeRect(b, e, usv);
|
|
1508
|
+
break;
|
|
1509
|
+
case "polygon":
|
|
1510
|
+
type = Duc.Element.DucPolygonElement;
|
|
1511
|
+
elem = writePolygon(b, e, usv);
|
|
1512
|
+
break;
|
|
1513
|
+
case "ellipse":
|
|
1514
|
+
type = Duc.Element.DucEllipseElement;
|
|
1515
|
+
elem = writeEllipse(b, e, usv);
|
|
1516
|
+
break;
|
|
1517
|
+
case "line":
|
|
1518
|
+
type = Duc.Element.DucLinearElement;
|
|
1519
|
+
elem = writeLinear(b, e, usv);
|
|
1520
|
+
break;
|
|
1521
|
+
case "text":
|
|
1522
|
+
type = Duc.Element.DucTextElement;
|
|
1523
|
+
elem = writeText(b, e, usv);
|
|
1524
|
+
break;
|
|
1525
|
+
case "arrow":
|
|
1526
|
+
type = Duc.Element.DucArrowElement;
|
|
1527
|
+
elem = writeArrow(b, e, usv);
|
|
1528
|
+
break;
|
|
1529
|
+
case "freedraw":
|
|
1530
|
+
type = Duc.Element.DucFreeDrawElement;
|
|
1531
|
+
elem = writeFreeDraw(b, e, usv);
|
|
1532
|
+
break;
|
|
1533
|
+
case "image":
|
|
1534
|
+
type = Duc.Element.DucImageElement;
|
|
1535
|
+
elem = writeImage(b, e, usv);
|
|
1536
|
+
break;
|
|
1537
|
+
case "table":
|
|
1538
|
+
type = Duc.Element.DucTableElement;
|
|
1539
|
+
elem = writeTable(b, e, usv);
|
|
1540
|
+
break;
|
|
1541
|
+
case "blockinstance":
|
|
1542
|
+
type = Duc.Element.DucBlockInstanceElement;
|
|
1543
|
+
elem = writeBlockInstance(b, e, usv);
|
|
1544
|
+
break;
|
|
1545
|
+
case "frame":
|
|
1546
|
+
type = Duc.Element.DucFrameElement;
|
|
1547
|
+
elem = writeFrame(b, e, usv);
|
|
1548
|
+
break;
|
|
1549
|
+
case "plot":
|
|
1550
|
+
type = Duc.Element.DucPlotElement;
|
|
1551
|
+
elem = writePlot(b, e, usv);
|
|
1552
|
+
break;
|
|
1553
|
+
case "viewport":
|
|
1554
|
+
type = Duc.Element.DucViewportElement;
|
|
1555
|
+
elem = writeViewport(b, e, usv);
|
|
1556
|
+
break;
|
|
1557
|
+
case "xray":
|
|
1558
|
+
type = Duc.Element.DucXRayElement;
|
|
1559
|
+
elem = writeXRay(b, e, usv);
|
|
1560
|
+
break;
|
|
1561
|
+
case "leader":
|
|
1562
|
+
type = Duc.Element.DucLeaderElement;
|
|
1563
|
+
elem = writeLeader(b, e, usv);
|
|
1564
|
+
break;
|
|
1565
|
+
case "dimension":
|
|
1566
|
+
type = Duc.Element.DucDimensionElement;
|
|
1567
|
+
elem = writeDimension(b, e, usv);
|
|
1568
|
+
break;
|
|
1569
|
+
case "featurecontrolframe":
|
|
1570
|
+
type = Duc.Element.DucFeatureControlFrameElement;
|
|
1571
|
+
elem = writeFcf(b, e, usv);
|
|
1572
|
+
break;
|
|
1573
|
+
case "doc":
|
|
1574
|
+
type = Duc.Element.DucDocElement;
|
|
1575
|
+
elem = writeDoc(b, e, usv);
|
|
1576
|
+
break;
|
|
1577
|
+
case "parametric":
|
|
1578
|
+
type = Duc.Element.DucParametricElement;
|
|
1579
|
+
elem = writeParametric(b, e, usv);
|
|
1580
|
+
break;
|
|
1581
|
+
case "embeddable":
|
|
1582
|
+
type = Duc.Element.DucEmbeddableElement;
|
|
1583
|
+
elem = writeEmbeddable(b, e, usv);
|
|
1584
|
+
break;
|
|
1585
|
+
case "pdf":
|
|
1586
|
+
type = Duc.Element.DucPdfElement;
|
|
1587
|
+
elem = writePdf(b, e, usv);
|
|
1588
|
+
break;
|
|
1589
|
+
case "mermaid":
|
|
1590
|
+
type = Duc.Element.DucMermaidElement;
|
|
1591
|
+
elem = writeMermaid(b, e, usv);
|
|
1592
|
+
break;
|
|
1593
|
+
default:
|
|
1594
|
+
throw new Error(`Unknown element type: ${e.type}`);
|
|
1595
|
+
}
|
|
1596
|
+
// Safety check to ensure elem is defined
|
|
1597
|
+
if (elem === undefined) {
|
|
1598
|
+
throw new Error(`Failed to serialize element of type ${e.type}`);
|
|
1599
|
+
}
|
|
1600
|
+
Duc.ElementWrapper.startElementWrapper(b);
|
|
1601
|
+
Duc.ElementWrapper.addElementType(b, type);
|
|
1602
|
+
Duc.ElementWrapper.addElement(b, elem);
|
|
1603
|
+
return Duc.ElementWrapper.endElementWrapper(b);
|
|
1604
|
+
}
|
|
1605
|
+
function writeGridStyle(b, s, usv) {
|
|
1606
|
+
const color = b.createString(s.color);
|
|
1607
|
+
const dash = Duc.GridStyle.createDashPatternVector(b, s.dashPattern);
|
|
1608
|
+
Duc.GridStyle.startGridStyle(b);
|
|
1609
|
+
Duc.GridStyle.addColor(b, color);
|
|
1610
|
+
Duc.GridStyle.addOpacity(b, s.opacity);
|
|
1611
|
+
Duc.GridStyle.addDashPattern(b, dash);
|
|
1612
|
+
return Duc.GridStyle.endGridStyle(b);
|
|
1613
|
+
}
|
|
1614
|
+
function writePolarGridSettings(b, p, usv) {
|
|
1615
|
+
Duc.PolarGridSettings.startPolarGridSettings(b);
|
|
1616
|
+
Duc.PolarGridSettings.addRadialDivisions(b, p.radialDivisions);
|
|
1617
|
+
Duc.PolarGridSettings.addRadialSpacing(b, getPrecisionValue(p.radialSpacing, usv));
|
|
1618
|
+
Duc.PolarGridSettings.addShowLabels(b, p.showLabels);
|
|
1619
|
+
return Duc.PolarGridSettings.endPolarGridSettings(b);
|
|
1620
|
+
}
|
|
1621
|
+
function writeIsometricGridSettings(b, i, usv) {
|
|
1622
|
+
Duc.IsometricGridSettings.startIsometricGridSettings(b);
|
|
1623
|
+
Duc.IsometricGridSettings.addLeftAngle(b, i.leftAngle);
|
|
1624
|
+
Duc.IsometricGridSettings.addRightAngle(b, i.rightAngle);
|
|
1625
|
+
return Duc.IsometricGridSettings.endIsometricGridSettings(b);
|
|
1626
|
+
}
|
|
1627
|
+
function writeGridSettings(b, g, usv) {
|
|
1628
|
+
const origin = Duc.GeometricPoint.createGeometricPoint(b, g.origin.x, g.origin.y);
|
|
1629
|
+
const major = writeGridStyle(b, g.majorStyle, usv);
|
|
1630
|
+
const minor = writeGridStyle(b, g.minorStyle, usv);
|
|
1631
|
+
const polar = g.polarSettings ? writePolarGridSettings(b, g.polarSettings, usv) : undefined;
|
|
1632
|
+
const iso = g.isometricSettings ? writeIsometricGridSettings(b, g.isometricSettings, usv) : undefined;
|
|
1633
|
+
Duc.GridSettings.startGridSettings(b);
|
|
1634
|
+
Duc.GridSettings.addType(b, g.type);
|
|
1635
|
+
Duc.GridSettings.addReadonly(b, g.readonly);
|
|
1636
|
+
Duc.GridSettings.addDisplayType(b, g.displayType);
|
|
1637
|
+
Duc.GridSettings.addIsAdaptive(b, g.isAdaptive);
|
|
1638
|
+
Duc.GridSettings.addXSpacing(b, getPrecisionValue(g.xSpacing, usv));
|
|
1639
|
+
Duc.GridSettings.addYSpacing(b, getPrecisionValue(g.ySpacing, usv));
|
|
1640
|
+
Duc.GridSettings.addSubdivisions(b, g.subdivisions);
|
|
1641
|
+
Duc.GridSettings.addOrigin(b, origin);
|
|
1642
|
+
Duc.GridSettings.addRotation(b, g.rotation);
|
|
1643
|
+
Duc.GridSettings.addFollowUcs(b, g.followUCS);
|
|
1644
|
+
Duc.GridSettings.addMajorStyle(b, major);
|
|
1645
|
+
Duc.GridSettings.addMinorStyle(b, minor);
|
|
1646
|
+
Duc.GridSettings.addShowMinor(b, g.showMinor);
|
|
1647
|
+
Duc.GridSettings.addMinZoom(b, g.minZoom);
|
|
1648
|
+
Duc.GridSettings.addMaxZoom(b, g.maxZoom);
|
|
1649
|
+
Duc.GridSettings.addAutoHide(b, g.autoHide);
|
|
1650
|
+
if (polar)
|
|
1651
|
+
Duc.GridSettings.addPolarSettings(b, polar);
|
|
1652
|
+
if (iso)
|
|
1653
|
+
Duc.GridSettings.addIsometricSettings(b, iso);
|
|
1654
|
+
Duc.GridSettings.addEnableSnapping(b, g.enableSnapping);
|
|
1655
|
+
return Duc.GridSettings.endGridSettings(b);
|
|
1656
|
+
}
|
|
1657
|
+
function writeSnapMarkerSettings(b, s, usv) {
|
|
1658
|
+
const styles = Duc.SnapMarkerSettings.createStylesVector(b, Object.entries(s.styles).map(([k, v]) => {
|
|
1659
|
+
Duc.SnapMarkerStyleEntry.startSnapMarkerStyleEntry(b);
|
|
1660
|
+
Duc.SnapMarkerStyleEntry.addKey(b, Number(k));
|
|
1661
|
+
const color = b.createString(v.color);
|
|
1662
|
+
Duc.SnapMarkerStyle.startSnapMarkerStyle(b);
|
|
1663
|
+
Duc.SnapMarkerStyle.addShape(b, v.shape);
|
|
1664
|
+
Duc.SnapMarkerStyle.addColor(b, color);
|
|
1665
|
+
const val = Duc.SnapMarkerStyle.endSnapMarkerStyle(b);
|
|
1666
|
+
Duc.SnapMarkerStyleEntry.addValue(b, val);
|
|
1667
|
+
return Duc.SnapMarkerStyleEntry.endSnapMarkerStyleEntry(b);
|
|
1668
|
+
}));
|
|
1669
|
+
Duc.SnapMarkerSettings.startSnapMarkerSettings(b);
|
|
1670
|
+
Duc.SnapMarkerSettings.addEnabled(b, s.enabled);
|
|
1671
|
+
Duc.SnapMarkerSettings.addSize(b, s.size);
|
|
1672
|
+
if (s.duration !== undefined)
|
|
1673
|
+
Duc.SnapMarkerSettings.addDuration(b, s.duration);
|
|
1674
|
+
Duc.SnapMarkerSettings.addStyles(b, styles);
|
|
1675
|
+
return Duc.SnapMarkerSettings.endSnapMarkerSettings(b);
|
|
1676
|
+
}
|
|
1677
|
+
function writeTrackingLineStyle(b, t, usv) {
|
|
1678
|
+
if (!t)
|
|
1679
|
+
return undefined;
|
|
1680
|
+
const color = b.createString(t.color);
|
|
1681
|
+
const dash = t.dashPattern ? Duc.TrackingLineStyle.createDashPatternVector(b, t.dashPattern) : undefined;
|
|
1682
|
+
Duc.TrackingLineStyle.startTrackingLineStyle(b);
|
|
1683
|
+
Duc.TrackingLineStyle.addColor(b, color);
|
|
1684
|
+
Duc.TrackingLineStyle.addOpacity(b, t.opacity);
|
|
1685
|
+
if (dash)
|
|
1686
|
+
Duc.TrackingLineStyle.addDashPattern(b, dash);
|
|
1687
|
+
return Duc.TrackingLineStyle.endTrackingLineStyle(b);
|
|
1688
|
+
}
|
|
1689
|
+
function writeDynamicSnapSettings(b, d, usv) {
|
|
1690
|
+
Duc.DynamicSnapSettings.startDynamicSnapSettings(b);
|
|
1691
|
+
Duc.DynamicSnapSettings.addEnabledDuringDrag(b, d.enabledDuringDrag);
|
|
1692
|
+
Duc.DynamicSnapSettings.addEnabledDuringRotation(b, d.enabledDuringRotation);
|
|
1693
|
+
Duc.DynamicSnapSettings.addEnabledDuringScale(b, d.enabledDuringScale);
|
|
1694
|
+
return Duc.DynamicSnapSettings.endDynamicSnapSettings(b);
|
|
1695
|
+
}
|
|
1696
|
+
function writeSnapOverride(b, o, usv) {
|
|
1697
|
+
const key = b.createString(o.key);
|
|
1698
|
+
Duc.SnapOverride.startSnapOverride(b);
|
|
1699
|
+
Duc.SnapOverride.addKey(b, key);
|
|
1700
|
+
Duc.SnapOverride.addBehavior(b, o.behavior);
|
|
1701
|
+
return Duc.SnapOverride.endSnapOverride(b);
|
|
1702
|
+
}
|
|
1703
|
+
function writePolarTrackingSettings(b, p, usv) {
|
|
1704
|
+
const angles = Duc.PolarTrackingSettings.createAnglesVector(b, p.angles.map(a => a));
|
|
1705
|
+
Duc.PolarTrackingSettings.startPolarTrackingSettings(b);
|
|
1706
|
+
Duc.PolarTrackingSettings.addEnabled(b, p.enabled);
|
|
1707
|
+
Duc.PolarTrackingSettings.addAngles(b, angles);
|
|
1708
|
+
if (p.incrementAngle !== undefined)
|
|
1709
|
+
Duc.PolarTrackingSettings.addIncrementAngle(b, p.incrementAngle);
|
|
1710
|
+
Duc.PolarTrackingSettings.addTrackFromLastPoint(b, p.trackFromLastPoint);
|
|
1711
|
+
Duc.PolarTrackingSettings.addShowPolarCoordinates(b, p.showPolarCoordinates);
|
|
1712
|
+
return Duc.PolarTrackingSettings.endPolarTrackingSettings(b);
|
|
1713
|
+
}
|
|
1714
|
+
function writeLayerSnapFilters(b, f, usv) {
|
|
1715
|
+
if (!f)
|
|
1716
|
+
return undefined;
|
|
1717
|
+
const include = f.includeLayers ? Duc.LayerSnapFilters.createIncludeLayersVector(b, f.includeLayers.map(id => b.createString(id))) : undefined;
|
|
1718
|
+
const exclude = f.excludeLayers ? Duc.LayerSnapFilters.createExcludeLayersVector(b, f.excludeLayers.map(id => b.createString(id))) : undefined;
|
|
1719
|
+
Duc.LayerSnapFilters.startLayerSnapFilters(b);
|
|
1720
|
+
if (include)
|
|
1721
|
+
Duc.LayerSnapFilters.addIncludeLayers(b, include);
|
|
1722
|
+
if (exclude)
|
|
1723
|
+
Duc.LayerSnapFilters.addExcludeLayers(b, exclude);
|
|
1724
|
+
return Duc.LayerSnapFilters.endLayerSnapFilters(b);
|
|
1725
|
+
}
|
|
1726
|
+
function writeSnapSettings(b, s, usv) {
|
|
1727
|
+
var _a;
|
|
1728
|
+
const overridesArray = (_a = s.temporaryOverrides) !== null && _a !== void 0 ? _a : [];
|
|
1729
|
+
const overridesVec = overridesArray.length
|
|
1730
|
+
? Duc.SnapSettings.createTemporaryOverridesVector(b, overridesArray.map(o => writeSnapOverride(b, o, usv)))
|
|
1731
|
+
: undefined;
|
|
1732
|
+
const tracking = writeTrackingLineStyle(b, s.trackingLineStyle, usv);
|
|
1733
|
+
const dynamic = writeDynamicSnapSettings(b, s.dynamicSnap, usv);
|
|
1734
|
+
// Always build PolarTrackingSettings (constructor ensures required fields); no defaults introduced.
|
|
1735
|
+
const polar = writePolarTrackingSettings(b, s.polarTracking, usv);
|
|
1736
|
+
const layers = writeLayerSnapFilters(b, s.layerSnapFilters, usv);
|
|
1737
|
+
const markers = writeSnapMarkerSettings(b, s.snapMarkers, usv);
|
|
1738
|
+
const types = s.elementTypeFilters ? Duc.SnapSettings.createElementTypeFiltersVector(b, s.elementTypeFilters.map(t => {
|
|
1739
|
+
// element type enum is Duc.Element (wrapper), but here it's a string union.
|
|
1740
|
+
// The schema likely stores raw strings; we store as strings.
|
|
1741
|
+
return b.createString(t);
|
|
1742
|
+
})) : undefined;
|
|
1743
|
+
Duc.SnapSettings.startSnapSettings(b);
|
|
1744
|
+
Duc.SnapSettings.addReadonly(b, s.readonly);
|
|
1745
|
+
Duc.SnapSettings.addTwistAngle(b, s.twistAngle);
|
|
1746
|
+
Duc.SnapSettings.addSnapTolerance(b, s.snapTolerance);
|
|
1747
|
+
Duc.SnapSettings.addObjectSnapAperture(b, s.objectSnapAperture);
|
|
1748
|
+
Duc.SnapSettings.addIsOrthoModeOn(b, s.isOrthoModeOn);
|
|
1749
|
+
if (polar !== undefined)
|
|
1750
|
+
Duc.SnapSettings.addPolarTracking(b, polar);
|
|
1751
|
+
Duc.SnapSettings.addIsObjectSnapOn(b, s.isObjectSnapOn);
|
|
1752
|
+
Duc.SnapSettings.addActiveObjectSnapModes(b, Duc.SnapSettings.createActiveObjectSnapModesVector(b, s.activeObjectSnapModes));
|
|
1753
|
+
Duc.SnapSettings.addSnapPriority(b, Duc.SnapSettings.createSnapPriorityVector(b, s.snapPriority));
|
|
1754
|
+
Duc.SnapSettings.addShowTrackingLines(b, s.showTrackingLines);
|
|
1755
|
+
if (tracking)
|
|
1756
|
+
Duc.SnapSettings.addTrackingLineStyle(b, tracking);
|
|
1757
|
+
Duc.SnapSettings.addDynamicSnap(b, dynamic);
|
|
1758
|
+
if (overridesVec)
|
|
1759
|
+
Duc.SnapSettings.addTemporaryOverrides(b, overridesVec);
|
|
1760
|
+
if (s.incrementalDistance !== undefined)
|
|
1761
|
+
Duc.SnapSettings.addIncrementalDistance(b, s.incrementalDistance);
|
|
1762
|
+
if (s.magneticStrength !== undefined)
|
|
1763
|
+
Duc.SnapSettings.addMagneticStrength(b, s.magneticStrength);
|
|
1764
|
+
if (layers)
|
|
1765
|
+
Duc.SnapSettings.addLayerSnapFilters(b, layers);
|
|
1766
|
+
if (types)
|
|
1767
|
+
Duc.SnapSettings.addElementTypeFilters(b, types);
|
|
1768
|
+
Duc.SnapSettings.addSnapMode(b, s.snapMode);
|
|
1769
|
+
Duc.SnapSettings.addSnapMarkers(b, markers);
|
|
1770
|
+
Duc.SnapSettings.addConstructionSnapEnabled(b, s.constructionSnapEnabled);
|
|
1771
|
+
if (s.snapToGridIntersections !== undefined)
|
|
1772
|
+
Duc.SnapSettings.addSnapToGridIntersections(b, s.snapToGridIntersections);
|
|
1773
|
+
return Duc.SnapSettings.endSnapSettings(b);
|
|
1774
|
+
}
|
|
1775
|
+
function writeUcs(b, u) {
|
|
1776
|
+
const origin = Duc.GeometricPoint.createGeometricPoint(b, u.origin.x, u.origin.y);
|
|
1777
|
+
Duc.DucUcs.startDucUcs(b);
|
|
1778
|
+
Duc.DucUcs.addOrigin(b, origin);
|
|
1779
|
+
Duc.DucUcs.addAngle(b, u.angle);
|
|
1780
|
+
return Duc.DucUcs.endDucUcs(b);
|
|
1781
|
+
}
|
|
1782
|
+
function serializeStandardOverrides(b, o, usv) {
|
|
1783
|
+
const activeGrid = o.activeGridSettingsId ? Duc.StandardOverrides.createActiveGridSettingsIdVector(b, o.activeGridSettingsId.map(id => b.createString(id))) : undefined;
|
|
1784
|
+
const dashOverride = o.dashLineOverride ? b.createString(o.dashLineOverride) : undefined;
|
|
1785
|
+
Duc.StandardOverrides.startStandardOverrides(b);
|
|
1786
|
+
if (o.mainScope)
|
|
1787
|
+
Duc.StandardOverrides.addMainScope(b, b.createString(o.mainScope));
|
|
1788
|
+
if (o.elementsStrokeWidthOverride)
|
|
1789
|
+
Duc.StandardOverrides.addElementsStrokeWidthOverride(b, getPrecisionValue(o.elementsStrokeWidthOverride, usv));
|
|
1790
|
+
if (o.commonStyleId)
|
|
1791
|
+
Duc.StandardOverrides.addCommonStyleId(b, b.createString(o.commonStyleId));
|
|
1792
|
+
if (o.stackLikeStyleId)
|
|
1793
|
+
Duc.StandardOverrides.addStackLikeStyleId(b, b.createString(o.stackLikeStyleId));
|
|
1794
|
+
if (o.textStyleId)
|
|
1795
|
+
Duc.StandardOverrides.addTextStyleId(b, b.createString(o.textStyleId));
|
|
1796
|
+
if (o.dimensionStyleId)
|
|
1797
|
+
Duc.StandardOverrides.addDimensionStyleId(b, b.createString(o.dimensionStyleId));
|
|
1798
|
+
if (o.leaderStyleId)
|
|
1799
|
+
Duc.StandardOverrides.addLeaderStyleId(b, b.createString(o.leaderStyleId));
|
|
1800
|
+
if (o.featureControlFrameStyleId)
|
|
1801
|
+
Duc.StandardOverrides.addFeatureControlFrameStyleId(b, b.createString(o.featureControlFrameStyleId));
|
|
1802
|
+
if (o.tableStyleId)
|
|
1803
|
+
Duc.StandardOverrides.addTableStyleId(b, b.createString(o.tableStyleId));
|
|
1804
|
+
if (o.docStyleId)
|
|
1805
|
+
Duc.StandardOverrides.addDocStyleId(b, b.createString(o.docStyleId));
|
|
1806
|
+
if (o.viewportStyleId)
|
|
1807
|
+
Duc.StandardOverrides.addViewportStyleId(b, b.createString(o.viewportStyleId));
|
|
1808
|
+
if (o.plotStyleId)
|
|
1809
|
+
Duc.StandardOverrides.addPlotStyleId(b, b.createString(o.plotStyleId));
|
|
1810
|
+
if (o.hatchStyleId)
|
|
1811
|
+
Duc.StandardOverrides.addHatchStyleId(b, b.createString(o.hatchStyleId));
|
|
1812
|
+
if (activeGrid)
|
|
1813
|
+
Duc.StandardOverrides.addActiveGridSettingsId(b, activeGrid);
|
|
1814
|
+
if (o.activeSnapSettingsId)
|
|
1815
|
+
Duc.StandardOverrides.addActiveSnapSettingsId(b, b.createString(o.activeSnapSettingsId));
|
|
1816
|
+
if (dashOverride)
|
|
1817
|
+
Duc.StandardOverrides.addDashLineOverride(b, dashOverride);
|
|
1818
|
+
if (o.unitPrecision) {
|
|
1819
|
+
Duc.UnitPrecision.startUnitPrecision(b);
|
|
1820
|
+
if (o.unitPrecision.linear !== undefined)
|
|
1821
|
+
Duc.UnitPrecision.addLinear(b, o.unitPrecision.linear);
|
|
1822
|
+
if (o.unitPrecision.angular !== undefined)
|
|
1823
|
+
Duc.UnitPrecision.addAngular(b, o.unitPrecision.angular);
|
|
1824
|
+
if (o.unitPrecision.area !== undefined)
|
|
1825
|
+
Duc.UnitPrecision.addArea(b, o.unitPrecision.area);
|
|
1826
|
+
if (o.unitPrecision.volume !== undefined)
|
|
1827
|
+
Duc.UnitPrecision.addVolume(b, o.unitPrecision.volume);
|
|
1828
|
+
const up = Duc.UnitPrecision.endUnitPrecision(b);
|
|
1829
|
+
Duc.StandardOverrides.addUnitPrecision(b, up);
|
|
1830
|
+
}
|
|
1831
|
+
return Duc.StandardOverrides.endStandardOverrides(b);
|
|
1832
|
+
}
|
|
1833
|
+
function serializeStandardUnits(b, u, usv) {
|
|
1834
|
+
const primary = writePrimaryUnits(b, {
|
|
1835
|
+
linear: {
|
|
1836
|
+
system: u.primaryUnits.linear.system,
|
|
1837
|
+
precision: u.primaryUnits.linear.precision,
|
|
1838
|
+
suppressLeadingZeros: u.primaryUnits.linear.suppressLeadingZeros,
|
|
1839
|
+
suppressTrailingZeros: u.primaryUnits.linear.suppressTrailingZeros,
|
|
1840
|
+
format: u.primaryUnits.linear.format,
|
|
1841
|
+
decimalSeparator: u.primaryUnits.linear.decimalSeparator,
|
|
1842
|
+
suppressZeroFeet: u.primaryUnits.linear.suppressZeroFeet,
|
|
1843
|
+
suppressZeroInches: u.primaryUnits.linear.suppressZeroInches,
|
|
1844
|
+
},
|
|
1845
|
+
angular: {
|
|
1846
|
+
system: u.primaryUnits.angular.system,
|
|
1847
|
+
precision: u.primaryUnits.angular.precision,
|
|
1848
|
+
suppressLeadingZeros: u.primaryUnits.angular.suppressLeadingZeros,
|
|
1849
|
+
suppressTrailingZeros: u.primaryUnits.angular.suppressTrailingZeros,
|
|
1850
|
+
format: u.primaryUnits.angular.format,
|
|
1851
|
+
},
|
|
1852
|
+
}, usv);
|
|
1853
|
+
Duc.AlternateUnits.startAlternateUnits(b);
|
|
1854
|
+
Duc.AlternateUnits.addIsVisible(b, u.alternateUnits.isVisible);
|
|
1855
|
+
Duc.AlternateUnits.addMultiplier(b, u.alternateUnits.multiplier);
|
|
1856
|
+
Duc.AlternateUnits.addFormat(b, u.alternateUnits.format);
|
|
1857
|
+
// AlternateUnits in schema may not have these fields; only write those that exist
|
|
1858
|
+
if ("addSystem" in Duc.AlternateUnits) {
|
|
1859
|
+
// @ts-expect-error guarded by runtime check
|
|
1860
|
+
Duc.AlternateUnits.addSystem(b, u.alternateUnits.system);
|
|
1861
|
+
}
|
|
1862
|
+
if ("addPrecision" in Duc.AlternateUnits) {
|
|
1863
|
+
// @ts-expect-error guarded by runtime check
|
|
1864
|
+
Duc.AlternateUnits.addPrecision(b, u.alternateUnits.precision);
|
|
1865
|
+
}
|
|
1866
|
+
if ("addSuppressLeadingZeros" in Duc.AlternateUnits) {
|
|
1867
|
+
// @ts-expect-error guarded by runtime check
|
|
1868
|
+
Duc.AlternateUnits.addSuppressLeadingZeros(b, u.alternateUnits.suppressLeadingZeros);
|
|
1869
|
+
}
|
|
1870
|
+
if ("addSuppressTrailingZeros" in Duc.AlternateUnits) {
|
|
1871
|
+
// @ts-expect-error guarded by runtime check
|
|
1872
|
+
Duc.AlternateUnits.addSuppressTrailingZeros(b, u.alternateUnits.suppressTrailingZeros);
|
|
1873
|
+
}
|
|
1874
|
+
const alt = Duc.AlternateUnits.endAlternateUnits(b);
|
|
1875
|
+
Duc.StandardUnits.startStandardUnits(b);
|
|
1876
|
+
if (primary !== undefined)
|
|
1877
|
+
Duc.StandardUnits.addPrimaryUnits(b, primary);
|
|
1878
|
+
Duc.StandardUnits.addAlternateUnits(b, alt);
|
|
1879
|
+
return Duc.StandardUnits.endStandardUnits(b);
|
|
1880
|
+
}
|
|
1881
|
+
function writeIdentifiedCommonStyle(b, entry, usv) {
|
|
1882
|
+
const idOff = writeIdentifier(b, entry);
|
|
1883
|
+
const bg = writeElementBackground(b, entry.background, usv);
|
|
1884
|
+
const st = writeElementStroke(b, entry.stroke, usv);
|
|
1885
|
+
Duc.DucCommonStyle.startDucCommonStyle(b);
|
|
1886
|
+
if (bg)
|
|
1887
|
+
Duc.DucCommonStyle.addBackground(b, bg);
|
|
1888
|
+
if (st)
|
|
1889
|
+
Duc.DucCommonStyle.addStroke(b, st);
|
|
1890
|
+
const style = Duc.DucCommonStyle.endDucCommonStyle(b);
|
|
1891
|
+
Duc.IdentifiedCommonStyle.startIdentifiedCommonStyle(b);
|
|
1892
|
+
Duc.IdentifiedCommonStyle.addId(b, idOff);
|
|
1893
|
+
Duc.IdentifiedCommonStyle.addStyle(b, style);
|
|
1894
|
+
return Duc.IdentifiedCommonStyle.endIdentifiedCommonStyle(b);
|
|
1895
|
+
}
|
|
1896
|
+
function writeIdentifiedStackLikeStyle(b, entry, usv) {
|
|
1897
|
+
const idOff = writeIdentifier(b, entry);
|
|
1898
|
+
const s = (() => {
|
|
1899
|
+
Duc.DucStackLikeStyles.startDucStackLikeStyles(b);
|
|
1900
|
+
Duc.DucStackLikeStyles.addOpacity(b, entry.opacity);
|
|
1901
|
+
Duc.DucStackLikeStyles.addLabelingColor(b, b.createString(entry.labelingColor));
|
|
1902
|
+
return Duc.DucStackLikeStyles.endDucStackLikeStyles(b);
|
|
1903
|
+
})();
|
|
1904
|
+
Duc.IdentifiedStackLikeStyle.startIdentifiedStackLikeStyle(b);
|
|
1905
|
+
Duc.IdentifiedStackLikeStyle.addId(b, idOff);
|
|
1906
|
+
Duc.IdentifiedStackLikeStyle.addStyle(b, s);
|
|
1907
|
+
return Duc.IdentifiedStackLikeStyle.endIdentifiedStackLikeStyle(b);
|
|
1908
|
+
}
|
|
1909
|
+
function writeIdentifiedTextStyle(b, entry, usv) {
|
|
1910
|
+
const idOff = writeIdentifier(b, entry);
|
|
1911
|
+
const style = writeTextStyle(b, entry, usv);
|
|
1912
|
+
Duc.IdentifiedTextStyle.startIdentifiedTextStyle(b);
|
|
1913
|
+
Duc.IdentifiedTextStyle.addId(b, idOff);
|
|
1914
|
+
Duc.IdentifiedTextStyle.addStyle(b, style);
|
|
1915
|
+
return Duc.IdentifiedTextStyle.endIdentifiedTextStyle(b);
|
|
1916
|
+
}
|
|
1917
|
+
function writeIdentifiedDimensionStyle(b, entry, usv) {
|
|
1918
|
+
const idOff = writeIdentifier(b, entry);
|
|
1919
|
+
const style = writeDimStyle(b, entry, usv);
|
|
1920
|
+
Duc.IdentifiedDimensionStyle.startIdentifiedDimensionStyle(b);
|
|
1921
|
+
Duc.IdentifiedDimensionStyle.addId(b, idOff);
|
|
1922
|
+
Duc.IdentifiedDimensionStyle.addStyle(b, style);
|
|
1923
|
+
return Duc.IdentifiedDimensionStyle.endIdentifiedDimensionStyle(b);
|
|
1924
|
+
}
|
|
1925
|
+
function writeIdentifiedLeaderStyle(b, entry, usv) {
|
|
1926
|
+
const idOff = writeIdentifier(b, entry);
|
|
1927
|
+
const style = writeLeaderStyle(b, entry, usv);
|
|
1928
|
+
Duc.IdentifiedLeaderStyle.startIdentifiedLeaderStyle(b);
|
|
1929
|
+
Duc.IdentifiedLeaderStyle.addId(b, idOff);
|
|
1930
|
+
Duc.IdentifiedLeaderStyle.addStyle(b, style);
|
|
1931
|
+
return Duc.IdentifiedLeaderStyle.endIdentifiedLeaderStyle(b);
|
|
1932
|
+
}
|
|
1933
|
+
function writeIdentifiedFCFStyle(b, entry, usv) {
|
|
1934
|
+
const idOff = writeIdentifier(b, entry);
|
|
1935
|
+
const style = writeFcfStyle(b, entry, usv);
|
|
1936
|
+
Duc.IdentifiedFCFStyle.startIdentifiedFCFStyle(b);
|
|
1937
|
+
Duc.IdentifiedFCFStyle.addId(b, idOff);
|
|
1938
|
+
Duc.IdentifiedFCFStyle.addStyle(b, style);
|
|
1939
|
+
return Duc.IdentifiedFCFStyle.endIdentifiedFCFStyle(b);
|
|
1940
|
+
}
|
|
1941
|
+
function writeIdentifiedTableStyle(b, entry, usv) {
|
|
1942
|
+
const idOff = writeIdentifier(b, entry);
|
|
1943
|
+
const style = writeTableStyle(b, entry, usv);
|
|
1944
|
+
Duc.IdentifiedTableStyle.startIdentifiedTableStyle(b);
|
|
1945
|
+
Duc.IdentifiedTableStyle.addId(b, idOff);
|
|
1946
|
+
Duc.IdentifiedTableStyle.addStyle(b, style);
|
|
1947
|
+
return Duc.IdentifiedTableStyle.endIdentifiedTableStyle(b);
|
|
1948
|
+
}
|
|
1949
|
+
function writeIdentifiedDocStyle(b, entry, usv) {
|
|
1950
|
+
const idOff = writeIdentifier(b, entry);
|
|
1951
|
+
const style = writeDocStyle(b, entry, usv);
|
|
1952
|
+
Duc.IdentifiedDocStyle.startIdentifiedDocStyle(b);
|
|
1953
|
+
Duc.IdentifiedDocStyle.addId(b, idOff);
|
|
1954
|
+
Duc.IdentifiedDocStyle.addStyle(b, style);
|
|
1955
|
+
return Duc.IdentifiedDocStyle.endIdentifiedDocStyle(b);
|
|
1956
|
+
}
|
|
1957
|
+
function writeIdentifiedViewportStyle(b, entry, usv) {
|
|
1958
|
+
const idOff = writeIdentifier(b, entry);
|
|
1959
|
+
const style = writeViewportStyle(b, entry, usv);
|
|
1960
|
+
Duc.IdentifiedViewportStyle.startIdentifiedViewportStyle(b);
|
|
1961
|
+
Duc.IdentifiedViewportStyle.addId(b, idOff);
|
|
1962
|
+
Duc.IdentifiedViewportStyle.addStyle(b, style);
|
|
1963
|
+
return Duc.IdentifiedViewportStyle.endIdentifiedViewportStyle(b);
|
|
1964
|
+
}
|
|
1965
|
+
function writeIdentifiedHatchStyle(b, entry, usv) {
|
|
1966
|
+
const idOff = writeIdentifier(b, entry);
|
|
1967
|
+
const style = writeHatchStyle(b, entry, usv);
|
|
1968
|
+
Duc.IdentifiedHatchStyle.startIdentifiedHatchStyle(b);
|
|
1969
|
+
Duc.IdentifiedHatchStyle.addId(b, idOff);
|
|
1970
|
+
if (style)
|
|
1971
|
+
Duc.IdentifiedHatchStyle.addStyle(b, style);
|
|
1972
|
+
return Duc.IdentifiedHatchStyle.endIdentifiedHatchStyle(b);
|
|
1973
|
+
}
|
|
1974
|
+
function writeIdentifiedXRayStyle(b, entry, usv) {
|
|
1975
|
+
const idOff = writeIdentifier(b, entry);
|
|
1976
|
+
const style = writeXRayStyle(b, entry, usv);
|
|
1977
|
+
Duc.IdentifiedXRayStyle.startIdentifiedXRayStyle(b);
|
|
1978
|
+
Duc.IdentifiedXRayStyle.addId(b, idOff);
|
|
1979
|
+
Duc.IdentifiedXRayStyle.addStyle(b, style);
|
|
1980
|
+
return Duc.IdentifiedXRayStyle.endIdentifiedXRayStyle(b);
|
|
1981
|
+
}
|
|
1982
|
+
function serializeStandardStyles(b, s, usv) {
|
|
1983
|
+
const commonVec = s.commonStyles.length
|
|
1984
|
+
? Duc.StandardStyles.createCommonStylesVector(b, s.commonStyles.map(cs => writeIdentifiedCommonStyle(b, cs, usv)))
|
|
1985
|
+
: undefined;
|
|
1986
|
+
const stackLikeVec = s.stackLikeStyles.length
|
|
1987
|
+
? Duc.StandardStyles.createStackLikeStylesVector(b, s.stackLikeStyles.map(st => writeIdentifiedStackLikeStyle(b, st, usv)))
|
|
1988
|
+
: undefined;
|
|
1989
|
+
const textVec = s.textStyles.length
|
|
1990
|
+
? Duc.StandardStyles.createTextStylesVector(b, s.textStyles.map(ts => writeIdentifiedTextStyle(b, ts, usv)))
|
|
1991
|
+
: undefined;
|
|
1992
|
+
const dimVec = s.dimensionStyles.length
|
|
1993
|
+
? Duc.StandardStyles.createDimensionStylesVector(b, s.dimensionStyles.map(ds => writeIdentifiedDimensionStyle(b, ds, usv)))
|
|
1994
|
+
: undefined;
|
|
1995
|
+
const leaderVec = s.leaderStyles.length
|
|
1996
|
+
? Duc.StandardStyles.createLeaderStylesVector(b, s.leaderStyles.map(ls => writeIdentifiedLeaderStyle(b, ls, usv)))
|
|
1997
|
+
: undefined;
|
|
1998
|
+
const fcfVec = s.featureControlFrameStyles.length
|
|
1999
|
+
? Duc.StandardStyles.createFeatureControlFrameStylesVector(b, s.featureControlFrameStyles.map(fs => writeIdentifiedFCFStyle(b, fs, usv)))
|
|
2000
|
+
: undefined;
|
|
2001
|
+
const tableVec = s.tableStyles.length
|
|
2002
|
+
? Duc.StandardStyles.createTableStylesVector(b, s.tableStyles.map(ts => writeIdentifiedTableStyle(b, ts, usv)))
|
|
2003
|
+
: undefined;
|
|
2004
|
+
const docVec = s.docStyles.length
|
|
2005
|
+
? Duc.StandardStyles.createDocStylesVector(b, s.docStyles.map(ds => writeIdentifiedDocStyle(b, ds, usv)))
|
|
2006
|
+
: undefined;
|
|
2007
|
+
const viewportVec = s.viewportStyles.length
|
|
2008
|
+
? Duc.StandardStyles.createViewportStylesVector(b, s.viewportStyles.map(vs => writeIdentifiedViewportStyle(b, vs, usv)))
|
|
2009
|
+
: undefined;
|
|
2010
|
+
const hatchVec = s.hatchStyles.length
|
|
2011
|
+
? Duc.StandardStyles.createHatchStylesVector(b, s.hatchStyles.map(hs => writeIdentifiedHatchStyle(b, hs, usv)))
|
|
2012
|
+
: undefined;
|
|
2013
|
+
const xrayVec = s.xrayStyles.length
|
|
2014
|
+
? Duc.StandardStyles.createXrayStylesVector(b, s.xrayStyles.map(xs => writeIdentifiedXRayStyle(b, xs, usv)))
|
|
2015
|
+
: undefined;
|
|
2016
|
+
Duc.StandardStyles.startStandardStyles(b);
|
|
2017
|
+
if (commonVec)
|
|
2018
|
+
Duc.StandardStyles.addCommonStyles(b, commonVec);
|
|
2019
|
+
if (stackLikeVec)
|
|
2020
|
+
Duc.StandardStyles.addStackLikeStyles(b, stackLikeVec);
|
|
2021
|
+
if (textVec)
|
|
2022
|
+
Duc.StandardStyles.addTextStyles(b, textVec);
|
|
2023
|
+
if (dimVec)
|
|
2024
|
+
Duc.StandardStyles.addDimensionStyles(b, dimVec);
|
|
2025
|
+
if (leaderVec)
|
|
2026
|
+
Duc.StandardStyles.addLeaderStyles(b, leaderVec);
|
|
2027
|
+
if (fcfVec)
|
|
2028
|
+
Duc.StandardStyles.addFeatureControlFrameStyles(b, fcfVec);
|
|
2029
|
+
if (tableVec)
|
|
2030
|
+
Duc.StandardStyles.addTableStyles(b, tableVec);
|
|
2031
|
+
if (docVec)
|
|
2032
|
+
Duc.StandardStyles.addDocStyles(b, docVec);
|
|
2033
|
+
if (viewportVec)
|
|
2034
|
+
Duc.StandardStyles.addViewportStyles(b, viewportVec);
|
|
2035
|
+
if (hatchVec)
|
|
2036
|
+
Duc.StandardStyles.addHatchStyles(b, hatchVec);
|
|
2037
|
+
if (xrayVec)
|
|
2038
|
+
Duc.StandardStyles.addXrayStyles(b, xrayVec);
|
|
2039
|
+
return Duc.StandardStyles.endStandardStyles(b);
|
|
2040
|
+
}
|
|
2041
|
+
function serializeStandardViewSettings(b, v, usv) {
|
|
2042
|
+
const viewsVec = v.views && v.views.length
|
|
2043
|
+
? Duc.StandardViewSettings.createViewsVector(b, v.views.map((entry) => {
|
|
2044
|
+
const id = writeIdentifier(b, entry);
|
|
2045
|
+
const view = writeView(b, entry, usv);
|
|
2046
|
+
Duc.IdentifiedView.startIdentifiedView(b);
|
|
2047
|
+
Duc.IdentifiedView.addId(b, id);
|
|
2048
|
+
Duc.IdentifiedView.addView(b, view);
|
|
2049
|
+
return Duc.IdentifiedView.endIdentifiedView(b);
|
|
2050
|
+
}))
|
|
2051
|
+
: undefined;
|
|
2052
|
+
const ucsVec = v.ucs && v.ucs.length
|
|
2053
|
+
? Duc.StandardViewSettings.createUcsVector(b, v.ucs.map((entry) => {
|
|
2054
|
+
const id = writeIdentifier(b, entry);
|
|
2055
|
+
const ucs = writeUcs(b, entry);
|
|
2056
|
+
Duc.IdentifiedUcs.startIdentifiedUcs(b);
|
|
2057
|
+
Duc.IdentifiedUcs.addId(b, id);
|
|
2058
|
+
Duc.IdentifiedUcs.addUcs(b, ucs);
|
|
2059
|
+
return Duc.IdentifiedUcs.endIdentifiedUcs(b);
|
|
2060
|
+
}))
|
|
2061
|
+
: undefined;
|
|
2062
|
+
const gridsVec = v.gridSettings && v.gridSettings.length
|
|
2063
|
+
? Duc.StandardViewSettings.createGridSettingsVector(b, v.gridSettings.map((entry) => {
|
|
2064
|
+
const id = writeIdentifier(b, entry);
|
|
2065
|
+
const settings = writeGridSettings(b, entry, usv);
|
|
2066
|
+
Duc.IdentifiedGridSettings.startIdentifiedGridSettings(b);
|
|
2067
|
+
Duc.IdentifiedGridSettings.addId(b, id);
|
|
2068
|
+
Duc.IdentifiedGridSettings.addSettings(b, settings);
|
|
2069
|
+
return Duc.IdentifiedGridSettings.endIdentifiedGridSettings(b);
|
|
2070
|
+
}))
|
|
2071
|
+
: undefined;
|
|
2072
|
+
const snapsVec = v.snapSettings && v.snapSettings.length
|
|
2073
|
+
? Duc.StandardViewSettings.createSnapSettingsVector(b, v.snapSettings.map((entry) => {
|
|
2074
|
+
const id = writeIdentifier(b, entry);
|
|
2075
|
+
const settings = writeSnapSettings(b, entry, usv);
|
|
2076
|
+
Duc.IdentifiedSnapSettings.startIdentifiedSnapSettings(b);
|
|
2077
|
+
Duc.IdentifiedSnapSettings.addId(b, id);
|
|
2078
|
+
Duc.IdentifiedSnapSettings.addSettings(b, settings);
|
|
2079
|
+
return Duc.IdentifiedSnapSettings.endIdentifiedSnapSettings(b);
|
|
2080
|
+
}))
|
|
2081
|
+
: undefined;
|
|
2082
|
+
Duc.StandardViewSettings.startStandardViewSettings(b);
|
|
2083
|
+
if (viewsVec)
|
|
2084
|
+
Duc.StandardViewSettings.addViews(b, viewsVec);
|
|
2085
|
+
if (ucsVec)
|
|
2086
|
+
Duc.StandardViewSettings.addUcs(b, ucsVec);
|
|
2087
|
+
if (gridsVec)
|
|
2088
|
+
Duc.StandardViewSettings.addGridSettings(b, gridsVec);
|
|
2089
|
+
if (snapsVec)
|
|
2090
|
+
Duc.StandardViewSettings.addSnapSettings(b, snapsVec);
|
|
2091
|
+
return Duc.StandardViewSettings.endStandardViewSettings(b);
|
|
2092
|
+
}
|
|
2093
|
+
function serializeStandardValidation(b, val, usv) {
|
|
2094
|
+
Duc.StandardValidation.startStandardValidation(b);
|
|
2095
|
+
if (val.dimensionRules) {
|
|
2096
|
+
Duc.DimensionValidationRules.startDimensionValidationRules(b);
|
|
2097
|
+
if (val.dimensionRules.minTextHeight !== undefined)
|
|
2098
|
+
Duc.DimensionValidationRules.addMinTextHeight(b, getPrecisionValue(val.dimensionRules.minTextHeight, usv));
|
|
2099
|
+
if (val.dimensionRules.maxTextHeight !== undefined)
|
|
2100
|
+
Duc.DimensionValidationRules.addMaxTextHeight(b, getPrecisionValue(val.dimensionRules.maxTextHeight, usv));
|
|
2101
|
+
if (val.dimensionRules.allowedPrecisions) {
|
|
2102
|
+
Duc.DimensionValidationRules.addAllowedPrecisions(b, Duc.DimensionValidationRules.createAllowedPrecisionsVector(b, val.dimensionRules.allowedPrecisions));
|
|
2103
|
+
}
|
|
2104
|
+
const dr = Duc.DimensionValidationRules.endDimensionValidationRules(b);
|
|
2105
|
+
Duc.StandardValidation.addDimensionRules(b, dr);
|
|
2106
|
+
}
|
|
2107
|
+
if (val.layerRules) {
|
|
2108
|
+
const prohibited = val.layerRules.prohibitedLayerNames
|
|
2109
|
+
? Duc.LayerValidationRules.createProhibitedLayerNamesVector(b, val.layerRules.prohibitedLayerNames.map(s => b.createString(s)))
|
|
2110
|
+
: undefined;
|
|
2111
|
+
Duc.LayerValidationRules.startLayerValidationRules(b);
|
|
2112
|
+
if (prohibited)
|
|
2113
|
+
Duc.LayerValidationRules.addProhibitedLayerNames(b, prohibited);
|
|
2114
|
+
const lr = Duc.LayerValidationRules.endLayerValidationRules(b);
|
|
2115
|
+
Duc.StandardValidation.addLayerRules(b, lr);
|
|
2116
|
+
}
|
|
2117
|
+
return Duc.StandardValidation.endStandardValidation(b);
|
|
2118
|
+
}
|
|
2119
|
+
function serializeStandard(b, s, usv) {
|
|
2120
|
+
const ident = writeIdentifier(b, s);
|
|
2121
|
+
const version = b.createString(s.version);
|
|
2122
|
+
const overrides = s.overrides ? serializeStandardOverrides(b, s.overrides, usv) : undefined;
|
|
2123
|
+
const styles = s.styles ? serializeStandardStyles(b, s.styles, usv) : undefined;
|
|
2124
|
+
const view = s.viewSettings ? serializeStandardViewSettings(b, s.viewSettings, usv) : undefined;
|
|
2125
|
+
const units = s.units ? serializeStandardUnits(b, s.units, usv) : undefined;
|
|
2126
|
+
const validation = s.validation ? serializeStandardValidation(b, s.validation, usv) : undefined;
|
|
2127
|
+
Duc.Standard.startStandard(b);
|
|
2128
|
+
Duc.Standard.addIdentifier(b, ident);
|
|
2129
|
+
Duc.Standard.addVersion(b, version);
|
|
2130
|
+
Duc.Standard.addReadonly(b, s.readonly);
|
|
2131
|
+
if (overrides)
|
|
2132
|
+
Duc.Standard.addOverrides(b, overrides);
|
|
2133
|
+
if (styles)
|
|
2134
|
+
Duc.Standard.addStyles(b, styles);
|
|
2135
|
+
if (view)
|
|
2136
|
+
Duc.Standard.addViewSettings(b, view);
|
|
2137
|
+
if (units)
|
|
2138
|
+
Duc.Standard.addUnits(b, units);
|
|
2139
|
+
if (validation)
|
|
2140
|
+
Duc.Standard.addValidation(b, validation);
|
|
2141
|
+
return Duc.Standard.endStandard(b);
|
|
2142
|
+
}
|
|
2143
|
+
/**
|
|
2144
|
+
* VersionGraph
|
|
2145
|
+
*/
|
|
2146
|
+
function serializeVersionBase(b, v) {
|
|
2147
|
+
const id = b.createString(v.id);
|
|
2148
|
+
const parent = v.parentId ? b.createString(v.parentId) : undefined;
|
|
2149
|
+
const desc = v.description ? b.createString(v.description) : undefined;
|
|
2150
|
+
const user = v.userId ? b.createString(v.userId) : undefined;
|
|
2151
|
+
Duc.VersionBase.startVersionBase(b);
|
|
2152
|
+
Duc.VersionBase.addId(b, id);
|
|
2153
|
+
if (parent)
|
|
2154
|
+
Duc.VersionBase.addParentId(b, parent);
|
|
2155
|
+
Duc.VersionBase.addTimestamp(b, BigInt(v.timestamp));
|
|
2156
|
+
if (desc)
|
|
2157
|
+
Duc.VersionBase.addDescription(b, desc);
|
|
2158
|
+
Duc.VersionBase.addIsManualSave(b, v.isManualSave);
|
|
2159
|
+
if (user)
|
|
2160
|
+
Duc.VersionBase.addUserId(b, user);
|
|
2161
|
+
return Duc.VersionBase.endVersionBase(b);
|
|
2162
|
+
}
|
|
2163
|
+
function serializeCheckpoint(b, c) {
|
|
2164
|
+
const base = serializeVersionBase(b, c);
|
|
2165
|
+
const data = b.createByteVector(c.data);
|
|
2166
|
+
Duc.Checkpoint.startCheckpoint(b);
|
|
2167
|
+
Duc.Checkpoint.addBase(b, base);
|
|
2168
|
+
Duc.Checkpoint.addData(b, data);
|
|
2169
|
+
Duc.Checkpoint.addSizeBytes(b, BigInt(c.sizeBytes));
|
|
2170
|
+
return Duc.Checkpoint.endCheckpoint(b);
|
|
2171
|
+
}
|
|
2172
|
+
function writeJsonPatch(b, p) {
|
|
2173
|
+
const ops = p.map((op) => {
|
|
2174
|
+
const opStr = b.createString(op.op);
|
|
2175
|
+
const pathStr = b.createString(op.path);
|
|
2176
|
+
const fromStr = op.from !== undefined ? b.createString(op.from) : undefined;
|
|
2177
|
+
const valueStr = op.value !== undefined ? b.createString(JSON.stringify(op.value)) : undefined;
|
|
2178
|
+
Duc.JSONPatchOperation.startJSONPatchOperation(b);
|
|
2179
|
+
Duc.JSONPatchOperation.addOp(b, opStr);
|
|
2180
|
+
Duc.JSONPatchOperation.addPath(b, pathStr);
|
|
2181
|
+
if (fromStr)
|
|
2182
|
+
Duc.JSONPatchOperation.addFrom(b, fromStr);
|
|
2183
|
+
if (valueStr)
|
|
2184
|
+
Duc.JSONPatchOperation.addValue(b, valueStr);
|
|
2185
|
+
return Duc.JSONPatchOperation.endJSONPatchOperation(b);
|
|
2186
|
+
});
|
|
2187
|
+
return Duc.Delta.createPatchVector(b, ops);
|
|
2188
|
+
}
|
|
2189
|
+
function serializeDelta(b, d) {
|
|
2190
|
+
const base = serializeVersionBase(b, d);
|
|
2191
|
+
const patch = writeJsonPatch(b, d.patch);
|
|
2192
|
+
Duc.Delta.startDelta(b);
|
|
2193
|
+
Duc.Delta.addBase(b, base);
|
|
2194
|
+
Duc.Delta.addPatch(b, patch);
|
|
2195
|
+
return Duc.Delta.endDelta(b);
|
|
2196
|
+
}
|
|
2197
|
+
function serializeDucVersionGraph(b, vg) {
|
|
2198
|
+
const userCheckpoint = b.createString(vg.userCheckpointVersionId);
|
|
2199
|
+
const latest = b.createString(vg.latestVersionId);
|
|
2200
|
+
const checkpoints = Duc.VersionGraph.createCheckpointsVector(b, vg.checkpoints.map(c => serializeCheckpoint(b, c)));
|
|
2201
|
+
const deltas = Duc.VersionGraph.createDeltasVector(b, vg.deltas.map(d => serializeDelta(b, d)));
|
|
2202
|
+
Duc.VersionGraphMetadata.startVersionGraphMetadata(b);
|
|
2203
|
+
Duc.VersionGraphMetadata.addLastPruned(b, BigInt(vg.metadata.lastPruned));
|
|
2204
|
+
Duc.VersionGraphMetadata.addTotalSize(b, BigInt(vg.metadata.totalSize));
|
|
2205
|
+
const meta = Duc.VersionGraphMetadata.endVersionGraphMetadata(b);
|
|
2206
|
+
Duc.VersionGraph.startVersionGraph(b);
|
|
2207
|
+
Duc.VersionGraph.addUserCheckpointVersionId(b, userCheckpoint);
|
|
2208
|
+
Duc.VersionGraph.addLatestVersionId(b, latest);
|
|
2209
|
+
Duc.VersionGraph.addCheckpoints(b, checkpoints);
|
|
2210
|
+
Duc.VersionGraph.addDeltas(b, deltas);
|
|
2211
|
+
Duc.VersionGraph.addMetadata(b, meta);
|
|
2212
|
+
return Duc.VersionGraph.endVersionGraph(b);
|
|
2213
|
+
}
|
|
2214
|
+
// #endregion
|
|
2215
|
+
// #region STATE SERIALIZERS
|
|
2216
|
+
function serializeDucGlobalState(builder, state, usv) {
|
|
2217
|
+
const nameOffset = writeString(builder, state.name);
|
|
2218
|
+
const viewBackgroundColorOffset = writeString(builder, state.viewBackgroundColor);
|
|
2219
|
+
const mainScopeOffset = writeString(builder, state.mainScope);
|
|
2220
|
+
Duc.DucGlobalState.startDucGlobalState(builder);
|
|
2221
|
+
if (nameOffset)
|
|
2222
|
+
Duc.DucGlobalState.addName(builder, nameOffset);
|
|
2223
|
+
if (viewBackgroundColorOffset)
|
|
2224
|
+
Duc.DucGlobalState.addViewBackgroundColor(builder, viewBackgroundColorOffset);
|
|
2225
|
+
if (mainScopeOffset)
|
|
2226
|
+
Duc.DucGlobalState.addMainScope(builder, mainScopeOffset);
|
|
2227
|
+
Duc.DucGlobalState.addDashSpacingScale(builder, state.dashSpacingScale);
|
|
2228
|
+
Duc.DucGlobalState.addIsDashSpacingAffectedByViewportScale(builder, state.isDashSpacingAffectedByViewportScale);
|
|
2229
|
+
Duc.DucGlobalState.addScopeExponentThreshold(builder, state.scopeExponentThreshold);
|
|
2230
|
+
if (state.pruningLevel)
|
|
2231
|
+
Duc.DucGlobalState.addPruningLevel(builder, state.pruningLevel);
|
|
2232
|
+
Duc.DucGlobalState.addDimensionsAssociativeByDefault(builder, state.dimensionsAssociativeByDefault);
|
|
2233
|
+
Duc.DucGlobalState.addUseAnnotativeScaling(builder, state.useAnnotativeScaling);
|
|
2234
|
+
Duc.DucGlobalState.addDisplayPrecisionLinear(builder, state.displayPrecision.linear);
|
|
2235
|
+
Duc.DucGlobalState.addDisplayPrecisionAngular(builder, state.displayPrecision.angular);
|
|
2236
|
+
return Duc.DucGlobalState.endDucGlobalState(builder);
|
|
2237
|
+
}
|
|
2238
|
+
function serializeDucLocalState(builder, state, usv) {
|
|
2239
|
+
const scopeOffset = writeString(builder, state.scope);
|
|
2240
|
+
const activeStandardIdOffset = writeString(builder, state.activeStandardId);
|
|
2241
|
+
const activeGridSettingsVector = writeStringVector(builder, state.activeGridSettings);
|
|
2242
|
+
const activeSnapSettingsOffset = writeString(builder, state.activeSnapSettings);
|
|
2243
|
+
const currentItemStrokeOffset = writeElementStroke(builder, state.currentItemStroke, usv);
|
|
2244
|
+
const currentItemBackgroundOffset = writeElementBackground(builder, state.currentItemBackground, usv);
|
|
2245
|
+
const currentItemFontFamilyOffset = state.currentItemFontFamily && writeString(builder, state.currentItemFontFamily.toString());
|
|
2246
|
+
Duc.DucLocalState.startDucLocalState(builder);
|
|
2247
|
+
if (scopeOffset)
|
|
2248
|
+
Duc.DucLocalState.addScope(builder, scopeOffset);
|
|
2249
|
+
if (activeStandardIdOffset)
|
|
2250
|
+
Duc.DucLocalState.addActiveStandardId(builder, activeStandardIdOffset);
|
|
2251
|
+
if (state.scrollX)
|
|
2252
|
+
Duc.DucLocalState.addScrollX(builder, getPrecisionValue(state.scrollX, usv));
|
|
2253
|
+
if (state.scrollY)
|
|
2254
|
+
Duc.DucLocalState.addScrollY(builder, getPrecisionValue(state.scrollY, usv));
|
|
2255
|
+
if (state.zoom)
|
|
2256
|
+
Duc.DucLocalState.addZoom(builder, state.zoom.value);
|
|
2257
|
+
if (activeGridSettingsVector)
|
|
2258
|
+
Duc.DucLocalState.addActiveGridSettings(builder, activeGridSettingsVector);
|
|
2259
|
+
if (activeSnapSettingsOffset)
|
|
2260
|
+
Duc.DucLocalState.addActiveSnapSettings(builder, activeSnapSettingsOffset);
|
|
2261
|
+
Duc.DucLocalState.addIsBindingEnabled(builder, state.isBindingEnabled);
|
|
2262
|
+
if (currentItemStrokeOffset)
|
|
2263
|
+
Duc.DucLocalState.addCurrentItemStroke(builder, currentItemStrokeOffset);
|
|
2264
|
+
if (currentItemBackgroundOffset)
|
|
2265
|
+
Duc.DucLocalState.addCurrentItemBackground(builder, currentItemBackgroundOffset);
|
|
2266
|
+
Duc.DucLocalState.addCurrentItemOpacity(builder, state.currentItemOpacity);
|
|
2267
|
+
if (currentItemFontFamilyOffset)
|
|
2268
|
+
Duc.DucLocalState.addCurrentItemFontFamily(builder, currentItemFontFamilyOffset);
|
|
2269
|
+
if (state.currentItemFontSize)
|
|
2270
|
+
Duc.DucLocalState.addCurrentItemFontSize(builder, getPrecisionValue(state.currentItemFontSize, usv));
|
|
2271
|
+
if (state.currentItemTextAlign)
|
|
2272
|
+
Duc.DucLocalState.addCurrentItemTextAlign(builder, state.currentItemTextAlign);
|
|
2273
|
+
if (state.currentItemRoundness)
|
|
2274
|
+
Duc.DucLocalState.addCurrentItemRoundness(builder, getPrecisionValue(state.currentItemRoundness, usv));
|
|
2275
|
+
Duc.DucLocalState.addPenMode(builder, state.penMode);
|
|
2276
|
+
Duc.DucLocalState.addViewModeEnabled(builder, state.viewModeEnabled);
|
|
2277
|
+
Duc.DucLocalState.addObjectsSnapModeEnabled(builder, state.objectsSnapModeEnabled);
|
|
2278
|
+
Duc.DucLocalState.addGridModeEnabled(builder, state.gridModeEnabled);
|
|
2279
|
+
Duc.DucLocalState.addOutlineModeEnabled(builder, state.outlineModeEnabled);
|
|
2280
|
+
Duc.DucLocalState.addManualSaveMode(builder, state.manualSaveMode);
|
|
2281
|
+
return Duc.DucLocalState.endDucLocalState(builder);
|
|
2282
|
+
}
|
|
2283
|
+
function serializeDictionary(builder, dictionary) {
|
|
2284
|
+
if (!dictionary)
|
|
2285
|
+
return undefined;
|
|
2286
|
+
const entries = Object.entries(dictionary).map(([key, value]) => {
|
|
2287
|
+
const keyOffset = builder.createString(key);
|
|
2288
|
+
const valueOffset = builder.createString(value);
|
|
2289
|
+
Duc.DictionaryEntry.startDictionaryEntry(builder);
|
|
2290
|
+
Duc.DictionaryEntry.addKey(builder, keyOffset);
|
|
2291
|
+
Duc.DictionaryEntry.addValue(builder, valueOffset);
|
|
2292
|
+
return Duc.DictionaryEntry.endDictionaryEntry(builder);
|
|
2293
|
+
});
|
|
2294
|
+
return Duc.ExportedDataState.createDictionaryVector(builder, entries);
|
|
2295
|
+
}
|
|
2296
|
+
// #endregion
|
|
2297
|
+
function serializeDucGroup(builder, g, usv) {
|
|
2298
|
+
const id = builder.createString(g.id);
|
|
2299
|
+
const stack = writeStackBase(builder, g, usv);
|
|
2300
|
+
Duc.DucGroup.startDucGroup(builder);
|
|
2301
|
+
Duc.DucGroup.addId(builder, id);
|
|
2302
|
+
Duc.DucGroup.addStackBase(builder, stack);
|
|
2303
|
+
return Duc.DucGroup.endDucGroup(builder);
|
|
2304
|
+
}
|
|
2305
|
+
function serializeDucRegion(builder, r, usv) {
|
|
2306
|
+
const id = builder.createString(r.id);
|
|
2307
|
+
const stack = writeStackBase(builder, r, usv);
|
|
2308
|
+
Duc.DucRegion.startDucRegion(builder);
|
|
2309
|
+
Duc.DucRegion.addId(builder, id);
|
|
2310
|
+
Duc.DucRegion.addStackBase(builder, stack);
|
|
2311
|
+
Duc.DucRegion.addBooleanOperation(builder, r.booleanOperation);
|
|
2312
|
+
return Duc.DucRegion.endDucRegion(builder);
|
|
2313
|
+
}
|
|
2314
|
+
function serializeDucLayer(builder, l, usv) {
|
|
2315
|
+
const id = builder.createString(l.id);
|
|
2316
|
+
const stack = writeStackBase(builder, l, usv);
|
|
2317
|
+
const overrides = l.overrides ? (() => {
|
|
2318
|
+
const stroke = writeElementStroke(builder, l.overrides.stroke, usv);
|
|
2319
|
+
const bg = writeElementBackground(builder, l.overrides.background, usv);
|
|
2320
|
+
Duc.DucLayerOverrides.startDucLayerOverrides(builder);
|
|
2321
|
+
if (stroke)
|
|
2322
|
+
Duc.DucLayerOverrides.addStroke(builder, stroke);
|
|
2323
|
+
if (bg)
|
|
2324
|
+
Duc.DucLayerOverrides.addBackground(builder, bg);
|
|
2325
|
+
return Duc.DucLayerOverrides.endDucLayerOverrides(builder);
|
|
2326
|
+
})() : undefined;
|
|
2327
|
+
Duc.DucLayer.startDucLayer(builder);
|
|
2328
|
+
Duc.DucLayer.addId(builder, id);
|
|
2329
|
+
Duc.DucLayer.addStackBase(builder, stack);
|
|
2330
|
+
Duc.DucLayer.addReadonly(builder, l.readonly);
|
|
2331
|
+
if (overrides)
|
|
2332
|
+
Duc.DucLayer.addOverrides(builder, overrides);
|
|
2333
|
+
return Duc.DucLayer.endDucLayer(builder);
|
|
2334
|
+
}
|
|
2335
|
+
/**
|
|
2336
|
+
* External files map serializer: returns vector offset or undefined
|
|
2337
|
+
*/
|
|
2338
|
+
function serializeExternalFiles(builder, files, usv) {
|
|
2339
|
+
if (!files)
|
|
2340
|
+
return undefined;
|
|
2341
|
+
const entries = Object.entries(files).map(([key, value]) => {
|
|
2342
|
+
const keyOff = builder.createString(key);
|
|
2343
|
+
const mt = builder.createString(value.mimeType);
|
|
2344
|
+
const idOff = builder.createString(value.id);
|
|
2345
|
+
let dataVectorOffset = undefined;
|
|
2346
|
+
if (value.data) {
|
|
2347
|
+
dataVectorOffset = Duc.DucExternalFileData.createDataVector(builder, value.data);
|
|
2348
|
+
}
|
|
2349
|
+
Duc.DucExternalFileData.startDucExternalFileData(builder);
|
|
2350
|
+
Duc.DucExternalFileData.addMimeType(builder, mt);
|
|
2351
|
+
Duc.DucExternalFileData.addId(builder, idOff);
|
|
2352
|
+
if (dataVectorOffset)
|
|
2353
|
+
Duc.DucExternalFileData.addData(builder, dataVectorOffset);
|
|
2354
|
+
Duc.DucExternalFileData.addCreated(builder, BigInt(value.created));
|
|
2355
|
+
if (value.lastRetrieved !== undefined)
|
|
2356
|
+
Duc.DucExternalFileData.addLastRetrieved(builder, BigInt(value.lastRetrieved));
|
|
2357
|
+
const dataOff = Duc.DucExternalFileData.endDucExternalFileData(builder);
|
|
2358
|
+
Duc.DucExternalFileEntry.startDucExternalFileEntry(builder);
|
|
2359
|
+
Duc.DucExternalFileEntry.addKey(builder, keyOff);
|
|
2360
|
+
Duc.DucExternalFileEntry.addValue(builder, dataOff);
|
|
2361
|
+
return Duc.DucExternalFileEntry.endDucExternalFileEntry(builder);
|
|
2362
|
+
});
|
|
2363
|
+
// Build vector of entries
|
|
2364
|
+
builder.startVector(4, entries.length, 4);
|
|
2365
|
+
for (let i = entries.length - 1; i >= 0; i--)
|
|
2366
|
+
builder.addOffset(entries[i]);
|
|
2367
|
+
return builder.endVector();
|
|
2368
|
+
}
|
|
2369
|
+
export const DUC_SCHEMA_VERSION = (typeof process !== "undefined" && process.env && process.env.DUC_SCHEMA_VERSION) ||
|
|
2370
|
+
(typeof import.meta !== "undefined" && import.meta.env && import.meta.env.DUC_SCHEMA_VERSION) ||
|
|
2371
|
+
"0.0.0";
|
|
2372
|
+
export const serializeDuc = (data_1, ...args_1) => __awaiter(void 0, [data_1, ...args_1], void 0, function* (data, useScopedValues = false, passThroughElementIds = []) {
|
|
2373
|
+
const builder = new flatbuffers.Builder(1024);
|
|
2374
|
+
const sanitized = restore(data, {
|
|
2375
|
+
refreshDimensions: false,
|
|
2376
|
+
syncInvalidIndices: (elements) => elements,
|
|
2377
|
+
passThroughElementIds
|
|
2378
|
+
});
|
|
2379
|
+
const typeOffset = builder.createString(EXPORT_DATA_TYPES.duc);
|
|
2380
|
+
const sourceOffset = builder.createString(typeof window !== "undefined" ? window.location.origin : "unknown");
|
|
2381
|
+
const versionOffset = builder.createString(DUC_SCHEMA_VERSION);
|
|
2382
|
+
// Serialize elements
|
|
2383
|
+
const elementOffsets = sanitized.elements.map((element) => {
|
|
2384
|
+
return writeElementWrapper(builder, element, useScopedValues);
|
|
2385
|
+
});
|
|
2386
|
+
const elementsOffset = Duc.ExportedDataState.createElementsVector(builder, elementOffsets);
|
|
2387
|
+
// Serialize localState
|
|
2388
|
+
const localStateOffset = serializeDucLocalState(builder, sanitized.localState, useScopedValues);
|
|
2389
|
+
// Serialize files
|
|
2390
|
+
const externalFilesOffset = serializeExternalFiles(builder, sanitized.files, useScopedValues);
|
|
2391
|
+
// Serialize blocks
|
|
2392
|
+
const blocksOffset = Duc.ExportedDataState.createBlocksVector(builder, sanitized.blocks.map(block => writeBlock(builder, block, useScopedValues)));
|
|
2393
|
+
// Serialize groups
|
|
2394
|
+
const groupsOffset = sanitized.groups.length > 0
|
|
2395
|
+
? Duc.ExportedDataState.createGroupsVector(builder, sanitized.groups.map(group => serializeDucGroup(builder, group, useScopedValues)))
|
|
2396
|
+
: null;
|
|
2397
|
+
// Serialize regions
|
|
2398
|
+
const regionsOffset = (sanitized.regions && sanitized.regions.length > 0)
|
|
2399
|
+
? Duc.ExportedDataState.createRegionsVector(builder, sanitized.regions.map(region => serializeDucRegion(builder, region, useScopedValues)))
|
|
2400
|
+
: null;
|
|
2401
|
+
// Serialize layers
|
|
2402
|
+
const layersOffset = (sanitized.layers && sanitized.layers.length > 0)
|
|
2403
|
+
? Duc.ExportedDataState.createLayersVector(builder, sanitized.layers.map(layer => serializeDucLayer(builder, layer, useScopedValues)))
|
|
2404
|
+
: null;
|
|
2405
|
+
// Serialize standards
|
|
2406
|
+
const standardsOffset = (sanitized.standards && sanitized.standards.length > 0)
|
|
2407
|
+
? Duc.ExportedDataState.createStandardsVector(builder, sanitized.standards.map(standard => serializeStandard(builder, standard, useScopedValues)))
|
|
2408
|
+
: null;
|
|
2409
|
+
// Serialize dictionary
|
|
2410
|
+
const dictionaryOffset = (sanitized.dictionary && Object.keys(sanitized.dictionary).length > 0)
|
|
2411
|
+
? serializeDictionary(builder, sanitized.dictionary)
|
|
2412
|
+
: null;
|
|
2413
|
+
// Serialize duc_global_state
|
|
2414
|
+
const ducGlobalStateOffset = sanitized.globalState
|
|
2415
|
+
? serializeDucGlobalState(builder, sanitized.globalState, useScopedValues)
|
|
2416
|
+
: null;
|
|
2417
|
+
// Serialize version_graph
|
|
2418
|
+
const versionGraphOffset = sanitized.versionGraph
|
|
2419
|
+
? serializeDucVersionGraph(builder, sanitized.versionGraph)
|
|
2420
|
+
: null;
|
|
2421
|
+
// Serialize thumbnail (as byte vector if present)
|
|
2422
|
+
const thumbnailOffset = sanitized.thumbnail
|
|
2423
|
+
? builder.createByteVector(sanitized.thumbnail)
|
|
2424
|
+
: null;
|
|
2425
|
+
Duc.ExportedDataState.startExportedDataState(builder);
|
|
2426
|
+
Duc.ExportedDataState.addType(builder, typeOffset);
|
|
2427
|
+
Duc.ExportedDataState.addVersion(builder, versionOffset);
|
|
2428
|
+
Duc.ExportedDataState.addSource(builder, sourceOffset);
|
|
2429
|
+
Duc.ExportedDataState.addElements(builder, elementsOffset);
|
|
2430
|
+
Duc.ExportedDataState.addDucLocalState(builder, localStateOffset);
|
|
2431
|
+
if (externalFilesOffset) {
|
|
2432
|
+
Duc.ExportedDataState.addExternalFiles(builder, externalFilesOffset);
|
|
2433
|
+
}
|
|
2434
|
+
if (blocksOffset) {
|
|
2435
|
+
Duc.ExportedDataState.addBlocks(builder, blocksOffset);
|
|
2436
|
+
}
|
|
2437
|
+
if (groupsOffset) {
|
|
2438
|
+
Duc.ExportedDataState.addGroups(builder, groupsOffset);
|
|
2439
|
+
}
|
|
2440
|
+
if (regionsOffset) {
|
|
2441
|
+
Duc.ExportedDataState.addRegions(builder, regionsOffset);
|
|
2442
|
+
}
|
|
2443
|
+
if (layersOffset) {
|
|
2444
|
+
Duc.ExportedDataState.addLayers(builder, layersOffset);
|
|
2445
|
+
}
|
|
2446
|
+
if (standardsOffset) {
|
|
2447
|
+
Duc.ExportedDataState.addStandards(builder, standardsOffset);
|
|
2448
|
+
}
|
|
2449
|
+
if (dictionaryOffset) {
|
|
2450
|
+
Duc.ExportedDataState.addDictionary(builder, dictionaryOffset);
|
|
2451
|
+
}
|
|
2452
|
+
if (ducGlobalStateOffset) {
|
|
2453
|
+
Duc.ExportedDataState.addDucGlobalState(builder, ducGlobalStateOffset);
|
|
2454
|
+
}
|
|
2455
|
+
if (versionGraphOffset) {
|
|
2456
|
+
Duc.ExportedDataState.addVersionGraph(builder, versionGraphOffset);
|
|
2457
|
+
}
|
|
2458
|
+
if (thumbnailOffset) {
|
|
2459
|
+
Duc.ExportedDataState.addThumbnail(builder, thumbnailOffset);
|
|
2460
|
+
}
|
|
2461
|
+
const exportedDataStateOffset = Duc.ExportedDataState.endExportedDataState(builder);
|
|
2462
|
+
builder.finish(exportedDataStateOffset, "DUC_");
|
|
2463
|
+
return builder.asUint8Array();
|
|
2464
|
+
});
|
|
2465
|
+
// #endregion
|