@pixerate/editor-react 0.159.0 → 0.161.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/dist/index.js CHANGED
@@ -94,7 +94,7 @@ import {
94
94
  } from "./chunk-FLS7Q32M.js";
95
95
 
96
96
  // src/hooks/usePromptEditor.ts
97
- import { useMemo, useEffect, useRef } from "react";
97
+ import React, { useMemo, useEffect, useRef } from "react";
98
98
  import { useEditor } from "@tiptap/react";
99
99
  import StarterKit from "@tiptap/starter-kit";
100
100
  import Placeholder from "@tiptap/extension-placeholder";
@@ -109,6 +109,40 @@ import {
109
109
  tokenizePrompt,
110
110
  FileImport
111
111
  } from "@pixerate/editor";
112
+
113
+ // src/loading-node/LoadingIndicator.tsx
114
+ import { createRoot } from "react-dom/client";
115
+ import { jsx } from "react/jsx-runtime";
116
+ function createReactLoadingNodeView(component) {
117
+ const Component = component;
118
+ return (dom, state) => {
119
+ const root = createRoot(dom);
120
+ let latest = state;
121
+ let scheduled = false;
122
+ let destroyed = false;
123
+ const schedule = () => {
124
+ if (scheduled) return;
125
+ scheduled = true;
126
+ queueMicrotask(() => {
127
+ scheduled = false;
128
+ if (!destroyed) root.render(/* @__PURE__ */ jsx(Component, { state: latest }));
129
+ });
130
+ };
131
+ schedule();
132
+ return {
133
+ update: (next) => {
134
+ latest = next;
135
+ schedule();
136
+ },
137
+ destroy: () => {
138
+ destroyed = true;
139
+ queueMicrotask(() => root.unmount());
140
+ }
141
+ };
142
+ };
143
+ }
144
+
145
+ // src/hooks/usePromptEditor.ts
112
146
  var DEFAULT_TEMPLATES = [];
