ducjs 1.0.0 → 2.0.1

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.
Files changed (127) hide show
  1. package/dist/legacy/index.d.ts +1 -1
  2. package/dist/legacy/index.js +1 -1
  3. package/dist/legacy/v1/parse/index.d.ts +22 -22
  4. package/dist/legacy/v1/parse/index.js +8 -8
  5. package/dist/legacy/v1/parse/parseAppStateFromBinary.d.ts +2 -2
  6. package/dist/legacy/v1/parse/parseAppStateFromBinary.js +3 -3
  7. package/dist/legacy/v1/parse/parseBinaryFilesFromBinary.d.ts +2 -2
  8. package/dist/legacy/v1/parse/parseBlockFromBinary.d.ts +2 -2
  9. package/dist/legacy/v1/parse/parseBlockFromBinary.js +1 -1
  10. package/dist/legacy/v1/parse/parseElementFromBinary.d.ts +3 -3
  11. package/dist/legacy/v1/parse/parseElementFromBinary.js +2 -2
  12. package/dist/legacy/v1/parse/parseGroupFromBinary.d.ts +3 -3
  13. package/dist/legacy/v1/parse/parseRendererStateFromBinary.d.ts +1 -1
  14. package/dist/legacy/v1/serialize/index.d.ts +3 -3
  15. package/dist/legacy/v1/serialize/index.js +9 -9
  16. package/dist/legacy/v1/serialize/serializationUtils.d.ts +1 -1
  17. package/dist/legacy/v1/serialize/serializeAppStateFromDuc.d.ts +1 -1
  18. package/dist/legacy/v1/serialize/serializeAppStateFromDuc.js +4 -4
  19. package/dist/legacy/v1/serialize/serializeBinaryFilesFromDuc.d.ts +1 -1
  20. package/dist/legacy/v1/serialize/serializeBinaryFilesFromDuc.js +2 -2
  21. package/dist/legacy/v1/serialize/serializeBlockFromDuc.d.ts +1 -1
  22. package/dist/legacy/v1/serialize/serializeBlockFromDuc.js +1 -1
  23. package/dist/legacy/v1/serialize/serializeElementFromDuc.d.ts +2 -2
  24. package/dist/legacy/v1/serialize/serializeElementFromDuc.js +3 -3
  25. package/dist/legacy/v1/serialize/serializeGroupFromDuc.d.ts +1 -1
  26. package/dist/legacy/v1/serialize/serializeGroupFromDuc.js +1 -1
  27. package/dist/legacy/v1/serialize/serializeRendererStateFromDuc.js +1 -1
  28. package/dist/legacy/v1/types/elements/index.d.ts +5 -5
  29. package/dist/legacy/v1/types/elements/typeChecks.d.ts +4 -4
  30. package/dist/legacy/v1/types/elements/typeChecks.js +1 -1
  31. package/dist/legacy/v1/types/geometryTypes.d.ts +1 -1
  32. package/dist/legacy/v1/types/index.d.ts +7 -7
  33. package/dist/legacy/v1/utils/bounds.d.ts +4 -4
  34. package/dist/legacy/v1/utils/bounds.js +4 -4
  35. package/dist/legacy/v1/utils/constants.d.ts +3 -3
  36. package/dist/legacy/v1/utils/constants.js +1 -1
  37. package/dist/legacy/v1/utils/elements/index.d.ts +4 -4
  38. package/dist/legacy/v1/utils/elements/index.js +5 -5
  39. package/dist/legacy/v1/utils/elements/linearElement.d.ts +6 -6
  40. package/dist/legacy/v1/utils/elements/linearElement.js +4 -4
  41. package/dist/legacy/v1/utils/elements/textElement.d.ts +7 -7
  42. package/dist/legacy/v1/utils/elements/textElement.js +7 -7
  43. package/dist/legacy/v1/utils/index.d.ts +1 -1
  44. package/dist/legacy/v1/utils/math/algebra/gadirections.d.ts +1 -1
  45. package/dist/legacy/v1/utils/math/algebra/gadirections.js +1 -1
  46. package/dist/legacy/v1/utils/math/algebra/galines.d.ts +1 -1
  47. package/dist/legacy/v1/utils/math/algebra/galines.js +1 -1
  48. package/dist/legacy/v1/utils/math/algebra/gapoints.d.ts +1 -1
  49. package/dist/legacy/v1/utils/math/algebra/gapoints.js +3 -3
  50. package/dist/legacy/v1/utils/math/algebra/gatransforms.d.ts +1 -1
  51. package/dist/legacy/v1/utils/math/algebra/gatransforms.js +2 -2
  52. package/dist/legacy/v1/utils/math/bbox.d.ts +2 -2
  53. package/dist/legacy/v1/utils/math/geometry.d.ts +3 -3
  54. package/dist/legacy/v1/utils/math/geometry.js +2 -2
  55. package/dist/legacy/v1/utils/math/index.d.ts +6 -6
  56. package/dist/legacy/v1/utils/math/index.js +3 -3
  57. package/dist/legacy/v1/utils/measurements.d.ts +2 -2
  58. package/dist/legacy/v1/utils/measurements.js +1 -1
  59. package/dist/legacy/v1/utils/normalize.d.ts +2 -2
  60. package/dist/legacy/v1/utils/normalize.js +2 -2
  61. package/dist/legacy/v1/utils/restore.d.ts +8 -8
  62. package/dist/legacy/v1/utils/restore.js +15 -15
  63. package/dist/legacy/v1/utils/scopes.d.ts +3 -3
  64. package/dist/legacy/v1/utils/standards.d.ts +1 -1
  65. package/dist/legacy/v1/utils/state/index.d.ts +1 -1
  66. package/dist/legacy/v1/utils/state/index.js +4 -4
  67. package/dist/parse.d.ts +4 -4
  68. package/dist/parse.js +3 -3
  69. package/dist/restore/restoreDataState.d.ts +8 -8
  70. package/dist/restore/restoreDataState.js +9 -9
  71. package/dist/restore/restoreElements.d.ts +2 -2
  72. package/dist/restore/restoreElements.js +5 -5
  73. package/dist/restore/restoreStandards.d.ts +2 -2
  74. package/dist/restore/restoreStandards.js +4 -4
  75. package/dist/serialize.d.ts +1 -1
  76. package/dist/serialize.js +3 -3
  77. package/dist/technical/measurements.d.ts +2 -2
  78. package/dist/technical/measurements.js +1 -1
  79. package/dist/technical/scopes.d.ts +4 -4
  80. package/dist/technical/scopes.js +1 -1
  81. package/dist/technical/standards.d.ts +4 -4
  82. package/dist/types/elements/index.d.ts +6 -6
  83. package/dist/types/elements/typeChecks.d.ts +4 -4
  84. package/dist/types/elements/typeChecks.js +1 -1
  85. package/dist/types/geometryTypes.d.ts +2 -2
  86. package/dist/types/index.d.ts +7 -7
  87. package/dist/utils/bounds.d.ts +3 -3
  88. package/dist/utils/bounds.js +3 -3
  89. package/dist/utils/constants.d.ts +3 -3
  90. package/dist/utils/constants.js +2 -2
  91. package/dist/utils/elements/frameElement.d.ts +1 -1
  92. package/dist/utils/elements/frameElement.js +1 -1
  93. package/dist/utils/elements/freedrawElement.d.ts +1 -1
  94. package/dist/utils/elements/freedrawElement.js +1 -1
  95. package/dist/utils/elements/index.d.ts +4 -4
  96. package/dist/utils/elements/index.js +6 -6
  97. package/dist/utils/elements/linearElement.d.ts +6 -6
  98. package/dist/utils/elements/linearElement.js +4 -4
  99. package/dist/utils/elements/newElement.d.ts +3 -3
  100. package/dist/utils/elements/newElement.js +8 -8
  101. package/dist/utils/elements/textElement.d.ts +7 -7
  102. package/dist/utils/elements/textElement.js +8 -8
  103. package/dist/utils/elements/viewportElement.d.ts +1 -1
  104. package/dist/utils/math/algebra/gadirections.d.ts +1 -1
  105. package/dist/utils/math/algebra/gadirections.js +1 -1
  106. package/dist/utils/math/algebra/galines.d.ts +1 -1
  107. package/dist/utils/math/algebra/galines.js +1 -1
  108. package/dist/utils/math/algebra/gapoints.d.ts +1 -1
  109. package/dist/utils/math/algebra/gapoints.js +3 -3
  110. package/dist/utils/math/algebra/gatransforms.d.ts +1 -1
  111. package/dist/utils/math/algebra/gatransforms.js +2 -2
  112. package/dist/utils/math/bbox.d.ts +2 -2
  113. package/dist/utils/math/geometry.d.ts +3 -3
  114. package/dist/utils/math/geometry.js +2 -2
  115. package/dist/utils/math/index.d.ts +6 -6
  116. package/dist/utils/math/index.js +3 -3
  117. package/dist/utils/normalize.d.ts +2 -2
  118. package/dist/utils/normalize.js +2 -2
  119. package/dist/utils/shape.d.ts +2 -2
  120. package/dist/utils/shape.js +8 -8
  121. package/dist/utils/state/grid.d.ts +1 -1
  122. package/dist/utils/state/grid.js +3 -3
  123. package/dist/utils/state/index.d.ts +1 -1
  124. package/dist/utils/state/index.js +7 -7
  125. package/dist/utils/version.d.ts +1 -1
  126. package/dist/utils/version.js +1 -1
  127. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import * as GA from "ducjs/legacy/v1/utils/math/algebra/ga";
