@nldd/design-system 0.8.79 → 0.8.82
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/custom-elements.json +2400 -664
- package/dist/components/actions/button/button.styles.d.ts.map +1 -1
- package/dist/components/actions/button/button.styles.js +4 -1
- package/dist/components/actions/button/button.styles.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 +4 -1
- package/dist/components/actions/icon-button/icon-button.styles.js.map +1 -1
- package/dist/components/actions/menu/menu.d.ts +44 -3
- package/dist/components/actions/menu/menu.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.js +86 -33
- package/dist/components/actions/menu/menu.js.map +1 -1
- package/dist/components/actions/menu/menu.template.d.ts +1 -1
- package/dist/components/actions/menu/menu.template.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.template.js +7 -3
- package/dist/components/actions/menu/menu.template.js.map +1 -1
- package/dist/components/actions/toolbar/toolbar.d.ts +29 -0
- package/dist/components/actions/toolbar/toolbar.d.ts.map +1 -1
- package/dist/components/actions/toolbar/toolbar.i18n.d.ts +1 -0
- package/dist/components/actions/toolbar/toolbar.i18n.d.ts.map +1 -1
- package/dist/components/actions/toolbar/toolbar.i18n.js +1 -0
- package/dist/components/actions/toolbar/toolbar.i18n.js.map +1 -1
- package/dist/components/actions/toolbar/toolbar.js +74 -0
- 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 +39 -5
- package/dist/components/actions/toolbar/toolbar.styles.js.map +1 -1
- package/dist/components/actions/toolbar/toolbar.template.d.ts.map +1 -1
- package/dist/components/actions/toolbar/toolbar.template.js +19 -1
- package/dist/components/actions/toolbar/toolbar.template.js.map +1 -1
- package/dist/components/breakpoints-CkxsiRgH.js +10 -0
- package/dist/components/components.js +51975 -114
- package/dist/components/content/avatar/avatar.d.ts +51 -47
- package/dist/components/content/avatar/avatar.d.ts.map +1 -1
- package/dist/components/content/avatar/avatar.js +85 -75
- package/dist/components/content/avatar/avatar.js.map +1 -1
- package/dist/components/content/avatar/avatar.styles.js +2 -2
- package/dist/components/content/avatar/avatar.template.d.ts +1 -0
- package/dist/components/content/avatar/avatar.template.d.ts.map +1 -1
- package/dist/components/content/avatar/avatar.template.js +26 -18
- package/dist/components/content/avatar/avatar.template.js.map +1 -1
- package/dist/components/content/avatar-group/avatar-group.d.ts +90 -0
- package/dist/components/content/avatar-group/avatar-group.d.ts.map +1 -0
- package/dist/components/content/avatar-group/avatar-group.i18n.d.ts +6 -0
- package/dist/components/content/avatar-group/avatar-group.i18n.d.ts.map +1 -0
- package/dist/components/content/avatar-group/avatar-group.i18n.js +5 -0
- package/dist/components/content/avatar-group/avatar-group.i18n.js.map +1 -0
- package/dist/components/content/avatar-group/avatar-group.js +169 -0
- package/dist/components/content/avatar-group/avatar-group.js.map +1 -0
- package/dist/components/content/avatar-group/avatar-group.styles.d.ts +2 -0
- package/dist/components/content/avatar-group/avatar-group.styles.d.ts.map +1 -0
- package/dist/components/content/avatar-group/avatar-group.styles.js +132 -0
- package/dist/components/content/avatar-group/avatar-group.styles.js.map +1 -0
- package/dist/components/content/avatar-group/avatar-group.template.d.ts +3 -0
- package/dist/components/content/avatar-group/avatar-group.template.d.ts.map +1 -0
- package/dist/components/content/avatar-group/avatar-group.template.js +50 -0
- package/dist/components/content/avatar-group/avatar-group.template.js.map +1 -0
- package/dist/components/content/blockquote/blockquote.d.ts +3 -3
- package/dist/components/content/blockquote/blockquote.d.ts.map +1 -1
- package/dist/components/content/blockquote/blockquote.js +8 -8
- package/dist/components/content/blockquote/blockquote.js.map +1 -1
- package/dist/components/content/blockquote/blockquote.styles.js +1 -1
- package/dist/components/content/blockquote/blockquote.template.js +1 -1
- package/dist/components/content/blockquote/blockquote.template.js.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.d.ts +4 -4
- package/dist/components/content/code-viewer/code-viewer.d.ts.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.js +5 -13
- package/dist/components/content/code-viewer/code-viewer.js.map +1 -1
- package/dist/components/content/code-viewer/code-viewer.styles.js +1 -1
- package/dist/components/content/icon/icon-aliases.d.ts.map +1 -1
- package/dist/components/content/icon/icon-aliases.js +18 -0
- package/dist/components/content/icon/icon-aliases.js.map +1 -1
- package/dist/components/content/icon/icon-gallery-status.d.ts.map +1 -1
- package/dist/components/content/icon/icon-gallery-status.js +75 -27
- package/dist/components/content/icon/icon-gallery-status.js.map +1 -1
- package/dist/components/content/icon/icon-registry.d.ts.map +1 -1
- package/dist/components/content/icon/icon-registry.js +25 -13
- package/dist/components/content/icon/icon-registry.js.map +1 -1
- package/dist/components/content/identity/identity.d.ts +71 -0
- package/dist/components/content/identity/identity.d.ts.map +1 -0
- package/dist/components/content/identity/identity.js +124 -0
- package/dist/components/content/identity/identity.js.map +1 -0
- package/dist/components/content/identity/identity.styles.d.ts +2 -0
- package/dist/components/content/identity/identity.styles.d.ts.map +1 -0
- package/dist/components/content/{byline/byline.styles.js → identity/identity.styles.js} +28 -47
- package/dist/components/content/identity/identity.styles.js.map +1 -0
- package/dist/components/content/identity/identity.template.d.ts +3 -0
- package/dist/components/content/identity/identity.template.d.ts.map +1 -0
- package/dist/components/content/{byline/byline.template.js → identity/identity.template.js} +12 -11
- package/dist/components/content/identity/identity.template.js.map +1 -0
- package/dist/components/content/tag/tag.d.ts +15 -10
- package/dist/components/content/tag/tag.d.ts.map +1 -1
- package/dist/components/content/tag/tag.js +15 -10
- package/dist/components/content/tag/tag.js.map +1 -1
- package/dist/components/content/title/title.d.ts +4 -4
- package/dist/components/content/title/title.js +4 -4
- package/dist/components/content/title/title.styles.js +1 -1
- package/dist/components/content/title/title.template.js +2 -2
- package/dist/components/content/token/token.d.ts +6 -2
- package/dist/components/content/token/token.d.ts.map +1 -1
- package/dist/components/content/token/token.js +6 -2
- package/dist/components/content/token/token.js.map +1 -1
- package/dist/components/content/tooltip/tooltip.d.ts +26 -25
- package/dist/components/content/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/content/tooltip/tooltip.js +31 -25
- package/dist/components/content/tooltip/tooltip.js.map +1 -1
- package/dist/components/decorate-BKn10QQi.js +9 -0
- package/dist/components/dist-BYVOPNHp.js +381 -0
- package/dist/components/dist-Bq4xc7Bm.js +624 -0
- package/dist/components/dist-C0PiB1dr.js +870 -0
- package/dist/components/dist-C400RcFU.js +1498 -0
- package/dist/components/dist-CCg5Mso_.js +390 -0
- package/dist/components/dist-CJR_Rwhh.js +464 -0
- package/dist/components/dist-Ccw7ZfsU.js +18481 -0
- package/dist/components/dist-OBifyiJS.js +887 -0
- package/dist/components/dist-TpIL8G4G.js +1480 -0
- package/dist/components/dist-afrAoubg.js +1181 -0
- package/dist/components/dist-bO14jlsr.js +78 -0
- package/dist/components/forms/form-field/form-field.d.ts +59 -2
- package/dist/components/forms/form-field/form-field.d.ts.map +1 -1
- package/dist/components/forms/form-field/form-field.js +120 -35
- package/dist/components/forms/form-field/form-field.js.map +1 -1
- package/dist/components/gherkin-uCVRxsGf.js +108 -0
- package/dist/components/icon-CIpJq_cf.js +751 -0
- package/dist/components/icon-button-BAkUJTn6.js +1676 -0
- package/dist/components/index.d.ts +4 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/input-modality-DhTeUxKi.js +43 -0
- package/dist/components/inputs/checkbox/checkbox.d.ts +13 -0
- package/dist/components/inputs/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/inputs/checkbox/checkbox.js +18 -0
- package/dist/components/inputs/checkbox/checkbox.js.map +1 -1
- package/dist/components/inputs/checkbox/checkbox.styles.d.ts.map +1 -1
- package/dist/components/inputs/checkbox/checkbox.styles.js +17 -0
- package/dist/components/inputs/checkbox/checkbox.styles.js.map +1 -1
- package/dist/components/inputs/checkbox/checkbox.template.d.ts.map +1 -1
- package/dist/components/inputs/checkbox/checkbox.template.js +11 -0
- package/dist/components/inputs/checkbox/checkbox.template.js.map +1 -1
- package/dist/components/inputs/checkbox-field/checkbox-field.d.ts +9 -0
- package/dist/components/inputs/checkbox-field/checkbox-field.d.ts.map +1 -1
- package/dist/components/inputs/checkbox-field/checkbox-field.js +11 -0
- package/dist/components/inputs/checkbox-field/checkbox-field.js.map +1 -1
- package/dist/components/inputs/code-editor/code-editor.d.ts +3 -0
- package/dist/components/inputs/code-editor/code-editor.d.ts.map +1 -1
- package/dist/components/inputs/code-editor/code-editor.js +3 -0
- package/dist/components/inputs/code-editor/code-editor.js.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.d.ts +6 -0
- package/dist/components/inputs/combo-box/combo-box.d.ts.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.js +21 -0
- package/dist/components/inputs/combo-box/combo-box.js.map +1 -1
- package/dist/components/inputs/date-field/date-field.d.ts +6 -0
- package/dist/components/inputs/date-field/date-field.d.ts.map +1 -1
- package/dist/components/inputs/date-field/date-field.js +11 -0
- package/dist/components/inputs/date-field/date-field.js.map +1 -1
- package/dist/components/inputs/date-picker/date-picker.d.ts +3 -0
- package/dist/components/inputs/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/inputs/date-picker/date-picker.js +4 -1
- package/dist/components/inputs/date-picker/date-picker.js.map +1 -1
- package/dist/components/inputs/date-picker/date-picker.styles.d.ts.map +1 -1
- package/dist/components/inputs/date-picker/date-picker.styles.js +7 -2
- package/dist/components/inputs/date-picker/date-picker.styles.js.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.d.ts +29 -0
- package/dist/components/inputs/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.js +44 -1
- package/dist/components/inputs/dropdown/dropdown.js.map +1 -1
- package/dist/components/inputs/file-field/file-field.d.ts +115 -0
- package/dist/components/inputs/file-field/file-field.d.ts.map +1 -0
- package/dist/components/inputs/file-field/file-field.i18n.d.ts +10 -0
- package/dist/components/inputs/file-field/file-field.i18n.d.ts.map +1 -0
- package/dist/components/inputs/file-field/file-field.i18n.js +9 -0
- package/dist/components/inputs/file-field/file-field.i18n.js.map +1 -0
- package/dist/components/inputs/file-field/file-field.js +249 -0
- package/dist/components/inputs/file-field/file-field.js.map +1 -0
- package/dist/components/inputs/file-field/file-field.styles.d.ts +2 -0
- package/dist/components/inputs/file-field/file-field.styles.d.ts.map +1 -0
- package/dist/components/inputs/file-field/file-field.styles.js +134 -0
- package/dist/components/inputs/file-field/file-field.styles.js.map +1 -0
- package/dist/components/inputs/file-field/file-field.template.d.ts +7 -0
- package/dist/components/inputs/file-field/file-field.template.d.ts.map +1 -0
- package/dist/components/inputs/file-field/file-field.template.js +63 -0
- package/dist/components/inputs/file-field/file-field.template.js.map +1 -0
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.d.ts +3 -0
- 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 +3 -0
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.js.map +1 -1
- package/dist/components/inputs/number-field/number-field.d.ts +9 -0
- package/dist/components/inputs/number-field/number-field.d.ts.map +1 -1
- package/dist/components/inputs/number-field/number-field.js +12 -0
- package/dist/components/inputs/number-field/number-field.js.map +1 -1
- package/dist/components/inputs/number-field/number-field.template.d.ts.map +1 -1
- package/dist/components/inputs/number-field/number-field.template.js +1 -0
- package/dist/components/inputs/number-field/number-field.template.js.map +1 -1
- package/dist/components/inputs/password-field/password-field.d.ts +9 -0
- package/dist/components/inputs/password-field/password-field.d.ts.map +1 -1
- package/dist/components/inputs/password-field/password-field.js +12 -0
- package/dist/components/inputs/password-field/password-field.js.map +1 -1
- package/dist/components/inputs/password-field/password-field.template.d.ts.map +1 -1
- package/dist/components/inputs/password-field/password-field.template.js +1 -0
- package/dist/components/inputs/password-field/password-field.template.js.map +1 -1
- package/dist/components/inputs/radio-button/radio-button.d.ts +13 -0
- package/dist/components/inputs/radio-button/radio-button.d.ts.map +1 -1
- package/dist/components/inputs/radio-button/radio-button.js +18 -0
- package/dist/components/inputs/radio-button/radio-button.js.map +1 -1
- package/dist/components/inputs/radio-button/radio-button.styles.d.ts.map +1 -1
- package/dist/components/inputs/radio-button/radio-button.styles.js +11 -0
- package/dist/components/inputs/radio-button/radio-button.styles.js.map +1 -1
- package/dist/components/inputs/radio-button/radio-button.template.d.ts.map +1 -1
- package/dist/components/inputs/radio-button/radio-button.template.js +10 -0
- package/dist/components/inputs/radio-button/radio-button.template.js.map +1 -1
- package/dist/components/inputs/radio-button-field/radio-button-field.d.ts +9 -0
- package/dist/components/inputs/radio-button-field/radio-button-field.d.ts.map +1 -1
- package/dist/components/inputs/radio-button-field/radio-button-field.js +11 -0
- package/dist/components/inputs/radio-button-field/radio-button-field.js.map +1 -1
- package/dist/components/inputs/radio-button-group/radio-button-group.d.ts +16 -0
- package/dist/components/inputs/radio-button-group/radio-button-group.d.ts.map +1 -1
- package/dist/components/inputs/radio-button-group/radio-button-group.js +33 -0
- package/dist/components/inputs/radio-button-group/radio-button-group.js.map +1 -1
- package/dist/components/inputs/search-field/search-field.d.ts +6 -0
- package/dist/components/inputs/search-field/search-field.d.ts.map +1 -1
- package/dist/components/inputs/search-field/search-field.js +6 -0
- package/dist/components/inputs/search-field/search-field.js.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.d.ts +16 -0
- package/dist/components/inputs/segmented-control/segmented-control.d.ts.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.js +26 -7
- package/dist/components/inputs/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/inputs/stepper/stepper.d.ts +17 -0
- package/dist/components/inputs/stepper/stepper.d.ts.map +1 -1
- package/dist/components/inputs/stepper/stepper.js +22 -0
- package/dist/components/inputs/stepper/stepper.js.map +1 -1
- package/dist/components/inputs/stepper/stepper.template.js +1 -1
- package/dist/components/inputs/stepper/stepper.template.js.map +1 -1
- package/dist/components/inputs/switch/switch.d.ts +3 -0
- package/dist/components/inputs/switch/switch.d.ts.map +1 -1
- package/dist/components/inputs/switch/switch.js +3 -0
- package/dist/components/inputs/switch/switch.js.map +1 -1
- package/dist/components/inputs/switch-field/switch-field.d.ts +3 -0
- package/dist/components/inputs/switch-field/switch-field.d.ts.map +1 -1
- package/dist/components/inputs/switch-field/switch-field.js +3 -0
- package/dist/components/inputs/switch-field/switch-field.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.caret.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.caret.js +7 -1
- package/dist/components/inputs/text-editor/text-editor.caret.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.d.ts +3 -4
- package/dist/components/inputs/text-editor/text-editor.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.js +4 -7
- package/dist/components/inputs/text-editor/text-editor.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.styles.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.styles.js +1 -9
- package/dist/components/inputs/text-editor/text-editor.styles.js.map +1 -1
- package/dist/components/inputs/text-field/text-field.d.ts +9 -0
- package/dist/components/inputs/text-field/text-field.d.ts.map +1 -1
- package/dist/components/inputs/text-field/text-field.js +12 -0
- package/dist/components/inputs/text-field/text-field.js.map +1 -1
- package/dist/components/inputs/text-field/text-field.template.d.ts.map +1 -1
- package/dist/components/inputs/text-field/text-field.template.js +1 -0
- package/dist/components/inputs/text-field/text-field.template.js.map +1 -1
- package/dist/components/inputs/time-field/time-field.d.ts +6 -0
- package/dist/components/inputs/time-field/time-field.d.ts.map +1 -1
- package/dist/components/inputs/time-field/time-field.js +11 -0
- package/dist/components/inputs/time-field/time-field.js.map +1 -1
- package/dist/components/inputs/time-field/time-field.template.js +1 -1
- package/dist/components/inputs/time-picker/time-picker.d.ts +3 -0
- package/dist/components/inputs/time-picker/time-picker.d.ts.map +1 -1
- package/dist/components/inputs/time-picker/time-picker.js +4 -1
- package/dist/components/inputs/time-picker/time-picker.js.map +1 -1
- package/dist/components/inputs/time-picker/time-picker.styles.d.ts.map +1 -1
- package/dist/components/inputs/time-picker/time-picker.styles.js +7 -2
- package/dist/components/inputs/time-picker/time-picker.styles.js.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.d.ts +10 -0
- package/dist/components/inputs/toggle-button/toggle-button.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.js +14 -0
- package/dist/components/inputs/toggle-button/toggle-button.js.map +1 -1
- package/dist/components/inputs/toggle-button-group/toggle-button-group.d.ts +11 -0
- 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 +16 -6
- package/dist/components/inputs/toggle-button-group/toggle-button-group.js.map +1 -1
- package/dist/components/inputs/token-field/token-field.d.ts +6 -0
- package/dist/components/inputs/token-field/token-field.d.ts.map +1 -1
- package/dist/components/inputs/token-field/token-field.js +13 -0
- package/dist/components/inputs/token-field/token-field.js.map +1 -1
- package/dist/components/layout/box/box.d.ts +17 -7
- package/dist/components/layout/box/box.d.ts.map +1 -1
- package/dist/components/layout/box/box.js +17 -7
- 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 +9 -2
- package/dist/components/layout/box/box.styles.js.map +1 -1
- package/dist/components/layout/container/container.d.ts +10 -0
- package/dist/components/layout/container/container.d.ts.map +1 -1
- package/dist/components/layout/container/container.js +38 -0
- package/dist/components/layout/container/container.js.map +1 -1
- package/dist/components/layout/container/container.styles.d.ts.map +1 -1
- package/dist/components/layout/container/container.styles.js +10 -1
- package/dist/components/layout/container/container.styles.js.map +1 -1
- package/dist/components/layout/page/page.styles.d.ts.map +1 -1
- package/dist/components/layout/page/page.styles.js +8 -1
- package/dist/components/layout/page/page.styles.js.map +1 -1
- package/dist/components/layout/page-sections/hero/hero.d.ts +32 -33
- package/dist/components/layout/page-sections/hero/hero.d.ts.map +1 -1
- package/dist/components/layout/page-sections/hero/hero.js +32 -33
- package/dist/components/layout/page-sections/hero/hero.js.map +1 -1
- package/dist/components/layout/page-sections/hero/hero.template.js +1 -1
- package/dist/components/layout/page-sections/hero/hero.template.js.map +1 -1
- package/dist/components/layout/page-sections/simple-section/simple-section.d.ts +7 -0
- package/dist/components/layout/page-sections/simple-section/simple-section.d.ts.map +1 -1
- package/dist/components/layout/page-sections/simple-section/simple-section.js +12 -0
- package/dist/components/layout/page-sections/simple-section/simple-section.js.map +1 -1
- package/dist/components/layout/page-sections/simple-section/simple-section.styles.d.ts.map +1 -1
- package/dist/components/layout/page-sections/simple-section/simple-section.styles.js +19 -0
- package/dist/components/layout/page-sections/simple-section/simple-section.styles.js.map +1 -1
- package/dist/components/layout/popover/popover.d.ts +34 -28
- package/dist/components/layout/popover/popover.d.ts.map +1 -1
- package/dist/components/layout/popover/popover.js +44 -31
- package/dist/components/layout/popover/popover.js.map +1 -1
- package/dist/components/layout/sheet/sheet.d.ts +2 -0
- package/dist/components/layout/sheet/sheet.d.ts.map +1 -1
- package/dist/components/layout/sheet/sheet.js +12 -1
- package/dist/components/layout/sheet/sheet.js.map +1 -1
- package/dist/components/lists-and-tables/cells/description-cell/description-cell.styles.d.ts.map +1 -1
- package/dist/components/lists-and-tables/cells/description-cell/description-cell.styles.js +9 -1
- package/dist/components/lists-and-tables/cells/description-cell/description-cell.styles.js.map +1 -1
- package/dist/components/lists-and-tables/cells/text-cell/text-cell.styles.d.ts.map +1 -1
- package/dist/components/lists-and-tables/cells/text-cell/text-cell.styles.js +9 -1
- package/dist/components/lists-and-tables/cells/text-cell/text-cell.styles.js.map +1 -1
- package/dist/components/lists-and-tables/cells/timeline-track-cell/timeline-track-cell.d.ts +14 -14
- 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 +13 -13
- package/dist/components/lists-and-tables/cells/title-cell/title-cell.styles.d.ts.map +1 -1
- package/dist/components/lists-and-tables/cells/title-cell/title-cell.styles.js +13 -2
- package/dist/components/lists-and-tables/cells/title-cell/title-cell.styles.js.map +1 -1
- package/dist/components/lists-and-tables/list/list.d.ts +8 -11
- package/dist/components/lists-and-tables/list/list.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list/list.js +8 -10
- 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 +13 -6
- 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 +20 -16
- 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 +44 -30
- package/dist/components/lists-and-tables/list-item/list-item.js.map +1 -1
- package/dist/components/navigation/top-navigation-bar/top-navigation-bar.js +1 -1
- 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 +15 -0
- 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 +44 -1
- package/dist/components/navigation/top-title-bar/top-title-bar.js.map +1 -1
- package/dist/components/navigation/top-title-bar/top-title-bar.template.d.ts.map +1 -1
- package/dist/components/navigation/top-title-bar/top-title-bar.template.js +3 -1
- package/dist/components/navigation/top-title-bar/top-title-bar.template.js.map +1 -1
- package/dist/components/reflect-non-default-OLaK60rT.js +37 -0
- package/dist/components/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/components/shadow-resets-aG-rgyNQ.js +61 -0
- package/dist/components/shell-C61GCsJA.js +223 -0
- package/dist/components/status-and-feedback/badge/badge.d.ts +23 -11
- package/dist/components/status-and-feedback/badge/badge.d.ts.map +1 -1
- package/dist/components/status-and-feedback/badge/badge.js +32 -14
- package/dist/components/status-and-feedback/badge/badge.js.map +1 -1
- package/dist/components/status-and-feedback/badge/badge.styles.d.ts.map +1 -1
- package/dist/components/status-and-feedback/badge/badge.styles.js +59 -2
- package/dist/components/status-and-feedback/badge/badge.styles.js.map +1 -1
- package/dist/components/status-and-feedback/badge/badge.template.d.ts.map +1 -1
- package/dist/components/status-and-feedback/badge/badge.template.js +6 -1
- package/dist/components/status-and-feedback/badge/badge.template.js.map +1 -1
- package/dist/components/status-and-feedback/banner/banner.styles.d.ts.map +1 -1
- package/dist/components/status-and-feedback/banner/banner.styles.js +6 -0
- package/dist/components/status-and-feedback/banner/banner.styles.js.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.d.ts +2 -0
- 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 +14 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/status-and-feedback/notification/notification-region.d.ts +6 -0
- package/dist/components/status-and-feedback/notification/notification-region.d.ts.map +1 -0
- package/dist/components/status-and-feedback/notification/notification-region.js +245 -0
- package/dist/components/status-and-feedback/notification/notification-region.js.map +1 -0
- package/dist/components/status-and-feedback/notification/notification.d.ts +129 -0
- package/dist/components/status-and-feedback/notification/notification.d.ts.map +1 -0
- package/dist/components/status-and-feedback/notification/notification.i18n.d.ts +6 -0
- package/dist/components/status-and-feedback/notification/notification.i18n.d.ts.map +1 -0
- package/dist/components/status-and-feedback/notification/notification.i18n.js +5 -0
- package/dist/components/status-and-feedback/notification/notification.i18n.js.map +1 -0
- package/dist/components/status-and-feedback/notification/notification.js +269 -0
- package/dist/components/status-and-feedback/notification/notification.js.map +1 -0
- package/dist/components/status-and-feedback/notification/notification.styles.d.ts +2 -0
- package/dist/components/status-and-feedback/notification/notification.styles.d.ts.map +1 -0
- package/dist/components/status-and-feedback/notification/notification.styles.js +177 -0
- package/dist/components/status-and-feedback/notification/notification.styles.js.map +1 -0
- package/dist/components/status-and-feedback/notification/notification.template.d.ts +4 -0
- package/dist/components/status-and-feedback/notification/notification.template.d.ts.map +1 -0
- package/dist/components/status-and-feedback/notification/notification.template.js +40 -0
- package/dist/components/status-and-feedback/notification/notification.template.js.map +1 -0
- 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 +1 -0
- package/dist/components/status-and-feedback/progress-bar/progress-bar.styles.js.map +1 -1
- package/dist/components/status-and-feedback/step-indicator/step-indicator.d.ts +30 -30
- package/dist/components/status-and-feedback/step-indicator/step-indicator.d.ts.map +1 -1
- package/dist/components/status-and-feedback/step-indicator/step-indicator.js +33 -30
- package/dist/components/status-and-feedback/step-indicator/step-indicator.js.map +1 -1
- package/dist/components/toml-C2HBbPgG.js +59 -0
- package/dist/components/visibility-mixin-GxbwkBb1.js +104 -0
- package/dist/components/with-translations-DzAdFTK8.js +48 -0
- package/dist/css/variables.css +24 -0
- package/dist/nldd.min.js +10763 -9942
- package/dist/types/vue.d.ts +270 -153
- package/dist/utilities/implicit-submission.d.ts +31 -0
- package/dist/utilities/implicit-submission.d.ts.map +1 -0
- package/dist/utilities/implicit-submission.js +65 -0
- package/dist/utilities/implicit-submission.js.map +1 -0
- package/dist/utilities/open-when-rendered.d.ts +21 -0
- package/dist/utilities/open-when-rendered.d.ts.map +1 -0
- package/dist/utilities/open-when-rendered.js +30 -0
- package/dist/utilities/open-when-rendered.js.map +1 -0
- package/dist/utilities/owned-attribute.d.ts +19 -0
- package/dist/utilities/owned-attribute.d.ts.map +1 -0
- package/dist/utilities/owned-attribute.js +32 -0
- package/dist/utilities/owned-attribute.js.map +1 -0
- package/dist/utilities/reflect-non-default.d.ts +3 -3
- package/dist/utilities/reflect-non-default.d.ts.map +1 -1
- package/dist/utilities/reflect-non-default.js +7 -4
- package/dist/utilities/reflect-non-default.js.map +1 -1
- package/dist/utilities/visibility-mixin.d.ts +5 -0
- package/dist/utilities/visibility-mixin.d.ts.map +1 -1
- package/dist/utilities/visibility-mixin.js +22 -0
- package/dist/utilities/visibility-mixin.js.map +1 -1
- package/package.json +34 -23
- package/dist/components/content/byline/byline.d.ts +0 -73
- package/dist/components/content/byline/byline.d.ts.map +0 -1
- package/dist/components/content/byline/byline.js +0 -125
- package/dist/components/content/byline/byline.js.map +0 -1
- package/dist/components/content/byline/byline.styles.d.ts +0 -2
- package/dist/components/content/byline/byline.styles.d.ts.map +0 -1
- package/dist/components/content/byline/byline.styles.js.map +0 -1
- package/dist/components/content/byline/byline.template.d.ts +0 -3
- package/dist/components/content/byline/byline.template.d.ts.map +0 -1
- package/dist/components/content/byline/byline.template.js.map +0 -1
- package/dist/components/gherkin-DhZlEZiy.js +0 -115
- package/dist/components/index--8_4HvE9.js +0 -688
- package/dist/components/index-BMeSmtdw.js +0 -384
- package/dist/components/index-Bonuul3m.js +0 -73466
- package/dist/components/index-CdOU-HVN.js +0 -81
- package/dist/components/index-CqhFJR7l.js +0 -703
- package/dist/components/index-CwmDMN6X.js +0 -177
- package/dist/components/index-yX0V7C44.js +0 -405
- package/dist/components/shell-BlsXDxCn.js +0 -222
- package/dist/components/toml-BOuWGMcf.js +0 -76
|
@@ -0,0 +1,1498 @@
|
|
|
1
|
+
import { A as syntaxTree, G as ViewPlugin, H as Decoration, K as WidgetType, Q as logException, T as indentUnit, U as Direction, W as EditorView, X as keymap, Y as getTooltip, _t as codePointSize, at as EditorSelection, ct as MapMode, dt as RangeValue, et as showTooltip, ft as StateEffect, gt as codePointAt, ht as Transaction, lt as Prec, mt as Text, pt as StateField, st as Facet, tt as Annotation, vt as combineConfig, xt as fromCodePoint } from "./dist-Ccw7ZfsU.js";
|
|
2
|
+
//#region node_modules/@codemirror/autocomplete/dist/index.js
|
|
3
|
+
/**
|
|
4
|
+
An instance of this is passed to completion source functions.
|
|
5
|
+
*/
|
|
6
|
+
var CompletionContext = class {
|
|
7
|
+
/**
|
|
8
|
+
Create a new completion context. (Mostly useful for testing
|
|
9
|
+
completion sources—in the editor, the extension will create
|
|
10
|
+
these for you.)
|
|
11
|
+
*/
|
|
12
|
+
constructor(state, pos, explicit, view) {
|
|
13
|
+
this.state = state;
|
|
14
|
+
this.pos = pos;
|
|
15
|
+
this.explicit = explicit;
|
|
16
|
+
this.view = view;
|
|
17
|
+
/**
|
|
18
|
+
@internal
|
|
19
|
+
*/
|
|
20
|
+
this.abortListeners = [];
|
|
21
|
+
/**
|
|
22
|
+
@internal
|
|
23
|
+
*/
|
|
24
|
+
this.abortOnDocChange = false;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
Get the extent, content, and (if there is a token) type of the
|
|
28
|
+
token before `this.pos`.
|
|
29
|
+
*/
|
|
30
|
+
tokenBefore(types) {
|
|
31
|
+
let token = syntaxTree(this.state).resolveInner(this.pos, -1);
|
|
32
|
+
while (token && types.indexOf(token.name) < 0) token = token.parent;
|
|
33
|
+
return token ? {
|
|
34
|
+
from: token.from,
|
|
35
|
+
to: this.pos,
|
|
36
|
+
text: this.state.sliceDoc(token.from, this.pos),
|
|
37
|
+
type: token.type
|
|
38
|
+
} : null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
Get the match of the given expression directly before the
|
|
42
|
+
cursor.
|
|
43
|
+
*/
|
|
44
|
+
matchBefore(expr) {
|
|
45
|
+
let line = this.state.doc.lineAt(this.pos);
|
|
46
|
+
let start = Math.max(line.from, this.pos - 250);
|
|
47
|
+
let str = line.text.slice(start - line.from, this.pos - line.from);
|
|
48
|
+
let found = str.search(ensureAnchor(expr, false));
|
|
49
|
+
return found < 0 ? null : {
|
|
50
|
+
from: start + found,
|
|
51
|
+
to: this.pos,
|
|
52
|
+
text: str.slice(found)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
Yields true when the query has been aborted. Can be useful in
|
|
57
|
+
asynchronous queries to avoid doing work that will be ignored.
|
|
58
|
+
*/
|
|
59
|
+
get aborted() {
|
|
60
|
+
return this.abortListeners == null;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
Allows you to register abort handlers, which will be called when
|
|
64
|
+
the query is
|
|
65
|
+
[aborted](https://codemirror.net/6/docs/ref/#autocomplete.CompletionContext.aborted).
|
|
66
|
+
|
|
67
|
+
By default, running queries will not be aborted for regular
|
|
68
|
+
typing or backspacing, on the assumption that they are likely to
|
|
69
|
+
return a result with a
|
|
70
|
+
[`validFor`](https://codemirror.net/6/docs/ref/#autocomplete.CompletionResult.validFor) field that
|
|
71
|
+
allows the result to be used after all. Passing `onDocChange:
|
|
72
|
+
true` will cause this query to be aborted for any document
|
|
73
|
+
change.
|
|
74
|
+
*/
|
|
75
|
+
addEventListener(type, listener, options) {
|
|
76
|
+
if (type == "abort" && this.abortListeners) {
|
|
77
|
+
this.abortListeners.push(listener);
|
|
78
|
+
if (options && options.onDocChange) this.abortOnDocChange = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
function toSet(chars) {
|
|
83
|
+
let flat = Object.keys(chars).join("");
|
|
84
|
+
let words = /\w/.test(flat);
|
|
85
|
+
if (words) flat = flat.replace(/\w/g, "");
|
|
86
|
+
return `[${words ? "\\w" : ""}${flat.replace(/[^\w\s]/g, "\\$&")}]`;
|
|
87
|
+
}
|
|
88
|
+
function prefixMatch(options) {
|
|
89
|
+
let first = Object.create(null), rest = Object.create(null);
|
|
90
|
+
for (let { label } of options) {
|
|
91
|
+
first[label[0]] = true;
|
|
92
|
+
for (let i = 1; i < label.length; i++) rest[label[i]] = true;
|
|
93
|
+
}
|
|
94
|
+
let source = toSet(first) + toSet(rest) + "*$";
|
|
95
|
+
return [new RegExp("^" + source), new RegExp(source)];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
Given a a fixed array of options, return an autocompleter that
|
|
99
|
+
completes them.
|
|
100
|
+
*/
|
|
101
|
+
function completeFromList(list) {
|
|
102
|
+
let options = list.map((o) => typeof o == "string" ? { label: o } : o);
|
|
103
|
+
let [validFor, match] = options.every((o) => /^\w+$/.test(o.label)) ? [/\w*$/, /\w+$/] : prefixMatch(options);
|
|
104
|
+
return (context) => {
|
|
105
|
+
let token = context.matchBefore(match);
|
|
106
|
+
return token || context.explicit ? {
|
|
107
|
+
from: token ? token.from : context.pos,
|
|
108
|
+
options,
|
|
109
|
+
validFor
|
|
110
|
+
} : null;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
Wrap the given completion source so that it will not fire when the
|
|
115
|
+
cursor is in a syntax node with one of the given names.
|
|
116
|
+
*/
|
|
117
|
+
function ifNotIn(nodes, source) {
|
|
118
|
+
return (context) => {
|
|
119
|
+
for (let pos = syntaxTree(context.state).resolveInner(context.pos, -1); pos; pos = pos.parent) {
|
|
120
|
+
if (nodes.indexOf(pos.name) > -1) return null;
|
|
121
|
+
if (pos.type.isTop) break;
|
|
122
|
+
}
|
|
123
|
+
return source(context);
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
var Option = class {
|
|
127
|
+
constructor(completion, source, match, score) {
|
|
128
|
+
this.completion = completion;
|
|
129
|
+
this.source = source;
|
|
130
|
+
this.match = match;
|
|
131
|
+
this.score = score;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
function cur(state) {
|
|
135
|
+
return state.selection.main.from;
|
|
136
|
+
}
|
|
137
|
+
function ensureAnchor(expr, start) {
|
|
138
|
+
var _a;
|
|
139
|
+
let { source } = expr;
|
|
140
|
+
let addStart = start && source[0] != "^", addEnd = source[source.length - 1] != "$";
|
|
141
|
+
if (!addStart && !addEnd) return expr;
|
|
142
|
+
return new RegExp(`${addStart ? "^" : ""}(?:${source})${addEnd ? "$" : ""}`, (_a = expr.flags) !== null && _a !== void 0 ? _a : expr.ignoreCase ? "i" : "");
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
This annotation is added to transactions that are produced by
|
|
146
|
+
picking a completion.
|
|
147
|
+
*/
|
|
148
|
+
var pickedCompletion = /*@__PURE__*/ Annotation.define();
|
|
149
|
+
/**
|
|
150
|
+
Helper function that returns a transaction spec which inserts a
|
|
151
|
+
completion's text in the main selection range, and any other
|
|
152
|
+
selection range that has the same text in front of it.
|
|
153
|
+
*/
|
|
154
|
+
function insertCompletionText(state, text, from, to) {
|
|
155
|
+
let { main } = state.selection, fromOff = from - main.from, toOff = to - main.from;
|
|
156
|
+
return {
|
|
157
|
+
...state.changeByRange((range) => {
|
|
158
|
+
if (range != main && from != to && state.sliceDoc(range.from + fromOff, range.from + toOff) != state.sliceDoc(from, to)) return { range };
|
|
159
|
+
let lines = state.toText(text);
|
|
160
|
+
return {
|
|
161
|
+
changes: {
|
|
162
|
+
from: range.from + fromOff,
|
|
163
|
+
to: to == main.from ? range.to : range.from + toOff,
|
|
164
|
+
insert: lines
|
|
165
|
+
},
|
|
166
|
+
range: EditorSelection.cursor(range.from + fromOff + lines.length)
|
|
167
|
+
};
|
|
168
|
+
}),
|
|
169
|
+
scrollIntoView: true,
|
|
170
|
+
userEvent: "input.complete"
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
var SourceCache = /*@__PURE__*/ new WeakMap();
|
|
174
|
+
function asSource(source) {
|
|
175
|
+
if (!Array.isArray(source)) return source;
|
|
176
|
+
let known = SourceCache.get(source);
|
|
177
|
+
if (!known) SourceCache.set(source, known = completeFromList(source));
|
|
178
|
+
return known;
|
|
179
|
+
}
|
|
180
|
+
var startCompletionEffect = /*@__PURE__*/ StateEffect.define();
|
|
181
|
+
var closeCompletionEffect = /*@__PURE__*/ StateEffect.define();
|
|
182
|
+
var FuzzyMatcher = class {
|
|
183
|
+
constructor(pattern) {
|
|
184
|
+
this.pattern = pattern;
|
|
185
|
+
this.chars = [];
|
|
186
|
+
this.folded = [];
|
|
187
|
+
this.any = [];
|
|
188
|
+
this.precise = [];
|
|
189
|
+
this.byWord = [];
|
|
190
|
+
this.score = 0;
|
|
191
|
+
this.matched = [];
|
|
192
|
+
for (let p = 0; p < pattern.length;) {
|
|
193
|
+
let char = codePointAt(pattern, p), size = codePointSize(char);
|
|
194
|
+
this.chars.push(char);
|
|
195
|
+
let part = pattern.slice(p, p + size), upper = part.toUpperCase();
|
|
196
|
+
this.folded.push(codePointAt(upper == part ? part.toLowerCase() : upper, 0));
|
|
197
|
+
p += size;
|
|
198
|
+
}
|
|
199
|
+
this.astral = pattern.length != this.chars.length;
|
|
200
|
+
}
|
|
201
|
+
ret(score, matched) {
|
|
202
|
+
this.score = score;
|
|
203
|
+
this.matched = matched;
|
|
204
|
+
return this;
|
|
205
|
+
}
|
|
206
|
+
match(word) {
|
|
207
|
+
if (this.pattern.length == 0) return this.ret(-100, []);
|
|
208
|
+
if (word.length < this.pattern.length) return null;
|
|
209
|
+
let { chars, folded, any, precise, byWord } = this;
|
|
210
|
+
if (chars.length == 1) {
|
|
211
|
+
let first = codePointAt(word, 0), firstSize = codePointSize(first);
|
|
212
|
+
let score = firstSize == word.length ? 0 : -100;
|
|
213
|
+
if (first == chars[0]);
|
|
214
|
+
else if (first == folded[0]) score += -200;
|
|
215
|
+
else return null;
|
|
216
|
+
return this.ret(score, [0, firstSize]);
|
|
217
|
+
}
|
|
218
|
+
let direct = word.indexOf(this.pattern);
|
|
219
|
+
if (direct == 0) return this.ret(word.length == this.pattern.length ? 0 : -100, [0, this.pattern.length]);
|
|
220
|
+
let len = chars.length, anyTo = 0;
|
|
221
|
+
if (direct < 0) {
|
|
222
|
+
for (let i = 0, e = Math.min(word.length, 200); i < e && anyTo < len;) {
|
|
223
|
+
let next = codePointAt(word, i);
|
|
224
|
+
if (next == chars[anyTo] || next == folded[anyTo]) any[anyTo++] = i;
|
|
225
|
+
i += codePointSize(next);
|
|
226
|
+
}
|
|
227
|
+
if (anyTo < len) return null;
|
|
228
|
+
}
|
|
229
|
+
let preciseTo = 0;
|
|
230
|
+
let byWordTo = 0, byWordFolded = false;
|
|
231
|
+
let adjacentTo = 0, adjacentStart = -1, adjacentEnd = -1;
|
|
232
|
+
let hasLower = /[a-z]/.test(word), wordAdjacent = true;
|
|
233
|
+
for (let i = 0, e = Math.min(word.length, 200), prevType = 0; i < e && byWordTo < len;) {
|
|
234
|
+
let next = codePointAt(word, i);
|
|
235
|
+
if (direct < 0) {
|
|
236
|
+
if (preciseTo < len && next == chars[preciseTo]) precise[preciseTo++] = i;
|
|
237
|
+
if (adjacentTo < len) {
|
|
238
|
+
if (next == chars[adjacentTo] || next == folded[adjacentTo]) {
|
|
239
|
+
if (adjacentTo == 0) adjacentStart = i;
|
|
240
|
+
adjacentEnd = i + 1;
|
|
241
|
+
adjacentTo++;
|
|
242
|
+
} else adjacentTo = 0;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
let ch, type = next < 255 ? next >= 48 && next <= 57 || next >= 97 && next <= 122 ? 2 : next >= 65 && next <= 90 ? 1 : 0 : (ch = fromCodePoint(next)) != ch.toLowerCase() ? 1 : ch != ch.toUpperCase() ? 2 : 0;
|
|
246
|
+
if (!i || type == 1 && hasLower || prevType == 0 && type != 0) {
|
|
247
|
+
if (chars[byWordTo] == next || folded[byWordTo] == next && (byWordFolded = true)) byWord[byWordTo++] = i;
|
|
248
|
+
else if (byWord.length) wordAdjacent = false;
|
|
249
|
+
}
|
|
250
|
+
prevType = type;
|
|
251
|
+
i += codePointSize(next);
|
|
252
|
+
}
|
|
253
|
+
if (byWordTo == len && byWord[0] == 0 && wordAdjacent) return this.result(-100 + (byWordFolded ? -200 : 0), byWord, word);
|
|
254
|
+
if (adjacentTo == len && adjacentStart == 0) return this.ret(-200 - word.length + (adjacentEnd == word.length ? 0 : -100), [0, adjacentEnd]);
|
|
255
|
+
if (direct > -1) return this.ret(-700 - word.length, [direct, direct + this.pattern.length]);
|
|
256
|
+
if (adjacentTo == len) return this.ret(-900 - word.length, [adjacentStart, adjacentEnd]);
|
|
257
|
+
if (byWordTo == len) return this.result(-100 + (byWordFolded ? -200 : 0) + -700 + (wordAdjacent ? 0 : -1100), byWord, word);
|
|
258
|
+
return chars.length == 2 ? null : this.result((any[0] ? -700 : 0) + -200 + -1100, any, word);
|
|
259
|
+
}
|
|
260
|
+
result(score, positions, word) {
|
|
261
|
+
let result = [], i = 0;
|
|
262
|
+
for (let pos of positions) {
|
|
263
|
+
let to = pos + (this.astral ? codePointSize(codePointAt(word, pos)) : 1);
|
|
264
|
+
if (i && result[i - 1] == pos) result[i - 1] = to;
|
|
265
|
+
else {
|
|
266
|
+
result[i++] = pos;
|
|
267
|
+
result[i++] = to;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return this.ret(score - word.length, result);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
var StrictMatcher = class {
|
|
274
|
+
constructor(pattern) {
|
|
275
|
+
this.pattern = pattern;
|
|
276
|
+
this.matched = [];
|
|
277
|
+
this.score = 0;
|
|
278
|
+
this.folded = pattern.toLowerCase();
|
|
279
|
+
}
|
|
280
|
+
match(word) {
|
|
281
|
+
if (word.length < this.pattern.length) return null;
|
|
282
|
+
let start = word.slice(0, this.pattern.length);
|
|
283
|
+
let match = start == this.pattern ? 0 : start.toLowerCase() == this.folded ? -200 : null;
|
|
284
|
+
if (match == null) return null;
|
|
285
|
+
this.matched = [0, start.length];
|
|
286
|
+
this.score = match + (word.length == this.pattern.length ? 0 : -100);
|
|
287
|
+
return this;
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
var completionConfig = /*@__PURE__*/ Facet.define({ combine(configs) {
|
|
291
|
+
return combineConfig(configs, {
|
|
292
|
+
activateOnTyping: true,
|
|
293
|
+
activateOnCompletion: () => false,
|
|
294
|
+
activateOnTypingDelay: 100,
|
|
295
|
+
selectOnOpen: true,
|
|
296
|
+
override: null,
|
|
297
|
+
closeOnBlur: true,
|
|
298
|
+
maxRenderedOptions: 100,
|
|
299
|
+
defaultKeymap: true,
|
|
300
|
+
tooltipClass: () => "",
|
|
301
|
+
optionClass: () => "",
|
|
302
|
+
aboveCursor: false,
|
|
303
|
+
icons: true,
|
|
304
|
+
addToOptions: [],
|
|
305
|
+
positionInfo: defaultPositionInfo,
|
|
306
|
+
filterStrict: false,
|
|
307
|
+
compareCompletions: (a, b) => (a.sortText || a.label).localeCompare(b.sortText || b.label),
|
|
308
|
+
interactionDelay: 75,
|
|
309
|
+
updateSyncTime: 100
|
|
310
|
+
}, {
|
|
311
|
+
defaultKeymap: (a, b) => a && b,
|
|
312
|
+
closeOnBlur: (a, b) => a && b,
|
|
313
|
+
icons: (a, b) => a && b,
|
|
314
|
+
tooltipClass: (a, b) => (c) => joinClass(a(c), b(c)),
|
|
315
|
+
optionClass: (a, b) => (c) => joinClass(a(c), b(c)),
|
|
316
|
+
addToOptions: (a, b) => a.concat(b),
|
|
317
|
+
filterStrict: (a, b) => a || b
|
|
318
|
+
});
|
|
319
|
+
} });
|
|
320
|
+
function joinClass(a, b) {
|
|
321
|
+
return a ? b ? a + " " + b : a : b;
|
|
322
|
+
}
|
|
323
|
+
function defaultPositionInfo(view, list, option, info, space, tooltip) {
|
|
324
|
+
let rtl = view.textDirection == Direction.RTL, left = rtl, narrow = false;
|
|
325
|
+
let side = "top", offset, maxWidth;
|
|
326
|
+
let spaceLeft = list.left - space.left, spaceRight = space.right - list.right;
|
|
327
|
+
let infoWidth = info.right - info.left, infoHeight = info.bottom - info.top;
|
|
328
|
+
if (left && spaceLeft < Math.min(infoWidth, spaceRight)) left = false;
|
|
329
|
+
else if (!left && spaceRight < Math.min(infoWidth, spaceLeft)) left = true;
|
|
330
|
+
if (infoWidth <= (left ? spaceLeft : spaceRight)) {
|
|
331
|
+
offset = Math.max(space.top, Math.min(option.top, space.bottom - infoHeight)) - list.top;
|
|
332
|
+
maxWidth = Math.min(400, left ? spaceLeft : spaceRight);
|
|
333
|
+
} else {
|
|
334
|
+
narrow = true;
|
|
335
|
+
maxWidth = Math.min(400, (rtl ? list.right : space.right - list.left) - 30);
|
|
336
|
+
let spaceBelow = space.bottom - list.bottom;
|
|
337
|
+
if (spaceBelow >= infoHeight || spaceBelow > list.top) offset = option.bottom - list.top;
|
|
338
|
+
else {
|
|
339
|
+
side = "bottom";
|
|
340
|
+
offset = list.bottom - option.top;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
let scaleY = (list.bottom - list.top) / tooltip.offsetHeight;
|
|
344
|
+
let scaleX = (list.right - list.left) / tooltip.offsetWidth;
|
|
345
|
+
return {
|
|
346
|
+
style: `${side}: ${offset / scaleY}px; max-width: ${maxWidth / scaleX}px`,
|
|
347
|
+
class: "cm-completionInfo-" + (narrow ? rtl ? "left-narrow" : "right-narrow" : left ? "left" : "right")
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
var setSelectedEffect = /*@__PURE__*/ StateEffect.define();
|
|
351
|
+
function optionContent(config) {
|
|
352
|
+
let content = config.addToOptions.slice();
|
|
353
|
+
if (config.icons) content.push({
|
|
354
|
+
render(completion) {
|
|
355
|
+
let icon = document.createElement("div");
|
|
356
|
+
icon.classList.add("cm-completionIcon");
|
|
357
|
+
if (completion.type) icon.classList.add(...completion.type.split(/\s+/g).map((cls) => "cm-completionIcon-" + cls));
|
|
358
|
+
icon.setAttribute("aria-hidden", "true");
|
|
359
|
+
return icon;
|
|
360
|
+
},
|
|
361
|
+
position: 20
|
|
362
|
+
});
|
|
363
|
+
content.push({
|
|
364
|
+
render(completion, _s, _v, match) {
|
|
365
|
+
let labelElt = document.createElement("span");
|
|
366
|
+
labelElt.className = "cm-completionLabel";
|
|
367
|
+
let label = completion.displayLabel || completion.label, off = 0;
|
|
368
|
+
for (let j = 0; j < match.length;) {
|
|
369
|
+
let from = match[j++], to = match[j++];
|
|
370
|
+
if (from > off) labelElt.appendChild(document.createTextNode(label.slice(off, from)));
|
|
371
|
+
let span = labelElt.appendChild(document.createElement("span"));
|
|
372
|
+
span.appendChild(document.createTextNode(label.slice(from, to)));
|
|
373
|
+
span.className = "cm-completionMatchedText";
|
|
374
|
+
off = to;
|
|
375
|
+
}
|
|
376
|
+
if (off < label.length) labelElt.appendChild(document.createTextNode(label.slice(off)));
|
|
377
|
+
return labelElt;
|
|
378
|
+
},
|
|
379
|
+
position: 50
|
|
380
|
+
}, {
|
|
381
|
+
render(completion) {
|
|
382
|
+
if (!completion.detail) return null;
|
|
383
|
+
let detailElt = document.createElement("span");
|
|
384
|
+
detailElt.className = "cm-completionDetail";
|
|
385
|
+
detailElt.textContent = completion.detail;
|
|
386
|
+
return detailElt;
|
|
387
|
+
},
|
|
388
|
+
position: 80
|
|
389
|
+
});
|
|
390
|
+
return content.sort((a, b) => a.position - b.position).map((a) => a.render);
|
|
391
|
+
}
|
|
392
|
+
function rangeAroundSelected(total, selected, max) {
|
|
393
|
+
if (total <= max) return {
|
|
394
|
+
from: 0,
|
|
395
|
+
to: total
|
|
396
|
+
};
|
|
397
|
+
if (selected < 0) selected = 0;
|
|
398
|
+
if (selected <= total >> 1) {
|
|
399
|
+
let off = Math.floor(selected / max);
|
|
400
|
+
return {
|
|
401
|
+
from: off * max,
|
|
402
|
+
to: (off + 1) * max
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
let off = Math.ceil((total - selected) / max);
|
|
406
|
+
return {
|
|
407
|
+
from: total - off * max,
|
|
408
|
+
to: total - (off - 1) * max
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
var CompletionTooltip = class {
|
|
412
|
+
constructor(view, stateField, applyCompletion) {
|
|
413
|
+
this.view = view;
|
|
414
|
+
this.stateField = stateField;
|
|
415
|
+
this.applyCompletion = applyCompletion;
|
|
416
|
+
this.info = null;
|
|
417
|
+
this.infoDestroy = null;
|
|
418
|
+
this.placeInfoReq = {
|
|
419
|
+
read: () => this.measureInfo(),
|
|
420
|
+
write: (pos) => this.placeInfo(pos),
|
|
421
|
+
key: this
|
|
422
|
+
};
|
|
423
|
+
this.space = null;
|
|
424
|
+
this.currentClass = "";
|
|
425
|
+
let cState = view.state.field(stateField);
|
|
426
|
+
let { options, selected } = cState.open;
|
|
427
|
+
let config = view.state.facet(completionConfig);
|
|
428
|
+
this.optionContent = optionContent(config);
|
|
429
|
+
this.optionClass = config.optionClass;
|
|
430
|
+
this.tooltipClass = config.tooltipClass;
|
|
431
|
+
this.range = rangeAroundSelected(options.length, selected, config.maxRenderedOptions);
|
|
432
|
+
this.dom = document.createElement("div");
|
|
433
|
+
this.dom.className = "cm-tooltip-autocomplete";
|
|
434
|
+
this.updateTooltipClass(view.state);
|
|
435
|
+
this.dom.addEventListener("mousedown", (e) => {
|
|
436
|
+
let { options } = view.state.field(stateField).open;
|
|
437
|
+
for (let dom = e.target, match; dom && dom != this.dom; dom = dom.parentNode) if (dom.nodeName == "LI" && (match = /-(\d+)$/.exec(dom.id)) && +match[1] < options.length) {
|
|
438
|
+
this.applyCompletion(view, options[+match[1]]);
|
|
439
|
+
e.preventDefault();
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
if (e.target == this.list) {
|
|
443
|
+
let move = this.list.classList.contains("cm-completionListIncompleteTop") && e.clientY < this.list.firstChild.getBoundingClientRect().top ? this.range.from - 1 : this.list.classList.contains("cm-completionListIncompleteBottom") && e.clientY > this.list.lastChild.getBoundingClientRect().bottom ? this.range.to : null;
|
|
444
|
+
if (move != null) {
|
|
445
|
+
view.dispatch({ effects: setSelectedEffect.of(move) });
|
|
446
|
+
e.preventDefault();
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
this.dom.addEventListener("focusout", (e) => {
|
|
451
|
+
let state = view.state.field(this.stateField, false);
|
|
452
|
+
if (state && state.tooltip && view.state.facet(completionConfig).closeOnBlur && e.relatedTarget != view.contentDOM) view.dispatch({ effects: closeCompletionEffect.of(null) });
|
|
453
|
+
});
|
|
454
|
+
this.showOptions(options, cState.id);
|
|
455
|
+
}
|
|
456
|
+
mount() {
|
|
457
|
+
this.updateSel();
|
|
458
|
+
}
|
|
459
|
+
showOptions(options, id) {
|
|
460
|
+
if (this.list) this.list.remove();
|
|
461
|
+
this.list = this.dom.appendChild(this.createListBox(options, id, this.range));
|
|
462
|
+
this.list.addEventListener("scroll", () => {
|
|
463
|
+
if (this.info) this.view.requestMeasure(this.placeInfoReq);
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
update(update) {
|
|
467
|
+
var _a;
|
|
468
|
+
let cState = update.state.field(this.stateField);
|
|
469
|
+
let prevState = update.startState.field(this.stateField);
|
|
470
|
+
this.updateTooltipClass(update.state);
|
|
471
|
+
if (cState != prevState) {
|
|
472
|
+
let { options, selected, disabled } = cState.open;
|
|
473
|
+
if (!prevState.open || prevState.open.options != options) {
|
|
474
|
+
this.range = rangeAroundSelected(options.length, selected, update.state.facet(completionConfig).maxRenderedOptions);
|
|
475
|
+
this.showOptions(options, cState.id);
|
|
476
|
+
}
|
|
477
|
+
this.updateSel();
|
|
478
|
+
if (disabled != ((_a = prevState.open) === null || _a === void 0 ? void 0 : _a.disabled)) this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!disabled);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
updateTooltipClass(state) {
|
|
482
|
+
let cls = this.tooltipClass(state);
|
|
483
|
+
if (cls != this.currentClass) {
|
|
484
|
+
for (let c of this.currentClass.split(" ")) if (c) this.dom.classList.remove(c);
|
|
485
|
+
for (let c of cls.split(" ")) if (c) this.dom.classList.add(c);
|
|
486
|
+
this.currentClass = cls;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
positioned(space) {
|
|
490
|
+
this.space = space;
|
|
491
|
+
if (this.info) this.view.requestMeasure(this.placeInfoReq);
|
|
492
|
+
}
|
|
493
|
+
updateSel() {
|
|
494
|
+
let cState = this.view.state.field(this.stateField), open = cState.open;
|
|
495
|
+
if (open.selected > -1 && open.selected < this.range.from || open.selected >= this.range.to) {
|
|
496
|
+
this.range = rangeAroundSelected(open.options.length, open.selected, this.view.state.facet(completionConfig).maxRenderedOptions);
|
|
497
|
+
this.showOptions(open.options, cState.id);
|
|
498
|
+
}
|
|
499
|
+
let newSel = this.updateSelectedOption(open.selected);
|
|
500
|
+
if (newSel) {
|
|
501
|
+
this.destroyInfo();
|
|
502
|
+
let { completion } = open.options[open.selected];
|
|
503
|
+
let { info } = completion;
|
|
504
|
+
if (!info) return;
|
|
505
|
+
let infoResult = typeof info === "string" ? document.createTextNode(info) : info(completion);
|
|
506
|
+
if (!infoResult) return;
|
|
507
|
+
if ("then" in infoResult) infoResult.then((obj) => {
|
|
508
|
+
if (obj && this.view.state.field(this.stateField, false) == cState) this.addInfoPane(obj, completion);
|
|
509
|
+
}).catch((e) => logException(this.view.state, e, "completion info"));
|
|
510
|
+
else {
|
|
511
|
+
this.addInfoPane(infoResult, completion);
|
|
512
|
+
newSel.setAttribute("aria-describedby", this.info.id);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
addInfoPane(content, completion) {
|
|
517
|
+
this.destroyInfo();
|
|
518
|
+
let wrap = this.info = document.createElement("div");
|
|
519
|
+
wrap.className = "cm-tooltip cm-completionInfo";
|
|
520
|
+
wrap.id = "cm-completionInfo-" + Math.floor(Math.random() * 65535).toString(16);
|
|
521
|
+
if (content.nodeType != null) {
|
|
522
|
+
wrap.appendChild(content);
|
|
523
|
+
this.infoDestroy = null;
|
|
524
|
+
} else {
|
|
525
|
+
let { dom, destroy } = content;
|
|
526
|
+
wrap.appendChild(dom);
|
|
527
|
+
this.infoDestroy = destroy || null;
|
|
528
|
+
}
|
|
529
|
+
this.dom.appendChild(wrap);
|
|
530
|
+
this.view.requestMeasure(this.placeInfoReq);
|
|
531
|
+
}
|
|
532
|
+
updateSelectedOption(selected) {
|
|
533
|
+
let set = null;
|
|
534
|
+
for (let opt = this.list.firstChild, i = this.range.from; opt; opt = opt.nextSibling, i++) if (opt.nodeName != "LI" || !opt.id) i--;
|
|
535
|
+
else if (i == selected) {
|
|
536
|
+
if (!opt.hasAttribute("aria-selected")) {
|
|
537
|
+
opt.setAttribute("aria-selected", "true");
|
|
538
|
+
set = opt;
|
|
539
|
+
}
|
|
540
|
+
} else if (opt.hasAttribute("aria-selected")) {
|
|
541
|
+
opt.removeAttribute("aria-selected");
|
|
542
|
+
opt.removeAttribute("aria-describedby");
|
|
543
|
+
}
|
|
544
|
+
if (set) scrollIntoView(this.list, set);
|
|
545
|
+
return set;
|
|
546
|
+
}
|
|
547
|
+
measureInfo() {
|
|
548
|
+
let sel = this.dom.querySelector("[aria-selected]");
|
|
549
|
+
if (!sel || !this.info) return null;
|
|
550
|
+
let listRect = this.dom.getBoundingClientRect();
|
|
551
|
+
let infoRect = this.info.getBoundingClientRect();
|
|
552
|
+
let selRect = sel.getBoundingClientRect();
|
|
553
|
+
let space = this.space;
|
|
554
|
+
if (!space) {
|
|
555
|
+
let docElt = this.dom.ownerDocument.documentElement;
|
|
556
|
+
space = {
|
|
557
|
+
left: 0,
|
|
558
|
+
top: 0,
|
|
559
|
+
right: docElt.clientWidth,
|
|
560
|
+
bottom: docElt.clientHeight
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
if (selRect.top > Math.min(space.bottom, listRect.bottom) - 10 || selRect.bottom < Math.max(space.top, listRect.top) + 10) return null;
|
|
564
|
+
return this.view.state.facet(completionConfig).positionInfo(this.view, listRect, selRect, infoRect, space, this.dom);
|
|
565
|
+
}
|
|
566
|
+
placeInfo(pos) {
|
|
567
|
+
if (this.info) {
|
|
568
|
+
if (pos) {
|
|
569
|
+
if (pos.style) this.info.style.cssText = pos.style;
|
|
570
|
+
this.info.className = "cm-tooltip cm-completionInfo " + (pos.class || "");
|
|
571
|
+
} else this.info.style.cssText = "top: -1e6px";
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
createListBox(options, id, range) {
|
|
575
|
+
const ul = document.createElement("ul");
|
|
576
|
+
ul.id = id;
|
|
577
|
+
ul.setAttribute("role", "listbox");
|
|
578
|
+
ul.setAttribute("aria-expanded", "true");
|
|
579
|
+
ul.setAttribute("aria-label", this.view.state.phrase("Completions"));
|
|
580
|
+
ul.addEventListener("mousedown", (e) => {
|
|
581
|
+
if (e.target == ul) e.preventDefault();
|
|
582
|
+
});
|
|
583
|
+
let curSection = null;
|
|
584
|
+
for (let i = range.from; i < range.to; i++) {
|
|
585
|
+
let { completion, match } = options[i], { section } = completion;
|
|
586
|
+
if (section) {
|
|
587
|
+
let name = typeof section == "string" ? section : section.name;
|
|
588
|
+
if (name != curSection && (i > range.from || range.from == 0)) {
|
|
589
|
+
curSection = name;
|
|
590
|
+
if (typeof section != "string" && section.header) ul.appendChild(section.header(section));
|
|
591
|
+
else {
|
|
592
|
+
let header = ul.appendChild(document.createElement("completion-section"));
|
|
593
|
+
header.textContent = name;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
const li = ul.appendChild(document.createElement("li"));
|
|
598
|
+
li.id = id + "-" + i;
|
|
599
|
+
li.setAttribute("role", "option");
|
|
600
|
+
let cls = this.optionClass(completion);
|
|
601
|
+
if (cls) li.className = cls;
|
|
602
|
+
for (let source of this.optionContent) {
|
|
603
|
+
let node = source(completion, this.view.state, this.view, match);
|
|
604
|
+
if (node) li.appendChild(node);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
if (range.from) ul.classList.add("cm-completionListIncompleteTop");
|
|
608
|
+
if (range.to < options.length) ul.classList.add("cm-completionListIncompleteBottom");
|
|
609
|
+
return ul;
|
|
610
|
+
}
|
|
611
|
+
destroyInfo() {
|
|
612
|
+
if (this.info) {
|
|
613
|
+
if (this.infoDestroy) this.infoDestroy();
|
|
614
|
+
this.info.remove();
|
|
615
|
+
this.info = null;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
destroy() {
|
|
619
|
+
this.destroyInfo();
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
function completionTooltip(stateField, applyCompletion) {
|
|
623
|
+
return (view) => new CompletionTooltip(view, stateField, applyCompletion);
|
|
624
|
+
}
|
|
625
|
+
function scrollIntoView(container, element) {
|
|
626
|
+
let parent = container.getBoundingClientRect();
|
|
627
|
+
let self = element.getBoundingClientRect();
|
|
628
|
+
let scaleY = parent.height / container.offsetHeight;
|
|
629
|
+
if (self.top < parent.top) container.scrollTop -= (parent.top - self.top) / scaleY;
|
|
630
|
+
else if (self.bottom > parent.bottom) container.scrollTop += (self.bottom - parent.bottom) / scaleY;
|
|
631
|
+
}
|
|
632
|
+
function score(option) {
|
|
633
|
+
return (option.boost || 0) * 100 + (option.apply ? 10 : 0) + (option.info ? 5 : 0) + (option.type ? 1 : 0);
|
|
634
|
+
}
|
|
635
|
+
function sortOptions(active, state) {
|
|
636
|
+
let options = [];
|
|
637
|
+
let sections = null, dynamicSectionScore = null;
|
|
638
|
+
let addOption = (option) => {
|
|
639
|
+
options.push(option);
|
|
640
|
+
let { section } = option.completion;
|
|
641
|
+
if (section) {
|
|
642
|
+
if (!sections) sections = [];
|
|
643
|
+
let name = typeof section == "string" ? section : section.name;
|
|
644
|
+
if (!sections.some((s) => s.name == name)) sections.push(typeof section == "string" ? { name } : section);
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
let conf = state.facet(completionConfig);
|
|
648
|
+
for (let a of active) if (a.hasResult()) {
|
|
649
|
+
let getMatch = a.result.getMatch;
|
|
650
|
+
if (a.result.filter === false) for (let option of a.result.options) addOption(new Option(option, a.source, getMatch ? getMatch(option) : [], 1e9 - options.length));
|
|
651
|
+
else {
|
|
652
|
+
let pattern = state.sliceDoc(a.from, a.to), match;
|
|
653
|
+
let matcher = conf.filterStrict ? new StrictMatcher(pattern) : new FuzzyMatcher(pattern);
|
|
654
|
+
for (let option of a.result.options) if (match = matcher.match(option.label)) {
|
|
655
|
+
let matched = !option.displayLabel ? match.matched : getMatch ? getMatch(option, match.matched) : [];
|
|
656
|
+
let score = match.score + (option.boost || 0);
|
|
657
|
+
addOption(new Option(option, a.source, matched, score));
|
|
658
|
+
if (typeof option.section == "object" && option.section.rank === "dynamic") {
|
|
659
|
+
let { name } = option.section;
|
|
660
|
+
if (!dynamicSectionScore) dynamicSectionScore = Object.create(null);
|
|
661
|
+
dynamicSectionScore[name] = Math.max(score, dynamicSectionScore[name] || -1e9);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
if (sections) {
|
|
667
|
+
let sectionOrder = Object.create(null), pos = 0;
|
|
668
|
+
let cmp = (a, b) => {
|
|
669
|
+
return (a.rank === "dynamic" && b.rank === "dynamic" ? dynamicSectionScore[b.name] - dynamicSectionScore[a.name] : 0) || (typeof a.rank == "number" ? a.rank : 1e9) - (typeof b.rank == "number" ? b.rank : 1e9) || (a.name < b.name ? -1 : 1);
|
|
670
|
+
};
|
|
671
|
+
for (let s of sections.sort(cmp)) {
|
|
672
|
+
pos -= 1e5;
|
|
673
|
+
sectionOrder[s.name] = pos;
|
|
674
|
+
}
|
|
675
|
+
for (let option of options) {
|
|
676
|
+
let { section } = option.completion;
|
|
677
|
+
if (section) option.score += sectionOrder[typeof section == "string" ? section : section.name];
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
let result = [], prev = null;
|
|
681
|
+
let compare = conf.compareCompletions;
|
|
682
|
+
for (let opt of options.sort((a, b) => b.score - a.score || compare(a.completion, b.completion))) {
|
|
683
|
+
let cur = opt.completion;
|
|
684
|
+
if (!prev || prev.label != cur.label || prev.detail != cur.detail || prev.type != null && cur.type != null && prev.type != cur.type || prev.apply != cur.apply || prev.boost != cur.boost) result.push(opt);
|
|
685
|
+
else if (score(opt.completion) > score(prev)) result[result.length - 1] = opt;
|
|
686
|
+
prev = opt.completion;
|
|
687
|
+
}
|
|
688
|
+
return result;
|
|
689
|
+
}
|
|
690
|
+
var CompletionDialog = class CompletionDialog {
|
|
691
|
+
constructor(options, attrs, tooltip, timestamp, selected, disabled) {
|
|
692
|
+
this.options = options;
|
|
693
|
+
this.attrs = attrs;
|
|
694
|
+
this.tooltip = tooltip;
|
|
695
|
+
this.timestamp = timestamp;
|
|
696
|
+
this.selected = selected;
|
|
697
|
+
this.disabled = disabled;
|
|
698
|
+
}
|
|
699
|
+
setSelected(selected, id) {
|
|
700
|
+
return selected == this.selected || selected >= this.options.length ? this : new CompletionDialog(this.options, makeAttrs(id, selected), this.tooltip, this.timestamp, selected, this.disabled);
|
|
701
|
+
}
|
|
702
|
+
static build(active, state, id, prev, conf, didSetActive) {
|
|
703
|
+
if (prev && !didSetActive && active.some((s) => s.isPending)) return prev.setDisabled();
|
|
704
|
+
let options = sortOptions(active, state);
|
|
705
|
+
if (!options.length) return prev && active.some((a) => a.isPending) ? prev.setDisabled() : null;
|
|
706
|
+
let selected = state.facet(completionConfig).selectOnOpen ? 0 : -1;
|
|
707
|
+
if (prev && prev.selected != selected && prev.selected != -1) {
|
|
708
|
+
let selectedValue = prev.options[prev.selected].completion;
|
|
709
|
+
for (let i = 0; i < options.length; i++) if (options[i].completion == selectedValue) {
|
|
710
|
+
selected = i;
|
|
711
|
+
break;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
return new CompletionDialog(options, makeAttrs(id, selected), {
|
|
715
|
+
pos: active.reduce((a, b) => b.hasResult() ? Math.min(a, b.from) : a, 1e8),
|
|
716
|
+
create: createTooltip,
|
|
717
|
+
above: conf.aboveCursor
|
|
718
|
+
}, prev ? prev.timestamp : Date.now(), selected, false);
|
|
719
|
+
}
|
|
720
|
+
map(changes) {
|
|
721
|
+
return new CompletionDialog(this.options, this.attrs, {
|
|
722
|
+
...this.tooltip,
|
|
723
|
+
pos: changes.mapPos(this.tooltip.pos)
|
|
724
|
+
}, this.timestamp, this.selected, this.disabled);
|
|
725
|
+
}
|
|
726
|
+
setDisabled() {
|
|
727
|
+
return new CompletionDialog(this.options, this.attrs, this.tooltip, this.timestamp, this.selected, true);
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
var CompletionState = class CompletionState {
|
|
731
|
+
constructor(active, id, open) {
|
|
732
|
+
this.active = active;
|
|
733
|
+
this.id = id;
|
|
734
|
+
this.open = open;
|
|
735
|
+
}
|
|
736
|
+
static start() {
|
|
737
|
+
return new CompletionState(none, "cm-ac-" + Math.floor(Math.random() * 2e6).toString(36), null);
|
|
738
|
+
}
|
|
739
|
+
update(tr) {
|
|
740
|
+
let { state } = tr, conf = state.facet(completionConfig);
|
|
741
|
+
let active = (conf.override || state.languageDataAt("autocomplete", cur(state)).map(asSource)).map((source) => {
|
|
742
|
+
return (this.active.find((s) => s.source == source) || new ActiveSource(source, this.active.some((a) => a.state != 0) ? 1 : 0)).update(tr, conf);
|
|
743
|
+
});
|
|
744
|
+
if (active.length == this.active.length && active.every((a, i) => a == this.active[i])) active = this.active;
|
|
745
|
+
let open = this.open, didSet = tr.effects.some((e) => e.is(setActiveEffect));
|
|
746
|
+
if (open && tr.docChanged) open = open.map(tr.changes);
|
|
747
|
+
if (tr.selection || active.some((a) => a.hasResult() && tr.changes.touchesRange(a.from, a.to)) || !sameResults(active, this.active) || didSet) open = CompletionDialog.build(active, state, this.id, open, conf, didSet);
|
|
748
|
+
else if (open && open.disabled && !active.some((a) => a.isPending)) open = null;
|
|
749
|
+
if (!open && active.every((a) => !a.isPending) && active.some((a) => a.hasResult())) active = active.map((a) => a.hasResult() ? new ActiveSource(a.source, 0) : a);
|
|
750
|
+
for (let effect of tr.effects) if (effect.is(setSelectedEffect)) open = open && open.setSelected(effect.value, this.id);
|
|
751
|
+
return active == this.active && open == this.open ? this : new CompletionState(active, this.id, open);
|
|
752
|
+
}
|
|
753
|
+
get tooltip() {
|
|
754
|
+
return this.open ? this.open.tooltip : null;
|
|
755
|
+
}
|
|
756
|
+
get attrs() {
|
|
757
|
+
return this.open ? this.open.attrs : this.active.length ? baseAttrs : noAttrs;
|
|
758
|
+
}
|
|
759
|
+
};
|
|
760
|
+
function sameResults(a, b) {
|
|
761
|
+
if (a == b) return true;
|
|
762
|
+
for (let iA = 0, iB = 0;;) {
|
|
763
|
+
while (iA < a.length && !a[iA].hasResult()) iA++;
|
|
764
|
+
while (iB < b.length && !b[iB].hasResult()) iB++;
|
|
765
|
+
let endA = iA == a.length, endB = iB == b.length;
|
|
766
|
+
if (endA || endB) return endA == endB;
|
|
767
|
+
if (a[iA++].result != b[iB++].result) return false;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
var baseAttrs = { "aria-autocomplete": "list" };
|
|
771
|
+
var noAttrs = {};
|
|
772
|
+
function makeAttrs(id, selected) {
|
|
773
|
+
let result = {
|
|
774
|
+
"aria-autocomplete": "list",
|
|
775
|
+
"aria-haspopup": "listbox",
|
|
776
|
+
"aria-controls": id
|
|
777
|
+
};
|
|
778
|
+
if (selected > -1) result["aria-activedescendant"] = id + "-" + selected;
|
|
779
|
+
return result;
|
|
780
|
+
}
|
|
781
|
+
var none = [];
|
|
782
|
+
function getUpdateType(tr, conf) {
|
|
783
|
+
if (tr.isUserEvent("input.complete")) {
|
|
784
|
+
let completion = tr.annotation(pickedCompletion);
|
|
785
|
+
if (completion && conf.activateOnCompletion(completion)) return 12;
|
|
786
|
+
}
|
|
787
|
+
let typing = tr.isUserEvent("input.type");
|
|
788
|
+
return typing && conf.activateOnTyping ? 5 : typing ? 1 : tr.isUserEvent("delete.backward") ? 2 : tr.selection ? 8 : tr.docChanged ? 16 : 0;
|
|
789
|
+
}
|
|
790
|
+
var ActiveSource = class ActiveSource {
|
|
791
|
+
constructor(source, state, explicit = false) {
|
|
792
|
+
this.source = source;
|
|
793
|
+
this.state = state;
|
|
794
|
+
this.explicit = explicit;
|
|
795
|
+
}
|
|
796
|
+
hasResult() {
|
|
797
|
+
return false;
|
|
798
|
+
}
|
|
799
|
+
get isPending() {
|
|
800
|
+
return this.state == 1;
|
|
801
|
+
}
|
|
802
|
+
update(tr, conf) {
|
|
803
|
+
let type = getUpdateType(tr, conf), value = this;
|
|
804
|
+
if (type & 8 || type & 16 && this.touches(tr)) value = new ActiveSource(value.source, 0);
|
|
805
|
+
if (type & 4 && value.state == 0) value = new ActiveSource(this.source, 1);
|
|
806
|
+
value = value.updateFor(tr, type);
|
|
807
|
+
for (let effect of tr.effects) if (effect.is(startCompletionEffect)) value = new ActiveSource(value.source, 1, effect.value);
|
|
808
|
+
else if (effect.is(closeCompletionEffect)) value = new ActiveSource(value.source, 0);
|
|
809
|
+
else if (effect.is(setActiveEffect)) {
|
|
810
|
+
for (let active of effect.value) if (active.source == value.source) value = active;
|
|
811
|
+
}
|
|
812
|
+
return value;
|
|
813
|
+
}
|
|
814
|
+
updateFor(tr, type) {
|
|
815
|
+
return this.map(tr.changes);
|
|
816
|
+
}
|
|
817
|
+
map(changes) {
|
|
818
|
+
return this;
|
|
819
|
+
}
|
|
820
|
+
touches(tr) {
|
|
821
|
+
return tr.changes.touchesRange(cur(tr.state));
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
var ActiveResult = class ActiveResult extends ActiveSource {
|
|
825
|
+
constructor(source, explicit, limit, result, from, to) {
|
|
826
|
+
super(source, 3, explicit);
|
|
827
|
+
this.limit = limit;
|
|
828
|
+
this.result = result;
|
|
829
|
+
this.from = from;
|
|
830
|
+
this.to = to;
|
|
831
|
+
}
|
|
832
|
+
hasResult() {
|
|
833
|
+
return true;
|
|
834
|
+
}
|
|
835
|
+
updateFor(tr, type) {
|
|
836
|
+
var _a;
|
|
837
|
+
if (!(type & 3)) return this.map(tr.changes);
|
|
838
|
+
let result = this.result;
|
|
839
|
+
if (result.map && !tr.changes.empty) result = result.map(result, tr.changes);
|
|
840
|
+
let from = tr.changes.mapPos(this.from), to = tr.changes.mapPos(this.to, 1);
|
|
841
|
+
let pos = cur(tr.state);
|
|
842
|
+
if (pos > to || !result || type & 2 && (cur(tr.startState) == this.from || pos < this.limit)) return new ActiveSource(this.source, type & 4 ? 1 : 0);
|
|
843
|
+
let limit = tr.changes.mapPos(this.limit);
|
|
844
|
+
if (checkValid(result.validFor, tr.state, from, to)) return new ActiveResult(this.source, this.explicit, limit, result, from, to);
|
|
845
|
+
if (result.update && (result = result.update(result, from, to, new CompletionContext(tr.state, pos, false)))) return new ActiveResult(this.source, this.explicit, limit, result, result.from, (_a = result.to) !== null && _a !== void 0 ? _a : cur(tr.state));
|
|
846
|
+
return new ActiveSource(this.source, 1, this.explicit);
|
|
847
|
+
}
|
|
848
|
+
map(mapping) {
|
|
849
|
+
if (mapping.empty) return this;
|
|
850
|
+
let result = this.result.map ? this.result.map(this.result, mapping) : this.result;
|
|
851
|
+
if (!result) return new ActiveSource(this.source, 0);
|
|
852
|
+
return new ActiveResult(this.source, this.explicit, mapping.mapPos(this.limit), result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1));
|
|
853
|
+
}
|
|
854
|
+
touches(tr) {
|
|
855
|
+
return tr.changes.touchesRange(this.from, this.to);
|
|
856
|
+
}
|
|
857
|
+
};
|
|
858
|
+
function checkValid(validFor, state, from, to) {
|
|
859
|
+
if (!validFor) return false;
|
|
860
|
+
let text = state.sliceDoc(from, to);
|
|
861
|
+
return typeof validFor == "function" ? validFor(text, from, to, state) : ensureAnchor(validFor, true).test(text);
|
|
862
|
+
}
|
|
863
|
+
var setActiveEffect = /*@__PURE__*/ StateEffect.define({ map(sources, mapping) {
|
|
864
|
+
return sources.map((s) => s.map(mapping));
|
|
865
|
+
} });
|
|
866
|
+
var completionState = /*@__PURE__*/ StateField.define({
|
|
867
|
+
create() {
|
|
868
|
+
return CompletionState.start();
|
|
869
|
+
},
|
|
870
|
+
update(value, tr) {
|
|
871
|
+
return value.update(tr);
|
|
872
|
+
},
|
|
873
|
+
provide: (f) => [showTooltip.from(f, (val) => val.tooltip), EditorView.contentAttributes.from(f, (state) => state.attrs)]
|
|
874
|
+
});
|
|
875
|
+
function applyCompletion(view, option) {
|
|
876
|
+
const apply = option.completion.apply || option.completion.label;
|
|
877
|
+
let result = view.state.field(completionState).active.find((a) => a.source == option.source);
|
|
878
|
+
if (!(result instanceof ActiveResult)) return false;
|
|
879
|
+
if (typeof apply == "string") view.dispatch({
|
|
880
|
+
...insertCompletionText(view.state, apply, result.from, result.to),
|
|
881
|
+
annotations: pickedCompletion.of(option.completion)
|
|
882
|
+
});
|
|
883
|
+
else apply(view, option.completion, result.from, result.to);
|
|
884
|
+
return true;
|
|
885
|
+
}
|
|
886
|
+
var createTooltip = /*@__PURE__*/ completionTooltip(completionState, applyCompletion);
|
|
887
|
+
/**
|
|
888
|
+
Returns a command that moves the completion selection forward or
|
|
889
|
+
backward by the given amount.
|
|
890
|
+
*/
|
|
891
|
+
function moveCompletionSelection(forward, by = "option") {
|
|
892
|
+
return (view) => {
|
|
893
|
+
let cState = view.state.field(completionState, false);
|
|
894
|
+
if (!cState || !cState.open || cState.open.disabled || Date.now() - cState.open.timestamp < view.state.facet(completionConfig).interactionDelay) return false;
|
|
895
|
+
let step = 1, tooltip;
|
|
896
|
+
if (by == "page" && (tooltip = getTooltip(view, cState.open.tooltip))) step = Math.max(2, Math.floor(tooltip.dom.offsetHeight / tooltip.dom.querySelector("li").offsetHeight) - 1);
|
|
897
|
+
let { length } = cState.open.options;
|
|
898
|
+
let selected = cState.open.selected > -1 ? cState.open.selected + step * (forward ? 1 : -1) : forward ? 0 : length - 1;
|
|
899
|
+
if (selected < 0) selected = by == "page" ? 0 : length - 1;
|
|
900
|
+
else if (selected >= length) selected = by == "page" ? length - 1 : 0;
|
|
901
|
+
view.dispatch({ effects: setSelectedEffect.of(selected) });
|
|
902
|
+
return true;
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
Accept the current completion.
|
|
907
|
+
*/
|
|
908
|
+
var acceptCompletion = (view) => {
|
|
909
|
+
let cState = view.state.field(completionState, false);
|
|
910
|
+
if (view.state.readOnly || !cState || !cState.open || cState.open.selected < 0 || cState.open.disabled || Date.now() - cState.open.timestamp < view.state.facet(completionConfig).interactionDelay) return false;
|
|
911
|
+
return applyCompletion(view, cState.open.options[cState.open.selected]);
|
|
912
|
+
};
|
|
913
|
+
/**
|
|
914
|
+
Explicitly start autocompletion.
|
|
915
|
+
*/
|
|
916
|
+
var startCompletion = (view) => {
|
|
917
|
+
if (!view.state.field(completionState, false)) return false;
|
|
918
|
+
view.dispatch({ effects: startCompletionEffect.of(true) });
|
|
919
|
+
return true;
|
|
920
|
+
};
|
|
921
|
+
/**
|
|
922
|
+
Close the currently active completion.
|
|
923
|
+
*/
|
|
924
|
+
var closeCompletion = (view) => {
|
|
925
|
+
let cState = view.state.field(completionState, false);
|
|
926
|
+
if (!cState || !cState.active.some((a) => a.state != 0)) return false;
|
|
927
|
+
view.dispatch({ effects: closeCompletionEffect.of(null) });
|
|
928
|
+
return true;
|
|
929
|
+
};
|
|
930
|
+
var RunningQuery = class {
|
|
931
|
+
constructor(active, context) {
|
|
932
|
+
this.active = active;
|
|
933
|
+
this.context = context;
|
|
934
|
+
this.time = Date.now();
|
|
935
|
+
this.updates = [];
|
|
936
|
+
this.done = void 0;
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
var MaxUpdateCount = 50;
|
|
940
|
+
var MinAbortTime = 1e3;
|
|
941
|
+
var completionPlugin = /*@__PURE__*/ ViewPlugin.fromClass(class {
|
|
942
|
+
constructor(view) {
|
|
943
|
+
this.view = view;
|
|
944
|
+
this.debounceUpdate = -1;
|
|
945
|
+
this.running = [];
|
|
946
|
+
this.debounceAccept = -1;
|
|
947
|
+
this.pendingStart = false;
|
|
948
|
+
this.composing = 0;
|
|
949
|
+
for (let active of view.state.field(completionState).active) if (active.isPending) this.startQuery(active);
|
|
950
|
+
}
|
|
951
|
+
update(update) {
|
|
952
|
+
let cState = update.state.field(completionState);
|
|
953
|
+
let conf = update.state.facet(completionConfig);
|
|
954
|
+
if (!update.selectionSet && !update.docChanged && update.startState.field(completionState) == cState) return;
|
|
955
|
+
let doesReset = update.transactions.some((tr) => {
|
|
956
|
+
let type = getUpdateType(tr, conf);
|
|
957
|
+
return type & 8 || (tr.selection || tr.docChanged) && !(type & 3);
|
|
958
|
+
});
|
|
959
|
+
for (let i = 0; i < this.running.length; i++) {
|
|
960
|
+
let query = this.running[i];
|
|
961
|
+
if (doesReset || query.context.abortOnDocChange && update.docChanged || query.updates.length + update.transactions.length > MaxUpdateCount && Date.now() - query.time > MinAbortTime) {
|
|
962
|
+
for (let handler of query.context.abortListeners) try {
|
|
963
|
+
handler();
|
|
964
|
+
} catch (e) {
|
|
965
|
+
logException(this.view.state, e);
|
|
966
|
+
}
|
|
967
|
+
query.context.abortListeners = null;
|
|
968
|
+
this.running.splice(i--, 1);
|
|
969
|
+
} else query.updates.push(...update.transactions);
|
|
970
|
+
}
|
|
971
|
+
if (this.debounceUpdate > -1) clearTimeout(this.debounceUpdate);
|
|
972
|
+
if (update.transactions.some((tr) => tr.effects.some((e) => e.is(startCompletionEffect)))) this.pendingStart = true;
|
|
973
|
+
let delay = this.pendingStart ? 50 : conf.activateOnTypingDelay;
|
|
974
|
+
this.debounceUpdate = cState.active.some((a) => a.isPending && !this.running.some((q) => q.active.source == a.source)) ? setTimeout(() => this.startUpdate(), delay) : -1;
|
|
975
|
+
if (this.composing != 0) {
|
|
976
|
+
for (let tr of update.transactions) if (tr.isUserEvent("input.type")) this.composing = 2;
|
|
977
|
+
else if (this.composing == 2 && tr.selection) this.composing = 3;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
startUpdate() {
|
|
981
|
+
this.debounceUpdate = -1;
|
|
982
|
+
this.pendingStart = false;
|
|
983
|
+
let { state } = this.view, cState = state.field(completionState);
|
|
984
|
+
for (let active of cState.active) if (active.isPending && !this.running.some((r) => r.active.source == active.source)) this.startQuery(active);
|
|
985
|
+
if (this.running.length && cState.open && cState.open.disabled) this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime);
|
|
986
|
+
}
|
|
987
|
+
startQuery(active) {
|
|
988
|
+
let { state } = this.view;
|
|
989
|
+
let context = new CompletionContext(state, cur(state), active.explicit, this.view);
|
|
990
|
+
let pending = new RunningQuery(active, context);
|
|
991
|
+
this.running.push(pending);
|
|
992
|
+
Promise.resolve(active.source(context)).then((result) => {
|
|
993
|
+
if (!pending.context.aborted) {
|
|
994
|
+
pending.done = result || null;
|
|
995
|
+
this.scheduleAccept();
|
|
996
|
+
}
|
|
997
|
+
}, (err) => {
|
|
998
|
+
this.view.dispatch({ effects: closeCompletionEffect.of(null) });
|
|
999
|
+
logException(this.view.state, err);
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
scheduleAccept() {
|
|
1003
|
+
if (this.running.every((q) => q.done !== void 0)) this.accept();
|
|
1004
|
+
else if (this.debounceAccept < 0) this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime);
|
|
1005
|
+
}
|
|
1006
|
+
accept() {
|
|
1007
|
+
var _a;
|
|
1008
|
+
if (this.debounceAccept > -1) clearTimeout(this.debounceAccept);
|
|
1009
|
+
this.debounceAccept = -1;
|
|
1010
|
+
let updated = [];
|
|
1011
|
+
let conf = this.view.state.facet(completionConfig), cState = this.view.state.field(completionState);
|
|
1012
|
+
for (let i = 0; i < this.running.length; i++) {
|
|
1013
|
+
let query = this.running[i];
|
|
1014
|
+
if (query.done === void 0) continue;
|
|
1015
|
+
this.running.splice(i--, 1);
|
|
1016
|
+
if (query.done) {
|
|
1017
|
+
let pos = cur(query.updates.length ? query.updates[0].startState : this.view.state);
|
|
1018
|
+
let limit = Math.min(pos, query.done.from + (query.active.explicit ? 0 : 1));
|
|
1019
|
+
let active = new ActiveResult(query.active.source, query.active.explicit, limit, query.done, query.done.from, (_a = query.done.to) !== null && _a !== void 0 ? _a : pos);
|
|
1020
|
+
for (let tr of query.updates) active = active.update(tr, conf);
|
|
1021
|
+
if (active.hasResult()) {
|
|
1022
|
+
updated.push(active);
|
|
1023
|
+
continue;
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
let current = cState.active.find((a) => a.source == query.active.source);
|
|
1027
|
+
if (current && current.isPending) {
|
|
1028
|
+
if (query.done == null) {
|
|
1029
|
+
let active = new ActiveSource(query.active.source, 0);
|
|
1030
|
+
for (let tr of query.updates) active = active.update(tr, conf);
|
|
1031
|
+
if (!active.isPending) updated.push(active);
|
|
1032
|
+
} else this.startQuery(current);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
if (updated.length || cState.open && cState.open.disabled) this.view.dispatch({ effects: setActiveEffect.of(updated) });
|
|
1036
|
+
}
|
|
1037
|
+
}, { eventHandlers: {
|
|
1038
|
+
blur(event) {
|
|
1039
|
+
let state = this.view.state.field(completionState, false);
|
|
1040
|
+
if (state && state.tooltip && this.view.state.facet(completionConfig).closeOnBlur) {
|
|
1041
|
+
let dialog = state.open && getTooltip(this.view, state.open.tooltip);
|
|
1042
|
+
if (!dialog || !dialog.dom.contains(event.relatedTarget)) setTimeout(() => this.view.dispatch({ effects: closeCompletionEffect.of(null) }), 10);
|
|
1043
|
+
}
|
|
1044
|
+
},
|
|
1045
|
+
compositionstart() {
|
|
1046
|
+
this.composing = 1;
|
|
1047
|
+
},
|
|
1048
|
+
compositionend() {
|
|
1049
|
+
if (this.composing == 3) setTimeout(() => this.view.dispatch({ effects: startCompletionEffect.of(false) }), 20);
|
|
1050
|
+
this.composing = 0;
|
|
1051
|
+
}
|
|
1052
|
+
} });
|
|
1053
|
+
var windows = typeof navigator == "object" && /*@__PURE__*/ /Win/.test(navigator.platform);
|
|
1054
|
+
var commitCharacters = /*@__PURE__*/ Prec.highest(/*@__PURE__*/ EditorView.domEventHandlers({ keydown(event, view) {
|
|
1055
|
+
let field = view.state.field(completionState, false);
|
|
1056
|
+
if (!field || !field.open || field.open.disabled || field.open.selected < 0 || event.key.length > 1 || event.ctrlKey && !(windows && event.altKey) || event.metaKey) return false;
|
|
1057
|
+
let option = field.open.options[field.open.selected];
|
|
1058
|
+
let result = field.active.find((a) => a.source == option.source);
|
|
1059
|
+
let commitChars = option.completion.commitCharacters || result.result.commitCharacters;
|
|
1060
|
+
if (commitChars && commitChars.indexOf(event.key) > -1) applyCompletion(view, option);
|
|
1061
|
+
return false;
|
|
1062
|
+
} }));
|
|
1063
|
+
var baseTheme = /*@__PURE__*/ EditorView.baseTheme({
|
|
1064
|
+
".cm-tooltip.cm-tooltip-autocomplete": { "& > ul": {
|
|
1065
|
+
fontFamily: "monospace",
|
|
1066
|
+
whiteSpace: "nowrap",
|
|
1067
|
+
overflow: "hidden auto",
|
|
1068
|
+
maxWidth_fallback: "700px",
|
|
1069
|
+
maxWidth: "min(700px, 95vw)",
|
|
1070
|
+
minWidth: "250px",
|
|
1071
|
+
maxHeight: "10em",
|
|
1072
|
+
height: "100%",
|
|
1073
|
+
listStyle: "none",
|
|
1074
|
+
margin: 0,
|
|
1075
|
+
padding: 0,
|
|
1076
|
+
"& > li, & > completion-section": {
|
|
1077
|
+
padding: "1px 3px",
|
|
1078
|
+
lineHeight: 1.2
|
|
1079
|
+
},
|
|
1080
|
+
"& > li": {
|
|
1081
|
+
overflowX: "hidden",
|
|
1082
|
+
textOverflow: "ellipsis",
|
|
1083
|
+
cursor: "pointer"
|
|
1084
|
+
},
|
|
1085
|
+
"& > completion-section": {
|
|
1086
|
+
display: "list-item",
|
|
1087
|
+
borderBottom: "1px solid silver",
|
|
1088
|
+
paddingLeft: "0.5em",
|
|
1089
|
+
opacity: .7
|
|
1090
|
+
}
|
|
1091
|
+
} },
|
|
1092
|
+
"&light .cm-tooltip-autocomplete ul li[aria-selected]": {
|
|
1093
|
+
background: "#17c",
|
|
1094
|
+
color: "white"
|
|
1095
|
+
},
|
|
1096
|
+
"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]": { background: "#777" },
|
|
1097
|
+
"&dark .cm-tooltip-autocomplete ul li[aria-selected]": {
|
|
1098
|
+
background: "#347",
|
|
1099
|
+
color: "white"
|
|
1100
|
+
},
|
|
1101
|
+
"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]": { background: "#444" },
|
|
1102
|
+
".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after": {
|
|
1103
|
+
content: "\"···\"",
|
|
1104
|
+
opacity: .5,
|
|
1105
|
+
display: "block",
|
|
1106
|
+
textAlign: "center",
|
|
1107
|
+
cursor: "pointer"
|
|
1108
|
+
},
|
|
1109
|
+
".cm-tooltip.cm-completionInfo": {
|
|
1110
|
+
position: "absolute",
|
|
1111
|
+
padding: "3px 9px",
|
|
1112
|
+
width: "max-content",
|
|
1113
|
+
maxWidth: `400px`,
|
|
1114
|
+
boxSizing: "border-box",
|
|
1115
|
+
whiteSpace: "pre-line"
|
|
1116
|
+
},
|
|
1117
|
+
".cm-completionInfo.cm-completionInfo-left": { right: "100%" },
|
|
1118
|
+
".cm-completionInfo.cm-completionInfo-right": { left: "100%" },
|
|
1119
|
+
".cm-completionInfo.cm-completionInfo-left-narrow": { right: `30px` },
|
|
1120
|
+
".cm-completionInfo.cm-completionInfo-right-narrow": { left: `30px` },
|
|
1121
|
+
"&light .cm-snippetField": { backgroundColor: "#00000022" },
|
|
1122
|
+
"&dark .cm-snippetField": { backgroundColor: "#ffffff22" },
|
|
1123
|
+
".cm-snippetFieldPosition": {
|
|
1124
|
+
verticalAlign: "text-top",
|
|
1125
|
+
width: 0,
|
|
1126
|
+
height: "1.15em",
|
|
1127
|
+
display: "inline-block",
|
|
1128
|
+
margin: "0 -0.7px -.7em",
|
|
1129
|
+
borderLeft: "1.4px dotted #888"
|
|
1130
|
+
},
|
|
1131
|
+
".cm-completionMatchedText": { textDecoration: "underline" },
|
|
1132
|
+
".cm-completionDetail": {
|
|
1133
|
+
marginLeft: "0.5em",
|
|
1134
|
+
fontStyle: "italic"
|
|
1135
|
+
},
|
|
1136
|
+
".cm-completionIcon": {
|
|
1137
|
+
fontSize: "90%",
|
|
1138
|
+
width: ".8em",
|
|
1139
|
+
display: "inline-block",
|
|
1140
|
+
textAlign: "center",
|
|
1141
|
+
paddingRight: ".6em",
|
|
1142
|
+
opacity: "0.6",
|
|
1143
|
+
boxSizing: "content-box"
|
|
1144
|
+
},
|
|
1145
|
+
".cm-completionIcon-function, .cm-completionIcon-method": { "&:after": { content: "'ƒ'" } },
|
|
1146
|
+
".cm-completionIcon-class": { "&:after": { content: "'○'" } },
|
|
1147
|
+
".cm-completionIcon-interface": { "&:after": { content: "'◌'" } },
|
|
1148
|
+
".cm-completionIcon-variable": { "&:after": { content: "'𝑥'" } },
|
|
1149
|
+
".cm-completionIcon-constant": { "&:after": { content: "'𝐶'" } },
|
|
1150
|
+
".cm-completionIcon-type": { "&:after": { content: "'𝑡'" } },
|
|
1151
|
+
".cm-completionIcon-enum": { "&:after": { content: "'∪'" } },
|
|
1152
|
+
".cm-completionIcon-property": { "&:after": { content: "'□'" } },
|
|
1153
|
+
".cm-completionIcon-keyword": { "&:after": { content: "'🔑︎'" } },
|
|
1154
|
+
".cm-completionIcon-namespace": { "&:after": { content: "'▢'" } },
|
|
1155
|
+
".cm-completionIcon-text": { "&:after": {
|
|
1156
|
+
content: "'abc'",
|
|
1157
|
+
fontSize: "50%",
|
|
1158
|
+
verticalAlign: "middle"
|
|
1159
|
+
} }
|
|
1160
|
+
});
|
|
1161
|
+
var FieldPos = class {
|
|
1162
|
+
constructor(field, line, from, to) {
|
|
1163
|
+
this.field = field;
|
|
1164
|
+
this.line = line;
|
|
1165
|
+
this.from = from;
|
|
1166
|
+
this.to = to;
|
|
1167
|
+
}
|
|
1168
|
+
};
|
|
1169
|
+
var FieldRange = class FieldRange {
|
|
1170
|
+
constructor(field, from, to) {
|
|
1171
|
+
this.field = field;
|
|
1172
|
+
this.from = from;
|
|
1173
|
+
this.to = to;
|
|
1174
|
+
}
|
|
1175
|
+
map(changes) {
|
|
1176
|
+
let from = changes.mapPos(this.from, -1, MapMode.TrackDel);
|
|
1177
|
+
let to = changes.mapPos(this.to, 1, MapMode.TrackDel);
|
|
1178
|
+
return from == null || to == null ? null : new FieldRange(this.field, from, to);
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
var Snippet = class Snippet {
|
|
1182
|
+
constructor(lines, fieldPositions) {
|
|
1183
|
+
this.lines = lines;
|
|
1184
|
+
this.fieldPositions = fieldPositions;
|
|
1185
|
+
}
|
|
1186
|
+
instantiate(state, pos) {
|
|
1187
|
+
let text = [], lineStart = [pos];
|
|
1188
|
+
let lineObj = state.doc.lineAt(pos), baseIndent = /^\s*/.exec(lineObj.text)[0];
|
|
1189
|
+
for (let line of this.lines) {
|
|
1190
|
+
if (text.length) {
|
|
1191
|
+
let indent = baseIndent, tabs = /^\t*/.exec(line)[0].length;
|
|
1192
|
+
for (let i = 0; i < tabs; i++) indent += state.facet(indentUnit);
|
|
1193
|
+
lineStart.push(pos + indent.length - tabs);
|
|
1194
|
+
line = indent + line.slice(tabs);
|
|
1195
|
+
}
|
|
1196
|
+
text.push(line);
|
|
1197
|
+
pos += line.length + 1;
|
|
1198
|
+
}
|
|
1199
|
+
return {
|
|
1200
|
+
text,
|
|
1201
|
+
ranges: this.fieldPositions.map((pos) => new FieldRange(pos.field, lineStart[pos.line] + pos.from, lineStart[pos.line] + pos.to))
|
|
1202
|
+
};
|
|
1203
|
+
}
|
|
1204
|
+
static parse(template) {
|
|
1205
|
+
let fields = [];
|
|
1206
|
+
let lines = [], positions = [], m;
|
|
1207
|
+
for (let line of template.split(/\r\n?|\n/)) {
|
|
1208
|
+
while (m = /[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(line)) {
|
|
1209
|
+
let seq = m[1] ? +m[1] : null, rawName = m[2] || m[3] || "", found = -1;
|
|
1210
|
+
if (seq === 0) seq = 1e9;
|
|
1211
|
+
let name = rawName.replace(/\\[{}]/g, (m) => m[1]);
|
|
1212
|
+
for (let i = 0; i < fields.length; i++) if (seq != null ? fields[i].seq == seq : name ? fields[i].name == name : false) found = i;
|
|
1213
|
+
if (found < 0) {
|
|
1214
|
+
let i = 0;
|
|
1215
|
+
while (i < fields.length && (seq == null || fields[i].seq != null && fields[i].seq < seq)) i++;
|
|
1216
|
+
fields.splice(i, 0, {
|
|
1217
|
+
seq,
|
|
1218
|
+
name
|
|
1219
|
+
});
|
|
1220
|
+
found = i;
|
|
1221
|
+
for (let pos of positions) if (pos.field >= found) pos.field++;
|
|
1222
|
+
}
|
|
1223
|
+
for (let pos of positions) if (pos.line == lines.length && pos.from > m.index) {
|
|
1224
|
+
let snip = m[2] ? 3 + (m[1] || "").length : 2;
|
|
1225
|
+
pos.from -= snip;
|
|
1226
|
+
pos.to -= snip;
|
|
1227
|
+
}
|
|
1228
|
+
positions.push(new FieldPos(found, lines.length, m.index, m.index + name.length));
|
|
1229
|
+
line = line.slice(0, m.index) + rawName + line.slice(m.index + m[0].length);
|
|
1230
|
+
}
|
|
1231
|
+
line = line.replace(/\\([{}])/g, (_, brace, index) => {
|
|
1232
|
+
for (let pos of positions) if (pos.line == lines.length && pos.from > index) {
|
|
1233
|
+
pos.from--;
|
|
1234
|
+
pos.to--;
|
|
1235
|
+
}
|
|
1236
|
+
return brace;
|
|
1237
|
+
});
|
|
1238
|
+
lines.push(line);
|
|
1239
|
+
}
|
|
1240
|
+
return new Snippet(lines, positions);
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
var fieldMarker = /*@__PURE__*/ Decoration.widget({ widget: /*@__PURE__*/ new class extends WidgetType {
|
|
1244
|
+
toDOM() {
|
|
1245
|
+
let span = document.createElement("span");
|
|
1246
|
+
span.className = "cm-snippetFieldPosition";
|
|
1247
|
+
return span;
|
|
1248
|
+
}
|
|
1249
|
+
ignoreEvent() {
|
|
1250
|
+
return false;
|
|
1251
|
+
}
|
|
1252
|
+
}() });
|
|
1253
|
+
var fieldRange = /*@__PURE__*/ Decoration.mark({ class: "cm-snippetField" });
|
|
1254
|
+
var ActiveSnippet = class ActiveSnippet {
|
|
1255
|
+
constructor(ranges, active) {
|
|
1256
|
+
this.ranges = ranges;
|
|
1257
|
+
this.active = active;
|
|
1258
|
+
this.deco = Decoration.set(ranges.map((r) => (r.from == r.to ? fieldMarker : fieldRange).range(r.from, r.to)), true);
|
|
1259
|
+
}
|
|
1260
|
+
map(changes) {
|
|
1261
|
+
let ranges = [];
|
|
1262
|
+
for (let r of this.ranges) {
|
|
1263
|
+
let mapped = r.map(changes);
|
|
1264
|
+
if (!mapped) return null;
|
|
1265
|
+
ranges.push(mapped);
|
|
1266
|
+
}
|
|
1267
|
+
return new ActiveSnippet(ranges, this.active);
|
|
1268
|
+
}
|
|
1269
|
+
selectionInsideField(sel) {
|
|
1270
|
+
return sel.ranges.every((range) => this.ranges.some((r) => r.field == this.active && r.from <= range.from && r.to >= range.to));
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
var setActive = /*@__PURE__*/ StateEffect.define({ map(value, changes) {
|
|
1274
|
+
return value && value.map(changes);
|
|
1275
|
+
} });
|
|
1276
|
+
var moveToField = /*@__PURE__*/ StateEffect.define();
|
|
1277
|
+
var snippetState = /*@__PURE__*/ StateField.define({
|
|
1278
|
+
create() {
|
|
1279
|
+
return null;
|
|
1280
|
+
},
|
|
1281
|
+
update(value, tr) {
|
|
1282
|
+
for (let effect of tr.effects) {
|
|
1283
|
+
if (effect.is(setActive)) return effect.value;
|
|
1284
|
+
if (effect.is(moveToField) && value) return new ActiveSnippet(value.ranges, effect.value);
|
|
1285
|
+
}
|
|
1286
|
+
if (value && tr.docChanged) value = value.map(tr.changes);
|
|
1287
|
+
if (value && tr.selection && !value.selectionInsideField(tr.selection)) value = null;
|
|
1288
|
+
return value;
|
|
1289
|
+
},
|
|
1290
|
+
provide: (f) => EditorView.decorations.from(f, (val) => val ? val.deco : Decoration.none)
|
|
1291
|
+
});
|
|
1292
|
+
function fieldSelection(ranges, field) {
|
|
1293
|
+
return EditorSelection.create(ranges.filter((r) => r.field == field).map((r) => EditorSelection.range(r.from, r.to)));
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
Convert a snippet template to a function that can
|
|
1297
|
+
[apply](https://codemirror.net/6/docs/ref/#autocomplete.Completion.apply) it. Snippets are written
|
|
1298
|
+
using syntax like this:
|
|
1299
|
+
|
|
1300
|
+
"for (let ${index} = 0; ${index} < ${end}; ${index}++) {\n\t${}\n}"
|
|
1301
|
+
|
|
1302
|
+
Each `${}` placeholder (you may also use `#{}`) indicates a field
|
|
1303
|
+
that the user can fill in. Its name, if any, will be the default
|
|
1304
|
+
content for the field.
|
|
1305
|
+
|
|
1306
|
+
When the snippet is activated by calling the returned function,
|
|
1307
|
+
the code is inserted at the given position. Newlines in the
|
|
1308
|
+
template are indented by the indentation of the start line, plus
|
|
1309
|
+
one [indent unit](https://codemirror.net/6/docs/ref/#language.indentUnit) per tab character after
|
|
1310
|
+
the newline.
|
|
1311
|
+
|
|
1312
|
+
On activation, (all instances of) the first field are selected.
|
|
1313
|
+
The user can move between fields with Tab and Shift-Tab as long as
|
|
1314
|
+
the fields are active. Moving to the last field or moving the
|
|
1315
|
+
cursor out of the current field deactivates the fields.
|
|
1316
|
+
|
|
1317
|
+
The order of fields defaults to textual order, but you can add
|
|
1318
|
+
numbers to placeholders (`${1}` or `${1:defaultText}`) to provide
|
|
1319
|
+
a custom order. `${0}` is special—it is always the last stop, where
|
|
1320
|
+
the cursor ends up after tabbing through the other fields.
|
|
1321
|
+
|
|
1322
|
+
To include a literal `{` or `}` in your template, put a backslash
|
|
1323
|
+
in front of it. This will be removed and the brace will not be
|
|
1324
|
+
interpreted as indicating a placeholder.
|
|
1325
|
+
*/
|
|
1326
|
+
function snippet(template) {
|
|
1327
|
+
let snippet = Snippet.parse(template);
|
|
1328
|
+
return (editor, completion, from, to) => {
|
|
1329
|
+
let { text, ranges } = snippet.instantiate(editor.state, from);
|
|
1330
|
+
let { main } = editor.state.selection;
|
|
1331
|
+
let spec = {
|
|
1332
|
+
changes: {
|
|
1333
|
+
from,
|
|
1334
|
+
to: to == main.from ? main.to : to,
|
|
1335
|
+
insert: Text.of(text)
|
|
1336
|
+
},
|
|
1337
|
+
scrollIntoView: true,
|
|
1338
|
+
annotations: completion ? [pickedCompletion.of(completion), Transaction.userEvent.of("input.complete")] : void 0
|
|
1339
|
+
};
|
|
1340
|
+
if (ranges.length) spec.selection = fieldSelection(ranges, 0);
|
|
1341
|
+
if (ranges.some((r) => r.field > 0)) {
|
|
1342
|
+
let active = new ActiveSnippet(ranges, 0);
|
|
1343
|
+
let effects = spec.effects = [setActive.of(active)];
|
|
1344
|
+
if (editor.state.field(snippetState, false) === void 0) effects.push(StateEffect.appendConfig.of([
|
|
1345
|
+
snippetState,
|
|
1346
|
+
addSnippetKeymap,
|
|
1347
|
+
snippetPointerHandler,
|
|
1348
|
+
baseTheme
|
|
1349
|
+
]));
|
|
1350
|
+
}
|
|
1351
|
+
editor.dispatch(editor.state.update(spec));
|
|
1352
|
+
};
|
|
1353
|
+
}
|
|
1354
|
+
function moveField(dir) {
|
|
1355
|
+
return ({ state, dispatch }) => {
|
|
1356
|
+
let active = state.field(snippetState, false);
|
|
1357
|
+
if (!active || dir < 0 && active.active == 0) return false;
|
|
1358
|
+
let next = active.active + dir, last = dir > 0 && !active.ranges.some((r) => r.field == next + dir);
|
|
1359
|
+
dispatch(state.update({
|
|
1360
|
+
selection: fieldSelection(active.ranges, next),
|
|
1361
|
+
effects: setActive.of(last ? null : new ActiveSnippet(active.ranges, next)),
|
|
1362
|
+
scrollIntoView: true
|
|
1363
|
+
}));
|
|
1364
|
+
return true;
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
A command that clears the active snippet, if any.
|
|
1369
|
+
*/
|
|
1370
|
+
var clearSnippet = ({ state, dispatch }) => {
|
|
1371
|
+
if (!state.field(snippetState, false)) return false;
|
|
1372
|
+
dispatch(state.update({ effects: setActive.of(null) }));
|
|
1373
|
+
return true;
|
|
1374
|
+
};
|
|
1375
|
+
var defaultSnippetKeymap = [{
|
|
1376
|
+
key: "Tab",
|
|
1377
|
+
run: /* @__PURE__ */ moveField(1),
|
|
1378
|
+
shift: /* @__PURE__ */ moveField(-1)
|
|
1379
|
+
}, {
|
|
1380
|
+
key: "Escape",
|
|
1381
|
+
run: clearSnippet
|
|
1382
|
+
}];
|
|
1383
|
+
/**
|
|
1384
|
+
A facet that can be used to configure the key bindings used by
|
|
1385
|
+
snippets. The default binds Tab to
|
|
1386
|
+
[`nextSnippetField`](https://codemirror.net/6/docs/ref/#autocomplete.nextSnippetField), Shift-Tab to
|
|
1387
|
+
[`prevSnippetField`](https://codemirror.net/6/docs/ref/#autocomplete.prevSnippetField), and Escape
|
|
1388
|
+
to [`clearSnippet`](https://codemirror.net/6/docs/ref/#autocomplete.clearSnippet).
|
|
1389
|
+
*/
|
|
1390
|
+
var snippetKeymap = /*@__PURE__*/ Facet.define({ combine(maps) {
|
|
1391
|
+
return maps.length ? maps[0] : defaultSnippetKeymap;
|
|
1392
|
+
} });
|
|
1393
|
+
var addSnippetKeymap = /*@__PURE__*/ Prec.highest(/*@__PURE__*/ keymap.compute([snippetKeymap], (state) => state.facet(snippetKeymap)));
|
|
1394
|
+
/**
|
|
1395
|
+
Create a completion from a snippet. Returns an object with the
|
|
1396
|
+
properties from `completion`, plus an `apply` function that
|
|
1397
|
+
applies the snippet.
|
|
1398
|
+
*/
|
|
1399
|
+
function snippetCompletion(template, completion) {
|
|
1400
|
+
return {
|
|
1401
|
+
...completion,
|
|
1402
|
+
apply: snippet(template)
|
|
1403
|
+
};
|
|
1404
|
+
}
|
|
1405
|
+
var snippetPointerHandler = /*@__PURE__*/ EditorView.domEventHandlers({ mousedown(event, view) {
|
|
1406
|
+
let active = view.state.field(snippetState, false), pos;
|
|
1407
|
+
if (!active || (pos = view.posAtCoords({
|
|
1408
|
+
x: event.clientX,
|
|
1409
|
+
y: event.clientY
|
|
1410
|
+
})) == null) return false;
|
|
1411
|
+
let match = active.ranges.find((r) => r.from <= pos && r.to >= pos);
|
|
1412
|
+
if (!match || match.field == active.active) return false;
|
|
1413
|
+
view.dispatch({
|
|
1414
|
+
selection: fieldSelection(active.ranges, match.field),
|
|
1415
|
+
effects: setActive.of(active.ranges.some((r) => r.field > match.field) ? new ActiveSnippet(active.ranges, match.field) : null),
|
|
1416
|
+
scrollIntoView: true
|
|
1417
|
+
});
|
|
1418
|
+
return true;
|
|
1419
|
+
} });
|
|
1420
|
+
var closedBracket = /*@__PURE__*/ new class extends RangeValue {}();
|
|
1421
|
+
closedBracket.startSide = 1;
|
|
1422
|
+
closedBracket.endSide = -1;
|
|
1423
|
+
typeof navigator == "object" && navigator.userAgent;
|
|
1424
|
+
/**
|
|
1425
|
+
Returns an extension that enables autocompletion.
|
|
1426
|
+
*/
|
|
1427
|
+
function autocompletion(config = {}) {
|
|
1428
|
+
return [
|
|
1429
|
+
commitCharacters,
|
|
1430
|
+
completionState,
|
|
1431
|
+
completionConfig.of(config),
|
|
1432
|
+
completionPlugin,
|
|
1433
|
+
completionKeymapExt,
|
|
1434
|
+
baseTheme
|
|
1435
|
+
];
|
|
1436
|
+
}
|
|
1437
|
+
/**
|
|
1438
|
+
Basic keybindings for autocompletion.
|
|
1439
|
+
|
|
1440
|
+
- Ctrl-Space (and Alt-\` or Alt-i on macOS): [`startCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.startCompletion)
|
|
1441
|
+
- Escape: [`closeCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.closeCompletion)
|
|
1442
|
+
- ArrowDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true)`
|
|
1443
|
+
- ArrowUp: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(false)`
|
|
1444
|
+
- PageDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true, "page")`
|
|
1445
|
+
- PageUp: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(false, "page")`
|
|
1446
|
+
- Enter: [`acceptCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.acceptCompletion)
|
|
1447
|
+
*/
|
|
1448
|
+
var completionKeymap = [
|
|
1449
|
+
{
|
|
1450
|
+
key: "Ctrl-Space",
|
|
1451
|
+
run: startCompletion
|
|
1452
|
+
},
|
|
1453
|
+
{
|
|
1454
|
+
mac: "Alt-`",
|
|
1455
|
+
run: startCompletion
|
|
1456
|
+
},
|
|
1457
|
+
{
|
|
1458
|
+
mac: "Alt-i",
|
|
1459
|
+
run: startCompletion
|
|
1460
|
+
},
|
|
1461
|
+
{
|
|
1462
|
+
key: "Escape",
|
|
1463
|
+
run: closeCompletion
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
key: "ArrowDown",
|
|
1467
|
+
run: /*@__PURE__*/ moveCompletionSelection(true)
|
|
1468
|
+
},
|
|
1469
|
+
{
|
|
1470
|
+
key: "ArrowUp",
|
|
1471
|
+
run: /*@__PURE__*/ moveCompletionSelection(false)
|
|
1472
|
+
},
|
|
1473
|
+
{
|
|
1474
|
+
key: "PageDown",
|
|
1475
|
+
run: /*@__PURE__*/ moveCompletionSelection(true, "page")
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
key: "PageUp",
|
|
1479
|
+
run: /*@__PURE__*/ moveCompletionSelection(false, "page")
|
|
1480
|
+
},
|
|
1481
|
+
{
|
|
1482
|
+
key: "Enter",
|
|
1483
|
+
run: acceptCompletion
|
|
1484
|
+
}
|
|
1485
|
+
];
|
|
1486
|
+
var completionKeymapExt = /*@__PURE__*/ Prec.highest(/*@__PURE__*/ keymap.computeN([completionConfig], (state) => state.facet(completionConfig).defaultKeymap ? [completionKeymap] : []));
|
|
1487
|
+
/**
|
|
1488
|
+
Get the current completion status. When completions are available,
|
|
1489
|
+
this will return `"active"`. When completions are pending (in the
|
|
1490
|
+
process of being queried), this returns `"pending"`. Otherwise, it
|
|
1491
|
+
returns `null`.
|
|
1492
|
+
*/
|
|
1493
|
+
function completionStatus(state) {
|
|
1494
|
+
let cState = state.field(completionState, false);
|
|
1495
|
+
return cState && cState.active.some((a) => a.isPending) ? "pending" : cState && cState.active.some((a) => a.state != 0) ? "active" : null;
|
|
1496
|
+
}
|
|
1497
|
+
//#endregion
|
|
1498
|
+
export { ifNotIn as a, completionStatus as i, autocompletion as n, snippetCompletion as o, completeFromList as r, startCompletion as s, CompletionContext as t };
|