@openreachtech/furo-vue 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +9 -0
- package/README.ja.md +334 -0
- package/README.md +333 -0
- package/index.js +11 -0
- package/lib/assets/css/furo/0010.variables-palette-color-scale.css +298 -0
- package/lib/assets/css/furo/0020.variables-z-index.css +10 -0
- package/lib/assets/css/furo/0030.variables-semantic-color.css +178 -0
- package/lib/assets/css/furo/0035.variables-semantic-dimension.css +104 -0
- package/lib/assets/css/furo/0040.variables-component-furo.css +28 -0
- package/lib/assets/css/furo/0050.furo-editor-content.css +22 -0
- package/lib/assets/css/furo.css +15 -0
- package/lib/components/atoms/FuroAvatar/FuroAvatar.vue +135 -0
- package/lib/components/atoms/FuroAvatar/FuroAvatarContext.js +147 -0
- package/lib/components/atoms/FuroBadge/FuroBadge.vue +240 -0
- package/lib/components/atoms/FuroBadge/FuroBadgeContext.js +298 -0
- package/lib/components/atoms/FuroButton/ButtonEmitPayload.js +44 -0
- package/lib/components/atoms/FuroButton/FuroButton.vue +301 -0
- package/lib/components/atoms/FuroButton/FuroButtonContext.js +328 -0
- package/lib/components/atoms/FuroCheckbox/CheckboxEmitPayload.js +106 -0
- package/lib/components/atoms/FuroCheckbox/FuroCheckbox.vue +173 -0
- package/lib/components/atoms/FuroCheckbox/FuroCheckboxContext.js +682 -0
- package/lib/components/atoms/FuroEmailField/EmailFieldEmitPayload.js +74 -0
- package/lib/components/atoms/FuroEmailField/FuroEmailField.vue +119 -0
- package/lib/components/atoms/FuroEmailField/FuroEmailFieldContext.js +311 -0
- package/lib/components/atoms/FuroFileField/FileFieldEmitPayload.js +80 -0
- package/lib/components/atoms/FuroFileField/FuroFileField.vue +128 -0
- package/lib/components/atoms/FuroFileField/FuroFileFieldContext.js +195 -0
- package/lib/components/atoms/FuroIcon/FuroIcon.vue +74 -0
- package/lib/components/atoms/FuroIcon/FuroIconContext.js +293 -0
- package/lib/components/atoms/FuroIcon/FuroIconRegistry.js +617 -0
- package/lib/components/atoms/FuroIcon/FuroIconifyRendererContext.js +101 -0
- package/lib/components/atoms/FuroIcon/furoIconData.js +164 -0
- package/lib/components/atoms/FuroIcon/iconRenderers.js +62 -0
- package/lib/components/atoms/FuroIcon/icons.js +7 -0
- package/lib/components/atoms/FuroNumberField/FuroNumberField.vue +213 -0
- package/lib/components/atoms/FuroNumberField/FuroNumberFieldContext.js +442 -0
- package/lib/components/atoms/FuroNumberField/NumberFieldEmitPayload.js +162 -0
- package/lib/components/atoms/FuroPasswordField/FuroPasswordField.vue +119 -0
- package/lib/components/atoms/FuroPasswordField/FuroPasswordFieldContext.js +311 -0
- package/lib/components/atoms/FuroPasswordField/PasswordFieldEmitPayload.js +74 -0
- package/lib/components/atoms/FuroRadio/FuroRadio.vue +193 -0
- package/lib/components/atoms/FuroRadio/FuroRadioContext.js +557 -0
- package/lib/components/atoms/FuroRadio/RadioEmitPayload.js +72 -0
- package/lib/components/atoms/FuroSwitch/FuroSwitch.vue +165 -0
- package/lib/components/atoms/FuroSwitch/FuroSwitchContext.js +440 -0
- package/lib/components/atoms/FuroSwitch/SwitchEmitPayload.js +86 -0
- package/lib/components/atoms/FuroTextField/FuroTextField.vue +119 -0
- package/lib/components/atoms/FuroTextField/FuroTextFieldContext.js +311 -0
- package/lib/components/atoms/FuroTextField/TextFieldEmitPayload.js +83 -0
- package/lib/components/atoms/FuroTextarea/FuroTextarea.vue +121 -0
- package/lib/components/atoms/FuroTextarea/FuroTextareaContext.js +322 -0
- package/lib/components/atoms/FuroTextarea/TextareaEmitPayload.js +83 -0
- package/lib/components/atoms/FuroToggle/FuroToggle.vue +172 -0
- package/lib/components/atoms/FuroToggle/FuroToggleContext.js +410 -0
- package/lib/components/atoms/FuroToggle/ToggleEmitPayload.js +86 -0
- package/lib/components/molecules/FuroAccordion/AccordionEmitPayload.js +80 -0
- package/lib/components/molecules/FuroAccordion/FuroAccordion.vue +219 -0
- package/lib/components/molecules/FuroAccordion/FuroAccordionContext.js +547 -0
- package/lib/components/molecules/FuroAttachment/FuroAttachment.vue +376 -0
- package/lib/components/molecules/FuroAttachment/FuroAttachmentContext.js +628 -0
- package/lib/components/molecules/FuroAutocompleteField/AutocompleteEmitPayload.js +225 -0
- package/lib/components/molecules/FuroAutocompleteField/FuroAutocompleteField.vue +669 -0
- package/lib/components/molecules/FuroAutocompleteField/FuroAutocompleteFieldContext.js +1525 -0
- package/lib/components/molecules/FuroAvatarGroup/FuroAvatarGroup.vue +126 -0
- package/lib/components/molecules/FuroAvatarGroup/FuroAvatarGroupContext.js +245 -0
- package/lib/components/molecules/FuroBreadcrumb/FuroBreadcrumb.vue +219 -0
- package/lib/components/molecules/FuroBreadcrumb/FuroBreadcrumbContext.js +257 -0
- package/lib/components/molecules/FuroCollapsible/CollapsibleEmitPayload.js +69 -0
- package/lib/components/molecules/FuroCollapsible/FuroCollapsible.vue +177 -0
- package/lib/components/molecules/FuroCollapsible/FuroCollapsibleContext.js +389 -0
- package/lib/components/molecules/FuroControlBlock/FuroControlBlock.vue +149 -0
- package/lib/components/molecules/FuroControlBlock/FuroControlBlockContext.js +81 -0
- package/lib/components/molecules/FuroDatePicker/DatePickerEmitPayload.js +74 -0
- package/lib/components/molecules/FuroDatePicker/FuroDatePicker.vue +661 -0
- package/lib/components/molecules/FuroDatePicker/FuroDatePickerContext.js +1038 -0
- package/lib/components/molecules/FuroDateTimePicker/DateTimePickerEmitPayload.js +96 -0
- package/lib/components/molecules/FuroDateTimePicker/FuroDateTimePicker.vue +153 -0
- package/lib/components/molecules/FuroDateTimePicker/FuroDateTimePickerContext.js +840 -0
- package/lib/components/molecules/FuroDropdownMenu/DropdownMenuOptionSelectEmitPayload.js +100 -0
- package/lib/components/molecules/FuroDropdownMenu/FuroDropdownMenu.vue +348 -0
- package/lib/components/molecules/FuroDropdownMenu/FuroDropdownMenuContext.js +714 -0
- package/lib/components/molecules/FuroDropdownMenu/FuroDropdownMenuOptionRows.vue +222 -0
- package/lib/components/molecules/FuroEditableField/EditableEmitPayload.js +89 -0
- package/lib/components/molecules/FuroEditableField/FuroEditableField.vue +314 -0
- package/lib/components/molecules/FuroEditableField/FuroEditableFieldContext.js +1018 -0
- package/lib/components/molecules/FuroEditableField/processors/EditorCollisionProcessor.js +236 -0
- package/lib/components/molecules/FuroEditableField/processors/ObjectProcessor.js +101 -0
- package/lib/components/molecules/FuroEmptyState/FuroEmptyState.vue +124 -0
- package/lib/components/molecules/FuroEmptyState/FuroEmptyStateContext.js +42 -0
- package/lib/components/molecules/FuroErrorState/FuroErrorState.vue +125 -0
- package/lib/components/molecules/FuroErrorState/FuroErrorStateContext.js +42 -0
- package/lib/components/molecules/FuroPagination/FuroPagination.vue +246 -0
- package/lib/components/molecules/FuroPagination/FuroPaginationContext.js +489 -0
- package/lib/components/molecules/FuroPopover/FuroPopover.vue +171 -0
- package/lib/components/molecules/FuroPopover/FuroPopoverContext.js +279 -0
- package/lib/components/molecules/FuroScrollArea/FuroScrollArea.vue +181 -0
- package/lib/components/molecules/FuroScrollArea/FuroScrollAreaContext.js +149 -0
- package/lib/components/molecules/FuroSearchField/FuroSearchField.vue +155 -0
- package/lib/components/molecules/FuroSearchField/FuroSearchFieldContext.js +231 -0
- package/lib/components/molecules/FuroSectionHeader/FuroSectionHeader.vue +140 -0
- package/lib/components/molecules/FuroSectionHeader/FuroSectionHeaderContext.js +204 -0
- package/lib/components/molecules/FuroSelect/FuroSelect.vue +474 -0
- package/lib/components/molecules/FuroSelect/FuroSelectContext.js +743 -0
- package/lib/components/molecules/FuroSelect/SelectEmitPayload.js +181 -0
- package/lib/components/molecules/FuroSeparator/FuroSeparator.vue +88 -0
- package/lib/components/molecules/FuroSeparator/FuroSeparatorContext.js +40 -0
- package/lib/components/molecules/FuroSkeleton/FuroSkeleton.vue +101 -0
- package/lib/components/molecules/FuroSkeleton/FuroSkeletonContext.js +82 -0
- package/lib/components/molecules/FuroSplitter/FuroSplitter.vue +237 -0
- package/lib/components/molecules/FuroSplitter/FuroSplitterContext.js +429 -0
- package/lib/components/molecules/FuroSplitter/SplitterEmitPayload.js +69 -0
- package/lib/components/molecules/FuroTimeField/FuroTimeField.vue +251 -0
- package/lib/components/molecules/FuroTimeField/FuroTimeFieldContext.js +1138 -0
- package/lib/components/molecules/FuroTimeField/TimeFieldEmitPayload.js +74 -0
- package/lib/components/molecules/FuroToggleGroup/FuroToggleGroup.vue +211 -0
- package/lib/components/molecules/FuroToggleGroup/FuroToggleGroupContext.js +551 -0
- package/lib/components/molecules/FuroToggleGroup/ToggleGroupEmitPayload.js +80 -0
- package/lib/components/molecules/FuroToolBar/FuroToolBar.vue +91 -0
- package/lib/components/molecules/FuroToolBar/FuroToolBarContext.js +75 -0
- package/lib/components/molecules/FuroTooltip/FuroTooltip.vue +183 -0
- package/lib/components/molecules/FuroTooltip/FuroTooltipContext.js +290 -0
- package/lib/components/organisms/FuroAlertDialog/FuroAlertDialog.vue +324 -0
- package/lib/components/organisms/FuroAlertDialog/FuroAlertDialogContext.js +608 -0
- package/lib/components/organisms/FuroDialog/FuroDialog.vue +362 -0
- package/lib/components/organisms/FuroDialog/FuroDialogContext.js +535 -0
- package/lib/components/organisms/FuroDrawer/FuroDrawer.vue +618 -0
- package/lib/components/organisms/FuroDrawer/FuroDrawerContext.js +676 -0
- package/lib/components/organisms/FuroEditor/FuroEditor.vue +613 -0
- package/lib/components/organisms/FuroEditor/FuroEditorCommandContext.js +420 -0
- package/lib/components/organisms/FuroEditor/FuroEditorContext.js +2048 -0
- package/lib/components/organisms/FuroEditor/FuroEditorMentionMenu.vue +120 -0
- package/lib/components/organisms/FuroEditor/FuroEditorMentionMenuContext.js +261 -0
- package/lib/components/organisms/FuroEditor/PreserveNewlinesPasteExtension.js +267 -0
- package/lib/components/organisms/FuroEditor/build-editor-extensions.js +97 -0
- package/lib/components/organisms/FuroEditor/mention-suggestion.js +320 -0
- package/lib/components/organisms/FuroEditor/paste-link-segments.js +124 -0
- package/lib/components/organisms/FuroSidebar/FuroSidebar.vue +473 -0
- package/lib/components/organisms/FuroSidebar/FuroSidebarContext.js +1014 -0
- package/lib/components/organisms/FuroStepper/FuroStepper.vue +345 -0
- package/lib/components/organisms/FuroStepper/FuroStepperContext.js +481 -0
- package/lib/components/organisms/FuroTable/FuroTable.vue +707 -0
- package/lib/components/organisms/FuroTable/FuroTableContext.js +1965 -0
- package/lib/components/organisms/FuroTable/FuroTableRowItemContext.js +111 -0
- package/lib/components/organisms/FuroTabs/FuroTabs.vue +403 -0
- package/lib/components/organisms/FuroTabs/FuroTabsContext.js +846 -0
- package/lib/components/organisms/FuroToast/FuroToast.vue +624 -0
- package/lib/components/organisms/FuroToast/FuroToastContext.js +1089 -0
- package/lib/components/organisms/FuroToast/FuroToaster.vue +44 -0
- package/lib/components/organisms/FuroToast/FuroToasterContext.js +113 -0
- package/lib/components/organisms/FuroToast/ToastQueue.js +325 -0
- package/lib/components/organisms/FuroToast/toast.js +64 -0
- package/lib/contexts/BaseFuroContext.js +318 -0
- package/lib/contexts/BaseFuroContextAccessor.js +47 -0
- package/lib/emit-payload/BaseEmitPayload.js +91 -0
- package/lib/index.components.js +61 -0
- package/lib/index.core.js +18 -0
- package/lib/tools/TimerClerk.js +75 -0
- package/nuxt/index.js +109 -0
- package/nuxt/runtime/furo-icon-renderer.js +24 -0
- package/package.json +137 -0
- package/public/furo-vue/components.json +4619 -0
- package/public/furo-vue/llms.txt +66 -0
- package/types/furo-nuxt.d.ts +48 -0
- package/types/generated/components/atoms/FuroAvatar/FuroAvatar.vue.d.ts +74 -0
- package/types/generated/components/atoms/FuroAvatar/FuroAvatarContext.d.ts +82 -0
- package/types/generated/components/atoms/FuroBadge/FuroBadge.vue.d.ts +12 -0
- package/types/generated/components/atoms/FuroBadge/FuroBadgeContext.d.ts +160 -0
- package/types/generated/components/atoms/FuroButton/ButtonEmitPayload.d.ts +19 -0
- package/types/generated/components/atoms/FuroButton/FuroButton.vue.d.ts +53 -0
- package/types/generated/components/atoms/FuroButton/FuroButtonContext.d.ts +156 -0
- package/types/generated/components/atoms/FuroCheckbox/CheckboxEmitPayload.d.ts +55 -0
- package/types/generated/components/atoms/FuroCheckbox/FuroCheckbox.vue.d.ts +87 -0
- package/types/generated/components/atoms/FuroCheckbox/FuroCheckboxContext.d.ts +342 -0
- package/types/generated/components/atoms/FuroEmailField/EmailFieldEmitPayload.d.ts +46 -0
- package/types/generated/components/atoms/FuroEmailField/FuroEmailField.vue.d.ts +458 -0
- package/types/generated/components/atoms/FuroEmailField/FuroEmailFieldContext.d.ts +161 -0
- package/types/generated/components/atoms/FuroFileField/FileFieldEmitPayload.d.ts +46 -0
- package/types/generated/components/atoms/FuroFileField/FuroFileField.vue.d.ts +454 -0
- package/types/generated/components/atoms/FuroFileField/FuroFileFieldContext.d.ts +109 -0
- package/types/generated/components/atoms/FuroIcon/FuroIcon.vue.d.ts +14 -0
- package/types/generated/components/atoms/FuroIcon/FuroIconContext.d.ts +152 -0
- package/types/generated/components/atoms/FuroIcon/FuroIconRegistry.d.ts +457 -0
- package/types/generated/components/atoms/FuroIcon/FuroIconifyRendererContext.d.ts +65 -0
- package/types/generated/components/atoms/FuroIcon/furoIconData.d.ts +154 -0
- package/types/generated/components/atoms/FuroIcon/iconRenderers.d.ts +6 -0
- package/types/generated/components/atoms/FuroIcon/icons.d.ts +6 -0
- package/types/generated/components/atoms/FuroNumberField/FuroNumberField.vue.d.ts +500 -0
- package/types/generated/components/atoms/FuroNumberField/FuroNumberFieldContext.d.ts +243 -0
- package/types/generated/components/atoms/FuroNumberField/NumberFieldEmitPayload.d.ts +74 -0
- package/types/generated/components/atoms/FuroPasswordField/FuroPasswordField.vue.d.ts +458 -0
- package/types/generated/components/atoms/FuroPasswordField/FuroPasswordFieldContext.d.ts +161 -0
- package/types/generated/components/atoms/FuroPasswordField/PasswordFieldEmitPayload.d.ts +46 -0
- package/types/generated/components/atoms/FuroRadio/FuroRadio.vue.d.ts +96 -0
- package/types/generated/components/atoms/FuroRadio/FuroRadioContext.d.ts +290 -0
- package/types/generated/components/atoms/FuroRadio/RadioEmitPayload.d.ts +39 -0
- package/types/generated/components/atoms/FuroSwitch/FuroSwitch.vue.d.ts +74 -0
- package/types/generated/components/atoms/FuroSwitch/FuroSwitchContext.d.ts +218 -0
- package/types/generated/components/atoms/FuroSwitch/SwitchEmitPayload.d.ts +42 -0
- package/types/generated/components/atoms/FuroTextField/FuroTextField.vue.d.ts +458 -0
- package/types/generated/components/atoms/FuroTextField/FuroTextFieldContext.d.ts +161 -0
- package/types/generated/components/atoms/FuroTextField/TextFieldEmitPayload.d.ts +52 -0
- package/types/generated/components/atoms/FuroTextarea/FuroTextarea.vue.d.ts +422 -0
- package/types/generated/components/atoms/FuroTextarea/FuroTextareaContext.d.ts +161 -0
- package/types/generated/components/atoms/FuroTextarea/TextareaEmitPayload.d.ts +52 -0
- package/types/generated/components/atoms/FuroToggle/FuroToggle.vue.d.ts +51 -0
- package/types/generated/components/atoms/FuroToggle/FuroToggleContext.d.ts +191 -0
- package/types/generated/components/atoms/FuroToggle/ToggleEmitPayload.d.ts +42 -0
- package/types/generated/components/molecules/FuroAccordion/AccordionEmitPayload.d.ts +41 -0
- package/types/generated/components/molecules/FuroAccordion/FuroAccordion.vue.d.ts +133 -0
- package/types/generated/components/molecules/FuroAccordion/FuroAccordionContext.d.ts +279 -0
- package/types/generated/components/molecules/FuroAttachment/FuroAttachment.vue.d.ts +79 -0
- package/types/generated/components/molecules/FuroAttachment/FuroAttachmentContext.d.ts +363 -0
- package/types/generated/components/molecules/FuroAutocompleteField/AutocompleteEmitPayload.d.ts +129 -0
- package/types/generated/components/molecules/FuroAutocompleteField/FuroAutocompleteField.vue.d.ts +751 -0
- package/types/generated/components/molecules/FuroAutocompleteField/FuroAutocompleteFieldContext.d.ts +722 -0
- package/types/generated/components/molecules/FuroAvatarGroup/FuroAvatarGroup.vue.d.ts +84 -0
- package/types/generated/components/molecules/FuroAvatarGroup/FuroAvatarGroupContext.d.ts +150 -0
- package/types/generated/components/molecules/FuroBreadcrumb/FuroBreadcrumb.vue.d.ts +24 -0
- package/types/generated/components/molecules/FuroBreadcrumb/FuroBreadcrumbContext.d.ts +152 -0
- package/types/generated/components/molecules/FuroCollapsible/CollapsibleEmitPayload.d.ts +36 -0
- package/types/generated/components/molecules/FuroCollapsible/FuroCollapsible.vue.d.ts +98 -0
- package/types/generated/components/molecules/FuroCollapsible/FuroCollapsibleContext.d.ts +191 -0
- package/types/generated/components/molecules/FuroControlBlock/FuroControlBlock.vue.d.ts +30 -0
- package/types/generated/components/molecules/FuroControlBlock/FuroControlBlockContext.d.ts +57 -0
- package/types/generated/components/molecules/FuroDatePicker/DatePickerEmitPayload.d.ts +41 -0
- package/types/generated/components/molecules/FuroDatePicker/FuroDatePicker.vue.d.ts +456 -0
- package/types/generated/components/molecules/FuroDatePicker/FuroDatePickerContext.d.ts +516 -0
- package/types/generated/components/molecules/FuroDateTimePicker/DateTimePickerEmitPayload.d.ts +55 -0
- package/types/generated/components/molecules/FuroDateTimePicker/FuroDateTimePicker.vue.d.ts +1365 -0
- package/types/generated/components/molecules/FuroDateTimePicker/FuroDateTimePickerContext.d.ts +435 -0
- package/types/generated/components/molecules/FuroDropdownMenu/DropdownMenuOptionSelectEmitPayload.d.ts +48 -0
- package/types/generated/components/molecules/FuroDropdownMenu/FuroDropdownMenu.vue.d.ts +773 -0
- package/types/generated/components/molecules/FuroDropdownMenu/FuroDropdownMenuContext.d.ts +380 -0
- package/types/generated/components/molecules/FuroDropdownMenu/FuroDropdownMenuOptionRows.vue.d.ts +261 -0
- package/types/generated/components/molecules/FuroEditableField/EditableEmitPayload.d.ts +39 -0
- package/types/generated/components/molecules/FuroEditableField/FuroEditableField.vue.d.ts +646 -0
- package/types/generated/components/molecules/FuroEditableField/FuroEditableFieldContext.d.ts +477 -0
- package/types/generated/components/molecules/FuroEditableField/processors/EditorCollisionProcessor.d.ts +121 -0
- package/types/generated/components/molecules/FuroEditableField/processors/ObjectProcessor.d.ts +45 -0
- package/types/generated/components/molecules/FuroEmptyState/FuroEmptyState.vue.d.ts +21 -0
- package/types/generated/components/molecules/FuroEmptyState/FuroEmptyStateContext.d.ts +32 -0
- package/types/generated/components/molecules/FuroErrorState/FuroErrorState.vue.d.ts +21 -0
- package/types/generated/components/molecules/FuroErrorState/FuroErrorStateContext.d.ts +32 -0
- package/types/generated/components/molecules/FuroPagination/FuroPagination.vue.d.ts +534 -0
- package/types/generated/components/molecules/FuroPagination/FuroPaginationContext.d.ts +271 -0
- package/types/generated/components/molecules/FuroPopover/FuroPopover.vue.d.ts +513 -0
- package/types/generated/components/molecules/FuroPopover/FuroPopoverContext.d.ts +160 -0
- package/types/generated/components/molecules/FuroScrollArea/FuroScrollArea.vue.d.ts +124 -0
- package/types/generated/components/molecules/FuroScrollArea/FuroScrollAreaContext.d.ts +86 -0
- package/types/generated/components/molecules/FuroSearchField/FuroSearchField.vue.d.ts +487 -0
- package/types/generated/components/molecules/FuroSearchField/FuroSearchFieldContext.d.ts +137 -0
- package/types/generated/components/molecules/FuroSectionHeader/FuroSectionHeader.vue.d.ts +49 -0
- package/types/generated/components/molecules/FuroSectionHeader/FuroSectionHeaderContext.d.ts +121 -0
- package/types/generated/components/molecules/FuroSelect/FuroSelect.vue.d.ts +719 -0
- package/types/generated/components/molecules/FuroSelect/FuroSelectContext.d.ts +402 -0
- package/types/generated/components/molecules/FuroSelect/SelectEmitPayload.d.ts +102 -0
- package/types/generated/components/molecules/FuroSeparator/FuroSeparator.vue.d.ts +39 -0
- package/types/generated/components/molecules/FuroSeparator/FuroSeparatorContext.d.ts +31 -0
- package/types/generated/components/molecules/FuroSkeleton/FuroSkeleton.vue.d.ts +27 -0
- package/types/generated/components/molecules/FuroSkeleton/FuroSkeletonContext.d.ts +61 -0
- package/types/generated/components/molecules/FuroSplitter/FuroSplitter.vue.d.ts +139 -0
- package/types/generated/components/molecules/FuroSplitter/FuroSplitterContext.d.ts +226 -0
- package/types/generated/components/molecules/FuroSplitter/SplitterEmitPayload.d.ts +41 -0
- package/types/generated/components/molecules/FuroTimeField/FuroTimeField.vue.d.ts +498 -0
- package/types/generated/components/molecules/FuroTimeField/FuroTimeFieldContext.d.ts +555 -0
- package/types/generated/components/molecules/FuroTimeField/TimeFieldEmitPayload.d.ts +41 -0
- package/types/generated/components/molecules/FuroToggleGroup/FuroToggleGroup.vue.d.ts +70 -0
- package/types/generated/components/molecules/FuroToggleGroup/FuroToggleGroupContext.d.ts +270 -0
- package/types/generated/components/molecules/FuroToggleGroup/ToggleGroupEmitPayload.d.ts +41 -0
- package/types/generated/components/molecules/FuroToolBar/FuroToolBar.vue.d.ts +30 -0
- package/types/generated/components/molecules/FuroToolBar/FuroToolBarContext.d.ts +48 -0
- package/types/generated/components/molecules/FuroTooltip/FuroTooltip.vue.d.ts +524 -0
- package/types/generated/components/molecules/FuroTooltip/FuroTooltipContext.d.ts +166 -0
- package/types/generated/components/organisms/FuroAlertDialog/FuroAlertDialog.vue.d.ts +651 -0
- package/types/generated/components/organisms/FuroAlertDialog/FuroAlertDialogContext.d.ts +299 -0
- package/types/generated/components/organisms/FuroDialog/FuroDialog.vue.d.ts +583 -0
- package/types/generated/components/organisms/FuroDialog/FuroDialogContext.d.ts +264 -0
- package/types/generated/components/organisms/FuroDrawer/FuroDrawer.vue.d.ts +635 -0
- package/types/generated/components/organisms/FuroDrawer/FuroDrawerContext.d.ts +347 -0
- package/types/generated/components/organisms/FuroEditor/FuroEditor.vue.d.ts +2487 -0
- package/types/generated/components/organisms/FuroEditor/FuroEditorCommandContext.d.ts +192 -0
- package/types/generated/components/organisms/FuroEditor/FuroEditorContext.d.ts +904 -0
- package/types/generated/components/organisms/FuroEditor/FuroEditorMentionMenu.vue.d.ts +43 -0
- package/types/generated/components/organisms/FuroEditor/FuroEditorMentionMenuContext.d.ts +159 -0
- package/types/generated/components/organisms/FuroEditor/PreserveNewlinesPasteExtension.d.ts +43 -0
- package/types/generated/components/organisms/FuroEditor/build-editor-extensions.d.ts +22 -0
- package/types/generated/components/organisms/FuroEditor/mention-suggestion.d.ts +25 -0
- package/types/generated/components/organisms/FuroEditor/paste-link-segments.d.ts +31 -0
- package/types/generated/components/organisms/FuroSidebar/FuroSidebar.vue.d.ts +898 -0
- package/types/generated/components/organisms/FuroSidebar/FuroSidebarContext.d.ts +596 -0
- package/types/generated/components/organisms/FuroStepper/FuroStepper.vue.d.ts +589 -0
- package/types/generated/components/organisms/FuroStepper/FuroStepperContext.d.ts +266 -0
- package/types/generated/components/organisms/FuroTable/FuroTable.vue.d.ts +528 -0
- package/types/generated/components/organisms/FuroTable/FuroTableContext.d.ts +1035 -0
- package/types/generated/components/organisms/FuroTable/FuroTableRowItemContext.d.ts +62 -0
- package/types/generated/components/organisms/FuroTabs/FuroTabs.vue.d.ts +515 -0
- package/types/generated/components/organisms/FuroTabs/FuroTabsContext.d.ts +438 -0
- package/types/generated/components/organisms/FuroToast/FuroToast.vue.d.ts +725 -0
- package/types/generated/components/organisms/FuroToast/FuroToastContext.d.ts +543 -0
- package/types/generated/components/organisms/FuroToast/FuroToaster.vue.d.ts +729 -0
- package/types/generated/components/organisms/FuroToast/FuroToasterContext.d.ts +62 -0
- package/types/generated/components/organisms/FuroToast/ToastQueue.d.ts +201 -0
- package/types/generated/components/organisms/FuroToast/toast.d.ts +23 -0
- package/types/generated/contexts/BaseFuroContext.d.ts +207 -0
- package/types/generated/contexts/BaseFuroContextAccessor.d.ts +28 -0
- package/types/generated/emit-payload/BaseEmitPayload.d.ts +62 -0
- package/types/generated/index.components.d.ts +50 -0
- package/types/generated/index.core.d.ts +6 -0
- package/types/generated/tools/TimerClerk.d.ts +50 -0
- package/types/index.d.ts +12 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import {
|
|
3
|
+
defineComponent,
|
|
4
|
+
} from 'vue'
|
|
5
|
+
|
|
6
|
+
import FuroEditorMentionMenuContext from './FuroEditorMentionMenuContext.js'
|
|
7
|
+
|
|
8
|
+
export default defineComponent({
|
|
9
|
+
name: 'FuroEditorMentionMenu',
|
|
10
|
+
|
|
11
|
+
props: {
|
|
12
|
+
items: {
|
|
13
|
+
/** @type {import('vue').PropType<Array<{ id: string | number, label: string }>>} */
|
|
14
|
+
type: Array,
|
|
15
|
+
default: () => [],
|
|
16
|
+
},
|
|
17
|
+
command: {
|
|
18
|
+
type: (/** @type {import('vue').PropType<(mention: { id: string | number, label: string }) => void>} */ (Function)),
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
setup (
|
|
24
|
+
props,
|
|
25
|
+
componentContext
|
|
26
|
+
) {
|
|
27
|
+
const context = FuroEditorMentionMenuContext.create({
|
|
28
|
+
props,
|
|
29
|
+
componentContext,
|
|
30
|
+
})
|
|
31
|
+
.setupComponent()
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
context,
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<div class="unit-editor-mention-list">
|
|
42
|
+
<template v-if="context.hasItems()">
|
|
43
|
+
<button
|
|
44
|
+
v-for="(mention, index) in context.items"
|
|
45
|
+
:key="mention.id"
|
|
46
|
+
type="button"
|
|
47
|
+
class="item"
|
|
48
|
+
:class="{
|
|
49
|
+
selected: context.isSelected({ index }),
|
|
50
|
+
}"
|
|
51
|
+
@click="context.selectMention({ index })"
|
|
52
|
+
>
|
|
53
|
+
{{ mention.label }}
|
|
54
|
+
</button>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<div
|
|
58
|
+
v-else
|
|
59
|
+
class="empty"
|
|
60
|
+
>
|
|
61
|
+
No matches
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<style>
|
|
67
|
+
@layer furo {
|
|
68
|
+
.unit-editor-mention-list {
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
|
|
72
|
+
min-width: 10rem;
|
|
73
|
+
max-height: 16rem;
|
|
74
|
+
|
|
75
|
+
border: var(--size-thinnest) solid var(--color-border);
|
|
76
|
+
border-radius: 0.375rem;
|
|
77
|
+
|
|
78
|
+
padding-block: 0.25rem;
|
|
79
|
+
padding-inline: 0.25rem;
|
|
80
|
+
|
|
81
|
+
background-color: var(--color-popover);
|
|
82
|
+
|
|
83
|
+
overflow-y: auto;
|
|
84
|
+
box-shadow: var(--shadow-strong);
|
|
85
|
+
font-family: var(--font-family);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.unit-editor-mention-list > .item {
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
|
|
92
|
+
border: none;
|
|
93
|
+
border-radius: 0.25rem;
|
|
94
|
+
|
|
95
|
+
padding-block: 0.375rem;
|
|
96
|
+
padding-inline: 0.5rem;
|
|
97
|
+
|
|
98
|
+
background-color: transparent;
|
|
99
|
+
|
|
100
|
+
color: var(--color-popover-foreground);
|
|
101
|
+
font: var(--font-body-medium);
|
|
102
|
+
text-align: start;
|
|
103
|
+
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.unit-editor-mention-list > .item:hover,
|
|
108
|
+
.unit-editor-mention-list > .item.selected {
|
|
109
|
+
background-color: var(--color-accent);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.unit-editor-mention-list > .empty {
|
|
113
|
+
padding-block: 0.375rem;
|
|
114
|
+
padding-inline: 0.5rem;
|
|
115
|
+
|
|
116
|
+
color: var(--color-muted-foreground);
|
|
117
|
+
font: var(--font-body-small);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
</style>
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ref,
|
|
3
|
+
} from 'vue'
|
|
4
|
+
|
|
5
|
+
import BaseFuroContext from '../../../contexts/BaseFuroContext.js'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Context for the mention suggestion list popup.
|
|
9
|
+
*
|
|
10
|
+
* Renders a domain-agnostic list of `{ id, label }` items and forwards the chosen
|
|
11
|
+
* item back to Tiptap through the injected `command` prop. Keyboard navigation
|
|
12
|
+
* (up / down / enter) is exposed for the suggestion renderer to drive.
|
|
13
|
+
*
|
|
14
|
+
* @extends {BaseFuroContext<null, FuroEditorMentionMenuContextParams['props'], null>}
|
|
15
|
+
*/
|
|
16
|
+
export default class FuroEditorMentionMenuContext extends BaseFuroContext {
|
|
17
|
+
/**
|
|
18
|
+
* Constructor.
|
|
19
|
+
*
|
|
20
|
+
* @param {FuroEditorMentionMenuContextParams} params - Parameters of this constructor.
|
|
21
|
+
*/
|
|
22
|
+
constructor ({
|
|
23
|
+
props,
|
|
24
|
+
componentContext,
|
|
25
|
+
|
|
26
|
+
refHash,
|
|
27
|
+
}) {
|
|
28
|
+
super({
|
|
29
|
+
props,
|
|
30
|
+
componentContext,
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
this.refHash = refHash
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Factory method.
|
|
38
|
+
*
|
|
39
|
+
* @template {X extends typeof FuroEditorMentionMenuContext ? X : never} T, X
|
|
40
|
+
* @override
|
|
41
|
+
* @param {FuroEditorMentionMenuContextFactoryParams} params - Parameters of this factory method.
|
|
42
|
+
* @returns {InstanceType<T>} An instance of this class.
|
|
43
|
+
* @this {T}
|
|
44
|
+
*/
|
|
45
|
+
static create ({
|
|
46
|
+
props,
|
|
47
|
+
componentContext,
|
|
48
|
+
|
|
49
|
+
refHash = this.buildRefHash(),
|
|
50
|
+
}) {
|
|
51
|
+
return /** @type {InstanceType<T>} */ (
|
|
52
|
+
new this({
|
|
53
|
+
props,
|
|
54
|
+
componentContext,
|
|
55
|
+
|
|
56
|
+
refHash,
|
|
57
|
+
})
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Build ref hash.
|
|
63
|
+
*
|
|
64
|
+
* @override
|
|
65
|
+
* @returns {FuroEditorMentionMenuContextParams['refHash']}
|
|
66
|
+
*/
|
|
67
|
+
static buildRefHash () {
|
|
68
|
+
return {
|
|
69
|
+
selectedIndexRef: ref(0),
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* get: mention items.
|
|
75
|
+
*
|
|
76
|
+
* @returns {Array<{ id: string | number, label: string }>} - Items.
|
|
77
|
+
*/
|
|
78
|
+
get items () {
|
|
79
|
+
return this.props.items
|
|
80
|
+
?? []
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* get: currently highlighted index.
|
|
85
|
+
*
|
|
86
|
+
* @returns {number} - Selected index.
|
|
87
|
+
*/
|
|
88
|
+
get selectedIndex () {
|
|
89
|
+
return this.refHash.selectedIndexRef.value
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Whether there are any items to show.
|
|
94
|
+
*
|
|
95
|
+
* @returns {boolean} - true when non-empty.
|
|
96
|
+
*/
|
|
97
|
+
hasItems () {
|
|
98
|
+
return this.items.length > 0
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Whether the item at the index is highlighted.
|
|
103
|
+
*
|
|
104
|
+
* @param {{
|
|
105
|
+
* index: number
|
|
106
|
+
* }} params - Parameters of this method.
|
|
107
|
+
* @returns {boolean} - true when highlighted.
|
|
108
|
+
*/
|
|
109
|
+
isSelected ({
|
|
110
|
+
index,
|
|
111
|
+
}) {
|
|
112
|
+
return this.selectedIndex === index
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Setup component context: expose keyboard handler for the suggestion renderer.
|
|
117
|
+
*
|
|
118
|
+
* @template {X extends FuroEditorMentionMenuContext ? X : never} T, X
|
|
119
|
+
* @override
|
|
120
|
+
* @returns {T} - For method chaining.
|
|
121
|
+
* @this {T}
|
|
122
|
+
*/
|
|
123
|
+
setupComponent () {
|
|
124
|
+
this.expose(
|
|
125
|
+
this.generateExposeHash()
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
return this
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** @override */
|
|
132
|
+
generateExposeHash () {
|
|
133
|
+
return {
|
|
134
|
+
/**
|
|
135
|
+
* @param {{
|
|
136
|
+
* targetEvent: KeyboardEvent
|
|
137
|
+
* }} params - Keyboard event from the suggestion renderer.
|
|
138
|
+
* @returns {boolean} - true when handled.
|
|
139
|
+
*/
|
|
140
|
+
onKeyDown: ({
|
|
141
|
+
targetEvent,
|
|
142
|
+
}) => this.onKeyDown({
|
|
143
|
+
targetEvent,
|
|
144
|
+
}),
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Move the highlight up, wrapping to the end.
|
|
150
|
+
*
|
|
151
|
+
* @returns {void}
|
|
152
|
+
*/
|
|
153
|
+
moveUp () {
|
|
154
|
+
const total = this.items.length
|
|
155
|
+
|
|
156
|
+
if (total === 0) {
|
|
157
|
+
return
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
this.refHash.selectedIndexRef.value = (this.selectedIndex + total - 1) % total
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Move the highlight down, wrapping to the start.
|
|
165
|
+
*
|
|
166
|
+
* @returns {void}
|
|
167
|
+
*/
|
|
168
|
+
moveDown () {
|
|
169
|
+
const total = this.items.length
|
|
170
|
+
|
|
171
|
+
if (total === 0) {
|
|
172
|
+
return
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
this.refHash.selectedIndexRef.value = (this.selectedIndex + 1) % total
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Select the mention at the given index, forwarding it to Tiptap.
|
|
180
|
+
*
|
|
181
|
+
* @param {{
|
|
182
|
+
* index: number
|
|
183
|
+
* }} params - Parameters of this method.
|
|
184
|
+
* @returns {void}
|
|
185
|
+
*/
|
|
186
|
+
selectMention ({
|
|
187
|
+
index,
|
|
188
|
+
}) {
|
|
189
|
+
const mention = this.items[index]
|
|
190
|
+
|
|
191
|
+
if (!mention) {
|
|
192
|
+
return
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
this.props.command({
|
|
196
|
+
id: mention.id,
|
|
197
|
+
label: mention.label,
|
|
198
|
+
})
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Select the currently highlighted mention.
|
|
203
|
+
*
|
|
204
|
+
* @returns {void}
|
|
205
|
+
*/
|
|
206
|
+
selectActive () {
|
|
207
|
+
this.selectMention({
|
|
208
|
+
index: this.selectedIndex,
|
|
209
|
+
})
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Handle a keyboard event from the suggestion renderer.
|
|
214
|
+
*
|
|
215
|
+
* @param {{
|
|
216
|
+
* targetEvent: KeyboardEvent
|
|
217
|
+
* }} params - Parameters of this method.
|
|
218
|
+
* @returns {boolean} - true when the key was handled.
|
|
219
|
+
*/
|
|
220
|
+
onKeyDown ({
|
|
221
|
+
targetEvent,
|
|
222
|
+
}) {
|
|
223
|
+
const keyHash = {
|
|
224
|
+
ArrowUp: () => {
|
|
225
|
+
this.moveUp()
|
|
226
|
+
|
|
227
|
+
return true
|
|
228
|
+
},
|
|
229
|
+
ArrowDown: () => {
|
|
230
|
+
this.moveDown()
|
|
231
|
+
|
|
232
|
+
return true
|
|
233
|
+
},
|
|
234
|
+
Enter: () => {
|
|
235
|
+
this.selectActive()
|
|
236
|
+
|
|
237
|
+
return true
|
|
238
|
+
},
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return keyHash[/** @type {keyof typeof keyHash} */ (targetEvent.key)]?.()
|
|
242
|
+
?? false
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* @typedef {import('../../../contexts/BaseFuroContext.js').BaseFuroContextParams<{
|
|
248
|
+
* items: Array<{ id: string | number, label: string }>
|
|
249
|
+
* command: (mention: { id: string | number, label: string }) => void
|
|
250
|
+
* }> & {
|
|
251
|
+
* refHash: {
|
|
252
|
+
* selectedIndexRef: import('vue').Ref<number>
|
|
253
|
+
* }
|
|
254
|
+
* }} FuroEditorMentionMenuContextParams
|
|
255
|
+
*/
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* @typedef {Omit<FuroEditorMentionMenuContextParams, 'refHash'> & {
|
|
259
|
+
* refHash?: FuroEditorMentionMenuContextParams['refHash']
|
|
260
|
+
* }} FuroEditorMentionMenuContextFactoryParams
|
|
261
|
+
*/
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Extension,
|
|
3
|
+
} from '@tiptap/core'
|
|
4
|
+
import {
|
|
5
|
+
DOMParser as ProseMirrorDOMParser,
|
|
6
|
+
Fragment,
|
|
7
|
+
Slice,
|
|
8
|
+
} from '@tiptap/pm/model'
|
|
9
|
+
import {
|
|
10
|
+
Plugin as ProseMirrorPlugin,
|
|
11
|
+
PluginKey as ProseMirrorPluginKey,
|
|
12
|
+
} from '@tiptap/pm/state'
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
extractTextSegmentsFromLine,
|
|
16
|
+
} from './paste-link-segments.js'
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a text node from a segment.
|
|
20
|
+
*
|
|
21
|
+
* @param {{
|
|
22
|
+
* schema: import('@tiptap/pm/model').Schema
|
|
23
|
+
* segment: import('./paste-link-segments.js').TextSegment
|
|
24
|
+
* }} params - Parameters of this function.
|
|
25
|
+
* @returns {import('@tiptap/pm/model').Node | null} - Text node, or null for empty plain text.
|
|
26
|
+
*/
|
|
27
|
+
function createTextNodeFromSegment ({
|
|
28
|
+
schema,
|
|
29
|
+
segment,
|
|
30
|
+
}) {
|
|
31
|
+
const linkMarkType = schema.marks.link
|
|
32
|
+
|
|
33
|
+
if (segment.type === 'link' && linkMarkType) {
|
|
34
|
+
return schema.text(
|
|
35
|
+
segment.text,
|
|
36
|
+
[
|
|
37
|
+
linkMarkType.create({
|
|
38
|
+
href: segment.href,
|
|
39
|
+
}),
|
|
40
|
+
]
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (segment.text.length === 0) {
|
|
45
|
+
return null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return schema.text(segment.text)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Create inline text nodes with link marks from a single line.
|
|
53
|
+
*
|
|
54
|
+
* @param {{
|
|
55
|
+
* schema: import('@tiptap/pm/model').Schema
|
|
56
|
+
* line: string
|
|
57
|
+
* }} params - Parameters of this function.
|
|
58
|
+
* @returns {Array<import('@tiptap/pm/model').Node>} - Inline nodes.
|
|
59
|
+
*/
|
|
60
|
+
function createInlineContentFromLine ({
|
|
61
|
+
schema,
|
|
62
|
+
line,
|
|
63
|
+
}) {
|
|
64
|
+
const segments = extractTextSegmentsFromLine({
|
|
65
|
+
line,
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
return segments
|
|
69
|
+
.map(segment => createTextNodeFromSegment({
|
|
70
|
+
schema,
|
|
71
|
+
segment,
|
|
72
|
+
}))
|
|
73
|
+
.filter(node => node !== null)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Parse HTML clipboard content into paragraph nodes with marks preserved.
|
|
78
|
+
*
|
|
79
|
+
* @param {{
|
|
80
|
+
* schema: import('@tiptap/pm/model').Schema
|
|
81
|
+
* html: string
|
|
82
|
+
* }} params - Parameters of this function.
|
|
83
|
+
* @returns {Array<import('@tiptap/pm/model').Node>} - Paragraph nodes parsed from HTML.
|
|
84
|
+
*/
|
|
85
|
+
function parseHtmlParagraphNodes ({
|
|
86
|
+
schema,
|
|
87
|
+
html,
|
|
88
|
+
}) {
|
|
89
|
+
const paragraphType = schema.nodes.paragraph
|
|
90
|
+
|
|
91
|
+
if (!paragraphType) {
|
|
92
|
+
return []
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const domParser = ProseMirrorDOMParser.fromSchema(schema)
|
|
96
|
+
const dom = document.implementation.createHTMLDocument()
|
|
97
|
+
const container = dom.createElement('div')
|
|
98
|
+
|
|
99
|
+
container.innerHTML = html
|
|
100
|
+
|
|
101
|
+
const parsedDocument = domParser.parse(container)
|
|
102
|
+
|
|
103
|
+
return parsedDocument.content.content
|
|
104
|
+
.filter(node => node.type === paragraphType)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Create a paragraph node from a pasted line.
|
|
109
|
+
*
|
|
110
|
+
* @param {{
|
|
111
|
+
* schema: import('@tiptap/pm/model').Schema
|
|
112
|
+
* line: string
|
|
113
|
+
* htmlParagraphNode?: import('@tiptap/pm/model').Node | null
|
|
114
|
+
* }} params - Parameters of this function.
|
|
115
|
+
* @returns {import('@tiptap/pm/model').Node} - Paragraph node.
|
|
116
|
+
*/
|
|
117
|
+
function createParagraphNodeFromPasteLine ({
|
|
118
|
+
schema,
|
|
119
|
+
line,
|
|
120
|
+
htmlParagraphNode = null,
|
|
121
|
+
}) {
|
|
122
|
+
const paragraphType = schema.nodes.paragraph
|
|
123
|
+
|
|
124
|
+
if (htmlParagraphNode !== null) {
|
|
125
|
+
return htmlParagraphNode
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (line === '') {
|
|
129
|
+
return paragraphType.create()
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const inlineContent = createInlineContentFromLine({
|
|
133
|
+
schema,
|
|
134
|
+
line,
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
return paragraphType.create(null, inlineContent)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Create paragraph nodes from pasted plain text while preserving newlines and marks.
|
|
142
|
+
*
|
|
143
|
+
* @param {{
|
|
144
|
+
* schema: import('@tiptap/pm/model').Schema
|
|
145
|
+
* lines: Array<string>
|
|
146
|
+
* html?: string
|
|
147
|
+
* }} params - Parameters of this function.
|
|
148
|
+
* @returns {Array<import('@tiptap/pm/model').Node>} - Paragraph nodes, one per line.
|
|
149
|
+
*/
|
|
150
|
+
export function createParagraphNodesFromPaste ({
|
|
151
|
+
schema,
|
|
152
|
+
lines,
|
|
153
|
+
html = '',
|
|
154
|
+
}) {
|
|
155
|
+
const htmlParagraphNodes = html
|
|
156
|
+
? parseHtmlParagraphNodes({
|
|
157
|
+
schema,
|
|
158
|
+
html,
|
|
159
|
+
})
|
|
160
|
+
: []
|
|
161
|
+
|
|
162
|
+
const shouldUseHtmlParagraphs = htmlParagraphNodes.length === lines.length
|
|
163
|
+
|
|
164
|
+
return lines.map((line, index) => {
|
|
165
|
+
const htmlParagraphNode = shouldUseHtmlParagraphs
|
|
166
|
+
? htmlParagraphNodes[index]
|
|
167
|
+
: null
|
|
168
|
+
|
|
169
|
+
return createParagraphNodeFromPasteLine({
|
|
170
|
+
schema,
|
|
171
|
+
line,
|
|
172
|
+
htmlParagraphNode,
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Resolve pasted clipboard content into paragraph nodes, or null to defer to
|
|
179
|
+
* default handling.
|
|
180
|
+
*
|
|
181
|
+
* @param {{
|
|
182
|
+
* schema: import('@tiptap/pm/model').Schema
|
|
183
|
+
* text?: string | null
|
|
184
|
+
* html?: string | null
|
|
185
|
+
* }} params - Parameters of this function.
|
|
186
|
+
* @returns {Array<import('@tiptap/pm/model').Node> | null} - Paragraph nodes, or null.
|
|
187
|
+
*/
|
|
188
|
+
export function resolvePastedParagraphs ({
|
|
189
|
+
schema,
|
|
190
|
+
text = null,
|
|
191
|
+
html = null,
|
|
192
|
+
}) {
|
|
193
|
+
// No plain text, no paragraph type, or rich HTML without newlines — defer to default.
|
|
194
|
+
if (
|
|
195
|
+
!text
|
|
196
|
+
|| !schema.nodes.paragraph
|
|
197
|
+
|| (html && !text.includes('\n'))
|
|
198
|
+
) {
|
|
199
|
+
return null
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Normalize CRLF / CR to LF, then split on each individual newline (not on runs)
|
|
203
|
+
// so empty lines survive as empty strings.
|
|
204
|
+
const lines = text
|
|
205
|
+
.replace(/\r\n/gu, '\n')
|
|
206
|
+
.replace(/\r/gu, '\n')
|
|
207
|
+
.split('\n')
|
|
208
|
+
|
|
209
|
+
return createParagraphNodesFromPaste({
|
|
210
|
+
schema,
|
|
211
|
+
lines,
|
|
212
|
+
html: html ?? '',
|
|
213
|
+
})
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Extension that preserves multiple consecutive newlines when pasting plain text.
|
|
218
|
+
*
|
|
219
|
+
* By default, Tiptap/ProseMirror collapses runs of newlines into single paragraph
|
|
220
|
+
* breaks because it splits on `/(?:\r\n?|\n)+/` (one or more). This extension splits
|
|
221
|
+
* on each individual newline so empty lines survive, normalizes Windows line endings,
|
|
222
|
+
* and reconstructs link marks from Markdown links and bare URLs.
|
|
223
|
+
*
|
|
224
|
+
* ref: https://unpkg.com/prosemirror-view@1.27.0/src/clipboard.ts, search for /(?:\r\n?|\n)+/
|
|
225
|
+
*/
|
|
226
|
+
export const PreserveNewlinesPasteExtension = Extension.create({
|
|
227
|
+
name: 'preserveNewlinesPaste',
|
|
228
|
+
|
|
229
|
+
addProseMirrorPlugins () {
|
|
230
|
+
return [
|
|
231
|
+
new ProseMirrorPlugin({
|
|
232
|
+
key: new ProseMirrorPluginKey('preserveNewlinesPaste'),
|
|
233
|
+
props: {
|
|
234
|
+
handlePaste: (view, clipboardEvent) => {
|
|
235
|
+
// Bracket access avoids the Data-suffix identifier lint on native ClipboardEvent APIs.
|
|
236
|
+
const clipboard = clipboardEvent['clipboardData']
|
|
237
|
+
const text = clipboard?.['getData']?.('text/plain')
|
|
238
|
+
const html = clipboard?.['getData']?.('text/html')
|
|
239
|
+
|
|
240
|
+
const paragraphs = resolvePastedParagraphs({
|
|
241
|
+
schema: view.state.schema,
|
|
242
|
+
text,
|
|
243
|
+
html,
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
if (!paragraphs) {
|
|
247
|
+
return false
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// openStart/openEnd of 1 lets the first/last paragraphs merge with
|
|
251
|
+
// surrounding content when pasting in the middle of existing text.
|
|
252
|
+
const fragment = Fragment.fromArray(paragraphs)
|
|
253
|
+
const slice = new Slice(fragment, 1, 1)
|
|
254
|
+
|
|
255
|
+
view.dispatch(
|
|
256
|
+
view.state.tr
|
|
257
|
+
.replaceSelection(slice)
|
|
258
|
+
.scrollIntoView()
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
return true
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
}),
|
|
265
|
+
]
|
|
266
|
+
},
|
|
267
|
+
})
|