noteloom 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +162 -1026
  2. package/dist/canvas.cjs +1 -1
  3. package/dist/canvas.js +1 -1
  4. package/dist/comments.cjs +1 -1
  5. package/dist/comments.js +3 -3
  6. package/dist/index.cjs +1 -1
  7. package/dist/index.d.ts +2 -1
  8. package/dist/index.js +19 -19
  9. package/dist/shared/{CommentThreadCard-Cxf8GwHJ.js → CommentThreadCard-CwKd6fp3.js} +2 -2
  10. package/dist/shared/{CommentThreadCard-Cxf8GwHJ.js.map → CommentThreadCard-CwKd6fp3.js.map} +1 -1
  11. package/dist/shared/{CommentThreadCard-CAJ3oPdr.cjs → CommentThreadCard-YziIa8My.cjs} +2 -2
  12. package/dist/shared/{CommentThreadCard-CAJ3oPdr.cjs.map → CommentThreadCard-YziIa8My.cjs.map} +1 -1
  13. package/dist/shared/{CommentsPanel-CES4uzye.cjs → CommentsPanel-DezejDdE.cjs} +2 -2
  14. package/dist/shared/{CommentsPanel-CES4uzye.cjs.map → CommentsPanel-DezejDdE.cjs.map} +1 -1
  15. package/dist/shared/{CommentsPanel-BwVVyMOC.js → CommentsPanel-dx7IaoqS.js} +3 -3
  16. package/dist/shared/{CommentsPanel-BwVVyMOC.js.map → CommentsPanel-dx7IaoqS.js.map} +1 -1
  17. package/dist/shared/{VersionHistory-Bg6fufP5.js → VersionHistory-DhYb8C2e.js} +3 -3
  18. package/dist/shared/{VersionHistory-Bg6fufP5.js.map → VersionHistory-DhYb8C2e.js.map} +1 -1
  19. package/dist/shared/{VersionHistory-DELa2Wbq.cjs → VersionHistory-DuSxis_7.cjs} +2 -2
  20. package/dist/shared/{VersionHistory-DELa2Wbq.cjs.map → VersionHistory-DuSxis_7.cjs.map} +1 -1
  21. package/dist/shared/{VoiceListeningIndicator-DNX8JlQM.cjs → VoiceListeningIndicator-BXByLZwO.cjs} +2 -2
  22. package/dist/shared/{VoiceListeningIndicator-DNX8JlQM.cjs.map → VoiceListeningIndicator-BXByLZwO.cjs.map} +1 -1
  23. package/dist/shared/{VoiceListeningIndicator-BOfVmLK0.js → VoiceListeningIndicator-bv285FSY.js} +4 -4
  24. package/dist/shared/{VoiceListeningIndicator-BOfVmLK0.js.map → VoiceListeningIndicator-bv285FSY.js.map} +1 -1
  25. package/dist/shared/{icons-DtCsXuU6.cjs → icons-BCseh2pt.cjs} +3 -3
  26. package/dist/shared/{icons-DtCsXuU6.cjs.map → icons-BCseh2pt.cjs.map} +1 -1
  27. package/dist/shared/{icons-C1_s0jKK.js → icons-D5Ctow8R.js} +249 -239
  28. package/dist/shared/{icons-C1_s0jKK.js.map → icons-D5Ctow8R.js.map} +1 -1
  29. package/dist/shared/{index-D9WEXpYM.cjs → index-CbIBsFmI.cjs} +2 -2
  30. package/dist/shared/{index-D9WEXpYM.cjs.map → index-CbIBsFmI.cjs.map} +1 -1
  31. package/dist/shared/{index-B9jyyL8u.js → index-D_8hJpI7.js} +3 -3
  32. package/dist/shared/{index-B9jyyL8u.js.map → index-D_8hJpI7.js.map} +1 -1
  33. package/dist/shared/{leafBlockFactory-Dp382eP8.cjs → leafBlockFactory-CaLWUcfa.cjs} +2 -2
  34. package/dist/shared/{leafBlockFactory-Dp382eP8.cjs.map → leafBlockFactory-CaLWUcfa.cjs.map} +1 -1
  35. package/dist/shared/{leafBlockFactory-A9eUhSe-.js → leafBlockFactory-DSa1XCox.js} +2 -2
  36. package/dist/shared/{leafBlockFactory-A9eUhSe-.js.map → leafBlockFactory-DSa1XCox.js.map} +1 -1
  37. package/dist/shared/{serialize-T9Odwx24.js → serialize-BqKU9EZy.js} +2 -2
  38. package/dist/shared/{serialize-T9Odwx24.js.map → serialize-BqKU9EZy.js.map} +1 -1
  39. package/dist/shared/{serialize-DWEfk0vU.cjs → serialize-CqwX55uK.cjs} +2 -2
  40. package/dist/shared/{serialize-DWEfk0vU.cjs.map → serialize-CqwX55uK.cjs.map} +1 -1
  41. package/dist/shared/{starter-kit-lPN-NpJ5.cjs → starter-kit-DyX1U84W.cjs} +2 -2
  42. package/dist/shared/{starter-kit-lPN-NpJ5.cjs.map → starter-kit-DyX1U84W.cjs.map} +1 -1
  43. package/dist/shared/{starter-kit-CY5wzYDf.js → starter-kit-mfeNxqFn.js} +7 -7
  44. package/dist/shared/{starter-kit-CY5wzYDf.js.map → starter-kit-mfeNxqFn.js.map} +1 -1
  45. package/dist/shared/{usePopoverEdgeClamp-CDG26jBM.cjs → usePopoverEdgeClamp-CPRWQtZV.cjs} +2 -2
  46. package/dist/shared/{usePopoverEdgeClamp-CDG26jBM.cjs.map → usePopoverEdgeClamp-CPRWQtZV.cjs.map} +1 -1
  47. package/dist/shared/{usePopoverEdgeClamp-gmFm0CnI.js → usePopoverEdgeClamp-D_hB5t60.js} +2 -2
  48. package/dist/shared/{usePopoverEdgeClamp-gmFm0CnI.js.map → usePopoverEdgeClamp-D_hB5t60.js.map} +1 -1
  49. package/dist/starter-kit.cjs +1 -1
  50. package/dist/starter-kit.js +2 -2
  51. package/dist/versions.cjs +1 -1
  52. package/dist/versions.js +1 -1
  53. package/dist/voice.cjs +1 -1
  54. package/dist/voice.js +1 -1
  55. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";const x=require("react/jsx-runtime"),r=require("react"),L=require("./icons-DtCsXuU6.cjs"),v='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';function y({isOpen:t,onClose:e,title:o,size:n="default",variant:s="dialog",children:u}){const c=r.useRef(null),a=r.useRef(null);if(r.useEffect(()=>{if(!t)return;const l=d=>{d.key==="Escape"&&e()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,e]),r.useEffect(()=>{var l,d,m;if(t){a.current=document.activeElement;const f=c.current;(l=(f==null?void 0:f.querySelector(v))??f)==null||l.focus();return}(m=(d=a.current)==null?void 0:d.focus)==null||m.call(d),a.current=null},[t]),!t)return null;const i=s==="sheet";return x.jsx("div",{className:`be-modal-overlay${i?" be-modal-overlay-sheet":""}`,onMouseDown:l=>{l.target===l.currentTarget&&e()},children:x.jsxs("div",{ref:c,className:`be-modal${n==="large"?" be-modal-large":""}${i?" be-modal-sheet":""}`,role:"dialog","aria-modal":"true","aria-label":o,tabIndex:-1,children:[o&&x.jsx("div",{className:"be-modal-title",children:o}),u]})})}const p=8;function g(t,e){const o=Math.max(p,window.innerWidth-e-p);return Math.min(Math.max(t,p),o)}function A(t,e){const o=Math.max(p,window.innerHeight-e-p);return Math.min(Math.max(t,p),o)}function B(t,e,o,n,s,u){const c=t.getBlock(e),i=t.getBlock(c.parentId).contentIds.indexOf(e),l="titleRunIds"in n,d="titleRunIds"in(c.props??{}),m=u?!u.isLeaf(c.type)&&c.contentIds.length>0:!1,f=u?!u.isLeaf(o):!1,h=[];if(m&&!f&&c.contentIds.forEach((E,w)=>h.push(L.moveBlock(E,c.parentId,i+1+w))),h.push(L.changeBlockType(e,o,n)),l)h.push(L.updateBlockProps(e,{titleRunIds:s})),!d&&!m&&h.push(L.setBlockContentIds(e,[]));else{const E=m&&f?c.contentIds:[];h.push(L.setBlockContentIds(e,[...E,...s]))}return{newBlockId:e,ops:h}}function T(t,e,o){const[n,s]=r.useState(null);return r.useLayoutEffect(()=>{s(o??null)},[o]),r.useLayoutEffect(()=>{if(!e||!t.current||n==null)return;const u=t.current.getBoundingClientRect(),c=g(n,u.width);c!==n&&s(c)},[e,t,n]),n}function C(t,e,o){const[n,s]=r.useState(null);return r.useLayoutEffect(()=>{s(o??null)},[o]),r.useLayoutEffect(()=>{if(!e||!t.current||n==null)return;const u=t.current.getBoundingClientRect(),c=u.width/2,i=g(n-c,u.width)+c;i!==n&&s(i)},[e,t,n]),n}function R(t,e,o){const[n,s]=r.useState(null);return r.useLayoutEffect(()=>{s(o??null)},[o]),r.useLayoutEffect(()=>{if(!e||!t.current||n==null)return;const u=t.current.getBoundingClientRect(),a=g(n-u.width,u.width)+u.width;a!==n&&s(a)},[e,t,n]),n}exports.Modal=y;exports.clampLeftToViewport=g;exports.clampTopToViewport=A;exports.convertBlockType=B;exports.useAutoAdjustedCenteredLeft=C;exports.useAutoAdjustedRightLeft=R;exports.useHorizontalAutoAdjustedLeft=T;
