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,709 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from 'tslib';
|
|
2
|
+
import { element, property, query, styles, ready, dispose, render, on, dispatch, css, html } from 'snice';
|
|
3
|
+
|
|
4
|
+
var drawStyles = ":host{display:block;width:100%;position:relative;user-select:none;-webkit-user-select:none}.draw-container{position:relative;width:100%;height:100%;overflow:hidden;background:var(--draw-bg,#fff);border-radius:var(--draw-border-radius,0);touch-action:none}.draw-canvas{display:block;width:100%;height:100%;cursor:crosshair}.draw-canvas.disabled{cursor:not-allowed;opacity:.5}.draw-canvas.tool-pen{cursor:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"12\" r=\"2\" fill=\"black\"/></svg>') 12 12,crosshair}.draw-canvas.tool-eraser{cursor:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" fill=\"white\" stroke=\"black\"/></svg>') 12 12,crosshair}.lazy-brush-point{position:absolute;width:8px;height:8px;margin:-4px 0 0 -4px;border-radius:50%;background:var(--primary-color,#2196f3);pointer-events:none;opacity:0;transition:opacity .2s}.lazy-brush-point.active{opacity:.6}.lazy-brush-radius{position:absolute;border:1px dashed var(--primary-color,#2196f3);border-radius:50%;pointer-events:none;opacity:0;transition:opacity .2s}.lazy-brush-radius.active{opacity:.3}";
|
|
5
|
+
|
|
6
|
+
const ease = (t) => t * (2 - t);
|
|
7
|
+
class DrawPoint {
|
|
8
|
+
constructor(x, y) {
|
|
9
|
+
this.x = x;
|
|
10
|
+
this.y = y;
|
|
11
|
+
}
|
|
12
|
+
update(point) {
|
|
13
|
+
this.x = point.x;
|
|
14
|
+
this.y = point.y;
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
moveByAngle(angle, distance, friction) {
|
|
18
|
+
const angleRotated = angle + Math.PI / 2;
|
|
19
|
+
if (friction) {
|
|
20
|
+
this.x = this.x + Math.sin(angleRotated) * distance * ease(1 - friction);
|
|
21
|
+
this.y = this.y - Math.cos(angleRotated) * distance * ease(1 - friction);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.x = this.x + Math.sin(angleRotated) * distance;
|
|
25
|
+
this.y = this.y - Math.cos(angleRotated) * distance;
|
|
26
|
+
}
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
equalsTo(point) {
|
|
30
|
+
return this.x === point.x && this.y === point.y;
|
|
31
|
+
}
|
|
32
|
+
getDifferenceTo(point) {
|
|
33
|
+
return new DrawPoint(this.x - point.x, this.y - point.y);
|
|
34
|
+
}
|
|
35
|
+
getDistanceTo(point) {
|
|
36
|
+
const diff = this.getDifferenceTo(point);
|
|
37
|
+
return Math.sqrt(Math.pow(diff.x, 2) + Math.pow(diff.y, 2));
|
|
38
|
+
}
|
|
39
|
+
getAngleTo(point) {
|
|
40
|
+
const diff = this.getDifferenceTo(point);
|
|
41
|
+
return Math.atan2(diff.y, diff.x);
|
|
42
|
+
}
|
|
43
|
+
toObject() {
|
|
44
|
+
return { x: this.x, y: this.y };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
class DrawBrush {
|
|
48
|
+
constructor(options = {}) {
|
|
49
|
+
const initialPoint = options.initialPoint || { x: 0, y: 0 };
|
|
50
|
+
this.radius = options.radius || 30;
|
|
51
|
+
this._isEnabled = options.enabled === false ? false : true;
|
|
52
|
+
this.pointer = new DrawPoint(initialPoint.x, initialPoint.y);
|
|
53
|
+
this.brush = new DrawPoint(initialPoint.x, initialPoint.y);
|
|
54
|
+
this.angle = 0;
|
|
55
|
+
this.distance = 0;
|
|
56
|
+
this._hasMoved = false;
|
|
57
|
+
}
|
|
58
|
+
enable() {
|
|
59
|
+
this._isEnabled = true;
|
|
60
|
+
}
|
|
61
|
+
disable() {
|
|
62
|
+
this._isEnabled = false;
|
|
63
|
+
}
|
|
64
|
+
isEnabled() {
|
|
65
|
+
return this._isEnabled;
|
|
66
|
+
}
|
|
67
|
+
setRadius(radius) {
|
|
68
|
+
this.radius = radius;
|
|
69
|
+
}
|
|
70
|
+
getRadius() {
|
|
71
|
+
return this.radius;
|
|
72
|
+
}
|
|
73
|
+
getBrushCoordinates() {
|
|
74
|
+
return this.brush.toObject();
|
|
75
|
+
}
|
|
76
|
+
getPointerCoordinates() {
|
|
77
|
+
return this.pointer.toObject();
|
|
78
|
+
}
|
|
79
|
+
getBrush() {
|
|
80
|
+
return this.brush;
|
|
81
|
+
}
|
|
82
|
+
getPointer() {
|
|
83
|
+
return this.pointer;
|
|
84
|
+
}
|
|
85
|
+
getAngle() {
|
|
86
|
+
return this.angle;
|
|
87
|
+
}
|
|
88
|
+
getDistance() {
|
|
89
|
+
return this.distance;
|
|
90
|
+
}
|
|
91
|
+
brushHasMoved() {
|
|
92
|
+
return this._hasMoved;
|
|
93
|
+
}
|
|
94
|
+
update(newPointerPoint, options = {}) {
|
|
95
|
+
this._hasMoved = false;
|
|
96
|
+
if (this.pointer.equalsTo(newPointerPoint) && !options.both && !options.friction) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
this.pointer.update(newPointerPoint);
|
|
100
|
+
if (options.both) {
|
|
101
|
+
this._hasMoved = true;
|
|
102
|
+
this.brush.update(newPointerPoint);
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
if (this._isEnabled) {
|
|
106
|
+
this.distance = this.pointer.getDistanceTo(this.brush);
|
|
107
|
+
this.angle = this.pointer.getAngleTo(this.brush);
|
|
108
|
+
const isOutside = Math.round((this.distance - this.radius) * 10) / 10 > 0;
|
|
109
|
+
const friction = options.friction && options.friction < 1 && options.friction > 0
|
|
110
|
+
? options.friction
|
|
111
|
+
: undefined;
|
|
112
|
+
if (isOutside) {
|
|
113
|
+
this.brush.moveByAngle(this.angle, this.distance - this.radius, friction);
|
|
114
|
+
this._hasMoved = true;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
this.distance = 0;
|
|
119
|
+
this.angle = 0;
|
|
120
|
+
this.brush.update(newPointerPoint);
|
|
121
|
+
this._hasMoved = true;
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
let SniceDraw = (() => {
|
|
127
|
+
let _classDecorators = [element('snice-draw')];
|
|
128
|
+
let _classDescriptor;
|
|
129
|
+
let _classExtraInitializers = [];
|
|
130
|
+
let _classThis;
|
|
131
|
+
let _classSuper = HTMLElement;
|
|
132
|
+
let _instanceExtraInitializers = [];
|
|
133
|
+
let _width_decorators;
|
|
134
|
+
let _width_initializers = [];
|
|
135
|
+
let _width_extraInitializers = [];
|
|
136
|
+
let _height_decorators;
|
|
137
|
+
let _height_initializers = [];
|
|
138
|
+
let _height_extraInitializers = [];
|
|
139
|
+
let _tool_decorators;
|
|
140
|
+
let _tool_initializers = [];
|
|
141
|
+
let _tool_extraInitializers = [];
|
|
142
|
+
let _color_decorators;
|
|
143
|
+
let _color_initializers = [];
|
|
144
|
+
let _color_extraInitializers = [];
|
|
145
|
+
let _strokeWidth_decorators;
|
|
146
|
+
let _strokeWidth_initializers = [];
|
|
147
|
+
let _strokeWidth_extraInitializers = [];
|
|
148
|
+
let _backgroundColor_decorators;
|
|
149
|
+
let _backgroundColor_initializers = [];
|
|
150
|
+
let _backgroundColor_extraInitializers = [];
|
|
151
|
+
let _lazy_decorators;
|
|
152
|
+
let _lazy_initializers = [];
|
|
153
|
+
let _lazy_extraInitializers = [];
|
|
154
|
+
let _lazyRadius_decorators;
|
|
155
|
+
let _lazyRadius_initializers = [];
|
|
156
|
+
let _lazyRadius_extraInitializers = [];
|
|
157
|
+
let _friction_decorators;
|
|
158
|
+
let _friction_initializers = [];
|
|
159
|
+
let _friction_extraInitializers = [];
|
|
160
|
+
let _smoothing_decorators;
|
|
161
|
+
let _smoothing_initializers = [];
|
|
162
|
+
let _smoothing_extraInitializers = [];
|
|
163
|
+
let _autoPolygon_decorators;
|
|
164
|
+
let _autoPolygon_initializers = [];
|
|
165
|
+
let _autoPolygon_extraInitializers = [];
|
|
166
|
+
let _polygonCurvePoints_decorators;
|
|
167
|
+
let _polygonCurvePoints_initializers = [];
|
|
168
|
+
let _polygonCurvePoints_extraInitializers = [];
|
|
169
|
+
let _disabled_decorators;
|
|
170
|
+
let _disabled_initializers = [];
|
|
171
|
+
let _disabled_extraInitializers = [];
|
|
172
|
+
let _canvasElement_decorators;
|
|
173
|
+
let _canvasElement_initializers = [];
|
|
174
|
+
let _canvasElement_extraInitializers = [];
|
|
175
|
+
let _styles_decorators;
|
|
176
|
+
let _onReady_decorators;
|
|
177
|
+
let _onDispose_decorators;
|
|
178
|
+
let _render_decorators;
|
|
179
|
+
let _handlePointerDown_decorators;
|
|
180
|
+
let _handlePointerMove_decorators;
|
|
181
|
+
let _handlePointerUp_decorators;
|
|
182
|
+
let _emitDrawStart_decorators;
|
|
183
|
+
let _emitDrawEnd_decorators;
|
|
184
|
+
let _emitDrawClear_decorators;
|
|
185
|
+
let _emitDrawUndo_decorators;
|
|
186
|
+
let _emitDrawRedo_decorators;
|
|
187
|
+
(class extends _classSuper {
|
|
188
|
+
static { _classThis = this; }
|
|
189
|
+
static {
|
|
190
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
191
|
+
_width_decorators = [property({ type: Number })];
|
|
192
|
+
_height_decorators = [property({ type: Number })];
|
|
193
|
+
_tool_decorators = [property({ type: String })];
|
|
194
|
+
_color_decorators = [property({ type: String })];
|
|
195
|
+
_strokeWidth_decorators = [property({ type: Number, attribute: 'stroke-width' })];
|
|
196
|
+
_backgroundColor_decorators = [property({ type: String, attribute: 'background-color' })];
|
|
197
|
+
_lazy_decorators = [property({ type: Boolean })];
|
|
198
|
+
_lazyRadius_decorators = [property({ type: Number, attribute: 'lazy-radius' })];
|
|
199
|
+
_friction_decorators = [property({ type: Number })];
|
|
200
|
+
_smoothing_decorators = [property({ type: Number })];
|
|
201
|
+
_autoPolygon_decorators = [property({ type: Boolean, attribute: 'auto-polygon' })];
|
|
202
|
+
_polygonCurvePoints_decorators = [property({ type: Number, attribute: 'polygon-curve-points' })];
|
|
203
|
+
_disabled_decorators = [property({ type: Boolean })];
|
|
204
|
+
_canvasElement_decorators = [query('.draw-canvas')];
|
|
205
|
+
_styles_decorators = [styles()];
|
|
206
|
+
_onReady_decorators = [ready()];
|
|
207
|
+
_onDispose_decorators = [dispose()];
|
|
208
|
+
_render_decorators = [render()];
|
|
209
|
+
_handlePointerDown_decorators = [on('pointerdown', { target: 'canvas' })];
|
|
210
|
+
_handlePointerMove_decorators = [on('pointermove', { target: 'canvas' })];
|
|
211
|
+
_handlePointerUp_decorators = [on('pointerup', { target: 'canvas' })];
|
|
212
|
+
_emitDrawStart_decorators = [dispatch('@snice/draw-start', { bubbles: true, composed: true })];
|
|
213
|
+
_emitDrawEnd_decorators = [dispatch('@snice/draw-end', { bubbles: true, composed: true })];
|
|
214
|
+
_emitDrawClear_decorators = [dispatch('@snice/draw-clear', { bubbles: true, composed: true })];
|
|
215
|
+
_emitDrawUndo_decorators = [dispatch('@snice/draw-undo', { bubbles: true, composed: true })];
|
|
216
|
+
_emitDrawRedo_decorators = [dispatch('@snice/draw-redo', { bubbles: true, composed: true })];
|
|
217
|
+
__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);
|
|
218
|
+
__esDecorate(this, null, _onReady_decorators, { kind: "method", name: "onReady", static: false, private: false, access: { has: obj => "onReady" in obj, get: obj => obj.onReady }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
219
|
+
__esDecorate(this, null, _onDispose_decorators, { kind: "method", name: "onDispose", static: false, private: false, access: { has: obj => "onDispose" in obj, get: obj => obj.onDispose }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
220
|
+
__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);
|
|
221
|
+
__esDecorate(this, null, _handlePointerDown_decorators, { kind: "method", name: "handlePointerDown", static: false, private: false, access: { has: obj => "handlePointerDown" in obj, get: obj => obj.handlePointerDown }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
222
|
+
__esDecorate(this, null, _handlePointerMove_decorators, { kind: "method", name: "handlePointerMove", static: false, private: false, access: { has: obj => "handlePointerMove" in obj, get: obj => obj.handlePointerMove }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
223
|
+
__esDecorate(this, null, _handlePointerUp_decorators, { kind: "method", name: "handlePointerUp", static: false, private: false, access: { has: obj => "handlePointerUp" in obj, get: obj => obj.handlePointerUp }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
224
|
+
__esDecorate(this, null, _emitDrawStart_decorators, { kind: "method", name: "emitDrawStart", static: false, private: false, access: { has: obj => "emitDrawStart" in obj, get: obj => obj.emitDrawStart }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
225
|
+
__esDecorate(this, null, _emitDrawEnd_decorators, { kind: "method", name: "emitDrawEnd", static: false, private: false, access: { has: obj => "emitDrawEnd" in obj, get: obj => obj.emitDrawEnd }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
226
|
+
__esDecorate(this, null, _emitDrawClear_decorators, { kind: "method", name: "emitDrawClear", static: false, private: false, access: { has: obj => "emitDrawClear" in obj, get: obj => obj.emitDrawClear }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
227
|
+
__esDecorate(this, null, _emitDrawUndo_decorators, { kind: "method", name: "emitDrawUndo", static: false, private: false, access: { has: obj => "emitDrawUndo" in obj, get: obj => obj.emitDrawUndo }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
228
|
+
__esDecorate(this, null, _emitDrawRedo_decorators, { kind: "method", name: "emitDrawRedo", static: false, private: false, access: { has: obj => "emitDrawRedo" in obj, get: obj => obj.emitDrawRedo }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
229
|
+
__esDecorate(null, null, _width_decorators, { kind: "field", name: "width", static: false, private: false, access: { has: obj => "width" in obj, get: obj => obj.width, set: (obj, value) => { obj.width = value; } }, metadata: _metadata }, _width_initializers, _width_extraInitializers);
|
|
230
|
+
__esDecorate(null, null, _height_decorators, { kind: "field", name: "height", static: false, private: false, access: { has: obj => "height" in obj, get: obj => obj.height, set: (obj, value) => { obj.height = value; } }, metadata: _metadata }, _height_initializers, _height_extraInitializers);
|
|
231
|
+
__esDecorate(null, null, _tool_decorators, { kind: "field", name: "tool", static: false, private: false, access: { has: obj => "tool" in obj, get: obj => obj.tool, set: (obj, value) => { obj.tool = value; } }, metadata: _metadata }, _tool_initializers, _tool_extraInitializers);
|
|
232
|
+
__esDecorate(null, null, _color_decorators, { kind: "field", name: "color", static: false, private: false, access: { has: obj => "color" in obj, get: obj => obj.color, set: (obj, value) => { obj.color = value; } }, metadata: _metadata }, _color_initializers, _color_extraInitializers);
|
|
233
|
+
__esDecorate(null, null, _strokeWidth_decorators, { kind: "field", name: "strokeWidth", static: false, private: false, access: { has: obj => "strokeWidth" in obj, get: obj => obj.strokeWidth, set: (obj, value) => { obj.strokeWidth = value; } }, metadata: _metadata }, _strokeWidth_initializers, _strokeWidth_extraInitializers);
|
|
234
|
+
__esDecorate(null, null, _backgroundColor_decorators, { kind: "field", name: "backgroundColor", static: false, private: false, access: { has: obj => "backgroundColor" in obj, get: obj => obj.backgroundColor, set: (obj, value) => { obj.backgroundColor = value; } }, metadata: _metadata }, _backgroundColor_initializers, _backgroundColor_extraInitializers);
|
|
235
|
+
__esDecorate(null, null, _lazy_decorators, { kind: "field", name: "lazy", static: false, private: false, access: { has: obj => "lazy" in obj, get: obj => obj.lazy, set: (obj, value) => { obj.lazy = value; } }, metadata: _metadata }, _lazy_initializers, _lazy_extraInitializers);
|
|
236
|
+
__esDecorate(null, null, _lazyRadius_decorators, { kind: "field", name: "lazyRadius", static: false, private: false, access: { has: obj => "lazyRadius" in obj, get: obj => obj.lazyRadius, set: (obj, value) => { obj.lazyRadius = value; } }, metadata: _metadata }, _lazyRadius_initializers, _lazyRadius_extraInitializers);
|
|
237
|
+
__esDecorate(null, null, _friction_decorators, { kind: "field", name: "friction", static: false, private: false, access: { has: obj => "friction" in obj, get: obj => obj.friction, set: (obj, value) => { obj.friction = value; } }, metadata: _metadata }, _friction_initializers, _friction_extraInitializers);
|
|
238
|
+
__esDecorate(null, null, _smoothing_decorators, { kind: "field", name: "smoothing", static: false, private: false, access: { has: obj => "smoothing" in obj, get: obj => obj.smoothing, set: (obj, value) => { obj.smoothing = value; } }, metadata: _metadata }, _smoothing_initializers, _smoothing_extraInitializers);
|
|
239
|
+
__esDecorate(null, null, _autoPolygon_decorators, { kind: "field", name: "autoPolygon", static: false, private: false, access: { has: obj => "autoPolygon" in obj, get: obj => obj.autoPolygon, set: (obj, value) => { obj.autoPolygon = value; } }, metadata: _metadata }, _autoPolygon_initializers, _autoPolygon_extraInitializers);
|
|
240
|
+
__esDecorate(null, null, _polygonCurvePoints_decorators, { kind: "field", name: "polygonCurvePoints", static: false, private: false, access: { has: obj => "polygonCurvePoints" in obj, get: obj => obj.polygonCurvePoints, set: (obj, value) => { obj.polygonCurvePoints = value; } }, metadata: _metadata }, _polygonCurvePoints_initializers, _polygonCurvePoints_extraInitializers);
|
|
241
|
+
__esDecorate(null, null, _disabled_decorators, { kind: "field", name: "disabled", static: false, private: false, access: { has: obj => "disabled" in obj, get: obj => obj.disabled, set: (obj, value) => { obj.disabled = value; } }, metadata: _metadata }, _disabled_initializers, _disabled_extraInitializers);
|
|
242
|
+
__esDecorate(null, null, _canvasElement_decorators, { kind: "field", name: "canvasElement", static: false, private: false, access: { has: obj => "canvasElement" in obj, get: obj => obj.canvasElement, set: (obj, value) => { obj.canvasElement = value; } }, metadata: _metadata }, _canvasElement_initializers, _canvasElement_extraInitializers);
|
|
243
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
244
|
+
_classThis = _classDescriptor.value;
|
|
245
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
246
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
247
|
+
}
|
|
248
|
+
constructor() {
|
|
249
|
+
super();
|
|
250
|
+
this.width = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _width_initializers, 800));
|
|
251
|
+
this.height = (__runInitializers(this, _width_extraInitializers), __runInitializers(this, _height_initializers, 600));
|
|
252
|
+
this.tool = (__runInitializers(this, _height_extraInitializers), __runInitializers(this, _tool_initializers, 'pen'));
|
|
253
|
+
this.color = (__runInitializers(this, _tool_extraInitializers), __runInitializers(this, _color_initializers, '#000000'));
|
|
254
|
+
this.strokeWidth = (__runInitializers(this, _color_extraInitializers), __runInitializers(this, _strokeWidth_initializers, 2));
|
|
255
|
+
this.backgroundColor = (__runInitializers(this, _strokeWidth_extraInitializers), __runInitializers(this, _backgroundColor_initializers, '#ffffff'));
|
|
256
|
+
this.lazy = (__runInitializers(this, _backgroundColor_extraInitializers), __runInitializers(this, _lazy_initializers, false));
|
|
257
|
+
this.lazyRadius = (__runInitializers(this, _lazy_extraInitializers), __runInitializers(this, _lazyRadius_initializers, 60));
|
|
258
|
+
this.friction = (__runInitializers(this, _lazyRadius_extraInitializers), __runInitializers(this, _friction_initializers, 0.1));
|
|
259
|
+
this.smoothing = (__runInitializers(this, _friction_extraInitializers), __runInitializers(this, _smoothing_initializers, 0.5));
|
|
260
|
+
this.autoPolygon = (__runInitializers(this, _smoothing_extraInitializers), __runInitializers(this, _autoPolygon_initializers, false));
|
|
261
|
+
this.polygonCurvePoints = (__runInitializers(this, _autoPolygon_extraInitializers), __runInitializers(this, _polygonCurvePoints_initializers, 10));
|
|
262
|
+
this.disabled = (__runInitializers(this, _polygonCurvePoints_extraInitializers), __runInitializers(this, _disabled_initializers, false));
|
|
263
|
+
this.canvasElement = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _canvasElement_initializers, void 0));
|
|
264
|
+
this.canvas = (__runInitializers(this, _canvasElement_extraInitializers), null);
|
|
265
|
+
this.ctx = null;
|
|
266
|
+
this.isDrawing = false;
|
|
267
|
+
this.isPressing = false;
|
|
268
|
+
this.currentStroke = [];
|
|
269
|
+
this.strokes = [];
|
|
270
|
+
this.undoneStrokes = [];
|
|
271
|
+
this.lastPoint = null;
|
|
272
|
+
this.rafId = null;
|
|
273
|
+
this.mouseX = 0;
|
|
274
|
+
this.mouseY = 0;
|
|
275
|
+
this.drawBrush = new DrawBrush({
|
|
276
|
+
radius: this.lazyRadius,
|
|
277
|
+
enabled: this.lazy
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
styles() {
|
|
281
|
+
return css /*css*/ `${drawStyles}`;
|
|
282
|
+
}
|
|
283
|
+
onReady() {
|
|
284
|
+
requestAnimationFrame(() => {
|
|
285
|
+
this.initCanvas();
|
|
286
|
+
this.startLoop();
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
onDispose() {
|
|
290
|
+
this.stopLoop();
|
|
291
|
+
}
|
|
292
|
+
render() {
|
|
293
|
+
return html `
|
|
294
|
+
<div class="draw-container">
|
|
295
|
+
<canvas
|
|
296
|
+
width="${this.width}"
|
|
297
|
+
height="${this.height}"
|
|
298
|
+
class="draw-canvas tool-${this.tool} ${this.disabled ? 'disabled' : ''}">
|
|
299
|
+
</canvas>
|
|
300
|
+
</div>
|
|
301
|
+
`;
|
|
302
|
+
}
|
|
303
|
+
initCanvas() {
|
|
304
|
+
this.canvas = this.canvasElement || null;
|
|
305
|
+
if (!this.canvas)
|
|
306
|
+
return;
|
|
307
|
+
// Handle high DPI displays
|
|
308
|
+
const dpr = window.devicePixelRatio || 1;
|
|
309
|
+
this.canvas.getBoundingClientRect();
|
|
310
|
+
// Set canvas buffer size (accounting for DPI)
|
|
311
|
+
this.canvas.width = this.width * dpr;
|
|
312
|
+
this.canvas.height = this.height * dpr;
|
|
313
|
+
// Set display size
|
|
314
|
+
this.canvas.style.width = `${this.width}px`;
|
|
315
|
+
this.canvas.style.height = `${this.height}px`;
|
|
316
|
+
this.ctx = this.canvas.getContext('2d', { willReadFrequently: true });
|
|
317
|
+
if (!this.ctx)
|
|
318
|
+
return;
|
|
319
|
+
// Scale canvas drawing to match DPI
|
|
320
|
+
this.ctx.scale(dpr, dpr);
|
|
321
|
+
// Enable anti-aliasing for smooth lines
|
|
322
|
+
this.ctx.imageSmoothingEnabled = true;
|
|
323
|
+
this.ctx.imageSmoothingQuality = 'high';
|
|
324
|
+
// Set background
|
|
325
|
+
this.ctx.fillStyle = this.backgroundColor;
|
|
326
|
+
this.ctx.fillRect(0, 0, this.width, this.height);
|
|
327
|
+
// Redraw existing strokes
|
|
328
|
+
this.redraw();
|
|
329
|
+
}
|
|
330
|
+
handlePointerDown(e) {
|
|
331
|
+
if (this.disabled)
|
|
332
|
+
return;
|
|
333
|
+
e.preventDefault();
|
|
334
|
+
const point = this.getPointerPosition(e);
|
|
335
|
+
this.mouseX = point.x;
|
|
336
|
+
this.mouseY = point.y;
|
|
337
|
+
// Update brush to pointer position immediately
|
|
338
|
+
this.drawBrush.update(point, { both: true });
|
|
339
|
+
this.isPressing = true;
|
|
340
|
+
this.canvas?.setPointerCapture(e.pointerId);
|
|
341
|
+
this.emitDrawStart(point);
|
|
342
|
+
}
|
|
343
|
+
handlePointerMove(e) {
|
|
344
|
+
if (this.disabled)
|
|
345
|
+
return;
|
|
346
|
+
e.preventDefault();
|
|
347
|
+
const point = this.getPointerPosition(e);
|
|
348
|
+
this.mouseX = point.x;
|
|
349
|
+
this.mouseY = point.y;
|
|
350
|
+
}
|
|
351
|
+
handlePointerUp(e) {
|
|
352
|
+
if (!this.isPressing)
|
|
353
|
+
return;
|
|
354
|
+
e.preventDefault();
|
|
355
|
+
this.isPressing = false;
|
|
356
|
+
this.isDrawing = false;
|
|
357
|
+
if (this.currentStroke.length > 0) {
|
|
358
|
+
// Process polygon if auto-polygon is enabled
|
|
359
|
+
const points = this.autoPolygon
|
|
360
|
+
? this.processPolygon([...this.currentStroke])
|
|
361
|
+
: [...this.currentStroke];
|
|
362
|
+
const stroke = {
|
|
363
|
+
id: this.generateId(),
|
|
364
|
+
tool: this.tool,
|
|
365
|
+
color: this.color,
|
|
366
|
+
width: this.strokeWidth,
|
|
367
|
+
points,
|
|
368
|
+
timestamp: Date.now()
|
|
369
|
+
};
|
|
370
|
+
this.strokes.push(stroke);
|
|
371
|
+
this.currentStroke = [];
|
|
372
|
+
// Redraw immediately to show the processed polygon
|
|
373
|
+
this.redraw();
|
|
374
|
+
this.emitDrawEnd(stroke);
|
|
375
|
+
}
|
|
376
|
+
this.canvas?.releasePointerCapture(e.pointerId);
|
|
377
|
+
}
|
|
378
|
+
getPointerPosition(e) {
|
|
379
|
+
if (!this.canvas)
|
|
380
|
+
return { x: 0, y: 0, pressure: 0 };
|
|
381
|
+
const rect = this.canvas.getBoundingClientRect();
|
|
382
|
+
// Map from screen coordinates to logical canvas coordinates
|
|
383
|
+
const x = (e.clientX - rect.left) * (this.width / rect.width);
|
|
384
|
+
const y = (e.clientY - rect.top) * (this.height / rect.height);
|
|
385
|
+
return {
|
|
386
|
+
x,
|
|
387
|
+
y,
|
|
388
|
+
pressure: e.pressure
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
startLoop() {
|
|
392
|
+
const loop = () => {
|
|
393
|
+
this.updateLazyBrush();
|
|
394
|
+
this.rafId = requestAnimationFrame(loop);
|
|
395
|
+
};
|
|
396
|
+
loop();
|
|
397
|
+
}
|
|
398
|
+
stopLoop() {
|
|
399
|
+
if (this.rafId !== null) {
|
|
400
|
+
cancelAnimationFrame(this.rafId);
|
|
401
|
+
this.rafId = null;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
midPointBtw(p1, p2) {
|
|
405
|
+
return {
|
|
406
|
+
x: p1.x + (p2.x - p1.x) / 2,
|
|
407
|
+
y: p1.y + (p2.y - p1.y) / 2
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
updateLazyBrush() {
|
|
411
|
+
if (!this.ctx)
|
|
412
|
+
return;
|
|
413
|
+
this.drawBrush.update({ x: this.mouseX, y: this.mouseY }, { friction: this.isDrawing ? this.friction : 1 });
|
|
414
|
+
!this.drawBrush.isEnabled();
|
|
415
|
+
this.drawBrush.brushHasMoved();
|
|
416
|
+
// Start drawing if pressing and not yet drawing
|
|
417
|
+
if (this.isPressing && !this.isDrawing) {
|
|
418
|
+
this.isDrawing = true;
|
|
419
|
+
this.currentStroke = [];
|
|
420
|
+
this.undoneStrokes = [];
|
|
421
|
+
this.currentStroke.push(this.drawBrush.getBrushCoordinates());
|
|
422
|
+
}
|
|
423
|
+
if (this.isDrawing) {
|
|
424
|
+
// Clear canvas and fill background
|
|
425
|
+
this.ctx.fillStyle = this.backgroundColor;
|
|
426
|
+
this.ctx.fillRect(0, 0, this.width, this.height);
|
|
427
|
+
// Redraw all completed strokes
|
|
428
|
+
this.strokes.forEach(stroke => {
|
|
429
|
+
this.drawStroke(stroke);
|
|
430
|
+
});
|
|
431
|
+
// Add current point
|
|
432
|
+
this.currentStroke.push(this.drawBrush.getBrushCoordinates());
|
|
433
|
+
// Draw current stroke with smoothing
|
|
434
|
+
if (this.currentStroke.length > 1) {
|
|
435
|
+
this.ctx.lineJoin = 'round';
|
|
436
|
+
this.ctx.lineCap = 'round';
|
|
437
|
+
this.ctx.strokeStyle = this.tool === 'eraser' ? this.backgroundColor : this.color;
|
|
438
|
+
this.ctx.lineWidth = this.strokeWidth * 2;
|
|
439
|
+
let p1 = this.currentStroke[0];
|
|
440
|
+
let p2 = this.currentStroke[1];
|
|
441
|
+
this.ctx.moveTo(p2.x, p2.y);
|
|
442
|
+
this.ctx.beginPath();
|
|
443
|
+
for (let i = 1, len = this.currentStroke.length; i < len; i++) {
|
|
444
|
+
const midPoint = this.midPointBtw(p1, p2);
|
|
445
|
+
this.ctx.quadraticCurveTo(p1.x, p1.y, midPoint.x, midPoint.y);
|
|
446
|
+
p1 = this.currentStroke[i];
|
|
447
|
+
p2 = this.currentStroke[i + 1];
|
|
448
|
+
}
|
|
449
|
+
// Draw last line as straight line while waiting for next point
|
|
450
|
+
this.ctx.lineTo(p1.x, p1.y);
|
|
451
|
+
this.ctx.stroke();
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
redraw() {
|
|
456
|
+
if (!this.ctx)
|
|
457
|
+
return;
|
|
458
|
+
// Clear and set background
|
|
459
|
+
this.ctx.fillStyle = this.backgroundColor;
|
|
460
|
+
this.ctx.fillRect(0, 0, this.width, this.height);
|
|
461
|
+
// Redraw all strokes
|
|
462
|
+
this.strokes.forEach(stroke => {
|
|
463
|
+
this.drawStroke(stroke);
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
drawStroke(stroke) {
|
|
467
|
+
if (!this.ctx || stroke.points.length === 0)
|
|
468
|
+
return;
|
|
469
|
+
this.ctx.lineJoin = 'round';
|
|
470
|
+
this.ctx.lineCap = 'round';
|
|
471
|
+
this.ctx.strokeStyle = stroke.tool === 'eraser' ? this.backgroundColor : stroke.color;
|
|
472
|
+
this.ctx.lineWidth = stroke.width * 2;
|
|
473
|
+
if (stroke.points.length === 1) {
|
|
474
|
+
// Single point - just draw a dot
|
|
475
|
+
this.ctx.beginPath();
|
|
476
|
+
this.ctx.arc(stroke.points[0].x, stroke.points[0].y, stroke.width, 0, Math.PI * 2);
|
|
477
|
+
this.ctx.fill();
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
let p1 = stroke.points[0];
|
|
481
|
+
let p2 = stroke.points[1];
|
|
482
|
+
this.ctx.moveTo(p2.x, p2.y);
|
|
483
|
+
this.ctx.beginPath();
|
|
484
|
+
for (let i = 1, len = stroke.points.length; i < len; i++) {
|
|
485
|
+
const midPoint = this.midPointBtw(p1, p2);
|
|
486
|
+
this.ctx.quadraticCurveTo(p1.x, p1.y, midPoint.x, midPoint.y);
|
|
487
|
+
p1 = stroke.points[i];
|
|
488
|
+
p2 = stroke.points[i + 1];
|
|
489
|
+
}
|
|
490
|
+
this.ctx.lineTo(p1.x, p1.y);
|
|
491
|
+
this.ctx.stroke();
|
|
492
|
+
}
|
|
493
|
+
clear() {
|
|
494
|
+
if (!this.ctx)
|
|
495
|
+
return;
|
|
496
|
+
this.strokes = [];
|
|
497
|
+
this.undoneStrokes = [];
|
|
498
|
+
this.ctx.fillStyle = this.backgroundColor;
|
|
499
|
+
this.ctx.fillRect(0, 0, this.width, this.height);
|
|
500
|
+
this.emitDrawClear();
|
|
501
|
+
}
|
|
502
|
+
undo() {
|
|
503
|
+
if (this.strokes.length === 0)
|
|
504
|
+
return;
|
|
505
|
+
const stroke = this.strokes.pop();
|
|
506
|
+
if (stroke) {
|
|
507
|
+
this.undoneStrokes.push(stroke);
|
|
508
|
+
this.redraw();
|
|
509
|
+
this.emitDrawUndo();
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
redo() {
|
|
513
|
+
if (this.undoneStrokes.length === 0)
|
|
514
|
+
return;
|
|
515
|
+
const stroke = this.undoneStrokes.pop();
|
|
516
|
+
if (stroke) {
|
|
517
|
+
this.strokes.push(stroke);
|
|
518
|
+
this.drawStroke(stroke);
|
|
519
|
+
this.emitDrawRedo();
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
toDataURL(type = 'image/png', quality = 0.92) {
|
|
523
|
+
if (!this.canvas)
|
|
524
|
+
return '';
|
|
525
|
+
return this.canvas.toDataURL(type, quality);
|
|
526
|
+
}
|
|
527
|
+
async toBlob(type = 'image/png', quality = 0.92) {
|
|
528
|
+
if (!this.canvas)
|
|
529
|
+
throw new Error('Canvas not initialized');
|
|
530
|
+
return new Promise((resolve, reject) => {
|
|
531
|
+
this.canvas?.toBlob((blob) => {
|
|
532
|
+
if (blob)
|
|
533
|
+
resolve(blob);
|
|
534
|
+
else
|
|
535
|
+
reject(new Error('Failed to create blob'));
|
|
536
|
+
}, type, quality);
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
download(filename = `drawing-${Date.now()}.png`) {
|
|
540
|
+
const dataURL = this.toDataURL();
|
|
541
|
+
const a = document.createElement('a');
|
|
542
|
+
a.href = dataURL;
|
|
543
|
+
a.download = filename;
|
|
544
|
+
a.click();
|
|
545
|
+
}
|
|
546
|
+
async loadImage(url) {
|
|
547
|
+
if (!this.ctx)
|
|
548
|
+
throw new Error('Canvas not initialized');
|
|
549
|
+
return new Promise((resolve, reject) => {
|
|
550
|
+
const img = new Image();
|
|
551
|
+
img.crossOrigin = 'anonymous';
|
|
552
|
+
img.onload = () => {
|
|
553
|
+
this.ctx.drawImage(img, 0, 0, this.width, this.height);
|
|
554
|
+
resolve();
|
|
555
|
+
};
|
|
556
|
+
img.onerror = () => reject(new Error('Failed to load image'));
|
|
557
|
+
img.src = url;
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
getStrokes() {
|
|
561
|
+
return [...this.strokes];
|
|
562
|
+
}
|
|
563
|
+
setStrokes(strokes) {
|
|
564
|
+
this.strokes = [...strokes];
|
|
565
|
+
this.undoneStrokes = [];
|
|
566
|
+
this.redraw();
|
|
567
|
+
}
|
|
568
|
+
generateId() {
|
|
569
|
+
return `stroke-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
570
|
+
}
|
|
571
|
+
// Polygon processing methods
|
|
572
|
+
processPolygon(points) {
|
|
573
|
+
if (!this.autoPolygon || points.length < 4)
|
|
574
|
+
return points;
|
|
575
|
+
// Simplify to line segments (sample every Nth point for performance)
|
|
576
|
+
const simplified = this.simplifyPoints(points, 5);
|
|
577
|
+
// Check for self-intersection
|
|
578
|
+
const intersection = this.findFirstIntersection(simplified);
|
|
579
|
+
if (intersection) {
|
|
580
|
+
// Trim at intersection point
|
|
581
|
+
return this.trimAtIntersection(points, intersection);
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
// Check if shape should be closed
|
|
585
|
+
const start = points[0];
|
|
586
|
+
const end = points[points.length - 1];
|
|
587
|
+
const distance = Math.sqrt(Math.pow(end.x - start.x, 2) + Math.pow(end.y - start.y, 2));
|
|
588
|
+
// If start and end are far apart (more than 20px), close the shape with a curve
|
|
589
|
+
if (distance > 20) {
|
|
590
|
+
const curvePoints = this.createClosingCurve(end, start, this.polygonCurvePoints);
|
|
591
|
+
return [...points, ...curvePoints];
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
return points;
|
|
595
|
+
}
|
|
596
|
+
simplifyPoints(points, step) {
|
|
597
|
+
const simplified = [];
|
|
598
|
+
for (let i = 0; i < points.length; i += step) {
|
|
599
|
+
simplified.push(points[i]);
|
|
600
|
+
}
|
|
601
|
+
// Always include the last point
|
|
602
|
+
if (simplified[simplified.length - 1] !== points[points.length - 1]) {
|
|
603
|
+
simplified.push(points[points.length - 1]);
|
|
604
|
+
}
|
|
605
|
+
return simplified;
|
|
606
|
+
}
|
|
607
|
+
findFirstIntersection(points) {
|
|
608
|
+
// Check each line segment against all others
|
|
609
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
610
|
+
const p1 = points[i];
|
|
611
|
+
const p2 = points[i + 1];
|
|
612
|
+
// Start checking from i+2 to avoid adjacent segments
|
|
613
|
+
for (let j = i + 2; j < points.length - 1; j++) {
|
|
614
|
+
const p3 = points[j];
|
|
615
|
+
const p4 = points[j + 1];
|
|
616
|
+
// Don't check the last segment against the first (they should connect)
|
|
617
|
+
if (i === 0 && j === points.length - 2)
|
|
618
|
+
continue;
|
|
619
|
+
const intersection = this.lineIntersection(p1, p2, p3, p4);
|
|
620
|
+
if (intersection) {
|
|
621
|
+
return { i, j, point: intersection };
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
return null;
|
|
626
|
+
}
|
|
627
|
+
lineIntersection(p1, p2, p3, p4) {
|
|
628
|
+
const x1 = p1.x, y1 = p1.y;
|
|
629
|
+
const x2 = p2.x, y2 = p2.y;
|
|
630
|
+
const x3 = p3.x, y3 = p3.y;
|
|
631
|
+
const x4 = p4.x, y4 = p4.y;
|
|
632
|
+
const denom = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
|
|
633
|
+
if (Math.abs(denom) < 0.0001)
|
|
634
|
+
return null; // Parallel lines
|
|
635
|
+
const t = ((x1 - x3) * (y3 - y4) - (y1 - y3) * (x3 - x4)) / denom;
|
|
636
|
+
const u = -((x1 - x2) * (y1 - y3) - (y1 - y2) * (x1 - x3)) / denom;
|
|
637
|
+
if (t >= 0 && t <= 1 && u >= 0 && u <= 1) {
|
|
638
|
+
return {
|
|
639
|
+
x: x1 + t * (x2 - x1),
|
|
640
|
+
y: y1 + t * (y2 - y1),
|
|
641
|
+
pressure: 0
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
return null;
|
|
645
|
+
}
|
|
646
|
+
trimAtIntersection(points, intersection) {
|
|
647
|
+
// Find the actual indices in the full point array based on simplified indices
|
|
648
|
+
const step = 5;
|
|
649
|
+
const actualI = Math.min(intersection.i * step, points.length - 1);
|
|
650
|
+
// Keep points up to the intersection, add the intersection point, then close
|
|
651
|
+
return [...points.slice(0, actualI + 1), intersection.point];
|
|
652
|
+
}
|
|
653
|
+
createClosingCurve(start, end, numPoints) {
|
|
654
|
+
if (numPoints < 2)
|
|
655
|
+
return [end];
|
|
656
|
+
const curvePoints = [];
|
|
657
|
+
// Calculate control point for the curve
|
|
658
|
+
// Use a point perpendicular to the line between start and end
|
|
659
|
+
const midX = (start.x + end.x) / 2;
|
|
660
|
+
const midY = (start.y + end.y) / 2;
|
|
661
|
+
// Vector from start to end
|
|
662
|
+
const dx = end.x - start.x;
|
|
663
|
+
const dy = end.y - start.y;
|
|
664
|
+
// Perpendicular vector (rotated 90 degrees)
|
|
665
|
+
const perpX = -dy;
|
|
666
|
+
const perpY = dx;
|
|
667
|
+
// Control point is offset from midpoint along perpendicular
|
|
668
|
+
// Offset is proportional to distance to create a natural curve
|
|
669
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
670
|
+
const offset = distance * 0.2; // 20% of distance
|
|
671
|
+
const controlX = midX + (perpX / distance) * offset;
|
|
672
|
+
const controlY = midY + (perpY / distance) * offset;
|
|
673
|
+
// Interpolate points along the quadratic Bezier curve
|
|
674
|
+
for (let i = 1; i <= numPoints; i++) {
|
|
675
|
+
const t = i / (numPoints + 1);
|
|
676
|
+
// Quadratic Bezier formula: B(t) = (1-t)²P0 + 2(1-t)tP1 + t²P2
|
|
677
|
+
const x = Math.pow(1 - t, 2) * start.x +
|
|
678
|
+
2 * (1 - t) * t * controlX +
|
|
679
|
+
Math.pow(t, 2) * end.x;
|
|
680
|
+
const y = Math.pow(1 - t, 2) * start.y +
|
|
681
|
+
2 * (1 - t) * t * controlY +
|
|
682
|
+
Math.pow(t, 2) * end.y;
|
|
683
|
+
curvePoints.push({ x, y, pressure: 0 });
|
|
684
|
+
}
|
|
685
|
+
// Add the end point
|
|
686
|
+
curvePoints.push(end);
|
|
687
|
+
return curvePoints;
|
|
688
|
+
}
|
|
689
|
+
emitDrawStart(point) {
|
|
690
|
+
return { draw: this, point };
|
|
691
|
+
}
|
|
692
|
+
emitDrawEnd(stroke) {
|
|
693
|
+
return { draw: this, stroke };
|
|
694
|
+
}
|
|
695
|
+
emitDrawClear() {
|
|
696
|
+
return { draw: this };
|
|
697
|
+
}
|
|
698
|
+
emitDrawUndo() {
|
|
699
|
+
return { draw: this };
|
|
700
|
+
}
|
|
701
|
+
emitDrawRedo() {
|
|
702
|
+
return { draw: this };
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
return _classThis;
|
|
706
|
+
})();
|
|
707
|
+
|
|
708
|
+
export { SniceDraw };
|
|
709
|
+
//# sourceMappingURL=snice-draw.js.map
|