@f-ewald/components 1.37.5 → 1.39.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 +25 -1
- package/custom-elements.json +45 -6
- package/dist/calendar-day.js +1 -1
- package/dist/calendar-day.js.map +1 -1
- package/dist/distribution-chart.js +1 -1
- package/dist/distribution-chart.js.map +1 -1
- package/dist/dropdown-button.js +1 -1
- package/dist/dropdown-button.js.map +1 -1
- package/dist/form-select.js +1 -1
- package/dist/form-select.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/kanban-board.js +1 -1
- package/dist/kanban-board.js.map +1 -1
- package/dist/kanban-column.js +1 -1
- package/dist/kanban-column.js.map +1 -1
- package/dist/link-card.js +1 -1
- package/dist/link-card.js.map +1 -1
- package/dist/loading-dots.js +1 -1
- package/dist/loading-dots.js.map +1 -1
- package/dist/multi-select.js +1 -1
- package/dist/multi-select.js.map +1 -1
- package/dist/photo-gallery.js +3 -3
- package/dist/photo-gallery.js.map +1 -1
- package/dist/radio-pills.js +1 -1
- package/dist/radio-pills.js.map +1 -1
- package/dist/range-slider.js +5 -5
- package/dist/range-slider.js.map +1 -1
- package/dist/scroll-dots.js +1 -1
- package/dist/scroll-dots.js.map +1 -1
- package/dist/slide-panel.js +1 -1
- package/dist/slide-panel.js.map +1 -1
- package/dist/stat-meter.js +1 -1
- package/dist/stat-meter.js.map +1 -1
- package/dist/status-pill.js +1 -1
- package/dist/status-pill.js.map +1 -1
- package/dist/timeline-entry.js +2 -2
- package/dist/timeline-entry.js.map +1 -1
- package/dist/tokens.css +17 -1
- package/dist/tokens.d.ts +27 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +54 -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/ui-checkbox.d.ts +10 -1
- package/dist/ui-checkbox.d.ts.map +1 -1
- package/dist/ui-checkbox.js +11 -2
- package/dist/ui-checkbox.js.map +1 -1
- package/dist/user-avatar.js +2 -2
- package/dist/user-avatar.js.map +1 -1
- package/dist/utils/transport-controls.js +5 -5
- package/dist/utils/transport-controls.js.map +1 -1
- package/docs/calendar-day.md +1 -0
- package/docs/design-language.md +21 -4
- package/docs/distribution-chart.md +1 -0
- package/docs/dropdown-button.md +1 -0
- package/docs/form-select.md +1 -0
- package/docs/kanban-board.md +1 -0
- package/docs/kanban-column.md +1 -0
- package/docs/link-card.md +1 -0
- package/docs/loading-dots.md +1 -0
- package/docs/multi-select.md +1 -0
- package/docs/photo-gallery.md +1 -0
- package/docs/radio-pills.md +1 -0
- package/docs/range-slider.md +2 -0
- package/docs/scroll-dots.md +1 -0
- package/docs/slide-panel.md +1 -0
- package/docs/stat-meter.md +1 -0
- package/docs/status-pill.md +1 -0
- package/docs/timeline-entry.md +1 -0
- package/docs/ui-button.md +1 -0
- package/docs/ui-checkbox.md +13 -2
- package/docs/user-avatar.md +1 -0
- package/llms.txt +34 -20
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"photo-gallery.js","sourceRoot":"","sources":["../src/photo-gallery.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAoBrC,MAAM,oBAAoB,GAAG,GAAG,CAA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AAO;4BACS,IAAI,CAAC,iBAAiB;;KAE7C,CAAC;IACJ,CAAC;CACF,CAAA;AAppBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACrD;AAGW;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAW;AAItC;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;kDAClD;AAIpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;iDACnC;AAIpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;oDACnC;AAIvB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;yDACnD;AAI3B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAC5B;AAIf;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;iDACjB;AAIvB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;+CACK;AAG1B;IADhB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;mDACL;AAGvC;IADP,KAAK,EAAE;oDACqC;AAGrC;IADP,KAAK,EAAE;mDACkB;AA3Cf,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAupBxB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property, queryAssignedElements, state } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport type { GalleryItemVariant } from \"./gallery-item-variant.js\";\nimport { GalleryItem } from \"./gallery-item.js\";\nimport { iconChevronLeft, iconChevronRight } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type PhotoGalleryObjectFit = \"cover\" | \"contain\";\nexport type PhotoGalleryChangeReason =\n | \"autoplay\"\n | \"indicator\"\n | \"items\"\n | \"keyboard\"\n | \"next\"\n | \"previous\"\n | \"programmatic\"\n | \"swipe\";\n\nexport interface PhotoGallerySlideChangeDetail {\n previousIndex: number;\n currentIndex: number;\n item: GalleryItem;\n reason: PhotoGalleryChangeReason;\n}\n\nconst transitionDurationMs = 250;\nconst swipeThresholdPx = 40;\nconst booleanAttribute = {\n fromAttribute(value: string | null): boolean {\n return value !== null && value !== \"false\";\n },\n};\n\n/**\n * Responsive, accessible image carousel composed from declarative\n * `gallery-item` children.\n *\n * The image viewport keeps a fixed `aspect-ratio`, and the caption row is\n * reserved for every slide whenever any slide has a caption, so the carousel's\n * total height stays constant as it cycles — it never shifts the page below it.\n *\n * @element photo-gallery\n * @slot - `gallery-item` elements rendered as slides.\n * @fires slide-change - The active image changed.\n */\n@customElement(\"photo-gallery\")\nexport class PhotoGallery extends LitElement {\n /** Zero-based active image index. */\n @property({ type: Number, attribute: \"current-index\", reflect: true })\n currentIndex = 0;\n\n /** Autoplay interval in milliseconds. Set to zero to disable autoplay. */\n @property({ type: Number }) delay = 0;\n\n /** Whether previous and next buttons are shown. */\n @property({ attribute: \"show-controls\", converter: booleanAttribute })\n showControls = true;\n\n /** Whether a current/total counter is shown. */\n @property({ type: Boolean, attribute: \"show-counter\" })\n showCounter = false;\n\n /** Whether clickable slide indicators are shown. */\n @property({ type: Boolean, attribute: \"show-indicators\" })\n showIndicators = false;\n\n /** Whether autoplay includes a built-in pause/play control. */\n @property({ attribute: \"show-autoplay-control\", converter: booleanAttribute })\n showAutoplayControl = true;\n\n /** Whether autoplay is explicitly paused. */\n @property({ type: Boolean, reflect: true })\n paused = false;\n\n /** CSS aspect ratio used by the image viewport. */\n @property({ attribute: \"aspect-ratio\" })\n aspectRatio = \"16 / 9\";\n\n /** How images fit within the stable viewport. */\n @property({ attribute: \"object-fit\" })\n objectFit: PhotoGalleryObjectFit = \"cover\";\n\n @queryAssignedElements({ selector: \"gallery-item\" })\n private readonly _galleryItems!: GalleryItem[];\n\n @state()\n private _previousIndex: number | null = null;\n\n @state()\n private _itemsVersion = 0;\n\n private _autoplayTimer?: number;\n private _transitionTimer?: number;\n private _metadataObserver?: MutationObserver;\n private _hovered = false;\n private _focusWithin = false;\n private _nextChangeReason: PhotoGalleryChangeReason | null = null;\n private _pendingChange?: PhotoGallerySlideChangeDetail;\n private _pointerStart?: { id: number; x: number; y: number };\n private _itemsChanged = false;\n private _activeItem?: GalleryItem;\n private _renderedIndex = 0;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n color: var(--ui-text, #0f172a);\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, 0.875rem);\n }\n .gallery {\n outline: none;\n }\n figure {\n margin: 0;\n }\n .viewport {\n position: relative;\n overflow: hidden;\n aspect-ratio: var(--photo-gallery-aspect-ratio, 16 / 9);\n border-radius: var(--ui-radius, 0.5rem);\n background: var(--ui-surface-muted, #f8fafc);\n touch-action: pan-y;\n user-select: none;\n }\n .gallery:focus-visible .viewport {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .slides {\n display: grid;\n width: 100%;\n height: 100%;\n }\n picture {\n grid-area: 1 / 1;\n display: block;\n width: 100%;\n height: 100%;\n }\n picture img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--photo-gallery-object-fit, cover);\n }\n .entering {\n z-index: 2;\n animation: gallery-fade-in 250ms ease both;\n }\n .leaving {\n z-index: 1;\n pointer-events: none;\n animation: gallery-fade-out 250ms ease both;\n }\n .arrow-controls {\n position: absolute;\n z-index: 3;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.5rem;\n pointer-events: none;\n }\n button {\n border: 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 cursor: pointer;\n }\n button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .arrow-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n color: var(--ui-on-accent, #ffffff);\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n border-radius: 9999px;\n pointer-events: auto;\n }\n .arrow-button:hover {\n background: color-mix(in srgb, var(--ui-text, #0f172a) 70%, transparent);\n }\n figcaption {\n padding: 0.5rem 0.25rem 0;\n min-height: 1lh;\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text-muted, #64748b);\n }\n .footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.75rem;\n min-height: 2rem;\n padding-top: 0.5rem;\n }\n .counter {\n color: var(--ui-text-muted, #64748b);\n font-size: var(--ui-font-size-sm, 0.75rem);\n white-space: nowrap;\n }\n .indicators {\n display: flex;\n flex: 1 1 auto;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n }\n .indicator {\n position: relative;\n width: 2rem;\n height: 2rem;\n padding: 0;\n background: transparent;\n border-radius: 9999px;\n }\n .indicator::before {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 0.625rem;\n height: 0.625rem;\n background: var(--ui-border, #e2e8f0);\n border-radius: 9999px;\n content: \"\";\n transform: translate(-50%, -50%);\n }\n .indicator[aria-current=\"true\"]::before {\n background: var(--ui-primary, #4f46e5);\n }\n .autoplay-button {\n height: 2rem;\n box-sizing: border-box;\n padding: 0.25rem 0.5rem;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface-muted, #f8fafc);\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n white-space: nowrap;\n }\n .autoplay-button:hover {\n background: var(--ui-surface, #ffffff);\n }\n slot {\n display: none;\n }\n @keyframes gallery-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n @keyframes gallery-fade-out {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .entering,\n .leaving {\n animation: none;\n }\n }\n `,\n ];\n\n /** Starts observers and autoplay integration when the element connects. */\n override connectedCallback(): void {\n super.connectedCallback();\n this._metadataObserver ??= new MutationObserver(() => this._handleMetadataChange());\n this._metadataObserver.observe(this, {\n attributes: true,\n attributeFilter: [\"alt\", \"caption\", \"media\", \"src\", \"srcset\"],\n childList: true,\n subtree: true,\n });\n document.addEventListener(\"visibilitychange\", this._handleVisibilityChange);\n }\n\n /** Releases timers and observers when the element disconnects. */\n override disconnectedCallback(): void {\n this._clearAutoplay();\n this._clearTransition();\n this._metadataObserver?.disconnect();\n document.removeEventListener(\"visibilitychange\", this._handleVisibilityChange);\n super.disconnectedCallback();\n }\n\n /** Normalizes external index changes before rendering. */\n protected override willUpdate(changed: PropertyValues<this>): void {\n if (!changed.has(\"currentIndex\")) return;\n\n const normalized = this._normalizeIndex(this.currentIndex);\n if (normalized !== this.currentIndex) {\n this.currentIndex = normalized;\n }\n\n const previousValue = changed.get(\"currentIndex\");\n if (previousValue === undefined || this._galleryItems.length === 0) {\n this._nextChangeReason = null;\n return;\n }\n\n const previousIndex = this._normalizeIndex(Number(previousValue));\n if (previousIndex === normalized) {\n this._nextChangeReason = null;\n return;\n }\n\n const reason = this._nextChangeReason ?? \"programmatic\";\n this._previousIndex = reason === \"items\" ? null : previousIndex;\n this._pendingChange = {\n previousIndex,\n currentIndex: normalized,\n item: this._galleryItems[normalized],\n reason,\n };\n this._nextChangeReason = null;\n }\n\n /** Emits completed changes and keeps autoplay synchronized with properties. */\n protected override updated(changed: PropertyValues<this>): void {\n if (this._pendingChange) {\n this.dispatchEvent(\n new CustomEvent<PhotoGallerySlideChangeDetail>(\"slide-change\", {\n bubbles: true,\n composed: true,\n detail: this._pendingChange,\n }),\n );\n this._pendingChange = undefined;\n this._scheduleTransitionCleanup();\n }\n\n if (changed.has(\"currentIndex\") || changed.has(\"delay\") || changed.has(\"paused\") || this._itemsChanged) {\n this._itemsChanged = false;\n this._restartAutoplay();\n }\n this._activeItem = this._galleryItems[this.currentIndex];\n this._renderedIndex = this.currentIndex;\n }\n\n /** Wraps any requested index into the current item range. */\n private _normalizeIndex(index: number): number {\n const count = this._galleryItems.length;\n if (count === 0 || !Number.isFinite(index)) return 0;\n return ((Math.trunc(index) % count) + count) % count;\n }\n\n /** Returns responsive variants declared directly under an item. */\n private _variantsFor(item: GalleryItem): GalleryItemVariant[] {\n return Array.from(item.children).filter(\n (child): child is GalleryItemVariant => child.tagName.toLowerCase() === \"gallery-item-variant\",\n );\n }\n\n /** Changes slides through the shared state and event path. */\n private _goTo(index: number, reason: PhotoGalleryChangeReason): void {\n const normalized = this._normalizeIndex(index);\n if (this._galleryItems.length < 2 || normalized === this.currentIndex) {\n this._restartAutoplay();\n return;\n }\n\n this._nextChangeReason = reason;\n this.currentIndex = normalized;\n }\n\n /** Moves to the previous image. */\n private _showPrevious(reason: PhotoGalleryChangeReason = \"previous\"): void {\n this._goTo(this.currentIndex - 1, reason);\n }\n\n /** Moves to the next image. */\n private _showNext(reason: PhotoGalleryChangeReason = \"next\"): void {\n this._goTo(this.currentIndex + 1, reason);\n }\n\n /** Toggles explicit autoplay pause state. */\n private _togglePaused(): void {\n this.paused = !this.paused;\n }\n\n /** Clears and conditionally schedules the next autoplay advance. */\n private _restartAutoplay(): void {\n this._clearAutoplay();\n if (!this._canAutoplay()) return;\n\n this._autoplayTimer = window.setTimeout(() => {\n this._showNext(\"autoplay\");\n }, this.delay);\n }\n\n /** Reports whether autoplay may currently schedule a transition. */\n private _canAutoplay(): boolean {\n return (\n this.delay > 0 &&\n this._galleryItems.length > 1 &&\n !this.paused &&\n !this._hovered &&\n !this._focusWithin &&\n !document.hidden\n );\n }\n\n /** Clears the pending autoplay timeout. */\n private _clearAutoplay(): void {\n if (this._autoplayTimer === undefined) return;\n window.clearTimeout(this._autoplayTimer);\n this._autoplayTimer = undefined;\n }\n\n /** Removes the outgoing crossfade layer after the animation completes. */\n private _scheduleTransitionCleanup(): void {\n this._clearTransition();\n this._transitionTimer = window.setTimeout(() => {\n this._previousIndex = null;\n this._transitionTimer = undefined;\n }, transitionDurationMs);\n }\n\n /** Clears pending transition cleanup. */\n private _clearTransition(): void {\n if (this._transitionTimer === undefined) return;\n window.clearTimeout(this._transitionTimer);\n this._transitionTimer = undefined;\n }\n\n /** Refreshes item metadata and clamps the active index after light-DOM changes. */\n private _handleMetadataChange(): void {\n this._itemsChanged = true;\n this._itemsVersion += 1;\n const preserveActiveItem = this.currentIndex === this._renderedIndex;\n const preservedIndex =\n preserveActiveItem && this._activeItem ? this._galleryItems.indexOf(this._activeItem) : -1;\n const normalized = preservedIndex >= 0 ? preservedIndex : this._normalizeIndex(this.currentIndex);\n if (normalized === this.currentIndex) {\n const item = this._galleryItems[normalized];\n const activeItemRemoved = Boolean(this._activeItem && !this._galleryItems.includes(this._activeItem));\n if (item && activeItemRemoved) {\n this._previousIndex = null;\n this._pendingChange = {\n previousIndex: this._renderedIndex,\n currentIndex: normalized,\n item,\n reason: \"items\",\n };\n }\n return;\n }\n this._nextChangeReason = \"items\";\n this.currentIndex = normalized;\n }\n\n /** Refreshes item state after the default slot changes. */\n private _handleSlotChange(): void {\n this._handleMetadataChange();\n }\n\n /** Temporarily pauses autoplay while the pointer is over the gallery. */\n private _handleMouseEnter(): void {\n this._hovered = true;\n this._restartAutoplay();\n }\n\n /** Resumes autoplay with a fresh delay after hover ends. */\n private _handleMouseLeave(): void {\n this._hovered = false;\n this._restartAutoplay();\n }\n\n /** Temporarily pauses autoplay while focus is inside the gallery. */\n private _handleFocusIn(): void {\n this._focusWithin = true;\n this._restartAutoplay();\n }\n\n /** Resumes autoplay with a fresh delay after focus leaves the gallery. */\n private _handleFocusOut(): void {\n queueMicrotask(() => {\n this._focusWithin = this.matches(\":focus-within\");\n this._restartAutoplay();\n });\n }\n\n /** Pauses or resumes scheduling when page visibility changes. */\n private readonly _handleVisibilityChange = (): void => {\n this._restartAutoplay();\n };\n\n /** Handles Left and Right arrow keyboard navigation. */\n private _handleKeyDown(event: KeyboardEvent): void {\n if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n this._showPrevious(\"keyboard\");\n return;\n }\n if (event.key === \"ArrowRight\") {\n event.preventDefault();\n this._showNext(\"keyboard\");\n }\n }\n\n /** Records the starting point of a primary pointer gesture. */\n private _handlePointerDown(event: PointerEvent): void {\n if (!event.isPrimary || event.button !== 0) return;\n if (event.composedPath().some((target) => target instanceof HTMLButtonElement)) return;\n this._pointerStart = { id: event.pointerId, x: event.clientX, y: event.clientY };\n (event.currentTarget as HTMLElement).setPointerCapture(event.pointerId);\n }\n\n /** Converts a sufficiently horizontal pointer gesture into navigation. */\n private _handlePointerUp(event: PointerEvent): void {\n const start = this._pointerStart;\n this._pointerStart = undefined;\n if (!start || start.id !== event.pointerId) return;\n\n const deltaX = event.clientX - start.x;\n const deltaY = event.clientY - start.y;\n if (Math.abs(deltaX) < swipeThresholdPx || Math.abs(deltaX) <= Math.abs(deltaY)) return;\n\n event.preventDefault();\n if (deltaX < 0) {\n this._showNext(\"swipe\");\n return;\n }\n this._showPrevious(\"swipe\");\n }\n\n /** Cancels an incomplete pointer gesture. */\n private _handlePointerCancel(): void {\n this._pointerStart = undefined;\n }\n\n /** Renders one responsive image layer for the crossfade stack. */\n private _renderPicture(index: number, state: \"current\" | \"previous\") {\n const item = this._galleryItems[index];\n if (!item) return nothing;\n\n const isPrevious = state === \"previous\";\n const transitionClass = this._previousIndex === null ? \"\" : isPrevious ? \"leaving\" : \"entering\";\n return html`\n <picture class=${transitionClass} aria-hidden=${isPrevious ? \"true\" : nothing}>\n ${this._variantsFor(item)\n .filter((variant) => variant.srcset)\n .map(\n (variant) =>\n html`<source media=${ifDefined(variant.media || undefined)} srcset=${variant.srcset} />`,\n )}\n <img src=${item.src} alt=${isPrevious ? \"\" : item.alt} draggable=\"false\" />\n </picture>\n `;\n }\n\n /** Renders enabled counter, indicator, and autoplay controls. */\n private _renderFooter(itemCount: number) {\n const showIndicators = this.showIndicators && itemCount > 1;\n const showAutoplay = this.showAutoplayControl && this.delay > 0 && itemCount > 1;\n if (!this.showCounter && !showIndicators && !showAutoplay) return nothing;\n\n return html`\n <div class=\"footer\">\n ${this.showCounter\n ? html`<span class=\"counter\">${this.currentIndex + 1} / ${itemCount}</span>`\n : nothing}\n ${showIndicators\n ? html`\n <div class=\"indicators\" role=\"group\" aria-label=\"Choose image\">\n ${this._galleryItems.map(\n (_item, index) => html`\n <button\n class=\"indicator\"\n type=\"button\"\n aria-label=\"Show image ${index + 1} of ${itemCount}\"\n aria-current=${String(index === this.currentIndex)}\n @click=${() => this._goTo(index, \"indicator\")}\n ></button>\n `,\n )}\n </div>\n `\n : nothing}\n ${showAutoplay\n ? html`\n <button\n class=\"autoplay-button\"\n type=\"button\"\n aria-label=${this.paused ? \"Resume slideshow\" : \"Pause slideshow\"}\n @click=${this._togglePaused}\n >\n ${this.paused ? \"Play\" : \"Pause\"}\n </button>\n `\n : nothing}\n </div>\n `;\n }\n\n /** Renders the active image, navigation, caption, and hidden metadata slot. */\n protected override render() {\n const itemCount = this._galleryItems.length;\n const currentItem = this._galleryItems[this.currentIndex];\n // Reserve the caption row for every slide as soon as any slide has a\n // caption, so the gallery's total height stays constant while it cycles\n // (a slide without a caption no longer collapses the box and shifts the\n // page below it).\n const hasCaptions = this._galleryItems.some((item) => item.caption);\n const objectFit: PhotoGalleryObjectFit = this.objectFit === \"contain\" ? \"contain\" : \"cover\";\n const viewportStyles = {\n \"--photo-gallery-aspect-ratio\": this.aspectRatio.trim() || \"16 / 9\",\n \"--photo-gallery-object-fit\": objectFit,\n };\n\n return html`\n <div\n class=\"gallery\"\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label=\"Photo gallery\"\n tabindex=\"0\"\n @keydown=${this._handleKeyDown}\n @mouseenter=${this._handleMouseEnter}\n @mouseleave=${this._handleMouseLeave}\n @focusin=${this._handleFocusIn}\n @focusout=${this._handleFocusOut}\n >\n ${currentItem\n ? html`\n <figure>\n <div\n class=\"viewport\"\n style=${styleMap(viewportStyles)}\n @pointerdown=${this._handlePointerDown}\n @pointerup=${this._handlePointerUp}\n @pointercancel=${this._handlePointerCancel}\n >\n <div class=\"slides\">\n ${this._previousIndex === null\n ? nothing\n : this._renderPicture(this._previousIndex, \"previous\")}\n ${this._renderPicture(this.currentIndex, \"current\")}\n </div>\n ${this.showControls && itemCount > 1\n ? html`\n <div class=\"arrow-controls\">\n <button\n class=\"arrow-button previous\"\n type=\"button\"\n aria-label=\"Previous image\"\n @click=${() => this._showPrevious()}\n >\n ${iconChevronLeft(18)}\n </button>\n <button\n class=\"arrow-button next\"\n type=\"button\"\n aria-label=\"Next image\"\n @click=${() => this._showNext()}\n >\n ${iconChevronRight(18)}\n </button>\n </div>\n `\n : nothing}\n </div>\n ${hasCaptions\n ? html`<figcaption>${currentItem.caption}</figcaption>`\n : nothing}\n </figure>\n ${this._renderFooter(itemCount)}\n `\n : nothing}\n <slot @slotchange=${this._handleSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"photo-gallery\": PhotoGallery;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"photo-gallery.js","sourceRoot":"","sources":["../src/photo-gallery.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,E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,CAAC;+CACK;AAG1B;IADhB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;mDACL;AAGvC;IADP,KAAK,EAAE;oDACqC;AAGrC;IADP,KAAK,EAAE;mDACkB;AA3Cf,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAupBxB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property, queryAssignedElements, state } from \"lit/decorators.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport type { GalleryItemVariant } from \"./gallery-item-variant.js\";\nimport { GalleryItem } from \"./gallery-item.js\";\nimport { iconChevronLeft, iconChevronRight } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type PhotoGalleryObjectFit = \"cover\" | \"contain\";\nexport type PhotoGalleryChangeReason =\n | \"autoplay\"\n | \"indicator\"\n | \"items\"\n | \"keyboard\"\n | \"next\"\n | \"previous\"\n | \"programmatic\"\n | \"swipe\";\n\nexport interface PhotoGallerySlideChangeDetail {\n previousIndex: number;\n currentIndex: number;\n item: GalleryItem;\n reason: PhotoGalleryChangeReason;\n}\n\nconst transitionDurationMs = 250;\nconst swipeThresholdPx = 40;\nconst booleanAttribute = {\n fromAttribute(value: string | null): boolean {\n return value !== null && value !== \"false\";\n },\n};\n\n/**\n * Responsive, accessible image carousel composed from declarative\n * `gallery-item` children.\n *\n * The image viewport keeps a fixed `aspect-ratio`, and the caption row is\n * reserved for every slide whenever any slide has a caption, so the carousel's\n * total height stays constant as it cycles — it never shifts the page below it.\n *\n * @element photo-gallery\n * @slot - `gallery-item` elements rendered as slides.\n * @fires slide-change - The active image changed.\n */\n@customElement(\"photo-gallery\")\nexport class PhotoGallery extends LitElement {\n /** Zero-based active image index. */\n @property({ type: Number, attribute: \"current-index\", reflect: true })\n currentIndex = 0;\n\n /** Autoplay interval in milliseconds. Set to zero to disable autoplay. */\n @property({ type: Number }) delay = 0;\n\n /** Whether previous and next buttons are shown. */\n @property({ attribute: \"show-controls\", converter: booleanAttribute })\n showControls = true;\n\n /** Whether a current/total counter is shown. */\n @property({ type: Boolean, attribute: \"show-counter\" })\n showCounter = false;\n\n /** Whether clickable slide indicators are shown. */\n @property({ type: Boolean, attribute: \"show-indicators\" })\n showIndicators = false;\n\n /** Whether autoplay includes a built-in pause/play control. */\n @property({ attribute: \"show-autoplay-control\", converter: booleanAttribute })\n showAutoplayControl = true;\n\n /** Whether autoplay is explicitly paused. */\n @property({ type: Boolean, reflect: true })\n paused = false;\n\n /** CSS aspect ratio used by the image viewport. */\n @property({ attribute: \"aspect-ratio\" })\n aspectRatio = \"16 / 9\";\n\n /** How images fit within the stable viewport. */\n @property({ attribute: \"object-fit\" })\n objectFit: PhotoGalleryObjectFit = \"cover\";\n\n @queryAssignedElements({ selector: \"gallery-item\" })\n private readonly _galleryItems!: GalleryItem[];\n\n @state()\n private _previousIndex: number | null = null;\n\n @state()\n private _itemsVersion = 0;\n\n private _autoplayTimer?: number;\n private _transitionTimer?: number;\n private _metadataObserver?: MutationObserver;\n private _hovered = false;\n private _focusWithin = false;\n private _nextChangeReason: PhotoGalleryChangeReason | null = null;\n private _pendingChange?: PhotoGallerySlideChangeDetail;\n private _pointerStart?: { id: number; x: number; y: number };\n private _itemsChanged = false;\n private _activeItem?: GalleryItem;\n private _renderedIndex = 0;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n color: var(--ui-text, #0f172a);\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, 0.875rem);\n }\n .gallery {\n outline: none;\n }\n figure {\n margin: 0;\n }\n .viewport {\n position: relative;\n overflow: hidden;\n aspect-ratio: var(--photo-gallery-aspect-ratio, 16 / 9);\n border-radius: var(--ui-radius, 0.5rem);\n background: var(--ui-surface-muted, #f8fafc);\n touch-action: pan-y;\n user-select: none;\n }\n .gallery:focus-visible .viewport {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .slides {\n display: grid;\n width: 100%;\n height: 100%;\n }\n picture {\n grid-area: 1 / 1;\n display: block;\n width: 100%;\n height: 100%;\n }\n picture img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: var(--photo-gallery-object-fit, cover);\n }\n .entering {\n z-index: 2;\n animation: gallery-fade-in 250ms ease both;\n }\n .leaving {\n z-index: 1;\n pointer-events: none;\n animation: gallery-fade-out 250ms ease both;\n }\n .arrow-controls {\n position: absolute;\n z-index: 3;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.5rem;\n pointer-events: none;\n }\n button {\n border: 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 cursor: pointer;\n }\n button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .arrow-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n color: var(--ui-on-accent, #ffffff);\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n border-radius: var(--ui-radius-pill, 9999px);\n pointer-events: auto;\n }\n .arrow-button:hover {\n background: color-mix(in srgb, var(--ui-text, #0f172a) 70%, transparent);\n }\n figcaption {\n padding: 0.5rem 0.25rem 0;\n min-height: 1lh;\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text-muted, #64748b);\n }\n .footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.75rem;\n min-height: 2rem;\n padding-top: 0.5rem;\n }\n .counter {\n color: var(--ui-text-muted, #64748b);\n font-size: var(--ui-font-size-sm, 0.75rem);\n white-space: nowrap;\n }\n .indicators {\n display: flex;\n flex: 1 1 auto;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n }\n .indicator {\n position: relative;\n width: 2rem;\n height: 2rem;\n padding: 0;\n background: transparent;\n border-radius: var(--ui-radius-pill, 9999px);\n }\n .indicator::before {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 0.625rem;\n height: 0.625rem;\n background: var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-pill, 9999px);\n content: \"\";\n transform: translate(-50%, -50%);\n }\n .indicator[aria-current=\"true\"]::before {\n background: var(--ui-primary, #4f46e5);\n }\n .autoplay-button {\n height: 2rem;\n box-sizing: border-box;\n padding: 0.25rem 0.5rem;\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface-muted, #f8fafc);\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n white-space: nowrap;\n }\n .autoplay-button:hover {\n background: var(--ui-surface, #ffffff);\n }\n slot {\n display: none;\n }\n @keyframes gallery-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n @keyframes gallery-fade-out {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .entering,\n .leaving {\n animation: none;\n }\n }\n `,\n ];\n\n /** Starts observers and autoplay integration when the element connects. */\n override connectedCallback(): void {\n super.connectedCallback();\n this._metadataObserver ??= new MutationObserver(() => this._handleMetadataChange());\n this._metadataObserver.observe(this, {\n attributes: true,\n attributeFilter: [\"alt\", \"caption\", \"media\", \"src\", \"srcset\"],\n childList: true,\n subtree: true,\n });\n document.addEventListener(\"visibilitychange\", this._handleVisibilityChange);\n }\n\n /** Releases timers and observers when the element disconnects. */\n override disconnectedCallback(): void {\n this._clearAutoplay();\n this._clearTransition();\n this._metadataObserver?.disconnect();\n document.removeEventListener(\"visibilitychange\", this._handleVisibilityChange);\n super.disconnectedCallback();\n }\n\n /** Normalizes external index changes before rendering. */\n protected override willUpdate(changed: PropertyValues<this>): void {\n if (!changed.has(\"currentIndex\")) return;\n\n const normalized = this._normalizeIndex(this.currentIndex);\n if (normalized !== this.currentIndex) {\n this.currentIndex = normalized;\n }\n\n const previousValue = changed.get(\"currentIndex\");\n if (previousValue === undefined || this._galleryItems.length === 0) {\n this._nextChangeReason = null;\n return;\n }\n\n const previousIndex = this._normalizeIndex(Number(previousValue));\n if (previousIndex === normalized) {\n this._nextChangeReason = null;\n return;\n }\n\n const reason = this._nextChangeReason ?? \"programmatic\";\n this._previousIndex = reason === \"items\" ? null : previousIndex;\n this._pendingChange = {\n previousIndex,\n currentIndex: normalized,\n item: this._galleryItems[normalized],\n reason,\n };\n this._nextChangeReason = null;\n }\n\n /** Emits completed changes and keeps autoplay synchronized with properties. */\n protected override updated(changed: PropertyValues<this>): void {\n if (this._pendingChange) {\n this.dispatchEvent(\n new CustomEvent<PhotoGallerySlideChangeDetail>(\"slide-change\", {\n bubbles: true,\n composed: true,\n detail: this._pendingChange,\n }),\n );\n this._pendingChange = undefined;\n this._scheduleTransitionCleanup();\n }\n\n if (changed.has(\"currentIndex\") || changed.has(\"delay\") || changed.has(\"paused\") || this._itemsChanged) {\n this._itemsChanged = false;\n this._restartAutoplay();\n }\n this._activeItem = this._galleryItems[this.currentIndex];\n this._renderedIndex = this.currentIndex;\n }\n\n /** Wraps any requested index into the current item range. */\n private _normalizeIndex(index: number): number {\n const count = this._galleryItems.length;\n if (count === 0 || !Number.isFinite(index)) return 0;\n return ((Math.trunc(index) % count) + count) % count;\n }\n\n /** Returns responsive variants declared directly under an item. */\n private _variantsFor(item: GalleryItem): GalleryItemVariant[] {\n return Array.from(item.children).filter(\n (child): child is GalleryItemVariant => child.tagName.toLowerCase() === \"gallery-item-variant\",\n );\n }\n\n /** Changes slides through the shared state and event path. */\n private _goTo(index: number, reason: PhotoGalleryChangeReason): void {\n const normalized = this._normalizeIndex(index);\n if (this._galleryItems.length < 2 || normalized === this.currentIndex) {\n this._restartAutoplay();\n return;\n }\n\n this._nextChangeReason = reason;\n this.currentIndex = normalized;\n }\n\n /** Moves to the previous image. */\n private _showPrevious(reason: PhotoGalleryChangeReason = \"previous\"): void {\n this._goTo(this.currentIndex - 1, reason);\n }\n\n /** Moves to the next image. */\n private _showNext(reason: PhotoGalleryChangeReason = \"next\"): void {\n this._goTo(this.currentIndex + 1, reason);\n }\n\n /** Toggles explicit autoplay pause state. */\n private _togglePaused(): void {\n this.paused = !this.paused;\n }\n\n /** Clears and conditionally schedules the next autoplay advance. */\n private _restartAutoplay(): void {\n this._clearAutoplay();\n if (!this._canAutoplay()) return;\n\n this._autoplayTimer = window.setTimeout(() => {\n this._showNext(\"autoplay\");\n }, this.delay);\n }\n\n /** Reports whether autoplay may currently schedule a transition. */\n private _canAutoplay(): boolean {\n return (\n this.delay > 0 &&\n this._galleryItems.length > 1 &&\n !this.paused &&\n !this._hovered &&\n !this._focusWithin &&\n !document.hidden\n );\n }\n\n /** Clears the pending autoplay timeout. */\n private _clearAutoplay(): void {\n if (this._autoplayTimer === undefined) return;\n window.clearTimeout(this._autoplayTimer);\n this._autoplayTimer = undefined;\n }\n\n /** Removes the outgoing crossfade layer after the animation completes. */\n private _scheduleTransitionCleanup(): void {\n this._clearTransition();\n this._transitionTimer = window.setTimeout(() => {\n this._previousIndex = null;\n this._transitionTimer = undefined;\n }, transitionDurationMs);\n }\n\n /** Clears pending transition cleanup. */\n private _clearTransition(): void {\n if (this._transitionTimer === undefined) return;\n window.clearTimeout(this._transitionTimer);\n this._transitionTimer = undefined;\n }\n\n /** Refreshes item metadata and clamps the active index after light-DOM changes. */\n private _handleMetadataChange(): void {\n this._itemsChanged = true;\n this._itemsVersion += 1;\n const preserveActiveItem = this.currentIndex === this._renderedIndex;\n const preservedIndex =\n preserveActiveItem && this._activeItem ? this._galleryItems.indexOf(this._activeItem) : -1;\n const normalized = preservedIndex >= 0 ? preservedIndex : this._normalizeIndex(this.currentIndex);\n if (normalized === this.currentIndex) {\n const item = this._galleryItems[normalized];\n const activeItemRemoved = Boolean(this._activeItem && !this._galleryItems.includes(this._activeItem));\n if (item && activeItemRemoved) {\n this._previousIndex = null;\n this._pendingChange = {\n previousIndex: this._renderedIndex,\n currentIndex: normalized,\n item,\n reason: \"items\",\n };\n }\n return;\n }\n this._nextChangeReason = \"items\";\n this.currentIndex = normalized;\n }\n\n /** Refreshes item state after the default slot changes. */\n private _handleSlotChange(): void {\n this._handleMetadataChange();\n }\n\n /** Temporarily pauses autoplay while the pointer is over the gallery. */\n private _handleMouseEnter(): void {\n this._hovered = true;\n this._restartAutoplay();\n }\n\n /** Resumes autoplay with a fresh delay after hover ends. */\n private _handleMouseLeave(): void {\n this._hovered = false;\n this._restartAutoplay();\n }\n\n /** Temporarily pauses autoplay while focus is inside the gallery. */\n private _handleFocusIn(): void {\n this._focusWithin = true;\n this._restartAutoplay();\n }\n\n /** Resumes autoplay with a fresh delay after focus leaves the gallery. */\n private _handleFocusOut(): void {\n queueMicrotask(() => {\n this._focusWithin = this.matches(\":focus-within\");\n this._restartAutoplay();\n });\n }\n\n /** Pauses or resumes scheduling when page visibility changes. */\n private readonly _handleVisibilityChange = (): void => {\n this._restartAutoplay();\n };\n\n /** Handles Left and Right arrow keyboard navigation. */\n private _handleKeyDown(event: KeyboardEvent): void {\n if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n this._showPrevious(\"keyboard\");\n return;\n }\n if (event.key === \"ArrowRight\") {\n event.preventDefault();\n this._showNext(\"keyboard\");\n }\n }\n\n /** Records the starting point of a primary pointer gesture. */\n private _handlePointerDown(event: PointerEvent): void {\n if (!event.isPrimary || event.button !== 0) return;\n if (event.composedPath().some((target) => target instanceof HTMLButtonElement)) return;\n this._pointerStart = { id: event.pointerId, x: event.clientX, y: event.clientY };\n (event.currentTarget as HTMLElement).setPointerCapture(event.pointerId);\n }\n\n /** Converts a sufficiently horizontal pointer gesture into navigation. */\n private _handlePointerUp(event: PointerEvent): void {\n const start = this._pointerStart;\n this._pointerStart = undefined;\n if (!start || start.id !== event.pointerId) return;\n\n const deltaX = event.clientX - start.x;\n const deltaY = event.clientY - start.y;\n if (Math.abs(deltaX) < swipeThresholdPx || Math.abs(deltaX) <= Math.abs(deltaY)) return;\n\n event.preventDefault();\n if (deltaX < 0) {\n this._showNext(\"swipe\");\n return;\n }\n this._showPrevious(\"swipe\");\n }\n\n /** Cancels an incomplete pointer gesture. */\n private _handlePointerCancel(): void {\n this._pointerStart = undefined;\n }\n\n /** Renders one responsive image layer for the crossfade stack. */\n private _renderPicture(index: number, state: \"current\" | \"previous\") {\n const item = this._galleryItems[index];\n if (!item) return nothing;\n\n const isPrevious = state === \"previous\";\n const transitionClass = this._previousIndex === null ? \"\" : isPrevious ? \"leaving\" : \"entering\";\n return html`\n <picture class=${transitionClass} aria-hidden=${isPrevious ? \"true\" : nothing}>\n ${this._variantsFor(item)\n .filter((variant) => variant.srcset)\n .map(\n (variant) =>\n html`<source media=${ifDefined(variant.media || undefined)} srcset=${variant.srcset} />`,\n )}\n <img src=${item.src} alt=${isPrevious ? \"\" : item.alt} draggable=\"false\" />\n </picture>\n `;\n }\n\n /** Renders enabled counter, indicator, and autoplay controls. */\n private _renderFooter(itemCount: number) {\n const showIndicators = this.showIndicators && itemCount > 1;\n const showAutoplay = this.showAutoplayControl && this.delay > 0 && itemCount > 1;\n if (!this.showCounter && !showIndicators && !showAutoplay) return nothing;\n\n return html`\n <div class=\"footer\">\n ${this.showCounter\n ? html`<span class=\"counter\">${this.currentIndex + 1} / ${itemCount}</span>`\n : nothing}\n ${showIndicators\n ? html`\n <div class=\"indicators\" role=\"group\" aria-label=\"Choose image\">\n ${this._galleryItems.map(\n (_item, index) => html`\n <button\n class=\"indicator\"\n type=\"button\"\n aria-label=\"Show image ${index + 1} of ${itemCount}\"\n aria-current=${String(index === this.currentIndex)}\n @click=${() => this._goTo(index, \"indicator\")}\n ></button>\n `,\n )}\n </div>\n `\n : nothing}\n ${showAutoplay\n ? html`\n <button\n class=\"autoplay-button\"\n type=\"button\"\n aria-label=${this.paused ? \"Resume slideshow\" : \"Pause slideshow\"}\n @click=${this._togglePaused}\n >\n ${this.paused ? \"Play\" : \"Pause\"}\n </button>\n `\n : nothing}\n </div>\n `;\n }\n\n /** Renders the active image, navigation, caption, and hidden metadata slot. */\n protected override render() {\n const itemCount = this._galleryItems.length;\n const currentItem = this._galleryItems[this.currentIndex];\n // Reserve the caption row for every slide as soon as any slide has a\n // caption, so the gallery's total height stays constant while it cycles\n // (a slide without a caption no longer collapses the box and shifts the\n // page below it).\n const hasCaptions = this._galleryItems.some((item) => item.caption);\n const objectFit: PhotoGalleryObjectFit = this.objectFit === \"contain\" ? \"contain\" : \"cover\";\n const viewportStyles = {\n \"--photo-gallery-aspect-ratio\": this.aspectRatio.trim() || \"16 / 9\",\n \"--photo-gallery-object-fit\": objectFit,\n };\n\n return html`\n <div\n class=\"gallery\"\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label=\"Photo gallery\"\n tabindex=\"0\"\n @keydown=${this._handleKeyDown}\n @mouseenter=${this._handleMouseEnter}\n @mouseleave=${this._handleMouseLeave}\n @focusin=${this._handleFocusIn}\n @focusout=${this._handleFocusOut}\n >\n ${currentItem\n ? html`\n <figure>\n <div\n class=\"viewport\"\n style=${styleMap(viewportStyles)}\n @pointerdown=${this._handlePointerDown}\n @pointerup=${this._handlePointerUp}\n @pointercancel=${this._handlePointerCancel}\n >\n <div class=\"slides\">\n ${this._previousIndex === null\n ? nothing\n : this._renderPicture(this._previousIndex, \"previous\")}\n ${this._renderPicture(this.currentIndex, \"current\")}\n </div>\n ${this.showControls && itemCount > 1\n ? html`\n <div class=\"arrow-controls\">\n <button\n class=\"arrow-button previous\"\n type=\"button\"\n aria-label=\"Previous image\"\n @click=${() => this._showPrevious()}\n >\n ${iconChevronLeft(18)}\n </button>\n <button\n class=\"arrow-button next\"\n type=\"button\"\n aria-label=\"Next image\"\n @click=${() => this._showNext()}\n >\n ${iconChevronRight(18)}\n </button>\n </div>\n `\n : nothing}\n </div>\n ${hasCaptions\n ? html`<figcaption>${currentItem.caption}</figcaption>`\n : nothing}\n </figure>\n ${this._renderFooter(itemCount)}\n `\n : nothing}\n <slot @slotchange=${this._handleSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"photo-gallery\": PhotoGallery;\n }\n}\n"]}
|
package/dist/radio-pills.js
CHANGED
|
@@ -55,7 +55,7 @@ let RadioPills = class RadioPills extends LitElement {
|
|
|
55
55
|
box-sizing: border-box;
|
|
56
56
|
padding: 0.25rem 0.5rem;
|
|
57
57
|
border: 1px solid var(--ui-border, #e2e8f0);
|
|
58
|
-
border-radius:
|
|
58
|
+
border-radius: var(--ui-radius-pill, 9999px);
|
|
59
59
|
cursor: pointer;
|
|
60
60
|
font-family: var(
|
|
61
61
|
--ui-font,
|
package/dist/radio-pills.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-pills.js","sourceRoot":"","sources":["../src/radio-pills.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,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QA+EL,wCAAwC;QACR,YAAO,GAAsB,EAAE,CAAC;QAChE,gCAAgC;QACpB,UAAK,GAAG,EAAE,CAAC;QACvB,gDAAgD;QACnB,aAAQ,GAAG,KAAK,CAAC;QAErC,UAAK,GAA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customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface RadioPillOption {\n value: string;\n label: string;\n}\n\nlet instanceCount = 0;\n\n/**\n * Single-select group of compact pill-shaped options — for many short,\n * same-shaped choices (a basemap style, a unit toggle). For a handful of\n * choices where a description matters, use `radio-cards` instead. Wraps\n * native radio inputs for keyboard/a11y and fires `change` rather than\n * relying on form submission.\n *\n * The selected pill's border/radio dot read `--ui-button-accent` (a solid\n * stand-in, since `border-color`/`accent-color` can't render a gradient),\n * and its background reads the shared `--ui-button-secondary-surface-muted`\n * plus `--ui-button-highlight`, so a gradient theme tints it consistently\n * with `button-group`/`pagination-nav`'s equivalents.\n *\n * @element radio-pills\n * @fires change - A pill was selected; detail: { value }.\n */\n@customElement(\"radio-pills\")\nexport class RadioPills extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .options {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n }\n .pill {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-height: 2rem;\n box-sizing: border-box;\n padding: 0.25rem 0.5rem;\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius:
|
|
1
|
+
{"version":3,"file":"radio-pills.js","sourceRoot":"","sources":["../src/radio-pills.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,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QA+EL,wCAAwC;QACR,YAAO,GAAs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AAE,CAAC;4CAAkB;AApFnC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAoHtB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface RadioPillOption {\n value: string;\n label: string;\n}\n\nlet instanceCount = 0;\n\n/**\n * Single-select group of compact pill-shaped options — for many short,\n * same-shaped choices (a basemap style, a unit toggle). For a handful of\n * choices where a description matters, use `radio-cards` instead. Wraps\n * native radio inputs for keyboard/a11y and fires `change` rather than\n * relying on form submission.\n *\n * The selected pill's border/radio dot read `--ui-button-accent` (a solid\n * stand-in, since `border-color`/`accent-color` can't render a gradient),\n * and its background reads the shared `--ui-button-secondary-surface-muted`\n * plus `--ui-button-highlight`, so a gradient theme tints it consistently\n * with `button-group`/`pagination-nav`'s equivalents.\n *\n * @element radio-pills\n * @fires change - A pill was selected; detail: { value }.\n */\n@customElement(\"radio-pills\")\nexport class RadioPills extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .options {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n }\n .pill {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-height: 2rem;\n box-sizing: border-box;\n padding: 0.25rem 0.5rem;\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-pill, 9999px);\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 line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n }\n .pill:has(input:checked) {\n border-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .pill input {\n width: 1rem;\n height: 1rem;\n accent-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n cursor: pointer;\n margin: 0;\n }\n .pill:has(input:focus-visible) {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .pill:has(input:checked):has(input:focus-visible) {\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 .pill:has(input:disabled) {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .pill:has(input:disabled) input {\n cursor: not-allowed;\n }\n @media (forced-colors: active) {\n .pill:has(input:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .pill:has(input:checked) {\n border-color: Highlight;\n }\n .pill:has(input:disabled) {\n color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Options to render, one pill each. */\n @property({ attribute: false }) options: RadioPillOption[] = [];\n /** Currently selected value. */\n @property() value = \"\";\n /** Disables every native radio in the group. */\n @property({ type: Boolean }) disabled = false;\n\n readonly #name = `radio-pills-${++instanceCount}`;\n\n private _onChange(value: string) {\n if (this.disabled) return;\n this.value = value;\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <div class=\"options\">\n ${repeat(\n this.options,\n (opt) => opt.value,\n (opt) => html`\n <label class=\"pill\">\n <input\n type=\"radio\"\n name=${this.#name}\n ?checked=${this.value === opt.value}\n ?disabled=${this.disabled}\n @change=${() => this._onChange(opt.value)}\n />\n <span>${opt.label}</span>\n </label>\n `,\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"radio-pills\": RadioPills;\n }\n}\n"]}
|
package/dist/range-slider.js
CHANGED
|
@@ -64,7 +64,7 @@ let RangeSlider = class RangeSlider extends LitElement {
|
|
|
64
64
|
/* Track */
|
|
65
65
|
input[type="range"]::-webkit-slider-runnable-track {
|
|
66
66
|
height: 0.375rem;
|
|
67
|
-
border-radius: 9999px;
|
|
67
|
+
border-radius: var(--ui-radius-pill, 9999px);
|
|
68
68
|
/* A hard-stop background gradient used as a two-tone fill trick —
|
|
69
69
|
its color-stops can't themselves hold a gradient value, so this
|
|
70
70
|
reads --ui-button-accent (a solid stand-in), not
|
|
@@ -79,12 +79,12 @@ let RangeSlider = class RangeSlider extends LitElement {
|
|
|
79
79
|
}
|
|
80
80
|
input[type="range"]::-moz-range-track {
|
|
81
81
|
height: 0.375rem;
|
|
82
|
-
border-radius: 9999px;
|
|
82
|
+
border-radius: var(--ui-radius-pill, 9999px);
|
|
83
83
|
background: var(--ui-surface-muted, #f8fafc);
|
|
84
84
|
}
|
|
85
85
|
input[type="range"]::-moz-range-progress {
|
|
86
86
|
height: 0.375rem;
|
|
87
|
-
border-radius: 9999px;
|
|
87
|
+
border-radius: var(--ui-radius-pill, 9999px);
|
|
88
88
|
background: var(--ui-button-accent, var(--ui-primary, #4f46e5));
|
|
89
89
|
}
|
|
90
90
|
/* Thumb */
|
|
@@ -97,7 +97,7 @@ let RangeSlider = class RangeSlider extends LitElement {
|
|
|
97
97
|
thinner custom track — nudge it up to align with the track.
|
|
98
98
|
A transform offset (not margin) so it isn't a spacing-grid value. */
|
|
99
99
|
transform: translateY(-0.3125rem);
|
|
100
|
-
border-radius: 50
|
|
100
|
+
border-radius: var(--ui-radius-circle, 50%);
|
|
101
101
|
background: var(--ui-button-background, var(--ui-primary, #4f46e5));
|
|
102
102
|
border: 2px solid var(--ui-surface, #ffffff);
|
|
103
103
|
box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);
|
|
@@ -105,7 +105,7 @@ let RangeSlider = class RangeSlider extends LitElement {
|
|
|
105
105
|
input[type="range"]::-moz-range-thumb {
|
|
106
106
|
width: 1rem;
|
|
107
107
|
height: 1rem;
|
|
108
|
-
border-radius: 50
|
|
108
|
+
border-radius: var(--ui-radius-circle, 50%);
|
|
109
109
|
background: var(--ui-button-background, var(--ui-primary, #4f46e5));
|
|
110
110
|
border: 2px solid var(--ui-surface, #ffffff);
|
|
111
111
|
box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);
|
package/dist/range-slider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-slider.js","sourceRoot":"","sources":["../src/range-slider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;;GAcG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAgHL,qBAAqB;QACO,QAAG,GAAG,CAAC,CAAC;QACpC,qBAAqB;QACO,QAAG,GAAG,GAAG,CAAC;QACtC,sBAAsB;QACM,SAAI,GAAG,CAAC,CAAC;QACrC,qBAAqB;QACO,UAAK,GAAG,CAAC,CAAC;QACtC,2EAA2E;QAC9C,aAAQ,GAAG,KAAK,CAAC;QAC9C,uBAAuB;QACX,SAAI,GAAG,EAAE,CAAC;QAEL,kBAAa,GAAG,KAAK,CAAC;QAEvC,eAAU,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACpC,kBAAa,GAAG,CAAC,CAAC;IAqEpB,CAAC;aApMQ,mBAAc,GAAG,IAAI,AAAP,CAAQ;aAEb,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAER;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAW;AAEV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAU;AAET;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAW;AAET;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAkB;AAElC;IAAX,QAAQ,EAAE;yCAAW;AAEL;IAAhB,KAAK,EAAE;kDAA+B;AA7H5B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAqMvB","sourcesContent":["import { LitElement, css, html, type PropertyValues } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A form-associated numeric range slider, usable standalone or inside a\n * native `<form>`. Wraps a native `<input type=\"range\">` (kept for its free\n * keyboard, drag, and screen-reader support) restyled to match this\n * package's track/fill visual language (`stat-meter`, `percent-bar-chart`)\n * instead of the browser-default appearance. Purely a value control — no\n * built-in label; wrap in `form-field` for a labeled field, or render a\n * value readout next to it (see the playground example), matching\n * `autocomplete-input`/`form-select`.\n *\n * @element range-slider\n * @fires input - Fires continuously while dragging/typing; detail: `{ value }`.\n * @fires change - Fires once the value is committed (drag released, arrow\n * key released); detail: `{ value }`.\n */\n@customElement(\"range-slider\")\nexport class RangeSlider extends LitElement {\n static formAssociated = true;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n input[type=\"range\"] {\n -webkit-appearance: none;\n appearance: none;\n width: 100%;\n height: 2rem;\n margin: 0;\n background: transparent;\n cursor: pointer;\n }\n input[type=\"range\"]:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n /* Track */\n input[type=\"range\"]::-webkit-slider-runnable-track {\n height: 0.375rem;\n border-radius: 9999px;\n /* A hard-stop background gradient used as a two-tone fill trick —\n its color-stops can't themselves hold a gradient value, so this\n reads --ui-button-accent (a solid stand-in), not\n --ui-button-background directly. */\n background: linear-gradient(\n to right,\n var(--ui-button-accent, var(--ui-primary, #4f46e5)) 0%,\n var(--ui-button-accent, var(--ui-primary, #4f46e5)) var(--range-percent, 0%),\n var(--ui-surface-muted, #f8fafc) var(--range-percent, 0%),\n var(--ui-surface-muted, #f8fafc) 100%\n );\n }\n input[type=\"range\"]::-moz-range-track {\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--ui-surface-muted, #f8fafc);\n }\n input[type=\"range\"]::-moz-range-progress {\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n }\n /* Thumb */\n input[type=\"range\"]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 1rem;\n height: 1rem;\n /* WebKit centers the thumb on the input's full 2rem box, not the\n thinner custom track — nudge it up to align with the track.\n A transform offset (not margin) so it isn't a spacing-grid value. */\n transform: translateY(-0.3125rem);\n border-radius: 50%;\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border: 2px solid var(--ui-surface, #ffffff);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n input[type=\"range\"]::-moz-range-thumb {\n width: 1rem;\n height: 1rem;\n border-radius: 50%;\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border: 2px solid var(--ui-surface, #ffffff);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n input[type=\"range\"]:disabled::-webkit-slider-thumb {\n background: var(--ui-text-muted, #64748b);\n }\n input[type=\"range\"]:disabled::-moz-range-thumb {\n background: var(--ui-text-muted, #64748b);\n }\n input[type=\"range\"]:focus-visible {\n outline: none;\n }\n input[type=\"range\"]:focus-visible::-webkit-slider-thumb {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n input[type=\"range\"]:focus-visible::-moz-range-thumb {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n @media (prefers-reduced-motion: no-preference) {\n input[type=\"range\"]::-webkit-slider-thumb {\n transition: box-shadow 120ms ease;\n }\n input[type=\"range\"]::-moz-range-thumb {\n transition: box-shadow 120ms ease;\n }\n }\n @media (forced-colors: active) {\n input[type=\"range\"]::-webkit-slider-runnable-track {\n background: Canvas;\n border: 1px solid CanvasText;\n }\n input[type=\"range\"]::-webkit-slider-thumb {\n background: Highlight;\n border-color: Canvas;\n }\n input[type=\"range\"]:focus-visible::-webkit-slider-thumb {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n /** Minimum value. */\n @property({ type: Number }) min = 0;\n /** Maximum value. */\n @property({ type: Number }) max = 100;\n /** Step increment. */\n @property({ type: Number }) step = 1;\n /** Current value. */\n @property({ type: Number }) value = 0;\n /** Disables interaction; merged with an ancestor `<fieldset disabled>`. */\n @property({ type: Boolean }) disabled = false;\n /** Form field name. */\n @property() name = \"\";\n\n @state() private _formDisabled = false;\n\n #internals = this.attachInternals();\n #defaultValue = 0;\n\n /** Whether the host or an ancestor fieldset currently disables the control. */\n get #isDisabled(): boolean {\n return this.disabled || this._formDisabled;\n }\n\n get #percent(): number {\n const range = this.max - this.min || 1;\n return ((this.value - this.min) / range) * 100;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.hasUpdated) this.#defaultValue = this.value;\n if (changed.has(\"value\")) this.#internals.setFormValue(String(this.value));\n }\n\n /** Resets to the value present at first render, per the form contract. */\n formResetCallback(): void {\n this.value = this.#defaultValue;\n }\n\n /** Mirrors an ancestor fieldset's disabled state. */\n formDisabledCallback(disabled: boolean): void {\n this._formDisabled = disabled;\n }\n\n /** Restores the value from saved form state (bfcache/autofill). */\n formStateRestoreCallback(state: string | File | FormData | null): void {\n if (typeof state !== \"string\") return;\n const parsed = Number(state);\n if (!Number.isNaN(parsed)) this.value = parsed;\n }\n\n // The native input's own \"input\"/\"change\" events are composed (cross the\n // shadow boundary) — stop them so only our re-dispatched CustomEvent\n // (carrying `detail.value`) reaches consumers, matching text-area.ts's fix\n // for the same issue. Otherwise the native event bubbles out afterwards\n // too, re-invoking the same listener with a plain Event whose `detail` is\n // undefined, crashing consumer code that reads `e.detail.value`.\n #onInput(e: Event): void {\n e.stopPropagation();\n const input = e.target as HTMLInputElement;\n this.value = Number(input.value);\n this.dispatchEvent(new CustomEvent(\"input\", { detail: { value: this.value }, bubbles: true, composed: true }));\n }\n\n #onChange(e: Event): void {\n e.stopPropagation();\n const input = e.target as HTMLInputElement;\n this.value = Number(input.value);\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value: this.value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <input\n type=\"range\"\n style=${`--range-percent: ${this.#percent}%`}\n min=${this.min}\n max=${this.max}\n step=${this.step}\n .value=${String(this.value)}\n ?disabled=${this.#isDisabled}\n @input=${(e: Event) => this.#onInput(e)}\n @change=${(e: Event) => this.#onChange(e)}\n />\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"range-slider\": RangeSlider;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"range-slider.js","sourceRoot":"","sources":["../src/range-slider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;;GAcG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAgHL,qBAAqB;QACO,QAAG,GAAG,CAAC,CAAC;QACpC,qBAAqB;QACO,QAAG,GAAG,GAAG,CAAC;QACtC,sBAAsB;QACM,SAAI,GAAG,CAAC,CA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;QACb,OAAO,IAAI,CAAA;;;gBAGC,oBAAoB,IAAI,CAAC,QAAQ,GAAG;cACtC,IAAI,CAAC,GAAG;cACR,IAAI,CAAC,GAAG;eACP,IAAI,CAAC,IAAI;iBACP,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;oBACf,IAAI,CAAC,WAAW;iBACnB,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;kBAC7B,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;;KAE5C,CAAC;IACJ,CAAC;CACF,CAAA;AApF6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAS;AAER;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAW;AAEV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAU;AAET;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAW;AAET;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAkB;AAElC;IAAX,QAAQ,EAAE;yCAAW;AAEL;IAAhB,KAAK,EAAE;kDAA+B;AA7H5B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAqMvB","sourcesContent":["import { LitElement, css, html, type PropertyValues } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A form-associated numeric range slider, usable standalone or inside a\n * native `<form>`. Wraps a native `<input type=\"range\">` (kept for its free\n * keyboard, drag, and screen-reader support) restyled to match this\n * package's track/fill visual language (`stat-meter`, `percent-bar-chart`)\n * instead of the browser-default appearance. Purely a value control — no\n * built-in label; wrap in `form-field` for a labeled field, or render a\n * value readout next to it (see the playground example), matching\n * `autocomplete-input`/`form-select`.\n *\n * @element range-slider\n * @fires input - Fires continuously while dragging/typing; detail: `{ value }`.\n * @fires change - Fires once the value is committed (drag released, arrow\n * key released); detail: `{ value }`.\n */\n@customElement(\"range-slider\")\nexport class RangeSlider extends LitElement {\n static formAssociated = true;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n input[type=\"range\"] {\n -webkit-appearance: none;\n appearance: none;\n width: 100%;\n height: 2rem;\n margin: 0;\n background: transparent;\n cursor: pointer;\n }\n input[type=\"range\"]:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n /* Track */\n input[type=\"range\"]::-webkit-slider-runnable-track {\n height: 0.375rem;\n border-radius: var(--ui-radius-pill, 9999px);\n /* A hard-stop background gradient used as a two-tone fill trick —\n its color-stops can't themselves hold a gradient value, so this\n reads --ui-button-accent (a solid stand-in), not\n --ui-button-background directly. */\n background: linear-gradient(\n to right,\n var(--ui-button-accent, var(--ui-primary, #4f46e5)) 0%,\n var(--ui-button-accent, var(--ui-primary, #4f46e5)) var(--range-percent, 0%),\n var(--ui-surface-muted, #f8fafc) var(--range-percent, 0%),\n var(--ui-surface-muted, #f8fafc) 100%\n );\n }\n input[type=\"range\"]::-moz-range-track {\n height: 0.375rem;\n border-radius: var(--ui-radius-pill, 9999px);\n background: var(--ui-surface-muted, #f8fafc);\n }\n input[type=\"range\"]::-moz-range-progress {\n height: 0.375rem;\n border-radius: var(--ui-radius-pill, 9999px);\n background: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n }\n /* Thumb */\n input[type=\"range\"]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 1rem;\n height: 1rem;\n /* WebKit centers the thumb on the input's full 2rem box, not the\n thinner custom track — nudge it up to align with the track.\n A transform offset (not margin) so it isn't a spacing-grid value. */\n transform: translateY(-0.3125rem);\n border-radius: var(--ui-radius-circle, 50%);\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border: 2px solid var(--ui-surface, #ffffff);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n input[type=\"range\"]::-moz-range-thumb {\n width: 1rem;\n height: 1rem;\n border-radius: var(--ui-radius-circle, 50%);\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border: 2px solid var(--ui-surface, #ffffff);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n input[type=\"range\"]:disabled::-webkit-slider-thumb {\n background: var(--ui-text-muted, #64748b);\n }\n input[type=\"range\"]:disabled::-moz-range-thumb {\n background: var(--ui-text-muted, #64748b);\n }\n input[type=\"range\"]:focus-visible {\n outline: none;\n }\n input[type=\"range\"]:focus-visible::-webkit-slider-thumb {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n input[type=\"range\"]:focus-visible::-moz-range-thumb {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n @media (prefers-reduced-motion: no-preference) {\n input[type=\"range\"]::-webkit-slider-thumb {\n transition: box-shadow 120ms ease;\n }\n input[type=\"range\"]::-moz-range-thumb {\n transition: box-shadow 120ms ease;\n }\n }\n @media (forced-colors: active) {\n input[type=\"range\"]::-webkit-slider-runnable-track {\n background: Canvas;\n border: 1px solid CanvasText;\n }\n input[type=\"range\"]::-webkit-slider-thumb {\n background: Highlight;\n border-color: Canvas;\n }\n input[type=\"range\"]:focus-visible::-webkit-slider-thumb {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n /** Minimum value. */\n @property({ type: Number }) min = 0;\n /** Maximum value. */\n @property({ type: Number }) max = 100;\n /** Step increment. */\n @property({ type: Number }) step = 1;\n /** Current value. */\n @property({ type: Number }) value = 0;\n /** Disables interaction; merged with an ancestor `<fieldset disabled>`. */\n @property({ type: Boolean }) disabled = false;\n /** Form field name. */\n @property() name = \"\";\n\n @state() private _formDisabled = false;\n\n #internals = this.attachInternals();\n #defaultValue = 0;\n\n /** Whether the host or an ancestor fieldset currently disables the control. */\n get #isDisabled(): boolean {\n return this.disabled || this._formDisabled;\n }\n\n get #percent(): number {\n const range = this.max - this.min || 1;\n return ((this.value - this.min) / range) * 100;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.hasUpdated) this.#defaultValue = this.value;\n if (changed.has(\"value\")) this.#internals.setFormValue(String(this.value));\n }\n\n /** Resets to the value present at first render, per the form contract. */\n formResetCallback(): void {\n this.value = this.#defaultValue;\n }\n\n /** Mirrors an ancestor fieldset's disabled state. */\n formDisabledCallback(disabled: boolean): void {\n this._formDisabled = disabled;\n }\n\n /** Restores the value from saved form state (bfcache/autofill). */\n formStateRestoreCallback(state: string | File | FormData | null): void {\n if (typeof state !== \"string\") return;\n const parsed = Number(state);\n if (!Number.isNaN(parsed)) this.value = parsed;\n }\n\n // The native input's own \"input\"/\"change\" events are composed (cross the\n // shadow boundary) — stop them so only our re-dispatched CustomEvent\n // (carrying `detail.value`) reaches consumers, matching text-area.ts's fix\n // for the same issue. Otherwise the native event bubbles out afterwards\n // too, re-invoking the same listener with a plain Event whose `detail` is\n // undefined, crashing consumer code that reads `e.detail.value`.\n #onInput(e: Event): void {\n e.stopPropagation();\n const input = e.target as HTMLInputElement;\n this.value = Number(input.value);\n this.dispatchEvent(new CustomEvent(\"input\", { detail: { value: this.value }, bubbles: true, composed: true }));\n }\n\n #onChange(e: Event): void {\n e.stopPropagation();\n const input = e.target as HTMLInputElement;\n this.value = Number(input.value);\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value: this.value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <input\n type=\"range\"\n style=${`--range-percent: ${this.#percent}%`}\n min=${this.min}\n max=${this.max}\n step=${this.step}\n .value=${String(this.value)}\n ?disabled=${this.#isDisabled}\n @input=${(e: Event) => this.#onInput(e)}\n @change=${(e: Event) => this.#onChange(e)}\n />\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"range-slider\": RangeSlider;\n }\n}\n"]}
|
package/dist/scroll-dots.js
CHANGED
|
@@ -65,7 +65,7 @@ let ScrollDots = class ScrollDots extends LitElement {
|
|
|
65
65
|
height: 0.625rem;
|
|
66
66
|
padding: 0;
|
|
67
67
|
border: none;
|
|
68
|
-
border-radius: 9999px;
|
|
68
|
+
border-radius: var(--ui-radius-pill, 9999px);
|
|
69
69
|
/* Same lighter-on-top token gradient as map-circle/timeline-entry's
|
|
70
70
|
dot; the base color is swapped via the private --_dot var. */
|
|
71
71
|
background: linear-gradient(
|
package/dist/scroll-dots.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scroll-dots.js","sourceRoot":"","sources":["../src/scroll-dots.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;AAkBrC;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QACL,qFAAqF;QACrD,UAAK,GAAqB,EAAE,CAAC;QAE7D,gFAAgF;QACpD,WAAM,GAAG,CAAC,CAAC;QAEvC,8EAA8E;QAClE,UAAK,GAAG,EAAE,CAAC;QAEvB,0DAA0D;QAC9C,UAAK,GAAG,EAAE,CAAC;IA2HzB,CAAC;aAzHiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8EF;KACF,AAjFqB,CAiFpB;IAEO,MAAM;QACb,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,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AAX,QAAQ,EAAE;yCAAY;AAXZ,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAsItB;;AAED,SAAS,SAAS,CAAC,IAAoB;IACrC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** One dot on a `scroll-dots` rail. */\nexport interface ScrollDotItem {\n /** Accessible name for the dot's button — the section or slide title. */\n label: string;\n /** Renders the dot smaller and quieter, for a section subordinate to its neighbours. */\n muted?: boolean;\n}\n\n/** A dot, or a bare string as shorthand for `{ label }`. */\nexport type ScrollDotsItem = string | ScrollDotItem;\n\n/** Fired when the user picks a dot. `detail.index` is the 0-based target. */\nexport interface DotSelectDetail {\n index: number;\n}\n\n/**\n * Vertical section navigator for a long scrolled page or a slide deck: one dot\n * per section, the active one drawn as an elongated rounded bar rather than a\n * dot, which is the only cue needed to read position at a glance.\n *\n * Controlled, like `pagination-nav`: it owns no scroll behavior and never\n * reads the scroll position. The consumer sets `active` and moves the page in\n * response to `dot-select` — what counts as the active section differs too much\n * between a snapped deck and an ordinary long page to bake in.\n *\n * Positioning is also the consumer's, since a rail is normally fixed into a\n * reserved gutter that only the page knows the width of.\n *\n * The dots use the same lighter-on-top gradient as `map-circle`/`map-pin`,\n * derived from a single base `color` — a rail beside a map reads as the same\n * family of marks as the pins on it.\n *\n * @element scroll-dots\n * @fires dot-select - The user picked a dot (`detail: { index }`).\n */\n@customElement(\"scroll-dots\")\nexport class ScrollDots extends LitElement {\n /** Dots to render, in document order. A bare string is shorthand for `{ label }`. */\n @property({ attribute: false }) items: ScrollDotsItem[] = [];\n\n /** 0-based index of the active dot. Out-of-range values simply match no dot. */\n @property({ type: Number }) active = 0;\n\n /** Base color the dot gradient is derived from. Empty uses `--ui-primary`. */\n @property() color = \"\";\n\n /** Accessible name for the rail, e.g. \"Journey stops\". */\n @property() label = \"\";\n\n static override styles = [\n tokens,\n css`\n /*\n * will-change promotes the rail to its own compositor layer. A rail is\n * typically fixed over the page's main content — for a map deck, over a\n * WebGL canvas — and without it the browser repaints the dots on the main\n * thread, which flickers and squares off their rounded edges whenever a\n * scroll and an animation are competing for that thread.\n */\n :host {\n display: inline-flex;\n will-change: transform;\n backface-visibility: hidden;\n }\n nav {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 0.75rem;\n }\n button {\n width: 0.625rem;\n height: 0.625rem;\n padding: 0;\n border: none;\n border-radius: 9999px;\n /* Same lighter-on-top token gradient as map-circle/timeline-entry's\n dot; the base color is swapped via the private --_dot var. */\n background: linear-gradient(\n to bottom,\n color-mix(in srgb, var(--_dot, var(--ui-text-muted, #64748b)) 70%, #ffffff) 0%,\n color-mix(in srgb, var(--_dot, var(--ui-text-muted, #64748b)) 70%, #000000) 100%\n );\n opacity: 0.45;\n cursor: pointer;\n /*\n * Size is deliberately absent: height is a layout property, so\n * transitioning it animates on the main thread, where a concurrent\n * animation elsewhere on the page can starve it down to a couple of\n * frames and render the bar with squared-off edges. The size change\n * snaps; only the compositable properties ease.\n */\n transition: opacity 0.25s ease;\n }\n button.muted {\n width: 0.4rem;\n height: 0.4rem;\n }\n button:hover {\n opacity: 0.8;\n }\n button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n button.active {\n height: 2.25rem;\n --_dot: var(--_color, var(--ui-primary, #4f46e5));\n opacity: 1;\n }\n @media (forced-colors: active) {\n button {\n background: GrayText;\n opacity: 1;\n }\n button.active {\n background: Highlight;\n }\n button:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n button {\n transition: none;\n }\n }\n `,\n ];\n\n override render() {\n const dots = this.items.map((item, index) => this._renderDot(normalize(item), index));\n return html`\n <nav\n aria-label=${this.label}\n style=${this.color === \"\" ? \"\" : `--_color: ${this.color}`}\n >\n ${dots}\n </nav>\n `;\n }\n\n private _renderDot(item: ScrollDotItem, index: number) {\n const isActive = index === this.active;\n const classes = [item.muted ? \"muted\" : \"\", isActive ? \"active\" : \"\"]\n .filter(Boolean)\n .join(\" \");\n return html`\n <button\n type=\"button\"\n class=${classes}\n aria-label=${item.label}\n title=${item.label}\n aria-current=${String(isActive)}\n @click=${() => this._select(index)}\n ></button>\n `;\n }\n\n private _select(index: number): void {\n this.dispatchEvent(\n new CustomEvent<DotSelectDetail>(\"dot-select\", {\n detail: { index },\n bubbles: true,\n composed: true,\n }),\n );\n }\n}\n\nfunction normalize(item: ScrollDotsItem): ScrollDotItem {\n return typeof item === \"string\" ? { label: item } : item;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"scroll-dots\": ScrollDots;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"scroll-dots.js","sourceRoot":"","sources":["../src/scroll-dots.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;AAkBrC;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QACL,qFAAqF;QACrD,UAAK,GAAqB,EAAE,CAAC;QAE7D,gFAAgF;QACpD,WAAM,GAAG,CAAC,CAAC;QAEvC,8EAA8E;QAClE,UAAK,GAAG,EAAE,CAAC;QAEvB,0DAA0D;QAC9C,UAAK,GAAG,EAAE,CAAC;IA2HzB,CAAC;aAzHiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;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AAA;AApIiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yCAA8B;AAGjC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAY;AAG3B;IAAX,QAAQ,EAAE;yCAAY;AAGX;IAAX,QAAQ,EAAE;yCAAY;AAXZ,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAsItB;;AAED,SAAS,SAAS,CAAC,IAAoB;IACrC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** One dot on a `scroll-dots` rail. */\nexport interface ScrollDotItem {\n /** Accessible name for the dot's button — the section or slide title. */\n label: string;\n /** Renders the dot smaller and quieter, for a section subordinate to its neighbours. */\n muted?: boolean;\n}\n\n/** A dot, or a bare string as shorthand for `{ label }`. */\nexport type ScrollDotsItem = string | ScrollDotItem;\n\n/** Fired when the user picks a dot. `detail.index` is the 0-based target. */\nexport interface DotSelectDetail {\n index: number;\n}\n\n/**\n * Vertical section navigator for a long scrolled page or a slide deck: one dot\n * per section, the active one drawn as an elongated rounded bar rather than a\n * dot, which is the only cue needed to read position at a glance.\n *\n * Controlled, like `pagination-nav`: it owns no scroll behavior and never\n * reads the scroll position. The consumer sets `active` and moves the page in\n * response to `dot-select` — what counts as the active section differs too much\n * between a snapped deck and an ordinary long page to bake in.\n *\n * Positioning is also the consumer's, since a rail is normally fixed into a\n * reserved gutter that only the page knows the width of.\n *\n * The dots use the same lighter-on-top gradient as `map-circle`/`map-pin`,\n * derived from a single base `color` — a rail beside a map reads as the same\n * family of marks as the pins on it.\n *\n * @element scroll-dots\n * @fires dot-select - The user picked a dot (`detail: { index }`).\n */\n@customElement(\"scroll-dots\")\nexport class ScrollDots extends LitElement {\n /** Dots to render, in document order. A bare string is shorthand for `{ label }`. */\n @property({ attribute: false }) items: ScrollDotsItem[] = [];\n\n /** 0-based index of the active dot. Out-of-range values simply match no dot. */\n @property({ type: Number }) active = 0;\n\n /** Base color the dot gradient is derived from. Empty uses `--ui-primary`. */\n @property() color = \"\";\n\n /** Accessible name for the rail, e.g. \"Journey stops\". */\n @property() label = \"\";\n\n static override styles = [\n tokens,\n css`\n /*\n * will-change promotes the rail to its own compositor layer. A rail is\n * typically fixed over the page's main content — for a map deck, over a\n * WebGL canvas — and without it the browser repaints the dots on the main\n * thread, which flickers and squares off their rounded edges whenever a\n * scroll and an animation are competing for that thread.\n */\n :host {\n display: inline-flex;\n will-change: transform;\n backface-visibility: hidden;\n }\n nav {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 0.75rem;\n }\n button {\n width: 0.625rem;\n height: 0.625rem;\n padding: 0;\n border: none;\n border-radius: var(--ui-radius-pill, 9999px);\n /* Same lighter-on-top token gradient as map-circle/timeline-entry's\n dot; the base color is swapped via the private --_dot var. */\n background: linear-gradient(\n to bottom,\n color-mix(in srgb, var(--_dot, var(--ui-text-muted, #64748b)) 70%, #ffffff) 0%,\n color-mix(in srgb, var(--_dot, var(--ui-text-muted, #64748b)) 70%, #000000) 100%\n );\n opacity: 0.45;\n cursor: pointer;\n /*\n * Size is deliberately absent: height is a layout property, so\n * transitioning it animates on the main thread, where a concurrent\n * animation elsewhere on the page can starve it down to a couple of\n * frames and render the bar with squared-off edges. The size change\n * snaps; only the compositable properties ease.\n */\n transition: opacity 0.25s ease;\n }\n button.muted {\n width: 0.4rem;\n height: 0.4rem;\n }\n button:hover {\n opacity: 0.8;\n }\n button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n button.active {\n height: 2.25rem;\n --_dot: var(--_color, var(--ui-primary, #4f46e5));\n opacity: 1;\n }\n @media (forced-colors: active) {\n button {\n background: GrayText;\n opacity: 1;\n }\n button.active {\n background: Highlight;\n }\n button:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n button {\n transition: none;\n }\n }\n `,\n ];\n\n override render() {\n const dots = this.items.map((item, index) => this._renderDot(normalize(item), index));\n return html`\n <nav\n aria-label=${this.label}\n style=${this.color === \"\" ? \"\" : `--_color: ${this.color}`}\n >\n ${dots}\n </nav>\n `;\n }\n\n private _renderDot(item: ScrollDotItem, index: number) {\n const isActive = index === this.active;\n const classes = [item.muted ? \"muted\" : \"\", isActive ? \"active\" : \"\"]\n .filter(Boolean)\n .join(\" \");\n return html`\n <button\n type=\"button\"\n class=${classes}\n aria-label=${item.label}\n title=${item.label}\n aria-current=${String(isActive)}\n @click=${() => this._select(index)}\n ></button>\n `;\n }\n\n private _select(index: number): void {\n this.dispatchEvent(\n new CustomEvent<DotSelectDetail>(\"dot-select\", {\n detail: { index },\n bubbles: true,\n composed: true,\n }),\n );\n }\n}\n\nfunction normalize(item: ScrollDotsItem): ScrollDotItem {\n return typeof item === \"string\" ? { label: item } : item;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"scroll-dots\": ScrollDots;\n }\n}\n"]}
|
package/dist/slide-panel.js
CHANGED
|
@@ -147,7 +147,7 @@ let SlidePanel = class SlidePanel extends LitElement {
|
|
|
147
147
|
width: 2.25rem;
|
|
148
148
|
height: 0.25rem;
|
|
149
149
|
background: var(--ui-border, #e2e8f0);
|
|
150
|
-
border-radius: 9999px;
|
|
150
|
+
border-radius: var(--ui-radius-pill, 9999px);
|
|
151
151
|
margin: 0.5rem auto 0;
|
|
152
152
|
flex: 0 0 auto;
|
|
153
153
|
}
|
package/dist/slide-panel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slide-panel.js","sourceRoot":"","sources":["../src/slide-panel.ts"],"names":[],"mappings":";;;;;;AAAA,O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AAC,IAAI,CAAC,IAAI;;;;;iCAKM,IAAI,CAAC,OAAO,IAAI,OAAO;;sEAEc,IAAI,CAAC,MAAM;uCAC1C,KAAK,CAAC,EAAE,CAAC;;;;;KAK3C,CAAC;IACJ,CAAC;CACF,CAAA;AA5L8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCAAc;AAE9B;IAAX,QAAQ,EAAE;2CAAc;AAJd,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA8LtB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconX } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport { activateLayer, claimEscape, deactivateLayer } from \"./utils/layer-stack.js\";\n\n/**\n * Generic sliding panel shell. Handles positioning, open/close animation,\n * header chrome, and a close button. Body content is provided via the\n * default slot; the consumer controls its own padding and overflow.\n *\n * Desktop: fixed right-side panel that slides from the right.\n * Mobile (≤48rem): bottom-sheet drawer (60vh) — reserved for future use.\n *\n * @element slide-panel\n * @fires panel-close - User clicked the close (✕) button.\n */\n@customElement(\"slide-panel\")\nexport class SlidePanel extends LitElement {\n /** Whether the panel is currently visible. */\n @property({ type: Boolean }) open = false;\n /** Title text shown in the panel header (overridable via slot=\"title\"). */\n @property() heading = \"\";\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .panel {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n width: 20rem;\n z-index: var(--component-layer-z, 20);\n background: var(--ui-surface, #ffffff);\n box-shadow: var(--ui-shadow-lg, 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1));\n transform: translateX(110%);\n transition: transform 250ms ease;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n .panel.open {\n transform: translateX(0);\n }\n .panel-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.75rem;\n border-bottom: 1px solid var(--ui-border, #e2e8f0);\n flex: 0 0 auto;\n }\n .panel-title {\n font-weight: var(--ui-font-weight-semibold, 600);\n font-size: var(--ui-font-size-lg, 1rem);\n line-height: var(--ui-line-height-tight, 1.25);\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 color: var(--ui-text, #0f172a);\n flex: 1 1 auto;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n padding-right: 0.5rem;\n }\n .close-btn {\n background: none;\n border: none;\n cursor: pointer;\n width: 2rem;\n height: 2rem;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n border-radius: var(--ui-radius-sm, 0.25rem);\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n .close-btn:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .close-btn:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .handle {\n display: none;\n }\n @media (prefers-reduced-motion: reduce) {\n .panel {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n .close-btn:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n @media (max-width: 48rem) {\n .panel {\n top: auto;\n right: 0;\n bottom: 0;\n left: 0;\n width: auto;\n height: 60vh;\n border-radius: var(--ui-radius, 0.5rem) var(--ui-radius, 0.5rem) 0 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 transform: translateY(110%);\n }\n .panel.open {\n transform: translateY(0);\n }\n .handle {\n display: block;\n width: 2.25rem;\n height: 0.25rem;\n background: var(--ui-border, #e2e8f0);\n border-radius: 9999px;\n margin: 0.5rem auto 0;\n flex: 0 0 auto;\n }\n .panel-header {\n padding: 0.25rem 0.5rem 0.5rem;\n }\n }\n `,\n ];\n\n private _previousFocus: HTMLElement | null = null;\n\n private _close() {\n this.dispatchEvent(new CustomEvent(\"panel-close\", { bubbles: true, composed: true }));\n }\n\n private _onWindowKeydown = (event: KeyboardEvent): void => {\n if (!this.open || !claimEscape(this, event)) return;\n this._close();\n };\n\n protected override updated(changed: PropertyValues): void {\n if (!changed.has(\"open\")) return;\n if (this.open) {\n activateLayer(this);\n this._previousFocus = document.activeElement as HTMLElement | null;\n window.addEventListener(\"keydown\", this._onWindowKeydown);\n this.shadowRoot?.querySelector<HTMLElement>(\".close-btn\")?.focus();\n return;\n }\n deactivateLayer(this);\n window.removeEventListener(\"keydown\", this._onWindowKeydown);\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener(\"keydown\", this._onWindowKeydown);\n deactivateLayer(this);\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n this.open = false;\n }\n\n override render() {\n const explicitLabel = this.getAttribute(\"aria-label\");\n return html`\n <div\n class=\"panel ${this.open ? \"open\" : \"\"}\"\n role=\"dialog\"\n aria-modal=\"false\"\n aria-label=${explicitLabel ?? nothing}\n aria-labelledby=${explicitLabel ? nothing : \"panel-title\"}\n aria-hidden=${String(!this.open)}\n ?inert=${!this.open}\n >\n <div class=\"handle\" aria-hidden=\"true\"></div>\n <div class=\"panel-header\">\n <span id=\"panel-title\" class=\"panel-title\">\n <slot name=\"title\">${this.heading || \"Panel\"}</slot>\n </span>\n <button class=\"close-btn\" aria-label=\"Close panel\" @click=${this._close}>\n <span aria-hidden=\"true\">${iconX(18)}</span>\n </button>\n </div>\n <slot></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"slide-panel\": SlidePanel;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"slide-panel.js","sourceRoot":"","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M,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;iBACvB,CAAC,IAAI,CAAC,IAAI;;;;;iCAKM,IAAI,CAAC,OAAO,IAAI,OAAO;;sEAEc,IAAI,CAAC,MAAM;uCAC1C,KAAK,CAAC,EAAE,CAAC;;;;;KAK3C,CAAC;IACJ,CAAC;CACF,CAAA;AA5L8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCAAc;AAE9B;IAAX,QAAQ,EAAE;2CAAc;AAJd,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA8LtB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconX } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport { activateLayer, claimEscape, deactivateLayer } from \"./utils/layer-stack.js\";\n\n/**\n * Generic sliding panel shell. Handles positioning, open/close animation,\n * header chrome, and a close button. Body content is provided via the\n * default slot; the consumer controls its own padding and overflow.\n *\n * Desktop: fixed right-side panel that slides from the right.\n * Mobile (≤48rem): bottom-sheet drawer (60vh) — reserved for future use.\n *\n * @element slide-panel\n * @fires panel-close - User clicked the close (✕) button.\n */\n@customElement(\"slide-panel\")\nexport class SlidePanel extends LitElement {\n /** Whether the panel is currently visible. */\n @property({ type: Boolean }) open = false;\n /** Title text shown in the panel header (overridable via slot=\"title\"). */\n @property() heading = \"\";\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .panel {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n width: 20rem;\n z-index: var(--component-layer-z, 20);\n background: var(--ui-surface, #ffffff);\n box-shadow: var(--ui-shadow-lg, 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1));\n transform: translateX(110%);\n transition: transform 250ms ease;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n .panel.open {\n transform: translateX(0);\n }\n .panel-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.75rem;\n border-bottom: 1px solid var(--ui-border, #e2e8f0);\n flex: 0 0 auto;\n }\n .panel-title {\n font-weight: var(--ui-font-weight-semibold, 600);\n font-size: var(--ui-font-size-lg, 1rem);\n line-height: var(--ui-line-height-tight, 1.25);\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 color: var(--ui-text, #0f172a);\n flex: 1 1 auto;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n padding-right: 0.5rem;\n }\n .close-btn {\n background: none;\n border: none;\n cursor: pointer;\n width: 2rem;\n height: 2rem;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n border-radius: var(--ui-radius-sm, 0.25rem);\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n .close-btn:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .close-btn:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .handle {\n display: none;\n }\n @media (prefers-reduced-motion: reduce) {\n .panel {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n .close-btn:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n @media (max-width: 48rem) {\n .panel {\n top: auto;\n right: 0;\n bottom: 0;\n left: 0;\n width: auto;\n height: 60vh;\n border-radius: var(--ui-radius, 0.5rem) var(--ui-radius, 0.5rem) 0 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 transform: translateY(110%);\n }\n .panel.open {\n transform: translateY(0);\n }\n .handle {\n display: block;\n width: 2.25rem;\n height: 0.25rem;\n background: var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-pill, 9999px);\n margin: 0.5rem auto 0;\n flex: 0 0 auto;\n }\n .panel-header {\n padding: 0.25rem 0.5rem 0.5rem;\n }\n }\n `,\n ];\n\n private _previousFocus: HTMLElement | null = null;\n\n private _close() {\n this.dispatchEvent(new CustomEvent(\"panel-close\", { bubbles: true, composed: true }));\n }\n\n private _onWindowKeydown = (event: KeyboardEvent): void => {\n if (!this.open || !claimEscape(this, event)) return;\n this._close();\n };\n\n protected override updated(changed: PropertyValues): void {\n if (!changed.has(\"open\")) return;\n if (this.open) {\n activateLayer(this);\n this._previousFocus = document.activeElement as HTMLElement | null;\n window.addEventListener(\"keydown\", this._onWindowKeydown);\n this.shadowRoot?.querySelector<HTMLElement>(\".close-btn\")?.focus();\n return;\n }\n deactivateLayer(this);\n window.removeEventListener(\"keydown\", this._onWindowKeydown);\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener(\"keydown\", this._onWindowKeydown);\n deactivateLayer(this);\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n this.open = false;\n }\n\n override render() {\n const explicitLabel = this.getAttribute(\"aria-label\");\n return html`\n <div\n class=\"panel ${this.open ? \"open\" : \"\"}\"\n role=\"dialog\"\n aria-modal=\"false\"\n aria-label=${explicitLabel ?? nothing}\n aria-labelledby=${explicitLabel ? nothing : \"panel-title\"}\n aria-hidden=${String(!this.open)}\n ?inert=${!this.open}\n >\n <div class=\"handle\" aria-hidden=\"true\"></div>\n <div class=\"panel-header\">\n <span id=\"panel-title\" class=\"panel-title\">\n <slot name=\"title\">${this.heading || \"Panel\"}</slot>\n </span>\n <button class=\"close-btn\" aria-label=\"Close panel\" @click=${this._close}>\n <span aria-hidden=\"true\">${iconX(18)}</span>\n </button>\n </div>\n <slot></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"slide-panel\": SlidePanel;\n }\n}\n"]}
|
package/dist/stat-meter.js
CHANGED
|
@@ -57,7 +57,7 @@ let StatMeter = class StatMeter extends LitElement {
|
|
|
57
57
|
display: block;
|
|
58
58
|
width: 4rem;
|
|
59
59
|
height: 0.375rem;
|
|
60
|
-
border-radius: 9999px;
|
|
60
|
+
border-radius: var(--ui-radius-pill, 9999px);
|
|
61
61
|
background: var(--track-color, var(--ui-surface-muted, #f8fafc));
|
|
62
62
|
overflow: hidden;
|
|
63
63
|
}
|
package/dist/stat-meter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat-meter.js","sourceRoot":"","sources":["../src/stat-meter.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;;;;;;;GAOG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QAgEL,6DAA6D;QACjD,UAAK,GAAG,EAAE,CAAC;QAEvB,qFAAqF;QACzD,YAAO,GAAkB,IAAI,CAAC;QAE1D,mEAAmE;QACvD,UAAK,GAAG,EAAE,CAAC;QAEvB,kGAAkG;QAC1D,eAAU,GAAG,EAAE,CAAC;IAe1D,CAAC;aAxFiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0DF;KACF,AA7DqB,CA6DpB;IAcO,MAAM;QACb,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC;QACzB,MAAM,OAAO,GAAG,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,OAAO,oBAAoB,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,UAAU,OAAO,GAAG,CAAC;QACxG,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,kBAAkB,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9E,OAAO,IAAI,CAAA;4BACa,IAAI,CAAC,KAAK;6CACO,UAAU,gBAAgB,IAAI,CAAC,KAAK,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG;mCACzF,SAAS;;4BAEhB,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG;KACrD,CAAC;IACJ,CAAC;CACF,CAAA;AAxBa;IAAX,QAAQ,EAAE;wCAAY;AAGK;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAA+B;AAG9C;IAAX,QAAQ,EAAE;wCAAY;AAGiB;IAAvC,QAAQ,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;6CAAiB;AA1E7C,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAyFrB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A compact labeled meter for a single percentage reading — e.g. CPU or\n * memory usage in a dashboard header. `percent` may be `null` when no\n * reading is available yet (e.g. the first tick of a polling metric); the\n * bar then renders empty and the value shows an em dash instead of \"0%\".\n *\n * @element stat-meter\n */\n@customElement(\"stat-meter\")\nexport class StatMeter extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-flex;\n align-items: center;\n gap: 0.5rem;\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 }\n\n .label {\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n letter-spacing: var(--ui-tracking-wide, 0.04em);\n color: var(--ui-text-muted, #64748b);\n }\n\n .track {\n display: block;\n width: 4rem;\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--track-color, var(--ui-surface-muted, #f8fafc));\n overflow: hidden;\n }\n\n .fill {\n display: block;\n height: 100%;\n /* Keep the top highlight while softening the dark edge for compact meters. */\n background: linear-gradient(\n to bottom,\n color-mix(in srgb, var(--fill-color, var(--ui-success, #16a34a)) 70%, #ffffff) 0%,\n color-mix(in srgb, var(--fill-color, var(--ui-success, #16a34a)) 80%, #000000) 100%\n );\n transition: width 200ms ease;\n }\n\n .value {\n min-width: 2rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n color: var(--ui-text, #0f172a);\n font-variant-numeric: tabular-nums;\n text-align: right;\n }\n @media (prefers-reduced-motion: reduce) {\n .fill {\n transition: none;\n }\n }\n `,\n ];\n\n /** Short label shown before the bar, e.g. \"CPU\" or \"MEM\". */\n @property() label = \"\";\n\n /** Percentage 0-100. `null` renders an empty bar and a \"—\" value instead of \"0%\". */\n @property({ type: Number }) percent: number | null = null;\n\n /** Fill color override; falls back to the `--ui-success` token. */\n @property() color = \"\";\n\n /** Track (inactive portion) background override; falls back to the `--ui-surface-muted` token. */\n @property({ attribute: \"track-color\" }) trackColor = \"\";\n\n override render() {\n const pct = this.percent;\n const clamped = pct === null ? 0 : Math.min(100, Math.max(0, pct));\n const fillStyle = this.color ? `width: ${clamped}%; --fill-color: ${this.color}` : `width: ${clamped}%`;\n const trackStyle = this.trackColor ? `--track-color: ${this.trackColor}` : \"\";\n return html`\n <span class=\"label\">${this.label}</span>\n <span class=\"track\" role=\"img\" style=${trackStyle} aria-label=\"${this.label} ${pct === null ? \"no reading\" : `${pct}%`}\">\n <span class=\"fill\" style=${fillStyle}></span>\n </span>\n <span class=\"value\">${pct === null ? \"—\" : `${pct}%`}</span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"stat-meter\": StatMeter;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"stat-meter.js","sourceRoot":"","sources":["../src/stat-meter.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;;;;;;;GAOG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QAgEL,6DAA6D;QACjD,UAAK,GAAG,EAAE,CAAC;QAEvB,qFAAqF;QACzD,YAAO,GAAkB,IAAI,CAAC;QAE1D,mEAAmE;QACvD,UAAK,GAAG,EAAE,CAAC;QAEvB,kGAAkG;QAC1D,eAAU,GAAG,EAAE,CAAC;IAe1D,CAAC;aAxFiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0DF;KACF,AA7DqB,CA6DpB;IAcO,MAAM;QACb,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC;QACzB,MAAM,OAAO,GAAG,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QACnE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,OAAO,oBAAoB,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,UAAU,OAAO,GAAG,CAAC;QACxG,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,kBAAkB,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9E,OAAO,IAAI,CAAA;4BACa,IAAI,CAAC,KAAK;6CACO,UAAU,gBAAgB,IAAI,CAAC,KAAK,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG;mCACzF,SAAS;;4BAEhB,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG;KACrD,CAAC;IACJ,CAAC;CACF,CAAA;AAxBa;IAAX,QAAQ,EAAE;wCAAY;AAGK;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAA+B;AAG9C;IAAX,QAAQ,EAAE;wCAAY;AAGiB;IAAvC,QAAQ,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;6CAAiB;AA1E7C,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAyFrB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A compact labeled meter for a single percentage reading — e.g. CPU or\n * memory usage in a dashboard header. `percent` may be `null` when no\n * reading is available yet (e.g. the first tick of a polling metric); the\n * bar then renders empty and the value shows an em dash instead of \"0%\".\n *\n * @element stat-meter\n */\n@customElement(\"stat-meter\")\nexport class StatMeter extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-flex;\n align-items: center;\n gap: 0.5rem;\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 }\n\n .label {\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n letter-spacing: var(--ui-tracking-wide, 0.04em);\n color: var(--ui-text-muted, #64748b);\n }\n\n .track {\n display: block;\n width: 4rem;\n height: 0.375rem;\n border-radius: var(--ui-radius-pill, 9999px);\n background: var(--track-color, var(--ui-surface-muted, #f8fafc));\n overflow: hidden;\n }\n\n .fill {\n display: block;\n height: 100%;\n /* Keep the top highlight while softening the dark edge for compact meters. */\n background: linear-gradient(\n to bottom,\n color-mix(in srgb, var(--fill-color, var(--ui-success, #16a34a)) 70%, #ffffff) 0%,\n color-mix(in srgb, var(--fill-color, var(--ui-success, #16a34a)) 80%, #000000) 100%\n );\n transition: width 200ms ease;\n }\n\n .value {\n min-width: 2rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n color: var(--ui-text, #0f172a);\n font-variant-numeric: tabular-nums;\n text-align: right;\n }\n @media (prefers-reduced-motion: reduce) {\n .fill {\n transition: none;\n }\n }\n `,\n ];\n\n /** Short label shown before the bar, e.g. \"CPU\" or \"MEM\". */\n @property() label = \"\";\n\n /** Percentage 0-100. `null` renders an empty bar and a \"—\" value instead of \"0%\". */\n @property({ type: Number }) percent: number | null = null;\n\n /** Fill color override; falls back to the `--ui-success` token. */\n @property() color = \"\";\n\n /** Track (inactive portion) background override; falls back to the `--ui-surface-muted` token. */\n @property({ attribute: \"track-color\" }) trackColor = \"\";\n\n override render() {\n const pct = this.percent;\n const clamped = pct === null ? 0 : Math.min(100, Math.max(0, pct));\n const fillStyle = this.color ? `width: ${clamped}%; --fill-color: ${this.color}` : `width: ${clamped}%`;\n const trackStyle = this.trackColor ? `--track-color: ${this.trackColor}` : \"\";\n return html`\n <span class=\"label\">${this.label}</span>\n <span class=\"track\" role=\"img\" style=${trackStyle} aria-label=\"${this.label} ${pct === null ? \"no reading\" : `${pct}%`}\">\n <span class=\"fill\" style=${fillStyle}></span>\n </span>\n <span class=\"value\">${pct === null ? \"—\" : `${pct}%`}</span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"stat-meter\": StatMeter;\n }\n}\n"]}
|
package/dist/status-pill.js
CHANGED
|
@@ -34,7 +34,7 @@ let StatusPill = class StatusPill extends LitElement {
|
|
|
34
34
|
display: inline-flex;
|
|
35
35
|
align-items: center;
|
|
36
36
|
gap: 0.25rem;
|
|
37
|
-
border-radius: 9999px;
|
|
37
|
+
border-radius: var(--ui-radius-pill, 9999px);
|
|
38
38
|
padding: 0.25rem 0.5rem;
|
|
39
39
|
font-size: var(--ui-font-size-sm, 0.75rem);
|
|
40
40
|
font-weight: var(--ui-font-weight-medium, 500);
|
package/dist/status-pill.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-pill.js","sourceRoot":"","sources":["../src/status-pill.ts"],"names":[],"mappings":";;;;;;AAAA,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,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC;;;;;GAKG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QAoEL,kCAAkC;QACtB,UAAK,GAAG,EAAE,CAAC;QACvB,qBAAqB;QACT,UAAK,GAAoB,SAAS,CAAC;QAC/C,sDAAsD;QACzB,YAAO,GAAG,KAAK,CAAC;IAU/C,CAAC;aAlFiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8DF;KACF,AAjEqB,CAiEpB;IASO,MAAM;QACb,OAAO,IAAI,CAAA;0BACW,IAAI,CAAC,KAAK;UAC1B,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA,yCAAyC,aAAa,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO;UAChG,IAAI,CAAC,KAAK;;KAEf,CAAC;IACJ,CAAC;CACF,CAAA;AAda;IAAX,QAAQ,EAAE;yCAAY;AAEX;IAAX,QAAQ,EAAE;yCAAoC;AAElB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAAiB;AAzElC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAmFtB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconArrowPath } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type StatusPillColor = \"neutral\" | \"info\" | \"primary\" | \"success\" | \"warning\" | \"danger\";\n\n/**\n * Small colored status pill, optionally with a spinning icon — for task/run\n * states (\"Open\", \"Blocked\", \"Done\") and live-activity indicators (\"Running\").\n *\n * @element status-pill\n */\n@customElement(\"status-pill\")\nexport class StatusPill extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-flex;\n }\n .pill {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n border-radius: 9999px;\n padding: 0.25rem 0.5rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\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 white-space: nowrap;\n }\n .pill.neutral {\n background: color-mix(in srgb, var(--ui-text-muted, #64748b) 15%, transparent);\n color: var(--ui-text-muted, #64748b);\n }\n .pill.info {\n background: color-mix(in srgb, var(--ui-info, #0ea5e9) 15%, transparent);\n color: var(--ui-info, #0ea5e9);\n }\n .pill.primary {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 15%, transparent);\n color: var(--ui-primary, #4f46e5);\n }\n .pill.success {\n background: color-mix(in srgb, var(--ui-success, #16a34a) 15%, transparent);\n color: var(--ui-success, #16a34a);\n }\n .pill.warning {\n background: color-mix(in srgb, var(--ui-warning, #d97706) 15%, transparent);\n color: var(--ui-warning, #d97706);\n }\n .pill.danger {\n background: color-mix(in srgb, var(--ui-danger, #dc2626) 15%, transparent);\n color: var(--ui-danger, #dc2626);\n }\n .spin {\n display: inline-flex;\n animation: spin 0.8s linear infinite;\n }\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .spin {\n animation: none;\n }\n }\n `,\n ];\n\n /** Text shown inside the pill. */\n @property() label = \"\";\n /** Color variant. */\n @property() color: StatusPillColor = \"neutral\";\n /** Renders a small spinning icon before the label. */\n @property({ type: Boolean }) spinner = false;\n\n override render() {\n return html`\n <span class=\"pill ${this.color}\">\n ${this.spinner ? html`<span class=\"spin\" aria-hidden=\"true\">${iconArrowPath(14)}</span>` : nothing}\n ${this.label}\n </span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"status-pill\": StatusPill;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"status-pill.js","sourceRoot":"","sources":["../src/status-pill.ts"],"names":[],"mappings":";;;;;;AAAA,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,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC;;;;;GAKG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QAoEL,kCAAkC;QACtB,UAAK,GAAG,EAAE,CAAC;QACvB,qBAAqB;QACT,UAAK,GAAoB,SAAS,CAAC;QAC/C,sDAAsD;QACzB,YAAO,GAAG,KAAK,CAAC;IAU/C,CAAC;aAlFiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8DF;KACF,AAjEqB,CAiEpB;IASO,MAAM;QACb,OAAO,IAAI,CAAA;0BACW,IAAI,CAAC,KAAK;UAC1B,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAA,yCAAyC,aAAa,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO;UAChG,IAAI,CAAC,KAAK;;KAEf,CAAC;IACJ,CAAC;CACF,CAAA;AAda;IAAX,QAAQ,EAAE;yCAAY;AAEX;IAAX,QAAQ,EAAE;yCAAoC;AAElB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAAiB;AAzElC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAmFtB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconArrowPath } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type StatusPillColor = \"neutral\" | \"info\" | \"primary\" | \"success\" | \"warning\" | \"danger\";\n\n/**\n * Small colored status pill, optionally with a spinning icon — for task/run\n * states (\"Open\", \"Blocked\", \"Done\") and live-activity indicators (\"Running\").\n *\n * @element status-pill\n */\n@customElement(\"status-pill\")\nexport class StatusPill extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-flex;\n }\n .pill {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n border-radius: var(--ui-radius-pill, 9999px);\n padding: 0.25rem 0.5rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\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 white-space: nowrap;\n }\n .pill.neutral {\n background: color-mix(in srgb, var(--ui-text-muted, #64748b) 15%, transparent);\n color: var(--ui-text-muted, #64748b);\n }\n .pill.info {\n background: color-mix(in srgb, var(--ui-info, #0ea5e9) 15%, transparent);\n color: var(--ui-info, #0ea5e9);\n }\n .pill.primary {\n background: color-mix(in srgb, var(--ui-primary, #4f46e5) 15%, transparent);\n color: var(--ui-primary, #4f46e5);\n }\n .pill.success {\n background: color-mix(in srgb, var(--ui-success, #16a34a) 15%, transparent);\n color: var(--ui-success, #16a34a);\n }\n .pill.warning {\n background: color-mix(in srgb, var(--ui-warning, #d97706) 15%, transparent);\n color: var(--ui-warning, #d97706);\n }\n .pill.danger {\n background: color-mix(in srgb, var(--ui-danger, #dc2626) 15%, transparent);\n color: var(--ui-danger, #dc2626);\n }\n .spin {\n display: inline-flex;\n animation: spin 0.8s linear infinite;\n }\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .spin {\n animation: none;\n }\n }\n `,\n ];\n\n /** Text shown inside the pill. */\n @property() label = \"\";\n /** Color variant. */\n @property() color: StatusPillColor = \"neutral\";\n /** Renders a small spinning icon before the label. */\n @property({ type: Boolean }) spinner = false;\n\n override render() {\n return html`\n <span class=\"pill ${this.color}\">\n ${this.spinner ? html`<span class=\"spin\" aria-hidden=\"true\">${iconArrowPath(14)}</span>` : nothing}\n ${this.label}\n </span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"status-pill\": StatusPill;\n }\n}\n"]}
|
package/dist/timeline-entry.js
CHANGED
|
@@ -130,7 +130,7 @@ let TimelineEntry = class TimelineEntry extends LitElement {
|
|
|
130
130
|
width: 0.75rem;
|
|
131
131
|
height: 0.75rem;
|
|
132
132
|
transform: translateX(-50%);
|
|
133
|
-
border-radius: 9999px;
|
|
133
|
+
border-radius: var(--ui-radius-pill, 9999px);
|
|
134
134
|
/* Same lighter-on-top token gradient as map-circle/user-avatar; the
|
|
135
135
|
base color is swapped per the color property via the private
|
|
136
136
|
--_dot var. */
|
|
@@ -165,7 +165,7 @@ let TimelineEntry = class TimelineEntry extends LitElement {
|
|
|
165
165
|
display: block;
|
|
166
166
|
width: 0.75rem;
|
|
167
167
|
height: 0.75rem;
|
|
168
|
-
border-radius: 9999px;
|
|
168
|
+
border-radius: var(--ui-radius-pill, 9999px);
|
|
169
169
|
/* Opaque backing so the connecting line is masked exactly like it is
|
|
170
170
|
behind the solid .dot, instead of showing through the ring's
|
|
171
171
|
hollow center and corners. */
|