113
147
  var DEFAULT_COLOR_MAP = /* @__PURE__ */ new Map([
114
148
  ["default", { from: "#f43f5e", to: "#8b5cf6" }]
@@ -133,11 +167,23 @@ function usePromptEditor({
133
167
  containerId = "editor-container",
134
168
  jsonVariables,
135
169
  speed = 2,
136
- fileImport
170
+ fileImport,
171
+ loadingIndicator,
172
+ loadingLabel
137
173
  }) {
138
174
  const fileImportRef = useRef(fileImport);
139
175
  fileImportRef.current = fileImport;
140
176
  const fileImportEnabled = !!fileImport;
177
+ const loadingIndicatorRef = useRef(loadingIndicator);
178
+ loadingIndicatorRef.current = loadingIndicator;
179
+ const hasLoadingIndicator = !!loadingIndicator;
180
+ const loadingNodeView = useMemo(
181
+ () => hasLoadingIndicator ? createReactLoadingNodeView((props) => {
182
+ const Indicator = loadingIndicatorRef.current;
183
+ return Indicator ? React.createElement(Indicator, props) : null;
184
+ }) : null,
185
+ [hasLoadingIndicator]
186
+ );
141
187
  const slashCommandActiveRef = useRef(slashCommandActive);
142
188
  slashCommandActiveRef.current = slashCommandActive;
143
189
  const clearSlashCommandRef = useRef(clearSlashCommand);
@@ -192,7 +238,10 @@ function usePromptEditor({
192
238
  TemplateSuggestions.configure({
193
239
  templates
194
240
  }),
195
- LoadingNode,
241
+ LoadingNode.configure({
242
+ nodeView: loadingNodeView,
243
+ ...loadingLabel ? { label: loadingLabel } : {}
244
+ }),
196
245
  ...fileImportEnabled ? [
197
246
  FileImport.configure({
198
247
  ...typeof fileImportRef.current === "object" ? fileImportRef.current : {},
@@ -296,7 +345,7 @@ function usePromptEditor({
296
345
  },
297
346
  // Only options baked into extensions recreate the editor; editable state,
298
347
  // placeholder, class names and content are applied to the live instance.
299
- [resolvedColorMap, templateKey, speed, jsonVariablesKey, fileImportEnabled]
348
+ [resolvedColorMap, templateKey, speed, jsonVariablesKey, fileImportEnabled, loadingNodeView, loadingLabel]
300
349
  );
301
350
  useEffect(() => {
302
351
  if (editor && !editor.isDestroyed) {
@@ -693,7 +742,7 @@ function useDocxExport(editor, options = {}) {
693
742
  }
694
743
 
695
744
  // src/components/ExportDocxButton.tsx
696
- import { jsx } from "react/jsx-runtime";
745
+ import { jsx as jsx2 } from "react/jsx-runtime";
697
746
  var ExportDocxButton = ({
698
747
  editor,
699
748
  className = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-50",
@@ -702,7 +751,7 @@ var ExportDocxButton = ({
702
751
  ...options
703
752
  }) => {
704
753
  const docx = useDocxExport(editor, options);
705
- return /* @__PURE__ */ jsx(
754
+ return /* @__PURE__ */ jsx2(
706
755
  "button",
707
756
  {
708
757
  type: "button",
@@ -788,13 +837,13 @@ function useToolRegistryView(registry, options = {}) {
788
837
  import {
789
838
  EditorContent as TipTapEditorContent
790
839
  } from "@tiptap/react";
791
- import { jsx as jsx2 } from "react/jsx-runtime";
840
+ import { jsx as jsx3 } from "react/jsx-runtime";
792
841
  var EditorContent = ({
793
842
  className,
794
843
  editor,
795
844
  ...props
796
845
  }) => {
797
- return /* @__PURE__ */ jsx2("div", { className, children: /* @__PURE__ */ jsx2(TipTapEditorContent, { editor, ...props }) });
846
+ return /* @__PURE__ */ jsx3("div", { className, children: /* @__PURE__ */ jsx3(TipTapEditorContent, { editor, ...props }) });
798
847
  };
799
848
 
800
849
  // src/components/BubbleMenu.tsx
@@ -855,7 +904,7 @@ import {
855
904
  formatConditionalTag,
856
905
  resolveTemplates
857
906
  } from "@pixerate/editor";
858
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
907
+ import { jsx as jsx4, jsxs } from "react/jsx-runtime";
859
908
  var TemplateRenderer = ({
860
909
  content,
861
910
  templates = [],
@@ -874,7 +923,7 @@ var TemplateRenderer = ({
874
923
  const tokens = useMemo7(() => {
875
924
  return evaluatePromptTokens(displayText, values);
876
925
  }, [displayText, values]);
877
- return /* @__PURE__ */ jsx3("div", { className, children: tokens.map((token, index) => {
926
+ return /* @__PURE__ */ jsx4("div", { className, children: tokens.map((token, index) => {
878
927
  if (token.type === "template") {
879
928
  const colors = templateColorMap?.get(token.value) || {
880
929
  from: "#f43f5e",
@@ -884,7 +933,7 @@ var TemplateRenderer = ({
884
933
  "--color-from": colors.from,
885
934
  "--color-to": colors.to
886
935
  };
887
- return /* @__PURE__ */ jsx3(
936
+ return /* @__PURE__ */ jsx4(
888
937
  "span",
889
938
  {
890
939
  style,
@@ -903,7 +952,7 @@ var TemplateRenderer = ({
903
952
  token.defaultValue !== void 0 ? `Default: ${token.defaultValue || "(empty)"}` : void 0
904
953
  ].filter(Boolean).join("\n");
905
954
  if (token.resolvedValue !== void 0) {
906
- return /* @__PURE__ */ jsx3(
955
+ return /* @__PURE__ */ jsx4(
907
956
  "span",
908
957
  {
909
958
  onClick: () => onVariableClick?.(token.value),
@@ -925,7 +974,7 @@ var TemplateRenderer = ({
925
974
  title: details,
926
975
  children: [
927
976
  `{${token.value}`,
928
- token.defaultValue !== void 0 && /* @__PURE__ */ jsx3("span", { className: "opacity-60", children: `|${token.defaultValue}` }),
977
+ token.defaultValue !== void 0 && /* @__PURE__ */ jsx4("span", { className: "opacity-60", children: `|${token.defaultValue}` }),
929
978
  "}"
930
979
  ]
931
980
  },
@@ -933,7 +982,7 @@ var TemplateRenderer = ({
933
982
  );
934
983
  }
935
984
  if (token.type === "conditional" && token.conditional) {
936
- return /* @__PURE__ */ jsx3(
985
+ return /* @__PURE__ */ jsx4(
937
986
  "span",
938
987
  {
939
988
  "data-conditional": token.conditional,
@@ -945,7 +994,7 @@ var TemplateRenderer = ({
945
994
  );
946
995
  }
947
996
  if (token.type === "instruction") {
948
- return /* @__PURE__ */ jsx3(
997
+ return /* @__PURE__ */ jsx4(
949
998
  "span",
950
999
  {
951
1000
  className: "inline-flex items-center px-1.5 py-0.5 mx-0.5 text-xs italic font-medium rounded-md border border-rose-400/40 bg-rose-400/15 text-rose-600 dark:text-rose-300",
@@ -955,7 +1004,7 @@ var TemplateRenderer = ({
955
1004
  index
956
1005
  );
957
1006
  }
958
- return /* @__PURE__ */ jsx3("span", { children: token.value }, index);
1007
+ return /* @__PURE__ */ jsx4("span", { children: token.value }, index);
959
1008
  }) });
960
1009
  };
961
1010
 
@@ -965,7 +1014,7 @@ import {
965
1014
  compactVariableValues,
966
1015
  getVariableFormFields
967
1016
  } from "@pixerate/editor";
968
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
1017
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
969
1018
  var VariableForm = ({
970
1019
  content,
971
1020
  templates,
@@ -990,7 +1039,7 @@ var VariableForm = ({
990
1039
  onChange?.(compactVariableValues(next), next);
991
1040
  };
992
1041
  if (fields.length === 0) return null;
993
- return /* @__PURE__ */ jsx4("form", { className, onSubmit: (event) => event.preventDefault(), children: fields.map((field) => {
1042
+ return /* @__PURE__ */ jsx5("form", { className, onSubmit: (event) => event.preventDefault(), children: fields.map((field) => {
994
1043
  const id = `${idPrefix}-${field.name}`;
995
1044
  if (field.conditionOnly) {
996
1045
  return /* @__PURE__ */ jsxs2(
@@ -1000,7 +1049,7 @@ var VariableForm = ({
1000
1049
  className: "flex items-center gap-2",
1001
1050
  "data-variable-field": field.name,
1002
1051
  children: [
1003
- /* @__PURE__ */ jsx4(
1052
+ /* @__PURE__ */ jsx5(
1004
1053
  "input",
1005
1054
  {
1006
1055
  id,
@@ -1010,7 +1059,7 @@ var VariableForm = ({
1010
1059
  onChange: (event) => update(field.name, event.target.checked ? "true" : "")
1011
1060
  }
1012
1061
  ),
1013
- /* @__PURE__ */ jsx4("span", { children: field.label })
1062
+ /* @__PURE__ */ jsx5("span", { children: field.label })
1014
1063
  ]
1015
1064
  },
1016
1065
  field.name
@@ -1025,9 +1074,9 @@ var VariableForm = ({
1025
1074
  children: [
1026
1075
  /* @__PURE__ */ jsxs2("span", { className: "font-medium", children: [
1027
1076
  field.label,
1028
- field.required && /* @__PURE__ */ jsx4("span", { className: "text-rose-500", "aria-hidden": "true", children: " *" })
1077
+ field.required && /* @__PURE__ */ jsx5("span", { className: "text-rose-500", "aria-hidden": "true", children: " *" })
1029
1078
  ] }),
1030
- /* @__PURE__ */ jsx4(
1079
+ /* @__PURE__ */ jsx5(
1031
1080
  "input",
1032
1081
  {
1033
1082
  id,
@@ -1149,7 +1198,7 @@ function useMergePreview(options) {
1149
1198
  }
1150
1199
 
1151
1200
  // src/components/MergePreview.tsx
1152
- import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
1201
+ import { Fragment, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
1153
1202
  function downloadText(text, fileName, type) {
1154
1203
  if (typeof document === "undefined" || typeof URL.createObjectURL !== "function") {
1155
1204
  return;
@@ -1198,8 +1247,8 @@ var MergePreview = ({
1198
1247
  };
1199
1248
  return /* @__PURE__ */ jsxs3("div", { className, "data-merge-preview": "", children: [
1200
1249
  /* @__PURE__ */ jsxs3("label", { htmlFor: `${id}-source`, className: "flex flex-col gap-1", children: [
1201
- /* @__PURE__ */ jsx5("span", { className: "font-medium", children: "Data source (CSV, TSV or JSON)" }),
1202
- /* @__PURE__ */ jsx5(
1250
+ /* @__PURE__ */ jsx6("span", { className: "font-medium", children: "Data source (CSV, TSV or JSON)" }),
1251
+ /* @__PURE__ */ jsx6(
1203
1252
  "textarea",
1204
1253
  {
1205
1254
  id: `${id}-source`,
@@ -1213,7 +1262,7 @@ var MergePreview = ({
1213
1262
  )
1214
1263
  ] }),
1215
1264
  /* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center gap-2", children: [
1216
- /* @__PURE__ */ jsx5(
1265
+ /* @__PURE__ */ jsx6(
1217
1266
  "input",
1218
1267
  {
1219
1268
  type: "file",
@@ -1226,18 +1275,18 @@ var MergePreview = ({
1226
1275
  }
1227
1276
  }
1228
1277
  ),
1229
- /* @__PURE__ */ jsx5("span", { "data-merge-summary": "", className: "opacity-70", children: `${source.records.length} record${source.records.length === 1 ? "" : "s"} \xB7 ${source.fields.length} field${source.fields.length === 1 ? "" : "s"}` })
1278
+ /* @__PURE__ */ jsx6("span", { "data-merge-summary": "", className: "opacity-70", children: `${source.records.length} record${source.records.length === 1 ? "" : "s"} \xB7 ${source.fields.length} field${source.fields.length === 1 ? "" : "s"}` })
1230
1279
  ] }),
1231
- source.warnings.length > 0 && merge.sourceText.trim() !== "" && /* @__PURE__ */ jsx5("ul", { "data-merge-warnings": "", className: "text-amber-600 text-xs", children: source.warnings.map((warning, i) => /* @__PURE__ */ jsx5("li", { children: warning.message }, i)) }),
1280
+ source.warnings.length > 0 && merge.sourceText.trim() !== "" && /* @__PURE__ */ jsx6("ul", { "data-merge-warnings": "", className: "text-amber-600 text-xs", children: source.warnings.map((warning, i) => /* @__PURE__ */ jsx6("li", { children: warning.message }, i)) }),
1232
1281
  merge.variables.length > 0 && /* @__PURE__ */ jsxs3("fieldset", { className: "flex flex-col gap-1", children: [
1233
- /* @__PURE__ */ jsx5("legend", { className: "font-medium", children: "Field mapping" }),
1282
+ /* @__PURE__ */ jsx6("legend", { className: "font-medium", children: "Field mapping" }),
1234
1283
  merge.variables.map((variable) => /* @__PURE__ */ jsxs3(
1235
1284
  "label",
1236
1285
  {
1237
1286
  className: "flex items-center gap-2",
1238
1287
  "data-merge-mapping": variable,
1239
1288
  children: [
1240
- /* @__PURE__ */ jsx5("span", { className: "min-w-24 font-mono", children: `{${variable}}` }),
1289
+ /* @__PURE__ */ jsx6("span", { className: "min-w-24 font-mono", children: `{${variable}}` }),
1241
1290
  /* @__PURE__ */ jsxs3(
1242
1291
  "select",
1243
1292
  {
@@ -1246,8 +1295,8 @@ var MergePreview = ({
1246
1295
  onChange: (event) => merge.setFieldMapping(variable, event.target.value || null),
1247
1296
  className: "px-1 py-0.5 rounded-md border border-violet-400/40 bg-transparent",
1248
1297
  children: [
1249
- /* @__PURE__ */ jsx5("option", { value: "", children: "(none)" }),
1250
- source.fields.map((field) => /* @__PURE__ */ jsx5("option", { value: field, children: field }, field))
1298
+ /* @__PURE__ */ jsx6("option", { value: "", children: "(none)" }),
1299
+ source.fields.map((field) => /* @__PURE__ */ jsx6("option", { value: field, children: field }, field))
1251
1300
  ]
1252
1301
  }
1253
1302
  )
@@ -1257,7 +1306,7 @@ var MergePreview = ({
1257
1306
  ))
1258
1307
  ] }),
1259
1308
  /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
1260
- /* @__PURE__ */ jsx5(
1309
+ /* @__PURE__ */ jsx6(
1261
1310
  "button",
1262
1311
  {
1263
1312
  type: "button",
@@ -1267,8 +1316,8 @@ var MergePreview = ({
1267
1316
  children: "Prev"
1268
1317
  }
1269
1318
  ),
1270
- /* @__PURE__ */ jsx5("span", { "data-merge-position": "", children: merge.count === 0 ? "No records" : `Record ${merge.index + 1} of ${merge.count}` }),
1271
- /* @__PURE__ */ jsx5(
1319
+ /* @__PURE__ */ jsx6("span", { "data-merge-position": "", children: merge.count === 0 ? "No records" : `Record ${merge.index + 1} of ${merge.count}` }),
1320
+ /* @__PURE__ */ jsx6(
1272
1321
  "button",
1273
1322
  {
1274
1323
  type: "button",
@@ -1279,7 +1328,7 @@ var MergePreview = ({
1279
1328
  }
1280
1329
  )
1281
1330
  ] }),
1282
- /* @__PURE__ */ jsx5("div", { "data-merge-output": "", children: /* @__PURE__ */ jsx5(
1331
+ /* @__PURE__ */ jsx6("div", { "data-merge-output": "", children: /* @__PURE__ */ jsx6(
1283
1332
  TemplateRenderer,
1284
1333
  {
1285
1334
  content,
@@ -1291,7 +1340,7 @@ var MergePreview = ({
1291
1340
  }
1292
1341
  ) }),
1293
1342
  /* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center gap-2", children: [
1294
- /* @__PURE__ */ jsx5(
1343
+ /* @__PURE__ */ jsx6(
1295
1344
  "button",
1296
1345
  {
1297
1346
  type: "button",
@@ -1306,9 +1355,9 @@ var MergePreview = ({
1306
1355
  }
1307
1356
  ),
1308
1357
  result && /* @__PURE__ */ jsxs3(Fragment, { children: [
1309
- /* @__PURE__ */ jsx5("span", { "data-merge-result": "", children: `${result.outputs.length} merged${result.skipped.length ? `, ${result.skipped.length} skipped` : ""}${result.truncated ? " (stopped early)" : ""}` }),
1310
- /* @__PURE__ */ jsx5("button", { type: "button", "data-merge-copy": "", onClick: copy, children: copied ? "Copied" : "Copy" }),
1311
- /* @__PURE__ */ jsx5(
1358
+ /* @__PURE__ */ jsx6("span", { "data-merge-result": "", children: `${result.outputs.length} merged${result.skipped.length ? `, ${result.skipped.length} skipped` : ""}${result.truncated ? " (stopped early)" : ""}` }),
1359
+ /* @__PURE__ */ jsx6("button", { type: "button", "data-merge-copy": "", onClick: copy, children: copied ? "Copied" : "Copy" }),
1360
+ /* @__PURE__ */ jsx6(
1312
1361
  "button",
1313
1362
  {
1314
1363
  type: "button",
@@ -1317,7 +1366,7 @@ var MergePreview = ({
1317
1366
  children: "Download .txt"
1318
1367
  }
1319
1368
  ),
1320
- /* @__PURE__ */ jsx5(
1369
+ /* @__PURE__ */ jsx6(
1321
1370
  "button",
1322
1371
  {
1323
1372
  type: "button",
@@ -1328,7 +1377,7 @@ var MergePreview = ({
1328
1377
  )
1329
1378
  ] })
1330
1379
  ] }),
1331
- result && /* @__PURE__ */ jsx5(
1380
+ result && /* @__PURE__ */ jsx6(
1332
1381
  "textarea",
1333
1382
  {
1334
1383
  readOnly: true,
@@ -1352,7 +1401,7 @@ function useOutline(editor) {
1352
1401
 
1353
1402
  // src/components/OutlinePanel.tsx
1354
1403
  import { navigateToHeading } from "@pixerate/editor";
1355
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
1404
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
1356
1405
  var OutlinePanel = ({
1357
1406
  editor,
1358
1407
  title = "Outline",
@@ -1367,10 +1416,10 @@ var OutlinePanel = ({
1367
1416
  const { headings, activeId } = useOutline(editor);
1368
1417
  const visible = headings.filter((h) => h.level <= maxLevel);
1369
1418
  return /* @__PURE__ */ jsxs4("nav", { className, "aria-label": "Document outline", "data-outline-panel": "", children: [
1370
- title != null && /* @__PURE__ */ jsx6("div", { className: "pixerate-outline-title", children: title }),
1371
- visible.length === 0 ? /* @__PURE__ */ jsx6("div", { className: "pixerate-outline-empty", children: emptyState }) : /* @__PURE__ */ jsx6("ul", { role: "list", style: { listStyle: "none", margin: 0, padding: 0 }, children: visible.map((heading) => {
1419
+ title != null && /* @__PURE__ */ jsx7("div", { className: "pixerate-outline-title", children: title }),
1420
+ visible.length === 0 ? /* @__PURE__ */ jsx7("div", { className: "pixerate-outline-empty", children: emptyState }) : /* @__PURE__ */ jsx7("ul", { role: "list", style: { listStyle: "none", margin: 0, padding: 0 }, children: visible.map((heading) => {
1372
1421
  const active = heading.id === activeId;
1373
- return /* @__PURE__ */ jsx6("li", { "data-level": heading.level, children: /* @__PURE__ */ jsx6(
1422
+ return /* @__PURE__ */ jsx7("li", { "data-level": heading.level, children: /* @__PURE__ */ jsx7(
1374
1423
  "button",
1375
1424
  {
1376
1425
  type: "button",
@@ -1424,7 +1473,7 @@ function useParagraphStyles(editor) {
1424
1473
 
1425
1474
  // src/components/StylesGallery.tsx
1426
1475
  import { useState as useState9 } from "react";
1427
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1476
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
1428
1477
  var camel = (property) => property.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
1429
1478
  var keepSelection = (event) => event.preventDefault();
1430
1479
  var StylesGallery = ({
@@ -1488,9 +1537,9 @@ var StylesGallery = ({
1488
1537
  {
1489
1538
  className: variant === "dropdown" ? "absolute left-0 top-full z-20 mt-1 flex min-w-[12rem] flex-col gap-0.5 rounded-md border border-border bg-background p-1 shadow-md" : "flex flex-wrap items-center gap-1",
1490
1539
  children: [
1491
- /* @__PURE__ */ jsx7("div", { role: "listbox", "aria-label": "Styles", className: variant === "dropdown" ? "flex flex-col gap-0.5" : "flex flex-wrap gap-1", children: list.map((style) => {
1540
+ /* @__PURE__ */ jsx8("div", { role: "listbox", "aria-label": "Styles", className: variant === "dropdown" ? "flex flex-col gap-0.5" : "flex flex-wrap gap-1", children: list.map((style) => {
1492
1541
  const active = style.id === styles.currentStyleId;
1493
- return /* @__PURE__ */ jsx7(
1542
+ return /* @__PURE__ */ jsx8(
1494
1543
  "button",
1495
1544
  {
1496
1545
  type: "button",
@@ -1507,7 +1556,7 @@ var StylesGallery = ({
1507
1556
  );
1508
1557
  }) }),
1509
1558
  showActions && /* @__PURE__ */ jsxs5("div", { className: variant === "dropdown" ? "mt-1 flex flex-col gap-0.5 border-t border-border pt-1" : "flex items-center gap-1", children: [
1510
- /* @__PURE__ */ jsx7(
1559
+ /* @__PURE__ */ jsx8(
1511
1560
  "button",
1512
1561
  {
1513
1562
  type: "button",
@@ -1524,7 +1573,7 @@ var StylesGallery = ({
1524
1573
  }
1525
1574
  ),
1526
1575
  creating ? /* @__PURE__ */ jsxs5("form", { className: "flex items-center gap-1", onSubmit: create, children: [
1527
- /* @__PURE__ */ jsx7(
1576
+ /* @__PURE__ */ jsx8(
1528
1577
  "input",
1529
1578
  {
1530
1579
  "aria-label": "New style name",
@@ -1534,8 +1583,8 @@ var StylesGallery = ({
1534
1583
  onChange: (event) => setName(event.target.value)
1535
1584
  }
1536
1585
  ),
1537
- /* @__PURE__ */ jsx7("button", { type: "submit", className: itemClassName, disabled: !name.trim(), children: "Create" })
1538
- ] }) : /* @__PURE__ */ jsx7(
1586
+ /* @__PURE__ */ jsx8("button", { type: "submit", className: itemClassName, disabled: !name.trim(), children: "Create" })
1587
+ ] }) : /* @__PURE__ */ jsx8(
1539
1588
  "button",
1540
1589
  {
1541
1590
  type: "button",
@@ -1566,9 +1615,9 @@ import {
1566
1615
 
1567
1616
  // src/slots.tsx
1568
1617
  import { createContext, useContext, useMemo as useMemo12 } from "react";
1569
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1618
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
1570
1619
  var defaultSlots = {
1571
- Button: (props) => /* @__PURE__ */ jsx8(
1620
+ Button: (props) => /* @__PURE__ */ jsx9(
1572
1621
  "button",
1573
1622
  {
1574
1623
  type: "button",
@@ -1578,19 +1627,19 @@ var defaultSlots = {
1578
1627
  children: props.children
1579
1628
  }
1580
1629
  ),
1581
- Tooltip: (props) => /* @__PURE__ */ jsx8("div", { className: `pixerate-tooltip-container ${props.className || ""}`, title: String(props.content), children: props.children }),
1630
+ Tooltip: (props) => /* @__PURE__ */ jsx9("div", { className: `pixerate-tooltip-container ${props.className || ""}`, title: String(props.content), children: props.children }),
1582
1631
  NodeHeader: (props) => /* @__PURE__ */ jsxs6("div", { className: `pixerate-node-header flex items-center justify-between ${props.className || ""}`, children: [
1583
1632
  /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
1584
1633
  props.icon,
1585
- /* @__PURE__ */ jsx8("span", { className: "font-semibold", children: props.title })
1634
+ /* @__PURE__ */ jsx9("span", { className: "font-semibold", children: props.title })
1586
1635
  ] }),
1587
- props.onClose && /* @__PURE__ */ jsx8("button", { type: "button", onClick: props.onClose, className: "opacity-70 hover:opacity-100", children: "\xD7" })
1636
+ props.onClose && /* @__PURE__ */ jsx9("button", { type: "button", onClick: props.onClose, className: "opacity-70 hover:opacity-100", children: "\xD7" })
1588
1637
  ] })
1589
1638
  };
1590
1639
  var EditorSlotsContext = createContext(defaultSlots);
1591
1640
  function EditorSlotsProvider({ slots, children }) {
1592
1641
  const mergedSlots = useMemo12(() => ({ ...defaultSlots, ...slots }), [slots]);
1593
- return /* @__PURE__ */ jsx8(EditorSlotsContext.Provider, { value: mergedSlots, children });
1642
+ return /* @__PURE__ */ jsx9(EditorSlotsContext.Provider, { value: mergedSlots, children });
1594
1643
  }
1595
1644
  function useEditorSlots() {
1596
1645
  return useContext(EditorSlotsContext);
@@ -1663,7 +1712,7 @@ import {
1663
1712
  formatReviewTime,
1664
1713
  getCommentAuthor
1665
1714
  } from "@pixerate/editor";
1666
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1715
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
1667
1716
  var buttonClass = "rounded px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50";
1668
1717
  var primaryButtonClass = "rounded px-2 py-1 text-xs bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-50";
1669
1718
  var textareaClass = "w-full resize-y rounded-md border border-input bg-background p-2 text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary";
@@ -1688,7 +1737,7 @@ var CommentsPanel = ({
1688
1737
  " open",
1689
1738
  resolvedCount > 0 ? ` \xB7 ${resolvedCount} resolved` : ""
1690
1739
  ] }),
1691
- resolvedCount > 0 && /* @__PURE__ */ jsx9(
1740
+ resolvedCount > 0 && /* @__PURE__ */ jsx10(
1692
1741
  "button",
1693
1742
  {
1694
1743
  type: "button",
@@ -1699,7 +1748,7 @@ var CommentsPanel = ({
1699
1748
  }
1700
1749
  )
1701
1750
  ] }),
1702
- visible.length === 0 ? /* @__PURE__ */ jsx9("p", { className: "text-xs text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ jsx9("ul", { className: "flex flex-col gap-2", role: "list", children: visible.map((thread) => /* @__PURE__ */ jsx9(
1751
+ visible.length === 0 ? /* @__PURE__ */ jsx10("p", { className: "text-xs text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ jsx10("ul", { className: "flex flex-col gap-2", role: "list", children: visible.map((thread) => /* @__PURE__ */ jsx10(
1703
1752
  CommentThreadCard,
1704
1753
  {
1705
1754
  thread,
@@ -1764,23 +1813,23 @@ var CommentThreadCard = ({
1764
1813
  },
1765
1814
  children: [
1766
1815
  /* @__PURE__ */ jsxs7("div", { className: "flex items-baseline justify-between gap-2", children: [
1767
- /* @__PURE__ */ jsx9("span", { className: "font-medium", children: thread.author.name }),
1768
- /* @__PURE__ */ jsx9("span", { className: "text-xs text-muted-foreground", children: formatTime(thread.createdAt) })
1816
+ /* @__PURE__ */ jsx10("span", { className: "font-medium", children: thread.author.name }),
1817
+ /* @__PURE__ */ jsx10("span", { className: "text-xs text-muted-foreground", children: formatTime(thread.createdAt) })
1769
1818
  ] }),
1770
- quote && /* @__PURE__ */ jsx9("blockquote", { className: "border-l-2 border-border pl-2 text-xs text-muted-foreground line-clamp-2", children: quote }),
1771
- thread.orphaned && /* @__PURE__ */ jsx9("span", { className: "text-xs text-destructive", children: "The commented text was deleted." }),
1772
- thread.resolved && /* @__PURE__ */ jsx9("span", { className: "text-xs text-muted-foreground", children: "Resolved" }),
1773
- !isDraft && /* @__PURE__ */ jsx9("p", { className: "whitespace-pre-wrap break-words", children: thread.body }),
1774
- thread.replies.length > 0 && /* @__PURE__ */ jsx9("ul", { className: "flex flex-col gap-2 border-l border-border pl-3", role: "list", children: thread.replies.map((reply) => /* @__PURE__ */ jsxs7("li", { className: "flex flex-col gap-0.5", "data-reply-id": reply.id, children: [
1819
+ quote && /* @__PURE__ */ jsx10("blockquote", { className: "border-l-2 border-border pl-2 text-xs text-muted-foreground line-clamp-2", children: quote }),
1820
+ thread.orphaned && /* @__PURE__ */ jsx10("span", { className: "text-xs text-destructive", children: "The commented text was deleted." }),
1821
+ thread.resolved && /* @__PURE__ */ jsx10("span", { className: "text-xs text-muted-foreground", children: "Resolved" }),
1822
+ !isDraft && /* @__PURE__ */ jsx10("p", { className: "whitespace-pre-wrap break-words", children: thread.body }),
1823
+ thread.replies.length > 0 && /* @__PURE__ */ jsx10("ul", { className: "flex flex-col gap-2 border-l border-border pl-3", role: "list", children: thread.replies.map((reply) => /* @__PURE__ */ jsxs7("li", { className: "flex flex-col gap-0.5", "data-reply-id": reply.id, children: [
1775
1824
  /* @__PURE__ */ jsxs7("span", { className: "text-xs", children: [
1776
- /* @__PURE__ */ jsx9("span", { className: "font-medium", children: reply.author.name }),
1825
+ /* @__PURE__ */ jsx10("span", { className: "font-medium", children: reply.author.name }),
1777
1826
  " ",
1778
- /* @__PURE__ */ jsx9("span", { className: "text-muted-foreground", children: formatTime(reply.createdAt) })
1827
+ /* @__PURE__ */ jsx10("span", { className: "text-muted-foreground", children: formatTime(reply.createdAt) })
1779
1828
  ] }),
1780
- /* @__PURE__ */ jsx9("p", { className: "whitespace-pre-wrap break-words", children: reply.body })
1829
+ /* @__PURE__ */ jsx10("p", { className: "whitespace-pre-wrap break-words", children: reply.body })
1781
1830
  ] }, reply.id)) }),
1782
1831
  (active || isDraft) && !thread.resolved && /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1", onClick: stop, children: [
1783
- /* @__PURE__ */ jsx9(
1832
+ /* @__PURE__ */ jsx10(
1784
1833
  "textarea",
1785
1834
  {
1786
1835
  className: textareaClass,
@@ -1799,8 +1848,8 @@ var CommentThreadCard = ({
1799
1848
  }
1800
1849
  ),
1801
1850
  /* @__PURE__ */ jsxs7("div", { className: "flex justify-end gap-1", children: [
1802
- isDraft && /* @__PURE__ */ jsx9("button", { type: "button", className: buttonClass, onClick: remove, children: "Cancel" }),
1803
- /* @__PURE__ */ jsx9(
1851
+ isDraft && /* @__PURE__ */ jsx10("button", { type: "button", className: buttonClass, onClick: remove, children: "Cancel" }),
1852
+ /* @__PURE__ */ jsx10(
1804
1853
  "button",
1805
1854
  {
1806
1855
  type: "button",
@@ -1813,8 +1862,8 @@ var CommentThreadCard = ({
1813
1862
  ] })
1814
1863
  ] }),
1815
1864
  !isDraft && /* @__PURE__ */ jsxs7("div", { className: "flex justify-end gap-1", onClick: stop, children: [
1816
- /* @__PURE__ */ jsx9("button", { type: "button", className: buttonClass, onClick: () => setResolved(!thread.resolved), children: thread.resolved ? "Reopen" : "Resolve" }),
1817
- /* @__PURE__ */ jsx9(
1865
+ /* @__PURE__ */ jsx10("button", { type: "button", className: buttonClass, onClick: () => setResolved(!thread.resolved), children: thread.resolved ? "Reopen" : "Resolve" }),
1866
+ /* @__PURE__ */ jsx10(
1818
1867
  "button",
1819
1868
  {
1820
1869
  type: "button",
@@ -1830,7 +1879,7 @@ var CommentThreadCard = ({
1830
1879
  };
1831
1880
 
1832
1881
  // src/review/ReviewToolbar.tsx
1833
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1882
+ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
1834
1883
  var defaultDescriptionClass = "max-w-[16rem] truncate px-1 text-xs text-muted-foreground";
1835
1884
  var buttonClass2 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
1836
1885
  var ReviewToolbar = ({
@@ -1844,7 +1893,7 @@ var ReviewToolbar = ({
1844
1893
  const current = review.currentChange;
1845
1894
  const index = current ? review.changes.findIndex((c) => c.id === current.id) + 1 : 0;
1846
1895
  return /* @__PURE__ */ jsxs8("div", { className, role: "toolbar", "aria-label": "Review", children: [
1847
- /* @__PURE__ */ jsx10(
1896
+ /* @__PURE__ */ jsx11(
1848
1897
  "button",
1849
1898
  {
1850
1899
  type: "button",
@@ -1855,8 +1904,8 @@ var ReviewToolbar = ({
1855
1904
  children: review.enabled ? "Tracking on" : "Track changes"
1856
1905
  }
1857
1906
  ),
1858
- /* @__PURE__ */ jsx10("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
1859
- /* @__PURE__ */ jsx10(
1907
+ /* @__PURE__ */ jsx11("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
1908
+ /* @__PURE__ */ jsx11(
1860
1909
  "button",
1861
1910
  {
1862
1911
  type: "button",
@@ -1867,8 +1916,8 @@ var ReviewToolbar = ({
1867
1916
  children: "\u2039"
1868
1917
  }
1869
1918
  ),
1870
- /* @__PURE__ */ jsx10("span", { className: "min-w-[4rem] text-center text-xs text-muted-foreground", "aria-live": "polite", children: count === 0 ? "No changes" : current ? `${index} of ${count}` : `${count} changes` }),
1871
- /* @__PURE__ */ jsx10(
1919
+ /* @__PURE__ */ jsx11("span", { className: "min-w-[4rem] text-center text-xs text-muted-foreground", "aria-live": "polite", children: count === 0 ? "No changes" : current ? `${index} of ${count}` : `${count} changes` }),
1920
+ /* @__PURE__ */ jsx11(
1872
1921
  "button",
1873
1922
  {
1874
1923
  type: "button",
@@ -1891,8 +1940,8 @@ var ReviewToolbar = ({
1891
1940
  ]
1892
1941
  }
1893
1942
  ),
1894
- /* @__PURE__ */ jsx10("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
1895
- /* @__PURE__ */ jsx10(
1943
+ /* @__PURE__ */ jsx11("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
1944
+ /* @__PURE__ */ jsx11(
1896
1945
  "button",
1897
1946
  {
1898
1947
  type: "button",
@@ -1902,7 +1951,7 @@ var ReviewToolbar = ({
1902
1951
  children: "Accept"
1903
1952
  }
1904
1953
  ),
1905
- /* @__PURE__ */ jsx10(
1954
+ /* @__PURE__ */ jsx11(
1906
1955
  "button",
1907
1956
  {
1908
1957
  type: "button",
@@ -1912,18 +1961,18 @@ var ReviewToolbar = ({
1912
1961
  children: "Reject"
1913
1962
  }
1914
1963
  ),
1915
- /* @__PURE__ */ jsx10("button", { type: "button", className: buttonClass2, disabled: count === 0, onClick: review.acceptAll, children: "Accept all" }),
1916
- /* @__PURE__ */ jsx10("button", { type: "button", className: buttonClass2, disabled: count === 0, onClick: review.rejectAll, children: "Reject all" })
1964
+ /* @__PURE__ */ jsx11("button", { type: "button", className: buttonClass2, disabled: count === 0, onClick: review.acceptAll, children: "Accept all" }),
1965
+ /* @__PURE__ */ jsx11("button", { type: "button", className: buttonClass2, disabled: count === 0, onClick: review.rejectAll, children: "Reject all" })
1917
1966
  ] });
1918
1967
  };
1919
1968
 
1920
1969
  // src/review/CommentButton.tsx
1921
- import { jsx as jsx11 } from "react/jsx-runtime";
1970
+ import { jsx as jsx12 } from "react/jsx-runtime";
1922
1971
  var CommentButton = ({
1923
1972
  editor,
1924
1973
  className = "rounded px-2 py-1 text-xs text-popover-foreground hover:bg-muted",
1925
1974
  children = "Comment"
1926
- }) => /* @__PURE__ */ jsx11(
1975
+ }) => /* @__PURE__ */ jsx12(
1927
1976
  "button",
1928
1977
  {
1929
1978
  type: "button",
@@ -1961,7 +2010,7 @@ function useDocumentCompare(editor, options) {
1961
2010
 
1962
2011
  // src/review/TrackedChangesList.tsx
1963
2012
  import { trackedChangeLabel } from "@pixerate/editor";
1964
- import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
2013
+ import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
1965
2014
  var buttonClass3 = "rounded px-1.5 py-0.5 text-xs text-foreground hover:bg-muted disabled:opacity-40";
1966
2015
  var TrackedChangesList = ({
1967
2016
  editor,
@@ -1972,9 +2021,9 @@ var TrackedChangesList = ({
1972
2021
  }) => {
1973
2022
  const review = useTrackChanges(editor);
1974
2023
  if (review.changes.length === 0) {
1975
- return /* @__PURE__ */ jsx12("div", { className, "data-tracked-changes-list": "", children: /* @__PURE__ */ jsx12("div", { className: "pixerate-changes-empty text-xs text-muted-foreground", children: emptyState }) });
2024
+ return /* @__PURE__ */ jsx13("div", { className, "data-tracked-changes-list": "", children: /* @__PURE__ */ jsx13("div", { className: "pixerate-changes-empty text-xs text-muted-foreground", children: emptyState }) });
1976
2025
  }
1977
- return /* @__PURE__ */ jsx12("ul", { className, role: "list", "aria-label": "Tracked changes", "data-tracked-changes-list": "", children: review.changes.map((change) => {
2026
+ return /* @__PURE__ */ jsx13("ul", { className, role: "list", "aria-label": "Tracked changes", "data-tracked-changes-list": "", children: review.changes.map((change) => {
1978
2027
  const active = change.id === review.currentChangeId;
1979
2028
  return /* @__PURE__ */ jsxs9(
1980
2029
  "li",
@@ -1991,14 +2040,14 @@ var TrackedChangesList = ({
1991
2040
  title: `${change.author.name}: ${change.description}`,
1992
2041
  onClick: () => review.select(change.id),
1993
2042
  children: [
1994
- /* @__PURE__ */ jsx12("span", { className: "font-medium", children: trackedChangeLabel(change) }),
2043
+ /* @__PURE__ */ jsx13("span", { className: "font-medium", children: trackedChangeLabel(change) }),
1995
2044
  change.author.name ? ` \xB7 ${change.author.name}` : "",
1996
- /* @__PURE__ */ jsx12("span", { className: "block truncate text-muted-foreground", children: change.description })
2045
+ /* @__PURE__ */ jsx13("span", { className: "block truncate text-muted-foreground", children: change.description })
1997
2046
  ]
1998
2047
  }
1999
2048
  ),
2000
- /* @__PURE__ */ jsx12("button", { type: "button", className: buttonClass3, onClick: () => review.accept(change.id), children: "Accept" }),
2001
- /* @__PURE__ */ jsx12("button", { type: "button", className: buttonClass3, onClick: () => review.reject(change.id), children: "Reject" })
2049
+ /* @__PURE__ */ jsx13("button", { type: "button", className: buttonClass3, onClick: () => review.accept(change.id), children: "Accept" }),
2050
+ /* @__PURE__ */ jsx13("button", { type: "button", className: buttonClass3, onClick: () => review.reject(change.id), children: "Reject" })
2002
2051
  ]
2003
2052
  },
2004
2053
  `${change.type}:${change.id}`
@@ -2048,7 +2097,7 @@ function useFindReplace(editor) {
2048
2097
  // src/find-replace/FindReplaceBar.tsx
2049
2098
  import { useEffect as useEffect12, useRef as useRef10, useState as useState12 } from "react";
2050
2099
  import { FIND_OPTION_TOGGLES, formatFindStatus } from "@pixerate/editor";
2051
- import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
2100
+ import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
2052
2101
  var inputClass = "min-w-0 flex-1 rounded border border-input bg-background px-2 py-1 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-ring";
2053
2102
  var buttonClass4 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
2054
2103
  var toggleClass = (on) => `${buttonClass4} font-mono ${on ? "bg-primary/10 text-primary" : "text-muted-foreground"}`;
@@ -2104,7 +2153,7 @@ var FindReplaceBar = ({
2104
2153
  };
2105
2154
  return /* @__PURE__ */ jsxs10("div", { className, role: "search", "aria-label": "Find and replace", onKeyDown: onBarKeyDown, children: [
2106
2155
  /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
2107
- /* @__PURE__ */ jsx13(
2156
+ /* @__PURE__ */ jsx14(
2108
2157
  "button",
2109
2158
  {
2110
2159
  type: "button",
@@ -2115,7 +2164,7 @@ var FindReplaceBar = ({
2115
2164
  children: showReplace ? "\u25BE" : "\u25B8"
2116
2165
  }
2117
2166
  ),
2118
- /* @__PURE__ */ jsx13(
2167
+ /* @__PURE__ */ jsx14(
2119
2168
  "input",
2120
2169
  {
2121
2170
  ref: findInput,
@@ -2129,7 +2178,7 @@ var FindReplaceBar = ({
2129
2178
  onKeyDown: onFindKeyDown
2130
2179
  }
2131
2180
  ),
2132
- FIND_OPTION_TOGGLES.filter((t) => !t.advanced).map((t) => /* @__PURE__ */ jsx13(
2181
+ FIND_OPTION_TOGGLES.filter((t) => !t.advanced).map((t) => /* @__PURE__ */ jsx14(
2133
2182
  "button",
2134
2183
  {
2135
2184
  type: "button",
@@ -2142,7 +2191,7 @@ var FindReplaceBar = ({
2142
2191
  },
2143
2192
  t.key
2144
2193
  )),
2145
- /* @__PURE__ */ jsx13(
2194
+ /* @__PURE__ */ jsx14(
2146
2195
  "span",
2147
2196
  {
2148
2197
  className: `min-w-[5rem] px-1 text-center text-xs ${find.error ? "text-destructive" : "text-muted-foreground"}`,
@@ -2152,9 +2201,9 @@ var FindReplaceBar = ({
2152
2201
  children: status
2153
2202
  }
2154
2203
  ),
2155
- /* @__PURE__ */ jsx13("button", { type: "button", className: buttonClass4, "aria-label": "Previous match", disabled: !hasMatches, onClick: find.previous, children: "\u2191" }),
2156
- /* @__PURE__ */ jsx13("button", { type: "button", className: buttonClass4, "aria-label": "Next match", disabled: !hasMatches, onClick: find.next, children: "\u2193" }),
2157
- showMoreOptions && /* @__PURE__ */ jsx13(
2204
+ /* @__PURE__ */ jsx14("button", { type: "button", className: buttonClass4, "aria-label": "Previous match", disabled: !hasMatches, onClick: find.previous, children: "\u2191" }),
2205
+ /* @__PURE__ */ jsx14("button", { type: "button", className: buttonClass4, "aria-label": "Next match", disabled: !hasMatches, onClick: find.next, children: "\u2193" }),
2206
+ showMoreOptions && /* @__PURE__ */ jsx14(
2158
2207
  "button",
2159
2208
  {
2160
2209
  type: "button",
@@ -2165,10 +2214,10 @@ var FindReplaceBar = ({
2165
2214
  children: "\u2026"
2166
2215
  }
2167
2216
  ),
2168
- /* @__PURE__ */ jsx13("button", { type: "button", className: buttonClass4, "aria-label": "Close find", onClick: close, children: "\xD7" })
2217
+ /* @__PURE__ */ jsx14("button", { type: "button", className: buttonClass4, "aria-label": "Close find", onClick: close, children: "\xD7" })
2169
2218
  ] }),
2170
2219
  showReplace && /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1 pl-7", children: [
2171
- /* @__PURE__ */ jsx13(
2220
+ /* @__PURE__ */ jsx14(
2172
2221
  "input",
2173
2222
  {
2174
2223
  type: "text",
@@ -2180,7 +2229,7 @@ var FindReplaceBar = ({
2180
2229
  onKeyDown: onReplaceKeyDown
2181
2230
  }
2182
2231
  ),
2183
- /* @__PURE__ */ jsx13(
2232
+ /* @__PURE__ */ jsx14(
2184
2233
  "button",
2185
2234
  {
2186
2235
  type: "button",
@@ -2190,11 +2239,11 @@ var FindReplaceBar = ({
2190
2239
  children: "Replace"
2191
2240
  }
2192
2241
  ),
2193
- /* @__PURE__ */ jsx13("button", { type: "button", className: buttonClass4, disabled: !hasMatches, onClick: find.replaceAll, children: "Replace all" }),
2194
- find.lastReplaceCount !== null && /* @__PURE__ */ jsx13("span", { className: "px-1 text-xs text-muted-foreground", "aria-live": "polite", children: find.lastReplaceCount === 1 ? "1 replaced" : `${find.lastReplaceCount} replaced` })
2242
+ /* @__PURE__ */ jsx14("button", { type: "button", className: buttonClass4, disabled: !hasMatches, onClick: find.replaceAll, children: "Replace all" }),
2243
+ find.lastReplaceCount !== null && /* @__PURE__ */ jsx14("span", { className: "px-1 text-xs text-muted-foreground", "aria-live": "polite", children: find.lastReplaceCount === 1 ? "1 replaced" : `${find.lastReplaceCount} replaced` })
2195
2244
  ] }),
2196
- showMoreOptions && moreOpen && /* @__PURE__ */ jsx13("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 pl-7 text-xs text-muted-foreground", children: FIND_OPTION_TOGGLES.filter((t) => t.advanced).map((t) => /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1", children: [
2197
- /* @__PURE__ */ jsx13(
2245
+ showMoreOptions && moreOpen && /* @__PURE__ */ jsx14("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 pl-7 text-xs text-muted-foreground", children: FIND_OPTION_TOGGLES.filter((t) => t.advanced).map((t) => /* @__PURE__ */ jsxs10("label", { className: "flex items-center gap-1", children: [
2246
+ /* @__PURE__ */ jsx14(
2198
2247
  "input",
2199
2248
  {
2200
2249
  type: "checkbox",
@@ -2228,9 +2277,9 @@ function useTableMenu(editor) {
2228
2277
  }
2229
2278
 
2230
2279
  // src/tables/TableToolbar.tsx
2231
- import React9 from "react";
2280
+ import React10 from "react";
2232
2281
  import { DEFAULT_TABLE_TOOLBAR } from "@pixerate/editor";
2233
- import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
2282
+ import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
2234
2283
  var keepSelection2 = (event) => event.preventDefault();
2235
2284
  var TableToolbar = ({
2236
2285
  editor,
@@ -2244,14 +2293,14 @@ var TableToolbar = ({
2244
2293
  }) => {
2245
2294
  const table = useTableMenu(editor);
2246
2295
  if (!editor || !table.inTable && !showWhenOutside) return null;
2247
- return /* @__PURE__ */ jsx14("div", { className, role: "toolbar", "aria-label": "Table", "data-table-toolbar": "", children: items.map((item, index) => {
2296
+ return /* @__PURE__ */ jsx15("div", { className, role: "toolbar", "aria-label": "Table", "data-table-toolbar": "", children: items.map((item, index) => {
2248
2297
  const status = table.check(item.action, item.params);
2249
2298
  const enabled = status === true;
2250
2299
  const active = item.active?.(table);
2251
2300
  const separator = index > 0 && items[index - 1].group !== item.group;
2252
- return /* @__PURE__ */ jsxs11(React9.Fragment, { children: [
2253
- separator && /* @__PURE__ */ jsx14("span", { className: separatorClassName, "aria-hidden": "true" }),
2254
- /* @__PURE__ */ jsx14(
2301
+ return /* @__PURE__ */ jsxs11(React10.Fragment, { children: [
2302
+ separator && /* @__PURE__ */ jsx15("span", { className: separatorClassName, "aria-hidden": "true" }),
2303
+ /* @__PURE__ */ jsx15(
2255
2304
  "button",
2256
2305
  {
2257
2306
  type: "button",
@@ -2274,7 +2323,7 @@ var TableToolbar = ({
2274
2323
 
2275
2324
  // src/tables/InsertTableGrid.tsx
2276
2325
  import { useState as useState13 } from "react";
2277
- import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
2326
+ import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
2278
2327
  var keepSelection3 = (event) => event.preventDefault();
2279
2328
  var InsertTableGrid = ({
2280
2329
  editor,
@@ -2304,7 +2353,7 @@ var InsertTableGrid = ({
2304
2353
  "data-insert-table-grid": "",
2305
2354
  onMouseLeave: () => setHover(null),
2306
2355
  children: [
2307
- /* @__PURE__ */ jsx15(
2356
+ /* @__PURE__ */ jsx16(
2308
2357
  "div",
2309
2358
  {
2310
2359
  role: "grid",
@@ -2313,7 +2362,7 @@ var InsertTableGrid = ({
2313
2362
  children: Array.from({ length: rows * cols }, (_, i) => {
2314
2363
  const size = { rows: Math.floor(i / cols) + 1, cols: i % cols + 1 };
2315
2364
  const active = !!hover && size.rows <= hover.rows && size.cols <= hover.cols;
2316
- return /* @__PURE__ */ jsx15(
2365
+ return /* @__PURE__ */ jsx16(
2317
2366
  "button",
2318
2367
  {
2319
2368
  type: "button",
@@ -2333,7 +2382,7 @@ var InsertTableGrid = ({
2333
2382
  })
2334
2383
  }
2335
2384
  ),
2336
- /* @__PURE__ */ jsx15("div", { "aria-live": "polite", "data-testid": "insert-table-size", children: disabled ? status.reason : hover ? `${hover.rows} \xD7 ${hover.cols}` : "Insert table" })
2385
+ /* @__PURE__ */ jsx16("div", { "aria-live": "polite", "data-testid": "insert-table-size", children: disabled ? status.reason : hover ? `${hover.rows} \xD7 ${hover.cols}` : "Insert table" })
2337
2386
  ]
2338
2387
  }
2339
2388
  );
@@ -2341,18 +2390,18 @@ var InsertTableGrid = ({
2341
2390
 
2342
2391
  // src/tables/TableBubbleMenu.tsx
2343
2392
  import { shouldShowTableBubbleMenu } from "@pixerate/editor";
2344
- import { jsx as jsx16 } from "react/jsx-runtime";
2393
+ import { jsx as jsx17 } from "react/jsx-runtime";
2345
2394
  var TableBubbleMenu = ({
2346
2395
  editor,
2347
2396
  children,
2348
2397
  toolbarProps,
2349
2398
  pluginKey = "tableBubbleMenu",
2350
2399
  ...rest
2351
- }) => /* @__PURE__ */ jsx16(BubbleMenu, { editor, pluginKey, shouldShow: shouldShowTableBubbleMenu, ...rest, children: children ?? /* @__PURE__ */ jsx16(TableToolbar, { editor, ...toolbarProps }) });
2400
+ }) => /* @__PURE__ */ jsx17(BubbleMenu, { editor, pluginKey, shouldShow: shouldShowTableBubbleMenu, ...rest, children: children ?? /* @__PURE__ */ jsx17(TableToolbar, { editor, ...toolbarProps }) });
2352
2401
 
2353
2402
  // src/chart-node/ChartNodeView.tsx
2354
- import { createRoot } from "react-dom/client";
2355
- import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
2403
+ import { createRoot as createRoot2 } from "react-dom/client";
2404
+ import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
2356
2405
  function ChartNodeView({ state, theme, showDataGrid = true }) {
2357
2406
  const { controller, editing, editable, selected, width, height, setEditing } = state;
2358
2407
  const open = () => {
@@ -2372,23 +2421,23 @@ function ChartNodeView({ state, theme, showDataGrid = true }) {
2372
2421
  },
2373
2422
  children: [
2374
2423
  editing && /* @__PURE__ */ jsxs13("div", { className: "mb-1 flex items-center justify-between gap-2 px-1", "data-chart-node-toolbar": "", children: [
2375
- /* @__PURE__ */ jsx17("span", { className: "text-xs text-muted-foreground", children: "Editing chart" }),
2376
- /* @__PURE__ */ jsx17("button", { type: "button", className: chartButtonClass, "data-action": "done", onClick: () => setEditing(false), children: "Done" })
2424
+ /* @__PURE__ */ jsx18("span", { className: "text-xs text-muted-foreground", children: "Editing chart" }),
2425
+ /* @__PURE__ */ jsx18("button", { type: "button", className: chartButtonClass, "data-action": "done", onClick: () => setEditing(false), children: "Done" })
2377
2426
  ] }),
2378
- /* @__PURE__ */ jsx17(
2427
+ /* @__PURE__ */ jsx18(
2379
2428
  "div",
2380
2429
  {
2381
2430
  className: editable && !editing ? "cursor-pointer" : void 0,
2382
2431
  onClick: open,
2383
2432
  title: editable && !editing ? "Click to edit the chart" : void 0,
2384
2433
  "data-chart-node-canvas": "",
2385
- children: /* @__PURE__ */ jsx17(ChartCanvas, { controller, width: width ?? 640, height, responsive: width === null, editable: editing, theme })
2434
+ children: /* @__PURE__ */ jsx18(ChartCanvas, { controller, width: width ?? 640, height, responsive: width === null, editable: editing, theme })
2386
2435
  }
2387
2436
  ),
2388
2437
  editing && // Wraps by the document's width, not the viewport's: side by side when there is room.
2389
2438
  /* @__PURE__ */ jsxs13("div", { className: "mt-2 flex flex-wrap items-start gap-2", "data-chart-node-panel": "", children: [
2390
- showDataGrid && /* @__PURE__ */ jsx17("div", { className: "min-w-0 flex-[1_1_20rem] overflow-x-auto", children: /* @__PURE__ */ jsx17(ChartDataGrid, { controller }) }),
2391
- /* @__PURE__ */ jsx17(ChartInspector, { controller, className: "max-h-96 min-w-0 flex-[1_1_16rem] overflow-y-auto rounded-md border border-border p-3" })
2439
+ showDataGrid && /* @__PURE__ */ jsx18("div", { className: "min-w-0 flex-[1_1_20rem] overflow-x-auto", children: /* @__PURE__ */ jsx18(ChartDataGrid, { controller }) }),
2440
+ /* @__PURE__ */ jsx18(ChartInspector, { controller, className: "max-h-96 min-w-0 flex-[1_1_16rem] overflow-y-auto rounded-md border border-border p-3" })
2392
2441
  ] })
2393
2442
  ]
2394
2443
  }
@@ -2397,7 +2446,7 @@ function ChartNodeView({ state, theme, showDataGrid = true }) {
2397
2446
  function createReactChartNodeView(options = {}) {
2398
2447
  const { component: Component = ChartNodeView, ...props } = options;
2399
2448
  return (dom, state) => {
2400
- const root = createRoot(dom);
2449
+ const root = createRoot2(dom);
2401
2450
  let latest = state;
2402
2451
  let scheduled = false;
2403
2452
  let destroyed = false;
@@ -2406,7 +2455,7 @@ function createReactChartNodeView(options = {}) {
2406
2455
  scheduled = true;
2407
2456
  queueMicrotask(() => {
2408
2457
  scheduled = false;
2409
- if (!destroyed) root.render(/* @__PURE__ */ jsx17(Component, { ...props, state: latest }));
2458
+ if (!destroyed) root.render(/* @__PURE__ */ jsx18(Component, { ...props, state: latest }));
2410
2459
  });
2411
2460
  };
2412
2461
  schedule();
@@ -2481,7 +2530,7 @@ function useStyleFindings(styles, domain, state) {
2481
2530
  }
2482
2531
 
2483
2532
  // src/style/StyleFindings.tsx
2484
- import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
2533
+ import { Fragment as Fragment2, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
2485
2534
  var SEVERITY_CLASS = {
2486
2535
  error: "text-destructive",
2487
2536
  warning: "text-amber-600",
@@ -2491,15 +2540,15 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
2491
2540
  if (!report) return null;
2492
2541
  const { findings, ran, skipped } = report;
2493
2542
  return /* @__PURE__ */ jsxs14("section", { "data-style-findings": "", "aria-label": title, className: `flex flex-col gap-1.5 text-xs text-foreground ${className}`, children: [
2494
- /* @__PURE__ */ jsx18("h3", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
2495
- findings.length > 0 && /* @__PURE__ */ jsx18("ul", { className: "flex flex-col gap-1", children: findings.map((finding, i) => {
2543
+ /* @__PURE__ */ jsx19("h3", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
2544
+ findings.length > 0 && /* @__PURE__ */ jsx19("ul", { className: "flex flex-col gap-1", children: findings.map((finding, i) => {
2496
2545
  const selectable = finding.target !== void 0 && !!onSelect;
2497
2546
  const body = /* @__PURE__ */ jsxs14(Fragment2, { children: [
2498
- /* @__PURE__ */ jsx18("span", { "data-style-severity": finding.severity, className: `shrink-0 font-semibold uppercase text-[10px] ${SEVERITY_CLASS[finding.severity]}`, children: finding.severity }),
2547
+ /* @__PURE__ */ jsx19("span", { "data-style-severity": finding.severity, className: `shrink-0 font-semibold uppercase text-[10px] ${SEVERITY_CLASS[finding.severity]}`, children: finding.severity }),
2499
2548
  /* @__PURE__ */ jsxs14("span", { className: "flex min-w-0 flex-col", children: [
2500
- /* @__PURE__ */ jsx18("span", { "data-style-message": "", children: finding.message }),
2549
+ /* @__PURE__ */ jsx19("span", { "data-style-message": "", children: finding.message }),
2501
2550
  /* @__PURE__ */ jsxs14("span", { className: "text-[10px] text-muted-foreground", children: [
2502
- /* @__PURE__ */ jsx18("code", { children: finding.check }),
2551
+ /* @__PURE__ */ jsx19("code", { children: finding.check }),
2503
2552
  finding.layer && /* @__PURE__ */ jsxs14(Fragment2, { children: [
2504
2553
  " \xB7 ",
2505
2554
  finding.layer
@@ -2507,7 +2556,7 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
2507
2556
  ] })
2508
2557
  ] })
2509
2558
  ] });
2510
- return /* @__PURE__ */ jsx18("li", { "data-style-finding": finding.check, children: selectable ? /* @__PURE__ */ jsx18(
2559
+ return /* @__PURE__ */ jsx19("li", { "data-style-finding": finding.check, children: selectable ? /* @__PURE__ */ jsx19(
2511
2560
  "button",
2512
2561
  {
2513
2562
  type: "button",
@@ -2515,7 +2564,7 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
2515
2564
  onClick: () => onSelect(finding),
2516
2565
  children: body
2517
2566
  }
2518
- ) : /* @__PURE__ */ jsx18("div", { className: "flex items-start gap-2 rounded border border-border px-2 py-1", children: body }) }, `${finding.check}-${i}`);
2567
+ ) : /* @__PURE__ */ jsx19("div", { className: "flex items-start gap-2 rounded border border-border px-2 py-1", children: body }) }, `${finding.check}-${i}`);
2519
2568
  }) }),
2520
2569
  findings.length === 0 && ran.length > 0 && /* @__PURE__ */ jsxs14("p", { "data-style-clear": "", className: "text-emerald-600", children: [
2521
2570
  "All clear: ",
@@ -2524,10 +2573,10 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
2524
2573
  ran.length === 1 ? "check" : "checks",
2525
2574
  " passed."
2526
2575
  ] }),
2527
- findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", children: "No house-style checks apply." }),
2528
- skipped.length > 0 && /* @__PURE__ */ jsx18("ul", { "data-style-skipped": "", "aria-label": "Skipped checks", className: "flex flex-col gap-0.5 text-muted-foreground", children: skipped.map((s) => /* @__PURE__ */ jsxs14("li", { "data-style-skipped-check": s.check, children: [
2576
+ findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ jsx19("p", { className: "text-muted-foreground", children: "No house-style checks apply." }),
2577
+ skipped.length > 0 && /* @__PURE__ */ jsx19("ul", { "data-style-skipped": "", "aria-label": "Skipped checks", className: "flex flex-col gap-0.5 text-muted-foreground", children: skipped.map((s) => /* @__PURE__ */ jsxs14("li", { "data-style-skipped-check": s.check, children: [
2529
2578
  "Skipped ",
2530
- /* @__PURE__ */ jsx18("code", { children: s.check }),
2579
+ /* @__PURE__ */ jsx19("code", { children: s.check }),
2531
2580
  ": ",
2532
2581
  s.reason
2533
2582
  ] }, s.check)) })
@@ -2609,6 +2658,7 @@ export {
2609
2658
  createDirtyTracker,
2610
2659
  createHistoryManager2 as createHistoryManager,
2611
2660
  createReactChartNodeView,
2661
+ createReactLoadingNodeView,
2612
2662
  defaultIsEqual,
2613
2663
  formatCommandsFor,
2614
2664
  useAgentPlayback,