1
+ import * as GA from "./ga";
2
2
  /**
3
3
  * A line is stored as an array `[0, c, a, b, 0, 0, 0, 0]` representing:
4
4
  * c * e0 + a * e1 + b*e2
@@ -1,4 +1,4 @@
1
- import type { Point, Line } from "ducjs/legacy/v1/utils/math/algebra/ga";
1
+ import type { Point, Line } from "./ga";
2
2
  export declare const from: ([x, y]: readonly [number, number]) => Point;
3
3
  export declare const toTuple: (point: Point) => [number, number];
4
4
  export declare const abs: (point: Point) => Point;
@@ -1,6 +1,6 @@
1
- import * as GA from "ducjs/legacy/v1/utils/math/algebra/ga";
2
- import * as GALine from "ducjs/legacy/v1/utils/math/algebra/galines";
3
- import { join } from "ducjs/legacy/v1/utils/math/algebra/ga";
1
+ import * as GA from "./ga";
2
+ import * as GALine from "./galines";
3
+ import { join } from "./ga";
4
4
  export const from = ([x, y]) => [
5
5
  0,
6
6
  0,
@@ -1,4 +1,4 @@
1
- import type { Line, Direction, Point, Transform } from "ducjs/legacy/v1/utils/math/algebra/ga";
1
+ import type { Line, Direction, Point, Transform } from "./ga";
2
2
  /**
3
3
  * TODO: docs
4
4
  */
@@ -1,5 +1,5 @@
1
- import * as GA from "ducjs/legacy/v1/utils/math/algebra/ga";
2
- import * as GADirection from "ducjs/legacy/v1/utils/math/algebra/gadirections";
1
+ import * as GA from "./ga";
2
+ import * as GADirection from "./gadirections";
3
3
  /**
4
4
  * TODO: docs
5
5
  */
@@ -1,5 +1,5 @@
1
- import { Bounds, LineSegment } from "ducjs/legacy/v1/types/geometryTypes";
2
- import { GeometricPoint } from "ducjs/legacy/v1/types/geometryTypes";
1
+ import { Bounds, LineSegment } from "../../types/geometryTypes";
2
+ import { GeometricPoint } from "../../types/geometryTypes";
3
3
  export declare function getBBox(line: LineSegment): Bounds;
4
4
  export declare function crossProduct(a: GeometricPoint, b: GeometricPoint): number;
5
5
  export declare function doBBoxesIntersect(a: Bounds, b: Bounds): boolean;
@@ -11,9 +11,9 @@
11
11
  * Also included in this file are methods for converting a Duc element or a Drawable from roughjs
12
12
  * to pure shapes.
13
13
  */
14
- import type { DucBindableElement } from "ducjs/legacy/v1/types/elements";
15
- import type { LineSegment } from "ducjs/legacy/v1/types/geometryTypes";
16
- import type { GeometricPoint, Line, Polygon, Curve, Ellipse, Polycurve, Polyline } from "ducjs/legacy/v1/types/geometryTypes";
14
+ import type { DucBindableElement } from "../../types/elements";
15
+ import type { LineSegment } from "../../types/geometryTypes";
16
+ import type { GeometricPoint, Line, Polygon, Curve, Ellipse, Polycurve, Polyline } from "../../types/geometryTypes";
17
17
  /**
18
18
  * Utils
19
19
  */
@@ -11,8 +11,8 @@
11
11
  * Also included in this file are methods for converting a Duc element or a Drawable from roughjs
12
12
  * to pure shapes.
13
13
  */
14
- import { addVectors, distance2d, rotatePoint, scaleVector, subtractVectors, } from "ducjs/legacy/v1/utils/math";
15
- import { crossProduct } from "ducjs/legacy/v1/utils/math/bbox";
14
+ import { addVectors, distance2d, rotatePoint, scaleVector, subtractVectors, } from "./";
15
+ import { crossProduct } from "./bbox";
16
16
  const DEFAULT_THRESHOLD = 10e-5;
