tldraw 3.16.0-canary.f60032f16651 → 3.16.0-canary.ffdf566dd0a8
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-cjs/index.d.ts +32 -34
- package/dist-cjs/index.js +7 -2
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js +10 -1
- package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js +35 -0
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js.map +7 -0
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js +3 -3
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js +2 -0
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +168 -137
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +3 -2
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
- package/dist-cjs/lib/ui/components/menu-items.js +6 -0
- package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +11 -3
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +267 -0
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +7 -0
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +1 -149
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js +3 -2
- package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +15 -0
- package/dist-cjs/lib/ui/context/actions.js.map +2 -2
- package/dist-cjs/lib/ui/context/events.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useTools.js +9 -76
- package/dist-cjs/lib/ui/hooks/useTools.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +3 -0
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
- package/dist-cjs/lib/ui/version.js +3 -3
- package/dist-cjs/lib/ui/version.js.map +1 -1
- package/dist-esm/index.d.mts +32 -34
- package/dist-esm/index.mjs +11 -3
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs +10 -1
- package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs +19 -0
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs.map +7 -0
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs +3 -5
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs +3 -1
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +168 -137
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +3 -3
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +3 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
- package/dist-esm/lib/ui/components/menu-items.mjs +6 -0
- package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +11 -3
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +237 -0
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +7 -0
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +3 -157
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs +3 -2
- package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +15 -0
- package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
- package/dist-esm/lib/ui/context/events.mjs.map +1 -1
- package/dist-esm/lib/ui/hooks/useTools.mjs +10 -83
- package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +3 -0
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
- package/dist-esm/lib/ui/version.mjs +3 -3
- package/dist-esm/lib/ui/version.mjs.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +8 -2
- package/src/lib/shapes/shared/usePrefersReducedMotion.tsx +11 -1
- package/src/lib/tools/SelectTool/childStates/Translating.ts +1 -0
- package/src/lib/ui/components/AccessibilityMenu.tsx +20 -0
- package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +4 -4
- package/src/lib/ui/components/StylePanel/DefaultStylePanel.tsx +3 -1
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +171 -128
- package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +3 -3
- package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +14 -11
- package/src/lib/ui/components/menu-items.tsx +8 -0
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +19 -3
- package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +313 -0
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +2 -213
- package/src/lib/ui/context/TldrawUiContextProvider.tsx +23 -20
- package/src/lib/ui/context/actions.tsx +15 -0
- package/src/lib/ui/context/events.tsx +1 -1
- package/src/lib/ui/hooks/useTools.tsx +10 -118
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +3 -0
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +3 -0
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/ui.css +57 -1
- package/tldraw.css +59 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var AccessibilityMenu_exports = {};
|
|
20
|
+
__export(AccessibilityMenu_exports, {
|
|
21
|
+
AccessibilityMenu: () => AccessibilityMenu
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(AccessibilityMenu_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_menu_items = require("./menu-items");
|
|
26
|
+
var import_TldrawUiMenuGroup = require("./primitives/menus/TldrawUiMenuGroup");
|
|
27
|
+
var import_TldrawUiMenuSubmenu = require("./primitives/menus/TldrawUiMenuSubmenu");
|
|
28
|
+
function AccessibilityMenu() {
|
|
29
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiMenuSubmenu.TldrawUiMenuSubmenu, { id: "help menu accessibility", label: "menu.accessibility", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_TldrawUiMenuGroup.TldrawUiMenuGroup, { id: "accessibility", children: [
|
|
30
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu_items.ToggleReduceMotionItem, {}),
|
|
31
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu_items.ToggleKeyboardShortcutsItem, {}),
|
|
32
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu_items.ToggleUiLabelsItem, {})
|
|
33
|
+
] }) });
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=AccessibilityMenu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/lib/ui/components/AccessibilityMenu.tsx"],
|
|
4
|
+
"sourcesContent": ["import {\n\tToggleKeyboardShortcutsItem,\n\tToggleReduceMotionItem,\n\tToggleUiLabelsItem,\n} from './menu-items'\nimport { TldrawUiMenuGroup } from './primitives/menus/TldrawUiMenuGroup'\nimport { TldrawUiMenuSubmenu } from './primitives/menus/TldrawUiMenuSubmenu'\n\n/** @public @react */\nexport function AccessibilityMenu() {\n\treturn (\n\t\t<TldrawUiMenuSubmenu id=\"help menu accessibility\" label=\"menu.accessibility\">\n\t\t\t<TldrawUiMenuGroup id=\"accessibility\">\n\t\t\t\t<ToggleReduceMotionItem />\n\t\t\t\t<ToggleKeyboardShortcutsItem />\n\t\t\t\t<ToggleUiLabelsItem />\n\t\t\t</TldrawUiMenuGroup>\n\t\t</TldrawUiMenuSubmenu>\n\t)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYG;AAZH,wBAIO;AACP,+BAAkC;AAClC,iCAAoC;AAG7B,SAAS,oBAAoB;AACnC,SACC,4CAAC,kDAAoB,IAAG,2BAA0B,OAAM,sBACvD,uDAAC,8CAAkB,IAAG,iBACrB;AAAA,gDAAC,4CAAuB;AAAA,IACxB,4CAAC,iDAA4B;AAAA,IAC7B,4CAAC,wCAAmB;AAAA,KACrB,GACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -31,6 +31,7 @@ __export(DefaultMainMenuContent_exports, {
|
|
|
31
31
|
module.exports = __toCommonJS(DefaultMainMenuContent_exports);
|
|
32
32
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
33
|
var import_menu_hooks = require("../../hooks/menu-hooks");
|
|
34
|
+
var import_AccessibilityMenu = require("../AccessibilityMenu");
|
|
34
35
|
var import_ColorSchemeMenu = require("../ColorSchemeMenu");
|
|
35
36
|
var import_DefaultHelpMenuContent = require("../HelpMenu/DefaultHelpMenuContent");
|
|
36
37
|
var import_LanguageMenu = require("../LanguageMenu");
|
|
@@ -120,13 +121,12 @@ function PreferencesGroup() {
|
|
|
120
121
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu_items.ToggleWrapModeItem, {}),
|
|
121
122
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu_items.ToggleFocusModeItem, {}),
|
|
122
123
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu_items.ToggleEdgeScrollingItem, {}),
|
|
123
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu_items.ToggleReduceMotionItem, {}),
|
|
124
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu_items.ToggleKeyboardShortcutsItem, {}),
|
|
125
124
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu_items.ToggleDynamicSizeModeItem, {}),
|
|
126
125
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu_items.TogglePasteAtCursorItem, {}),
|
|
127
126
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_menu_items.ToggleDebugModeItem, {})
|
|
128
127
|
] }),
|
|
129
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiMenuGroup.TldrawUiMenuGroup, { id: "color-scheme", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ColorSchemeMenu.ColorSchemeMenu, {}) })
|
|
128
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiMenuGroup.TldrawUiMenuGroup, { id: "color-scheme", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ColorSchemeMenu.ColorSchemeMenu, {}) }),
|
|
129
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiMenuGroup.TldrawUiMenuGroup, { id: "accessibility-menu", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AccessibilityMenu.AccessibilityMenu, {}) })
|
|
130
130
|
] }),
|
|
131
131
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LanguageMenu.LanguageMenu, {}),
|
|
132
132
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DefaultHelpMenuContent.KeyboardShortcutsMenuItem, {})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useCanRedo, useCanUndo } from '../../hooks/menu-hooks'\nimport { ColorSchemeMenu } from '../ColorSchemeMenu'\nimport { KeyboardShortcutsMenuItem } from '../HelpMenu/DefaultHelpMenuContent'\nimport { LanguageMenu } from '../LanguageMenu'\nimport {\n\tClipboardMenuGroup,\n\tConversionsMenuGroup,\n\tConvertToBookmarkMenuItem,\n\tConvertToEmbedMenuItem,\n\tEditLinkMenuItem,\n\tFitFrameToContentMenuItem,\n\tFlattenMenuItem,\n\tGroupMenuItem,\n\tRemoveFrameMenuItem,\n\tSelectAllMenuItem,\n\tToggleAutoSizeMenuItem,\n\tToggleDebugModeItem,\n\tToggleDynamicSizeModeItem,\n\tToggleEdgeScrollingItem,\n\tToggleFocusModeItem,\n\tToggleGridItem,\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import { useCanRedo, useCanUndo } from '../../hooks/menu-hooks'\nimport { AccessibilityMenu } from '../AccessibilityMenu'\nimport { ColorSchemeMenu } from '../ColorSchemeMenu'\nimport { KeyboardShortcutsMenuItem } from '../HelpMenu/DefaultHelpMenuContent'\nimport { LanguageMenu } from '../LanguageMenu'\nimport {\n\tClipboardMenuGroup,\n\tConversionsMenuGroup,\n\tConvertToBookmarkMenuItem,\n\tConvertToEmbedMenuItem,\n\tEditLinkMenuItem,\n\tFitFrameToContentMenuItem,\n\tFlattenMenuItem,\n\tGroupMenuItem,\n\tRemoveFrameMenuItem,\n\tSelectAllMenuItem,\n\tToggleAutoSizeMenuItem,\n\tToggleDebugModeItem,\n\tToggleDynamicSizeModeItem,\n\tToggleEdgeScrollingItem,\n\tToggleFocusModeItem,\n\tToggleGridItem,\n\tToggleLockMenuItem,\n\tTogglePasteAtCursorItem,\n\tToggleSnapModeItem,\n\tToggleToolLockItem,\n\tToggleTransparentBgMenuItem,\n\tToggleWrapModeItem,\n\tUngroupMenuItem,\n\tUnlockAllMenuItem,\n\tZoomTo100MenuItem,\n\tZoomToFitMenuItem,\n\tZoomToSelectionMenuItem,\n} from '../menu-items'\nimport { TldrawUiMenuActionItem } from '../primitives/menus/TldrawUiMenuActionItem'\nimport { TldrawUiMenuGroup } from '../primitives/menus/TldrawUiMenuGroup'\nimport { TldrawUiMenuSubmenu } from '../primitives/menus/TldrawUiMenuSubmenu'\n\n/** @public @react */\nexport function DefaultMainMenuContent() {\n\treturn (\n\t\t<>\n\t\t\t<TldrawUiMenuGroup id=\"basic\">\n\t\t\t\t<EditSubmenu />\n\t\t\t\t<ViewSubmenu />\n\t\t\t\t<ExportFileContentSubMenu />\n\t\t\t\t<ExtrasGroup />\n\t\t\t</TldrawUiMenuGroup>\n\t\t\t<PreferencesGroup />\n\t\t</>\n\t)\n}\n\n/** @public @react */\nexport function ExportFileContentSubMenu() {\n\treturn (\n\t\t<TldrawUiMenuSubmenu id=\"export-all-as\" label=\"context-menu.export-all-as\" size=\"small\">\n\t\t\t<TldrawUiMenuGroup id=\"export-all-as-group\">\n\t\t\t\t<TldrawUiMenuActionItem actionId=\"export-all-as-svg\" />\n\t\t\t\t<TldrawUiMenuActionItem actionId=\"export-all-as-png\" />\n\t\t\t</TldrawUiMenuGroup>\n\t\t\t<TldrawUiMenuGroup id=\"export-all-as-bg\">\n\t\t\t\t<ToggleTransparentBgMenuItem />\n\t\t\t</TldrawUiMenuGroup>\n\t\t</TldrawUiMenuSubmenu>\n\t)\n}\n\n/** @public @react */\nexport function EditSubmenu() {\n\treturn (\n\t\t<TldrawUiMenuSubmenu id=\"edit\" label=\"menu.edit\">\n\t\t\t<UndoRedoGroup />\n\t\t\t<ClipboardMenuGroup />\n\t\t\t<ConversionsMenuGroup />\n\t\t\t<MiscMenuGroup />\n\t\t\t<LockGroup />\n\t\t\t<TldrawUiMenuGroup id=\"select-all\">\n\t\t\t\t<SelectAllMenuItem />\n\t\t\t</TldrawUiMenuGroup>\n\t\t</TldrawUiMenuSubmenu>\n\t)\n}\n\n/** @public @react */\nexport function MiscMenuGroup() {\n\treturn (\n\t\t<TldrawUiMenuGroup id=\"misc\">\n\t\t\t<GroupMenuItem />\n\t\t\t<UngroupMenuItem />\n\t\t\t<EditLinkMenuItem />\n\t\t\t<ToggleAutoSizeMenuItem />\n\t\t\t<RemoveFrameMenuItem />\n\t\t\t<FitFrameToContentMenuItem />\n\t\t\t<ConvertToEmbedMenuItem />\n\t\t\t<ConvertToBookmarkMenuItem />\n\t\t\t<FlattenMenuItem />\n\t\t</TldrawUiMenuGroup>\n\t)\n}\n\n/** @public @react */\nexport function LockGroup() {\n\treturn (\n\t\t<TldrawUiMenuGroup id=\"lock\">\n\t\t\t<ToggleLockMenuItem />\n\t\t\t<UnlockAllMenuItem />\n\t\t</TldrawUiMenuGroup>\n\t)\n}\n\n/** @public @react */\nexport function UndoRedoGroup() {\n\tconst canUndo = useCanUndo()\n\tconst canRedo = useCanRedo()\n\treturn (\n\t\t<TldrawUiMenuGroup id=\"undo-redo\">\n\t\t\t<TldrawUiMenuActionItem actionId=\"undo\" disabled={!canUndo} />\n\t\t\t<TldrawUiMenuActionItem actionId=\"redo\" disabled={!canRedo} />\n\t\t</TldrawUiMenuGroup>\n\t)\n}\n\n/** @public @react */\nexport function ViewSubmenu() {\n\treturn (\n\t\t<TldrawUiMenuSubmenu id=\"view\" label=\"menu.view\">\n\t\t\t<TldrawUiMenuGroup id=\"view-actions\">\n\t\t\t\t<TldrawUiMenuActionItem actionId=\"zoom-in\" />\n\t\t\t\t<TldrawUiMenuActionItem actionId=\"zoom-out\" />\n\t\t\t\t<ZoomTo100MenuItem />\n\t\t\t\t<ZoomToFitMenuItem />\n\t\t\t\t<ZoomToSelectionMenuItem />\n\t\t\t</TldrawUiMenuGroup>\n\t\t</TldrawUiMenuSubmenu>\n\t)\n}\n\n/** @public @react */\nexport function ExtrasGroup() {\n\treturn (\n\t\t<>\n\t\t\t<TldrawUiMenuActionItem actionId=\"insert-embed\" />\n\t\t\t<TldrawUiMenuActionItem actionId=\"insert-media\" />\n\t\t</>\n\t)\n}\n\n/* ------------------- Preferences ------------------ */\n\n/** @public @react */\nexport function PreferencesGroup() {\n\treturn (\n\t\t<TldrawUiMenuGroup id=\"preferences\">\n\t\t\t<TldrawUiMenuSubmenu id=\"preferences\" label=\"menu.preferences\">\n\t\t\t\t<TldrawUiMenuGroup id=\"preferences-actions\">\n\t\t\t\t\t<ToggleSnapModeItem />\n\t\t\t\t\t<ToggleToolLockItem />\n\t\t\t\t\t<ToggleGridItem />\n\t\t\t\t\t<ToggleWrapModeItem />\n\t\t\t\t\t<ToggleFocusModeItem />\n\t\t\t\t\t<ToggleEdgeScrollingItem />\n\t\t\t\t\t<ToggleDynamicSizeModeItem />\n\t\t\t\t\t<TogglePasteAtCursorItem />\n\t\t\t\t\t<ToggleDebugModeItem />\n\t\t\t\t</TldrawUiMenuGroup>\n\t\t\t\t<TldrawUiMenuGroup id=\"color-scheme\">\n\t\t\t\t\t<ColorSchemeMenu />\n\t\t\t\t</TldrawUiMenuGroup>\n\t\t\t\t<TldrawUiMenuGroup id=\"accessibility-menu\">\n\t\t\t\t\t<AccessibilityMenu />\n\t\t\t\t</TldrawUiMenuGroup>\n\t\t\t</TldrawUiMenuSubmenu>\n\t\t\t<LanguageMenu />\n\t\t\t<KeyboardShortcutsMenuItem />\n\t\t</TldrawUiMenuGroup>\n\t)\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -42,6 +42,7 @@ const DefaultStylePanel = (0, import_react.memo)(function DefaultStylePanel2({
|
|
|
42
42
|
children
|
|
43
43
|
}) {
|
|
44
44
|
const editor = (0, import_editor.useEditor)();
|
|
45
|
+
const showUiLabels = (0, import_editor.useValue)("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
|
|
45
46
|
const ref = (0, import_react.useRef)(null);
|
|
46
47
|
(0, import_editor.usePassThroughWheelEvents)(ref);
|
|
47
48
|
const styles = (0, import_useRelevantStyles.useRelevantStyles)();
|
|
@@ -70,6 +71,7 @@ const DefaultStylePanel = (0, import_react.memo)(function DefaultStylePanel2({
|
|
|
70
71
|
ref,
|
|
71
72
|
className: (0, import_classnames.default)("tlui-style-panel", { "tlui-style-panel__wrapper": !isMobile }),
|
|
72
73
|
"data-ismobile": isMobile,
|
|
74
|
+
"data-show-ui-labels": showUiLabels,
|
|
73
75
|
onPointerLeave: handlePointerOut,
|
|
74
76
|
children: content
|
|
75
77
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/lib/ui/components/StylePanel/DefaultStylePanel.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useEditor, usePassThroughWheelEvents } from '@tldraw/editor'\nimport classNames from 'classnames'\nimport { ReactNode, memo, useCallback, useEffect, useRef } from 'react'\nimport { useRelevantStyles } from '../../hooks/useRelevantStyles'\nimport { DefaultStylePanelContent } from './DefaultStylePanelContent'\n\n/** @public */\nexport interface TLUiStylePanelProps {\n\tisMobile?: boolean\n\tchildren?: ReactNode\n}\n\n/** @public @react */\nexport const DefaultStylePanel = memo(function DefaultStylePanel({\n\tisMobile,\n\tchildren,\n}: TLUiStylePanelProps) {\n\tconst editor = useEditor()\n\n\tconst ref = useRef<HTMLDivElement>(null)\n\tusePassThroughWheelEvents(ref)\n\n\tconst styles = useRelevantStyles()\n\n\tconst handlePointerOut = useCallback(() => {\n\t\tif (!isMobile) {\n\t\t\teditor.updateInstanceState({ isChangingStyle: false })\n\t\t}\n\t}, [editor, isMobile])\n\n\tconst content = children ?? <DefaultStylePanelContent styles={styles} />\n\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (event.key === 'Escape' && ref.current?.contains(document.activeElement)) {\n\t\t\t\tevent.stopPropagation()\n\t\t\t\teditor.getContainer().focus()\n\t\t\t}\n\t\t}\n\n\t\tconst stylePanelContainerEl = ref.current\n\t\tstylePanelContainerEl?.addEventListener('keydown', handleKeyDown, { capture: true })\n\t\treturn () => {\n\t\t\tstylePanelContainerEl?.removeEventListener('keydown', handleKeyDown, { capture: true })\n\t\t}\n\t}, [editor])\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={classNames('tlui-style-panel', { 'tlui-style-panel__wrapper': !isMobile })}\n\t\t\tdata-ismobile={isMobile}\n\t\t\tonPointerLeave={handlePointerOut}\n\t\t>\n\t\t\t{content}\n\t\t</div>\n\t)\n})\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import { useEditor, usePassThroughWheelEvents, useValue } from '@tldraw/editor'\nimport classNames from 'classnames'\nimport { ReactNode, memo, useCallback, useEffect, useRef } from 'react'\nimport { useRelevantStyles } from '../../hooks/useRelevantStyles'\nimport { DefaultStylePanelContent } from './DefaultStylePanelContent'\n\n/** @public */\nexport interface TLUiStylePanelProps {\n\tisMobile?: boolean\n\tchildren?: ReactNode\n}\n\n/** @public @react */\nexport const DefaultStylePanel = memo(function DefaultStylePanel({\n\tisMobile,\n\tchildren,\n}: TLUiStylePanelProps) {\n\tconst editor = useEditor()\n\tconst showUiLabels = useValue('showUiLabels', () => editor.user.getShowUiLabels(), [editor])\n\n\tconst ref = useRef<HTMLDivElement>(null)\n\tusePassThroughWheelEvents(ref)\n\n\tconst styles = useRelevantStyles()\n\n\tconst handlePointerOut = useCallback(() => {\n\t\tif (!isMobile) {\n\t\t\teditor.updateInstanceState({ isChangingStyle: false })\n\t\t}\n\t}, [editor, isMobile])\n\n\tconst content = children ?? <DefaultStylePanelContent styles={styles} />\n\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (event.key === 'Escape' && ref.current?.contains(document.activeElement)) {\n\t\t\t\tevent.stopPropagation()\n\t\t\t\teditor.getContainer().focus()\n\t\t\t}\n\t\t}\n\n\t\tconst stylePanelContainerEl = ref.current\n\t\tstylePanelContainerEl?.addEventListener('keydown', handleKeyDown, { capture: true })\n\t\treturn () => {\n\t\t\tstylePanelContainerEl?.removeEventListener('keydown', handleKeyDown, { capture: true })\n\t\t}\n\t}, [editor])\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={classNames('tlui-style-panel', { 'tlui-style-panel__wrapper': !isMobile })}\n\t\t\tdata-ismobile={isMobile}\n\t\t\tdata-show-ui-labels={showUiLabels}\n\t\t\tonPointerLeave={handlePointerOut}\n\t\t>\n\t\t\t{content}\n\t\t</div>\n\t)\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+B6B;AA/B7B,oBAA+D;AAC/D,wBAAuB;AACvB,mBAAgE;AAChE,+BAAkC;AAClC,sCAAyC;AASlC,MAAM,wBAAoB,mBAAK,SAASA,mBAAkB;AAAA,EAChE;AAAA,EACA;AACD,GAAwB;AACvB,QAAM,aAAS,yBAAU;AACzB,QAAM,mBAAe,wBAAS,gBAAgB,MAAM,OAAO,KAAK,gBAAgB,GAAG,CAAC,MAAM,CAAC;AAE3F,QAAM,UAAM,qBAAuB,IAAI;AACvC,+CAA0B,GAAG;AAE7B,QAAM,aAAS,4CAAkB;AAEjC,QAAM,uBAAmB,0BAAY,MAAM;AAC1C,QAAI,CAAC,UAAU;AACd,aAAO,oBAAoB,EAAE,iBAAiB,MAAM,CAAC;AAAA,IACtD;AAAA,EACD,GAAG,CAAC,QAAQ,QAAQ,CAAC;AAErB,QAAM,UAAU,YAAY,4CAAC,4DAAyB,QAAgB;AAEtE,8BAAU,MAAM;AACf,aAAS,cAAc,OAAsB;AAC5C,UAAI,MAAM,QAAQ,YAAY,IAAI,SAAS,SAAS,SAAS,aAAa,GAAG;AAC5E,cAAM,gBAAgB;AACtB,eAAO,aAAa,EAAE,MAAM;AAAA,MAC7B;AAAA,IACD;AAEA,UAAM,wBAAwB,IAAI;AAClC,2BAAuB,iBAAiB,WAAW,eAAe,EAAE,SAAS,KAAK,CAAC;AACnF,WAAO,MAAM;AACZ,6BAAuB,oBAAoB,WAAW,eAAe,EAAE,SAAS,KAAK,CAAC;AAAA,IACvF;AAAA,EACD,GAAG,CAAC,MAAM,CAAC;AAEX,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,eAAW,kBAAAC,SAAW,oBAAoB,EAAE,6BAA6B,CAAC,SAAS,CAAC;AAAA,MACpF,iBAAe;AAAA,MACf,uBAAqB;AAAA,MACrB,gBAAgB;AAAA,MAEf;AAAA;AAAA,EACF;AAEF,CAAC;",
|
|
6
6
|
"names": ["DefaultStylePanel", "classNames"]
|
|
7
7
|
}
|
|
@@ -50,6 +50,9 @@ var import_TldrawUiSlider = require("../primitives/TldrawUiSlider");
|
|
|
50
50
|
var import_TldrawUiToolbar = require("../primitives/TldrawUiToolbar");
|
|
51
51
|
var import_DoubleDropdownPicker = require("./DoubleDropdownPicker");
|
|
52
52
|
var import_DropdownPicker = require("./DropdownPicker");
|
|
53
|
+
function StylePanelSubheading({ children }) {
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "tlui-style-panel__subheading", children });
|
|
55
|
+
}
|
|
53
56
|
function DefaultStylePanelContent({ styles }) {
|
|
54
57
|
const isDarkMode = (0, import_editor.useIsDarkMode)();
|
|
55
58
|
if (!styles) return null;
|
|
@@ -97,6 +100,7 @@ function CommonStylePickerSet({ styles, theme }) {
|
|
|
97
100
|
const msg = (0, import_useTranslation.useTranslation)();
|
|
98
101
|
const editor = (0, import_editor.useEditor)();
|
|
99
102
|
const onHistoryMark = (0, import_react.useCallback)((id) => editor.markHistoryStoppingPoint(id), [editor]);
|
|
103
|
+
const showUiLabels = (0, import_editor.useValue)("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
|
|
100
104
|
const handleValueChange = useStyleChangeCallback();
|
|
101
105
|
const color = styles.get(import_editor.DefaultColorStyle);
|
|
102
106
|
const fill = styles.get(import_editor.DefaultFillStyle);
|
|
@@ -105,67 +109,79 @@ function CommonStylePickerSet({ styles, theme }) {
|
|
|
105
109
|
const showPickers = fill !== void 0 || dash !== void 0 || size !== void 0;
|
|
106
110
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
107
111
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tlui-style-panel__section__common", "data-testid": "style.panel", children: [
|
|
108
|
-
color === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
112
|
+
color === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
113
|
+
showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.color") }),
|
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.color"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
115
|
+
import_TldrawUiButtonPicker.TldrawUiButtonPicker,
|
|
116
|
+
{
|
|
117
|
+
title: msg("style-panel.color"),
|
|
118
|
+
uiType: "color",
|
|
119
|
+
style: import_editor.DefaultColorStyle,
|
|
120
|
+
items: import_styles.STYLES.color,
|
|
121
|
+
value: color,
|
|
122
|
+
onValueChange: handleValueChange,
|
|
123
|
+
theme,
|
|
124
|
+
onHistoryMark
|
|
125
|
+
}
|
|
126
|
+
) })
|
|
127
|
+
] }),
|
|
121
128
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(OpacitySlider, {})
|
|
122
129
|
] }),
|
|
123
130
|
showPickers && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tlui-style-panel__section", children: [
|
|
124
|
-
fill === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.
|
|
125
|
-
|
|
126
|
-
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
131
|
+
fill === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
132
|
+
showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.fill") }),
|
|
133
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.fill"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
134
|
+
import_TldrawUiButtonPicker.TldrawUiButtonPicker,
|
|
135
|
+
{
|
|
136
|
+
title: msg("style-panel.fill"),
|
|
137
|
+
uiType: "fill",
|
|
138
|
+
style: import_editor.DefaultFillStyle,
|
|
139
|
+
items: import_styles.STYLES.fill,
|
|
140
|
+
value: fill,
|
|
141
|
+
onValueChange: handleValueChange,
|
|
142
|
+
theme,
|
|
143
|
+
onHistoryMark
|
|
144
|
+
}
|
|
145
|
+
) })
|
|
146
|
+
] }),
|
|
147
|
+
dash === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
148
|
+
showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.dash") }),
|
|
149
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.dash"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
150
|
+
import_TldrawUiButtonPicker.TldrawUiButtonPicker,
|
|
151
|
+
{
|
|
152
|
+
title: msg("style-panel.dash"),
|
|
153
|
+
uiType: "dash",
|
|
154
|
+
style: import_editor.DefaultDashStyle,
|
|
155
|
+
items: import_styles.STYLES.dash,
|
|
156
|
+
value: dash,
|
|
157
|
+
onValueChange: handleValueChange,
|
|
158
|
+
theme,
|
|
159
|
+
onHistoryMark
|
|
160
|
+
}
|
|
161
|
+
) })
|
|
162
|
+
] }),
|
|
163
|
+
size === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
164
|
+
showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.size") }),
|
|
165
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.size"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
166
|
+
import_TldrawUiButtonPicker.TldrawUiButtonPicker,
|
|
167
|
+
{
|
|
168
|
+
title: msg("style-panel.size"),
|
|
169
|
+
uiType: "size",
|
|
170
|
+
style: import_editor.DefaultSizeStyle,
|
|
171
|
+
items: import_styles.STYLES.size,
|
|
172
|
+
value: size,
|
|
173
|
+
onValueChange: (style, value) => {
|
|
174
|
+
handleValueChange(style, value);
|
|
175
|
+
const selectedShapeIds = editor.getSelectedShapeIds();
|
|
176
|
+
if (selectedShapeIds.length > 0) {
|
|
177
|
+
(0, import_editor.kickoutOccludedShapes)(editor, selectedShapeIds);
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
theme,
|
|
181
|
+
onHistoryMark
|
|
182
|
+
}
|
|
183
|
+
) })
|
|
184
|
+
] })
|
|
169
185
|
] })
|
|
170
186
|
] });
|
|
171
187
|
}
|
|
@@ -174,6 +190,8 @@ function TextStylePickerSet({ theme, styles }) {
|
|
|
174
190
|
const handleValueChange = useStyleChangeCallback();
|
|
175
191
|
const editor = (0, import_editor.useEditor)();
|
|
176
192
|
const onHistoryMark = (0, import_react.useCallback)((id) => editor.markHistoryStoppingPoint(id), [editor]);
|
|
193
|
+
const showUiLabels = (0, import_editor.useValue)("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
|
|
194
|
+
const labelStr = showUiLabels && msg("style-panel.font");
|
|
177
195
|
const font = styles.get(import_editor.DefaultFontStyle);
|
|
178
196
|
const textAlign = styles.get(import_editor.DefaultTextAlignStyle);
|
|
179
197
|
const labelAlign = styles.get(import_editor.DefaultHorizontalAlignStyle);
|
|
@@ -182,80 +200,89 @@ function TextStylePickerSet({ theme, styles }) {
|
|
|
182
200
|
return null;
|
|
183
201
|
}
|
|
184
202
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tlui-style-panel__section", children: [
|
|
185
|
-
font === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.
|
|
186
|
-
|
|
187
|
-
{
|
|
188
|
-
title: msg("style-panel.font"),
|
|
189
|
-
uiType: "font",
|
|
190
|
-
style: import_editor.DefaultFontStyle,
|
|
191
|
-
items: import_styles.STYLES.font,
|
|
192
|
-
value: font,
|
|
193
|
-
onValueChange: handleValueChange,
|
|
194
|
-
theme,
|
|
195
|
-
onHistoryMark
|
|
196
|
-
}
|
|
197
|
-
) }),
|
|
198
|
-
textAlign === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.align"), className: "tlui-style-panel__row", children: [
|
|
199
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
203
|
+
font === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
204
|
+
labelStr && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: labelStr }),
|
|
205
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.font"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
200
206
|
import_TldrawUiButtonPicker.TldrawUiButtonPicker,
|
|
201
207
|
{
|
|
202
|
-
title: msg("style-panel.
|
|
203
|
-
uiType: "
|
|
204
|
-
style: import_editor.
|
|
205
|
-
items: import_styles.STYLES.
|
|
206
|
-
value:
|
|
208
|
+
title: msg("style-panel.font"),
|
|
209
|
+
uiType: "font",
|
|
210
|
+
style: import_editor.DefaultFontStyle,
|
|
211
|
+
items: import_styles.STYLES.font,
|
|
212
|
+
value: font,
|
|
207
213
|
onValueChange: handleValueChange,
|
|
208
214
|
theme,
|
|
209
215
|
onHistoryMark
|
|
210
216
|
}
|
|
211
|
-
),
|
|
212
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tlui-style-panel__row__extra-button", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
213
|
-
import_TldrawUiToolbar.TldrawUiToolbarButton,
|
|
214
|
-
{
|
|
215
|
-
type: "icon",
|
|
216
|
-
title: msg("style-panel.vertical-align"),
|
|
217
|
-
"data-testid": "vertical-align",
|
|
218
|
-
disabled: true,
|
|
219
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiButtonIcon.TldrawUiButtonIcon, { icon: "vertical-align-middle" })
|
|
220
|
-
}
|
|
221
217
|
) })
|
|
222
218
|
] }),
|
|
223
|
-
|
|
224
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
{
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
219
|
+
textAlign === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
220
|
+
showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.align") }),
|
|
221
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.align"), className: "tlui-style-panel__row", children: [
|
|
222
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
223
|
+
import_TldrawUiButtonPicker.TldrawUiButtonPicker,
|
|
224
|
+
{
|
|
225
|
+
title: msg("style-panel.align"),
|
|
226
|
+
uiType: "align",
|
|
227
|
+
style: import_editor.DefaultTextAlignStyle,
|
|
228
|
+
items: import_styles.STYLES.textAlign,
|
|
229
|
+
value: textAlign,
|
|
230
|
+
onValueChange: handleValueChange,
|
|
231
|
+
theme,
|
|
232
|
+
onHistoryMark
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tlui-style-panel__row__extra-button", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
236
|
+
import_TldrawUiToolbar.TldrawUiToolbarButton,
|
|
237
|
+
{
|
|
238
|
+
type: "icon",
|
|
239
|
+
title: msg("style-panel.vertical-align"),
|
|
240
|
+
"data-testid": "vertical-align",
|
|
241
|
+
disabled: true,
|
|
242
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiButtonIcon.TldrawUiButtonIcon, { icon: "vertical-align-middle" })
|
|
243
|
+
}
|
|
244
|
+
) })
|
|
245
|
+
] })
|
|
246
|
+
] }),
|
|
247
|
+
labelAlign === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
248
|
+
showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.label-align") }),
|
|
249
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_TldrawUiToolbar.TldrawUiToolbar, { label: msg("style-panel.label-align"), className: "tlui-style-panel__row", children: [
|
|
250
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
251
|
+
import_TldrawUiButtonPicker.TldrawUiButtonPicker,
|
|
252
|
+
{
|
|
253
|
+
title: msg("style-panel.label-align"),
|
|
254
|
+
uiType: "align",
|
|
255
|
+
style: import_editor.DefaultHorizontalAlignStyle,
|
|
256
|
+
items: import_styles.STYLES.horizontalAlign,
|
|
257
|
+
value: labelAlign,
|
|
258
|
+
onValueChange: handleValueChange,
|
|
259
|
+
theme,
|
|
260
|
+
onHistoryMark
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tlui-style-panel__row__extra-button", children: verticalLabelAlign === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
264
|
+
import_TldrawUiToolbar.TldrawUiToolbarButton,
|
|
265
|
+
{
|
|
266
|
+
type: "icon",
|
|
267
|
+
title: msg("style-panel.vertical-align"),
|
|
268
|
+
"data-testid": "vertical-align",
|
|
269
|
+
disabled: true,
|
|
270
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiButtonIcon.TldrawUiButtonIcon, { icon: "vertical-align-middle" })
|
|
271
|
+
}
|
|
272
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
273
|
+
import_DropdownPicker.DropdownPicker,
|
|
274
|
+
{
|
|
275
|
+
type: "icon",
|
|
276
|
+
id: "geo-vertical-alignment",
|
|
277
|
+
uiType: "verticalAlign",
|
|
278
|
+
stylePanelType: "vertical-align",
|
|
279
|
+
style: import_editor.DefaultVerticalAlignStyle,
|
|
280
|
+
items: import_styles.STYLES.verticalAlign,
|
|
281
|
+
value: verticalLabelAlign,
|
|
282
|
+
onValueChange: handleValueChange
|
|
283
|
+
}
|
|
284
|
+
) })
|
|
285
|
+
] })
|
|
259
286
|
] })
|
|
260
287
|
] });
|
|
261
288
|
}
|
|
@@ -354,6 +381,7 @@ const tldrawSupportedOpacities = [0.1, 0.25, 0.5, 0.75, 1];
|
|
|
354
381
|
function OpacitySlider() {
|
|
355
382
|
const editor = (0, import_editor.useEditor)();
|
|
356
383
|
const onHistoryMark = (0, import_react.useCallback)((id) => editor.markHistoryStoppingPoint(id), [editor]);
|
|
384
|
+
const showUiLabels = (0, import_editor.useValue)("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
|
|
357
385
|
const opacity = (0, import_editor.useValue)("opacity", () => editor.getSharedOpacity(), [editor]);
|
|
358
386
|
const trackEvent = (0, import_events.useUiEvents)();
|
|
359
387
|
const msg = (0, import_useTranslation.useTranslation)();
|
|
@@ -378,18 +406,21 @@ function OpacitySlider() {
|
|
|
378
406
|
(supportedOpacity) => Math.abs(supportedOpacity - opacity.value)
|
|
379
407
|
)
|
|
380
408
|
);
|
|
381
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
410
|
+
showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.opacity") }),
|
|
411
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
412
|
+
import_TldrawUiSlider.TldrawUiSlider,
|
|
413
|
+
{
|
|
414
|
+
"data-testid": "style.opacity",
|
|
415
|
+
value: opacityIndex >= 0 ? opacityIndex : tldrawSupportedOpacities.length - 1,
|
|
416
|
+
label: opacity.type === "mixed" ? "style-panel.mixed" : `opacity-style.${opacity.value}`,
|
|
417
|
+
onValueChange: handleOpacityValueChange,
|
|
418
|
+
steps: tldrawSupportedOpacities.length - 1,
|
|
419
|
+
title: msg("style-panel.opacity"),
|
|
420
|
+
onHistoryMark,
|
|
421
|
+
ariaValueModifier: 25
|
|
422
|
+
}
|
|
423
|
+
)
|
|
424
|
+
] });
|
|
394
425
|
}
|
|
395
426
|
//# sourceMappingURL=DefaultStylePanelContent.js.map
|