@nldd/design-system 0.8.64 → 0.8.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/actions/button/button.d.ts.map +1 -1
- package/dist/components/actions/button/button.js +7 -6
- package/dist/components/actions/button/button.js.map +1 -1
- package/dist/components/actions/button/button.styles.d.ts.map +1 -1
- package/dist/components/actions/button/button.styles.js +9 -5
- package/dist/components/actions/button/button.styles.js.map +1 -1
- package/dist/components/actions/button-bar/button-bar.d.ts.map +1 -1
- package/dist/components/actions/button-bar/button-bar.js +3 -2
- package/dist/components/actions/button-bar/button-bar.js.map +1 -1
- package/dist/components/actions/button-group/button-group.d.ts.map +1 -1
- package/dist/components/actions/button-group/button-group.js +3 -2
- package/dist/components/actions/button-group/button-group.js.map +1 -1
- package/dist/components/actions/icon-button/icon-button.d.ts +4 -0
- package/dist/components/actions/icon-button/icon-button.d.ts.map +1 -1
- package/dist/components/actions/icon-button/icon-button.js +13 -5
- package/dist/components/actions/icon-button/icon-button.js.map +1 -1
- package/dist/components/actions/icon-button/icon-button.styles.d.ts.map +1 -1
- package/dist/components/actions/icon-button/icon-button.styles.js +15 -10
- package/dist/components/actions/icon-button/icon-button.styles.js.map +1 -1
- package/dist/components/actions/icon-button/icon-button.template.d.ts.map +1 -1
- package/dist/components/actions/icon-button/icon-button.template.js +2 -0
- package/dist/components/actions/icon-button/icon-button.template.js.map +1 -1
- package/dist/components/actions/menu/menu.d.ts +1 -0
- package/dist/components/actions/menu/menu.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.js +33 -15
- package/dist/components/actions/menu/menu.js.map +1 -1
- package/dist/components/actions/menu/menu.styles.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.styles.js +8 -0
- package/dist/components/actions/menu/menu.styles.js.map +1 -1
- package/dist/components/actions/split-button/split-button.d.ts.map +1 -1
- package/dist/components/actions/split-button/split-button.js +5 -4
- package/dist/components/actions/split-button/split-button.js.map +1 -1
- package/dist/components/actions/toolbar/toolbar.d.ts +11 -0
- package/dist/components/actions/toolbar/toolbar.d.ts.map +1 -1
- package/dist/components/actions/toolbar/toolbar.js +112 -40
- package/dist/components/actions/toolbar/toolbar.js.map +1 -1
- package/dist/components/actions/toolbar/toolbar.styles.d.ts.map +1 -1
- package/dist/components/actions/toolbar/toolbar.styles.js +3 -12
- package/dist/components/actions/toolbar/toolbar.styles.js.map +1 -1
- package/dist/components/components.js +104 -102
- package/dist/components/content/blockquote/blockquote.styles.d.ts.map +1 -1
- package/dist/components/content/blockquote/blockquote.styles.js +0 -3
- package/dist/components/content/blockquote/blockquote.styles.js.map +1 -1
- package/dist/components/content/byline/byline.d.ts.map +1 -1
- package/dist/components/content/byline/byline.js +3 -2
- package/dist/components/content/byline/byline.js.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.d.ts +24 -64
- package/dist/components/content/code-viewer/code-viewer.d.ts.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.js +239 -156
- package/dist/components/content/code-viewer/code-viewer.js.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.styles.d.ts.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.styles.js +33 -92
- package/dist/components/content/code-viewer/code-viewer.styles.js.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.template.d.ts.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.template.js +10 -29
- package/dist/components/content/code-viewer/code-viewer.template.js.map +1 -1
- package/dist/components/content/icon/icon-aliases.d.ts.map +1 -1
- package/dist/components/content/icon/icon-aliases.js +22 -1
- package/dist/components/content/icon/icon-aliases.js.map +1 -1
- package/dist/components/content/icon/icon-registry.d.ts.map +1 -1
- package/dist/components/content/icon/icon-registry.js +18 -0
- package/dist/components/content/icon/icon-registry.js.map +1 -1
- package/dist/components/content/icon/icon.d.ts.map +1 -1
- package/dist/components/content/icon/icon.js +3 -2
- package/dist/components/content/icon/icon.js.map +1 -1
- package/dist/components/content/image/image.d.ts.map +1 -1
- package/dist/components/content/image/image.js +7 -6
- package/dist/components/content/image/image.js.map +1 -1
- package/dist/components/content/image/image.styles.d.ts.map +1 -1
- package/dist/components/content/image/image.styles.js +2 -6
- package/dist/components/content/image/image.styles.js.map +1 -1
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.d.ts.map +1 -1
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.js +8 -7
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.styles.d.ts.map +1 -1
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.styles.js +5 -1
- package/dist/components/content/keyboard-shortcut/keyboard-shortcut.styles.js.map +1 -1
- package/dist/components/content/rich-text/rich-text.d.ts.map +1 -1
- package/dist/components/content/rich-text/rich-text.js +3 -2
- package/dist/components/content/rich-text/rich-text.js.map +1 -1
- package/dist/components/content/tag/tag.d.ts.map +1 -1
- package/dist/components/content/tag/tag.js +5 -4
- package/dist/components/content/tag/tag.js.map +1 -1
- package/dist/components/content/title/title.d.ts.map +1 -1
- package/dist/components/content/title/title.js +2 -1
- package/dist/components/content/title/title.js.map +1 -1
- package/dist/components/content/token/token.d.ts +70 -0
- package/dist/components/content/token/token.d.ts.map +1 -0
- package/dist/components/content/token/token.js +170 -0
- package/dist/components/content/token/token.js.map +1 -0
- package/dist/components/content/token/token.styles.d.ts.map +1 -0
- package/dist/components/content/token/token.styles.js +122 -0
- package/dist/components/content/token/token.styles.js.map +1 -0
- package/dist/components/content/token/token.template.d.ts +6 -0
- package/dist/components/content/token/token.template.d.ts.map +1 -0
- package/dist/components/content/token/token.template.js +47 -0
- package/dist/components/content/token/token.template.js.map +1 -0
- package/dist/components/content/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/content/tooltip/tooltip.js +14 -5
- package/dist/components/content/tooltip/tooltip.js.map +1 -1
- package/dist/components/content/tooltip/tooltip.styles.d.ts.map +1 -1
- package/dist/components/content/tooltip/tooltip.styles.js +11 -0
- package/dist/components/content/tooltip/tooltip.styles.js.map +1 -1
- package/dist/components/gherkin-DhZlEZiy.js +115 -0
- package/dist/components/index-BI4lrehT.js +66595 -0
- package/dist/components/index-BcdqzZql.js +703 -0
- package/dist/components/index-BlMqctke.js +81 -0
- package/dist/components/index-BseMFLNF.js +688 -0
- package/dist/components/index-ChjtFo6I.js +177 -0
- package/dist/components/index-D3NSlPL5.js +405 -0
- package/dist/components/index-D7B3n3QJ.js +384 -0
- package/dist/components/index.d.ts +20 -18
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +20 -18
- package/dist/components/index.js.map +1 -1
- package/dist/components/inputs/code-editor/code-editor.d.ts +58 -29
- package/dist/components/inputs/code-editor/code-editor.d.ts.map +1 -1
- package/dist/components/inputs/code-editor/code-editor.js +241 -52
- package/dist/components/inputs/code-editor/code-editor.js.map +1 -1
- package/dist/components/inputs/code-editor/code-editor.styles.d.ts.map +1 -1
- package/dist/components/inputs/code-editor/code-editor.styles.js +58 -46
- package/dist/components/inputs/code-editor/code-editor.styles.js.map +1 -1
- package/dist/components/inputs/code-editor/code-editor.template.d.ts +1 -1
- package/dist/components/inputs/code-editor/code-editor.template.d.ts.map +1 -1
- package/dist/components/inputs/code-editor/code-editor.template.js +5 -22
- package/dist/components/inputs/code-editor/code-editor.template.js.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.d.ts +15 -4
- package/dist/components/inputs/combo-box/combo-box.d.ts.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.js +53 -9
- package/dist/components/inputs/combo-box/combo-box.js.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.js +2 -1
- package/dist/components/inputs/dropdown/dropdown.js.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.d.ts +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.d.ts.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.js +6 -5
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.js.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.styles.d.ts.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.styles.js +8 -11
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.styles.js.map +1 -1
- package/dist/components/inputs/number-field/number-field.d.ts.map +1 -1
- package/dist/components/inputs/number-field/number-field.js +2 -1
- package/dist/components/inputs/number-field/number-field.js.map +1 -1
- package/dist/components/inputs/password-field/password-field.d.ts.map +1 -1
- package/dist/components/inputs/password-field/password-field.js +3 -2
- package/dist/components/inputs/password-field/password-field.js.map +1 -1
- package/dist/components/inputs/radio-button-group/radio-button-group.js +1 -1
- package/dist/components/inputs/radio-button-group/radio-button-group.js.map +1 -1
- package/dist/components/inputs/search-field/search-field.d.ts.map +1 -1
- package/dist/components/inputs/search-field/search-field.js +2 -1
- package/dist/components/inputs/search-field/search-field.js.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.d.ts +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.d.ts.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.js +10 -9
- package/dist/components/inputs/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.styles.d.ts.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.styles.js +70 -36
- package/dist/components/inputs/segmented-control/segmented-control.styles.js.map +1 -1
- package/dist/components/inputs/stepper/stepper.d.ts.map +1 -1
- package/dist/components/inputs/stepper/stepper.js +2 -1
- package/dist/components/inputs/stepper/stepper.js.map +1 -1
- package/dist/components/inputs/switch/switch.d.ts.map +1 -1
- package/dist/components/inputs/switch/switch.js +2 -1
- package/dist/components/inputs/switch/switch.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.d.ts +51 -0
- package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.js +148 -0
- package/dist/components/inputs/text-editor/text-editor.annotation-sentinels.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.annotations.d.ts +47 -0
- package/dist/components/inputs/text-editor/text-editor.annotations.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.annotations.js +327 -0
- package/dist/components/inputs/text-editor/text-editor.annotations.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.caret.d.ts +13 -0
- package/dist/components/inputs/text-editor/text-editor.caret.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.caret.js +27 -0
- package/dist/components/inputs/text-editor/text-editor.caret.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.commands.d.ts +61 -0
- package/dist/components/inputs/text-editor/text-editor.commands.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.commands.js +376 -0
- package/dist/components/inputs/text-editor/text-editor.commands.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.d.ts +241 -0
- package/dist/components/inputs/text-editor/text-editor.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.drag.d.ts +30 -0
- package/dist/components/inputs/text-editor/text-editor.drag.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.drag.js +231 -0
- package/dist/components/inputs/text-editor/text-editor.drag.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.i18n.d.ts +8 -0
- package/dist/components/inputs/text-editor/text-editor.i18n.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.i18n.js +13 -0
- package/dist/components/inputs/text-editor/text-editor.i18n.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.js +782 -0
- package/dist/components/inputs/text-editor/text-editor.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.links.d.ts +18 -0
- package/dist/components/inputs/text-editor/text-editor.links.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.links.js +147 -0
- package/dist/components/inputs/text-editor/text-editor.links.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.markdown.d.ts +20 -0
- package/dist/components/inputs/text-editor/text-editor.markdown.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.markdown.js +372 -0
- package/dist/components/inputs/text-editor/text-editor.markdown.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.mentions.d.ts +32 -0
- package/dist/components/inputs/text-editor/text-editor.mentions.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.mentions.js +153 -0
- package/dist/components/inputs/text-editor/text-editor.mentions.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.ordered-list.d.ts +12 -0
- package/dist/components/inputs/text-editor/text-editor.ordered-list.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.ordered-list.js +85 -0
- package/dist/components/inputs/text-editor/text-editor.ordered-list.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.styles.d.ts +2 -0
- package/dist/components/inputs/text-editor/text-editor.styles.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.styles.js +592 -0
- package/dist/components/inputs/text-editor/text-editor.styles.js.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.template.d.ts +4 -0
- package/dist/components/inputs/text-editor/text-editor.template.d.ts.map +1 -0
- package/dist/components/inputs/text-editor/text-editor.template.js +7 -0
- package/dist/components/inputs/text-editor/text-editor.template.js.map +1 -0
- package/dist/components/inputs/text-field/text-field.d.ts.map +1 -1
- package/dist/components/inputs/text-field/text-field.js +3 -2
- package/dist/components/inputs/text-field/text-field.js.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.js +4 -3
- package/dist/components/inputs/toggle-button/toggle-button.js.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.styles.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.styles.js +14 -10
- package/dist/components/inputs/toggle-button/toggle-button.styles.js.map +1 -1
- package/dist/components/inputs/toggle-button-group/toggle-button-group.d.ts +1 -1
- package/dist/components/inputs/toggle-button-group/toggle-button-group.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button-group/toggle-button-group.js +5 -4
- package/dist/components/inputs/toggle-button-group/toggle-button-group.js.map +1 -1
- package/dist/components/inputs/token-field/token-field.d.ts +257 -0
- package/dist/components/inputs/token-field/token-field.d.ts.map +1 -0
- package/dist/components/inputs/token-field/token-field.i18n.d.ts +9 -0
- package/dist/components/inputs/token-field/token-field.i18n.d.ts.map +1 -0
- package/dist/components/inputs/token-field/token-field.i18n.js +8 -0
- package/dist/components/inputs/token-field/token-field.i18n.js.map +1 -0
- package/dist/components/inputs/token-field/token-field.js +877 -0
- package/dist/components/inputs/token-field/token-field.js.map +1 -0
- package/dist/components/inputs/token-field/token-field.styles.d.ts +2 -0
- package/dist/components/inputs/token-field/token-field.styles.d.ts.map +1 -0
- package/dist/components/inputs/token-field/token-field.styles.js +194 -0
- package/dist/components/inputs/token-field/token-field.styles.js.map +1 -0
- package/dist/components/inputs/token-field/token-field.template.d.ts +8 -0
- package/dist/components/inputs/token-field/token-field.template.d.ts.map +1 -0
- package/dist/components/inputs/token-field/token-field.template.js +136 -0
- package/dist/components/inputs/token-field/token-field.template.js.map +1 -0
- package/dist/components/layout/app-view/app-view.d.ts.map +1 -1
- package/dist/components/layout/app-view/app-view.js +2 -1
- package/dist/components/layout/app-view/app-view.js.map +1 -1
- package/dist/components/layout/box/box.d.ts.map +1 -1
- package/dist/components/layout/box/box.js +2 -1
- package/dist/components/layout/box/box.js.map +1 -1
- package/dist/components/layout/box/box.styles.d.ts.map +1 -1
- package/dist/components/layout/box/box.styles.js +1 -6
- package/dist/components/layout/box/box.styles.js.map +1 -1
- package/dist/components/layout/collection/collection.d.ts +5 -0
- package/dist/components/layout/collection/collection.d.ts.map +1 -1
- package/dist/components/layout/collection/collection.js +17 -1
- package/dist/components/layout/collection/collection.js.map +1 -1
- package/dist/components/layout/collection/collection.styles.d.ts.map +1 -1
- package/dist/components/layout/collection/collection.styles.js +18 -17
- package/dist/components/layout/collection/collection.styles.js.map +1 -1
- package/dist/components/layout/page-footer/page-footer.d.ts.map +1 -1
- package/dist/components/layout/page-footer/page-footer.js +2 -1
- package/dist/components/layout/page-footer/page-footer.js.map +1 -1
- package/dist/components/layout/page-sections/hero/hero.d.ts +7 -23
- package/dist/components/layout/page-sections/hero/hero.d.ts.map +1 -1
- package/dist/components/layout/page-sections/hero/hero.js +12 -73
- package/dist/components/layout/page-sections/hero/hero.js.map +1 -1
- package/dist/components/layout/page-sections/hero/hero.styles.d.ts.map +1 -1
- package/dist/components/layout/page-sections/hero/hero.styles.js +13 -159
- package/dist/components/layout/page-sections/hero/hero.styles.js.map +1 -1
- package/dist/components/layout/popover/popover.d.ts +1 -0
- package/dist/components/layout/popover/popover.d.ts.map +1 -1
- package/dist/components/layout/popover/popover.js +14 -1
- package/dist/components/layout/popover/popover.js.map +1 -1
- package/dist/components/layout/popover/popover.styles.d.ts.map +1 -1
- package/dist/components/layout/popover/popover.styles.js +11 -0
- package/dist/components/layout/popover/popover.styles.js.map +1 -1
- package/dist/components/layout/sheet/sheet.d.ts +1 -1
- package/dist/components/layout/sheet/sheet.d.ts.map +1 -1
- package/dist/components/layout/sheet/sheet.js +16 -6
- package/dist/components/layout/sheet/sheet.js.map +1 -1
- package/dist/components/layout/sheet/sheet.styles.d.ts.map +1 -1
- package/dist/components/layout/sheet/sheet.styles.js +60 -83
- package/dist/components/layout/sheet/sheet.styles.js.map +1 -1
- package/dist/components/layout/spacer/spacer.d.ts.map +1 -1
- package/dist/components/layout/spacer/spacer.js +2 -1
- package/dist/components/layout/spacer/spacer.js.map +1 -1
- package/dist/components/layout/spacer/spacer.styles.d.ts.map +1 -1
- package/dist/components/layout/spacer/spacer.styles.js +0 -1
- package/dist/components/layout/spacer/spacer.styles.js.map +1 -1
- package/dist/components/layout/split-views/split-view-divider/split-view-divider.d.ts.map +1 -1
- package/dist/components/layout/split-views/split-view-divider/split-view-divider.js +2 -1
- package/dist/components/layout/split-views/split-view-divider/split-view-divider.js.map +1 -1
- package/dist/components/layout/split-views/split-view-divider/split-view-divider.styles.js +10 -10
- package/dist/components/layout/window/window.d.ts.map +1 -1
- package/dist/components/layout/window/window.js +11 -2
- package/dist/components/layout/window/window.js.map +1 -1
- package/dist/components/lists-and-tables/cells/cell/cell.d.ts.map +1 -1
- package/dist/components/lists-and-tables/cells/cell/cell.js +4 -3
- package/dist/components/lists-and-tables/cells/cell/cell.js.map +1 -1
- package/dist/components/lists-and-tables/cells/description-cell/description-cell.d.ts.map +1 -1
- package/dist/components/lists-and-tables/cells/description-cell/description-cell.js +3 -2
- package/dist/components/lists-and-tables/cells/description-cell/description-cell.js.map +1 -1
- package/dist/components/lists-and-tables/cells/drag-handle-cell/drag-handle-cell.d.ts.map +1 -1
- package/dist/components/lists-and-tables/cells/drag-handle-cell/drag-handle-cell.js +2 -1
- package/dist/components/lists-and-tables/cells/drag-handle-cell/drag-handle-cell.js.map +1 -1
- package/dist/components/lists-and-tables/cells/icon-cell/icon-cell.d.ts.map +1 -1
- package/dist/components/lists-and-tables/cells/icon-cell/icon-cell.js +3 -2
- package/dist/components/lists-and-tables/cells/icon-cell/icon-cell.js.map +1 -1
- package/dist/components/lists-and-tables/cells/text-cell/text-cell.d.ts.map +1 -1
- package/dist/components/lists-and-tables/cells/text-cell/text-cell.js +10 -9
- package/dist/components/lists-and-tables/cells/text-cell/text-cell.js.map +1 -1
- package/dist/components/lists-and-tables/cells/timeline-track-cell/timeline-track-cell.d.ts.map +1 -1
- package/dist/components/lists-and-tables/cells/timeline-track-cell/timeline-track-cell.js +3 -2
- package/dist/components/lists-and-tables/cells/timeline-track-cell/timeline-track-cell.js.map +1 -1
- package/dist/components/lists-and-tables/cells/title-cell/title-cell.d.ts.map +1 -1
- package/dist/components/lists-and-tables/cells/title-cell/title-cell.js +9 -8
- package/dist/components/lists-and-tables/cells/title-cell/title-cell.js.map +1 -1
- package/dist/components/lists-and-tables/list/list.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list/list.js +5 -4
- package/dist/components/lists-and-tables/list/list.js.map +1 -1
- package/dist/components/lists-and-tables/list/list.styles.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list/list.styles.js +3 -2
- package/dist/components/lists-and-tables/list/list.styles.js.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.js +2 -1
- package/dist/components/lists-and-tables/list-item/list-item.js.map +1 -1
- package/dist/components/lists-and-tables/table/table.d.ts.map +1 -1
- package/dist/components/lists-and-tables/table/table.js +4 -3
- package/dist/components/lists-and-tables/table/table.js.map +1 -1
- package/dist/components/navigation/breadcrumbs/breadcrumbs.d.ts.map +1 -1
- package/dist/components/navigation/breadcrumbs/breadcrumbs.js +2 -1
- package/dist/components/navigation/breadcrumbs/breadcrumbs.js.map +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.d.ts.map +1 -1
- package/dist/components/navigation/document-tab-bar/document-tab-bar.js +5 -4
- package/dist/components/navigation/document-tab-bar/document-tab-bar.js.map +1 -1
- package/dist/components/navigation/link/link.d.ts.map +1 -1
- package/dist/components/navigation/link/link.js +2 -1
- package/dist/components/navigation/link/link.js.map +1 -1
- package/dist/components/navigation/menu-bar/menu-bar.d.ts.map +1 -1
- package/dist/components/navigation/menu-bar/menu-bar.js +2 -1
- package/dist/components/navigation/menu-bar/menu-bar.js.map +1 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.d.ts.map +1 -1
- package/dist/components/navigation/menu-bar-item/menu-bar-item.js +4 -3
- package/dist/components/navigation/menu-bar-item/menu-bar-item.js.map +1 -1
- package/dist/components/navigation/skip-link/skip-link.d.ts.map +1 -1
- package/dist/components/navigation/skip-link/skip-link.js +2 -1
- package/dist/components/navigation/skip-link/skip-link.js.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.d.ts +7 -0
- package/dist/components/navigation/tab-bar/tab-bar.d.ts.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.js +31 -5
- package/dist/components/navigation/tab-bar/tab-bar.js.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.styles.d.ts.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.styles.js +74 -78
- package/dist/components/navigation/tab-bar/tab-bar.styles.js.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.template.d.ts.map +1 -1
- package/dist/components/navigation/tab-bar/tab-bar.template.js +8 -1
- package/dist/components/navigation/tab-bar/tab-bar.template.js.map +1 -1
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.d.ts.map +1 -1
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.js +7 -6
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.js.map +1 -1
- package/dist/components/navigation/top-title-bar/top-title-bar.d.ts.map +1 -1
- package/dist/components/navigation/top-title-bar/top-title-bar.js +5 -4
- package/dist/components/navigation/top-title-bar/top-title-bar.js.map +1 -1
- package/dist/components/shell-BlsXDxCn.js +222 -0
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.d.ts.map +1 -1
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.js +4 -3
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.js.map +1 -1
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.styles.d.ts.map +1 -1
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.styles.js +0 -1
- package/dist/components/status-and-feedback/activity-indicator/activity-indicator.styles.js.map +1 -1
- package/dist/components/status-and-feedback/badge/badge.d.ts.map +1 -1
- package/dist/components/status-and-feedback/badge/badge.js +4 -3
- package/dist/components/status-and-feedback/badge/badge.js.map +1 -1
- package/dist/components/status-and-feedback/banner/banner.d.ts +0 -1
- package/dist/components/status-and-feedback/banner/banner.d.ts.map +1 -1
- package/dist/components/status-and-feedback/banner/banner.js +13 -13
- package/dist/components/status-and-feedback/banner/banner.js.map +1 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.d.ts.map +1 -1
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.js +5 -4
- package/dist/components/status-and-feedback/inline-dialog/inline-dialog.js.map +1 -1
- package/dist/components/status-and-feedback/just-in-time-education/just-in-time-education.d.ts +1 -0
- package/dist/components/status-and-feedback/just-in-time-education/just-in-time-education.d.ts.map +1 -1
- package/dist/components/status-and-feedback/just-in-time-education/just-in-time-education.js +35 -4
- package/dist/components/status-and-feedback/just-in-time-education/just-in-time-education.js.map +1 -1
- package/dist/components/status-and-feedback/just-in-time-education/just-in-time-education.styles.d.ts.map +1 -1
- package/dist/components/status-and-feedback/just-in-time-education/just-in-time-education.styles.js +11 -0
- package/dist/components/status-and-feedback/just-in-time-education/just-in-time-education.styles.js.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.d.ts.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.js +4 -3
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/status-and-feedback/progress-bar/progress-bar.d.ts.map +1 -1
- package/dist/components/status-and-feedback/progress-bar/progress-bar.js +9 -8
- package/dist/components/status-and-feedback/progress-bar/progress-bar.js.map +1 -1
- package/dist/components/status-and-feedback/progress-bar/progress-bar.styles.d.ts.map +1 -1
- package/dist/components/status-and-feedback/progress-bar/progress-bar.styles.js +0 -6
- package/dist/components/status-and-feedback/progress-bar/progress-bar.styles.js.map +1 -1
- package/dist/components/status-and-feedback/progress-circle/progress-circle.d.ts.map +1 -1
- package/dist/components/status-and-feedback/progress-circle/progress-circle.js +8 -7
- package/dist/components/status-and-feedback/progress-circle/progress-circle.js.map +1 -1
- package/dist/components/status-and-feedback/progress-circle/progress-circle.styles.d.ts.map +1 -1
- package/dist/components/status-and-feedback/progress-circle/progress-circle.styles.js +0 -2
- package/dist/components/status-and-feedback/progress-circle/progress-circle.styles.js.map +1 -1
- package/dist/components/status-and-feedback/status-bar/status-bar.d.ts.map +1 -1
- package/dist/components/status-and-feedback/status-bar/status-bar.js +3 -2
- package/dist/components/status-and-feedback/status-bar/status-bar.js.map +1 -1
- package/dist/components/toml-BOuWGMcf.js +76 -0
- package/dist/css/fouc.css +30 -0
- package/dist/css/global.css +1 -0
- package/dist/css/rich-text.css +0 -5
- package/dist/css/settings.css +25 -10
- package/dist/utilities/codemirror/codemirror-element.d.ts +66 -0
- package/dist/utilities/codemirror/codemirror-element.d.ts.map +1 -0
- package/dist/utilities/codemirror/codemirror-element.js +121 -0
- package/dist/utilities/codemirror/codemirror-element.js.map +1 -0
- package/dist/utilities/codemirror/languages.d.ts +4 -0
- package/dist/utilities/codemirror/languages.d.ts.map +1 -0
- package/dist/utilities/codemirror/languages.js +39 -0
- package/dist/utilities/codemirror/languages.js.map +1 -0
- package/dist/utilities/codemirror/theme.d.ts +4 -0
- package/dist/utilities/codemirror/theme.d.ts.map +1 -0
- package/dist/utilities/codemirror/theme.js +84 -0
- package/dist/utilities/codemirror/theme.js.map +1 -0
- package/dist/utilities/dismiss-from-title-bar.d.ts +19 -0
- package/dist/utilities/dismiss-from-title-bar.d.ts.map +1 -0
- package/dist/utilities/dismiss-from-title-bar.js +21 -0
- package/dist/utilities/dismiss-from-title-bar.js.map +1 -0
- package/dist/utilities/reflect-non-default.d.ts +30 -0
- package/dist/utilities/reflect-non-default.d.ts.map +1 -0
- package/dist/utilities/reflect-non-default.js +34 -0
- package/dist/utilities/reflect-non-default.js.map +1 -0
- package/package.json +92 -68
- package/dist/components/index-BNhqNvDd.js +0 -36784
- package/dist/components/inputs/token/token.d.ts +0 -42
- package/dist/components/inputs/token/token.d.ts.map +0 -1
- package/dist/components/inputs/token/token.js +0 -86
- package/dist/components/inputs/token/token.js.map +0 -1
- package/dist/components/inputs/token/token.styles.d.ts.map +0 -1
- package/dist/components/inputs/token/token.styles.js +0 -142
- package/dist/components/inputs/token/token.styles.js.map +0 -1
- package/dist/components/inputs/token/token.template.d.ts +0 -4
- package/dist/components/inputs/token/token.template.d.ts.map +0 -1
- package/dist/components/inputs/token/token.template.js +0 -41
- package/dist/components/inputs/token/token.template.js.map +0 -1
- package/dist/components/prism-bash-vbqaw3JR.js +0 -226
- package/dist/components/prism-css-B93tXdOU.js +0 -59
- package/dist/components/prism-gherkin-CMPYyXOQ.js +0 -82
- package/dist/components/prism-javascript-DeC_17Pw.js +0 -140
- package/dist/components/prism-json-DIMpow89.js +0 -25
- package/dist/components/prism-markdown-D-uFBkiz.js +0 -339
- package/dist/components/prism-markup-DfJYPYHA.js +0 -177
- package/dist/components/prism-python--N285k7w.js +0 -99
- package/dist/components/prism-rust-Cnm1tSdo.js +0 -157
- package/dist/components/prism-sql-BGqCBMyJ.js +0 -33
- package/dist/components/prism-toml-Ubdq-a5x.js +0 -45
- package/dist/components/prism-typescript-BPJAiB1s.js +0 -87
- package/dist/components/prism-yaml-DO0f9pf6.js +0 -71
- /package/dist/components/{inputs → content}/token/token.styles.d.ts +0 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { EditorSelection } from '@codemirror/state';
|
|
2
|
+
import { syntaxTree } from '@codemirror/language';
|
|
3
|
+
export const EMPTY_FORMATS = {
|
|
4
|
+
bold: false,
|
|
5
|
+
italic: false,
|
|
6
|
+
inlineCode: false,
|
|
7
|
+
codeBlock: false,
|
|
8
|
+
strikethrough: false,
|
|
9
|
+
link: false,
|
|
10
|
+
bulletList: false,
|
|
11
|
+
orderedList: false,
|
|
12
|
+
quote: false,
|
|
13
|
+
heading: 0,
|
|
14
|
+
};
|
|
15
|
+
function enclosing(view, pos, nodeName, side = 1) {
|
|
16
|
+
for (let n = syntaxTree(view.state).resolveInner(pos, side); n; n = n.parent) {
|
|
17
|
+
if (n.name === nodeName)
|
|
18
|
+
return n;
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
/** An inline format is "active" for the caret only when the node encloses it on
|
|
23
|
+
* *both* sides. At the outer edge (just before the opening marker or just after
|
|
24
|
+
* the closing one) only one side is inside, and text typed there lands outside
|
|
25
|
+
* the format — so the toolbar must not light up. This mirrors what typing does. */
|
|
26
|
+
function enclosingInline(view, pos, nodeName) {
|
|
27
|
+
const left = enclosing(view, pos, nodeName, -1);
|
|
28
|
+
const right = enclosing(view, pos, nodeName, 1);
|
|
29
|
+
return left && right && left.from === right.from && left.to === right.to ? right : null;
|
|
30
|
+
}
|
|
31
|
+
/** Wrap (or, if already wrapped, unwrap) each selection range with `marker`. */
|
|
32
|
+
export function toggleInlineWrap(view, marker, nodeName) {
|
|
33
|
+
// CodeMirror's `readOnly` facet only gates its own built-in commands, not a raw
|
|
34
|
+
// `view.dispatch`, so every editing helper here must refuse a read-only view
|
|
35
|
+
// itself — otherwise the command API and the Mod-b/i/e/k keymap would mutate a
|
|
36
|
+
// read-only (or disabled) editor.
|
|
37
|
+
if (view.state.readOnly)
|
|
38
|
+
return;
|
|
39
|
+
const len = marker.length;
|
|
40
|
+
view.dispatch(view.state.changeByRange((range) => {
|
|
41
|
+
const wrap = enclosing(view, range.from, nodeName);
|
|
42
|
+
if (wrap) {
|
|
43
|
+
return {
|
|
44
|
+
changes: [
|
|
45
|
+
{ from: wrap.from, to: wrap.from + len },
|
|
46
|
+
{ from: wrap.to - len, to: wrap.to },
|
|
47
|
+
],
|
|
48
|
+
range: EditorSelection.range(Math.max(wrap.from, range.from - len), Math.max(wrap.from, range.to - len)),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
changes: [
|
|
53
|
+
{ from: range.from, insert: marker },
|
|
54
|
+
{ from: range.to, insert: marker },
|
|
55
|
+
],
|
|
56
|
+
range: EditorSelection.range(range.from + len, range.to + len),
|
|
57
|
+
};
|
|
58
|
+
}));
|
|
59
|
+
view.focus();
|
|
60
|
+
}
|
|
61
|
+
/** Build a change that turns `line.text` into `next` by touching only the span
|
|
62
|
+
* that differs (shared prefix and suffix are left untouched). Replacing the whole
|
|
63
|
+
* line would collapse any annotation anchored inside it — its offsets map to the
|
|
64
|
+
* line boundary. Returns null when nothing changed. */
|
|
65
|
+
function minimalLineChange(line, next) {
|
|
66
|
+
const old = line.text;
|
|
67
|
+
if (next === old)
|
|
68
|
+
return null;
|
|
69
|
+
let p = 0;
|
|
70
|
+
while (p < old.length && p < next.length && old[p] === next[p])
|
|
71
|
+
p++;
|
|
72
|
+
let s = 0;
|
|
73
|
+
while (s < old.length - p && s < next.length - p && old[old.length - 1 - s] === next[next.length - 1 - s])
|
|
74
|
+
s++;
|
|
75
|
+
return { from: line.from + p, to: line.from + old.length - s, insert: next.slice(p, next.length - s) };
|
|
76
|
+
}
|
|
77
|
+
function mapSelectedLines(view, transform) {
|
|
78
|
+
if (view.state.readOnly)
|
|
79
|
+
return; // guards toggleHeading/setHeading/toggleBulletList/toggleQuote
|
|
80
|
+
const { state } = view;
|
|
81
|
+
const { from, to } = state.selection.main;
|
|
82
|
+
const first = state.doc.lineAt(from).number;
|
|
83
|
+
const last = state.doc.lineAt(to).number;
|
|
84
|
+
const changes = [];
|
|
85
|
+
for (let i = first; i <= last; i++) {
|
|
86
|
+
const line = state.doc.line(i);
|
|
87
|
+
const change = minimalLineChange(line, transform(line.text));
|
|
88
|
+
if (change)
|
|
89
|
+
changes.push(change);
|
|
90
|
+
}
|
|
91
|
+
if (changes.length)
|
|
92
|
+
view.dispatch({ changes });
|
|
93
|
+
view.focus();
|
|
94
|
+
}
|
|
95
|
+
function everySelectedLine(view, predicate) {
|
|
96
|
+
const { state } = view;
|
|
97
|
+
const { from, to } = state.selection.main;
|
|
98
|
+
const first = state.doc.lineAt(from).number;
|
|
99
|
+
const last = state.doc.lineAt(to).number;
|
|
100
|
+
for (let i = first; i <= last; i++) {
|
|
101
|
+
if (!predicate(state.doc.line(i).text))
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
/** Set the selected lines to heading `level`, or toggle them back to body. */
|
|
107
|
+
export function toggleHeading(view, level) {
|
|
108
|
+
mapSelectedLines(view, (text) => {
|
|
109
|
+
const match = text.match(/^(#{1,6})\s+/);
|
|
110
|
+
const current = match ? match[1].length : 0;
|
|
111
|
+
const body = match ? text.slice(match[0].length) : text;
|
|
112
|
+
if (level === 0 || current === level)
|
|
113
|
+
return body;
|
|
114
|
+
return `${'#'.repeat(level)} ${body}`;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/** Set the selected lines to heading `level` (0 = paragraph), without toggling.
|
|
118
|
+
* Suited to a picker where choosing a level always applies it. */
|
|
119
|
+
export function setHeading(view, level) {
|
|
120
|
+
mapSelectedLines(view, (text) => {
|
|
121
|
+
const body = text.replace(/^#{1,6}\s+/, '');
|
|
122
|
+
return level === 0 ? body : `${'#'.repeat(level)} ${body}`;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
export function toggleBulletList(view) {
|
|
126
|
+
// Accept every markdown bullet char (- * +), matching readActiveFormats and the
|
|
127
|
+
// render guard. If the toggle recognised fewer chars than the state reader, a
|
|
128
|
+
// "+ item" line would report active yet the toggle couldn't strip it (it'd add
|
|
129
|
+
// another "- " instead), so state and toggle would disagree.
|
|
130
|
+
const re = /^(\s*)[-*+]\s+/;
|
|
131
|
+
const allBulleted = everySelectedLine(view, (t) => re.test(t) || t.trim() === '');
|
|
132
|
+
mapSelectedLines(view, (t) => {
|
|
133
|
+
if (t.trim() === '')
|
|
134
|
+
return t;
|
|
135
|
+
if (allBulleted)
|
|
136
|
+
return t.replace(re, '$1');
|
|
137
|
+
return re.test(t) ? t : t.replace(/^(\s*)/, '$1- ');
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
const LIST_STRIP_RE = /^(\s*)(?:[-*+]|\d+[.)])\s+/;
|
|
141
|
+
/** Set the selected lines to a list of `type`, replacing any existing list
|
|
142
|
+
* marker; `'none'` strips it. Ordered items are numbered within the selection.
|
|
143
|
+
* Unlike the toggles, this cleanly switches between list types (for a picker). */
|
|
144
|
+
export function setList(view, type) {
|
|
145
|
+
if (view.state.readOnly)
|
|
146
|
+
return;
|
|
147
|
+
const { state } = view;
|
|
148
|
+
const { from, to } = state.selection.main;
|
|
149
|
+
const first = state.doc.lineAt(from).number;
|
|
150
|
+
const last = state.doc.lineAt(to).number;
|
|
151
|
+
const changes = [];
|
|
152
|
+
let number = 0;
|
|
153
|
+
for (let i = first; i <= last; i++) {
|
|
154
|
+
const line = state.doc.line(i);
|
|
155
|
+
// 'none' clears the leading indent too — bare text can't carry list
|
|
156
|
+
// indentation (4+ spaces would even parse as a code block); the list types
|
|
157
|
+
// keep it ($1) so nesting survives a switch between bullet and ordered.
|
|
158
|
+
const stripped = line.text.replace(LIST_STRIP_RE, type === 'none' ? '' : '$1');
|
|
159
|
+
let next = stripped;
|
|
160
|
+
if (type !== 'none' && stripped.trim() !== '') {
|
|
161
|
+
number += 1;
|
|
162
|
+
const marker = type === 'bullet' ? '- ' : `${number}. `;
|
|
163
|
+
next = stripped.replace(/^(\s*)/, `$1${marker}`);
|
|
164
|
+
}
|
|
165
|
+
// Only rewrite the marker, not the whole line — keeps annotations alive.
|
|
166
|
+
const change = minimalLineChange(line, next);
|
|
167
|
+
if (change)
|
|
168
|
+
changes.push(change);
|
|
169
|
+
}
|
|
170
|
+
if (changes.length)
|
|
171
|
+
view.dispatch({ changes });
|
|
172
|
+
view.focus();
|
|
173
|
+
}
|
|
174
|
+
/** Nest the selected list item(s) under the nearest preceding item at the same
|
|
175
|
+
* level, indenting only as far as that parent's content column. That keeps the
|
|
176
|
+
* item a valid nested list — 4+ spaces with no parent would parse as an indented
|
|
177
|
+
* code block — so a first or standalone item (no parent) is left untouched. */
|
|
178
|
+
export function indentListItems(view) {
|
|
179
|
+
if (view.state.readOnly)
|
|
180
|
+
return;
|
|
181
|
+
const { state } = view;
|
|
182
|
+
const { from, to } = state.selection.main;
|
|
183
|
+
const first = state.doc.lineAt(from).number;
|
|
184
|
+
const last = state.doc.lineAt(to).number;
|
|
185
|
+
const changes = [];
|
|
186
|
+
for (let i = first; i <= last; i++) {
|
|
187
|
+
const line = state.doc.line(i);
|
|
188
|
+
const match = line.text.match(LIST_STRIP_RE);
|
|
189
|
+
if (!match)
|
|
190
|
+
continue;
|
|
191
|
+
const indent = match[1].length;
|
|
192
|
+
// Walk up to the nearest list item at this level or shallower — the item we
|
|
193
|
+
// nest under. A blank line is skipped (loose lists); a non-list line ends it.
|
|
194
|
+
let parentContentColumn = -1;
|
|
195
|
+
for (let j = i - 1; j >= 1; j--) {
|
|
196
|
+
const text = state.doc.line(j).text;
|
|
197
|
+
if (text.trim() === '')
|
|
198
|
+
continue;
|
|
199
|
+
const prev = text.match(LIST_STRIP_RE);
|
|
200
|
+
if (!prev)
|
|
201
|
+
break;
|
|
202
|
+
if (prev[1].length <= indent) {
|
|
203
|
+
parentContentColumn = prev[0].length;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (parentContentColumn > indent) {
|
|
208
|
+
changes.push({ from: line.from, insert: ' '.repeat(parentContentColumn - indent) });
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (changes.length)
|
|
212
|
+
view.dispatch({ changes });
|
|
213
|
+
view.focus();
|
|
214
|
+
}
|
|
215
|
+
/** Whether the list item at the caret can be nested deeper (it has a preceding
|
|
216
|
+
* item at the same level to nest under). Drives the indent button's disabled state. */
|
|
217
|
+
export function canIndentListItem(view) {
|
|
218
|
+
const { state } = view;
|
|
219
|
+
const line = state.doc.lineAt(state.selection.main.head);
|
|
220
|
+
const match = line.text.match(LIST_STRIP_RE);
|
|
221
|
+
if (!match)
|
|
222
|
+
return false;
|
|
223
|
+
const indent = match[1].length;
|
|
224
|
+
for (let j = line.number - 1; j >= 1; j--) {
|
|
225
|
+
const text = state.doc.line(j).text;
|
|
226
|
+
if (text.trim() === '')
|
|
227
|
+
continue;
|
|
228
|
+
const prev = text.match(LIST_STRIP_RE);
|
|
229
|
+
if (!prev)
|
|
230
|
+
return false;
|
|
231
|
+
if (prev[1].length <= indent)
|
|
232
|
+
return prev[0].length > indent;
|
|
233
|
+
}
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
/** Whether the list item at the caret is nested (indented) and so can be outdented. */
|
|
237
|
+
export function canOutdentListItem(view) {
|
|
238
|
+
const match = view.state.doc.lineAt(view.state.selection.main.head).text.match(LIST_STRIP_RE);
|
|
239
|
+
return !!match && match[1].length > 0;
|
|
240
|
+
}
|
|
241
|
+
/** Backspace at a list item's content start (right after the marker) removes the
|
|
242
|
+
* marker and its trailing space — the item's own indent is kept — so a top-level
|
|
243
|
+
* item cleanly returns to column 0 for every number, not just the first. CodeMirror's
|
|
244
|
+
* default deleteMarkupBackward instead aligns the content under the previous item,
|
|
245
|
+
* leaving stray whitespace on items 2, 3, … Returns false (so other handlers run)
|
|
246
|
+
* unless the caret sits exactly at a list marker's end outside a code block. */
|
|
247
|
+
export function clearListMarkerBackward(view) {
|
|
248
|
+
// Consume Backspace entirely on a read-only editor. Returning false would hand it
|
|
249
|
+
// to the markdown language's deleteMarkupBackward, which (unlike @codemirror/commands)
|
|
250
|
+
// does NOT check readOnly and would delete the marker anyway. This binding is
|
|
251
|
+
// already Prec.highest to sit in front of it, so swallowing here is the fix.
|
|
252
|
+
if (view.state.readOnly)
|
|
253
|
+
return true;
|
|
254
|
+
const { state } = view;
|
|
255
|
+
const sel = state.selection.main;
|
|
256
|
+
if (!sel.empty)
|
|
257
|
+
return false;
|
|
258
|
+
const line = state.doc.lineAt(sel.head);
|
|
259
|
+
const marker = line.text.match(/^(\s*)(?:\d+[.)]|[-*+])\s/);
|
|
260
|
+
if (!marker || sel.head !== line.from + marker[0].length)
|
|
261
|
+
return false;
|
|
262
|
+
// A leading marker in a code block is literal text, not a list.
|
|
263
|
+
if (enclosing(view, line.from, 'FencedCode') || enclosing(view, line.from, 'CodeBlock'))
|
|
264
|
+
return false;
|
|
265
|
+
const from = line.from + marker[1].length; // keep the item's own indent
|
|
266
|
+
view.dispatch({
|
|
267
|
+
changes: { from, to: line.from + marker[0].length },
|
|
268
|
+
selection: { anchor: from },
|
|
269
|
+
userEvent: 'delete.backward',
|
|
270
|
+
});
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
export function toggleQuote(view) {
|
|
274
|
+
const re = /^(\s*)>\s?/;
|
|
275
|
+
const allQuoted = everySelectedLine(view, (t) => re.test(t) || t.trim() === '');
|
|
276
|
+
mapSelectedLines(view, (t) => {
|
|
277
|
+
if (t.trim() === '')
|
|
278
|
+
return t;
|
|
279
|
+
if (allQuoted)
|
|
280
|
+
return t.replace(re, '$1');
|
|
281
|
+
return re.test(t) ? t : t.replace(/^(\s*)/, '$1> ');
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
/** Wrap the selection as a markdown link. Caret lands where the user types next:
|
|
285
|
+
* inside `[]` if there's no text, inside `()` if there's no href, else after. */
|
|
286
|
+
// The non-mention Link node enclosing `pos`, or null. Mentions own their click,
|
|
287
|
+
// so they don't count as a "link" for the link button.
|
|
288
|
+
function realLinkAt(view, pos) {
|
|
289
|
+
const link = enclosing(view, pos, 'Link');
|
|
290
|
+
if (!link)
|
|
291
|
+
return null;
|
|
292
|
+
for (let child = link.firstChild; child; child = child.nextSibling) {
|
|
293
|
+
if (child.name === 'URL' && view.state.sliceDoc(child.from, child.to).startsWith('user:'))
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
return link;
|
|
297
|
+
}
|
|
298
|
+
export function toggleLink(view, href = '') {
|
|
299
|
+
if (view.state.readOnly)
|
|
300
|
+
return;
|
|
301
|
+
// In a link already → unwrap it (drop the [ ]( ) markers, keep the text).
|
|
302
|
+
const link = realLinkAt(view, view.state.selection.main.head);
|
|
303
|
+
if (link) {
|
|
304
|
+
const text = view.state.sliceDoc(link.from, link.to).replace(/^\[(.*)\]\([^)]*\)$/, '$1');
|
|
305
|
+
view.dispatch({
|
|
306
|
+
changes: { from: link.from, to: link.to, insert: text },
|
|
307
|
+
selection: EditorSelection.range(link.from, link.from + text.length),
|
|
308
|
+
});
|
|
309
|
+
view.focus();
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
view.dispatch(view.state.changeByRange((range) => {
|
|
313
|
+
const text = view.state.sliceDoc(range.from, range.to);
|
|
314
|
+
const insert = `[${text}](${href})`;
|
|
315
|
+
let caret;
|
|
316
|
+
if (!text)
|
|
317
|
+
caret = range.from + 1;
|
|
318
|
+
else if (!href)
|
|
319
|
+
caret = range.from + 1 + text.length + 2;
|
|
320
|
+
else
|
|
321
|
+
caret = range.from + insert.length;
|
|
322
|
+
return { changes: { from: range.from, to: range.to, insert }, range: EditorSelection.cursor(caret) };
|
|
323
|
+
}));
|
|
324
|
+
view.focus();
|
|
325
|
+
}
|
|
326
|
+
/** Wrap the selected lines in a ``` fenced code block, or unwrap if already in one. */
|
|
327
|
+
export function toggleCodeBlock(view) {
|
|
328
|
+
if (view.state.readOnly)
|
|
329
|
+
return;
|
|
330
|
+
const { state } = view;
|
|
331
|
+
const { from, to } = state.selection.main;
|
|
332
|
+
const first = state.doc.lineAt(from);
|
|
333
|
+
const last = state.doc.lineAt(to);
|
|
334
|
+
const prev = first.number > 1 ? state.doc.line(first.number - 1) : null;
|
|
335
|
+
const next = last.number < state.doc.lines ? state.doc.line(last.number + 1) : null;
|
|
336
|
+
const fenced = !!prev?.text.trim().startsWith('```') && !!next?.text.trim().startsWith('```');
|
|
337
|
+
if (fenced && prev && next) {
|
|
338
|
+
view.dispatch({ changes: [{ from: prev.from, to: first.from }, { from: last.to, to: next.to }] });
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
view.dispatch({ changes: [{ from: first.from, insert: '```\n' }, { from: last.to, insert: '\n```' }] });
|
|
342
|
+
}
|
|
343
|
+
view.focus();
|
|
344
|
+
}
|
|
345
|
+
export function readActiveFormats(view) {
|
|
346
|
+
const { state } = view;
|
|
347
|
+
const pos = state.selection.main.head;
|
|
348
|
+
// Inline marks light up only when the caret is *within* them on both sides,
|
|
349
|
+
// so an edge caret (where typed text lands outside the format) stays inactive.
|
|
350
|
+
const has = (name) => enclosingInline(view, pos, name) !== null;
|
|
351
|
+
const lineText = state.doc.lineAt(pos).text;
|
|
352
|
+
const lineStart = state.doc.lineAt(pos).from;
|
|
353
|
+
const headingMatch = lineText.match(/^(#{1,6})\s/);
|
|
354
|
+
// In a code block a leading marker is literal text, not a list/heading — the
|
|
355
|
+
// regex-based checks below would otherwise report it. (The syntax-tree checks,
|
|
356
|
+
// like bold or quote, already ignore code content.)
|
|
357
|
+
const codeBlock = enclosing(view, lineStart, 'FencedCode') !== null || enclosing(view, lineStart, 'CodeBlock') !== null;
|
|
358
|
+
return {
|
|
359
|
+
bold: has('StrongEmphasis'),
|
|
360
|
+
italic: has('Emphasis'),
|
|
361
|
+
inlineCode: has('InlineCode'),
|
|
362
|
+
codeBlock,
|
|
363
|
+
strikethrough: has('Strikethrough'),
|
|
364
|
+
link: realLinkAt(view, pos) !== null,
|
|
365
|
+
// Lists from the line's own marker. (Resolving the tree at a line-end caret
|
|
366
|
+
// can spill into the next line and flip-flop the toolbar state.)
|
|
367
|
+
bulletList: !codeBlock && /^\s*[-*+]\s/.test(lineText),
|
|
368
|
+
orderedList: !codeBlock && /^\s*\d+[.)]\s/.test(lineText),
|
|
369
|
+
// Quote from the Blockquote node at the line's *start* — that catches lazy
|
|
370
|
+
// continuation lines (part of the quote but with no '>') too, while resolving
|
|
371
|
+
// at line.from (not the caret) keeps it stable at the line end.
|
|
372
|
+
quote: enclosing(view, lineStart, 'Blockquote') !== null,
|
|
373
|
+
heading: (codeBlock || !headingMatch ? 0 : headingMatch[1].length),
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
//# sourceMappingURL=text-editor.commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-editor.commands.js","sourceRoot":"","sources":["../../../../src/components/inputs/text-editor/text-editor.commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,C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DDCodeMirrorElement):
|
|
5
|
+
* the document stays plain markdown text, but formatting is shown inline (bold
|
|
6
|
+
* is bold, headings are larger, links are coloured) while the syntax markers
|
|
7
|
+
* stay visible, only dimmed — the iA Writer / Kirby approach. No WYSIWYG tree,
|
|
8
|
+
* so the data stays portable.
|
|
9
|
+
*
|
|
10
|
+
* Default `variant="simple"` is bare (no frame, no focus ring) for use inside
|
|
11
|
+
* a composition (e.g. a message field) that owns its chrome and focus; the
|
|
12
|
+
* caret is a prominent accent. `variant="input-field"` adds a framed surface + focus
|
|
13
|
+
* ring. `font` is `sans` (default, best for prose) or `mono`.
|
|
14
|
+
*
|
|
15
|
+
* Headless: there is no built-in toolbar. A consumer drives formatting via the
|
|
16
|
+
* command methods (toggleBold/toggleItalic/toggleInlineCode/toggleStrikethrough/
|
|
17
|
+
* toggleHeading/toggleBulletList/toggleQuote/toggleLink/runCommand to toggle, and
|
|
18
|
+
* setHeading/setList for picker-style "set" semantics), reads the active formats
|
|
19
|
+
* with getState(), listens to the nldd-text-editor-state event to render toggle
|
|
20
|
+
* states, and forwards padding clicks with focusFromPoint(). Cmd/Ctrl+B/I/E/K are
|
|
21
|
+
* bound out of the box. Commands keep focus on the editor. An @-mention typeahead
|
|
22
|
+
* (mentionSource) collapses to an atomic token, and a W3C-style annotation overlay
|
|
23
|
+
* (annotations) marks ranges with a dashed underline, light tint and a count badge
|
|
24
|
+
* without touching the underlying text.
|
|
25
|
+
*
|
|
26
|
+
* @element nldd-text-editor
|
|
27
|
+
*
|
|
28
|
+
* @attr {string} value - Editor content (markdown)
|
|
29
|
+
* @attr {string} placeholder - Placeholder text shown while empty
|
|
30
|
+
* @attr {string} input-id - Sets the id on the editable element. Set automatically by nldd-form-field.
|
|
31
|
+
* @attr {boolean} disabled - Disabled state
|
|
32
|
+
* @attr {string} name - Field name for form submission
|
|
33
|
+
* @attr {boolean} readonly - Readonly state (focusable and selectable, not editable)
|
|
34
|
+
* @attr {boolean} required - Required state
|
|
35
|
+
* @attr {boolean} wrap - Wrap long lines (default true; prose wraps)
|
|
36
|
+
* @attr {number} rows - Minimum visible rows (the floor in every resize mode). Default: 6.
|
|
37
|
+
* @attr {string} resize - 'none' (fixed) | 'vertical' (drag) | 'auto' (grow, default)
|
|
38
|
+
* @attr {string} variant - 'simple' (default, bare) | 'input-field' (framed surface)
|
|
39
|
+
* @attr {string} font - 'sans' (default) | 'mono'
|
|
40
|
+
* @attr {string} accessible-label - Accessible label forwarded to the editor. Set automatically by nldd-form-field.
|
|
41
|
+
*
|
|
42
|
+
* @prop {MentionSource} mentionSource - Consumer-supplied @-mention candidate source (property only). Without it, @-typeahead is inert.
|
|
43
|
+
* @attr {boolean} annotatable - Enable the annotation overlay (off by default). Annotations only render when this is set.
|
|
44
|
+
* @prop {Annotation[]} annotations - Consumer-supplied annotation overlay (property only). Anchored by offset and mapped through edits; the text stays clean. Requires `annotatable`. Assign a NEW array to apply changes (Lit dirty-checks by identity, so in-place mutation like `.push()` won't re-render): `editor.annotations = [...editor.annotations, next]`.
|
|
45
|
+
* @attr {object} translations - Override the editor's assistive-tech strings (the open-in-new-tab link badge and the annotation count badge). Unset keys fall back to Dutch.
|
|
46
|
+
*
|
|
47
|
+
* @fires input - When the content changes (detail: { value })
|
|
48
|
+
* @fires change - When the content is committed on blur (detail: { value })
|
|
49
|
+
* @fires nldd-text-editor-state - When the selection or content changes (detail: TextEditorState), for toolbar toggle state
|
|
50
|
+
* @fires nldd-text-editor-mention - When an @-mention is inserted (detail: MentionInsertedDetail with id, label, from, to)
|
|
51
|
+
* @fires nldd-text-editor-annotation-click - When an annotation's count badge is clicked (detail: { ids: string[], rect: DOMRect }); rect is the badge's viewport box so a consumer can anchor its own note UI to it
|
|
52
|
+
*/
|
|
53
|
+
import { type PropertyValues } from 'lit';
|
|
54
|
+
import { type Extension } from '@codemirror/state';
|
|
55
|
+
import { NLDDCodeMirrorElement } from '../../../utilities/codemirror/codemirror-element.js';
|
|
56
|
+
import { type MentionSource } from './text-editor.mentions.js';
|
|
57
|
+
import { type Annotation } from './text-editor.annotations.js';
|
|
58
|
+
import { type HeadingLevel, type TextEditorState } from './text-editor.commands.js';
|
|
59
|
+
import { type NLDDTextEditorTranslations } from './text-editor.i18n.js';
|
|
60
|
+
export type ResizeMode = 'none' | 'vertical' | 'auto';
|
|
61
|
+
export type TextEditorVariant = 'input-field' | 'simple';
|
|
62
|
+
export type TextEditorFont = 'sans' | 'mono';
|
|
63
|
+
export type { HeadingLevel, TextEditorState, TextEditorActiveFormats } from './text-editor.commands.js';
|
|
64
|
+
export type { MentionCandidate, MentionSource, MentionInsertedDetail } from './text-editor.mentions.js';
|
|
65
|
+
export type { Annotation } from './text-editor.annotations.js';
|
|
66
|
+
export declare class NLDDTextEditor extends NLDDCodeMirrorElement {
|
|
67
|
+
static formAssociated: boolean;
|
|
68
|
+
static shadowRootOptions: {
|
|
69
|
+
delegatesFocus: boolean;
|
|
70
|
+
clonable?: boolean;
|
|
71
|
+
customElementRegistry?: CustomElementRegistry;
|
|
72
|
+
mode: ShadowRootMode;
|
|
73
|
+
serializable?: boolean;
|
|
74
|
+
slotAssignment?: SlotAssignmentMode;
|
|
75
|
+
};
|
|
76
|
+
static styles: import("lit").CSSResult;
|
|
77
|
+
private _internals;
|
|
78
|
+
private _initialValue;
|
|
79
|
+
private _valueAtFocus;
|
|
80
|
+
private _accessibleLabelWarned;
|
|
81
|
+
value: string;
|
|
82
|
+
inputId: string;
|
|
83
|
+
placeholder: string;
|
|
84
|
+
disabled: boolean;
|
|
85
|
+
name: string;
|
|
86
|
+
readonly: boolean;
|
|
87
|
+
required: boolean;
|
|
88
|
+
wrap: boolean;
|
|
89
|
+
rows: number;
|
|
90
|
+
resize: ResizeMode;
|
|
91
|
+
variant: TextEditorVariant;
|
|
92
|
+
font: TextEditorFont;
|
|
93
|
+
accessibleLabel: string;
|
|
94
|
+
/** Consumer-supplied @-mention source: called with the text typed after `@`
|
|
95
|
+
* and returns (a promise of) candidates. Property only (set via JS); without
|
|
96
|
+
* it, @-typeahead is inert. */
|
|
97
|
+
mentionSource?: MentionSource;
|
|
98
|
+
/** Whether the annotation overlay is enabled. Off by default; set the
|
|
99
|
+
* `annotatable` attribute to turn it on (so the comment affordance and the
|
|
100
|
+
* overlay only appear when the consumer opts in). */
|
|
101
|
+
annotatable: boolean;
|
|
102
|
+
/** Consumer-supplied annotations (W3C-style overlay). Property only (set via
|
|
103
|
+
* JS). Render only when `annotatable` is on. The text stays clean; these
|
|
104
|
+
* render as a light tint and a count badge, anchored by offset and mapped
|
|
105
|
+
* through edits.
|
|
106
|
+
*
|
|
107
|
+
* IMPORTANT: assign a NEW array to apply changes. Lit dirty-checks this
|
|
108
|
+
* property by identity, so mutating the existing array in place
|
|
109
|
+
* (`editor.annotations.push(next)`, `editor.annotations[0].end = 9`, …) does
|
|
110
|
+
* NOT trigger a re-render. Always replace it:
|
|
111
|
+
* `editor.annotations = [...editor.annotations, next]`. */
|
|
112
|
+
annotations: Annotation[];
|
|
113
|
+
/** Override translation keys for the editor's assistive-tech strings (the
|
|
114
|
+
* open-in-new-tab link badge and the annotation count badge). Unset keys fall
|
|
115
|
+
* back to Dutch. */
|
|
116
|
+
translations: Partial<NLDDTextEditorTranslations>;
|
|
117
|
+
private _container;
|
|
118
|
+
private _editableCompartment;
|
|
119
|
+
private _wrapCompartment;
|
|
120
|
+
private _placeholderCompartment;
|
|
121
|
+
private _attrsCompartment;
|
|
122
|
+
private _historyCompartment;
|
|
123
|
+
protected getEditorParent(): HTMLElement | null | undefined;
|
|
124
|
+
/** Resolve a translation key, applying `{name}` placeholder substitution from
|
|
125
|
+
* `vars`. Consumer overrides via `translations` win; unset keys fall back to the
|
|
126
|
+
* Dutch defaults. */
|
|
127
|
+
_t(key: keyof NLDDTextEditorTranslations, vars?: Record<string, string | number>): string;
|
|
128
|
+
protected buildExtensions(): Extension[];
|
|
129
|
+
private _editableExtension;
|
|
130
|
+
private _placeholderExtension;
|
|
131
|
+
private _attrsExtension;
|
|
132
|
+
firstUpdated(): void;
|
|
133
|
+
protected onEditorMounted(): void;
|
|
134
|
+
updated(changed: PropertyValues): void;
|
|
135
|
+
private _syncAnnotations;
|
|
136
|
+
private _selectMentionBeforeDelete;
|
|
137
|
+
toggleBold(): void;
|
|
138
|
+
toggleItalic(): void;
|
|
139
|
+
toggleInlineCode(): void;
|
|
140
|
+
toggleStrikethrough(): void;
|
|
141
|
+
toggleHeading(level: HeadingLevel): void;
|
|
142
|
+
/** Set the block to a heading level (0 = paragraph) without toggling — for a
|
|
143
|
+
* picker where choosing a level always applies it. */
|
|
144
|
+
setHeading(level: HeadingLevel): void;
|
|
145
|
+
toggleBulletList(): void;
|
|
146
|
+
/** Set the list type, replacing any existing list ('none' strips it) — for an
|
|
147
|
+
* exclusive list picker. */
|
|
148
|
+
setList(type: 'none' | 'bullet' | 'ordered'): void;
|
|
149
|
+
toggleQuote(): void;
|
|
150
|
+
toggleLink(href?: string): void;
|
|
151
|
+
toggleCodeBlock(): void;
|
|
152
|
+
/** Nest the selected list item(s) under the preceding item at the same level.
|
|
153
|
+
* Only list items move, and only as far as that parent's content column — so a
|
|
154
|
+
* first or standalone item can't be over-indented into an indented code block. */
|
|
155
|
+
indent(): void;
|
|
156
|
+
/** Decrease the leading indentation of the selected lines. */
|
|
157
|
+
outdent(): void;
|
|
158
|
+
/** Undo the last change. History is built in, so Cmd/Ctrl+Z works too. */
|
|
159
|
+
undo(): void;
|
|
160
|
+
/** Redo the last undone change (Cmd/Ctrl+Shift+Z / Ctrl+Y also work). */
|
|
161
|
+
redo(): void;
|
|
162
|
+
/** Drop the undo/redo history, leaving the document untouched. Use after a
|
|
163
|
+
* consumer-driven discard so a later undo can't step back into the
|
|
164
|
+
* thrown-away edits. Reconfiguring the history compartment off and back on
|
|
165
|
+
* re-initialises it with empty stacks. */
|
|
166
|
+
clearHistory(): void;
|
|
167
|
+
/** Text and annotations of the last cut, so a same-editor paste can move the
|
|
168
|
+
* annotations along with their text. Cleared by copy and by a matching paste. */
|
|
169
|
+
private _cutBuffer;
|
|
170
|
+
/** The annotations lying fully inside the current selection, offset relative to
|
|
171
|
+
* the selection's clean start. */
|
|
172
|
+
private _annotationsInSelection;
|
|
173
|
+
/** Copy the current selection to the clipboard, sentinel-free. No-op when the
|
|
174
|
+
* selection is empty or the clipboard is unavailable (e.g. permission denied). */
|
|
175
|
+
copy(): Promise<void>;
|
|
176
|
+
/** Cut the current selection to the clipboard and remove it from the document.
|
|
177
|
+
* Its annotations are remembered so a paste back into this editor moves them
|
|
178
|
+
* along. No-op when the selection is empty. */
|
|
179
|
+
cut(): Promise<void>;
|
|
180
|
+
/** Paste clipboard text at the caret, replacing any selection. Sentinels that
|
|
181
|
+
* rode in from another editor are stripped. When the text matches a cut made in
|
|
182
|
+
* this editor, its annotations travel with it (a move); otherwise it's plain
|
|
183
|
+
* text. No-op when the clipboard is empty or unreadable. */
|
|
184
|
+
paste(): Promise<void>;
|
|
185
|
+
/** Insert `text` at the selection, re-attaching the cut annotations when it matches
|
|
186
|
+
* a cut made in this editor (a move, one-shot). Shared by the toolbar's paste()
|
|
187
|
+
* and the native Cmd/Ctrl+V handler. */
|
|
188
|
+
private _pasteText;
|
|
189
|
+
/** Escape hatch: run a command by name (bold, italic, inlineCode,
|
|
190
|
+
* strikethrough, bulletList, quote, heading [payload: level], link
|
|
191
|
+
* [payload: href], copy, cut, paste). */
|
|
192
|
+
runCommand(name: string, payload?: unknown): void;
|
|
193
|
+
/** The formats active at the current selection (drives a toolbar's state). */
|
|
194
|
+
getState(): TextEditorState;
|
|
195
|
+
/** The current selection in CLEAN (annotation-sentinel-free) coordinates plus
|
|
196
|
+
* the quoted text — the anchor a consumer needs to attach a new annotation to
|
|
197
|
+
* the selection (e.g. from a toolbar "comment" button). `empty` mirrors
|
|
198
|
+
* getState().empty for gating that button.
|
|
199
|
+
*
|
|
200
|
+
* `rect` is the selection's bounding box in viewport coordinates (or the
|
|
201
|
+
* caret box when empty), so a consumer can anchor a popover to the selected
|
|
202
|
+
* text itself instead of to its own button. Use it as a Floating UI virtual
|
|
203
|
+
* anchor: `{ getBoundingClientRect: () => rect, contextElement: editorEl }`.
|
|
204
|
+
* It is computed from CodeMirror's layout, so it is correct even when the
|
|
205
|
+
* editor is not focused (clicking a toolbar button blurs the editor but the
|
|
206
|
+
* selection state survives). `null` when there is no view or the selection
|
|
207
|
+
* is scrolled out of sight. */
|
|
208
|
+
getSelection(): {
|
|
209
|
+
start: number;
|
|
210
|
+
end: number;
|
|
211
|
+
quote: string;
|
|
212
|
+
empty: boolean;
|
|
213
|
+
rect: DOMRect | null;
|
|
214
|
+
};
|
|
215
|
+
/** The annotations currently in the editor, in CLEAN coordinates, each quote
|
|
216
|
+
* re-sliced from the current text — so a consumer can persist positions that
|
|
217
|
+
* moved with edits (read this on save, then write the anchors back). */
|
|
218
|
+
getAnnotations(): Annotation[];
|
|
219
|
+
private _emitState;
|
|
220
|
+
private _emitMention;
|
|
221
|
+
private _onScrollerPointerDown;
|
|
222
|
+
private _onMentionPointerDown;
|
|
223
|
+
/** A click on an annotation's count badge emits nldd-text-editor-annotation-click
|
|
224
|
+
* with the id(s) it covers (a merged badge carries several) and the badge's
|
|
225
|
+
* viewport rect, so the consumer can anchor its own note UI to the badge. The
|
|
226
|
+
* tinted text stays plain-clickable for caret placement. */
|
|
227
|
+
private _onAnnotationBadgeClick;
|
|
228
|
+
private _onDocChanged;
|
|
229
|
+
private _emitChange;
|
|
230
|
+
private _checkAccessibleLabel;
|
|
231
|
+
formResetCallback(): void;
|
|
232
|
+
formDisabledCallback(disabled: boolean): void;
|
|
233
|
+
formStateRestoreCallback(state: File | string | FormData | null): void;
|
|
234
|
+
render(): import("lit-html").TemplateResult;
|
|
235
|
+
}
|
|
236
|
+
declare global {
|
|
237
|
+
interface HTMLElementTagNameMap {
|
|
238
|
+
'nldd-text-editor': NLDDTextEditor;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=text-editor.d.ts.map
|
|
@@ -0,0 +1 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