@damiro/stylo 0.10.1 → 0.12.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 (46) hide show
  1. package/README.md +15 -3
  2. package/dist/{InPlaceView-CkbMemAa.js → InPlaceView-BWc06Jso.js} +491 -486
  3. package/dist/InPlaceView-BWc06Jso.js.map +1 -0
  4. package/dist/{Preview-AaGGwLQP.js → Preview-DIsFdBFA.js} +3 -3
  5. package/dist/{Preview-AaGGwLQP.js.map → Preview-DIsFdBFA.js.map} +1 -1
  6. package/dist/SplitView.d.ts +8 -2
  7. package/dist/SplitView.d.ts.map +1 -1
  8. package/dist/Stylo.d.ts.map +1 -1
  9. package/dist/editor/SourceView.d.ts +10 -3
  10. package/dist/editor/SourceView.d.ts.map +1 -1
  11. package/dist/editor/canvas-header-panel.d.ts +27 -0
  12. package/dist/editor/canvas-header-panel.d.ts.map +1 -0
  13. package/dist/editor/extensions.d.ts +2 -2
  14. package/dist/editor/extensions.d.ts.map +1 -1
  15. package/dist/editor/tag-complete.d.ts +16 -0
  16. package/dist/editor/tag-complete.d.ts.map +1 -0
  17. package/dist/editor/useCodeMirror.d.ts +8 -3
  18. package/dist/editor/useCodeMirror.d.ts.map +1 -1
  19. package/dist/{embed-B2Dfkpd_.js → embed-Dsu6b-MV.js} +16 -9
  20. package/dist/embed-Dsu6b-MV.js.map +1 -0
  21. package/dist/frontmatter-DTCC0gaa.js +40 -0
  22. package/dist/frontmatter-DTCC0gaa.js.map +1 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/inplace/InPlaceView.d.ts +10 -3
  26. package/dist/inplace/InPlaceView.d.ts.map +1 -1
  27. package/dist/inplace/table-widget.d.ts +10 -5
  28. package/dist/inplace/table-widget.d.ts.map +1 -1
  29. package/dist/inplace/theme-canvas.d.ts +7 -1
  30. package/dist/inplace/theme-canvas.d.ts.map +1 -1
  31. package/dist/render/Embed.d.ts.map +1 -1
  32. package/dist/styles.css +1 -1
  33. package/dist/stylo.js +200 -168
  34. package/dist/stylo.js.map +1 -1
  35. package/dist/toolbar/Toolbar.d.ts.map +1 -1
  36. package/dist/toolbar/commands.d.ts.map +1 -1
  37. package/dist/types.d.ts +38 -6
  38. package/dist/types.d.ts.map +1 -1
  39. package/dist/{useCodeMirror-CpE_Ncfn.js → useCodeMirror-BI1kEPRE.js} +402 -334
  40. package/dist/useCodeMirror-BI1kEPRE.js.map +1 -0
  41. package/package.json +1 -1
  42. package/dist/InPlaceView-CkbMemAa.js.map +0 -1
  43. package/dist/embed-B2Dfkpd_.js.map +0 -1
  44. package/dist/frontmatter-DGUkb9z-.js +0 -39
  45. package/dist/frontmatter-DGUkb9z-.js.map +0 -1
  46. package/dist/useCodeMirror-CpE_Ncfn.js.map +0 -1
