@ibodr/draw 0.2.2 → 0.2.4
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 +9 -3
- package/dist/index.mjs +69 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -76,13 +76,17 @@ interface SolidPathBuilderOpts extends BasePathBuilderOpts {
|
|
|
76
76
|
}
|
|
77
77
|
/** @public */
|
|
78
78
|
interface DashedPathBuilderOpts extends BasePathBuilderOpts {
|
|
79
|
-
style: 'dashed' | 'dotted';
|
|
79
|
+
style: 'dashed' | 'dotted' | 'sparse';
|
|
80
80
|
snap?: number;
|
|
81
81
|
end?: PerfectDashTerminal;
|
|
82
82
|
start?: PerfectDashTerminal;
|
|
83
83
|
lengthRatio?: number;
|
|
84
84
|
}
|
|
85
85
|
/** @public */
|
|
86
|
+
interface DoublePathBuilderOpts extends BasePathBuilderOpts {
|
|
87
|
+
style: 'double';
|
|
88
|
+
}
|
|
89
|
+
/** @public */
|
|
86
90
|
interface DrawPathBuilderDOpts {
|
|
87
91
|
strokeWidth: number;
|
|
88
92
|
randomSeed: string;
|
|
@@ -100,7 +104,7 @@ interface NonePathBuilderOpts extends BasePathBuilderOpts {
|
|
|
100
104
|
style: 'none';
|
|
101
105
|
}
|
|
102
106
|
/** @public */
|
|
103
|
-
type PathBuilderOpts = SolidPathBuilderOpts | DashedPathBuilderOpts | DrawPathBuilderOpts | NonePathBuilderOpts;
|
|
107
|
+
type PathBuilderOpts = SolidPathBuilderOpts | DashedPathBuilderOpts | DoublePathBuilderOpts | DrawPathBuilderOpts | NonePathBuilderOpts;
|
|
104
108
|
/** @public */
|
|
105
109
|
interface PathBuilderCommandOpts {
|
|
106
110
|
/**
|
|
@@ -190,6 +194,8 @@ declare class PathBuilder {
|
|
|
190
194
|
toPath2D(opts: PathBuilderOpts): Path2D;
|
|
191
195
|
toGeometry(): PathBuilderGeometry2d | Group2d;
|
|
192
196
|
private toSolidSvg;
|
|
197
|
+
/** Two parallel strokes: a thick stroke with the center cut out by a mask. */
|
|
198
|
+
private toDoubleSvg;
|
|
193
199
|
private toDashedSvg;
|
|
194
200
|
private toDrawSvg;
|
|
195
201
|
toDrawD(opts: DrawPathBuilderDOpts): string;
|
|
@@ -583,7 +589,7 @@ declare function DrawUiMenuToolItem({ toolId, ...rest }: DrUiMenuToolItemProps):
|
|
|
583
589
|
declare const DefaultToasts: React$1.NamedExoticComponent<object>;
|
|
584
590
|
|
|
585
591
|
/** @public */
|
|
586
|
-
type DrUiTranslationKey = 'action.toggle-auto-pan' | 'action.toggle-auto-zoom' | 'action.toggle-auto-none' | 'action.toggle-mouse' | 'action.toggle-trackpad' | 'action.convert-to-bookmark' | 'action.convert-to-embed' | 'action.open-embed-link' | 'action.align-bottom' | 'action.align-center-horizontal' | 'action.align-center-vertical' | 'action.align-center-horizontal.short' | 'action.align-center-vertical.short' | 'action.align-left' | 'action.align-right' | 'action.align-top' | 'action.back-to-content' | 'action.bring-forward' | 'action.bring-to-front' | 'action.copy-as-json.short' | 'action.copy-as-json' | 'action.copy-as-png.short' | 'action.copy-as-png' | 'action.copy-as-svg.short' | 'action.copy-as-svg' | 'action.copy' | 'action.copy-hovered-styles' | 'action.cut' | 'action.delete' | 'action.unlock-all' | 'action.distribute-horizontal' | 'action.distribute-vertical' | 'action.distribute-horizontal.short' | 'action.distribute-vertical.short' | 'action.download-original' | 'action.duplicate' | 'action.edit-link' | 'action.exit-pen-mode' | 'action.export-as-png.short' | 'action.export-as-png' | 'action.export-as-svg.short' | 'action.export-as-svg' | 'action.export-all-as-png.short' | 'action.export-all-as-png' | 'action.export-all-as-svg.short' | 'action.export-all-as-svg' | 'action.fit-frame-to-content' | 'action.flip-horizontal' | 'action.flip-vertical' | 'action.flip-horizontal.short' | 'action.flip-vertical.short' | 'action.fork-project' | 'action.fork-project-on-tldraw' | 'action.group' | 'action.insert-embed' | 'action.insert-media' | 'action.leave-shared-project' | 'action.new-project' | 'action.new-shared-project' | 'action.open-cursor-chat' | 'action.open-kbd-shortcuts' | 'action.open-file' | 'action.pack' | 'action.paste' | 'action.paste-error-title' | 'action.paste-error-description' | 'action.print' | 'action.redo' | 'action.remove-frame' | 'action.rename' | 'action.rotate-ccw' | 'action.rotate-cw' | 'action.save-copy' | 'action.select-all' | 'action.select-none' | 'action.send-backward' | 'action.send-to-back' | 'action.share-project' | 'action.stack-horizontal' | 'action.stack-vertical' | 'action.stack-horizontal.short' | 'action.stack-vertical.short' | 'action.stop-following' | 'action.stretch-horizontal' | 'action.stretch-vertical' | 'action.stretch-horizontal.short' | 'action.stretch-vertical.short' | 'action.toggle-auto-size' | 'action.toggle-dark-mode.menu' | 'action.toggle-dark-mode' | 'action.toggle-paste-at-cursor.menu' | 'action.toggle-paste-at-cursor' | 'action.toggle-wrap-mode.menu' | 'action.toggle-wrap-mode' | 'action.toggle-reduce-motion.menu' | 'action.toggle-reduce-motion' | 'action.toggle-keyboard-shortcuts.menu' | 'action.toggle-keyboard-shortcuts' | 'action.enhanced-a11y-mode.menu' | 'action.enhanced-a11y-mode' | 'action.toggle-edge-scrolling.menu' | 'action.toggle-edge-scrolling' | 'action.toggle-invert-zoom.menu' | 'action.toggle-invert-zoom' | 'action.toggle-debug-mode.menu' | 'action.toggle-debug-mode' | 'action.toggle-focus-mode.menu' | 'action.toggle-focus-mode' | 'action.toggle-dynamic-size-mode.menu' | 'action.toggle-dynamic-size-mode' | 'action.toggle-grid.menu' | 'action.toggle-grid' | 'action.toggle-lock' | 'action.flatten-to-image' | 'action.toggle-snap-mode.menu' | 'action.toggle-snap-mode' | 'action.toggle-tool-lock.menu' | 'action.toggle-tool-lock' | 'action.toggle-transparent.context-menu' | 'action.toggle-transparent.menu' | 'action.toggle-transparent' | 'action.undo' | 'action.ungroup' | 'action.zoom-in' | 'action.zoom-out' | 'action.zoom-to-100' | 'action.zoom-to-fit' | 'action.zoom-to-selection' | 'action.zoom-quick' | 'action.select-zoom-tool' | 'assets.files.size-too-big' | 'assets.files.maximum-size' | 'assets.files.type-not-allowed' | 'assets.files.upload-failed' | 'assets.files.amount-too-many' | 'assets.url.failed' | 'theme.dark' | 'theme.light' | 'theme.system' | 'color-style.white' | 'color-style.black' | 'color-style.blue' | 'color-style.green' | 'color-style.grey' | 'color-style.light-blue' | 'color-style.light-green' | 'color-style.light-red' | 'color-style.light-violet' | 'color-style.orange' | 'color-style.red' | 'color-style.violet' | 'color-style.yellow' | 'fill-style.none' | 'document.default-name' | 'fill-style.semi' | 'fill-style.solid' | 'fill-style.pattern' | 'fill-style.fill' | 'fill-style.lined-fill' | 'dash-style.dashed' | 'dash-style.dotted' | 'dash-style.draw' | 'dash-style.solid' | 'size-style.s' | 'size-style.m' | 'size-style.l' | 'size-style.xl' | 'opacity-style.0.1' | 'opacity-style.0.25' | 'opacity-style.0.5' | 'opacity-style.0.75' | 'opacity-style.1' | 'font-style.draw' | 'font-style.sans' | 'font-style.serif' | 'font-style.mono' | 'align-style.start' | 'align-style.middle' | 'align-style.end' | 'align-style.justify' | 'verticalAlign-style.start' | 'verticalAlign-style.middle' | 'verticalAlign-style.end' | 'geo-style.arrow-down' | 'geo-style.arrow-left' | 'geo-style.arrow-right' | 'geo-style.arrow-up' | 'geo-style.cloud' | 'geo-style.diamond' | 'geo-style.ellipse' | 'geo-style.heart' | 'geo-style.hexagon' | 'geo-style.octagon' | 'geo-style.oval' | 'geo-style.pentagon' | 'geo-style.rectangle' | 'geo-style.rhombus' | 'geo-style.rhombus-2' | 'geo-style.star' | 'geo-style.trapezoid' | 'geo-style.triangle' | 'geo-style.x-box' | 'geo-style.check-box' | 'arrowheadStart-style.none' | 'arrowheadStart-style.arrow' | 'arrowheadStart-style.bar' | 'arrowheadStart-style.diamond' | 'arrowheadStart-style.dot' | 'arrowheadStart-style.inverted' | 'arrowheadStart-style.pipe' | 'arrowheadStart-style.square' | 'arrowheadStart-style.triangle' | 'arrowheadEnd-style.none' | 'arrowheadEnd-style.arrow' | 'arrowheadEnd-style.bar' | 'arrowheadEnd-style.diamond' | 'arrowheadEnd-style.dot' | 'arrowheadEnd-style.inverted' | 'arrowheadEnd-style.pipe' | 'arrowheadEnd-style.square' | 'arrowheadEnd-style.triangle' | 'spline-style.line' | 'spline-style.cubic' | 'arrow-kind-style.arc' | 'arrow-kind-style.elbow' | 'tool.select' | 'tool.hand' | 'tool.draw' | 'tool.eraser' | 'tool.arrow-down' | 'tool.arrow-left' | 'tool.arrow-right' | 'tool.arrow-up' | 'tool.arrow' | 'tool.cloud' | 'tool.diamond' | 'tool.ellipse' | 'tool.heart' | 'tool.hexagon' | 'tool.highlight' | 'tool.line' | 'tool.octagon' | 'tool.oval' | 'tool.pentagon' | 'tool.rectangle' | 'tool.rhombus' | 'tool.star' | 'tool.trapezoid' | 'tool.triangle' | 'tool.x-box' | 'tool.check-box' | 'tool.media' | 'tool.frame' | 'tool.note' | 'tool.laser' | 'tool.embed' | 'tool.text' | 'tool.pointer-down' | 'tool.image-zoom' | 'tool.replace-media' | 'tool.flip-horz' | 'tool.flip-vert' | 'tool.rotate-cw' | 'tool.aspect-ratio' | 'tool.aspect-ratio.original' | 'tool.aspect-ratio.square' | 'tool.aspect-ratio.circle' | 'tool.aspect-ratio.landscape' | 'tool.aspect-ratio.portrait' | 'tool.aspect-ratio.wide' | 'tool.image-toolbar-title' | 'tool.image-crop' | 'tool.image-crop-confirm' | 'tool.media-alt-text' | 'tool.media-alt-text-desc' | 'tool.media-alt-text-confirm' | 'tool.rich-text-bold' | 'tool.rich-text-italic' | 'tool.rich-text-code' | 'tool.rich-text-highlight' | 'tool.rich-text-strikethrough' | 'tool.rich-text-link' | 'tool.rich-text-link-visit' | 'tool.rich-text-link-remove' | 'tool.rich-text-header' | 'tool.rich-text-bulletList' | 'tool.rich-text-toolbar-title' | 'tool.rich-text-orderedList' | 'tool.bookmark' | 'a11y.status' | 'a11y.skip-to-main-content' | 'a11y.shape-index' | 'a11y.shape-image' | 'a11y.shape-video' | 'a11y.multiple-shapes' | 'a11y.select-shape' | 'a11y.select-shape-direction' | 'a11y.enter-leave-container' | 'a11y.repeat-shape' | 'a11y.move-shape' | 'a11y.move-shape-faster' | 'a11y.rotate-shape-cw' | 'a11y.rotate-shape-ccw' | 'a11y.rotate-shape-cw-fine' | 'a11y.rotate-shape-ccw-fine' | 'a11y.enlarge-shape' | 'a11y.shrink-shape' | 'a11y.pan-camera' | 'a11y.adjust-shape-styles' | 'a11y.open-context-menu' | 'a11y.open-keyboard-shortcuts' | 'menu.title' | 'menu.theme' | 'menu.color-theme' | 'menu.accessibility' | 'menu.copy-as' | 'menu.edit' | 'menu.export-as' | 'menu.file' | 'menu.language' | 'menu.preferences' | 'menu.view' | 'menu.input-device' | 'context-menu.title' | 'context-menu.edit' | 'context-menu.arrange' | 'context-menu.copy-as' | 'context-menu.export-as' | 'context-menu.export-all-as' | 'context-menu.move-to-page' | 'context-menu.reorder' | 'page-menu.title' | 'page-menu.create-new-page' | 'page-menu.new-page-initial-name' | 'page-menu.edit-start' | 'page-menu.edit-done' | 'page-menu.go-to-page' | 'page-menu.resize' | 'page-menu.submenu.rename' | 'page-menu.submenu.duplicate-page' | 'page-menu.submenu.title' | 'page-menu.submenu.move-down' | 'page-menu.submenu.move-up' | 'page-menu.submenu.delete' | 'share-menu.title' | 'share-menu.save-note' | 'share-menu.fork-note' | 'share-menu.share-project' | 'share-menu.copy-link' | 'share-menu.create-snapshot-link' | 'share-menu.snapshot-link-note' | 'share-menu.copy-readonly-link' | 'share-menu.offline-note' | 'share-menu.copy-link-note' | 'share-menu.copy-readonly-link-note' | 'share-menu.project-too-large' | 'share-menu.upload-failed' | 'share-menu.creating-project' | 'share-menu.copied' | 'document-name-menu.copy-link' | 'status.offline' | 'people-menu.title' | 'people-menu.change-name' | 'people-menu.avatar-color' | 'people-menu.change-color' | 'people-menu.follow' | 'people-menu.following' | 'people-menu.leading' | 'people-menu.user' | 'people-menu.invite' | 'people-menu.anonymous-user' | 'help-menu.import-tldr-file' | 'help-menu.title' | 'help-menu.about' | 'help-menu.discord' | 'help-menu.github' | 'help-menu.keyboard-shortcuts' | 'help-menu.twitter' | 'help-menu.terms' | 'help-menu.privacy' | 'actions-menu.title' | 'edit-link-dialog.title' | 'edit-link-dialog.invalid-url' | 'edit-link-dialog.detail' | 'edit-link-dialog.url' | 'edit-link-dialog.clear' | 'edit-link-dialog.save' | 'edit-link-dialog.cancel' | 'edit-link-dialog.external-link' | 'embed-dialog.title' | 'embed-dialog.back' | 'embed-dialog.create' | 'embed-dialog.cancel' | 'embed-dialog.url' | 'embed-dialog.instruction' | 'embed-dialog.invalid-url' | 'shortcuts-dialog.title' | 'shortcuts-dialog.edit' | 'shortcuts-dialog.file' | 'shortcuts-dialog.preferences' | 'shortcuts-dialog.tools' | 'shortcuts-dialog.transform' | 'shortcuts-dialog.view' | 'shortcuts-dialog.collaboration' | 'shortcuts-dialog.a11y' | 'shortcuts-dialog.text-formatting' | 'style-panel.title' | 'style-panel.align' | 'style-panel.label-align' | 'style-panel.vertical-align' | 'style-panel.position' | 'style-panel.arrowheads' | 'style-panel.arrowhead-start' | 'style-panel.arrowhead-end' | 'style-panel.arrow-kind' | 'style-panel.color' | 'style-panel.dash' | 'style-panel.fill' | 'style-panel.font' | 'style-panel.geo' | 'style-panel.mixed' | 'style-panel.opacity' | 'style-panel.size' | 'style-panel.spline' | 'style-panel.selected' | 'tool-panel.title' | 'tool-panel.more' | 'navigation-zone.title' | 'navigation-zone.minimap' | 'navigation-zone.toggle-minimap' | 'navigation-zone.zoom' | 'focus-mode.toggle-focus-mode' | 'toast.close' | 'toast.success' | 'toast.error' | 'toast.info' | 'toast.warning' | 'file-system.file-open-error.title' | 'file-system.file-open-error.not-a-tldraw-file' | 'file-system.file-open-error.file-format-version-too-new' | 'file-system.file-open-error.generic-corrupted-file' | 'file-system.confirm-open.title' | 'file-system.confirm-open.description' | 'file-system.confirm-open.cancel' | 'file-system.confirm-open.open' | 'file-system.confirm-open.dont-show-again' | 'file-system.confirm-clear.title' | 'file-system.confirm-clear.description' | 'file-system.confirm-clear.cancel' | 'file-system.confirm-clear.continue' | 'file-system.confirm-clear.dont-show-again' | 'file-system.shared-document-file-open-error.title' | 'file-system.shared-document-file-open-error.description' | 'sharing.confirm-leave.title' | 'sharing.confirm-leave.description' | 'sharing.confirm-leave.cancel' | 'sharing.confirm-leave.leave' | 'sharing.confirm-leave.dont-show-again' | 'toast.error.export-fail.title' | 'toast.error.export-fail.desc' | 'toast.error.copy-fail.title' | 'toast.error.copy-fail.desc' | 'context.pages.new-page' | 'vscode.file-open.desc' | 'vscode.file-open.open' | 'vscode.file-open.backup' | 'vscode.file-open.backup-saved' | 'vscode.file-open.backup-failed' | 'vscode.file-open.dont-show-again' | 'cursor-chat.type-to-chat' | 'app.loading' | 'handle.resize-top' | 'handle.resize-bottom' | 'handle.resize-left' | 'handle.resize-right' | 'handle.resize-top-left' | 'handle.resize-top-right' | 'handle.resize-bottom-left' | 'handle.resize-bottom-right' | 'handle.rotate.top_left_rotate' | 'handle.rotate.top_right_rotate' | 'handle.rotate.bottom_left_rotate' | 'handle.rotate.bottom_right_rotate' | 'handle.rotate.mobile_rotate' | 'handle.crop.top' | 'handle.crop.bottom' | 'handle.crop.left' | 'handle.crop.right' | 'handle.crop.top-left' | 'handle.crop.top-right' | 'handle.crop.bottom-left' | 'handle.crop.bottom-right' | 'ui.close' | 'ui.checked' | 'ui.unchecked';
|
|
592
|
+
type DrUiTranslationKey = 'action.toggle-auto-pan' | 'action.toggle-auto-zoom' | 'action.toggle-auto-none' | 'action.toggle-mouse' | 'action.toggle-trackpad' | 'action.convert-to-bookmark' | 'action.convert-to-embed' | 'action.open-embed-link' | 'action.align-bottom' | 'action.align-center-horizontal' | 'action.align-center-vertical' | 'action.align-center-horizontal.short' | 'action.align-center-vertical.short' | 'action.align-left' | 'action.align-right' | 'action.align-top' | 'action.back-to-content' | 'action.bring-forward' | 'action.bring-to-front' | 'action.copy-as-json.short' | 'action.copy-as-json' | 'action.copy-as-png.short' | 'action.copy-as-png' | 'action.copy-as-svg.short' | 'action.copy-as-svg' | 'action.copy' | 'action.copy-hovered-styles' | 'action.cut' | 'action.delete' | 'action.unlock-all' | 'action.distribute-horizontal' | 'action.distribute-vertical' | 'action.distribute-horizontal.short' | 'action.distribute-vertical.short' | 'action.download-original' | 'action.duplicate' | 'action.edit-link' | 'action.exit-pen-mode' | 'action.export-as-png.short' | 'action.export-as-png' | 'action.export-as-svg.short' | 'action.export-as-svg' | 'action.export-all-as-png.short' | 'action.export-all-as-png' | 'action.export-all-as-svg.short' | 'action.export-all-as-svg' | 'action.fit-frame-to-content' | 'action.flip-horizontal' | 'action.flip-vertical' | 'action.flip-horizontal.short' | 'action.flip-vertical.short' | 'action.fork-project' | 'action.fork-project-on-tldraw' | 'action.group' | 'action.insert-embed' | 'action.insert-media' | 'action.leave-shared-project' | 'action.new-project' | 'action.new-shared-project' | 'action.open-cursor-chat' | 'action.open-kbd-shortcuts' | 'action.open-file' | 'action.pack' | 'action.paste' | 'action.paste-error-title' | 'action.paste-error-description' | 'action.print' | 'action.redo' | 'action.remove-frame' | 'action.rename' | 'action.rotate-ccw' | 'action.rotate-cw' | 'action.save-copy' | 'action.select-all' | 'action.select-none' | 'action.send-backward' | 'action.send-to-back' | 'action.share-project' | 'action.stack-horizontal' | 'action.stack-vertical' | 'action.stack-horizontal.short' | 'action.stack-vertical.short' | 'action.stop-following' | 'action.stretch-horizontal' | 'action.stretch-vertical' | 'action.stretch-horizontal.short' | 'action.stretch-vertical.short' | 'action.toggle-auto-size' | 'action.toggle-dark-mode.menu' | 'action.toggle-dark-mode' | 'action.toggle-paste-at-cursor.menu' | 'action.toggle-paste-at-cursor' | 'action.toggle-wrap-mode.menu' | 'action.toggle-wrap-mode' | 'action.toggle-reduce-motion.menu' | 'action.toggle-reduce-motion' | 'action.toggle-keyboard-shortcuts.menu' | 'action.toggle-keyboard-shortcuts' | 'action.enhanced-a11y-mode.menu' | 'action.enhanced-a11y-mode' | 'action.toggle-edge-scrolling.menu' | 'action.toggle-edge-scrolling' | 'action.toggle-invert-zoom.menu' | 'action.toggle-invert-zoom' | 'action.toggle-debug-mode.menu' | 'action.toggle-debug-mode' | 'action.toggle-focus-mode.menu' | 'action.toggle-focus-mode' | 'action.toggle-dynamic-size-mode.menu' | 'action.toggle-dynamic-size-mode' | 'action.toggle-grid.menu' | 'action.toggle-grid' | 'action.toggle-lock' | 'action.flatten-to-image' | 'action.toggle-snap-mode.menu' | 'action.toggle-snap-mode' | 'action.toggle-tool-lock.menu' | 'action.toggle-tool-lock' | 'action.toggle-transparent.context-menu' | 'action.toggle-transparent.menu' | 'action.toggle-transparent' | 'action.undo' | 'action.ungroup' | 'action.zoom-in' | 'action.zoom-out' | 'action.zoom-to-100' | 'action.zoom-to-fit' | 'action.zoom-to-selection' | 'action.zoom-quick' | 'action.select-zoom-tool' | 'assets.files.size-too-big' | 'assets.files.maximum-size' | 'assets.files.type-not-allowed' | 'assets.files.upload-failed' | 'assets.files.amount-too-many' | 'assets.url.failed' | 'theme.dark' | 'theme.light' | 'theme.system' | 'color-style.white' | 'color-style.black' | 'color-style.blue' | 'color-style.green' | 'color-style.grey' | 'color-style.light-blue' | 'color-style.light-green' | 'color-style.light-red' | 'color-style.light-violet' | 'color-style.orange' | 'color-style.red' | 'color-style.violet' | 'color-style.yellow' | 'fill-style.none' | 'document.default-name' | 'fill-style.semi' | 'fill-style.solid' | 'fill-style.pattern' | 'fill-style.fill' | 'fill-style.lined-fill' | 'dash-style.dashed' | 'dash-style.dotted' | 'dash-style.draw' | 'dash-style.solid' | 'size-style.xs' | 'size-style.s' | 'size-style.m' | 'size-style.l' | 'size-style.xl' | 'opacity-style.0.1' | 'opacity-style.0.25' | 'opacity-style.0.5' | 'opacity-style.0.75' | 'opacity-style.1' | 'font-style.draw' | 'font-style.sans' | 'font-style.serif' | 'font-style.mono' | 'align-style.start' | 'align-style.middle' | 'align-style.end' | 'align-style.justify' | 'verticalAlign-style.start' | 'verticalAlign-style.middle' | 'verticalAlign-style.end' | 'geo-style.arrow-down' | 'geo-style.arrow-left' | 'geo-style.arrow-right' | 'geo-style.arrow-up' | 'geo-style.cloud' | 'geo-style.diamond' | 'geo-style.ellipse' | 'geo-style.heart' | 'geo-style.hexagon' | 'geo-style.octagon' | 'geo-style.oval' | 'geo-style.pentagon' | 'geo-style.rectangle' | 'geo-style.rhombus' | 'geo-style.rhombus-2' | 'geo-style.star' | 'geo-style.trapezoid' | 'geo-style.triangle' | 'geo-style.x-box' | 'geo-style.check-box' | 'arrowheadStart-style.none' | 'arrowheadStart-style.arrow' | 'arrowheadStart-style.bar' | 'arrowheadStart-style.diamond' | 'arrowheadStart-style.dot' | 'arrowheadStart-style.inverted' | 'arrowheadStart-style.pipe' | 'arrowheadStart-style.square' | 'arrowheadStart-style.triangle' | 'arrowheadEnd-style.none' | 'arrowheadEnd-style.arrow' | 'arrowheadEnd-style.bar' | 'arrowheadEnd-style.diamond' | 'arrowheadEnd-style.dot' | 'arrowheadEnd-style.inverted' | 'arrowheadEnd-style.pipe' | 'arrowheadEnd-style.square' | 'arrowheadEnd-style.triangle' | 'spline-style.line' | 'spline-style.cubic' | 'arrow-kind-style.arc' | 'arrow-kind-style.elbow' | 'tool.select' | 'tool.hand' | 'tool.draw' | 'tool.eraser' | 'tool.arrow-down' | 'tool.arrow-left' | 'tool.arrow-right' | 'tool.arrow-up' | 'tool.arrow' | 'tool.cloud' | 'tool.diamond' | 'tool.ellipse' | 'tool.heart' | 'tool.hexagon' | 'tool.highlight' | 'tool.line' | 'tool.octagon' | 'tool.oval' | 'tool.pentagon' | 'tool.rectangle' | 'tool.rhombus' | 'tool.star' | 'tool.trapezoid' | 'tool.triangle' | 'tool.x-box' | 'tool.check-box' | 'tool.media' | 'tool.frame' | 'tool.note' | 'tool.laser' | 'tool.embed' | 'tool.text' | 'tool.pointer-down' | 'tool.image-zoom' | 'tool.replace-media' | 'tool.flip-horz' | 'tool.flip-vert' | 'tool.rotate-cw' | 'tool.aspect-ratio' | 'tool.aspect-ratio.original' | 'tool.aspect-ratio.square' | 'tool.aspect-ratio.circle' | 'tool.aspect-ratio.landscape' | 'tool.aspect-ratio.portrait' | 'tool.aspect-ratio.wide' | 'tool.image-toolbar-title' | 'tool.image-crop' | 'tool.image-crop-confirm' | 'tool.media-alt-text' | 'tool.media-alt-text-desc' | 'tool.media-alt-text-confirm' | 'tool.rich-text-bold' | 'tool.rich-text-italic' | 'tool.rich-text-code' | 'tool.rich-text-highlight' | 'tool.rich-text-strikethrough' | 'tool.rich-text-link' | 'tool.rich-text-link-visit' | 'tool.rich-text-link-remove' | 'tool.rich-text-header' | 'tool.rich-text-bulletList' | 'tool.rich-text-toolbar-title' | 'tool.rich-text-orderedList' | 'tool.bookmark' | 'a11y.status' | 'a11y.skip-to-main-content' | 'a11y.shape-index' | 'a11y.shape-image' | 'a11y.shape-video' | 'a11y.multiple-shapes' | 'a11y.select-shape' | 'a11y.select-shape-direction' | 'a11y.enter-leave-container' | 'a11y.repeat-shape' | 'a11y.move-shape' | 'a11y.move-shape-faster' | 'a11y.rotate-shape-cw' | 'a11y.rotate-shape-ccw' | 'a11y.rotate-shape-cw-fine' | 'a11y.rotate-shape-ccw-fine' | 'a11y.enlarge-shape' | 'a11y.shrink-shape' | 'a11y.pan-camera' | 'a11y.adjust-shape-styles' | 'a11y.open-context-menu' | 'a11y.open-keyboard-shortcuts' | 'menu.title' | 'menu.theme' | 'menu.color-theme' | 'menu.accessibility' | 'menu.copy-as' | 'menu.edit' | 'menu.export-as' | 'menu.file' | 'menu.language' | 'menu.preferences' | 'menu.view' | 'menu.input-device' | 'context-menu.title' | 'context-menu.edit' | 'context-menu.arrange' | 'context-menu.copy-as' | 'context-menu.export-as' | 'context-menu.export-all-as' | 'context-menu.move-to-page' | 'context-menu.reorder' | 'page-menu.title' | 'page-menu.create-new-page' | 'page-menu.new-page-initial-name' | 'page-menu.edit-start' | 'page-menu.edit-done' | 'page-menu.go-to-page' | 'page-menu.resize' | 'page-menu.submenu.rename' | 'page-menu.submenu.duplicate-page' | 'page-menu.submenu.title' | 'page-menu.submenu.move-down' | 'page-menu.submenu.move-up' | 'page-menu.submenu.delete' | 'share-menu.title' | 'share-menu.save-note' | 'share-menu.fork-note' | 'share-menu.share-project' | 'share-menu.copy-link' | 'share-menu.create-snapshot-link' | 'share-menu.snapshot-link-note' | 'share-menu.copy-readonly-link' | 'share-menu.offline-note' | 'share-menu.copy-link-note' | 'share-menu.copy-readonly-link-note' | 'share-menu.project-too-large' | 'share-menu.upload-failed' | 'share-menu.creating-project' | 'share-menu.copied' | 'document-name-menu.copy-link' | 'status.offline' | 'people-menu.title' | 'people-menu.change-name' | 'people-menu.avatar-color' | 'people-menu.change-color' | 'people-menu.follow' | 'people-menu.following' | 'people-menu.leading' | 'people-menu.user' | 'people-menu.invite' | 'people-menu.anonymous-user' | 'help-menu.import-tldr-file' | 'help-menu.title' | 'help-menu.about' | 'help-menu.discord' | 'help-menu.github' | 'help-menu.keyboard-shortcuts' | 'help-menu.twitter' | 'help-menu.terms' | 'help-menu.privacy' | 'actions-menu.title' | 'edit-link-dialog.title' | 'edit-link-dialog.invalid-url' | 'edit-link-dialog.detail' | 'edit-link-dialog.url' | 'edit-link-dialog.clear' | 'edit-link-dialog.save' | 'edit-link-dialog.cancel' | 'edit-link-dialog.external-link' | 'embed-dialog.title' | 'embed-dialog.back' | 'embed-dialog.create' | 'embed-dialog.cancel' | 'embed-dialog.url' | 'embed-dialog.instruction' | 'embed-dialog.invalid-url' | 'shortcuts-dialog.title' | 'shortcuts-dialog.edit' | 'shortcuts-dialog.file' | 'shortcuts-dialog.preferences' | 'shortcuts-dialog.tools' | 'shortcuts-dialog.transform' | 'shortcuts-dialog.view' | 'shortcuts-dialog.collaboration' | 'shortcuts-dialog.a11y' | 'shortcuts-dialog.text-formatting' | 'style-panel.title' | 'style-panel.align' | 'style-panel.label-align' | 'style-panel.vertical-align' | 'style-panel.position' | 'style-panel.arrowheads' | 'style-panel.arrowhead-start' | 'style-panel.arrowhead-end' | 'style-panel.arrow-kind' | 'style-panel.color' | 'style-panel.dash' | 'style-panel.fill' | 'style-panel.font' | 'style-panel.geo' | 'style-panel.mixed' | 'style-panel.opacity' | 'style-panel.size' | 'style-panel.spline' | 'style-panel.selected' | 'tool-panel.title' | 'tool-panel.more' | 'navigation-zone.title' | 'navigation-zone.minimap' | 'navigation-zone.toggle-minimap' | 'navigation-zone.zoom' | 'focus-mode.toggle-focus-mode' | 'toast.close' | 'toast.success' | 'toast.error' | 'toast.info' | 'toast.warning' | 'file-system.file-open-error.title' | 'file-system.file-open-error.not-a-tldraw-file' | 'file-system.file-open-error.file-format-version-too-new' | 'file-system.file-open-error.generic-corrupted-file' | 'file-system.confirm-open.title' | 'file-system.confirm-open.description' | 'file-system.confirm-open.cancel' | 'file-system.confirm-open.open' | 'file-system.confirm-open.dont-show-again' | 'file-system.confirm-clear.title' | 'file-system.confirm-clear.description' | 'file-system.confirm-clear.cancel' | 'file-system.confirm-clear.continue' | 'file-system.confirm-clear.dont-show-again' | 'file-system.shared-document-file-open-error.title' | 'file-system.shared-document-file-open-error.description' | 'sharing.confirm-leave.title' | 'sharing.confirm-leave.description' | 'sharing.confirm-leave.cancel' | 'sharing.confirm-leave.leave' | 'sharing.confirm-leave.dont-show-again' | 'toast.error.export-fail.title' | 'toast.error.export-fail.desc' | 'toast.error.copy-fail.title' | 'toast.error.copy-fail.desc' | 'context.pages.new-page' | 'vscode.file-open.desc' | 'vscode.file-open.open' | 'vscode.file-open.backup' | 'vscode.file-open.backup-saved' | 'vscode.file-open.backup-failed' | 'vscode.file-open.dont-show-again' | 'cursor-chat.type-to-chat' | 'app.loading' | 'handle.resize-top' | 'handle.resize-bottom' | 'handle.resize-left' | 'handle.resize-right' | 'handle.resize-top-left' | 'handle.resize-top-right' | 'handle.resize-bottom-left' | 'handle.resize-bottom-right' | 'handle.rotate.top_left_rotate' | 'handle.rotate.top_right_rotate' | 'handle.rotate.bottom_left_rotate' | 'handle.rotate.bottom_right_rotate' | 'handle.rotate.mobile_rotate' | 'handle.crop.top' | 'handle.crop.bottom' | 'handle.crop.left' | 'handle.crop.right' | 'handle.crop.top-left' | 'handle.crop.top-right' | 'handle.crop.bottom-left' | 'handle.crop.bottom-right' | 'ui.close' | 'ui.checked' | 'ui.unchecked';
|
|
587
593
|
|
|
588
594
|
/** @public */
|
|
589
595
|
declare const RTL_LANGUAGES: Set<string>;
|
package/dist/index.mjs
CHANGED
|
@@ -728,6 +728,8 @@ function getDrawShapeStrokeDashArray(shape, strokeWidth, dotAdjustment) {
|
|
|
728
728
|
solid: `none`,
|
|
729
729
|
dotted: `${dotAdjustment} ${strokeWidth * 2}`,
|
|
730
730
|
dashed: `${strokeWidth * 2} ${strokeWidth * 2}`,
|
|
731
|
+
sparse: `${strokeWidth * 4} ${strokeWidth * 10}`,
|
|
732
|
+
double: `none`,
|
|
731
733
|
none: `none`
|
|
732
734
|
}[shape.props.dash];
|
|
733
735
|
}
|
|
@@ -988,7 +990,10 @@ var PathBuilder = class _PathBuilder {
|
|
|
988
990
|
return this.toSolidSvg(opts);
|
|
989
991
|
case "dashed":
|
|
990
992
|
case "dotted":
|
|
993
|
+
case "sparse":
|
|
991
994
|
return this.toDashedSvg(opts);
|
|
995
|
+
case "double":
|
|
996
|
+
return this.toDoubleSvg(opts);
|
|
992
997
|
case "draw": {
|
|
993
998
|
const d = this.toDrawSvg(opts);
|
|
994
999
|
return d;
|
|
@@ -1048,6 +1053,51 @@ var PathBuilder = class _PathBuilder {
|
|
|
1048
1053
|
const { strokeWidth, props } = opts;
|
|
1049
1054
|
return /* @__PURE__ */ jsx("path", { strokeWidth, d: this.toD({ onlyFilled: opts.onlyFilled }), ...props });
|
|
1050
1055
|
}
|
|
1056
|
+
/** Two parallel strokes: a thick stroke with the center cut out by a mask. */
|
|
1057
|
+
toDoubleSvg(opts) {
|
|
1058
|
+
const { strokeWidth, props = {} } = opts;
|
|
1059
|
+
const d = this.toD({ onlyFilled: opts.onlyFilled });
|
|
1060
|
+
const outer = strokeWidth * 3;
|
|
1061
|
+
const inner = strokeWidth;
|
|
1062
|
+
const maskId = doubleLineMaskId(d);
|
|
1063
|
+
return /* @__PURE__ */ jsxs("g", { ...props, children: [
|
|
1064
|
+
/* @__PURE__ */ jsxs("mask", { id: maskId, maskUnits: "userSpaceOnUse", children: [
|
|
1065
|
+
/* @__PURE__ */ jsx(
|
|
1066
|
+
"path",
|
|
1067
|
+
{
|
|
1068
|
+
d,
|
|
1069
|
+
fill: "none",
|
|
1070
|
+
stroke: "#fff",
|
|
1071
|
+
strokeWidth: outer,
|
|
1072
|
+
strokeLinecap: "round",
|
|
1073
|
+
strokeLinejoin: "round"
|
|
1074
|
+
}
|
|
1075
|
+
),
|
|
1076
|
+
/* @__PURE__ */ jsx(
|
|
1077
|
+
"path",
|
|
1078
|
+
{
|
|
1079
|
+
d,
|
|
1080
|
+
fill: "none",
|
|
1081
|
+
stroke: "#000",
|
|
1082
|
+
strokeWidth: inner,
|
|
1083
|
+
strokeLinecap: "round",
|
|
1084
|
+
strokeLinejoin: "round"
|
|
1085
|
+
}
|
|
1086
|
+
)
|
|
1087
|
+
] }),
|
|
1088
|
+
/* @__PURE__ */ jsx(
|
|
1089
|
+
"path",
|
|
1090
|
+
{
|
|
1091
|
+
d,
|
|
1092
|
+
fill: "none",
|
|
1093
|
+
strokeWidth: outer,
|
|
1094
|
+
strokeLinecap: "round",
|
|
1095
|
+
strokeLinejoin: "round",
|
|
1096
|
+
mask: `url(#${maskId})`
|
|
1097
|
+
}
|
|
1098
|
+
)
|
|
1099
|
+
] });
|
|
1100
|
+
}
|
|
1051
1101
|
toDashedSvg(opts) {
|
|
1052
1102
|
const {
|
|
1053
1103
|
style,
|
|
@@ -1491,6 +1541,11 @@ var CubicBezier = {
|
|
|
1491
1541
|
0.0472
|
|
1492
1542
|
]
|
|
1493
1543
|
};
|
|
1544
|
+
function doubleLineMaskId(d) {
|
|
1545
|
+
let hash = 0;
|
|
1546
|
+
for (let i = 0; i < d.length; i++) hash = Math.imul(31, hash) + d.charCodeAt(i) | 0;
|
|
1547
|
+
return `dr-double-${(hash >>> 0).toString(36)}`;
|
|
1548
|
+
}
|
|
1494
1549
|
function usePrefersReducedMotion() {
|
|
1495
1550
|
const editor = useMaybeEditor();
|
|
1496
1551
|
const animationSpeed = useValue("animationSpeed", () => editor?.user.getAnimationSpeed(), [
|
|
@@ -1726,6 +1781,7 @@ var DEFAULT_TRANSLATION = {
|
|
|
1726
1781
|
"dash-style.dotted": "Dotted",
|
|
1727
1782
|
"dash-style.draw": "Draw",
|
|
1728
1783
|
"dash-style.solid": "Solid",
|
|
1784
|
+
"size-style.xs": "Extra small",
|
|
1729
1785
|
"size-style.s": "Small",
|
|
1730
1786
|
"size-style.m": "Medium",
|
|
1731
1787
|
"size-style.l": "Large",
|
|
@@ -3265,24 +3321,28 @@ var TEXT_PROPS = {
|
|
|
3265
3321
|
padding: "0px"
|
|
3266
3322
|
};
|
|
3267
3323
|
var STROKE_SIZES = {
|
|
3324
|
+
xs: 0.35,
|
|
3268
3325
|
s: 1,
|
|
3269
3326
|
m: 1.75,
|
|
3270
3327
|
l: 2.5,
|
|
3271
3328
|
xl: 5
|
|
3272
3329
|
};
|
|
3273
3330
|
var FONT_SIZES = {
|
|
3331
|
+
xs: 0.875,
|
|
3274
3332
|
s: 1.125,
|
|
3275
3333
|
m: 1.5,
|
|
3276
3334
|
l: 2.25,
|
|
3277
3335
|
xl: 2.75
|
|
3278
3336
|
};
|
|
3279
3337
|
var LABEL_FONT_SIZES = {
|
|
3338
|
+
xs: 0.875,
|
|
3280
3339
|
s: 1.125,
|
|
3281
3340
|
m: 1.375,
|
|
3282
3341
|
l: 1.625,
|
|
3283
3342
|
xl: 2
|
|
3284
3343
|
};
|
|
3285
3344
|
var ARROW_LABEL_FONT_SIZES = {
|
|
3345
|
+
xs: 0.875,
|
|
3286
3346
|
s: 1.125,
|
|
3287
3347
|
m: 1.25,
|
|
3288
3348
|
l: 1.5,
|
|
@@ -3782,6 +3842,7 @@ function miroLineStyleToDash(style) {
|
|
|
3782
3842
|
function miroStrokeWidthToSize(width) {
|
|
3783
3843
|
const w = typeof width === "number" ? width : Number(width);
|
|
3784
3844
|
if (!Number.isFinite(w)) return "m";
|
|
3845
|
+
if (w <= 0.5) return "xs";
|
|
3785
3846
|
if (w <= 1) return "s";
|
|
3786
3847
|
if (w <= 2) return "m";
|
|
3787
3848
|
if (w <= 4) return "l";
|
|
@@ -13405,6 +13466,7 @@ function getPillPoints(width, height, numPoints) {
|
|
|
13405
13466
|
return points;
|
|
13406
13467
|
}
|
|
13407
13468
|
var SIZES = {
|
|
13469
|
+
xs: 40,
|
|
13408
13470
|
s: 50,
|
|
13409
13471
|
m: 70,
|
|
13410
13472
|
l: 100,
|
|
@@ -13543,9 +13605,12 @@ var STYLES = {
|
|
|
13543
13605
|
{ value: "draw", icon: "dash-draw" },
|
|
13544
13606
|
{ value: "dashed", icon: "dash-dashed" },
|
|
13545
13607
|
{ value: "dotted", icon: "dash-dotted" },
|
|
13608
|
+
{ value: "sparse", icon: "dash-dashed" },
|
|
13609
|
+
{ value: "double", icon: "dash-solid" },
|
|
13546
13610
|
{ value: "solid", icon: "dash-solid" }
|
|
13547
13611
|
],
|
|
13548
13612
|
size: [
|
|
13613
|
+
{ value: "xs", icon: "size-small" },
|
|
13549
13614
|
{ value: "s", icon: "size-small" },
|
|
13550
13615
|
{ value: "m", icon: "size-medium" },
|
|
13551
13616
|
{ value: "l", icon: "size-large" },
|
|
@@ -26507,12 +26572,14 @@ var ArrowShapeUtil = class extends ShapeUtil {
|
|
|
26507
26572
|
static migrations = arrowShapeMigrations;
|
|
26508
26573
|
options = {
|
|
26509
26574
|
expandElbowLegLength: {
|
|
26575
|
+
xs: 22,
|
|
26510
26576
|
s: 28,
|
|
26511
26577
|
m: 36,
|
|
26512
26578
|
l: 44,
|
|
26513
26579
|
xl: 66
|
|
26514
26580
|
},
|
|
26515
26581
|
minElbowLegLength: {
|
|
26582
|
+
xs: 4,
|
|
26516
26583
|
s: 6,
|
|
26517
26584
|
m: 10.5,
|
|
26518
26585
|
l: 15,
|
|
@@ -28938,6 +29005,7 @@ function GeoShapeBody({
|
|
|
28938
29005
|
] });
|
|
28939
29006
|
}
|
|
28940
29007
|
var GEO_SHAPE_MIN_WIDTHS = Object.freeze({
|
|
29008
|
+
xs: 10,
|
|
28941
29009
|
s: 12,
|
|
28942
29010
|
m: 14,
|
|
28943
29011
|
l: 16,
|
|
@@ -38460,7 +38528,7 @@ async function extractAssets(editor, snapshot, msg, addToast) {
|
|
|
38460
38528
|
// src/index.ts
|
|
38461
38529
|
registerDrawLibraryVersion(
|
|
38462
38530
|
"@ibodr/draw",
|
|
38463
|
-
"0.2.
|
|
38531
|
+
"0.2.4",
|
|
38464
38532
|
"esm"
|
|
38465
38533
|
);
|
|
38466
38534
|
/*!
|