@rowsncolumns/ui 15.0.38
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/LICENSE.md +100 -0
- package/dist/cjs/arrow/index.d.ts +17 -0
- package/dist/cjs/arrow/index.d.ts.map +1 -0
- package/dist/cjs/arrow/index.js +46 -0
- package/dist/cjs/button/index.d.ts +14 -0
- package/dist/cjs/button/index.d.ts.map +1 -0
- package/dist/cjs/button/index.js +46 -0
- package/dist/cjs/calendar/index.d.ts +5 -0
- package/dist/cjs/calendar/index.d.ts.map +1 -0
- package/dist/cjs/calendar/index.js +13 -0
- package/dist/cjs/card/index.d.ts +10 -0
- package/dist/cjs/card/index.d.ts.map +1 -0
- package/dist/cjs/card/index.js +32 -0
- package/dist/cjs/cell-tooltip/index.d.ts +17 -0
- package/dist/cjs/cell-tooltip/index.d.ts.map +1 -0
- package/dist/cjs/cell-tooltip/index.js +38 -0
- package/dist/cjs/circular-loader/index.d.ts +9 -0
- package/dist/cjs/circular-loader/index.d.ts.map +1 -0
- package/dist/cjs/circular-loader/index.js +11 -0
- package/dist/cjs/color-picker/index.d.ts +12 -0
- package/dist/cjs/color-picker/index.d.ts.map +1 -0
- package/dist/cjs/color-picker/index.js +101 -0
- package/dist/cjs/color-picker/style.d.ts +5 -0
- package/dist/cjs/color-picker/style.d.ts.map +1 -0
- package/dist/cjs/color-picker/style.js +11 -0
- package/dist/cjs/command/index.d.ts +74 -0
- package/dist/cjs/command/index.d.ts.map +1 -0
- package/dist/cjs/command/index.js +37 -0
- package/dist/cjs/conditional-wrapper/index.d.ts +9 -0
- package/dist/cjs/conditional-wrapper/index.d.ts.map +1 -0
- package/dist/cjs/conditional-wrapper/index.js +4 -0
- package/dist/cjs/dialog/index.d.ts +17 -0
- package/dist/cjs/dialog/index.d.ts.map +1 -0
- package/dist/cjs/dialog/index.js +50 -0
- package/dist/cjs/dropdown/index.d.ts +34 -0
- package/dist/cjs/dropdown/index.d.ts.map +1 -0
- package/dist/cjs/dropdown/index.js +73 -0
- package/dist/cjs/editor/constants.d.ts +7 -0
- package/dist/cjs/editor/constants.d.ts.map +1 -0
- package/dist/cjs/editor/constants.js +50 -0
- package/dist/cjs/editor/editor-error-boundary.d.ts +3 -0
- package/dist/cjs/editor/editor-error-boundary.d.ts.map +1 -0
- package/dist/cjs/editor/editor-error-boundary.js +9 -0
- package/dist/cjs/editor/style.d.ts +12 -0
- package/dist/cjs/editor/style.d.ts.map +1 -0
- package/dist/cjs/editor/style.js +24 -0
- package/dist/cjs/editor/suggestions-dropdown.d.ts +25 -0
- package/dist/cjs/editor/suggestions-dropdown.d.ts.map +1 -0
- package/dist/cjs/editor/suggestions-dropdown.js +120 -0
- package/dist/cjs/editor-pm/constants.d.ts +2 -0
- package/dist/cjs/editor-pm/constants.d.ts.map +1 -0
- package/dist/cjs/editor-pm/constants.js +2 -0
- package/dist/cjs/editor-pm/decoration-plugin.d.ts +15 -0
- package/dist/cjs/editor-pm/decoration-plugin.d.ts.map +1 -0
- package/dist/cjs/editor-pm/decoration-plugin.js +38 -0
- package/dist/cjs/editor-pm/helpers.d.ts +197 -0
- package/dist/cjs/editor-pm/helpers.d.ts.map +1 -0
- package/dist/cjs/editor-pm/helpers.js +1170 -0
- package/dist/cjs/editor-pm/index.d.ts +10 -0
- package/dist/cjs/editor-pm/index.d.ts.map +1 -0
- package/dist/cjs/editor-pm/index.js +9 -0
- package/dist/cjs/editor-pm/mention-nodeview.d.ts +31 -0
- package/dist/cjs/editor-pm/mention-nodeview.d.ts.map +1 -0
- package/dist/cjs/editor-pm/mention-nodeview.js +105 -0
- package/dist/cjs/editor-pm/mentions-dropdown.d.ts +13 -0
- package/dist/cjs/editor-pm/mentions-dropdown.d.ts.map +1 -0
- package/dist/cjs/editor-pm/mentions-dropdown.js +19 -0
- package/dist/cjs/editor-pm/mentions-plugin.d.ts +18 -0
- package/dist/cjs/editor-pm/mentions-plugin.d.ts.map +1 -0
- package/dist/cjs/editor-pm/mentions-plugin.js +72 -0
- package/dist/cjs/editor-pm/placeholder-plugin.d.ts +4 -0
- package/dist/cjs/editor-pm/placeholder-plugin.d.ts.map +1 -0
- package/dist/cjs/editor-pm/placeholder-plugin.js +20 -0
- package/dist/cjs/editor-pm/prosemirror-editor.d.ts +493 -0
- package/dist/cjs/editor-pm/prosemirror-editor.d.ts.map +1 -0
- package/dist/cjs/editor-pm/prosemirror-editor.js +1145 -0
- package/dist/cjs/editor-pm/schema.d.ts +3 -0
- package/dist/cjs/editor-pm/schema.d.ts.map +1 -0
- package/dist/cjs/editor-pm/schema.js +183 -0
- package/dist/cjs/editor-pm/types.d.ts +8 -0
- package/dist/cjs/editor-pm/types.d.ts.map +1 -0
- package/dist/cjs/editor-pm/types.js +1 -0
- package/dist/cjs/editor-pm/unfocused-selection-plugin.d.ts +25 -0
- package/dist/cjs/editor-pm/unfocused-selection-plugin.d.ts.map +1 -0
- package/dist/cjs/editor-pm/unfocused-selection-plugin.js +61 -0
- package/dist/cjs/editor-pm/use-dropdown-change-pm.d.ts +24 -0
- package/dist/cjs/editor-pm/use-dropdown-change-pm.d.ts.map +1 -0
- package/dist/cjs/editor-pm/use-dropdown-change-pm.js +140 -0
- package/dist/cjs/editor-pm/use-editor-change-pm.d.ts +29 -0
- package/dist/cjs/editor-pm/use-editor-change-pm.d.ts.map +1 -0
- package/dist/cjs/editor-pm/use-editor-change-pm.js +154 -0
- package/dist/cjs/editor-pm/use-editor-decorator-pm.d.ts +17 -0
- package/dist/cjs/editor-pm/use-editor-decorator-pm.d.ts.map +1 -0
- package/dist/cjs/editor-pm/use-editor-decorator-pm.js +59 -0
- package/dist/cjs/editor-pm/use-editor-keydown-pm.d.ts +21 -0
- package/dist/cjs/editor-pm/use-editor-keydown-pm.d.ts.map +1 -0
- package/dist/cjs/editor-pm/use-editor-keydown-pm.js +81 -0
- package/dist/cjs/editor-pm/use-mention-keydown.d.ts +11 -0
- package/dist/cjs/editor-pm/use-mention-keydown.d.ts.map +1 -0
- package/dist/cjs/editor-pm/use-mention-keydown.js +59 -0
- package/dist/cjs/editor-pm/use-parameter-suggestions.d.ts +19 -0
- package/dist/cjs/editor-pm/use-parameter-suggestions.d.ts.map +1 -0
- package/dist/cjs/editor-pm/use-parameter-suggestions.js +79 -0
- package/dist/cjs/editor-pm/use-parameter-suggestions.test.d.ts +2 -0
- package/dist/cjs/editor-pm/use-parameter-suggestions.test.d.ts.map +1 -0
- package/dist/cjs/editor-pm/use-parameter-suggestions.test.js +122 -0
- package/dist/cjs/eye-dropper/index.d.ts +10 -0
- package/dist/cjs/eye-dropper/index.d.ts.map +1 -0
- package/dist/cjs/eye-dropper/index.js +24 -0
- package/dist/cjs/function-info/helpers.d.ts +10 -0
- package/dist/cjs/function-info/helpers.d.ts.map +1 -0
- package/dist/cjs/function-info/helpers.js +20 -0
- package/dist/cjs/function-info/index.d.ts +11 -0
- package/dist/cjs/function-info/index.d.ts.map +1 -0
- package/dist/cjs/function-info/index.js +71 -0
- package/dist/cjs/function-info/style.d.ts +7 -0
- package/dist/cjs/function-info/style.d.ts.map +1 -0
- package/dist/cjs/function-info/style.js +13 -0
- package/dist/cjs/hex-color-picker/index.d.ts +8 -0
- package/dist/cjs/hex-color-picker/index.d.ts.map +1 -0
- package/dist/cjs/hex-color-picker/index.js +47 -0
- package/dist/cjs/hooks/use-cycle-reference.d.ts +16 -0
- package/dist/cjs/hooks/use-cycle-reference.d.ts.map +1 -0
- package/dist/cjs/hooks/use-cycle-reference.js +72 -0
- package/dist/cjs/hooks/use-dropdown-categories.d.ts +9 -0
- package/dist/cjs/hooks/use-dropdown-categories.d.ts.map +1 -0
- package/dist/cjs/hooks/use-dropdown-categories.js +45 -0
- package/dist/cjs/hooks/use-dropdown.d.ts +38 -0
- package/dist/cjs/hooks/use-dropdown.d.ts.map +1 -0
- package/dist/cjs/hooks/use-dropdown.js +236 -0
- package/dist/cjs/hooks/use-isomorphic-layout-effect.ts.d.ts +6 -0
- package/dist/cjs/hooks/use-isomorphic-layout-effect.ts.d.ts.map +1 -0
- package/dist/cjs/hooks/use-isomorphic-layout-effect.ts.js +8 -0
- package/dist/cjs/hooks/use-modal.d.ts +28 -0
- package/dist/cjs/hooks/use-modal.d.ts.map +1 -0
- package/dist/cjs/hooks/use-modal.js +101 -0
- package/dist/cjs/hooks/use-visibility.d.ts +2 -0
- package/dist/cjs/hooks/use-visibility.d.ts.map +1 -0
- package/dist/cjs/hooks/use-visibility.js +12 -0
- package/dist/cjs/icon-button/index.d.ts +15 -0
- package/dist/cjs/icon-button/index.d.ts.map +1 -0
- package/dist/cjs/icon-button/index.js +34 -0
- package/dist/cjs/index.d.ts +34 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +33 -0
- package/dist/cjs/input/index.d.ts +9 -0
- package/dist/cjs/input/index.d.ts.map +1 -0
- package/dist/cjs/input/index.js +9 -0
- package/dist/cjs/popover/index.d.ts +13 -0
- package/dist/cjs/popover/index.d.ts.map +1 -0
- package/dist/cjs/popover/index.js +29 -0
- package/dist/cjs/progress/index.d.ts +10 -0
- package/dist/cjs/progress/index.d.ts.map +1 -0
- package/dist/cjs/progress/index.js +15 -0
- package/dist/cjs/select/index.d.ts +14 -0
- package/dist/cjs/select/index.d.ts.map +1 -0
- package/dist/cjs/select/index.js +46 -0
- package/dist/cjs/separator/index.d.ts +5 -0
- package/dist/cjs/separator/index.d.ts.map +1 -0
- package/dist/cjs/separator/index.js +10 -0
- package/dist/cjs/skeleton/index.d.ts +7 -0
- package/dist/cjs/skeleton/index.d.ts.map +1 -0
- package/dist/cjs/skeleton/index.js +11 -0
- package/dist/cjs/stack/index.d.ts +11 -0
- package/dist/cjs/stack/index.d.ts.map +1 -0
- package/dist/cjs/stack/index.js +22 -0
- package/dist/cjs/tabs/index.d.ts +8 -0
- package/dist/cjs/tabs/index.d.ts.map +1 -0
- package/dist/cjs/tabs/index.js +21 -0
- package/dist/cjs/tooltip/index.d.ts +12 -0
- package/dist/cjs/tooltip/index.d.ts.map +1 -0
- package/dist/cjs/tooltip/index.js +20 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/cjs/utils.d.ts +3 -0
- package/dist/cjs/utils.d.ts.map +1 -0
- package/dist/cjs/utils.js +9 -0
- package/dist/cjs/vitest.config.d.ts +3 -0
- package/dist/cjs/vitest.config.d.ts.map +1 -0
- package/dist/cjs/vitest.config.js +21 -0
- package/dist/esm/arrow/index.d.ts +17 -0
- package/dist/esm/arrow/index.d.ts.map +1 -0
- package/dist/esm/arrow/index.js +45 -0
- package/dist/esm/button/index.d.ts +14 -0
- package/dist/esm/button/index.d.ts.map +1 -0
- package/dist/esm/button/index.js +44 -0
- package/dist/esm/calendar/index.d.ts +5 -0
- package/dist/esm/calendar/index.d.ts.map +1 -0
- package/dist/esm/calendar/index.js +34 -0
- package/dist/esm/card/index.d.ts +10 -0
- package/dist/esm/card/index.d.ts.map +1 -0
- package/dist/esm/card/index.js +24 -0
- package/dist/esm/cell-tooltip/index.d.ts +17 -0
- package/dist/esm/cell-tooltip/index.d.ts.map +1 -0
- package/dist/esm/cell-tooltip/index.js +31 -0
- package/dist/esm/circular-loader/index.d.ts +9 -0
- package/dist/esm/circular-loader/index.d.ts.map +1 -0
- package/dist/esm/circular-loader/index.js +7 -0
- package/dist/esm/color-picker/index.d.ts +12 -0
- package/dist/esm/color-picker/index.d.ts.map +1 -0
- package/dist/esm/color-picker/index.js +99 -0
- package/dist/esm/color-picker/style.d.ts +5 -0
- package/dist/esm/color-picker/style.d.ts.map +1 -0
- package/dist/esm/color-picker/style.js +7 -0
- package/dist/esm/command/index.d.ts +74 -0
- package/dist/esm/command/index.d.ts.map +1 -0
- package/dist/esm/command/index.js +18 -0
- package/dist/esm/conditional-wrapper/index.d.ts +9 -0
- package/dist/esm/conditional-wrapper/index.d.ts.map +1 -0
- package/dist/esm/conditional-wrapper/index.js +1 -0
- package/dist/esm/dialog/index.d.ts +17 -0
- package/dist/esm/dialog/index.d.ts.map +1 -0
- package/dist/esm/dialog/index.js +30 -0
- package/dist/esm/dropdown/index.d.ts +34 -0
- package/dist/esm/dropdown/index.d.ts.map +1 -0
- package/dist/esm/dropdown/index.js +42 -0
- package/dist/esm/editor/constants.d.ts +7 -0
- package/dist/esm/editor/constants.d.ts.map +1 -0
- package/dist/esm/editor/constants.js +51 -0
- package/dist/esm/editor/editor-error-boundary.d.ts +3 -0
- package/dist/esm/editor/editor-error-boundary.d.ts.map +1 -0
- package/dist/esm/editor/editor-error-boundary.js +9 -0
- package/dist/esm/editor/style.d.ts +12 -0
- package/dist/esm/editor/style.d.ts.map +1 -0
- package/dist/esm/editor/style.js +17 -0
- package/dist/esm/editor/suggestions-dropdown.d.ts +25 -0
- package/dist/esm/editor/suggestions-dropdown.d.ts.map +1 -0
- package/dist/esm/editor/suggestions-dropdown.js +115 -0
- package/dist/esm/editor-pm/constants.d.ts +2 -0
- package/dist/esm/editor-pm/constants.d.ts.map +1 -0
- package/dist/esm/editor-pm/constants.js +2 -0
- package/dist/esm/editor-pm/decoration-plugin.d.ts +15 -0
- package/dist/esm/editor-pm/decoration-plugin.d.ts.map +1 -0
- package/dist/esm/editor-pm/decoration-plugin.js +38 -0
- package/dist/esm/editor-pm/helpers.d.ts +197 -0
- package/dist/esm/editor-pm/helpers.d.ts.map +1 -0
- package/dist/esm/editor-pm/helpers.js +1113 -0
- package/dist/esm/editor-pm/index.d.ts +10 -0
- package/dist/esm/editor-pm/index.d.ts.map +1 -0
- package/dist/esm/editor-pm/index.js +9 -0
- package/dist/esm/editor-pm/mention-nodeview.d.ts +31 -0
- package/dist/esm/editor-pm/mention-nodeview.d.ts.map +1 -0
- package/dist/esm/editor-pm/mention-nodeview.js +88 -0
- package/dist/esm/editor-pm/mentions-dropdown.d.ts +13 -0
- package/dist/esm/editor-pm/mentions-dropdown.d.ts.map +1 -0
- package/dist/esm/editor-pm/mentions-dropdown.js +17 -0
- package/dist/esm/editor-pm/mentions-plugin.d.ts +18 -0
- package/dist/esm/editor-pm/mentions-plugin.d.ts.map +1 -0
- package/dist/esm/editor-pm/mentions-plugin.js +92 -0
- package/dist/esm/editor-pm/placeholder-plugin.d.ts +4 -0
- package/dist/esm/editor-pm/placeholder-plugin.d.ts.map +1 -0
- package/dist/esm/editor-pm/placeholder-plugin.js +20 -0
- package/dist/esm/editor-pm/prosemirror-editor.d.ts +493 -0
- package/dist/esm/editor-pm/prosemirror-editor.d.ts.map +1 -0
- package/dist/esm/editor-pm/prosemirror-editor.js +1135 -0
- package/dist/esm/editor-pm/schema.d.ts +3 -0
- package/dist/esm/editor-pm/schema.d.ts.map +1 -0
- package/dist/esm/editor-pm/schema.js +179 -0
- package/dist/esm/editor-pm/types.d.ts +8 -0
- package/dist/esm/editor-pm/types.d.ts.map +1 -0
- package/dist/esm/editor-pm/types.js +1 -0
- package/dist/esm/editor-pm/unfocused-selection-plugin.d.ts +25 -0
- package/dist/esm/editor-pm/unfocused-selection-plugin.d.ts.map +1 -0
- package/dist/esm/editor-pm/unfocused-selection-plugin.js +61 -0
- package/dist/esm/editor-pm/use-dropdown-change-pm.d.ts +24 -0
- package/dist/esm/editor-pm/use-dropdown-change-pm.d.ts.map +1 -0
- package/dist/esm/editor-pm/use-dropdown-change-pm.js +137 -0
- package/dist/esm/editor-pm/use-editor-change-pm.d.ts +29 -0
- package/dist/esm/editor-pm/use-editor-change-pm.d.ts.map +1 -0
- package/dist/esm/editor-pm/use-editor-change-pm.js +152 -0
- package/dist/esm/editor-pm/use-editor-decorator-pm.d.ts +17 -0
- package/dist/esm/editor-pm/use-editor-decorator-pm.d.ts.map +1 -0
- package/dist/esm/editor-pm/use-editor-decorator-pm.js +57 -0
- package/dist/esm/editor-pm/use-editor-keydown-pm.d.ts +21 -0
- package/dist/esm/editor-pm/use-editor-keydown-pm.d.ts.map +1 -0
- package/dist/esm/editor-pm/use-editor-keydown-pm.js +79 -0
- package/dist/esm/editor-pm/use-mention-keydown.d.ts +11 -0
- package/dist/esm/editor-pm/use-mention-keydown.d.ts.map +1 -0
- package/dist/esm/editor-pm/use-mention-keydown.js +57 -0
- package/dist/esm/editor-pm/use-parameter-suggestions.d.ts +19 -0
- package/dist/esm/editor-pm/use-parameter-suggestions.d.ts.map +1 -0
- package/dist/esm/editor-pm/use-parameter-suggestions.js +66 -0
- package/dist/esm/editor-pm/use-parameter-suggestions.test.d.ts +2 -0
- package/dist/esm/editor-pm/use-parameter-suggestions.test.d.ts.map +1 -0
- package/dist/esm/editor-pm/use-parameter-suggestions.test.js +66 -0
- package/dist/esm/eye-dropper/index.d.ts +10 -0
- package/dist/esm/eye-dropper/index.d.ts.map +1 -0
- package/dist/esm/eye-dropper/index.js +23 -0
- package/dist/esm/function-info/helpers.d.ts +10 -0
- package/dist/esm/function-info/helpers.d.ts.map +1 -0
- package/dist/esm/function-info/helpers.js +20 -0
- package/dist/esm/function-info/index.d.ts +11 -0
- package/dist/esm/function-info/index.d.ts.map +1 -0
- package/dist/esm/function-info/index.js +68 -0
- package/dist/esm/function-info/style.d.ts +7 -0
- package/dist/esm/function-info/style.d.ts.map +1 -0
- package/dist/esm/function-info/style.js +10 -0
- package/dist/esm/hex-color-picker/index.d.ts +8 -0
- package/dist/esm/hex-color-picker/index.d.ts.map +1 -0
- package/dist/esm/hex-color-picker/index.js +44 -0
- package/dist/esm/hooks/use-cycle-reference.d.ts +16 -0
- package/dist/esm/hooks/use-cycle-reference.d.ts.map +1 -0
- package/dist/esm/hooks/use-cycle-reference.js +70 -0
- package/dist/esm/hooks/use-dropdown-categories.d.ts +9 -0
- package/dist/esm/hooks/use-dropdown-categories.d.ts.map +1 -0
- package/dist/esm/hooks/use-dropdown-categories.js +38 -0
- package/dist/esm/hooks/use-dropdown.d.ts +38 -0
- package/dist/esm/hooks/use-dropdown.d.ts.map +1 -0
- package/dist/esm/hooks/use-dropdown.js +236 -0
- package/dist/esm/hooks/use-isomorphic-layout-effect.ts.d.ts +6 -0
- package/dist/esm/hooks/use-isomorphic-layout-effect.ts.d.ts.map +1 -0
- package/dist/esm/hooks/use-isomorphic-layout-effect.ts.js +8 -0
- package/dist/esm/hooks/use-modal.d.ts +28 -0
- package/dist/esm/hooks/use-modal.d.ts.map +1 -0
- package/dist/esm/hooks/use-modal.js +93 -0
- package/dist/esm/hooks/use-visibility.d.ts +2 -0
- package/dist/esm/hooks/use-visibility.d.ts.map +1 -0
- package/dist/esm/hooks/use-visibility.js +12 -0
- package/dist/esm/icon-button/index.d.ts +15 -0
- package/dist/esm/icon-button/index.d.ts.map +1 -0
- package/dist/esm/icon-button/index.js +32 -0
- package/dist/esm/index.d.ts +34 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +33 -0
- package/dist/esm/input/index.d.ts +9 -0
- package/dist/esm/input/index.d.ts.map +1 -0
- package/dist/esm/input/index.js +7 -0
- package/dist/esm/popover/index.d.ts +13 -0
- package/dist/esm/popover/index.d.ts.map +1 -0
- package/dist/esm/popover/index.js +22 -0
- package/dist/esm/progress/index.d.ts +10 -0
- package/dist/esm/progress/index.d.ts.map +1 -0
- package/dist/esm/progress/index.js +12 -0
- package/dist/esm/select/index.d.ts +14 -0
- package/dist/esm/select/index.d.ts.map +1 -0
- package/dist/esm/select/index.js +30 -0
- package/dist/esm/separator/index.d.ts +5 -0
- package/dist/esm/separator/index.d.ts.map +1 -0
- package/dist/esm/separator/index.js +6 -0
- package/dist/esm/skeleton/index.d.ts +7 -0
- package/dist/esm/skeleton/index.d.ts.map +1 -0
- package/dist/esm/skeleton/index.js +9 -0
- package/dist/esm/stack/index.d.ts +11 -0
- package/dist/esm/stack/index.d.ts.map +1 -0
- package/dist/esm/stack/index.js +20 -0
- package/dist/esm/tabs/index.d.ts +8 -0
- package/dist/esm/tabs/index.d.ts.map +1 -0
- package/dist/esm/tabs/index.js +11 -0
- package/dist/esm/tooltip/index.d.ts +12 -0
- package/dist/esm/tooltip/index.d.ts.map +1 -0
- package/dist/esm/tooltip/index.js +13 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/esm/utils.d.ts +3 -0
- package/dist/esm/utils.d.ts.map +1 -0
- package/dist/esm/utils.js +5 -0
- package/dist/esm/vitest.config.d.ts +3 -0
- package/dist/esm/vitest.config.d.ts.map +1 -0
- package/dist/esm/vitest.config.js +21 -0
- package/package.json +78 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Schema } from "prosemirror-model";
|
|
2
|
+
export declare const schema: Schema<"text" | "line" | "mention" | "doc", "color" | "bold" | "fontFamily" | "fontSize" | "italic" | "strikethrough" | "underline" | "superscript" | "subscript">;
|
|
3
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../editor-pm/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,eAAO,MAAM,MAAM,oKAmLjB,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { Schema } from "prosemirror-model";
|
|
2
|
+
export const schema = new Schema({
|
|
3
|
+
nodes: {
|
|
4
|
+
doc: {
|
|
5
|
+
content: "line*",
|
|
6
|
+
},
|
|
7
|
+
line: {
|
|
8
|
+
content: "inline*",
|
|
9
|
+
toDOM() {
|
|
10
|
+
return ["div", 0];
|
|
11
|
+
},
|
|
12
|
+
parseDOM: [{ tag: "div" }],
|
|
13
|
+
},
|
|
14
|
+
text: {
|
|
15
|
+
group: "inline",
|
|
16
|
+
},
|
|
17
|
+
mention: {
|
|
18
|
+
group: "inline",
|
|
19
|
+
inline: true,
|
|
20
|
+
atom: true,
|
|
21
|
+
selectable: true,
|
|
22
|
+
draggable: false,
|
|
23
|
+
attrs: { label: {}, value: {} },
|
|
24
|
+
parseDOM: [
|
|
25
|
+
{
|
|
26
|
+
tag: "span[data-mention-value]",
|
|
27
|
+
getAttrs(dom) {
|
|
28
|
+
return {
|
|
29
|
+
value: dom.getAttribute("data-mention-value"),
|
|
30
|
+
label: dom.getAttribute("data-mention-label"),
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
tag: "span[data-mention]",
|
|
36
|
+
getAttrs(dom) {
|
|
37
|
+
const text = dom.textContent || "";
|
|
38
|
+
const match = text.match(/@(.+)/);
|
|
39
|
+
return match
|
|
40
|
+
? {
|
|
41
|
+
label: match[1],
|
|
42
|
+
value: match[1],
|
|
43
|
+
}
|
|
44
|
+
: false;
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
toDOM(node) {
|
|
49
|
+
return [
|
|
50
|
+
"span",
|
|
51
|
+
{
|
|
52
|
+
"data-mention-value": node.attrs.value,
|
|
53
|
+
"data-mention-label": node.attrs.label,
|
|
54
|
+
},
|
|
55
|
+
`@[${node.attrs.label}](${node.attrs.value})`,
|
|
56
|
+
];
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
marks: {
|
|
61
|
+
bold: {
|
|
62
|
+
toDOM() {
|
|
63
|
+
return ["strong", 0];
|
|
64
|
+
},
|
|
65
|
+
parseDOM: [
|
|
66
|
+
{ tag: "strong" },
|
|
67
|
+
{ tag: "b" },
|
|
68
|
+
{
|
|
69
|
+
style: "font-weight",
|
|
70
|
+
getAttrs: (value) => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
italic: {
|
|
75
|
+
toDOM() {
|
|
76
|
+
return ["em", 0];
|
|
77
|
+
},
|
|
78
|
+
parseDOM: [
|
|
79
|
+
{ tag: "em" },
|
|
80
|
+
{ tag: "i" },
|
|
81
|
+
{ style: "font-style=italic" },
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
underline: {
|
|
85
|
+
toDOM() {
|
|
86
|
+
return ["u", 0];
|
|
87
|
+
},
|
|
88
|
+
parseDOM: [
|
|
89
|
+
{ tag: "u" },
|
|
90
|
+
{
|
|
91
|
+
style: "text-decoration",
|
|
92
|
+
getAttrs: (value) => /^(underline)$/.test(String(value)) ? null : false,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
strikethrough: {
|
|
97
|
+
toDOM() {
|
|
98
|
+
return ["s", 0];
|
|
99
|
+
},
|
|
100
|
+
parseDOM: [
|
|
101
|
+
{ tag: "s" },
|
|
102
|
+
{ tag: "del" },
|
|
103
|
+
{ tag: "strike" },
|
|
104
|
+
{
|
|
105
|
+
style: "text-decoration",
|
|
106
|
+
getAttrs: (value) => /^(line-through)$/.test(String(value)) ? null : false,
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
// Superscript / subscript are mutually exclusive (a glyph can't be
|
|
111
|
+
// both), so each mark excludes the other in addition to itself —
|
|
112
|
+
// note `excludes` REPLACES ProseMirror's default self-exclusion,
|
|
113
|
+
// which is why the mark's own name is listed too.
|
|
114
|
+
superscript: {
|
|
115
|
+
excludes: "superscript subscript",
|
|
116
|
+
toDOM() {
|
|
117
|
+
return ["sup", 0];
|
|
118
|
+
},
|
|
119
|
+
parseDOM: [{ tag: "sup" }, { style: "vertical-align=super" }],
|
|
120
|
+
},
|
|
121
|
+
subscript: {
|
|
122
|
+
excludes: "subscript superscript",
|
|
123
|
+
toDOM() {
|
|
124
|
+
return ["sub", 0];
|
|
125
|
+
},
|
|
126
|
+
parseDOM: [{ tag: "sub" }, { style: "vertical-align=sub" }],
|
|
127
|
+
},
|
|
128
|
+
color: {
|
|
129
|
+
attrs: { color: {} },
|
|
130
|
+
toDOM(mark) {
|
|
131
|
+
return ["span", { style: `color: ${mark.attrs.color}` }, 0];
|
|
132
|
+
},
|
|
133
|
+
parseDOM: [
|
|
134
|
+
{
|
|
135
|
+
tag: "span[style*=color]",
|
|
136
|
+
getAttrs(dom) {
|
|
137
|
+
const style = dom.getAttribute("style");
|
|
138
|
+
const match = style.match(/color:\s*([^;]+)/);
|
|
139
|
+
return match ? { color: match[1] } : false;
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
// Per-run font size, in points (the `TextFormat.fontSize` unit). Carried
|
|
145
|
+
// as a mark so xlsx-imported size runs survive an edit and so the toolbar
|
|
146
|
+
// font-size control can format a selection inside the cell editor.
|
|
147
|
+
fontSize: {
|
|
148
|
+
attrs: { size: {} },
|
|
149
|
+
toDOM(mark) {
|
|
150
|
+
return ["span", { style: `font-size: ${mark.attrs.size}pt` }, 0];
|
|
151
|
+
},
|
|
152
|
+
parseDOM: [
|
|
153
|
+
{
|
|
154
|
+
style: "font-size",
|
|
155
|
+
getAttrs: (value) => {
|
|
156
|
+
const match = /^([\d.]+)pt$/.exec(String(value).trim());
|
|
157
|
+
return match ? { size: Number(match[1]) } : false;
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
},
|
|
162
|
+
// Per-run font family (`TextFormat.fontFamily`).
|
|
163
|
+
fontFamily: {
|
|
164
|
+
attrs: { family: {} },
|
|
165
|
+
toDOM(mark) {
|
|
166
|
+
return ["span", { style: `font-family: ${mark.attrs.family}` }, 0];
|
|
167
|
+
},
|
|
168
|
+
parseDOM: [
|
|
169
|
+
{
|
|
170
|
+
style: "font-family",
|
|
171
|
+
getAttrs: (value) => {
|
|
172
|
+
const family = String(value).replace(/["']/g, "").trim();
|
|
173
|
+
return family ? { family } : false;
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { TextFormatRun, Mention } from "@rowsncolumns/common-types";
|
|
2
|
+
export type OptionItem = {
|
|
3
|
+
title: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
category?: OptionCategory;
|
|
6
|
+
};
|
|
7
|
+
export type OptionCategory = "table" | "function" | "column" | "namedrange" | "thisrow" | "specialitem" | "property" | "parameter";
|
|
8
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../editor-pm/types.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAEzE,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,cAAc,GACtB,OAAO,GACP,UAAU,GACV,QAAQ,GACR,YAAY,GACZ,SAAS,GACT,aAAa,GACb,UAAU,GACV,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Plugin, PluginKey } from "prosemirror-state";
|
|
2
|
+
/**
|
|
3
|
+
* Plugin state: `true` while the editor DOM is blurred.
|
|
4
|
+
*/
|
|
5
|
+
export declare const unfocusedSelectionPluginKey: PluginKey<boolean>;
|
|
6
|
+
export declare const UNFOCUSED_SELECTION_CLASS = "rnc-pm-unfocused-selection";
|
|
7
|
+
/**
|
|
8
|
+
* Keeps the user's text selection visibly painted while the editor does not
|
|
9
|
+
* own DOM focus.
|
|
10
|
+
*
|
|
11
|
+
* Browsers only paint the native selection of a contenteditable while it is
|
|
12
|
+
* focused, so interacting with a control that must take focus (the toolbar's
|
|
13
|
+
* font-size input, a dropdown search field, a color picker) makes the
|
|
14
|
+
* selection *appear* to vanish even though ProseMirror's state still holds
|
|
15
|
+
* it. This plugin mirrors that kept selection as an inline decoration while
|
|
16
|
+
* the view is blurred and removes it as soon as focus returns — the standard
|
|
17
|
+
* "fake selection" approach rich-text editors use for toolbar interop.
|
|
18
|
+
*
|
|
19
|
+
* The decoration uses the `Highlight` CSS system color so it matches the
|
|
20
|
+
* platform's native selection paint without any stylesheet wiring; the
|
|
21
|
+
* `rnc-pm-unfocused-selection` class is attached for hosts that want to
|
|
22
|
+
* restyle it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createUnfocusedSelectionPlugin(): Plugin<boolean>;
|
|
25
|
+
//# sourceMappingURL=unfocused-selection-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unfocused-selection-plugin.d.ts","sourceRoot":"","sources":["../../../editor-pm/unfocused-selection-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGtD;;GAEG;AACH,eAAO,MAAM,2BAA2B,oBAEvC,CAAC;AAEF,eAAO,MAAM,yBAAyB,+BAA+B,CAAC;AAEtE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,8BAA8B,oBA0C7C"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Plugin, PluginKey } from "prosemirror-state";
|
|
2
|
+
import { Decoration, DecorationSet } from "prosemirror-view";
|
|
3
|
+
/**
|
|
4
|
+
* Plugin state: `true` while the editor DOM is blurred.
|
|
5
|
+
*/
|
|
6
|
+
export const unfocusedSelectionPluginKey = new PluginKey("unfocusedSelection");
|
|
7
|
+
export const UNFOCUSED_SELECTION_CLASS = "rnc-pm-unfocused-selection";
|
|
8
|
+
/**
|
|
9
|
+
* Keeps the user's text selection visibly painted while the editor does not
|
|
10
|
+
* own DOM focus.
|
|
11
|
+
*
|
|
12
|
+
* Browsers only paint the native selection of a contenteditable while it is
|
|
13
|
+
* focused, so interacting with a control that must take focus (the toolbar's
|
|
14
|
+
* font-size input, a dropdown search field, a color picker) makes the
|
|
15
|
+
* selection *appear* to vanish even though ProseMirror's state still holds
|
|
16
|
+
* it. This plugin mirrors that kept selection as an inline decoration while
|
|
17
|
+
* the view is blurred and removes it as soon as focus returns — the standard
|
|
18
|
+
* "fake selection" approach rich-text editors use for toolbar interop.
|
|
19
|
+
*
|
|
20
|
+
* The decoration uses the `Highlight` CSS system color so it matches the
|
|
21
|
+
* platform's native selection paint without any stylesheet wiring; the
|
|
22
|
+
* `rnc-pm-unfocused-selection` class is attached for hosts that want to
|
|
23
|
+
* restyle it.
|
|
24
|
+
*/
|
|
25
|
+
export function createUnfocusedSelectionPlugin() {
|
|
26
|
+
return new Plugin({
|
|
27
|
+
key: unfocusedSelectionPluginKey,
|
|
28
|
+
state: {
|
|
29
|
+
init: () => false,
|
|
30
|
+
apply(tr, blurred) {
|
|
31
|
+
const meta = tr.getMeta(unfocusedSelectionPluginKey);
|
|
32
|
+
return meta === undefined ? blurred : meta;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
props: {
|
|
36
|
+
handleDOMEvents: {
|
|
37
|
+
blur(view) {
|
|
38
|
+
view.dispatch(view.state.tr.setMeta(unfocusedSelectionPluginKey, true));
|
|
39
|
+
return false;
|
|
40
|
+
},
|
|
41
|
+
focus(view) {
|
|
42
|
+
view.dispatch(view.state.tr.setMeta(unfocusedSelectionPluginKey, false));
|
|
43
|
+
return false;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
decorations(state) {
|
|
47
|
+
const blurred = unfocusedSelectionPluginKey.getState(state);
|
|
48
|
+
const { from, to, empty } = state.selection;
|
|
49
|
+
if (!blurred || empty) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return DecorationSet.create(state.doc, [
|
|
53
|
+
Decoration.inline(from, to, {
|
|
54
|
+
class: UNFOCUSED_SELECTION_CLASS,
|
|
55
|
+
style: "background-color: Highlight;",
|
|
56
|
+
}),
|
|
57
|
+
]);
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ParsedToken } from "@rowsncolumns/calculator";
|
|
2
|
+
import { EditorView } from "prosemirror-view";
|
|
3
|
+
import { OptionItem, TextFormatRun } from "./types";
|
|
4
|
+
type InputProps = {
|
|
5
|
+
itemToString(value: OptionItem): string;
|
|
6
|
+
formulaMode?: boolean;
|
|
7
|
+
getView(): EditorView | null;
|
|
8
|
+
onSubmit?(value: string, textFormatRuns?: TextFormatRun[] | null): void;
|
|
9
|
+
suggestionToken: ParsedToken | undefined;
|
|
10
|
+
activeToken: ParsedToken | undefined;
|
|
11
|
+
propertyToken?: ParsedToken | undefined;
|
|
12
|
+
parameterRange?: {
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
} | undefined;
|
|
16
|
+
previousToken?: ParsedToken | undefined;
|
|
17
|
+
};
|
|
18
|
+
export declare const getUnterminatedStringRange: (token: ParsedToken | undefined, docSize: number, fallbackEnd: number) => {
|
|
19
|
+
from: number;
|
|
20
|
+
to: number;
|
|
21
|
+
} | null;
|
|
22
|
+
export declare const useDropdownChangePM: ({ itemToString, formulaMode, getView, onSubmit, suggestionToken, activeToken, propertyToken, parameterRange, previousToken, }: InputProps) => (item: OptionItem) => void;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=use-dropdown-change-pm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-dropdown-change-pm.d.ts","sourceRoot":"","sources":["../../../editor-pm/use-dropdown-change-pm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGpD,KAAK,UAAU,GAAG;IAChB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,IAAI,UAAU,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,aAAa,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IACxE,eAAe,EAAE,WAAW,GAAG,SAAS,CAAC;IACzC,WAAW,EAAE,WAAW,GAAG,SAAS,CAAC;IACrC,aAAa,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACxC,cAAc,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IAC5D,aAAa,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,OAAO,WAAW,GAAG,SAAS,EAC9B,SAAS,MAAM,EACf,aAAa,MAAM;;;QAkBpB,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,+HAUjC,UAAU,YAEF,UAAU,SAsJpB,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { TextSelection } from "prosemirror-state";
|
|
3
|
+
import { tokenVocabulary } from "@rowsncolumns/fast-formula-parser";
|
|
4
|
+
import { extractTextFormatRuns, getPropertyStartIndex } from "./helpers";
|
|
5
|
+
export const getUnterminatedStringRange = (token, docSize, fallbackEnd) => {
|
|
6
|
+
if (!token ||
|
|
7
|
+
token.tokenType?.name !== tokenVocabulary.UnterminatedStringStart.name) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const tokenLength = token.image?.length ?? 0;
|
|
11
|
+
const fallbackStart = fallbackEnd - tokenLength;
|
|
12
|
+
const startOffset = token.startOffset !== undefined ? token.startOffset : fallbackStart - 1;
|
|
13
|
+
const start = Math.max(0, Math.min(startOffset + 1, docSize));
|
|
14
|
+
const end = Math.max(start, Math.min(start + tokenLength, docSize));
|
|
15
|
+
if (end <= start) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return { from: start, to: end };
|
|
19
|
+
};
|
|
20
|
+
export const useDropdownChangePM = ({ itemToString, formulaMode, getView, onSubmit, suggestionToken, activeToken, propertyToken, parameterRange, previousToken, }) => {
|
|
21
|
+
return useCallback((item) => {
|
|
22
|
+
const category = item.category;
|
|
23
|
+
const value = itemToString(item);
|
|
24
|
+
const view = getView();
|
|
25
|
+
if (formulaMode && view) {
|
|
26
|
+
const { state } = view;
|
|
27
|
+
const { tr } = state;
|
|
28
|
+
const { selection } = state;
|
|
29
|
+
let insertPos = selection.from;
|
|
30
|
+
if (category === "parameter" && parameterRange) {
|
|
31
|
+
const from = Math.max(0, Math.min(parameterRange.start, state.doc.content.size));
|
|
32
|
+
const to = Math.max(from, Math.min(parameterRange.end, state.doc.content.size));
|
|
33
|
+
tr.delete(from, to);
|
|
34
|
+
tr.insertText(value, from);
|
|
35
|
+
const newCursorPos = from + value.length;
|
|
36
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(newCursorPos)));
|
|
37
|
+
view.dispatch(tr);
|
|
38
|
+
view.focus();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const deleteUnterminatedToken = (tokenToDelete, fallbackEnd) => {
|
|
42
|
+
const range = getUnterminatedStringRange(tokenToDelete, state.doc.content.size, fallbackEnd ?? insertPos);
|
|
43
|
+
if (range) {
|
|
44
|
+
tr.delete(range.from, range.to);
|
|
45
|
+
insertPos = range.from;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
// // If we have a suggestion token, delete it and update insert position
|
|
49
|
+
if (suggestionToken) {
|
|
50
|
+
let from = suggestionToken.startOffset + 1;
|
|
51
|
+
let to = suggestionToken.startOffset +
|
|
52
|
+
(suggestionToken.image?.length ?? 0) +
|
|
53
|
+
1;
|
|
54
|
+
if (category === "property") {
|
|
55
|
+
const baseToken = propertyToken ||
|
|
56
|
+
suggestionToken.basePropertyToken ||
|
|
57
|
+
suggestionToken;
|
|
58
|
+
if (baseToken?.image) {
|
|
59
|
+
const dotIndex = getPropertyStartIndex(baseToken);
|
|
60
|
+
if (dotIndex !== -1) {
|
|
61
|
+
const baseStart = (baseToken.startOffset ?? 0) + 1;
|
|
62
|
+
from = baseStart + dotIndex;
|
|
63
|
+
const tokenEnd = baseStart + baseToken.image.length;
|
|
64
|
+
to = tokenEnd;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
let handled = false;
|
|
69
|
+
if (from <= to && to <= state.doc.content.size) {
|
|
70
|
+
tr.delete(from, to);
|
|
71
|
+
insertPos = from;
|
|
72
|
+
handled = true;
|
|
73
|
+
}
|
|
74
|
+
if (!handled) {
|
|
75
|
+
deleteUnterminatedToken(suggestionToken);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
deleteUnterminatedToken(previousToken, insertPos);
|
|
79
|
+
let textToInsert = "";
|
|
80
|
+
switch (category) {
|
|
81
|
+
case "table": {
|
|
82
|
+
const prevChar = insertPos > 0
|
|
83
|
+
? state.doc.textBetween(insertPos - 1, insertPos)
|
|
84
|
+
: "";
|
|
85
|
+
const nextChar = state.doc.textBetween(insertPos, insertPos + 1);
|
|
86
|
+
textToInsert = value + "[";
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
case "column": {
|
|
90
|
+
const prevChar = insertPos > 0
|
|
91
|
+
? state.doc.textBetween(insertPos - 1, insertPos)
|
|
92
|
+
: "";
|
|
93
|
+
const nextChar = state.doc.textBetween(insertPos, insertPos + 1);
|
|
94
|
+
const prefix = prevChar === "[" || prevChar === "@" ? "" : "[";
|
|
95
|
+
const suffix = nextChar === "]" ? "" : "]";
|
|
96
|
+
textToInsert = prefix + value + suffix;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
case "thisrow":
|
|
100
|
+
textToInsert = "@";
|
|
101
|
+
break;
|
|
102
|
+
case "namedrange":
|
|
103
|
+
case "specialitem":
|
|
104
|
+
case "parameter":
|
|
105
|
+
textToInsert = value;
|
|
106
|
+
break;
|
|
107
|
+
case "property":
|
|
108
|
+
textToInsert = "." + value;
|
|
109
|
+
break;
|
|
110
|
+
case "function":
|
|
111
|
+
default:
|
|
112
|
+
textToInsert = value + "(";
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
// Insert the text and move cursor to the end
|
|
116
|
+
tr.insertText(textToInsert, insertPos);
|
|
117
|
+
const newCursorPos = insertPos + textToInsert.length;
|
|
118
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(newCursorPos)));
|
|
119
|
+
view.dispatch(tr);
|
|
120
|
+
view.focus();
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
const textFormatRuns = extractTextFormatRuns(view?.state.doc);
|
|
124
|
+
onSubmit?.(value, textFormatRuns);
|
|
125
|
+
}
|
|
126
|
+
}, [
|
|
127
|
+
onSubmit,
|
|
128
|
+
formulaMode,
|
|
129
|
+
getView,
|
|
130
|
+
itemToString,
|
|
131
|
+
suggestionToken,
|
|
132
|
+
activeToken,
|
|
133
|
+
propertyToken,
|
|
134
|
+
parameterRange,
|
|
135
|
+
previousToken,
|
|
136
|
+
]);
|
|
137
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ParsedToken } from "@rowsncolumns/calculator";
|
|
2
|
+
import { EditorState } from "prosemirror-state";
|
|
3
|
+
import { EditorView } from "prosemirror-view";
|
|
4
|
+
import type { ProseMirrorEditorProps } from "./prosemirror-editor";
|
|
5
|
+
import { TextFormatRun } from "./types";
|
|
6
|
+
type UseEditorOnChangePMProps = {
|
|
7
|
+
onChange(value: string, textFormatRuns?: TextFormatRun[] | null): void;
|
|
8
|
+
getView(): EditorView | null;
|
|
9
|
+
isActive?: boolean;
|
|
10
|
+
enableContinuousSelection?: boolean;
|
|
11
|
+
onChangeCursor(position: number | undefined): void;
|
|
12
|
+
onChangeActiveToken(token: ParsedToken | undefined): void;
|
|
13
|
+
tokenizer(value: string): ParsedToken[];
|
|
14
|
+
onFormulaStateChange: ProseMirrorEditorProps["onFormulaStateChange"];
|
|
15
|
+
onSuggestionTokenChange(token: ParsedToken | undefined): void;
|
|
16
|
+
onTableTokenChange(token: ParsedToken | undefined): void;
|
|
17
|
+
onChangeFunctionToken(token: ParsedToken | undefined): void;
|
|
18
|
+
onChangeParameterIndex(index: number): void;
|
|
19
|
+
onChangeIsEdgeOfCell(isEdgeOfCell: boolean): void;
|
|
20
|
+
onCellPropertyTokenChange(token: ParsedToken | undefined): void;
|
|
21
|
+
onChangeFunctionParameters?(params: string[], ranges: {
|
|
22
|
+
start: number;
|
|
23
|
+
end: number;
|
|
24
|
+
}[]): void;
|
|
25
|
+
onChangePreviousToken(token: ParsedToken | undefined): void;
|
|
26
|
+
};
|
|
27
|
+
export declare const useEditorOnChangePM: ({ onChange, getView, isActive, enableContinuousSelection, tokenizer, onChangeCursor, onChangeActiveToken, onFormulaStateChange, onSuggestionTokenChange, onTableTokenChange, onChangeFunctionToken, onChangeParameterIndex, onCellPropertyTokenChange, onChangeFunctionParameters, onChangeIsEdgeOfCell, onChangePreviousToken, }: UseEditorOnChangePMProps) => (newState: EditorState) => void;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=use-editor-change-pm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-editor-change-pm.d.ts","sourceRoot":"","sources":["../../../editor-pm/use-editor-change-pm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG7E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAuBnE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,aAAa,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IACvE,OAAO,IAAI,UAAU,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACnD,mBAAmB,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC;IAC1D,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,CAAC;IACxC,oBAAoB,EAAE,sBAAsB,CAAC,sBAAsB,CAAC,CAAC;IACrE,uBAAuB,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC;IAC9D,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC;IACzD,qBAAqB,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC;IAC5D,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,oBAAoB,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI,CAAC;IAClD,yBAAyB,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC;IAChE,0BAA0B,CAAC,CACzB,MAAM,EAAE,MAAM,EAAE,EAChB,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,GACvC,IAAI,CAAC;IACR,qBAAqB,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAAC;CAC7D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,mUAiBjC,wBAAwB,gBAWV,WAAW,SA6M3B,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { tokenVocabulary } from "@rowsncolumns/calculator";
|
|
2
|
+
import { isAFormula } from "@rowsncolumns/utils";
|
|
3
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
4
|
+
import { enableCellSelection, extractTextFormatRuns, getActiveFunctionToken, getActiveSelectionIndex, getActiveSuggestionToken, getActiveTableToken, getActiveToken, getCursorPosition, getFunctionParameters, getParameterIndex, getTokenizationContent, getPreviousToken, hasPropertyReference, isCellToken, isNamedRangeToken, isTableColumnToken, isTableNameToken, resolveCellPropertyToken, serializeEditorValue, } from "./helpers";
|
|
5
|
+
import { useCallbackRef } from "@rowsncolumns/grid";
|
|
6
|
+
import { CELL_SUGGESTION_PREFIX } from "../editor/constants";
|
|
7
|
+
export const useEditorOnChangePM = ({ onChange, getView, isActive, enableContinuousSelection, tokenizer, onChangeCursor, onChangeActiveToken, onFormulaStateChange, onSuggestionTokenChange, onTableTokenChange, onChangeFunctionToken, onChangeParameterIndex, onCellPropertyTokenChange, onChangeFunctionParameters, onChangeIsEdgeOfCell, onChangePreviousToken, }) => {
|
|
8
|
+
const lastSeenCursorTokenRef = useRef(undefined);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!isActive) {
|
|
11
|
+
lastSeenCursorTokenRef.current = undefined;
|
|
12
|
+
}
|
|
13
|
+
}, [isActive]);
|
|
14
|
+
return useCallbackRef(useCallback((newState) => {
|
|
15
|
+
const newValue = serializeEditorValue(newState.doc);
|
|
16
|
+
const isFormula = isAFormula(newValue);
|
|
17
|
+
const textFormatRuns = isFormula
|
|
18
|
+
? undefined
|
|
19
|
+
: extractTextFormatRuns(newState.doc);
|
|
20
|
+
// Callback
|
|
21
|
+
onChange(newValue, textFormatRuns);
|
|
22
|
+
// Formula mode
|
|
23
|
+
const view = getView();
|
|
24
|
+
// Set cursor tokens
|
|
25
|
+
if (isFormula && isActive && view) {
|
|
26
|
+
const cursorPos = getCursorPosition(newState);
|
|
27
|
+
if (cursorPos === undefined) {
|
|
28
|
+
lastSeenCursorTokenRef.current = undefined;
|
|
29
|
+
onChangeCursor(undefined);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// Get content for tokenization - handle both single and multi-line scenarios
|
|
33
|
+
const { line, offsetInLine } = getTokenizationContent(newState, cursorPos);
|
|
34
|
+
const tokens = tokenizer(line);
|
|
35
|
+
const activeToken = getActiveToken(offsetInLine, tokens);
|
|
36
|
+
const previousToken = getPreviousToken(offsetInLine, tokens);
|
|
37
|
+
const isEdge = activeToken?.endColumn === offsetInLine;
|
|
38
|
+
const isCell = activeToken
|
|
39
|
+
? isCellToken(activeToken) ||
|
|
40
|
+
isTableColumnToken(activeToken) ||
|
|
41
|
+
isTableNameToken(activeToken)
|
|
42
|
+
: false;
|
|
43
|
+
const isNamedRange = activeToken
|
|
44
|
+
? isNamedRangeToken(activeToken)
|
|
45
|
+
: false;
|
|
46
|
+
const isEdgeOfCell = isEdge &&
|
|
47
|
+
((isCell && !hasPropertyReference(activeToken)) || isNamedRange);
|
|
48
|
+
let canSelectCells = Boolean(enableCellSelection(offsetInLine, cursorPos, tokens));
|
|
49
|
+
const selectionIndex = getActiveSelectionIndex(activeToken);
|
|
50
|
+
const suggestionToken = getActiveSuggestionToken(offsetInLine, activeToken, view);
|
|
51
|
+
const tableToken = getActiveTableToken(offsetInLine, activeToken, tokens, view, isEdge);
|
|
52
|
+
const tokenForFunction = activeToken ?? previousToken;
|
|
53
|
+
const functionToken = getActiveFunctionToken(tokenForFunction, tokens);
|
|
54
|
+
// Check for cell property token - we want to show suggestions when user types "A1."
|
|
55
|
+
let cellPropertyToken = resolveCellPropertyToken(activeToken, tokens);
|
|
56
|
+
if (!cellPropertyToken && suggestionToken) {
|
|
57
|
+
const basePropertyToken = suggestionToken.basePropertyToken;
|
|
58
|
+
if (basePropertyToken) {
|
|
59
|
+
cellPropertyToken = basePropertyToken;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const isPropertyContext = Boolean(cellPropertyToken);
|
|
63
|
+
if (isPropertyContext) {
|
|
64
|
+
canSelectCells = false;
|
|
65
|
+
}
|
|
66
|
+
if (canSelectCells) {
|
|
67
|
+
lastSeenCursorTokenRef.current = cursorPos;
|
|
68
|
+
}
|
|
69
|
+
const charBeforeCursor = offsetInLine > 0 ? line[offsetInLine - 1] : "";
|
|
70
|
+
const isSpaceTerminator = charBeforeCursor === " " &&
|
|
71
|
+
!CELL_SUGGESTION_PREFIX.includes(previousToken?.tokenType?.name ?? "");
|
|
72
|
+
if (isSpaceTerminator) {
|
|
73
|
+
lastSeenCursorTokenRef.current = undefined;
|
|
74
|
+
}
|
|
75
|
+
const lastSeenCursorPos = lastSeenCursorTokenRef.current;
|
|
76
|
+
const isLiteralToken = activeToken?.tokenType?.name === tokenVocabulary.String.name ||
|
|
77
|
+
activeToken?.tokenType?.name ===
|
|
78
|
+
tokenVocabulary.UnterminatedStringStart.name ||
|
|
79
|
+
activeToken?.tokenType?.name === tokenVocabulary.Number.name ||
|
|
80
|
+
activeToken?.tokenType?.name === tokenVocabulary.Boolean.name;
|
|
81
|
+
const isContinuation = enableContinuousSelection
|
|
82
|
+
? canSelectCells || isEdgeOfCell
|
|
83
|
+
: !isPropertyContext &&
|
|
84
|
+
!isLiteralToken &&
|
|
85
|
+
lastSeenCursorPos !== undefined &&
|
|
86
|
+
cursorPos >= lastSeenCursorPos;
|
|
87
|
+
if (isLiteralToken || (!canSelectCells && !isContinuation)) {
|
|
88
|
+
lastSeenCursorTokenRef.current = undefined;
|
|
89
|
+
}
|
|
90
|
+
// Get function parameters
|
|
91
|
+
const parameterIndex = getParameterIndex(tokenForFunction, functionToken, tokens);
|
|
92
|
+
const { parameters, ranges } = getFunctionParameters(line, functionToken);
|
|
93
|
+
// Cursor position to show cell suggestion
|
|
94
|
+
onChangeCursor(canSelectCells ? cursorPos : undefined);
|
|
95
|
+
// Active token
|
|
96
|
+
onChangeActiveToken(activeToken);
|
|
97
|
+
onChangePreviousToken(previousToken);
|
|
98
|
+
onSuggestionTokenChange?.(suggestionToken);
|
|
99
|
+
// Table token change
|
|
100
|
+
onTableTokenChange?.(tableToken);
|
|
101
|
+
// Function token change
|
|
102
|
+
onChangeFunctionToken?.(functionToken);
|
|
103
|
+
// Cell property token change
|
|
104
|
+
onCellPropertyTokenChange?.(cellPropertyToken);
|
|
105
|
+
// On parameter index change
|
|
106
|
+
onChangeParameterIndex?.(parameterIndex);
|
|
107
|
+
onChangeFunctionParameters?.(parameters, ranges);
|
|
108
|
+
onChangeIsEdgeOfCell(isEdgeOfCell);
|
|
109
|
+
/**
|
|
110
|
+
* Users are able to select cells
|
|
111
|
+
* 1. When canUserSelect = true
|
|
112
|
+
*/
|
|
113
|
+
const finalCanSelectCells = !isPropertyContext && (canSelectCells || isContinuation);
|
|
114
|
+
const selectionMode = isPropertyContext || !canSelectCells ? "modify" : "append";
|
|
115
|
+
// Callback to update
|
|
116
|
+
onFormulaStateChange?.(finalCanSelectCells, selectionMode, selectionIndex);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
lastSeenCursorTokenRef.current = undefined;
|
|
120
|
+
// Function token change
|
|
121
|
+
onChangeFunctionToken?.(undefined);
|
|
122
|
+
onChangeFunctionParameters?.([], []);
|
|
123
|
+
// Set suggestion token
|
|
124
|
+
onSuggestionTokenChange({
|
|
125
|
+
image: newValue,
|
|
126
|
+
startColumn: 0,
|
|
127
|
+
startOffset: 0,
|
|
128
|
+
endColumn: 0,
|
|
129
|
+
endOffset: 0,
|
|
130
|
+
endLine: 0,
|
|
131
|
+
tokenType: { name: "Suggestion" },
|
|
132
|
+
tokenTypeIdx: 0,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}, [
|
|
136
|
+
onChange,
|
|
137
|
+
getView,
|
|
138
|
+
isActive,
|
|
139
|
+
enableContinuousSelection,
|
|
140
|
+
tokenizer,
|
|
141
|
+
onFormulaStateChange,
|
|
142
|
+
onChangeActiveToken,
|
|
143
|
+
onSuggestionTokenChange,
|
|
144
|
+
onChangeIsEdgeOfCell,
|
|
145
|
+
onChangeCursor,
|
|
146
|
+
onTableTokenChange,
|
|
147
|
+
onChangeFunctionToken,
|
|
148
|
+
onChangeParameterIndex,
|
|
149
|
+
onCellPropertyTokenChange,
|
|
150
|
+
onChangeFunctionParameters,
|
|
151
|
+
]));
|
|
152
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ParsedToken } from "@rowsncolumns/calculator";
|
|
2
|
+
import { EditorState } from "prosemirror-state";
|
|
3
|
+
import { DecorationSet } from "prosemirror-view";
|
|
4
|
+
import { type LeafDecorator } from "./helpers";
|
|
5
|
+
export type DecoratorRange = LeafDecorator & {
|
|
6
|
+
from: number;
|
|
7
|
+
to: number;
|
|
8
|
+
};
|
|
9
|
+
type UseDecoratorPMProps = {
|
|
10
|
+
cursorPosition: number | undefined;
|
|
11
|
+
formulaMode?: boolean;
|
|
12
|
+
isActive?: boolean;
|
|
13
|
+
tokenizer(value: string): ParsedToken[];
|
|
14
|
+
};
|
|
15
|
+
export declare const useEditorDecoratorPM: ({ cursorPosition, formulaMode, tokenizer, isActive, }: UseDecoratorPMProps) => (state: EditorState) => DecorationSet;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=use-editor-decorator-pm.d.ts.map
|