camox 0.41.1 → 0.43.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.
Files changed (93) hide show
  1. package/dist/core/components/lexical/{GradientNode.js → HighlightNode.js} +34 -34
  2. package/dist/core/components/lexical/InlineLexicalEditor.js +14 -14
  3. package/dist/core/components/lexical/InlineStylesPlugin.js +6 -6
  4. package/dist/core/components/lexical/SelectionBroadcaster.js +5 -5
  5. package/dist/core/components/lexical/SidebarLexicalEditor.js +52 -49
  6. package/dist/core/components/lexical/TextLinkPopover.js +191 -208
  7. package/dist/core/components/lexical/editorConfig.js +2 -2
  8. package/dist/core/createApp.d.ts +19 -4
  9. package/dist/core/createApp.js +2 -1
  10. package/dist/core/createLayout.d.ts +16 -3
  11. package/dist/core/createLayout.js +15 -15
  12. package/dist/core/derivedRoutes.js +1 -1
  13. package/dist/core/dom.d.ts +17 -0
  14. package/dist/core/dom.js +22 -0
  15. package/dist/core/editing/createEditableBlock.d.ts +8 -1
  16. package/dist/core/editing/createEditableBlock.js +636 -459
  17. package/dist/core/hooks/useOverlayState.js +11 -0
  18. package/dist/core/lib/fieldTypes.js +5 -5
  19. package/dist/core/lib/lexicalReact.js +4 -4
  20. package/dist/core/lib/lexicalState.js +20 -4
  21. package/dist/core/lib/modifierFormats.js +1 -1
  22. package/dist/core/lib/textLinks.js +5 -2
  23. package/dist/core/lib/textStyles.d.ts +2 -2
  24. package/dist/core/lib/textStyles.js +6 -11
  25. package/dist/core/pageDestinations.js +37 -0
  26. package/dist/features/og/imageResponse.node.js +11 -9
  27. package/dist/features/preview/CamoxPreview.js +108 -124
  28. package/dist/features/preview/commentsEnabled.js +8 -0
  29. package/dist/features/preview/components/AddBlockSidebar.js +80 -90
  30. package/dist/features/preview/components/AssetLightbox.js +4 -11
  31. package/dist/features/preview/components/AttachedComments.js +194 -0
  32. package/dist/features/preview/components/BlockActionsPopover.js +14 -65
  33. package/dist/features/preview/components/CommentHeader.js +122 -0
  34. package/dist/features/preview/components/CommentSidebar.js +29 -0
  35. package/dist/features/preview/components/CommentTargetQuote.js +166 -0
  36. package/dist/features/preview/components/CreatePageModal.js +4 -10
  37. package/dist/features/preview/components/DerivedLayoutSidebar.js +45 -26
  38. package/dist/features/preview/components/DerivedPageInfoSidebar.js +38 -26
  39. package/dist/features/preview/components/FieldToolbar.js +7 -7
  40. package/dist/features/preview/components/ItemFieldsEditor.js +275 -204
  41. package/dist/features/preview/components/LeftSidebar.js +18 -18
  42. package/dist/features/preview/components/LinkFieldEditor.js +212 -209
  43. package/dist/features/preview/components/OverlayTracker.js +14 -20
  44. package/dist/features/preview/components/Overlays.js +26 -35
  45. package/dist/features/preview/components/PageEditorSidebar.js +90 -91
  46. package/dist/features/preview/components/PageInfoSidebar.js +128 -159
  47. package/dist/features/preview/components/PagePicker.js +29 -24
  48. package/dist/features/preview/components/PageTree.js +159 -157
  49. package/dist/features/preview/components/PreviewComments.js +56 -0
  50. package/dist/features/preview/components/PreviewPanel.js +122 -78
  51. package/dist/features/preview/components/PreviewToolbar.js +280 -231
  52. package/dist/features/preview/components/PublicationRow.js +8 -11
  53. package/dist/features/preview/components/RightSidebar.js +14 -11
  54. package/dist/features/preview/components/SidebarSection.js +121 -0
  55. package/dist/features/preview/components/useRepeatableItemActions.js +1 -1
  56. package/dist/features/preview/previewCommentsStore.js +115 -0
  57. package/dist/features/preview/previewSelection.js +75 -0
  58. package/dist/features/preview/previewStore.js +19 -39
  59. package/dist/features/preview/publication.js +10 -0
  60. package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -34
  61. package/dist/features/provider/CoreCamoxProvider.js +1 -1
  62. package/dist/features/provider/components/CommandPalette.js +142 -58
  63. package/dist/features/provider/useAdminShortcuts.js +19 -8
  64. package/dist/features/routes/pageRuntime.js +0 -6
  65. package/dist/features/runtime/RuntimeChrome.js +40 -37
  66. package/dist/features/runtime/runtime.js +20 -21
  67. package/dist/features/studio/CamoxStudio.js +30 -50
  68. package/dist/features/studio/components/EnvironmentMenu.js +3 -2
  69. package/dist/features/studio/components/Navbar.js +53 -80
  70. package/dist/features/vite/layoutGeneration.js +7 -3
  71. package/dist/features/vite/runtimeDev.js +4 -1
  72. package/dist/features/vite/vite.d.ts +3 -2
  73. package/dist/features/vite/vite.js +14 -6
  74. package/dist/hooks/use-file-upload.js +0 -2
  75. package/dist/hooks/use-page-destinations.js +53 -0
  76. package/dist/lib/auth.js +11 -14
  77. package/dist/lib/server-auth-cookie.js +21 -0
  78. package/dist/studio.css +1 -1
  79. package/package.json +9 -7
  80. package/skills/camox/SKILL.md +32 -9
  81. package/skills/camox/references/block-definitions.md +84 -290
  82. package/skills/camox/references/cli-common.md +2 -4
  83. package/skills/camox/references/cli-content.md +147 -0
  84. package/skills/camox/references/cli-environments.md +1 -1
  85. package/skills/camox/references/dom-integrations.md +93 -0
  86. package/skills/camox/references/field-styling.md +50 -0
  87. package/skills/camox/references/layout-definitions.md +33 -147
  88. package/skills/camox/references/routed-layouts.md +71 -0
  89. package/skills/camoxify/SKILL.md +52 -0
  90. package/dist/lib/telemetry-client.js +0 -66
  91. package/dist/lib/telemetry.js +0 -26
  92. package/skills/camox/references/cli-blocks.md +0 -78
  93. package/skills/camox/references/cli-pages.md +0 -53
