@rimelight/ui 0.0.42 → 0.0.44
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/README.md +18 -26
- package/package.json +24 -37
- package/src/components/3d-hover/3d-hover.theme.ts +9 -12
- package/src/components/3d-hover/RLA3dHover.astro +9 -20
- package/src/components/accordion/RLAAccordion.astro +5 -14
- package/src/components/accordion/accordion.theme.ts +34 -37
- package/src/components/app/RLAApp.astro +9 -20
- package/src/components/app/app.theme.ts +9 -12
- package/src/components/aspect-ratio/RLAAspectRatio.astro +19 -27
- package/src/components/aspect-ratio/aspect-ratio.theme.ts +8 -12
- package/src/components/audio/RLAAudio.astro +3 -14
- package/src/components/audio/audio.theme.ts +9 -12
- package/src/components/avatar/RLAAvatar.astro +11 -39
- package/src/components/avatar/avatar.theme.ts +66 -77
- package/src/components/avatar/avatar.ts +6 -11
- package/src/components/avatar-group/RLAAvatarGroup.astro +188 -23
- package/src/components/avatar-group/avatar-group.theme.ts +12 -11
- package/src/components/avatar-group/avatar-group.ts +41 -0
- package/src/components/badge/RLABadge.astro +24 -36
- package/src/components/badge/RLSBadge.tsx +41 -0
- package/src/components/badge/RLVBadge.vue +8 -16
- package/src/components/badge/badge.theme.ts +114 -160
- package/src/components/badge/badge.ts +2 -1
- package/src/components/banner/RLABanner.astro +88 -103
- package/src/components/banner/banner.theme.ts +40 -43
- package/src/components/breadcrumb/RLABreadcrumb.astro +241 -62
- package/src/components/breadcrumb/breadcrumb.theme.ts +12 -16
- package/src/components/breadcrumb/breadcrumb.ts +19 -0
- package/src/components/browser-mockup/RLABrowserMockup.astro +9 -20
- package/src/components/browser-mockup/browser-mockup.theme.ts +9 -12
- package/src/components/button/RLAButton.astro +13 -30
- package/src/components/button/RLSButton.tsx +169 -0
- package/src/components/button/RLVButton.vue +13 -26
- package/src/components/button/button.theme.ts +159 -220
- package/src/components/button/button.ts +1 -1
- package/src/components/calendar/RLACalendar.astro +9 -20
- package/src/components/calendar/calendar.theme.ts +9 -12
- package/src/components/callout/RLACallout.astro +11 -18
- package/src/components/callout/callout.theme.ts +55 -101
- package/src/components/callout/callout.ts +1 -1
- package/src/components/card/RLACard.astro +71 -77
- package/src/components/card/RLSCard.tsx +116 -0
- package/src/components/card/RLVCard.vue +6 -14
- package/src/components/card/card.theme.ts +41 -44
- package/src/components/carousel/RLACarousel.astro +45 -13
- package/src/components/carousel/carousel.theme.ts +28 -32
- package/src/components/chart/RLAChart.astro +6 -12
- package/src/components/chart/chart.theme.ts +18 -21
- package/src/components/chart/chart.ts +1 -1
- package/src/components/chat/RLAChat.astro +9 -20
- package/src/components/chat/chat.theme.ts +9 -12
- package/src/components/chat-message/RLAChatMessage.astro +9 -20
- package/src/components/chat-message/chat-message.theme.ts +9 -12
- package/src/components/chat-messages/RLAChatMessages.astro +9 -20
- package/src/components/chat-messages/chat-messages.theme.ts +9 -12
- package/src/components/chat-palette/RLAChatPalette.astro +9 -20
- package/src/components/chat-palette/chat-palette.theme.ts +9 -12
- package/src/components/chat-prompt/RLAChatPrompt.astro +9 -20
- package/src/components/chat-prompt/chat-prompt.theme.ts +9 -12
- package/src/components/chat-prompt-submit/RLAChatPromptSubmit.astro +9 -20
- package/src/components/chat-prompt-submit/chat-prompt-submit.theme.ts +9 -12
- package/src/components/chat-reasoning/RLAChatReasoning.astro +9 -20
- package/src/components/chat-reasoning/chat-reasoning.theme.ts +9 -12
- package/src/components/chat-shimmer/RLAChatShimmer.astro +9 -20
- package/src/components/chat-shimmer/chat-shimmer.theme.ts +9 -12
- package/src/components/chat-tool/RLAChatTool.astro +9 -20
- package/src/components/chat-tool/chat-tool.theme.ts +9 -12
- package/src/components/checkbox/RLACheckbox.astro +3 -17
- package/src/components/checkbox/RLSCheckbox.tsx +65 -0
- package/src/components/checkbox/checkbox.theme.ts +31 -46
- package/src/components/checkbox/checkbox.ts +1 -1
- package/src/components/chip/RLAChip.astro +33 -56
- package/src/components/chip/chip.theme.ts +62 -72
- package/src/components/chip/chip.ts +3 -1
- package/src/components/collapsible/RLACollapsible.astro +3 -13
- package/src/components/collapsible/collapsible.theme.ts +17 -20
- package/src/components/collapsible/collapsible.ts +1 -1
- package/src/components/color-area/RLAColorArea.astro +3 -13
- package/src/components/color-area/color-area.theme.ts +16 -32
- package/src/components/color-area/color-area.ts +1 -1
- package/src/components/color-field/RLAColorField.astro +4 -14
- package/src/components/color-field/color-field.theme.ts +15 -31
- package/src/components/color-field/color-field.ts +1 -1
- package/src/components/color-picker/RLAColorPicker.astro +9 -20
- package/src/components/color-picker/color-picker.theme.ts +9 -12
- package/src/components/color-slider/RLAColorSlider.astro +3 -13
- package/src/components/color-slider/color-slider.theme.ts +17 -33
- package/src/components/color-slider/color-slider.ts +1 -1
- package/src/components/command-palette/RLACommandPalette.astro +9 -20
- package/src/components/command-palette/command-palette.theme.ts +9 -12
- package/src/components/compare/RLACompare.astro +9 -20
- package/src/components/compare/compare.theme.ts +9 -12
- package/src/components/confirm/RLAConfirm.astro +114 -122
- package/src/components/confirm/confirm.theme.ts +40 -44
- package/src/components/confirm/confirm.ts +1 -0
- package/src/components/container/RLAContainer.astro +9 -20
- package/src/components/container/container.theme.ts +9 -12
- package/src/components/context-menu/RLAContextMenu.astro +9 -20
- package/src/components/context-menu/context-menu.theme.ts +9 -12
- package/src/components/dashboard-group/RLADashboardGroup.astro +15 -21
- package/src/components/dashboard-group/dashboard-group.theme.ts +9 -12
- package/src/components/dashboard-group/dashboard-group.ts +1 -6
- package/src/components/dashboard-navbar/RLADashboardNavbar.astro +61 -21
- package/src/components/dashboard-navbar/dashboard-navbar.theme.ts +26 -12
- package/src/components/dashboard-navbar/dashboard-navbar.ts +5 -6
- package/src/components/dashboard-panel/RLADashboardPanel.astro +25 -12
- package/src/components/dashboard-panel/dashboard-panel.theme.ts +22 -12
- package/src/components/dashboard-panel/dashboard-panel.ts +4 -6
- package/src/components/dashboard-resize-handle/RLADashboardResizeHandle.astro +21 -21
- package/src/components/dashboard-resize-handle/dashboard-resize-handle.theme.ts +9 -12
- package/src/components/dashboard-resize-handle/dashboard-resize-handle.ts +1 -6
- package/src/components/dashboard-search/RLADashboardSearch.astro +100 -21
- package/src/components/dashboard-search/dashboard-search.theme.ts +24 -11
- package/src/components/dashboard-search/dashboard-search.ts +2 -6
- package/src/components/dashboard-search-button/RLADashboardSearchButton.astro +45 -21
- package/src/components/dashboard-search-button/dashboard-search-button.theme.ts +20 -12
- package/src/components/dashboard-search-button/dashboard-search-button.ts +4 -6
- package/src/components/dashboard-sidebar/RLADashboardSidebar.astro +122 -21
- package/src/components/dashboard-sidebar/dashboard-sidebar.theme.ts +41 -11
- package/src/components/dashboard-sidebar/dashboard-sidebar.ts +8 -6
- package/src/components/dashboard-sidebar-collapse/RLADashboardSidebarCollapse.astro +25 -21
- package/src/components/dashboard-sidebar-collapse/dashboard-sidebar-collapse.theme.ts +16 -12
- package/src/components/dashboard-sidebar-collapse/dashboard-sidebar-collapse.ts +2 -6
- package/src/components/dashboard-sidebar-toggle/RLADashboardSidebarToggle.astro +23 -21
- package/src/components/dashboard-sidebar-toggle/dashboard-sidebar-toggle.theme.ts +16 -12
- package/src/components/dashboard-sidebar-toggle/dashboard-sidebar-toggle.ts +2 -6
- package/src/components/dashboard-toolbar/RLADashboardToolbar.astro +25 -21
- package/src/components/dashboard-toolbar/dashboard-toolbar.theme.ts +11 -12
- package/src/components/dashboard-toolbar/dashboard-toolbar.ts +1 -6
- package/src/components/dock/RLADock.astro +9 -20
- package/src/components/dock/dock.theme.ts +9 -12
- package/src/components/drawer/RLADrawer.astro +115 -126
- package/src/components/drawer/drawer.theme.ts +53 -57
- package/src/components/dropdown-menu/RLADropdownMenu.astro +180 -47
- package/src/components/dropdown-menu/RLSDropdownMenu.tsx +196 -0
- package/src/components/dropdown-menu/dropdown-menu.theme.ts +51 -27
- package/src/components/dropdown-menu/dropdown-menu.ts +47 -9
- package/src/components/editor/RLAEditor.astro +9 -20
- package/src/components/editor/editor.theme.ts +9 -12
- package/src/components/empty/RLAEmpty.astro +86 -20
- package/src/components/empty/empty.theme.ts +79 -11
- package/src/components/empty/empty.ts +59 -2
- package/src/components/error/RLAError.astro +9 -20
- package/src/components/error/error.theme.ts +9 -12
- package/src/components/field-group/RLAFieldGroup.astro +2 -11
- package/src/components/field-group/field-group.theme.ts +18 -22
- package/src/components/fieldset/RLAFieldset.astro +9 -20
- package/src/components/fieldset/fieldset.theme.ts +9 -12
- package/src/components/file-upload/RLAFileUpload.astro +4 -13
- package/src/components/file-upload/file-upload.theme.ts +19 -22
- package/src/components/file-upload/file-upload.ts +1 -1
- package/src/components/floating-action/RLAFloatingAction.astro +9 -20
- package/src/components/floating-action/floating-action.theme.ts +9 -12
- package/src/components/footer/RLAFooter.astro +34 -38
- package/src/components/footer/footer.theme.ts +24 -27
- package/src/components/footer/footer.ts +4 -0
- package/src/components/form/RLAForm.astro +9 -20
- package/src/components/form/form.theme.ts +9 -12
- package/src/components/form-field/RLAFormField.astro +5 -12
- package/src/components/form-field/RLSFormField.tsx +71 -0
- package/src/components/form-field/RLVFormField.vue +5 -14
- package/src/components/form-field/form-field.theme.ts +19 -22
- package/src/components/form-field/form-field.ts +1 -0
- package/src/components/gallery/RLAGallery.astro +9 -20
- package/src/components/gallery/gallery.theme.ts +9 -12
- package/src/components/gamepad/RLAGamepad.astro +1 -1
- package/src/components/grid/RLAGrid.astro +2 -15
- package/src/components/grid/grid.theme.ts +31 -34
- package/src/components/head/UIHead.astro +297 -0
- package/src/components/head/head.theme.ts +9 -12
- package/src/components/header/HeaderLayer.astro +63 -0
- package/src/components/header/RLAHeader.astro +29 -48
- package/src/components/header/header.theme.ts +37 -40
- package/src/components/header/header.ts +4 -0
- package/src/{utils → components/header}/headerStack.ts +30 -22
- package/src/components/hover-card/RLAHoverCard.astro +24 -35
- package/src/components/hover-card/hover-card.theme.ts +23 -27
- package/src/components/icon/RLAIcon.astro +26 -36
- package/src/components/icon/RLSIcon.tsx +8 -9
- package/src/components/icon/RLVIcon.vue +23 -12
- package/src/components/icon/icon.theme.ts +18 -28
- package/src/components/image/RLAImage.astro +20 -23
- package/src/components/image/image.theme.ts +29 -32
- package/src/components/input/RLAInput.astro +7 -21
- package/src/components/input/RLSInput.tsx +101 -0
- package/src/components/input/RLVInput.vue +11 -20
- package/src/components/input/input.theme.ts +37 -44
- package/src/components/input/input.ts +1 -1
- package/src/components/input-date/RLAInputDate.astro +9 -20
- package/src/components/input-date/input-date.theme.ts +9 -12
- package/src/components/input-menu/RLAInputMenu.astro +4 -14
- package/src/components/input-menu/input-menu.theme.ts +29 -32
- package/src/components/input-menu/input-menu.ts +1 -1
- package/src/components/input-number/RLAInputNumber.astro +9 -20
- package/src/components/input-number/input-number.theme.ts +9 -12
- package/src/components/input-pin/RLAInputPin.astro +9 -22
- package/src/components/input-pin/input-pin.theme.ts +9 -13
- package/src/components/input-rating/RLAInputRating.astro +2 -23
- package/src/components/input-rating/input-rating.theme.ts +64 -76
- package/src/components/input-rating/input-rating.ts +1 -1
- package/src/components/input-tags/RLAInputTags.astro +174 -21
- package/src/components/input-tags/input-tags.theme.ts +37 -12
- package/src/components/input-tags/input-tags.ts +50 -0
- package/src/components/input-time/RLAInputTime.astro +9 -20
- package/src/components/input-time/input-time.theme.ts +9 -12
- package/src/components/kbd/RLAKbd.astro +18 -32
- package/src/components/kbd/kbd.theme.ts +45 -91
- package/src/components/kbd/kbd.ts +3 -0
- package/src/components/keyboard/RLAKeyboard.astro +1 -1
- package/src/components/knob/RLAKnob.astro +9 -20
- package/src/components/knob/knob.theme.ts +9 -12
- package/src/components/label/RLALabel.astro +16 -27
- package/src/components/label/label.theme.ts +16 -20
- package/src/components/layout-grid/RLALayoutGrid.astro +5 -11
- package/src/components/layout-grid/layout-grid.theme.ts +12 -15
- package/src/components/link/RLALink.astro +7 -20
- package/src/components/link/RLSLink.tsx +8 -16
- package/src/components/link/RLVLink.vue +7 -16
- package/src/components/link/link.theme.ts +33 -37
- package/src/components/link/link.ts +5 -5
- package/src/components/link-group/RLALinkGroup.astro +8 -45
- package/src/components/link-group/link-group.theme.ts +13 -27
- package/src/components/link-group/link-group.ts +5 -16
- package/src/components/listbox/RLAListbox.astro +9 -20
- package/src/components/listbox/listbox.theme.ts +9 -12
- package/src/components/locale-selector/RLALocaleSelector.astro +12 -52
- package/src/components/locale-selector/locale-selector.theme.ts +42 -45
- package/src/components/locale-selector/locale-selector.ts +4 -0
- package/src/components/logo/RLALogo.astro +13 -27
- package/src/components/logo/logo.theme.ts +9 -12
- package/src/components/main/RLAMain.astro +31 -36
- package/src/components/main/main.theme.ts +9 -12
- package/src/components/marquee/RLAMarquee.astro +62 -43
- package/src/components/marquee/marquee.theme.ts +22 -26
- package/src/components/meter/RLAMeter.astro +9 -20
- package/src/components/meter/meter.theme.ts +9 -12
- package/src/components/modal/RLAModal.astro +71 -73
- package/src/components/modal/RLSModal.tsx +156 -0
- package/src/components/modal/RLVModal.vue +5 -6
- package/src/components/modal/modal.theme.ts +42 -46
- package/src/components/modal/modal.ts +1 -0
- package/src/components/navigation-menu/RLANavigationMenu.astro +22 -31
- package/src/components/navigation-menu/navigation-menu.theme.ts +33 -40
- package/src/components/navigation-menu/navigation-menu.ts +19 -18
- package/src/components/page/RLAPage.astro +9 -20
- package/src/components/page/page.theme.ts +9 -12
- package/src/components/page-aside/RLAPageAside.astro +9 -20
- package/src/components/page-aside/page-aside.theme.ts +9 -12
- package/src/components/page-body/RLAPageBody.astro +9 -20
- package/src/components/page-body/page-body.theme.ts +9 -12
- package/src/components/page-header/RLAPageHeader.astro +9 -20
- package/src/components/page-header/page-header.theme.ts +9 -12
- package/src/components/page-section/RLAPageSection.astro +11 -15
- package/src/components/page-section/page-section.theme.ts +193 -176
- package/src/components/pagination/RLAPagination.astro +91 -97
- package/src/components/pagination/pagination.theme.ts +22 -26
- package/src/components/password/RLAPassword.astro +9 -20
- package/src/components/password/password.theme.ts +9 -12
- package/src/components/phone-mockup/RLAPhoneMockup.astro +9 -20
- package/src/components/phone-mockup/phone-mockup.theme.ts +9 -12
- package/src/components/placeholder/RLAPlaceholder.astro +32 -43
- package/src/components/placeholder/placeholder.theme.ts +11 -14
- package/src/components/popover/RLAPopover.astro +241 -129
- package/src/components/popover/popover.theme.ts +23 -27
- package/src/components/post/RLAPost.astro +2 -10
- package/src/components/post/post.theme.ts +45 -48
- package/src/components/pricing-plan/RLAPricingPlan.astro +9 -20
- package/src/components/pricing-plan/pricing-plan.theme.ts +9 -12
- package/src/components/pricing-table/RLAPricingTable.astro +9 -20
- package/src/components/pricing-table/pricing-table.theme.ts +9 -12
- package/src/components/progress/RLAProgress.astro +3 -16
- package/src/components/progress/progress.theme.ts +19 -35
- package/src/components/progress/progress.ts +1 -1
- package/src/components/prose/RLAProse.astro +9 -20
- package/src/components/prose/prose.theme.ts +9 -12
- package/src/components/qr-code/RLAQrCode.astro +9 -20
- package/src/components/qr-code/qr-code.theme.ts +9 -12
- package/src/components/quote/quote.theme.ts +9 -12
- package/src/components/radio-group/RLARadioGroup.astro +9 -20
- package/src/components/radio-group/radio-group.theme.ts +9 -12
- package/src/components/rating/RLARating.astro +9 -20
- package/src/components/rating/rating.theme.ts +9 -12
- package/src/components/scroll-area/RLAScrollArea.astro +2 -10
- package/src/components/scroll-area/scroll-area.theme.ts +21 -24
- package/src/components/scroll-to-top/RLAScrollToTop.astro +70 -45
- package/src/components/scroll-to-top/RLVScrollToTop.vue +13 -17
- package/src/components/scroll-to-top/scroll-to-top.theme.ts +28 -46
- package/src/components/scroll-to-top/scroll-to-top.ts +1 -1
- package/src/{utils → components/scroll-to-top}/scroll.ts +19 -6
- package/src/components/search/RLASearch.astro +6 -12
- package/src/components/search/search.theme.ts +60 -63
- package/src/components/select/RLASelect.astro +101 -132
- package/src/components/select/RLSSelect.tsx +180 -0
- package/src/components/select/RLVSelect.vue +64 -15
- package/src/components/select/select.theme.ts +21 -27
- package/src/components/select/select.ts +58 -36
- package/src/components/separator/RLASeparator.astro +62 -83
- package/src/components/separator/separator.theme.ts +135 -138
- package/src/components/separator/separator.ts +4 -0
- package/src/components/shortcuts/RLAShortcuts.astro +11 -12
- package/src/components/sidebar/RLASidebar.astro +14 -24
- package/src/components/sidebar/sidebar.theme.ts +39 -42
- package/src/components/sidebar/sidebar.ts +2 -0
- package/src/components/skeleton/RLASkeleton.astro +13 -22
- package/src/components/skeleton/skeleton.theme.ts +16 -19
- package/src/components/slideover/RLASlideover.astro +3 -13
- package/src/components/slideover/slideover.theme.ts +51 -55
- package/src/components/slider/RLASlider.astro +3 -15
- package/src/components/slider/slider.theme.ts +17 -34
- package/src/components/slider/slider.ts +1 -1
- package/src/components/speed-dial/RLASpeedDial.astro +9 -20
- package/src/components/speed-dial/speed-dial.theme.ts +9 -12
- package/src/components/spinner/RLASpinner.astro +3 -17
- package/src/components/spinner/spinner.theme.ts +25 -30
- package/src/components/spinner/spinner.ts +1 -1
- package/src/components/splitter/RLASplitter.astro +3 -11
- package/src/components/splitter/splitter.theme.ts +18 -21
- package/src/components/spoiler/RLASpoiler.astro +9 -20
- package/src/components/spoiler/spoiler.theme.ts +9 -12
- package/src/components/stepper/RLAStepper.astro +300 -21
- package/src/components/stepper/stepper.theme.ts +213 -12
- package/src/components/stepper/stepper.ts +23 -6
- package/src/components/steps/RLASteps.astro +5 -11
- package/src/components/steps/steps.theme.ts +9 -12
- package/src/components/sticky-surface/RLAStickySurface.astro +67 -38
- package/src/components/sticky-surface/sticky-surface.theme.ts +7 -11
- package/src/components/sticky-surface/sticky-surface.ts +1 -0
- package/src/components/surround/RLASurround.astro +5 -5
- package/src/components/switch/RLASwitch.astro +3 -18
- package/src/components/switch/switch.theme.ts +46 -61
- package/src/components/switch/switch.ts +1 -1
- package/src/components/table/RLATable.astro +566 -50
- package/src/components/table/table.theme.ts +112 -31
- package/src/components/table/table.ts +207 -6
- package/src/components/table-of-contents/RLATableOfContents.astro +12 -17
- package/src/components/table-of-contents/table-of-contents.theme.ts +60 -63
- package/src/components/tabs/RLATabs.astro +195 -51
- package/src/components/tabs/tabs.theme.ts +81 -84
- package/src/components/tabs/tabs.ts +18 -1
- package/src/components/textarea/RLATextarea.astro +16 -13
- package/src/components/textarea/RLSTextarea.tsx +69 -0
- package/src/components/textarea/RLVTextarea.vue +8 -16
- package/src/components/textarea/textarea.theme.ts +21 -24
- package/src/components/textarea/textarea.ts +2 -1
- package/src/components/theme-selector/RLAThemeSelector.astro +21 -27
- package/src/components/theme-selector/theme-selector.theme.ts +11 -14
- package/src/components/timeline/RLATimeline.astro +24 -44
- package/src/components/timeline/timeline.theme.ts +302 -307
- package/src/components/toast/RLAToast.astro +50 -24
- package/src/components/toast/store.ts +97 -0
- package/src/components/toast/toast.theme.ts +31 -34
- package/src/components/toast/toast.ts +1 -1
- package/src/components/toaster/RLAToaster.astro +76 -6
- package/src/components/tooltip/RLATooltip.astro +136 -33
- package/src/components/tooltip/tooltip.theme.ts +23 -26
- package/src/components/tour/RLATour.astro +9 -20
- package/src/components/tour/tour.theme.ts +9 -12
- package/src/components/tree/RLATree.astro +9 -20
- package/src/components/tree/tree.theme.ts +9 -12
- package/src/components/user/RLAUser.astro +9 -20
- package/src/components/user/user.theme.ts +9 -12
- package/src/components/video/RLAVideo.astro +5 -10
- package/src/components/video/video.theme.ts +13 -16
- package/src/components/watermark/RLAWatermark.astro +9 -20
- package/src/components/watermark/watermark.theme.ts +9 -12
- package/src/components/window-mockup/RLAWindowMockup.astro +9 -20
- package/src/components/window-mockup/window-mockup.theme.ts +9 -12
- package/src/icons.raw.ts +67 -0
- package/src/icons.ts +35 -0
- package/src/index.ts +32 -0
- package/src/preset.ts +148 -0
- package/src/resolver.ts +132 -0
- package/src/shortcuts.ts +191 -0
- package/src/stores.ts +22 -0
- package/src/types.ts +75 -0
- package/src/virtual.d.ts +4 -0
- package/src/components/editor/PageEditor.vue +0 -459
- package/src/components/editor/PageMention.vue +0 -87
- package/src/components/editor/PagePropertiesEditor.vue +0 -358
- package/src/components/editor/PagePropertiesRenderer.vue +0 -285
- package/src/components/editor/PageRenderer.vue +0 -155
- package/src/components/editor/PageSurround.vue +0 -130
- package/src/components/editor/PageVersionSelector.vue +0 -371
- package/src/components/editor/blocks/AddBlockModal.vue +0 -196
- package/src/components/editor/blocks/Block.vue +0 -141
- package/src/components/editor/blocks/BlockEditRenderer.vue +0 -26
- package/src/components/editor/blocks/BlockEditor.vue +0 -141
- package/src/components/editor/blocks/BlockViewRenderer.vue +0 -65
- package/src/components/editor/blocks/TextRenderer.vue +0 -31
- package/src/components/editor/blocks/editor/CalloutBlockEditor.vue +0 -53
- package/src/components/editor/blocks/editor/ImageBlockEditor.vue +0 -55
- package/src/components/editor/blocks/editor/ParagraphBlockEditor.vue +0 -31
- package/src/components/editor/blocks/editor/SectionBlockEditor.vue +0 -65
- package/src/components/editor/blocks/nodes/LinkNode.vue +0 -28
- package/src/components/editor/blocks/nodes/TextNode.vue +0 -22
- package/src/components/editor/blocks/renderer/CalloutBlockRenderer.vue +0 -66
- package/src/components/editor/blocks/renderer/ImageBlockRenderer.vue +0 -20
- package/src/components/editor/blocks/renderer/ParagraphBlockRenderer.vue +0 -21
- package/src/components/editor/blocks/renderer/SectionBlockRenderer.vue +0 -55
- package/src/components/editor/composables/injectionKeys.ts +0 -3
- package/src/components/editor/composables/useBlockEditor.ts +0 -261
- package/src/components/editor/composables/usePageEditor.ts +0 -97
- package/src/components/editor/modals/CreatePageModal.vue +0 -160
- package/src/components/editor/modals/DeletePageModal.vue +0 -116
- package/src/components/editor/modals/PageTreeModal.vue +0 -275
- package/src/components/editor/types/blocks.ts +0 -100
- package/src/components/editor/types/pages.ts +0 -89
- package/src/components/editor/types/schemas.ts +0 -36
- package/src/components/editor/utils/blocks.ts +0 -42
- package/src/components/editor/utils/editorHelpers.ts +0 -24
- package/src/components/editor/utils/page.ts +0 -219
- package/src/components/editor/utils/richTextHelpers.ts +0 -35
- package/src/components/editor/views/PageEditView.vue +0 -195
- package/src/components/editor/views/PageLiveView.vue +0 -90
- package/src/components/editor/views/PageReviewView.vue +0 -308
- package/src/components/head/RLAHead.astro +0 -528
- package/src/components/icon/resolver.ts +0 -37
- package/src/config/color.config.ts +0 -300
- package/src/config/site.config.ts +0 -28
- package/src/config/ui.config.ts +0 -89
- package/src/env.d.ts +0 -23
- package/src/icons/defaults.ts +0 -44
- package/src/presets/index.ts +0 -577
- package/src/stores/toast.ts +0 -24
- package/src/themes.ts +0 -26
- package/src/types/component.ts +0 -28
- package/src/ui.ts +0 -159
- package/src/utils/defineTheme.ts +0 -5
- package/src/utils/merge.ts +0 -62
- package/src/utils/resolveClasses.ts +0 -39
- package/src/utils/resolveTheme.ts +0 -13
- package/src/utils/shortcuts.ts +0 -322
- package/src/utils/toast.ts +0 -36
- package/src/utils/useUi.ts +0 -33
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6
|
|
2
|
-
|
|
3
|
-
export type BlockType = "SectionBlock" | "ParagraphBlock" | "CalloutBlock" | "ImageBlock"
|
|
4
|
-
|
|
5
|
-
export interface BaseBlock {
|
|
6
|
-
id: string
|
|
7
|
-
type: BlockType
|
|
8
|
-
isTemplated?: boolean
|
|
9
|
-
props: Record<string, any>
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface SectionBlockProps {
|
|
13
|
-
level: HeadingLevel
|
|
14
|
-
title: string
|
|
15
|
-
description?: string
|
|
16
|
-
children: Block[]
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface ParagraphBlockProps {
|
|
20
|
-
text: RichTextContent
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type CalloutVariant =
|
|
24
|
-
| "info"
|
|
25
|
-
| "success"
|
|
26
|
-
| "warning"
|
|
27
|
-
| "error"
|
|
28
|
-
| "commentary"
|
|
29
|
-
| "ideation"
|
|
30
|
-
| "source"
|
|
31
|
-
|
|
32
|
-
export interface CalloutBlockProps {
|
|
33
|
-
variant: CalloutVariant
|
|
34
|
-
children: Block[]
|
|
35
|
-
to?: string
|
|
36
|
-
target?: string
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface ImageBlockProps {
|
|
40
|
-
src: string
|
|
41
|
-
alt: string
|
|
42
|
-
caption?: string
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface SectionBlock extends BaseBlock {
|
|
46
|
-
type: "SectionBlock"
|
|
47
|
-
props: SectionBlockProps
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface ParagraphContentBlock extends BaseBlock {
|
|
51
|
-
type: "ParagraphBlock"
|
|
52
|
-
props: ParagraphBlockProps
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface CalloutContentBlock extends BaseBlock {
|
|
56
|
-
type: "CalloutBlock"
|
|
57
|
-
props: CalloutBlockProps
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface ImageContentBlock extends BaseBlock {
|
|
61
|
-
type: "ImageBlock"
|
|
62
|
-
props: ImageBlockProps
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export type Block = SectionBlock | ParagraphContentBlock | CalloutContentBlock | ImageContentBlock
|
|
66
|
-
|
|
67
|
-
export type InlineContentType = "text" | "link" | "mention"
|
|
68
|
-
|
|
69
|
-
export interface BaseInlineContent {
|
|
70
|
-
type: InlineContentType
|
|
71
|
-
id: string
|
|
72
|
-
props: Record<string, any>
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface InlineText extends BaseInlineContent {
|
|
76
|
-
type: "text"
|
|
77
|
-
props: {
|
|
78
|
-
content: string
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface InlineLink extends BaseInlineContent {
|
|
83
|
-
type: "link"
|
|
84
|
-
props: {
|
|
85
|
-
href: string
|
|
86
|
-
target?: "_blank" | "_self"
|
|
87
|
-
content: string
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface InlineMention extends BaseInlineContent {
|
|
92
|
-
type: "mention"
|
|
93
|
-
props: {
|
|
94
|
-
pageId: string
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export type InlineContent = InlineText | InlineLink | InlineMention
|
|
99
|
-
|
|
100
|
-
export type RichTextContent = InlineContent[]
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { type Block } from "./blocks"
|
|
2
|
-
export type { Block }
|
|
3
|
-
import { type Image, type Link } from "./schemas"
|
|
4
|
-
|
|
5
|
-
export type Localized<T = string> = Record<string, T>
|
|
6
|
-
|
|
7
|
-
declare global {
|
|
8
|
-
interface RimelightRegisterPageTypes {}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface RegisterPageTypes extends RimelightRegisterPageTypes {
|
|
12
|
-
Default: BasePageProperties
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type PageType = keyof RegisterPageTypes
|
|
16
|
-
|
|
17
|
-
export interface Property<T = any> {
|
|
18
|
-
defaultValue: T | string | string[] | number | Localized | Localized[]
|
|
19
|
-
label: Localized
|
|
20
|
-
type: "number" | "text" | "text-array" | "enum" | "page" | "page-array"
|
|
21
|
-
options?: string[] | Localized[]
|
|
22
|
-
allowedPageTypes?: PageType[]
|
|
23
|
-
order?: number
|
|
24
|
-
visibleIf?: (properties: any) => boolean
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface PropertyGroup {
|
|
28
|
-
label: Localized
|
|
29
|
-
order?: number
|
|
30
|
-
fields: Record<string, Property>
|
|
31
|
-
defaultOpen: boolean
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface PageDefinition {
|
|
35
|
-
typeLabelKey: string
|
|
36
|
-
properties: Record<string, PropertyGroup>
|
|
37
|
-
initialBlocks?: () => Block[]
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface BasePageProperties {
|
|
41
|
-
[key: string]: PropertyGroup | undefined
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface BasePage {
|
|
45
|
-
id: string
|
|
46
|
-
slug: string
|
|
47
|
-
icon?: Image
|
|
48
|
-
banner?: Image
|
|
49
|
-
images?: Image[]
|
|
50
|
-
title: Localized
|
|
51
|
-
description?: Localized
|
|
52
|
-
tags?: Localized[]
|
|
53
|
-
links?: Link[]
|
|
54
|
-
authorsIds?: string[]
|
|
55
|
-
blocks: Block[]
|
|
56
|
-
postedAt?: Date | string | null
|
|
57
|
-
createdAt: Date | string
|
|
58
|
-
updatedAt: Date | string
|
|
59
|
-
status?: "published" | "draft" | "archived" | (string & {})
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface Page extends BasePage {
|
|
63
|
-
type: PageType
|
|
64
|
-
properties: RegisterPageTypes[PageType]
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export type SurroundItem = Pick<BasePage, "id" | "slug" | "title" | "description">
|
|
68
|
-
|
|
69
|
-
export interface PageSurround {
|
|
70
|
-
previous: SurroundItem | null
|
|
71
|
-
next: SurroundItem | null
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface PageVersion extends BasePage {
|
|
75
|
-
pageId: string
|
|
76
|
-
status: "pending" | "approved" | "rejected"
|
|
77
|
-
type: PageType
|
|
78
|
-
content: {
|
|
79
|
-
blocks: Block[]
|
|
80
|
-
properties: RegisterPageTypes[PageType]
|
|
81
|
-
}
|
|
82
|
-
createdBy: string
|
|
83
|
-
approvedBy?: string | null
|
|
84
|
-
approvedAt?: Date | string | null
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export function definePageDefinition(definition: PageDefinition): PageDefinition {
|
|
88
|
-
return definition
|
|
89
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { z } from "astro/zod"
|
|
2
|
-
|
|
3
|
-
export const LocalizedSchema = (schema: z.ZodTypeAny) => z.record(z.string(), schema)
|
|
4
|
-
|
|
5
|
-
export const linkVariantEnum = z.enum(["solid", "outline", "subtle", "soft", "ghost", "link"])
|
|
6
|
-
|
|
7
|
-
export const linkColorEnum = z.enum([
|
|
8
|
-
"primary",
|
|
9
|
-
"secondary",
|
|
10
|
-
"neutral",
|
|
11
|
-
"error",
|
|
12
|
-
"warning",
|
|
13
|
-
"success",
|
|
14
|
-
"info"
|
|
15
|
-
])
|
|
16
|
-
|
|
17
|
-
export const ImageSchema = z.object({
|
|
18
|
-
src: z.string().min(1, "Image source must be provided."),
|
|
19
|
-
alt: z.string().min(1, "Image alt text must be provided."),
|
|
20
|
-
width: z.number().int().min(1).optional(),
|
|
21
|
-
height: z.number().int().min(1).optional(),
|
|
22
|
-
name: LocalizedSchema(z.string()).optional()
|
|
23
|
-
})
|
|
24
|
-
export type Image = z.infer<typeof ImageSchema>
|
|
25
|
-
|
|
26
|
-
export const LinkSchema = z.object({
|
|
27
|
-
label: z.string().min(1, "Link label must be provided."),
|
|
28
|
-
to: z.string().min(1, "Link destination must be provided."),
|
|
29
|
-
icon: z.string().optional(),
|
|
30
|
-
trailing: z.boolean().optional(),
|
|
31
|
-
color: linkColorEnum.optional(),
|
|
32
|
-
variant: linkVariantEnum.optional()
|
|
33
|
-
})
|
|
34
|
-
export type Link = z.infer<typeof LinkSchema>
|
|
35
|
-
|
|
36
|
-
export type UserAvailability = "available" | "busy" | "invisible"
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { BlockType } from "../types/blocks"
|
|
2
|
-
|
|
3
|
-
export interface BlockDefinition {
|
|
4
|
-
type: BlockType
|
|
5
|
-
label: string
|
|
6
|
-
icon: string
|
|
7
|
-
category: string
|
|
8
|
-
description?: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const CATEGORY_ORDER = ["Layout", "Text", "Media", "Special"]
|
|
12
|
-
|
|
13
|
-
export const BLOCK_DEFINITIONS: BlockDefinition[] = [
|
|
14
|
-
{
|
|
15
|
-
type: "SectionBlock",
|
|
16
|
-
label: "blocks.SectionBlock.label",
|
|
17
|
-
icon: "i-lucide-heading",
|
|
18
|
-
category: "Layout",
|
|
19
|
-
description: "blocks.SectionBlock.description"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
type: "ParagraphBlock",
|
|
23
|
-
label: "blocks.ParagraphBlock.label",
|
|
24
|
-
icon: "i-lucide-pilcrow",
|
|
25
|
-
category: "Text",
|
|
26
|
-
description: "blocks.ParagraphBlock.description"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
type: "ImageBlock",
|
|
30
|
-
label: "blocks.ImageBlock.label",
|
|
31
|
-
icon: "i-lucide-image",
|
|
32
|
-
category: "Media",
|
|
33
|
-
description: "blocks.ImageBlock.description"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
type: "CalloutBlock",
|
|
37
|
-
label: "blocks.CalloutBlock.label",
|
|
38
|
-
icon: "i-lucide-info",
|
|
39
|
-
category: "Special",
|
|
40
|
-
description: "blocks.CalloutBlock.description"
|
|
41
|
-
}
|
|
42
|
-
]
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ref } from "vue"
|
|
2
|
-
|
|
3
|
-
function translate(key: string, fallback?: string) {
|
|
4
|
-
if (fallback !== undefined) return fallback
|
|
5
|
-
const parts = key.split(".")
|
|
6
|
-
return parts[parts.length - 1] || key
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function useI18n() {
|
|
10
|
-
const locale = ref("en")
|
|
11
|
-
return { t: translate, locale }
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function addToast(options: { title?: string; description?: string; color?: string }) {
|
|
15
|
-
if (typeof window !== "undefined") {
|
|
16
|
-
console.log(
|
|
17
|
-
`[Toast ${options.color || "info"}]: ${options.title || ""} ${options.description || ""}`
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function useToast() {
|
|
23
|
-
return { add: addToast }
|
|
24
|
-
}
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import { type MaybeRefOrGetter, toValue } from "vue"
|
|
2
|
-
import type {
|
|
3
|
-
Localized,
|
|
4
|
-
Page,
|
|
5
|
-
PageVersion,
|
|
6
|
-
BasePageProperties,
|
|
7
|
-
PageDefinition,
|
|
8
|
-
Property,
|
|
9
|
-
PropertyGroup
|
|
10
|
-
} from "../types/pages"
|
|
11
|
-
import type { Block, SectionBlock } from "../types/blocks"
|
|
12
|
-
|
|
13
|
-
function getValue(value: object, key: string): unknown {
|
|
14
|
-
return Reflect.get(value, key)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const getLocalizedContent = <T = string>(
|
|
18
|
-
field: Localized<T> | T | undefined,
|
|
19
|
-
currentLocale: MaybeRefOrGetter<string>
|
|
20
|
-
): T | string => {
|
|
21
|
-
if (field === undefined || field === null) return ""
|
|
22
|
-
if (typeof field !== "object") return String(field)
|
|
23
|
-
|
|
24
|
-
const locale = toValue(currentLocale)
|
|
25
|
-
|
|
26
|
-
if (Object.keys(field).length === 0) return ""
|
|
27
|
-
|
|
28
|
-
const val = getValue(field, locale) ?? getValue(field, "en")
|
|
29
|
-
if (val !== undefined && val !== null) {
|
|
30
|
-
if (typeof val === "string") return val
|
|
31
|
-
if (typeof val === "object") {
|
|
32
|
-
const innerVal = getValue(val, locale) ?? getValue(val, "en")
|
|
33
|
-
if (typeof innerVal === "string") return innerVal
|
|
34
|
-
const firstString = Object.values(val).find((v) => typeof v === "string")
|
|
35
|
-
if (firstString !== undefined) return firstString
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const firstVal = Object.values(field).find((v) => typeof v === "string" && v.trim() !== "")
|
|
40
|
-
if (firstVal !== undefined) return String(firstVal)
|
|
41
|
-
|
|
42
|
-
return ""
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function syncPageWithDefinition(page: Page, definition?: PageDefinition): Page {
|
|
46
|
-
if (!definition) return page
|
|
47
|
-
|
|
48
|
-
const updatedProperties: BasePageProperties = {}
|
|
49
|
-
const definitionGroups = definition.properties
|
|
50
|
-
const existingProperties: Record<string, PropertyGroup | undefined> = page.properties || {}
|
|
51
|
-
|
|
52
|
-
for (const [groupId, group] of Object.entries(definitionGroups)) {
|
|
53
|
-
const definitionGroup = group
|
|
54
|
-
let existingGroup = existingProperties[groupId]
|
|
55
|
-
|
|
56
|
-
if (!existingGroup) {
|
|
57
|
-
const lowerGroupId = groupId.toLowerCase()
|
|
58
|
-
const foundGroupKey = Object.keys(existingProperties).find(
|
|
59
|
-
(k) => k.toLowerCase() === lowerGroupId
|
|
60
|
-
)
|
|
61
|
-
if (foundGroupKey) {
|
|
62
|
-
existingGroup = existingProperties[foundGroupKey]
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const updatedGroupFields: Record<string, Property> = {}
|
|
67
|
-
const definitionFields = definitionGroup.fields || {}
|
|
68
|
-
|
|
69
|
-
for (const [fieldId, field] of Object.entries(definitionFields)) {
|
|
70
|
-
const definitionField = field
|
|
71
|
-
let value = definitionField.defaultValue
|
|
72
|
-
|
|
73
|
-
if (existingGroup) {
|
|
74
|
-
if (existingGroup.fields?.[fieldId]?.defaultValue !== undefined) {
|
|
75
|
-
value = existingGroup.fields[fieldId].defaultValue
|
|
76
|
-
} else if (getValue(existingGroup, fieldId) !== undefined) {
|
|
77
|
-
value = getValue(existingGroup, fieldId)
|
|
78
|
-
} else {
|
|
79
|
-
const lowerFieldId = fieldId.toLowerCase()
|
|
80
|
-
const foundKey = Object.keys(existingGroup).find((k) => k.toLowerCase() === lowerFieldId)
|
|
81
|
-
if (foundKey && getValue(existingGroup, foundKey) !== undefined) {
|
|
82
|
-
value = getValue(existingGroup, foundKey)
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
updatedGroupFields[fieldId] = {
|
|
88
|
-
...JSON.parse(JSON.stringify(definitionField)),
|
|
89
|
-
defaultValue: value
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
updatedProperties[groupId] = {
|
|
94
|
-
...definitionGroup,
|
|
95
|
-
fields: updatedGroupFields
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
page.properties = updatedProperties
|
|
100
|
-
|
|
101
|
-
if (definition.initialBlocks) {
|
|
102
|
-
const templateBlocks = definition.initialBlocks()
|
|
103
|
-
const currentBlocks = page.blocks || []
|
|
104
|
-
const definitionTemplatedBlocks = templateBlocks.filter((b) => b.isTemplated)
|
|
105
|
-
|
|
106
|
-
let updatedBlocks = currentBlocks.filter((b: Block) => {
|
|
107
|
-
if (!b.isTemplated) return true
|
|
108
|
-
return definitionTemplatedBlocks.some((db: Block) => isSameBlock(b, db))
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
for (const db of definitionTemplatedBlocks) {
|
|
112
|
-
const existingIdx = updatedBlocks.findIndex((b: Block) => isSameBlock(b, db))
|
|
113
|
-
const dbIndexAtStart = templateBlocks.findIndex((b: Block) => b.id === db.id)
|
|
114
|
-
|
|
115
|
-
if (existingIdx === -1) {
|
|
116
|
-
updatedBlocks.splice(dbIndexAtStart, 0, { ...db })
|
|
117
|
-
} else {
|
|
118
|
-
const existing = updatedBlocks[existingIdx]
|
|
119
|
-
if (!existing) {
|
|
120
|
-
updatedBlocks.splice(dbIndexAtStart, 0, { ...db })
|
|
121
|
-
continue
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (existing.type === "SectionBlock" && db.type === "SectionBlock") {
|
|
125
|
-
const updated: SectionBlock = {
|
|
126
|
-
...existing,
|
|
127
|
-
...db,
|
|
128
|
-
props: {
|
|
129
|
-
...db.props,
|
|
130
|
-
children: existing.props.children || db.props.children || []
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
updatedBlocks[existingIdx] = updated
|
|
134
|
-
} else {
|
|
135
|
-
updatedBlocks[existingIdx] = { ...db }
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
page.blocks = updatedBlocks
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return page
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function isSameBlock(a: any, b: any) {
|
|
147
|
-
if (a.id === b.id) return true
|
|
148
|
-
if (a.type !== b.type) return false
|
|
149
|
-
if (a.type === "SectionBlock" && b.type === "SectionBlock") {
|
|
150
|
-
return a.props.title === b.props.title
|
|
151
|
-
}
|
|
152
|
-
return false
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export function dehydratePageProperties(properties: BasePageProperties): any {
|
|
156
|
-
const dehydrated: any = {}
|
|
157
|
-
for (const [groupKey, group] of Object.entries(properties)) {
|
|
158
|
-
if (!group?.fields) continue
|
|
159
|
-
dehydrated[groupKey] = {}
|
|
160
|
-
for (const [fieldKey, field] of Object.entries(group.fields)) {
|
|
161
|
-
dehydrated[groupKey][fieldKey] = field.defaultValue
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return dehydrated
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export function convertVersionToPage(version: PageVersion): Page {
|
|
168
|
-
const blocks = version.content?.blocks || version.blocks || []
|
|
169
|
-
const properties = version.content?.properties || getValue(version, "properties")
|
|
170
|
-
const rawAuthorIds = getValue(version, "authorIds")
|
|
171
|
-
|
|
172
|
-
return {
|
|
173
|
-
id: version.pageId || version.id,
|
|
174
|
-
type: version.type,
|
|
175
|
-
blocks: JSON.parse(JSON.stringify(blocks)),
|
|
176
|
-
properties: properties ? JSON.parse(JSON.stringify(properties)) : {},
|
|
177
|
-
authorsIds:
|
|
178
|
-
version.authorsIds ??
|
|
179
|
-
(Array.isArray(rawAuthorIds)
|
|
180
|
-
? rawAuthorIds.filter((s): s is string => typeof s === "string")
|
|
181
|
-
: []),
|
|
182
|
-
createdAt: version.createdAt ? new Date(version.createdAt) : new Date(),
|
|
183
|
-
updatedAt: version.updatedAt ? new Date(version.updatedAt) : new Date(),
|
|
184
|
-
postedAt: version.postedAt ? new Date(version.postedAt) : null,
|
|
185
|
-
...(version.banner ? { banner: version.banner } : {}),
|
|
186
|
-
...(version.icon ? { icon: version.icon } : {}),
|
|
187
|
-
images: version.images || [],
|
|
188
|
-
title: version.title || { en: "" },
|
|
189
|
-
slug: version.slug || "",
|
|
190
|
-
description: version.description || { en: "" },
|
|
191
|
-
tags: version.tags || [],
|
|
192
|
-
links: version.links || []
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export function getPageResolutionPath(idOrSlug: string): string {
|
|
197
|
-
if (
|
|
198
|
-
!idOrSlug ||
|
|
199
|
-
idOrSlug === "undefined" ||
|
|
200
|
-
idOrSlug === "null" ||
|
|
201
|
-
idOrSlug === "[object Object]"
|
|
202
|
-
)
|
|
203
|
-
return ""
|
|
204
|
-
|
|
205
|
-
let clean = idOrSlug.replace(/^(?:.*\/)?api\/pages\/(?:id|find)\//, "")
|
|
206
|
-
clean = clean.replace(/^\/|\/$/g, "")
|
|
207
|
-
|
|
208
|
-
const parts = clean.split("/")
|
|
209
|
-
if (parts.length >= 4) {
|
|
210
|
-
const threePart = parts.slice(0, 3).join("/")
|
|
211
|
-
const nextThreePart = parts.slice(3, 6).join("/")
|
|
212
|
-
if (threePart === nextThreePart) {
|
|
213
|
-
clean = parts.slice(3).join("/")
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
const isUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(clean)
|
|
218
|
-
return isUuid ? `/api/pages/id/${clean}` : `/api/pages/find/${clean}`
|
|
219
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { RichTextContent, InlineText } from "../types/blocks"
|
|
2
|
-
|
|
3
|
-
export function richTextToHtml(content: RichTextContent): string {
|
|
4
|
-
if (!Array.isArray(content)) return ""
|
|
5
|
-
return content
|
|
6
|
-
.map((item) => {
|
|
7
|
-
if (item.type === "text" || item.type === "link") {
|
|
8
|
-
return item.props.content
|
|
9
|
-
}
|
|
10
|
-
if (item.type === "mention") {
|
|
11
|
-
return ""
|
|
12
|
-
}
|
|
13
|
-
return ""
|
|
14
|
-
})
|
|
15
|
-
.join("")
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function parseHtmlToRichText(html: string): RichTextContent {
|
|
19
|
-
if (!html || html.trim().length === 0) {
|
|
20
|
-
return []
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const newTextNode: InlineText = {
|
|
24
|
-
id:
|
|
25
|
-
typeof crypto !== "undefined" && typeof crypto.randomUUID === "function"
|
|
26
|
-
? crypto.randomUUID()
|
|
27
|
-
: Math.random().toString(36).substring(2, 15),
|
|
28
|
-
type: "text",
|
|
29
|
-
props: {
|
|
30
|
-
content: html.trim()
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return [newTextNode]
|
|
35
|
-
}
|