package/dist/styles.css CHANGED
@@ -1,2 +1,2 @@
1
- ._root_1y1lh_1{min-height:0;color:var(--stylo-text);background:var(--stylo-bg);border:1px solid var(--stylo-border);border-radius:var(--stylo-radius);flex-direction:column;display:flex;overflow:hidden}._root_1y1lh_1 .cm-scroller{scrollbar-width:thin;scrollbar-color:color-mix(in srgb, var(--stylo-border) 90%, transparent) transparent}._root_1y1lh_1 .cm-scroller::-webkit-scrollbar{width:10px;height:10px}._root_1y1lh_1 .cm-scroller::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--stylo-border) 90%, transparent);background-clip:padding-box;border:3px solid #0000;border-radius:6px}._root_1y1lh_1 .cm-scroller::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb, var(--stylo-text-muted) 55%, transparent);background-clip:padding-box}._root_1y1lh_1 .cm-scroller::-webkit-scrollbar-corner{background:0 0}._source_1y1lh_42{flex:auto;min-height:0;overflow:auto}._source_1y1lh_42 .cm-editor{height:100%}._source_1y1lh_42 .cm-editor.cm-focused{outline:2px solid var(--stylo-ring);outline-offset:-2px}._inplace_1y1lh_57{flex:auto;min-height:0;overflow:auto}._toolbar_1y1lh_63{background:var(--stylo-bg);border-bottom:1px solid var(--stylo-border);flex-wrap:wrap;align-items:center;gap:2px;padding:4px 6px;display:flex}._toolbarButton_1y1lh_73{box-sizing:border-box;border-radius:calc(var(--stylo-radius) - 3px);min-width:28px;height:28px;color:var(--stylo-text-muted);font:inherit;cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;padding:0 5px;font-size:.75rem;font-weight:600;line-height:1;display:inline-flex}._toolbarButton_1y1lh_73:hover:not(:disabled){background:color-mix(in srgb, var(--stylo-border) 45%, transparent);color:var(--stylo-text)}._toolbarButton_1y1lh_73[data-active]{background:color-mix(in srgb, var(--stylo-accent) 12%, transparent);color:var(--stylo-text)}._toolbarButton_1y1lh_73:disabled{opacity:.4;cursor:default}._toolbarButton_1y1lh_73:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-2px}._toolbarButton_1y1lh_73 svg{width:16px;height:16px;display:block}._toolbarButton_1y1lh_73 code{font-family:var(--stylo-font-family-mono,ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-size:.8125rem;font-weight:500}._toolbarSep_1y1lh_132{background:var(--stylo-border);align-self:stretch;width:1px;margin:4px 3px}._toolbarSticky_1y1lh_142{z-index:50;-webkit-overflow-scrolling:touch;scrollbar-width:none;font-family:var(--stylo-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);flex-wrap:nowrap;transition:opacity .15s;overflow-x:auto}._toolbarSticky_1y1lh_142::-webkit-scrollbar{display:none}._toolbarSticky_1y1lh_142 ._toolbarButton_1y1lh_73{flex:none;min-width:40px;height:40px}._toolbarStickyBottom_1y1lh_142{border-bottom:none;border-top:1px solid var(--stylo-border);box-shadow:0 -2px 8px color-mix(in srgb, var(--stylo-text) 10%, transparent);position:fixed;bottom:0;left:0;right:0}._toolbarStickyTop_1y1lh_142{box-shadow:0 2px 8px color-mix(in srgb, var(--stylo-text) 10%, transparent);position:fixed;top:0;left:0;right:0}._toolbarStickyHidden_1y1lh_211{opacity:0;pointer-events:none}._stickyToolbarRootBottom_1y1lh_222 ._source_1y1lh_42,._stickyToolbarRootBottom_1y1lh_222 ._inplace_1y1lh_57{padding-bottom:52px}._stickyToolbarRootTop_1y1lh_227 ._source_1y1lh_42,._stickyToolbarRootTop_1y1lh_227 ._inplace_1y1lh_57{padding-top:52px}._inplace_1y1lh_57 .cm-editor{height:100%}._inplace_1y1lh_57 .cm-editor.cm-focused{outline:2px solid var(--stylo-ring);outline-offset:-2px}._split_1y1lh_241{flex:1;grid-template-columns:1fr 1fr;min-height:0;display:grid}._splitPane_1y1lh_248{box-sizing:border-box;flex-direction:column;min-height:0;display:flex;overflow:auto}._splitPane_1y1lh_248+._splitPane_1y1lh_248{border-left:1px solid var(--stylo-border)}._splitPane_1y1lh_248>._source_1y1lh_42{flex:1;min-height:0}._preview_1y1lh_268{overflow-wrap:break-word;padding:.75rem 1rem;font-size:.9375rem;line-height:1.75}._preview_1y1lh_268>:first-child{margin-top:0}._preview_1y1lh_268>:last-child{margin-bottom:0}._preview_1y1lh_268 :is(h1,h2,h3,h4,h5,h6){font-weight:600}._preview_1y1lh_268 h1{margin:0 0 .888889em;font-size:2.25em;line-height:1.11111}._preview_1y1lh_268 h2{margin:2em 0 1em;font-size:1.5em;line-height:1.33333}._preview_1y1lh_268 h3{margin:1.6em 0 .6em;font-size:1.25em;line-height:1.6}._preview_1y1lh_268 :is(h4,h5,h6){margin:1.5em 0 .5em;line-height:1.5}._preview_1y1lh_268 p{margin:1.25em 0}._preview_1y1lh_268 :is(ul,ol){margin:1.25em 0;padding-left:1.625em}._preview_1y1lh_268 li{margin:.5em 0}._preview_1y1lh_268 li>:is(ul,ol){margin:.75em 0}._preview_1y1lh_268 a{color:var(--stylo-link);text-decoration:none}._preview_1y1lh_268 code{font-family:var(--stylo-font-family-mono,ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);border-radius:calc(var(--stylo-radius) - 3px);background:color-mix(in srgb, var(--stylo-border) 45%, transparent);padding:.1em .35em;font-size:.9em}._preview_1y1lh_268 pre{border-radius:var(--stylo-radius);background:color-mix(in srgb, var(--stylo-border) 35%, transparent);margin:1.71429em 0;padding:.75rem .9rem;overflow-x:auto}._preview_1y1lh_268 pre code{background:0 0;padding:0;font-size:.85em}.stylo-frontmatter{border-left:3px solid var(--stylo-border);border-radius:calc(var(--stylo-radius) - 3px);background:color-mix(in srgb, var(--stylo-border) 22%, transparent);color:var(--stylo-text-muted);font-family:var(--stylo-font-family-mono,ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);white-space:pre-wrap;margin:0 0 1.2em;padding:.7rem .9rem;font-size:.8125rem;line-height:1.5;overflow-x:auto}.stylo-frontmatter:before{content:"Frontmatter";font-family:var(--stylo-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);letter-spacing:.04em;text-transform:uppercase;margin-bottom:.5em;font-size:.7rem;font-weight:600;display:block}._preview_1y1lh_268 blockquote{border-left:.25rem solid var(--stylo-border);color:var(--stylo-text-muted);margin:1.6em 0;padding-left:1em}._preview_1y1lh_268 .stylo-callout{border-left:.25rem solid var(--stylo-callout-accent,var(--stylo-border));border-radius:var(--stylo-radius);background:color-mix(in srgb, var(--stylo-callout-accent,var(--stylo-border)) 10%, transparent);color:var(--stylo-text);margin:1.6em 0;padding:.6em 1em}._preview_1y1lh_268 .stylo-callout:before{content:attr(data-callout);letter-spacing:.04em;text-transform:uppercase;color:var(--stylo-callout-accent,var(--stylo-text-muted));margin-bottom:.2em;font-size:.8em;font-weight:700;display:block}._preview_1y1lh_268 .stylo-callout-note{--stylo-callout-accent:var(--stylo-callout-note,#3b82f6)}._preview_1y1lh_268 .stylo-callout-tip{--stylo-callout-accent:var(--stylo-callout-tip,#22c55e)}._preview_1y1lh_268 .stylo-callout-warn{--stylo-callout-accent:var(--stylo-callout-warn,#f59e0b)}._preview_1y1lh_268 .stylo-callout-danger{--stylo-callout-accent:var(--stylo-callout-danger,#ef4444)}._preview_1y1lh_268 .stylo-callout-example{--stylo-callout-accent:var(--stylo-callout-example,#a855f7)}._preview_1y1lh_268 .stylo-embed{border-left:.25rem solid var(--stylo-embed-accent,var(--stylo-border));margin:1.6em 0;padding-left:1em}._preview_1y1lh_268 .stylo-embed-content>:first-child{margin-top:0}._preview_1y1lh_268 .stylo-embed-content>:last-child{margin-bottom:0}._preview_1y1lh_268 table{border-collapse:collapse;margin:2em 0;display:block;overflow-x:auto}._preview_1y1lh_268 :is(th,td){border:1px solid var(--stylo-table-border);text-align:left;padding:.35em .6em}._preview_1y1lh_268 thead th{background:var(--stylo-table-header-bg);font-weight:600}._preview_1y1lh_268 tbody tr:nth-child(2n) td{background:var(--stylo-table-stripe-bg)}._preview_1y1lh_268 hr{border:none;border-top:1px solid var(--stylo-border);margin:1em 0}._preview_1y1lh_268 .katex-display{padding:.25em 0;overflow:auto hidden}.stylo{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--stylo-bg:#fff;--stylo-surface-floating:#fff;--stylo-text:#09090b;--stylo-text-muted:#71717a;--stylo-border:#e4e4e7;--stylo-accent:#18181b;--stylo-link:#2563eb;--stylo-ring:#a1a1aa;--stylo-radius:.5rem;--stylo-font-size:.9375rem;--stylo-font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--stylo-font-family-mono:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--stylo-table-border:var(--stylo-border);--stylo-table-header-bg:color-mix(in srgb, var(--stylo-border) 30%, transparent);--stylo-table-stripe-bg:transparent;--stylo-guide:var(--stylo-border);--stylo-syntax-keyword:#7c3aed;--stylo-syntax-string:#0a7c2f;--stylo-syntax-escape:#b45309;--stylo-syntax-comment:#8a8f98;--stylo-syntax-number:#b45309;--stylo-syntax-constant:#b45309;--stylo-syntax-function:#2563eb;--stylo-syntax-type:#a16207;--stylo-syntax-property:#0f766e;--stylo-syntax-tag:#cf222e;--stylo-syntax-invalid:#dc2626}:where(.dark,[data-theme=dark]) .stylo,.stylo:where(.dark,[data-theme=dark]){--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--stylo-bg:#09090b;--stylo-surface-floating:#09090b;--stylo-text:#fafafa;--stylo-text-muted:#a1a1aa;--stylo-border:#27272a;--stylo-accent:#fafafa;--stylo-link:#60a5fa;--stylo-ring:#52525b;--stylo-syntax-keyword:#c678dd;--stylo-syntax-string:#98c379;--stylo-syntax-escape:#d19a66;--stylo-syntax-comment:#7f848e;--stylo-syntax-number:#d19a66;--stylo-syntax-constant:#d19a66;--stylo-syntax-function:#61afef;--stylo-syntax-type:#e5c07b;--stylo-syntax-property:#56b6c2;--stylo-syntax-tag:#e06c75;--stylo-syntax-invalid:#e06c75}._root_18hcd_3{color:var(--stylo-text);font:inherit;grid-template-columns:1fr 1fr;gap:12px;display:grid}@media (width<=460px){._root_18hcd_3{grid-template-columns:1fr}}._col_18hcd_17{border:1px solid var(--stylo-border);border-radius:var(--stylo-radius);background:var(--stylo-bg);flex-direction:column;min-width:0;display:flex}._colHead_18hcd_26{border-bottom:1px solid var(--stylo-border);letter-spacing:.04em;text-transform:uppercase;color:var(--stylo-text-muted);margin:0;padding:8px 12px;font-size:.75rem;font-weight:600}._list_18hcd_37{flex-direction:column;flex:1;gap:2px;margin:0;padding:4px;list-style:none;display:flex}._row_18hcd_47{border-radius:calc(var(--stylo-radius) - 3px);background:var(--stylo-bg);align-items:center;gap:8px;padding:5px 6px;display:flex}._row_18hcd_47:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-2px}._row_18hcd_47:hover{background:color-mix(in srgb, var(--stylo-border) 30%, transparent)}._row_18hcd_47[data-dragging]{background:var(--stylo-surface-floating,#fff);opacity:.9;box-shadow:0 4px 16px #00000024}._handle_18hcd_73{border-radius:calc(var(--stylo-radius) - 4px);width:20px;height:22px;color:var(--stylo-text-muted);font:inherit;cursor:grab;touch-action:none;background:0 0;border:1px solid #0000;flex:none;justify-content:center;align-items:center;padding:0;line-height:1;display:inline-flex}._handle_18hcd_73:hover{background:color-mix(in srgb, var(--stylo-border) 45%, transparent);color:var(--stylo-text)}._handle_18hcd_73:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-1px}._handle_18hcd_73:active{cursor:grabbing}._glyph_18hcd_105{width:18px;height:18px;color:var(--stylo-text-muted);flex:none;justify-content:center;align-items:center;display:inline-flex}._glyph_18hcd_105 svg{width:16px;height:16px;display:block}._label_18hcd_121{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:.8125rem;overflow:hidden}._rowActions_18hcd_130{flex:none;gap:2px;display:flex}._iconButton_18hcd_136,._textButton_18hcd_137{box-sizing:border-box;border-radius:calc(var(--stylo-radius) - 4px);color:var(--stylo-text-muted);font:inherit;cursor:pointer;background:0 0;border:1px solid #0000}._iconButton_18hcd_136{width:22px;height:22px;font-size:.8125rem;line-height:1}._textButton_18hcd_137{padding:3px 8px;font-size:.75rem}._iconButton_18hcd_136:hover:not(:disabled),._textButton_18hcd_137:hover:not(:disabled){background:color-mix(in srgb, var(--stylo-border) 45%, transparent);color:var(--stylo-text)}._iconButton_18hcd_136:focus-visible,._textButton_18hcd_137:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-1px}._iconButton_18hcd_136:disabled{opacity:.35;cursor:default}._footer_18hcd_176{border-top:1px solid var(--stylo-border);flex-wrap:wrap;gap:6px;padding:6px;display:flex}._empty_18hcd_184{color:var(--stylo-text-muted);padding:8px 6px;font-size:.8125rem}._srOnly_18hcd_190{clip:rect(0 0 0 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}
1
+ ._root_1lohh_1{min-height:0;color:var(--stylo-text);background:var(--stylo-bg);border:1px solid var(--stylo-border);border-radius:var(--stylo-radius);flex-direction:column;display:flex;overflow:hidden}._root_1lohh_1 .cm-scroller{scrollbar-width:thin;scrollbar-color:color-mix(in srgb, var(--stylo-border) 90%, transparent) transparent}._root_1lohh_1 .cm-scroller::-webkit-scrollbar{width:10px;height:10px}._root_1lohh_1 .cm-scroller::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--stylo-border) 90%, transparent);background-clip:padding-box;border:3px solid #0000;border-radius:6px}._root_1lohh_1 .cm-scroller::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb, var(--stylo-text-muted) 55%, transparent);background-clip:padding-box}._root_1lohh_1 .cm-scroller::-webkit-scrollbar-corner{background:0 0}._source_1lohh_42{flex:auto;min-height:0;overflow:auto}._source_1lohh_42 .cm-editor{height:100%}._source_1lohh_42 .cm-editor.cm-focused{outline:2px solid var(--stylo-ring);outline-offset:-2px}._inplace_1lohh_57{flex:auto;min-height:0;overflow:auto}._toolbar_1lohh_63{background:var(--stylo-bg);border-bottom:1px solid var(--stylo-border);flex-wrap:wrap;align-items:center;gap:2px;padding:4px 6px;display:flex}._toolbarGroup_1lohh_75{align-items:center;gap:2px;display:flex}._toolbarButton_1lohh_81{box-sizing:border-box;border-radius:calc(var(--stylo-radius) - 3px);min-width:28px;height:28px;color:var(--stylo-text-muted);font:inherit;cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;padding:0 5px;font-size:.75rem;font-weight:600;line-height:1;display:inline-flex}._toolbarButton_1lohh_81:hover:not(:disabled){background:color-mix(in srgb, var(--stylo-border) 45%, transparent);color:var(--stylo-text)}._toolbarButton_1lohh_81[data-active]{background:color-mix(in srgb, var(--stylo-accent) 12%, transparent);color:var(--stylo-text)}._toolbarButton_1lohh_81:disabled{opacity:.4;cursor:default}._toolbarButton_1lohh_81:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-2px}._toolbarButton_1lohh_81 svg{width:16px;height:16px;display:block}._toolbarButton_1lohh_81 code{font-family:var(--stylo-font-family-mono,ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);font-size:.8125rem;font-weight:500}._toolbarSep_1lohh_140{background:var(--stylo-border);align-self:stretch;width:1px;margin:4px 3px}._toolbarSticky_1lohh_150{z-index:50;-webkit-overflow-scrolling:touch;scrollbar-width:none;font-family:var(--stylo-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);flex-wrap:nowrap;transition:opacity .15s;overflow-x:auto}._toolbarSticky_1lohh_150::-webkit-scrollbar{display:none}._toolbarSticky_1lohh_150 ._toolbarButton_1lohh_81{flex:none;min-width:40px;height:40px}._toolbarStickyBottom_1lohh_150{border-bottom:none;border-top:1px solid var(--stylo-border);box-shadow:0 -2px 8px color-mix(in srgb, var(--stylo-text) 10%, transparent);position:fixed;bottom:0;left:0;right:0}._toolbarStickyTop_1lohh_150{box-shadow:0 2px 8px color-mix(in srgb, var(--stylo-text) 10%, transparent);position:fixed;top:0;left:0;right:0}._toolbarStickyHidden_1lohh_219{opacity:0;pointer-events:none}._stickyToolbarRootBottom_1lohh_230 ._source_1lohh_42,._stickyToolbarRootBottom_1lohh_230 ._inplace_1lohh_57{padding-bottom:52px}._stickyToolbarRootTop_1lohh_235 ._source_1lohh_42,._stickyToolbarRootTop_1lohh_235 ._inplace_1lohh_57{padding-top:52px}._inplace_1lohh_57 .cm-editor{height:100%}._inplace_1lohh_57 .cm-editor.cm-focused{outline:2px solid var(--stylo-ring);outline-offset:-2px}._split_1lohh_249{flex:1;grid-template-columns:1fr 1fr;min-height:0;display:grid}._splitPane_1lohh_256{box-sizing:border-box;flex-direction:column;min-height:0;display:flex;overflow:auto}._splitPane_1lohh_256+._splitPane_1lohh_256{border-left:1px solid var(--stylo-border)}._splitPane_1lohh_256>._source_1lohh_42{flex:1;min-height:0}._preview_1lohh_276{overflow-wrap:break-word;padding:.75rem 1rem;font-size:.9375rem;line-height:1.75}._preview_1lohh_276>:first-child{margin-top:0}._preview_1lohh_276>:last-child{margin-bottom:0}._preview_1lohh_276 :is(h1,h2,h3,h4,h5,h6){font-weight:600}._preview_1lohh_276 h1{margin:0 0 .888889em;font-size:2.25em;line-height:1.11111}._preview_1lohh_276 h2{margin:2em 0 1em;font-size:1.5em;line-height:1.33333}._preview_1lohh_276 h3{margin:1.6em 0 .6em;font-size:1.25em;line-height:1.6}._preview_1lohh_276 :is(h4,h5,h6){margin:1.5em 0 .5em;line-height:1.5}._preview_1lohh_276 p{margin:1.25em 0}._preview_1lohh_276 :is(ul,ol){margin:1.25em 0;padding-left:1.625em}._preview_1lohh_276 li{margin:.5em 0}._preview_1lohh_276 li>:is(ul,ol){margin:.75em 0}._preview_1lohh_276 a{color:var(--stylo-link);text-decoration:none}._preview_1lohh_276 code{font-family:var(--stylo-font-family-mono,ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);border-radius:calc(var(--stylo-radius) - 3px);background:color-mix(in srgb, var(--stylo-border) 45%, transparent);padding:.1em .35em;font-size:.9em}._preview_1lohh_276 pre{border-radius:var(--stylo-radius);background:color-mix(in srgb, var(--stylo-border) 35%, transparent);margin:1.71429em 0;padding:.75rem .9rem;overflow-x:auto}._preview_1lohh_276 pre code{background:0 0;padding:0;font-size:.85em}.stylo-frontmatter{border-left:3px solid var(--stylo-border);border-radius:calc(var(--stylo-radius) - 3px);background:color-mix(in srgb, var(--stylo-border) 22%, transparent);color:var(--stylo-text-muted);font-family:var(--stylo-font-family-mono,ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);white-space:pre-wrap;margin:0 0 1.2em;padding:.7rem .9rem;font-size:.8125rem;line-height:1.5;overflow-x:auto}.stylo-frontmatter:before{content:"Frontmatter";font-family:var(--stylo-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);letter-spacing:.04em;text-transform:uppercase;margin-bottom:.5em;font-size:.7rem;font-weight:600;display:block}._preview_1lohh_276 blockquote{border-left:.25rem solid var(--stylo-border);color:var(--stylo-text-muted);margin:1.6em 0;padding-left:1em}._preview_1lohh_276 .stylo-callout{border-left:.25rem solid var(--stylo-callout-accent,var(--stylo-border));border-radius:var(--stylo-radius);background:color-mix(in srgb, var(--stylo-callout-accent,var(--stylo-border)) 10%, transparent);color:var(--stylo-text);margin:1.6em 0;padding:.6em 1em}._preview_1lohh_276 .stylo-callout:before{content:attr(data-callout);letter-spacing:.04em;text-transform:uppercase;color:var(--stylo-callout-accent,var(--stylo-text-muted));margin-bottom:.2em;font-size:.8em;font-weight:700;display:block}._preview_1lohh_276 .stylo-callout-note{--stylo-callout-accent:var(--stylo-callout-note,#3b82f6)}._preview_1lohh_276 .stylo-callout-tip{--stylo-callout-accent:var(--stylo-callout-tip,#22c55e)}._preview_1lohh_276 .stylo-callout-warn{--stylo-callout-accent:var(--stylo-callout-warn,#f59e0b)}._preview_1lohh_276 .stylo-callout-danger{--stylo-callout-accent:var(--stylo-callout-danger,#ef4444)}._preview_1lohh_276 .stylo-callout-example{--stylo-callout-accent:var(--stylo-callout-example,#a855f7)}._preview_1lohh_276 .stylo-embed{border-left:.25rem solid var(--stylo-embed-accent,var(--stylo-border));margin:1.6em 0;padding-left:1em}._preview_1lohh_276 .stylo-embed-content>:first-child{margin-top:0}._preview_1lohh_276 .stylo-embed-content>:last-child{margin-bottom:0}._preview_1lohh_276 table{border-collapse:collapse;margin:2em 0;display:block;overflow-x:auto}._preview_1lohh_276 :is(th,td){border:1px solid var(--stylo-table-border);text-align:left;padding:.35em .6em}._preview_1lohh_276 thead th{background:var(--stylo-table-header-bg);font-weight:600}._preview_1lohh_276 tbody tr:nth-child(2n) td{background:var(--stylo-table-stripe-bg)}._preview_1lohh_276 hr{border:none;border-top:1px solid var(--stylo-border);margin:1em 0}._preview_1lohh_276 .katex-display{padding:.25em 0;overflow:auto hidden}.stylo{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;--stylo-bg:#fff;--stylo-surface-floating:#fff;--stylo-text:#09090b;--stylo-text-muted:#71717a;--stylo-border:#e4e4e7;--stylo-accent:#18181b;--stylo-link:#2563eb;--stylo-ring:#a1a1aa;--stylo-radius:.5rem;--stylo-font-size:.9375rem;--stylo-font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--stylo-font-family-mono:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--stylo-table-border:var(--stylo-border);--stylo-table-header-bg:color-mix(in srgb, var(--stylo-border) 30%, transparent);--stylo-table-stripe-bg:transparent;--stylo-guide:var(--stylo-border);--stylo-syntax-keyword:#7c3aed;--stylo-syntax-string:#0a7c2f;--stylo-syntax-escape:#b45309;--stylo-syntax-comment:#8a8f98;--stylo-syntax-number:#b45309;--stylo-syntax-constant:#b45309;--stylo-syntax-function:#2563eb;--stylo-syntax-type:#a16207;--stylo-syntax-property:#0f766e;--stylo-syntax-tag:#cf222e;--stylo-syntax-invalid:#dc2626}:where(.dark,[data-theme=dark]) .stylo,.stylo:where(.dark,[data-theme=dark]){--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--stylo-bg:#09090b;--stylo-surface-floating:#09090b;--stylo-text:#fafafa;--stylo-text-muted:#a1a1aa;--stylo-border:#27272a;--stylo-accent:#fafafa;--stylo-link:#60a5fa;--stylo-ring:#52525b;--stylo-syntax-keyword:#c678dd;--stylo-syntax-string:#98c379;--stylo-syntax-escape:#d19a66;--stylo-syntax-comment:#7f848e;--stylo-syntax-number:#d19a66;--stylo-syntax-constant:#d19a66;--stylo-syntax-function:#61afef;--stylo-syntax-type:#e5c07b;--stylo-syntax-property:#56b6c2;--stylo-syntax-tag:#e06c75;--stylo-syntax-invalid:#e06c75}._root_18hcd_3{color:var(--stylo-text);font:inherit;grid-template-columns:1fr 1fr;gap:12px;display:grid}@media (width<=460px){._root_18hcd_3{grid-template-columns:1fr}}._col_18hcd_17{border:1px solid var(--stylo-border);border-radius:var(--stylo-radius);background:var(--stylo-bg);flex-direction:column;min-width:0;display:flex}._colHead_18hcd_26{border-bottom:1px solid var(--stylo-border);letter-spacing:.04em;text-transform:uppercase;color:var(--stylo-text-muted);margin:0;padding:8px 12px;font-size:.75rem;font-weight:600}._list_18hcd_37{flex-direction:column;flex:1;gap:2px;margin:0;padding:4px;list-style:none;display:flex}._row_18hcd_47{border-radius:calc(var(--stylo-radius) - 3px);background:var(--stylo-bg);align-items:center;gap:8px;padding:5px 6px;display:flex}._row_18hcd_47:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-2px}._row_18hcd_47:hover{background:color-mix(in srgb, var(--stylo-border) 30%, transparent)}._row_18hcd_47[data-dragging]{background:var(--stylo-surface-floating,#fff);opacity:.9;box-shadow:0 4px 16px #00000024}._handle_18hcd_73{border-radius:calc(var(--stylo-radius) - 4px);width:20px;height:22px;color:var(--stylo-text-muted);font:inherit;cursor:grab;touch-action:none;background:0 0;border:1px solid #0000;flex:none;justify-content:center;align-items:center;padding:0;line-height:1;display:inline-flex}._handle_18hcd_73:hover{background:color-mix(in srgb, var(--stylo-border) 45%, transparent);color:var(--stylo-text)}._handle_18hcd_73:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-1px}._handle_18hcd_73:active{cursor:grabbing}._glyph_18hcd_105{width:18px;height:18px;color:var(--stylo-text-muted);flex:none;justify-content:center;align-items:center;display:inline-flex}._glyph_18hcd_105 svg{width:16px;height:16px;display:block}._label_18hcd_121{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:.8125rem;overflow:hidden}._rowActions_18hcd_130{flex:none;gap:2px;display:flex}._iconButton_18hcd_136,._textButton_18hcd_137{box-sizing:border-box;border-radius:calc(var(--stylo-radius) - 4px);color:var(--stylo-text-muted);font:inherit;cursor:pointer;background:0 0;border:1px solid #0000}._iconButton_18hcd_136{width:22px;height:22px;font-size:.8125rem;line-height:1}._textButton_18hcd_137{padding:3px 8px;font-size:.75rem}._iconButton_18hcd_136:hover:not(:disabled),._textButton_18hcd_137:hover:not(:disabled){background:color-mix(in srgb, var(--stylo-border) 45%, transparent);color:var(--stylo-text)}._iconButton_18hcd_136:focus-visible,._textButton_18hcd_137:focus-visible{outline:2px solid var(--stylo-ring);outline-offset:-1px}._iconButton_18hcd_136:disabled{opacity:.35;cursor:default}._footer_18hcd_176{border-top:1px solid var(--stylo-border);flex-wrap:wrap;gap:6px;padding:6px;display:flex}._empty_18hcd_184{color:var(--stylo-text-muted);padding:8px 6px;font-size:.8125rem}._srOnly_18hcd_190{clip:rect(0 0 0 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}
2
2
  /*$vite$:1*/
