snice 7.8.0 → 7.9.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 +1 -1
- package/adapters/react/SniceProvider.js +1 -1
- package/adapters/react/SniceRouter.js +1 -1
- package/adapters/react/matchRoute.js +1 -1
- package/adapters/react/table.d.ts +1 -0
- package/adapters/react/table.d.ts.map +1 -1
- package/adapters/react/table.js +1 -1
- package/adapters/react/table.js.map +1 -1
- package/adapters/react/table.tsx +2 -1
- package/adapters/react/useRequestHandler.js +1 -1
- package/bin/analyzer-contracts.js +17 -1
- package/custom-elements.json +57 -3
- package/dist/cdn/accordion/snice-accordion.js +1 -1
- package/dist/cdn/action-bar/snice-action-bar.js +1 -1
- package/dist/cdn/activity-feed/snice-activity-feed.js +1 -1
- package/dist/cdn/alert/snice-alert.js +1 -1
- package/dist/cdn/app-tiles/snice-app-tiles.js +1 -1
- package/dist/cdn/approval-flow/snice-approval-flow.js +1 -1
- package/dist/cdn/audio-recorder/snice-audio-recorder.js +1 -1
- package/dist/cdn/availability/snice-availability.js +1 -1
- package/dist/cdn/avatar/snice-avatar.js +1 -1
- package/dist/cdn/avatar-group/snice-avatar-group.js +1 -1
- package/dist/cdn/badge/snice-badge.js +1 -1
- package/dist/cdn/banner/snice-banner.js +1 -1
- package/dist/cdn/binpack/snice-binpack.js +1 -1
- package/dist/cdn/book/snice-book.js +1 -1
- package/dist/cdn/booking/snice-booking.js +1 -1
- package/dist/cdn/breadcrumbs/snice-breadcrumbs.js +1 -1
- package/dist/cdn/button/snice-button.js +1 -1
- package/dist/cdn/calendar/README.md +2 -2
- package/dist/cdn/calendar/snice-calendar.js +537 -44
- package/dist/cdn/calendar/snice-calendar.js.map +1 -1
- package/dist/cdn/calendar/snice-calendar.min.js +2 -2
- package/dist/cdn/calendar/snice-calendar.min.js.map +1 -1
- package/dist/cdn/camera/snice-camera.js +1 -1
- package/dist/cdn/camera-annotate/snice-camera-annotate.js +1 -1
- package/dist/cdn/candlestick/snice-candlestick.js +1 -1
- package/dist/cdn/card/snice-card.js +1 -1
- package/dist/cdn/carousel/snice-carousel.js +1 -1
- package/dist/cdn/cart/snice-cart.js +1 -1
- package/dist/cdn/chart/snice-chart.js +1 -1
- package/dist/cdn/chat/snice-chat.js +1 -1
- package/dist/cdn/checkbox/snice-checkbox.js +1 -1
- package/dist/cdn/chip/snice-chip.js +1 -1
- package/dist/cdn/code-block/README.md +2 -2
- package/dist/cdn/code-block/snice-code-block.js +177 -167
- package/dist/cdn/code-block/snice-code-block.js.map +1 -1
- package/dist/cdn/code-block/snice-code-block.min.js +2 -2
- package/dist/cdn/code-block/snice-code-block.min.js.map +1 -1
- package/dist/cdn/color-display/snice-color-display.js +1 -1
- package/dist/cdn/color-picker/snice-color-picker.js +1 -1
- package/dist/cdn/command-palette/README.md +1 -1
- package/dist/cdn/command-palette/snice-command-palette.js +2 -2
- package/dist/cdn/command-palette/snice-command-palette.js.map +1 -1
- package/dist/cdn/command-palette/snice-command-palette.min.js +1 -1
- package/dist/cdn/command-palette/snice-command-palette.min.js.map +1 -1
- package/dist/cdn/comments/snice-comments.js +1 -1
- package/dist/cdn/countdown/snice-countdown.js +1 -1
- package/dist/cdn/cropper/snice-cropper.js +1 -1
- package/dist/cdn/data-card/snice-data-card.js +1 -1
- package/dist/cdn/date-picker/snice-date-picker.js +1 -1
- package/dist/cdn/date-range-picker/snice-date-range-picker.js +1 -1
- package/dist/cdn/date-time-picker/snice-date-time-picker.js +1 -1
- package/dist/cdn/diff/snice-diff.js +1 -1
- package/dist/cdn/divider/snice-divider.js +1 -1
- package/dist/cdn/doc/snice-doc.js +1 -1
- package/dist/cdn/draw/snice-draw.js +1 -1
- package/dist/cdn/drawer/snice-drawer.js +1 -1
- package/dist/cdn/empty-state/snice-empty-state.js +1 -1
- package/dist/cdn/estimate/snice-estimate.js +1 -1
- package/dist/cdn/file-gallery/snice-file-gallery.js +1 -1
- package/dist/cdn/file-upload/snice-file-upload.js +1 -1
- package/dist/cdn/flip-card/snice-flip-card.js +1 -1
- package/dist/cdn/flow/snice-flow.js +1 -1
- package/dist/cdn/form-layout/snice-form-layout.js +1 -1
- package/dist/cdn/funnel/snice-funnel.js +1 -1
- package/dist/cdn/gantt/snice-gantt.js +1 -1
- package/dist/cdn/gauge/snice-gauge.js +1 -1
- package/dist/cdn/grid/snice-grid.js +1 -1
- package/dist/cdn/heatmap/snice-heatmap.js +1 -1
- package/dist/cdn/image/snice-image.js +1 -1
- package/dist/cdn/input/snice-input.js +1 -1
- package/dist/cdn/invoice/snice-invoice.js +1 -1
- package/dist/cdn/kanban/snice-kanban.js +1 -1
- package/dist/cdn/key-value/snice-key-value.js +1 -1
- package/dist/cdn/kpi/snice-kpi.js +1 -1
- package/dist/cdn/layout/snice-layout.js +1 -1
- package/dist/cdn/leaderboard/snice-leaderboard.js +1 -1
- package/dist/cdn/link/snice-link.js +1 -1
- package/dist/cdn/link-preview/snice-link-preview.js +1 -1
- package/dist/cdn/list/snice-list.js +1 -1
- package/dist/cdn/location/snice-location.js +1 -1
- package/dist/cdn/login/snice-login.js +1 -1
- package/dist/cdn/map/snice-map.js +1 -1
- package/dist/cdn/markdown/snice-markdown.js +1 -1
- package/dist/cdn/masonry/snice-masonry.js +1 -1
- package/dist/cdn/menu/snice-menu.js +1 -1
- package/dist/cdn/message-strip/snice-message-strip.js +1 -1
- package/dist/cdn/modal/snice-modal.js +1 -1
- package/dist/cdn/music-player/snice-music-player.js +1 -1
- package/dist/cdn/nav/snice-nav.js +1 -1
- package/dist/cdn/network-graph/snice-network-graph.js +1 -1
- package/dist/cdn/notification-center/snice-notification-center.js +1 -1
- package/dist/cdn/order-tracker/snice-order-tracker.js +1 -1
- package/dist/cdn/org-chart/snice-org-chart.js +1 -1
- package/dist/cdn/pagination/snice-pagination.js +1 -1
- package/dist/cdn/paint/snice-paint.js +1 -1
- package/dist/cdn/pdf-viewer/snice-pdf-viewer.js +1 -1
- package/dist/cdn/permission-matrix/snice-permission-matrix.js +1 -1
- package/dist/cdn/podcast-player/snice-podcast-player.js +1 -1
- package/dist/cdn/popover/snice-popover.js +1 -1
- package/dist/cdn/pricing-table/snice-pricing-table.js +1 -1
- package/dist/cdn/product-card/snice-product-card.js +1 -1
- package/dist/cdn/progress/snice-progress.js +2 -2
- package/dist/cdn/progress/snice-progress.js.map +1 -1
- package/dist/cdn/progress/snice-progress.min.js +1 -1
- package/dist/cdn/progress/snice-progress.min.js.map +1 -1
- package/dist/cdn/progress-ring/snice-progress-ring.js +1 -1
- package/dist/cdn/qr-code/README.md +2 -2
- package/dist/cdn/qr-code/snice-qr-code.js +19 -3
- package/dist/cdn/qr-code/snice-qr-code.js.map +1 -1
- package/dist/cdn/qr-code/snice-qr-code.min.js +2 -2
- package/dist/cdn/qr-code/snice-qr-code.min.js.map +1 -1
- package/dist/cdn/qr-reader/snice-qr-reader.js +1 -1
- package/dist/cdn/radio/snice-radio.js +1 -1
- package/dist/cdn/range-slider/snice-range-slider.js +1 -1
- package/dist/cdn/rating/snice-rating.js +1 -1
- package/dist/cdn/receipt/snice-receipt.js +5 -2
- package/dist/cdn/receipt/snice-receipt.js.map +1 -1
- package/dist/cdn/receipt/snice-receipt.min.js +1 -1
- package/dist/cdn/receipt/snice-receipt.min.js.map +1 -1
- package/dist/cdn/recipe/snice-recipe.js +1 -1
- package/dist/cdn/runtime/snice-runtime.esm.js +4 -4
- package/dist/cdn/runtime/snice-runtime.esm.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.esm.min.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.js +4 -4
- package/dist/cdn/runtime/snice-runtime.js.map +1 -1
- package/dist/cdn/runtime/snice-runtime.min.js.map +1 -1
- package/dist/cdn/sankey/snice-sankey.js +1 -1
- package/dist/cdn/segmented-control/snice-segmented-control.js +1 -1
- package/dist/cdn/select/README.md +2 -2
- package/dist/cdn/select/snice-select.js +6 -9
- package/dist/cdn/select/snice-select.js.map +1 -1
- package/dist/cdn/select/snice-select.min.js +2 -2
- package/dist/cdn/select/snice-select.min.js.map +1 -1
- package/dist/cdn/skeleton/snice-skeleton.js +1 -1
- package/dist/cdn/slider/snice-slider.js +1 -1
- package/dist/cdn/sortable/snice-sortable.js +1 -1
- package/dist/cdn/sparkline/snice-sparkline.js +1 -1
- package/dist/cdn/spinner/snice-spinner.js +1 -1
- package/dist/cdn/split-button/snice-split-button.js +1 -1
- package/dist/cdn/split-pane/snice-split-pane.js +1 -1
- package/dist/cdn/spotlight/snice-spotlight.js +1 -1
- package/dist/cdn/stat-group/snice-stat-group.js +1 -1
- package/dist/cdn/step-input/snice-step-input.js +1 -1
- package/dist/cdn/stepper/snice-stepper.js +1 -1
- package/dist/cdn/switch/snice-switch.js +1 -1
- package/dist/cdn/table/README.md +2 -2
- package/dist/cdn/table/snice-table.esm.js +1940 -407
- package/dist/cdn/table/snice-table.esm.js.map +1 -1
- package/dist/cdn/table/snice-table.esm.min.js +242 -53
- package/dist/cdn/table/snice-table.esm.min.js.map +1 -1
- package/dist/cdn/table/snice-table.js +1940 -407
- package/dist/cdn/table/snice-table.js.map +1 -1
- package/dist/cdn/table/snice-table.min.js +234 -45
- package/dist/cdn/table/snice-table.min.js.map +1 -1
- package/dist/cdn/tabs/snice-tabs.js +1 -1
- package/dist/cdn/tag/snice-tag.js +1 -1
- package/dist/cdn/tag-input/snice-tag-input.js +1 -1
- package/dist/cdn/terminal/snice-terminal.js +1 -1
- package/dist/cdn/testimonial/snice-testimonial.js +1 -1
- package/dist/cdn/textarea/snice-textarea.js +1 -1
- package/dist/cdn/time-picker/snice-time-picker.js +1 -1
- package/dist/cdn/time-range-picker/snice-time-range-picker.js +1 -1
- package/dist/cdn/timeline/snice-timeline.js +1 -1
- package/dist/cdn/timer/snice-timer.js +1 -1
- package/dist/cdn/toast/snice-toast.js +1 -1
- package/dist/cdn/tooltip/snice-tooltip.js +1 -1
- package/dist/cdn/tree/snice-tree.js +1 -1
- package/dist/cdn/treemap/snice-treemap.js +1 -1
- package/dist/cdn/user-card/snice-user-card.js +1 -1
- package/dist/cdn/video-player/snice-video-player.js +1 -1
- package/dist/cdn/virtual-scroller/snice-virtual-scroller.js +1 -1
- package/dist/cdn/waterfall/snice-waterfall.js +1 -1
- package/dist/cdn/weather/snice-weather.js +1 -1
- package/dist/cdn/work-order/snice-work-order.js +1 -1
- package/dist/components/calendar/snice-calendar.d.ts +187 -5
- package/dist/components/calendar/snice-calendar.js +537 -44
- package/dist/components/calendar/snice-calendar.js.map +1 -1
- package/dist/components/calendar/snice-calendar.types.d.ts +2 -1
- package/dist/components/code-block/formatter.d.ts +6 -0
- package/dist/components/code-block/formatter.js +174 -164
- package/dist/components/code-block/formatter.js.map +1 -1
- package/dist/components/code-block/grammars/snice.json +1 -1
- package/dist/components/code-block/grammars/typescript.json +1 -1
- package/dist/components/command-palette/snice-command-palette.js +1 -1
- package/dist/components/command-palette/snice-command-palette.js.map +1 -1
- package/dist/components/progress/snice-progress.js +1 -1
- package/dist/components/progress/snice-progress.js.map +1 -1
- package/dist/components/qr-code/qrcode.d.ts +1 -1
- package/dist/components/qr-code/qrcode.js +18 -2
- package/dist/components/qr-code/qrcode.js.map +1 -1
- package/dist/components/receipt/snice-receipt.js +4 -1
- package/dist/components/receipt/snice-receipt.js.map +1 -1
- package/dist/components/select/snice-select.d.ts +1 -1
- package/dist/components/select/snice-select.js +5 -8
- package/dist/components/select/snice-select.js.map +1 -1
- package/dist/components/table/snice-cell-actions.js +1 -1
- package/dist/components/table/snice-cell-actions.js.map +1 -1
- package/dist/components/table/snice-cell-color.js +1 -1
- package/dist/components/table/snice-cell-color.js.map +1 -1
- package/dist/components/table/snice-cell-date.js +20 -8
- package/dist/components/table/snice-cell-date.js.map +1 -1
- package/dist/components/table/snice-cell-email.js +1 -1
- package/dist/components/table/snice-cell-email.js.map +1 -1
- package/dist/components/table/snice-cell-image.js +1 -1
- package/dist/components/table/snice-cell-image.js.map +1 -1
- package/dist/components/table/snice-cell-json.js +1 -1
- package/dist/components/table/snice-cell-json.js.map +1 -1
- package/dist/components/table/snice-cell-link.js +1 -1
- package/dist/components/table/snice-cell-link.js.map +1 -1
- package/dist/components/table/snice-cell-location.js +1 -1
- package/dist/components/table/snice-cell-location.js.map +1 -1
- package/dist/components/table/snice-cell-phone.js +1 -1
- package/dist/components/table/snice-cell-phone.js.map +1 -1
- package/dist/components/table/snice-cell-status.js +1 -1
- package/dist/components/table/snice-cell-status.js.map +1 -1
- package/dist/components/table/snice-cell.d.ts +10 -0
- package/dist/components/table/snice-cell.js +59 -13
- package/dist/components/table/snice-cell.js.map +1 -1
- package/dist/components/table/snice-row.d.ts +0 -1
- package/dist/components/table/snice-row.js +4 -10
- package/dist/components/table/snice-row.js.map +1 -1
- package/dist/components/table/snice-table.d.ts +170 -2
- package/dist/components/table/snice-table.js +868 -189
- package/dist/components/table/snice-table.js.map +1 -1
- package/dist/components/table/snice-table.types.d.ts +17 -0
- package/dist/components/table/table-cell-presentation.d.ts +17 -4
- package/dist/components/table/table-cell-presentation.js +37 -11
- package/dist/components/table/table-cell-presentation.js.map +1 -1
- package/dist/components/table/table-column-manager.d.ts +153 -2
- package/dist/components/table/table-column-manager.js +364 -43
- package/dist/components/table/table-column-manager.js.map +1 -1
- package/dist/components/table/table-date.d.ts +29 -0
- package/dist/components/table/table-date.js +78 -0
- package/dist/components/table/table-date.js.map +1 -0
- package/dist/components/table/table-export.js +6 -2
- package/dist/components/table/table-export.js.map +1 -1
- package/dist/components/table/table-filter-engine.d.ts +9 -0
- package/dist/components/table/table-filter-engine.js +58 -14
- package/dist/components/table/table-filter-engine.js.map +1 -1
- package/dist/components/table/table-keyboard.d.ts +8 -0
- package/dist/components/table/table-keyboard.js +14 -3
- package/dist/components/table/table-keyboard.js.map +1 -1
- package/dist/components/table/table-toolbar.js +1 -0
- package/dist/components/table/table-toolbar.js.map +1 -1
- package/dist/components/table/table-tree-data.d.ts +2 -0
- package/dist/components/table/table-tree-data.js +35 -9
- package/dist/components/table/table-tree-data.js.map +1 -1
- package/dist/components/table/table-virtualizer.d.ts +44 -7
- package/dist/components/table/table-virtualizer.js +101 -54
- package/dist/components/table/table-virtualizer.js.map +1 -1
- package/dist/components/theme/theme.css +9 -0
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/react/SniceProvider.js +1 -1
- package/dist/react/SniceRouter.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/matchRoute.js +1 -1
- package/dist/react/useRequestHandler.js +1 -1
- package/dist/symbols.cjs +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/testing-dom.cjs +1 -1
- package/dist/testing-dom.esm.js +1 -1
- package/dist/transitions.cjs +1 -1
- package/dist/transitions.esm.js +1 -1
- package/docs/ai/DEVELOPMENT.md +93 -2
- package/docs/ai/components/calendar.md +113 -10
- package/docs/ai/components/code-block.md +4 -0
- package/docs/ai/components/doc.md +1 -1
- package/docs/ai/components/progress.md +1 -0
- package/docs/ai/components/receipt.md +1 -1
- package/docs/ai/components/table.md +29 -30
- package/docs/ai/components/theme.md +1 -0
- package/docs/ai/events.md +30 -0
- package/docs/ai/theme.md +1 -0
- package/docs/components/calendar.md +171 -11
- package/docs/components/code-block.md +2 -0
- package/docs/components/doc.md +1 -1
- package/docs/components/progress.md +13 -0
- package/docs/components/receipt.md +1 -0
- package/docs/components/table.md +274 -15
- package/docs/components/theme.md +5 -0
- package/docs/events.md +49 -0
- package/docs/plans/2026-03-06-date-range-picker-plan.md +4 -4
- package/docs/plans/2026-03-07-table-mui-parity-design.md +1 -1
- package/docs/plans/2026-03-09-action-bar-plan.md +11 -11
- package/docs/superpowers/specs/2026-07-09-table-incredible-design.md +1 -1
- package/docs/superpowers/specs/2026-07-09-table-phase0-implementation.md +2 -2
- package/package.json +3 -1
- package/vscode.html-custom-data.json +13 -1
|
@@ -18,7 +18,7 @@ Display and select dates with event support, date restrictions, and locale-aware
|
|
|
18
18
|
|
|
19
19
|
| Property | Type | Default | Description |
|
|
20
20
|
|----------|------|---------|-------------|
|
|
21
|
-
| `value` | `Date \| string` | `
|
|
21
|
+
| `value` | `Date \| string \| null` | `null` | Selected date. `null` means nothing is selected — a fresh calendar marks today via `highlightToday`, it does not select it |
|
|
22
22
|
| `view` | `'month' \| 'week' \| 'day'` | `'month'` | Calendar view |
|
|
23
23
|
| `events` | `CalendarEvent[]` | `[]` | Calendar events |
|
|
24
24
|
| `minDate` (attr: `min-date`) | `Date \| string` | `''` | Minimum selectable date |
|
|
@@ -26,8 +26,8 @@ Display and select dates with event support, date restrictions, and locale-aware
|
|
|
26
26
|
| `disabledDates` | `(Date \| string)[]` | `[]` | Disabled dates (JS-only; no attribute) |
|
|
27
27
|
| `highlightToday` (attr: `highlight-today`) | `boolean` | `true` | Highlight today's date |
|
|
28
28
|
| `noDaySelect` (attr: `no-day-select`) | `boolean` | `false` | Display-only mode: day clicks neither select/highlight nor fire `calendar-change`; event bars stay interactive |
|
|
29
|
-
| `cellSizing` (attr: `cell-sizing`) | `'square' \| 'stretch'` | `'square'` | `square` keeps day cells as tall as the column is wide; `stretch` lets rows collapse to their content and event-
|
|
30
|
-
| `showWeekNumbers` (attr: `show-week-numbers`) | `boolean` | `false` |
|
|
29
|
+
| `cellSizing` (attr: `cell-sizing`) | `'square' \| 'stretch'` | `'square'` | `square` keeps day cells as tall as the column is wide; `stretch` lets rows collapse to their content. Either way the cell's height is what sets how many event lanes are visible — see [Event lanes and the `+N more` chip](#event-lanes-and-the-n-more-chip) |
|
|
30
|
+
| `showWeekNumbers` (attr: `show-week-numbers`) | `boolean` | `false` | Add a leading week-number column — see [With week numbers](#with-week-numbers) |
|
|
31
31
|
| `firstDayOfWeek` (attr: `first-day-of-week`) | `number` | `0` | First day of week (0=Sun, 1=Mon) |
|
|
32
32
|
| `locale` | `string` | `'en-US'` | Locale for formatting |
|
|
33
33
|
|
|
@@ -68,6 +68,7 @@ interface CalendarEventAvatar {
|
|
|
68
68
|
| `nextDay()` | -- | `void` | Navigate to next day |
|
|
69
69
|
| `getDisplayedMonth()` | -- | `{ month: number; year: number }` | Get currently displayed month |
|
|
70
70
|
| `getEventsForDate()` | `date: Date \| string` | `CalendarEvent[]` | Get events for specific date |
|
|
71
|
+
| `closeEventPopover()` | `options?: { returnFocus?: boolean }` | — | Closes the shared overlay — either an event popover or the `+N more` day panel |
|
|
71
72
|
|
|
72
73
|
## Events
|
|
73
74
|
|
|
@@ -75,7 +76,7 @@ interface CalendarEventAvatar {
|
|
|
75
76
|
|-------|--------|-------------|
|
|
76
77
|
| `calendar-change` | `{ value: Date, calendar: SniceCalendarElement }` | Fired when selected date changes |
|
|
77
78
|
| `calendar-event-click` | `{ event: CalendarEvent, calendar: SniceCalendarElement }` | Fired when an event is clicked |
|
|
78
|
-
| `calendar-more-click` | `{ date: Date, count: number, calendar: SniceCalendarElement }` | Fired when a day's `+N more` chip is clicked (or activated with Enter/Space). The day is not selected and `calendar-change` does not fire |
|
|
79
|
+
| `calendar-more-click` | `{ date: Date, count: number, calendar: SniceCalendarElement }` | Fired when a day's `+N more` chip is clicked (or activated with Enter/Space). The day is not selected and `calendar-change` does not fire. **Cancelable** — calling `preventDefault()` suppresses the [built-in day panel](#the-n-more-chip-and-its-built-in-day-panel) |
|
|
79
80
|
|
|
80
81
|
## CSS Parts
|
|
81
82
|
|
|
@@ -87,8 +88,14 @@ Style internal elements from outside the shadow DOM using `::part()`.
|
|
|
87
88
|
| `header` | The header with month title and navigation buttons |
|
|
88
89
|
| `grid` | The day cells grid |
|
|
89
90
|
| `more-chip` | A day's `+N more` overflow chip |
|
|
91
|
+
| `more-panel-date` | The date heading inside the chip's built-in day panel |
|
|
92
|
+
| `more-list` | The list of hidden events inside the chip's built-in day panel |
|
|
93
|
+
| `more-item` | One hidden-event entry in that list |
|
|
94
|
+
| `more-dot` | The colour dot on a hidden-event entry |
|
|
95
|
+
| `week-number` | A week-number cell in the `show-week-numbers` column |
|
|
96
|
+
| `week-number-header` | The empty corner cell above the week-number column |
|
|
90
97
|
| `event-bar` | An event stripe (plus any `className` you set on the event) |
|
|
91
|
-
| `event-avatar` | The `<snice-avatar>`
|
|
98
|
+
| `event-avatar` | The `<snice-avatar>` at the start of an event bar (segments ≥ `4.5rem` only) |
|
|
92
99
|
| `event-tooltip` | The shared tooltip overlay shown on event hover |
|
|
93
100
|
| `event-popover` | The popover opened by a `popover`-enabled event |
|
|
94
101
|
|
|
@@ -136,27 +143,131 @@ Events render as continuous stripes, the way professional calendars draw them:
|
|
|
136
143
|
an event with an `end` date spans all of its days as one bar per week row,
|
|
137
144
|
chopped at week boundaries with squared corners so consecutive rows read as a
|
|
138
145
|
single bar (the title repeats on each row). Concurrent events stack into
|
|
139
|
-
lanes — earlier start first, longer event first on ties.
|
|
140
|
-
|
|
146
|
+
lanes — earlier start first, longer event first on ties. How many lanes are
|
|
147
|
+
visible is derived from the room a day cell has, week by week (see
|
|
148
|
+
[Event lanes and the `+N more` chip](#event-lanes-and-the-n-more-chip)); days
|
|
149
|
+
with deeper stacks get a `+N more` chip. Each bar exposes a
|
|
141
150
|
`part="event-bar"` for styling and dispatches `calendar-event-click` when
|
|
142
151
|
clicked.
|
|
143
152
|
|
|
153
|
+
### Event lanes and the `+N more` chip
|
|
154
|
+
|
|
155
|
+
There is no fixed lane limit. Each week shows as many 1.375rem lanes as fit in
|
|
156
|
+
its day cells, above the 2.125rem day-number strip, keeping 1rem for the
|
|
157
|
+
`+N more` chip when the stack runs deeper than the cell; at least one lane is
|
|
158
|
+
always drawn. So the visible depth follows whatever gives the cell its height:
|
|
159
|
+
|
|
160
|
+
- **`cell-sizing="square"` (the default).** The cell is as tall as the column is
|
|
161
|
+
wide (`100cqw / 7`), so a wider calendar shows more lanes. Note the built-in
|
|
162
|
+
`max-width: 37.5rem`: at the widest default calendar a cell is about 5.4rem,
|
|
163
|
+
which affords two lanes (one once the chip claims its strip). Lift the cap
|
|
164
|
+
with `snice-calendar::part(base) { max-width: none }`, or give the calendar a
|
|
165
|
+
height, to go deeper. Narrow calendars therefore show fewer stripes than the
|
|
166
|
+
flat three-lane cap this replaced — give the calendar room if you want more.
|
|
167
|
+
- **A height of your own.** Give the calendar a definite height — an inline
|
|
168
|
+
`height`, a CSS rule, or a sized flex/grid parent — and its six week rows
|
|
169
|
+
share the room under the header. A full-page calendar shows seven or eight
|
|
170
|
+
stripes a day instead of collapsing them into a chip:
|
|
171
|
+
|
|
172
|
+
```css
|
|
173
|
+
snice-calendar { height: 100%; } /* inside a sized layout slot */
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
- **`cell-sizing="stretch"` with no height imposed.** Rows collapse to their
|
|
177
|
+
content, so there is no budget to run out of: every lane is drawn and no chip
|
|
178
|
+
appears.
|
|
179
|
+
|
|
180
|
+
The count is re-derived whenever the calendar's box changes, so resizing the
|
|
181
|
+
window or the layout slot is enough — you do not need to re-assign `events`.
|
|
182
|
+
|
|
183
|
+
A busy week does not grow taller than the rest of the grid as long as its cells
|
|
184
|
+
can hold the stack they show: one lane needs 3.5rem, and one lane plus the
|
|
185
|
+
`+N more` chip needs 4.5rem. Below that the row still stretches to that floor —
|
|
186
|
+
so with the default square sizing, calendars under roughly 500px wide (a cell
|
|
187
|
+
under 4.5rem) keep the uneven row the reservation produces. When there is no
|
|
188
|
+
layout to measure at all (a headless DOM, a detached or `display: none`
|
|
189
|
+
calendar) the calendar falls back to three lanes.
|
|
190
|
+
|
|
191
|
+
### Sizing inside a constrained host
|
|
192
|
+
|
|
193
|
+
The month fits its own host box. A host that gives the calendar less height
|
|
194
|
+
than the square baseline would like does not clip the bottom weeks:
|
|
195
|
+
|
|
196
|
+
- **Auto height (the default).** The week rows take the square baseline and a
|
|
197
|
+
busy row grows by its lane reservation; the host ends up as tall as that
|
|
198
|
+
comes to.
|
|
199
|
+
- **A definite height with room to spare.** The six rows share the surplus and
|
|
200
|
+
the lane budget grows with them.
|
|
201
|
+
- **A height that is too small** — an inline `height`, a `max-height`, an
|
|
202
|
+
`aspect-ratio`, or a sized flex/grid parent — the rows are capped at their
|
|
203
|
+
equal share of the room under the header, so all six weeks stay inside the
|
|
204
|
+
box. The lane budget follows the compressed row: events that no longer fit
|
|
205
|
+
collapse into the `+N more` chip rather than being drawn past the bottom of
|
|
206
|
+
their cell, and a row too short for even one lane shows the chip alone.
|
|
207
|
+
|
|
208
|
+
Two limits are worth knowing:
|
|
209
|
+
|
|
210
|
+
- The calendar can only measure **its own** box. An ancestor that clips or
|
|
211
|
+
scrolls while leaving the calendar's own height unconstrained (a fixed-height
|
|
212
|
+
wrapper with `overflow: hidden` around an auto-height calendar, or a flex item
|
|
213
|
+
without `min-height: 0`) is invisible to it — put the constraint on the
|
|
214
|
+
calendar, not around it.
|
|
215
|
+
- A week row can never be shorter than its own padding and rules (~17px at the
|
|
216
|
+
default spacing). Below roughly a 200px host the rows have compressed as far
|
|
217
|
+
as they physically can and the grid overflows again rather than stacking one
|
|
218
|
+
week over the next.
|
|
219
|
+
- `view="week"` and `view="day"` set their own, much taller row minimums and are
|
|
220
|
+
not capped.
|
|
221
|
+
|
|
222
|
+
A month grid is a header, a weekday strip and six square-ish week rows, so its
|
|
223
|
+
natural box is **taller than it is wide**. `aspect-ratio: 1` on the host is
|
|
224
|
+
therefore not a neutral size hint — it asks the grid to give up about a week and
|
|
225
|
+
a half of height, and everything the calendar can still show has to be squeezed
|
|
226
|
+
into what is left. Constrain the width and let the height follow:
|
|
227
|
+
|
|
228
|
+
```html
|
|
229
|
+
<snice-calendar style="min-width: 360px; max-width: 26rem; width: 100%"></snice-calendar>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### The `+N more` chip and its built-in day panel
|
|
233
|
+
|
|
144
234
|
The `+N more` chip is a control of its own: it exposes `part="more-chip"`, is
|
|
145
235
|
keyboard-reachable (`role="button"`, Enter/Space), and dispatches
|
|
146
236
|
`calendar-more-click` with the day it belongs to and how many events are
|
|
147
237
|
hidden there. Its click never falls through to day selection, so opening a
|
|
148
|
-
day view does not change the selected date
|
|
238
|
+
day view does not change the selected date.
|
|
239
|
+
|
|
240
|
+
The chip does something useful on its own — no wiring required. Activating it
|
|
241
|
+
opens the calendar's shared overlay listing exactly the events that day hid:
|
|
242
|
+
|
|
243
|
+
- The panel is the same element the event popover uses (`role="dialog"`,
|
|
244
|
+
`part="event-popover"`), so it dismisses on Escape or an outside press,
|
|
245
|
+
takes focus while open, and hands focus back to the chip when it closes.
|
|
246
|
+
- Its `aria-label` names the day. Inside are a date heading
|
|
247
|
+
(`part="more-panel-date"`) and a list (`part="more-list"`) of buttons
|
|
248
|
+
(`part="more-item"`), each showing the event's colour dot
|
|
249
|
+
(`part="more-dot"`) and title.
|
|
250
|
+
- Clicking an entry fires `calendar-event-click`. If that event carries
|
|
251
|
+
`popover` content the same overlay drills into it; otherwise the panel
|
|
252
|
+
closes.
|
|
253
|
+
|
|
254
|
+
To replace the default with your own day view, cancel the event:
|
|
149
255
|
|
|
150
256
|
```typescript
|
|
151
257
|
calendar.addEventListener('calendar-more-click', (e) => {
|
|
258
|
+
e.preventDefault(); // the built-in panel does not open
|
|
152
259
|
// e.detail.date -> the day whose events overflowed
|
|
153
260
|
// e.detail.count -> how many events are hidden on that day
|
|
154
261
|
showDayAgenda(e.detail.date, calendar.getEventsForDate(e.detail.date));
|
|
155
262
|
});
|
|
156
263
|
```
|
|
157
264
|
|
|
265
|
+
Leave the event uncancelled and both happen: your listener runs and the panel
|
|
266
|
+
still opens.
|
|
267
|
+
|
|
158
268
|
```css
|
|
159
269
|
snice-calendar::part(more-chip) { color: #2563eb; }
|
|
270
|
+
snice-calendar::part(more-item) { font-size: 0.9rem; }
|
|
160
271
|
```
|
|
161
272
|
|
|
162
273
|
Bars are styleable per event: `color` sets the background, `avatar` renders a
|
|
@@ -170,6 +281,14 @@ snice-calendar::part(event-bar) { font-weight: 500; }
|
|
|
170
281
|
snice-calendar::part(urgent) { background: crimson; }
|
|
171
282
|
```
|
|
172
283
|
|
|
284
|
+
The title is the payload and the avatar is an adornment, so a bar only carries
|
|
285
|
+
the avatar when its segment has room for both. A segment narrower than `4.5rem`
|
|
286
|
+
— a single day in a 400px-wide month grid is about 57px — renders the title
|
|
287
|
+
alone and halves its inline padding to hand the title every pixel; the bar is
|
|
288
|
+
marked `calendar__event-bar--compact` for styling. The measurement is per
|
|
289
|
+
segment, so the same event keeps its avatar in a week where it spans several
|
|
290
|
+
days, and the decision is re-taken whenever the calendar is resized.
|
|
291
|
+
|
|
173
292
|
```typescript
|
|
174
293
|
calendar.events = [
|
|
175
294
|
{ id: 1, title: 'Incident review', start: '2024-06-18', className: 'urgent',
|
|
@@ -183,7 +302,9 @@ A per-event `tooltip` string shows on hover. For rich or lazily-loaded
|
|
|
183
302
|
content, set the `eventTooltip` provider on the calendar — it runs when the
|
|
184
303
|
pointer enters a bar and may return text, a DOM node, or a promise of either;
|
|
185
304
|
results that resolve after the pointer left are discarded. The provider wins
|
|
186
|
-
over `event.tooltip`. The overlay exposes `part="event-tooltip"
|
|
305
|
+
over `event.tooltip`. The overlay exposes `part="event-tooltip"`, and paints on
|
|
306
|
+
the shared tooltip surface — `--snice-tooltip-bg` / `--snice-tooltip-color`
|
|
307
|
+
(the same pair `<snice-tooltip>` uses) restyle it in both themes.
|
|
187
308
|
|
|
188
309
|
```typescript
|
|
189
310
|
calendar.eventTooltip = async (event) => {
|
|
@@ -247,6 +368,28 @@ Bars with a popover are keyboard-operable (`role="button"`, `tabindex="0"`,
|
|
|
247
368
|
Enter/Space opens). Close programmatically with
|
|
248
369
|
`calendar.closeEventPopover()`.
|
|
249
370
|
|
|
371
|
+
### Overlay Placement
|
|
372
|
+
|
|
373
|
+
Both overlays — the hover tooltip and the click popover — are anchored inside
|
|
374
|
+
the calendar's own box (`::part(base)`), not to the viewport. The host declares
|
|
375
|
+
`contain: layout style`, which makes it the containing block for any
|
|
376
|
+
`position: fixed` descendant, so a viewport-anchored overlay would be offset by
|
|
377
|
+
the calendar's own position on the page. They are placed next to their bar
|
|
378
|
+
(popover below, tooltip above), flipped to the other side when the viewport
|
|
379
|
+
edge is in the way, and clamped to it horizontally.
|
|
380
|
+
|
|
381
|
+
Layout containment also makes the host a stacking context, so an open overlay
|
|
382
|
+
cannot paint above content that follows the calendar on its own. While a
|
|
383
|
+
tooltip or popover is showing, the host therefore carries an `overlay-open`
|
|
384
|
+
attribute and lifts itself with `z-index: var(--snice-z-floating, 1000)`. The
|
|
385
|
+
attribute is set and cleared by the component — treat it as read-only state,
|
|
386
|
+
and match on it to restyle the lift:
|
|
387
|
+
|
|
388
|
+
```css
|
|
389
|
+
/* Keep the calendar under a sticky app header while an overlay is open. */
|
|
390
|
+
snice-calendar[overlay-open] { z-index: 20; }
|
|
391
|
+
```
|
|
392
|
+
|
|
250
393
|
### Date Restrictions
|
|
251
394
|
|
|
252
395
|
Use `min-date` and `max-date` to constrain the selectable date range.
|
|
@@ -283,14 +426,31 @@ Use the `locale` attribute for locale-aware date formatting.
|
|
|
283
426
|
<snice-calendar locale="fr-FR"></snice-calendar>
|
|
284
427
|
```
|
|
285
428
|
|
|
286
|
-
### With
|
|
429
|
+
### With week numbers
|
|
287
430
|
|
|
288
|
-
Set `show-week-numbers` to
|
|
431
|
+
Set `show-week-numbers` to add a leading column that numbers each week row.
|
|
289
432
|
|
|
290
433
|
```html
|
|
291
434
|
<snice-calendar show-week-numbers></snice-calendar>
|
|
292
435
|
```
|
|
293
436
|
|
|
437
|
+
The numbering follows the start of the week:
|
|
438
|
+
|
|
439
|
+
- `first-day-of-week="1"` (Monday) numbers weeks by **ISO-8601** — week 1 is the
|
|
440
|
+
week holding the year's first Thursday, so a January grid can open on week 52
|
|
441
|
+
or 53 of the previous year.
|
|
442
|
+
- Any other start of week uses the common civil rule: **the week containing
|
|
443
|
+
January 1 is week 1**, counted from the year the week ends in.
|
|
444
|
+
|
|
445
|
+
```html
|
|
446
|
+
<!-- ISO week numbers, Monday-first -->
|
|
447
|
+
<snice-calendar show-week-numbers first-day-of-week="1" locale="de-DE"></snice-calendar>
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Style the column with `::part(week-number)` and `::part(week-number-header)`, or
|
|
451
|
+
resize it with the `--calendar-week-number-width` custom property (default
|
|
452
|
+
`2.25rem`).
|
|
453
|
+
|
|
294
454
|
### Programmatic Navigation
|
|
295
455
|
|
|
296
456
|
Use methods to control navigation from JavaScript.
|
|
@@ -157,6 +157,8 @@ Use `format="pretty"` with a grammar that includes formatters.
|
|
|
157
157
|
<snice-code-block grammar="grammars/json.json" format="pretty" code='{"a":1,"b":[2,3]}'></snice-code-block>
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
+
Grammar formatters format authored code — they do not re-flow it. Author line breaks and blank lines are preserved; leading indentation is renormalized; spacing rules apply within a line. Rule-driven breaks (e.g. after `;`) fire only where they do not duplicate an author break and are suppressed inside parentheses/brackets. One-liners like the JSON example above are still pretty-printed.
|
|
161
|
+
|
|
160
162
|
Grammars with built-in `"pretty"` formatters: `json.json`, `typescript.json`, `css.json`, `snice.json`.
|
|
161
163
|
|
|
162
164
|
### Imperative Formatter
|
package/docs/components/doc.md
CHANGED
|
@@ -74,8 +74,21 @@ Style internal elements from outside the shadow DOM using `::part()`.
|
|
|
74
74
|
| `--progress-radius` | Bar border radius | `4px` |
|
|
75
75
|
| `--progress-bg` | Background track color | `var(--snice-color-border)` |
|
|
76
76
|
| `--progress-color` | Progress fill color | `var(--snice-color-primary)` |
|
|
77
|
+
| `--progress-track-opacity` | Opacity of the circular track ring | `0.2` |
|
|
77
78
|
| `--progress-animation-duration` | Animation speed | `1.5s` |
|
|
78
79
|
|
|
80
|
+
The circular track is deliberately faint over light surfaces. Twenty percent of
|
|
81
|
+
any color over a near-black surface is invisible, so a spinner placed on a dark
|
|
82
|
+
or low-contrast background should raise `--progress-track-opacity` (up to `1`)
|
|
83
|
+
rather than try to compensate with an impossibly bright `--progress-bg`:
|
|
84
|
+
|
|
85
|
+
```css
|
|
86
|
+
.on-a-dark-panel snice-progress {
|
|
87
|
+
--progress-track-opacity: 1;
|
|
88
|
+
--progress-bg: var(--snice-color-border);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
79
92
|
## Basic Usage
|
|
80
93
|
|
|
81
94
|
```typescript
|
|
@@ -287,3 +287,4 @@ receipt.print();
|
|
|
287
287
|
- Print styles included for all variants
|
|
288
288
|
- Currency formatted using `Intl.NumberFormat` for locale-appropriate display
|
|
289
289
|
- Subtotal auto-calculated from items if not set; total auto-calculated as subtotal + tax - discount + tip
|
|
290
|
+
- A `ReceiptItem`'s `sku`, `note`, and `discount` render their own lines only in the `detailed` variant; an item `discount` still counts toward the subtotal in every variant
|