17
17
  /**
18
18
  * Utils
@@ -1,9 +1,9 @@
1
- import type { NullableGridSize, Zoom } from "ducjs/legacy/v1/types";
2
- import { Scope, ScopedValue } from "ducjs/legacy/v1/types";
3
- import type { DucElement, DucLine, DucLinearElement, DucPoint, NonDeleted } from "ducjs/legacy/v1/types/elements";
4
- import type { Bounds, GeometricPoint, GeometricVector } from "ducjs/legacy/v1/types/geometryTypes";
5
- import { Heading } from "ducjs/legacy/v1/types/geometryTypes";
6
- import { SupportedMeasures } from "ducjs/legacy/v1/utils/scopes";
1
+ import type { NullableGridSize, Zoom } from "../../types";
2
+ import { Scope, ScopedValue } from "../../types";
3
+ import type { DucElement, DucLine, DucLinearElement, DucPoint, NonDeleted } from "../../types/elements";
4
+ import type { Bounds, GeometricPoint, GeometricVector } from "../../types/geometryTypes";
5
+ import { Heading } from "../../types/geometryTypes";
6
+ import { SupportedMeasures } from "../scopes";
7
7
  /**
8
8
  * Rotates a point (x, y) around another point (cx, cy) by a given angle.
9
9
  * Returns the rotated point as a Point object.
@@ -1,6 +1,6 @@
1
- import { LINE_CONFIRM_THRESHOLD } from "ducjs/legacy/v1/utils/constants";
2
- import { pointFrom } from "ducjs/legacy/v1/utils/math/geometry";
3
- import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, getScopedBezierPointFromDucPoint } from "ducjs/legacy/v1/utils/scopes";
1
+ import { LINE_CONFIRM_THRESHOLD } from "../constants";
2
+ import { pointFrom } from "./geometry";
3
+ import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, getScopedBezierPointFromDucPoint } from "../scopes";
4
4
  /**
5
5
  * Rotates a point (x, y) around another point (cx, cy) by a given angle.
6
6
  * Returns the rotated point as a Point object.
@@ -1,5 +1,5 @@
1
- import { DucElement } from "ducjs/legacy/v1/types/elements";
2
- import { CombinedMeasure, ImperialMeasure, imperialMeasures, MetricMeasure, metricMeasures, ScaleFactors, SupportedMeasures } from "ducjs/legacy/v1/utils/scopes";
1
+ import { DucElement } from "../types/elements";
2
+ import { CombinedMeasure, ImperialMeasure, imperialMeasures, MetricMeasure, metricMeasures, ScaleFactors, SupportedMeasures } from "./scopes";
3
3
  export { imperialMeasures, metricMeasures, ScaleFactors };
4
4
  export type { CombinedMeasure, ImperialMeasure, MetricMeasure, SupportedMeasures };
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { calculateScope, getTranslationFactor, imperialMeasures, metricMeasures, ScaleFactors } from "ducjs/legacy/v1/utils/scopes";
1
+ import { calculateScope, getTranslationFactor, imperialMeasures, metricMeasures, ScaleFactors } from "./scopes";
2
2
  export { imperialMeasures, metricMeasures, ScaleFactors };
3
3
  /**
4
4
  * Gets translation factor between current scope and element scope
@@ -1,5 +1,5 @@
1
- import type { NormalizedZoomValue, ScopedValue } from "ducjs/legacy/v1/types";
2
- import { DucElement, FixedPoint } from "ducjs/legacy/v1/types/elements";
1
+ import type { NormalizedZoomValue, ScopedValue } from "../types";
2
+ import { DucElement, FixedPoint } from "../types/elements";
3
3
  export declare const getNormalizedZoom: (zoom: number) => NormalizedZoomValue;
4
4
  export declare const getNormalizedGridSize: (gridStep: number) => number;
5
5
  export declare const getNormalizedGridStep: (gridStep: number) => number;
@@ -1,5 +1,5 @@
1
- import { MAX_ZOOM, MIN_ZOOM } from "ducjs/legacy/v1/utils/constants";
2
- import { clamp } from "ducjs/legacy/v1/utils/math";
1
+ import { MAX_ZOOM, MIN_ZOOM } from "./constants";
2
+ import { clamp } from "./math";
3
3
  export const getNormalizedZoom = (zoom) => {
4
4
  return clamp(zoom, MIN_ZOOM, MAX_ZOOM);
5
5
  };
@@ -1,11 +1,11 @@
1
- import type { BinaryFiles, LibraryItem, LibraryItems, LibraryItems_anyVersion, PrecisionValue, RendererState, Scope } from "ducjs/legacy/v1/types";
2
- import { DucState } from "ducjs/legacy/v1/types";
3
- import type { BezierMirroring, DucBlock, DucElement, DucFreeDrawEasing, DucGroup, DucPoint, ElementSubset, FillStyle, ImageStatus, LineHead, OrderedDucElement, StrokeCap, StrokeJoin, StrokePreference, StrokeSidePreference, TextAlign, VerticalAlign } from "ducjs/legacy/v1/types/elements";
4
- import { Percentage, Radian } from "ducjs/legacy/v1/types/geometryTypes";
5
- import type { ValueOf } from "ducjs/legacy/v1/types/utility-types";
6
- import { BLENDING, VERSIONS } from "ducjs/legacy/v1/utils/constants";
7
- import { SupportedMeasures } from "ducjs/legacy/v1/utils/measurements";
8
- import { DesignStandard } from "ducjs/legacy/v1/utils/standards";
1
+ import type { BinaryFiles, LibraryItem, LibraryItems, LibraryItems_anyVersion, PrecisionValue, RendererState, Scope } from "../types";
2
+ import { DucState } from "../types";
3
+ import type { BezierMirroring, DucBlock, DucElement, DucFreeDrawEasing, DucGroup, DucPoint, ElementSubset, FillStyle, ImageStatus, LineHead, OrderedDucElement, StrokeCap, StrokeJoin, StrokePreference, StrokeSidePreference, TextAlign, VerticalAlign } from "../types/elements";
4
+ import { Percentage, Radian } from "../types/geometryTypes";
5
+ import type { ValueOf } from "../types/utility-types";
6
+ import { BLENDING, VERSIONS } from "./constants";
7
+ import { SupportedMeasures } from "./measurements";
8
+ import { DesignStandard } from "./standards";
9
9
  type RestoredDucState = Omit<DucState, "offsetTop" | "offsetLeft" | "width" | "height">;
10
10
  export interface ExportedDataState {
11
11
  type: string;
@@ -1,18 +1,18 @@
1
- import { isElbowArrow, isLinearElement, isTextElement } from "ducjs/legacy/v1/types/elements/typeChecks";
2
- import { arrayToMap, getUpdatedTimestamp, isFiniteNumber, updateActiveTool, } from "ducjs/legacy/v1/utils";
3
- import { getContainerElement } from "ducjs/legacy/v1/utils/bounds";
4
- import { BEZIER_MIRRORING, BLENDING, DEFAULT_ELEMENT_PROPS, DEFAULT_ELLIPSE_ELEMENT, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FREEDRAW_ELEMENT, DEFAULT_POLYGON_SIDES, DEFAULT_TEXT_ALIGN, DEFAULT_VERTICAL_ALIGN, DEFAULT_ZOOM_STEP, ELEMENT_CONTENT_PREFERENCE, ELEMENT_SUBSET, FONT_FAMILY, IMAGE_STATUS, LINE_CONFIRM_THRESHOLD, LINE_HEAD, MAX_ZOOM_STEP, MIN_ZOOM_STEP, STROKE_CAP, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, STROKE_SIDE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN } from "ducjs/legacy/v1/utils/constants";
5
- import { bumpVersion, getDefaultStackProperties, getNonDeletedElements, isInvisiblySmallElement, migratePoints } from "ducjs/legacy/v1/utils/elements";
6
- import { getNormalizedPoints, mergeOverlappingPoints, validateClosedPath } from "ducjs/legacy/v1/utils/elements/linearElement";
7
- import { detectLineHeight, refreshTextDimensions } from "ducjs/legacy/v1/utils/elements/textElement";
8
- import { getSizeFromPoints } from "ducjs/legacy/v1/utils/math";
9
- import { randomId } from "ducjs/legacy/v1/utils/math/random";
10
- import { getPrecisionScope, ScaleFactors } from "ducjs/legacy/v1/utils/measurements";
11
- import { getNormalizedDimensions, getNormalizedGridSize, getNormalizedGridStep, getNormalizedZoom, normalizeFixedPoint, } from "ducjs/legacy/v1/utils/normalize";
12
- import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, getScaledZoomValueForScope, getScopedBezierPointFromDucPoint, getScopedZoomValue, NEUTRAL_SCOPE } from "ducjs/legacy/v1/utils/scopes";
13
- import { DESIGN_STANDARD } from "ducjs/legacy/v1/utils/standards";
14
- import { getDefaultDucState } from "ducjs/legacy/v1/utils/state";
15
- import { normalizeLink } from "ducjs/legacy/v1/utils/url";
1
+ import { isElbowArrow, isLinearElement, isTextElement } from "../types/elements/typeChecks";
2
+ import { arrayToMap, getUpdatedTimestamp, isFiniteNumber, updateActiveTool, } from "./";
3
+ import { getContainerElement } from "./bounds";
4
+ import { BEZIER_MIRRORING, BLENDING, DEFAULT_ELEMENT_PROPS, DEFAULT_ELLIPSE_ELEMENT, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FREEDRAW_ELEMENT, DEFAULT_POLYGON_SIDES, DEFAULT_TEXT_ALIGN, DEFAULT_VERTICAL_ALIGN, DEFAULT_ZOOM_STEP, ELEMENT_CONTENT_PREFERENCE, ELEMENT_SUBSET, FONT_FAMILY, IMAGE_STATUS, LINE_CONFIRM_THRESHOLD, LINE_HEAD, MAX_ZOOM_STEP, MIN_ZOOM_STEP, STROKE_CAP, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, STROKE_SIDE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN } from "./constants";
5
+ import { bumpVersion, getDefaultStackProperties, getNonDeletedElements, isInvisiblySmallElement, migratePoints } from "./elements";
6
+ import { getNormalizedPoints, mergeOverlappingPoints, validateClosedPath } from "./elements/linearElement";
7
+ import { detectLineHeight, refreshTextDimensions } from "./elements/textElement";
8
+ import { getSizeFromPoints } from "./math";
9
+ import { randomId } from "./math/random";
10
+ import { getPrecisionScope, ScaleFactors } from "./measurements";
11
+ import { getNormalizedDimensions, getNormalizedGridSize, getNormalizedGridStep, getNormalizedZoom, normalizeFixedPoint, } from "./normalize";
12
+ import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, getScaledZoomValueForScope, getScopedBezierPointFromDucPoint, getScopedZoomValue, NEUTRAL_SCOPE } from "./scopes";
13
+ import { DESIGN_STANDARD } from "./standards";
14
+ import { getDefaultDucState } from "./state";
15
+ import { normalizeLink } from "./url";
16
16
  import tinycolor from "tinycolor2";
17
17
  export const AllowedDucActiveTools = {
18
18
  selection: true,
@@ -1,6 +1,6 @@
1
- import { PrecisionValue, RawValue, ScaledZoom, Scope, ScopedValue, ScopedZoomValue } from "ducjs/legacy/v1/types";
2
- import { DucPoint } from "ducjs/legacy/v1/types/elements";
3
- import { GeometricPoint } from "ducjs/legacy/v1/types/geometryTypes";
1
+ import { PrecisionValue, RawValue, ScaledZoom, Scope, ScopedValue, ScopedZoomValue } from "../types";
2
+ import { DucPoint } from "../types/elements";
3
+ import { GeometricPoint } from "../types/geometryTypes";
4
4
  export type UnitSystem = 'metric' | 'imperial';
5
5
  export type ZoomDirection = 'up' | 'down' | 'neutral';
6
6
  export declare const MIN_ZOOM = 1e-32;
@@ -1,4 +1,4 @@
1
- import { ValueOf } from "ducjs/legacy/v1/types/utility-types";
1
+ import { ValueOf } from "../types/utility-types";
2
2
  export declare const DESIGN_STANDARD: {
3
3
  readonly DUC: 10;
4
4
  readonly ABNT: 11;
@@ -1,2 +1,2 @@
1
- import { DucState } from "ducjs/legacy/v1/types";
1
+ import { DucState } from "../../types";
2
2
  export declare const getDefaultDucState: () => Omit<DucState, "offsetTop" | "offsetLeft" | "width" | "height">;
@@ -1,7 +1,7 @@
1
- import { ANTI_ALIASING, COLOR_PALETTE, DEFAULT_ELEMENT_PROPS, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_GRID_SIZE, DEFAULT_GRID_STEP, TEXT_ALIGN } from "ducjs/legacy/v1/utils/constants";
2
- import { getNormalizedZoom } from "ducjs/legacy/v1/utils/normalize";
3
- import { getPrecisionValueFromRaw, getScaledZoomValueForScope, getScopedZoomValue, NEUTRAL_SCOPE } from "ducjs/legacy/v1/utils/scopes";
4
- import { DESIGN_STANDARD } from "ducjs/legacy/v1/utils/standards";
1
+ import { ANTI_ALIASING, COLOR_PALETTE, DEFAULT_ELEMENT_PROPS, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_GRID_SIZE, DEFAULT_GRID_STEP, TEXT_ALIGN } from "../constants";
2
+ import { getNormalizedZoom } from "../normalize";
3
+ import { getPrecisionValueFromRaw, getScaledZoomValueForScope, getScopedZoomValue, NEUTRAL_SCOPE } from "../scopes";
4
+ import { DESIGN_STANDARD } from "../standards";
5
5
  export const getDefaultDucState = () => {
6
6
  const scrollX = window.innerWidth / 2;
7
7
  const scrollY = window.innerHeight / 2;
package/dist/parse.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { FileSystemHandle } from 'browser-fs-access';
2
- import { CustomHatchPattern as CustomHatchPatternFb, DimensionToleranceStyle as DimensionToleranceStyleFb, DucBlock as DucBlockFb, DucDimensionStyle as DucDimensionStyleFb, DucDocStyle as DucDocStyleFb, DucExternalFileEntry, DucFeatureControlFrameStyle as DucFeatureControlFrameStyleFb, DucGlobalState as DucGlobalStateFb, DucGroup as DucGroupFb, DucHatchStyle as DucHatchStyleFb, DucHead as DucHeadFb, DucImageFilter as DucImageFilterFb, DucLayer as DucLayerFb, DucLeaderStyle as DucLeaderStyleFb, DucLine as DucLineFb, DucLineReference as DucLineReferenceFb, DucLocalState as DucLocalStateFb, DucPath as DucPathFb, DucPlotStyle as DucPlotStyleFb, DucPointBinding as DucPointBindingFb, DucPoint as DucPointFb, DucRegion as DucRegionFb, DucStackLikeStyles as DucStackLikeStylesFb, DucTableCellStyle as DucTableCellStyleFb, DucTableStyle as DucTableStyleFb, DucTextStyle as DucTextStyleFb, DucViewportStyle as DucViewportStyleFb, DucXRayStyle as DucXRayStyleFb, ElementBackground as ElementBackgroundFb, ElementContentBase as ElementContentBaseFb, ElementStroke as ElementStrokeFb, ElementWrapper, ExportedDataState as ExportedDataStateFb, GeometricPoint as GeometricPointFb, HatchPatternLine as HatchPatternLineFb, Margins as MarginsFb, PrimaryUnits as PrimaryUnitsFb, Standard as StandardFb, StrokeSides as StrokeSidesFb, StrokeStyle as StrokeStyleFb, TilingProperties as TilingPropertiesFb, VersionGraph as VersionGraphFb, _DucElementBase as _DucElementBaseFb, _DucElementStylesBase as _DucElementStylesBaseFb, _DucLinearElementBase as _DucLinearElementBaseFb, _DucStackBase as _DucStackBaseFb, _DucStackElementBase as _DucStackElementBaseFb } from "ducjs/flatbuffers/duc";
3
- import { RestoredDataState } from "ducjs/restore";
4
- import { Standard, StandardUnits } from "ducjs/technical";
5
- import { CustomHatchPattern, Dictionary, DucBlock, DucDimensionStyle, DucDocStyle, DucElement, DucExternalFiles, DucFeatureControlFrameStyle, DucGlobalState, DucGroup, DucHatchStyle, DucHead, DucImageFilter, DucLayer, DucLeaderStyle, DucLine, DucLineReference, DucLocalState, DucPath, DucPlotStyle, DucPoint, DucPointBinding, DucRegion, DucStackLikeStyles, DucTableCellStyle, DucTableStyle, DucTextStyle, DucViewportStyle, DucXRayStyle, ElementBackground, ElementContentBase, ElementStroke, GeometricPoint, HatchPatternLine, PlotLayout, StrokeSides, StrokeStyle, TilingProperties, VersionGraph, _DucElementBase, _DucElementStylesBase, _DucLinearElementBase, _DucStackBase, _DucStackElementBase } from "ducjs/types";
2
+ import { CustomHatchPattern as CustomHatchPatternFb, DimensionToleranceStyle as DimensionToleranceStyleFb, DucBlock as DucBlockFb, DucDimensionStyle as DucDimensionStyleFb, DucDocStyle as DucDocStyleFb, DucExternalFileEntry, DucFeatureControlFrameStyle as DucFeatureControlFrameStyleFb, DucGlobalState as DucGlobalStateFb, DucGroup as DucGroupFb, DucHatchStyle as DucHatchStyleFb, DucHead as DucHeadFb, DucImageFilter as DucImageFilterFb, DucLayer as DucLayerFb, DucLeaderStyle as DucLeaderStyleFb, DucLine as DucLineFb, DucLineReference as DucLineReferenceFb, DucLocalState as DucLocalStateFb, DucPath as DucPathFb, DucPlotStyle as DucPlotStyleFb, DucPointBinding as DucPointBindingFb, DucPoint as DucPointFb, DucRegion as DucRegionFb, DucStackLikeStyles as DucStackLikeStylesFb, DucTableCellStyle as DucTableCellStyleFb, DucTableStyle as DucTableStyleFb, DucTextStyle as DucTextStyleFb, DucViewportStyle as DucViewportStyleFb, DucXRayStyle as DucXRayStyleFb, ElementBackground as ElementBackgroundFb, ElementContentBase as ElementContentBaseFb, ElementStroke as ElementStrokeFb, ElementWrapper, ExportedDataState as ExportedDataStateFb, GeometricPoint as GeometricPointFb, HatchPatternLine as HatchPatternLineFb, Margins as MarginsFb, PrimaryUnits as PrimaryUnitsFb, Standard as StandardFb, StrokeSides as StrokeSidesFb, StrokeStyle as StrokeStyleFb, TilingProperties as TilingPropertiesFb, VersionGraph as VersionGraphFb, _DucElementBase as _DucElementBaseFb, _DucElementStylesBase as _DucElementStylesBaseFb, _DucLinearElementBase as _DucLinearElementBaseFb, _DucStackBase as _DucStackBaseFb, _DucStackElementBase as _DucStackElementBaseFb } from "./flatbuffers/duc";
3
+ import { RestoredDataState } from "./restore";
4
+ import { Standard, StandardUnits } from "./technical";
5
+ import { CustomHatchPattern, Dictionary, DucBlock, DucDimensionStyle, DucDocStyle, DucElement, DucExternalFiles, DucFeatureControlFrameStyle, DucGlobalState, DucGroup, DucHatchStyle, DucHead, DucImageFilter, DucLayer, DucLeaderStyle, DucLine, DucLineReference, DucLocalState, DucPath, DucPlotStyle, DucPoint, DucPointBinding, DucRegion, DucStackLikeStyles, DucTableCellStyle, DucTableStyle, DucTextStyle, DucViewportStyle, DucXRayStyle, ElementBackground, ElementContentBase, ElementStroke, GeometricPoint, HatchPatternLine, PlotLayout, StrokeSides, StrokeStyle, TilingProperties, VersionGraph, _DucElementBase, _DucElementStylesBase, _DucLinearElementBase, _DucStackBase, _DucStackElementBase } from "./types";
6
6
  export declare function parseGeometricPoint(point: GeometricPointFb): GeometricPoint;
7
7
  export declare function parsePoint(point: DucPointFb): DucPoint;
8
8
  export declare function parseMargins(margins: MarginsFb): PlotLayout["margins"];
package/dist/parse.js CHANGED
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { DucArrowElement as DucArrowElementFb, DucBlockInstanceElement as DucBlockInstanceElementFb, DucDimensionElement as DucDimensionElementFb, DucDocElement as DucDocElementFb, DucEllipseElement as DucEllipseElementFb, DucEmbeddableElement as DucEmbeddableElementFb, DucFeatureControlFrameElement as DucFeatureControlFrameElementFb, DucFrameElement as DucFrameElementFb, DucFreeDrawElement as DucFreeDrawElementFb, DucImageElement as DucImageElementFb, DucLeaderElement as DucLeaderElementFb, DucLinearElement as DucLinearElementFb, DucMermaidElement as DucMermaidElementFb, DucParametricElement as DucParametricElementFb, DucPdfElement as DucPdfElementFb, DucPlotElement as DucPlotElementFb, DucPolygonElement as DucPolygonElementFb, DucRectangleElement as DucRectangleElementFb, DucTableElement as DucTableElementFb, DucTextDynamicDictionarySource as DucTextDynamicDictionarySourceFb, DucTextDynamicElementSource as DucTextDynamicElementSourceFb, DucTextElement as DucTextElementFb, DucViewportElement as DucViewportElementFb, DucXRayElement as DucXRayElementFb, Element as ElementUnion, ExportedDataState, LEADER_CONTENT_TYPE as LEADER_CONTENT_TYPE_ENUM, LeaderBlockContent as LeaderBlockContentFb, LeaderTextBlockContent as LeaderTextBlockContentFb, TEXT_FIELD_SOURCE_TYPE } from "ducjs/flatbuffers/duc";
11
- import { parseDucFlatBuffers as parseDucFlatBuffersV1 } from 'ducjs/legacy/v1/parse';
12
- import { restore } from "ducjs/restore";
10
+ import { DucArrowElement as DucArrowElementFb, DucBlockInstanceElement as DucBlockInstanceElementFb, DucDimensionElement as DucDimensionElementFb, DucDocElement as DucDocElementFb, DucEllipseElement as DucEllipseElementFb, DucEmbeddableElement as DucEmbeddableElementFb, DucFeatureControlFrameElement as DucFeatureControlFrameElementFb, DucFrameElement as DucFrameElementFb, DucFreeDrawElement as DucFreeDrawElementFb, DucImageElement as DucImageElementFb, DucLeaderElement as DucLeaderElementFb, DucLinearElement as DucLinearElementFb, DucMermaidElement as DucMermaidElementFb, DucParametricElement as DucParametricElementFb, DucPdfElement as DucPdfElementFb, DucPlotElement as DucPlotElementFb, DucPolygonElement as DucPolygonElementFb, DucRectangleElement as DucRectangleElementFb, DucTableElement as DucTableElementFb, DucTextDynamicDictionarySource as DucTextDynamicDictionarySourceFb, DucTextDynamicElementSource as DucTextDynamicElementSourceFb, DucTextElement as DucTextElementFb, DucViewportElement as DucViewportElementFb, DucXRayElement as DucXRayElementFb, Element as ElementUnion, ExportedDataState, LEADER_CONTENT_TYPE as LEADER_CONTENT_TYPE_ENUM, LeaderBlockContent as LeaderBlockContentFb, LeaderTextBlockContent as LeaderTextBlockContentFb, TEXT_FIELD_SOURCE_TYPE } from "./flatbuffers/duc";
11
+ import { parseDucFlatBuffers as parseDucFlatBuffersV1 } from './legacy/v1/parse';
12
+ import { restore } from "./restore";
13
13
  import * as flatbuffers from "flatbuffers";
14
14
  // #region HELPERS & LOW-LEVEL CASTS
15
15
  // Helper functions for type casting
@@ -1,11 +1,11 @@
1
- import { BLENDING } from "ducjs/flatbuffers/duc";
2
- import { Standard } from "ducjs/technical/standards";
3
- import type { Dictionary, DucExternalFiles, DucGlobalState, ImportedDataState, LibraryItems, PrecisionValue, Scope, VersionGraph } from "ducjs/types";
4
- import { DucLocalState } from "ducjs/types";
5
- import type { _DucStackBase, BezierMirroring, DucBlock, DucElement, DucGroup, DucHead, DucLayer, DucRegion, ElementBackground, ElementContentBase, ElementStroke, ExternalFileId, FillStyle, ImageStatus, LineHead, OrderedDucElement, StrokeCap, StrokeJoin, StrokePreference, StrokeSidePreference, StrokeStyle, TextAlign, VerticalAlign } from "ducjs/types/elements";
6
- import { Percentage, Radian } from "ducjs/types/geometryTypes";
7
- import { ValueOf } from "ducjs/types/utility-types";
8
- import { VERSIONS } from "ducjs/utils/constants";
1
+ import { BLENDING } from "../flatbuffers/duc";
2
+ import { Standard } from "../technical/standards";
3
+ import type { Dictionary, DucExternalFiles, DucGlobalState, ImportedDataState, LibraryItems, PrecisionValue, Scope, VersionGraph } from "../types";
4
+ import { DucLocalState } from "../types";
5
+ import type { _DucStackBase, BezierMirroring, DucBlock, DucElement, DucGroup, DucHead, DucLayer, DucRegion, ElementBackground, ElementContentBase, ElementStroke, ExternalFileId, FillStyle, ImageStatus, LineHead, OrderedDucElement, StrokeCap, StrokeJoin, StrokePreference, StrokeSidePreference, StrokeStyle, TextAlign, VerticalAlign } from "../types/elements";
6
+ import { Percentage, Radian } from "../types/geometryTypes";
7
+ import { ValueOf } from "../types/utility-types";
8
+ import { VERSIONS } from "../utils/constants";
9
9
  export type RestoredLocalState = Omit<DucLocalState, "offsetTop" | "offsetLeft" | "width" | "height">;
10
10
  export type RestoredDataState = {
11
11
  thumbnail: Uint8Array | undefined;
@@ -1,12 +1,12 @@
1
- import { BEZIER_MIRRORING, BLENDING, BOOLEAN_OPERATION, ELEMENT_CONTENT_PREFERENCE, IMAGE_STATUS, LINE_HEAD, PRUNING_LEVEL, STROKE_CAP, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, STROKE_SIDE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN, } from "ducjs/flatbuffers/duc";
2
- import { restoreElements } from "ducjs/restore/restoreElements";
3
- import { isStandardIdPresent, restoreStandards, } from "ducjs/restore/restoreStandards";
4
- import { getPrecisionScope } from "ducjs/technical/measurements";
5
- import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, NEUTRAL_SCOPE, ScaleFactors } from "ducjs/technical/scopes";
6
- import { PREDEFINED_STANDARDS } from "ducjs/technical/standards";
7
- import { base64ToUint8Array, getDefaultGlobalState, getDefaultLocalState, getZoom, isEncodedFunctionString, isFiniteNumber, reviveEncodedFunction, } from "ducjs/utils";
8
- import { DEFAULT_ELEMENT_PROPS, DEFAULT_POLYGON_SIDES, DEFAULT_TEXT_ALIGN, DEFAULT_VERTICAL_ALIGN, DEFAULT_ZOOM_STEP, MAX_ZOOM_STEP, MIN_ZOOM_STEP, } from "ducjs/utils/constants";
9
- import { getDefaultStackProperties } from "ducjs/utils/elements";
1
+ import { BEZIER_MIRRORING, BLENDING, BOOLEAN_OPERATION, ELEMENT_CONTENT_PREFERENCE, IMAGE_STATUS, LINE_HEAD, PRUNING_LEVEL, STROKE_CAP, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, STROKE_SIDE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN, } from "../flatbuffers/duc";
2
+ import { restoreElements } from "./restoreElements";
3
+ import { isStandardIdPresent, restoreStandards, } from "./restoreStandards";
4
+ import { getPrecisionScope } from "../technical/measurements";
5
+ import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, NEUTRAL_SCOPE, ScaleFactors } from "../technical/scopes";
6
+ import { PREDEFINED_STANDARDS } from "../technical/standards";
7
+ import { base64ToUint8Array, getDefaultGlobalState, getDefaultLocalState, getZoom, isEncodedFunctionString, isFiniteNumber, reviveEncodedFunction, } from "../utils";
8
+ import { DEFAULT_ELEMENT_PROPS, DEFAULT_POLYGON_SIDES, DEFAULT_TEXT_ALIGN, DEFAULT_VERTICAL_ALIGN, DEFAULT_ZOOM_STEP, MAX_ZOOM_STEP, MIN_ZOOM_STEP, } from "../utils/constants";
9
+ import { getDefaultStackProperties } from "../utils/elements";
10
10
  import tinycolor from "tinycolor2";
11
11
  export const restore = (data, elementsConfig) => {
12
12
  const restoredStandards = restoreStandards(data === null || data === void 0 ? void 0 : data.standards);
@@ -1,5 +1,5 @@
1
- import { ElementsConfig, RestoredDataState } from "ducjs/restore/restoreDataState";
2
- import { BezierMirroring, DucElement, DucFreeDrawEasing, DucLocalState, DucPoint, ImportedDataState, OrderedDucElement, PrecisionValue, Scope } from "ducjs/types";
1
+ import { ElementsConfig, RestoredDataState } from "./restoreDataState";
2
+ import { BezierMirroring, DucElement, DucFreeDrawEasing, DucLocalState, DucPoint, ImportedDataState, OrderedDucElement, PrecisionValue, Scope } from "../types";
3
3
  /**
4
4
  * Restores a point that might have legacy format (x,y as numbers)
5
5
  * @param point - The point to restore
@@ -1,9 +1,9 @@
1
1
  import { isValidBezierMirroringValue, isValidBlendingValue, isValidBoolean, isValidBoolean as isValidBooleanValue, // Renaming to avoid conflict
2
- isValidColor, isValidDucHead, isValidEnumValue, isValidFunction, isValidImageScaleValue, isValidImageStatusValue, isValidPercentageValue, isValidPolygonSides, isValidRadianValue, isValidString, isValidTextAlignValue, isValidVerticalAlignValue, restoreDucStackProperties, restorePrecisionValue, validateBackground, validateStroke } from "ducjs/restore/restoreDataState";
3
- import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, getScaledZoomValueForScope, getScopedBezierPointFromDucPoint, getScopedZoomValue, NEUTRAL_SCOPE, ScaleFactors, } from "ducjs/technical/scopes";
4
- import { isElbowArrow, isLinearElement, isTextElement, } from "ducjs/types";
5
- import { arrayToMap, bumpVersion, DEFAULT_ELEMENT_PROPS, DEFAULT_ELLIPSE_ELEMENT, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FREEDRAW_ELEMENT, detectLineHeight, FONT_FAMILY, getContainerElement, getDefaultLocalState, getDefaultTableData, getNormalizedDimensions, getNormalizedPoints, getNormalizedZoom, getSizeFromPoints, getUpdatedTimestamp, isFiniteNumber, isInvisiblySmallElement, LINE_CONFIRM_THRESHOLD, mergeOverlappingPoints, migratePoints, normalizeFixedPoint, normalizeLink, randomId, refreshTextDimensions, validateClosedPath, } from "ducjs/utils";
6
- import { AXIS, BLOCK_ATTACHMENT, COLUMN_TYPE, DATUM_BRACKET_STYLE, DIMENSION_FIT_RULE, DIMENSION_TEXT_PLACEMENT, DIMENSION_TYPE, GDT_SYMBOL, LEADER_CONTENT_TYPE, LINE_SPACING_TYPE, MARK_ELLIPSE_CENTER, MATERIAL_CONDITION, PARAMETRIC_SOURCE_TYPE, STACKED_TEXT_ALIGN, TABLE_CELL_ALIGNMENT, TABLE_FLOW_DIRECTION, TEXT_FLOW_DIRECTION, TOLERANCE_DISPLAY, TOLERANCE_ZONE_TYPE, VERTICAL_ALIGN, VIEWPORT_SHADE_PLOT, } from "ducjs/flatbuffers/duc";
2
+ isValidColor, isValidDucHead, isValidEnumValue, isValidFunction, isValidImageScaleValue, isValidImageStatusValue, isValidPercentageValue, isValidPolygonSides, isValidRadianValue, isValidString, isValidTextAlignValue, isValidVerticalAlignValue, restoreDucStackProperties, restorePrecisionValue, validateBackground, validateStroke } from "./restoreDataState";
3
+ import { getPrecisionValueFromRaw, getPrecisionValueFromScoped, getScaledZoomValueForScope, getScopedBezierPointFromDucPoint, getScopedZoomValue, NEUTRAL_SCOPE, ScaleFactors, } from "../technical/scopes";
4
+ import { isElbowArrow, isLinearElement, isTextElement, } from "../types";
5
+ import { arrayToMap, bumpVersion, DEFAULT_ELEMENT_PROPS, DEFAULT_ELLIPSE_ELEMENT, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FREEDRAW_ELEMENT, detectLineHeight, FONT_FAMILY, getContainerElement, getDefaultLocalState, getDefaultTableData, getNormalizedDimensions, getNormalizedPoints, getNormalizedZoom, getSizeFromPoints, getUpdatedTimestamp, isFiniteNumber, isInvisiblySmallElement, LINE_CONFIRM_THRESHOLD, mergeOverlappingPoints, migratePoints, normalizeFixedPoint, normalizeLink, randomId, refreshTextDimensions, validateClosedPath, } from "../utils";
6
+ import { AXIS, BLOCK_ATTACHMENT, COLUMN_TYPE, DATUM_BRACKET_STYLE, DIMENSION_FIT_RULE, DIMENSION_TEXT_PLACEMENT, DIMENSION_TYPE, GDT_SYMBOL, LEADER_CONTENT_TYPE, LINE_SPACING_TYPE, MARK_ELLIPSE_CENTER, MATERIAL_CONDITION, PARAMETRIC_SOURCE_TYPE, STACKED_TEXT_ALIGN, TABLE_CELL_ALIGNMENT, TABLE_FLOW_DIRECTION, TEXT_FLOW_DIRECTION, TOLERANCE_DISPLAY, TOLERANCE_ZONE_TYPE, VERTICAL_ALIGN, VIEWPORT_SHADE_PLOT, } from "../flatbuffers/duc";
7
7
  import tinycolor from "tinycolor2";
8
8
  const restoreElementWithProperties = (element, extra, localState, globalState) => {
9
9
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
@@ -1,5 +1,5 @@
1
- import { Standard } from "ducjs/technical/standards";
2
- import { Scope } from "ducjs/types";
1
+ import { Standard } from "../technical/standards";
2
+ import { Scope } from "../types";
3
3
  export declare const restoreStandards: (standards: any, currentScope?: Scope) => Standard[];
4
4
  /**
5
5
  * Checks if a given id is present in the standards array.
@@ -1,7 +1,7 @@
1
- import { ANGULAR_UNITS_FORMAT, DECIMAL_SEPARATOR, DIMENSION_UNITS_FORMAT, GRID_DISPLAY_TYPE, GRID_TYPE, UNIT_SYSTEM, } from "ducjs/flatbuffers/duc";
2
- import { isValidBoolean, isValidEnumValue, isValidRadianValue, isValidString, restorePrecisionValue } from "ducjs/restore/restoreDataState";
3
- import { NEUTRAL_SCOPE, ScaleFactors } from "ducjs/technical";
4
- import { PREDEFINED_STANDARDS } from "ducjs/technical/standards";
1
+ import { ANGULAR_UNITS_FORMAT, DECIMAL_SEPARATOR, DIMENSION_UNITS_FORMAT, GRID_DISPLAY_TYPE, GRID_TYPE, UNIT_SYSTEM, } from "../flatbuffers/duc";
2
+ import { isValidBoolean, isValidEnumValue, isValidRadianValue, isValidString, restorePrecisionValue } from "./restoreDataState";
3
+ import { NEUTRAL_SCOPE, ScaleFactors } from "../technical";
4
+ import { PREDEFINED_STANDARDS } from "../technical/standards";
5
5
  export const restoreStandards = (standards,
6
6
  // Pass current scope to resolve precision values if needed
7
7
  currentScope = NEUTRAL_SCOPE) => {
@@ -1,3 +1,3 @@
1
- import { ImportedDataState } from "ducjs/types";
1
+ import { ImportedDataState } from "./types";
2
2
  export declare const DUC_SCHEMA_VERSION: any;
3
3
  export declare const serializeDuc: (data: ImportedDataState, useScopedValues?: boolean, passThroughElementIds?: string[]) => Promise<Uint8Array>;
package/dist/serialize.js CHANGED
@@ -16,10 +16,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
16
16
  cast to number at the final write site (e.g. pv.value).
17
17
  - Keep args strongly typed. Never use any for function args.
18
18
  */
