snice 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/snice-accordion-item.d.ts +2 -2
- package/dist/components/accordion/snice-accordion-item.js +8 -8
- package/dist/components/accordion/snice-accordion-item.js.map +1 -1
- package/dist/components/accordion/snice-accordion.d.ts +2 -2
- package/dist/components/accordion/snice-accordion.js +8 -8
- package/dist/components/accordion/snice-accordion.js.map +1 -1
- package/dist/components/actions/snice-actions.d.ts +28 -0
- package/dist/components/actions/snice-actions.js +220 -0
- package/dist/components/actions/snice-actions.js.map +1 -0
- package/dist/components/actions/snice-actions.types.d.ts +27 -0
- package/dist/components/alert/snice-alert.d.ts +2 -2
- package/dist/components/alert/snice-alert.js +8 -8
- package/dist/components/alert/snice-alert.js.map +1 -1
- package/dist/components/audio-recorder/snice-audio-recorder.d.ts +58 -0
- package/dist/components/audio-recorder/snice-audio-recorder.js +413 -0
- package/dist/components/audio-recorder/snice-audio-recorder.js.map +1 -0
- package/dist/components/audio-recorder/snice-audio-recorder.types.d.ts +28 -0
- package/dist/components/avatar/snice-avatar.d.ts +2 -2
- package/dist/components/avatar/snice-avatar.js +8 -8
- package/dist/components/avatar/snice-avatar.js.map +1 -1
- package/dist/components/badge/snice-badge.d.ts +2 -2
- package/dist/components/badge/snice-badge.js +9 -9
- package/dist/components/badge/snice-badge.js.map +1 -1
- package/dist/components/banner/snice-banner.d.ts +2 -2
- package/dist/components/banner/snice-banner.js +8 -8
- package/dist/components/banner/snice-banner.js.map +1 -1
- package/dist/components/breadcrumbs/snice-breadcrumbs.d.ts +2 -2
- package/dist/components/breadcrumbs/snice-breadcrumbs.js +8 -8
- package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -1
- package/dist/components/button/snice-button.d.ts +2 -2
- package/dist/components/button/snice-button.js +8 -8
- package/dist/components/button/snice-button.js.map +1 -1
- package/dist/components/calendar/snice-calendar.d.ts +46 -0
- package/dist/components/calendar/snice-calendar.js +294 -0
- package/dist/components/calendar/snice-calendar.js.map +1 -0
- package/dist/components/calendar/snice-calendar.types.d.ts +34 -0
- package/dist/components/camera/snice-camera.d.ts +39 -0
- package/dist/components/camera/snice-camera.js +286 -0
- package/dist/components/camera/snice-camera.js.map +1 -0
- package/dist/components/camera/snice-camera.types.d.ts +28 -0
- package/dist/components/card/snice-card.d.ts +2 -2
- package/dist/components/card/snice-card.js +8 -8
- package/dist/components/card/snice-card.js.map +1 -1
- package/dist/components/carousel/snice-carousel.d.ts +32 -0
- package/dist/components/carousel/snice-carousel.js +279 -0
- package/dist/components/carousel/snice-carousel.js.map +1 -0
- package/dist/components/carousel/snice-carousel.types.d.ts +22 -0
- package/dist/components/chart/snice-chart.d.ts +73 -0
- package/dist/components/chart/snice-chart.js +940 -0
- package/dist/components/chart/snice-chart.js.map +1 -0
- package/dist/components/chart/snice-chart.types.d.ts +71 -0
- package/dist/components/chat/snice-chat.d.ts +98 -0
- package/dist/components/chat/snice-chat.js +589 -0
- package/dist/components/chat/snice-chat.js.map +1 -0
- package/dist/components/chat/snice-chat.types.d.ts +141 -0
- package/dist/components/checkbox/snice-checkbox.d.ts +2 -2
- package/dist/components/checkbox/snice-checkbox.js +8 -8
- package/dist/components/checkbox/snice-checkbox.js.map +1 -1
- package/dist/components/chip/snice-chip.d.ts +2 -2
- package/dist/components/chip/snice-chip.js +8 -8
- package/dist/components/chip/snice-chip.js.map +1 -1
- package/dist/components/code-block/snice-code-block.d.ts +15 -0
- package/dist/components/code-block/snice-code-block.js +141 -0
- package/dist/components/code-block/snice-code-block.js.map +1 -0
- package/dist/components/code-block/snice-code-block.types.d.ts +15 -0
- package/dist/components/color-display/snice-color-display.d.ts +2 -2
- package/dist/components/color-display/snice-color-display.js +9 -9
- package/dist/components/color-display/snice-color-display.js.map +1 -1
- package/dist/components/color-picker/snice-color-picker.d.ts +2 -2
- package/dist/components/color-picker/snice-color-picker.js +8 -8
- package/dist/components/color-picker/snice-color-picker.js.map +1 -1
- package/dist/components/command-palette/snice-command-palette.d.ts +47 -0
- package/dist/components/command-palette/snice-command-palette.js +428 -0
- package/dist/components/command-palette/snice-command-palette.js.map +1 -0
- package/dist/components/command-palette/snice-command-palette.types.d.ts +49 -0
- package/dist/components/date-picker/snice-date-picker.d.ts +2 -2
- package/dist/components/date-picker/snice-date-picker.js +9 -9
- package/dist/components/date-picker/snice-date-picker.js.map +1 -1
- package/dist/components/divider/snice-divider.d.ts +2 -2
- package/dist/components/divider/snice-divider.js +8 -8
- package/dist/components/divider/snice-divider.js.map +1 -1
- package/dist/components/doc/snice-doc.d.ts +93 -0
- package/dist/components/doc/snice-doc.js +626 -0
- package/dist/components/doc/snice-doc.js.map +1 -0
- package/dist/components/doc/snice-doc.types.d.ts +118 -0
- package/dist/components/draw/snice-draw.d.ts +71 -0
- package/dist/components/draw/snice-draw.js +709 -0
- package/dist/components/draw/snice-draw.js.map +1 -0
- package/dist/components/draw/snice-draw.types.d.ts +41 -0
- package/dist/components/drawer/snice-drawer.d.ts +2 -2
- package/dist/components/drawer/snice-drawer.js +8 -8
- package/dist/components/drawer/snice-drawer.js.map +1 -1
- package/dist/components/empty-state/snice-empty-state.d.ts +2 -2
- package/dist/components/empty-state/snice-empty-state.js +8 -8
- package/dist/components/empty-state/snice-empty-state.js.map +1 -1
- package/dist/components/file-upload/snice-file-upload.d.ts +2 -3
- package/dist/components/file-upload/snice-file-upload.js +8 -15
- package/dist/components/file-upload/snice-file-upload.js.map +1 -1
- package/dist/components/gantt/snice-gantt.d.ts +29 -0
- package/dist/components/gantt/snice-gantt.js +268 -0
- package/dist/components/gantt/snice-gantt.js.map +1 -0
- package/dist/components/gantt/snice-gantt.types.d.ts +23 -0
- package/dist/components/image/snice-image.d.ts +2 -2
- package/dist/components/image/snice-image.js +9 -9
- package/dist/components/image/snice-image.js.map +1 -1
- package/dist/components/input/snice-input.d.ts +2 -2
- package/dist/components/input/snice-input.js +8 -8
- package/dist/components/input/snice-input.js.map +1 -1
- package/dist/components/kanban/snice-kanban.d.ts +31 -0
- package/dist/components/kanban/snice-kanban.js +243 -0
- package/dist/components/kanban/snice-kanban.js.map +1 -0
- package/dist/components/kanban/snice-kanban.types.d.ts +29 -0
- package/dist/components/kpi/snice-kpi.d.ts +2 -2
- package/dist/components/kpi/snice-kpi.js +10 -10
- package/dist/components/kpi/snice-kpi.js.map +1 -1
- package/dist/components/layout/snice-layout-blog.d.ts +2 -2
- package/dist/components/layout/snice-layout-blog.js +8 -8
- package/dist/components/layout/snice-layout-blog.js.map +1 -1
- package/dist/components/layout/snice-layout-card.d.ts +2 -2
- package/dist/components/layout/snice-layout-card.js +8 -8
- package/dist/components/layout/snice-layout-card.js.map +1 -1
- package/dist/components/layout/snice-layout-centered.d.ts +2 -2
- package/dist/components/layout/snice-layout-centered.js +8 -8
- package/dist/components/layout/snice-layout-centered.js.map +1 -1
- package/dist/components/layout/snice-layout-dashboard.d.ts +2 -2
- package/dist/components/layout/snice-layout-dashboard.js +8 -8
- package/dist/components/layout/snice-layout-dashboard.js.map +1 -1
- package/dist/components/layout/snice-layout-fullscreen.d.ts +2 -2
- package/dist/components/layout/snice-layout-fullscreen.js +8 -8
- package/dist/components/layout/snice-layout-fullscreen.js.map +1 -1
- package/dist/components/layout/snice-layout-landing.d.ts +2 -2
- package/dist/components/layout/snice-layout-landing.js +8 -8
- package/dist/components/layout/snice-layout-landing.js.map +1 -1
- package/dist/components/layout/snice-layout-minimal.d.ts +2 -2
- package/dist/components/layout/snice-layout-minimal.js +8 -8
- package/dist/components/layout/snice-layout-minimal.js.map +1 -1
- package/dist/components/layout/snice-layout-sidebar.d.ts +2 -2
- package/dist/components/layout/snice-layout-sidebar.js +8 -8
- package/dist/components/layout/snice-layout-sidebar.js.map +1 -1
- package/dist/components/layout/snice-layout-split.d.ts +2 -2
- package/dist/components/layout/snice-layout-split.js +8 -8
- package/dist/components/layout/snice-layout-split.js.map +1 -1
- package/dist/components/layout/snice-layout.d.ts +2 -2
- package/dist/components/layout/snice-layout.js +8 -8
- package/dist/components/layout/snice-layout.js.map +1 -1
- package/dist/components/link/snice-link.d.ts +2 -2
- package/dist/components/link/snice-link.js +9 -9
- package/dist/components/link/snice-link.js.map +1 -1
- package/dist/components/list/snice-list-item.d.ts +6 -0
- package/dist/components/list/snice-list-item.js +68 -0
- package/dist/components/list/snice-list-item.js.map +1 -0
- package/dist/components/list/snice-list.d.ts +23 -0
- package/dist/components/list/snice-list.js +270 -0
- package/dist/components/list/snice-list.js.map +1 -0
- package/dist/components/list/snice-list.types.d.ts +28 -0
- package/dist/components/location/snice-location.d.ts +35 -0
- package/dist/components/location/snice-location.js +238 -0
- package/dist/components/location/snice-location.js.map +1 -0
- package/dist/components/location/snice-location.types.d.ts +35 -0
- package/dist/components/login/snice-login.d.ts +2 -2
- package/dist/components/login/snice-login.js +8 -8
- package/dist/components/login/snice-login.js.map +1 -1
- package/dist/components/menu/snice-menu-divider.d.ts +4 -0
- package/dist/components/menu/snice-menu-divider.js +53 -0
- package/dist/components/menu/snice-menu-divider.js.map +1 -0
- package/dist/components/menu/snice-menu-item.d.ts +10 -0
- package/dist/components/menu/snice-menu-item.js +99 -0
- package/dist/components/menu/snice-menu-item.js.map +1 -0
- package/dist/components/menu/snice-menu-item.types.d.ts +9 -0
- package/dist/components/menu/snice-menu.d.ts +27 -0
- package/dist/components/menu/snice-menu.js +199 -0
- package/dist/components/menu/snice-menu.js.map +1 -0
- package/dist/components/menu/snice-menu.types.d.ts +18 -0
- package/dist/components/modal/snice-modal.d.ts +2 -2
- package/dist/components/modal/snice-modal.js +8 -8
- package/dist/components/modal/snice-modal.js.map +1 -1
- package/dist/components/nav/snice-nav.js.map +1 -1
- package/dist/components/pagination/snice-pagination.d.ts +2 -2
- package/dist/components/pagination/snice-pagination.js +8 -8
- package/dist/components/pagination/snice-pagination.js.map +1 -1
- package/dist/components/progress/snice-progress.d.ts +2 -2
- package/dist/components/progress/snice-progress.js +8 -8
- package/dist/components/progress/snice-progress.js.map +1 -1
- package/dist/components/qr-code/qrcode.d.ts +28 -0
- package/dist/components/qr-code/qrcode.js +906 -0
- package/dist/components/qr-code/qrcode.js.map +1 -0
- package/dist/components/qr-code/snice-qr-code.d.ts +35 -0
- package/dist/components/qr-code/snice-qr-code.js +256 -0
- package/dist/components/qr-code/snice-qr-code.js.map +1 -0
- package/dist/components/qr-code/snice-qr-code.types.d.ts +33 -0
- package/dist/components/radio/snice-radio.d.ts +2 -2
- package/dist/components/radio/snice-radio.js +8 -8
- package/dist/components/radio/snice-radio.js.map +1 -1
- package/dist/components/select/snice-option.d.ts +2 -2
- package/dist/components/select/snice-option.js +8 -8
- package/dist/components/select/snice-option.js.map +1 -1
- package/dist/components/select/snice-select.d.ts +2 -2
- package/dist/components/select/snice-select.js +8 -8
- package/dist/components/select/snice-select.js.map +1 -1
- package/dist/components/skeleton/snice-skeleton.d.ts +2 -2
- package/dist/components/skeleton/snice-skeleton.js +8 -8
- package/dist/components/skeleton/snice-skeleton.js.map +1 -1
- package/dist/components/slider/snice-slider.d.ts +2 -2
- package/dist/components/slider/snice-slider.js +8 -8
- package/dist/components/slider/snice-slider.js.map +1 -1
- package/dist/components/sparkline/snice-sparkline.d.ts +2 -2
- package/dist/components/sparkline/snice-sparkline.js +9 -9
- package/dist/components/sparkline/snice-sparkline.js.map +1 -1
- package/dist/components/spinner/snice-spinner.d.ts +2 -2
- package/dist/components/spinner/snice-spinner.js +9 -9
- package/dist/components/spinner/snice-spinner.js.map +1 -1
- package/dist/components/split-pane/snice-split-pane.d.ts +32 -0
- package/dist/components/split-pane/snice-split-pane.js +191 -0
- package/dist/components/split-pane/snice-split-pane.js.map +1 -0
- package/dist/components/split-pane/snice-split-pane.types.d.ts +19 -0
- package/dist/components/stat/snice-stat.d.ts +14 -0
- package/dist/components/stat/snice-stat.js +140 -0
- package/dist/components/stat/snice-stat.js.map +1 -0
- package/dist/components/stat/snice-stat.types.d.ts +12 -0
- package/dist/components/stepper/snice-stepper-panel.d.ts +2 -2
- package/dist/components/stepper/snice-stepper-panel.js +9 -9
- package/dist/components/stepper/snice-stepper-panel.js.map +1 -1
- package/dist/components/stepper/snice-stepper.d.ts +2 -2
- package/dist/components/stepper/snice-stepper.js +9 -9
- package/dist/components/stepper/snice-stepper.js.map +1 -1
- package/dist/components/switch/snice-switch.d.ts +2 -2
- package/dist/components/switch/snice-switch.js +8 -8
- package/dist/components/switch/snice-switch.js.map +1 -1
- package/dist/components/table/snice-cell-actions.d.ts +2 -2
- package/dist/components/table/snice-cell-actions.js +8 -8
- package/dist/components/table/snice-cell-actions.js.map +1 -1
- package/dist/components/table/snice-cell-boolean.d.ts +2 -2
- package/dist/components/table/snice-cell-boolean.js +8 -8
- package/dist/components/table/snice-cell-boolean.js.map +1 -1
- package/dist/components/table/snice-cell-color.d.ts +2 -2
- package/dist/components/table/snice-cell-color.js +8 -8
- package/dist/components/table/snice-cell-color.js.map +1 -1
- package/dist/components/table/snice-cell-currency.d.ts +2 -2
- package/dist/components/table/snice-cell-currency.js +8 -8
- package/dist/components/table/snice-cell-currency.js.map +1 -1
- package/dist/components/table/snice-cell-date.d.ts +2 -2
- package/dist/components/table/snice-cell-date.js +8 -8
- package/dist/components/table/snice-cell-date.js.map +1 -1
- package/dist/components/table/snice-cell-duration.d.ts +2 -2
- package/dist/components/table/snice-cell-duration.js +8 -8
- package/dist/components/table/snice-cell-duration.js.map +1 -1
- package/dist/components/table/snice-cell-email.d.ts +2 -2
- package/dist/components/table/snice-cell-email.js +8 -8
- package/dist/components/table/snice-cell-email.js.map +1 -1
- package/dist/components/table/snice-cell-filesize.d.ts +2 -2
- package/dist/components/table/snice-cell-filesize.js +8 -8
- package/dist/components/table/snice-cell-filesize.js.map +1 -1
- package/dist/components/table/snice-cell-image.d.ts +2 -2
- package/dist/components/table/snice-cell-image.js +8 -8
- package/dist/components/table/snice-cell-image.js.map +1 -1
- package/dist/components/table/snice-cell-json.d.ts +2 -2
- package/dist/components/table/snice-cell-json.js +8 -8
- package/dist/components/table/snice-cell-json.js.map +1 -1
- package/dist/components/table/snice-cell-link.d.ts +2 -2
- package/dist/components/table/snice-cell-link.js +8 -8
- package/dist/components/table/snice-cell-link.js.map +1 -1
- package/dist/components/table/snice-cell-location.d.ts +2 -2
- package/dist/components/table/snice-cell-location.js +8 -8
- package/dist/components/table/snice-cell-location.js.map +1 -1
- package/dist/components/table/snice-cell-number.d.ts +2 -2
- package/dist/components/table/snice-cell-number.js +8 -8
- package/dist/components/table/snice-cell-number.js.map +1 -1
- package/dist/components/table/snice-cell-percentage.d.ts +2 -2
- package/dist/components/table/snice-cell-percentage.js +8 -8
- package/dist/components/table/snice-cell-percentage.js.map +1 -1
- package/dist/components/table/snice-cell-phone.d.ts +2 -2
- package/dist/components/table/snice-cell-phone.js +8 -8
- package/dist/components/table/snice-cell-phone.js.map +1 -1
- package/dist/components/table/snice-cell-progress.d.ts +2 -2
- package/dist/components/table/snice-cell-progress.js +8 -8
- package/dist/components/table/snice-cell-progress.js.map +1 -1
- package/dist/components/table/snice-cell-rating.d.ts +2 -2
- package/dist/components/table/snice-cell-rating.js +8 -8
- package/dist/components/table/snice-cell-rating.js.map +1 -1
- package/dist/components/table/snice-cell-sparkline.d.ts +2 -2
- package/dist/components/table/snice-cell-sparkline.js +8 -8
- package/dist/components/table/snice-cell-sparkline.js.map +1 -1
- package/dist/components/table/snice-cell-status.d.ts +2 -2
- package/dist/components/table/snice-cell-status.js +8 -8
- package/dist/components/table/snice-cell-status.js.map +1 -1
- package/dist/components/table/snice-cell-tag.d.ts +2 -2
- package/dist/components/table/snice-cell-tag.js +8 -8
- package/dist/components/table/snice-cell-tag.js.map +1 -1
- package/dist/components/table/snice-cell-text.d.ts +2 -2
- package/dist/components/table/snice-cell-text.js +8 -8
- package/dist/components/table/snice-cell-text.js.map +1 -1
- package/dist/components/table/snice-cell.d.ts +2 -2
- package/dist/components/table/snice-cell.js +8 -8
- package/dist/components/table/snice-cell.js.map +1 -1
- package/dist/components/table/snice-column.d.ts +1 -1
- package/dist/components/table/snice-column.js +4 -4
- package/dist/components/table/snice-column.js.map +1 -1
- package/dist/components/table/snice-header.d.ts +2 -2
- package/dist/components/table/snice-header.js +8 -8
- package/dist/components/table/snice-header.js.map +1 -1
- package/dist/components/table/snice-progress.d.ts +2 -2
- package/dist/components/table/snice-progress.js +8 -8
- package/dist/components/table/snice-progress.js.map +1 -1
- package/dist/components/table/snice-rating.d.ts +2 -2
- package/dist/components/table/snice-rating.js +8 -8
- package/dist/components/table/snice-rating.js.map +1 -1
- package/dist/components/table/snice-row.d.ts +2 -2
- package/dist/components/table/snice-row.js +8 -8
- package/dist/components/table/snice-row.js.map +1 -1
- package/dist/components/table/snice-table.d.ts +2 -3
- package/dist/components/table/snice-table.js +8 -13
- package/dist/components/table/snice-table.js.map +1 -1
- package/dist/components/tabs/snice-tab-panel.d.ts +2 -2
- package/dist/components/tabs/snice-tab-panel.js +8 -8
- package/dist/components/tabs/snice-tab-panel.js.map +1 -1
- package/dist/components/tabs/snice-tab.d.ts +2 -2
- package/dist/components/tabs/snice-tab.js +8 -8
- package/dist/components/tabs/snice-tab.js.map +1 -1
- package/dist/components/tabs/snice-tabs.d.ts +2 -2
- package/dist/components/tabs/snice-tabs.js +8 -8
- package/dist/components/tabs/snice-tabs.js.map +1 -1
- package/dist/components/terminal/snice-terminal.types.d.ts +133 -0
- package/dist/components/textarea/snice-textarea.d.ts +2 -2
- package/dist/components/textarea/snice-textarea.js +8 -8
- package/dist/components/textarea/snice-textarea.js.map +1 -1
- package/dist/components/timeline/snice-timeline.d.ts +1 -1
- package/dist/components/timeline/snice-timeline.js +5 -5
- package/dist/components/timeline/snice-timeline.js.map +1 -1
- package/dist/components/toast/snice-toast-container.d.ts +2 -2
- package/dist/components/toast/snice-toast-container.js +8 -8
- package/dist/components/toast/snice-toast-container.js.map +1 -1
- package/dist/components/toast/snice-toast.d.ts +2 -2
- package/dist/components/toast/snice-toast.js +8 -8
- package/dist/components/toast/snice-toast.js.map +1 -1
- package/dist/components/tooltip/snice-tooltip.d.ts +2 -2
- package/dist/components/tooltip/snice-tooltip.js +8 -8
- package/dist/components/tooltip/snice-tooltip.js.map +1 -1
- package/dist/components/tree/snice-tree-item.d.ts +35 -0
- package/dist/components/tree/snice-tree-item.js +301 -0
- package/dist/components/tree/snice-tree-item.js.map +1 -0
- package/dist/components/tree/snice-tree-item.types.d.ts +30 -0
- package/dist/components/tree/snice-tree.d.ts +45 -0
- package/dist/components/tree/snice-tree.js +390 -0
- package/dist/components/tree/snice-tree.js.map +1 -0
- package/dist/components/tree/snice-tree.types.d.ts +65 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.d.ts +31 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.js +160 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.js.map +1 -0
- package/dist/components/virtual-scroller/snice-virtual-scroller.types.d.ts +19 -0
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/symbols.cjs +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/transitions.cjs +1 -1
- package/dist/transitions.esm.js +1 -1
- package/docs/ai/components/actions.md +81 -0
- package/docs/ai/components/audio-recorder.md +97 -0
- package/docs/ai/components/calendar.md +95 -0
- package/docs/ai/components/camera.md +130 -0
- package/docs/ai/components/carousel.md +49 -0
- package/docs/ai/components/chart.md +160 -0
- package/docs/ai/components/chat.md +189 -0
- package/docs/ai/components/code-block.md +32 -0
- package/docs/ai/components/command-palette.md +117 -0
- package/docs/ai/components/doc.md +154 -0
- package/docs/ai/components/draw.md +140 -0
- package/docs/ai/components/gantt.md +95 -0
- package/docs/ai/components/kanban.md +102 -0
- package/docs/ai/components/layout.md +261 -0
- package/docs/ai/components/list.md +50 -0
- package/docs/ai/components/location.md +75 -0
- package/docs/ai/components/menu.md +114 -0
- package/docs/ai/components/popover.md +70 -0
- package/docs/ai/components/qr-code.md +106 -0
- package/docs/ai/components/split-pane.md +71 -0
- package/docs/ai/components/stat.md +29 -0
- package/docs/ai/components/tree.md +191 -0
- package/docs/ai/components/virtual-scroller.md +71 -0
- package/docs/components/actions.md +317 -0
- package/docs/components/alert.md +540 -0
- package/docs/components/audio-recorder.md +152 -0
- package/docs/components/badge.md +593 -0
- package/docs/components/breadcrumbs.md +568 -0
- package/docs/components/button.md +648 -0
- package/docs/components/calendar.md +397 -0
- package/docs/components/camera.md +383 -0
- package/docs/components/card.md +778 -0
- package/docs/components/carousel.md +63 -0
- package/docs/components/chart.md +526 -0
- package/docs/components/chat.md +482 -0
- package/docs/components/checkbox.md +714 -0
- package/docs/components/chip.md +670 -0
- package/docs/components/code-block.md +49 -0
- package/docs/components/command-palette.md +159 -0
- package/docs/components/doc.md +357 -0
- package/docs/components/draw.md +307 -0
- package/docs/components/gantt.md +347 -0
- package/docs/components/kanban.md +410 -0
- package/docs/components/list.md +65 -0
- package/docs/components/location.md +369 -0
- package/docs/components/menu.md +633 -0
- package/docs/components/popover.md +333 -0
- package/docs/components/qr-code.md +464 -0
- package/docs/components/split-pane.md +315 -0
- package/docs/components/stat.md +45 -0
- package/docs/components/tree.md +536 -0
- package/docs/components/virtual-scroller.md +298 -0
- package/package.json +1 -1
|
@@ -0,0 +1,626 @@
|
|
|
1
|
+
import { __runInitializers, __esDecorate } from 'tslib';
|
|
2
|
+
import { element, property, query, styles, ready, dispose, watch, dispatch, render, css, html } from 'snice';
|
|
3
|
+
|
|
4
|
+
var cssContent = ":host{display:block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Noto Sans',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji';font-size:16px;line-height:1.5;color:var(--snice-doc-text-color,#333);background:var(--snice-doc-background,#fff);padding:var(--snice-doc-padding,40px 20px);min-height:var(--snice-doc-min-height,400px)}.doc-container{max-width:var(--snice-doc-max-width,900px);margin:0 auto}.doc-block{position:relative;margin:4px 0;min-height:1.5em}.doc-block:hover .block-handle{opacity:1}.block-handle{position:absolute;left:-30px;top:4px;width:20px;height:20px;opacity:0;cursor:grab;display:flex;align-items:center;justify-content:center;color:var(--snice-doc-muted-color,#999);transition:opacity .2s}.block-handle:active{cursor:grabbing}.block-handle svg{width:16px;height:16px}.block-content{outline:0;word-wrap:break-word;white-space:pre-wrap}.block-content:empty:before{content:attr(data-placeholder);color:var(--snice-doc-placeholder-color,#999);pointer-events:none}.block-paragraph{margin:2px 0}.block-heading-1 .block-content{font-size:2em;font-weight:700;line-height:1.2;margin:.67em 0}.block-heading-2 .block-content{font-size:1.5em;font-weight:700;line-height:1.3;margin:.75em 0}.block-heading-3 .block-content{font-size:1.25em;font-weight:700;line-height:1.4;margin:.83em 0}.block-bulleted-list{display:flex;align-items:flex-start}.block-bulleted-list:before{content:'•';margin-right:8px;margin-top:2px;color:var(--snice-doc-text-color,#333)}.block-numbered-list{display:flex;align-items:flex-start}.block-numbered-list:before{content:attr(data-number) '.';margin-right:8px;margin-top:2px;min-width:24px;color:var(--snice-doc-text-color,#333)}.block-todo{display:flex;align-items:flex-start}.todo-checkbox{margin-right:8px;margin-top:4px;cursor:pointer;flex-shrink:0}.block-todo.checked .block-content{text-decoration:line-through;opacity:.6}.block-code .block-content{font-family:Monaco,Menlo,'Ubuntu Mono',Consolas,source-code-pro,monospace;font-size:.9em;background:var(--snice-doc-code-background,#f6f8fa);border:1px solid var(--snice-doc-code-border,#e1e4e8);border-radius:6px;padding:16px;overflow-x:auto;white-space:pre}.block-quote .block-content{border-left:3px solid var(--snice-doc-quote-border,#e1e4e8);padding-left:16px;color:var(--snice-doc-muted-color,#666);font-style:italic}.block-divider{border:none;border-top:1px solid var(--snice-doc-divider-color,#e1e4e8);margin:16px 0;height:1px}.format-bold{font-weight:700}.format-italic{font-style:italic}.format-underline{text-decoration:underline}.format-strikethrough{text-decoration:line-through}.format-code{font-family:Monaco,Menlo,'Ubuntu Mono',Consolas,source-code-pro,monospace;font-size:.9em;background:var(--snice-doc-inline-code-background,rgba(175,184,193,.2));padding:2px 6px;border-radius:3px}.format-link{color:var(--snice-doc-link-color,#0969da);text-decoration:underline;cursor:pointer}.format-link:hover{opacity:.8}.block-menu{position:absolute;left:0;top:100%;background:var(--snice-doc-menu-background,#fff);border:1px solid var(--snice-doc-menu-border,#e1e4e8);border-radius:6px;box-shadow:0 8px 24px rgba(0,0,0,.12);max-height:300px;overflow-y:auto;z-index:1000;min-width:240px}.block-menu-item{display:flex;align-items:center;gap:12px;padding:8px 12px;cursor:pointer;transition:background .2s}.block-menu-item.selected,.block-menu-item:hover{background:var(--snice-doc-menu-hover,#f6f8fa)}.block-menu-icon{width:20px;height:20px;flex-shrink:0;color:var(--snice-doc-muted-color,#666)}.block-menu-label{font-size:14px;color:var(--snice-doc-text-color,#333)}.format-toolbar{position:absolute;left:50%;transform:translateX(-50%);background:var(--snice-doc-toolbar-background,#1f2328);border-radius:6px;box-shadow:0 8px 24px rgba(0,0,0,.12);padding:4px;display:flex;gap:2px;z-index:1000}.format-button{width:32px;height:32px;border:none;background:0 0;color:var(--snice-doc-toolbar-text,#fff);cursor:pointer;border-radius:4px;display:flex;align-items:center;justify-content:center;transition:background .2s}.format-button:hover{background:var(--snice-doc-toolbar-hover,rgba(255,255,255,.1))}.format-button.active{background:var(--snice-doc-toolbar-active,rgba(88,166,255,.3))}.format-button svg{width:16px;height:16px}.doc-block.dragging{opacity:.5}.doc-block.drag-over{border-top:2px solid var(--snice-doc-primary-color,#0969da)}:host([readonly]) .block-handle,:host([readonly]) .block-menu,:host([readonly]) .format-toolbar{display:none}:host([readonly]) .block-content{cursor:default}:host([readonly]) .todo-checkbox{pointer-events:none}";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Generate unique ID
|
|
8
|
+
*/
|
|
9
|
+
function generateId() {
|
|
10
|
+
return Math.random().toString(36).substring(2, 15);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Block menu items
|
|
14
|
+
*/
|
|
15
|
+
const BLOCK_MENU_ITEMS = [
|
|
16
|
+
{
|
|
17
|
+
type: 'paragraph',
|
|
18
|
+
label: 'Paragraph',
|
|
19
|
+
icon: '¶',
|
|
20
|
+
keywords: ['text', 'paragraph', 'p'],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type: 'heading-1',
|
|
24
|
+
label: 'Heading 1',
|
|
25
|
+
icon: 'H1',
|
|
26
|
+
keywords: ['h1', 'heading', 'title'],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: 'heading-2',
|
|
30
|
+
label: 'Heading 2',
|
|
31
|
+
icon: 'H2',
|
|
32
|
+
keywords: ['h2', 'heading', 'subtitle'],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'heading-3',
|
|
36
|
+
label: 'Heading 3',
|
|
37
|
+
icon: 'H3',
|
|
38
|
+
keywords: ['h3', 'heading'],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'bulleted-list',
|
|
42
|
+
label: 'Bulleted List',
|
|
43
|
+
icon: '•',
|
|
44
|
+
keywords: ['ul', 'list', 'bullet'],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'numbered-list',
|
|
48
|
+
label: 'Numbered List',
|
|
49
|
+
icon: '1.',
|
|
50
|
+
keywords: ['ol', 'list', 'number'],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: 'todo',
|
|
54
|
+
label: 'To-do List',
|
|
55
|
+
icon: '☐',
|
|
56
|
+
keywords: ['todo', 'checkbox', 'task'],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: 'code',
|
|
60
|
+
label: 'Code Block',
|
|
61
|
+
icon: '</>',
|
|
62
|
+
keywords: ['code', 'snippet'],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: 'quote',
|
|
66
|
+
label: 'Quote',
|
|
67
|
+
icon: '"',
|
|
68
|
+
keywords: ['quote', 'blockquote'],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: 'divider',
|
|
72
|
+
label: 'Divider',
|
|
73
|
+
icon: '―',
|
|
74
|
+
keywords: ['divider', 'separator', 'hr'],
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
/**
|
|
78
|
+
* snice-doc - Document editor component
|
|
79
|
+
*
|
|
80
|
+
* A Notion-like document editor with block-based editing
|
|
81
|
+
*
|
|
82
|
+
* @element snice-doc
|
|
83
|
+
*
|
|
84
|
+
* @fires {CustomEvent<{ blocks: DocBlock[] }>} doc-change - Fires when document changes
|
|
85
|
+
* @fires {CustomEvent<{ blockId: string }>} doc-focus - Fires when a block receives focus
|
|
86
|
+
* @fires {CustomEvent<{ blockId: string }>} doc-blur - Fires when a block loses focus
|
|
87
|
+
*/
|
|
88
|
+
let SniceDoc = (() => {
|
|
89
|
+
let _classDecorators = [element('snice-doc')];
|
|
90
|
+
let _classDescriptor;
|
|
91
|
+
let _classExtraInitializers = [];
|
|
92
|
+
let _classThis;
|
|
93
|
+
let _classSuper = HTMLElement;
|
|
94
|
+
let _instanceExtraInitializers = [];
|
|
95
|
+
let _blocks_decorators;
|
|
96
|
+
let _blocks_initializers = [];
|
|
97
|
+
let _blocks_extraInitializers = [];
|
|
98
|
+
let _placeholder_decorators;
|
|
99
|
+
let _placeholder_initializers = [];
|
|
100
|
+
let _placeholder_extraInitializers = [];
|
|
101
|
+
let _readonly_decorators;
|
|
102
|
+
let _readonly_initializers = [];
|
|
103
|
+
let _readonly_extraInitializers = [];
|
|
104
|
+
let _container_decorators;
|
|
105
|
+
let _container_initializers = [];
|
|
106
|
+
let _container_extraInitializers = [];
|
|
107
|
+
let _firstBlockElement_decorators;
|
|
108
|
+
let _firstBlockElement_initializers = [];
|
|
109
|
+
let _firstBlockElement_extraInitializers = [];
|
|
110
|
+
let _styles_decorators;
|
|
111
|
+
let _init_decorators;
|
|
112
|
+
let _cleanup_decorators;
|
|
113
|
+
let _blocksChanged_decorators;
|
|
114
|
+
let _emitChange_decorators;
|
|
115
|
+
let _emitFocus_decorators;
|
|
116
|
+
let _emitBlur_decorators;
|
|
117
|
+
let _render_decorators;
|
|
118
|
+
(class extends _classSuper {
|
|
119
|
+
static { _classThis = this; }
|
|
120
|
+
constructor() {
|
|
121
|
+
super(...arguments);
|
|
122
|
+
this.blocks = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _blocks_initializers, [{ id: generateId(), type: 'paragraph', content: '', formats: [] }]));
|
|
123
|
+
this.placeholder = (__runInitializers(this, _blocks_extraInitializers), __runInitializers(this, _placeholder_initializers, "Type '/' for commands..."));
|
|
124
|
+
this.readonly = (__runInitializers(this, _placeholder_extraInitializers), __runInitializers(this, _readonly_initializers, false));
|
|
125
|
+
this.container = (__runInitializers(this, _readonly_extraInitializers), __runInitializers(this, _container_initializers, void 0));
|
|
126
|
+
this.firstBlockElement = (__runInitializers(this, _container_extraInitializers), __runInitializers(this, _firstBlockElement_initializers, void 0));
|
|
127
|
+
this.selection = (__runInitializers(this, _firstBlockElement_extraInitializers), null);
|
|
128
|
+
this.draggedBlock = null;
|
|
129
|
+
this.showBlockMenu = false;
|
|
130
|
+
this.blockMenuFilter = '';
|
|
131
|
+
this.blockMenuSelectedIndex = 0;
|
|
132
|
+
this.blockMenuBlockId = '';
|
|
133
|
+
this.handleKeyDown = (e) => {
|
|
134
|
+
if (this.readonly)
|
|
135
|
+
return;
|
|
136
|
+
const target = e.target;
|
|
137
|
+
if (!target.classList.contains('block-content'))
|
|
138
|
+
return;
|
|
139
|
+
const blockId = target.dataset.blockId;
|
|
140
|
+
const block = this.blocks.find((b) => b.id === blockId);
|
|
141
|
+
if (!block)
|
|
142
|
+
return;
|
|
143
|
+
// Handle block menu navigation
|
|
144
|
+
if (this.showBlockMenu) {
|
|
145
|
+
if (e.key === 'ArrowDown') {
|
|
146
|
+
e.preventDefault();
|
|
147
|
+
this.blockMenuSelectedIndex = Math.min(this.blockMenuSelectedIndex + 1, this.getFilteredBlockMenuItems().length - 1);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (e.key === 'ArrowUp') {
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
this.blockMenuSelectedIndex = Math.max(this.blockMenuSelectedIndex - 1, 0);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (e.key === 'Enter') {
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
const items = this.getFilteredBlockMenuItems();
|
|
158
|
+
if (items[this.blockMenuSelectedIndex]) {
|
|
159
|
+
this.selectBlockType(this.blockMenuBlockId, items[this.blockMenuSelectedIndex].type);
|
|
160
|
+
}
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (e.key === 'Escape') {
|
|
164
|
+
e.preventDefault();
|
|
165
|
+
this.hideBlockMenu();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Enter - create new block
|
|
170
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
171
|
+
e.preventDefault();
|
|
172
|
+
this.createNewBlock(blockId);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
// Backspace on empty block - remove block
|
|
176
|
+
if (e.key === 'Backspace' && block.content === '' && this.blocks.length > 1) {
|
|
177
|
+
e.preventDefault();
|
|
178
|
+
this.removeBlock(blockId);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
// Keyboard shortcuts
|
|
182
|
+
if (e.ctrlKey || e.metaKey) {
|
|
183
|
+
if (e.key === 'b') {
|
|
184
|
+
e.preventDefault();
|
|
185
|
+
this.toggleFormat('bold');
|
|
186
|
+
}
|
|
187
|
+
else if (e.key === 'i') {
|
|
188
|
+
e.preventDefault();
|
|
189
|
+
this.toggleFormat('italic');
|
|
190
|
+
}
|
|
191
|
+
else if (e.key === 'u') {
|
|
192
|
+
e.preventDefault();
|
|
193
|
+
this.toggleFormat('underline');
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
this.handlePaste = (e) => {
|
|
198
|
+
if (this.readonly)
|
|
199
|
+
return;
|
|
200
|
+
// Allow default paste behavior for now
|
|
201
|
+
// Could add special handling for HTML/markdown paste
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
static {
|
|
205
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
206
|
+
_blocks_decorators = [property({ type: Array, attribute: false })];
|
|
207
|
+
_placeholder_decorators = [property({ type: String })];
|
|
208
|
+
_readonly_decorators = [property({ type: Boolean })];
|
|
209
|
+
_container_decorators = [query('.doc-container')];
|
|
210
|
+
_firstBlockElement_decorators = [query('.block-content')];
|
|
211
|
+
_styles_decorators = [styles()];
|
|
212
|
+
_init_decorators = [ready()];
|
|
213
|
+
_cleanup_decorators = [dispose()];
|
|
214
|
+
_blocksChanged_decorators = [watch('blocks')];
|
|
215
|
+
_emitChange_decorators = [dispatch('doc-change')];
|
|
216
|
+
_emitFocus_decorators = [dispatch('doc-focus')];
|
|
217
|
+
_emitBlur_decorators = [dispatch('doc-blur')];
|
|
218
|
+
_render_decorators = [render()];
|
|
219
|
+
__esDecorate(this, null, _styles_decorators, { kind: "method", name: "styles", static: false, private: false, access: { has: obj => "styles" in obj, get: obj => obj.styles }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
220
|
+
__esDecorate(this, null, _init_decorators, { kind: "method", name: "init", static: false, private: false, access: { has: obj => "init" in obj, get: obj => obj.init }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
221
|
+
__esDecorate(this, null, _cleanup_decorators, { kind: "method", name: "cleanup", static: false, private: false, access: { has: obj => "cleanup" in obj, get: obj => obj.cleanup }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
222
|
+
__esDecorate(this, null, _blocksChanged_decorators, { kind: "method", name: "blocksChanged", static: false, private: false, access: { has: obj => "blocksChanged" in obj, get: obj => obj.blocksChanged }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
223
|
+
__esDecorate(this, null, _emitChange_decorators, { kind: "method", name: "emitChange", static: false, private: false, access: { has: obj => "emitChange" in obj, get: obj => obj.emitChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
224
|
+
__esDecorate(this, null, _emitFocus_decorators, { kind: "method", name: "emitFocus", static: false, private: false, access: { has: obj => "emitFocus" in obj, get: obj => obj.emitFocus }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
225
|
+
__esDecorate(this, null, _emitBlur_decorators, { kind: "method", name: "emitBlur", static: false, private: false, access: { has: obj => "emitBlur" in obj, get: obj => obj.emitBlur }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
226
|
+
__esDecorate(this, null, _render_decorators, { kind: "method", name: "render", static: false, private: false, access: { has: obj => "render" in obj, get: obj => obj.render }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
227
|
+
__esDecorate(null, null, _blocks_decorators, { kind: "field", name: "blocks", static: false, private: false, access: { has: obj => "blocks" in obj, get: obj => obj.blocks, set: (obj, value) => { obj.blocks = value; } }, metadata: _metadata }, _blocks_initializers, _blocks_extraInitializers);
|
|
228
|
+
__esDecorate(null, null, _placeholder_decorators, { kind: "field", name: "placeholder", static: false, private: false, access: { has: obj => "placeholder" in obj, get: obj => obj.placeholder, set: (obj, value) => { obj.placeholder = value; } }, metadata: _metadata }, _placeholder_initializers, _placeholder_extraInitializers);
|
|
229
|
+
__esDecorate(null, null, _readonly_decorators, { kind: "field", name: "readonly", static: false, private: false, access: { has: obj => "readonly" in obj, get: obj => obj.readonly, set: (obj, value) => { obj.readonly = value; } }, metadata: _metadata }, _readonly_initializers, _readonly_extraInitializers);
|
|
230
|
+
__esDecorate(null, null, _container_decorators, { kind: "field", name: "container", static: false, private: false, access: { has: obj => "container" in obj, get: obj => obj.container, set: (obj, value) => { obj.container = value; } }, metadata: _metadata }, _container_initializers, _container_extraInitializers);
|
|
231
|
+
__esDecorate(null, null, _firstBlockElement_decorators, { kind: "field", name: "firstBlockElement", static: false, private: false, access: { has: obj => "firstBlockElement" in obj, get: obj => obj.firstBlockElement, set: (obj, value) => { obj.firstBlockElement = value; } }, metadata: _metadata }, _firstBlockElement_initializers, _firstBlockElement_extraInitializers);
|
|
232
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
233
|
+
_classThis = _classDescriptor.value;
|
|
234
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
235
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
236
|
+
}
|
|
237
|
+
styles() {
|
|
238
|
+
return css /*css*/ `${cssContent}`;
|
|
239
|
+
}
|
|
240
|
+
init() {
|
|
241
|
+
this.addEventListener('keydown', this.handleKeyDown);
|
|
242
|
+
this.addEventListener('paste', this.handlePaste);
|
|
243
|
+
}
|
|
244
|
+
cleanup() {
|
|
245
|
+
this.removeEventListener('keydown', this.handleKeyDown);
|
|
246
|
+
this.removeEventListener('paste', this.handlePaste);
|
|
247
|
+
}
|
|
248
|
+
blocksChanged() {
|
|
249
|
+
this.emitChange();
|
|
250
|
+
}
|
|
251
|
+
emitChange() {
|
|
252
|
+
return new CustomEvent('doc-change', {
|
|
253
|
+
detail: { blocks: this.blocks },
|
|
254
|
+
bubbles: true,
|
|
255
|
+
composed: true,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
emitFocus(blockId) {
|
|
259
|
+
return new CustomEvent('doc-focus', {
|
|
260
|
+
detail: { blockId },
|
|
261
|
+
bubbles: true,
|
|
262
|
+
composed: true,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
emitBlur(blockId) {
|
|
266
|
+
return new CustomEvent('doc-blur', {
|
|
267
|
+
detail: { blockId },
|
|
268
|
+
bubbles: true,
|
|
269
|
+
composed: true,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Get current blocks
|
|
274
|
+
*/
|
|
275
|
+
getBlocks() {
|
|
276
|
+
return [...this.blocks];
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Set blocks
|
|
280
|
+
*/
|
|
281
|
+
setBlocks(blocks) {
|
|
282
|
+
this.blocks = blocks.map((b) => ({ ...b }));
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Export as JSON
|
|
286
|
+
*/
|
|
287
|
+
toJSON() {
|
|
288
|
+
return JSON.stringify(this.blocks, null, 2);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Import from JSON
|
|
292
|
+
*/
|
|
293
|
+
fromJSON(json) {
|
|
294
|
+
try {
|
|
295
|
+
const blocks = JSON.parse(json);
|
|
296
|
+
if (Array.isArray(blocks)) {
|
|
297
|
+
this.blocks = blocks;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
console.error('Failed to parse JSON:', error);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Export as Markdown
|
|
306
|
+
*/
|
|
307
|
+
toMarkdown() {
|
|
308
|
+
return this.blocks
|
|
309
|
+
.map((block) => {
|
|
310
|
+
switch (block.type) {
|
|
311
|
+
case 'heading-1':
|
|
312
|
+
return `# ${block.content}`;
|
|
313
|
+
case 'heading-2':
|
|
314
|
+
return `## ${block.content}`;
|
|
315
|
+
case 'heading-3':
|
|
316
|
+
return `### ${block.content}`;
|
|
317
|
+
case 'bulleted-list':
|
|
318
|
+
return `- ${block.content}`;
|
|
319
|
+
case 'numbered-list':
|
|
320
|
+
return `1. ${block.content}`;
|
|
321
|
+
case 'todo':
|
|
322
|
+
return `- [${block.checked ? 'x' : ' '}] ${block.content}`;
|
|
323
|
+
case 'code':
|
|
324
|
+
return `\`\`\`\n${block.content}\n\`\`\``;
|
|
325
|
+
case 'quote':
|
|
326
|
+
return `> ${block.content}`;
|
|
327
|
+
case 'divider':
|
|
328
|
+
return '---';
|
|
329
|
+
default:
|
|
330
|
+
return block.content;
|
|
331
|
+
}
|
|
332
|
+
})
|
|
333
|
+
.join('\n\n');
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Export as HTML
|
|
337
|
+
*/
|
|
338
|
+
toHTML() {
|
|
339
|
+
return this.blocks
|
|
340
|
+
.map((block) => {
|
|
341
|
+
const content = this.escapeHtml(block.content);
|
|
342
|
+
switch (block.type) {
|
|
343
|
+
case 'heading-1':
|
|
344
|
+
return `<h1>${content}</h1>`;
|
|
345
|
+
case 'heading-2':
|
|
346
|
+
return `<h2>${content}</h2>`;
|
|
347
|
+
case 'heading-3':
|
|
348
|
+
return `<h3>${content}</h3>`;
|
|
349
|
+
case 'bulleted-list':
|
|
350
|
+
return `<ul><li>${content}</li></ul>`;
|
|
351
|
+
case 'numbered-list':
|
|
352
|
+
return `<ol><li>${content}</li></ol>`;
|
|
353
|
+
case 'todo':
|
|
354
|
+
return `<input type="checkbox" ${block.checked ? 'checked' : ''}>${content}`;
|
|
355
|
+
case 'code':
|
|
356
|
+
return `<pre><code>${content}</code></pre>`;
|
|
357
|
+
case 'quote':
|
|
358
|
+
return `<blockquote>${content}</blockquote>`;
|
|
359
|
+
case 'divider':
|
|
360
|
+
return '<hr>';
|
|
361
|
+
default:
|
|
362
|
+
return `<p>${content}</p>`;
|
|
363
|
+
}
|
|
364
|
+
})
|
|
365
|
+
.join('\n');
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Focus the editor
|
|
369
|
+
*/
|
|
370
|
+
focus() {
|
|
371
|
+
this.firstBlockElement?.focus();
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Clear all content
|
|
375
|
+
*/
|
|
376
|
+
clear() {
|
|
377
|
+
this.blocks = [{ id: generateId(), type: 'paragraph', content: '', formats: [] }];
|
|
378
|
+
}
|
|
379
|
+
escapeHtml(text) {
|
|
380
|
+
return text
|
|
381
|
+
.replace(/&/g, '&')
|
|
382
|
+
.replace(/</g, '<')
|
|
383
|
+
.replace(/>/g, '>')
|
|
384
|
+
.replace(/"/g, '"')
|
|
385
|
+
.replace(/'/g, ''');
|
|
386
|
+
}
|
|
387
|
+
handleInput(blockId, e) {
|
|
388
|
+
if (this.readonly)
|
|
389
|
+
return;
|
|
390
|
+
const target = e.target;
|
|
391
|
+
const content = target.textContent || '';
|
|
392
|
+
const blockIndex = this.blocks.findIndex((b) => b.id === blockId);
|
|
393
|
+
if (blockIndex === -1)
|
|
394
|
+
return;
|
|
395
|
+
// Check for block menu trigger
|
|
396
|
+
if (content.startsWith('/')) {
|
|
397
|
+
this.showBlockMenuFor(blockId, content.slice(1));
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
this.hideBlockMenu();
|
|
401
|
+
}
|
|
402
|
+
// Update block content
|
|
403
|
+
this.blocks = this.blocks.map((b) => b.id === blockId ? { ...b, content: content } : b);
|
|
404
|
+
}
|
|
405
|
+
handleFocus(blockId) {
|
|
406
|
+
this.emitFocus(blockId);
|
|
407
|
+
}
|
|
408
|
+
handleBlur(blockId) {
|
|
409
|
+
this.emitBlur(blockId);
|
|
410
|
+
}
|
|
411
|
+
createNewBlock(afterBlockId) {
|
|
412
|
+
const index = this.blocks.findIndex((b) => b.id === afterBlockId);
|
|
413
|
+
if (index === -1)
|
|
414
|
+
return;
|
|
415
|
+
const newBlock = {
|
|
416
|
+
id: generateId(),
|
|
417
|
+
type: 'paragraph',
|
|
418
|
+
content: '',
|
|
419
|
+
formats: [],
|
|
420
|
+
};
|
|
421
|
+
this.blocks = [
|
|
422
|
+
...this.blocks.slice(0, index + 1),
|
|
423
|
+
newBlock,
|
|
424
|
+
...this.blocks.slice(index + 1),
|
|
425
|
+
];
|
|
426
|
+
// Focus new block
|
|
427
|
+
setTimeout(() => {
|
|
428
|
+
const el = this.shadowRoot?.querySelector(`[data-block-id="${newBlock.id}"]`);
|
|
429
|
+
el?.focus();
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
removeBlock(blockId) {
|
|
433
|
+
const index = this.blocks.findIndex((b) => b.id === blockId);
|
|
434
|
+
if (index === -1)
|
|
435
|
+
return;
|
|
436
|
+
this.blocks = this.blocks.filter((b) => b.id !== blockId);
|
|
437
|
+
// Focus previous block
|
|
438
|
+
if (index > 0) {
|
|
439
|
+
setTimeout(() => {
|
|
440
|
+
const prevBlock = this.blocks[index - 1];
|
|
441
|
+
const el = this.shadowRoot?.querySelector(`[data-block-id="${prevBlock.id}"]`);
|
|
442
|
+
el?.focus();
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
toggleFormat(format) {
|
|
447
|
+
// TODO: Implement inline formatting
|
|
448
|
+
console.log('Toggle format:', format);
|
|
449
|
+
}
|
|
450
|
+
showBlockMenuFor(blockId, filter) {
|
|
451
|
+
this.showBlockMenu = true;
|
|
452
|
+
this.blockMenuBlockId = blockId;
|
|
453
|
+
this.blockMenuFilter = filter;
|
|
454
|
+
this.blockMenuSelectedIndex = 0;
|
|
455
|
+
}
|
|
456
|
+
hideBlockMenu() {
|
|
457
|
+
this.showBlockMenu = false;
|
|
458
|
+
this.blockMenuFilter = '';
|
|
459
|
+
this.blockMenuSelectedIndex = 0;
|
|
460
|
+
}
|
|
461
|
+
getFilteredBlockMenuItems() {
|
|
462
|
+
if (!this.blockMenuFilter)
|
|
463
|
+
return BLOCK_MENU_ITEMS;
|
|
464
|
+
const filter = this.blockMenuFilter.toLowerCase();
|
|
465
|
+
return BLOCK_MENU_ITEMS.filter((item) => item.label.toLowerCase().includes(filter) ||
|
|
466
|
+
item.keywords.some((k) => k.includes(filter)));
|
|
467
|
+
}
|
|
468
|
+
selectBlockType(blockId, type) {
|
|
469
|
+
this.blocks = this.blocks.map((b) => b.id === blockId ? { ...b, type, content: '' } : b);
|
|
470
|
+
this.hideBlockMenu();
|
|
471
|
+
// Focus the block
|
|
472
|
+
setTimeout(() => {
|
|
473
|
+
const el = this.shadowRoot?.querySelector(`[data-block-id="${blockId}"]`);
|
|
474
|
+
el?.focus();
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
handleBlockMenuItemClick(blockId, type) {
|
|
478
|
+
this.selectBlockType(blockId, type);
|
|
479
|
+
}
|
|
480
|
+
handleTodoToggle(blockId) {
|
|
481
|
+
if (this.readonly)
|
|
482
|
+
return;
|
|
483
|
+
this.blocks = this.blocks.map((b) => b.id === blockId ? { ...b, checked: !b.checked } : b);
|
|
484
|
+
}
|
|
485
|
+
handleDragStart(blockId, e) {
|
|
486
|
+
if (this.readonly)
|
|
487
|
+
return;
|
|
488
|
+
this.draggedBlock = blockId;
|
|
489
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
490
|
+
}
|
|
491
|
+
handleDragOver(blockId, e) {
|
|
492
|
+
if (this.readonly)
|
|
493
|
+
return;
|
|
494
|
+
if (!this.draggedBlock || this.draggedBlock === blockId)
|
|
495
|
+
return;
|
|
496
|
+
e.preventDefault();
|
|
497
|
+
e.dataTransfer.dropEffect = 'move';
|
|
498
|
+
}
|
|
499
|
+
handleDrop(blockId, e) {
|
|
500
|
+
if (this.readonly)
|
|
501
|
+
return;
|
|
502
|
+
e.preventDefault();
|
|
503
|
+
if (!this.draggedBlock || this.draggedBlock === blockId)
|
|
504
|
+
return;
|
|
505
|
+
const draggedIndex = this.blocks.findIndex((b) => b.id === this.draggedBlock);
|
|
506
|
+
const targetIndex = this.blocks.findIndex((b) => b.id === blockId);
|
|
507
|
+
if (draggedIndex === -1 || targetIndex === -1)
|
|
508
|
+
return;
|
|
509
|
+
const newBlocks = [...this.blocks];
|
|
510
|
+
const [draggedBlock] = newBlocks.splice(draggedIndex, 1);
|
|
511
|
+
newBlocks.splice(targetIndex, 0, draggedBlock);
|
|
512
|
+
this.blocks = newBlocks;
|
|
513
|
+
this.draggedBlock = null;
|
|
514
|
+
}
|
|
515
|
+
handleDragEnd() {
|
|
516
|
+
this.draggedBlock = null;
|
|
517
|
+
}
|
|
518
|
+
render() {
|
|
519
|
+
return html `
|
|
520
|
+
<div class="doc-container">
|
|
521
|
+
${this.blocks.map((block, index) => this.renderBlock(block, index))}
|
|
522
|
+
${this.showBlockMenu ? this.renderBlockMenu() : ''}
|
|
523
|
+
</div>
|
|
524
|
+
`;
|
|
525
|
+
}
|
|
526
|
+
renderBlock(block, index) {
|
|
527
|
+
const placeholder = index === 0 && !block.content ? this.placeholder : "Type '/' for commands";
|
|
528
|
+
const isDivider = block.type === 'divider';
|
|
529
|
+
if (isDivider) {
|
|
530
|
+
return html `
|
|
531
|
+
<div class="doc-block block-divider" data-block-id="${block.id}">
|
|
532
|
+
<div
|
|
533
|
+
class="block-handle"
|
|
534
|
+
draggable="${!this.readonly}"
|
|
535
|
+
@dragstart="${(e) => this.handleDragStart(block.id, e)}"
|
|
536
|
+
@dragend="${() => this.handleDragEnd()}"
|
|
537
|
+
>
|
|
538
|
+
<svg viewBox="0 0 16 16" fill="currentColor">
|
|
539
|
+
<circle cx="3" cy="3" r="1.5" />
|
|
540
|
+
<circle cx="8" cy="3" r="1.5" />
|
|
541
|
+
<circle cx="3" cy="8" r="1.5" />
|
|
542
|
+
<circle cx="8" cy="8" r="1.5" />
|
|
543
|
+
<circle cx="3" cy="13" r="1.5" />
|
|
544
|
+
<circle cx="8" cy="13" r="1.5" />
|
|
545
|
+
</svg>
|
|
546
|
+
</div>
|
|
547
|
+
</div>
|
|
548
|
+
`;
|
|
549
|
+
}
|
|
550
|
+
const isTodo = block.type === 'todo';
|
|
551
|
+
const isNumberedList = block.type === 'numbered-list';
|
|
552
|
+
return html `
|
|
553
|
+
<div
|
|
554
|
+
class="doc-block block-${block.type} ${block.checked ? 'checked' : ''} ${this
|
|
555
|
+
.draggedBlock === block.id
|
|
556
|
+
? 'dragging'
|
|
557
|
+
: ''}"
|
|
558
|
+
data-block-id="${block.id}"
|
|
559
|
+
@dragover="${(e) => this.handleDragOver(block.id, e)}"
|
|
560
|
+
@drop="${(e) => this.handleDrop(block.id, e)}"
|
|
561
|
+
data-number="${isNumberedList ? index + 1 : ''}"
|
|
562
|
+
>
|
|
563
|
+
<div
|
|
564
|
+
class="block-handle"
|
|
565
|
+
draggable="${!this.readonly}"
|
|
566
|
+
@dragstart="${(e) => this.handleDragStart(block.id, e)}"
|
|
567
|
+
@dragend="${() => this.handleDragEnd()}"
|
|
568
|
+
>
|
|
569
|
+
<svg viewBox="0 0 16 16" fill="currentColor">
|
|
570
|
+
<circle cx="3" cy="3" r="1.5" />
|
|
571
|
+
<circle cx="8" cy="3" r="1.5" />
|
|
572
|
+
<circle cx="3" cy="8" r="1.5" />
|
|
573
|
+
<circle cx="8" cy="8" r="1.5" />
|
|
574
|
+
<circle cx="3" cy="13" r="1.5" />
|
|
575
|
+
<circle cx="8" cy="13" r="1.5" />
|
|
576
|
+
</svg>
|
|
577
|
+
</div>
|
|
578
|
+
${isTodo
|
|
579
|
+
? html `<input
|
|
580
|
+
type="checkbox"
|
|
581
|
+
class="todo-checkbox"
|
|
582
|
+
?checked="${block.checked}"
|
|
583
|
+
@change="${() => this.handleTodoToggle(block.id)}"
|
|
584
|
+
/>`
|
|
585
|
+
: ''}
|
|
586
|
+
<div
|
|
587
|
+
class="block-content"
|
|
588
|
+
contenteditable="${!this.readonly}"
|
|
589
|
+
data-block-id="${block.id}"
|
|
590
|
+
data-placeholder="${placeholder}"
|
|
591
|
+
@input="${(e) => this.handleInput(block.id, e)}"
|
|
592
|
+
@focus="${() => this.handleFocus(block.id)}"
|
|
593
|
+
@blur="${() => this.handleBlur(block.id)}"
|
|
594
|
+
>
|
|
595
|
+
${block.content}
|
|
596
|
+
</div>
|
|
597
|
+
</div>
|
|
598
|
+
`;
|
|
599
|
+
}
|
|
600
|
+
renderBlockMenu() {
|
|
601
|
+
const items = this.getFilteredBlockMenuItems();
|
|
602
|
+
return html `
|
|
603
|
+
<div class="block-menu">
|
|
604
|
+
${items.map((item, index) => html `
|
|
605
|
+
<div
|
|
606
|
+
class="block-menu-item ${index === this.blockMenuSelectedIndex ? 'selected' : ''}"
|
|
607
|
+
@click="${() => this.handleBlockMenuItemClick(this.blockMenuBlockId, item.type)}"
|
|
608
|
+
>
|
|
609
|
+
<div class="block-menu-icon">${item.icon}</div>
|
|
610
|
+
<div class="block-menu-label">${item.label}</div>
|
|
611
|
+
</div>
|
|
612
|
+
`)}
|
|
613
|
+
${items.length === 0
|
|
614
|
+
? html `<div class="block-menu-item">
|
|
615
|
+
<div class="block-menu-label">No results</div>
|
|
616
|
+
</div>`
|
|
617
|
+
: ''}
|
|
618
|
+
</div>
|
|
619
|
+
`;
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
return _classThis;
|
|
623
|
+
})();
|
|
624
|
+
|
|
625
|
+
export { SniceDoc };
|
|
626
|
+
//# sourceMappingURL=snice-doc.js.map
|