@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.
- package/README.md +15 -3
- package/dist/{InPlaceView-CkbMemAa.js → InPlaceView-BWc06Jso.js} +491 -486
- package/dist/InPlaceView-BWc06Jso.js.map +1 -0
- package/dist/{Preview-AaGGwLQP.js → Preview-DIsFdBFA.js} +3 -3
- package/dist/{Preview-AaGGwLQP.js.map → Preview-DIsFdBFA.js.map} +1 -1
- package/dist/SplitView.d.ts +8 -2
- package/dist/SplitView.d.ts.map +1 -1
- package/dist/Stylo.d.ts.map +1 -1
- package/dist/editor/SourceView.d.ts +10 -3
- package/dist/editor/SourceView.d.ts.map +1 -1
- package/dist/editor/canvas-header-panel.d.ts +27 -0
- package/dist/editor/canvas-header-panel.d.ts.map +1 -0
- package/dist/editor/extensions.d.ts +2 -2
- package/dist/editor/extensions.d.ts.map +1 -1
- package/dist/editor/tag-complete.d.ts +16 -0
- package/dist/editor/tag-complete.d.ts.map +1 -0
- package/dist/editor/useCodeMirror.d.ts +8 -3
- package/dist/editor/useCodeMirror.d.ts.map +1 -1
- package/dist/{embed-B2Dfkpd_.js → embed-Dsu6b-MV.js} +16 -9
- package/dist/embed-Dsu6b-MV.js.map +1 -0
- package/dist/frontmatter-DTCC0gaa.js +40 -0
- package/dist/frontmatter-DTCC0gaa.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/inplace/InPlaceView.d.ts +10 -3
- package/dist/inplace/InPlaceView.d.ts.map +1 -1
- package/dist/inplace/table-widget.d.ts +10 -5
- package/dist/inplace/table-widget.d.ts.map +1 -1
- package/dist/inplace/theme-canvas.d.ts +7 -1
- package/dist/inplace/theme-canvas.d.ts.map +1 -1
- package/dist/render/Embed.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/stylo.js +200 -168
- package/dist/stylo.js.map +1 -1
- package/dist/toolbar/Toolbar.d.ts.map +1 -1
- package/dist/toolbar/commands.d.ts.map +1 -1
- package/dist/types.d.ts +38 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/{useCodeMirror-CpE_Ncfn.js → useCodeMirror-BI1kEPRE.js} +402 -334
- package/dist/useCodeMirror-BI1kEPRE.js.map +1 -0
- package/package.json +1 -1
- package/dist/InPlaceView-CkbMemAa.js.map +0 -1
- package/dist/embed-B2Dfkpd_.js.map +0 -1
- package/dist/frontmatter-DGUkb9z-.js +0 -39
- package/dist/frontmatter-DGUkb9z-.js.map +0 -1
- 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-
|
|
2
|
-
import { n,
|
|
3
|
-
import { n as
|
|
4
|
-
import { Suspense as
|
|
5
|
-
import { EditorView as
|
|
6
|
-
import {
|
|
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
|
-
|
|
9
|
-
|
|
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:
|
|
12
|
-
readOnly:
|
|
13
|
-
placeholder:
|
|
14
|
-
codeLanguages:
|
|
15
|
-
wikiLinkSource:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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__ */
|
|
30
|
+
return /* @__PURE__ */ y("div", {
|
|
21
31
|
className: e.source,
|
|
22
|
-
ref:
|
|
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
|
|
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
|
|
31
|
-
let [x, S] =
|
|
32
|
-
return
|
|
33
|
-
let e = x?.scrollDOM, t =
|
|
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 (
|
|
47
|
+
if (E.current) return;
|
|
37
48
|
let n = e.scrollHeight - e.clientHeight;
|
|
38
|
-
n <= 0 || (
|
|
39
|
-
|
|
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__ */
|
|
56
|
+
}, [x]), /* @__PURE__ */ b("div", {
|
|
46
57
|
className: e.split,
|
|
47
|
-
children: [/* @__PURE__ */
|
|
58
|
+
children: [/* @__PURE__ */ y("div", {
|
|
48
59
|
className: e.splitPane,
|
|
49
|
-
children: /* @__PURE__ */
|
|
60
|
+
children: /* @__PURE__ */ y(C, {
|
|
50
61
|
value: t,
|
|
51
62
|
onChange: n,
|
|
52
63
|
readOnly: i,
|
|
53
64
|
placeholder: a,
|
|
54
|
-
codeLanguages:
|
|
65
|
+
codeLanguages: o,
|
|
55
66
|
wikiLinkSource: c,
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
tagSource: l,
|
|
68
|
+
onResolveError: f,
|
|
69
|
+
onSave: g,
|
|
58
70
|
onViewChange: (e) => {
|
|
59
|
-
S(e),
|
|
60
|
-
}
|
|
71
|
+
S(e), _?.(e);
|
|
72
|
+
},
|
|
73
|
+
canvasHeader: v
|
|
61
74
|
})
|
|
62
|
-
}), /* @__PURE__ */
|
|
75
|
+
}), /* @__PURE__ */ y("div", {
|
|
63
76
|
className: e.splitPane,
|
|
64
|
-
ref:
|
|
65
|
-
children: /* @__PURE__ */
|
|
66
|
-
fallback: /* @__PURE__ */
|
|
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__ */
|
|
83
|
+
children: /* @__PURE__ */ y(T, {
|
|
71
84
|
value: t,
|
|
72
85
|
onWikiLinkClick: r,
|
|
73
|
-
embedSource:
|
|
74
|
-
onResolveError:
|
|
75
|
-
frontmatter:
|
|
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
|
|
84
|
-
|
|
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
|
|
96
|
-
let [t, n] =
|
|
97
|
-
return
|
|
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
|
|
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
|
|
124
|
-
return
|
|
147
|
+
let n = r[e];
|
|
148
|
+
return n ? {
|
|
125
149
|
key: e,
|
|
126
|
-
icon: t?.[e] ??
|
|
127
|
-
title:
|
|
128
|
-
run:
|
|
129
|
-
isActive:
|
|
130
|
-
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
|
|
134
|
-
let [, s] =
|
|
135
|
-
|
|
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
|
-
|
|
162
|
+
l(t.hasFocus);
|
|
139
163
|
let n = () => {
|
|
140
|
-
|
|
164
|
+
l(!0), s();
|
|
141
165
|
}, r = () => {
|
|
142
|
-
|
|
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
|
|
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
|
-
|
|
160
|
-
].filter(Boolean).join(" "),
|
|
161
|
-
return /* @__PURE__ */
|
|
162
|
-
ref:
|
|
163
|
-
className:
|
|
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":
|
|
167
|
-
style:
|
|
168
|
-
children: n.map((n, a) => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
|
197
|
-
let
|
|
198
|
-
|
|
199
|
-
let
|
|
200
|
-
|
|
201
|
-
let
|
|
202
|
-
|
|
203
|
-
}).current,
|
|
204
|
-
|
|
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 !==
|
|
207
|
-
}, [n]),
|
|
208
|
-
focus: () =>
|
|
209
|
-
getView: () =>
|
|
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
|
-
|
|
237
|
+
R && (R.dispatch(R.state.replaceSelection(e)), R.focus());
|
|
212
238
|
},
|
|
213
239
|
scrollToHeading: (e) => {
|
|
214
|
-
if (!
|
|
215
|
-
let t = e.trim().toLowerCase(), { doc: n } =
|
|
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
|
|
244
|
+
if (!(!i || i[1] === void 0) && i[1].trim().toLowerCase() === t) return R.dispatch({
|
|
219
245
|
selection: { anchor: r.from },
|
|
220
|
-
effects:
|
|
221
|
-
}),
|
|
246
|
+
effects: g.scrollIntoView(r.from, { y: "start" })
|
|
247
|
+
}), R.focus(), !0;
|
|
222
248
|
}
|
|
223
249
|
return !1;
|
|
224
250
|
}
|
|
225
|
-
}), [
|
|
226
|
-
let
|
|
251
|
+
}), [R]);
|
|
252
|
+
let Y = [
|
|
227
253
|
e.root,
|
|
228
|
-
|
|
229
|
-
|
|
254
|
+
U === "bottom" && e.stickyToolbarRootBottom,
|
|
255
|
+
U === "top" && e.stickyToolbarRootTop,
|
|
230
256
|
"stylo",
|
|
231
|
-
|
|
257
|
+
v
|
|
232
258
|
].filter(Boolean).join(" ");
|
|
233
|
-
return /* @__PURE__ */
|
|
234
|
-
className:
|
|
235
|
-
"data-stylo-mode":
|
|
259
|
+
return /* @__PURE__ */ b("div", {
|
|
260
|
+
className: Y,
|
|
261
|
+
"data-stylo-mode": L,
|
|
236
262
|
children: [
|
|
237
|
-
|
|
238
|
-
let e = /* @__PURE__ */
|
|
239
|
-
view:
|
|
240
|
-
items:
|
|
241
|
-
icons:
|
|
242
|
-
disabled:
|
|
243
|
-
sticky:
|
|
244
|
-
stickyVisibility:
|
|
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
|
|
272
|
+
return V ? V(e, { view: R }) : e;
|
|
247
273
|
})(),
|
|
248
|
-
|
|
274
|
+
L === "source" && /* @__PURE__ */ y(C, {
|
|
249
275
|
value: n,
|
|
250
276
|
onChange: r,
|
|
251
|
-
readOnly:
|
|
252
|
-
placeholder:
|
|
253
|
-
codeLanguages:
|
|
254
|
-
wikiLinkSource:
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
-
|
|
260
|
-
fallback: /* @__PURE__ */
|
|
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__ */
|
|
292
|
+
children: /* @__PURE__ */ y(T, {
|
|
265
293
|
value: n,
|
|
266
|
-
onWikiLinkClick:
|
|
294
|
+
onWikiLinkClick: l,
|
|
267
295
|
embedSource: k,
|
|
268
|
-
onResolveError:
|
|
269
|
-
frontmatter:
|
|
296
|
+
onResolveError: q,
|
|
297
|
+
frontmatter: P
|
|
270
298
|
})
|
|
271
299
|
}),
|
|
272
|
-
|
|
300
|
+
L === "split" && /* @__PURE__ */ y(E, {
|
|
273
301
|
value: n,
|
|
274
302
|
onChange: r,
|
|
275
|
-
onWikiLinkClick:
|
|
276
|
-
readOnly:
|
|
277
|
-
placeholder:
|
|
278
|
-
codeLanguages:
|
|
279
|
-
wikiLinkSource:
|
|
303
|
+
onWikiLinkClick: l,
|
|
304
|
+
readOnly: h,
|
|
305
|
+
placeholder: _,
|
|
306
|
+
codeLanguages: S,
|
|
307
|
+
wikiLinkSource: D,
|
|
308
|
+
tagSource: O,
|
|
280
309
|
embedSource: k,
|
|
281
|
-
onResolveError:
|
|
282
|
-
frontmatter:
|
|
283
|
-
onSave:
|
|
284
|
-
onViewChange:
|
|
310
|
+
onResolveError: q,
|
|
311
|
+
frontmatter: P,
|
|
312
|
+
onSave: o,
|
|
313
|
+
onViewChange: z,
|
|
314
|
+
canvasHeader: F
|
|
285
315
|
}),
|
|
286
|
-
|
|
287
|
-
fallback: /* @__PURE__ */
|
|
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__ */
|
|
321
|
+
children: /* @__PURE__ */ y(w, {
|
|
292
322
|
value: n,
|
|
293
323
|
onChange: r,
|
|
294
|
-
readOnly:
|
|
295
|
-
placeholder:
|
|
296
|
-
onWikiLinkClick:
|
|
297
|
-
onLinkClick:
|
|
298
|
-
inPlace:
|
|
299
|
-
codeLanguages:
|
|
300
|
-
wikiLinkSource:
|
|
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:
|
|
303
|
-
onSave:
|
|
304
|
-
onViewChange:
|
|
333
|
+
onResolveError: q,
|
|
334
|
+
onSave: o,
|
|
335
|
+
onViewChange: z,
|
|
336
|
+
canvasHeader: F
|
|
305
337
|
})
|
|
306
338
|
})
|
|
307
339
|
]
|
|
308
340
|
});
|
|
309
341
|
});
|
|
310
|
-
|
|
342
|
+
M.displayName = "Stylo";
|
|
311
343
|
//#endregion
|
|
312
|
-
export {
|
|
344
|
+
export { M as Stylo, t as splitFrontmatter };
|
|
313
345
|
|
|
314
346
|
//# sourceMappingURL=stylo.js.map
|