@meowdown/react 0.82.1 → 0.82.3

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
@@ -230,7 +230,7 @@ function _temp$4(event) {
230
230
  * mode emits a block-level `math[display="block"]` element.
231
231
  */
232
232
  function MathRender(props) {
233
- const $ = c(9);
233
+ const $ = c(10);
234
234
  const { katex, formula, displayMode, className, onMouseDown } = props;
235
235
  const ref = useRef(null);
236
236
  let t0;
@@ -257,21 +257,24 @@ function MathRender(props) {
257
257
  }
258
258
  useLayoutEffect(t0, t1);
259
259
  const t2 = props["data-testid"];
260
- let t3;
261
- if ($[5] !== className || $[6] !== onMouseDown || $[7] !== t2) {
262
- t3 = /* @__PURE__ */ jsx("span", {
260
+ const t3 = props["data-scroll-x"];
261
+ let t4;
262
+ if ($[5] !== className || $[6] !== onMouseDown || $[7] !== t2 || $[8] !== t3) {
263
+ t4 = /* @__PURE__ */ jsx("span", {
263
264
  ref,
264
265
  className,
265
266
  contentEditable: false,
266
267
  "data-testid": t2,
268
+ "data-scroll-x": t3,
267
269
  onMouseDown
268
270
  });
269
271
  $[5] = className;
270
272
  $[6] = onMouseDown;
271
273
  $[7] = t2;
272
274
  $[8] = t3;
273
- } else t3 = $[8];
274
- return t3;
275
+ $[9] = t4;
276
+ } else t4 = $[9];
277
+ return t4;
275
278
  }
276
279
 
277
280
  // src/components/mermaid-render.tsx
@@ -298,7 +301,7 @@ function renderMermaid(renderer, source) {
298
301
  }
299
302
  }
300
303
  function MermaidRender(props) {
301
- const $ = c(16);
304
+ const $ = c(18);
302
305
  const { renderer, source, className, onMouseDown } = props;
303
306
  let t0;
304
307
  if ($[0] !== renderer || $[1] !== source) {
@@ -328,13 +331,15 @@ function MermaidRender(props) {
328
331
  useLayoutEffect(t1, t2);
329
332
  if (output.error) {
330
333
  const t3 = props["data-testid"];
331
- let t4;
332
- if ($[7] !== className || $[8] !== onMouseDown || $[9] !== output.error || $[10] !== t3) {
333
- t4 = /* @__PURE__ */ jsx("span", {
334
+ const t4 = props["data-scroll-x"];
335
+ let t5;
336
+ if ($[7] !== className || $[8] !== onMouseDown || $[9] !== output.error || $[10] !== t3 || $[11] !== t4) {
337
+ t5 = /* @__PURE__ */ jsx("span", {
334
338
  className,
335
339
  contentEditable: false,
336
340
  "data-error": true,
337
341
  "data-testid": t3,
342
+ "data-scroll-x": t4,
338
343
  onMouseDown,
339
344
  children: output.error
340
345
  }, "error");
@@ -343,25 +348,29 @@ function MermaidRender(props) {
343
348
  $[9] = output.error;
344
349
  $[10] = t3;
345
350
  $[11] = t4;
346
- } else t4 = $[11];
347
- return t4;
351
+ $[12] = t5;
352
+ } else t5 = $[12];
353
+ return t5;
348
354
  }
349
355
  const t3 = props["data-testid"];
350
- let t4;
351
- if ($[12] !== className || $[13] !== onMouseDown || $[14] !== t3) {
352
- t4 = /* @__PURE__ */ jsx("span", {
356
+ const t4 = props["data-scroll-x"];
357
+ let t5;
358
+ if ($[13] !== className || $[14] !== onMouseDown || $[15] !== t3 || $[16] !== t4) {
359
+ t5 = /* @__PURE__ */ jsx("span", {
353
360
  ref,
354
361
  className,
355
362
  contentEditable: false,
356
363
  "data-testid": t3,
364
+ "data-scroll-x": t4,
357
365
  onMouseDown
358
366
  }, "svg");
359
- $[12] = className;
360
- $[13] = onMouseDown;
361
- $[14] = t3;
362
- $[15] = t4;
363
- } else t4 = $[15];
364
- return t4;
367
+ $[13] = className;
368
+ $[14] = onMouseDown;
369
+ $[15] = t3;
370
+ $[16] = t4;
371
+ $[17] = t5;
372
+ } else t5 = $[17];
373
+ return t5;
365
374
  }
366
375
 
367
376
  // src/components/code-block-view.tsx
@@ -425,6 +434,7 @@ function CodeBlockView(props) {
425
434
  t6 = /* @__PURE__ */ jsx("pre", {
426
435
  ref: contentRef,
427
436
  "data-language": language,
437
+ "data-scroll-x": true,
428
438
  ...NON_PROSE_PROPS
429
439
  });
430
440
  $[11] = contentRef;
@@ -452,6 +462,7 @@ function CodeBlockView(props) {
452
462
  displayMode: true,
453
463
  className: code_block_view_module_default.Preview,
454
464
  "data-testid": "code-block-math-preview",
465
+ "data-scroll-x": true,
455
466
  onMouseDown: focusSource
456
467
  });
457
468
  $[19] = focusSource;
@@ -467,6 +478,7 @@ function CodeBlockView(props) {
467
478
  source: previewCode,
468
479
  className: `${code_block_view_module_default.Preview} ${code_block_view_module_default.MermaidPreview}`,
469
480
  "data-testid": "code-block-mermaid-preview",
481
+ "data-scroll-x": true,
470
482
  onMouseDown: focusSource
471
483
  });
472
484
  $[24] = focusSource;
@@ -692,10 +704,16 @@ const CodeBlockLanguagePickerMemo = /* @__PURE__ */ memo(CodeBlockLanguagePicker
692
704
  function defineCodeBlockView(component = CodeBlockView) {
693
705
  return union(defineReactNodeView({
694
706
  name: "codeBlock",
707
+ as: createCodeBlockRoot,
695
708
  contentAs: "code",
696
709
  component
697
710
  }), defineCodeBlockPreviewPlugin());
698
711
  }
712
+ function createCodeBlockRoot() {
713
+ const element = document.createElement("div");
714
+ element.dataset.codeBlock = "";
715
+ return element;
716
+ }
699
717
 
700
718
  // src/components/block-handle.module.css
701
719
  var block_handle_module_default = {
@@ -3299,9 +3317,102 @@ function TableMenuDeleteTable(t0) {
3299
3317
  } else t2 = $[5];
3300
3318
  return t2;
3301
3319
  }
3320
+ function TableColumnMenuItems(t0) {
3321
+ const $ = c(2);
3322
+ const { editor } = t0;
3323
+ let t1;
3324
+ if ($[0] !== editor) {
3325
+ t1 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
3326
+ /* @__PURE__ */ jsx(TableMenuInsertLeft, { editor }),
3327
+ /* @__PURE__ */ jsx(TableMenuInsertRight, { editor }),
3328
+ /* @__PURE__ */ jsx(TableMenuAlign, { editor }),
3329
+ /* @__PURE__ */ jsx(TableMenuClearContents, {
3330
+ editor,
3331
+ testId: "table-clear-column"
3332
+ }),
3333
+ /* @__PURE__ */ jsx(TableMenuDeleteColumn, { editor }),
3334
+ /* @__PURE__ */ jsx(TableMenuDeleteTable, {
3335
+ editor,
3336
+ testId: "table-delete-table-column"
3337
+ })
3338
+ ] });
3339
+ $[0] = editor;
3340
+ $[1] = t1;
3341
+ } else t1 = $[1];
3342
+ return t1;
3343
+ }
3344
+ function TableRowMenuItems(t0) {
3345
+ const $ = c(2);
3346
+ const { editor } = t0;
3347
+ let t1;
3348
+ if ($[0] !== editor) {
3349
+ t1 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
3350
+ /* @__PURE__ */ jsx(TableMenuInsertAbove, { editor }),
3351
+ /* @__PURE__ */ jsx(TableMenuInsertBelow, { editor }),
3352
+ /* @__PURE__ */ jsx(TableMenuClearContents, {
3353
+ editor,
3354
+ testId: "table-clear-row"
3355
+ }),
3356
+ /* @__PURE__ */ jsx(TableMenuDeleteRow, { editor }),
3357
+ /* @__PURE__ */ jsx(TableMenuDeleteTable, {
3358
+ editor,
3359
+ testId: "table-delete-table-row"
3360
+ })
3361
+ ] });
3362
+ $[0] = editor;
3363
+ $[1] = t1;
3364
+ } else t1 = $[1];
3365
+ return t1;
3366
+ }
3367
+ /**
3368
+ * Mounts a menu's items only while the menu is shown, so a closed menu holds no
3369
+ * editor subscriptions. Opening is canceled and replayed through `open`, so the
3370
+ * items mount in the same commit that opens the menu. Closing keeps the items
3371
+ * until the close animation finishes.
3372
+ */
3373
+ function useLazyMenu() {
3374
+ const $ = c(5);
3375
+ const [open, setOpen] = useState(false);
3376
+ const [mounted, setMounted] = useState(false);
3377
+ let t0;
3378
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
3379
+ t0 = (event) => {
3380
+ if (event.detail) {
3381
+ event.preventDefault();
3382
+ setMounted(true);
3383
+ }
3384
+ setOpen(event.detail);
3385
+ };
3386
+ $[0] = t0;
3387
+ } else t0 = $[0];
3388
+ const onOpenChange = t0;
3389
+ let t1;
3390
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
3391
+ t1 = (event_0) => {
3392
+ if (!event_0.detail) setMounted(false);
3393
+ };
3394
+ $[1] = t1;
3395
+ } else t1 = $[1];
3396
+ const onOpenChangeComplete = t1;
3397
+ let t2;
3398
+ if ($[2] !== mounted || $[3] !== open) {
3399
+ t2 = {
3400
+ open,
3401
+ mounted,
3402
+ onOpenChange,
3403
+ onOpenChangeComplete
3404
+ };
3405
+ $[2] = mounted;
3406
+ $[3] = open;
3407
+ $[4] = t2;
3408
+ } else t2 = $[4];
3409
+ return t2;
3410
+ }
3302
3411
  function TableHandle() {
3303
- const $ = c(11);
3412
+ const $ = c(27);
3304
3413
  const editor = useEditor$1();
3414
+ const columnMenu = useLazyMenu();
3415
+ const rowMenu = useLazyMenu();
3305
3416
  let t0;
3306
3417
  let t1;
3307
3418
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -3323,90 +3434,107 @@ function TableHandle() {
3323
3434
  $[2] = t2;
3324
3435
  } else t2 = $[2];
3325
3436
  let t3;
3326
- if ($[3] !== editor) {
3327
- t3 = /* @__PURE__ */ jsx(TableHandleColumnPositioner, {
3437
+ if ($[3] !== columnMenu.mounted || $[4] !== editor) {
3438
+ t3 = columnMenu.mounted && /* @__PURE__ */ jsx(TableColumnMenuItems, { editor });
3439
+ $[3] = columnMenu.mounted;
3440
+ $[4] = editor;
3441
+ $[5] = t3;
3442
+ } else t3 = $[5];
3443
+ let t4;
3444
+ if ($[6] !== t3) {
3445
+ t4 = /* @__PURE__ */ jsx(MenuPositioner, {
3446
+ className: table_handle_module_default.MenuPositioner,
3447
+ children: /* @__PURE__ */ jsx(MenuPopup, {
3448
+ className: table_handle_module_default.MenuPopup,
3449
+ "data-testid": "table-handle-column-menu",
3450
+ children: t3
3451
+ })
3452
+ });
3453
+ $[6] = t3;
3454
+ $[7] = t4;
3455
+ } else t4 = $[7];
3456
+ let t5;
3457
+ if ($[8] !== columnMenu.onOpenChange || $[9] !== columnMenu.onOpenChangeComplete || $[10] !== columnMenu.open || $[11] !== t4) {
3458
+ t5 = /* @__PURE__ */ jsx(TableHandleColumnPositioner, {
3328
3459
  className: table_handle_module_default.Positioner,
3329
3460
  children: /* @__PURE__ */ jsx(TableHandleColumnPopup, {
3330
3461
  className: table_handle_module_default.ColumnPopup,
3331
- children: /* @__PURE__ */ jsxs(TableHandleColumnMenuRoot, { children: [t2, /* @__PURE__ */ jsx(MenuPositioner, {
3332
- className: table_handle_module_default.MenuPositioner,
3333
- children: /* @__PURE__ */ jsxs(MenuPopup, {
3334
- className: table_handle_module_default.MenuPopup,
3335
- "data-testid": "table-handle-column-menu",
3336
- children: [
3337
- /* @__PURE__ */ jsx(TableMenuInsertLeft, { editor }),
3338
- /* @__PURE__ */ jsx(TableMenuInsertRight, { editor }),
3339
- /* @__PURE__ */ jsx(TableMenuAlign, { editor }),
3340
- /* @__PURE__ */ jsx(TableMenuClearContents, {
3341
- editor,
3342
- testId: "table-clear-column"
3343
- }),
3344
- /* @__PURE__ */ jsx(TableMenuDeleteColumn, { editor }),
3345
- /* @__PURE__ */ jsx(TableMenuDeleteTable, {
3346
- editor,
3347
- testId: "table-delete-table-column"
3348
- })
3349
- ]
3350
- })
3351
- })] })
3462
+ children: /* @__PURE__ */ jsxs(TableHandleColumnMenuRoot, {
3463
+ open: columnMenu.open,
3464
+ onOpenChange: columnMenu.onOpenChange,
3465
+ onOpenChangeComplete: columnMenu.onOpenChangeComplete,
3466
+ children: [t2, t4]
3467
+ })
3352
3468
  })
3353
3469
  });
3354
- $[3] = editor;
3355
- $[4] = t3;
3356
- } else t3 = $[4];
3357
- let t4;
3358
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
3359
- t4 = /* @__PURE__ */ jsx(TableHandleRowMenuTrigger, {
3470
+ $[8] = columnMenu.onOpenChange;
3471
+ $[9] = columnMenu.onOpenChangeComplete;
3472
+ $[10] = columnMenu.open;
3473
+ $[11] = t4;
3474
+ $[12] = t5;
3475
+ } else t5 = $[12];
3476
+ let t6;
3477
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
3478
+ t6 = /* @__PURE__ */ jsx(TableHandleRowMenuTrigger, {
3360
3479
  className: table_handle_module_default.Trigger,
3361
3480
  "data-testid": "table-handle-row",
3362
3481
  children: /* @__PURE__ */ jsx(GripVerticalIcon, {})
3363
3482
  });
3364
- $[5] = t4;
3365
- } else t4 = $[5];
3366
- let t5;
3367
- if ($[6] !== editor) {
3368
- t5 = /* @__PURE__ */ jsx(TableHandleRowPositioner, {
3483
+ $[13] = t6;
3484
+ } else t6 = $[13];
3485
+ let t7;
3486
+ if ($[14] !== editor || $[15] !== rowMenu.mounted) {
3487
+ t7 = rowMenu.mounted && /* @__PURE__ */ jsx(TableRowMenuItems, { editor });
3488
+ $[14] = editor;
3489
+ $[15] = rowMenu.mounted;
3490
+ $[16] = t7;
3491
+ } else t7 = $[16];
3492
+ let t8;
3493
+ if ($[17] !== t7) {
3494
+ t8 = /* @__PURE__ */ jsx(MenuPositioner, {
3495
+ className: table_handle_module_default.MenuPositioner,
3496
+ children: /* @__PURE__ */ jsx(MenuPopup, {
3497
+ className: table_handle_module_default.MenuPopup,
3498
+ "data-testid": "table-handle-row-menu",
3499
+ children: t7
3500
+ })
3501
+ });
3502
+ $[17] = t7;
3503
+ $[18] = t8;
3504
+ } else t8 = $[18];
3505
+ let t9;
3506
+ if ($[19] !== rowMenu.onOpenChange || $[20] !== rowMenu.onOpenChangeComplete || $[21] !== rowMenu.open || $[22] !== t8) {
3507
+ t9 = /* @__PURE__ */ jsx(TableHandleRowPositioner, {
3369
3508
  className: table_handle_module_default.Positioner,
3370
3509
  children: /* @__PURE__ */ jsx(TableHandleRowPopup, {
3371
3510
  className: table_handle_module_default.RowPopup,
3372
- children: /* @__PURE__ */ jsxs(TableHandleRowMenuRoot, { children: [t4, /* @__PURE__ */ jsx(MenuPositioner, {
3373
- className: table_handle_module_default.MenuPositioner,
3374
- children: /* @__PURE__ */ jsxs(MenuPopup, {
3375
- className: table_handle_module_default.MenuPopup,
3376
- "data-testid": "table-handle-row-menu",
3377
- children: [
3378
- /* @__PURE__ */ jsx(TableMenuInsertAbove, { editor }),
3379
- /* @__PURE__ */ jsx(TableMenuInsertBelow, { editor }),
3380
- /* @__PURE__ */ jsx(TableMenuClearContents, {
3381
- editor,
3382
- testId: "table-clear-row"
3383
- }),
3384
- /* @__PURE__ */ jsx(TableMenuDeleteRow, { editor }),
3385
- /* @__PURE__ */ jsx(TableMenuDeleteTable, {
3386
- editor,
3387
- testId: "table-delete-table-row"
3388
- })
3389
- ]
3390
- })
3391
- })] })
3511
+ children: /* @__PURE__ */ jsxs(TableHandleRowMenuRoot, {
3512
+ open: rowMenu.open,
3513
+ onOpenChange: rowMenu.onOpenChange,
3514
+ onOpenChangeComplete: rowMenu.onOpenChangeComplete,
3515
+ children: [t6, t8]
3516
+ })
3392
3517
  })
3393
3518
  });
3394
- $[6] = editor;
3395
- $[7] = t5;
3396
- } else t5 = $[7];
3397
- let t6;
3398
- if ($[8] !== t3 || $[9] !== t5) {
3399
- t6 = /* @__PURE__ */ jsxs(TableHandleRoot, { children: [
3519
+ $[19] = rowMenu.onOpenChange;
3520
+ $[20] = rowMenu.onOpenChangeComplete;
3521
+ $[21] = rowMenu.open;
3522
+ $[22] = t8;
3523
+ $[23] = t9;
3524
+ } else t9 = $[23];
3525
+ let t10;
3526
+ if ($[24] !== t5 || $[25] !== t9) {
3527
+ t10 = /* @__PURE__ */ jsxs(TableHandleRoot, { children: [
3400
3528
  t0,
3401
3529
  t1,
3402
- t3,
3403
- t5
3530
+ t5,
3531
+ t9
3404
3532
  ] });
3405
- $[8] = t3;
3406
- $[9] = t5;
3407
- $[10] = t6;
3408
- } else t6 = $[10];
3409
- return t6;
3533
+ $[24] = t5;
3534
+ $[25] = t9;
3535
+ $[26] = t10;
3536
+ } else t10 = $[26];
3537
+ return t10;
3410
3538
  }
3411
3539
 
3412
3540
  // src/utils/returns-true.ts
@@ -5093,7 +5221,9 @@ function CodeBlock(t0) {
5093
5221
  let t5;
5094
5222
  if ($[8] !== t2 || $[9] !== t4) {
5095
5223
  t5 = /* @__PURE__ */ jsx("pre", {
5224
+ "data-code-block": "",
5096
5225
  "data-language": t2,
5226
+ "data-scroll-x": true,
5097
5227
  children: t4
5098
5228
  });
5099
5229
  $[8] = t2;
@@ -5180,7 +5310,8 @@ function MathCodeBlock(t0) {
5180
5310
  formula: code,
5181
5311
  displayMode: true,
5182
5312
  className: code_block_view_module_default.Preview,
5183
- "data-testid": "code-block-math-preview"
5313
+ "data-testid": "code-block-math-preview",
5314
+ "data-scroll-x": true
5184
5315
  });
5185
5316
  $[2] = code;
5186
5317
  $[3] = katex;
@@ -5210,7 +5341,8 @@ function MermaidCodeBlock(t0) {
5210
5341
  renderer,
5211
5342
  source: code,
5212
5343
  className: `${code_block_view_module_default.Preview} ${code_block_view_module_default.MermaidPreview}`,
5213
- "data-testid": "code-block-mermaid-preview"
5344
+ "data-testid": "code-block-mermaid-preview",
5345
+ "data-scroll-x": true
5214
5346
  });
5215
5347
  $[2] = code;
5216
5348
  $[3] = renderer;
package/dist/style.css CHANGED
@@ -854,9 +854,12 @@
854
854
  }
855
855
  .meow_Positioner_Dqll0G {
856
856
  z-index: 50;
857
+ border: 0;
857
858
  flex-direction: column;
858
859
  width: min(24rem, 100vw - 1rem);
859
860
  height: min-content;
861
+ margin: 0;
862
+ padding: 0;
860
863
  display: flex;
861
864
  overflow: visible;
862
865
  }
@@ -927,6 +930,12 @@
927
930
  font-size: .8125rem;
928
931
  overflow: hidden;
929
932
  }
933
+ .meow_MenuPositioner_hpZLgq {
934
+ border: 0;
935
+ margin: 0;
936
+ padding: 0;
937
+ }
938
+
930
939
  .meow_Positioner_hpZLgq, .meow_MenuPositioner_hpZLgq {
931
940
  z-index: 50;
932
941
  width: min-content;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meowdown/react",
3
3
  "type": "module",
4
- "version": "0.82.1",
4
+ "version": "0.82.3",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -22,15 +22,15 @@
22
22
  ],
23
23
  "dependencies": {
24
24
  "@base-ui/react": "^1.9.0",
25
- "@meowdown/core": "0.82.0",
25
+ "@meowdown/core": "0.83.0",
26
26
  "@meowdown/embed": "0.3.1",
27
- "@meowdown/markdown": "0.77.0",
27
+ "@meowdown/markdown": "0.78.0",
28
28
  "@ocavue/utils": "^1.9.0",
29
29
  "@post-embed/types": "^0.5.0",
30
- "@prosekit/core": "^0.13.3",
31
- "@prosekit/pm": "^0.1.20",
32
- "@prosekit/react": "^0.8.4",
33
- "@prosekit/web": "^0.9.4",
30
+ "@prosekit/core": "^0.13.4",
31
+ "@prosekit/pm": "^0.1.21",
32
+ "@prosekit/react": "^0.9.0",
33
+ "@prosekit/web": "^0.10.0",
34
34
  "beautiful-mermaid": "^1.1.3",
35
35
  "clsx": "^2.1.1",
36
36
  "github-slugger": "^2.0.0",
@@ -53,16 +53,16 @@
53
53
  "@css-modules-kit/codegen": "^1.4.0",
54
54
  "@meowdown/vitest": "0.0.0",
55
55
  "@ocavue/tsconfig": "^0.7.1",
56
- "@tsdown/css": "^0.23.2",
56
+ "@tsdown/css": "^0.23.3",
57
57
  "@types/react": "^19.3.0",
58
58
  "@types/react-dom": "^19.3.0",
59
59
  "@vitejs/plugin-react": "^6.1.2",
60
60
  "@vitest/browser-playwright": "^5.0.5",
61
61
  "dedent": "^1.7.2",
62
- "oxc-transform-react": "^0.152.0",
63
- "react": "^19.3.0",
64
- "react-dom": "^19.3.0",
65
- "tsdown": "^0.23.2",
62
+ "oxc-transform-react": "^0.156.0",
63
+ "react": "^19.3.1",
64
+ "react-dom": "^19.3.1",
65
+ "tsdown": "^0.23.3",
66
66
  "vitest": "^5.0.5",
67
67
  "vitest-browser-commands": "^0.5.0",
68
68
  "vitest-browser-react": "^2.3.0"