19
- import * as Duc from "ducjs/flatbuffers/duc";
19
+ import * as Duc from "./flatbuffers/duc";
20
20
  import * as flatbuffers from "flatbuffers";
21
- import { restore } from "ducjs/restore";
22
- import { encodeFunctionString, EXPORT_DATA_TYPES } from "ducjs/utils";
21
+ import { restore } from "./restore";
22
+ import { encodeFunctionString, EXPORT_DATA_TYPES } from "./utils";
23
23
  /**
24
24
  * Basic helpers
25
25
  */
@@ -1,5 +1,5 @@
1
- import { DucElement } from "ducjs/types/elements";
2
- import { CombinedMeasure, SupportedMeasures } from "ducjs/technical/scopes";
1
+ import { DucElement } from "../types/elements";
2
+ import { CombinedMeasure, SupportedMeasures } from "./scopes";
3
3
  /**
4
4
  * Gets translation factor between current scope and element scope
5
5
  */
@@ -1,4 +1,4 @@
1
- import { calculateScope, getTranslationFactor } from "ducjs/technical/scopes";
1
+ import { calculateScope, getTranslationFactor } from "./scopes";
2
2
  /**
3
3
  * Gets translation factor between current scope and element scope
4
4
  */
@@ -1,7 +1,7 @@
1
- import { UNIT_SYSTEM } from "ducjs/flatbuffers/duc";
2
- import { PrecisionValue, RawValue, ScaledZoom, Scope, ScopedValue, ScopedZoomValue, ValueOf } from "ducjs/types";
3
- import { DucPoint } from "ducjs/types/elements";
4
- import { GeometricPoint } from "ducjs/types/geometryTypes";
1
+ import { UNIT_SYSTEM } from "../flatbuffers/duc";
2
+ import { PrecisionValue, RawValue, ScaledZoom, Scope, ScopedValue, ScopedZoomValue, ValueOf } from "../types";
3
+ import { DucPoint } from "../types/elements";
4
+ import { GeometricPoint } from "../types/geometryTypes";
5
5
  export type UnitSystem = ValueOf<typeof UNIT_SYSTEM>;
