@collabchron/notiq 0.3.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +230 -39
- package/dist/CodeActionMenuPlugin-EINOY4U4.mjs +15 -0
- package/dist/DynamicBlockComponent-NRQJ4WW4.mjs +161 -0
- package/dist/EquationComponent-CB6DFIHV.mjs +154 -0
- package/dist/ExcalidrawComponent-XW6646OH.mjs +528 -0
- package/dist/ExcalidrawPlugin-ZFHT62IF.mjs +14 -0
- package/dist/ExportPlugin-V2RLM63S.mjs +11 -0
- package/dist/FloatingLinkEditorPlugin-TRTCMSP4.mjs +12 -0
- package/dist/FloatingTextFormatToolbarPlugin-F2GY6LMI.mjs +30 -0
- package/dist/HintComponet-BRL6EAMS.mjs +217 -0
- package/dist/InlineImageComponent-UWIUWBHI.mjs +453 -0
- package/dist/MobileToolbar-BOOZAMQE.mjs +268 -0
- package/dist/SlashCommand-GMT5JI33.mjs +28 -0
- package/dist/StoryBuilderComponent-JGDBM5JU.mjs +562 -0
- package/{src/components/editor/plugins/TableCellActionMenuPlugin/index.tsx → dist/TableCellActionMenuPlugin-PGK2K3VG.mjs} +667 -759
- package/{src/components/editor/plugins/TableHoverActionsPlugin/index.tsx → dist/TableHoverActionsPlugin-GJVE6VRW.mjs} +258 -314
- package/dist/TemplatePlugin-ZD3QEVTI.mjs +9 -0
- package/dist/ToolbarPlugin-7TOZRD2R.mjs +1547 -0
- package/dist/babel-JZ2EV6AX.mjs +7233 -0
- package/dist/background-color-XZTYLGO2.mjs +362 -0
- package/dist/block-format-YJCV2DIY.mjs +15 -0
- package/dist/chunk-2FNEAMSP.mjs +127 -0
- package/dist/chunk-3CPBODXA.mjs +84 -0
- package/dist/chunk-3G37YKTV.mjs +83 -0
- package/dist/chunk-3JVFG7ER.mjs +184 -0
- package/dist/chunk-456TN7IM.mjs +110 -0
- package/dist/chunk-4EXYCTGJ.mjs +27 -0
- package/{src/utils/getSelectedNode.ts → dist/chunk-4HBCVSE6.mjs} +26 -27
- package/dist/chunk-4MEDW3T6.mjs +125 -0
- package/dist/chunk-4VWFVWYP.mjs +36 -0
- package/dist/chunk-5BAKY5KN.mjs +84 -0
- package/dist/chunk-5QSNIVIG.mjs +333 -0
- package/dist/chunk-64Z3FI7T.mjs +37 -0
- package/{src/components/editor/nodes/Stepper/index.tsx → dist/chunk-6RNZQOH2.mjs} +214 -260
- package/dist/chunk-77KXU36M.mjs +64 -0
- package/dist/chunk-77UA6HYR.mjs +165 -0
- package/dist/chunk-7NZAPJ4G.mjs +102 -0
- package/dist/chunk-7VUMHWWL.mjs +152 -0
- package/dist/chunk-AMMKBSST.mjs +1256 -0
- package/dist/chunk-BIU7WTLX.mjs +95 -0
- package/dist/chunk-EGMI62PP.mjs +83 -0
- package/dist/chunk-EHNQD5KO.mjs +88 -0
- package/dist/chunk-FSM26655.mjs +37 -0
- package/{src/components/editor/nodes/Hint/index.tsx → dist/chunk-G53GLEAY.mjs} +158 -190
- package/dist/chunk-GK35L7UY.mjs +28 -0
- package/dist/chunk-GXYD4VZM.mjs +193 -0
- package/dist/chunk-GYIOYVCN.mjs +538 -0
- package/dist/chunk-GZPNVR7L.mjs +157 -0
- package/dist/chunk-JXDPPUJI.mjs +52 -0
- package/dist/chunk-K36V4SIW.mjs +141 -0
- package/dist/chunk-KJ6AJ44Q.mjs +128 -0
- package/dist/chunk-KJV3FAZ7.mjs +142 -0
- package/{src/components/editor/plugins/ImagesPlugin/index.tsx → dist/chunk-LGG4IUIA.mjs} +189 -222
- package/dist/chunk-LQN3CMKV.mjs +1906 -0
- package/dist/chunk-N3WN46VL.mjs +236 -0
- package/dist/chunk-PBD6LMLC.mjs +366 -0
- package/dist/chunk-POGRR73N.mjs +33 -0
- package/{src/components/editor/utils/editorFormatting.ts → dist/chunk-PZSUSXQG.mjs} +238 -282
- package/dist/chunk-QEIFVK5M.mjs +29 -0
- package/dist/chunk-QHIQKMVN.mjs +427 -0
- package/dist/chunk-TCYK7DM7.mjs +36 -0
- package/dist/chunk-TTHQCW5F.mjs +47 -0
- package/dist/chunk-U47ABU5Z.mjs +53 -0
- package/dist/chunk-WDG7J2DY.mjs +116 -0
- package/dist/chunk-WJRHXI2C.mjs +733 -0
- package/dist/chunk-XLER2DHM.mjs +357 -0
- package/dist/chunk-XWC4TK2N.mjs +315 -0
- package/dist/chunk-YHPNOWFH.mjs +15 -0
- package/dist/chunk-YKC3SO4Z.mjs +32 -0
- package/dist/chunk-YMBXLRW5.mjs +374 -0
- package/dist/chunk-YPHOEJ46.mjs +64 -0
- package/dist/chunk-YUDCJRJM.mjs +25 -0
- package/dist/chunk-Z4EWP7BI.mjs +65 -0
- package/dist/chunk-ZB5LZQKC.mjs +191 -0
- package/dist/chunk-ZJRKATOJ.mjs +65 -0
- package/dist/color-BPKOPQKN.mjs +12 -0
- package/dist/estree-XC56IUFX.mjs +4414 -0
- package/dist/font-FEZ3GKSF.mjs +13 -0
- package/dist/font-size-EK775WRH.mjs +15 -0
- package/dist/html-S3ACX7NI.mjs +2738 -0
- package/dist/image-2PJIAYAT.mjs +993 -0
- package/dist/index.d.mts +145 -0
- package/dist/index.d.ts +145 -0
- package/dist/index.js +57855 -0
- package/dist/index.mjs +1790 -0
- package/dist/insert-gif-SAIDYURE.mjs +100 -0
- package/dist/insert-image-U3RJN3OW.mjs +259 -0
- package/dist/insert-node-5P2CRJ7S.mjs +201 -0
- package/dist/insert-poll-HCPM7MO6.mjs +33 -0
- package/dist/insert-table-24XYUS2W.mjs +66 -0
- package/dist/markdown-SNVBOSRA.mjs +3487 -0
- package/dist/poll-component-2R4MDLHS.mjs +303 -0
- package/dist/postcss-ONF3VDIM.mjs +5051 -0
- package/dist/standalone-EOIALU3M.mjs +2373 -0
- package/dist/stepper-FSARL6X6.mjs +304 -0
- package/dist/styles/notiq.css +1149 -0
- package/dist/text-align-VLECWO4H.mjs +118 -0
- package/dist/text-format-BG5WOOPZ.mjs +16 -0
- package/dist/typescript-AMPI6OVS.mjs +13135 -0
- package/package.json +66 -11
- package/src/styles/notiq.css +1149 -0
- package/src/styles/tailwind-plugin.ts +134 -0
- package/components.json +0 -21
- package/eslint.config.mjs +0 -16
- package/next.config.ts +0 -12
- package/postcss.config.mjs +0 -5
- package/public/file.svg +0 -1
- package/public/globe.svg +0 -1
- package/public/images/icons/plus.svg +0 -10
- package/public/next.svg +0 -1
- package/public/vercel.svg +0 -1
- package/public/window.svg +0 -1
- package/src/app/actions.ts +0 -2
- package/src/app/api/ai/route.ts +0 -175
- package/src/app/api/edgestore/[...edgestore]/route.ts +0 -28
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +0 -205
- package/src/app/layout.tsx +0 -38
- package/src/app/page.tsx +0 -12
- package/src/components/editor/Core.tsx +0 -220
- package/src/components/editor/hooks/instructions-messages.ts +0 -300
- package/src/components/editor/hooks/use-mobile.ts +0 -19
- package/src/components/editor/hooks/useReport.ts +0 -67
- package/src/components/editor/hooks/useResizeObservert.ts +0 -22
- package/src/components/editor/index.tsx +0 -39
- package/src/components/editor/lexical-on-change.tsx +0 -28
- package/src/components/editor/nodes/CollapsibleNode/CollapsibleContainerNode.ts +0 -92
- package/src/components/editor/nodes/CollapsibleNode/CollapsibleContentNode.ts +0 -65
- package/src/components/editor/nodes/CollapsibleNode/CollapsibleTitleNode.ts +0 -105
- package/src/components/editor/nodes/EquationNode/EquationComponent.tsx +0 -143
- package/src/components/editor/nodes/EquationNode/EquationNode.tsx +0 -170
- package/src/components/editor/nodes/ExcalidrawNode/ExcalidrawComponent.tsx +0 -228
- package/src/components/editor/nodes/ExcalidrawNode/ExcalidrawImage.tsx +0 -137
- package/src/components/editor/nodes/ExcalidrawNode/ImageResizer.tsx +0 -317
- package/src/components/editor/nodes/ExcalidrawNode/index.tsx +0 -204
- package/src/components/editor/nodes/FigmaNode/FigmaNode.tsx +0 -134
- package/src/components/editor/nodes/Hint/HintComponet.tsx +0 -221
- package/src/components/editor/nodes/ImageNode/index.tsx +0 -328
- package/src/components/editor/nodes/InlineImageNode/InlineImageComponent.tsx +0 -383
- package/src/components/editor/nodes/InlineImageNode/InlineImageNode.css +0 -94
- package/src/components/editor/nodes/InlineImageNode/InlineImageNode.tsx +0 -309
- package/src/components/editor/nodes/LayoutNode/LayoutContainerNode.ts +0 -146
- package/src/components/editor/nodes/LayoutNode/LayoutItemNode.ts +0 -79
- package/src/components/editor/nodes/PollNode/index.tsx +0 -204
- package/src/components/editor/nodes/TweetNode/index.tsx +0 -214
- package/src/components/editor/nodes/index.ts +0 -81
- package/src/components/editor/plugins/AutoEmbedPlugin/index.tsx +0 -350
- package/src/components/editor/plugins/AutoLinkPlugin/index.tsx +0 -56
- package/src/components/editor/plugins/CodeActionMenuPlugin/components/CopyButton.tsx +0 -70
- package/src/components/editor/plugins/CodeActionMenuPlugin/components/PrettierButton.tsx +0 -192
- package/src/components/editor/plugins/CodeActionMenuPlugin/index.tsx +0 -217
- package/src/components/editor/plugins/CodeActionMenuPlugin/utils.ts +0 -26
- package/src/components/editor/plugins/CodeHighlightPlugin/index.ts +0 -21
- package/src/components/editor/plugins/CollapsiblePlugin/Collapsible.css +0 -76
- package/src/components/editor/plugins/CollapsiblePlugin/index.ts +0 -228
- package/src/components/editor/plugins/DragDropPastePlugin/index.tsx +0 -44
- package/src/components/editor/plugins/DraggableBlockPlugin/index.tsx +0 -52
- package/src/components/editor/plugins/EquationsPlugin/index.tsx +0 -85
- package/src/components/editor/plugins/ExcalidrawPlugin/index.tsx +0 -98
- package/src/components/editor/plugins/FigmaPlugin/index.tsx +0 -42
- package/src/components/editor/plugins/FloatingLinkEditorPlugin/index.tsx +0 -445
- package/src/components/editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx +0 -275
- package/src/components/editor/plugins/InlineImagePlugin/index.tsx +0 -351
- package/src/components/editor/plugins/LayoutPlugin/index.tsx +0 -238
- package/src/components/editor/plugins/LinkPlugin/index.tsx +0 -36
- package/src/components/editor/plugins/LinkWithMetaData/index.tsx +0 -271
- package/src/components/editor/plugins/MarkdownShortcutPlugin/index.tsx +0 -11
- package/src/components/editor/plugins/MarkdownTransformers/index.tsx +0 -304
- package/src/components/editor/plugins/PollPlugin/index.tsx +0 -49
- package/src/components/editor/plugins/ShortcutsPlugin/index.tsx +0 -180
- package/src/components/editor/plugins/ShortcutsPlugin/shortcuts.ts +0 -253
- package/src/components/editor/plugins/SlashCommand/index.tsx +0 -621
- package/src/components/editor/plugins/SpeechToTextPlugin/index.ts +0 -127
- package/src/components/editor/plugins/TabFocusPlugin/index.ts +0 -58
- package/src/components/editor/plugins/TableCellResizer/index.tsx +0 -438
- package/src/components/editor/plugins/TablePlugin/index.tsx +0 -99
- package/src/components/editor/plugins/ToolbarPlugin/index.tsx +0 -522
- package/src/components/editor/plugins/TwitterPlugin/index.ts +0 -35
- package/src/components/editor/plugins/YouTubeNode/index.tsx +0 -179
- package/src/components/editor/plugins/YouTubePlugin/index.ts +0 -41
- package/src/components/editor/themes/editor-theme.ts +0 -113
- package/src/components/editor/themes/theme.css +0 -377
- package/src/components/editor/utils/ai.ts +0 -291
- package/src/components/editor/utils/canUseDOM.ts +0 -12
- package/src/components/editor/utils/environment.ts +0 -50
- package/src/components/editor/utils/extract-data.ts +0 -166
- package/src/components/editor/utils/getAllLexicalChildren.ts +0 -13
- package/src/components/editor/utils/getDOMRangeRect.ts +0 -27
- package/src/components/editor/utils/getSelectedNode.ts +0 -27
- package/src/components/editor/utils/gif.ts +0 -29
- package/src/components/editor/utils/invariant.ts +0 -15
- package/src/components/editor/utils/setFloatingElemPosition.ts +0 -51
- package/src/components/editor/utils/setFloatingElemPositionForLinkEditor.ts +0 -40
- package/src/components/editor/utils/setNodePlaceholderFromSelection/getNodePlaceholder.ts +0 -51
- package/src/components/editor/utils/setNodePlaceholderFromSelection/setNodePlaceholderFromSelection.ts +0 -15
- package/src/components/editor/utils/setNodePlaceholderFromSelection/setPlaceholderOnSelection.ts +0 -114
- package/src/components/editor/utils/setNodePlaceholderFromSelection/styles.css +0 -6
- package/src/components/editor/utils/url.ts +0 -109
- package/src/components/editor/utils/useLayoutEffect.ts +0 -13
- package/src/components/providers/QueryProvider.tsx +0 -15
- package/src/components/providers/SharedHistoryContext.tsx +0 -28
- package/src/components/providers/ToolbarContext.tsx +0 -123
- package/src/components/providers/theme-provider.tsx +0 -11
- package/src/components/theme/ModeToggle.tsx +0 -40
- package/src/components/ui/FileInput.tsx +0 -40
- package/src/components/ui/Input.css +0 -32
- package/src/components/ui/Select.css +0 -42
- package/src/components/ui/Select.tsx +0 -36
- package/src/components/ui/TextInput.tsx +0 -48
- package/src/components/ui/ai/ai-button.tsx +0 -574
- package/src/components/ui/ai/border.tsx +0 -99
- package/src/components/ui/ai/placeholder-input-vanish.tsx +0 -282
- package/src/components/ui/button.tsx +0 -89
- package/src/components/ui/card.tsx +0 -76
- package/src/components/ui/checkbox.tsx +0 -30
- package/src/components/ui/command.tsx +0 -153
- package/src/components/ui/dialog/Dialog.css +0 -25
- package/src/components/ui/dialog/Dialog.tsx +0 -34
- package/src/components/ui/dialog.tsx +0 -122
- package/src/components/ui/drop-downs/background-color.tsx +0 -183
- package/src/components/ui/drop-downs/block-format.tsx +0 -159
- package/src/components/ui/drop-downs/code.tsx +0 -42
- package/src/components/ui/drop-downs/color.tsx +0 -177
- package/src/components/ui/drop-downs/font-size.tsx +0 -138
- package/src/components/ui/drop-downs/font.tsx +0 -155
- package/src/components/ui/drop-downs/index.tsx +0 -122
- package/src/components/ui/drop-downs/insert-node.tsx +0 -213
- package/src/components/ui/drop-downs/text-align.tsx +0 -123
- package/src/components/ui/drop-downs/text-format.tsx +0 -104
- package/src/components/ui/dropdown-menu.tsx +0 -201
- package/src/components/ui/equation/EquationEditor.css +0 -38
- package/src/components/ui/equation/EquationEditor.tsx +0 -56
- package/src/components/ui/equation/KatexEquationAlterer.css +0 -41
- package/src/components/ui/equation/KatexEquationAlterer.tsx +0 -83
- package/src/components/ui/equation/KatexRenderer.tsx +0 -66
- package/src/components/ui/excalidraw/ExcalidrawModal.css +0 -64
- package/src/components/ui/excalidraw/ExcalidrawModal.tsx +0 -234
- package/src/components/ui/excalidraw/Modal.css +0 -62
- package/src/components/ui/excalidraw/Modal.tsx +0 -110
- package/src/components/ui/hover-card.tsx +0 -29
- package/src/components/ui/image/error-image.tsx +0 -17
- package/src/components/ui/image/file-upload.tsx +0 -240
- package/src/components/ui/image/image-resizer.tsx +0 -297
- package/src/components/ui/image/image-toolbar.tsx +0 -264
- package/src/components/ui/image/index.tsx +0 -408
- package/src/components/ui/image/lazy-image.tsx +0 -68
- package/src/components/ui/image/lazy-video.tsx +0 -71
- package/src/components/ui/input.tsx +0 -22
- package/src/components/ui/models/custom-dialog.tsx +0 -320
- package/src/components/ui/models/insert-gif.tsx +0 -90
- package/src/components/ui/models/insert-image.tsx +0 -52
- package/src/components/ui/models/insert-poll.tsx +0 -29
- package/src/components/ui/models/insert-table.tsx +0 -62
- package/src/components/ui/models/use-model.tsx +0 -91
- package/src/components/ui/poll/poll-component.tsx +0 -304
- package/src/components/ui/popover.tsx +0 -33
- package/src/components/ui/progress.tsx +0 -28
- package/src/components/ui/scroll-area.tsx +0 -48
- package/src/components/ui/separator.tsx +0 -31
- package/src/components/ui/skeleton.tsx +0 -15
- package/src/components/ui/sonner.tsx +0 -31
- package/src/components/ui/stepper/step.tsx +0 -179
- package/src/components/ui/stepper/stepper.tsx +0 -89
- package/src/components/ui/textarea.tsx +0 -22
- package/src/components/ui/toggle.tsx +0 -71
- package/src/components/ui/tooltip.tsx +0 -32
- package/src/components/ui/write/text-format-floting-toolbar.tsx +0 -346
- package/src/lib/edgestore.ts +0 -9
- package/src/lib/pinecone-client.ts +0 -0
- package/src/lib/utils.ts +0 -6
- package/src/utils/docSerialization.ts +0 -77
- package/src/utils/emoji-list.ts +0 -16615
- package/src/utils/getDOMRangeRect.ts +0 -27
- package/src/utils/getThemeSelector.ts +0 -25
- package/src/utils/isMobileWidth.ts +0 -7
- package/src/utils/joinClasses.ts +0 -13
- package/src/utils/setFloatingElemPosition.ts +0 -74
- package/src/utils/setFloatingElemPositionForLinkEditor.ts +0 -46
- package/src/utils/swipe.ts +0 -127
- package/src/utils/url.ts +0 -38
- package/tsconfig.json +0 -27
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Popover,
|
|
3
|
+
PopoverContent,
|
|
4
|
+
PopoverTrigger
|
|
5
|
+
} from "./chunk-64Z3FI7T.mjs";
|
|
6
|
+
import {
|
|
7
|
+
Label,
|
|
8
|
+
Tabs,
|
|
9
|
+
TabsContent,
|
|
10
|
+
TabsList,
|
|
11
|
+
TabsTrigger
|
|
12
|
+
} from "./chunk-3CPBODXA.mjs";
|
|
13
|
+
import {
|
|
14
|
+
Input
|
|
15
|
+
} from "./chunk-POGRR73N.mjs";
|
|
16
|
+
import {
|
|
17
|
+
Button
|
|
18
|
+
} from "./chunk-BIU7WTLX.mjs";
|
|
19
|
+
import {
|
|
20
|
+
cn
|
|
21
|
+
} from "./chunk-YHPNOWFH.mjs";
|
|
22
|
+
import {
|
|
23
|
+
__spreadProps,
|
|
24
|
+
__spreadValues,
|
|
25
|
+
init_react_shim
|
|
26
|
+
} from "./chunk-77KXU36M.mjs";
|
|
27
|
+
|
|
28
|
+
// src/components/ui/drop-downs/background-color.tsx
|
|
29
|
+
init_react_shim();
|
|
30
|
+
import { $getSelection } from "lexical";
|
|
31
|
+
import React, { useCallback, useState } from "react";
|
|
32
|
+
import { $patchStyleText } from "@lexical/selection";
|
|
33
|
+
import { useTheme } from "next-themes";
|
|
34
|
+
import { PaintBucketIcon, XIcon } from "lucide-react";
|
|
35
|
+
function BackgroundColor({
|
|
36
|
+
disabled,
|
|
37
|
+
color,
|
|
38
|
+
bgColor,
|
|
39
|
+
editor,
|
|
40
|
+
isTable = false,
|
|
41
|
+
side = "bottom",
|
|
42
|
+
sideOffset = 0,
|
|
43
|
+
style
|
|
44
|
+
}) {
|
|
45
|
+
const { theme } = useTheme();
|
|
46
|
+
const [customBgColor, setCustomBgColor] = useState("#ffffff");
|
|
47
|
+
const [activeTab, setActiveTab] = useState("palette");
|
|
48
|
+
const [recentBgColors, setRecentBgColors] = useState([]);
|
|
49
|
+
const applyStyleText = useCallback(
|
|
50
|
+
(styles, skipHistoryStack) => {
|
|
51
|
+
editor.update(
|
|
52
|
+
() => {
|
|
53
|
+
const selection = $getSelection();
|
|
54
|
+
if (selection !== null) {
|
|
55
|
+
$patchStyleText(selection, styles);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
skipHistoryStack ? { tag: "historic" } : {}
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
[editor]
|
|
62
|
+
);
|
|
63
|
+
const onBgColorSelect = useCallback(
|
|
64
|
+
(value, skipHistoryStack) => {
|
|
65
|
+
applyStyleText({ "background-color": value }, skipHistoryStack);
|
|
66
|
+
if (value && value !== "transparent" && !recentBgColors.includes(value) && !value.startsWith("var(--")) {
|
|
67
|
+
setRecentBgColors((prev) => [value, ...prev.slice(0, 7)]);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
[applyStyleText, recentBgColors]
|
|
71
|
+
);
|
|
72
|
+
const resetBgColor = useCallback(() => {
|
|
73
|
+
applyStyleText({ "background-color": "" }, true);
|
|
74
|
+
}, [applyStyleText]);
|
|
75
|
+
const handleCustomBgColorChange = useCallback((value) => {
|
|
76
|
+
setCustomBgColor(value);
|
|
77
|
+
onBgColorSelect(value, true);
|
|
78
|
+
}, [onBgColorSelect]);
|
|
79
|
+
const hexToRgb = (hex) => {
|
|
80
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
81
|
+
return result ? {
|
|
82
|
+
r: parseInt(result[1], 16),
|
|
83
|
+
g: parseInt(result[2], 16),
|
|
84
|
+
b: parseInt(result[3], 16)
|
|
85
|
+
} : null;
|
|
86
|
+
};
|
|
87
|
+
const generateShades = (baseColor) => {
|
|
88
|
+
const rgb = hexToRgb(baseColor);
|
|
89
|
+
if (!rgb) return [];
|
|
90
|
+
const shades = [];
|
|
91
|
+
for (let i = 10; i <= 90; i += 10) {
|
|
92
|
+
const factor = i / 100;
|
|
93
|
+
const r = Math.round(rgb.r * factor);
|
|
94
|
+
const g = Math.round(rgb.g * factor);
|
|
95
|
+
const b = Math.round(rgb.b * factor);
|
|
96
|
+
shades.push(`rgb(${r}, ${g}, ${b})`);
|
|
97
|
+
}
|
|
98
|
+
return shades;
|
|
99
|
+
};
|
|
100
|
+
const generateTints = (baseColor) => {
|
|
101
|
+
const rgb = hexToRgb(baseColor);
|
|
102
|
+
if (!rgb) return [];
|
|
103
|
+
const tints = [];
|
|
104
|
+
for (let i = 10; i <= 90; i += 10) {
|
|
105
|
+
const factor = i / 100;
|
|
106
|
+
const r = Math.round(rgb.r + (255 - rgb.r) * factor);
|
|
107
|
+
const g = Math.round(rgb.g + (255 - rgb.g) * factor);
|
|
108
|
+
const b = Math.round(rgb.b + (255 - rgb.b) * factor);
|
|
109
|
+
tints.push(`rgb(${r}, ${g}, ${b})`);
|
|
110
|
+
}
|
|
111
|
+
return tints;
|
|
112
|
+
};
|
|
113
|
+
const backgroundColorPalette = React.useMemo(() => ({
|
|
114
|
+
basic: [
|
|
115
|
+
{ name: "None", value: "transparent", isDefault: true },
|
|
116
|
+
{ name: "Gray", value: "var(--background-gray)" },
|
|
117
|
+
{ name: "Brown", value: "var(--background-brown)" },
|
|
118
|
+
{ name: "Orange", value: "var(--background-orange)" },
|
|
119
|
+
{ name: "Yellow", value: "var(--background-yellow)" },
|
|
120
|
+
{ name: "Green", value: "var(--background-green)" },
|
|
121
|
+
{ name: "Blue", value: "var(--background-blue)" },
|
|
122
|
+
{ name: "Purple", value: "var(--background-purple)" },
|
|
123
|
+
{ name: "Pink", value: "var(--background-pink)" },
|
|
124
|
+
{ name: "Red", value: "var(--background-red)" }
|
|
125
|
+
],
|
|
126
|
+
extended: [
|
|
127
|
+
// Light backgrounds
|
|
128
|
+
{ name: "Light Red", value: "#ffebee" },
|
|
129
|
+
{ name: "Light Pink", value: "#fce4ec" },
|
|
130
|
+
{ name: "Light Purple", value: "#f3e5f5" },
|
|
131
|
+
{ name: "Light Blue", value: "#e3f2fd" },
|
|
132
|
+
{ name: "Light Cyan", value: "#e0f2f1" },
|
|
133
|
+
{ name: "Light Green", value: "#e8f5e8" },
|
|
134
|
+
{ name: "Light Yellow", value: "#fffde7" },
|
|
135
|
+
{ name: "Light Orange", value: "#fff3e0" },
|
|
136
|
+
{ name: "Light Brown", value: "#efebe9" },
|
|
137
|
+
{ name: "Light Gray", value: "#fafafa" },
|
|
138
|
+
// Medium backgrounds
|
|
139
|
+
{ name: "Red", value: "#ffcdd2" },
|
|
140
|
+
{ name: "Pink", value: "#f8bbd9" },
|
|
141
|
+
{ name: "Purple", value: "#e1bee7" },
|
|
142
|
+
{ name: "Blue", value: "#bbdefb" },
|
|
143
|
+
{ name: "Cyan", value: "#b2dfdb" },
|
|
144
|
+
{ name: "Green", value: "#c8e6c9" },
|
|
145
|
+
{ name: "Yellow", value: "#fff9c4" },
|
|
146
|
+
{ name: "Orange", value: "#ffe0b2" },
|
|
147
|
+
{ name: "Brown", value: "#d7ccc8" },
|
|
148
|
+
{ name: "Gray", value: "#f5f5f5" },
|
|
149
|
+
// Darker backgrounds
|
|
150
|
+
{ name: "Dark Red", value: "#ef9a9a" },
|
|
151
|
+
{ name: "Dark Pink", value: "#f48fb1" },
|
|
152
|
+
{ name: "Dark Purple", value: "#ce93d8" },
|
|
153
|
+
{ name: "Dark Blue", value: "#90caf9" },
|
|
154
|
+
{ name: "Dark Cyan", value: "#80cbc4" },
|
|
155
|
+
{ name: "Dark Green", value: "#a5d6a7" },
|
|
156
|
+
{ name: "Dark Yellow", value: "#fff59d" },
|
|
157
|
+
{ name: "Dark Orange", value: "#ffcc02" },
|
|
158
|
+
{ name: "Dark Brown", value: "#bcaaa4" },
|
|
159
|
+
{ name: "Dark Gray", value: "#eeeeee" },
|
|
160
|
+
// Accent colors
|
|
161
|
+
{ name: "Mint", value: "#f0fff4" },
|
|
162
|
+
{ name: "Lavender", value: "#f0f8ff" },
|
|
163
|
+
{ name: "Peach", value: "#ffeee6" },
|
|
164
|
+
{ name: "Cream", value: "#fffdd0" },
|
|
165
|
+
{ name: "Rose", value: "#fff0f5" }
|
|
166
|
+
]
|
|
167
|
+
}), []);
|
|
168
|
+
const isActiveBgColor = (colorValue) => {
|
|
169
|
+
return bgColor === colorValue || !bgColor && colorValue === "transparent";
|
|
170
|
+
};
|
|
171
|
+
return /* @__PURE__ */ React.createElement(Popover, null, /* @__PURE__ */ React.createElement(PopoverTrigger, { asChild: true, disabled }, !isTable ? /* @__PURE__ */ React.createElement(
|
|
172
|
+
Button,
|
|
173
|
+
{
|
|
174
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
175
|
+
backgroundColor: bgColor === "#fff" || !bgColor ? "transparent" : bgColor
|
|
176
|
+
}),
|
|
177
|
+
variant: "ghost",
|
|
178
|
+
className: cn(
|
|
179
|
+
"relative px-3 py-2 h-9 border border-transparent rounded-md",
|
|
180
|
+
"hover:bg-accent hover:text-accent-foreground",
|
|
181
|
+
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
182
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
183
|
+
"transition-all duration-200"
|
|
184
|
+
),
|
|
185
|
+
size: "sm",
|
|
186
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
187
|
+
"aria-label": "Background color options"
|
|
188
|
+
},
|
|
189
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-1" }, /* @__PURE__ */ React.createElement(PaintBucketIcon, { className: "w-4 h-4" }), /* @__PURE__ */ React.createElement(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
className: "w-3 h-1 rounded-sm border border-border/50 ml-1",
|
|
193
|
+
style: {
|
|
194
|
+
backgroundColor: bgColor || "transparent",
|
|
195
|
+
backgroundImage: !bgColor || bgColor === "transparent" ? "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)" : void 0,
|
|
196
|
+
backgroundSize: !bgColor || bgColor === "transparent" ? "4px 4px" : void 0,
|
|
197
|
+
backgroundPosition: !bgColor || bgColor === "transparent" ? "0 0, 0 2px, 2px -2px, -2px 0px" : void 0
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
))
|
|
201
|
+
) : /* @__PURE__ */ React.createElement(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
style: __spreadProps(__spreadValues({}, style), {
|
|
205
|
+
backgroundColor: bgColor === "#fff" ? "transparent" : bgColor
|
|
206
|
+
}),
|
|
207
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
208
|
+
className: "cursor-pointer px-2 py-1 rounded hover:bg-accent transition-colors"
|
|
209
|
+
},
|
|
210
|
+
"Background"
|
|
211
|
+
)), /* @__PURE__ */ React.createElement(
|
|
212
|
+
PopoverContent,
|
|
213
|
+
{
|
|
214
|
+
className: "w-60 p-4 z-[250] shadow-lg border-border/50",
|
|
215
|
+
side,
|
|
216
|
+
sideOffset
|
|
217
|
+
},
|
|
218
|
+
/* @__PURE__ */ React.createElement(Tabs, { value: activeTab, onValueChange: setActiveTab, className: "w-full" }, /* @__PURE__ */ React.createElement(TabsList, { className: "grid w-full grid-cols-4" }, /* @__PURE__ */ React.createElement(TabsTrigger, { value: "palette", className: "text-xs" }, "Basic"), /* @__PURE__ */ React.createElement(TabsTrigger, { value: "extended", className: "text-xs" }, "Extended"), /* @__PURE__ */ React.createElement(TabsTrigger, { value: "custom", className: "text-xs" }, "Custom"), /* @__PURE__ */ React.createElement(TabsTrigger, { value: "recent", className: "text-xs" }, "Recent")), /* @__PURE__ */ React.createElement("div", { className: "mt-4" }, /* @__PURE__ */ React.createElement(TabsContent, { value: "palette", className: "mt-0" }, /* @__PURE__ */ React.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React.createElement("span", { className: "text-sm font-semibold text-foreground" }, "Basic Backgrounds"), /* @__PURE__ */ React.createElement(
|
|
219
|
+
Button,
|
|
220
|
+
{
|
|
221
|
+
variant: "ghost",
|
|
222
|
+
size: "sm",
|
|
223
|
+
onClick: resetBgColor,
|
|
224
|
+
className: "h-7 px-3 text-xs text-muted-foreground hover:text-foreground"
|
|
225
|
+
},
|
|
226
|
+
/* @__PURE__ */ React.createElement(XIcon, { className: "w-3 h-3 mr-1" }),
|
|
227
|
+
"Remove"
|
|
228
|
+
)), /* @__PURE__ */ React.createElement("div", { className: "grid grid-cols-5 gap-2" }, backgroundColorPalette.basic.map((colorItem, index) => /* @__PURE__ */ React.createElement(
|
|
229
|
+
Button,
|
|
230
|
+
{
|
|
231
|
+
key: `${colorItem.name}-${index}`,
|
|
232
|
+
type: "button",
|
|
233
|
+
onClick: () => onBgColorSelect(colorItem.value, true),
|
|
234
|
+
className: cn(
|
|
235
|
+
"w-8 h-8 p-0 rounded-lg border-2 transition-all duration-200",
|
|
236
|
+
"hover:scale-110 hover:shadow-md",
|
|
237
|
+
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
238
|
+
isActiveBgColor(colorItem.value) ? "border-ring shadow-md scale-105" : "border-border/30 hover:border-border"
|
|
239
|
+
),
|
|
240
|
+
style: {
|
|
241
|
+
backgroundColor: colorItem.value === "transparent" ? "transparent" : colorItem.value,
|
|
242
|
+
backgroundImage: colorItem.value === "transparent" ? "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)" : void 0,
|
|
243
|
+
backgroundSize: colorItem.value === "transparent" ? "8px 8px" : void 0,
|
|
244
|
+
backgroundPosition: colorItem.value === "transparent" ? "0 0, 0 4px, 4px -4px, -4px 0px" : void 0
|
|
245
|
+
},
|
|
246
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
247
|
+
title: colorItem.name
|
|
248
|
+
}
|
|
249
|
+
))))), /* @__PURE__ */ React.createElement(TabsContent, { value: "extended", className: "mt-0" }, /* @__PURE__ */ React.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React.createElement("span", { className: "text-sm font-semibold text-foreground" }, "Extended Backgrounds"), /* @__PURE__ */ React.createElement(
|
|
250
|
+
Button,
|
|
251
|
+
{
|
|
252
|
+
variant: "ghost",
|
|
253
|
+
size: "sm",
|
|
254
|
+
onClick: resetBgColor,
|
|
255
|
+
className: "h-7 px-3 text-xs text-muted-foreground hover:text-foreground"
|
|
256
|
+
},
|
|
257
|
+
/* @__PURE__ */ React.createElement(XIcon, { className: "w-3 h-3 mr-1" }),
|
|
258
|
+
"Remove"
|
|
259
|
+
)), /* @__PURE__ */ React.createElement("div", { className: "grid grid-cols-5 gap-1.5 max-h-48 overflow-y-auto scrollbar-none" }, backgroundColorPalette.extended.map((colorItem, index) => /* @__PURE__ */ React.createElement(
|
|
260
|
+
Button,
|
|
261
|
+
{
|
|
262
|
+
key: `${colorItem.name}-ext-${index}`,
|
|
263
|
+
type: "button",
|
|
264
|
+
onClick: () => onBgColorSelect(colorItem.value, true),
|
|
265
|
+
className: cn(
|
|
266
|
+
"w-8 h-8 p-0 rounded-md border-2 transition-all duration-200",
|
|
267
|
+
"hover:scale-110 hover:shadow-md",
|
|
268
|
+
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
269
|
+
isActiveBgColor(colorItem.value) ? "border-ring shadow-md scale-105" : "border-border/30 hover:border-border"
|
|
270
|
+
),
|
|
271
|
+
style: {
|
|
272
|
+
backgroundColor: colorItem.value
|
|
273
|
+
},
|
|
274
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
275
|
+
title: colorItem.name
|
|
276
|
+
}
|
|
277
|
+
))))), /* @__PURE__ */ React.createElement(TabsContent, { value: "custom", className: "mt-0" }, /* @__PURE__ */ React.createElement("div", { className: "space-y-4" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React.createElement("span", { className: "text-sm font-semibold text-foreground" }, "Custom Background"), /* @__PURE__ */ React.createElement(
|
|
278
|
+
Button,
|
|
279
|
+
{
|
|
280
|
+
variant: "ghost",
|
|
281
|
+
size: "sm",
|
|
282
|
+
onClick: resetBgColor,
|
|
283
|
+
className: "h-7 px-3 text-xs text-muted-foreground hover:text-foreground"
|
|
284
|
+
},
|
|
285
|
+
/* @__PURE__ */ React.createElement(XIcon, { className: "w-3 h-3 mr-1" }),
|
|
286
|
+
"Remove"
|
|
287
|
+
)), /* @__PURE__ */ React.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ React.createElement("div", { className: "flex gap-2" }, /* @__PURE__ */ React.createElement(
|
|
288
|
+
Input,
|
|
289
|
+
{
|
|
290
|
+
type: "color",
|
|
291
|
+
value: customBgColor,
|
|
292
|
+
onChange: (e) => handleCustomBgColorChange(e.target.value),
|
|
293
|
+
className: "w-16 h-10 p-1 rounded-md cursor-pointer"
|
|
294
|
+
}
|
|
295
|
+
), /* @__PURE__ */ React.createElement(
|
|
296
|
+
Input,
|
|
297
|
+
{
|
|
298
|
+
type: "text",
|
|
299
|
+
value: customBgColor,
|
|
300
|
+
onChange: (e) => {
|
|
301
|
+
setCustomBgColor(e.target.value);
|
|
302
|
+
if (/^#[0-9A-F]{6}$/i.test(e.target.value)) {
|
|
303
|
+
onBgColorSelect(e.target.value, true);
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
placeholder: "#ffffff",
|
|
307
|
+
className: "flex-1 font-mono text-sm"
|
|
308
|
+
}
|
|
309
|
+
)), customBgColor && /* @__PURE__ */ React.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ React.createElement(Label, { className: "text-xs text-muted-foreground" }, "Shades"), /* @__PURE__ */ React.createElement("div", { className: "grid grid-cols-6 gap-1" }, generateShades(customBgColor).map((shade, index) => /* @__PURE__ */ React.createElement(
|
|
310
|
+
Button,
|
|
311
|
+
{
|
|
312
|
+
key: `bg-shade-${index}`,
|
|
313
|
+
type: "button",
|
|
314
|
+
onClick: () => onBgColorSelect(shade, true),
|
|
315
|
+
className: "w-6 h-6 p-0 rounded border hover:scale-110 transition-transform",
|
|
316
|
+
style: { backgroundColor: shade },
|
|
317
|
+
onMouseDown: (e) => e.preventDefault()
|
|
318
|
+
}
|
|
319
|
+
))), /* @__PURE__ */ React.createElement(Label, { className: "text-xs text-muted-foreground" }, "Tints"), /* @__PURE__ */ React.createElement("div", { className: "grid grid-cols-6 gap-1" }, generateTints(customBgColor).map((tint, index) => /* @__PURE__ */ React.createElement(
|
|
320
|
+
Button,
|
|
321
|
+
{
|
|
322
|
+
key: `bg-tint-${index}`,
|
|
323
|
+
type: "button",
|
|
324
|
+
onClick: () => onBgColorSelect(tint, true),
|
|
325
|
+
className: "w-6 h-6 p-0 rounded border hover:scale-110 transition-transform",
|
|
326
|
+
style: { backgroundColor: tint },
|
|
327
|
+
onMouseDown: (e) => e.preventDefault()
|
|
328
|
+
}
|
|
329
|
+
))))))), /* @__PURE__ */ React.createElement(TabsContent, { value: "recent", className: "mt-0" }, /* @__PURE__ */ React.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React.createElement("span", { className: "text-sm font-semibold text-foreground" }, "Recent Backgrounds"), /* @__PURE__ */ React.createElement(
|
|
330
|
+
Button,
|
|
331
|
+
{
|
|
332
|
+
variant: "ghost",
|
|
333
|
+
size: "sm",
|
|
334
|
+
onClick: () => setRecentBgColors([]),
|
|
335
|
+
className: "h-7 px-3 text-xs text-muted-foreground hover:text-foreground",
|
|
336
|
+
disabled: recentBgColors.length === 0
|
|
337
|
+
},
|
|
338
|
+
"Clear"
|
|
339
|
+
)), recentBgColors.length > 0 ? /* @__PURE__ */ React.createElement("div", { className: "grid grid-cols-4 gap-2" }, recentBgColors.map((recentColor, index) => /* @__PURE__ */ React.createElement(
|
|
340
|
+
Button,
|
|
341
|
+
{
|
|
342
|
+
key: `recent-bg-${index}`,
|
|
343
|
+
type: "button",
|
|
344
|
+
onClick: () => onBgColorSelect(recentColor, true),
|
|
345
|
+
className: cn(
|
|
346
|
+
"w-12 h-12 p-0 rounded-lg border-2 transition-all duration-200",
|
|
347
|
+
"hover:scale-110 hover:shadow-md",
|
|
348
|
+
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
349
|
+
isActiveBgColor(recentColor) ? "border-ring shadow-md scale-105" : "border-border/30 hover:border-border"
|
|
350
|
+
),
|
|
351
|
+
style: {
|
|
352
|
+
backgroundColor: recentColor
|
|
353
|
+
},
|
|
354
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
355
|
+
title: recentColor
|
|
356
|
+
}
|
|
357
|
+
))) : /* @__PURE__ */ React.createElement("div", { className: "text-center py-6 text-muted-foreground text-sm" }, "No recent background colors")))))
|
|
358
|
+
));
|
|
359
|
+
}
|
|
360
|
+
export {
|
|
361
|
+
BackgroundColor as default
|
|
362
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BlockFormatDropDown
|
|
3
|
+
} from "./chunk-K36V4SIW.mjs";
|
|
4
|
+
import "./chunk-EGMI62PP.mjs";
|
|
5
|
+
import "./chunk-KJ6AJ44Q.mjs";
|
|
6
|
+
import "./chunk-64Z3FI7T.mjs";
|
|
7
|
+
import "./chunk-PZSUSXQG.mjs";
|
|
8
|
+
import "./chunk-7NZAPJ4G.mjs";
|
|
9
|
+
import "./chunk-WDG7J2DY.mjs";
|
|
10
|
+
import "./chunk-BIU7WTLX.mjs";
|
|
11
|
+
import "./chunk-YHPNOWFH.mjs";
|
|
12
|
+
import "./chunk-77KXU36M.mjs";
|
|
13
|
+
export {
|
|
14
|
+
BlockFormatDropDown as default
|
|
15
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SHORTCUTS
|
|
3
|
+
} from "./chunk-ZB5LZQKC.mjs";
|
|
4
|
+
import {
|
|
5
|
+
updateFontSize,
|
|
6
|
+
updateFontSizeInSelection
|
|
7
|
+
} from "./chunk-PZSUSXQG.mjs";
|
|
8
|
+
import {
|
|
9
|
+
MAX_ALLOWED_FONT_SIZE,
|
|
10
|
+
MIN_ALLOWED_FONT_SIZE
|
|
11
|
+
} from "./chunk-7NZAPJ4G.mjs";
|
|
12
|
+
import {
|
|
13
|
+
Input
|
|
14
|
+
} from "./chunk-POGRR73N.mjs";
|
|
15
|
+
import {
|
|
16
|
+
Button
|
|
17
|
+
} from "./chunk-BIU7WTLX.mjs";
|
|
18
|
+
import {
|
|
19
|
+
cn
|
|
20
|
+
} from "./chunk-YHPNOWFH.mjs";
|
|
21
|
+
import {
|
|
22
|
+
init_react_shim
|
|
23
|
+
} from "./chunk-77KXU36M.mjs";
|
|
24
|
+
|
|
25
|
+
// src/components/ui/drop-downs/font-size.tsx
|
|
26
|
+
init_react_shim();
|
|
27
|
+
import * as React from "react";
|
|
28
|
+
import { Minus, Plus } from "lucide-react";
|
|
29
|
+
function parseAllowedFontSize(input) {
|
|
30
|
+
const match = input.match(/^(\d+(?:\.\d+)?)px$/);
|
|
31
|
+
if (match) {
|
|
32
|
+
const n = Number(match[1]);
|
|
33
|
+
if (n >= MIN_ALLOWED_FONT_SIZE && n <= MAX_ALLOWED_FONT_SIZE) {
|
|
34
|
+
return input;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return "";
|
|
38
|
+
}
|
|
39
|
+
function FontSize({
|
|
40
|
+
selectionFontSize,
|
|
41
|
+
disabled,
|
|
42
|
+
editor,
|
|
43
|
+
className,
|
|
44
|
+
classNameContent
|
|
45
|
+
}) {
|
|
46
|
+
const [inputValue, setInputValue] = React.useState(selectionFontSize);
|
|
47
|
+
const [inputChangeFlag, setInputChangeFlag] = React.useState(false);
|
|
48
|
+
const handleKeyPress = (e) => {
|
|
49
|
+
const inputValueNumber = Number(inputValue);
|
|
50
|
+
if (e.key === "Tab") {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (["e", "E", "+", "-"].includes(e.key) || isNaN(inputValueNumber)) {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
setInputValue("");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
setInputChangeFlag(true);
|
|
59
|
+
if (e.key === "Enter" || e.key === "Escape") {
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
updateFontSizeByInputValue(inputValueNumber);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const handleInputBlur = () => {
|
|
65
|
+
if (inputValue !== "" && inputChangeFlag) {
|
|
66
|
+
const inputValueNumber = Number(inputValue);
|
|
67
|
+
updateFontSizeByInputValue(inputValueNumber);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const updateFontSizeByInputValue = (inputValueNumber) => {
|
|
71
|
+
let updatedFontSize = inputValueNumber;
|
|
72
|
+
if (inputValueNumber > MAX_ALLOWED_FONT_SIZE) {
|
|
73
|
+
updatedFontSize = MAX_ALLOWED_FONT_SIZE;
|
|
74
|
+
} else if (inputValueNumber < MIN_ALLOWED_FONT_SIZE) {
|
|
75
|
+
updatedFontSize = MIN_ALLOWED_FONT_SIZE;
|
|
76
|
+
}
|
|
77
|
+
setInputValue(String(updatedFontSize));
|
|
78
|
+
updateFontSizeInSelection(editor, String(updatedFontSize) + "px", null);
|
|
79
|
+
setInputChangeFlag(false);
|
|
80
|
+
};
|
|
81
|
+
React.useEffect(() => {
|
|
82
|
+
setInputValue(selectionFontSize);
|
|
83
|
+
}, [selectionFontSize]);
|
|
84
|
+
return /* @__PURE__ */ React.createElement("div", { className: cn("flex flex-row items-center gap-1", classNameContent) }, /* @__PURE__ */ React.createElement(
|
|
85
|
+
Button,
|
|
86
|
+
{
|
|
87
|
+
type: "button",
|
|
88
|
+
className: cn("h-7 min-w-[29px] w-[29px] px-[6px] border-none cursor-pointer", className),
|
|
89
|
+
tip: `decrement ${SHORTCUTS.INCREASE_FONT_SIZE}`,
|
|
90
|
+
disabled: disabled || selectionFontSize !== "" && Number(inputValue) <= MIN_ALLOWED_FONT_SIZE,
|
|
91
|
+
variant: "outline",
|
|
92
|
+
size: "Toolbar",
|
|
93
|
+
onClick: () => updateFontSize(editor, 2 /* decrement */, inputValue)
|
|
94
|
+
},
|
|
95
|
+
/* @__PURE__ */ React.createElement(Minus, { className: "w-[15px] h-[15px]" })
|
|
96
|
+
), /* @__PURE__ */ React.createElement(
|
|
97
|
+
Input,
|
|
98
|
+
{
|
|
99
|
+
type: "number",
|
|
100
|
+
value: inputValue,
|
|
101
|
+
disabled,
|
|
102
|
+
className: cn("h-7 min-w-[29px] w-[29px] px-[6px] border-none cursor-text", className),
|
|
103
|
+
min: MIN_ALLOWED_FONT_SIZE,
|
|
104
|
+
max: MAX_ALLOWED_FONT_SIZE,
|
|
105
|
+
onChange: (e) => setInputValue(e.target.value),
|
|
106
|
+
onKeyDown: handleKeyPress,
|
|
107
|
+
onBlur: handleInputBlur
|
|
108
|
+
}
|
|
109
|
+
), /* @__PURE__ */ React.createElement(
|
|
110
|
+
Button,
|
|
111
|
+
{
|
|
112
|
+
type: "button",
|
|
113
|
+
tip: `increment ${SHORTCUTS.DECREASE_FONT_SIZE}`,
|
|
114
|
+
className: cn("h-7 min-w-[29px] w-[29px] px-[6px] border-none cursor-pointer", className),
|
|
115
|
+
disabled: disabled || selectionFontSize !== "" && Number(inputValue) >= MAX_ALLOWED_FONT_SIZE,
|
|
116
|
+
variant: "outline",
|
|
117
|
+
size: "Toolbar",
|
|
118
|
+
onClick: () => updateFontSize(editor, 1 /* increment */, inputValue)
|
|
119
|
+
},
|
|
120
|
+
/* @__PURE__ */ React.createElement(Plus, { className: "w-4 h-4" })
|
|
121
|
+
));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
parseAllowedFontSize,
|
|
126
|
+
FontSize
|
|
127
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-YHPNOWFH.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__objRest,
|
|
6
|
+
__spreadValues,
|
|
7
|
+
init_react_shim
|
|
8
|
+
} from "./chunk-77KXU36M.mjs";
|
|
9
|
+
|
|
10
|
+
// src/components/ui/tabs.tsx
|
|
11
|
+
init_react_shim();
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
14
|
+
var Tabs = TabsPrimitive.Root;
|
|
15
|
+
var TabsList = React.forwardRef((_a, ref) => {
|
|
16
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
17
|
+
return /* @__PURE__ */ React.createElement(
|
|
18
|
+
TabsPrimitive.List,
|
|
19
|
+
__spreadValues({
|
|
20
|
+
ref,
|
|
21
|
+
className: cn(
|
|
22
|
+
"inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
|
|
23
|
+
className
|
|
24
|
+
)
|
|
25
|
+
}, props)
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
29
|
+
var TabsTrigger = React.forwardRef((_a, ref) => {
|
|
30
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
31
|
+
return /* @__PURE__ */ React.createElement(
|
|
32
|
+
TabsPrimitive.Trigger,
|
|
33
|
+
__spreadValues({
|
|
34
|
+
ref,
|
|
35
|
+
className: cn(
|
|
36
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
|
|
37
|
+
className
|
|
38
|
+
)
|
|
39
|
+
}, props)
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
43
|
+
var TabsContent = React.forwardRef((_a, ref) => {
|
|
44
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
45
|
+
return /* @__PURE__ */ React.createElement(
|
|
46
|
+
TabsPrimitive.Content,
|
|
47
|
+
__spreadValues({
|
|
48
|
+
ref,
|
|
49
|
+
className: cn(
|
|
50
|
+
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
51
|
+
className
|
|
52
|
+
)
|
|
53
|
+
}, props)
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
57
|
+
|
|
58
|
+
// src/components/ui/label.tsx
|
|
59
|
+
init_react_shim();
|
|
60
|
+
import * as React2 from "react";
|
|
61
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
62
|
+
import { cva } from "class-variance-authority";
|
|
63
|
+
var labelVariants = cva(
|
|
64
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
65
|
+
);
|
|
66
|
+
var Label = React2.forwardRef((_a, ref) => {
|
|
67
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
68
|
+
return /* @__PURE__ */ React2.createElement(
|
|
69
|
+
LabelPrimitive.Root,
|
|
70
|
+
__spreadValues({
|
|
71
|
+
ref,
|
|
72
|
+
className: cn(labelVariants(), className)
|
|
73
|
+
}, props)
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
77
|
+
|
|
78
|
+
export {
|
|
79
|
+
Tabs,
|
|
80
|
+
TabsList,
|
|
81
|
+
TabsTrigger,
|
|
82
|
+
TabsContent,
|
|
83
|
+
Label
|
|
84
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-YHPNOWFH.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__objRest,
|
|
6
|
+
__spreadValues,
|
|
7
|
+
init_react_shim
|
|
8
|
+
} from "./chunk-77KXU36M.mjs";
|
|
9
|
+
|
|
10
|
+
// src/components/ui/card.tsx
|
|
11
|
+
init_react_shim();
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
var Card = React.forwardRef((_a, ref) => {
|
|
14
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
15
|
+
return /* @__PURE__ */ React.createElement(
|
|
16
|
+
"div",
|
|
17
|
+
__spreadValues({
|
|
18
|
+
ref,
|
|
19
|
+
className: cn(
|
|
20
|
+
"rounded-xl border bg-card text-card-foreground shadow",
|
|
21
|
+
className
|
|
22
|
+
)
|
|
23
|
+
}, props)
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
Card.displayName = "Card";
|
|
27
|
+
var CardHeader = React.forwardRef((_a, ref) => {
|
|
28
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
29
|
+
return /* @__PURE__ */ React.createElement(
|
|
30
|
+
"div",
|
|
31
|
+
__spreadValues({
|
|
32
|
+
ref,
|
|
33
|
+
className: cn("flex flex-col space-y-1.5 p-6", className)
|
|
34
|
+
}, props)
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
CardHeader.displayName = "CardHeader";
|
|
38
|
+
var CardTitle = React.forwardRef((_a, ref) => {
|
|
39
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
40
|
+
return /* @__PURE__ */ React.createElement(
|
|
41
|
+
"div",
|
|
42
|
+
__spreadValues({
|
|
43
|
+
ref,
|
|
44
|
+
className: cn("font-semibold leading-none tracking-tight", className)
|
|
45
|
+
}, props)
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
CardTitle.displayName = "CardTitle";
|
|
49
|
+
var CardDescription = React.forwardRef((_a, ref) => {
|
|
50
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
51
|
+
return /* @__PURE__ */ React.createElement(
|
|
52
|
+
"div",
|
|
53
|
+
__spreadValues({
|
|
54
|
+
ref,
|
|
55
|
+
className: cn("text-sm text-muted-foreground", className)
|
|
56
|
+
}, props)
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
CardDescription.displayName = "CardDescription";
|
|
60
|
+
var CardContent = React.forwardRef((_a, ref) => {
|
|
61
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
62
|
+
return /* @__PURE__ */ React.createElement("div", __spreadValues({ ref, className: cn("p-6 ", className) }, props));
|
|
63
|
+
});
|
|
64
|
+
CardContent.displayName = "CardContent";
|
|
65
|
+
var CardFooter = React.forwardRef((_a, ref) => {
|
|
66
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
67
|
+
return /* @__PURE__ */ React.createElement(
|
|
68
|
+
"div",
|
|
69
|
+
__spreadValues({
|
|
70
|
+
ref,
|
|
71
|
+
className: cn("flex items-center p-6 ", className)
|
|
72
|
+
}, props)
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
CardFooter.displayName = "CardFooter";
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
Card,
|
|
79
|
+
CardHeader,
|
|
80
|
+
CardTitle,
|
|
81
|
+
CardContent,
|
|
82
|
+
CardFooter
|
|
83
|
+
};
|