@f-ewald/components 1.40.2 → 1.41.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 +11 -3
- package/custom-elements.json +788 -97
- package/dist/app-shell.js +1 -1
- package/dist/app-shell.js.map +1 -1
- package/dist/blink-cursor.d.ts +27 -0
- package/dist/blink-cursor.d.ts.map +1 -0
- package/dist/blink-cursor.js +78 -0
- package/dist/blink-cursor.js.map +1 -0
- package/dist/button-group.d.ts.map +1 -1
- package/dist/button-group.js +3 -0
- package/dist/button-group.js.map +1 -1
- package/dist/calendar-day.d.ts.map +1 -1
- package/dist/calendar-day.js +5 -0
- package/dist/calendar-day.js.map +1 -1
- package/dist/calendar-week.d.ts.map +1 -1
- package/dist/calendar-week.js +5 -0
- package/dist/calendar-week.js.map +1 -1
- package/dist/code-diff.d.ts +41 -0
- package/dist/code-diff.d.ts.map +1 -0
- package/dist/code-diff.js +161 -0
- package/dist/code-diff.js.map +1 -0
- package/dist/comment-label.d.ts +26 -0
- package/dist/comment-label.d.ts.map +1 -0
- package/dist/comment-label.js +81 -0
- package/dist/comment-label.js.map +1 -0
- package/dist/confirm-dialog.d.ts +12 -6
- package/dist/confirm-dialog.d.ts.map +1 -1
- package/dist/confirm-dialog.js +50 -88
- package/dist/confirm-dialog.js.map +1 -1
- package/dist/frame-box.d.ts.map +1 -1
- package/dist/frame-box.js +4 -0
- package/dist/frame-box.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.js +1 -1
- package/dist/mcp-server.js.map +1 -1
- package/dist/modal-dialog.d.ts +16 -13
- package/dist/modal-dialog.d.ts.map +1 -1
- package/dist/modal-dialog.js +69 -104
- package/dist/modal-dialog.js.map +1 -1
- package/dist/photo-gallery.js +1 -1
- package/dist/photo-gallery.js.map +1 -1
- package/dist/price-history-chart.js +1 -1
- package/dist/price-history-chart.js.map +1 -1
- package/dist/progress-bar.d.ts.map +1 -1
- package/dist/progress-bar.js +23 -17
- package/dist/progress-bar.js.map +1 -1
- package/dist/radio-pills.d.ts.map +1 -1
- package/dist/radio-pills.js +3 -0
- package/dist/radio-pills.js.map +1 -1
- package/dist/slide-panel.d.ts +3 -3
- package/dist/slide-panel.d.ts.map +1 -1
- package/dist/slide-panel.js +38 -22
- package/dist/slide-panel.js.map +1 -1
- package/dist/stat-strip.d.ts +30 -0
- package/dist/stat-strip.d.ts.map +1 -0
- package/dist/stat-strip.js +111 -0
- package/dist/stat-strip.js.map +1 -0
- package/dist/step-ladder.d.ts +46 -0
- package/dist/step-ladder.d.ts.map +1 -0
- package/dist/step-ladder.js +175 -0
- package/dist/step-ladder.js.map +1 -0
- package/dist/terminal-block.d.ts +45 -0
- package/dist/terminal-block.d.ts.map +1 -0
- package/dist/terminal-block.js +113 -0
- package/dist/terminal-block.js.map +1 -0
- package/dist/tile-grid.d.ts.map +1 -1
- package/dist/tile-grid.js +3 -0
- package/dist/tile-grid.js.map +1 -1
- package/dist/toast-notification.d.ts +7 -0
- package/dist/toast-notification.d.ts.map +1 -1
- package/dist/toast-notification.js +34 -0
- package/dist/toast-notification.js.map +1 -1
- package/dist/tokens.css +60 -1
- package/dist/tokens.d.ts +58 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +135 -0
- package/dist/tokens.js.map +1 -1
- package/dist/ui-button.js +2 -2
- package/dist/ui-button.js.map +1 -1
- package/dist/window-chrome.d.ts +34 -0
- package/dist/window-chrome.d.ts.map +1 -0
- package/dist/window-chrome.js +141 -0
- package/dist/window-chrome.js.map +1 -0
- package/docs/app-shell.md +1 -1
- package/docs/blink-cursor.md +45 -0
- package/docs/code-diff.md +64 -0
- package/docs/comment-label.md +49 -0
- package/docs/confirm-dialog.md +4 -3
- package/docs/design-language.md +80 -28
- package/docs/layouts/marketing-landing.md +102 -0
- package/docs/modal-dialog.md +9 -9
- package/docs/photo-gallery.md +1 -1
- package/docs/price-history-chart.md +1 -0
- package/docs/radio-pills.md +1 -0
- package/docs/slide-panel.md +2 -2
- package/docs/stat-strip.md +57 -0
- package/docs/step-ladder.md +63 -0
- package/docs/terminal-block.md +69 -0
- package/docs/tile-grid.md +1 -0
- package/docs/ui-button.md +2 -0
- package/docs/window-chrome.md +64 -0
- package/llms.txt +227 -20
- package/package.json +1 -1
package/dist/app-shell.js
CHANGED
|
@@ -252,7 +252,7 @@ let AppShell = class AppShell extends LitElement {
|
|
|
252
252
|
padding: 0.25rem 0.5rem;
|
|
253
253
|
border-radius: var(--ui-radius-sm, 0.25rem);
|
|
254
254
|
background: var(--ui-tooltip, #0f172a);
|
|
255
|
-
color: var(--ui-
|
|
255
|
+
color: var(--ui-tooltip-text, #ffffff);
|
|
256
256
|
box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));
|
|
257
257
|
font-size: var(--ui-font-size-sm, 0.75rem);
|
|
258
258
|
line-height: var(--ui-line-height-tight, 1.25);
|
package/dist/app-shell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-shell.js","sourceRoot":"","sources":["../src/app-shell.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QACL,0EAA0E;QACH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,EAAE;4CAA4B;AAjBzB,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAocpB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { iconBars3 } from \"./icons.js\";\nimport \"./kbd-hint.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** Fired when the built-in toggle changes the sidebar state. */\nexport interface SidebarToggleDetail {\n /** Whether the sidebar is now open. */\n open: boolean;\n}\n\n/**\n * The dashboard page shell: a slot-based CSS-grid backbone that arranges a\n * top bar, the main content, an optional right-hand detail column, an\n * optional footer, and a sidebar. The top bar always spans the shell's full\n * width, in every sidebar state.\n *\n * The sidebar's visibility, width, and layout mode are three independent\n * properties:\n * - `sidebar-open` (default closed) — whether it's shown at all.\n * - `sidebar-width`: `\"full\"` (16rem, icons + labels, the default) or\n * `\"icon\"` (3.5rem rail, icons only — drives the slotted `app-sidebar`'s\n * own `collapsed` attribute).\n * - `sidebar-mode`: `\"overlay\"` (the default) floats the sidebar above the\n * shell's own content with a higher z-index, covering part of the top\n * bar's corner and whatever content sits beneath it, without ever\n * resizing or reflowing `main`/`footer`. `\"push\"` instead reserves a real\n * grid column beside `main`/`footer` (which resize to make room) — the\n * top bar still spans full width above it either way.\n *\n * Below the shared 48rem breakpoint the sidebar always behaves as a\n * full-width, modal, scrim/Escape-dismissible drawer regardless of\n * `sidebar-mode`/`sidebar-width` — those two properties only affect the\n * desktop presentation. Above 48rem, an `overlay`-mode sidebar is a\n * non-modal panel (no dimming scrim, no Escape-dismiss, since it reads as\n * an ordinary always-interactive panel rather than a blocking dialog); a\n * `push`-mode sidebar is even more clearly non-modal, since it never\n * covers anything.\n *\n * The right-hand detail column is unaffected by any of the above: it still\n * reserves an inline grid column on desktop and becomes a dismissible\n * overlay (scrim/Escape) on mobile.\n *\n * Widths are tunable per instance via `--component-sidebar-width` (16rem),\n * `--component-sidebar-rail-width` (3.5rem), and `--component-topbar-height`\n * (3rem); the detail column reuses the 20rem/25rem panel widths. The main\n * content area is white by default — override it with\n * `--component-main-background`. Give the shell a height (e.g. `height:\n * 100vh`) so the sidebar and main can size and scroll.\n *\n * Hovering or keyboard-focusing the toggle reveals a tooltip naming the\n * action and its `[` shortcut — the shortcut is not shown as permanent\n * chrome.\n *\n * Consumers with their own external top bar can set `no-topbar` to skip\n * rendering the built-in topbar row and toggle button entirely (the grid\n * drops that row rather than leaving dead space). The `[`/Escape shortcuts\n * stay fully active either way — drive `sidebar-open` from your own UI and\n * listen for `sidebar-toggle` to stay in sync with keyboard-driven changes.\n *\n * @element app-shell\n * @slot - Main content area.\n * @slot sidebar - Sidebar navigation (typically `app-sidebar`).\n * @slot topbar - Top bar content, right of the built-in toggle.\n * @slot detail - Optional right-hand detail; shown when `detail-open` is set.\n * @slot footer - Optional footer beneath the main content.\n * @fires sidebar-toggle - The built-in toggle changed the sidebar state.\n * @fires detail-close - The scrim or Escape dismissed the mobile detail overlay.\n */\n@customElement(\"app-shell\")\nexport class AppShell extends LitElement {\n /** Whether the sidebar is open. Closed by default at every breakpoint. */\n @property({ type: Boolean, reflect: true, attribute: \"sidebar-open\" }) sidebarOpen = false;\n /** `\"overlay\"` (default) floats the sidebar above content; `\"push\"` reserves a grid column instead. */\n @property({ reflect: true, attribute: \"sidebar-mode\" }) sidebarMode: \"overlay\" | \"push\" = \"overlay\";\n /** Sidebar width when open: `\"full\"` (16rem, icons + labels) or `\"icon\"` (3.5rem rail, icons only). */\n @property({ reflect: true, attribute: \"sidebar-width\" }) sidebarWidth: \"full\" | \"icon\" = \"full\";\n /** Shows the right-hand detail region (inline column, or overlay on mobile). */\n @property({ type: Boolean, reflect: true, attribute: \"detail-open\" }) detailOpen = false;\n /** Detail width: `compact` (20rem) or `comfortable` (25rem). */\n @property({ attribute: \"detail-width\" }) detailWidth: \"compact\" | \"comfortable\" = \"compact\";\n /** Skips rendering the built-in topbar row and its nav toggle entirely, for consumers with their own external top bar. The `[`/Escape shortcuts stay active regardless — this only affects what's rendered. */\n @property({ type: Boolean, reflect: true, attribute: \"no-topbar\" }) noTopbar = false;\n\n /** Whether the viewport is at/below the 48rem breakpoint. */\n @state() private _mobile = false;\n /** Whether the footer slot has assigned content. */\n @state() private _hasFooter = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n block-size: 100%;\n }\n .shell {\n --_sidebar-w: 0px;\n --_detail-w: 0px;\n display: grid;\n grid-template-columns: var(--_sidebar-w) minmax(0, 1fr) var(--_detail-w);\n grid-template-rows: auto minmax(0, 1fr) auto;\n grid-template-areas:\n \"topbar topbar topbar\"\n \"sidebar main detail\"\n \"sidebar footer footer\";\n position: relative;\n block-size: 100%;\n min-height: 0;\n background: var(--ui-surface, #ffffff);\n }\n /* no-topbar drops the topbar row from the grid rather than rendering\n an empty one — the header element itself is skipped in render(). */\n :host([no-topbar]) .shell {\n grid-template-rows: minmax(0, 1fr) auto;\n grid-template-areas:\n \"sidebar main detail\"\n \"sidebar footer footer\";\n }\n :host([detail-open]) .shell {\n --_detail-w: 20rem;\n }\n :host([detail-open][detail-width=\"comfortable\"]) .shell {\n --_detail-w: 25rem;\n }\n /* Push mode reserves a real grid column, sized only while open — the\n column width doesn't animate (custom properties feeding a grid\n track don't transition smoothly without @property registration),\n so push mode's open/close is an instant snap, unlike overlay\n mode's sliding transform. */\n :host([sidebar-mode=\"push\"][sidebar-open]) .shell {\n --_sidebar-w: var(--component-sidebar-width, 16rem);\n }\n :host([sidebar-mode=\"push\"][sidebar-open][sidebar-width=\"icon\"]) .shell {\n --_sidebar-w: var(--component-sidebar-rail-width, 3.5rem);\n }\n .sidebar {\n /* No grid-area here: an absolutely-positioned grid item's inset\n properties resolve against its OWN grid area's box, not the\n whole grid container, once grid-area is set — even with\n explicit (non-auto) insets. Overlay mode must stay anchored to\n the whole .shell (to overlap the topbar row), so grid-area is\n assigned only in push mode below, where the sidebar is a real,\n in-flow grid item instead of an absolutely-positioned one. */\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: var(--component-sidebar-width, 16rem);\n z-index: 40;\n overflow: hidden;\n border-right: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n transform: translateX(-100%);\n transition: transform 150ms ease;\n }\n :host([sidebar-open]) .sidebar {\n transform: translateX(0);\n }\n :host([sidebar-open]:not([sidebar-mode=\"push\"])) .sidebar {\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n }\n :host([sidebar-width=\"icon\"]) .sidebar {\n width: var(--component-sidebar-rail-width, 3.5rem);\n }\n :host([sidebar-mode=\"push\"]) .sidebar {\n grid-area: sidebar;\n position: static;\n width: 100%;\n transform: none;\n }\n .topbar {\n grid-area: topbar;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-height: var(--component-topbar-height, 3rem);\n padding: 0.5rem 0.75rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n /* Deliberately no z-index here: an explicit z-index on a CSS grid\n item creates a stacking context, which would trap .nav-toggle\n below .sidebar once an overlay-mode sidebar opens and covers this\n corner. See CLAUDE.md before adding one. */\n }\n .nav-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n width: 2rem;\n height: 2rem;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--ui-text-muted, #64748b);\n border-radius: var(--ui-radius-sm, 0.25rem);\n }\n .nav-group {\n position: relative;\n z-index: 41;\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n flex: 0 0 auto;\n }\n .nav-tip {\n position: absolute;\n top: 100%;\n left: 0;\n margin-top: 0.25rem;\n z-index: 10;\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n white-space: nowrap;\n padding: 0.25rem 0.5rem;\n border-radius: var(--ui-radius-sm, 0.25rem);\n background: var(--ui-tooltip, #0f172a);\n color: var(--ui-on-accent, #ffffff);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n opacity: 0;\n visibility: hidden;\n pointer-events: none;\n transition: opacity 120ms ease;\n }\n .nav-toggle:hover + .nav-tip,\n .nav-toggle:focus-visible + .nav-tip {\n opacity: 1;\n visibility: visible;\n }\n .nav-toggle:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .nav-toggle:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .topbar-content {\n flex: 1 1 auto;\n min-width: 0;\n }\n .main {\n grid-area: main;\n min-height: 0;\n min-width: 0;\n overflow: auto;\n padding: 1rem;\n background: var(--component-main-background, var(--ui-surface, #ffffff));\n }\n .detail {\n grid-area: detail;\n display: none;\n min-height: 0;\n overflow: auto;\n border-left: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n }\n :host([detail-open]) .detail {\n display: block;\n }\n .footer {\n grid-area: footer;\n padding: 0.5rem 0.75rem;\n border-top: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n }\n .footer.empty {\n display: none;\n }\n .scrim {\n display: none;\n }\n @media (max-width: 48rem) {\n .shell {\n grid-template-columns: minmax(0, 1fr) var(--_detail-w);\n grid-template-areas:\n \"topbar topbar\"\n \"main detail\"\n \"footer footer\";\n }\n :host([no-topbar]) .shell {\n grid-template-rows: minmax(0, 1fr) auto;\n grid-template-areas:\n \"main detail\"\n \"footer footer\";\n }\n /* Mobile is always a full-screen, position:absolute overlay drawer,\n regardless of sidebar-mode/sidebar-width — those two properties\n only affect the desktop presentation. A full-width sidebar sits\n above .scrim (z-index 40 vs 39), so .scrim's click target is only\n reachable on desktop, where the sidebar doesn't span the whole\n shell — Escape is the mobile dismiss path (see app-shell.spec.ts). */\n .sidebar,\n :host([sidebar-mode=\"push\"]) .sidebar {\n position: absolute;\n width: 100%;\n }\n .detail {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n width: var(--_detail-w, 20rem);\n max-width: calc(100vw - 3rem);\n z-index: 40;\n transform: translateX(110%);\n transition: transform 250ms ease;\n }\n :host([detail-open]) .detail {\n transform: translateX(0);\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n }\n .scrim.show {\n display: block;\n position: absolute;\n inset: 0;\n z-index: 39;\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n border: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .sidebar,\n .detail,\n .nav-tip {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n .nav-toggle:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .nav-tip {\n border: 1px solid CanvasText;\n }\n }\n `,\n ];\n\n private _mediaQuery: MediaQueryList | null = null;\n private _previousFocus: HTMLElement | null = null;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._mediaQuery = window.matchMedia(\"(max-width: 48rem)\");\n this._mobile = this._mediaQuery.matches;\n this._mediaQuery.addEventListener(\"change\", this._onMediaChange);\n window.addEventListener(\"keydown\", this._onKeydown);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._mediaQuery?.removeEventListener(\"change\", this._onMediaChange);\n this._mediaQuery = null;\n window.removeEventListener(\"keydown\", this._onKeydown);\n }\n\n /** Tracks the breakpoint the sidebar's width and modality depend on. */\n private _onMediaChange = (event: MediaQueryListEvent): void => {\n this._mobile = event.matches;\n };\n\n /** Handles the `[` sidebar shortcut and Escape dismissal of mobile overlays. */\n private _onKeydown = (event: KeyboardEvent): void => {\n if (event.defaultPrevented) return;\n if (event.key === \"Escape\" && this._mobile) {\n if (this.detailOpen) {\n event.preventDefault();\n this._closeDetail();\n } else if (this.sidebarOpen) {\n event.preventDefault();\n this.sidebarOpen = false;\n }\n return;\n }\n if (\n event.key === \"[\" &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.altKey &&\n !this._isEditableTarget(event)\n ) {\n event.preventDefault();\n this._toggleSidebar();\n }\n };\n\n /** Whether the keydown originated in a text field, so the shortcut defers to typing. */\n private _isEditableTarget(event: KeyboardEvent): boolean {\n const target = event.composedPath()[0] as HTMLElement | undefined;\n if (!target) return false;\n if (target.isContentEditable) return true;\n const tag = target.tagName;\n return tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\";\n }\n\n /** Toggles the sidebar and announces it. */\n private _toggleSidebar(): void {\n this.sidebarOpen = !this.sidebarOpen;\n if (this._mobile && this.sidebarOpen) {\n this._previousFocus = document.activeElement as HTMLElement | null;\n }\n this.dispatchEvent(\n new CustomEvent<SidebarToggleDetail>(\"sidebar-toggle\", {\n detail: { open: this.sidebarOpen },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n /** Closes the detail overlay and notifies the consumer that owns `detail-open`. */\n private _closeDetail(): void {\n this.detailOpen = false;\n this.dispatchEvent(new CustomEvent(\"detail-close\", { bubbles: true, composed: true }));\n }\n\n /** Scrim click dismisses whichever overlay is open. */\n private _onScrim(): void {\n if (this.detailOpen) this._closeDetail();\n if (this.sidebarOpen) this.sidebarOpen = false;\n }\n\n /** Mirrors `sidebar-width` onto the slotted sidebar's `collapsed` (icon rail) attribute. */\n private _syncSidebarWidth(): void {\n const icon = this.sidebarWidth === \"icon\";\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"sidebar\"]');\n for (const element of slot?.assignedElements() ?? []) {\n element.toggleAttribute(\"collapsed\", icon);\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(\"sidebarWidth\")) this._syncSidebarWidth();\n if (!changed.has(\"sidebarOpen\") || !this._mobile) return;\n if (this.sidebarOpen) {\n this.shadowRoot?.querySelector<HTMLElement>(\".sidebar\")?.focus();\n return;\n }\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n }\n\n override render() {\n const scrimActive = this._mobile && (this.sidebarOpen || this.detailOpen);\n return html`\n <div class=\"shell\">\n <aside\n class=\"sidebar\"\n tabindex=\"-1\"\n aria-label=\"Primary\"\n ?inert=${!this.sidebarOpen}\n aria-hidden=${String(!this.sidebarOpen)}\n >\n <slot name=\"sidebar\" @slotchange=${this._syncSidebarWidth}></slot>\n </aside>\n ${this.noTopbar\n ? nothing\n : html`\n <header class=\"topbar\">\n <div class=\"nav-group\">\n <button\n class=\"nav-toggle\"\n type=\"button\"\n aria-label=\"Toggle navigation\"\n aria-keyshortcuts=\"[\"\n aria-describedby=\"nav-tip\"\n aria-expanded=${String(this.sidebarOpen)}\n @click=${this._toggleSidebar}\n >\n ${iconBars3(18)}\n </button>\n <span class=\"nav-tip\" id=\"nav-tip\" role=\"tooltip\">\n <span>${this.sidebarOpen ? \"Hide navigation\" : \"Show navigation\"}</span>\n <kbd-hint keys=\"[\"></kbd-hint>\n </span>\n </div>\n <div class=\"topbar-content\"><slot name=\"topbar\"></slot></div>\n </header>\n `}\n <main class=\"main\"><slot></slot></main>\n <aside\n class=\"detail\"\n aria-label=\"Detail\"\n ?inert=${!this.detailOpen}\n aria-hidden=${String(!this.detailOpen)}\n >\n <slot name=\"detail\"></slot>\n </aside>\n <footer class=\"footer ${this._hasFooter ? \"\" : \"empty\"}\">\n <slot name=\"footer\" @slotchange=${this._onFooterSlotChange}></slot>\n </footer>\n <button\n class=\"scrim ${scrimActive ? \"show\" : \"\"}\"\n type=\"button\"\n tabindex=\"-1\"\n aria-label=\"Close\"\n @click=${this._onScrim}\n ?hidden=${!scrimActive}\n ></button>\n </div>\n `;\n }\n\n /** Collapses the footer row when nothing is slotted into it. */\n private _onFooterSlotChange(event: Event): void {\n this._hasFooter = (event.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"app-shell\": AppShell;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"app-shell.js","sourceRoot":"","sources":["../src/app-shell.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QACL,0EAA0E;QACH,gBAAW,GAAG,KAAK,CAAC;QAC3F,uGAAuG;QAC/C,gBAAW,GAAuB,SAAS,CAAC;QACpG,uGAAuG;QAC9C,iBAAY,GAAoB,MAAM,CAAC;QAChG,gFAAgF;QACV,eAAU,GAAG,KAAK,CAAC;QACzF,gEAAgE;QACvB,gBAAW,GAA8B,SAAS,CAAC;QAC5F,+MAA+M;QAC3I,aAAQ,GAAG,KAAK,CAAC;QAErF,6DAA6D;QAC5C,YAAO,GAAG,KAAK,CAAC;QACjC,oDAAoD;QACnC,eAAU,GAAG,KAAK,CAAC;QA0Q5B,gBAAW,GAA0B,IAAI,CAAC;QAC1C,mBAAc,GAAuB,IAAI,CAAC;QAiBlD,wEAAwE;QAChE,mBAAc,GAAG,CAAC,KAA0B,EAAQ,EAAE;YAC5D,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC/B,CAAC,CAAC;QAEF,gFAAgF;QACxE,eAAU,GAAG,CAAC,KAAoB,EAAQ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,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;6CAAqB;AAEnC;IAAvD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;6CAA6C;AAE3C;IAAxD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;8CAAwC;AAE1B;IAArE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;4CAAoB;AAEhD;IAAxC,QAAQ,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;6CAAoD;AAExB;IAAnE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;0CAAkB;AAGpE;IAAhB,KAAK,EAAE;yCAAyB;AAEhB;IAAhB,KAAK,EAAE;4CAA4B;AAjBzB,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAocpB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { iconBars3 } from \"./icons.js\";\nimport \"./kbd-hint.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** Fired when the built-in toggle changes the sidebar state. */\nexport interface SidebarToggleDetail {\n /** Whether the sidebar is now open. */\n open: boolean;\n}\n\n/**\n * The dashboard page shell: a slot-based CSS-grid backbone that arranges a\n * top bar, the main content, an optional right-hand detail column, an\n * optional footer, and a sidebar. The top bar always spans the shell's full\n * width, in every sidebar state.\n *\n * The sidebar's visibility, width, and layout mode are three independent\n * properties:\n * - `sidebar-open` (default closed) — whether it's shown at all.\n * - `sidebar-width`: `\"full\"` (16rem, icons + labels, the default) or\n * `\"icon\"` (3.5rem rail, icons only — drives the slotted `app-sidebar`'s\n * own `collapsed` attribute).\n * - `sidebar-mode`: `\"overlay\"` (the default) floats the sidebar above the\n * shell's own content with a higher z-index, covering part of the top\n * bar's corner and whatever content sits beneath it, without ever\n * resizing or reflowing `main`/`footer`. `\"push\"` instead reserves a real\n * grid column beside `main`/`footer` (which resize to make room) — the\n * top bar still spans full width above it either way.\n *\n * Below the shared 48rem breakpoint the sidebar always behaves as a\n * full-width, modal, scrim/Escape-dismissible drawer regardless of\n * `sidebar-mode`/`sidebar-width` — those two properties only affect the\n * desktop presentation. Above 48rem, an `overlay`-mode sidebar is a\n * non-modal panel (no dimming scrim, no Escape-dismiss, since it reads as\n * an ordinary always-interactive panel rather than a blocking dialog); a\n * `push`-mode sidebar is even more clearly non-modal, since it never\n * covers anything.\n *\n * The right-hand detail column is unaffected by any of the above: it still\n * reserves an inline grid column on desktop and becomes a dismissible\n * overlay (scrim/Escape) on mobile.\n *\n * Widths are tunable per instance via `--component-sidebar-width` (16rem),\n * `--component-sidebar-rail-width` (3.5rem), and `--component-topbar-height`\n * (3rem); the detail column reuses the 20rem/25rem panel widths. The main\n * content area is white by default — override it with\n * `--component-main-background`. Give the shell a height (e.g. `height:\n * 100vh`) so the sidebar and main can size and scroll.\n *\n * Hovering or keyboard-focusing the toggle reveals a tooltip naming the\n * action and its `[` shortcut — the shortcut is not shown as permanent\n * chrome.\n *\n * Consumers with their own external top bar can set `no-topbar` to skip\n * rendering the built-in topbar row and toggle button entirely (the grid\n * drops that row rather than leaving dead space). The `[`/Escape shortcuts\n * stay fully active either way — drive `sidebar-open` from your own UI and\n * listen for `sidebar-toggle` to stay in sync with keyboard-driven changes.\n *\n * @element app-shell\n * @slot - Main content area.\n * @slot sidebar - Sidebar navigation (typically `app-sidebar`).\n * @slot topbar - Top bar content, right of the built-in toggle.\n * @slot detail - Optional right-hand detail; shown when `detail-open` is set.\n * @slot footer - Optional footer beneath the main content.\n * @fires sidebar-toggle - The built-in toggle changed the sidebar state.\n * @fires detail-close - The scrim or Escape dismissed the mobile detail overlay.\n */\n@customElement(\"app-shell\")\nexport class AppShell extends LitElement {\n /** Whether the sidebar is open. Closed by default at every breakpoint. */\n @property({ type: Boolean, reflect: true, attribute: \"sidebar-open\" }) sidebarOpen = false;\n /** `\"overlay\"` (default) floats the sidebar above content; `\"push\"` reserves a grid column instead. */\n @property({ reflect: true, attribute: \"sidebar-mode\" }) sidebarMode: \"overlay\" | \"push\" = \"overlay\";\n /** Sidebar width when open: `\"full\"` (16rem, icons + labels) or `\"icon\"` (3.5rem rail, icons only). */\n @property({ reflect: true, attribute: \"sidebar-width\" }) sidebarWidth: \"full\" | \"icon\" = \"full\";\n /** Shows the right-hand detail region (inline column, or overlay on mobile). */\n @property({ type: Boolean, reflect: true, attribute: \"detail-open\" }) detailOpen = false;\n /** Detail width: `compact` (20rem) or `comfortable` (25rem). */\n @property({ attribute: \"detail-width\" }) detailWidth: \"compact\" | \"comfortable\" = \"compact\";\n /** Skips rendering the built-in topbar row and its nav toggle entirely, for consumers with their own external top bar. The `[`/Escape shortcuts stay active regardless — this only affects what's rendered. */\n @property({ type: Boolean, reflect: true, attribute: \"no-topbar\" }) noTopbar = false;\n\n /** Whether the viewport is at/below the 48rem breakpoint. */\n @state() private _mobile = false;\n /** Whether the footer slot has assigned content. */\n @state() private _hasFooter = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n block-size: 100%;\n }\n .shell {\n --_sidebar-w: 0px;\n --_detail-w: 0px;\n display: grid;\n grid-template-columns: var(--_sidebar-w) minmax(0, 1fr) var(--_detail-w);\n grid-template-rows: auto minmax(0, 1fr) auto;\n grid-template-areas:\n \"topbar topbar topbar\"\n \"sidebar main detail\"\n \"sidebar footer footer\";\n position: relative;\n block-size: 100%;\n min-height: 0;\n background: var(--ui-surface, #ffffff);\n }\n /* no-topbar drops the topbar row from the grid rather than rendering\n an empty one — the header element itself is skipped in render(). */\n :host([no-topbar]) .shell {\n grid-template-rows: minmax(0, 1fr) auto;\n grid-template-areas:\n \"sidebar main detail\"\n \"sidebar footer footer\";\n }\n :host([detail-open]) .shell {\n --_detail-w: 20rem;\n }\n :host([detail-open][detail-width=\"comfortable\"]) .shell {\n --_detail-w: 25rem;\n }\n /* Push mode reserves a real grid column, sized only while open — the\n column width doesn't animate (custom properties feeding a grid\n track don't transition smoothly without @property registration),\n so push mode's open/close is an instant snap, unlike overlay\n mode's sliding transform. */\n :host([sidebar-mode=\"push\"][sidebar-open]) .shell {\n --_sidebar-w: var(--component-sidebar-width, 16rem);\n }\n :host([sidebar-mode=\"push\"][sidebar-open][sidebar-width=\"icon\"]) .shell {\n --_sidebar-w: var(--component-sidebar-rail-width, 3.5rem);\n }\n .sidebar {\n /* No grid-area here: an absolutely-positioned grid item's inset\n properties resolve against its OWN grid area's box, not the\n whole grid container, once grid-area is set — even with\n explicit (non-auto) insets. Overlay mode must stay anchored to\n the whole .shell (to overlap the topbar row), so grid-area is\n assigned only in push mode below, where the sidebar is a real,\n in-flow grid item instead of an absolutely-positioned one. */\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: var(--component-sidebar-width, 16rem);\n z-index: 40;\n overflow: hidden;\n border-right: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n transform: translateX(-100%);\n transition: transform 150ms ease;\n }\n :host([sidebar-open]) .sidebar {\n transform: translateX(0);\n }\n :host([sidebar-open]:not([sidebar-mode=\"push\"])) .sidebar {\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n }\n :host([sidebar-width=\"icon\"]) .sidebar {\n width: var(--component-sidebar-rail-width, 3.5rem);\n }\n :host([sidebar-mode=\"push\"]) .sidebar {\n grid-area: sidebar;\n position: static;\n width: 100%;\n transform: none;\n }\n .topbar {\n grid-area: topbar;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-height: var(--component-topbar-height, 3rem);\n padding: 0.5rem 0.75rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n /* Deliberately no z-index here: an explicit z-index on a CSS grid\n item creates a stacking context, which would trap .nav-toggle\n below .sidebar once an overlay-mode sidebar opens and covers this\n corner. See CLAUDE.md before adding one. */\n }\n .nav-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n width: 2rem;\n height: 2rem;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--ui-text-muted, #64748b);\n border-radius: var(--ui-radius-sm, 0.25rem);\n }\n .nav-group {\n position: relative;\n z-index: 41;\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n flex: 0 0 auto;\n }\n .nav-tip {\n position: absolute;\n top: 100%;\n left: 0;\n margin-top: 0.25rem;\n z-index: 10;\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n white-space: nowrap;\n padding: 0.25rem 0.5rem;\n border-radius: var(--ui-radius-sm, 0.25rem);\n background: var(--ui-tooltip, #0f172a);\n color: var(--ui-tooltip-text, #ffffff);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n opacity: 0;\n visibility: hidden;\n pointer-events: none;\n transition: opacity 120ms ease;\n }\n .nav-toggle:hover + .nav-tip,\n .nav-toggle:focus-visible + .nav-tip {\n opacity: 1;\n visibility: visible;\n }\n .nav-toggle:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .nav-toggle:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .topbar-content {\n flex: 1 1 auto;\n min-width: 0;\n }\n .main {\n grid-area: main;\n min-height: 0;\n min-width: 0;\n overflow: auto;\n padding: 1rem;\n background: var(--component-main-background, var(--ui-surface, #ffffff));\n }\n .detail {\n grid-area: detail;\n display: none;\n min-height: 0;\n overflow: auto;\n border-left: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n }\n :host([detail-open]) .detail {\n display: block;\n }\n .footer {\n grid-area: footer;\n padding: 0.5rem 0.75rem;\n border-top: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n }\n .footer.empty {\n display: none;\n }\n .scrim {\n display: none;\n }\n @media (max-width: 48rem) {\n .shell {\n grid-template-columns: minmax(0, 1fr) var(--_detail-w);\n grid-template-areas:\n \"topbar topbar\"\n \"main detail\"\n \"footer footer\";\n }\n :host([no-topbar]) .shell {\n grid-template-rows: minmax(0, 1fr) auto;\n grid-template-areas:\n \"main detail\"\n \"footer footer\";\n }\n /* Mobile is always a full-screen, position:absolute overlay drawer,\n regardless of sidebar-mode/sidebar-width — those two properties\n only affect the desktop presentation. A full-width sidebar sits\n above .scrim (z-index 40 vs 39), so .scrim's click target is only\n reachable on desktop, where the sidebar doesn't span the whole\n shell — Escape is the mobile dismiss path (see app-shell.spec.ts). */\n .sidebar,\n :host([sidebar-mode=\"push\"]) .sidebar {\n position: absolute;\n width: 100%;\n }\n .detail {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n width: var(--_detail-w, 20rem);\n max-width: calc(100vw - 3rem);\n z-index: 40;\n transform: translateX(110%);\n transition: transform 250ms ease;\n }\n :host([detail-open]) .detail {\n transform: translateX(0);\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n }\n .scrim.show {\n display: block;\n position: absolute;\n inset: 0;\n z-index: 39;\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n border: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .sidebar,\n .detail,\n .nav-tip {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n .nav-toggle:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .nav-tip {\n border: 1px solid CanvasText;\n }\n }\n `,\n ];\n\n private _mediaQuery: MediaQueryList | null = null;\n private _previousFocus: HTMLElement | null = null;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._mediaQuery = window.matchMedia(\"(max-width: 48rem)\");\n this._mobile = this._mediaQuery.matches;\n this._mediaQuery.addEventListener(\"change\", this._onMediaChange);\n window.addEventListener(\"keydown\", this._onKeydown);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._mediaQuery?.removeEventListener(\"change\", this._onMediaChange);\n this._mediaQuery = null;\n window.removeEventListener(\"keydown\", this._onKeydown);\n }\n\n /** Tracks the breakpoint the sidebar's width and modality depend on. */\n private _onMediaChange = (event: MediaQueryListEvent): void => {\n this._mobile = event.matches;\n };\n\n /** Handles the `[` sidebar shortcut and Escape dismissal of mobile overlays. */\n private _onKeydown = (event: KeyboardEvent): void => {\n if (event.defaultPrevented) return;\n if (event.key === \"Escape\" && this._mobile) {\n if (this.detailOpen) {\n event.preventDefault();\n this._closeDetail();\n } else if (this.sidebarOpen) {\n event.preventDefault();\n this.sidebarOpen = false;\n }\n return;\n }\n if (\n event.key === \"[\" &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.altKey &&\n !this._isEditableTarget(event)\n ) {\n event.preventDefault();\n this._toggleSidebar();\n }\n };\n\n /** Whether the keydown originated in a text field, so the shortcut defers to typing. */\n private _isEditableTarget(event: KeyboardEvent): boolean {\n const target = event.composedPath()[0] as HTMLElement | undefined;\n if (!target) return false;\n if (target.isContentEditable) return true;\n const tag = target.tagName;\n return tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\";\n }\n\n /** Toggles the sidebar and announces it. */\n private _toggleSidebar(): void {\n this.sidebarOpen = !this.sidebarOpen;\n if (this._mobile && this.sidebarOpen) {\n this._previousFocus = document.activeElement as HTMLElement | null;\n }\n this.dispatchEvent(\n new CustomEvent<SidebarToggleDetail>(\"sidebar-toggle\", {\n detail: { open: this.sidebarOpen },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n /** Closes the detail overlay and notifies the consumer that owns `detail-open`. */\n private _closeDetail(): void {\n this.detailOpen = false;\n this.dispatchEvent(new CustomEvent(\"detail-close\", { bubbles: true, composed: true }));\n }\n\n /** Scrim click dismisses whichever overlay is open. */\n private _onScrim(): void {\n if (this.detailOpen) this._closeDetail();\n if (this.sidebarOpen) this.sidebarOpen = false;\n }\n\n /** Mirrors `sidebar-width` onto the slotted sidebar's `collapsed` (icon rail) attribute. */\n private _syncSidebarWidth(): void {\n const icon = this.sidebarWidth === \"icon\";\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"sidebar\"]');\n for (const element of slot?.assignedElements() ?? []) {\n element.toggleAttribute(\"collapsed\", icon);\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(\"sidebarWidth\")) this._syncSidebarWidth();\n if (!changed.has(\"sidebarOpen\") || !this._mobile) return;\n if (this.sidebarOpen) {\n this.shadowRoot?.querySelector<HTMLElement>(\".sidebar\")?.focus();\n return;\n }\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n }\n\n override render() {\n const scrimActive = this._mobile && (this.sidebarOpen || this.detailOpen);\n return html`\n <div class=\"shell\">\n <aside\n class=\"sidebar\"\n tabindex=\"-1\"\n aria-label=\"Primary\"\n ?inert=${!this.sidebarOpen}\n aria-hidden=${String(!this.sidebarOpen)}\n >\n <slot name=\"sidebar\" @slotchange=${this._syncSidebarWidth}></slot>\n </aside>\n ${this.noTopbar\n ? nothing\n : html`\n <header class=\"topbar\">\n <div class=\"nav-group\">\n <button\n class=\"nav-toggle\"\n type=\"button\"\n aria-label=\"Toggle navigation\"\n aria-keyshortcuts=\"[\"\n aria-describedby=\"nav-tip\"\n aria-expanded=${String(this.sidebarOpen)}\n @click=${this._toggleSidebar}\n >\n ${iconBars3(18)}\n </button>\n <span class=\"nav-tip\" id=\"nav-tip\" role=\"tooltip\">\n <span>${this.sidebarOpen ? \"Hide navigation\" : \"Show navigation\"}</span>\n <kbd-hint keys=\"[\"></kbd-hint>\n </span>\n </div>\n <div class=\"topbar-content\"><slot name=\"topbar\"></slot></div>\n </header>\n `}\n <main class=\"main\"><slot></slot></main>\n <aside\n class=\"detail\"\n aria-label=\"Detail\"\n ?inert=${!this.detailOpen}\n aria-hidden=${String(!this.detailOpen)}\n >\n <slot name=\"detail\"></slot>\n </aside>\n <footer class=\"footer ${this._hasFooter ? \"\" : \"empty\"}\">\n <slot name=\"footer\" @slotchange=${this._onFooterSlotChange}></slot>\n </footer>\n <button\n class=\"scrim ${scrimActive ? \"show\" : \"\"}\"\n type=\"button\"\n tabindex=\"-1\"\n aria-label=\"Close\"\n @click=${this._onScrim}\n ?hidden=${!scrimActive}\n ></button>\n </div>\n `;\n }\n\n /** Collapses the footer row when nothing is slotted into it. */\n private _onFooterSlotChange(event: Event): void {\n this._hasFooter = (event.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"app-shell\": AppShell;\n }\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* A small inline blinking cursor glyph for terminal- or editor-styled
|
|
4
|
+
* headings, prompts, and status lines. It renders its own decorative
|
|
5
|
+
* character so consumers can append it directly to adjacent text while
|
|
6
|
+
* inheriting the surrounding typography.
|
|
7
|
+
*
|
|
8
|
+
* The cursor uses the shared `--ui-primary` accent color so it reads as an
|
|
9
|
+
* active insertion point across themes. Change `char` to swap the glyph (for
|
|
10
|
+
* example `|` or `▋`). Under `prefers-reduced-motion` the blink stops and the
|
|
11
|
+
* cursor remains visible.
|
|
12
|
+
*
|
|
13
|
+
* @element blink-cursor
|
|
14
|
+
*/
|
|
15
|
+
export declare class BlinkCursor extends LitElement {
|
|
16
|
+
static styles: import("lit").CSSResult[];
|
|
17
|
+
/** Character shown for the cursor; any single character or short string such as `|` or `▋` works. */
|
|
18
|
+
char: string;
|
|
19
|
+
connectedCallback(): void;
|
|
20
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
21
|
+
}
|
|
22
|
+
declare global {
|
|
23
|
+
interface HTMLElementTagNameMap {
|
|
24
|
+
"blink-cursor": BlinkCursor;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=blink-cursor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blink-cursor.d.ts","sourceRoot":"","sources":["../src/blink-cursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C;;;;;;;;;;;;GAYG;AACH,qBACa,WAAY,SAAQ,UAAU;IACzC,OAAgB,MAAM,4BAiCpB;IAEF,qGAAqG;IACzF,IAAI,SAAO;IAEd,iBAAiB,IAAI,IAAI,CAGjC;IAEQ,MAAM,yCAEd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, css, html } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { tokens } from "./tokens.js";
|
|
10
|
+
/**
|
|
11
|
+
* A small inline blinking cursor glyph for terminal- or editor-styled
|
|
12
|
+
* headings, prompts, and status lines. It renders its own decorative
|
|
13
|
+
* character so consumers can append it directly to adjacent text while
|
|
14
|
+
* inheriting the surrounding typography.
|
|
15
|
+
*
|
|
16
|
+
* The cursor uses the shared `--ui-primary` accent color so it reads as an
|
|
17
|
+
* active insertion point across themes. Change `char` to swap the glyph (for
|
|
18
|
+
* example `|` or `▋`). Under `prefers-reduced-motion` the blink stops and the
|
|
19
|
+
* cursor remains visible.
|
|
20
|
+
*
|
|
21
|
+
* @element blink-cursor
|
|
22
|
+
*/
|
|
23
|
+
let BlinkCursor = class BlinkCursor extends LitElement {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
/** Character shown for the cursor; any single character or short string such as `|` or `▋` works. */
|
|
27
|
+
this.char = "▋";
|
|
28
|
+
}
|
|
29
|
+
static { this.styles = [
|
|
30
|
+
tokens,
|
|
31
|
+
css `
|
|
32
|
+
:host {
|
|
33
|
+
display: inline-block;
|
|
34
|
+
line-height: var(--ui-line-height-glyph, 1);
|
|
35
|
+
color: var(--ui-primary, #4f46e5);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.cursor {
|
|
39
|
+
display: inline-block;
|
|
40
|
+
white-space: pre;
|
|
41
|
+
animation: blink-cursor-blink 1s steps(1, end) infinite;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@keyframes blink-cursor-blink {
|
|
45
|
+
0%,
|
|
46
|
+
50% {
|
|
47
|
+
opacity: 1;
|
|
48
|
+
}
|
|
49
|
+
50.01%,
|
|
50
|
+
100% {
|
|
51
|
+
opacity: 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@media (prefers-reduced-motion: reduce) {
|
|
56
|
+
.cursor {
|
|
57
|
+
animation: none;
|
|
58
|
+
opacity: 1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`,
|
|
62
|
+
]; }
|
|
63
|
+
connectedCallback() {
|
|
64
|
+
super.connectedCallback();
|
|
65
|
+
this.setAttribute("aria-hidden", "true");
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
return html `<span class="cursor">${this.char}</span>`;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
__decorate([
|
|
72
|
+
property()
|
|
73
|
+
], BlinkCursor.prototype, "char", void 0);
|
|
74
|
+
BlinkCursor = __decorate([
|
|
75
|
+
customElement("blink-cursor")
|
|
76
|
+
], BlinkCursor);
|
|
77
|
+
export { BlinkCursor };
|
|
78
|
+
//# sourceMappingURL=blink-cursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blink-cursor.js","sourceRoot":"","sources":["../src/blink-cursor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;GAYG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAoCL,qGAAqG;QACzF,SAAI,GAAG,GAAG,CAAC;IAUzB,CAAC;aA9CiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BF;KACF,AAjCqB,CAiCpB;IAKO,iBAAiB;QACxB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA,wBAAwB,IAAI,CAAC,IAAI,SAAS,CAAC;IACxD,CAAC;CACF,CAAA;AAVa;IAAX,QAAQ,EAAE;yCAAY;AArCZ,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA+CvB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A small inline blinking cursor glyph for terminal- or editor-styled\n * headings, prompts, and status lines. It renders its own decorative\n * character so consumers can append it directly to adjacent text while\n * inheriting the surrounding typography.\n *\n * The cursor uses the shared `--ui-primary` accent color so it reads as an\n * active insertion point across themes. Change `char` to swap the glyph (for\n * example `|` or `▋`). Under `prefers-reduced-motion` the blink stops and the\n * cursor remains visible.\n *\n * @element blink-cursor\n */\n@customElement(\"blink-cursor\")\nexport class BlinkCursor extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-block;\n line-height: var(--ui-line-height-glyph, 1);\n color: var(--ui-primary, #4f46e5);\n }\n\n .cursor {\n display: inline-block;\n white-space: pre;\n animation: blink-cursor-blink 1s steps(1, end) infinite;\n }\n\n @keyframes blink-cursor-blink {\n 0%,\n 50% {\n opacity: 1;\n }\n 50.01%,\n 100% {\n opacity: 0;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .cursor {\n animation: none;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Character shown for the cursor; any single character or short string such as `|` or `▋` works. */\n @property() char = \"▋\";\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.setAttribute(\"aria-hidden\", \"true\");\n }\n\n override render() {\n return html`<span class=\"cursor\">${this.char}</span>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"blink-cursor\": BlinkCursor;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.d.ts","sourceRoot":"","sources":["../src/button-group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAKrD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAID;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBACa,WAAY,SAAQ,UAAU;;IACzC,OAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"button-group.d.ts","sourceRoot":"","sources":["../src/button-group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAKrD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAID;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBACa,WAAY,SAAQ,UAAU;;IACzC,OAAgB,MAAM,4BAwIpB;IAEF,2CAA2C;IACX,OAAO,EAAE,iBAAiB,EAAE,CAAM;IAClE,gCAAgC;IACpB,KAAK,SAAM;IACvB,gDAAgD;IACnB,QAAQ,UAAS;IAC9C,oFAAoF;IAChB,QAAQ,UAAS;IACrF,uFAAuF;IAC1D,IAAI,EAAE,IAAI,GAAG,IAAI,CAAQ;IAItD,OAAO,CAAC,SAAS;IAQR,MAAM,sBAwBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|
package/dist/button-group.js
CHANGED
|
@@ -55,6 +55,9 @@ let ButtonGroup = class ButtonGroup extends LitElement {
|
|
|
55
55
|
display: flex;
|
|
56
56
|
border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
57
57
|
border-radius: var(--ui-radius-sm, 0.25rem);
|
|
58
|
+
/* The segments paint their own base, but the strip's rounded corners
|
|
59
|
+
sit outside them and would otherwise show the page through. */
|
|
60
|
+
background: var(--ui-surface, #ffffff);
|
|
58
61
|
overflow: hidden;
|
|
59
62
|
}
|
|
60
63
|
.segment {
|
package/dist/button-group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.js","sourceRoot":"","sources":["../src/button-group.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;;;;;;;;;;GAoBG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAwIL,2CAA2C;QACX,YAAO,GAAwB,EAAE,CAAC;QAClE,gCAAgC;QACpB,UAAK,GAAG,EAAE,CAAC;QACvB,gDAAgD;QACnB,aAAQ,GAAG,KAAK,CAAC;QAC9C,oFAAoF;QAChB,aAAQ,GAAG,KAAK,CAAC;QACrF,uFAAuF;QAC1D,SAAI,GAAgB,IAAI,CAAC;QAE7C,UAAK,GAAG,gBAAgB,EAAE,aAAa,EAAE,CAAC;IAmCrD,CAAC;aArLiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkIF;KACF,AArIqB,CAqIpB;IAaO,KAAK,CAAqC;IAE3C,SAAS,CAAC,KAAa;QAC7B,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,KAAK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,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAA0B;AAjJ3C,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAsLvB","sourcesContent":["import type { TemplateResult } from \"lit\";\nimport { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface ButtonGroupOption {\n value: string;\n label: string;\n /** Optional pre-rendered icon template displayed before the label. */\n icon?: TemplateResult;\n}\n\nlet instanceCount = 0;\n\n/**\n * Single-select segmented control — a strip of buttons joined into one\n * shared-border shape, for a small, persistent set of mutually exclusive\n * choices (a view switcher, a theme picker) where the *currently selected*\n * option should read as visually \"pressed,\" not just checked. For many\n * short, individually pill-shaped choices, use `radio-pills` instead. Wraps\n * native radio inputs for keyboard/a11y and fires `change` rather than\n * relying on form submission. Set `size=\"sm\"` for a compact strip one step\n * below the default, matching `ui-button`'s `sm` size.\n *\n * The checked segment reads `--ui-button-background`/`-hover`/`-active`,\n * same as `ui-button`'s `primary` variant. Unchecked segments are treated as\n * `ui-button`'s `secondary` variant: they read the shared\n * `--ui-button-secondary-background`/`-active` (rest/pressed) so a gradient\n * theme applies consistently, but use the shared `--ui-button-secondary-surface-muted`\n * (also used by `pagination-nav`) for hover, since — unlike `secondary` — an\n * unchecked segment already paints `--ui-surface-muted` on hover by default.\n *\n * @element button-group\n * @fires change - A segment was selected; detail: { value }.\n */\n@customElement(\"button-group\")\nexport class ButtonGroup extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-block;\n }\n .group {\n display: flex;\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n overflow: hidden;\n }\n .segment {\n position: relative;\n display: flex;\n flex: 1 1 auto;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n height: 2rem;\n box-sizing: border-box;\n padding: 0.5rem 0.75rem;\n border-left: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n cursor: pointer;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n white-space: nowrap;\n /* Opaque base under the transparent-by-default secondary token, so an\n unchecked segment reads as a solid control rather than letting a\n textured or tinted page show through. See ui-button's secondary. */\n background:\n var(--ui-button-secondary-background, none),\n var(--ui-surface, #ffffff);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .segment:first-child {\n border-left: none;\n border-top-left-radius: var(--ui-radius-sm, 0.25rem);\n border-bottom-left-radius: var(--ui-radius-sm, 0.25rem);\n }\n .segment:last-child {\n border-top-right-radius: var(--ui-radius-sm, 0.25rem);\n border-bottom-right-radius: var(--ui-radius-sm, 0.25rem);\n }\n .segment:has(input:checked) {\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n color: var(--ui-on-accent, #ffffff);\n text-shadow: var(--ui-button-text-shadow, none);\n }\n .segment:not(:has(input:checked)):hover {\n background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));\n }\n .segment:not(:has(input:checked)):active {\n background:\n var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none)),\n var(--ui-surface, #ffffff);\n box-shadow: none;\n }\n .segment input {\n /* Fills the whole segment (not visually-hidden-offscreen) so a real\n click anywhere in the segment — including a test driver clicking\n the input by its accessible role — lands on the input itself,\n not just via native <label> click delegation. */\n position: absolute;\n inset: 0;\n margin: 0;\n opacity: 0;\n cursor: pointer;\n }\n /* Clipped by the group's own overflow:hidden unless promoted above its\n neighbors — the focus ring needs a stacking context of its own. */\n .segment:has(input:focus-visible) {\n z-index: 1;\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .segment:has(input:focus-visible):not(:active) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .segment:has(input:disabled) {\n cursor: not-allowed;\n opacity: 0.6;\n }\n :host([icon-only]) .segment {\n padding: 0.5rem;\n }\n :host([size=\"sm\"]) .segment {\n height: 1.5rem;\n padding: 0.25rem 0.5rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n :host([icon-only][size=\"sm\"]) .segment {\n padding: 0.25rem;\n }\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n @media (forced-colors: active) {\n .segment:has(input:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .segment:has(input:checked) {\n background: Highlight;\n color: HighlightText;\n }\n .segment:has(input:disabled) {\n color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Options to render, one segment each. */\n @property({ attribute: false }) options: ButtonGroupOption[] = [];\n /** Currently selected value. */\n @property() value = \"\";\n /** Disables every native radio in the group. */\n @property({ type: Boolean }) disabled = false;\n /** Hides labels visually (icons only) while keeping them as the accessible name. */\n @property({ type: Boolean, reflect: true, attribute: \"icon-only\" }) iconOnly = false;\n /** Size — `sm` reduces segment height/padding/font-size one step below the default. */\n @property({ reflect: true }) size: \"sm\" | \"md\" = \"md\";\n\n readonly #name = `button-group-${++instanceCount}`;\n\n private _onChange(value: string) {\n if (this.disabled) return;\n this.value = value;\n this.dispatchEvent(\n new CustomEvent(\"change\", { detail: { value }, bubbles: true, composed: true }),\n );\n }\n\n override render() {\n return html`\n <div class=\"group\">\n ${repeat(\n this.options,\n (opt) => opt.value,\n (opt) => html`\n <label class=\"segment\">\n <input\n type=\"radio\"\n name=${this.#name}\n ?checked=${this.value === opt.value}\n ?disabled=${this.disabled}\n aria-label=${this.iconOnly ? opt.label : nothing}\n title=${this.iconOnly ? opt.label : nothing}\n @change=${() => this._onChange(opt.value)}\n />\n ${opt.icon ?? nothing}\n <span class=${this.iconOnly ? \"sr-only\" : \"\"}>${opt.label}</span>\n </label>\n `,\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"button-group\": ButtonGroup;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"button-group.js","sourceRoot":"","sources":["../src/button-group.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;;;;;;;;;;GAoBG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QA2IL,2CAA2C;QACX,YAAO,GAAwB,EAAE,CAAC;QAClE,gCAAgC;QACpB,UAAK,GAAG,EAAE,CAAC;QACvB,gDAAgD;QACnB,aAAQ,GAAG,KAAK,CAAC;QAC9C,oFAAoF;QAChB,aAAQ,GAAG,KAAK,CAAC;QACrF,uFAAuF;QAC1D,SAAI,GAAgB,IAAI,CAAC;QAE7C,UAAK,GAAG,gBAAgB,EAAE,aAAa,EAAE,CAAC;IAmCrD,CAAC;aAxLiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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E,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAkB;AAEsB;IAAnE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;6CAAkB;AAExD;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAA0B;AApJ3C,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAyLvB","sourcesContent":["import type { TemplateResult } from \"lit\";\nimport { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface ButtonGroupOption {\n value: string;\n label: string;\n /** Optional pre-rendered icon template displayed before the label. */\n icon?: TemplateResult;\n}\n\nlet instanceCount = 0;\n\n/**\n * Single-select segmented control — a strip of buttons joined into one\n * shared-border shape, for a small, persistent set of mutually exclusive\n * choices (a view switcher, a theme picker) where the *currently selected*\n * option should read as visually \"pressed,\" not just checked. For many\n * short, individually pill-shaped choices, use `radio-pills` instead. Wraps\n * native radio inputs for keyboard/a11y and fires `change` rather than\n * relying on form submission. Set `size=\"sm\"` for a compact strip one step\n * below the default, matching `ui-button`'s `sm` size.\n *\n * The checked segment reads `--ui-button-background`/`-hover`/`-active`,\n * same as `ui-button`'s `primary` variant. Unchecked segments are treated as\n * `ui-button`'s `secondary` variant: they read the shared\n * `--ui-button-secondary-background`/`-active` (rest/pressed) so a gradient\n * theme applies consistently, but use the shared `--ui-button-secondary-surface-muted`\n * (also used by `pagination-nav`) for hover, since — unlike `secondary` — an\n * unchecked segment already paints `--ui-surface-muted` on hover by default.\n *\n * @element button-group\n * @fires change - A segment was selected; detail: { value }.\n */\n@customElement(\"button-group\")\nexport class ButtonGroup extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-block;\n }\n .group {\n display: flex;\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n /* The segments paint their own base, but the strip's rounded corners\n sit outside them and would otherwise show the page through. */\n background: var(--ui-surface, #ffffff);\n overflow: hidden;\n }\n .segment {\n position: relative;\n display: flex;\n flex: 1 1 auto;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n height: 2rem;\n box-sizing: border-box;\n padding: 0.5rem 0.75rem;\n border-left: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n cursor: pointer;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n white-space: nowrap;\n /* Opaque base under the transparent-by-default secondary token, so an\n unchecked segment reads as a solid control rather than letting a\n textured or tinted page show through. See ui-button's secondary. */\n background:\n var(--ui-button-secondary-background, none),\n var(--ui-surface, #ffffff);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .segment:first-child {\n border-left: none;\n border-top-left-radius: var(--ui-radius-sm, 0.25rem);\n border-bottom-left-radius: var(--ui-radius-sm, 0.25rem);\n }\n .segment:last-child {\n border-top-right-radius: var(--ui-radius-sm, 0.25rem);\n border-bottom-right-radius: var(--ui-radius-sm, 0.25rem);\n }\n .segment:has(input:checked) {\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n color: var(--ui-on-accent, #ffffff);\n text-shadow: var(--ui-button-text-shadow, none);\n }\n .segment:not(:has(input:checked)):hover {\n background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));\n }\n .segment:not(:has(input:checked)):active {\n background:\n var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none)),\n var(--ui-surface, #ffffff);\n box-shadow: none;\n }\n .segment input {\n /* Fills the whole segment (not visually-hidden-offscreen) so a real\n click anywhere in the segment — including a test driver clicking\n the input by its accessible role — lands on the input itself,\n not just via native <label> click delegation. */\n position: absolute;\n inset: 0;\n margin: 0;\n opacity: 0;\n cursor: pointer;\n }\n /* Clipped by the group's own overflow:hidden unless promoted above its\n neighbors — the focus ring needs a stacking context of its own. */\n .segment:has(input:focus-visible) {\n z-index: 1;\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .segment:has(input:focus-visible):not(:active) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .segment:has(input:disabled) {\n cursor: not-allowed;\n opacity: 0.6;\n }\n :host([icon-only]) .segment {\n padding: 0.5rem;\n }\n :host([size=\"sm\"]) .segment {\n height: 1.5rem;\n padding: 0.25rem 0.5rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n :host([icon-only][size=\"sm\"]) .segment {\n padding: 0.25rem;\n }\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n @media (forced-colors: active) {\n .segment:has(input:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .segment:has(input:checked) {\n background: Highlight;\n color: HighlightText;\n }\n .segment:has(input:disabled) {\n color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Options to render, one segment each. */\n @property({ attribute: false }) options: ButtonGroupOption[] = [];\n /** Currently selected value. */\n @property() value = \"\";\n /** Disables every native radio in the group. */\n @property({ type: Boolean }) disabled = false;\n /** Hides labels visually (icons only) while keeping them as the accessible name. */\n @property({ type: Boolean, reflect: true, attribute: \"icon-only\" }) iconOnly = false;\n /** Size — `sm` reduces segment height/padding/font-size one step below the default. */\n @property({ reflect: true }) size: \"sm\" | \"md\" = \"md\";\n\n readonly #name = `button-group-${++instanceCount}`;\n\n private _onChange(value: string) {\n if (this.disabled) return;\n this.value = value;\n this.dispatchEvent(\n new CustomEvent(\"change\", { detail: { value }, bubbles: true, composed: true }),\n );\n }\n\n override render() {\n return html`\n <div class=\"group\">\n ${repeat(\n this.options,\n (opt) => opt.value,\n (opt) => html`\n <label class=\"segment\">\n <input\n type=\"radio\"\n name=${this.#name}\n ?checked=${this.value === opt.value}\n ?disabled=${this.disabled}\n aria-label=${this.iconOnly ? opt.label : nothing}\n title=${this.iconOnly ? opt.label : nothing}\n @change=${() => this._onChange(opt.value)}\n />\n ${opt.icon ?? nothing}\n <span class=${this.iconOnly ? \"sr-only\" : \"\"}>${opt.label}</span>\n </label>\n `,\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"button-group\": ButtonGroup;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-day.d.ts","sourceRoot":"","sources":["../src/calendar-day.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AA4DnE;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,WAAY,SAAQ,oBAAoB;IACnD,qCAAqC;IACR,IAAI,EAAE,MAAM,CAAyB;IAElE;;;;OAIG;IACmE,UAAU,UAAS;IAEzF;;;;;OAKG;IACkD,QAAQ,SAAM;IAE1D,OAAO,CAAC,IAAI,CAAc;IAEnC,OAAO,CAAC,SAAS,CAA+C;IAEhE,OAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"calendar-day.d.ts","sourceRoot":"","sources":["../src/calendar-day.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AA4DnE;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,WAAY,SAAQ,oBAAoB;IACnD,qCAAqC;IACR,IAAI,EAAE,MAAM,CAAyB;IAElE;;;;OAIG;IACmE,UAAU,UAAS;IAEzF;;;;;OAKG;IACkD,QAAQ,SAAM;IAE1D,OAAO,CAAC,IAAI,CAAc;IAEnC,OAAO,CAAC,SAAS,CAA+C;IAEhE,OAAgB,MAAM,4BAmOpB;IAEF,iFAAiF;IACxE,iBAAiB,IAAI,IAAI,CAGjC;IAED,mEAAmE;IAC1D,oBAAoB,IAAI,IAAI,CAIpC;IAED,iHAAiH;IACjH,UAAmB,OAAO,IAAI,IAAI,CAIjC;IAED,uFAAuF;IACvF,OAAO,CAAC,aAAa;IAYrB,0GAA0G;IAC1G,OAAO,CAAC,aAAa;IAQrB,iFAAiF;IACjF,OAAO,CAAC,iBAAiB;IA0BzB,0FAA0F;IAC1F,OAAO,CAAC,iBAAiB;IA0BzB,UAAmB,MAAM,yCA8DxB;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|
package/dist/calendar-day.js
CHANGED
|
@@ -159,6 +159,11 @@ let CalendarDay = class CalendarDay extends CalendarTimelineBase {
|
|
|
159
159
|
.grid {
|
|
160
160
|
display: flex;
|
|
161
161
|
border-top: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
162
|
+
/* The hour grid is the day's canvas — .day-column only paints for
|
|
163
|
+
weekend/today, so without this the page showed through every
|
|
164
|
+
ordinary hour. The today tint is translucent and composites over
|
|
165
|
+
this paper rather than over the page. */
|
|
166
|
+
background: var(--ui-surface, #ffffff);
|
|
162
167
|
}
|
|
163
168
|
.hour-gutter {
|
|
164
169
|
flex: 0 0 3rem;
|
package/dist/calendar-day.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-day.js","sourceRoot":"","sources":["../src/calendar-day.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO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jB,WAAW,CAsZvB","sourcesContent":["import { css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { CalendarTimelineBase } from \"./calendar-timeline-base.js\";\nimport { iconMapPin } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n assignLanes,\n isWeekend,\n minutesSinceMidnight,\n monthName,\n parseIsoDate,\n toIsoDate,\n type LanedEntry,\n} from \"./utils/calendar.js\";\n\nconst NOW_MARKER_INTERVAL_MS = 60_000;\n\nconst HOUR_HEIGHT_REM = 3;\nconst HOURS = Array.from({ length: 24 }, (_, i) => i);\nconst hourLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: \"numeric\" });\n\n/** Formats hour `h` (0-23) as a locale-aware hour label, e.g. \"9 AM\". */\nfunction hourLabel(h: number): string {\n return hourLabelFormatter.format(new Date(2000, 0, 1, h));\n}\n\nconst nowLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: \"numeric\", minute: \"2-digit\" });\n\n// Half-heights of the current-time pill and of an hour label, derived from\n// --ui-font-size-sm x --ui-line-height-tight (plus the pill's vertical\n// padding). Used to work out which hour label the pill covers.\nconst NOW_PILL_HALF_HEIGHT_REM = (0.75 * 1.25 + 0.25) / 2;\nconst HOUR_LABEL_HALF_HEIGHT_REM = (0.75 * 1.25) / 2;\n\n/**\n * Formats `date` as a locale-aware clock time without any AM/PM marker, e.g.\n * \"6:37\" in a 12-hour locale and \"18:37\" in a 24-hour one. The meridiem is\n * dropped so the label stays narrow enough for the hour gutter.\n */\nfunction nowLabel(date: Date): string {\n return nowLabelFormatter\n .formatToParts(date)\n .filter((part) => part.type !== \"dayPeriod\")\n .map((part) => part.value)\n .join(\"\")\n .trim();\n}\n\n/**\n * The hour (0-23) whose gutter label the current-time pill overlaps, given the\n * pill's offset in rem from the top of the grid, or `null` when the pill\n * clears every label. Labels sit flush with the top of their own hour cell.\n */\nfunction hourLabelCoveredByNow(nowTopRem: number | null): number | null {\n if (nowTopRem === null) return null;\n const hour = Math.round((nowTopRem - HOUR_LABEL_HALF_HEIGHT_REM) / HOUR_HEIGHT_REM);\n if (hour < 0 || hour > 23) return null;\n const labelCenterRem = hour * HOUR_HEIGHT_REM + HOUR_LABEL_HALF_HEIGHT_REM;\n const clearance = NOW_PILL_HALF_HEIGHT_REM + HOUR_LABEL_HALF_HEIGHT_REM;\n return Math.abs(nowTopRem - labelCenterRem) < clearance ? hour : null;\n}\n\n/**\n * A single day rendered as an hourly time grid — a Google-Calendar-style\n * view distinct from `calendar-month`'s whole-day table. Declarative\n * `calendar-entry` children with a time-of-day in `start`/`end` (e.g.\n * `start=\"2026-03-05T09:00\"`) render as positioned/sized blocks; entries\n * with only a date (no time) render in an all-day band above the grid.\n * Overlapping timed entries stack into side-by-side columns; overlapping\n * all-day/multi-day entries stack into lanes, same as `calendar-month`.\n * Read-only.\n *\n * Shares its slotted-entry observation, resolution, and hover/focus\n * interaction sync with `calendar-week` via `CalendarTimelineBase`.\n *\n * @element calendar-day\n * @slot - Declarative `calendar-entry` elements to render for this day.\n * @slot actions - Optional controls rendered beside the day name (e.g. day-navigation buttons).\n */\n@customElement(\"calendar-day\")\nexport class CalendarDay extends CalendarTimelineBase {\n /** The day shown, `\"YYYY-MM-DD\"`. */\n @property({ reflect: true }) date: string = toIsoDate(new Date());\n\n /**\n * Shows a fine live line marking the current time, with a rounded pill in\n * the hour gutter reading the current clock time. The hour label the pill\n * covers is hidden while it does. Only rendered when `date` is today.\n */\n @property({ type: Boolean, reflect: true, attribute: \"time-marker\" }) timeMarker = false;\n\n /**\n * Minimum width for the day column, as a CSS length (e.g. `\"18rem\"`).\n * Unset leaves the host's width fully controlled by its container —\n * useful as the sizing floor when placing several `calendar-day`\n * elements in a scrollable row.\n */\n @property({ reflect: true, attribute: \"min-width\" }) minWidth = \"\";\n\n @state() private _now = Date.now();\n\n private _nowTimer: ReturnType<typeof setInterval> | null = null;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n min-width: var(--calendar-day-min-width, 0);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .day-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n margin-bottom: 0.5rem;\n }\n .day-name {\n margin: 0;\n min-width: 0;\n color: var(--ui-text, #0f172a);\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .day-name.weekend {\n color: var(--ui-text-muted, #64748b);\n }\n .day-name.today {\n color: var(--ui-primary, #4f46e5);\n }\n .actions {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n gap: 0.5rem;\n }\n .all-day-band {\n display: flex;\n margin-bottom: 0.5rem;\n }\n .all-day-band.empty {\n display: none;\n }\n .hour-gutter-spacer {\n flex: 0 0 3rem;\n }\n .all-day-lanes {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: 0.25rem;\n }\n .all-day-lane {\n display: flex;\n gap: 0.25rem;\n }\n .grid {\n display: flex;\n border-top: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n .hour-gutter {\n flex: 0 0 3rem;\n }\n .hour-label-cell {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n padding-right: 0.5rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: tabular-nums;\n line-height: var(--ui-line-height-tight, 1.25);\n text-align: right;\n white-space: nowrap;\n }\n /* Hidden rather than removed so the cell keeps its own separator line. */\n .hour-label.covered {\n visibility: hidden;\n }\n .day-column {\n position: relative;\n flex: 1 1 auto;\n height: ${HOUR_HEIGHT_REM * 24}rem;\n }\n .day-column.weekend {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .day-column.today {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 6%, transparent);\n }\n .now-line {\n position: absolute;\n left: 0;\n right: 0;\n height: 2px;\n background: var(--ui-danger, #dc2626);\n pointer-events: none;\n z-index: 2;\n }\n /* Overhangs left into the hour gutter; nothing between here and .grid\n clips overflow, and .day-column's z-index stays auto, so the pill\n paints above the (unpositioned) hour labels it overlaps. */\n .now-pill {\n position: absolute;\n top: 50%;\n right: 100%;\n border-radius: var(--ui-radius-pill, 9999px);\n padding: 0.125rem 0.25rem;\n background: var(--ui-danger, #dc2626);\n color: var(--ui-on-accent, #ffffff);\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n transform: translateY(-50%);\n }\n .hour-line {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n .entry-bar {\n position: relative;\n box-sizing: border-box;\n flex: 1 1 auto;\n overflow: hidden;\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.25rem 0.5rem;\n transition: box-shadow 120ms ease;\n }\n .entry-bar.entry-block {\n position: absolute;\n }\n .entry-bar.entry-hovered,\n .entry-bar.entry-focused {\n box-shadow: inset 0 0 0 100vmax var(--ui-hover-overlay, rgb(255 255 255 / 0.32));\n }\n .entry-title {\n display: block;\n overflow: hidden;\n font-weight: var(--ui-font-weight-medium, 500);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n overflow: hidden;\n color: inherit;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-regular, 400);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location svg {\n flex: 0 0 auto;\n }\n .entry-link {\n position: absolute;\n z-index: 1;\n inset: 0;\n border-radius: inherit;\n color: inherit;\n cursor: pointer;\n text-decoration: none;\n }\n .entry-link:focus-visible {\n outline: 2px solid var(--ui-primary, #4f46e5);\n outline-offset: -2px;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)) inset;\n }\n .entry-bar.neutral {\n background: color-mix(in srgb, var(--ui-text-muted, #64748b) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-text-muted, #64748b);\n }\n .entry-bar.info {\n background: color-mix(in srgb, var(--ui-info, #0ea5e9) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-info, #0ea5e9);\n }\n .entry-bar.primary {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-primary, #4f46e5);\n }\n .entry-bar.success {\n background: color-mix(in srgb, var(--ui-success, #16a34a) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-success, #16a34a);\n }\n .entry-bar.warning {\n background: color-mix(in srgb, var(--ui-warning, #d97706) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-warning, #d97706);\n }\n .entry-bar.danger {\n background: color-mix(in srgb, var(--ui-danger, #dc2626) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-danger, #dc2626);\n }\n @media (forced-colors: active) {\n .entry-link:focus-visible {\n outline-color: Highlight;\n box-shadow: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .entry-bar {\n transition: none;\n }\n }\n slot:not([name]) {\n display: none;\n }\n `,\n ];\n\n /** Starts the current-time ticker if `time-marker` is already set on connect. */\n override connectedCallback(): void {\n super.connectedCallback();\n this._syncNowTimer();\n }\n\n /** Stops the current-time ticker when this element disconnects. */\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._nowTimer != null) clearInterval(this._nowTimer);\n this._nowTimer = null;\n }\n\n /** Starts/stops the current-time ticker and re-syncs the min-width host style to match the latest properties. */\n protected override updated(): void {\n super.updated();\n this._syncNowTimer();\n this._syncMinWidth();\n }\n\n /** Ensures a 60s current-time ticker is running only while `timeMarker` is enabled. */\n private _syncNowTimer(): void {\n if (this.timeMarker && this._nowTimer == null) {\n this._now = Date.now();\n this._nowTimer = setInterval(() => {\n this._now = Date.now();\n }, NOW_MARKER_INTERVAL_MS);\n } else if (!this.timeMarker && this._nowTimer != null) {\n clearInterval(this._nowTimer);\n this._nowTimer = null;\n }\n }\n\n /** Reflects `minWidth` onto the `--calendar-day-min-width` custom property the host's own styles read. */\n private _syncMinWidth(): void {\n if (this.minWidth) {\n this.style.setProperty(\"--calendar-day-min-width\", this.minWidth);\n } else {\n this.style.removeProperty(\"--calendar-day-min-width\");\n }\n }\n\n /** Renders one lane's stacked all-day bars, given the entries assigned to it. */\n private _renderAllDayLane(laned: LanedEntry[], lane: number) {\n const entries = laned.filter((entry) => entry.lane === lane);\n return html`\n <div class=\"all-day-lane\">\n ${entries.map((entry) => {\n const bodyText = [entry.label, entry.location].filter(Boolean).join(\" · \");\n return html`\n <div\n class=\"entry-bar ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n })}\n </div>\n `;\n }\n\n /** Renders a positioned/sized block for one timed entry, clamped to this day's bounds. */\n private _renderTimedEntry(entry: LanedEntry, laneCount: number, dayStart: Date, dayEnd: Date) {\n const visibleStart = entry.startDate < dayStart ? dayStart : entry.startDate;\n const visibleEnd = entry.endDate > dayEnd ? dayEnd : entry.endDate;\n const topRem = (minutesSinceMidnight(visibleStart) / 60) * HOUR_HEIGHT_REM;\n const bottomRem = (minutesSinceMidnight(visibleEnd) / 60) * HOUR_HEIGHT_REM;\n const heightRem = Math.max(bottomRem - topRem, HOUR_HEIGHT_REM / 4);\n const widthPercent = 100 / laneCount;\n const bodyText = [entry.label, ...(entry.details ?? []), entry.location].filter(Boolean).join(\"\\n\");\n return html`\n <div\n class=\"entry-bar entry-block ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n style=\"top: ${topRem}rem; height: ${heightRem}rem; left: ${entry.lane * widthPercent}%; width: ${widthPercent}%;\"\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n }\n\n protected override render() {\n const day = parseIsoDate(this.date) ?? new Date();\n const dayStart = new Date(day);\n dayStart.setHours(0, 0, 0, 0);\n const dayEnd = new Date(day);\n dayEnd.setHours(23, 59, 59, 999);\n const isToday = toIsoDate(day) === toIsoDate(new Date());\n const isWeekendDay = isWeekend(day);\n\n const resolved = this.resolveTimedEntriesFor(dayStart, dayEnd);\n const allDay = resolved.filter((entry) => entry.allDay);\n const timed = resolved.filter((entry) => !entry.allDay);\n const { entries: lanedAllDay, laneCount: allDayLaneCount } = assignLanes(allDay);\n const { entries: lanedTimed, laneCount: timedLaneCount } = assignLanes(timed);\n const nowTopRem =\n this.timeMarker && isToday ? (minutesSinceMidnight(new Date(this._now)) / 60) * HOUR_HEIGHT_REM : null;\n const coveredHour = hourLabelCoveredByNow(nowTopRem);\n\n return html`\n <div class=\"day\">\n <div class=\"day-header\">\n <h4 class=\"day-name ${isWeekendDay ? \"weekend\" : \"\"} ${isToday ? \"today\" : \"\"}\">\n ${monthName(day.getMonth() + 1)} ${day.getDate()}, ${day.getFullYear()}\n </h4>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>\n <div class=\"all-day-band ${allDay.length === 0 ? \"empty\" : \"\"}\">\n <div class=\"hour-gutter-spacer\"></div>\n <div class=\"all-day-lanes\">\n ${repeat(\n Array.from({ length: Math.max(allDayLaneCount, 1) }, (_, i) => i),\n (lane) => lane,\n (lane) => this._renderAllDayLane(lanedAllDay, lane),\n )}\n </div>\n </div>\n <div class=\"grid\">\n <div class=\"hour-gutter\">\n ${HOURS.map(\n (h) =>\n html`<div class=\"hour-label-cell\">\n <span class=\"hour-label ${h === coveredHour ? \"covered\" : \"\"}\">${hourLabel(h)}</span>\n </div>`,\n )}\n </div>\n <div class=\"day-column ${isWeekendDay ? \"weekend\" : \"\"} ${isToday ? \"today\" : \"\"}\">\n ${HOURS.map(() => html`<div class=\"hour-line\"></div>`)}\n ${repeat(\n lanedTimed,\n (entry) => this.entryKey(entry),\n (entry) => this._renderTimedEntry(entry, Math.max(timedLaneCount, 1), dayStart, dayEnd),\n )}\n ${nowTopRem !== null\n ? html`<div class=\"now-line\" style=\"top: ${nowTopRem}rem\" aria-hidden=\"true\">\n <span class=\"now-pill\">${nowLabel(new Date(this._now))}</span>\n </div>`\n : nothing}\n </div>\n </div>\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"calendar-day\": CalendarDay;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"calendar-day.js","sourceRoot":"","sources":["../src/calendar-day.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CA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C,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;cAC5E,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAA,+BAA+B,CAAC;cACpD,MAAM,CACN,UAAU,EACV,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC/B,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,CACxF;cACC,SAAS,KAAK,IAAI;YAClB,CAAC,CAAC,IAAI,CAAA,qCAAqC,SAAS;2CACvB,QAAQ,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;uBACjD;YACT,CAAC,CAAC,OAAO;;;4BAGK,IAAI,CAAC,gBAAgB;;KAE5C,CAAC;IACJ,CAAC;CACF,CAAA;AAzZ8B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAsC;AAOI;IAArE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;+CAAoB;AAQpC;IAApD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;6CAAe;AAElD;IAAhB,KAAK,EAAE;yCAA2B;AAnBxB,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA2ZvB","sourcesContent":["import { css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { CalendarTimelineBase } from \"./calendar-timeline-base.js\";\nimport { iconMapPin } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n assignLanes,\n isWeekend,\n minutesSinceMidnight,\n monthName,\n parseIsoDate,\n toIsoDate,\n type LanedEntry,\n} from \"./utils/calendar.js\";\n\nconst NOW_MARKER_INTERVAL_MS = 60_000;\n\nconst HOUR_HEIGHT_REM = 3;\nconst HOURS = Array.from({ length: 24 }, (_, i) => i);\nconst hourLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: \"numeric\" });\n\n/** Formats hour `h` (0-23) as a locale-aware hour label, e.g. \"9 AM\". */\nfunction hourLabel(h: number): string {\n return hourLabelFormatter.format(new Date(2000, 0, 1, h));\n}\n\nconst nowLabelFormatter = new Intl.DateTimeFormat(undefined, { hour: \"numeric\", minute: \"2-digit\" });\n\n// Half-heights of the current-time pill and of an hour label, derived from\n// --ui-font-size-sm x --ui-line-height-tight (plus the pill's vertical\n// padding). Used to work out which hour label the pill covers.\nconst NOW_PILL_HALF_HEIGHT_REM = (0.75 * 1.25 + 0.25) / 2;\nconst HOUR_LABEL_HALF_HEIGHT_REM = (0.75 * 1.25) / 2;\n\n/**\n * Formats `date` as a locale-aware clock time without any AM/PM marker, e.g.\n * \"6:37\" in a 12-hour locale and \"18:37\" in a 24-hour one. The meridiem is\n * dropped so the label stays narrow enough for the hour gutter.\n */\nfunction nowLabel(date: Date): string {\n return nowLabelFormatter\n .formatToParts(date)\n .filter((part) => part.type !== \"dayPeriod\")\n .map((part) => part.value)\n .join(\"\")\n .trim();\n}\n\n/**\n * The hour (0-23) whose gutter label the current-time pill overlaps, given the\n * pill's offset in rem from the top of the grid, or `null` when the pill\n * clears every label. Labels sit flush with the top of their own hour cell.\n */\nfunction hourLabelCoveredByNow(nowTopRem: number | null): number | null {\n if (nowTopRem === null) return null;\n const hour = Math.round((nowTopRem - HOUR_LABEL_HALF_HEIGHT_REM) / HOUR_HEIGHT_REM);\n if (hour < 0 || hour > 23) return null;\n const labelCenterRem = hour * HOUR_HEIGHT_REM + HOUR_LABEL_HALF_HEIGHT_REM;\n const clearance = NOW_PILL_HALF_HEIGHT_REM + HOUR_LABEL_HALF_HEIGHT_REM;\n return Math.abs(nowTopRem - labelCenterRem) < clearance ? hour : null;\n}\n\n/**\n * A single day rendered as an hourly time grid — a Google-Calendar-style\n * view distinct from `calendar-month`'s whole-day table. Declarative\n * `calendar-entry` children with a time-of-day in `start`/`end` (e.g.\n * `start=\"2026-03-05T09:00\"`) render as positioned/sized blocks; entries\n * with only a date (no time) render in an all-day band above the grid.\n * Overlapping timed entries stack into side-by-side columns; overlapping\n * all-day/multi-day entries stack into lanes, same as `calendar-month`.\n * Read-only.\n *\n * Shares its slotted-entry observation, resolution, and hover/focus\n * interaction sync with `calendar-week` via `CalendarTimelineBase`.\n *\n * @element calendar-day\n * @slot - Declarative `calendar-entry` elements to render for this day.\n * @slot actions - Optional controls rendered beside the day name (e.g. day-navigation buttons).\n */\n@customElement(\"calendar-day\")\nexport class CalendarDay extends CalendarTimelineBase {\n /** The day shown, `\"YYYY-MM-DD\"`. */\n @property({ reflect: true }) date: string = toIsoDate(new Date());\n\n /**\n * Shows a fine live line marking the current time, with a rounded pill in\n * the hour gutter reading the current clock time. The hour label the pill\n * covers is hidden while it does. Only rendered when `date` is today.\n */\n @property({ type: Boolean, reflect: true, attribute: \"time-marker\" }) timeMarker = false;\n\n /**\n * Minimum width for the day column, as a CSS length (e.g. `\"18rem\"`).\n * Unset leaves the host's width fully controlled by its container —\n * useful as the sizing floor when placing several `calendar-day`\n * elements in a scrollable row.\n */\n @property({ reflect: true, attribute: \"min-width\" }) minWidth = \"\";\n\n @state() private _now = Date.now();\n\n private _nowTimer: ReturnType<typeof setInterval> | null = null;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n min-width: var(--calendar-day-min-width, 0);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .day-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n margin-bottom: 0.5rem;\n }\n .day-name {\n margin: 0;\n min-width: 0;\n color: var(--ui-text, #0f172a);\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .day-name.weekend {\n color: var(--ui-text-muted, #64748b);\n }\n .day-name.today {\n color: var(--ui-primary, #4f46e5);\n }\n .actions {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n gap: 0.5rem;\n }\n .all-day-band {\n display: flex;\n margin-bottom: 0.5rem;\n }\n .all-day-band.empty {\n display: none;\n }\n .hour-gutter-spacer {\n flex: 0 0 3rem;\n }\n .all-day-lanes {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: 0.25rem;\n }\n .all-day-lane {\n display: flex;\n gap: 0.25rem;\n }\n .grid {\n display: flex;\n border-top: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n /* The hour grid is the day's canvas — .day-column only paints for\n weekend/today, so without this the page showed through every\n ordinary hour. The today tint is translucent and composites over\n this paper rather than over the page. */\n background: var(--ui-surface, #ffffff);\n }\n .hour-gutter {\n flex: 0 0 3rem;\n }\n .hour-label-cell {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n padding-right: 0.5rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: tabular-nums;\n line-height: var(--ui-line-height-tight, 1.25);\n text-align: right;\n white-space: nowrap;\n }\n /* Hidden rather than removed so the cell keeps its own separator line. */\n .hour-label.covered {\n visibility: hidden;\n }\n .day-column {\n position: relative;\n flex: 1 1 auto;\n height: ${HOUR_HEIGHT_REM * 24}rem;\n }\n .day-column.weekend {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .day-column.today {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 6%, transparent);\n }\n .now-line {\n position: absolute;\n left: 0;\n right: 0;\n height: 2px;\n background: var(--ui-danger, #dc2626);\n pointer-events: none;\n z-index: 2;\n }\n /* Overhangs left into the hour gutter; nothing between here and .grid\n clips overflow, and .day-column's z-index stays auto, so the pill\n paints above the (unpositioned) hour labels it overlaps. */\n .now-pill {\n position: absolute;\n top: 50%;\n right: 100%;\n border-radius: var(--ui-radius-pill, 9999px);\n padding: 0.125rem 0.25rem;\n background: var(--ui-danger, #dc2626);\n color: var(--ui-on-accent, #ffffff);\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n font-variant-numeric: tabular-nums;\n white-space: nowrap;\n transform: translateY(-50%);\n }\n .hour-line {\n box-sizing: border-box;\n height: ${HOUR_HEIGHT_REM}rem;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n .entry-bar {\n position: relative;\n box-sizing: border-box;\n flex: 1 1 auto;\n overflow: hidden;\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.25rem 0.5rem;\n transition: box-shadow 120ms ease;\n }\n .entry-bar.entry-block {\n position: absolute;\n }\n .entry-bar.entry-hovered,\n .entry-bar.entry-focused {\n box-shadow: inset 0 0 0 100vmax var(--ui-hover-overlay, rgb(255 255 255 / 0.32));\n }\n .entry-title {\n display: block;\n overflow: hidden;\n font-weight: var(--ui-font-weight-medium, 500);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n overflow: hidden;\n color: inherit;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-regular, 400);\n white-space: nowrap;\n text-overflow: ellipsis;\n pointer-events: none;\n }\n .entry-location svg {\n flex: 0 0 auto;\n }\n .entry-link {\n position: absolute;\n z-index: 1;\n inset: 0;\n border-radius: inherit;\n color: inherit;\n cursor: pointer;\n text-decoration: none;\n }\n .entry-link:focus-visible {\n outline: 2px solid var(--ui-primary, #4f46e5);\n outline-offset: -2px;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)) inset;\n }\n .entry-bar.neutral {\n background: color-mix(in srgb, var(--ui-text-muted, #64748b) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-text-muted, #64748b);\n }\n .entry-bar.info {\n background: color-mix(in srgb, var(--ui-info, #0ea5e9) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-info, #0ea5e9);\n }\n .entry-bar.primary {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-primary, #4f46e5);\n }\n .entry-bar.success {\n background: color-mix(in srgb, var(--ui-success, #16a34a) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-success, #16a34a);\n }\n .entry-bar.warning {\n background: color-mix(in srgb, var(--ui-warning, #d97706) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-warning, #d97706);\n }\n .entry-bar.danger {\n background: color-mix(in srgb, var(--ui-danger, #dc2626) 15%, var(--ui-surface, #ffffff));\n color: var(--ui-danger, #dc2626);\n }\n @media (forced-colors: active) {\n .entry-link:focus-visible {\n outline-color: Highlight;\n box-shadow: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .entry-bar {\n transition: none;\n }\n }\n slot:not([name]) {\n display: none;\n }\n `,\n ];\n\n /** Starts the current-time ticker if `time-marker` is already set on connect. */\n override connectedCallback(): void {\n super.connectedCallback();\n this._syncNowTimer();\n }\n\n /** Stops the current-time ticker when this element disconnects. */\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this._nowTimer != null) clearInterval(this._nowTimer);\n this._nowTimer = null;\n }\n\n /** Starts/stops the current-time ticker and re-syncs the min-width host style to match the latest properties. */\n protected override updated(): void {\n super.updated();\n this._syncNowTimer();\n this._syncMinWidth();\n }\n\n /** Ensures a 60s current-time ticker is running only while `timeMarker` is enabled. */\n private _syncNowTimer(): void {\n if (this.timeMarker && this._nowTimer == null) {\n this._now = Date.now();\n this._nowTimer = setInterval(() => {\n this._now = Date.now();\n }, NOW_MARKER_INTERVAL_MS);\n } else if (!this.timeMarker && this._nowTimer != null) {\n clearInterval(this._nowTimer);\n this._nowTimer = null;\n }\n }\n\n /** Reflects `minWidth` onto the `--calendar-day-min-width` custom property the host's own styles read. */\n private _syncMinWidth(): void {\n if (this.minWidth) {\n this.style.setProperty(\"--calendar-day-min-width\", this.minWidth);\n } else {\n this.style.removeProperty(\"--calendar-day-min-width\");\n }\n }\n\n /** Renders one lane's stacked all-day bars, given the entries assigned to it. */\n private _renderAllDayLane(laned: LanedEntry[], lane: number) {\n const entries = laned.filter((entry) => entry.lane === lane);\n return html`\n <div class=\"all-day-lane\">\n ${entries.map((entry) => {\n const bodyText = [entry.label, entry.location].filter(Boolean).join(\" · \");\n return html`\n <div\n class=\"entry-bar ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n })}\n </div>\n `;\n }\n\n /** Renders a positioned/sized block for one timed entry, clamped to this day's bounds. */\n private _renderTimedEntry(entry: LanedEntry, laneCount: number, dayStart: Date, dayEnd: Date) {\n const visibleStart = entry.startDate < dayStart ? dayStart : entry.startDate;\n const visibleEnd = entry.endDate > dayEnd ? dayEnd : entry.endDate;\n const topRem = (minutesSinceMidnight(visibleStart) / 60) * HOUR_HEIGHT_REM;\n const bottomRem = (minutesSinceMidnight(visibleEnd) / 60) * HOUR_HEIGHT_REM;\n const heightRem = Math.max(bottomRem - topRem, HOUR_HEIGHT_REM / 4);\n const widthPercent = 100 / laneCount;\n const bodyText = [entry.label, ...(entry.details ?? []), entry.location].filter(Boolean).join(\"\\n\");\n return html`\n <div\n class=\"entry-bar entry-block ${entry.color}\"\n data-entry-key=${this.entryKey(entry)}\n title=${entry.href ? nothing : bodyText}\n style=\"top: ${topRem}rem; height: ${heightRem}rem; left: ${entry.lane * widthPercent}%; width: ${widthPercent}%;\"\n >\n ${this.renderEntryLink(entry, bodyText)}\n <span class=\"entry-title\" aria-hidden=${entry.href ? \"true\" : nothing}>${entry.label}</span>\n ${entry.location\n ? html`<span class=\"entry-location\" aria-hidden=${entry.href ? \"true\" : nothing}\n >${iconMapPin(14)}${entry.location}</span\n >`\n : nothing}\n </div>\n `;\n }\n\n protected override render() {\n const day = parseIsoDate(this.date) ?? new Date();\n const dayStart = new Date(day);\n dayStart.setHours(0, 0, 0, 0);\n const dayEnd = new Date(day);\n dayEnd.setHours(23, 59, 59, 999);\n const isToday = toIsoDate(day) === toIsoDate(new Date());\n const isWeekendDay = isWeekend(day);\n\n const resolved = this.resolveTimedEntriesFor(dayStart, dayEnd);\n const allDay = resolved.filter((entry) => entry.allDay);\n const timed = resolved.filter((entry) => !entry.allDay);\n const { entries: lanedAllDay, laneCount: allDayLaneCount } = assignLanes(allDay);\n const { entries: lanedTimed, laneCount: timedLaneCount } = assignLanes(timed);\n const nowTopRem =\n this.timeMarker && isToday ? (minutesSinceMidnight(new Date(this._now)) / 60) * HOUR_HEIGHT_REM : null;\n const coveredHour = hourLabelCoveredByNow(nowTopRem);\n\n return html`\n <div class=\"day\">\n <div class=\"day-header\">\n <h4 class=\"day-name ${isWeekendDay ? \"weekend\" : \"\"} ${isToday ? \"today\" : \"\"}\">\n ${monthName(day.getMonth() + 1)} ${day.getDate()}, ${day.getFullYear()}\n </h4>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>\n <div class=\"all-day-band ${allDay.length === 0 ? \"empty\" : \"\"}\">\n <div class=\"hour-gutter-spacer\"></div>\n <div class=\"all-day-lanes\">\n ${repeat(\n Array.from({ length: Math.max(allDayLaneCount, 1) }, (_, i) => i),\n (lane) => lane,\n (lane) => this._renderAllDayLane(lanedAllDay, lane),\n )}\n </div>\n </div>\n <div class=\"grid\">\n <div class=\"hour-gutter\">\n ${HOURS.map(\n (h) =>\n html`<div class=\"hour-label-cell\">\n <span class=\"hour-label ${h === coveredHour ? \"covered\" : \"\"}\">${hourLabel(h)}</span>\n </div>`,\n )}\n </div>\n <div class=\"day-column ${isWeekendDay ? \"weekend\" : \"\"} ${isToday ? \"today\" : \"\"}\">\n ${HOURS.map(() => html`<div class=\"hour-line\"></div>`)}\n ${repeat(\n lanedTimed,\n (entry) => this.entryKey(entry),\n (entry) => this._renderTimedEntry(entry, Math.max(timedLaneCount, 1), dayStart, dayEnd),\n )}\n ${nowTopRem !== null\n ? html`<div class=\"now-line\" style=\"top: ${nowTopRem}rem\" aria-hidden=\"true\">\n <span class=\"now-pill\">${nowLabel(new Date(this._now))}</span>\n </div>`\n : nothing}\n </div>\n </div>\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"calendar-day\": CalendarDay;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-week.d.ts","sourceRoot":"","sources":["../src/calendar-week.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AA8BnE;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBACa,YAAa,SAAQ,oBAAoB;IACpD,mGAAmG;IACtE,IAAI,EAAE,MAAM,CAAyB;IAElE,OAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"calendar-week.d.ts","sourceRoot":"","sources":["../src/calendar-week.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AA8BnE;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBACa,YAAa,SAAQ,oBAAoB;IACpD,mGAAmG;IACtE,IAAI,EAAE,MAAM,CAAyB;IAElE,OAAgB,MAAM,4BAoMpB;IAEF,sFAAsF;IACtF,OAAO,CAAC,kBAAkB;IAwB1B,uFAAuF;IACvF,OAAO,CAAC,iBAAiB;IA0BzB,gGAAgG;IAChG,OAAO,CAAC,gBAAgB;IAoBxB,UAAmB,MAAM,yCAkDxB;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,YAAY,CAAC;KAC/B;CACF"}
|
package/dist/calendar-week.js
CHANGED
|
@@ -115,6 +115,11 @@ let CalendarWeek = class CalendarWeek extends CalendarTimelineBase {
|
|
|
115
115
|
.grid {
|
|
116
116
|
display: flex;
|
|
117
117
|
border-top: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
118
|
+
/* The hour grid is the week's canvas — .day-column only paints for
|
|
119
|
+
weekend/today, so without this the page showed through every
|
|
120
|
+
ordinary hour. The today tint is translucent and composites over
|
|
121
|
+
this paper rather than over the page. */
|
|
122
|
+
background: var(--ui-surface, #ffffff);
|
|
118
123
|
}
|
|
119
124
|
.hour-gutter {
|
|
120
125
|
flex: 0 0 3rem;
|