6
6
  export type ZoomDirection = 'up' | 'down' | 'neutral';
7
7
  export declare const MIN_ZOOM = 1e-32;
@@ -1,4 +1,4 @@
1
- import { UNIT_SYSTEM } from "ducjs/flatbuffers/duc";
1
+ import { UNIT_SYSTEM } from "../flatbuffers/duc";
2
2
  export const MIN_ZOOM = 1e-32;
3
3
  export const MAX_ZOOM = 1e32;
4
4
  export const NEUTRAL_SCOPE = "m";
@@ -1,7 +1,7 @@
1
- import { ANGULAR_UNITS_FORMAT, DECIMAL_SEPARATOR, DIMENSION_UNITS_FORMAT } from "ducjs/flatbuffers/duc";
2
- import { UnitSystem } from "ducjs/technical/scopes";
3
- import { DucCommonStyle, DucDimensionStyle, DucDocStyle, DucFeatureControlFrameStyle, DucHatchStyle, DucLeaderStyle, DucStackLikeStyles, DucTableStyle, DucTextStyle, DucUcs, DucView, DucViewportStyle, DucXRayStyle, GridSettings, Identifier, PrecisionValue, Scope, SnapSettings, StrokeStyle } from "ducjs/types";
4
- import { ValueOf } from "ducjs/types/utility-types";
1
+ import { ANGULAR_UNITS_FORMAT, DECIMAL_SEPARATOR, DIMENSION_UNITS_FORMAT } from "../flatbuffers/duc";
2
+ import { UnitSystem } from "./scopes";
3
+ import { DucCommonStyle, DucDimensionStyle, DucDocStyle, DucFeatureControlFrameStyle, DucHatchStyle, DucLeaderStyle, DucStackLikeStyles, DucTableStyle, DucTextStyle, DucUcs, DucView, DucViewportStyle, DucXRayStyle, GridSettings, Identifier, PrecisionValue, Scope, SnapSettings, StrokeStyle } from "../types";
4
+ import { ValueOf } from "../types/utility-types";
5
5
  export declare const PREDEFINED_STANDARDS: {
6
6
  readonly DUC: "duc";
7
7
  readonly ISO_25300: "iso-25300-2013";
@@ -1,10 +1,10 @@
1
1
  export * from "./typeChecks";
2
- import { BEZIER_MIRRORING, BLENDING, BLOCK_ATTACHMENT, BOOLEAN_OPERATION, COLUMN_TYPE, DATUM_BRACKET_STYLE, DATUM_TARGET_TYPE, DIMENSION_FIT_RULE, DIMENSION_TEXT_PLACEMENT, DIMENSION_TYPE, ELEMENT_CONTENT_PREFERENCE, FEATURE_MODIFIER, GDT_SYMBOL, HATCH_STYLE, IMAGE_STATUS, LINE_HEAD, LINE_SPACING_TYPE, MARK_ELLIPSE_CENTER, MATERIAL_CONDITION, PARAMETRIC_SOURCE_TYPE, STACKED_TEXT_ALIGN, STROKE_CAP, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, STROKE_SIDE_PREFERENCE, TABLE_CELL_ALIGNMENT, TABLE_FLOW_DIRECTION, TEXT_ALIGN, TEXT_FIELD_SOURCE_PROPERTY, TEXT_FIELD_SOURCE_TYPE, TEXT_FLOW_DIRECTION, TOLERANCE_DISPLAY, TOLERANCE_TYPE, TOLERANCE_ZONE_TYPE, VERTICAL_ALIGN, VIEWPORT_SHADE_PLOT } from "ducjs/flatbuffers/duc";
3
- import { Standard, StandardUnits } from "ducjs/technical/standards";
4
- import { DucView, PrecisionValue, Scope } from "ducjs/types";
5
- import { Axis, GeometricPoint, Percentage, Radian, ScaleFactor } from "ducjs/types/geometryTypes";
6
- import { MakeBrand, MarkNonNullable, MarkOptional, Merge, ValueOf } from "ducjs/types/utility-types";
7
- import { FONT_FAMILY, FREEDRAW_EASINGS } from "ducjs/utils/constants";
2
+ import { BEZIER_MIRRORING, BLENDING, BLOCK_ATTACHMENT, BOOLEAN_OPERATION, COLUMN_TYPE, DATUM_BRACKET_STYLE, DATUM_TARGET_TYPE, DIMENSION_FIT_RULE, DIMENSION_TEXT_PLACEMENT, DIMENSION_TYPE, ELEMENT_CONTENT_PREFERENCE, FEATURE_MODIFIER, GDT_SYMBOL, HATCH_STYLE, IMAGE_STATUS, LINE_HEAD, LINE_SPACING_TYPE, MARK_ELLIPSE_CENTER, MATERIAL_CONDITION, PARAMETRIC_SOURCE_TYPE, STACKED_TEXT_ALIGN, STROKE_CAP, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, STROKE_SIDE_PREFERENCE, TABLE_CELL_ALIGNMENT, TABLE_FLOW_DIRECTION, TEXT_ALIGN, TEXT_FIELD_SOURCE_PROPERTY, TEXT_FIELD_SOURCE_TYPE, TEXT_FLOW_DIRECTION, TOLERANCE_DISPLAY, TOLERANCE_TYPE, TOLERANCE_ZONE_TYPE, VERTICAL_ALIGN, VIEWPORT_SHADE_PLOT } from "../../flatbuffers/duc";
3
+ import { Standard, StandardUnits } from "../../technical/standards";
4
+ import { DucView, PrecisionValue, Scope } from "..";
5
+ import { Axis, GeometricPoint, Percentage, Radian, ScaleFactor } from "../geometryTypes";
6
+ import { MakeBrand, MarkNonNullable, MarkOptional, Merge, ValueOf } from "../utility-types";
7
+ import { FONT_FAMILY, FREEDRAW_EASINGS } from "../../utils/constants";
8
8
  /**
9
9
  * Base styles that all elements share
10
10
  */
@@ -1,7 +1,7 @@
1
- import type { ElementOrToolType } from "ducjs/types";
2
- import type { MarkNonNullable } from "ducjs/types/utility-types";
3
- import { Bounds, LineSegment, TuplePoint } from "ducjs/types/geometryTypes";
4
- import type { DucArrowElement, DucBindableElement, DucElbowArrowElement, DucElement, DucElementType, DucEmbeddableElement, DucFlowchartNodeElement, DucFrameElement, DucFrameLikeElement, DucFreeDrawElement, DucImageElement, DucLinearElement, DucTableElement, DucPointBinding, DucTextContainer, DucTextElement, DucTextElementWithContainer, FixedPointBinding, InitializedDucImageElement, DucNonSelectionElement, DucEllipseElement, DucPolygonElement, DucBlockInstanceElement, NonDeleted, DucIframeLikeElement } from "ducjs/types/elements";
1
+ import type { ElementOrToolType } from "..";
2
+ import type { MarkNonNullable } from "../utility-types";
3
+ import { Bounds, LineSegment, TuplePoint } from "../geometryTypes";
4
+ import type { DucArrowElement, DucBindableElement, DucElbowArrowElement, DucElement, DucElementType, DucEmbeddableElement, DucFlowchartNodeElement, DucFrameElement, DucFrameLikeElement, DucFreeDrawElement, DucImageElement, DucLinearElement, DucTableElement, DucPointBinding, DucTextContainer, DucTextElement, DucTextElementWithContainer, FixedPointBinding, InitializedDucImageElement, DucNonSelectionElement, DucEllipseElement, DucPolygonElement, DucBlockInstanceElement, NonDeleted, DucIframeLikeElement } from "./";
5
5
  export declare const isInitializedImageElement: (element: DucElement | null) => element is InitializedDucImageElement;
6
6
  export declare const isImageElement: (element: DucElement | null) => element is DucImageElement;
7
7
  export declare const isEmbeddableElement: (element: DucElement | null | undefined) => element is DucEmbeddableElement;
@@ -1,4 +1,4 @@
1
- import { assertNever } from "ducjs/utils";
1
+ import { assertNever } from "../../utils";
2
2
  export const isInitializedImageElement = (element) => {
3
3
  return !!element && element.type === "image" && !!element.fileId;
4
4
  };
@@ -1,5 +1,5 @@
1
- import { AXIS } from "ducjs/flatbuffers/duc";
2
- import { ScopedValue, ValueOf } from "ducjs/types";
1
+ import { AXIS } from "../flatbuffers/duc";
2
+ import { ScopedValue, ValueOf } from "./";
3
3
  /**
4
4
  * Axis such as X, Y, Z
5
5
  */
@@ -1,13 +1,13 @@
1
1
  export * from "./elements";
2
2
  export * from "./geometryTypes";
3
3
  export * from "./utility-types";
4
- import { OBJECT_SNAP_MODE, PRUNING_LEVEL } from "ducjs/flatbuffers/duc";
5
- import { SupportedMeasures } from "ducjs/technical/scopes";
6
- import { Standard } from "ducjs/technical/standards";
7
- import { DucBindableElement, DucBlock, DucElement, DucElementType, DucGroup, DucIframeLikeElement, DucLayer, DucLinearElement, DucPoint, DucRegion, DucTextElement, ElementBackground, ElementStroke, ExternalFileId, FontFamilyValues, LineHead, NonDeleted, TextAlign } from "ducjs/types/elements";
8
- import { GeometricPoint, Percentage, Radian, ScaleFactor } from "ducjs/types/geometryTypes";
9
- import { MakeBrand, MaybePromise, ValueOf } from "ducjs/types/utility-types";
10
- import type { GRID_DISPLAY_TYPE, GRID_TYPE, SNAP_MARKER_SHAPE, SNAP_MODE, SNAP_OVERRIDE_BEHAVIOR } from "ducjs/utils/constants";
4
+ import { OBJECT_SNAP_MODE, PRUNING_LEVEL } from "../flatbuffers/duc";
5
+ import { SupportedMeasures } from "../technical/scopes";
6
+ import { Standard } from "../technical/standards";
7
+ import { DucBindableElement, DucBlock, DucElement, DucElementType, DucGroup, DucIframeLikeElement, DucLayer, DucLinearElement, DucPoint, DucRegion, DucTextElement, ElementBackground, ElementStroke, ExternalFileId, FontFamilyValues, LineHead, NonDeleted, TextAlign } from "./elements";
8
+ import { GeometricPoint, Percentage, Radian, ScaleFactor } from "./geometryTypes";
9
+ import { MakeBrand, MaybePromise, ValueOf } from "./utility-types";
10
+ import type { GRID_DISPLAY_TYPE, GRID_TYPE, SNAP_MARKER_SHAPE, SNAP_MODE, SNAP_OVERRIDE_BEHAVIOR } from "../utils/constants";
11
11
  /**
12
12
  * Root data structure for the stored data state
13
13
  */
@@ -1,6 +1,6 @@
1
- import { Scope, ScopedValue } from "ducjs/types";
2
- import { DucElement, DucFreeDrawElement, DucLine, DucLinearElement, DucPoint, DucTextContainer, DucTextElement, DucTextElementWithContainer, ElementsMap } from "ducjs/types/elements";
3
- import { Bounds, GeometricPoint } from "ducjs/types/geometryTypes";
1
+ import { Scope, ScopedValue } from "../types";
2
+ import { DucElement, DucFreeDrawElement, DucLine, DucLinearElement, DucPoint, DucTextContainer, DucTextElement, DucTextElementWithContainer, ElementsMap } from "../types/elements";
3
+ import { Bounds, GeometricPoint } from "../types/geometryTypes";
4
4
  type SV = ScopedValue;
5
5
  /**
6
6
  * Common bounds calculation interface
@@ -1,6 +1,6 @@
1
- import { isArrowElement, isFreeDrawElement, isLinearElement, isTextElement } from "ducjs/types/elements/typeChecks";
2
- import { getBoundTextElementPosition, getLinearElementAbsoluteCoords } from "ducjs/utils/elements/linearElement";
3
- import { getCubicBezierBoundingBox, getQuadraticBezierBoundingBox, rescaleLines, rescalePoints, rotate } from "ducjs/utils/math";
1
+ import { isArrowElement, isFreeDrawElement, isLinearElement, isTextElement } from "../types/elements/typeChecks";
2
+ import { getBoundTextElementPosition, getLinearElementAbsoluteCoords } from "./elements/linearElement";
3
+ import { getCubicBezierBoundingBox, getQuadraticBezierBoundingBox, rescaleLines, rescalePoints, rotate } from "./math";
4
4
  export const getElementAbsoluteCoords = (element, elementsMap, currentScope, includeBoundText = false, returnUnrotatedBoundsOnly = true) => {
5
5
  if (isFreeDrawElement(element)) {
6
6
  return getFreeDrawElementAbsoluteCoords(element);
@@ -1,6 +1,6 @@
1
- import { GridSettings, RawValue, SnapSettings } from "ducjs/types";
2
- import { DucElement, DucEllipseElement, DucFreeDrawElement, DucTextElement, ElementBackground, ElementStroke, FontFamilyValues } from "ducjs/types/elements";
3
- import { MAX_ZOOM, MIN_ZOOM } from "ducjs/technical/scopes";
1
+ import { GridSettings, RawValue, SnapSettings } from "../types";
2
+ import { DucElement, DucEllipseElement, DucFreeDrawElement, DucTextElement, ElementBackground, ElementStroke, FontFamilyValues } from "../types/elements";
3
+ import { MAX_ZOOM, MIN_ZOOM } from "../technical/scopes";
4
4
  export declare const COLOR_PALETTE: {
5
5
  readonly transparent: "transparent";
6
6
  readonly black: "#1e1e1e";
@@ -1,5 +1,5 @@
1
- import { ELEMENT_CONTENT_PREFERENCE, OBJECT_SNAP_MODE, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN } from "ducjs/flatbuffers/duc";
2
- import { MAX_ZOOM, MIN_ZOOM, NEUTRAL_SCOPE } from "ducjs/technical/scopes";
1
+ import { ELEMENT_CONTENT_PREFERENCE, OBJECT_SNAP_MODE, STROKE_JOIN, STROKE_PLACEMENT, STROKE_PREFERENCE, TEXT_ALIGN, VERTICAL_ALIGN } from "../flatbuffers/duc";
2
+ import { MAX_ZOOM, MIN_ZOOM, NEUTRAL_SCOPE } from "../technical/scopes";
3
3
  export const COLOR_PALETTE = {
4
4
  transparent: "transparent",
5
5
  black: "#1e1e1e",
@@ -1,4 +1,4 @@
1
- import { DucElement, DucElementsIncludingDeleted, DucFrameLikeElement, ElementsMap } from "ducjs/types/elements";
1
+ import { DucElement, DucElementsIncludingDeleted, DucFrameLikeElement, ElementsMap } from "../../types/elements";
2
2
  export declare const getContainingFrame: (element: DucElement, elementsMap: ElementsMap) => DucFrameLikeElement | null;
3
3
  export declare const getFrameLikeElements: (allElements: DucElementsIncludingDeleted) => DucFrameLikeElement[];
4
4
  export declare const getFrameLikeTitle: (element: DucFrameLikeElement) => string;