@ibodr/draw 0.2.13 → 0.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2353,11 +2353,6 @@ declare class ArrowShapeUtil extends ShapeUtil<DrArrowShape> {
2353
2353
  canBeLaidOut(shape: DrArrowShape, info: DrShapeUtilCanBeLaidOutOpts): boolean;
2354
2354
  getFontFaces(shape: DrArrowShape): _ibodr_schema.DrFontFace[];
2355
2355
  getDefaultProps(): DrArrowShape['props'];
2356
- getLodStyle(shape: DrArrowShape): {
2357
- fill: null;
2358
- stroke: string;
2359
- strokeWidth: number;
2360
- };
2361
2356
  getGeometry(shape: DrArrowShape): Group2d;
2362
2357
  getHandles(shape: DrArrowShape): DrHandle[];
2363
2358
  getText(shape: DrArrowShape): string;
@@ -2477,11 +2472,6 @@ declare class DrawShapeUtil extends ShapeUtil<DrDrawShape> {
2477
2472
  hideRotateHandle(shape: DrDrawShape): boolean;
2478
2473
  hideSelectionBoundsFg(shape: DrDrawShape): boolean;
2479
2474
  getDefaultProps(): DrDrawShape['props'];
2480
- getLodStyle(shape: DrDrawShape): {
2481
- fill: string | null;
2482
- stroke: string;
2483
- strokeWidth: number;
2484
- } | null;
2485
2475
  getGeometry(shape: DrDrawShape): Polyline2d | Circle2d;
2486
2476
  component(shape: DrDrawShape): react_jsx_runtime.JSX.Element;
2487
2477
  getIndicatorPath(shape: DrDrawShape): Path2D;
@@ -3063,12 +3053,6 @@ declare class HighlightShapeUtil extends ShapeUtil<DrHighlightShape> {
3063
3053
  hideRotateHandle(shape: DrHighlightShape): boolean;
3064
3054
  hideSelectionBoundsFg(shape: DrHighlightShape): boolean;
3065
3055
  getDefaultProps(): DrHighlightShape['props'];
3066
- getLodStyle(shape: DrHighlightShape): {
3067
- fill: null;
3068
- stroke: string;
3069
- strokeWidth: number;
3070
- opacity: number;
3071
- } | null;
3072
3056
  getGeometry(shape: DrHighlightShape): Polygon2d | Circle2d;
3073
3057
  component(shape: DrHighlightShape): react_jsx_runtime.JSX.Element;
3074
3058
  backgroundComponent(shape: DrHighlightShape): react_jsx_runtime.JSX.Element;
@@ -3105,6 +3089,7 @@ declare class ImageShapeUtil extends BaseBoxShapeUtil<DrImageShape> {
3105
3089
  stroke: null;
3106
3090
  strokeWidth: number;
3107
3091
  unmountWhenCulled: boolean;
3092
+ snapshotBelowPx: number;
3108
3093
  };
3109
3094
  getDefaultProps(): DrImageShape['props'];
3110
3095
  createShapeForAsset(asset: DrAsset, position: VecModel): DrShapePartial | null;
@@ -3138,11 +3123,6 @@ declare class LineShapeUtil extends ShapeUtil<DrLineShape> {
3138
3123
  hideSelectionBoundsBg(shape: DrLineShape): boolean;
3139
3124
  hideInMinimap(): boolean;
3140
3125
  getDefaultProps(): DrLineShape['props'];
3141
- getLodStyle(shape: DrLineShape): {
3142
- fill: null;
3143
- stroke: string;
3144
- strokeWidth: number;
3145
- };
3146
3126
  getGeometry(shape: DrLineShape): PathBuilderGeometry2d;
3147
3127
  getHandles(shape: DrLineShape): DrHandle[];
3148
3128
  onResize(shape: DrLineShape, info: DrResizeInfo<DrLineShape>): {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { objectMapValues, WeakCache, useMaybeEditor, uniqueId, useValue, assert, tlenv, track, useEditor, useEditorComponents, useContainer, preventDefault, usePassThroughWheelEvents, debugFlags, PageRecordType, setPointerCapture, releasePointerCapture, usePresence, USER_COLORS, tltime, modulate, isEqual, approximately, Box, debounce, EditorAtom, useReactor, unsafe__withoutCapture, isEqualAllowingForFloatingPointErrors, createComputedCache as createComputedCache$1, useUniqueSafeId, useEvent, resolveLineHeightPx, toRichText, Vec, getChangedKeys, useSharedSafeId, useIsEditing, toDomPrecision, LruCache, HTMLContainer, MediaHelpers, Image, getGlobalDocument, defaultUserPreferences, useShallowArrayIdentity, mergeArraysAndReplaceDefaults, useDrStore, Editor as Editor$1, T, registerDrawLibraryVersion, getOwnProperty, atom, tlenvReactive, warnOnce, safeParseUrl, useGlobalMenuIsOpen, getFromLocalStorage, setInLocalStorage, getIndexAbove, getIndexBelow, getIndexBetween, exhaustiveSwitchError, getOwnerWindow, DefaultColorStyle, getColorValue, tlmenus, SharedStyleMap, DefaultDashStyle, DefaultFillStyle, DefaultSizeStyle, kickoutOccludedShapes, useAtom, react, lerp, isSafeFloat, Mat, isAccelKey, openWindow, Polyline2d, Arc2d, Edge2d, useSvgExportContext, useColorMode, getVerticesCountForArcLength, Group2d, assertExists, clamp, rng, canonicalizeRotation, getPolygonVertices, useDelaySvgExport, noop, getGlobalWindow, useShallowObjectIdentity, GeoShapeGeoStyle, ShapeUtil, textShapeProps, textShapeMigrations, Rectangle2d, getFontsFromRichText, resizeScaled, BaseBoxShapeUtil, bookmarkShapeProps, bookmarkShapeMigrations, drawShapeProps, drawShapeMigrations, Circle2d, Polygon2d, SVGContainer, last, geoShapeProps, geoShapeMigrations, EMPTY_ARRAY, noteShapeProps, noteShapeMigrations, lineShapeProps, lineShapeMigrations, getIndices, sortByIndex, mapObjectMapValues, maybeSnapToGrid, ZERO_INDEX_KEY, BaseFrameLikeShapeUtil, frameShapeProps, frameShapeMigrations, compact, arrowShapeProps, arrowShapeMigrations, invLerp, structuredClone, highlightShapeProps, highlightShapeMigrations, embedShapeProps, embedShapeMigrations, resizeBox, imageShapeProps, imageShapeMigrations, createShapeId, Ellipse2d, videoShapeProps, videoShapeMigrations, BindingUtil, arrowBindingProps, arrowBindingMigrations, DefaultSpinner, elementShouldCaptureKeys, minBy, DefaultFontStyle, DefaultTextAlignStyle, DefaultHorizontalAlignStyle, DefaultVerticalAlignStyle, ArrowShapeKindStyle, ArrowShapeArrowheadEndStyle, ArrowShapeArrowheadStartStyle, LineShapeSplineStyle, activeElementShouldCaptureKeys, Geometry2dFilters, pointInPolygon, intersectLineSegmentPolygon, centerOfCircleFromThreePoints, clockwiseAngleDist, counterClockwiseAngleDist, PI, getPointerInfo, intersectCircleCircle, HALF_PI, suffixSafeId, getPerfectDashProps, Geometry2d, CubicBezier2d, LANGUAGES, getFirstCharacter, usePeerIds, objectMapEntries, getIndicesBetween, AssetRecordType, getHashForString, b64Vecs, computed, objectMapKeys, intersectLineSegmentCircle, EASINGS, fetch, FileHelpers, isFontEntry, PI2, hardResetEditor, sanitizeId, Result, transact, isShapeId, richTextValidator, isDefined, featureFlags, useQuickReactor, objectMapFromEntries, uniq, createBindingId, getHashForBuffer, bind, getPointOnCircle, AssetUtil, bookmarkAssetProps, bookmarkAssetMigrations, clampToBrowserMaxCanvasSize, imageAssetProps, imageAssetMigrations, DEFAULT_SUPPORTED_IMAGE_TYPES, videoAssetProps, videoAssetMigrations, DEFAULT_SUPPORT_VIDEO_TYPES, OverlayUtil, getOverlayDisplayValues, isCursorInViewport, getSvgPathFromPoints, strokeShapeIndicators, SIDES, rangeIntersection, StateNode, BaseBoxShapeTool, DrawEditor, useOnMount, createDrStore, MigrationFailureReason, DIM_2D, toFixed, snapAngle, rotateSelectionHandle, areAnglesCompatible, getRotationSnapshot, applyRotationToSnapshotShapes, shortAngleDist, degreesToRadians, isPageId, polygonsIntersect, LoadingScreen as LoadingScreen$1, SIN, throttle } from '@ibodr/editor';
1
+ import { objectMapValues, WeakCache, useMaybeEditor, uniqueId, useValue, assert, tlenv, track, useEditor, useEditorComponents, useContainer, preventDefault, usePassThroughWheelEvents, debugFlags, PageRecordType, setPointerCapture, releasePointerCapture, usePresence, USER_COLORS, tltime, modulate, isEqual, approximately, Box, debounce, EditorAtom, useReactor, unsafe__withoutCapture, isEqualAllowingForFloatingPointErrors, createComputedCache as createComputedCache$1, useUniqueSafeId, useEvent, resolveLineHeightPx, toRichText, Vec, getChangedKeys, useSharedSafeId, useIsEditing, toDomPrecision, LruCache, HTMLContainer, MediaHelpers, Image, getGlobalDocument, defaultUserPreferences, useShallowArrayIdentity, mergeArraysAndReplaceDefaults, useDrStore, Editor as Editor$1, T, registerDrawLibraryVersion, getOwnProperty, atom, tlenvReactive, warnOnce, safeParseUrl, useGlobalMenuIsOpen, getFromLocalStorage, setInLocalStorage, getIndexAbove, getIndexBelow, getIndexBetween, exhaustiveSwitchError, getOwnerWindow, DefaultColorStyle, getColorValue, tlmenus, SharedStyleMap, DefaultDashStyle, DefaultFillStyle, DefaultSizeStyle, kickoutOccludedShapes, useAtom, react, lerp, isSafeFloat, Mat, isAccelKey, openWindow, Polyline2d, Arc2d, Edge2d, useSvgExportContext, useColorMode, getVerticesCountForArcLength, Group2d, assertExists, clamp, rng, canonicalizeRotation, getPolygonVertices, useDelaySvgExport, noop, getGlobalWindow, useShallowObjectIdentity, GeoShapeGeoStyle, ShapeUtil, textShapeProps, textShapeMigrations, Rectangle2d, getFontsFromRichText, resizeScaled, BaseBoxShapeUtil, bookmarkShapeProps, bookmarkShapeMigrations, drawShapeProps, drawShapeMigrations, Circle2d, Polygon2d, SVGContainer, last, geoShapeProps, geoShapeMigrations, EMPTY_ARRAY, noteShapeProps, noteShapeMigrations, lineShapeProps, lineShapeMigrations, getIndices, sortByIndex, mapObjectMapValues, maybeSnapToGrid, ZERO_INDEX_KEY, BaseFrameLikeShapeUtil, frameShapeProps, frameShapeMigrations, compact, arrowShapeProps, arrowShapeMigrations, invLerp, structuredClone, highlightShapeProps, highlightShapeMigrations, embedShapeProps, embedShapeMigrations, resizeBox, imageShapeProps, imageShapeMigrations, LOD_SNAPSHOT_SCREEN_PX, createShapeId, Ellipse2d, videoShapeProps, videoShapeMigrations, BindingUtil, arrowBindingProps, arrowBindingMigrations, DefaultSpinner, elementShouldCaptureKeys, minBy, DefaultFontStyle, DefaultTextAlignStyle, DefaultHorizontalAlignStyle, DefaultVerticalAlignStyle, ArrowShapeKindStyle, ArrowShapeArrowheadEndStyle, ArrowShapeArrowheadStartStyle, LineShapeSplineStyle, activeElementShouldCaptureKeys, Geometry2dFilters, pointInPolygon, intersectLineSegmentPolygon, centerOfCircleFromThreePoints, clockwiseAngleDist, counterClockwiseAngleDist, PI, getPointerInfo, intersectCircleCircle, HALF_PI, suffixSafeId, getPerfectDashProps, Geometry2d, CubicBezier2d, LANGUAGES, getFirstCharacter, usePeerIds, objectMapEntries, getIndicesBetween, AssetRecordType, getHashForString, b64Vecs, computed, objectMapKeys, intersectLineSegmentCircle, EASINGS, fetch, FileHelpers, isFontEntry, PI2, hardResetEditor, sanitizeId, Result, transact, isShapeId, richTextValidator, isDefined, featureFlags, useQuickReactor, objectMapFromEntries, uniq, createBindingId, getHashForBuffer, bind, getPointOnCircle, AssetUtil, bookmarkAssetProps, bookmarkAssetMigrations, clampToBrowserMaxCanvasSize, imageAssetProps, imageAssetMigrations, DEFAULT_SUPPORTED_IMAGE_TYPES, videoAssetProps, videoAssetMigrations, DEFAULT_SUPPORT_VIDEO_TYPES, OverlayUtil, getOverlayDisplayValues, isCursorInViewport, getSvgPathFromPoints, strokeShapeIndicators, SIDES, rangeIntersection, StateNode, BaseBoxShapeTool, DrawEditor, useOnMount, createDrStore, MigrationFailureReason, DIM_2D, toFixed, snapAngle, rotateSelectionHandle, areAnglesCompatible, getRotationSnapshot, applyRotationToSnapshotShapes, shortAngleDist, degreesToRadians, isPageId, polygonsIntersect, LoadingScreen as LoadingScreen$1, SIN, throttle } from '@ibodr/editor';
2
2
  export * from '@ibodr/editor';
3
3
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
4
4
  import * as React4 from 'react';
@@ -27391,10 +27391,6 @@ var ArrowShapeUtil = class extends ShapeUtil {
27391
27391
  scale: 1
27392
27392
  };
27393
27393
  }
27394
- getLodStyle(shape) {
27395
- const dv = getDisplayValues(this, shape);
27396
- return { fill: null, stroke: dv.strokeColor, strokeWidth: dv.strokeWidth };
27397
- }
27398
27394
  getGeometry(shape) {
27399
27395
  const isEditing = this.editor.getEditingShapeId() === shape.id;
27400
27396
  const info = getArrowInfo(this.editor, shape);
@@ -28854,17 +28850,6 @@ var DrawShapeUtil = class extends ShapeUtil {
28854
28850
  scaleY: 1
28855
28851
  };
28856
28852
  }
28857
- getLodStyle(shape) {
28858
- if (!shape.props.isComplete || shape.props.segments.length === 0) return null;
28859
- const dv = getDisplayValues(this, shape);
28860
- const sw = (dv.strokeWidth + 1) * shape.props.scale;
28861
- const filled = shape.props.isClosed && shape.props.fill !== "none";
28862
- return {
28863
- fill: filled ? dv.fillColor : null,
28864
- stroke: dv.strokeColor,
28865
- strokeWidth: sw
28866
- };
28867
- }
28868
28853
  getGeometry(shape) {
28869
28854
  const points = getPointsFromDrawSegments(
28870
28855
  shape.props.segments,
@@ -30795,16 +30780,6 @@ var HighlightShapeUtil = class extends ShapeUtil {
30795
30780
  scaleY: 1
30796
30781
  };
30797
30782
  }
30798
- getLodStyle(shape) {
30799
- if (!shape.props.isComplete || shape.props.segments.length === 0) return null;
30800
- const dv = getDisplayValues(this, shape);
30801
- return {
30802
- fill: null,
30803
- stroke: dv.strokeColor,
30804
- strokeWidth: dv.strokeWidth,
30805
- opacity: dv.underlayOpacity
30806
- };
30807
- }
30808
30783
  getGeometry(shape) {
30809
30784
  const dv = getDisplayValues(this, shape);
30810
30785
  const strokeWidth = dv.strokeWidth * shape.props.scale;
@@ -31303,7 +31278,13 @@ var ImageShapeUtil = class extends BaseBoxShapeUtil {
31303
31278
  return true;
31304
31279
  }
31305
31280
  getLodStyle(_shape) {
31306
- return { fill: null, stroke: null, strokeWidth: 0, unmountWhenCulled: true };
31281
+ return {
31282
+ fill: null,
31283
+ stroke: null,
31284
+ strokeWidth: 0,
31285
+ unmountWhenCulled: true,
31286
+ snapshotBelowPx: LOD_SNAPSHOT_SCREEN_PX
31287
+ };
31307
31288
  }
31308
31289
  getDefaultProps() {
31309
31290
  return {
@@ -31792,10 +31773,6 @@ var LineShapeUtil = class extends ShapeUtil {
31792
31773
  scale: 1
31793
31774
  };
31794
31775
  }
31795
- getLodStyle(shape) {
31796
- const dv = getDisplayValues(this, shape);
31797
- return { fill: null, stroke: dv.strokeColor, strokeWidth: dv.strokeWidth };
31798
- }
31799
31776
  getGeometry(shape) {
31800
31777
  const geometry = getPathForLineShape(shape).toGeometry();
31801
31778
  assert(geometry instanceof PathBuilderGeometry2d);
@@ -40276,7 +40253,7 @@ init_sanitizeSvg();
40276
40253
  // src/index.ts
40277
40254
  registerDrawLibraryVersion(
40278
40255
  "@ibodr/draw",
40279
- "0.2.13",
40256
+ "0.2.15",
40280
40257
  "esm"
40281
40258
  );
40282
40259
  /*!