wysimark-lite 0.25.13 → 0.25.16

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.mjs CHANGED
@@ -5,14 +5,14 @@ import {
5
5
  createRef,
6
6
  useCallback as useCallback19,
7
7
  useImperativeHandle,
8
- useRef as useRef16,
8
+ useRef as useRef17,
9
9
  useState as useState14
10
10
  } from "react";
11
11
  import { createRoot } from "react-dom/client";
12
12
 
13
13
  // src/entry/index.tsx
14
14
  import throttle2 from "lodash.throttle";
15
- import { useCallback as useCallback18, useRef as useRef15, useState as useState13 } from "react";
15
+ import { useCallback as useCallback18, useRef as useRef16, useState as useState13 } from "react";
16
16
  import { Editor as Editor67, Transforms as Transforms49 } from "slate";
17
17
  import { ReactEditor as ReactEditor18, Slate as Slate2 } from "slate-react";
18
18
 
@@ -2486,7 +2486,7 @@ function normalizeNode(editor, entry) {
2486
2486
 
2487
2487
  // src/anchor-plugin/render-element/anchor.tsx
2488
2488
  import { clsx } from "clsx";
2489
- import { useEffect as useEffect3, useRef as useRef5 } from "react";
2489
+ import { useEffect as useEffect3, useRef as useRef6 } from "react";
2490
2490
  import { useSelected, useSlate } from "slate-react";
2491
2491
 
2492
2492
  // src/use-layer/layers.tsx
@@ -2608,7 +2608,7 @@ var $ProgressBarFill = styled2("span")`
2608
2608
 
2609
2609
  // src/anchor-plugin/render-element/AnchorDialog.tsx
2610
2610
  import styled15 from "@emotion/styled";
2611
- import { useCallback as useCallback5, useState as useState4 } from "react";
2611
+ import { useCallback as useCallback5, useRef as useRef5, useState as useState4 } from "react";
2612
2612
  import { useSlateStatic as useSlateStatic4 } from "slate-react";
2613
2613
 
2614
2614
  // src/shared-overlays/components/CloseMask/index.tsx
@@ -2851,6 +2851,9 @@ var $Panel = styled4(SinkReset)`
2851
2851
  filter: drop-shadow(0 4px 3px rgb(0 0 0 / 0.07))
2852
2852
  drop-shadow(0 2px 2px rgb(0 0 0 / 0.06));
2853
2853
  background: white;
2854
+ color: #333;
2855
+ max-width: calc(100vw - 32px);
2856
+ box-sizing: border-box;
2854
2857
  /**
2855
2858
  * If you are tempted to add the transitions back in, here's why we left
2856
2859
  * them off:
@@ -3479,17 +3482,23 @@ function AnchorEditDialog({
3479
3482
  element
3480
3483
  }) {
3481
3484
  const dialog = useLayer("dialog");
3485
+ const ref = useRef4(null);
3482
3486
  const [dragOffset, setDragOffset] = useState3({ x: 0, y: 0 });
3483
3487
  const handleDrag = useCallback4((deltaX, deltaY) => {
3484
3488
  setDragOffset((prev) => ({ x: prev.x + deltaX, y: prev.y + deltaY }));
3485
3489
  }, []);
3486
3490
  const baseStyle = useAbsoluteReposition(
3487
- { destAnchor, destStartEdge },
3488
- ({ destAnchor: destAnchor2, destStartEdge: destStartEdge2 }) => {
3489
- return {
3490
- left: destStartEdge2.left,
3491
- top: destAnchor2.top + destAnchor2.height
3492
- };
3491
+ { src: ref, destAnchor, destStartEdge },
3492
+ ({ src, destAnchor: destAnchor2, destStartEdge: destStartEdge2 }, viewport) => {
3493
+ return positionInside(
3494
+ src,
3495
+ viewport,
3496
+ {
3497
+ left: destStartEdge2.left,
3498
+ top: destAnchor2.top + destAnchor2.height
3499
+ },
3500
+ { margin: 16 }
3501
+ );
3493
3502
  }
3494
3503
  );
3495
3504
  const style = {
@@ -3527,7 +3536,7 @@ function AnchorEditDialog({
3527
3536
  editor.anchor.editLink({ href: href2, text: text2, title: title2 }, { at: element });
3528
3537
  openAnchorDialog();
3529
3538
  }, [openAnchorDialog]);
3530
- return /* @__PURE__ */ jsxs5($AnchorEditDialog, { contentEditable: false, style, children: [
3539
+ return /* @__PURE__ */ jsxs5($AnchorEditDialog, { ref, contentEditable: false, style, children: [
3531
3540
  /* @__PURE__ */ jsx12(DraggableHeader, { onDrag: handleDrag }),
3532
3541
  /* @__PURE__ */ jsxs5("div", { style: { padding: "1em" }, children: [
3533
3542
  /* @__PURE__ */ jsxs5($FormGroup, { children: [
@@ -3576,7 +3585,8 @@ var $AnchorDialog2 = styled15($Panel)`
3576
3585
  .--link {
3577
3586
  text-decoration: none;
3578
3587
  display: flex;
3579
- flex: 0 0 14em;
3588
+ flex: 1 1 auto;
3589
+ min-width: 0;
3580
3590
  overflow: hidden;
3581
3591
  color: var(--shade-400);
3582
3592
  &:hover {
@@ -3589,7 +3599,7 @@ var $AnchorDialog2 = styled15($Panel)`
3589
3599
  margin-left: 0.5em;
3590
3600
  .--hostname {
3591
3601
  font-size: 0.875em;
3592
- width: 14em;
3602
+ max-width: 14em;
3593
3603
  line-height: 1.5em;
3594
3604
  color: var(--blue-600);
3595
3605
  overflow-wrap: break-word;
@@ -3601,7 +3611,7 @@ var $AnchorDialog2 = styled15($Panel)`
3601
3611
  .--pathname {
3602
3612
  margin-top: 0.125em;
3603
3613
  font-size: 0.75em;
3604
- width: 16.25em;
3614
+ max-width: 16.25em;
3605
3615
  line-height: 1.5em;
3606
3616
  overflow-wrap: break-word;
3607
3617
  }
@@ -3610,7 +3620,7 @@ var $AnchorDialog2 = styled15($Panel)`
3610
3620
  position: relative;
3611
3621
  margin-top: 1em;
3612
3622
  font-size: 0.875em;
3613
- width: 14em;
3623
+ max-width: 14em;
3614
3624
  line-height: 1.5em;
3615
3625
  background: var(--shade-200);
3616
3626
  border-radius: 0.5em;
@@ -3659,18 +3669,24 @@ function AnchorDialog({
3659
3669
  }) {
3660
3670
  const dialog = useLayer("dialog");
3661
3671
  const editor = useSlateStatic4();
3672
+ const ref = useRef5(null);
3662
3673
  const url = parseUrl2(element.href);
3663
3674
  const [dragOffset, setDragOffset] = useState4({ x: 0, y: 0 });
3664
3675
  const handleDrag = useCallback5((deltaX, deltaY) => {
3665
3676
  setDragOffset((prev) => ({ x: prev.x + deltaX, y: prev.y + deltaY }));
3666
3677
  }, []);
3667
3678
  const baseStyle = useAbsoluteReposition(
3668
- { destAnchor, destStartEdge },
3669
- ({ destAnchor: destAnchor2, destStartEdge: destStartEdge2 }) => {
3670
- return {
3671
- left: destStartEdge2.left,
3672
- top: destAnchor2.top + destAnchor2.height
3673
- };
3679
+ { src: ref, destAnchor, destStartEdge },
3680
+ ({ src, destAnchor: destAnchor2, destStartEdge: destStartEdge2 }, viewport) => {
3681
+ return positionInside(
3682
+ src,
3683
+ viewport,
3684
+ {
3685
+ left: destStartEdge2.left,
3686
+ top: destAnchor2.top + destAnchor2.height
3687
+ },
3688
+ { margin: 16 }
3689
+ );
3674
3690
  }
3675
3691
  );
3676
3692
  const style = {
@@ -3701,7 +3717,7 @@ function AnchorDialog({
3701
3717
  );
3702
3718
  });
3703
3719
  }, [destAnchor, destStartEdge, element]);
3704
- return /* @__PURE__ */ jsxs6($AnchorDialog2, { contentEditable: false, style, children: [
3720
+ return /* @__PURE__ */ jsxs6($AnchorDialog2, { ref, contentEditable: false, style, children: [
3705
3721
  /* @__PURE__ */ jsx14(DraggableHeader, { onDrag: handleDrag }),
3706
3722
  /* @__PURE__ */ jsxs6("div", { style: { display: "flex", padding: "1em" }, children: [
3707
3723
  /* @__PURE__ */ jsxs6(
@@ -3764,8 +3780,8 @@ function Anchor({
3764
3780
  attributes,
3765
3781
  children
3766
3782
  }) {
3767
- const startEdgeRef = useRef5(null);
3768
- const anchorRef = useRef5(null);
3783
+ const startEdgeRef = useRef6(null);
3784
+ const anchorRef = useRef6(null);
3769
3785
  const selected = useSelected();
3770
3786
  const editor = useSlate();
3771
3787
  const dialog = useLayer("dialog");
@@ -4019,7 +4035,7 @@ var $Image = styled17("img")`
4019
4035
 
4020
4036
  // src/image-plugin/render-element/image-with-controls/image-resize-controls/image-resize-control.tsx
4021
4037
  import { clsx as clsx2 } from "clsx";
4022
- import { useCallback as useCallback6, useEffect as useEffect5, useRef as useRef6 } from "react";
4038
+ import { useCallback as useCallback6, useEffect as useEffect5, useRef as useRef7 } from "react";
4023
4039
  import { Transforms as Transforms13 } from "slate";
4024
4040
  import { ReactEditor as ReactEditor5, useSlateStatic as useSlateStatic5 } from "slate-react";
4025
4041
 
@@ -4234,10 +4250,10 @@ function ImageResizeControl({
4234
4250
  setIsDragging
4235
4251
  }) {
4236
4252
  const editor = useSlateStatic5();
4237
- const mouseMoveRef = useRef6(null);
4238
- const mouseUpRef = useRef6(null);
4239
- const touchMoveRef = useRef6(null);
4240
- const touchEndRef = useRef6(null);
4253
+ const mouseMoveRef = useRef7(null);
4254
+ const mouseUpRef = useRef7(null);
4255
+ const touchMoveRef = useRef7(null);
4256
+ const touchEndRef = useRef7(null);
4241
4257
  useResizeBrowser();
4242
4258
  const editorWidth = getEditorWidth(editor);
4243
4259
  const width = size.width;
@@ -5305,7 +5321,7 @@ function normalizeNode3(editor, entry) {
5305
5321
  }
5306
5322
 
5307
5323
  // src/code-block-plugin/render-element/CodeBlock.tsx
5308
- import { useCallback as useCallback10, useRef as useRef7 } from "react";
5324
+ import { useCallback as useCallback10, useRef as useRef8 } from "react";
5309
5325
  import { useSelected as useSelected3 } from "slate-react";
5310
5326
 
5311
5327
  // src/code-block-plugin/icons/ChevronDownIcon.tsx
@@ -5398,7 +5414,7 @@ function CodeBlock({
5398
5414
  attributes,
5399
5415
  children
5400
5416
  }) {
5401
- const ref = useRef7(null);
5417
+ const ref = useRef8(null);
5402
5418
  const selected = useSelected3();
5403
5419
  const dropdown = useLayer("code-block-dropdown");
5404
5420
  const onClick = useCallback10(() => {
@@ -7724,7 +7740,7 @@ import { useContext as useContext2 } from "react";
7724
7740
  import { useSelected as useSelected8 } from "slate-react";
7725
7741
 
7726
7742
  // src/table-plugin/render-element/table-cell/column-menu/index.tsx
7727
- import { useCallback as useCallback12, useRef as useRef8, useState as useState6 } from "react";
7743
+ import { useCallback as useCallback12, useRef as useRef9, useState as useState6 } from "react";
7728
7744
  import { useSlateStatic as useSlateStatic14 } from "slate-react";
7729
7745
 
7730
7746
  // src/table-plugin/icons.tsx
@@ -7777,7 +7793,7 @@ import { Fragment as Fragment5, jsx as jsx51, jsxs as jsxs23 } from "react/jsx-r
7777
7793
  function ColumnMenu({ cellElement }) {
7778
7794
  const editor = useSlateStatic14();
7779
7795
  const menu = useLayer("column-menu");
7780
- const buttonRef = useRef8(null);
7796
+ const buttonRef = useRef9(null);
7781
7797
  const [hover, setHover] = useState6(false);
7782
7798
  const onMouseEnter = useCallback12(() => {
7783
7799
  setHover(true);
@@ -8182,13 +8198,13 @@ var ThemePlugin = createPlugin((editor) => {
8182
8198
 
8183
8199
  // src/toolbar-plugin/render-editable/index.tsx
8184
8200
  import { clsx as clsx10 } from "clsx";
8185
- import { useCallback as useCallback17, useRef as useRef14 } from "react";
8201
+ import { useCallback as useCallback17, useRef as useRef15 } from "react";
8186
8202
  import { Editor as Editor63, Transforms as Transforms45 } from "slate";
8187
8203
  import { ReactEditor as ReactEditor16, useFocused, useSlateStatic as useSlateStatic21 } from "slate-react";
8188
8204
 
8189
8205
  // src/toolbar-plugin/components/dialog/table-dialog.tsx
8190
8206
  import { clsx as clsx8 } from "clsx";
8191
- import { useCallback as useCallback13, useRef as useRef9, useState as useState8 } from "react";
8207
+ import { useCallback as useCallback13, useRef as useRef10, useState as useState8 } from "react";
8192
8208
  import { ReactEditor as ReactEditor13, useSlateStatic as useSlateStatic16 } from "slate-react";
8193
8209
 
8194
8210
  // src/toolbar-plugin/styles/table-styles.ts
@@ -8225,7 +8241,7 @@ function TableDialog({
8225
8241
  }) {
8226
8242
  const [hover, setHover] = useState8({ x: 0, y: 0 });
8227
8243
  const editor = useSlateStatic16();
8228
- const ref = useRef9(null);
8244
+ const ref = useRef10(null);
8229
8245
  const style = useAbsoluteReposition({ src: ref, dest }, ({ dest: dest2 }) => {
8230
8246
  if (!dest2) return { left: 0, top: 0 };
8231
8247
  return { left: dest2.left - 8, top: dest2.top + dest2.height };
@@ -8266,7 +8282,7 @@ function TableDialog({
8266
8282
  }
8267
8283
 
8268
8284
  // src/toolbar-plugin/components/toolbar/toolbar.tsx
8269
- import { useEffect as useEffect9, useRef as useRef13, useState as useState11 } from "react";
8285
+ import { useEffect as useEffect9, useRef as useRef14, useState as useState11 } from "react";
8270
8286
  import { useSlateStatic as useSlateStatic20 } from "slate-react";
8271
8287
 
8272
8288
  // src/toolbar-plugin/icons.tsx
@@ -8379,7 +8395,7 @@ var compactBlockItems = [
8379
8395
  ];
8380
8396
 
8381
8397
  // src/toolbar-plugin/components/dialog/image-url-dialog.tsx
8382
- import { useState as useState9, useRef as useRef10, useEffect as useEffect8, useCallback as useCallback14 } from "react";
8398
+ import { useState as useState9, useRef as useRef11, useEffect as useEffect8, useCallback as useCallback14 } from "react";
8383
8399
  import { useSlateStatic as useSlateStatic17 } from "slate-react";
8384
8400
 
8385
8401
  // src/toolbar-plugin/styles/file-dialog-styles.ts
@@ -8397,8 +8413,8 @@ function ImageUrlDialog({
8397
8413
  close
8398
8414
  }) {
8399
8415
  const editor = useSlateStatic17();
8400
- const ref = useRef10(null);
8401
- const fileInputRef = useRef10(null);
8416
+ const ref = useRef11(null);
8417
+ const fileInputRef = useRef11(null);
8402
8418
  const [dragOffset, setDragOffset] = useState9({ x: 0, y: 0 });
8403
8419
  const handleDrag = useCallback14((deltaX, deltaY) => {
8404
8420
  setDragOffset((prev) => ({ x: prev.x + deltaX, y: prev.y + deltaY }));
@@ -8724,7 +8740,7 @@ import { isHotkey as isHotkey3 } from "is-hotkey";
8724
8740
  import {
8725
8741
  useCallback as useCallback15,
8726
8742
  useMemo as useMemo3,
8727
- useRef as useRef11,
8743
+ useRef as useRef12,
8728
8744
  useState as useState10
8729
8745
  } from "react";
8730
8746
  import { Editor as Editor60, Range as Range10 } from "slate";
@@ -8772,7 +8788,7 @@ function AnchorDialog2({
8772
8788
  close
8773
8789
  }) {
8774
8790
  const editor = useSlateStatic18();
8775
- const ref = useRef11(null);
8791
+ const ref = useRef12(null);
8776
8792
  const [dragOffset, setDragOffset] = useState10({ x: 0, y: 0 });
8777
8793
  const handleDrag = useCallback15((deltaX, deltaY) => {
8778
8794
  setDragOffset((prev) => ({ x: prev.x + deltaX, y: prev.y + deltaY }));
@@ -9151,7 +9167,7 @@ var itemSets = [largeItems, mediumItems, smallItems];
9151
9167
 
9152
9168
  // src/toolbar-plugin/components/toolbar/toolbar-button.tsx
9153
9169
  import { clsx as clsx9 } from "clsx";
9154
- import { useCallback as useCallback16, useRef as useRef12 } from "react";
9170
+ import { useCallback as useCallback16, useRef as useRef13 } from "react";
9155
9171
  import { ReactEditor as ReactEditor15, useSlate as useSlate2, useSlateStatic as useSlateStatic19 } from "slate-react";
9156
9172
  import { jsx as jsx63, jsxs as jsxs31 } from "react/jsx-runtime";
9157
9173
  function ToolbarButton({
@@ -9160,7 +9176,7 @@ function ToolbarButton({
9160
9176
  const staticEditor = useSlateStatic19();
9161
9177
  const editor = useSlate2();
9162
9178
  const isActive = item.active ? item.active(editor) : false;
9163
- const ref = useRef12(null);
9179
+ const ref = useRef13(null);
9164
9180
  const tooltip = useTooltip({
9165
9181
  title: item.title,
9166
9182
  hotkey: () => item.hotkey ? formatHotkey(item.hotkey) : void 0
@@ -9251,7 +9267,7 @@ function measureItemSetWidth(items, buttonWidth, dividerWidth) {
9251
9267
  }
9252
9268
  var WIDTH_BUFFER_PX = 4;
9253
9269
  function Toolbar() {
9254
- const ref = useRef13(null);
9270
+ const ref = useRef14(null);
9255
9271
  const [items, setItems] = useState11(initialItems);
9256
9272
  useEffect9(() => {
9257
9273
  const toolbar = ref.current;
@@ -9290,7 +9306,7 @@ function Toolbar() {
9290
9306
  // src/toolbar-plugin/render-editable/index.tsx
9291
9307
  import { jsx as jsx65, jsxs as jsxs32 } from "react/jsx-runtime";
9292
9308
  function renderEditable({ attributes, Editable: Editable3 }) {
9293
- const outerContainerRef = useRef14(null);
9309
+ const outerContainerRef = useRef15(null);
9294
9310
  const editor = useSlateStatic21();
9295
9311
  const focused = useFocused();
9296
9312
  const onClickOuterContainer = useCallback17(
@@ -9538,11 +9554,11 @@ function Editable2({
9538
9554
  }) {
9539
9555
  const [isRawMode, setIsRawMode] = useState13(false);
9540
9556
  const [rawText, setRawText] = useState13(value);
9541
- const ignoreNextChangeRef = useRef15(false);
9542
- const initialValueRef = useRef15(void 0);
9543
- const prevValueRef = useRef15(void 0);
9544
- const pendingRawTextRef = useRef15(null);
9545
- const onChangeRef = useRef15(onChange);
9557
+ const ignoreNextChangeRef = useRef16(false);
9558
+ const initialValueRef = useRef16(void 0);
9559
+ const prevValueRef = useRef16(void 0);
9560
+ const pendingRawTextRef = useRef16(null);
9561
+ const onChangeRef = useRef16(onChange);
9546
9562
  onChangeRef.current = onChange;
9547
9563
  const onThrottledSlateChange = useCallback18(
9548
9564
  throttle2(
@@ -9750,7 +9766,7 @@ function StandaloneEditor({
9750
9766
  standaloneMethodsRef
9751
9767
  }) {
9752
9768
  const [markdown, setMarkdown] = useState14(options.initialMarkdown || "");
9753
- const markdownRef = useRef16(markdown);
9769
+ const markdownRef = useRef17(markdown);
9754
9770
  const editor = useEditor(options);
9755
9771
  markdownRef.current = markdown;
9756
9772
  useImperativeHandle(