package/dist/stylo.js CHANGED
@@ -1,78 +1,91 @@
1
- import { i as e, n as t } from "./frontmatter-DGUkb9z-.js";
2
- import { n, t as r } from "./useCodeMirror-CpE_Ncfn.js";
3
- import { n as i, r as a } from "./config-DTBxVhtH.js";
4
- import { Suspense as o, forwardRef as s, lazy as c, useEffect as l, useImperativeHandle as u, useReducer as d, useRef as f, useState as p } from "react";
5
- import { EditorView as m } from "@codemirror/view";
6
- import { jsx as h, jsxs as g } from "react/jsx-runtime";
1
+ import { i as e, n as t } from "./frontmatter-DTCC0gaa.js";
2
+ import { S as n, n as r, t as i } from "./useCodeMirror-BI1kEPRE.js";
3
+ import { n as a, r as o } from "./config-DTBxVhtH.js";
4
+ import { Suspense as s, forwardRef as c, lazy as l, useEffect as u, useImperativeHandle as d, useReducer as f, useRef as p, useState as m, useSyncExternalStore as h } from "react";
5
+ import { EditorView as g, showPanel as _ } from "@codemirror/view";
6
+ import { createPortal as v } from "react-dom";
7
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
7
8
  //#region src/editor/SourceView.tsx