2
- //# sourceMappingURL=usePopoverEdgeClamp-CDG26jBM.cjs.map
1
+ "use strict";const x=require("react/jsx-runtime"),r=require("react"),L=require("./icons-BCseh2pt.cjs"),v='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';function y({isOpen:t,onClose:e,title:o,size:n="default",variant:s="dialog",children:u}){const c=r.useRef(null),a=r.useRef(null);if(r.useEffect(()=>{if(!t)return;const l=d=>{d.key==="Escape"&&e()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,e]),r.useEffect(()=>{var l,d,m;if(t){a.current=document.activeElement;const f=c.current;(l=(f==null?void 0:f.querySelector(v))??f)==null||l.focus();return}(m=(d=a.current)==null?void 0:d.focus)==null||m.call(d),a.current=null},[t]),!t)return null;const i=s==="sheet";return x.jsx("div",{className:`be-modal-overlay${i?" be-modal-overlay-sheet":""}`,onMouseDown:l=>{l.target===l.currentTarget&&e()},children:x.jsxs("div",{ref:c,className:`be-modal${n==="large"?" be-modal-large":""}${i?" be-modal-sheet":""}`,role:"dialog","aria-modal":"true","aria-label":o,tabIndex:-1,children:[o&&x.jsx("div",{className:"be-modal-title",children:o}),u]})})}const p=8;function g(t,e){const o=Math.max(p,window.innerWidth-e-p);return Math.min(Math.max(t,p),o)}function A(t,e){const o=Math.max(p,window.innerHeight-e-p);return Math.min(Math.max(t,p),o)}function B(t,e,o,n,s,u){const c=t.getBlock(e),i=t.getBlock(c.parentId).contentIds.indexOf(e),l="titleRunIds"in n,d="titleRunIds"in(c.props??{}),m=u?!u.isLeaf(c.type)&&c.contentIds.length>0:!1,f=u?!u.isLeaf(o):!1,h=[];if(m&&!f&&c.contentIds.forEach((E,w)=>h.push(L.moveBlock(E,c.parentId,i+1+w))),h.push(L.changeBlockType(e,o,n)),l)h.push(L.updateBlockProps(e,{titleRunIds:s})),!d&&!m&&h.push(L.setBlockContentIds(e,[]));else{const E=m&&f?c.contentIds:[];h.push(L.setBlockContentIds(e,[...E,...s]))}return{newBlockId:e,ops:h}}function T(t,e,o){const[n,s]=r.useState(null);return r.useLayoutEffect(()=>{s(o??null)},[o]),r.useLayoutEffect(()=>{if(!e||!t.current||n==null)return;const u=t.current.getBoundingClientRect(),c=g(n,u.width);c!==n&&s(c)},[e,t,n]),n}function C(t,e,o){const[n,s]=r.useState(null);return r.useLayoutEffect(()=>{s(o??null)},[o]),r.useLayoutEffect(()=>{if(!e||!t.current||n==null)return;const u=t.current.getBoundingClientRect(),c=u.width/2,i=g(n-c,u.width)+c;i!==n&&s(i)},[e,t,n]),n}function R(t,e,o){const[n,s]=r.useState(null);return r.useLayoutEffect(()=>{s(o??null)},[o]),r.useLayoutEffect(()=>{if(!e||!t.current||n==null)return;const u=t.current.getBoundingClientRect(),a=g(n-u.width,u.width)+u.width;a!==n&&s(a)},[e,t,n]),n}exports.Modal=y;exports.clampLeftToViewport=g;exports.clampTopToViewport=A;exports.convertBlockType=B;exports.useAutoAdjustedCenteredLeft=C;exports.useAutoAdjustedRightLeft=R;exports.useHorizontalAutoAdjustedLeft=T;
2
+ //# sourceMappingURL=usePopoverEdgeClamp-CPRWQtZV.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePopoverEdgeClamp-CDG26jBM.cjs","sources":["../../src/react/Modal.jsx","../../src/react/popoverPosition.js","../../src/blocks/shared/convertBlockType.js","../../src/react/usePopoverEdgeClamp.js"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nconst FOCUSABLE_SELECTOR =\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * Minimal, dependency-free modal dialog: a fixed backdrop + centered panel.\n * Closes on Escape or a click directly on the backdrop (not bubbled up from\n * inside the panel, which is why the backdrop's onMouseDown checks\n * `event.target === event.currentTarget`). No focus trap — the whole\n * editor package is deliberately zero-dependency, and dialogs here are\n * short, single-purpose forms, not deep navigable UI.\n *\n * Does move focus IN (to the first focusable element inside the panel, or\n * the panel itself as a fallback) on open, and OUT (back to whatever had\n * focus right before the modal opened — typically the button that opened\n * it) on close — distinct from a focus trap: it's a one-time move each\n * way, not a loop that prevents Tab from ever leaving the panel.\n */\nexport function Modal({ isOpen, onClose, title, size = 'default', variant = 'dialog', children }) {\n const panelRef = useRef(null);\n const previouslyFocusedRef = useRef(null);\n\n useEffect(() => {\n if (!isOpen) return undefined;\n const handleKeyDown = (event) => {\n if (event.key === 'Escape') onClose();\n };\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [isOpen, onClose]);\n\n useEffect(() => {\n if (isOpen) {\n previouslyFocusedRef.current = document.activeElement;\n const panel = panelRef.current;\n const focusable = panel?.querySelector(FOCUSABLE_SELECTOR);\n (focusable ?? panel)?.focus();\n return undefined;\n }\n previouslyFocusedRef.current?.focus?.();\n previouslyFocusedRef.current = null;\n return undefined;\n }, [isOpen]);\n\n if (!isOpen) return null;\n const isSheet = variant === 'sheet';\n\n return (\n <div\n className={`be-modal-overlay${isSheet ? ' be-modal-overlay-sheet' : ''}`}\n onMouseDown={(event) => {\n if (event.target === event.currentTarget) onClose();\n }}\n >\n <div\n ref={panelRef}\n className={`be-modal${size === 'large' ? ' be-modal-large' : ''}${isSheet ? ' be-modal-sheet' : ''}`}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={title}\n tabIndex={-1}\n >\n {title && <div className=\"be-modal-title\">{title}</div>}\n {children}\n </div>\n </div>\n );\n}\n","const MARGIN = 8;\n\n/**\n * Shifts `left`/`top` back inside the viewport (never past the opposite\n * edge either) for a box of the given size — the \"shift\" strategy antd's\n * `autoAdjustOverflow` uses, not a side-flip. Shared by every popover-\n * positioning hook in this file so the margin/clamp math lives in exactly\n * one place.\n */\nexport function clampLeftToViewport(left, width) {\n const maxLeft = Math.max(MARGIN, window.innerWidth - width - MARGIN);\n return Math.min(Math.max(left, MARGIN), maxLeft);\n}\n\nexport function clampTopToViewport(top, height) {\n const maxTop = Math.max(MARGIN, window.innerHeight - height - MARGIN);\n return Math.min(Math.max(top, MARGIN), maxTop);\n}\n","import {\n changeBlockType,\n moveBlock,\n setBlockContentIds,\n updateBlockProps,\n} from '../../store/operations.js';\n\n/**\n * Builds the ops that convert `blockId` to a different type IN PLACE — same\n * id, same parentId, same position among siblings — carrying over `runIds`\n * (reusing the existing Run objects — never recreated) rather than creating\n * new ones, so any marks/text already typed survive the conversion. `props`\n * may include `titleRunIds` (for a listItem-shaped target) — `runIds` is\n * threaded into whichever of contentIds/props.titleRunIds the target type\n * actually uses (and whichever the *source* type used, when detaching).\n *\n * Keeping the same id (rather than deleting the old block and inserting a\n * new one) matters beyond just simplicity: it's what lets a future\n * multi-peer merge treat two concurrent conversions of the same block as\n * one field-level conflict on that id (last-write-wins) instead of two\n * unrelated structural edits that would otherwise leave both resulting\n * blocks sitting side by side after merging.\n *\n * `registry` is optional and additive — this function's two original\n * callers (markdownShortcuts.js, applyVoiceAction.js) never pass one, and\n * only ever call this on a fresh, childless, single-run paragraph, so their\n * behavior is completely unaffected by anything below. When `registry` IS\n * supplied (the \"Turn into\" feature), the *source* block's own nested\n * children — real child blocks in `contentIds`, distinct from a leaf's own\n * runs, true for `listItem`/`toggleHeading`/`callout` (`!registry.isLeaf`)\n * — are handled instead of being silently orphaned:\n * - If the *target* type can also hold children (`!registry.isLeaf(type)`,\n * e.g. listItem -> toggleHeading), the children simply stay parented to\n * this same block id — nothing needs to move.\n * - If the target is a pure leaf (e.g. toggleHeading -> heading) and can't\n * hold them, they're promoted to sibling blocks inserted immediately\n * after this block instead — content is never silently dropped.\n *\n * Returns `{ ops, newBlockId }` rather than applying anything itself —\n * `newBlockId` is always `blockId` (kept for backward compatibility with\n * callers written when this returned a freshly generated id). The caller\n * folds `ops` into its own batch (e.g. alongside an `updateRun` that strips\n * a matched markdown-shortcut prefix from the first run), so the whole\n * thing is one atomic undo step.\n */\nexport function convertBlockType(store, blockId, type, props, runIds, registry) {\n const block = store.getBlock(blockId);\n const parent = store.getBlock(block.parentId);\n const index = parent.contentIds.indexOf(blockId);\n const targetUsesTitleRunIds = 'titleRunIds' in props;\n const sourceUsesTitleRunIds = 'titleRunIds' in (block.props ?? {});\n const sourceHasChildren = registry\n ? !registry.isLeaf(block.type) && block.contentIds.length > 0\n : false;\n const targetCanHoldChildren = registry ? !registry.isLeaf(type) : false;\n\n const ops = [];\n\n // Children only need to move when the target can't hold them (promoted\n // to siblings). When the target can also hold children, they're already\n // correctly parented to this same block id — nothing to do.\n if (sourceHasChildren && !targetCanHoldChildren) {\n block.contentIds.forEach((childId, i) =>\n ops.push(moveBlock(childId, block.parentId, index + 1 + i)),\n );\n }\n\n ops.push(changeBlockType(blockId, type, props));\n\n if (targetUsesTitleRunIds) {\n ops.push(updateBlockProps(blockId, { titleRunIds: runIds }));\n // A leaf source's old contentIds held its own runs, now superseded by\n // titleRunIds — clear it so those ids aren't misread as child blocks.\n // A container source that already used titleRunIds (or had its\n // children promoted to siblings above) already has the right\n // contentIds and needs no clearing.\n if (!sourceUsesTitleRunIds && !sourceHasChildren) {\n ops.push(setBlockContentIds(blockId, []));\n }\n } else {\n // Target keeps its own runs directly in contentIds. Any children still\n // sitting in contentIds at this point are ones the target can also\n // hold (handled above) and must be kept alongside the transferred\n // runIds, not replaced by them.\n const keepChildren = sourceHasChildren && targetCanHoldChildren ? block.contentIds : [];\n ops.push(setBlockContentIds(blockId, [...keepChildren, ...runIds]));\n }\n\n return { newBlockId: blockId, ops };\n}\n","import { useLayoutEffect, useState } from 'react';\nimport { clampLeftToViewport } from './popoverPosition.js';\n\n// All three hooks below share the exact two-phase shape\n// useAutoAdjustedPosition.js documents in full (snap to the raw anchor\n// first so nothing jumps, then measure + clamp once real layout exists,\n// both as useLayoutEffects so the whole chain settles before the browser\n// ever paints) — only the *anchor math* differs per popover's own CSS\n// convention, so each is kept as its own tiny hook rather than forcing one\n// generic shape to cover every transform variant.\n\n/**\n * For a popover that's LEFT-anchored (plain `left: <value>`, no transform)\n * but already owns its own vertical placement (Select/SlashMenu both flip\n * between `top`/`bottom` to dodge the on-screen keyboard) — this only ever\n * touches the horizontal axis, leaving the caller's vertical decision alone.\n */\nexport function useHorizontalAutoAdjustedLeft(menuRef, isOpen, rawLeft) {\n const [left, setLeft] = useState(null);\n\n useLayoutEffect(() => {\n setLeft(rawLeft ?? null);\n }, [rawLeft]);\n\n useLayoutEffect(() => {\n if (!isOpen || !menuRef.current || left == null) return;\n const rect = menuRef.current.getBoundingClientRect();\n const clamped = clampLeftToViewport(left, rect.width);\n if (clamped !== left) setLeft(clamped);\n }, [isOpen, menuRef, left]);\n\n return left;\n}\n\n/**\n * For a popover CENTERED on an x-coordinate via `left: <centerX>;\n * transform: translateX(-50%)` (FloatingToolbar's own bubble, centered over\n * the text selection it's formatting) — clamps the box's actual left/right\n * edges (accounting for the -50% shift) and returns an adjusted `centerX`\n * for that same `left` + `transform: translateX(-50%)` pairing, so the\n * caller's JSX doesn't need to change anything but the number.\n */\nexport function useAutoAdjustedCenteredLeft(menuRef, isOpen, rawCenterLeft) {\n const [centerLeft, setCenterLeft] = useState(null);\n\n useLayoutEffect(() => {\n setCenterLeft(rawCenterLeft ?? null);\n }, [rawCenterLeft]);\n\n useLayoutEffect(() => {\n if (!isOpen || !menuRef.current || centerLeft == null) return;\n const rect = menuRef.current.getBoundingClientRect();\n const half = rect.width / 2;\n const clampedEdge = clampLeftToViewport(centerLeft - half, rect.width);\n const nextCenter = clampedEdge + half;\n if (nextCenter !== centerLeft) setCenterLeft(nextCenter);\n }, [isOpen, menuRef, centerLeft]);\n\n return centerLeft;\n}\n\n/**\n * For a popover RIGHT-anchored on an x-coordinate via `left: <rightEdgeX>;\n * transform: translateX(-100%)` (TableHeaderRow's column menu, whose right\n * edge lines up with the header cell's own right edge and grows leftward)\n * — clamps the box's actual left edge and returns an adjusted `rightEdgeX`\n * for that same `left` + `transform: translateX(-100%)` pairing.\n */\nexport function useAutoAdjustedRightLeft(menuRef, isOpen, rawRightEdgeLeft) {\n const [rightLeft, setRightLeft] = useState(null);\n\n useLayoutEffect(() => {\n setRightLeft(rawRightEdgeLeft ?? null);\n }, [rawRightEdgeLeft]);\n\n useLayoutEffect(() => {\n if (!isOpen || !menuRef.current || rightLeft == null) return;\n const rect = menuRef.current.getBoundingClientRect();\n const clampedEdge = clampLeftToViewport(rightLeft - rect.width, rect.width);\n const nextRightLeft = clampedEdge + rect.width;\n if (nextRightLeft !== rightLeft) setRightLeft(nextRightLeft);\n }, [isOpen, menuRef, rightLeft]);\n\n return rightLeft;\n}\n"],"names":["FOCUSABLE_SELECTOR","Modal","isOpen","onClose","title","size","variant","children","panelRef","useRef","previouslyFocusedRef","useEffect","handleKeyDown","event","panel","_a","_c","_b","isSheet","jsx","jsxs","MARGIN","clampLeftToViewport","left","width","maxLeft","clampTopToViewport","top","height","maxTop","convertBlockType","store","blockId","type","props","runIds","registry","block","index","targetUsesTitleRunIds","sourceUsesTitleRunIds","sourceHasChildren","targetCanHoldChildren","ops","childId","i","moveBlock","changeBlockType","updateBlockProps","setBlockContentIds","keepChildren","useHorizontalAutoAdjustedLeft","menuRef","rawLeft","setLeft","useState","useLayoutEffect","rect","clamped","useAutoAdjustedCenteredLeft","rawCenterLeft","centerLeft","setCenterLeft","half","nextCenter","useAutoAdjustedRightLeft","rawRightEdgeLeft","rightLeft","setRightLeft","nextRightLeft"],"mappings":"uGAEMA,EACJ,2EAgBK,SAASC,EAAM,CAAE,OAAAC,EAAQ,QAAAC,EAAS,MAAAC,EAAO,KAAAC,EAAO,UAAW,QAAAC,EAAU,SAAU,SAAAC,GAAY,CAChG,MAAMC,EAAWC,EAAAA,OAAO,IAAI,EACtBC,EAAuBD,EAAAA,OAAO,IAAI,EAwBxC,GAtBAE,EAAAA,UAAU,IAAM,CACd,GAAI,CAACT,EAAQ,OACb,MAAMU,EAAiBC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AkBF,GAAWC,EAAaC,CAAa,CAC7D,EAAG,CAACnE,EAAQkD,EAASe,CAAS,CAAC,EAExBA,CACT"}
1
+ {"version":3,"file":"usePopoverEdgeClamp-CPRWQtZV.cjs","sources":["../../src/react/Modal.jsx","../../src/react/popoverPosition.js","../../src/blocks/shared/convertBlockType.js","../../src/react/usePopoverEdgeClamp.js"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nconst FOCUSABLE_SELECTOR =\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * Minimal, dependency-free modal dialog: a fixed backdrop + centered panel.\n * Closes on Escape or a click directly on the backdrop (not bubbled up from\n * inside the panel, which is why the backdrop's onMouseDown checks\n * `event.target === event.currentTarget`). No focus trap — the whole\n * editor package is deliberately zero-dependency, and dialogs here are\n * short, single-purpose forms, not deep navigable UI.\n *\n * Does move focus IN (to the first focusable element inside the panel, or\n * the panel itself as a fallback) on open, and OUT (back to whatever had\n * focus right before the modal opened — typically the button that opened\n * it) on close — distinct from a focus trap: it's a one-time move each\n * way, not a loop that prevents Tab from ever leaving the panel.\n */\nexport function Modal({ isOpen, onClose, title, size = 'default', variant = 'dialog', children }) {\n const panelRef = useRef(null);\n const previouslyFocusedRef = useRef(null);\n\n useEffect(() => {\n if (!isOpen) return undefined;\n const handleKeyDown = (event) => {\n if (event.key === 'Escape') onClose();\n };\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [isOpen, onClose]);\n\n useEffect(() => {\n if (isOpen) {\n previouslyFocusedRef.current = document.activeElement;\n const panel = panelRef.current;\n const focusable = panel?.querySelector(FOCUSABLE_SELECTOR);\n (focusable ?? panel)?.focus();\n return undefined;\n }\n previouslyFocusedRef.current?.focus?.();\n previouslyFocusedRef.current = null;\n return undefined;\n }, [isOpen]);\n\n if (!isOpen) return null;\n const isSheet = variant === 'sheet';\n\n return (\n <div\n className={`be-modal-overlay${isSheet ? ' be-modal-overlay-sheet' : ''}`}\n onMouseDown={(event) => {\n if (event.target === event.currentTarget) onClose();\n }}\n >\n <div\n ref={panelRef}\n className={`be-modal${size === 'large' ? ' be-modal-large' : ''}${isSheet ? ' be-modal-sheet' : ''}`}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={title}\n tabIndex={-1}\n >\n {title && <div className=\"be-modal-title\">{title}</div>}\n {children}\n </div>\n </div>\n );\n}\n","const MARGIN = 8;\n\n/**\n * Shifts `left`/`top` back inside the viewport (never past the opposite\n * edge either) for a box of the given size — the \"shift\" strategy antd's\n * `autoAdjustOverflow` uses, not a side-flip. Shared by every popover-\n * positioning hook in this file so the margin/clamp math lives in exactly\n * one place.\n */\nexport function clampLeftToViewport(left, width) {\n const maxLeft = Math.max(MARGIN, window.innerWidth - width - MARGIN);\n return Math.min(Math.max(left, MARGIN), maxLeft);\n}\n\nexport function clampTopToViewport(top, height) {\n const maxTop = Math.max(MARGIN, window.innerHeight - height - MARGIN);\n return Math.min(Math.max(top, MARGIN), maxTop);\n}\n","import {\n changeBlockType,\n moveBlock,\n setBlockContentIds,\n updateBlockProps,\n} from '../../store/operations.js';\n\n/**\n * Builds the ops that convert `blockId` to a different type IN PLACE — same\n * id, same parentId, same position among siblings — carrying over `runIds`\n * (reusing the existing Run objects — never recreated) rather than creating\n * new ones, so any marks/text already typed survive the conversion. `props`\n * may include `titleRunIds` (for a listItem-shaped target) — `runIds` is\n * threaded into whichever of contentIds/props.titleRunIds the target type\n * actually uses (and whichever the *source* type used, when detaching).\n *\n * Keeping the same id (rather than deleting the old block and inserting a\n * new one) matters beyond just simplicity: it's what lets a future\n * multi-peer merge treat two concurrent conversions of the same block as\n * one field-level conflict on that id (last-write-wins) instead of two\n * unrelated structural edits that would otherwise leave both resulting\n * blocks sitting side by side after merging.\n *\n * `registry` is optional and additive — this function's two original\n * callers (markdownShortcuts.js, applyVoiceAction.js) never pass one, and\n * only ever call this on a fresh, childless, single-run paragraph, so their\n * behavior is completely unaffected by anything below. When `registry` IS\n * supplied (the \"Turn into\" feature), the *source* block's own nested\n * children — real child blocks in `contentIds`, distinct from a leaf's own\n * runs, true for `listItem`/`toggleHeading`/`callout` (`!registry.isLeaf`)\n * — are handled instead of being silently orphaned:\n * - If the *target* type can also hold children (`!registry.isLeaf(type)`,\n * e.g. listItem -> toggleHeading), the children simply stay parented to\n * this same block id — nothing needs to move.\n * - If the target is a pure leaf (e.g. toggleHeading -> heading) and can't\n * hold them, they're promoted to sibling blocks inserted immediately\n * after this block instead — content is never silently dropped.\n *\n * Returns `{ ops, newBlockId }` rather than applying anything itself —\n * `newBlockId` is always `blockId` (kept for backward compatibility with\n * callers written when this returned a freshly generated id). The caller\n * folds `ops` into its own batch (e.g. alongside an `updateRun` that strips\n * a matched markdown-shortcut prefix from the first run), so the whole\n * thing is one atomic undo step.\n */\nexport function convertBlockType(store, blockId, type, props, runIds, registry) {\n const block = store.getBlock(blockId);\n const parent = store.getBlock(block.parentId);\n const index = parent.contentIds.indexOf(blockId);\n const targetUsesTitleRunIds = 'titleRunIds' in props;\n const sourceUsesTitleRunIds = 'titleRunIds' in (block.props ?? {});\n const sourceHasChildren = registry\n ? !registry.isLeaf(block.type) && block.contentIds.length > 0\n : false;\n const targetCanHoldChildren = registry ? !registry.isLeaf(type) : false;\n\n const ops = [];\n\n // Children only need to move when the target can't hold them (promoted\n // to siblings). When the target can also hold children, they're already\n // correctly parented to this same block id — nothing to do.\n if (sourceHasChildren && !targetCanHoldChildren) {\n block.contentIds.forEach((childId, i) =>\n ops.push(moveBlock(childId, block.parentId, index + 1 + i)),\n );\n }\n\n ops.push(changeBlockType(blockId, type, props));\n\n if (targetUsesTitleRunIds) {\n ops.push(updateBlockProps(blockId, { titleRunIds: runIds }));\n // A leaf source's old contentIds held its own runs, now superseded by\n // titleRunIds — clear it so those ids aren't misread as child blocks.\n // A container source that already used titleRunIds (or had its\n // children promoted to siblings above) already has the right\n // contentIds and needs no clearing.\n if (!sourceUsesTitleRunIds && !sourceHasChildren) {\n ops.push(setBlockContentIds(blockId, []));\n }\n } else {\n // Target keeps its own runs directly in contentIds. Any children still\n // sitting in contentIds at this point are ones the target can also\n // hold (handled above) and must be kept alongside the transferred\n // runIds, not replaced by them.\n const keepChildren = sourceHasChildren && targetCanHoldChildren ? block.contentIds : [];\n ops.push(setBlockContentIds(blockId, [...keepChildren, ...runIds]));\n }\n\n return { newBlockId: blockId, ops };\n}\n","import { useLayoutEffect, useState } from 'react';\nimport { clampLeftToViewport } from './popoverPosition.js';\n\n// All three hooks below share the exact two-phase shape\n// useAutoAdjustedPosition.js documents in full (snap to the raw anchor\n// first so nothing jumps, then measure + clamp once real layout exists,\n// both as useLayoutEffects so the whole chain settles before the browser\n// ever paints) — only the *anchor math* differs per popover's own CSS\n// convention, so each is kept as its own tiny hook rather than forcing one\n// generic shape to cover every transform variant.\n\n/**\n * For a popover that's LEFT-anchored (plain `left: <value>`, no transform)\n * but already owns its own vertical placement (Select/SlashMenu both flip\n * between `top`/`bottom` to dodge the on-screen keyboard) — this only ever\n * touches the horizontal axis, leaving the caller's vertical decision alone.\n */\nexport function useHorizontalAutoAdjustedLeft(menuRef, isOpen, rawLeft) {\n const [left, setLeft] = useState(null);\n\n useLayoutEffect(() => {\n setLeft(rawLeft ?? null);\n }, [rawLeft]);\n\n useLayoutEffect(() => {\n if (!isOpen || !menuRef.current || left == null) return;\n const rect = menuRef.current.getBoundingClientRect();\n const clamped = clampLeftToViewport(left, rect.width);\n if (clamped !== left) setLeft(clamped);\n }, [isOpen, menuRef, left]);\n\n return left;\n}\n\n/**\n * For a popover CENTERED on an x-coordinate via `left: <centerX>;\n * transform: translateX(-50%)` (FloatingToolbar's own bubble, centered over\n * the text selection it's formatting) — clamps the box's actual left/right\n * edges (accounting for the -50% shift) and returns an adjusted `centerX`\n * for that same `left` + `transform: translateX(-50%)` pairing, so the\n * caller's JSX doesn't need to change anything but the number.\n */\nexport function useAutoAdjustedCenteredLeft(menuRef, isOpen, rawCenterLeft) {\n const [centerLeft, setCenterLeft] = useState(null);\n\n useLayoutEffect(() => {\n setCenterLeft(rawCenterLeft ?? null);\n }, [rawCenterLeft]);\n\n useLayoutEffect(() => {\n if (!isOpen || !menuRef.current || centerLeft == null) return;\n const rect = menuRef.current.getBoundingClientRect();\n const half = rect.width / 2;\n const clampedEdge = clampLeftToViewport(centerLeft - half, rect.width);\n const nextCenter = clampedEdge + half;\n if (nextCenter !== centerLeft) setCenterLeft(nextCenter);\n }, [isOpen, menuRef, centerLeft]);\n\n return centerLeft;\n}\n\n/**\n * For a popover RIGHT-anchored on an x-coordinate via `left: <rightEdgeX>;\n * transform: translateX(-100%)` (TableHeaderRow's column menu, whose right\n * edge lines up with the header cell's own right edge and grows leftward)\n * — clamps the box's actual left edge and returns an adjusted `rightEdgeX`\n * for that same `left` + `transform: translateX(-100%)` pairing.\n */\nexport function useAutoAdjustedRightLeft(menuRef, isOpen, rawRightEdgeLeft) {\n const [rightLeft, setRightLeft] = useState(null);\n\n useLayoutEffect(() => {\n setRightLeft(rawRightEdgeLeft ?? null);\n }, [rawRightEdgeLeft]);\n\n useLayoutEffect(() => {\n if (!isOpen || !menuRef.current || rightLeft == null) return;\n const rect = menuRef.current.getBoundingClientRect();\n const clampedEdge = clampLeftToViewport(rightLeft - rect.width, rect.width);\n const nextRightLeft = clampedEdge + rect.width;\n if (nextRightLeft !== rightLeft) setRightLeft(nextRightLeft);\n }, [isOpen, menuRef, rightLeft]);\n\n return rightLeft;\n}\n"],"names":["FOCUSABLE_SELECTOR","Modal","isOpen","onClose","title","size","variant","children","panelRef","useRef","previouslyFocusedRef","useEffect","handleKeyDown","event","panel","_a","_c","_b","isSheet","jsx","jsxs","MARGIN","clampLeftToViewport","left","width","maxLeft","clampTopToViewport","top","height","maxTop","convertBlockType","store","blockId","type","props","runIds","registry","block","index","targetUsesTitleRunIds","sourceUsesTitleRunIds","sourceHasChildren","targetCanHoldChildren","ops","childId","i","moveBlock","changeBlockType","updateBlockProps","setBlockContentIds","keepChildren","useHorizontalAutoAdjustedLeft","menuRef","rawLeft","setLeft","useState","useLayoutEffect","rect","clamped","useAutoAdjustedCenteredLeft","rawCenterLeft","centerLeft","setCenterLeft","half","nextCenter","useAutoAdjustedRightLeft","rawRightEdgeLeft","rightLeft","setRightLeft","nextRightLeft"],"mappings":"uGAEMA,EACJ,2EAgBK,SAASC,EAAM,CAAE,OAAAC,EAAQ,QAAAC,EAAS,MAAAC,EAAO,KAAAC,EAAO,UAAW,QAAAC,EAAU,SAAU,SAAAC,GAAY,CAChG,MAAMC,EAAWC,EAAAA,OAAO,IAAI,EACtBC,EAAuBD,EAAAA,OAAO,IAAI,EAwBxC,GAtBAE,EAAAA,UAAU,IAAM,CACd,GAAI,CAACT,EAAQ,OACb,MAAMU,EAAiBC,GAAU,CAC3BA,EAAM,MAAQ,UAAUV,EAAA,CAC9B,EACA,gBAAS,iBAAiB,UAAWS,CAAa,EAC3C,IAAM,SAAS,oBAAoB,UAAWA,CAAa,CACpE,EAAG,CAACV,EAAQC,CAAO,CAAC,EAEpBQ,EAAAA,UAAU,IAAM,WACd,GAAIT,EAAQ,CACVQ,EAAqB,QAAU,SAAS,cACxC,MAAMI,EAAQN,EAAS,SAEtBO,GADiBD,GAAA,YAAAA,EAAO,cAAcd,KACzBc,IAAb,MAAAC,EAAqB,QACtB,MACF,EACAC,GAAAC,EAAAP,EAAqB,UAArB,YAAAO,EAA8B,QAA9B,MAAAD,EAAA,KAAAC,GACAP,EAAqB,QAAU,IAEjC,EAAG,CAACR,CAAM,CAAC,EAEP,CAACA,EAAQ,OAAO,KACpB,MAAMgB,EAAUZ,IAAY,QAE5B,OACEa,EAAAA,IAAC,MAAA,CACC,UAAW,mBAAmBD,EAAU,0BAA4B,EAAE,GACtE,YAAcL,GAAU,CAClBA,EAAM,SAAWA,EAAM,eAAeV,EAAA,CAC5C,EAEA,SAAAiB,EAAAA,KAAC,MAAA,CACC,IAAKZ,EACL,UAAW,WAAWH,IAAS,QAAU,kBAAoB,EAAE,GAAGa,EAAU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,EAAG,CAAC9D,EAAQkD,EAASS,CAAU,CAAC,EAEzBA,CACT,CASO,SAASI,EAAyBb,EAASlD,EAAQgE,EAAkB,CAC1E,KAAM,CAACC,EAAWC,CAAY,EAAIb,EAAAA,SAAS,IAAI,EAE/CC,OAAAA,EAAAA,gBAAgB,IAAM,CACpBY,EAAaF,GAAoB,IAAI,CACvC,EAAG,CAACA,CAAgB,CAAC,EAErBV,EAAAA,gBAAgB,IAAM,CACpB,GAAI,CAACtD,GAAU,CAACkD,EAAQ,SAAWe,GAAa,KAAM,OACtD,MAAMV,EAAOL,EAAQ,QAAQ,sBAAqB,EAE5CiB,EADc/C,EAAoB6C,EAAYV,EAAK,MAAOA,EAAK,KAAK,EACtCA,EAAK,MACrCY,IAAkBF,GAAWC,EAAaC,CAAa,CAC7D,EAAG,CAACnE,EAAQkD,EAASe,CAAS,CAAC,EAExBA,CACT"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as v, jsxs as M } from "react/jsx-runtime";
2
2
  import { useRef as w, useEffect as E, useState as x, useLayoutEffect as p } from "react";
3
- import { m as T, i as b, j as R, s as B } from "./icons-C1_s0jKK.js";
3
+ import { m as T, i as b, j as R, s as B } from "./icons-D5Ctow8R.js";
4
4
  const y = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
5
5
  function j({ isOpen: t, onClose: e, title: o, size: n = "default", variant: s = "dialog", children: r }) {
6
6
  const c = w(null), u = w(null);
@@ -106,4 +106,4 @@ export {
106
106
  $ as e,
107
107
  U as u
108
108
  };
109
- //# sourceMappingURL=usePopoverEdgeClamp-gmFm0CnI.js.map
109
+ //# sourceMappingURL=usePopoverEdgeClamp-D_hB5t60.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePopoverEdgeClamp-gmFm0CnI.js","sources":["../../src/react/Modal.jsx","../../src/react/popoverPosition.js","../../src/blocks/shared/convertBlockType.js","../../src/react/usePopoverEdgeClamp.js"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nconst FOCUSABLE_SELECTOR =\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * Minimal, dependency-free modal dialog: a fixed backdrop + centered panel.\n * Closes on Escape or a click directly on the backdrop (not bubbled up from\n * inside the panel, which is why the backdrop's onMouseDown checks\n * `event.target === event.currentTarget`). No focus trap — the whole\n * editor package is deliberately zero-dependency, and dialogs here are\n * short, single-purpose forms, not deep navigable UI.\n *\n * Does move focus IN (to the first focusable element inside the panel, or\n * the panel itself as a fallback) on open, and OUT (back to whatever had\n * focus right before the modal opened — typically the button that opened\n * it) on close — distinct from a focus trap: it's a one-time move each\n * way, not a loop that prevents Tab from ever leaving the panel.\n */\nexport function Modal({ isOpen, onClose, title, size = 'default', variant = 'dialog', children }) {\n const panelRef = useRef(null);\n const previouslyFocusedRef = useRef(null);\n\n useEffect(() => {\n if (!isOpen) return undefined;\n const handleKeyDown = (event) => {\n if (event.key === 'Escape') onClose();\n };\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [isOpen, onClose]);\n\n useEffect(() => {\n if (isOpen) {\n previouslyFocusedRef.current = document.activeElement;\n const panel = panelRef.current;\n const focusable = panel?.querySelector(FOCUSABLE_SELECTOR);\n (focusable ?? panel)?.focus();\n return undefined;\n }\n previouslyFocusedRef.current?.focus?.();\n previouslyFocusedRef.current = null;\n return undefined;\n }, [isOpen]);\n\n if (!isOpen) return null;\n const isSheet = variant === 'sheet';\n\n return (\n <div\n className={`be-modal-overlay${isSheet ? ' be-modal-overlay-sheet' : ''}`}\n onMouseDown={(event) => {\n if (event.target === event.currentTarget) onClose();\n }}\n >\n <div\n ref={panelRef}\n className={`be-modal${size === 'large' ? ' be-modal-large' : ''}${isSheet ? ' be-modal-sheet' : ''}`}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={title}\n tabIndex={-1}\n >\n {title && <div className=\"be-modal-title\">{title}</div>}\n {children}\n </div>\n </div>\n );\n}\n","const MARGIN = 8;\n\n/**\n * Shifts `left`/`top` back inside the viewport (never past the opposite\n * edge either) for a box of the given size — the \"shift\" strategy antd's\n * `autoAdjustOverflow` uses, not a side-flip. Shared by every popover-\n * positioning hook in this file so the margin/clamp math lives in exactly\n * one place.\n */\nexport function clampLeftToViewport(left, width) {\n const maxLeft = Math.max(MARGIN, window.innerWidth - width - MARGIN);\n return Math.min(Math.max(left, MARGIN), maxLeft);\n}\n\nexport function clampTopToViewport(top, height) {\n const maxTop = Math.max(MARGIN, window.innerHeight - height - MARGIN);\n return Math.min(Math.max(top, MARGIN), maxTop);\n}\n","import {\n changeBlockType,\n moveBlock,\n setBlockContentIds,\n updateBlockProps,\n} from '../../store/operations.js';\n\n/**\n * Builds the ops that convert `blockId` to a different type IN PLACE — same\n * id, same parentId, same position among siblings — carrying over `runIds`\n * (reusing the existing Run objects — never recreated) rather than creating\n * new ones, so any marks/text already typed survive the conversion. `props`\n * may include `titleRunIds` (for a listItem-shaped target) — `runIds` is\n * threaded into whichever of contentIds/props.titleRunIds the target type\n * actually uses (and whichever the *source* type used, when detaching).\n *\n * Keeping the same id (rather than deleting the old block and inserting a\n * new one) matters beyond just simplicity: it's what lets a future\n * multi-peer merge treat two concurrent conversions of the same block as\n * one field-level conflict on that id (last-write-wins) instead of two\n * unrelated structural edits that would otherwise leave both resulting\n * blocks sitting side by side after merging.\n *\n * `registry` is optional and additive — this function's two original\n * callers (markdownShortcuts.js, applyVoiceAction.js) never pass one, and\n * only ever call this on a fresh, childless, single-run paragraph, so their\n * behavior is completely unaffected by anything below. When `registry` IS\n * supplied (the \"Turn into\" feature), the *source* block's own nested\n * children — real child blocks in `contentIds`, distinct from a leaf's own\n * runs, true for `listItem`/`toggleHeading`/`callout` (`!registry.isLeaf`)\n * — are handled instead of being silently orphaned:\n * - If the *target* type can also hold children (`!registry.isLeaf(type)`,\n * e.g. listItem -> toggleHeading), the children simply stay parented to\n * this same block id — nothing needs to move.\n * - If the target is a pure leaf (e.g. toggleHeading -> heading) and can't\n * hold them, they're promoted to sibling blocks inserted immediately\n * after this block instead — content is never silently dropped.\n *\n * Returns `{ ops, newBlockId }` rather than applying anything itself —\n * `newBlockId` is always `blockId` (kept for backward compatibility with\n * callers written when this returned a freshly generated id). The caller\n * folds `ops` into its own batch (e.g. alongside an `updateRun` that strips\n * a matched markdown-shortcut prefix from the first run), so the whole\n * thing is one atomic undo step.\n */\nexport function convertBlockType(store, blockId, type, props, runIds, registry) {\n const block = store.getBlock(blockId);\n const parent = store.getBlock(block.parentId);\n const index = parent.contentIds.indexOf(blockId);\n const targetUsesTitleRunIds = 'titleRunIds' in props;\n const sourceUsesTitleRunIds = 'titleRunIds' in (block.props ?? {});\n const sourceHasChildren = registry\n ? !registry.isLeaf(block.type) && block.contentIds.length > 0\n : false;\n const targetCanHoldChildren = registry ? !registry.isLeaf(type) : false;\n\n const ops = [];\n\n // Children only need to move when the target can't hold them (promoted\n // to siblings). When the target can also hold children, they're already\n // correctly parented to this same block id — nothing to do.\n if (sourceHasChildren && !targetCanHoldChildren) {\n block.contentIds.forEach((childId, i) =>\n ops.push(moveBlock(childId, block.parentId, index + 1 + i)),\n );\n }\n\n ops.push(changeBlockType(blockId, type, props));\n\n if (targetUsesTitleRunIds) {\n ops.push(updateBlockProps(blockId, { titleRunIds: runIds }));\n // A leaf source's old contentIds held its own runs, now superseded by\n // titleRunIds — clear it so those ids aren't misread as child blocks.\n // A container source that already used titleRunIds (or had its\n // children promoted to siblings above) already has the right\n // contentIds and needs no clearing.\n if (!sourceUsesTitleRunIds && !sourceHasChildren) {\n ops.push(setBlockContentIds(blockId, []));\n }\n } else {\n // Target keeps its own runs directly in contentIds. Any children still\n // sitting in contentIds at this point are ones the target can also\n // hold (handled above) and must be kept alongside the transferred\n // runIds, not replaced by them.\n const keepChildren = sourceHasChildren && targetCanHoldChildren ? block.contentIds : [];\n ops.push(setBlockContentIds(blockId, [...keepChildren, ...runIds]));\n }\n\n return { newBlockId: blockId, ops };\n}\n","import { useLayoutEffect, useState } from 'react';\nimport { clampLeftToViewport } from './popoverPosition.js';\n\n// All three hooks below share the exact two-phase shape\n// useAutoAdjustedPosition.js documents in full (snap to the raw anchor\n// first so nothing jumps, then measure + clamp once real layout exists,\n// both as useLayoutEffects so the whole chain settles before the browser\n// ever paints) — only the *anchor math* differs per popover's own CSS\n// convention, so each is kept as its own tiny hook rather than forcing one\n// generic shape to cover every transform variant.\n\n/**\n * For a popover that's LEFT-anchored (plain `left: <value>`, no transform)\n * but already owns its own vertical placement (Select/SlashMenu both flip\n * between `top`/`bottom` to dodge the on-screen keyboard) — this only ever\n * touches the horizontal axis, leaving the caller's vertical decision alone.\n */\nexport function useHorizontalAutoAdjustedLeft(menuRef, isOpen, rawLeft) {\n const [left, setLeft] = useState(null);\n\n useLayoutEffect(() => {\n setLeft(rawLeft ?? null);\n }, [rawLeft]);\n\n useLayoutEffect(() => {\n if (!isOpen || !menuRef.current || left == null) return;\n const rect = menuRef.current.getBoundingClientRect();\n const clamped = clampLeftToViewport(left, rect.width);\n if (clamped !== left) setLeft(clamped);\n }, [isOpen, menuRef, left]);\n\n return left;\n}\n\n/**\n * For a popover CENTERED on an x-coordinate via `left: <centerX>;\n * transform: translateX(-50%)` (FloatingToolbar's own bubble, centered over\n * the text selection it's formatting) — clamps the box's actual left/right\n * edges (accounting for the -50% shift) and returns an adjusted `centerX`\n * for that same `left` + `transform: translateX(-50%)` pairing, so the\n * caller's JSX doesn't need to change anything but the number.\n */\nexport function useAutoAdjustedCenteredLeft(menuRef, isOpen, rawCenterLeft) {\n const [centerLeft, setCenterLeft] = useState(null);\n\n useLayoutEffect(() => {\n setCenterLeft(rawCenterLeft ?? null);\n }, [rawCenterLeft]);\n\n useLayoutEffect(() => {\n if (!isOpen || !menuRef.current || centerLeft == null) return;\n const rect = menuRef.current.getBoundingClientRect();\n const half = rect.width / 2;\n const clampedEdge = clampLeftToViewport(centerLeft - half, rect.width);\n const nextCenter = clampedEdge + half;\n if (nextCenter !== centerLeft) setCenterLeft(nextCenter);\n }, [isOpen, menuRef, centerLeft]);\n\n return centerLeft;\n}\n\n/**\n * For a popover RIGHT-anchored on an x-coordinate via `left: <rightEdgeX>;\n * transform: translateX(-100%)` (TableHeaderRow's column menu, whose right\n * edge lines up with the header cell's own right edge and grows leftward)\n * — clamps the box's actual left edge and returns an adjusted `rightEdgeX`\n * for that same `left` + `transform: translateX(-100%)` pairing.\n */\nexport function useAutoAdjustedRightLeft(menuRef, isOpen, rawRightEdgeLeft) {\n const [rightLeft, setRightLeft] = useState(null);\n\n useLayoutEffect(() => {\n setRightLeft(rawRightEdgeLeft ?? null);\n }, [rawRightEdgeLeft]);\n\n useLayoutEffect(() => {\n if (!isOpen || !menuRef.current || rightLeft == null) return;\n const rect = menuRef.current.getBoundingClientRect();\n const clampedEdge = clampLeftToViewport(rightLeft - rect.width, rect.width);\n const nextRightLeft = clampedEdge + rect.width;\n if (nextRightLeft !== rightLeft) setRightLeft(nextRightLeft);\n }, [isOpen, menuRef, rightLeft]);\n\n return rightLeft;\n}\n"],"names":["FOCUSABLE_SELECTOR","Modal","isOpen","onClose","title","size","variant","children","panelRef","useRef","previouslyFocusedRef","useEffect","handleKeyDown","event","panel","_a","_c","_b","isSheet","jsx","jsxs","MARGIN","clampLeftToViewport","left","width","maxLeft","clampTopToViewport","top","height","maxTop","convertBlockType","store","blockId","type","props","runIds","registry","block","index","targetUsesTitleRunIds","sourceUsesTitleRunIds","sourceHasChildren","targetCanHoldChildren","ops","childId","i","moveBlock","changeBlockType","updateBlockProps","setBlockContentIds","keepChildren","useHorizontalAutoAdjustedLeft","menuRef","rawLeft","setLeft","useState","useLayoutEffect","rect","clamped","useAutoAdjustedCenteredLeft","rawCenterLeft","centerLeft","setCenterLeft","half","nextCenter","useAutoAdjustedRightLeft","rawRightEdgeLeft","rightLeft","setRightLeft","nextRightLeft"],"mappings":";;;AAEA,MAAMA,IACJ;AAgBK,SAASC,EAAM,EAAE,QAAAC,GAAQ,SAAAC,GAAS,OAAAC,GAAO,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,GAAkB;AAC1E,QAAM,CAACC,GAAWC,CAAY,IAAIb,EAAS,IAAI;AAE/C,SAAAC,EAAgB,MAAM;AACpB,IAAAY,EAAaF,KAAoB,IAAI;AAAA,EACvC,GAAG,CAACA,CAAgB,CAAC,GAErBV,EAAgB,MAAM;AACpB,QAAI,CAACtD,KAAU,CAACkD,EAAQ,WAAWe,KAAa,KAAM;AACtD,UAAMV,IAAOL,EAAQ,QAAQ,sBAAqB,GAE5CiB,IADc/C,EAAoB6C,IAAYV,EAAK,OAAOA,EAAK,KAAK,IACtCA,EAAK;AACzC,IAAIY,MAAkBF,KAAWC,EAAaC,CAAa;AAAA,EAC7D,GAAG,CAACnE,GAAQkD,GAASe,CAAS,CAAC,GAExBA;AACT;"}
1
+ {"version":3,"file":"usePopoverEdgeClamp-D_hB5t60.js","sources":["../../src/react/Modal.jsx","../../src/react/popoverPosition.js","../../src/blocks/shared/convertBlockType.js","../../src/react/usePopoverEdgeClamp.js"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nconst FOCUSABLE_SELECTOR =\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * Minimal, dependency-free modal dialog: a fixed backdrop + centered panel.\n * Closes on Escape or a click directly on the backdrop (not bubbled up from\n * inside the panel, which is why the backdrop's onMouseDown checks\n * `event.target === event.currentTarget`). No focus trap — the whole\n * editor package is deliberately zero-dependency, and dialogs here are\n * short, single-purpose forms, not deep navigable UI.\n *\n * Does move focus IN (to the first focusable element inside the panel, or\n * the panel itself as a fallback) on open, and OUT (back to whatever had\n * focus right before the modal opened — typically the button that opened\n * it) on close — distinct from a focus trap: it's a one-time move each\n * way, not a loop that prevents Tab from ever leaving the panel.\n */\nexport function Modal({ isOpen, onClose, title, size = 'default', variant = 'dialog', children }) {\n const panelRef = useRef(null);\n const previouslyFocusedRef = useRef(null);\n\n useEffect(() => {\n if (!isOpen) return undefined;\n const handleKeyDown = (event) => {\n if (event.key === 'Escape') onClose();\n };\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [isOpen, onClose]);\n\n useEffect(() => {\n if (isOpen) {\n previouslyFocusedRef.current = document.activeElement;\n const panel = panelRef.current;\n const focusable = panel?.querySelector(FOCUSABLE_SELECTOR);\n (focusable ?? panel)?.focus();\n return undefined;\n }\n previouslyFocusedRef.current?.focus?.();\n previouslyFocusedRef.current = null;\n return undefined;\n }, [isOpen]);\n\n if (!isOpen) return null;\n const isSheet = variant === 'sheet';\n\n return (\n <div\n className={`be-modal-overlay${isSheet ? ' be-modal-overlay-sheet' : ''}`}\n onMouseDown={(event) => {\n if (event.target === event.currentTarget) onClose();\n }}\n >\n <div\n ref={panelRef}\n className={`be-modal${size === 'large' ? ' be-modal-large' : ''}${isSheet ? ' be-modal-sheet' : ''}`}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={title}\n tabIndex={-1}\n >\n {title && <div className=\"be-modal-title\">{title}</div>}\n {children}\n </div>\n </div>\n );\n}\n","const MARGIN = 8;\n\n/**\n * Shifts `left`/`top` back inside the viewport (never past the opposite\n * edge either) for a box of the given size — the \"shift\" strategy antd's\n * `autoAdjustOverflow` uses, not a side-flip. Shared by every popover-\n * positioning hook in this file so the margin/clamp math lives in exactly\n * one place.\n */\nexport function clampLeftToViewport(left, width) {\n const maxLeft = Math.max(MARGIN, window.innerWidth - width - MARGIN);\n return Math.min(Math.max(left, MARGIN), maxLeft);\n}\n\nexport function clampTopToViewport(top, height) {\n const maxTop = Math.max(MARGIN, window.innerHeight - height - MARGIN);\n return Math.min(Math.max(top, MARGIN), maxTop);\n}\n","import {\n changeBlockType,\n moveBlock,\n setBlockContentIds,\n updateBlockProps,\n} from '../../store/operations.js';\n\n/**\n * Builds the ops that convert `blockId` to a different type IN PLACE — same\n * id, same parentId, same position among siblings — carrying over `runIds`\n * (reusing the existing Run objects — never recreated) rather than creating\n * new ones, so any marks/text already typed survive the conversion. `props`\n * may include `titleRunIds` (for a listItem-shaped target) — `runIds` is\n * threaded into whichever of contentIds/props.titleRunIds the target type\n * actually uses (and whichever the *source* type used, when detaching).\n *\n * Keeping the same id (rather than deleting the old block and inserting a\n * new one) matters beyond just simplicity: it's what lets a future\n * multi-peer merge treat two concurrent conversions of the same block as\n * one field-level conflict on that id (last-write-wins) instead of two\n * unrelated structural edits that would otherwise leave both resulting\n * blocks sitting side by side after merging.\n *\n * `registry` is optional and additive — this function's two original\n * callers (markdownShortcuts.js, applyVoiceAction.js) never pass one, and\n * only ever call this on a fresh, childless, single-run paragraph, so their\n * behavior is completely unaffected by anything below. When `registry` IS\n * supplied (the \"Turn into\" feature), the *source* block's own nested\n * children — real child blocks in `contentIds`, distinct from a leaf's own\n * runs, true for `listItem`/`toggleHeading`/`callout` (`!registry.isLeaf`)\n * — are handled instead of being silently orphaned:\n * - If the *target* type can also hold children (`!registry.isLeaf(type)`,\n * e.g. listItem -> toggleHeading), the children simply stay parented to\n * this same block id — nothing needs to move.\n * - If the target is a pure leaf (e.g. toggleHeading -> heading) and can't\n * hold them, they're promoted to sibling blocks inserted immediately\n * after this block instead — content is never silently dropped.\n *\n * Returns `{ ops, newBlockId }` rather than applying anything itself —\n * `newBlockId` is always `blockId` (kept for backward compatibility with\n * callers written when this returned a freshly generated id). The caller\n * folds `ops` into its own batch (e.g. alongside an `updateRun` that strips\n * a matched markdown-shortcut prefix from the first run), so the whole\n * thing is one atomic undo step.\n */\nexport function convertBlockType(store, blockId, type, props, runIds, registry) {\n const block = store.getBlock(blockId);\n const parent = store.getBlock(block.parentId);\n const index = parent.contentIds.indexOf(blockId);\n const targetUsesTitleRunIds = 'titleRunIds' in props;\n const sourceUsesTitleRunIds = 'titleRunIds' in (block.props ?? {});\n const sourceHasChildren = registry\n ? !registry.isLeaf(block.type) && block.contentIds.length > 0\n : false;\n const targetCanHoldChildren = registry ? !registry.isLeaf(type) : false;\n\n const ops = [];\n\n // Children only need to move when the target can't hold them (promoted\n // to siblings). When the target can also hold children, they're already\n // correctly parented to this same block id — nothing to do.\n if (sourceHasChildren && !targetCanHoldChildren) {\n block.contentIds.forEach((childId, i) =>\n ops.push(moveBlock(childId, block.parentId, index + 1 + i)),\n );\n }\n\n ops.push(changeBlockType(blockId, type, props));\n\n if (targetUsesTitleRunIds) {\n ops.push(updateBlockProps(blockId, { titleRunIds: runIds }));\n // A leaf source's old contentIds held its own runs, now superseded by\n // titleRunIds — clear it so those ids aren't misread as child blocks.\n // A container source that already used titleRunIds (or had its\n // children promoted to siblings above) already has the right\n // contentIds and needs no clearing.\n if (!sourceUsesTitleRunIds && !sourceHasChildren) {\n ops.push(setBlockContentIds(blockId, []));\n }\n } else {\n // Target keeps its own runs directly in contentIds. Any children still\n // sitting in contentIds at this point are ones the target can also\n // hold (handled above) and must be kept alongside the transferred\n // runIds, not replaced by them.\n const keepChildren = sourceHasChildren && targetCanHoldChildren ? block.contentIds : [];\n ops.push(setBlockContentIds(blockId, [...keepChildren, ...runIds]));\n }\n\n return { newBlockId: blockId, ops };\n}\n","import { useLayoutEffect, useState } from 'react';\nimport { clampLeftToViewport } from './popoverPosition.js';\n\n// All three hooks below share the exact two-phase shape\n// useAutoAdjustedPosition.js documents in full (snap to the raw anchor\n// first so nothing jumps, then measure + clamp once real layout exists,\n// both as useLayoutEffects so the whole chain settles before the browser\n// ever paints) — only the *anchor math* differs per popover's own CSS\n// convention, so each is kept as its own tiny hook rather than forcing one\n// generic shape to cover every transform variant.\n\n/**\n * For a popover that's LEFT-anchored (plain `left: <value>`, no transform)\n * but already owns its own vertical placement (Select/SlashMenu both flip\n * between `top`/`bottom` to dodge the on-screen keyboard) — this only ever\n * touches the horizontal axis, leaving the caller's vertical decision alone.\n */\nexport function useHorizontalAutoAdjustedLeft(menuRef, isOpen, rawLeft) {\n const [left, setLeft] = useState(null);\n\n useLayoutEffect(() => {\n setLeft(rawLeft ?? null);\n }, [rawLeft]);\n\n useLayoutEffect(() => {\n if (!isOpen || !menuRef.current || left == null) return;\n const rect = menuRef.current.getBoundingClientRect();\n const clamped = clampLeftToViewport(left, rect.width);\n if (clamped !== left) setLeft(clamped);\n }, [isOpen, menuRef, left]);\n\n return left;\n}\n\n/**\n * For a popover CENTERED on an x-coordinate via `left: <centerX>;\n * transform: translateX(-50%)` (FloatingToolbar's own bubble, centered over\n * the text selection it's formatting) — clamps the box's actual left/right\n * edges (accounting for the -50% shift) and returns an adjusted `centerX`\n * for that same `left` + `transform: translateX(-50%)` pairing, so the\n * caller's JSX doesn't need to change anything but the number.\n */\nexport function useAutoAdjustedCenteredLeft(menuRef, isOpen, rawCenterLeft) {\n const [centerLeft, setCenterLeft] = useState(null);\n\n useLayoutEffect(() => {\n setCenterLeft(rawCenterLeft ?? null);\n }, [rawCenterLeft]);\n\n useLayoutEffect(() => {\n if (!isOpen || !menuRef.current || centerLeft == null) return;\n const rect = menuRef.current.getBoundingClientRect();\n const half = rect.width / 2;\n const clampedEdge = clampLeftToViewport(centerLeft - half, rect.width);\n const nextCenter = clampedEdge + half;\n if (nextCenter !== centerLeft) setCenterLeft(nextCenter);\n }, [isOpen, menuRef, centerLeft]);\n\n return centerLeft;\n}\n\n/**\n * For a popover RIGHT-anchored on an x-coordinate via `left: <rightEdgeX>;\n * transform: translateX(-100%)` (TableHeaderRow's column menu, whose right\n * edge lines up with the header cell's own right edge and grows leftward)\n * — clamps the box's actual left edge and returns an adjusted `rightEdgeX`\n * for that same `left` + `transform: translateX(-100%)` pairing.\n */\nexport function useAutoAdjustedRightLeft(menuRef, isOpen, rawRightEdgeLeft) {\n const [rightLeft, setRightLeft] = useState(null);\n\n useLayoutEffect(() => {\n setRightLeft(rawRightEdgeLeft ?? null);\n }, [rawRightEdgeLeft]);\n\n useLayoutEffect(() => {\n if (!isOpen || !menuRef.current || rightLeft == null) return;\n const rect = menuRef.current.getBoundingClientRect();\n const clampedEdge = clampLeftToViewport(rightLeft - rect.width, rect.width);\n const nextRightLeft = clampedEdge + rect.width;\n if (nextRightLeft !== rightLeft) setRightLeft(nextRightLeft);\n }, [isOpen, menuRef, rightLeft]);\n\n return rightLeft;\n}\n"],"names":["FOCUSABLE_SELECTOR","Modal","isOpen","onClose","title","size","variant","children","panelRef","useRef","previouslyFocusedRef","useEffect","handleKeyDown","event","panel","_a","_c","_b","isSheet","jsx","jsxs","MARGIN","clampLeftToViewport","left","width","maxLeft","clampTopToViewport","top","height","maxTop","convertBlockType","store","blockId","type","props","runIds","registry","block","index","targetUsesTitleRunIds","sourceUsesTitleRunIds","sourceHasChildren","targetCanHoldChildren","ops","childId","i","moveBlock","changeBlockType","updateBlockProps","setBlockContentIds","keepChildren","useHorizontalAutoAdjustedLeft","menuRef","rawLeft","setLeft","useState","useLayoutEffect","rect","clamped","useAutoAdjustedCenteredLeft","rawCenterLeft","centerLeft","setCenterLeft","half","nextCenter","useAutoAdjustedRightLeft","rawRightEdgeLeft","rightLeft","setRightLeft","nextRightLeft"],"mappings":";;;AAEA,MAAMA,IACJ;AAgBK,SAASC,EAAM,EAAE,QAAAC,GAAQ,SAAAC,GAAS,OAAAC,GAAO,MAAAC,IAAO,WAAW,SAAAC,IAAU,UAAU,UAAAC,KAAY;AAChG,QAAMC,IAAWC,EAAO,IAAI,GACtBC,IAAuBD,EAAO,IAAI;AAwBxC,MAtBAE,EAAU,MAAM;AACd,QAAI,CAACT,EAAQ;AACb,UAAMU,IAAgB,CAACC,MAAU;AAC/B,MAAIA,EAAM,QAAQ,YAAUV,EAAA;AAAA,IAC9B;AACA,oBAAS,iBAAiB,WAAWS,CAAa,GAC3C,MAAM,SAAS,oBAAoB,WAAWA,CAAa;AAAA,EACpE,GAAG,CAACV,GAAQC,CAAO,CAAC,GAEpBQ,EAAU,MAAM;;AACd,QAAIT,GAAQ;AACV,MAAAQ,EAAqB,UAAU,SAAS;AACxC,YAAMI,IAAQN,EAAS;AAEvB,OAACO,KADiBD,KAAA,gBAAAA,EAAO,cAAcd,OACzBc,MAAb,QAAAC,EAAqB;AACtB;AAAA,IACF;AACA,KAAAC,KAAAC,IAAAP,EAAq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nC,KAAM+B,EAAQI,CAAO;AAAA,EACvC,GAAG,CAACxD,GAAQkD,GAAS7B,CAAI,CAAC,GAEnBA;AACT;AAUO,SAASoC,EAA4BP,GAASlD,GAAQ0D,GAAe;AAC1E,QAAM,CAACC,GAAYC,CAAa,IAAIP,EAAS,IAAI;AAEjD,SAAAC,EAAgB,MAAM;AACpB,IAAAM,EAAcF,KAAiB,IAAI;AAAA,EACrC,GAAG,CAACA,CAAa,CAAC,GAElBJ,EAAgB,MAAM;AACpB,QAAI,CAACtD,KAAU,CAACkD,EAAQ,WAAWS,KAAc,KAAM;AACvD,UAAMJ,IAAOL,EAAQ,QAAQ,sBAAqB,GAC5CW,IAAON,EAAK,QAAQ,GAEpBO,IADc1C,EAAoBuC,IAAaE,GAAMN,EAAK,KAAK,IACpCM;AACjC,IAAIC,MAAeH,KAAYC,EAAcE,CAAU;AAAA,EACzD,GAAG,CAAC9D,GAAQkD,GAASS,CAAU,CAAC,GAEzBA;AACT;AASO,SAASI,EAAyBb,GAASlD,GAAQgE,GAAkB;AAC1E,QAAM,CAACC,GAAWC,CAAY,IAAIb,EAAS,IAAI;AAE/C,SAAAC,EAAgB,MAAM;AACpB,IAAAY,EAAaF,KAAoB,IAAI;AAAA,EACvC,GAAG,CAACA,CAAgB,CAAC,GAErBV,EAAgB,MAAM;AACpB,QAAI,CAACtD,KAAU,CAACkD,EAAQ,WAAWe,KAAa,KAAM;AACtD,UAAMV,IAAOL,EAAQ,QAAQ,sBAAqB,GAE5CiB,IADc/C,EAAoB6C,IAAYV,EAAK,OAAOA,EAAK,KAAK,IACtCA,EAAK;AACzC,IAAIY,MAAkBF,KAAWC,EAAaC,CAAa;AAAA,EAC7D,GAAG,CAACnE,GAAQkD,GAASe,CAAS,CAAC,GAExBA;AACT;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./shared/index-D9WEXpYM.cjs"),i=require("./shared/starter-kit-lPN-NpJ5.cjs");exports.defineBlock=e.defineBlock;exports.defineExtension=e.defineExtension;exports.defineInline=e.defineInline;exports.registerExtensions=e.registerExtensions;exports.starterKit=i.starterKit;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./shared/index-CbIBsFmI.cjs"),i=require("./shared/starter-kit-DyX1U84W.cjs");exports.defineBlock=e.defineBlock;exports.defineExtension=e.defineExtension;exports.defineInline=e.defineInline;exports.registerExtensions=e.registerExtensions;exports.starterKit=i.starterKit;
2
2
  //# sourceMappingURL=starter-kit.cjs.map
@@ -1,5 +1,5 @@
1
- import { b as n, d as a, e as i, a as r } from "./shared/index-B9jyyL8u.js";
2
- import { am as o } from "./shared/starter-kit-CY5wzYDf.js";
1
+ import { b as n, d as a, e as i, a as r } from "./shared/index-D_8hJpI7.js";
2
+ import { am as o } from "./shared/starter-kit-mfeNxqFn.js";
3
3
  export {
4
4
  n as defineBlock,
5
5
  a as defineExtension,
package/dist/versions.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./shared/VersionHistory-DELa2Wbq.cjs"),o=require("./shared/indexedDbPersistence-BWJ1h5Vp.cjs");exports.VersionHistory=e.VersionHistory;exports.createAutoVersionHistory=e.createAutoVersionHistory;exports.diffDocumentsHTML=e.diffDocumentsHTML;exports.useDocumentVersions=e.useDocumentVersions;exports.deleteDocumentVersion=o.deleteDocumentVersion;exports.listDocumentVersions=o.listDocumentVersions;exports.loadDocumentVersion=o.loadDocumentVersion;exports.saveDocumentVersion=o.saveDocumentVersion;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./shared/VersionHistory-DuSxis_7.cjs"),o=require("./shared/indexedDbPersistence-BWJ1h5Vp.cjs");exports.VersionHistory=e.VersionHistory;exports.createAutoVersionHistory=e.createAutoVersionHistory;exports.diffDocumentsHTML=e.diffDocumentsHTML;exports.useDocumentVersions=e.useDocumentVersions;exports.deleteDocumentVersion=o.deleteDocumentVersion;exports.listDocumentVersions=o.listDocumentVersions;exports.loadDocumentVersion=o.loadDocumentVersion;exports.saveDocumentVersion=o.saveDocumentVersion;
2
2
  //# sourceMappingURL=versions.cjs.map
package/dist/versions.js CHANGED
@@ -1,4 +1,4 @@
1
- import { V as o, c as r, d as t, u as n } from "./shared/VersionHistory-Bg6fufP5.js";
1
+ import { V as o, c as r, d as t, u as n } from "./shared/VersionHistory-DhYb8C2e.js";
2
2
  import { b as i, c, e as u, f as m } from "./shared/indexedDbPersistence-BKlGPFTP.js";
3
3
  export {
4
4
  o as VersionHistory,
package/dist/voice.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./shared/VoiceListeningIndicator-DNX8JlQM.cjs");exports.VoiceListeningIndicator=i.VoiceListeningIndicator;exports.VoicePermissionModal=i.VoicePermissionModal;exports.listVoiceCommands=i.listVoiceCommands;exports.useVoiceTyping=i.useVoiceTyping;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./shared/VoiceListeningIndicator-BXByLZwO.cjs");exports.VoiceListeningIndicator=i.VoiceListeningIndicator;exports.VoicePermissionModal=i.VoicePermissionModal;exports.listVoiceCommands=i.listVoiceCommands;exports.useVoiceTyping=i.useVoiceTyping;
2
2
  //# sourceMappingURL=voice.cjs.map
package/dist/voice.js CHANGED
@@ -1,4 +1,4 @@
1
- import { V as s, a, l as e, u as n } from "./shared/VoiceListeningIndicator-BOfVmLK0.js";
1
+ import { V as s, a, l as e, u as n } from "./shared/VoiceListeningIndicator-bv285FSY.js";
2
2
  export {
3
3
  s as VoiceListeningIndicator,
4
4
  a as VoicePermissionModal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noteloom",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Zero-runtime-dependency, React-first block/rich-text editor — nestable content blocks, inline widgets, slash commands, undo/redo, clipboard, real-time collaborative editing (a custom CRDT over WebRTC), offline-first persistence (IndexedDB + PWA-ready), and live presence, with an optional default theme (noteloom/style.css).",
5
5
  "keywords": [
6
6
  "react",