@@ -1,25 +1,25 @@
1
1
  import { $applyNodeReplacement, $copyNode, $getSelection, $isElementNode, $isRangeSelection, $isTextNode, ElementNode } from "lexical";
2
2
 
3
- //#region src/core/components/lexical/GradientNode.ts
4
- var GradientNode = class GradientNode extends ElementNode {
3
+ //#region src/core/components/lexical/HighlightNode.ts
4
+ var HighlightNode = class HighlightNode extends ElementNode {
5
5
  static getType() {
6
- return "gradient";
6
+ return "highlight";
7
7
  }
8
8
  static clone(node) {
9
- return new GradientNode(node.__key);
9
+ return new HighlightNode(node.__key);
10
10
  }
11
11
  static importJSON(value) {
12
- return $createGradientNode().updateFromJSON(value);
12
+ return $createHighlightNode().updateFromJSON(value);
13
13
  }
14
14
  static importDOM() {
15
- return { span: (element) => element.hasAttribute("data-camox-gradient") ? {
16
- conversion: () => ({ node: $createGradientNode() }),
15
+ return { span: (element) => element.hasAttribute("data-camox-highlight") ? {
16
+ conversion: () => ({ node: $createHighlightNode() }),
17
17
  priority: 1
18
18
  } : null };
19
19
  }
20
20
  createDOM() {
21
21
  const span = document.createElement("span");
22
- span.dataset.camoxGradient = "";
22
+ span.dataset.camoxHighlight = "";
23
23
  return span;
24
24
  }
25
25
  updateDOM() {
@@ -38,30 +38,30 @@ var GradientNode = class GradientNode extends ElementNode {
38
38
  return false;
39
39
  }
40
40
  };
41
- function $createGradientNode() {
42
- return $applyNodeReplacement(new GradientNode());
41
+ function $createHighlightNode() {
42
+ return $applyNodeReplacement(new HighlightNode());
43
43
  }
44
- function $getGradient(node) {
44
+ function $getHighlight(node) {
45
45
  let current = node;
46
46
  while (current) {
47
- if (current instanceof GradientNode) return current;
47
+ if (current instanceof HighlightNode) return current;
48
48
  current = current.getParent();
49
49
  }
50
50
  return null;
51
51
  }
52
- function $selectionHasGradient() {
52
+ function $selectionHasHighlight() {
53
53
  const selection = $getSelection();
54
54
  if (!$isRangeSelection(selection)) return false;
55
- if (selection.isCollapsed()) return !!$getGradient(selection.anchor.getNode());
55
+ if (selection.isCollapsed()) return !!$getHighlight(selection.anchor.getNode());
56
56
  const texts = selection.getNodes().filter($isTextNode);
57
- return texts.length > 0 && texts.every((node) => !!$getGradient(node));
57
+ return texts.length > 0 && texts.every((node) => !!$getHighlight(node));
58
58
  }
59
- /** Isolate a selected leaf without removing gradient from its unselected siblings. */
60
- function $removeGradientFrom(node) {
61
- const gradient = $getGradient(node);
62
- if (!gradient) return;
59
+ /** Isolate a selected leaf without removing highlight from its unselected siblings. */
60
+ function $removeHighlightFrom(node) {
61
+ const highlight = $getHighlight(node);
62
+ if (!highlight) return;
63
63
  let branch = node;
64
- while (branch.getKey() !== gradient.getKey()) {
64
+ while (branch.getKey() !== highlight.getKey()) {
65
65
  const parent = branch.getParentOrThrow();
66
66
  const before = branch.getPreviousSiblings();
67
67
  const after = branch.getNextSiblings();
@@ -77,40 +77,40 @@ function $removeGradientFrom(node) {
77
77
  }
78
78
  branch = parent;
79
79
  }
80
- for (const child of gradient.getChildren()) gradient.insertBefore(child);
81
- gradient.remove();
80
+ for (const child of highlight.getChildren()) highlight.insertBefore(child);
81
+ highlight.remove();
82
82
  }
83
- function $toggleGradient() {
83
+ function $toggleHighlight() {
84
84
  const selection = $getSelection();
85
85
  if (!$isRangeSelection(selection) || selection.isCollapsed()) return;
86
- const remove = $selectionHasGradient();
86
+ const remove = $selectionHasHighlight();
87
87
  const nodes = selection.extract().filter((node) => $isTextNode(node) || node.getType() === "linebreak");
88
88
  for (const node of nodes) {
89
89
  if (remove) {
90
- $removeGradientFrom(node);
90
+ $removeHighlightFrom(node);
91
91
  continue;
92
92
  }
93
- if ($getGradient(node)) continue;
93
+ if ($getHighlight(node)) continue;
94
94
  const previous = node.getPreviousSibling();
95
- if (previous instanceof GradientNode) {
95
+ if (previous instanceof HighlightNode) {
96
96
  previous.append(node);
97
97
  continue;
98
98
  }
99
- const gradient = $createGradientNode();
100
- node.insertBefore(gradient);
101
- gradient.append(node);
99
+ const highlight = $createHighlightNode();
100
+ node.insertBefore(highlight);
101
+ highlight.append(node);
102
102
  }
103
103
  }
104
104
  /** Keep one background across adjacent runs, including after formatting changes. */
105
- function $normalizeGradient(node) {
105
+ function $normalizeHighlight(node) {
106
106
  const parent = node.getParent();
107
- if (parent instanceof GradientNode) {
107
+ if (parent instanceof HighlightNode) {
108
108
  for (const child of node.getChildren()) node.insertBefore(child);
109
109
  node.remove();
110
110
  return;
111
111
  }
112
112
  const next = node.getNextSibling();
113
- if (next instanceof GradientNode) {
113
+ if (next instanceof HighlightNode) {
114
114
  node.append(...next.getChildren());
115
115
  next.remove();
116
116
  }
@@ -123,4 +123,4 @@ function $normalizeGradient(node) {
123
123
  }
124
124
 
125
125
  //#endregion
126
- export { $normalizeGradient, $selectionHasGradient, $toggleGradient, GradientNode };
126
+ export { $normalizeHighlight, $selectionHasHighlight, $toggleHighlight, HighlightNode };
@@ -1,4 +1,4 @@
1
- import { isHttpTextLinkTarget } from "../../lib/textLinks.js";
1
+ import { isValidTextLinkTarget } from "../../lib/textLinks.js";
2
2
  import { lexicalStateToMarkdown } from "../../lib/lexicalState.js";
3
3
  import { useFrame } from "../../../features/preview/components/Frame.js";
4
4
  import { createEditorConfig, normalizeLexicalState } from "./editorConfig.js";
@@ -20,9 +20,9 @@ import { $getSelection, $isRangeSelection, COMMAND_PRIORITY_LOW, INSERT_LINE_BRE
20
20
  //#region src/core/components/lexical/InlineLexicalEditor.tsx
21
21
  function ExternalStateSync(t0) {
22
22
  const $ = c(8);
23
- if ($[0] !== "b0541f4280871b1a808d1959e8ce88626b23577e7b86258a9337e3475a84264b") {
23
+ if ($[0] !== "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc") {
24
24
  for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
25
- $[0] = "b0541f4280871b1a808d1959e8ce88626b23577e7b86258a9337e3475a84264b";
25
+ $[0] = "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc";
26
26
  }
27
27
  const { externalState } = t0;
28
28
  const [editor] = useLexicalComposerContext();
@@ -79,9 +79,9 @@ function ExternalStateSync(t0) {
79
79
  }
80
80
  function EscapeHandler() {
81
81
  const $ = c(4);
82
- if ($[0] !== "b0541f4280871b1a808d1959e8ce88626b23577e7b86258a9337e3475a84264b") {
82
+ if ($[0] !== "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc") {
83
83
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
84
- $[0] = "b0541f4280871b1a808d1959e8ce88626b23577e7b86258a9337e3475a84264b";
84
+ $[0] = "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc";
85
85
  }
86
86
  const [editor] = useLexicalComposerContext();
87
87
  let t0;
@@ -104,9 +104,9 @@ function EscapeHandler() {
104
104
  }
105
105
  function EnterAsLineBreakHandler() {
106
106
  const $ = c(4);
107
- if ($[0] !== "b0541f4280871b1a808d1959e8ce88626b23577e7b86258a9337e3475a84264b") {
107
+ if ($[0] !== "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc") {
108
108
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
109
- $[0] = "b0541f4280871b1a808d1959e8ce88626b23577e7b86258a9337e3475a84264b";
109
+ $[0] = "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc";
110
110
  }
111
111
  const [editor] = useLexicalComposerContext();
112
112
  let t0;
@@ -130,9 +130,9 @@ function EnterAsLineBreakHandler() {
130
130
  }
131
131
  function PasteUrlAsLinkHandler() {
132
132
  const $ = c(4);
133
- if ($[0] !== "b0541f4280871b1a808d1959e8ce88626b23577e7b86258a9337e3475a84264b") {
133
+ if ($[0] !== "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc") {
134
134
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
135
- $[0] = "b0541f4280871b1a808d1959e8ce88626b23577e7b86258a9337e3475a84264b";
135
+ $[0] = "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc";
136
136
  }
137
137
  const [editor] = useLexicalComposerContext();
138
138
  let t0;
@@ -143,7 +143,7 @@ function PasteUrlAsLinkHandler() {
143
143
  if (!$isRangeSelection(selection) || selection.isCollapsed()) return false;
144
144
  if (!("clipboardData" in event) || !event.clipboardData) return false;
145
145
  const url = event.clipboardData.getData("text/plain").trim();
146
- if (!url || !isHttpTextLinkTarget(url)) return false;
146
+ if (!url || !isValidTextLinkTarget(url)) return false;
147
147
  event.preventDefault();
148
148
  editor.dispatchCommand(TOGGLE_LINK_COMMAND, url);
149
149
  return true;
@@ -161,9 +161,9 @@ function PasteUrlAsLinkHandler() {
161
161
  }
162
162
  function FocusBlurHandler(t0) {
163
163
  const $ = c(6);
164
- if ($[0] !== "b0541f4280871b1a808d1959e8ce88626b23577e7b86258a9337e3475a84264b") {
164
+ if ($[0] !== "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc") {
165
165
  for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
166
- $[0] = "b0541f4280871b1a808d1959e8ce88626b23577e7b86258a9337e3475a84264b";
166
+ $[0] = "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc";
167
167
  }
168
168
  const { onFocus, onBlur } = t0;
169
169
  const [editor] = useLexicalComposerContext();
@@ -265,9 +265,9 @@ function InlineLexicalEditor({ initialState, externalState, onChange, onFocus, o
265
265
  }
266
266
  function LexicalErrorBoundary(t0) {
267
267
  const $ = c(3);
268
- if ($[0] !== "b0541f4280871b1a808d1959e8ce88626b23577e7b86258a9337e3475a84264b") {
268
+ if ($[0] !== "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc") {
269
269
  for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
270
- $[0] = "b0541f4280871b1a808d1959e8ce88626b23577e7b86258a9337e3475a84264b";
270
+ $[0] = "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc";
271
271
  }
272
272
  const { children } = t0;
273
273
  let t1;
@@ -1,6 +1,6 @@
1
1
  import { getPageIdFromTextLinkTarget, isHttpTextLinkTarget, resolveTextLinkHref, shouldOpenTextLinkInNewTab } from "../../lib/textLinks.js";
2
- import { getGradientStyle, getTextAppearance } from "../../lib/textStyles.js";
3
- import { $normalizeGradient, GradientNode } from "./GradientNode.js";
2
+ import { getHighlightStyle, getTextAppearance } from "../../lib/textStyles.js";
3
+ import { $normalizeHighlight, HighlightNode } from "./HighlightNode.js";
4
4
  import { c } from "react/compiler-runtime";
5
5
  import * as React from "react";
6
6
  import { $isLinkNode } from "@lexical/link";
@@ -57,9 +57,9 @@ const unitless = new Set([
57
57
  /** Only manages appearance attributes; Lexical retains ownership of the editable tree. */
58
58
  function InlineStylesPlugin(options) {
59
59
  const $ = c(13);
60
- if ($[0] !== "9e9ec32bc10d3e8c9e669fba8eed46eaf4d41dffba75b558500fddddf9ab14e2") {
60
+ if ($[0] !== "2ac672d1b6a8ab06af1a7ad709040f99688a70d9b3bd2a117fe818c6dc8986e3") {
61
61
  for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
62
- $[0] = "9e9ec32bc10d3e8c9e669fba8eed46eaf4d41dffba75b558500fddddf9ab14e2";
62
+ $[0] = "2ac672d1b6a8ab06af1a7ad709040f99688a70d9b3bd2a117fe818c6dc8986e3";
63
63
  }
64
64
  const [editor] = useLexicalComposerContext();
65
65
  let t0;
@@ -91,7 +91,7 @@ function InlineStylesPlugin(options) {
91
91
  function visit(node) {
92
92
  const dom_0 = editor.getElementByKey(node.getKey());
93
93
  if (dom_0 && $isTextNode(node)) apply(dom_0, getTextAppearance(node.getFormat(), options));
94
- if (dom_0 && node instanceof GradientNode) apply(dom_0, getGradientStyle(options));
94
+ if (dom_0 && node instanceof HighlightNode) apply(dom_0, getHighlightStyle(options));
95
95
  if (dom_0 && $isLinkNode(node)) {
96
96
  const target = node.getURL();
97
97
  const href = resolveTextLinkHref(target, options.pages, options.fallbackHref ?? "#") ?? "#";
@@ -160,7 +160,7 @@ function InlineStylesPlugin(options) {
160
160
  let t2;
161
161
  let t3;
162
162
  if ($[10] !== editor) {
163
- t2 = () => editor.registerNodeTransform(GradientNode, $normalizeGradient);
163
+ t2 = () => editor.registerNodeTransform(HighlightNode, $normalizeHighlight);
164
164
  t3 = [editor];
165
165
  $[10] = editor;
166
166
  $[11] = t2;
@@ -1,6 +1,6 @@
1
1
  import { FORMAT_FLAGS } from "../../lib/modifierFormats.js";
2
2
  import { isOverlayMessage, postOverlayMessage } from "../../../features/preview/overlayMessages.js";
3
- import { $selectionHasGradient, $toggleGradient } from "./GradientNode.js";
3
+ import { $selectionHasHighlight, $toggleHighlight } from "./HighlightNode.js";
4
4
  import { selectTextLink } from "./selectTextLink.js";
5
5
  import { c } from "react/compiler-runtime";
6
6
  import * as React from "react";
@@ -24,9 +24,9 @@ function getLinkTargetFromSelection() {
24
24
  }
25
25
  function SelectionBroadcaster(t0) {
26
26
  const $ = c(20);
27
- if ($[0] !== "9b38f39cf15304b288c351ba69b5c7891a3521400640cd47c3395c47e67ae59c") {
27
+ if ($[0] !== "b88c574c21c23f501029bacae0b122b78516d4a0df4269eae25d68662efb6a32") {
28
28
  for (let $i = 0; $i < 20; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
29
- $[0] = "9b38f39cf15304b288c351ba69b5c7891a3521400640cd47c3395c47e67ae59c";
29
+ $[0] = "b88c574c21c23f501029bacae0b122b78516d4a0df4269eae25d68662efb6a32";
30
30
  }
31
31
  const { targetWindow } = t0;
32
32
  const [editor] = useLexicalComposerContext();
@@ -56,7 +56,7 @@ function SelectionBroadcaster(t0) {
56
56
  "italic",
57
57
  "underline"
58
58
  ]) if (selection.hasFormat(key)) format = format | FORMAT_FLAGS[key];
59
- if ($selectionHasGradient()) format = format | FORMAT_FLAGS.gradient;
59
+ if ($selectionHasHighlight()) format = format | FORMAT_FLAGS.highlight;
60
60
  linkTarget = getLinkTargetFromSelection();
61
61
  });
62
62
  postOverlayMessage({
@@ -154,7 +154,7 @@ function SelectionBroadcaster(t0) {
154
154
  if (lastTextSelectionRef.current) $setSelection(lastTextSelectionRef.current.clone());
155
155
  });
156
156
  if (data.type === "CAMOX_FORMAT_TEXT") {
157
- if (data.formatKey === "gradient") editor.update($toggleGradient);
157
+ if (data.formatKey === "highlight") editor.update($toggleHighlight);
158
158
  else if (data.formatKey === "bold" || data.formatKey === "italic" || data.formatKey === "underline") editor.dispatchCommand(FORMAT_TEXT_COMMAND, data.formatKey);
159
159
  } else if (data.target === null) editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
160
160
  else if (typeof data.text === "string") {
@@ -1,9 +1,9 @@
1
1
  import { FORMAT_FLAGS } from "../../lib/modifierFormats.js";
2
- import { isHttpTextLinkTarget } from "../../lib/textLinks.js";
2
+ import { isValidTextLinkTarget } from "../../lib/textLinks.js";
3
3
  import { lexicalStateToMarkdown } from "../../lib/lexicalState.js";
4
4
  import { INPUT_BASE_STYLES, INPUT_FOCUS_STYLES, cn } from "../../../lib/utils.js";
5
5
  import { TextLinkPopover } from "./TextLinkPopover.js";
6
- import { $selectionHasGradient, $toggleGradient } from "./GradientNode.js";
6
+ import { $selectionHasHighlight, $toggleHighlight } from "./HighlightNode.js";
7
7
  import { createEditorConfig, normalizeLexicalState } from "./editorConfig.js";
8
8
  import { InlineStylesPlugin } from "./InlineStylesPlugin.js";
9
9
  import { selectTextLink } from "./selectTextLink.js";
@@ -11,7 +11,7 @@ import { c } from "react/compiler-runtime";
11
11
  import * as React from "react";
12
12
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
13
  import { Button } from "@camox/ui/button";
14
- import { Blend, Bold, Italic, Underline } from "lucide-react";
14
+ import { Bold, Highlighter, Italic, Underline } from "lucide-react";
15
15
  import { FloatingToolbar } from "@camox/ui/floating-toolbar";
16
16
  import { Toggle } from "@camox/ui/toggle";
17
17
  import { $createLinkNode, TOGGLE_LINK_COMMAND } from "@lexical/link";
@@ -27,9 +27,9 @@ import { $createTextNode, $getSelection, $isRangeSelection, $setSelection, COMMA
27
27
  //#region src/core/components/lexical/SidebarLexicalEditor.tsx
28
28
  function EnterAsLineBreakHandler() {
29
29
  const $ = c(4);
30
- if ($[0] !== "63fce41aab52cd282d26a73e81de9225d7bcf44f37fcaae7c81941ba12aafa05") {
30
+ if ($[0] !== "b2abd53d41bcf7845fda084f34768059ff9a381fdb75359c9fd3fc0de4052372") {
31
31
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
32
- $[0] = "63fce41aab52cd282d26a73e81de9225d7bcf44f37fcaae7c81941ba12aafa05";
32
+ $[0] = "b2abd53d41bcf7845fda084f34768059ff9a381fdb75359c9fd3fc0de4052372";
33
33
  }
34
34
  const [editor] = useLexicalComposerContext();
35
35
  let t0;
@@ -53,9 +53,9 @@ function EnterAsLineBreakHandler() {
53
53
  }
54
54
  function ExternalStateSync(t0) {
55
55
  const $ = c(6);
56
- if ($[0] !== "63fce41aab52cd282d26a73e81de9225d7bcf44f37fcaae7c81941ba12aafa05") {
56
+ if ($[0] !== "b2abd53d41bcf7845fda084f34768059ff9a381fdb75359c9fd3fc0de4052372") {
57
57
  for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
58
- $[0] = "63fce41aab52cd282d26a73e81de9225d7bcf44f37fcaae7c81941ba12aafa05";
58
+ $[0] = "b2abd53d41bcf7845fda084f34768059ff9a381fdb75359c9fd3fc0de4052372";
59
59
  }
60
60
  const { value, isSyncingRef } = t0;
61
61
  const [editor] = useLexicalComposerContext();
@@ -91,9 +91,9 @@ function ExternalStateSync(t0) {
91
91
  }
92
92
  function SidebarFloatingTextToolbar() {
93
93
  const $ = c(72);
94
- if ($[0] !== "63fce41aab52cd282d26a73e81de9225d7bcf44f37fcaae7c81941ba12aafa05") {
94
+ if ($[0] !== "b2abd53d41bcf7845fda084f34768059ff9a381fdb75359c9fd3fc0de4052372") {
95
95
  for (let $i = 0; $i < 72; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
96
- $[0] = "63fce41aab52cd282d26a73e81de9225d7bcf44f37fcaae7c81941ba12aafa05";
96
+ $[0] = "b2abd53d41bcf7845fda084f34768059ff9a381fdb75359c9fd3fc0de4052372";
97
97
  }
98
98
  const [editor] = useLexicalComposerContext();
99
99
  const [open, setOpen] = React.useState(false);
@@ -144,7 +144,7 @@ function SidebarFloatingTextToolbar() {
144
144
  if (selection.hasFormat("bold")) activeFormats = activeFormats | FORMAT_FLAGS.bold;
145
145
  if (selection.hasFormat("italic")) activeFormats = activeFormats | FORMAT_FLAGS.italic;
146
146
  if (selection.hasFormat("underline")) activeFormats = activeFormats | FORMAT_FLAGS.underline;
147
- if ($selectionHasGradient()) activeFormats = activeFormats | FORMAT_FLAGS.gradient;
147
+ if ($selectionHasHighlight()) activeFormats = activeFormats | FORMAT_FLAGS.highlight;
148
148
  let node = selection.anchor.getNode();
149
149
  while (node) {
150
150
  if (node.getType?.() === "link") {
@@ -260,8 +260,8 @@ function SidebarFloatingTextToolbar() {
260
260
  t9 = (formatKey) => {
261
261
  editor.update(() => {
262
262
  restoreSelection();
263
- if (formatKey === "gradient") {
264
- $toggleGradient();
263
+ if (formatKey === "highlight") {
264
+ $toggleHighlight();
265
265
  return;
266
266
  }
267
267
  editor.dispatchCommand(FORMAT_TEXT_COMMAND, formatKey);
@@ -431,9 +431,9 @@ function SidebarFloatingTextToolbar() {
431
431
  label: "Underline",
432
432
  icon: Underline
433
433
  }, {
434
- key: "gradient",
435
- label: "Gradient",
436
- icon: Blend
434
+ key: "highlight",
435
+ label: "Highlight",
436
+ icon: Highlighter
437
437
  }];
438
438
  $[53] = t23;
439
439
  } else t23 = $[53];
@@ -518,9 +518,9 @@ function _temp(event_0) {
518
518
  }
519
519
  function PasteUrlAsLinkHandler() {
520
520
  const $ = c(4);
521
- if ($[0] !== "63fce41aab52cd282d26a73e81de9225d7bcf44f37fcaae7c81941ba12aafa05") {
521
+ if ($[0] !== "b2abd53d41bcf7845fda084f34768059ff9a381fdb75359c9fd3fc0de4052372") {
522
522
  for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
523
- $[0] = "63fce41aab52cd282d26a73e81de9225d7bcf44f37fcaae7c81941ba12aafa05";
523
+ $[0] = "b2abd53d41bcf7845fda084f34768059ff9a381fdb75359c9fd3fc0de4052372";
524
524
  }
525
525
  const [editor] = useLexicalComposerContext();
526
526
  let t0;
@@ -531,7 +531,7 @@ function PasteUrlAsLinkHandler() {
531
531
  if (!$isRangeSelection(selection) || selection.isCollapsed()) return false;
532
532
  if (!("clipboardData" in event) || !event.clipboardData) return false;
533
533
  const url = event.clipboardData.getData("text/plain").trim();
534
- if (!isHttpTextLinkTarget(url)) return false;
534
+ if (!isValidTextLinkTarget(url)) return false;
535
535
  event.preventDefault();
536
536
  editor.dispatchCommand(TOGGLE_LINK_COMMAND, url);
537
537
  return true;
@@ -571,43 +571,46 @@ function SidebarLexicalEditor({ id, value, onChange, onFocus, onBlur }) {
571
571
  timerRef.current = window.setTimeout(flushChange, 300);
572
572
  }, [flushChange]);
573
573
  React.useEffect(() => flushChange, [flushChange]);
574
- return /* @__PURE__ */ jsxs(LexicalComposer, {
575
- initialConfig: config,
576
- children: [
577
- /* @__PURE__ */ jsx(RichTextPlugin, {
578
- contentEditable: /* @__PURE__ */ jsx(ContentEditable, {
579
- id,
580
- className: cn(INPUT_BASE_STYLES, INPUT_FOCUS_STYLES, "flex min-h-[80px] w-full px-3 py-2"),
581
- onFocus,
582
- onBlur: () => {
583
- flushChange();
584
- onBlur?.();
585
- }
574
+ return /* @__PURE__ */ jsx("div", {
575
+ className: "w-full min-w-0",
576
+ children: /* @__PURE__ */ jsxs(LexicalComposer, {
577
+ initialConfig: config,
578
+ children: [
579
+ /* @__PURE__ */ jsx(RichTextPlugin, {
580
+ contentEditable: /* @__PURE__ */ jsx(ContentEditable, {
581
+ id,
582
+ className: cn(INPUT_BASE_STYLES, INPUT_FOCUS_STYLES, "flex min-h-[80px] w-full px-3 py-2"),
583
+ onFocus,
584
+ onBlur: () => {
585
+ flushChange();
586
+ onBlur?.();
587
+ }
588
+ }),
589
+ ErrorBoundary: LexicalErrorBoundary
590
+ }),
591
+ /* @__PURE__ */ jsx(OnChangePlugin, {
592
+ onChange: handleChange,
593
+ ignoreSelectionChange: true
586
594
  }),
587
- ErrorBoundary: LexicalErrorBoundary
588
- }),
589
- /* @__PURE__ */ jsx(OnChangePlugin, {
590
- onChange: handleChange,
591
- ignoreSelectionChange: true
592
- }),
593
- /* @__PURE__ */ jsx(HistoryPlugin, {}),
594
- /* @__PURE__ */ jsx(LinkPlugin, {}),
595
- /* @__PURE__ */ jsx(ExternalStateSync, {
596
- value,
597
- isSyncingRef
598
- }),
599
- /* @__PURE__ */ jsx(EnterAsLineBreakHandler, {}),
600
- /* @__PURE__ */ jsx(PasteUrlAsLinkHandler, {}),
601
- /* @__PURE__ */ jsx(SidebarFloatingTextToolbar, {}),
602
- /* @__PURE__ */ jsx(InlineStylesPlugin, {})
603
- ]
595
+ /* @__PURE__ */ jsx(HistoryPlugin, {}),
596
+ /* @__PURE__ */ jsx(LinkPlugin, {}),
597
+ /* @__PURE__ */ jsx(ExternalStateSync, {
598
+ value,
599
+ isSyncingRef
600
+ }),
601
+ /* @__PURE__ */ jsx(EnterAsLineBreakHandler, {}),
602
+ /* @__PURE__ */ jsx(PasteUrlAsLinkHandler, {}),
603
+ /* @__PURE__ */ jsx(SidebarFloatingTextToolbar, {}),
604
+ /* @__PURE__ */ jsx(InlineStylesPlugin, {})
605
+ ]
606
+ })
604
607
  });
605
608
  }
606
609
  function LexicalErrorBoundary(t0) {
607
610
  const $ = c(3);
608
- if ($[0] !== "63fce41aab52cd282d26a73e81de9225d7bcf44f37fcaae7c81941ba12aafa05") {
611
+ if ($[0] !== "b2abd53d41bcf7845fda084f34768059ff9a381fdb75359c9fd3fc0de4052372") {
609
612
  for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
610
- $[0] = "63fce41aab52cd282d26a73e81de9225d7bcf44f37fcaae7c81941ba12aafa05";
613
+ $[0] = "b2abd53d41bcf7845fda084f34768059ff9a381fdb75359c9fd3fc0de4052372";
611
614
  }
612
615
  const { children } = t0;
613
616
  let t1;