8
- function _({ value: t, onChange: n, readOnly: i, placeholder: a, codeLanguages: o, wikiLinkSource: s, onResolveError: c, onSave: l, onViewChange: u }) {
9
- let d = r({
9
+ var x = () => () => {}, S = () => null;
10
+ function C({ value: t, onChange: r, readOnly: a, placeholder: o, codeLanguages: s, wikiLinkSource: c, tagSource: l, onResolveError: u, onSave: d, onViewChange: f, canvasHeader: g }) {
11
+ let [b, C] = m(null), w = p(f);
12
+ w.current = f;
13
+ let T = p((e) => {
14
+ C(e), w.current?.(e);
15
+ }).current, E = p(g);
16
+ E.current = g;
17
+ let [D] = m(() => g ? new n() : null), O = h(D?.subscribe ?? x, D?.getSnapshot ?? S), [k] = m(() => D ? [_.of(D.panel)] : []), A = i({
10
18
  value: t,
11
- onChange: n,
12
- readOnly: i,
13
- placeholder: a,
14
- codeLanguages: o,
15
- wikiLinkSource: s,
16
- onResolveError: c,
17
- onSave: l,
18
- onViewChange: u
19
+ onChange: r,
20
+ readOnly: a,
21
+ placeholder: o,
22
+ codeLanguages: s,
23
+ wikiLinkSource: c,
24
+ tagSource: l,
25
+ onResolveError: u,
26
+ onSave: d,
27
+ onViewChange: T,
28
+ extensions: k
19
29
  });
20
- return /* @__PURE__ */ h("div", {
30
+ return /* @__PURE__ */ y("div", {
21
31
  className: e.source,
22
- ref: d
32
+ ref: A,
33
+ children: O && E.current && v(E.current({ view: b }), O)
23
34
  });
24
35
  }
25
36
  //#endregion
26
37
  //#region src/inplace/lazyInPlace.ts
27
- var v = c(async () => ({ default: (await import("./InPlaceView-CkbMemAa.js")).InPlaceView })), y = c(async () => ({ default: (await import("./Preview-AaGGwLQP.js")).Preview }));
38
+ var w = l(async () => ({ default: (await import("./InPlaceView-BWc06Jso.js")).InPlaceView })), T = l(async () => ({ default: (await import("./Preview-DIsFdBFA.js")).Preview }));
28
39
  //#endregion
29
40
  //#region src/SplitView.tsx
30
- function b({ value: t, onChange: n, onWikiLinkClick: r, readOnly: i, placeholder: a, codeLanguages: s, wikiLinkSource: c, embedSource: u, onResolveError: d, frontmatter: m, onSave: v, onViewChange: b }) {
31
- let [x, S] = p(null), C = f(null), w = f(!1);
32
- return l(() => {
33
- let e = x?.scrollDOM, t = C.current;
41
+ function E({ value: t, onChange: n, onWikiLinkClick: r, readOnly: i, placeholder: a, codeLanguages: o, wikiLinkSource: c, tagSource: l, embedSource: d, onResolveError: f, frontmatter: h, onSave: g, onViewChange: _, canvasHeader: v }) {
42
+ let [x, S] = m(null), w = p(null), E = p(!1);
43
+ return u(() => {
44
+ let e = x?.scrollDOM, t = w.current;
34
45
  if (!e || !t) return;
35
46
  let n = (e, t) => {
36
- if (w.current) return;
47
+ if (E.current) return;
37
48
  let n = e.scrollHeight - e.clientHeight;
38
- n <= 0 || (w.current = !0, t.scrollTop = e.scrollTop / n * (t.scrollHeight - t.clientHeight), requestAnimationFrame(() => {
39
- w.current = !1;
49
+ n <= 0 || (E.current = !0, t.scrollTop = e.scrollTop / n * (t.scrollHeight - t.clientHeight), requestAnimationFrame(() => {
50
+ E.current = !1;
40
51
  }));
41
52
  }, r = () => n(e, t), i = () => n(t, e);
42
53
  return e.addEventListener("scroll", r, { passive: !0 }), t.addEventListener("scroll", i, { passive: !0 }), () => {
43
54
  e.removeEventListener("scroll", r), t.removeEventListener("scroll", i);
44
55
  };
45
- }, [x]), /* @__PURE__ */ g("div", {
56
+ }, [x]), /* @__PURE__ */ b("div", {
46
57
  className: e.split,
47
- children: [/* @__PURE__ */ h("div", {
58
+ children: [/* @__PURE__ */ y("div", {
48
59
  className: e.splitPane,
49
- children: /* @__PURE__ */ h(_, {
60
+ children: /* @__PURE__ */ y(C, {
50
61
  value: t,
51
62
  onChange: n,
52
63
  readOnly: i,
53
64
  placeholder: a,
54
- codeLanguages: s,
65
+ codeLanguages: o,
55
66
  wikiLinkSource: c,
56
- onResolveError: d,
57
- onSave: v,
67
+ tagSource: l,
68
+ onResolveError: f,
69
+ onSave: g,
58
70
  onViewChange: (e) => {
59
- S(e), b?.(e);
60
- }
71
+ S(e), _?.(e);
72
+ },
73
+ canvasHeader: v
61
74
  })
62
- }), /* @__PURE__ */ h("div", {
75
+ }), /* @__PURE__ */ y("div", {
63
76
  className: e.splitPane,
64
- ref: C,
65
- children: /* @__PURE__ */ h(o, {
66
- fallback: /* @__PURE__ */ h("div", {
77
+ ref: w,
78
+ children: /* @__PURE__ */ y(s, {
79
+ fallback: /* @__PURE__ */ y("div", {
67
80
  className: e.preview,
68
81
  "aria-busy": "true"
69
82
  }),
70
- children: /* @__PURE__ */ h(y, {
83
+ children: /* @__PURE__ */ y(T, {
71
84
  value: t,
72
85
  onWikiLinkClick: r,
73
- embedSource: u,
74
- onResolveError: d,
75
- frontmatter: m
86
+ embedSource: d,
87
+ onResolveError: f,
88
+ frontmatter: h
76
89
  })
77
90
  })
78
91
  })]
@@ -80,8 +93,8 @@ function b({ value: t, onChange: n, onWikiLinkClick: r, readOnly: i, placeholder
80
93
  }
81
94
  //#endregion
82
95
  //#region src/toolbar/floating-watchdog.ts
83
- function x(e, t) {
84
- l(() => {
96
+ function D(e, t) {
97
+ u(() => {
85
98
  if (!t) return;
86
99
  let n = 0, r = !1, i = () => {
87
100
  let t = e.current;
@@ -92,9 +105,9 @@ function x(e, t) {
92
105
  }
93
106
  //#endregion
94
107
  //#region src/toolbar/keyboard-inset.ts
95
- function S(e) {
96
- let [t, n] = p(0);
97
- return l(() => {
108
+ function O(e) {
109
+ let [t, n] = m(0);
110
+ return u(() => {
98
111
  let t = typeof window > "u" ? null : window.visualViewport;
99
112
  if (!e || !t) {
100
113
  n(0);
@@ -108,7 +121,18 @@ function S(e) {
108
121
  }
109
122
  //#endregion
110
123
  //#region src/toolbar/Toolbar.tsx
111
- function C(e, t) {
124
+ function k(e) {
125
+ let t = [], n = [];
126
+ for (let r of e) {
127
+ if (r !== "|") {
128
+ n.push(r);
129
+ continue;
130
+ }
131
+ n.length && t.push(n), n = [], t.push("|");
132
+ }
133
+ return n.length && t.push(n), t;
134
+ }
135
+ function A(e, t) {
112
136
  if (typeof e != "string") {
113
137
  let { id: t, icon: n, title: r, run: i, isActive: a, disabled: o } = e;
114
138
  return {
@@ -120,26 +144,26 @@ function C(e, t) {
120
144
  disabled: o
121
145
  };
122
146
  }
123
- let r = n[e];
124
- return r ? {
147
+ let n = r[e];
148
+ return n ? {
125
149
  key: e,
126
- icon: t?.[e] ?? a[e],
127
- title: r.title,
128
- run: r.run,
129
- isActive: r.isActive,
130
- disabled: r.disabled
150
+ icon: t?.[e] ?? o[e],
151
+ title: n.title,
152
+ run: n.run,
153
+ isActive: n.isActive,
154
+ disabled: n.disabled
131
155
  } : null;
132
156
  }
133
- function w({ view: t, items: n, icons: r, disabled: i, sticky: a, stickyVisibility: o }) {
134
- let [, s] = d((e) => e + 1, 0), [c, u] = p(!1), m = S(a === "bottom"), g = f(null);
135
- x(g, a === "top"), l(() => {
157
+ function j({ view: t, items: n, icons: r, disabled: i, sticky: a, stickyVisibility: o }) {
158
+ let [, s] = f((e) => e + 1, 0), [c, l] = m(!1), d = O(a === "bottom"), h = p(null);
159
+ D(h, a === "top"), u(() => {
136
160
  if (!t) return;
137
161
  let e = t.contentDOM;
138
- u(t.hasFocus);
162
+ l(t.hasFocus);
139
163
  let n = () => {
140
- u(!0), s();
164
+ l(!0), s();
141
165
  }, r = () => {
142
- u(!1), s();
166
+ l(!1), s();
143
167
  }, i = [
144
168
  "keyup",
145
169
  "mouseup",
@@ -151,164 +175,172 @@ function w({ view: t, items: n, icons: r, disabled: i, sticky: a, stickyVisibili
151
175
  e.removeEventListener("focus", n), e.removeEventListener("blur", r);
152
176
  };
153
177
  }, [t]);
154
- let _ = !!a && o === "dynamic" && !c, v = [
178
+ let g = !!a && o === "dynamic" && !c, _ = [
155
179
  e.toolbar,
156
180
  a && e.toolbarSticky,
157
181
  a === "top" && e.toolbarStickyTop,
158
182
  a === "bottom" && e.toolbarStickyBottom,
159
- _ && e.toolbarStickyHidden
160
- ].filter(Boolean).join(" "), y = a === "bottom" ? { transform: `translateY(-${m}px)` } : void 0;
161
- return /* @__PURE__ */ h("div", {
162
- ref: g,
163
- className: v,
183
+ g && e.toolbarStickyHidden
184
+ ].filter(Boolean).join(" "), v = a === "bottom" ? { transform: `translateY(-${d}px)` } : void 0;
185
+ return /* @__PURE__ */ y("div", {
186
+ ref: h,
187
+ className: _,
164
188
  role: "toolbar",
165
189
  "aria-label": "Formatting",
166
- "aria-hidden": _ || void 0,
167
- style: y,
168
- children: n.map((n, a) => {
169
- if (n === "|") return /* @__PURE__ */ h("span", {
170
- className: e.toolbarSep,
171
- "aria-hidden": "true"
172
- }, `sep-${a}`);
173
- let o = C(n, r);
174
- if (!o) return null;
175
- let c = i || !t || !!o.disabled?.(t.state), l = !!(!c && t && o.isActive?.(t.state));
176
- return /* @__PURE__ */ h("button", {
177
- type: "button",
178
- className: e.toolbarButton,
179
- "data-command": o.key,
180
- title: o.title,
181
- "aria-label": o.title,
182
- "aria-pressed": o.isActive ? l : void 0,
183
- "data-active": l ? "" : void 0,
184
- disabled: c,
185
- onMouseDown: (e) => e.preventDefault(),
186
- onClick: () => {
187
- t && (o.run(t), s());
188
- },
189
- children: o.icon
190
- }, o.key);
191
- })
190
+ "aria-hidden": g || void 0,
191
+ style: v,
192
+ children: k(n).map((n, a) => n === "|" ? /* @__PURE__ */ y("span", {
193
+ className: e.toolbarSep,
194
+ "aria-hidden": "true"
195
+ }, `sep-${a}`) : /* @__PURE__ */ y("div", {
196
+ className: e.toolbarGroup,
197
+ children: n.map((n) => {
198
+ let a = A(n, r);
199
+ if (!a) return null;
200
+ let o = i || !t || !!a.disabled?.(t.state), c = !!(!o && t && a.isActive?.(t.state));
201
+ return /* @__PURE__ */ y("button", {
202
+ type: "button",
203
+ className: e.toolbarButton,
204
+ "data-command": a.key,
205
+ title: a.title,
206
+ "aria-label": a.title,
207
+ "aria-pressed": a.isActive ? c : void 0,
208
+ "data-active": c ? "" : void 0,
209
+ disabled: o,
210
+ onMouseDown: (e) => e.preventDefault(),
211
+ onClick: () => {
212
+ t && (a.run(t), s());
213
+ },
214
+ children: a.icon
215
+ }, a.key);
216
+ })
217
+ }, `group-${a}`))
192
218
  });
193
219
  }
194
220
  //#endregion
195
221
  //#region src/Stylo.tsx
196
- var T = s(function({ value: n, onChange: r, mode: a = "in-place", onSave: s, onFrontmatter: c, onWikiLinkClick: d, onLinkClick: x, readOnly: S, placeholder: C, className: T, inPlace: E, codeLanguages: D, wikiLinkSource: O, embedSource: k, onResolveError: A, toolbar: j, icons: M, frontmatter: N }, P) {
197
- let F = a === "preview" || a === "split" || a === "in-place" ? a : "source", [I, L] = p(null), R = F === "preview" ? null : i(j), z = j && typeof j == "object" ? j.render : void 0, B = j && typeof j == "object" ? j.sticky : void 0, V = B === "top" ? "top" : B ? "bottom" : !1, H = j && typeof j == "object" ? j.stickyVisibility : void 0, U = f(c);
198
- U.current = c;
199
- let W = f(A);
200
- W.current = A;
201
- let G = f((e, t) => {
202
- W.current?.(e, t);
203
- }).current, K = f(void 0);
204
- l(() => {
222
+ var M = c(function({ value: n, onChange: r, mode: i = "in-place", onSave: o, onFrontmatter: c, onWikiLinkClick: l, onLinkClick: f, readOnly: h, placeholder: _, className: v, inPlace: x, codeLanguages: S, wikiLinkSource: D, tagSource: O, embedSource: k, onResolveError: A, toolbar: M, icons: N, frontmatter: P, canvasHeader: F }, I) {
223
+ let L = i === "preview" || i === "split" || i === "in-place" ? i : "source", [R, z] = m(null), B = L === "preview" ? null : a(M), V = M && typeof M == "object" ? M.render : void 0, H = M && typeof M == "object" ? M.sticky : void 0, U = H === "top" ? "top" : H ? "bottom" : !1, W = M && typeof M == "object" ? M.stickyVisibility : void 0, G = p(c);
224
+ G.current = c;
225
+ let K = p(A);
226
+ K.current = A;
227
+ let q = p((e, t) => {
228
+ K.current?.(e, t);
229
+ }).current, J = p(void 0);
230
+ u(() => {
205
231
  let e = t(n)?.frontmatter ?? null;
206
- e !== K.current && (K.current = e, U.current?.(e));
207
- }, [n]), u(P, () => ({
208
- focus: () => I?.focus(),
209
- getView: () => I,
232
+ e !== J.current && (J.current = e, G.current?.(e));
233
+ }, [n]), d(I, () => ({
234
+ focus: () => R?.focus(),
235
+ getView: () => R,
210
236
  insertAtCursor: (e) => {
211
- I && (I.dispatch(I.state.replaceSelection(e)), I.focus());
237
+ R && (R.dispatch(R.state.replaceSelection(e)), R.focus());
212
238
  },
213
239
  scrollToHeading: (e) => {
214
- if (!I) return !1;
215
- let t = e.trim().toLowerCase(), { doc: n } = I.state;
240
+ if (!R) return !1;
241
+ let t = e.trim().toLowerCase(), { doc: n } = R.state;
216
242
  for (let e = 1; e <= n.lines; e++) {
217
243
  let r = n.line(e), i = /^ {0,3}#{1,6}[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*$/.exec(r.text);
218
- if (!(!i || i[1] === void 0) && i[1].trim().toLowerCase() === t) return I.dispatch({
244
+ if (!(!i || i[1] === void 0) && i[1].trim().toLowerCase() === t) return R.dispatch({
219
245
  selection: { anchor: r.from },
220
- effects: m.scrollIntoView(r.from, { y: "start" })
221
- }), I.focus(), !0;
246
+ effects: g.scrollIntoView(r.from, { y: "start" })
247
+ }), R.focus(), !0;
222
248
  }
223
249
  return !1;
224
250
  }
225
- }), [I]);
226
- let q = [
251
+ }), [R]);
252
+ let Y = [
227
253
  e.root,
228
- V === "bottom" && e.stickyToolbarRootBottom,
229
- V === "top" && e.stickyToolbarRootTop,
254
+ U === "bottom" && e.stickyToolbarRootBottom,
255
+ U === "top" && e.stickyToolbarRootTop,
230
256
  "stylo",
231
- T
257
+ v
232
258
  ].filter(Boolean).join(" ");
233
- return /* @__PURE__ */ g("div", {
234
- className: q,
235
- "data-stylo-mode": F,
259
+ return /* @__PURE__ */ b("div", {
260
+ className: Y,
261
+ "data-stylo-mode": L,
236
262
  children: [
237
- R && (() => {
238
- let e = /* @__PURE__ */ h(w, {
239
- view: I,
240
- items: R,
241
- icons: M,
242
- disabled: S,
243
- sticky: V,
244
- stickyVisibility: H
263
+ B && (() => {
264
+ let e = /* @__PURE__ */ y(j, {
265
+ view: R,
266
+ items: B,
267
+ icons: N,
268
+ disabled: h,
269
+ sticky: U,
270
+ stickyVisibility: W
245
271
  });
246
- return z ? z(e, { view: I }) : e;
272
+ return V ? V(e, { view: R }) : e;
247
273
  })(),
248
- F === "source" && /* @__PURE__ */ h(_, {
274
+ L === "source" && /* @__PURE__ */ y(C, {
249
275
  value: n,
250
276
  onChange: r,
251
- readOnly: S,
252
- placeholder: C,
253
- codeLanguages: D,
254
- wikiLinkSource: O,
255
- onResolveError: G,
256
- onSave: s,
257
- onViewChange: L
277
+ readOnly: h,
278
+ placeholder: _,
279
+ codeLanguages: S,
280
+ wikiLinkSource: D,
281
+ tagSource: O,
282
+ onResolveError: q,
283
+ onSave: o,
284
+ onViewChange: z,
285
+ canvasHeader: F
258
286
  }),
259
- F === "preview" && /* @__PURE__ */ h(o, {
260
- fallback: /* @__PURE__ */ h("div", {
287
+ L === "preview" && /* @__PURE__ */ y(s, {
288
+ fallback: /* @__PURE__ */ y("div", {
261
289
  className: e.preview,
262
290
  "aria-busy": "true"
263
291
  }),
264
- children: /* @__PURE__ */ h(y, {
292
+ children: /* @__PURE__ */ y(T, {
265
293
  value: n,
266
- onWikiLinkClick: d,
294
+ onWikiLinkClick: l,
267
295
  embedSource: k,
268
- onResolveError: G,
269
- frontmatter: N
296
+ onResolveError: q,
297
+ frontmatter: P
270
298
  })
271
299
  }),
272
- F === "split" && /* @__PURE__ */ h(b, {
300
+ L === "split" && /* @__PURE__ */ y(E, {
273
301
  value: n,
274
302
  onChange: r,
275
- onWikiLinkClick: d,
276
- readOnly: S,
277
- placeholder: C,
278
- codeLanguages: D,
279
- wikiLinkSource: O,
303
+ onWikiLinkClick: l,
304
+ readOnly: h,
305
+ placeholder: _,
306
+ codeLanguages: S,
307
+ wikiLinkSource: D,
308
+ tagSource: O,
280
309
  embedSource: k,
281
- onResolveError: G,
282
- frontmatter: N,
283
- onSave: s,
284
- onViewChange: L
310
+ onResolveError: q,
311
+ frontmatter: P,
312
+ onSave: o,
313
+ onViewChange: z,
314
+ canvasHeader: F
285
315
  }),
286
- F === "in-place" && /* @__PURE__ */ h(o, {
287
- fallback: /* @__PURE__ */ h("div", {
316
+ L === "in-place" && /* @__PURE__ */ y(s, {
317
+ fallback: /* @__PURE__ */ y("div", {
288
318
  className: e.inplace,
289
319
  "aria-busy": "true"
290
320
  }),
291
- children: /* @__PURE__ */ h(v, {
321
+ children: /* @__PURE__ */ y(w, {
292
322
  value: n,
293
323
  onChange: r,
294
- readOnly: S,
295
- placeholder: C,
296
- onWikiLinkClick: d,
297
- onLinkClick: x,
298
- inPlace: E,
299
- codeLanguages: D,
300
- wikiLinkSource: O,
324
+ readOnly: h,
325
+ placeholder: _,
326
+ onWikiLinkClick: l,
327
+ onLinkClick: f,
328
+ inPlace: x,
329
+ codeLanguages: S,
330
+ wikiLinkSource: D,
331
+ tagSource: O,
301
332
  embedSource: k,
302
- onResolveError: G,
303
- onSave: s,
304
- onViewChange: L
333
+ onResolveError: q,
334
+ onSave: o,
335
+ onViewChange: z,
336
+ canvasHeader: F
305
337
  })
306
338
  })
307
339
  ]
308
340
  });
309
341
  });
310
- T.displayName = "Stylo";
342
+ M.displayName = "Stylo";
311
343
  //#endregion
312
- export { T as Stylo, t as splitFrontmatter };
344
+ export { M as Stylo, t as splitFrontmatter };
313
345
 
314
346
  //# sourceMappingURL=stylo.js.map