@lapismd/mira 0.0.1
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/CHANGELOG.md +7 -0
- package/LICENSE.md +4 -0
- package/README.md +52 -0
- package/dist/codemirror.d.ts +5 -0
- package/dist/codemirror.d.ts.map +1 -0
- package/dist/codemirror.js +4 -0
- package/dist/core/code-mirror.d.ts +29 -0
- package/dist/core/code-mirror.d.ts.map +1 -0
- package/dist/core/code-mirror.js +74 -0
- package/dist/core/code-mirror.test.d.ts +2 -0
- package/dist/core/code-mirror.test.d.ts.map +1 -0
- package/dist/core/code-mirror.test.js +68 -0
- package/dist/core/images.d.ts +30 -0
- package/dist/core/images.d.ts.map +1 -0
- package/dist/core/images.js +226 -0
- package/dist/core/images.test.d.ts +2 -0
- package/dist/core/images.test.d.ts.map +1 -0
- package/dist/core/images.test.js +109 -0
- package/dist/core/index.d.ts +69 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +138 -0
- package/dist/core/index.test.d.ts +2 -0
- package/dist/core/index.test.d.ts.map +1 -0
- package/dist/core/index.test.js +11 -0
- package/dist/core/markdown-actions.d.ts +11 -0
- package/dist/core/markdown-actions.d.ts.map +1 -0
- package/dist/core/markdown-actions.js +603 -0
- package/dist/core/markdown-actions.test.d.ts +2 -0
- package/dist/core/markdown-actions.test.d.ts.map +1 -0
- package/dist/core/markdown-actions.test.js +182 -0
- package/dist/extensions/doodle-dividers.d.ts +44 -0
- package/dist/extensions/doodle-dividers.d.ts.map +1 -0
- package/dist/extensions/doodle-dividers.js +909 -0
- package/dist/extensions/doodle-dividers.test.d.ts +2 -0
- package/dist/extensions/doodle-dividers.test.d.ts.map +1 -0
- package/dist/extensions/doodle-dividers.test.js +296 -0
- package/dist/extensions/index.d.ts +342 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +279 -0
- package/dist/extensions/index.test.d.ts +2 -0
- package/dist/extensions/index.test.d.ts.map +1 -0
- package/dist/extensions/index.test.js +283 -0
- package/dist/extensions/selection-toolbar.d.ts +6 -0
- package/dist/extensions/selection-toolbar.d.ts.map +1 -0
- package/dist/extensions/selection-toolbar.js +14 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +64 -0
- package/dist/internal/appearance-context.d.ts +12 -0
- package/dist/internal/appearance-context.d.ts.map +1 -0
- package/dist/internal/appearance-context.js +31 -0
- package/dist/internal/appearance-context.test.d.ts +2 -0
- package/dist/internal/appearance-context.test.d.ts.map +1 -0
- package/dist/internal/appearance-context.test.js +31 -0
- package/dist/internal/codemirror/base/index.d.ts +24 -0
- package/dist/internal/codemirror/base/index.d.ts.map +1 -0
- package/dist/internal/codemirror/base/index.js +489 -0
- package/dist/internal/codemirror/base/index.test.d.ts +2 -0
- package/dist/internal/codemirror/base/index.test.d.ts.map +1 -0
- package/dist/internal/codemirror/base/index.test.js +303 -0
- package/dist/internal/codemirror/base/search-panel.svelte +590 -0
- package/dist/internal/codemirror/base/search-panel.svelte.d.ts +8 -0
- package/dist/internal/codemirror/base/search-panel.svelte.d.ts.map +1 -0
- package/dist/internal/codemirror/base/search.d.ts +46 -0
- package/dist/internal/codemirror/base/search.d.ts.map +1 -0
- package/dist/internal/codemirror/base/search.js +58 -0
- package/dist/internal/codemirror/base/search.test.d.ts +2 -0
- package/dist/internal/codemirror/base/search.test.d.ts.map +1 -0
- package/dist/internal/codemirror/base/search.test.js +155 -0
- package/dist/internal/codemirror/base/selection-toolbar.d.ts +21 -0
- package/dist/internal/codemirror/base/selection-toolbar.d.ts.map +1 -0
- package/dist/internal/codemirror/base/selection-toolbar.js +306 -0
- package/dist/internal/codemirror/base/selection-toolbar.test.d.ts +2 -0
- package/dist/internal/codemirror/base/selection-toolbar.test.d.ts.map +1 -0
- package/dist/internal/codemirror/base/selection-toolbar.test.js +149 -0
- package/dist/internal/codemirror/base/slash-commands.d.ts +61 -0
- package/dist/internal/codemirror/base/slash-commands.d.ts.map +1 -0
- package/dist/internal/codemirror/base/slash-commands.js +463 -0
- package/dist/internal/codemirror/markdown/authoring.d.ts +9 -0
- package/dist/internal/codemirror/markdown/authoring.d.ts.map +1 -0
- package/dist/internal/codemirror/markdown/authoring.js +14 -0
- package/dist/internal/codemirror/markdown/authoring.test.d.ts +2 -0
- package/dist/internal/codemirror/markdown/authoring.test.d.ts.map +1 -0
- package/dist/internal/codemirror/markdown/authoring.test.js +222 -0
- package/dist/internal/codemirror/markdown/completion.d.ts +12 -0
- package/dist/internal/codemirror/markdown/completion.d.ts.map +1 -0
- package/dist/internal/codemirror/markdown/completion.js +302 -0
- package/dist/internal/codemirror/markdown/directives.d.ts +3 -0
- package/dist/internal/codemirror/markdown/directives.d.ts.map +1 -0
- package/dist/internal/codemirror/markdown/directives.js +154 -0
- package/dist/internal/codemirror/markdown/grid-table.d.ts +3 -0
- package/dist/internal/codemirror/markdown/grid-table.d.ts.map +1 -0
- package/dist/internal/codemirror/markdown/grid-table.js +129 -0
- package/dist/internal/codemirror/markdown/index.d.ts +16 -0
- package/dist/internal/codemirror/markdown/index.d.ts.map +1 -0
- package/dist/internal/codemirror/markdown/index.js +125 -0
- package/dist/internal/codemirror/markdown/index.test.d.ts +2 -0
- package/dist/internal/codemirror/markdown/index.test.d.ts.map +1 -0
- package/dist/internal/codemirror/markdown/index.test.js +158 -0
- package/dist/internal/codemirror/markdown/input-handlers.d.ts +4 -0
- package/dist/internal/codemirror/markdown/input-handlers.d.ts.map +1 -0
- package/dist/internal/codemirror/markdown/input-handlers.js +56 -0
- package/dist/internal/codemirror/markdown/lapis-inline.d.ts +11 -0
- package/dist/internal/codemirror/markdown/lapis-inline.d.ts.map +1 -0
- package/dist/internal/codemirror/markdown/lapis-inline.js +189 -0
- package/dist/internal/codemirror/markdown/latex.d.ts +5 -0
- package/dist/internal/codemirror/markdown/latex.d.ts.map +1 -0
- package/dist/internal/codemirror/markdown/latex.js +97 -0
- package/dist/internal/codemirror/markdown/list-after-lazy-quote.d.ts +10 -0
- package/dist/internal/codemirror/markdown/list-after-lazy-quote.d.ts.map +1 -0
- package/dist/internal/codemirror/markdown/list-after-lazy-quote.js +28 -0
- package/dist/internal/codemirror/markdown/paste.d.ts +5 -0
- package/dist/internal/codemirror/markdown/paste.d.ts.map +1 -0
- package/dist/internal/codemirror/markdown/paste.js +84 -0
- package/dist/internal/codemirror/markdown/showcase-fixture.test.d.ts +2 -0
- package/dist/internal/codemirror/markdown/showcase-fixture.test.d.ts.map +1 -0
- package/dist/internal/codemirror/markdown/showcase-fixture.test.js +50 -0
- package/dist/internal/codemirror/markdown/types.d.ts +6 -0
- package/dist/internal/codemirror/rich/block-controls.d.ts +4 -0
- package/dist/internal/codemirror/rich/block-controls.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/block-controls.js +1419 -0
- package/dist/internal/codemirror/rich/block-controls.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/block-controls.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/block-controls.test.js +401 -0
- package/dist/internal/codemirror/rich/block-ranges.d.ts +22 -0
- package/dist/internal/codemirror/rich/block-ranges.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/block-ranges.js +736 -0
- package/dist/internal/codemirror/rich/block-ranges.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/block-ranges.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/block-ranges.test.js +310 -0
- package/dist/internal/codemirror/rich/block-toolbar.d.ts +25 -0
- package/dist/internal/codemirror/rich/block-toolbar.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/block-toolbar.js +506 -0
- package/dist/internal/codemirror/rich/block-toolbar.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/block-toolbar.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/block-toolbar.test.js +178 -0
- package/dist/internal/codemirror/rich/decorations/fold-indicators.d.ts +7 -0
- package/dist/internal/codemirror/rich/decorations/fold-indicators.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/decorations/fold-indicators.js +122 -0
- package/dist/internal/codemirror/rich/decorations/fold-indicators.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/decorations/fold-indicators.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/decorations/fold-indicators.test.js +8 -0
- package/dist/internal/codemirror/rich/decorations/heading-gutter.d.ts +3 -0
- package/dist/internal/codemirror/rich/decorations/heading-gutter.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/decorations/heading-gutter.js +43 -0
- package/dist/internal/codemirror/rich/index.d.ts +17 -0
- package/dist/internal/codemirror/rich/index.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/index.js +727 -0
- package/dist/internal/codemirror/rich/index.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/index.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/index.test.js +544 -0
- package/dist/internal/codemirror/rich/theme.d.ts +2 -0
- package/dist/internal/codemirror/rich/theme.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/theme.js +268 -0
- package/dist/internal/codemirror/rich/types.d.ts +22 -0
- package/dist/internal/codemirror/rich/types.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/types.js +1 -0
- package/dist/internal/codemirror/rich/utils/activation.d.ts +3 -0
- package/dist/internal/codemirror/rich/utils/activation.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/activation.js +27 -0
- package/dist/internal/codemirror/rich/utils/code-block-lines.d.ts +8 -0
- package/dist/internal/codemirror/rich/utils/code-block-lines.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/code-block-lines.js +143 -0
- package/dist/internal/codemirror/rich/utils/code-block-lines.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/utils/code-block-lines.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/code-block-lines.test.js +82 -0
- package/dist/internal/codemirror/rich/utils/fenced-code.d.ts +4 -0
- package/dist/internal/codemirror/rich/utils/fenced-code.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/fenced-code.js +25 -0
- package/dist/internal/codemirror/rich/utils/fenced-code.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/utils/fenced-code.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/fenced-code.test.js +12 -0
- package/dist/internal/codemirror/rich/utils/headings.d.ts +5 -0
- package/dist/internal/codemirror/rich/utils/headings.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/headings.js +20 -0
- package/dist/internal/codemirror/rich/utils/headings.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/utils/headings.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/headings.test.js +27 -0
- package/dist/internal/codemirror/rich/utils/height-estimates.d.ts +2 -0
- package/dist/internal/codemirror/rich/utils/height-estimates.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/height-estimates.js +82 -0
- package/dist/internal/codemirror/rich/utils/height-estimates.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/utils/height-estimates.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/height-estimates.test.js +10 -0
- package/dist/internal/codemirror/rich/utils/images.d.ts +9 -0
- package/dist/internal/codemirror/rich/utils/images.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/images.js +103 -0
- package/dist/internal/codemirror/rich/utils/images.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/utils/images.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/images.test.js +37 -0
- package/dist/internal/codemirror/rich/utils/indent.d.ts +38 -0
- package/dist/internal/codemirror/rich/utils/indent.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/indent.js +435 -0
- package/dist/internal/codemirror/rich/utils/indent.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/utils/indent.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/indent.test.js +169 -0
- package/dist/internal/codemirror/rich/utils/inline-code.d.ts +7 -0
- package/dist/internal/codemirror/rich/utils/inline-code.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/inline-code.js +43 -0
- package/dist/internal/codemirror/rich/utils/inline-math.d.ts +6 -0
- package/dist/internal/codemirror/rich/utils/inline-math.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/inline-math.js +45 -0
- package/dist/internal/codemirror/rich/utils/inline-math.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/utils/inline-math.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/inline-math.test.js +15 -0
- package/dist/internal/codemirror/rich/utils/links.d.ts +6 -0
- package/dist/internal/codemirror/rich/utils/links.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/links.js +36 -0
- package/dist/internal/codemirror/rich/utils/links.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/utils/links.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/links.test.js +28 -0
- package/dist/internal/codemirror/rich/utils/list-callouts.d.ts +15 -0
- package/dist/internal/codemirror/rich/utils/list-callouts.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/list-callouts.js +41 -0
- package/dist/internal/codemirror/rich/utils/list-callouts.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/utils/list-callouts.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/list-callouts.test.js +47 -0
- package/dist/internal/codemirror/rich/utils/measured-indent.d.ts +18 -0
- package/dist/internal/codemirror/rich/utils/measured-indent.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/measured-indent.js +419 -0
- package/dist/internal/codemirror/rich/utils/measured-indent.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/utils/measured-indent.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/measured-indent.test.js +102 -0
- package/dist/internal/codemirror/rich/utils/ranges.d.ts +13 -0
- package/dist/internal/codemirror/rich/utils/ranges.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/ranges.js +42 -0
- package/dist/internal/codemirror/rich/utils/ranges.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/utils/ranges.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/ranges.test.js +22 -0
- package/dist/internal/codemirror/rich/utils/tasks.d.ts +11 -0
- package/dist/internal/codemirror/rich/utils/tasks.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/tasks.js +23 -0
- package/dist/internal/codemirror/rich/utils/tasks.test.d.ts +2 -0
- package/dist/internal/codemirror/rich/utils/tasks.test.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/utils/tasks.test.js +57 -0
- package/dist/internal/codemirror/rich/widgets/list-callout.d.ts +19 -0
- package/dist/internal/codemirror/rich/widgets/list-callout.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/widgets/list-callout.js +58 -0
- package/dist/internal/codemirror/rich/widgets/preview-widgets.d.ts +50 -0
- package/dist/internal/codemirror/rich/widgets/preview-widgets.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/widgets/preview-widgets.js +311 -0
- package/dist/internal/codemirror/rich/widgets/source-toggle.d.ts +4 -0
- package/dist/internal/codemirror/rich/widgets/source-toggle.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/widgets/source-toggle.js +47 -0
- package/dist/internal/codemirror/rich/widgets/task-checkbox.d.ts +14 -0
- package/dist/internal/codemirror/rich/widgets/task-checkbox.d.ts.map +1 -0
- package/dist/internal/codemirror/rich/widgets/task-checkbox.js +54 -0
- package/dist/internal/doodle-dividers.d.ts +62 -0
- package/dist/internal/doodle-dividers.d.ts.map +1 -0
- package/dist/internal/doodle-dividers.js +103 -0
- package/dist/internal/task-states.d.ts +73 -0
- package/dist/internal/task-states.d.ts.map +1 -0
- package/dist/internal/task-states.js +27 -0
- package/dist/internal/task-states.test.d.ts +2 -0
- package/dist/internal/task-states.test.d.ts.map +1 -0
- package/dist/internal/task-states.test.js +36 -0
- package/dist/mira-code-editor.css +222 -0
- package/dist/mira-code-editor.d.ts +40 -0
- package/dist/mira-code-editor.d.ts.map +1 -0
- package/dist/mira-code-editor.js +1 -0
- package/dist/mira-code-editor.svelte +181 -0
- package/dist/mira-code-editor.svelte.d.ts +17 -0
- package/dist/mira-code-editor.svelte.d.ts.map +1 -0
- package/dist/mira-code-editor.test.d.ts +2 -0
- package/dist/mira-code-editor.test.d.ts.map +1 -0
- package/dist/mira-code-editor.test.js +93 -0
- package/dist/mira.svelte +581 -0
- package/dist/mira.svelte.d.ts +23 -0
- package/dist/mira.svelte.d.ts.map +1 -0
- package/dist/mode-position.d.ts +18 -0
- package/dist/mode-position.d.ts.map +1 -0
- package/dist/mode-position.js +99 -0
- package/dist/mode-position.test.d.ts +2 -0
- package/dist/mode-position.test.d.ts.map +1 -0
- package/dist/mode-position.test.js +60 -0
- package/dist/preview/adobe-gridtables.d.ts +11 -0
- package/dist/preview/code-language.d.ts +2 -0
- package/dist/preview/code-language.d.ts.map +1 -0
- package/dist/preview/code-language.js +58 -0
- package/dist/preview/code-language.test.d.ts +2 -0
- package/dist/preview/code-language.test.d.ts.map +1 -0
- package/dist/preview/code-language.test.js +12 -0
- package/dist/preview/components/callout.svelte +123 -0
- package/dist/preview/components/callout.svelte.d.ts +17 -0
- package/dist/preview/components/callout.svelte.d.ts.map +1 -0
- package/dist/preview/components/checkbox.svelte +151 -0
- package/dist/preview/components/checkbox.svelte.d.ts +12 -0
- package/dist/preview/components/checkbox.svelte.d.ts.map +1 -0
- package/dist/preview/components/code.svelte +146 -0
- package/dist/preview/components/code.svelte.d.ts +12 -0
- package/dist/preview/components/code.svelte.d.ts.map +1 -0
- package/dist/preview/components/embed.svelte +236 -0
- package/dist/preview/components/embed.svelte.d.ts +14 -0
- package/dist/preview/components/embed.svelte.d.ts.map +1 -0
- package/dist/preview/components/embedded-markdown-preview.svelte +53 -0
- package/dist/preview/components/embedded-markdown-preview.svelte.d.ts +12 -0
- package/dist/preview/components/embedded-markdown-preview.svelte.d.ts.map +1 -0
- package/dist/preview/components/frontmatter-property-name-input.svelte +207 -0
- package/dist/preview/components/frontmatter-property-name-input.svelte.d.ts +14 -0
- package/dist/preview/components/frontmatter-property-name-input.svelte.d.ts.map +1 -0
- package/dist/preview/components/frontmatter-property-text-input.svelte +228 -0
- package/dist/preview/components/frontmatter-property-text-input.svelte.d.ts +13 -0
- package/dist/preview/components/frontmatter-property-text-input.svelte.d.ts.map +1 -0
- package/dist/preview/components/frontmatter-property-value-input.svelte +232 -0
- package/dist/preview/components/frontmatter-property-value-input.svelte.d.ts +13 -0
- package/dist/preview/components/frontmatter-property-value-input.svelte.d.ts.map +1 -0
- package/dist/preview/components/frontmatter-utils.d.ts +2 -0
- package/dist/preview/components/frontmatter-utils.d.ts.map +1 -0
- package/dist/preview/components/frontmatter-utils.js +1 -0
- package/dist/preview/components/frontmatter.svelte +857 -0
- package/dist/preview/components/frontmatter.svelte.d.ts +18 -0
- package/dist/preview/components/frontmatter.svelte.d.ts.map +1 -0
- package/dist/preview/components/icon.svelte +225 -0
- package/dist/preview/components/icon.svelte.d.ts +9 -0
- package/dist/preview/components/icon.svelte.d.ts.map +1 -0
- package/dist/preview/components/icon.test.d.ts +2 -0
- package/dist/preview/components/icon.test.d.ts.map +1 -0
- package/dist/preview/components/icon.test.js +20 -0
- package/dist/preview/components/image.svelte +266 -0
- package/dist/preview/components/image.svelte.d.ts +10 -0
- package/dist/preview/components/image.svelte.d.ts.map +1 -0
- package/dist/preview/components/link.svelte +382 -0
- package/dist/preview/components/link.svelte.d.ts +16 -0
- package/dist/preview/components/link.svelte.d.ts.map +1 -0
- package/dist/preview/components/list-callout-control.svelte +138 -0
- package/dist/preview/components/list-callout-control.svelte.d.ts +10 -0
- package/dist/preview/components/list-callout-control.svelte.d.ts.map +1 -0
- package/dist/preview/components/list-callout-marker.svelte +108 -0
- package/dist/preview/components/list-callout-marker.svelte.d.ts +15 -0
- package/dist/preview/components/list-callout-marker.svelte.d.ts.map +1 -0
- package/dist/preview/components/list-item.svelte +161 -0
- package/dist/preview/components/list-item.svelte.d.ts +11 -0
- package/dist/preview/components/list-item.svelte.d.ts.map +1 -0
- package/dist/preview/components/tag.svelte +18 -0
- package/dist/preview/components/tag.svelte.d.ts +10 -0
- package/dist/preview/components/tag.svelte.d.ts.map +1 -0
- package/dist/preview/components/task-checkbox-control.svelte +113 -0
- package/dist/preview/components/task-checkbox-control.svelte.d.ts +14 -0
- package/dist/preview/components/task-checkbox-control.svelte.d.ts.map +1 -0
- package/dist/preview/editable-markdown-preview/behavior.d.ts +6 -0
- package/dist/preview/editable-markdown-preview/behavior.d.ts.map +1 -0
- package/dist/preview/editable-markdown-preview/behavior.js +57 -0
- package/dist/preview/editable-markdown-preview/behavior.test.d.ts +2 -0
- package/dist/preview/editable-markdown-preview/behavior.test.d.ts.map +1 -0
- package/dist/preview/editable-markdown-preview/behavior.test.js +36 -0
- package/dist/preview/editable-markdown-preview/editable-markdown-surface.svelte +386 -0
- package/dist/preview/editable-markdown-preview/editable-markdown-surface.svelte.d.ts +35 -0
- package/dist/preview/editable-markdown-preview/editable-markdown-surface.svelte.d.ts.map +1 -0
- package/dist/preview/editable-markdown-preview/editor-surface.svelte +228 -0
- package/dist/preview/editable-markdown-preview/editor-surface.svelte.d.ts +22 -0
- package/dist/preview/editable-markdown-preview/editor-surface.svelte.d.ts.map +1 -0
- package/dist/preview/editable-markdown-preview/serialized-writer.d.ts +36 -0
- package/dist/preview/editable-markdown-preview/serialized-writer.d.ts.map +1 -0
- package/dist/preview/editable-markdown-preview/serialized-writer.js +109 -0
- package/dist/preview/editable-markdown-preview/serialized-writer.test.d.ts +2 -0
- package/dist/preview/editable-markdown-preview/serialized-writer.test.d.ts.map +1 -0
- package/dist/preview/editable-markdown-preview/serialized-writer.test.js +59 -0
- package/dist/preview/editable-markdown-preview.svelte +195 -0
- package/dist/preview/editable-markdown-preview.svelte.d.ts +37 -0
- package/dist/preview/editable-markdown-preview.svelte.d.ts.map +1 -0
- package/dist/preview/embed-target.d.ts +13 -0
- package/dist/preview/embed-target.d.ts.map +1 -0
- package/dist/preview/embed-target.js +133 -0
- package/dist/preview/embed-target.test.d.ts +2 -0
- package/dist/preview/embed-target.test.d.ts.map +1 -0
- package/dist/preview/embed-target.test.js +78 -0
- package/dist/preview/file-embed.svelte +56 -0
- package/dist/preview/file-embed.svelte.d.ts +32 -0
- package/dist/preview/file-embed.svelte.d.ts.map +1 -0
- package/dist/preview/frontmatter/controller.svelte.d.ts +58 -0
- package/dist/preview/frontmatter/controller.svelte.d.ts.map +1 -0
- package/dist/preview/frontmatter/controller.svelte.js +195 -0
- package/dist/preview/frontmatter/defaults.d.ts +3 -0
- package/dist/preview/frontmatter/defaults.d.ts.map +1 -0
- package/dist/preview/frontmatter/defaults.js +32 -0
- package/dist/preview/frontmatter/frontmatter.test.d.ts +2 -0
- package/dist/preview/frontmatter/frontmatter.test.d.ts.map +1 -0
- package/dist/preview/frontmatter/frontmatter.test.js +190 -0
- package/dist/preview/frontmatter/index.d.ts +12 -0
- package/dist/preview/frontmatter/index.d.ts.map +1 -0
- package/dist/preview/frontmatter/index.js +11 -0
- package/dist/preview/frontmatter/manager.d.ts +28 -0
- package/dist/preview/frontmatter/manager.d.ts.map +1 -0
- package/dist/preview/frontmatter/manager.js +46 -0
- package/dist/preview/frontmatter/parse.d.ts +4 -0
- package/dist/preview/frontmatter/parse.d.ts.map +1 -0
- package/dist/preview/frontmatter/parse.js +49 -0
- package/dist/preview/frontmatter/predicates.d.ts +3 -0
- package/dist/preview/frontmatter/predicates.d.ts.map +1 -0
- package/dist/preview/frontmatter/predicates.js +7 -0
- package/dist/preview/frontmatter/properties.d.ts +13 -0
- package/dist/preview/frontmatter/properties.d.ts.map +1 -0
- package/dist/preview/frontmatter/properties.js +250 -0
- package/dist/preview/frontmatter/serialize.d.ts +3 -0
- package/dist/preview/frontmatter/serialize.d.ts.map +1 -0
- package/dist/preview/frontmatter/serialize.js +10 -0
- package/dist/preview/frontmatter/suggestions.d.ts +11 -0
- package/dist/preview/frontmatter/suggestions.d.ts.map +1 -0
- package/dist/preview/frontmatter/suggestions.js +91 -0
- package/dist/preview/frontmatter/suggestions.test.d.ts +2 -0
- package/dist/preview/frontmatter/suggestions.test.d.ts.map +1 -0
- package/dist/preview/frontmatter/suggestions.test.js +45 -0
- package/dist/preview/frontmatter/types.d.ts +66 -0
- package/dist/preview/frontmatter/types.d.ts.map +1 -0
- package/dist/preview/frontmatter/types.js +27 -0
- package/dist/preview/frontmatter/values.d.ts +5 -0
- package/dist/preview/frontmatter/values.d.ts.map +1 -0
- package/dist/preview/frontmatter/values.js +96 -0
- package/dist/preview/frontmatter/widgets.d.ts +9 -0
- package/dist/preview/frontmatter/widgets.d.ts.map +1 -0
- package/dist/preview/frontmatter/widgets.js +104 -0
- package/dist/preview/index.d.ts +18 -0
- package/dist/preview/index.d.ts.map +1 -0
- package/dist/preview/index.js +15 -0
- package/dist/preview/markdown-embed.svelte +80 -0
- package/dist/preview/markdown-embed.svelte.d.ts +27 -0
- package/dist/preview/markdown-embed.svelte.d.ts.map +1 -0
- package/dist/preview/markdown-outline.svelte +256 -0
- package/dist/preview/markdown-outline.svelte.d.ts +15 -0
- package/dist/preview/markdown-outline.svelte.d.ts.map +1 -0
- package/dist/preview/markdown-preview.svelte +500 -0
- package/dist/preview/markdown-preview.svelte.d.ts +30 -0
- package/dist/preview/markdown-preview.svelte.d.ts.map +1 -0
- package/dist/preview/note-link.svelte +78 -0
- package/dist/preview/note-link.svelte.d.ts +25 -0
- package/dist/preview/note-link.svelte.d.ts.map +1 -0
- package/dist/preview/outline.d.ts +16 -0
- package/dist/preview/outline.d.ts.map +1 -0
- package/dist/preview/outline.js +54 -0
- package/dist/preview/outline.test.d.ts +2 -0
- package/dist/preview/outline.test.d.ts.map +1 -0
- package/dist/preview/outline.test.js +98 -0
- package/dist/preview/portable-surfaces.test.d.ts +2 -0
- package/dist/preview/portable-surfaces.test.d.ts.map +1 -0
- package/dist/preview/portable-surfaces.test.js +482 -0
- package/dist/preview/preview.test.d.ts +2 -0
- package/dist/preview/preview.test.d.ts.map +1 -0
- package/dist/preview/preview.test.js +124 -0
- package/dist/preview/rehype-code-context.d.ts +5 -0
- package/dist/preview/rehype-code-context.d.ts.map +1 -0
- package/dist/preview/rehype-code-context.js +17 -0
- package/dist/preview/rehype-highlight-lines.d.ts +9 -0
- package/dist/preview/rehype-highlight-lines.d.ts.map +1 -0
- package/dist/preview/rehype-highlight-lines.js +257 -0
- package/dist/preview/rehype-table-spans.d.ts +4 -0
- package/dist/preview/rehype-table-spans.d.ts.map +1 -0
- package/dist/preview/rehype-table-spans.js +120 -0
- package/dist/preview/remark/callouts.d.ts +4 -0
- package/dist/preview/remark/callouts.d.ts.map +1 -0
- package/dist/preview/remark/callouts.js +81 -0
- package/dist/preview/remark/callouts.test.d.ts +2 -0
- package/dist/preview/remark/callouts.test.d.ts.map +1 -0
- package/dist/preview/remark/callouts.test.js +23 -0
- package/dist/preview/remark/custom-checklists.d.ts +25 -0
- package/dist/preview/remark/custom-checklists.d.ts.map +1 -0
- package/dist/preview/remark/custom-checklists.js +204 -0
- package/dist/preview/remark/custom-checklists.test.d.ts +2 -0
- package/dist/preview/remark/custom-checklists.test.d.ts.map +1 -0
- package/dist/preview/remark/custom-checklists.test.js +51 -0
- package/dist/preview/remark/external-links.d.ts +4 -0
- package/dist/preview/remark/external-links.d.ts.map +1 -0
- package/dist/preview/remark/external-links.js +34 -0
- package/dist/preview/remark/hast.d.ts +6 -0
- package/dist/preview/remark/hast.d.ts.map +1 -0
- package/dist/preview/remark/hast.js +60 -0
- package/dist/preview/remark/headings.d.ts +8 -0
- package/dist/preview/remark/headings.d.ts.map +1 -0
- package/dist/preview/remark/headings.js +40 -0
- package/dist/preview/remark/links.test.d.ts +2 -0
- package/dist/preview/remark/links.test.d.ts.map +1 -0
- package/dist/preview/remark/links.test.js +62 -0
- package/dist/preview/remark/list-callouts.d.ts +14 -0
- package/dist/preview/remark/list-callouts.d.ts.map +1 -0
- package/dist/preview/remark/list-callouts.js +91 -0
- package/dist/preview/remark/multimarkdown-table.d.ts +11 -0
- package/dist/preview/remark/multimarkdown-table.d.ts.map +1 -0
- package/dist/preview/remark/multimarkdown-table.js +138 -0
- package/dist/preview/remark/parity.test.d.ts +2 -0
- package/dist/preview/remark/parity.test.d.ts.map +1 -0
- package/dist/preview/remark/parity.test.js +105 -0
- package/dist/preview/remark/pathlink.d.ts +4 -0
- package/dist/preview/remark/pathlink.d.ts.map +1 -0
- package/dist/preview/remark/pathlink.js +26 -0
- package/dist/preview/remark/tags.d.ts +4 -0
- package/dist/preview/remark/tags.d.ts.map +1 -0
- package/dist/preview/remark/tags.js +22 -0
- package/dist/preview/remark/utils.d.ts +12 -0
- package/dist/preview/remark/utils.d.ts.map +1 -0
- package/dist/preview/remark/utils.js +74 -0
- package/dist/preview/remark/wikilink.d.ts +4 -0
- package/dist/preview/remark/wikilink.d.ts.map +1 -0
- package/dist/preview/remark/wikilink.js +23 -0
- package/dist/preview/remark.d.ts +12 -0
- package/dist/preview/remark.d.ts.map +1 -0
- package/dist/preview/remark.js +11 -0
- package/dist/preview/renderer/context.svelte.d.ts +37 -0
- package/dist/preview/renderer/context.svelte.d.ts.map +1 -0
- package/dist/preview/renderer/context.svelte.js +47 -0
- package/dist/preview/renderer/markdown.svelte +109 -0
- package/dist/preview/renderer/markdown.svelte.d.ts +28 -0
- package/dist/preview/renderer/markdown.svelte.d.ts.map +1 -0
- package/dist/preview/renderer/renderer.svelte +122 -0
- package/dist/preview/renderer/renderer.svelte.d.ts +9 -0
- package/dist/preview/renderer/renderer.svelte.d.ts.map +1 -0
- package/dist/preview/renderer/types.d.ts +20 -0
- package/dist/preview/renderer/types.d.ts.map +1 -0
- package/dist/preview/renderer/types.js +1 -0
- package/dist/preview/renderer/utils.d.ts +9 -0
- package/dist/preview/renderer/utils.d.ts.map +1 -0
- package/dist/preview/renderer/utils.js +135 -0
- package/dist/preview/styles/blockquotes-footnotes.css +78 -0
- package/dist/preview/styles/callouts.css +171 -0
- package/dist/preview/styles/code-katex.css +213 -0
- package/dist/preview/styles/editor-shared.css +132 -0
- package/dist/preview/styles/frontmatter-collapsible.css +94 -0
- package/dist/preview/styles/frontmatter-properties.css +532 -0
- package/dist/preview/styles/frontmatter-properties.test.d.ts +2 -0
- package/dist/preview/styles/frontmatter-properties.test.d.ts.map +1 -0
- package/dist/preview/styles/frontmatter-properties.test.js +57 -0
- package/dist/preview/styles/headings.css +183 -0
- package/dist/preview/styles/images.css +177 -0
- package/dist/preview/styles/links-embeds-tags.css +275 -0
- package/dist/preview/styles/list-callouts.css +281 -0
- package/dist/preview/styles/lists-tasks.css +638 -0
- package/dist/preview/styles/live-preview.css +58 -0
- package/dist/preview/styles/mermaid-highlight.css +112 -0
- package/dist/preview/styles/outline.css +219 -0
- package/dist/preview/styles/reading-mode.css +151 -0
- package/dist/preview/styles/source-mode.css +498 -0
- package/dist/preview/styles/source-mode.test.d.ts +2 -0
- package/dist/preview/styles/source-mode.test.d.ts.map +1 -0
- package/dist/preview/styles/source-mode.test.js +13 -0
- package/dist/preview/styles/surfaces.css +56 -0
- package/dist/preview/styles/tables.css +550 -0
- package/dist/preview/styles/tokens.css +269 -0
- package/dist/preview/styles/utilities.css +700 -0
- package/dist/preview/styles.css +22 -0
- package/dist/preview/test-utils.d.ts +3 -0
- package/dist/preview/test-utils.d.ts.map +1 -0
- package/dist/preview/test-utils.js +15 -0
- package/dist/styles.css +139 -0
- package/dist/tables/adobe-gridtables.d.ts +6 -0
- package/dist/tables/editor-column.svelte +136 -0
- package/dist/tables/editor-column.svelte.d.ts +12 -0
- package/dist/tables/editor-column.svelte.d.ts.map +1 -0
- package/dist/tables/editor-table.svelte +967 -0
- package/dist/tables/editor-table.svelte.d.ts +12 -0
- package/dist/tables/editor-table.svelte.d.ts.map +1 -0
- package/dist/tables/extension.d.ts +19 -0
- package/dist/tables/extension.d.ts.map +1 -0
- package/dist/tables/extension.js +189 -0
- package/dist/tables/extension.test.d.ts +2 -0
- package/dist/tables/extension.test.d.ts.map +1 -0
- package/dist/tables/extension.test.js +100 -0
- package/dist/tables/from-markdown.d.ts +1 -0
- package/dist/tables/from-markdown.js +378 -0
- package/dist/tables/grid-editor-column.svelte +127 -0
- package/dist/tables/grid-editor-column.svelte.d.ts +10 -0
- package/dist/tables/grid-editor-column.svelte.d.ts.map +1 -0
- package/dist/tables/grid-editor-column.test.d.ts +2 -0
- package/dist/tables/grid-editor-column.test.d.ts.map +1 -0
- package/dist/tables/grid-editor-column.test.js +27 -0
- package/dist/tables/grid-editor-table.svelte +1260 -0
- package/dist/tables/grid-editor-table.svelte.d.ts +12 -0
- package/dist/tables/grid-editor-table.svelte.d.ts.map +1 -0
- package/dist/tables/grid-table-extension.d.ts +14 -0
- package/dist/tables/grid-table-extension.d.ts.map +1 -0
- package/dist/tables/grid-table-extension.js +183 -0
- package/dist/tables/grid-table.d.ts +141 -0
- package/dist/tables/grid-table.d.ts.map +1 -0
- package/dist/tables/grid-table.js +425 -0
- package/dist/tables/grid-table.test.d.ts +2 -0
- package/dist/tables/grid-table.test.d.ts.map +1 -0
- package/dist/tables/grid-table.test.js +140 -0
- package/dist/tables/index.d.ts +13 -0
- package/dist/tables/index.d.ts.map +1 -0
- package/dist/tables/index.js +12 -0
- package/dist/tables/index.test.d.ts +2 -0
- package/dist/tables/index.test.d.ts.map +1 -0
- package/dist/tables/index.test.js +7 -0
- package/dist/tables/inline-editor-extensions.d.ts +3 -0
- package/dist/tables/inline-editor-extensions.d.ts.map +1 -0
- package/dist/tables/inline-editor-extensions.js +16 -0
- package/dist/tables/inline-editor-extensions.test.d.ts +2 -0
- package/dist/tables/inline-editor-extensions.test.d.ts.map +1 -0
- package/dist/tables/inline-editor-extensions.test.js +23 -0
- package/dist/tables/markdown-table-column-head.svelte +103 -0
- package/dist/tables/markdown-table-column-head.svelte.d.ts +14 -0
- package/dist/tables/markdown-table-column-head.svelte.d.ts.map +1 -0
- package/dist/tables/markdown-table-data-cell.svelte +121 -0
- package/dist/tables/markdown-table-data-cell.svelte.d.ts +24 -0
- package/dist/tables/markdown-table-data-cell.svelte.d.ts.map +1 -0
- package/dist/tables/markdown-table-dnd.d.ts +6 -0
- package/dist/tables/markdown-table-dnd.d.ts.map +1 -0
- package/dist/tables/markdown-table-dnd.js +6 -0
- package/dist/tables/markdown-table-row-gutter-cell.svelte +161 -0
- package/dist/tables/markdown-table-row-gutter-cell.svelte.d.ts +15 -0
- package/dist/tables/markdown-table-row-gutter-cell.svelte.d.ts.map +1 -0
- package/dist/tables/menu-component.svelte +109 -0
- package/dist/tables/menu-component.svelte.d.ts +8 -0
- package/dist/tables/menu-component.svelte.d.ts.map +1 -0
- package/dist/tables/menu.d.ts +21 -0
- package/dist/tables/menu.d.ts.map +1 -0
- package/dist/tables/menu.js +41 -0
- package/dist/tables/pipe-table.d.ts +4 -0
- package/dist/tables/pipe-table.d.ts.map +1 -0
- package/dist/tables/pipe-table.js +62 -0
- package/dist/tables/pipe-table.test.d.ts +2 -0
- package/dist/tables/pipe-table.test.d.ts.map +1 -0
- package/dist/tables/pipe-table.test.js +13 -0
- package/dist/tables/syntax.d.ts +1 -0
- package/dist/tables/syntax.js +436 -0
- package/dist/tables/table-line-scroll-sync.d.ts +5 -0
- package/dist/tables/table-line-scroll-sync.d.ts.map +1 -0
- package/dist/tables/table-line-scroll-sync.js +123 -0
- package/dist/tables/table-node.d.ts +92 -0
- package/dist/tables/table-node.d.ts.map +1 -0
- package/dist/tables/table-node.js +514 -0
- package/dist/tables/table-node.test.d.ts +2 -0
- package/dist/tables/table-node.test.d.ts.map +1 -0
- package/dist/tables/table-node.test.js +167 -0
- package/dist/tables/types.d.ts +25 -0
- package/dist/tables/types.d.ts.map +1 -0
- package/dist/tables/types.js +8 -0
- package/dist/tables/utils.d.ts +4 -0
- package/dist/tables/utils.d.ts.map +1 -0
- package/dist/tables/utils.js +16 -0
- package/dist/tables/widgets/grid-table-widget.d.ts +3 -0
- package/dist/tables/widgets/grid-table-widget.d.ts.map +1 -0
- package/dist/tables/widgets/grid-table-widget.js +26 -0
- package/dist/tables/widgets/pipe-table-widget.d.ts +3 -0
- package/dist/tables/widgets/pipe-table-widget.d.ts.map +1 -0
- package/dist/tables/widgets/pipe-table-widget.js +25 -0
- package/dist/tables/widgets/source-button.d.ts +2 -0
- package/dist/tables/widgets/source-button.d.ts.map +1 -0
- package/dist/tables/widgets/source-button.js +20 -0
- package/dist/tables/widgets/source-button.test.d.ts +2 -0
- package/dist/tables/widgets/source-button.test.d.ts.map +1 -0
- package/dist/tables/widgets/source-button.test.js +11 -0
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/test-setup.js +31 -0
- package/dist/themes/_contract.css +88 -0
- package/dist/themes/_mira-palette.css +187 -0
- package/dist/themes/_obsidian-palette.css +183 -0
- package/dist/themes/mira.css +2 -0
- package/dist/themes/obsidian.css +2 -0
- package/dist/themes/theme-contract.test.d.ts +2 -0
- package/dist/themes/theme-contract.test.d.ts.map +1 -0
- package/dist/themes/theme-contract.test.js +88 -0
- package/dist/themes.css +3 -0
- package/dist/types.d.ts +55 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/ui/appearance/index.d.ts +6 -0
- package/dist/ui/appearance/index.d.ts.map +1 -0
- package/dist/ui/appearance/index.js +9 -0
- package/dist/ui/button/button.shared.d.ts +59 -0
- package/dist/ui/button/button.shared.d.ts.map +1 -0
- package/dist/ui/button/button.shared.js +25 -0
- package/dist/ui/button/button.svelte +42 -0
- package/dist/ui/button/button.svelte.d.ts +5 -0
- package/dist/ui/button/button.svelte.d.ts.map +1 -0
- package/dist/ui/button/index.d.ts +4 -0
- package/dist/ui/button/index.d.ts.map +1 -0
- package/dist/ui/button/index.js +5 -0
- package/dist/ui/context-menu/context-menu-checkbox-item.svelte +40 -0
- package/dist/ui/context-menu/context-menu-checkbox-item.svelte.d.ts +10 -0
- package/dist/ui/context-menu/context-menu-checkbox-item.svelte.d.ts.map +1 -0
- package/dist/ui/context-menu/context-menu-content.svelte +61 -0
- package/dist/ui/context-menu/context-menu-content.svelte.d.ts +8 -0
- package/dist/ui/context-menu/context-menu-content.svelte.d.ts.map +1 -0
- package/dist/ui/context-menu/context-menu-group-heading.svelte +24 -0
- package/dist/ui/context-menu/context-menu-group-heading.svelte.d.ts +8 -0
- package/dist/ui/context-menu/context-menu-group-heading.svelte.d.ts.map +1 -0
- package/dist/ui/context-menu/context-menu-group.svelte +12 -0
- package/dist/ui/context-menu/context-menu-group.svelte.d.ts +5 -0
- package/dist/ui/context-menu/context-menu-group.svelte.d.ts.map +1 -0
- package/dist/ui/context-menu/context-menu-item.svelte +27 -0
- package/dist/ui/context-menu/context-menu-item.svelte.d.ts +9 -0
- package/dist/ui/context-menu/context-menu-item.svelte.d.ts.map +1 -0
- package/dist/ui/context-menu/context-menu-label.svelte +27 -0
- package/dist/ui/context-menu/context-menu-label.svelte.d.ts +9 -0
- package/dist/ui/context-menu/context-menu-label.svelte.d.ts.map +1 -0
- package/dist/ui/context-menu/context-menu-radio-group.svelte +16 -0
- package/dist/ui/context-menu/context-menu-radio-group.svelte.d.ts +5 -0
- package/dist/ui/context-menu/context-menu-radio-group.svelte.d.ts.map +1 -0
- package/dist/ui/context-menu/context-menu-radio-item.svelte +33 -0
- package/dist/ui/context-menu/context-menu-radio-item.svelte.d.ts +5 -0
- package/dist/ui/context-menu/context-menu-radio-item.svelte.d.ts.map +1 -0
- package/dist/ui/context-menu/context-menu-root.svelte +17 -0
- package/dist/ui/context-menu/context-menu-root.svelte.d.ts +4 -0
- package/dist/ui/context-menu/context-menu-root.svelte.d.ts.map +1 -0
- package/dist/ui/context-menu/context-menu-separator.svelte +17 -0
- package/dist/ui/context-menu/context-menu-separator.svelte.d.ts +5 -0
- package/dist/ui/context-menu/context-menu-separator.svelte.d.ts.map +1 -0
- package/dist/ui/context-menu/context-menu-shortcut.svelte +20 -0
- package/dist/ui/context-menu/context-menu-shortcut.svelte.d.ts +6 -0
- package/dist/ui/context-menu/context-menu-shortcut.svelte.d.ts.map +1 -0
- package/dist/ui/context-menu/context-menu-sub-content.svelte +20 -0
- package/dist/ui/context-menu/context-menu-sub-content.svelte.d.ts +5 -0
- package/dist/ui/context-menu/context-menu-sub-content.svelte.d.ts.map +1 -0
- package/dist/ui/context-menu/context-menu-sub-trigger.svelte +29 -0
- package/dist/ui/context-menu/context-menu-sub-trigger.svelte.d.ts +9 -0
- package/dist/ui/context-menu/context-menu-sub-trigger.svelte.d.ts.map +1 -0
- package/dist/ui/context-menu/context-menu-trigger.svelte +29 -0
- package/dist/ui/context-menu/context-menu-trigger.svelte.d.ts +5 -0
- package/dist/ui/context-menu/context-menu-trigger.svelte.d.ts.map +1 -0
- package/dist/ui/context-menu/index.d.ts +17 -0
- package/dist/ui/context-menu/index.d.ts.map +1 -0
- package/dist/ui/context-menu/index.js +19 -0
- package/dist/ui/dialog/dialog-close.svelte +8 -0
- package/dist/ui/dialog/dialog-close.svelte.d.ts +5 -0
- package/dist/ui/dialog/dialog-close.svelte.d.ts.map +1 -0
- package/dist/ui/dialog/dialog-content.svelte +66 -0
- package/dist/ui/dialog/dialog-content.svelte.d.ts +12 -0
- package/dist/ui/dialog/dialog-content.svelte.d.ts.map +1 -0
- package/dist/ui/dialog/dialog-description.svelte +17 -0
- package/dist/ui/dialog/dialog-description.svelte.d.ts +5 -0
- package/dist/ui/dialog/dialog-description.svelte.d.ts.map +1 -0
- package/dist/ui/dialog/dialog-footer.svelte +23 -0
- package/dist/ui/dialog/dialog-footer.svelte.d.ts +6 -0
- package/dist/ui/dialog/dialog-footer.svelte.d.ts.map +1 -0
- package/dist/ui/dialog/dialog-header.svelte +20 -0
- package/dist/ui/dialog/dialog-header.svelte.d.ts +6 -0
- package/dist/ui/dialog/dialog-header.svelte.d.ts.map +1 -0
- package/dist/ui/dialog/dialog-overlay.svelte +21 -0
- package/dist/ui/dialog/dialog-overlay.svelte.d.ts +5 -0
- package/dist/ui/dialog/dialog-overlay.svelte.d.ts.map +1 -0
- package/dist/ui/dialog/dialog-title.svelte +17 -0
- package/dist/ui/dialog/dialog-title.svelte.d.ts +5 -0
- package/dist/ui/dialog/dialog-title.svelte.d.ts.map +1 -0
- package/dist/ui/dialog/dialog-trigger.svelte +8 -0
- package/dist/ui/dialog/dialog-trigger.svelte.d.ts +5 -0
- package/dist/ui/dialog/dialog-trigger.svelte.d.ts.map +1 -0
- package/dist/ui/dialog/index.d.ts +12 -0
- package/dist/ui/dialog/index.d.ts.map +1 -0
- package/dist/ui/dialog/index.js +14 -0
- package/dist/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +43 -0
- package/dist/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte.d.ts +10 -0
- package/dist/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/dropdown-menu-content.svelte +63 -0
- package/dist/ui/dropdown-menu/dropdown-menu-content.svelte.d.ts +8 -0
- package/dist/ui/dropdown-menu/dropdown-menu-content.svelte.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/dropdown-menu-group-heading.svelte +22 -0
- package/dist/ui/dropdown-menu/dropdown-menu-group-heading.svelte.d.ts +9 -0
- package/dist/ui/dropdown-menu/dropdown-menu-group-heading.svelte.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/dropdown-menu-group.svelte +14 -0
- package/dist/ui/dropdown-menu/dropdown-menu-group.svelte.d.ts +5 -0
- package/dist/ui/dropdown-menu/dropdown-menu-group.svelte.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/dropdown-menu-item.svelte +27 -0
- package/dist/ui/dropdown-menu/dropdown-menu-item.svelte.d.ts +9 -0
- package/dist/ui/dropdown-menu/dropdown-menu-item.svelte.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/dropdown-menu-label.svelte +24 -0
- package/dist/ui/dropdown-menu/dropdown-menu-label.svelte.d.ts +9 -0
- package/dist/ui/dropdown-menu/dropdown-menu-label.svelte.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/dropdown-menu-radio-group.svelte +16 -0
- package/dist/ui/dropdown-menu/dropdown-menu-radio-group.svelte.d.ts +5 -0
- package/dist/ui/dropdown-menu/dropdown-menu-radio-group.svelte.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/dropdown-menu-radio-item.svelte +33 -0
- package/dist/ui/dropdown-menu/dropdown-menu-radio-item.svelte.d.ts +5 -0
- package/dist/ui/dropdown-menu/dropdown-menu-radio-item.svelte.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/dropdown-menu-root.svelte +27 -0
- package/dist/ui/dropdown-menu/dropdown-menu-root.svelte.d.ts +4 -0
- package/dist/ui/dropdown-menu/dropdown-menu-root.svelte.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/dropdown-menu-separator.svelte +17 -0
- package/dist/ui/dropdown-menu/dropdown-menu-separator.svelte.d.ts +5 -0
- package/dist/ui/dropdown-menu/dropdown-menu-separator.svelte.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/dropdown-menu-shortcut.svelte +20 -0
- package/dist/ui/dropdown-menu/dropdown-menu-shortcut.svelte.d.ts +6 -0
- package/dist/ui/dropdown-menu/dropdown-menu-shortcut.svelte.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/dropdown-menu-sub-content.svelte +20 -0
- package/dist/ui/dropdown-menu/dropdown-menu-sub-content.svelte.d.ts +5 -0
- package/dist/ui/dropdown-menu/dropdown-menu-sub-content.svelte.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +29 -0
- package/dist/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte.d.ts +8 -0
- package/dist/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/dropdown-menu-trigger.svelte +29 -0
- package/dist/ui/dropdown-menu/dropdown-menu-trigger.svelte.d.ts +5 -0
- package/dist/ui/dropdown-menu/dropdown-menu-trigger.svelte.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/index.d.ts +17 -0
- package/dist/ui/dropdown-menu/index.d.ts.map +1 -0
- package/dist/ui/dropdown-menu/index.js +17 -0
- package/dist/ui/index.d.ts +13 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +12 -0
- package/dist/ui/index.test.d.ts +2 -0
- package/dist/ui/index.test.d.ts.map +1 -0
- package/dist/ui/index.test.js +7 -0
- package/dist/ui/internal/overlay-portal-context.d.ts +19 -0
- package/dist/ui/internal/overlay-portal-context.d.ts.map +1 -0
- package/dist/ui/internal/overlay-portal-context.js +39 -0
- package/dist/ui/popover/index.d.ts +7 -0
- package/dist/ui/popover/index.d.ts.map +1 -0
- package/dist/ui/popover/index.js +6 -0
- package/dist/ui/popover/popover-content.svelte +65 -0
- package/dist/ui/popover/popover-content.svelte.d.ts +8 -0
- package/dist/ui/popover/popover-content.svelte.d.ts.map +1 -0
- package/dist/ui/popover/popover-root.svelte +15 -0
- package/dist/ui/popover/popover-root.svelte.d.ts +4 -0
- package/dist/ui/popover/popover-root.svelte.d.ts.map +1 -0
- package/dist/ui/popover/popover-trigger.svelte +23 -0
- package/dist/ui/popover/popover-trigger.svelte.d.ts +5 -0
- package/dist/ui/popover/popover-trigger.svelte.d.ts.map +1 -0
- package/dist/ui/scroll-area/index.d.ts +2 -0
- package/dist/ui/scroll-area/index.d.ts.map +1 -0
- package/dist/ui/scroll-area/index.js +1 -0
- package/dist/ui/scroll-area/scroll-area.svelte +14 -0
- package/dist/ui/scroll-area/scroll-area.svelte.d.ts +9 -0
- package/dist/ui/scroll-area/scroll-area.svelte.d.ts.map +1 -0
- package/dist/ui/separator/index.d.ts +2 -0
- package/dist/ui/separator/index.d.ts.map +1 -0
- package/dist/ui/separator/index.js +1 -0
- package/dist/ui/separator/separator.svelte +14 -0
- package/dist/ui/separator/separator.svelte.d.ts +8 -0
- package/dist/ui/separator/separator.svelte.d.ts.map +1 -0
- package/dist/ui/styles.css +760 -0
- package/dist/ui/styles.test.d.ts +2 -0
- package/dist/ui/styles.test.d.ts.map +1 -0
- package/dist/ui/styles.test.js +26 -0
- package/dist/ui/table/index.d.ts +10 -0
- package/dist/ui/table/index.d.ts.map +1 -0
- package/dist/ui/table/index.js +11 -0
- package/dist/ui/table/table-body.svelte +20 -0
- package/dist/ui/table/table-body.svelte.d.ts +6 -0
- package/dist/ui/table/table-body.svelte.d.ts.map +1 -0
- package/dist/ui/table/table-caption.svelte +20 -0
- package/dist/ui/table/table-caption.svelte.d.ts +6 -0
- package/dist/ui/table/table-caption.svelte.d.ts.map +1 -0
- package/dist/ui/table/table-cell.svelte +23 -0
- package/dist/ui/table/table-cell.svelte.d.ts +6 -0
- package/dist/ui/table/table-cell.svelte.d.ts.map +1 -0
- package/dist/ui/table/table-footer.svelte +23 -0
- package/dist/ui/table/table-footer.svelte.d.ts +6 -0
- package/dist/ui/table/table-footer.svelte.d.ts.map +1 -0
- package/dist/ui/table/table-head.svelte +23 -0
- package/dist/ui/table/table-head.svelte.d.ts +6 -0
- package/dist/ui/table/table-head.svelte.d.ts.map +1 -0
- package/dist/ui/table/table-header.svelte +20 -0
- package/dist/ui/table/table-header.svelte.d.ts +6 -0
- package/dist/ui/table/table-header.svelte.d.ts.map +1 -0
- package/dist/ui/table/table-row.svelte +23 -0
- package/dist/ui/table/table-row.svelte.d.ts +6 -0
- package/dist/ui/table/table-row.svelte.d.ts.map +1 -0
- package/dist/ui/table/table.svelte +21 -0
- package/dist/ui/table/table.svelte.d.ts +9 -0
- package/dist/ui/table/table.svelte.d.ts.map +1 -0
- package/dist/ui/table-dnd/index.d.ts +4 -0
- package/dist/ui/table-dnd/index.d.ts.map +1 -0
- package/dist/ui/table-dnd/index.js +3 -0
- package/dist/ui/table-dnd/table-dnd-sensors.d.ts +3 -0
- package/dist/ui/table-dnd/table-dnd-sensors.d.ts.map +1 -0
- package/dist/ui/table-dnd/table-dnd-sensors.js +11 -0
- package/dist/ui/table-dnd/table-dnd-utils.d.ts +30 -0
- package/dist/ui/table-dnd/table-dnd-utils.d.ts.map +1 -0
- package/dist/ui/table-dnd/table-dnd-utils.js +77 -0
- package/dist/ui/table-dnd/table-dnd-utils.test.d.ts +2 -0
- package/dist/ui/table-dnd/table-dnd-utils.test.d.ts.map +1 -0
- package/dist/ui/table-dnd/table-dnd-utils.test.js +46 -0
- package/dist/ui/table-dnd/table-drag-grip.svelte +60 -0
- package/dist/ui/table-dnd/table-drag-grip.svelte.d.ts +17 -0
- package/dist/ui/table-dnd/table-drag-grip.svelte.d.ts.map +1 -0
- package/dist/ui/toggle-group/context.d.ts +7 -0
- package/dist/ui/toggle-group/context.d.ts.map +1 -0
- package/dist/ui/toggle-group/context.js +8 -0
- package/dist/ui/toggle-group/index.d.ts +3 -0
- package/dist/ui/toggle-group/index.d.ts.map +1 -0
- package/dist/ui/toggle-group/index.js +2 -0
- package/dist/ui/toggle-group/toggle-group-item.svelte +33 -0
- package/dist/ui/toggle-group/toggle-group-item.svelte.d.ts +11 -0
- package/dist/ui/toggle-group/toggle-group-item.svelte.d.ts.map +1 -0
- package/dist/ui/toggle-group/toggle-group.svelte +74 -0
- package/dist/ui/toggle-group/toggle-group.svelte.d.ts +12 -0
- package/dist/ui/toggle-group/toggle-group.svelte.d.ts.map +1 -0
- package/dist/ui/toolbar/index.d.ts +7 -0
- package/dist/ui/toolbar/index.d.ts.map +1 -0
- package/dist/ui/toolbar/index.js +6 -0
- package/dist/ui/toolbar/toolbar-button.svelte +17 -0
- package/dist/ui/toolbar/toolbar-button.svelte.d.ts +5 -0
- package/dist/ui/toolbar/toolbar-button.svelte.d.ts.map +1 -0
- package/dist/ui/toolbar/toolbar-group-item.svelte +17 -0
- package/dist/ui/toolbar/toolbar-group-item.svelte.d.ts +4 -0
- package/dist/ui/toolbar/toolbar-group-item.svelte.d.ts.map +1 -0
- package/dist/ui/toolbar/toolbar-group.svelte +19 -0
- package/dist/ui/toolbar/toolbar-group.svelte.d.ts +5 -0
- package/dist/ui/toolbar/toolbar-group.svelte.d.ts.map +1 -0
- package/dist/ui/toolbar/toolbar-link.svelte +17 -0
- package/dist/ui/toolbar/toolbar-link.svelte.d.ts +5 -0
- package/dist/ui/toolbar/toolbar-link.svelte.d.ts.map +1 -0
- package/dist/ui/toolbar/toolbar.svelte +21 -0
- package/dist/ui/toolbar/toolbar.svelte.d.ts +5 -0
- package/dist/ui/toolbar/toolbar.svelte.d.ts.map +1 -0
- package/dist/ui/tooltip/index.d.ts +8 -0
- package/dist/ui/tooltip/index.d.ts.map +1 -0
- package/dist/ui/tooltip/index.js +9 -0
- package/dist/ui/tooltip/tooltip-content.svelte +85 -0
- package/dist/ui/tooltip/tooltip-content.svelte.d.ts +9 -0
- package/dist/ui/tooltip/tooltip-content.svelte.d.ts.map +1 -0
- package/dist/ui/tooltip/tooltip-root.svelte +15 -0
- package/dist/ui/tooltip/tooltip-root.svelte.d.ts +5 -0
- package/dist/ui/tooltip/tooltip-root.svelte.d.ts.map +1 -0
- package/dist/ui/tooltip/tooltip-trigger.svelte +23 -0
- package/dist/ui/tooltip/tooltip-trigger.svelte.d.ts +5 -0
- package/dist/ui/tooltip/tooltip-trigger.svelte.d.ts.map +1 -0
- package/dist/ui/utils.d.ts +13 -0
- package/dist/ui/utils.d.ts.map +1 -0
- package/dist/ui/utils.js +5 -0
- package/package.json +171 -0
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import { EditorView, ViewPlugin, } from "@codemirror/view";
|
|
2
|
+
import { selectionTouchesIndent } from "./indent";
|
|
3
|
+
const measuredPaddingProperty = "--hmd-indent-padding-measured";
|
|
4
|
+
const measuredPrefixProperty = "--hmd-indent-prefix-measured";
|
|
5
|
+
function setStylePropertyIfChanged(line, property, value) {
|
|
6
|
+
if (line.style.getPropertyValue(property) !== value) {
|
|
7
|
+
line.style.setProperty(property, value);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function removeStylePropertyIfPresent(line, property) {
|
|
11
|
+
if (line.style.getPropertyValue(property)) {
|
|
12
|
+
line.style.removeProperty(property);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function syncMeasuredIndentStyles(content, measurements) {
|
|
16
|
+
for (const line of content.querySelectorAll(".cm-line")) {
|
|
17
|
+
const from = Number.parseInt(line.dataset["lineFrom"] ?? "", 10);
|
|
18
|
+
const measurement = Number.isFinite(from)
|
|
19
|
+
? measurements.get(from)
|
|
20
|
+
: undefined;
|
|
21
|
+
if (!measurement) {
|
|
22
|
+
// The read and write phases can straddle a CodeMirror decoration
|
|
23
|
+
// update. Preserve a still-participating line that was absent from this
|
|
24
|
+
// read; only a line that definitively lost its indent contract clears
|
|
25
|
+
// the last valid measurement.
|
|
26
|
+
if (!line.hasAttribute("data-indent-prefix")) {
|
|
27
|
+
removeStylePropertyIfPresent(line, measuredPaddingProperty);
|
|
28
|
+
removeStylePropertyIfPresent(line, measuredPrefixProperty);
|
|
29
|
+
}
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
// A null component means that this measurement pass could not resolve it,
|
|
33
|
+
// not that the line stopped participating. Preserve the last valid value
|
|
34
|
+
// through focus and decoration transitions; a line absent from the map is
|
|
35
|
+
// the explicit signal to clear both properties.
|
|
36
|
+
if (measurement.paddingPx !== null) {
|
|
37
|
+
setStylePropertyIfChanged(line, measuredPaddingProperty, `${measurement.paddingPx}px`);
|
|
38
|
+
}
|
|
39
|
+
if (measurement.prefixPx !== null) {
|
|
40
|
+
setStylePropertyIfChanged(line, measuredPrefixProperty, `${measurement.prefixPx}px`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function quotePrefixLength(line) {
|
|
45
|
+
return line.match(/^\s*>+\s*/u)?.[0].length ?? 0;
|
|
46
|
+
}
|
|
47
|
+
function measureLeadingRawPrefixBox(line, prefix) {
|
|
48
|
+
const rawPrefix = Array.from(line.childNodes).find((node) => node.nodeType === Node.TEXT_NODE &&
|
|
49
|
+
typeof node.textContent === "string" &&
|
|
50
|
+
node.textContent.startsWith(prefix));
|
|
51
|
+
if (!rawPrefix) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const range = document.createRange();
|
|
55
|
+
range.setStart(rawPrefix, 0);
|
|
56
|
+
range.setEnd(rawPrefix, Math.min(prefix.length, rawPrefix.length));
|
|
57
|
+
const rect = Array.from(range.getClientRects()).find((candidate) => candidate.width > 0 || candidate.height > 0) ?? range.getBoundingClientRect();
|
|
58
|
+
return Number.isFinite(rect.width) && rect.width > 0
|
|
59
|
+
? { width: rect.width }
|
|
60
|
+
: null;
|
|
61
|
+
}
|
|
62
|
+
function measureTextNodeWidth(node) {
|
|
63
|
+
if (node.length <= 0) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const range = document.createRange();
|
|
67
|
+
range.setStart(node, 0);
|
|
68
|
+
range.setEnd(node, node.length);
|
|
69
|
+
const rect = Array.from(range.getClientRects()).find((candidate) => candidate.width > 0 || candidate.height > 0) ?? range.getBoundingClientRect();
|
|
70
|
+
return Number.isFinite(rect.width) && rect.width > 0 ? rect.width : null;
|
|
71
|
+
}
|
|
72
|
+
function measureMarkerWidth(line) {
|
|
73
|
+
const marker = line.querySelector(".cm-formatting-list-ul, .cm-formatting-list-ol");
|
|
74
|
+
const width = marker?.getBoundingClientRect().width;
|
|
75
|
+
return width && Number.isFinite(width) && width > 0 ? width : 0;
|
|
76
|
+
}
|
|
77
|
+
function measureQuotePrefixWidth(view, from) {
|
|
78
|
+
const length = quotePrefixLength(view.state.doc.lineAt(from).text);
|
|
79
|
+
if (length <= 0) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
const start = view.coordsAtPos(from);
|
|
83
|
+
const end = view.coordsAtPos(from + length);
|
|
84
|
+
if (!start || !end) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const measured = end.left - start.left;
|
|
88
|
+
return Number.isFinite(measured) && measured > 0 ? measured : null;
|
|
89
|
+
}
|
|
90
|
+
function measureStableWidgetWidth(line) {
|
|
91
|
+
const widget = line.querySelector(".cm-plain-indent-widget, .cm-hmd-list-indent");
|
|
92
|
+
if (!widget) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
const segmentWidth = Array.from(widget.querySelectorAll(".cm-indent")).reduce((total, segment) => {
|
|
96
|
+
return total + (measureIndentSegmentWidth(segment) ?? 0);
|
|
97
|
+
}, 0);
|
|
98
|
+
if (segmentWidth > 0) {
|
|
99
|
+
return segmentWidth;
|
|
100
|
+
}
|
|
101
|
+
const widgetWidth = widget.getBoundingClientRect().width;
|
|
102
|
+
return Number.isFinite(widgetWidth) && widgetWidth > 0 ? widgetWidth : null;
|
|
103
|
+
}
|
|
104
|
+
export function measureIndentSegmentWidth(segment) {
|
|
105
|
+
if (segment.classList.contains("cm-indent-spacer")) {
|
|
106
|
+
let textWidth = 0;
|
|
107
|
+
let measuredText = false;
|
|
108
|
+
const walker = document.createTreeWalker(segment, NodeFilter.SHOW_TEXT);
|
|
109
|
+
while (walker.nextNode()) {
|
|
110
|
+
const node = walker.currentNode;
|
|
111
|
+
if (!(node instanceof Text)) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const width = measureTextNodeWidth(node);
|
|
115
|
+
if (width !== null) {
|
|
116
|
+
textWidth += width;
|
|
117
|
+
measuredText = true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (measuredText && textWidth > 0) {
|
|
121
|
+
return textWidth;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const width = segment.getBoundingClientRect().width;
|
|
125
|
+
return Number.isFinite(width) && width > 0 ? width : null;
|
|
126
|
+
}
|
|
127
|
+
function measureRawPrefixWidth(view, line, from, prefix) {
|
|
128
|
+
const rawWidth = measureLeadingRawPrefixBox(line, prefix)?.width;
|
|
129
|
+
if (rawWidth !== undefined) {
|
|
130
|
+
return rawWidth;
|
|
131
|
+
}
|
|
132
|
+
const start = view.coordsAtPos(from);
|
|
133
|
+
const end = view.coordsAtPos(from + prefix.length);
|
|
134
|
+
if (start && end) {
|
|
135
|
+
const measured = end.left - start.left;
|
|
136
|
+
if (Number.isFinite(measured) && measured > 0) {
|
|
137
|
+
return measured;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
function measuredWidth(cache, line, cacheKey, canMeasureWidget) {
|
|
143
|
+
const measured = canMeasureWidget ? measureStableWidgetWidth(line) : null;
|
|
144
|
+
return measured ?? cache.get(cacheKey) ?? null;
|
|
145
|
+
}
|
|
146
|
+
function firstContentTextNode(line) {
|
|
147
|
+
const walker = document.createTreeWalker(line, NodeFilter.SHOW_TEXT);
|
|
148
|
+
while (walker.nextNode()) {
|
|
149
|
+
const node = walker.currentNode;
|
|
150
|
+
if (!(node instanceof Text)) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
const skipped = node.parentElement?.closest(".cm-hmd-list-indent, .cm-plain-indent-widget, .cm-formatting-list-ul, .cm-formatting-list-ol, .cm-blockquote-border, .cm-formatting-quote");
|
|
154
|
+
if (skipped && skipped !== line) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
const index = Array.from(node.textContent ?? "").findIndex((character) => /\S/u.test(character));
|
|
158
|
+
if (index < 0) {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
return node;
|
|
162
|
+
}
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
function measureLeadingContentChrome(line) {
|
|
166
|
+
const node = firstContentTextNode(line);
|
|
167
|
+
let chrome = 0;
|
|
168
|
+
for (let element = node?.parentElement ?? null; element && element !== line; element = element.parentElement) {
|
|
169
|
+
const style = getComputedStyle(element);
|
|
170
|
+
for (const value of [
|
|
171
|
+
style.paddingInlineStart,
|
|
172
|
+
style.borderInlineStartWidth,
|
|
173
|
+
style.marginInlineStart,
|
|
174
|
+
]) {
|
|
175
|
+
const width = Number.parseFloat(value);
|
|
176
|
+
if (Number.isFinite(width)) {
|
|
177
|
+
chrome += width;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return chrome;
|
|
182
|
+
}
|
|
183
|
+
function measureFirstContentOffset(line) {
|
|
184
|
+
const lineRect = line.getBoundingClientRect();
|
|
185
|
+
const node = firstContentTextNode(line);
|
|
186
|
+
if (node) {
|
|
187
|
+
const index = Array.from(node.textContent ?? "").findIndex((character) => /\S/u.test(character));
|
|
188
|
+
const range = document.createRange();
|
|
189
|
+
range.setStart(node, index);
|
|
190
|
+
range.setEnd(node, Math.min(index + 1, node.length));
|
|
191
|
+
const rect = Array.from(range.getClientRects()).find((candidate) => candidate.width > 0 || candidate.height > 0) ?? range.getBoundingClientRect();
|
|
192
|
+
if (Number.isFinite(rect.left) && (rect.width > 0 || rect.height > 0)) {
|
|
193
|
+
return rect.left - lineRect.left;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
class MeasuredIndentPlugin {
|
|
199
|
+
cache = new Map();
|
|
200
|
+
measuredPaddingByFrom = new Map();
|
|
201
|
+
reschedule = false;
|
|
202
|
+
scheduled = false;
|
|
203
|
+
transitionRetryFrames = 0;
|
|
204
|
+
retryFrames = 0;
|
|
205
|
+
destroyed = false;
|
|
206
|
+
constructor(view) {
|
|
207
|
+
this.schedule(view);
|
|
208
|
+
this.retryStartup(view);
|
|
209
|
+
}
|
|
210
|
+
update(update) {
|
|
211
|
+
if (update.docChanged) {
|
|
212
|
+
this.measuredPaddingByFrom.clear();
|
|
213
|
+
}
|
|
214
|
+
let needsMeasure = update.geometryChanged;
|
|
215
|
+
const selectionChanged = !update.startState.selection.eq(update.state.selection);
|
|
216
|
+
if (update.focusChanged || selectionChanged) {
|
|
217
|
+
// CodeMirror can rebuild line decorations across several frames after a
|
|
218
|
+
// focus or selection transition. Keep measuring until that transition
|
|
219
|
+
// has exposed its stable DOM, including under a busy browser worker.
|
|
220
|
+
this.transitionRetryFrames = 30;
|
|
221
|
+
}
|
|
222
|
+
// A geometry update can be the second half of CodeMirror revealing a raw
|
|
223
|
+
// prefix. Keep the last widget-backed width until a laid-out widget can
|
|
224
|
+
// replace it; clearing the cache here creates a one-frame 2ch/4ch jump.
|
|
225
|
+
needsMeasure ||= update.docChanged || update.viewportChanged;
|
|
226
|
+
needsMeasure ||= update.focusChanged;
|
|
227
|
+
needsMeasure ||= selectionChanged;
|
|
228
|
+
if (needsMeasure) {
|
|
229
|
+
this.schedule(update.view);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
schedule(view) {
|
|
233
|
+
if (this.scheduled) {
|
|
234
|
+
// Focus, selection, and geometry updates can arrive before the pending
|
|
235
|
+
// measure writes. Remember the later invalidation so a transitional DOM
|
|
236
|
+
// read cannot become the final indentation state.
|
|
237
|
+
this.reschedule = true;
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
if (!view.inView) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
this.scheduled = true;
|
|
244
|
+
view.requestMeasure({
|
|
245
|
+
read: () => {
|
|
246
|
+
const selection = view.state.selection.main;
|
|
247
|
+
if (!view.inView) {
|
|
248
|
+
return {
|
|
249
|
+
inactive: true,
|
|
250
|
+
measurements: [],
|
|
251
|
+
selectionFrom: selection.from,
|
|
252
|
+
selectionTo: selection.to,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
const lines = view.contentDOM.querySelectorAll(".cm-line[data-indent-prefix]");
|
|
256
|
+
const measurements = [];
|
|
257
|
+
for (const line of lines) {
|
|
258
|
+
const from = Number.parseInt(line.dataset["lineFrom"] ?? "", 10);
|
|
259
|
+
if (!Number.isFinite(from)) {
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
const prefix = line.dataset["indentPrefix"] ?? "";
|
|
263
|
+
const variant = line.dataset["indentVariant"] ?? "unknown";
|
|
264
|
+
const listKind = line.dataset["listKind"] ?? "";
|
|
265
|
+
const cacheKey = `${variant}\u0000${listKind}\u0000${prefix}`;
|
|
266
|
+
const isList = line.hasAttribute("data-list-kind");
|
|
267
|
+
const hasPrefix = prefix.length > 0;
|
|
268
|
+
const hasIndentWidget = Boolean(line.querySelector(".cm-plain-indent-widget, .cm-hmd-list-indent"));
|
|
269
|
+
const selection = view.state.selection.main;
|
|
270
|
+
const expectsIndentWidget = hasPrefix &&
|
|
271
|
+
!selectionTouchesIndent(selection.from, selection.to, from, from + prefix.length);
|
|
272
|
+
const stableIndentPx = hasPrefix
|
|
273
|
+
? measuredWidth(this.cache, line, cacheKey, hasIndentWidget)
|
|
274
|
+
: isList
|
|
275
|
+
? 0
|
|
276
|
+
: null;
|
|
277
|
+
const rawPrefixWidth = hasPrefix
|
|
278
|
+
? measureLeadingRawPrefixBox(line, prefix)?.width
|
|
279
|
+
: undefined;
|
|
280
|
+
const visibleIndentPx = hasPrefix
|
|
281
|
+
? expectsIndentWidget
|
|
282
|
+
? stableIndentPx === null
|
|
283
|
+
? null
|
|
284
|
+
: stableIndentPx + measureLeadingContentChrome(line)
|
|
285
|
+
: (rawPrefixWidth ??
|
|
286
|
+
(hasIndentWidget
|
|
287
|
+
? null
|
|
288
|
+
: measureRawPrefixWidth(view, line, from, prefix)))
|
|
289
|
+
: isList
|
|
290
|
+
? 0
|
|
291
|
+
: null;
|
|
292
|
+
const markerWidth = measureMarkerWidth(line);
|
|
293
|
+
const lineText = view.state.doc.lineAt(from).text;
|
|
294
|
+
const hasQuote = quotePrefixLength(lineText) > 0;
|
|
295
|
+
const isQuoteList = variant === "quote-list" || (isList && hasQuote);
|
|
296
|
+
const quoteWidth = variant === "quote" || isQuoteList
|
|
297
|
+
? measureQuotePrefixWidth(view, from)
|
|
298
|
+
: null;
|
|
299
|
+
let prefixPx = visibleIndentPx;
|
|
300
|
+
if (isList && prefixPx !== null) {
|
|
301
|
+
prefixPx += markerWidth;
|
|
302
|
+
}
|
|
303
|
+
if (quoteWidth !== null) {
|
|
304
|
+
prefixPx = isQuoteList ? quoteWidth + markerWidth : quoteWidth;
|
|
305
|
+
}
|
|
306
|
+
let paddingPx = stableIndentPx;
|
|
307
|
+
if (isList && paddingPx !== null) {
|
|
308
|
+
paddingPx += markerWidth;
|
|
309
|
+
}
|
|
310
|
+
if (quoteWidth !== null) {
|
|
311
|
+
paddingPx = isQuoteList ? quoteWidth + markerWidth : quoteWidth;
|
|
312
|
+
}
|
|
313
|
+
const anchorFrom = Number.parseInt(line.dataset["indentAnchorLineFrom"] ?? "", 10);
|
|
314
|
+
if (Number.isFinite(anchorFrom)) {
|
|
315
|
+
const anchor = view.contentDOM.querySelector(`.cm-line[data-line-from="${anchorFrom}"]`);
|
|
316
|
+
const anchorOffset = anchor
|
|
317
|
+
? measureFirstContentOffset(anchor)
|
|
318
|
+
: null;
|
|
319
|
+
if (anchorOffset !== null && anchorOffset > 0) {
|
|
320
|
+
paddingPx = anchorOffset;
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
// Focus and decoration transitions can briefly replace the
|
|
324
|
+
// anchor's measurable content span. Retain this document's last
|
|
325
|
+
// resolved parent column instead of dropping to the narrower
|
|
326
|
+
// structural fallback for a paint frame.
|
|
327
|
+
paddingPx = this.measuredPaddingByFrom.get(from) ?? null;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
measurements.push({
|
|
331
|
+
cacheKey,
|
|
332
|
+
from,
|
|
333
|
+
paddingPx,
|
|
334
|
+
prefixPx,
|
|
335
|
+
stableIndentPx,
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
return {
|
|
339
|
+
inactive: false,
|
|
340
|
+
measurements,
|
|
341
|
+
selectionFrom: selection.from,
|
|
342
|
+
selectionTo: selection.to,
|
|
343
|
+
};
|
|
344
|
+
},
|
|
345
|
+
write: ({ inactive, measurements, selectionFrom, selectionTo }) => {
|
|
346
|
+
this.scheduled = false;
|
|
347
|
+
const reschedule = this.reschedule;
|
|
348
|
+
this.reschedule = false;
|
|
349
|
+
const scheduleFollowUp = () => {
|
|
350
|
+
if (reschedule) {
|
|
351
|
+
this.schedule(view);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
if (this.transitionRetryFrames <= 0) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
this.transitionRetryFrames -= 1;
|
|
358
|
+
requestAnimationFrame(() => {
|
|
359
|
+
if (!this.destroyed) {
|
|
360
|
+
this.schedule(view);
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
};
|
|
364
|
+
// CodeMirror can move an otherwise visible editor out of its measured
|
|
365
|
+
// viewport between scheduling and reading. That is not evidence that
|
|
366
|
+
// its valid line measurements became stale.
|
|
367
|
+
if (inactive) {
|
|
368
|
+
scheduleFollowUp();
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
const selection = view.state.selection.main;
|
|
372
|
+
if (selection.from !== selectionFrom || selection.to !== selectionTo) {
|
|
373
|
+
this.schedule(view);
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
const byFrom = new Map();
|
|
377
|
+
for (const measurement of measurements) {
|
|
378
|
+
const { cacheKey, from, paddingPx, prefixPx, stableIndentPx } = measurement;
|
|
379
|
+
if (paddingPx !== null) {
|
|
380
|
+
this.measuredPaddingByFrom.set(from, paddingPx);
|
|
381
|
+
}
|
|
382
|
+
if (paddingPx !== null || prefixPx !== null) {
|
|
383
|
+
byFrom.set(from, { paddingPx, prefixPx });
|
|
384
|
+
}
|
|
385
|
+
const previous = this.cache.get(cacheKey);
|
|
386
|
+
if (stableIndentPx !== null &&
|
|
387
|
+
(previous === undefined ||
|
|
388
|
+
Math.abs(previous - stableIndentPx) > 0.5)) {
|
|
389
|
+
this.cache.set(cacheKey, stableIndentPx);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
syncMeasuredIndentStyles(view.contentDOM, byFrom);
|
|
393
|
+
scheduleFollowUp();
|
|
394
|
+
},
|
|
395
|
+
});
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
398
|
+
retryStartup(view) {
|
|
399
|
+
if (this.destroyed || this.retryFrames > 60) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
this.retryFrames += 1;
|
|
403
|
+
requestAnimationFrame(() => {
|
|
404
|
+
if (!this.destroyed) {
|
|
405
|
+
this.schedule(view);
|
|
406
|
+
this.retryStartup(view);
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
destroy() {
|
|
411
|
+
this.destroyed = true;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
export function measuredIndentExtension() {
|
|
415
|
+
return [
|
|
416
|
+
ViewPlugin.fromClass(MeasuredIndentPlugin),
|
|
417
|
+
EditorView.editorAttributes.of({ class: "cm-measured-indent" }),
|
|
418
|
+
];
|
|
419
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measured-indent.test.d.ts","sourceRoot":"","sources":["../../../../../src/internal/codemirror/rich/utils/measured-indent.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { measureIndentSegmentWidth, syncMeasuredIndentStyles, } from "./measured-indent";
|
|
3
|
+
function appendLine(root, from) {
|
|
4
|
+
const line = document.createElement("div");
|
|
5
|
+
line.className = "cm-line";
|
|
6
|
+
line.dataset["lineFrom"] = `${from}`;
|
|
7
|
+
root.append(line);
|
|
8
|
+
return line;
|
|
9
|
+
}
|
|
10
|
+
function domRect(width) {
|
|
11
|
+
return {
|
|
12
|
+
bottom: 16,
|
|
13
|
+
height: 16,
|
|
14
|
+
left: 0,
|
|
15
|
+
right: width,
|
|
16
|
+
toJSON: () => ({}),
|
|
17
|
+
top: 0,
|
|
18
|
+
width,
|
|
19
|
+
x: 0,
|
|
20
|
+
y: 0,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function mockTextRangeMeasurements(characterWidth) {
|
|
24
|
+
vi.spyOn(document, "createRange").mockImplementation(() => {
|
|
25
|
+
let node = null;
|
|
26
|
+
let end = 0;
|
|
27
|
+
const range = {
|
|
28
|
+
setStart(nextNode) {
|
|
29
|
+
node = nextNode;
|
|
30
|
+
},
|
|
31
|
+
setEnd(_nextNode, nextEnd) {
|
|
32
|
+
end = nextEnd;
|
|
33
|
+
},
|
|
34
|
+
getClientRects() {
|
|
35
|
+
const width = (node?.data.slice(0, end).length ?? 0) * characterWidth;
|
|
36
|
+
return [domRect(width)];
|
|
37
|
+
},
|
|
38
|
+
getBoundingClientRect() {
|
|
39
|
+
const width = (node?.data.slice(0, end).length ?? 0) * characterWidth;
|
|
40
|
+
return domRect(width);
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
return range;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
afterEach(() => {
|
|
47
|
+
vi.restoreAllMocks();
|
|
48
|
+
});
|
|
49
|
+
describe("measured indent styles", () => {
|
|
50
|
+
it("measures plain spacer text instead of its minimum guide slot", () => {
|
|
51
|
+
mockTextRangeMeasurements(8);
|
|
52
|
+
const spacer = document.createElement("span");
|
|
53
|
+
spacer.className = "cm-indent cm-indent-spacer";
|
|
54
|
+
spacer.textContent = " ";
|
|
55
|
+
vi.spyOn(spacer, "getBoundingClientRect").mockReturnValue(domRect(32));
|
|
56
|
+
expect(measureIndentSegmentWidth(spacer)).toBe(16);
|
|
57
|
+
});
|
|
58
|
+
it("keeps guide segments measured by their rendered slot", () => {
|
|
59
|
+
mockTextRangeMeasurements(8);
|
|
60
|
+
const guide = document.createElement("span");
|
|
61
|
+
guide.className = "cm-indent cm-indent-guide";
|
|
62
|
+
guide.textContent = " ";
|
|
63
|
+
vi.spyOn(guide, "getBoundingClientRect").mockReturnValue(domRect(32));
|
|
64
|
+
expect(measureIndentSegmentWidth(guide)).toBe(32);
|
|
65
|
+
});
|
|
66
|
+
it("only writes changed measurements", () => {
|
|
67
|
+
const root = document.createElement("div");
|
|
68
|
+
const line = appendLine(root, 10);
|
|
69
|
+
line.style.setProperty("--hmd-indent-padding-measured", "24px");
|
|
70
|
+
line.style.setProperty("--hmd-indent-prefix-measured", "8px");
|
|
71
|
+
const setProperty = vi.spyOn(line.style, "setProperty");
|
|
72
|
+
syncMeasuredIndentStyles(root, new Map([[10, { paddingPx: 24, prefixPx: 8 }]]));
|
|
73
|
+
expect(setProperty).not.toHaveBeenCalled();
|
|
74
|
+
});
|
|
75
|
+
it("removes measurements from lines that no longer carry a prefix", () => {
|
|
76
|
+
const root = document.createElement("div");
|
|
77
|
+
const line = appendLine(root, 10);
|
|
78
|
+
line.style.setProperty("--hmd-indent-padding-measured", "24px");
|
|
79
|
+
line.style.setProperty("--hmd-indent-prefix-measured", "8px");
|
|
80
|
+
syncMeasuredIndentStyles(root, new Map());
|
|
81
|
+
expect(line.style.getPropertyValue("--hmd-indent-padding-measured")).toBe("");
|
|
82
|
+
expect(line.style.getPropertyValue("--hmd-indent-prefix-measured")).toBe("");
|
|
83
|
+
});
|
|
84
|
+
it("preserves a participating line omitted by a transitional read", () => {
|
|
85
|
+
const root = document.createElement("div");
|
|
86
|
+
const line = appendLine(root, 10);
|
|
87
|
+
line.dataset["indentPrefix"] = " ";
|
|
88
|
+
line.style.setProperty("--hmd-indent-padding-measured", "24px");
|
|
89
|
+
line.style.setProperty("--hmd-indent-prefix-measured", "8px");
|
|
90
|
+
syncMeasuredIndentStyles(root, new Map());
|
|
91
|
+
expect(line.style.getPropertyValue("--hmd-indent-padding-measured")).toBe("24px");
|
|
92
|
+
expect(line.style.getPropertyValue("--hmd-indent-prefix-measured")).toBe("8px");
|
|
93
|
+
});
|
|
94
|
+
it("keeps the last measured padding when the parent temporarily falls back", () => {
|
|
95
|
+
const root = document.createElement("div");
|
|
96
|
+
const line = appendLine(root, 10);
|
|
97
|
+
line.style.setProperty("--hmd-indent-padding-measured", "24px");
|
|
98
|
+
syncMeasuredIndentStyles(root, new Map([[10, { paddingPx: null, prefixPx: 32 }]]));
|
|
99
|
+
expect(line.style.getPropertyValue("--hmd-indent-padding-measured")).toBe("24px");
|
|
100
|
+
expect(line.style.getPropertyValue("--hmd-indent-prefix-measured")).toBe("32px");
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EditorState, Range } from "@codemirror/state";
|
|
2
|
+
import type { Decoration } from "@codemirror/view";
|
|
3
|
+
export type RangeBoundary = {
|
|
4
|
+
from: number;
|
|
5
|
+
to: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function rangeIntersectsSelection(state: EditorState, from: number, to: number): boolean;
|
|
8
|
+
export declare function rangeContainsSelectionCursor(state: EditorState, from: number, to: number): boolean;
|
|
9
|
+
export declare function hasInitialFrontmatterCursor(state: EditorState, from: number): boolean;
|
|
10
|
+
export declare function hasRenderedInitialFrontmatterCursor(state: EditorState): boolean;
|
|
11
|
+
export declare function rangesOverlap(left: RangeBoundary, right: RangeBoundary): boolean;
|
|
12
|
+
export declare function sortRanges(ranges: Range<Decoration>[]): Range<Decoration>[];
|
|
13
|
+
//# sourceMappingURL=ranges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ranges.d.ts","sourceRoot":"","sources":["../../../../../src/internal/codemirror/rich/utils/ranges.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,OAAO,CAIT;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,OAAO,CAOT;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM,GACX,OAAO,CAOT;AAED,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,WAAW,GACjB,OAAO,CAgBT;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,aAAa,GACnB,OAAO,CAET;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE,CAO3E"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export function rangeIntersectsSelection(state, from, to) {
|
|
2
|
+
return state.selection.ranges.some((selection) => selection.from <= to && selection.to >= from);
|
|
3
|
+
}
|
|
4
|
+
export function rangeContainsSelectionCursor(state, from, to) {
|
|
5
|
+
return state.selection.ranges.some((selection) => {
|
|
6
|
+
if (selection.empty) {
|
|
7
|
+
return selection.from > from && selection.from < to;
|
|
8
|
+
}
|
|
9
|
+
return selection.from < to && selection.to > from;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export function hasInitialFrontmatterCursor(state, from) {
|
|
13
|
+
return (from === 0 &&
|
|
14
|
+
state.selection.ranges.length === 1 &&
|
|
15
|
+
state.selection.main.empty &&
|
|
16
|
+
state.selection.main.from === 0);
|
|
17
|
+
}
|
|
18
|
+
export function hasRenderedInitialFrontmatterCursor(state) {
|
|
19
|
+
if (!hasInitialFrontmatterCursor(state, 0) || state.doc.lines < 3) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (state.doc.line(1).text !== "---") {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
for (let lineNumber = 2; lineNumber <= state.doc.lines; lineNumber += 1) {
|
|
26
|
+
if (state.doc.line(lineNumber).text === "---") {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
export function rangesOverlap(left, right) {
|
|
33
|
+
return left.from < right.to && right.from < left.to;
|
|
34
|
+
}
|
|
35
|
+
export function sortRanges(ranges) {
|
|
36
|
+
return ranges.sort((left, right) => {
|
|
37
|
+
if (left.from !== right.from) {
|
|
38
|
+
return left.from - right.from;
|
|
39
|
+
}
|
|
40
|
+
return left.to - right.to;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ranges.test.d.ts","sourceRoot":"","sources":["../../../../../src/internal/codemirror/rich/utils/ranges.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { EditorState } from "@codemirror/state";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { hasRenderedInitialFrontmatterCursor } from "./ranges";
|
|
4
|
+
describe("range utilities", () => {
|
|
5
|
+
it("detects the hidden live-preview cursor state at rendered frontmatter start", () => {
|
|
6
|
+
const state = EditorState.create({
|
|
7
|
+
doc: "---\ntitle: Demo\n---\n# Heading",
|
|
8
|
+
selection: { anchor: 0 },
|
|
9
|
+
});
|
|
10
|
+
expect(hasRenderedInitialFrontmatterCursor(state)).toBe(true);
|
|
11
|
+
});
|
|
12
|
+
it("does not hide the cursor for normal document starts or frontmatter source edits", () => {
|
|
13
|
+
expect(hasRenderedInitialFrontmatterCursor(EditorState.create({
|
|
14
|
+
doc: "# Heading",
|
|
15
|
+
selection: { anchor: 0 },
|
|
16
|
+
}))).toBe(false);
|
|
17
|
+
expect(hasRenderedInitialFrontmatterCursor(EditorState.create({
|
|
18
|
+
doc: "---\ntitle: Demo\n---\n# Heading",
|
|
19
|
+
selection: { anchor: 5 },
|
|
20
|
+
}))).toBe(false);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EditorState } from "@codemirror/state";
|
|
2
|
+
export type TaskMarkerRange = {
|
|
3
|
+
markerStart: number;
|
|
4
|
+
checkboxStart: number;
|
|
5
|
+
checkboxEnd: number;
|
|
6
|
+
markerEnd: number;
|
|
7
|
+
taskValue: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function getTaskMarkerRange(text: string, lineStart: number): TaskMarkerRange | null;
|
|
10
|
+
export declare function selectionTouchesTaskMarker(state: EditorState, lineStart: number, markerEnd: number): boolean;
|
|
11
|
+
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../../../../src/internal/codemirror/rich/utils/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAChB,eAAe,GAAG,IAAI,CAiBxB;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAQT"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function getTaskMarkerRange(text, lineStart) {
|
|
2
|
+
const match = text.match(/^([ \t]*(?:>[ \t]*)*)((?:[-*+]|\d+[.)])[ \t]+)\[([^\]\r\n])\][ \t]/u);
|
|
3
|
+
if (!match || match[1] === undefined || match[2] === undefined) {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
const markerStart = lineStart + match[1].length;
|
|
7
|
+
const checkboxStart = markerStart + match[2].length;
|
|
8
|
+
return {
|
|
9
|
+
markerStart,
|
|
10
|
+
checkboxStart,
|
|
11
|
+
checkboxEnd: checkboxStart + 3,
|
|
12
|
+
markerEnd: lineStart + match[0].length,
|
|
13
|
+
taskValue: match[3] ?? " ",
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function selectionTouchesTaskMarker(state, lineStart, markerEnd) {
|
|
17
|
+
return state.selection.ranges.some((selection) => {
|
|
18
|
+
if (selection.empty) {
|
|
19
|
+
return selection.from >= lineStart && selection.from <= markerEnd;
|
|
20
|
+
}
|
|
21
|
+
return selection.from <= markerEnd && selection.to >= lineStart;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.test.d.ts","sourceRoot":"","sources":["../../../../../src/internal/codemirror/rich/utils/tasks.test.ts"],"names":[],"mappings":""}
|