snice 4.28.0 → 4.30.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/README.md +3 -10
- package/adapters/react/SniceProvider.d.ts +71 -0
- package/adapters/react/SniceProvider.js +49 -0
- package/adapters/react/SniceProvider.js.map +1 -0
- package/adapters/react/SniceRouter.d.ts +44 -0
- package/adapters/react/SniceRouter.js +190 -0
- package/adapters/react/SniceRouter.js.map +1 -0
- package/adapters/react/action-bar.d.ts +30 -0
- package/adapters/react/action-bar.d.ts.map +1 -0
- package/adapters/react/action-bar.js +24 -0
- package/adapters/react/action-bar.js.map +1 -0
- package/adapters/react/action-bar.tsx +38 -0
- package/adapters/react/binpack.d.ts +35 -0
- package/adapters/react/binpack.d.ts.map +1 -0
- package/adapters/react/binpack.js +24 -0
- package/adapters/react/binpack.js.map +1 -0
- package/adapters/react/binpack.tsx +43 -0
- package/adapters/react/components.d.ts +6 -0
- package/adapters/react/components.d.ts.map +1 -1
- package/adapters/react/components.js +3 -0
- package/adapters/react/components.js.map +1 -1
- package/adapters/react/components.ts +6 -0
- package/adapters/react/grid.d.ts +36 -0
- package/adapters/react/grid.d.ts.map +1 -0
- package/adapters/react/grid.js +24 -0
- package/adapters/react/grid.js.map +1 -0
- package/adapters/react/grid.tsx +44 -0
- package/adapters/react/index.d.ts +5 -0
- package/adapters/react/index.d.ts.map +1 -1
- package/adapters/react/index.js +3 -2
- package/adapters/react/index.js.map +1 -1
- package/adapters/react/index.ts +6 -3
- package/adapters/react/matchRoute.d.ts +16 -0
- package/adapters/react/matchRoute.js +32 -0
- package/adapters/react/matchRoute.js.map +1 -0
- package/adapters/react/types.d.ts +1 -15
- package/adapters/react/types.d.ts.map +1 -1
- package/adapters/react/types.ts +1 -15
- package/adapters/react/useRequestHandler.d.ts +56 -0
- package/adapters/react/useRequestHandler.js +103 -0
- package/adapters/react/useRequestHandler.js.map +1 -0
- package/bin/snice.js +8 -13
- package/bin/templates/{pwa → default}/index.html +1 -1
- package/bin/templates/{pwa → default}/src/components/app-header.ts +36 -18
- package/bin/templates/{pwa → default}/src/components/notification-badge.ts +2 -21
- package/bin/templates/{pwa → default}/src/components/search-bar.ts +12 -12
- package/bin/templates/default/src/context.ts +17 -0
- package/bin/templates/{pwa → default}/src/controllers/notification-controller.ts +10 -15
- package/bin/templates/{pwa → default}/src/daemons/notifications.ts +0 -12
- package/bin/templates/{pwa → default}/src/main.ts +1 -7
- package/bin/templates/{pwa → default}/src/middleware/error.ts +1 -8
- package/bin/templates/{pwa → default}/src/pages/dashboard.ts +17 -18
- package/bin/templates/{pwa → default}/src/pages/data.ts +24 -24
- package/bin/templates/{pwa → default}/src/pages/login.ts +3 -6
- package/bin/templates/{pwa → default}/src/pages/notifications.ts +21 -19
- package/bin/templates/{pwa → default}/src/pages/profile.ts +10 -12
- package/bin/templates/{pwa → default}/src/pages/settings.ts +22 -22
- package/bin/templates/default/src/router.ts +13 -0
- package/bin/templates/default/src/styles/global.css +16 -0
- package/bin/templates/{pwa → default}/tsconfig.json +2 -1
- package/bin/templates/react/README.md +124 -0
- package/bin/templates/react/global.d.ts +10 -0
- package/bin/templates/react/index.html +15 -0
- package/bin/templates/react/package.json +31 -0
- package/bin/templates/react/src/App.tsx +112 -0
- package/bin/templates/react/src/components/AppHeader.tsx +85 -0
- package/bin/templates/react/src/components/AppLayout.tsx +11 -0
- package/bin/templates/react/src/components/NotificationBadge.tsx +13 -0
- package/bin/templates/react/src/components/SearchBar.tsx +63 -0
- package/bin/templates/react/src/daemons/notifications.ts +136 -0
- package/bin/templates/react/src/fetcher.ts +15 -0
- package/bin/templates/react/src/guards/auth.ts +6 -0
- package/bin/templates/react/src/main.tsx +27 -0
- package/bin/templates/react/src/middleware/auth.ts +16 -0
- package/bin/templates/react/src/middleware/error.ts +29 -0
- package/bin/templates/react/src/middleware/retry.ts +31 -0
- package/bin/templates/react/src/pages/DashboardPage.tsx +111 -0
- package/bin/templates/react/src/pages/DataPage.tsx +119 -0
- package/bin/templates/react/src/pages/LoginPage.tsx +46 -0
- package/bin/templates/react/src/pages/NotificationsPage.tsx +119 -0
- package/bin/templates/react/src/pages/ProfilePage.tsx +92 -0
- package/bin/templates/react/src/pages/SettingsPage.tsx +165 -0
- package/bin/templates/react/src/services/auth.ts +48 -0
- package/bin/templates/react/src/services/jwt.ts +35 -0
- package/bin/templates/react/src/services/storage.ts +24 -0
- package/bin/templates/react/src/styles/global.css +382 -0
- package/bin/templates/react/src/types/auth.ts +21 -0
- package/bin/templates/react/src/types/notifications.ts +9 -0
- package/bin/templates/react/tests/helpers/test-utils.ts +79 -0
- package/bin/templates/react/tests/middleware/auth.test.ts +67 -0
- package/bin/templates/react/tests/middleware/error.test.ts +105 -0
- package/bin/templates/react/tests/middleware/retry.test.ts +103 -0
- package/bin/templates/react/tests/services/auth.test.ts +89 -0
- package/bin/templates/react/tests/services/jwt.test.ts +76 -0
- package/bin/templates/react/tests/services/storage.test.ts +69 -0
- package/bin/templates/{base → react}/tsconfig.json +4 -6
- package/bin/templates/react/vite.config.ts +18 -0
- package/bin/templates/react/vitest.config.ts +18 -0
- package/dist/cdn/accordion/snice-accordion.js +1 -1
- package/dist/cdn/accordion/snice-accordion.min.js +1 -1
- package/dist/cdn/action-bar/README.md +27 -0
- package/dist/cdn/action-bar/snice-action-bar.js +249 -0
- package/dist/cdn/action-bar/snice-action-bar.js.map +1 -0
- package/dist/cdn/action-bar/snice-action-bar.min.js +12 -0
- package/dist/cdn/action-bar/snice-action-bar.min.js.map +1 -0
- package/dist/cdn/activity-feed/snice-activity-feed.js +1 -1
- package/dist/cdn/activity-feed/snice-activity-feed.min.js +1 -1
- package/dist/cdn/alert/snice-alert.js +1 -1
- package/dist/cdn/alert/snice-alert.min.js +1 -1
- package/dist/cdn/app-tiles/snice-app-tiles.js +1 -1
- package/dist/cdn/app-tiles/snice-app-tiles.min.js +1 -1
- package/dist/cdn/approval-flow/snice-approval-flow.js +1 -1
- package/dist/cdn/approval-flow/snice-approval-flow.min.js +1 -1
- package/dist/cdn/audio-recorder/snice-audio-recorder.js +1 -1
- package/dist/cdn/audio-recorder/snice-audio-recorder.min.js +1 -1
- package/dist/cdn/availability/snice-availability.js +1 -1
- package/dist/cdn/availability/snice-availability.min.js +1 -1
- package/dist/cdn/avatar/snice-avatar.js +1 -1
- package/dist/cdn/avatar/snice-avatar.min.js +1 -1
- package/dist/cdn/avatar-group/snice-avatar-group.js +1 -1
- package/dist/cdn/avatar-group/snice-avatar-group.min.js +1 -1
- package/dist/cdn/badge/snice-badge.js +1 -1
- package/dist/cdn/badge/snice-badge.min.js +1 -1
- package/dist/cdn/banner/snice-banner.js +1 -1
- package/dist/cdn/banner/snice-banner.min.js +1 -1
- package/dist/cdn/binpack/README.md +27 -0
- package/dist/cdn/binpack/snice-binpack.js +1037 -0
- package/dist/cdn/binpack/snice-binpack.js.map +1 -0
- package/dist/cdn/binpack/snice-binpack.min.js +13 -0
- package/dist/cdn/binpack/snice-binpack.min.js.map +1 -0
- package/dist/cdn/book/snice-book.js +1 -1
- package/dist/cdn/book/snice-book.min.js +1 -1
- package/dist/cdn/booking/snice-booking.js +1 -1
- package/dist/cdn/booking/snice-booking.min.js +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.js +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.min.js +1 -1
- package/dist/cdn/button/README.md +1 -1
- package/dist/cdn/button/snice-button.js +2 -2
- package/dist/cdn/button/snice-button.js.map +1 -1
- package/dist/cdn/button/snice-button.min.js +2 -2
- package/dist/cdn/button/snice-button.min.js.map +1 -1
- package/dist/cdn/calendar/snice-calendar.js +1 -1
- package/dist/cdn/calendar/snice-calendar.min.js +1 -1
- package/dist/cdn/camera/snice-camera.js +1 -1
- package/dist/cdn/camera/snice-camera.min.js +1 -1
- package/dist/cdn/camera-annotate/snice-camera-annotate.js +1 -1
- package/dist/cdn/camera-annotate/snice-camera-annotate.min.js +1 -1
- package/dist/cdn/candlestick/snice-candlestick.js +1 -1
- package/dist/cdn/candlestick/snice-candlestick.min.js +1 -1
- package/dist/cdn/card/snice-card.js +1 -1
- package/dist/cdn/card/snice-card.min.js +1 -1
- package/dist/cdn/carousel/snice-carousel.js +1 -1
- package/dist/cdn/carousel/snice-carousel.min.js +1 -1
- package/dist/cdn/cart/snice-cart.js +1 -1
- package/dist/cdn/cart/snice-cart.min.js +1 -1
- package/dist/cdn/chart/snice-chart.js +1 -1
- package/dist/cdn/chart/snice-chart.min.js +1 -1
- package/dist/cdn/chat/snice-chat.js +1 -1
- package/dist/cdn/chat/snice-chat.min.js +1 -1
- package/dist/cdn/checkbox/snice-checkbox.js +1 -1
- package/dist/cdn/checkbox/snice-checkbox.min.js +1 -1
- package/dist/cdn/chip/README.md +2 -2
- package/dist/cdn/chip/snice-chip.js +2 -2
- package/dist/cdn/chip/snice-chip.js.map +1 -1
- package/dist/cdn/chip/snice-chip.min.js +3 -3
- package/dist/cdn/chip/snice-chip.min.js.map +1 -1
- package/dist/cdn/code-block/snice-code-block.js +1 -1
- package/dist/cdn/code-block/snice-code-block.min.js +1 -1
- package/dist/cdn/color-display/snice-color-display.js +1 -1
- package/dist/cdn/color-display/snice-color-display.min.js +1 -1
- package/dist/cdn/color-picker/snice-color-picker.js +1 -1
- package/dist/cdn/color-picker/snice-color-picker.min.js +1 -1
- package/dist/cdn/command-palette/snice-command-palette.js +1 -1
- package/dist/cdn/command-palette/snice-command-palette.min.js +1 -1
- package/dist/cdn/comments/snice-comments.js +1 -1
- package/dist/cdn/comments/snice-comments.min.js +1 -1
- package/dist/cdn/countdown/snice-countdown.js +1 -1
- package/dist/cdn/countdown/snice-countdown.min.js +1 -1
- package/dist/cdn/cropper/snice-cropper.js +1 -1
- package/dist/cdn/cropper/snice-cropper.min.js +1 -1
- package/dist/cdn/data-card/snice-data-card.js +1 -1
- package/dist/cdn/data-card/snice-data-card.min.js +1 -1
- package/dist/cdn/date-picker/README.md +1 -1
- package/dist/cdn/date-picker/snice-date-picker.js +2 -2
- package/dist/cdn/date-picker/snice-date-picker.js.map +1 -1
- package/dist/cdn/date-picker/snice-date-picker.min.js +2 -2
- package/dist/cdn/date-picker/snice-date-picker.min.js.map +1 -1
- package/dist/cdn/date-range-picker/README.md +1 -1
- package/dist/cdn/date-range-picker/snice-date-range-picker.js +2 -2
- package/dist/cdn/date-range-picker/snice-date-range-picker.js.map +1 -1
- package/dist/cdn/date-range-picker/snice-date-range-picker.min.js +11 -11
- package/dist/cdn/date-range-picker/snice-date-range-picker.min.js.map +1 -1
- package/dist/cdn/date-time-picker/README.md +1 -1
- package/dist/cdn/date-time-picker/snice-date-time-picker.js +2 -2
- package/dist/cdn/date-time-picker/snice-date-time-picker.js.map +1 -1
- package/dist/cdn/date-time-picker/snice-date-time-picker.min.js +2 -2
- package/dist/cdn/date-time-picker/snice-date-time-picker.min.js.map +1 -1
- package/dist/cdn/diff/snice-diff.js +1 -1
- package/dist/cdn/diff/snice-diff.min.js +1 -1
- package/dist/cdn/divider/snice-divider.js +1 -1
- package/dist/cdn/divider/snice-divider.min.js +1 -1
- package/dist/cdn/doc/snice-doc.js +1 -1
- package/dist/cdn/doc/snice-doc.min.js +1 -1
- package/dist/cdn/draw/README.md +2 -2
- package/dist/cdn/draw/snice-draw.js +26 -4
- package/dist/cdn/draw/snice-draw.js.map +1 -1
- package/dist/cdn/draw/snice-draw.min.js +3 -3
- package/dist/cdn/draw/snice-draw.min.js.map +1 -1
- package/dist/cdn/drawer/snice-drawer.js +1 -1
- package/dist/cdn/drawer/snice-drawer.min.js +1 -1
- package/dist/cdn/empty-state/snice-empty-state.js +1 -1
- package/dist/cdn/empty-state/snice-empty-state.min.js +1 -1
- package/dist/cdn/estimate/snice-estimate.js +1 -1
- package/dist/cdn/estimate/snice-estimate.min.js +1 -1
- package/dist/cdn/file-gallery/snice-file-gallery.js +1 -1
- package/dist/cdn/file-gallery/snice-file-gallery.min.js +1 -1
- package/dist/cdn/file-upload/snice-file-upload.js +1 -1
- package/dist/cdn/file-upload/snice-file-upload.min.js +1 -1
- package/dist/cdn/flip-card/snice-flip-card.js +1 -1
- package/dist/cdn/flip-card/snice-flip-card.min.js +1 -1
- package/dist/cdn/flow/snice-flow.js +1 -1
- package/dist/cdn/flow/snice-flow.min.js +1 -1
- package/dist/cdn/form-layout/snice-form-layout.js +1 -1
- package/dist/cdn/form-layout/snice-form-layout.min.js +1 -1
- package/dist/cdn/funnel/snice-funnel.js +1 -1
- package/dist/cdn/funnel/snice-funnel.min.js +1 -1
- package/dist/cdn/gantt/snice-gantt.js +1 -1
- package/dist/cdn/gantt/snice-gantt.min.js +1 -1
- package/dist/cdn/gauge/snice-gauge.js +1 -1
- package/dist/cdn/gauge/snice-gauge.min.js +1 -1
- package/dist/cdn/grid/README.md +27 -0
- package/dist/cdn/grid/snice-grid.js +862 -0
- package/dist/cdn/grid/snice-grid.js.map +1 -0
- package/dist/cdn/grid/snice-grid.min.js +13 -0
- package/dist/cdn/grid/snice-grid.min.js.map +1 -0
- package/dist/cdn/heatmap/snice-heatmap.js +1 -1
- package/dist/cdn/heatmap/snice-heatmap.min.js +1 -1
- package/dist/cdn/image/snice-image.js +1 -1
- package/dist/cdn/image/snice-image.min.js +1 -1
- package/dist/cdn/input/snice-input.js +1 -1
- package/dist/cdn/input/snice-input.min.js +1 -1
- package/dist/cdn/invoice/snice-invoice.js +1 -1
- package/dist/cdn/invoice/snice-invoice.min.js +1 -1
- package/dist/cdn/kanban/snice-kanban.js +1 -1
- package/dist/cdn/kanban/snice-kanban.min.js +1 -1
- package/dist/cdn/key-value/snice-key-value.js +1 -1
- package/dist/cdn/key-value/snice-key-value.min.js +1 -1
- package/dist/cdn/kpi/snice-kpi.js +1 -1
- package/dist/cdn/kpi/snice-kpi.min.js +1 -1
- package/dist/cdn/layout/snice-layout.js +1 -1
- package/dist/cdn/layout/snice-layout.min.js +1 -1
- package/dist/cdn/leaderboard/snice-leaderboard.js +1 -1
- package/dist/cdn/leaderboard/snice-leaderboard.min.js +1 -1
- package/dist/cdn/link/snice-link.js +1 -1
- package/dist/cdn/link/snice-link.min.js +1 -1
- package/dist/cdn/link-preview/snice-link-preview.js +1 -1
- package/dist/cdn/link-preview/snice-link-preview.min.js +1 -1
- package/dist/cdn/list/snice-list.js +1 -1
- package/dist/cdn/list/snice-list.min.js +1 -1
- package/dist/cdn/location/snice-location.js +1 -1
- package/dist/cdn/location/snice-location.min.js +1 -1
- package/dist/cdn/login/README.md +2 -2
- package/dist/cdn/login/snice-login.js +2 -2
- package/dist/cdn/login/snice-login.js.map +1 -1
- package/dist/cdn/login/snice-login.min.js +2 -2
- package/dist/cdn/login/snice-login.min.js.map +1 -1
- package/dist/cdn/map/snice-map.js +1 -1
- package/dist/cdn/map/snice-map.min.js +1 -1
- package/dist/cdn/markdown/snice-markdown.js +1 -1
- package/dist/cdn/markdown/snice-markdown.min.js +1 -1
- package/dist/cdn/masonry/snice-masonry.js +1 -1
- package/dist/cdn/masonry/snice-masonry.min.js +1 -1
- package/dist/cdn/menu/snice-menu.js +1 -1
- package/dist/cdn/menu/snice-menu.min.js +1 -1
- package/dist/cdn/message-strip/README.md +2 -2
- package/dist/cdn/message-strip/snice-message-strip.js +2 -2
- package/dist/cdn/message-strip/snice-message-strip.js.map +1 -1
- package/dist/cdn/message-strip/snice-message-strip.min.js +6 -6
- package/dist/cdn/message-strip/snice-message-strip.min.js.map +1 -1
- package/dist/cdn/metric-table/snice-metric-table.js +1 -1
- package/dist/cdn/metric-table/snice-metric-table.min.js +1 -1
- package/dist/cdn/modal/snice-modal.js +1 -1
- package/dist/cdn/modal/snice-modal.min.js +1 -1
- package/dist/cdn/music-player/snice-music-player.js +1 -1
- package/dist/cdn/music-player/snice-music-player.min.js +1 -1
- package/dist/cdn/nav/snice-nav.js +1 -1
- package/dist/cdn/nav/snice-nav.min.js +1 -1
- package/dist/cdn/network-graph/snice-network-graph.js +1 -1
- package/dist/cdn/network-graph/snice-network-graph.min.js +1 -1
- package/dist/cdn/notification-center/snice-notification-center.js +1 -1
- package/dist/cdn/notification-center/snice-notification-center.min.js +1 -1
- package/dist/cdn/order-tracker/snice-order-tracker.js +1 -1
- package/dist/cdn/order-tracker/snice-order-tracker.min.js +1 -1
- package/dist/cdn/org-chart/snice-org-chart.js +1 -1
- package/dist/cdn/org-chart/snice-org-chart.min.js +1 -1
- package/dist/cdn/pagination/snice-pagination.js +1 -1
- package/dist/cdn/pagination/snice-pagination.min.js +1 -1
- package/dist/cdn/paint/README.md +2 -2
- package/dist/cdn/paint/snice-paint.js +26 -3
- package/dist/cdn/paint/snice-paint.js.map +1 -1
- package/dist/cdn/paint/snice-paint.min.js +3 -3
- package/dist/cdn/paint/snice-paint.min.js.map +1 -1
- package/dist/cdn/pdf-viewer/snice-pdf-viewer.js +1 -1
- package/dist/cdn/pdf-viewer/snice-pdf-viewer.min.js +1 -1
- package/dist/cdn/permission-matrix/snice-permission-matrix.js +1 -1
- package/dist/cdn/permission-matrix/snice-permission-matrix.min.js +1 -1
- package/dist/cdn/podcast-player/snice-podcast-player.js +1 -1
- package/dist/cdn/podcast-player/snice-podcast-player.min.js +1 -1
- package/dist/cdn/pricing-table/snice-pricing-table.js +1 -1
- package/dist/cdn/pricing-table/snice-pricing-table.min.js +1 -1
- package/dist/cdn/product-card/README.md +1 -1
- package/dist/cdn/product-card/snice-product-card.js +1 -1
- package/dist/cdn/product-card/snice-product-card.min.js +1 -1
- package/dist/cdn/progress/snice-progress.js +1 -1
- package/dist/cdn/progress/snice-progress.min.js +1 -1
- package/dist/cdn/progress-ring/snice-progress-ring.js +1 -1
- package/dist/cdn/progress-ring/snice-progress-ring.min.js +1 -1
- package/dist/cdn/qr-code/snice-qr-code.js +1 -1
- package/dist/cdn/qr-code/snice-qr-code.min.js +1 -1
- package/dist/cdn/qr-reader/snice-qr-reader.js +1 -1
- package/dist/cdn/qr-reader/snice-qr-reader.min.js +1 -1
- package/dist/cdn/radio/snice-radio.js +1 -1
- package/dist/cdn/radio/snice-radio.min.js +1 -1
- package/dist/cdn/range-slider/snice-range-slider.js +1 -1
- package/dist/cdn/range-slider/snice-range-slider.min.js +1 -1
- package/dist/cdn/rating/snice-rating.js +1 -1
- package/dist/cdn/rating/snice-rating.min.js +1 -1
- package/dist/cdn/receipt/snice-receipt.js +1 -1
- package/dist/cdn/receipt/snice-receipt.min.js +1 -1
- package/dist/cdn/recipe/snice-recipe.js +1 -1
- package/dist/cdn/recipe/snice-recipe.min.js +1 -1
- package/dist/cdn/runtime/README.md +2 -2
- package/dist/cdn/runtime/snice-runtime.esm.js +109 -16
- package/dist/cdn/runtime/snice-runtime.esm.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.esm.min.js +8 -8
- package/dist/cdn/runtime/snice-runtime.esm.min.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.js +109 -15
- package/dist/cdn/runtime/snice-runtime.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.min.js +7 -7
- package/dist/cdn/runtime/snice-runtime.min.js.map +1 -1
- package/dist/cdn/sankey/snice-sankey.js +1 -1
- package/dist/cdn/sankey/snice-sankey.min.js +1 -1
- package/dist/cdn/segmented-control/snice-segmented-control.js +1 -1
- package/dist/cdn/segmented-control/snice-segmented-control.min.js +1 -1
- package/dist/cdn/select/snice-select.js +1 -1
- package/dist/cdn/select/snice-select.min.js +1 -1
- package/dist/cdn/skeleton/snice-skeleton.js +1 -1
- package/dist/cdn/skeleton/snice-skeleton.min.js +1 -1
- package/dist/cdn/slider/snice-slider.js +1 -1
- package/dist/cdn/slider/snice-slider.min.js +1 -1
- package/dist/cdn/sortable/snice-sortable.js +1 -1
- package/dist/cdn/sortable/snice-sortable.min.js +1 -1
- package/dist/cdn/sparkline/snice-sparkline.js +1 -1
- package/dist/cdn/sparkline/snice-sparkline.min.js +1 -1
- package/dist/cdn/spinner/snice-spinner.js +1 -1
- package/dist/cdn/spinner/snice-spinner.min.js +1 -1
- package/dist/cdn/split-button/snice-split-button.js +1 -1
- package/dist/cdn/split-button/snice-split-button.min.js +1 -1
- package/dist/cdn/split-pane/snice-split-pane.js +1 -1
- package/dist/cdn/split-pane/snice-split-pane.min.js +1 -1
- package/dist/cdn/spotlight/snice-spotlight.js +1 -1
- package/dist/cdn/spotlight/snice-spotlight.min.js +1 -1
- package/dist/cdn/spreadsheet/snice-spreadsheet.js +1 -1
- package/dist/cdn/spreadsheet/snice-spreadsheet.min.js +1 -1
- package/dist/cdn/stat-group/snice-stat-group.js +1 -1
- package/dist/cdn/stat-group/snice-stat-group.min.js +1 -1
- package/dist/cdn/step-input/snice-step-input.js +1 -1
- package/dist/cdn/step-input/snice-step-input.min.js +1 -1
- package/dist/cdn/stepper/snice-stepper.js +1 -1
- package/dist/cdn/stepper/snice-stepper.min.js +1 -1
- package/dist/cdn/switch/snice-switch.js +1 -1
- package/dist/cdn/switch/snice-switch.min.js +1 -1
- package/dist/cdn/table/README.md +1 -1
- package/dist/cdn/table/snice-table.js +2 -2
- package/dist/cdn/table/snice-table.js.map +1 -1
- package/dist/cdn/table/snice-table.min.js +2 -2
- package/dist/cdn/table/snice-table.min.js.map +1 -1
- package/dist/cdn/tabs/snice-tabs.js +1 -1
- package/dist/cdn/tabs/snice-tabs.min.js +1 -1
- package/dist/cdn/tag/README.md +1 -1
- package/dist/cdn/tag/snice-tag.js +2 -2
- package/dist/cdn/tag/snice-tag.js.map +1 -1
- package/dist/cdn/tag/snice-tag.min.js +3 -3
- package/dist/cdn/tag/snice-tag.min.js.map +1 -1
- package/dist/cdn/tag-input/README.md +2 -2
- package/dist/cdn/tag-input/snice-tag-input.js +2 -2
- package/dist/cdn/tag-input/snice-tag-input.js.map +1 -1
- package/dist/cdn/tag-input/snice-tag-input.min.js +2 -2
- package/dist/cdn/tag-input/snice-tag-input.min.js.map +1 -1
- package/dist/cdn/terminal/snice-terminal.js +1 -1
- package/dist/cdn/terminal/snice-terminal.min.js +1 -1
- package/dist/cdn/testimonial/snice-testimonial.js +1 -1
- package/dist/cdn/testimonial/snice-testimonial.min.js +1 -1
- package/dist/cdn/textarea/snice-textarea.js +1 -1
- package/dist/cdn/textarea/snice-textarea.min.js +1 -1
- package/dist/cdn/time-picker/README.md +1 -1
- package/dist/cdn/time-picker/snice-time-picker.js +2 -2
- package/dist/cdn/time-picker/snice-time-picker.js.map +1 -1
- package/dist/cdn/time-picker/snice-time-picker.min.js +2 -2
- package/dist/cdn/time-picker/snice-time-picker.min.js.map +1 -1
- package/dist/cdn/time-range-picker/snice-time-range-picker.js +1 -1
- package/dist/cdn/time-range-picker/snice-time-range-picker.min.js +1 -1
- package/dist/cdn/timeline/snice-timeline.js +1 -1
- package/dist/cdn/timeline/snice-timeline.min.js +1 -1
- package/dist/cdn/timer/snice-timer.js +1 -1
- package/dist/cdn/timer/snice-timer.min.js +1 -1
- package/dist/cdn/toast/README.md +1 -1
- package/dist/cdn/toast/snice-toast.js +7 -3
- package/dist/cdn/toast/snice-toast.js.map +1 -1
- package/dist/cdn/toast/snice-toast.min.js +6 -6
- package/dist/cdn/toast/snice-toast.min.js.map +1 -1
- package/dist/cdn/tooltip/snice-tooltip.js +1 -1
- package/dist/cdn/tooltip/snice-tooltip.min.js +1 -1
- package/dist/cdn/tree/snice-tree.js +1 -1
- package/dist/cdn/tree/snice-tree.min.js +1 -1
- package/dist/cdn/treemap/snice-treemap.js +1 -1
- package/dist/cdn/treemap/snice-treemap.min.js +1 -1
- package/dist/cdn/user-card/snice-user-card.js +1 -1
- package/dist/cdn/user-card/snice-user-card.min.js +1 -1
- package/dist/cdn/video-player/snice-video-player.js +1 -1
- package/dist/cdn/video-player/snice-video-player.min.js +1 -1
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.js +1 -1
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.min.js +1 -1
- package/dist/cdn/waterfall/README.md +1 -1
- package/dist/cdn/waterfall/snice-waterfall.js +1 -1
- package/dist/cdn/waterfall/snice-waterfall.min.js +1 -1
- package/dist/cdn/weather/snice-weather.js +1 -1
- package/dist/cdn/weather/snice-weather.min.js +1 -1
- package/dist/cdn/work-order/snice-work-order.js +1 -1
- package/dist/cdn/work-order/snice-work-order.min.js +1 -1
- package/dist/components/action-bar/snice-action-bar.d.ts +22 -0
- package/dist/components/action-bar/snice-action-bar.js +182 -0
- package/dist/components/action-bar/snice-action-bar.js.map +1 -0
- package/dist/components/action-bar/snice-action-bar.types.d.ts +17 -0
- package/dist/components/binpack/snice-binpack.d.ts +82 -0
- package/dist/components/binpack/snice-binpack.js +970 -0
- package/dist/components/binpack/snice-binpack.js.map +1 -0
- package/dist/components/binpack/snice-binpack.types.d.ts +52 -0
- package/dist/components/button/snice-button.js +1 -1
- package/dist/components/button/snice-button.js.map +1 -1
- package/dist/components/chip/snice-chip.js +1 -1
- package/dist/components/chip/snice-chip.js.map +1 -1
- package/dist/components/date-picker/snice-date-picker.js +1 -1
- package/dist/components/date-picker/snice-date-picker.js.map +1 -1
- package/dist/components/date-range-picker/snice-date-range-picker.js +1 -1
- package/dist/components/date-range-picker/snice-date-range-picker.js.map +1 -1
- package/dist/components/date-time-picker/snice-date-time-picker.js +1 -1
- package/dist/components/date-time-picker/snice-date-time-picker.js.map +1 -1
- package/dist/components/draw/snice-draw.d.ts +2 -0
- package/dist/components/draw/snice-draw.js +25 -3
- package/dist/components/draw/snice-draw.js.map +1 -1
- package/dist/components/grid/snice-grid.d.ts +73 -0
- package/dist/components/grid/snice-grid.js +795 -0
- package/dist/components/grid/snice-grid.js.map +1 -0
- package/dist/components/grid/snice-grid.types.d.ts +41 -0
- package/dist/components/message-strip/snice-message-strip.js +1 -1
- package/dist/components/message-strip/snice-message-strip.js.map +1 -1
- package/dist/components/paint/snice-paint.d.ts +2 -0
- package/dist/components/paint/snice-paint.js +25 -2
- package/dist/components/paint/snice-paint.js.map +1 -1
- package/dist/components/tag/snice-tag.js +1 -1
- package/dist/components/tag/snice-tag.js.map +1 -1
- package/dist/components/tag-input/snice-tag-input.js +1 -1
- package/dist/components/tag-input/snice-tag-input.js.map +1 -1
- package/dist/components/theme/theme.css +15 -0
- package/dist/components/time-picker/snice-time-picker.js +1 -1
- package/dist/components/time-picker/snice-time-picker.js.map +1 -1
- package/dist/components/toast/snice-toast-container.js +4 -0
- package/dist/components/toast/snice-toast-container.js.map +1 -1
- package/dist/components/toast/snice-toast.js +2 -2
- package/dist/create-request-handler.d.ts +42 -0
- package/dist/index.cjs +106 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +106 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +106 -12
- package/dist/index.iife.js.map +1 -1
- package/dist/react/SniceProvider.d.ts +71 -0
- package/dist/react/SniceProvider.js +49 -0
- package/dist/react/SniceProvider.js.map +1 -0
- package/dist/react/SniceRouter.d.ts +44 -0
- package/dist/react/SniceRouter.js +190 -0
- package/dist/react/SniceRouter.js.map +1 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.js +14 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/matchRoute.d.ts +16 -0
- package/dist/react/matchRoute.js +32 -0
- package/dist/react/matchRoute.js.map +1 -0
- package/dist/react/useRequestHandler.d.ts +56 -0
- package/dist/react/useRequestHandler.js +103 -0
- package/dist/react/useRequestHandler.js.map +1 -0
- 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/dist/types/guard.d.ts +4 -11
- package/docs/ai/DEVELOPMENT.md +1 -1
- package/docs/ai/README.md +7 -7
- package/docs/ai/components/accordion.md +46 -80
- package/docs/ai/components/action-bar.md +75 -0
- package/docs/ai/components/activity-feed.md +7 -7
- package/docs/ai/components/alert.md +26 -44
- package/docs/ai/components/app-tiles.md +34 -39
- package/docs/ai/components/approval-flow.md +1 -1
- package/docs/ai/components/audio-recorder.md +35 -67
- package/docs/ai/components/availability.md +13 -34
- package/docs/ai/components/avatar-group.md +26 -13
- package/docs/ai/components/avatar.md +52 -36
- package/docs/ai/components/badge.md +21 -32
- package/docs/ai/components/banner.md +21 -43
- package/docs/ai/components/binpack.md +89 -0
- package/docs/ai/components/book.md +25 -23
- package/docs/ai/components/booking.md +31 -36
- package/docs/ai/components/breadcrumbs.md +36 -11
- package/docs/ai/components/button.md +33 -44
- package/docs/ai/components/calendar.md +37 -70
- package/docs/ai/components/camera-annotate.md +31 -64
- package/docs/ai/components/camera.md +38 -120
- package/docs/ai/components/candlestick.md +32 -52
- package/docs/ai/components/card.md +20 -30
- package/docs/ai/components/carousel.md +32 -32
- package/docs/ai/components/cart.md +24 -29
- package/docs/ai/components/chart.md +29 -114
- package/docs/ai/components/chat.md +38 -75
- package/docs/ai/components/checkbox.md +22 -41
- package/docs/ai/components/chip.md +18 -54
- package/docs/ai/components/code-block.md +57 -178
- package/docs/ai/components/color-display.md +12 -32
- package/docs/ai/components/color-picker.md +17 -39
- package/docs/ai/components/command-palette.md +49 -71
- package/docs/ai/components/comments.md +55 -36
- package/docs/ai/components/countdown.md +28 -30
- package/docs/ai/components/cropper.md +33 -33
- package/docs/ai/components/data-card.md +20 -14
- package/docs/ai/components/date-picker.md +40 -47
- package/docs/ai/components/date-range-picker.md +31 -15
- package/docs/ai/components/date-time-picker.md +23 -46
- package/docs/ai/components/diff.md +30 -31
- package/docs/ai/components/divider.md +17 -47
- package/docs/ai/components/doc.md +43 -68
- package/docs/ai/components/draw.md +35 -87
- package/docs/ai/components/drawer.md +48 -77
- package/docs/ai/components/empty-state.md +10 -44
- package/docs/ai/components/estimate.md +33 -58
- package/docs/ai/components/file-gallery.md +48 -100
- package/docs/ai/components/file-upload.md +17 -53
- package/docs/ai/components/flip-card.md +31 -23
- package/docs/ai/components/flow.md +37 -65
- package/docs/ai/components/form-builder.md +35 -75
- package/docs/ai/components/form-layout.md +10 -20
- package/docs/ai/components/funnel.md +33 -48
- package/docs/ai/components/gantt.md +27 -23
- package/docs/ai/components/gauge.md +16 -17
- package/docs/ai/components/grid.md +116 -0
- package/docs/ai/components/heatmap.md +21 -21
- package/docs/ai/components/image.md +7 -13
- package/docs/ai/components/input.md +38 -70
- package/docs/ai/components/invoice.md +35 -36
- package/docs/ai/components/kanban.md +32 -61
- package/docs/ai/components/key-value.md +32 -16
- package/docs/ai/components/kpi.md +38 -73
- package/docs/ai/components/layout.md +29 -23
- package/docs/ai/components/leaderboard.md +28 -37
- package/docs/ai/components/link-preview.md +12 -18
- package/docs/ai/components/link.md +10 -7
- package/docs/ai/components/list.md +21 -5
- package/docs/ai/components/location.md +21 -25
- package/docs/ai/components/login.md +14 -9
- package/docs/ai/components/map.md +27 -33
- package/docs/ai/components/markdown.md +20 -24
- package/docs/ai/components/masonry.md +10 -14
- package/docs/ai/components/mentions.md +26 -12
- package/docs/ai/components/menu.md +54 -52
- package/docs/ai/components/message-strip.md +20 -20
- package/docs/ai/components/metric-table.md +14 -21
- package/docs/ai/components/modal.md +27 -18
- package/docs/ai/components/music-player.md +49 -41
- package/docs/ai/components/nav.md +34 -31
- package/docs/ai/components/network-graph.md +27 -42
- package/docs/ai/components/notification-center.md +31 -33
- package/docs/ai/components/order-tracker.md +36 -27
- package/docs/ai/components/org-chart.md +36 -31
- package/docs/ai/components/pagination.md +34 -26
- package/docs/ai/components/paint.md +53 -91
- package/docs/ai/components/pdf-viewer.md +35 -36
- package/docs/ai/components/permission-matrix.md +26 -31
- package/docs/ai/components/podcast-player.md +64 -70
- package/docs/ai/components/pricing-table.md +37 -48
- package/docs/ai/components/product-card.md +58 -41
- package/docs/ai/components/progress-ring.md +20 -24
- package/docs/ai/components/progress.md +28 -45
- package/docs/ai/components/qr-code.md +25 -27
- package/docs/ai/components/qr-reader.md +20 -23
- package/docs/ai/components/radio.md +17 -15
- package/docs/ai/components/range-slider.md +22 -11
- package/docs/ai/components/rating.md +29 -33
- package/docs/ai/components/receipt.md +50 -127
- package/docs/ai/components/recipe.md +44 -42
- package/docs/ai/components/sankey.md +21 -30
- package/docs/ai/components/scheduler.md +29 -41
- package/docs/ai/components/segmented-control.md +11 -15
- package/docs/ai/components/select.md +58 -102
- package/docs/ai/components/skeleton.md +16 -30
- package/docs/ai/components/slider.md +26 -20
- package/docs/ai/components/sortable.md +25 -27
- package/docs/ai/components/sparkline.md +21 -17
- package/docs/ai/components/spinner.md +9 -5
- package/docs/ai/components/split-button.md +10 -13
- package/docs/ai/components/split-pane.md +19 -14
- package/docs/ai/components/spotlight.md +31 -26
- package/docs/ai/components/spreadsheet.md +51 -97
- package/docs/ai/components/stat-group.md +9 -19
- package/docs/ai/components/step-input.md +17 -15
- package/docs/ai/components/stepper.md +14 -15
- package/docs/ai/components/switch.md +15 -9
- package/docs/ai/components/table.md +24 -84
- package/docs/ai/components/tabs.md +18 -10
- package/docs/ai/components/tag-input.md +18 -29
- package/docs/ai/components/tag.md +10 -22
- package/docs/ai/components/terminal.md +9 -9
- package/docs/ai/components/testimonial.md +9 -19
- package/docs/ai/components/textarea.md +15 -16
- package/docs/ai/components/theme.md +3 -3
- package/docs/ai/components/time-picker.md +30 -49
- package/docs/ai/components/time-range-picker.md +16 -15
- package/docs/ai/components/timeline.md +5 -4
- package/docs/ai/components/timer.md +8 -8
- package/docs/ai/components/toast.md +24 -18
- package/docs/ai/components/tooltip.md +11 -22
- package/docs/ai/components/tree.md +9 -9
- package/docs/ai/components/treemap.md +14 -13
- package/docs/ai/components/user-card.md +21 -27
- package/docs/ai/components/video-player.md +35 -52
- package/docs/ai/components/virtual-scroller.md +1 -1
- package/docs/ai/components/waterfall.md +17 -16
- package/docs/ai/components/weather.md +19 -34
- package/docs/ai/components/work-order.md +58 -134
- package/docs/ai/patterns.md +87 -0
- package/docs/ai/react-integration.md +97 -0
- package/docs/components/accordion.md +72 -151
- package/docs/components/action-bar.md +185 -0
- package/docs/components/activity-feed.md +9 -14
- package/docs/components/alert.md +17 -109
- package/docs/components/app-tiles.md +58 -43
- package/docs/components/approval-flow.md +8 -14
- package/docs/components/audio-recorder.md +45 -51
- package/docs/components/availability.md +30 -45
- package/docs/components/avatar-group.md +34 -14
- package/docs/components/avatar.md +20 -55
- package/docs/components/badge.md +53 -470
- package/docs/components/banner.md +44 -30
- package/docs/components/binpack.md +208 -0
- package/docs/components/book.md +78 -57
- package/docs/components/booking.md +35 -87
- package/docs/components/breadcrumbs.md +74 -448
- package/docs/components/button.md +72 -603
- package/docs/components/calendar.md +77 -261
- package/docs/components/camera-annotate.md +44 -96
- package/docs/components/camera.md +94 -333
- package/docs/components/candlestick.md +79 -116
- package/docs/components/card.md +51 -689
- package/docs/components/carousel.md +29 -76
- package/docs/components/cart.md +44 -136
- package/docs/components/chart.md +95 -438
- package/docs/components/chat.md +175 -439
- package/docs/components/checkbox.md +52 -609
- package/docs/components/chip.md +45 -574
- package/docs/components/code-block.md +157 -421
- package/docs/components/color-display.md +45 -54
- package/docs/components/color-picker.md +103 -36
- package/docs/components/command-palette.md +98 -92
- package/docs/components/comments.md +16 -10
- package/docs/components/countdown.md +15 -20
- package/docs/components/cropper.md +14 -16
- package/docs/components/data-card.md +16 -15
- package/docs/components/date-picker.md +45 -25
- package/docs/components/date-range-picker.md +140 -87
- package/docs/components/date-time-picker.md +25 -28
- package/docs/components/diff.md +22 -17
- package/docs/components/divider.md +18 -20
- package/docs/components/doc.md +105 -197
- package/docs/components/draw.md +117 -223
- package/docs/components/drawer.md +113 -478
- package/docs/components/empty-state.md +13 -29
- package/docs/components/estimate.md +58 -118
- package/docs/components/file-gallery.md +123 -495
- package/docs/components/file-upload.md +36 -123
- package/docs/components/flip-card.md +30 -34
- package/docs/components/flow.md +74 -89
- package/docs/components/form-builder.md +59 -86
- package/docs/components/form-layout.md +21 -31
- package/docs/components/funnel.md +21 -22
- package/docs/components/gantt.md +5 -5
- package/docs/components/gauge.md +5 -23
- package/docs/components/grid.md +249 -0
- package/docs/components/heatmap.md +13 -55
- package/docs/components/image.md +28 -32
- package/docs/components/input.md +25 -14
- package/docs/components/invoice.md +34 -33
- package/docs/components/kanban.md +99 -394
- package/docs/components/key-value.md +22 -12
- package/docs/components/kpi.md +41 -112
- package/docs/components/layout.md +7 -13
- package/docs/components/leaderboard.md +52 -76
- package/docs/components/link-preview.md +20 -16
- package/docs/components/link.md +22 -19
- package/docs/components/list.md +44 -26
- package/docs/components/location.md +9 -13
- package/docs/components/login.md +42 -36
- package/docs/components/map.md +24 -46
- package/docs/components/markdown.md +14 -25
- package/docs/components/masonry.md +15 -13
- package/docs/components/mentions.md +36 -25
- package/docs/components/menu.md +39 -46
- package/docs/components/message-strip.md +15 -51
- package/docs/components/metric-table.md +50 -72
- package/docs/components/modal.md +32 -43
- package/docs/components/music-player.md +41 -49
- package/docs/components/nav.md +23 -13
- package/docs/components/network-graph.md +14 -13
- package/docs/components/notification-center.md +68 -172
- package/docs/components/order-tracker.md +72 -117
- package/docs/components/org-chart.md +58 -207
- package/docs/components/pagination.md +67 -89
- package/docs/components/paint.md +86 -172
- package/docs/components/pdf-viewer.md +46 -151
- package/docs/components/permission-matrix.md +61 -112
- package/docs/components/podcast-player.md +41 -119
- package/docs/components/pricing-table.md +104 -147
- package/docs/components/product-card.md +94 -197
- package/docs/components/progress-ring.md +29 -32
- package/docs/components/progress.md +30 -61
- package/docs/components/qr-code.md +53 -61
- package/docs/components/qr-reader.md +53 -42
- package/docs/components/radio.md +42 -40
- package/docs/components/range-slider.md +41 -30
- package/docs/components/rating.md +50 -84
- package/docs/components/receipt.md +91 -129
- package/docs/components/recipe.md +107 -216
- package/docs/components/sankey.md +47 -83
- package/docs/components/scheduler.md +81 -184
- package/docs/components/segmented-control.md +48 -40
- package/docs/components/select.md +107 -129
- package/docs/components/skeleton.md +33 -47
- package/docs/components/slider.md +49 -53
- package/docs/components/sortable.md +43 -186
- package/docs/components/sparkline.md +26 -25
- package/docs/components/spinner.md +32 -37
- package/docs/components/split-button.md +43 -23
- package/docs/components/split-pane.md +41 -58
- package/docs/components/spotlight.md +53 -145
- package/docs/components/spreadsheet.md +84 -307
- package/docs/components/stat-group.md +27 -61
- package/docs/components/step-input.md +44 -41
- package/docs/components/stepper.md +55 -89
- package/docs/components/switch.md +39 -39
- package/docs/components/table.md +27 -32
- package/docs/components/tabs.md +36 -27
- package/docs/components/tag-input.md +50 -176
- package/docs/components/tag.md +12 -50
- package/docs/components/terminal.md +32 -37
- package/docs/components/testimonial.md +24 -81
- package/docs/components/textarea.md +9 -14
- package/docs/components/theme.md +10 -23
- package/docs/components/time-picker.md +48 -72
- package/docs/components/time-range-picker.md +22 -41
- package/docs/components/timeline.md +7 -14
- package/docs/components/timer.md +16 -32
- package/docs/components/toast.md +19 -45
- package/docs/components/tooltip.md +13 -115
- package/docs/components/tree.md +2 -19
- package/docs/components/treemap.md +19 -43
- package/docs/components/user-card.md +13 -22
- package/docs/components/video-player.md +53 -227
- package/docs/components/virtual-scroller.md +11 -44
- package/docs/components/waterfall.md +58 -137
- package/docs/components/weather.md +94 -153
- package/docs/components/work-order.md +56 -143
- package/docs/plans/2026-03-09-action-bar-design.md +104 -0
- package/docs/plans/2026-03-09-action-bar-plan.md +676 -0
- package/docs/plans/2026-03-10-grid-component-design.md +138 -0
- package/docs/plans/2026-03-10-grid-component-plan.md +716 -0
- package/docs/plans/2026-03-10-react-integration-design.md +166 -0
- package/docs/plans/2026-03-10-react-integration-plan.md +1178 -0
- package/docs/react-integration.md +508 -0
- package/docs/request-response.md +63 -0
- package/package.json +1 -1
- package/bin/templates/base/README.md +0 -33
- package/bin/templates/base/global.d.ts +0 -14
- package/bin/templates/base/index.html +0 -13
- package/bin/templates/base/package.json +0 -21
- package/bin/templates/base/src/components/counter-button.ts +0 -88
- package/bin/templates/base/src/components/counter-button.types.ts +0 -7
- package/bin/templates/base/src/components/feature-card.ts +0 -59
- package/bin/templates/base/src/components/feature-card.types.ts +0 -5
- package/bin/templates/base/src/controllers/counter-controller.ts +0 -24
- package/bin/templates/base/src/main.ts +0 -24
- package/bin/templates/base/src/pages/about-page.ts +0 -68
- package/bin/templates/base/src/pages/home-page.ts +0 -105
- package/bin/templates/base/src/pages/not-found-page.ts +0 -55
- package/bin/templates/base/src/router.ts +0 -9
- package/bin/templates/base/src/styles/global.css +0 -27
- package/bin/templates/base/src/types/api-response.ts +0 -5
- package/bin/templates/base/src/types/status.ts +0 -1
- package/bin/templates/base/src/types/theme.ts +0 -1
- package/bin/templates/base/src/types/user.ts +0 -5
- package/bin/templates/base/vite.config.ts +0 -38
- package/bin/templates/pwa/public/vite.svg +0 -1
- package/bin/templates/pwa/src/router.ts +0 -20
- package/bin/templates/pwa/src/styles/global.css +0 -64
- /package/bin/templates/{pwa → default}/README.md +0 -0
- /package/bin/templates/{pwa → default}/global.d.ts +0 -0
- /package/bin/templates/{pwa → default}/package.json +0 -0
- /package/bin/templates/{pwa → default}/public/icons/.gitkeep +0 -0
- /package/bin/templates/{base → default}/public/vite.svg +0 -0
- /package/bin/templates/{pwa → default}/src/fetcher.ts +0 -0
- /package/bin/templates/{pwa → default}/src/guards/auth.ts +0 -0
- /package/bin/templates/{pwa → default}/src/middleware/auth.ts +0 -0
- /package/bin/templates/{pwa → default}/src/middleware/retry.ts +0 -0
- /package/bin/templates/{pwa → default}/src/services/auth.ts +0 -0
- /package/bin/templates/{pwa → default}/src/services/jwt.ts +0 -0
- /package/bin/templates/{pwa → default}/src/services/storage.ts +0 -0
- /package/bin/templates/{pwa → default}/src/types/auth.ts +0 -0
- /package/bin/templates/{pwa → default}/src/types/notifications.ts +0 -0
- /package/bin/templates/{pwa → default}/tests/helpers/test-utils.ts +0 -0
- /package/bin/templates/{pwa → default}/tests/middleware/auth.test.ts +0 -0
- /package/bin/templates/{pwa → default}/tests/middleware/error.test.ts +0 -0
- /package/bin/templates/{pwa → default}/tests/middleware/retry.test.ts +0 -0
- /package/bin/templates/{pwa → default}/tests/services/auth.test.ts +0 -0
- /package/bin/templates/{pwa → default}/tests/services/jwt.test.ts +0 -0
- /package/bin/templates/{pwa → default}/tests/services/storage.test.ts +0 -0
- /package/bin/templates/{pwa → default}/vite.config.ts +0 -0
- /package/bin/templates/{pwa → default}/vitest.config.ts +0 -0
|
@@ -0,0 +1,795 @@
|
|
|
1
|
+
import { __runInitializers, __esDecorate } from 'tslib';
|
|
2
|
+
import { element, property, query, ready, dispose, watch, dispatch, render, styles, html, css } from 'snice';
|
|
3
|
+
|
|
4
|
+
var cssContent = ":host{display:block;position:relative;width:100%;font-family:var(--snice-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif);contain:layout style;--grid-gap:1rem;--grid-transition-duration:0.4s;overflow:hidden}.grid{position:relative;width:100%;min-height:1rem}::slotted(*){position:absolute;top:0;left:0;box-sizing:border-box}::slotted([hidden]){display:none!important}:host([ready]) ::slotted(*){transition:transform var(--grid-transition-duration) ease}::slotted(.grid-dragging){z-index:100;opacity:.9;transition:none!important;cursor:grabbing!important;user-select:none}::slotted(.grid-positioning){z-index:99}:host([draggable]) ::slotted(*){cursor:grab}.grid-drop-placeholder{position:absolute;top:0;left:0;outline:rgba(128,128,128,.5) dashed 3px;outline-offset:-6px;border-radius:4px;transition:transform .2s;pointer-events:none;display:none}.grid-drop-placeholder.visible{display:block}";
|
|
5
|
+
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// OccupancyGrid
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
class OccupancyGrid {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.cells = new Map();
|
|
12
|
+
}
|
|
13
|
+
key(col, row) {
|
|
14
|
+
return `${col},${row}`;
|
|
15
|
+
}
|
|
16
|
+
occupy(col, row, colspan, rowspan, item) {
|
|
17
|
+
for (let r = row; r < row + rowspan; r++) {
|
|
18
|
+
for (let c = col; c < col + colspan; c++) {
|
|
19
|
+
this.cells.set(this.key(c, r), item);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
vacate(col, row, colspan, rowspan) {
|
|
24
|
+
for (let r = row; r < row + rowspan; r++) {
|
|
25
|
+
for (let c = col; c < col + colspan; c++) {
|
|
26
|
+
this.cells.delete(this.key(c, r));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
getOccupant(col, row) {
|
|
31
|
+
return this.cells.get(this.key(col, row));
|
|
32
|
+
}
|
|
33
|
+
isOccupied(col, row, colspan, rowspan) {
|
|
34
|
+
for (let r = row; r < row + rowspan; r++) {
|
|
35
|
+
for (let c = col; c < col + colspan; c++) {
|
|
36
|
+
if (this.cells.has(this.key(c, r)))
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
/** Find all unique items occupying cells in the given range */
|
|
43
|
+
getOccupants(col, row, colspan, rowspan) {
|
|
44
|
+
const occupants = new Set();
|
|
45
|
+
for (let r = row; r < row + rowspan; r++) {
|
|
46
|
+
for (let c = col; c < col + colspan; c++) {
|
|
47
|
+
const occupant = this.cells.get(this.key(c, r));
|
|
48
|
+
if (occupant)
|
|
49
|
+
occupants.add(occupant);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return occupants;
|
|
53
|
+
}
|
|
54
|
+
findNextFree(startCol, startRow, colspan, rowspan, maxCols) {
|
|
55
|
+
// Scan right-then-down
|
|
56
|
+
for (let r = startRow; r < 10000; r++) {
|
|
57
|
+
const startC = r === startRow ? startCol : 0;
|
|
58
|
+
const endC = maxCols > 0 ? maxCols - colspan + 1 : 10000;
|
|
59
|
+
for (let c = startC; c < endC; c++) {
|
|
60
|
+
if (!this.isOccupied(c, r, colspan, rowspan)) {
|
|
61
|
+
return { col: c, row: r };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return { col: startCol, row: startRow };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
// Component
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
let SniceGrid = (() => {
|
|
72
|
+
let _classDecorators = [element('snice-grid')];
|
|
73
|
+
let _classDescriptor;
|
|
74
|
+
let _classExtraInitializers = [];
|
|
75
|
+
let _classThis;
|
|
76
|
+
let _classSuper = HTMLElement;
|
|
77
|
+
let _instanceExtraInitializers = [];
|
|
78
|
+
let _gap_decorators;
|
|
79
|
+
let _gap_initializers = [];
|
|
80
|
+
let _gap_extraInitializers = [];
|
|
81
|
+
let _columnWidth_decorators;
|
|
82
|
+
let _columnWidth_initializers = [];
|
|
83
|
+
let _columnWidth_extraInitializers = [];
|
|
84
|
+
let _rowHeight_decorators;
|
|
85
|
+
let _rowHeight_initializers = [];
|
|
86
|
+
let _rowHeight_extraInitializers = [];
|
|
87
|
+
let _columns_decorators;
|
|
88
|
+
let _columns_initializers = [];
|
|
89
|
+
let _columns_extraInitializers = [];
|
|
90
|
+
let _rows_decorators;
|
|
91
|
+
let _rows_initializers = [];
|
|
92
|
+
let _rows_extraInitializers = [];
|
|
93
|
+
let _originLeft_decorators;
|
|
94
|
+
let _originLeft_initializers = [];
|
|
95
|
+
let _originLeft_extraInitializers = [];
|
|
96
|
+
let _originTop_decorators;
|
|
97
|
+
let _originTop_initializers = [];
|
|
98
|
+
let _originTop_extraInitializers = [];
|
|
99
|
+
let _transitionDuration_decorators;
|
|
100
|
+
let _transitionDuration_initializers = [];
|
|
101
|
+
let _transitionDuration_extraInitializers = [];
|
|
102
|
+
let _stagger_decorators;
|
|
103
|
+
let _stagger_initializers = [];
|
|
104
|
+
let _stagger_extraInitializers = [];
|
|
105
|
+
let _resize_decorators;
|
|
106
|
+
let _resize_initializers = [];
|
|
107
|
+
let _resize_extraInitializers = [];
|
|
108
|
+
let _draggable_decorators;
|
|
109
|
+
let _draggable_initializers = [];
|
|
110
|
+
let _draggable_extraInitializers = [];
|
|
111
|
+
let _dragThrottle_decorators;
|
|
112
|
+
let _dragThrottle_initializers = [];
|
|
113
|
+
let _dragThrottle_extraInitializers = [];
|
|
114
|
+
let _container_decorators;
|
|
115
|
+
let _container_initializers = [];
|
|
116
|
+
let _container_extraInitializers = [];
|
|
117
|
+
let _slotElement_decorators;
|
|
118
|
+
let _slotElement_initializers = [];
|
|
119
|
+
let _slotElement_extraInitializers = [];
|
|
120
|
+
let _dropPlaceholder_decorators;
|
|
121
|
+
let _dropPlaceholder_initializers = [];
|
|
122
|
+
let _dropPlaceholder_extraInitializers = [];
|
|
123
|
+
let _onReady_decorators;
|
|
124
|
+
let _onDispose_decorators;
|
|
125
|
+
let _onGapChange_decorators;
|
|
126
|
+
let _onTransitionDurationChange_decorators;
|
|
127
|
+
let _onColumnWidthChange_decorators;
|
|
128
|
+
let _onRowHeightChange_decorators;
|
|
129
|
+
let _onColumnsChange_decorators;
|
|
130
|
+
let _onRowsChange_decorators;
|
|
131
|
+
let _onOriginLeftChange_decorators;
|
|
132
|
+
let _onOriginTopChange_decorators;
|
|
133
|
+
let _onResizeChange_decorators;
|
|
134
|
+
let _onDraggableChange_decorators;
|
|
135
|
+
let _emitLayoutComplete_decorators;
|
|
136
|
+
let _emitDragItemPositioned_decorators;
|
|
137
|
+
let _template_decorators;
|
|
138
|
+
let _componentStyles_decorators;
|
|
139
|
+
(class extends _classSuper {
|
|
140
|
+
static { _classThis = this; }
|
|
141
|
+
constructor() {
|
|
142
|
+
super(...arguments);
|
|
143
|
+
this.gap = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _gap_initializers, '1rem'));
|
|
144
|
+
this.columnWidth = (__runInitializers(this, _gap_extraInitializers), __runInitializers(this, _columnWidth_initializers, 80));
|
|
145
|
+
this.rowHeight = (__runInitializers(this, _columnWidth_extraInitializers), __runInitializers(this, _rowHeight_initializers, 80));
|
|
146
|
+
this.columns = (__runInitializers(this, _rowHeight_extraInitializers), __runInitializers(this, _columns_initializers, 0));
|
|
147
|
+
this.rows = (__runInitializers(this, _columns_extraInitializers), __runInitializers(this, _rows_initializers, 0));
|
|
148
|
+
this.originLeft = (__runInitializers(this, _rows_extraInitializers), __runInitializers(this, _originLeft_initializers, true));
|
|
149
|
+
this.originTop = (__runInitializers(this, _originLeft_extraInitializers), __runInitializers(this, _originTop_initializers, true));
|
|
150
|
+
this.transitionDuration = (__runInitializers(this, _originTop_extraInitializers), __runInitializers(this, _transitionDuration_initializers, '0.4s'));
|
|
151
|
+
this.stagger = (__runInitializers(this, _transitionDuration_extraInitializers), __runInitializers(this, _stagger_initializers, 0));
|
|
152
|
+
this.resize = (__runInitializers(this, _stagger_extraInitializers), __runInitializers(this, _resize_initializers, true));
|
|
153
|
+
this.draggable = (__runInitializers(this, _resize_extraInitializers), __runInitializers(this, _draggable_initializers, false));
|
|
154
|
+
this.dragThrottle = (__runInitializers(this, _draggable_extraInitializers), __runInitializers(this, _dragThrottle_initializers, 120));
|
|
155
|
+
this.container = (__runInitializers(this, _dragThrottle_extraInitializers), __runInitializers(this, _container_initializers, void 0));
|
|
156
|
+
this.slotElement = (__runInitializers(this, _container_extraInitializers), __runInitializers(this, _slotElement_initializers, void 0));
|
|
157
|
+
this.dropPlaceholder = (__runInitializers(this, _slotElement_extraInitializers), __runInitializers(this, _dropPlaceholder_initializers, void 0));
|
|
158
|
+
this.items = (__runInitializers(this, _dropPlaceholder_extraInitializers), []);
|
|
159
|
+
this.resizeObserver = null;
|
|
160
|
+
this.layoutScheduled = false;
|
|
161
|
+
this.resolvedPositions = new Map();
|
|
162
|
+
// Drag state
|
|
163
|
+
this.dragItem = null;
|
|
164
|
+
this.dragItemCol = 0;
|
|
165
|
+
this.dragItemRow = 0;
|
|
166
|
+
this.dragOffsetX = 0;
|
|
167
|
+
this.dragOffsetY = 0;
|
|
168
|
+
this.dragTime = 0;
|
|
169
|
+
this.dragTimeoutId = null;
|
|
170
|
+
this.boundPointerMove = null;
|
|
171
|
+
this.boundPointerUp = null;
|
|
172
|
+
this.pendingLayout = null;
|
|
173
|
+
this.lastObservedWidth = 0;
|
|
174
|
+
this.lastObservedHeight = 0;
|
|
175
|
+
this.onPointerDown = (e) => {
|
|
176
|
+
if (!this.draggable)
|
|
177
|
+
return;
|
|
178
|
+
if (e.button !== 0)
|
|
179
|
+
return;
|
|
180
|
+
const target = e.target;
|
|
181
|
+
const item = this.items.find(el => el === target || el.contains(target));
|
|
182
|
+
if (!item)
|
|
183
|
+
return;
|
|
184
|
+
e.preventDefault();
|
|
185
|
+
this.dragItemStart(item, e);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
static {
|
|
189
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
190
|
+
_gap_decorators = [property()];
|
|
191
|
+
_columnWidth_decorators = [property({ type: Number, attribute: 'column-width' })];
|
|
192
|
+
_rowHeight_decorators = [property({ type: Number, attribute: 'row-height' })];
|
|
193
|
+
_columns_decorators = [property({ type: Number })];
|
|
194
|
+
_rows_decorators = [property({ type: Number })];
|
|
195
|
+
_originLeft_decorators = [property({ type: Boolean, attribute: 'origin-left' })];
|
|
196
|
+
_originTop_decorators = [property({ type: Boolean, attribute: 'origin-top' })];
|
|
197
|
+
_transitionDuration_decorators = [property({ attribute: 'transition-duration' })];
|
|
198
|
+
_stagger_decorators = [property({ type: Number })];
|
|
199
|
+
_resize_decorators = [property({ type: Boolean })];
|
|
200
|
+
_draggable_decorators = [property({ type: Boolean })];
|
|
201
|
+
_dragThrottle_decorators = [property({ type: Number, attribute: 'drag-throttle' })];
|
|
202
|
+
_container_decorators = [query('.grid')];
|
|
203
|
+
_slotElement_decorators = [query('slot')];
|
|
204
|
+
_dropPlaceholder_decorators = [query('.grid-drop-placeholder')];
|
|
205
|
+
_onReady_decorators = [ready()];
|
|
206
|
+
_onDispose_decorators = [dispose()];
|
|
207
|
+
_onGapChange_decorators = [watch('gap')];
|
|
208
|
+
_onTransitionDurationChange_decorators = [watch('transitionDuration')];
|
|
209
|
+
_onColumnWidthChange_decorators = [watch('columnWidth')];
|
|
210
|
+
_onRowHeightChange_decorators = [watch('rowHeight')];
|
|
211
|
+
_onColumnsChange_decorators = [watch('columns')];
|
|
212
|
+
_onRowsChange_decorators = [watch('rows')];
|
|
213
|
+
_onOriginLeftChange_decorators = [watch('originLeft')];
|
|
214
|
+
_onOriginTopChange_decorators = [watch('originTop')];
|
|
215
|
+
_onResizeChange_decorators = [watch('resize')];
|
|
216
|
+
_onDraggableChange_decorators = [watch('draggable')];
|
|
217
|
+
_emitLayoutComplete_decorators = [dispatch('grid-layout-complete', { bubbles: true, composed: true })];
|
|
218
|
+
_emitDragItemPositioned_decorators = [dispatch('grid-drag-item-positioned', { bubbles: true, composed: true })];
|
|
219
|
+
_template_decorators = [render()];
|
|
220
|
+
_componentStyles_decorators = [styles()];
|
|
221
|
+
__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);
|
|
222
|
+
__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);
|
|
223
|
+
__esDecorate(this, null, _onGapChange_decorators, { kind: "method", name: "onGapChange", static: false, private: false, access: { has: obj => "onGapChange" in obj, get: obj => obj.onGapChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
224
|
+
__esDecorate(this, null, _onTransitionDurationChange_decorators, { kind: "method", name: "onTransitionDurationChange", static: false, private: false, access: { has: obj => "onTransitionDurationChange" in obj, get: obj => obj.onTransitionDurationChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
225
|
+
__esDecorate(this, null, _onColumnWidthChange_decorators, { kind: "method", name: "onColumnWidthChange", static: false, private: false, access: { has: obj => "onColumnWidthChange" in obj, get: obj => obj.onColumnWidthChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
226
|
+
__esDecorate(this, null, _onRowHeightChange_decorators, { kind: "method", name: "onRowHeightChange", static: false, private: false, access: { has: obj => "onRowHeightChange" in obj, get: obj => obj.onRowHeightChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
227
|
+
__esDecorate(this, null, _onColumnsChange_decorators, { kind: "method", name: "onColumnsChange", static: false, private: false, access: { has: obj => "onColumnsChange" in obj, get: obj => obj.onColumnsChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
228
|
+
__esDecorate(this, null, _onRowsChange_decorators, { kind: "method", name: "onRowsChange", static: false, private: false, access: { has: obj => "onRowsChange" in obj, get: obj => obj.onRowsChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
229
|
+
__esDecorate(this, null, _onOriginLeftChange_decorators, { kind: "method", name: "onOriginLeftChange", static: false, private: false, access: { has: obj => "onOriginLeftChange" in obj, get: obj => obj.onOriginLeftChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
230
|
+
__esDecorate(this, null, _onOriginTopChange_decorators, { kind: "method", name: "onOriginTopChange", static: false, private: false, access: { has: obj => "onOriginTopChange" in obj, get: obj => obj.onOriginTopChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
231
|
+
__esDecorate(this, null, _onResizeChange_decorators, { kind: "method", name: "onResizeChange", static: false, private: false, access: { has: obj => "onResizeChange" in obj, get: obj => obj.onResizeChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
232
|
+
__esDecorate(this, null, _onDraggableChange_decorators, { kind: "method", name: "onDraggableChange", static: false, private: false, access: { has: obj => "onDraggableChange" in obj, get: obj => obj.onDraggableChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
233
|
+
__esDecorate(this, null, _emitLayoutComplete_decorators, { kind: "method", name: "emitLayoutComplete", static: false, private: false, access: { has: obj => "emitLayoutComplete" in obj, get: obj => obj.emitLayoutComplete }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
234
|
+
__esDecorate(this, null, _emitDragItemPositioned_decorators, { kind: "method", name: "emitDragItemPositioned", static: false, private: false, access: { has: obj => "emitDragItemPositioned" in obj, get: obj => obj.emitDragItemPositioned }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
235
|
+
__esDecorate(this, null, _template_decorators, { kind: "method", name: "template", static: false, private: false, access: { has: obj => "template" in obj, get: obj => obj.template }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
236
|
+
__esDecorate(this, null, _componentStyles_decorators, { kind: "method", name: "componentStyles", static: false, private: false, access: { has: obj => "componentStyles" in obj, get: obj => obj.componentStyles }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
237
|
+
__esDecorate(null, null, _gap_decorators, { kind: "field", name: "gap", static: false, private: false, access: { has: obj => "gap" in obj, get: obj => obj.gap, set: (obj, value) => { obj.gap = value; } }, metadata: _metadata }, _gap_initializers, _gap_extraInitializers);
|
|
238
|
+
__esDecorate(null, null, _columnWidth_decorators, { kind: "field", name: "columnWidth", static: false, private: false, access: { has: obj => "columnWidth" in obj, get: obj => obj.columnWidth, set: (obj, value) => { obj.columnWidth = value; } }, metadata: _metadata }, _columnWidth_initializers, _columnWidth_extraInitializers);
|
|
239
|
+
__esDecorate(null, null, _rowHeight_decorators, { kind: "field", name: "rowHeight", static: false, private: false, access: { has: obj => "rowHeight" in obj, get: obj => obj.rowHeight, set: (obj, value) => { obj.rowHeight = value; } }, metadata: _metadata }, _rowHeight_initializers, _rowHeight_extraInitializers);
|
|
240
|
+
__esDecorate(null, null, _columns_decorators, { kind: "field", name: "columns", static: false, private: false, access: { has: obj => "columns" in obj, get: obj => obj.columns, set: (obj, value) => { obj.columns = value; } }, metadata: _metadata }, _columns_initializers, _columns_extraInitializers);
|
|
241
|
+
__esDecorate(null, null, _rows_decorators, { kind: "field", name: "rows", static: false, private: false, access: { has: obj => "rows" in obj, get: obj => obj.rows, set: (obj, value) => { obj.rows = value; } }, metadata: _metadata }, _rows_initializers, _rows_extraInitializers);
|
|
242
|
+
__esDecorate(null, null, _originLeft_decorators, { kind: "field", name: "originLeft", static: false, private: false, access: { has: obj => "originLeft" in obj, get: obj => obj.originLeft, set: (obj, value) => { obj.originLeft = value; } }, metadata: _metadata }, _originLeft_initializers, _originLeft_extraInitializers);
|
|
243
|
+
__esDecorate(null, null, _originTop_decorators, { kind: "field", name: "originTop", static: false, private: false, access: { has: obj => "originTop" in obj, get: obj => obj.originTop, set: (obj, value) => { obj.originTop = value; } }, metadata: _metadata }, _originTop_initializers, _originTop_extraInitializers);
|
|
244
|
+
__esDecorate(null, null, _transitionDuration_decorators, { kind: "field", name: "transitionDuration", static: false, private: false, access: { has: obj => "transitionDuration" in obj, get: obj => obj.transitionDuration, set: (obj, value) => { obj.transitionDuration = value; } }, metadata: _metadata }, _transitionDuration_initializers, _transitionDuration_extraInitializers);
|
|
245
|
+
__esDecorate(null, null, _stagger_decorators, { kind: "field", name: "stagger", static: false, private: false, access: { has: obj => "stagger" in obj, get: obj => obj.stagger, set: (obj, value) => { obj.stagger = value; } }, metadata: _metadata }, _stagger_initializers, _stagger_extraInitializers);
|
|
246
|
+
__esDecorate(null, null, _resize_decorators, { kind: "field", name: "resize", static: false, private: false, access: { has: obj => "resize" in obj, get: obj => obj.resize, set: (obj, value) => { obj.resize = value; } }, metadata: _metadata }, _resize_initializers, _resize_extraInitializers);
|
|
247
|
+
__esDecorate(null, null, _draggable_decorators, { kind: "field", name: "draggable", static: false, private: false, access: { has: obj => "draggable" in obj, get: obj => obj.draggable, set: (obj, value) => { obj.draggable = value; } }, metadata: _metadata }, _draggable_initializers, _draggable_extraInitializers);
|
|
248
|
+
__esDecorate(null, null, _dragThrottle_decorators, { kind: "field", name: "dragThrottle", static: false, private: false, access: { has: obj => "dragThrottle" in obj, get: obj => obj.dragThrottle, set: (obj, value) => { obj.dragThrottle = value; } }, metadata: _metadata }, _dragThrottle_initializers, _dragThrottle_extraInitializers);
|
|
249
|
+
__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);
|
|
250
|
+
__esDecorate(null, null, _slotElement_decorators, { kind: "field", name: "slotElement", static: false, private: false, access: { has: obj => "slotElement" in obj, get: obj => obj.slotElement, set: (obj, value) => { obj.slotElement = value; } }, metadata: _metadata }, _slotElement_initializers, _slotElement_extraInitializers);
|
|
251
|
+
__esDecorate(null, null, _dropPlaceholder_decorators, { kind: "field", name: "dropPlaceholder", static: false, private: false, access: { has: obj => "dropPlaceholder" in obj, get: obj => obj.dropPlaceholder, set: (obj, value) => { obj.dropPlaceholder = value; } }, metadata: _metadata }, _dropPlaceholder_initializers, _dropPlaceholder_extraInitializers);
|
|
252
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
253
|
+
_classThis = _classDescriptor.value;
|
|
254
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
255
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
256
|
+
}
|
|
257
|
+
onReady() {
|
|
258
|
+
this.collectItems();
|
|
259
|
+
this.setupResizeObserver();
|
|
260
|
+
if (this.draggable) {
|
|
261
|
+
this.setAttribute('draggable', '');
|
|
262
|
+
this.setupDragListeners();
|
|
263
|
+
}
|
|
264
|
+
this.performLayout();
|
|
265
|
+
setTimeout(() => this.setAttribute('ready', ''), 10);
|
|
266
|
+
}
|
|
267
|
+
onDispose() {
|
|
268
|
+
this.resizeObserver?.disconnect();
|
|
269
|
+
this.resizeObserver = null;
|
|
270
|
+
this.teardownDragListeners();
|
|
271
|
+
}
|
|
272
|
+
// -- Property watchers ----------------------------------------------------
|
|
273
|
+
onGapChange() {
|
|
274
|
+
this.style.setProperty('--grid-gap', this.gap);
|
|
275
|
+
this.scheduleLayout();
|
|
276
|
+
}
|
|
277
|
+
onTransitionDurationChange() {
|
|
278
|
+
this.style.setProperty('--grid-transition-duration', this.transitionDuration);
|
|
279
|
+
}
|
|
280
|
+
onColumnWidthChange() {
|
|
281
|
+
this.scheduleLayout();
|
|
282
|
+
}
|
|
283
|
+
onRowHeightChange() {
|
|
284
|
+
this.scheduleLayout();
|
|
285
|
+
}
|
|
286
|
+
onColumnsChange() {
|
|
287
|
+
this.scheduleLayout();
|
|
288
|
+
}
|
|
289
|
+
onRowsChange() {
|
|
290
|
+
this.scheduleLayout();
|
|
291
|
+
}
|
|
292
|
+
onOriginLeftChange() {
|
|
293
|
+
this.scheduleLayout();
|
|
294
|
+
}
|
|
295
|
+
onOriginTopChange() {
|
|
296
|
+
this.scheduleLayout();
|
|
297
|
+
}
|
|
298
|
+
onResizeChange() {
|
|
299
|
+
if (this.resize) {
|
|
300
|
+
this.setupResizeObserver();
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
this.resizeObserver?.disconnect();
|
|
304
|
+
this.resizeObserver = null;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
onDraggableChange() {
|
|
308
|
+
if (this.draggable) {
|
|
309
|
+
this.setAttribute('draggable', '');
|
|
310
|
+
this.setupDragListeners();
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
this.removeAttribute('draggable');
|
|
314
|
+
this.teardownDragListeners();
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
// -- Events ---------------------------------------------------------------
|
|
318
|
+
emitLayoutComplete() {
|
|
319
|
+
return { items: [...this.items] };
|
|
320
|
+
}
|
|
321
|
+
emitDragItemPositioned(item, col, row) {
|
|
322
|
+
return { item, col, row };
|
|
323
|
+
}
|
|
324
|
+
// -- Public API -----------------------------------------------------------
|
|
325
|
+
layout() {
|
|
326
|
+
this.performLayout();
|
|
327
|
+
}
|
|
328
|
+
fit(element, col, row) {
|
|
329
|
+
if (!this.items.includes(element))
|
|
330
|
+
return;
|
|
331
|
+
if (col !== undefined && row !== undefined) {
|
|
332
|
+
element.setAttribute('grid-col', String(col));
|
|
333
|
+
element.setAttribute('grid-row', String(row));
|
|
334
|
+
}
|
|
335
|
+
this.performLayout();
|
|
336
|
+
}
|
|
337
|
+
reloadItems() {
|
|
338
|
+
this.collectItems();
|
|
339
|
+
this.scheduleLayout();
|
|
340
|
+
}
|
|
341
|
+
getItemElements() {
|
|
342
|
+
return [...this.items];
|
|
343
|
+
}
|
|
344
|
+
getLayout() {
|
|
345
|
+
const layout = {};
|
|
346
|
+
let order = 0;
|
|
347
|
+
for (const item of this.items) {
|
|
348
|
+
const name = item.getAttribute('name');
|
|
349
|
+
if (!name)
|
|
350
|
+
continue;
|
|
351
|
+
const resolved = this.resolvedPositions.get(item);
|
|
352
|
+
const entry = {
|
|
353
|
+
col: resolved ? resolved.col : parseInt(item.getAttribute('grid-col') || '0', 10),
|
|
354
|
+
row: resolved ? resolved.row : parseInt(item.getAttribute('grid-row') || '0', 10),
|
|
355
|
+
colspan: resolved ? resolved.colspan : parseInt(item.getAttribute('grid-colspan') || '1', 10),
|
|
356
|
+
rowspan: resolved ? resolved.rowspan : parseInt(item.getAttribute('grid-rowspan') || '1', 10),
|
|
357
|
+
order: order++,
|
|
358
|
+
};
|
|
359
|
+
if (item.hasAttribute('hidden')) {
|
|
360
|
+
entry.hidden = true;
|
|
361
|
+
}
|
|
362
|
+
layout[name] = entry;
|
|
363
|
+
}
|
|
364
|
+
return layout;
|
|
365
|
+
}
|
|
366
|
+
setLayout(layout) {
|
|
367
|
+
this.pendingLayout = layout;
|
|
368
|
+
this.applyPendingLayout();
|
|
369
|
+
this.performLayout();
|
|
370
|
+
}
|
|
371
|
+
applyPendingLayout() {
|
|
372
|
+
if (!this.pendingLayout)
|
|
373
|
+
return;
|
|
374
|
+
const layout = this.pendingLayout;
|
|
375
|
+
const entries = Object.entries(layout).sort((a, b) => a[1].order - b[1].order);
|
|
376
|
+
const namedItems = new Map();
|
|
377
|
+
const unnamed = [];
|
|
378
|
+
for (const item of this.items) {
|
|
379
|
+
const name = item.getAttribute('name');
|
|
380
|
+
if (name) {
|
|
381
|
+
namedItems.set(name, item);
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
unnamed.push(item);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
const reordered = [];
|
|
388
|
+
for (const [name, entry] of entries) {
|
|
389
|
+
const item = namedItems.get(name);
|
|
390
|
+
if (!item)
|
|
391
|
+
continue;
|
|
392
|
+
namedItems.delete(name);
|
|
393
|
+
// Apply grid attributes from layout
|
|
394
|
+
item.setAttribute('grid-col', String(entry.col));
|
|
395
|
+
item.setAttribute('grid-row', String(entry.row));
|
|
396
|
+
if (entry.colspan != null)
|
|
397
|
+
item.setAttribute('grid-colspan', String(entry.colspan));
|
|
398
|
+
if (entry.rowspan != null)
|
|
399
|
+
item.setAttribute('grid-rowspan', String(entry.rowspan));
|
|
400
|
+
if (entry.hidden) {
|
|
401
|
+
item.setAttribute('hidden', '');
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
item.removeAttribute('hidden');
|
|
405
|
+
}
|
|
406
|
+
reordered.push(item);
|
|
407
|
+
}
|
|
408
|
+
for (const item of namedItems.values()) {
|
|
409
|
+
item.removeAttribute('hidden');
|
|
410
|
+
reordered.push(item);
|
|
411
|
+
}
|
|
412
|
+
reordered.push(...unnamed);
|
|
413
|
+
for (const item of reordered) {
|
|
414
|
+
this.appendChild(item);
|
|
415
|
+
}
|
|
416
|
+
this.items = reordered;
|
|
417
|
+
}
|
|
418
|
+
// -- Template & Styles ----------------------------------------------------
|
|
419
|
+
template() {
|
|
420
|
+
return html `
|
|
421
|
+
<div class="grid" part="base" role="list">
|
|
422
|
+
<slot @slotchange="${() => this.handleSlotChange()}"></slot>
|
|
423
|
+
<div class="grid-drop-placeholder"></div>
|
|
424
|
+
</div>
|
|
425
|
+
`;
|
|
426
|
+
}
|
|
427
|
+
componentStyles() {
|
|
428
|
+
return css /*css*/ `${cssContent}`;
|
|
429
|
+
}
|
|
430
|
+
// -- Private helpers ------------------------------------------------------
|
|
431
|
+
handleSlotChange() {
|
|
432
|
+
this.collectItems();
|
|
433
|
+
if (this.pendingLayout) {
|
|
434
|
+
this.applyPendingLayout();
|
|
435
|
+
}
|
|
436
|
+
this.scheduleLayout();
|
|
437
|
+
}
|
|
438
|
+
collectItems() {
|
|
439
|
+
if (!this.slotElement)
|
|
440
|
+
return;
|
|
441
|
+
this.items = this.slotElement.assignedElements({ flatten: true })
|
|
442
|
+
.filter(el => el instanceof HTMLElement);
|
|
443
|
+
}
|
|
444
|
+
setupResizeObserver() {
|
|
445
|
+
if (!this.resize)
|
|
446
|
+
return;
|
|
447
|
+
if (this.resizeObserver)
|
|
448
|
+
return;
|
|
449
|
+
this.resizeObserver = new ResizeObserver((entries) => {
|
|
450
|
+
const entry = entries[0];
|
|
451
|
+
if (!entry)
|
|
452
|
+
return;
|
|
453
|
+
const { width, height } = entry.contentRect;
|
|
454
|
+
// Only relayout if the host element size actually changed (not from our own container sizing)
|
|
455
|
+
if (Math.abs(width - this.lastObservedWidth) > 0.5 || Math.abs(height - this.lastObservedHeight) > 0.5) {
|
|
456
|
+
this.lastObservedWidth = width;
|
|
457
|
+
this.lastObservedHeight = height;
|
|
458
|
+
this.scheduleLayout();
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
this.resizeObserver.observe(this);
|
|
462
|
+
}
|
|
463
|
+
scheduleLayout() {
|
|
464
|
+
if (this.layoutScheduled)
|
|
465
|
+
return;
|
|
466
|
+
this.layoutScheduled = true;
|
|
467
|
+
requestAnimationFrame(() => {
|
|
468
|
+
this.layoutScheduled = false;
|
|
469
|
+
// Don't run scheduled layouts during active drag — it would fight with free drag positioning
|
|
470
|
+
if (this.dragItem)
|
|
471
|
+
return;
|
|
472
|
+
this.performLayout();
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
getGapPixels() {
|
|
476
|
+
const gap = this.gap;
|
|
477
|
+
if (gap.endsWith('px')) {
|
|
478
|
+
const val = parseFloat(gap);
|
|
479
|
+
if (!isNaN(val))
|
|
480
|
+
return val;
|
|
481
|
+
}
|
|
482
|
+
if (gap.endsWith('rem')) {
|
|
483
|
+
const val = parseFloat(gap);
|
|
484
|
+
if (!isNaN(val)) {
|
|
485
|
+
const fontSize = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
486
|
+
return val * fontSize;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
const temp = document.createElement('div');
|
|
490
|
+
temp.style.position = 'absolute';
|
|
491
|
+
temp.style.visibility = 'hidden';
|
|
492
|
+
temp.style.width = gap;
|
|
493
|
+
document.body.appendChild(temp);
|
|
494
|
+
const px = temp.getBoundingClientRect().width;
|
|
495
|
+
temp.remove();
|
|
496
|
+
return px;
|
|
497
|
+
}
|
|
498
|
+
performLayout() {
|
|
499
|
+
const gapPx = this.getGapPixels();
|
|
500
|
+
const maxCols = this.columns;
|
|
501
|
+
const occupancy = new OccupancyGrid();
|
|
502
|
+
const placements = [];
|
|
503
|
+
for (const item of this.items) {
|
|
504
|
+
if (item.hasAttribute('hidden'))
|
|
505
|
+
continue;
|
|
506
|
+
placements.push({
|
|
507
|
+
item,
|
|
508
|
+
col: parseInt(item.getAttribute('grid-col') || '0', 10),
|
|
509
|
+
row: parseInt(item.getAttribute('grid-row') || '0', 10),
|
|
510
|
+
colspan: parseInt(item.getAttribute('grid-colspan') || '1', 10),
|
|
511
|
+
rowspan: parseInt(item.getAttribute('grid-rowspan') || '1', 10),
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
// Phase 1b: Sort placements — unmoved items first, moved items last.
|
|
515
|
+
// This ensures static items are in the occupancy grid before moved items
|
|
516
|
+
// are processed, so the moved item triggers proper swap logic.
|
|
517
|
+
const sorted = [...placements].sort((a, b) => {
|
|
518
|
+
const aPrev = this.resolvedPositions.get(a.item);
|
|
519
|
+
const bPrev = this.resolvedPositions.get(b.item);
|
|
520
|
+
const aMoved = aPrev ? (aPrev.col !== a.col || aPrev.row !== a.row ? 1 : 0) : 0;
|
|
521
|
+
const bMoved = bPrev ? (bPrev.col !== b.col || bPrev.row !== b.row ? 1 : 0) : 0;
|
|
522
|
+
return aMoved - bMoved;
|
|
523
|
+
});
|
|
524
|
+
// Phase 2: Place items with swap-first collision resolution
|
|
525
|
+
// Unmoved items placed first, moved items last (so they collide with and swap static items).
|
|
526
|
+
const resolvedMap = new Map();
|
|
527
|
+
for (const p of sorted) {
|
|
528
|
+
let { col, row } = p;
|
|
529
|
+
const { colspan, rowspan, item } = p;
|
|
530
|
+
// Clamp to column constraint
|
|
531
|
+
if (maxCols > 0 && col + colspan > maxCols) {
|
|
532
|
+
col = Math.max(0, maxCols - colspan);
|
|
533
|
+
}
|
|
534
|
+
if (occupancy.isOccupied(col, row, colspan, rowspan)) {
|
|
535
|
+
// Try swap: displace all occupants in target area, place incoming item,
|
|
536
|
+
// then re-place displaced items at incoming item's previous position (best effort)
|
|
537
|
+
const occupants = occupancy.getOccupants(col, row, colspan, rowspan);
|
|
538
|
+
const prevPos = this.resolvedPositions.get(item);
|
|
539
|
+
const swapCol = prevPos ? prevPos.col : p.col;
|
|
540
|
+
const swapRow = prevPos ? prevPos.row : p.row;
|
|
541
|
+
const samePosition = swapCol === col && swapRow === row;
|
|
542
|
+
let swapped = false;
|
|
543
|
+
if (occupants.size > 0 && !samePosition) {
|
|
544
|
+
// Collect occupant info and vacate all their cells
|
|
545
|
+
const displaced = [];
|
|
546
|
+
for (const occ of occupants) {
|
|
547
|
+
const occPos = resolvedMap.get(occ);
|
|
548
|
+
if (occPos) {
|
|
549
|
+
displaced.push({ el: occ, pos: { ...occPos } });
|
|
550
|
+
occupancy.vacate(occPos.col, occPos.row, occPos.colspan, occPos.rowspan);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
// Can we place the incoming item at the target now?
|
|
554
|
+
if (!occupancy.isOccupied(col, row, colspan, rowspan)) {
|
|
555
|
+
// Place incoming item
|
|
556
|
+
occupancy.occupy(col, row, colspan, rowspan, item);
|
|
557
|
+
resolvedMap.set(item, { col, row, colspan, rowspan });
|
|
558
|
+
// Re-place displaced items: best effort at swap position, fallback push-right-then-down
|
|
559
|
+
for (const d of displaced) {
|
|
560
|
+
const { colspan: dc, rowspan: dr } = d.pos;
|
|
561
|
+
// Try the swap position (incoming item's previous location)
|
|
562
|
+
if (!occupancy.isOccupied(swapCol, swapRow, dc, dr)) {
|
|
563
|
+
occupancy.occupy(swapCol, swapRow, dc, dr, d.el);
|
|
564
|
+
resolvedMap.set(d.el, { ...d.pos, col: swapCol, row: swapRow });
|
|
565
|
+
}
|
|
566
|
+
else {
|
|
567
|
+
// Push-right-then-down from swap position
|
|
568
|
+
const free = occupancy.findNextFree(swapCol, swapRow, dc, dr, maxCols);
|
|
569
|
+
occupancy.occupy(free.col, free.row, dc, dr, d.el);
|
|
570
|
+
resolvedMap.set(d.el, { ...d.pos, col: free.col, row: free.row });
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
swapped = true;
|
|
574
|
+
}
|
|
575
|
+
else {
|
|
576
|
+
// Can't place — restore all occupants
|
|
577
|
+
for (const d of displaced) {
|
|
578
|
+
occupancy.occupy(d.pos.col, d.pos.row, d.pos.colspan, d.pos.rowspan, d.el);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
if (swapped)
|
|
583
|
+
continue;
|
|
584
|
+
// Fall back: push-right-then-down
|
|
585
|
+
const free = occupancy.findNextFree(col, row, colspan, rowspan, maxCols);
|
|
586
|
+
col = free.col;
|
|
587
|
+
row = free.row;
|
|
588
|
+
}
|
|
589
|
+
occupancy.occupy(col, row, colspan, rowspan, item);
|
|
590
|
+
resolvedMap.set(item, { col, row, colspan, rowspan });
|
|
591
|
+
}
|
|
592
|
+
// Phase 2b: Sync grid attributes so displaced items don't snap back on next layout
|
|
593
|
+
for (const p of placements) {
|
|
594
|
+
const resolved = resolvedMap.get(p.item);
|
|
595
|
+
if (!resolved)
|
|
596
|
+
continue;
|
|
597
|
+
if (resolved.col !== p.col || resolved.row !== p.row) {
|
|
598
|
+
p.item.setAttribute('grid-col', String(resolved.col));
|
|
599
|
+
p.item.setAttribute('grid-row', String(resolved.row));
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
// Phase 3: Apply positions to DOM
|
|
603
|
+
let maxCol = 0;
|
|
604
|
+
let maxRow = 0;
|
|
605
|
+
let staggerIndex = 0;
|
|
606
|
+
this.resolvedPositions.clear();
|
|
607
|
+
for (const p of placements) {
|
|
608
|
+
const resolved = resolvedMap.get(p.item);
|
|
609
|
+
if (!resolved)
|
|
610
|
+
continue;
|
|
611
|
+
const { col, row, colspan, rowspan } = resolved;
|
|
612
|
+
let x = col * (this.columnWidth + gapPx);
|
|
613
|
+
let y = row * (this.rowHeight + gapPx);
|
|
614
|
+
const itemWidth = colspan * this.columnWidth + (colspan - 1) * gapPx;
|
|
615
|
+
const itemHeight = rowspan * this.rowHeight + (rowspan - 1) * gapPx;
|
|
616
|
+
p.item.style.width = `${itemWidth}px`;
|
|
617
|
+
p.item.style.height = `${itemHeight}px`;
|
|
618
|
+
if (!this.originLeft) {
|
|
619
|
+
x = this.clientWidth - x - itemWidth;
|
|
620
|
+
}
|
|
621
|
+
if (!this.originTop) {
|
|
622
|
+
y = this.clientHeight - y - itemHeight;
|
|
623
|
+
}
|
|
624
|
+
this.positionItem(p.item, x, y, this.stagger > 0 ? staggerIndex * this.stagger : 0);
|
|
625
|
+
this.resolvedPositions.set(p.item, { col, row, colspan, rowspan });
|
|
626
|
+
if (col + colspan > maxCol)
|
|
627
|
+
maxCol = col + colspan;
|
|
628
|
+
if (row + rowspan > maxRow)
|
|
629
|
+
maxRow = row + rowspan;
|
|
630
|
+
staggerIndex++;
|
|
631
|
+
}
|
|
632
|
+
// Compute container size
|
|
633
|
+
if (this.container) {
|
|
634
|
+
const effectiveCols = this.columns > 0 ? this.columns : maxCol;
|
|
635
|
+
const effectiveRows = this.rows > 0 ? this.rows : maxRow;
|
|
636
|
+
const containerWidth = effectiveCols > 0
|
|
637
|
+
? effectiveCols * this.columnWidth + (effectiveCols - 1) * gapPx
|
|
638
|
+
: 0;
|
|
639
|
+
const containerHeight = effectiveRows > 0
|
|
640
|
+
? effectiveRows * this.rowHeight + (effectiveRows - 1) * gapPx
|
|
641
|
+
: 0;
|
|
642
|
+
this.container.style.width = containerWidth > 0 ? `${containerWidth}px` : '';
|
|
643
|
+
this.container.style.height = containerHeight > 0 ? `${containerHeight}px` : '';
|
|
644
|
+
}
|
|
645
|
+
this.emitLayoutComplete();
|
|
646
|
+
}
|
|
647
|
+
positionItem(item, x, y, delay) {
|
|
648
|
+
if (delay > 0) {
|
|
649
|
+
item.style.transitionDelay = `${delay}ms`;
|
|
650
|
+
}
|
|
651
|
+
else {
|
|
652
|
+
item.style.transitionDelay = '';
|
|
653
|
+
}
|
|
654
|
+
item.style.transform = `translate(${x}px, ${y}px)`;
|
|
655
|
+
}
|
|
656
|
+
// -- Drag implementation --------------------------------------------------
|
|
657
|
+
setupDragListeners() {
|
|
658
|
+
this.addEventListener('pointerdown', this.onPointerDown);
|
|
659
|
+
}
|
|
660
|
+
teardownDragListeners() {
|
|
661
|
+
this.removeEventListener('pointerdown', this.onPointerDown);
|
|
662
|
+
if (this.boundPointerMove) {
|
|
663
|
+
document.removeEventListener('pointermove', this.boundPointerMove);
|
|
664
|
+
this.boundPointerMove = null;
|
|
665
|
+
}
|
|
666
|
+
if (this.boundPointerUp) {
|
|
667
|
+
document.removeEventListener('pointerup', this.boundPointerUp);
|
|
668
|
+
this.boundPointerUp = null;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
dragItemStart(item, e) {
|
|
672
|
+
const containerRect = this.getBoundingClientRect();
|
|
673
|
+
const itemRect = item.getBoundingClientRect();
|
|
674
|
+
const currentX = itemRect.left - containerRect.left;
|
|
675
|
+
const currentY = itemRect.top - containerRect.top;
|
|
676
|
+
this.dragItem = item;
|
|
677
|
+
this.dragOffsetX = e.clientX - itemRect.left;
|
|
678
|
+
this.dragOffsetY = e.clientY - itemRect.top;
|
|
679
|
+
const gapPx = this.getGapPixels();
|
|
680
|
+
const cellW = this.columnWidth + gapPx;
|
|
681
|
+
const cellH = this.rowHeight + gapPx;
|
|
682
|
+
this.dragItemCol = cellW > 0 ? Math.round(currentX / cellW) : 0;
|
|
683
|
+
this.dragItemRow = cellH > 0 ? Math.round(currentY / cellH) : 0;
|
|
684
|
+
item.classList.add('grid-dragging');
|
|
685
|
+
item.style.transition = 'none';
|
|
686
|
+
// Show placeholder
|
|
687
|
+
this.showPlaceholder(item);
|
|
688
|
+
this.boundPointerMove = (ev) => this.onPointerMove(ev);
|
|
689
|
+
this.boundPointerUp = (ev) => this.onPointerUp(ev);
|
|
690
|
+
document.addEventListener('pointermove', this.boundPointerMove);
|
|
691
|
+
document.addEventListener('pointerup', this.boundPointerUp);
|
|
692
|
+
try {
|
|
693
|
+
item.setPointerCapture(e.pointerId);
|
|
694
|
+
}
|
|
695
|
+
catch (_) { /* synthetic events */ }
|
|
696
|
+
}
|
|
697
|
+
onPointerMove(e) {
|
|
698
|
+
if (!this.dragItem)
|
|
699
|
+
return;
|
|
700
|
+
const containerRect = this.getBoundingClientRect();
|
|
701
|
+
const x = e.clientX - containerRect.left - this.dragOffsetX;
|
|
702
|
+
const y = e.clientY - containerRect.top - this.dragOffsetY;
|
|
703
|
+
this.dragItem.style.transform = `translate(${x}px, ${y}px)`;
|
|
704
|
+
const now = Date.now();
|
|
705
|
+
const isThrottled = this.dragTime && (now - this.dragTime) < this.dragThrottle;
|
|
706
|
+
const doSnap = () => {
|
|
707
|
+
const gapPx = this.getGapPixels();
|
|
708
|
+
const cellW = this.columnWidth + gapPx;
|
|
709
|
+
const cellH = this.rowHeight + gapPx;
|
|
710
|
+
this.dragItemCol = cellW > 0 ? Math.round(x / cellW) : 0;
|
|
711
|
+
this.dragItemRow = cellH > 0 ? Math.round(y / cellH) : 0;
|
|
712
|
+
if (this.dragItemCol < 0)
|
|
713
|
+
this.dragItemCol = 0;
|
|
714
|
+
if (this.dragItemRow < 0)
|
|
715
|
+
this.dragItemRow = 0;
|
|
716
|
+
this.positionPlaceholder();
|
|
717
|
+
};
|
|
718
|
+
if (isThrottled) {
|
|
719
|
+
if (this.dragTimeoutId !== null)
|
|
720
|
+
clearTimeout(this.dragTimeoutId);
|
|
721
|
+
this.dragTimeoutId = setTimeout(doSnap, this.dragThrottle);
|
|
722
|
+
}
|
|
723
|
+
else {
|
|
724
|
+
doSnap();
|
|
725
|
+
this.dragTime = now;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
onPointerUp(_e) {
|
|
729
|
+
if (!this.dragItem)
|
|
730
|
+
return;
|
|
731
|
+
const item = this.dragItem;
|
|
732
|
+
if (this.boundPointerMove) {
|
|
733
|
+
document.removeEventListener('pointermove', this.boundPointerMove);
|
|
734
|
+
this.boundPointerMove = null;
|
|
735
|
+
}
|
|
736
|
+
if (this.boundPointerUp) {
|
|
737
|
+
document.removeEventListener('pointerup', this.boundPointerUp);
|
|
738
|
+
this.boundPointerUp = null;
|
|
739
|
+
}
|
|
740
|
+
if (this.dragTimeoutId !== null) {
|
|
741
|
+
clearTimeout(this.dragTimeoutId);
|
|
742
|
+
this.dragTimeoutId = null;
|
|
743
|
+
}
|
|
744
|
+
// Update grid attributes to snapped position
|
|
745
|
+
item.setAttribute('grid-col', String(this.dragItemCol));
|
|
746
|
+
item.setAttribute('grid-row', String(this.dragItemRow));
|
|
747
|
+
item.classList.remove('grid-dragging');
|
|
748
|
+
item.classList.add('grid-positioning');
|
|
749
|
+
item.style.transition = '';
|
|
750
|
+
const col = this.dragItemCol;
|
|
751
|
+
const row = this.dragItemRow;
|
|
752
|
+
const onTransitionEnd = () => {
|
|
753
|
+
item.removeEventListener('transitionend', onTransitionEnd);
|
|
754
|
+
item.classList.remove('grid-positioning');
|
|
755
|
+
this.hidePlaceholder();
|
|
756
|
+
this.emitDragItemPositioned(item, col, row);
|
|
757
|
+
};
|
|
758
|
+
item.addEventListener('transitionend', onTransitionEnd);
|
|
759
|
+
this.dragItem = null;
|
|
760
|
+
this.performLayout();
|
|
761
|
+
// Safety timeout
|
|
762
|
+
setTimeout(() => {
|
|
763
|
+
if (item.classList.contains('grid-positioning')) {
|
|
764
|
+
item.classList.remove('grid-positioning');
|
|
765
|
+
this.hidePlaceholder();
|
|
766
|
+
}
|
|
767
|
+
}, parseFloat(this.transitionDuration) * 1000 + 100);
|
|
768
|
+
}
|
|
769
|
+
showPlaceholder(item) {
|
|
770
|
+
if (!this.dropPlaceholder)
|
|
771
|
+
return;
|
|
772
|
+
this.dropPlaceholder.style.width = `${item.offsetWidth}px`;
|
|
773
|
+
this.dropPlaceholder.style.height = `${item.offsetHeight}px`;
|
|
774
|
+
this.dropPlaceholder.classList.add('visible');
|
|
775
|
+
this.positionPlaceholder();
|
|
776
|
+
}
|
|
777
|
+
positionPlaceholder() {
|
|
778
|
+
if (!this.dropPlaceholder)
|
|
779
|
+
return;
|
|
780
|
+
const gapPx = this.getGapPixels();
|
|
781
|
+
const x = this.dragItemCol * (this.columnWidth + gapPx);
|
|
782
|
+
const y = this.dragItemRow * (this.rowHeight + gapPx);
|
|
783
|
+
this.dropPlaceholder.style.transform = `translate(${x}px, ${y}px)`;
|
|
784
|
+
}
|
|
785
|
+
hidePlaceholder() {
|
|
786
|
+
if (!this.dropPlaceholder)
|
|
787
|
+
return;
|
|
788
|
+
this.dropPlaceholder.classList.remove('visible');
|
|
789
|
+
}
|
|
790
|
+
});
|
|
791
|
+
return _classThis;
|
|
792
|
+
})();
|
|
793
|
+
|
|
794
|
+
export { SniceGrid };
|
|
795
|
+
//# sourceMappingURL=snice-grid.js.map
|