@f-ewald/components 1.40.2 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/custom-elements.json +788 -97
- package/dist/app-shell.js +1 -1
- package/dist/app-shell.js.map +1 -1
- package/dist/blink-cursor.d.ts +27 -0
- package/dist/blink-cursor.d.ts.map +1 -0
- package/dist/blink-cursor.js +78 -0
- package/dist/blink-cursor.js.map +1 -0
- package/dist/button-group.d.ts.map +1 -1
- package/dist/button-group.js +3 -0
- package/dist/button-group.js.map +1 -1
- package/dist/calendar-day.d.ts.map +1 -1
- package/dist/calendar-day.js +5 -0
- package/dist/calendar-day.js.map +1 -1
- package/dist/calendar-week.d.ts.map +1 -1
- package/dist/calendar-week.js +5 -0
- package/dist/calendar-week.js.map +1 -1
- package/dist/code-diff.d.ts +41 -0
- package/dist/code-diff.d.ts.map +1 -0
- package/dist/code-diff.js +161 -0
- package/dist/code-diff.js.map +1 -0
- package/dist/comment-label.d.ts +26 -0
- package/dist/comment-label.d.ts.map +1 -0
- package/dist/comment-label.js +81 -0
- package/dist/comment-label.js.map +1 -0
- package/dist/confirm-dialog.d.ts +12 -6
- package/dist/confirm-dialog.d.ts.map +1 -1
- package/dist/confirm-dialog.js +50 -88
- package/dist/confirm-dialog.js.map +1 -1
- package/dist/frame-box.d.ts.map +1 -1
- package/dist/frame-box.js +4 -0
- package/dist/frame-box.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.js +1 -1
- package/dist/mcp-server.js.map +1 -1
- package/dist/modal-dialog.d.ts +16 -13
- package/dist/modal-dialog.d.ts.map +1 -1
- package/dist/modal-dialog.js +69 -104
- package/dist/modal-dialog.js.map +1 -1
- package/dist/photo-gallery.js +1 -1
- package/dist/photo-gallery.js.map +1 -1
- package/dist/price-history-chart.js +1 -1
- package/dist/price-history-chart.js.map +1 -1
- package/dist/progress-bar.d.ts.map +1 -1
- package/dist/progress-bar.js +23 -17
- package/dist/progress-bar.js.map +1 -1
- package/dist/radio-pills.d.ts.map +1 -1
- package/dist/radio-pills.js +3 -0
- package/dist/radio-pills.js.map +1 -1
- package/dist/slide-panel.d.ts +3 -3
- package/dist/slide-panel.d.ts.map +1 -1
- package/dist/slide-panel.js +38 -22
- package/dist/slide-panel.js.map +1 -1
- package/dist/stat-strip.d.ts +30 -0
- package/dist/stat-strip.d.ts.map +1 -0
- package/dist/stat-strip.js +111 -0
- package/dist/stat-strip.js.map +1 -0
- package/dist/step-ladder.d.ts +46 -0
- package/dist/step-ladder.d.ts.map +1 -0
- package/dist/step-ladder.js +175 -0
- package/dist/step-ladder.js.map +1 -0
- package/dist/terminal-block.d.ts +45 -0
- package/dist/terminal-block.d.ts.map +1 -0
- package/dist/terminal-block.js +113 -0
- package/dist/terminal-block.js.map +1 -0
- package/dist/tile-grid.d.ts.map +1 -1
- package/dist/tile-grid.js +3 -0
- package/dist/tile-grid.js.map +1 -1
- package/dist/toast-notification.d.ts +7 -0
- package/dist/toast-notification.d.ts.map +1 -1
- package/dist/toast-notification.js +34 -0
- package/dist/toast-notification.js.map +1 -1
- package/dist/tokens.css +60 -1
- package/dist/tokens.d.ts +58 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +135 -0
- package/dist/tokens.js.map +1 -1
- package/dist/ui-button.js +2 -2
- package/dist/ui-button.js.map +1 -1
- package/dist/window-chrome.d.ts +34 -0
- package/dist/window-chrome.d.ts.map +1 -0
- package/dist/window-chrome.js +141 -0
- package/dist/window-chrome.js.map +1 -0
- package/docs/app-shell.md +1 -1
- package/docs/blink-cursor.md +45 -0
- package/docs/code-diff.md +64 -0
- package/docs/comment-label.md +49 -0
- package/docs/confirm-dialog.md +4 -3
- package/docs/design-language.md +80 -28
- package/docs/layouts/marketing-landing.md +102 -0
- package/docs/modal-dialog.md +9 -9
- package/docs/photo-gallery.md +1 -1
- package/docs/price-history-chart.md +1 -0
- package/docs/radio-pills.md +1 -0
- package/docs/slide-panel.md +2 -2
- package/docs/stat-strip.md +57 -0
- package/docs/step-ladder.md +63 -0
- package/docs/terminal-block.md +69 -0
- package/docs/tile-grid.md +1 -0
- package/docs/ui-button.md +2 -0
- package/docs/window-chrome.md +64 -0
- package/llms.txt +227 -20
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast-notification.js","sourceRoot":"","sources":["../src/toast-notification.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,QAAQ,EACR,KAAK,GACN,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA+BrC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,oFAAoF;AACpF,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,WAAW,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QACY,YAAO,GAAY,EAAE,CAAC;QAE/B,YAAO,GAAG,CAAC,CAAC;QACZ,YAAO,GAAG,IAAI,GAAG,EAAyC,CAAC;QACnE,mGAAmG;QAC3F,iBAAY,GAAG,IAAI,GAAG,EAAsD,CAAC;QACrF,8FAA8F;QACtF,eAAU,GAA0C,IAAI,CAAC;IAoZnE,CAAC;aAlZiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;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"lit/decorators.js\";\nimport {\n iconCheckCircle,\n iconExclamationCircle,\n iconExclamationTriangle,\n iconInfo,\n iconX,\n} from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type ToastVariant = \"error\" | \"info\" | \"success\" | \"warning\";\n\ninterface ToastOptions {\n /** Visual style; also selects the accent color. Defaults to \"info\". */\n variant?: ToastVariant;\n /** Auto-dismiss delay in ms. Pass 0 to require a manual close. Defaults to 5000. */\n duration?: number;\n /**\n * Optional secondary line shown beneath the headline in smaller, non-bold\n * type. Omit for a single-line toast.\n */\n description?: string;\n}\n\ninterface Toast {\n id: number;\n message: string;\n variant: ToastVariant;\n description?: string;\n /** Configured auto-dismiss delay in ms; 0 means manual dismiss only (no countdown). */\n duration: number;\n /** Timestamp (`Date.now()`-based) this toast will auto-dismiss at, while the countdown is running. */\n endTime: number;\n /** Milliseconds remaining, frozen at the instant hover/focus paused the countdown. */\n remaining: number;\n /** Whether hover or focus has paused the countdown. */\n paused: boolean;\n}\n\nconst DEFAULT_DURATION_MS = 5000;\n/** Radius of the countdown ring's SVG circle — used to derive its circumference. */\nconst RING_RADIUS = 9;\nconst RING_CIRCUMFERENCE = 2 * Math.PI * RING_RADIUS;\n\n/**\n * Fixed-position stack of dismissible notifications, anchored top-right\n * (top-full-width on mobile). Every toast shares one fixed width so entries\n * never appear narrower or wider than one another. Not wired to any app state\n * yet — callers add toasts imperatively via the `show()` method on a live\n * element reference,\n * e.g. `document.querySelector('toast-notification')?.show('Offline', { variant: 'error' })`,\n * or via the `notifySuccess`/`notifyError`/`notifyInfo` module-level helpers\n * exported from this file. The first argument is the required bold headline; an\n * optional `description` renders a smaller, non-bold second line. Each variant\n * leads with a matching status icon (success → check, error → exclamation\n * circle, info → information circle, warning → exclamation triangle). Each toast\n * auto-dismisses after `duration` ms and can also be dismissed via its ✕\n * button. Appears/disappears instantly — no slide/fade transitions.\n *\n * A toast with `duration > 0` replaces its ✕ button with a countdown: a\n * number of seconds remaining inside a ring that fills in clockwise over\n * `duration`. Hovering or keyboard-focusing the toast swaps the countdown\n * back for the ✕ and pauses the countdown (both the visual ring/number and\n * the underlying auto-dismiss timer) — the toast won't disappear while\n * someone's reading it or has tabbed to its close button — resuming from\n * where it left off once the pointer/focus leaves. A `duration: 0` toast has\n * no countdown to show, so its ✕ is always visible, exactly as before.\n *\n * Each variant's background reads a dedicated `--ui-toast-*-background` hook\n * (`success`/`error`/`info`/`warning`), which defaults to the flat\n * `--ui-success`/`--ui-danger`/`--ui-info`/`--ui-warning` tokens unchanged —\n * so those stay the single source of truth for every other component. A\n * consumer can override just these toast-specific tokens with a\n * `linear-gradient(...)` to opt every toast into a gradient look without\n * touching component markup — `gradientTokenValues` in `tokens.ts` ships\n * exactly this, wired up via `data-theme=\"gradient\"` (see `tokens.css`'s\n * \"Gradient theme\" section), the same mechanism `ui-button` uses.\n * `--ui-toast-highlight` (a glossy top-edge box-shadow, layered onto the\n * existing elevation shadow) and `--ui-toast-text-shadow` (legibility\n * against the gradient's lighter stop) round out the effect, mirroring\n * `ui-button`'s `--ui-button-highlight`/`--ui-button-text-shadow`.\n *\n * @element toast-notification\n */\n@customElement(\"toast-notification\")\nexport class ToastNotification extends LitElement {\n @state() private _toasts: Toast[] = [];\n\n private _nextId = 0;\n private _timers = new Map<number, ReturnType<typeof setTimeout>>();\n /** Per-toast hover/focus tracking, so leaving one doesn't resume while the other still applies. */\n private _interaction = new Map<number, { hovered: boolean; focusWithin: boolean }>();\n /** Ticks while any toast has a running countdown, purely to refresh the displayed seconds. */\n private _tickTimer: ReturnType<typeof setInterval> | null = null;\n\n static override styles = [\n tokens,\n css`\n :host {\n position: fixed;\n top: 1rem;\n right: 1rem;\n z-index: 200;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n width: 22.5rem;\n pointer-events: none;\n }\n .toast {\n pointer-events: auto;\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n border-radius: var(--ui-radius, 0.5rem);\n padding: 0.75rem;\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 ), var(--ui-toast-highlight, 0 0 0 0 transparent);\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 line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-on-accent, #ffffff);\n background: var(--ui-text, #0f172a);\n text-shadow: var(--ui-toast-text-shadow, none);\n }\n .toast.error {\n background: var(--ui-toast-error-background, var(--ui-danger, #dc2626));\n }\n .toast.success {\n background: var(--ui-toast-success-background, var(--ui-success, #16a34a));\n }\n .toast.info {\n background: var(--ui-toast-info-background, var(--ui-info, #0ea5e9));\n }\n .toast.warning {\n background: var(--ui-toast-warning-background, var(--ui-warning, #d97706));\n }\n .icon {\n flex: 0 0 auto;\n margin-top: 0.125rem;\n line-height: var(--ui-line-height-glyph, 1);\n }\n .content {\n flex: 1 1 auto;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n }\n .message {\n font-weight: var(--ui-font-weight-semibold, 600);\n word-break: break-word;\n }\n .description {\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-regular, 400);\n line-height: var(--ui-line-height-normal, 1.5);\n word-break: break-word;\n }\n /* .countdown and .close are stacked exactly on top of one another (both\n inset:0 inside this fixed-size box) rather than swapped via\n display:none, so toggling between them never shifts layout. */\n .actions {\n position: relative;\n flex: 0 0 auto;\n width: 2rem;\n height: 2rem;\n margin: -0.25rem -0.25rem -0.25rem 0;\n }\n .countdown {\n position: absolute;\n inset: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n }\n .ring {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n }\n .ring-track {\n fill: none;\n stroke: currentColor;\n stroke-width: 2;\n opacity: 0.3;\n }\n .ring-progress {\n fill: none;\n stroke: currentColor;\n stroke-width: 2;\n stroke-linecap: round;\n transform-origin: 50% 50%;\n transform: rotate(-90deg);\n stroke-dasharray: ${RING_CIRCUMFERENCE};\n stroke-dashoffset: ${RING_CIRCUMFERENCE};\n animation-name: toast-ring-fill;\n animation-duration: var(--toast-duration, 5000ms);\n animation-timing-function: linear;\n animation-fill-mode: forwards;\n }\n .toast.has-countdown:hover .ring-progress,\n .toast.has-countdown:focus-within .ring-progress {\n animation-play-state: paused;\n }\n @keyframes toast-ring-fill {\n to {\n stroke-dashoffset: 0;\n }\n }\n .countdown-number {\n position: relative;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n font-variant-numeric: tabular-nums;\n line-height: var(--ui-line-height-glyph, 1);\n }\n .close {\n position: absolute;\n inset: 0;\n width: 2rem;\n height: 2rem;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n padding: 0;\n color: inherit;\n opacity: 0.8;\n cursor: pointer;\n line-height: var(--ui-line-height-glyph, 1);\n border-radius: var(--ui-radius-sm, 0.25rem);\n }\n /* Only hide the ✕ behind the countdown when there IS a countdown — a\n duration:0 toast has no .countdown sibling and keeps the ✕ always\n visible, unchanged from before this feature existed. */\n .toast.has-countdown .close {\n opacity: 0;\n }\n .toast.has-countdown:hover .close,\n .toast.has-countdown:focus-within .close {\n opacity: 1;\n }\n .toast.has-countdown:hover .countdown,\n .toast.has-countdown:focus-within .countdown {\n visibility: hidden;\n }\n .close:hover {\n opacity: 1;\n background: var(--ui-hover-overlay, rgb(255 255 255 / 0.32));\n }\n .close:focus-visible {\n outline: none;\n opacity: 1;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n @media (prefers-reduced-motion: reduce) {\n .ring-progress {\n animation: none;\n }\n }\n @media (forced-colors: active) {\n .toast {\n border: 1px solid CanvasText;\n forced-color-adjust: auto;\n }\n .close:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n @media (max-width: 48rem) {\n :host {\n top: 0.75rem;\n right: 0.75rem;\n left: 0.75rem;\n width: auto;\n }\n }\n `,\n ];\n\n /**\n * Queues a toast for display.\n * @param message Text to show.\n * @param options Variant + auto-dismiss duration (see {@link ToastOptions}).\n * @returns The toast's id — pass to `dismiss()` to remove it early.\n */\n show(message: string, options: ToastOptions = {}): number {\n const id = this._nextId++;\n const variant = options.variant ?? \"info\";\n const duration = options.duration ?? DEFAULT_DURATION_MS;\n const toast: Toast = {\n id,\n message,\n variant,\n description: options.description,\n duration,\n endTime: duration > 0 ? Date.now() + duration : 0,\n remaining: duration,\n paused: false,\n };\n this._toasts = [...this._toasts, toast];\n if (duration > 0) this._scheduleTimer(id, duration);\n this._syncTicking();\n return id;\n }\n\n /**\n * Removes a toast immediately, cancelling its pending auto-dismiss timer if any.\n * @param id The id returned by `show()`.\n */\n dismiss(id: number) {\n const timer = this._timers.get(id);\n if (timer) {\n clearTimeout(timer);\n this._timers.delete(id);\n }\n this._interaction.delete(id);\n this._toasts = this._toasts.filter((t) => t.id !== id);\n this._syncTicking();\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n for (const timer of this._timers.values()) clearTimeout(timer);\n this._timers.clear();\n if (this._tickTimer) clearInterval(this._tickTimer);\n this._tickTimer = null;\n }\n\n /** Schedules (or reschedules) the real auto-dismiss timeout for a toast. */\n private _scheduleTimer(id: number, ms: number): void {\n this._timers.set(\n id,\n setTimeout(() => this.dismiss(id), ms),\n );\n }\n\n /** Freezes a toast's countdown at its current remaining time. */\n private _pause(id: number): void {\n const index = this._toasts.findIndex((t) => t.id === id);\n if (index === -1) return;\n const toast = this._toasts[index];\n if (toast.duration === 0 || toast.paused) return;\n const timer = this._timers.get(id);\n if (timer) {\n clearTimeout(timer);\n this._timers.delete(id);\n }\n const remaining = Math.max(0, toast.endTime - Date.now());\n const next = [...this._toasts];\n next[index] = { ...toast, paused: true, remaining };\n this._toasts = next;\n this._syncTicking();\n }\n\n /** Resumes a paused toast's countdown for whatever time was remaining. */\n private _resume(id: number): void {\n const index = this._toasts.findIndex((t) => t.id === id);\n if (index === -1) return;\n const toast = this._toasts[index];\n if (toast.duration === 0 || !toast.paused) return;\n this._scheduleTimer(id, toast.remaining);\n const next = [...this._toasts];\n next[index] = { ...toast, paused: false, endTime: Date.now() + toast.remaining };\n this._toasts = next;\n this._syncTicking();\n }\n\n /** Starts or stops the shared display-only tick, matching whether any countdown is actually running. */\n private _syncTicking(): void {\n const needsTicking = this._toasts.some((t) => t.duration > 0 && !t.paused);\n if (needsTicking && !this._tickTimer) {\n this._tickTimer = setInterval(() => this.requestUpdate(), 250);\n } else if (!needsTicking && this._tickTimer) {\n clearInterval(this._tickTimer);\n this._tickTimer = null;\n }\n }\n\n /** Reads (creating if absent) a toast's hover/focus tracking record. */\n private _interactionState(id: number): { hovered: boolean; focusWithin: boolean } {\n let state = this._interaction.get(id);\n if (!state) {\n state = { hovered: false, focusWithin: false };\n this._interaction.set(id, state);\n }\n return state;\n }\n\n private _onMouseEnter(id: number): void {\n this._interactionState(id).hovered = true;\n this._pause(id);\n }\n\n private _onMouseLeave(id: number): void {\n const state = this._interactionState(id);\n state.hovered = false;\n if (!state.focusWithin) this._resume(id);\n }\n\n private _onFocusIn(id: number): void {\n this._interactionState(id).focusWithin = true;\n this._pause(id);\n }\n\n /** Rechecks focus-within on a microtask, since focusout fires before the new focus target settles. */\n private _onFocusOut(id: number, event: FocusEvent): void {\n const el = event.currentTarget as HTMLElement;\n queueMicrotask(() => {\n const state = this._interactionState(id);\n state.focusWithin = el.matches(\":focus-within\");\n if (!state.hovered && !state.focusWithin) this._resume(id);\n });\n }\n\n /** Whole seconds remaining until auto-dismiss, for the countdown number. */\n private _secondsLeft(t: Toast): number {\n const ms = t.paused ? t.remaining : Math.max(0, t.endTime - Date.now());\n return Math.max(0, Math.ceil(ms / 1000));\n }\n\n /**\n * Returns the decorative status icon for a variant, sized as a standalone\n * 18px glyph to match the dismiss button.\n * @param variant The toast variant.\n */\n private _variantIcon(variant: ToastVariant) {\n switch (variant) {\n case \"success\":\n return iconCheckCircle(18);\n case \"error\":\n return iconExclamationCircle(18);\n case \"warning\":\n return iconExclamationTriangle(18);\n default:\n return iconInfo(18);\n }\n }\n\n override render() {\n if (this._toasts.length === 0) return nothing;\n return html`\n ${this._toasts.map(\n (t) => html`\n <div\n class=\"toast ${t.variant} ${t.duration > 0 ? \"has-countdown\" : \"\"}\"\n role=${t.variant === \"error\" ? \"alert\" : \"status\"}\n aria-atomic=\"true\"\n @mouseenter=${() => this._onMouseEnter(t.id)}\n @mouseleave=${() => this._onMouseLeave(t.id)}\n @focusin=${() => this._onFocusIn(t.id)}\n @focusout=${(e: FocusEvent) => this._onFocusOut(t.id, e)}\n >\n <span class=\"icon\" aria-hidden=\"true\">${this._variantIcon(t.variant)}</span>\n <div class=\"content\">\n <span class=\"message\">${t.message}</span>\n ${t.description ? html`<span class=\"description\">${t.description}</span>` : nothing}\n </div>\n <div class=\"actions\">\n ${t.duration > 0\n ? html`\n <div class=\"countdown\" aria-hidden=\"true\" style=\"--toast-duration: ${t.duration}ms\">\n <svg class=\"ring\" viewBox=\"0 0 24 24\">\n <circle class=\"ring-track\" cx=\"12\" cy=\"12\" r=${RING_RADIUS}></circle>\n <circle class=\"ring-progress\" cx=\"12\" cy=\"12\" r=${RING_RADIUS}></circle>\n </svg>\n <span class=\"countdown-number\">${this._secondsLeft(t)}</span>\n </div>\n `\n : nothing}\n <button class=\"close\" aria-label=\"Dismiss notification\" @click=${() => this.dismiss(t.id)}>\n <span aria-hidden=\"true\">${iconX(18)}</span>\n </button>\n </div>\n </div>\n `,\n )}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"toast-notification\": ToastNotification;\n }\n}\n\nfunction getToast(): ToastNotification | null {\n return document.querySelector(\"toast-notification\");\n}\n\n/** Shows an error toast. Use for connection/network failures, not validation errors. */\nexport function notifyError(message: string, description?: string) {\n getToast()?.show(message, { variant: \"error\", description });\n}\n\n/** Shows a success toast. */\nexport function notifySuccess(message: string, description?: string) {\n getToast()?.show(message, { variant: \"success\", description });\n}\n\n/** Shows an info toast. */\nexport function notifyInfo(message: string, description?: string) {\n getToast()?.show(message, { variant: \"info\", description });\n}\n\n/** Shows a warning toast. */\nexport function notifyWarning(message: string, description?: string) {\n getToast()?.show(message, { variant: \"warning\", description });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"toast-notification.js","sourceRoot":"","sources":["../src/toast-notification.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,QAAQ,EACR,KAAK,GACN,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA+BrC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,oFAAoF;AACpF,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,WAAW,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QACY,YAAO,GAAY,EAAE,CAAC;QAE/B,YAAO,GAAG,CAAC,CAAC;QACZ,YAAO,GAAG,IAAI,GAAG,EAAyC,CAAC;QACnE,mGAAmG;QAC3F,iBAAY,GAAG,IAAI,GAAG,EAAsD,CAAC;QACrF,8FAA8F;QACtF,eAAU,GAA0C,IAAI,CAAC;IAobnE,CAAC;aAlbiB,WAAM,GAAG;QACvB,MAAM;QACN,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AAC,CAAC;AAC/D,CAAC;AAED,6BAA6B;AAC7B,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,WAAoB;IACjE,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;AACjE,CAAC;AAED,2BAA2B;AAC3B,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,WAAoB;IAC9D,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,6BAA6B;AAC7B,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,WAAoB;IACjE,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, state } from \"lit/decorators.js\";\nimport {\n iconCheckCircle,\n iconExclamationCircle,\n iconExclamationTriangle,\n iconInfo,\n iconX,\n} from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type ToastVariant = \"error\" | \"info\" | \"success\" | \"warning\";\n\ninterface ToastOptions {\n /** Visual style; also selects the accent color. Defaults to \"info\". */\n variant?: ToastVariant;\n /** Auto-dismiss delay in ms. Pass 0 to require a manual close. Defaults to 5000. */\n duration?: number;\n /**\n * Optional secondary line shown beneath the headline in smaller, non-bold\n * type. Omit for a single-line toast.\n */\n description?: string;\n}\n\ninterface Toast {\n id: number;\n message: string;\n variant: ToastVariant;\n description?: string;\n /** Configured auto-dismiss delay in ms; 0 means manual dismiss only (no countdown). */\n duration: number;\n /** Timestamp (`Date.now()`-based) this toast will auto-dismiss at, while the countdown is running. */\n endTime: number;\n /** Milliseconds remaining, frozen at the instant hover/focus paused the countdown. */\n remaining: number;\n /** Whether hover or focus has paused the countdown. */\n paused: boolean;\n}\n\nconst DEFAULT_DURATION_MS = 5000;\n/** Radius of the countdown ring's SVG circle — used to derive its circumference. */\nconst RING_RADIUS = 9;\nconst RING_CIRCUMFERENCE = 2 * Math.PI * RING_RADIUS;\n\n/**\n * Fixed-position stack of dismissible notifications, anchored top-right\n * (top-full-width on mobile). Every toast shares one fixed width so entries\n * never appear narrower or wider than one another. Not wired to any app state\n * yet — callers add toasts imperatively via the `show()` method on a live\n * element reference,\n * e.g. `document.querySelector('toast-notification')?.show('Offline', { variant: 'error' })`,\n * or via the `notifySuccess`/`notifyError`/`notifyInfo` module-level helpers\n * exported from this file. The first argument is the required bold headline; an\n * optional `description` renders a smaller, non-bold second line. Each variant\n * leads with a matching status icon (success → check, error → exclamation\n * circle, info → information circle, warning → exclamation triangle). Each toast\n * auto-dismisses after `duration` ms and can also be dismissed via its ✕\n * button. Appears/disappears instantly — no slide/fade transitions.\n *\n * A toast with `duration > 0` replaces its ✕ button with a countdown: a\n * number of seconds remaining inside a ring that fills in clockwise over\n * `duration`. Hovering or keyboard-focusing the toast swaps the countdown\n * back for the ✕ and pauses the countdown (both the visual ring/number and\n * the underlying auto-dismiss timer) — the toast won't disappear while\n * someone's reading it or has tabbed to its close button — resuming from\n * where it left off once the pointer/focus leaves. A `duration: 0` toast has\n * no countdown to show, so its ✕ is always visible, exactly as before.\n *\n * Each variant's background reads a dedicated `--ui-toast-*-background` hook\n * (`success`/`error`/`info`/`warning`), which defaults to the flat\n * `--ui-success`/`--ui-danger`/`--ui-info`/`--ui-warning` tokens unchanged —\n * so those stay the single source of truth for every other component. A\n * consumer can override just these toast-specific tokens with a\n * `linear-gradient(...)` to opt every toast into a gradient look without\n * touching component markup — `gradientTokenValues` in `tokens.ts` ships\n * exactly this, wired up via `data-theme=\"gradient\"` (see `tokens.css`'s\n * \"Gradient theme\" section), the same mechanism `ui-button` uses.\n * `--ui-toast-highlight` (a glossy top-edge box-shadow, layered onto the\n * existing elevation shadow) and `--ui-toast-text-shadow` (legibility\n * against the gradient's lighter stop) round out the effect, mirroring\n * `ui-button`'s `--ui-button-highlight`/`--ui-button-text-shadow`.\n *\n * @element toast-notification\n */\n@customElement(\"toast-notification\")\nexport class ToastNotification extends LitElement {\n @state() private _toasts: Toast[] = [];\n\n private _nextId = 0;\n private _timers = new Map<number, ReturnType<typeof setTimeout>>();\n /** Per-toast hover/focus tracking, so leaving one doesn't resume while the other still applies. */\n private _interaction = new Map<number, { hovered: boolean; focusWithin: boolean }>();\n /** Ticks while any toast has a running countdown, purely to refresh the displayed seconds. */\n private _tickTimer: ReturnType<typeof setInterval> | null = null;\n\n static override styles = [\n tokens,\n css`\n :host {\n position: fixed;\n top: 1rem;\n right: 1rem;\n z-index: 200;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n width: 22.5rem;\n pointer-events: none;\n /* Reset the UA [popover] box (the host is a manual popover, see _promote()). */\n inset: auto;\n inset-block-start: 1rem;\n inset-inline-end: 1rem;\n margin: 0;\n padding: 0;\n border: 0;\n overflow: visible;\n background: transparent;\n color: inherit;\n }\n /* An author display value would otherwise defeat the UA's display:none for a closed popover. */\n :host([popover]:not(:popover-open)) {\n display: none;\n }\n .toast {\n pointer-events: auto;\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n border-radius: var(--ui-radius, 0.5rem);\n padding: 0.75rem;\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 ), var(--ui-toast-highlight, 0 0 0 0 transparent);\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 line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-on-accent, #ffffff);\n background: var(--ui-text, #0f172a);\n text-shadow: var(--ui-toast-text-shadow, none);\n }\n .toast.error {\n background: var(--ui-toast-error-background, var(--ui-danger, #dc2626));\n }\n .toast.success {\n background: var(--ui-toast-success-background, var(--ui-success, #16a34a));\n }\n .toast.info {\n background: var(--ui-toast-info-background, var(--ui-info, #0ea5e9));\n }\n .toast.warning {\n background: var(--ui-toast-warning-background, var(--ui-warning, #d97706));\n }\n .icon {\n flex: 0 0 auto;\n margin-top: 0.125rem;\n line-height: var(--ui-line-height-glyph, 1);\n }\n .content {\n flex: 1 1 auto;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n }\n .message {\n font-weight: var(--ui-font-weight-semibold, 600);\n word-break: break-word;\n }\n .description {\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-regular, 400);\n line-height: var(--ui-line-height-normal, 1.5);\n word-break: break-word;\n }\n /* .countdown and .close are stacked exactly on top of one another (both\n inset:0 inside this fixed-size box) rather than swapped via\n display:none, so toggling between them never shifts layout. */\n .actions {\n position: relative;\n flex: 0 0 auto;\n width: 2rem;\n height: 2rem;\n margin: -0.25rem -0.25rem -0.25rem 0;\n }\n .countdown {\n position: absolute;\n inset: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n }\n .ring {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n }\n .ring-track {\n fill: none;\n stroke: currentColor;\n stroke-width: 2;\n opacity: 0.3;\n }\n .ring-progress {\n fill: none;\n stroke: currentColor;\n stroke-width: 2;\n stroke-linecap: round;\n transform-origin: 50% 50%;\n transform: rotate(-90deg);\n stroke-dasharray: ${RING_CIRCUMFERENCE};\n stroke-dashoffset: ${RING_CIRCUMFERENCE};\n animation-name: toast-ring-fill;\n animation-duration: var(--toast-duration, 5000ms);\n animation-timing-function: linear;\n animation-fill-mode: forwards;\n }\n .toast.has-countdown:hover .ring-progress,\n .toast.has-countdown:focus-within .ring-progress {\n animation-play-state: paused;\n }\n @keyframes toast-ring-fill {\n to {\n stroke-dashoffset: 0;\n }\n }\n .countdown-number {\n position: relative;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n font-variant-numeric: tabular-nums;\n line-height: var(--ui-line-height-glyph, 1);\n }\n .close {\n position: absolute;\n inset: 0;\n width: 2rem;\n height: 2rem;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n padding: 0;\n color: inherit;\n opacity: 0.8;\n cursor: pointer;\n line-height: var(--ui-line-height-glyph, 1);\n border-radius: var(--ui-radius-sm, 0.25rem);\n }\n /* Only hide the ✕ behind the countdown when there IS a countdown — a\n duration:0 toast has no .countdown sibling and keeps the ✕ always\n visible, unchanged from before this feature existed. */\n .toast.has-countdown .close {\n opacity: 0;\n }\n .toast.has-countdown:hover .close,\n .toast.has-countdown:focus-within .close {\n opacity: 1;\n }\n .toast.has-countdown:hover .countdown,\n .toast.has-countdown:focus-within .countdown {\n visibility: hidden;\n }\n .close:hover {\n opacity: 1;\n background: var(--ui-hover-overlay, rgb(255 255 255 / 0.32));\n }\n .close:focus-visible {\n outline: none;\n opacity: 1;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n @media (prefers-reduced-motion: reduce) {\n .ring-progress {\n animation: none;\n }\n }\n @media (forced-colors: active) {\n .toast {\n border: 1px solid CanvasText;\n forced-color-adjust: auto;\n }\n .close:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n @media (max-width: 48rem) {\n :host {\n top: 0.75rem;\n right: 0.75rem;\n left: 0.75rem;\n width: auto;\n }\n }\n `,\n ];\n\n /**\n * Queues a toast for display.\n * @param message Text to show.\n * @param options Variant + auto-dismiss duration (see {@link ToastOptions}).\n * @returns The toast's id — pass to `dismiss()` to remove it early.\n */\n show(message: string, options: ToastOptions = {}): number {\n const id = this._nextId++;\n const variant = options.variant ?? \"info\";\n const duration = options.duration ?? DEFAULT_DURATION_MS;\n const toast: Toast = {\n id,\n message,\n variant,\n description: options.description,\n duration,\n endTime: duration > 0 ? Date.now() + duration : 0,\n remaining: duration,\n paused: false,\n };\n this._toasts = [...this._toasts, toast];\n if (duration > 0) this._scheduleTimer(id, duration);\n this._syncTicking();\n this._promote();\n return id;\n }\n\n /**\n * Moves the stack to the top of the browser's top layer, so it renders above any native\n * modal `<dialog>` opened earlier (a `position: fixed; z-index` stack can't). Re-showing\n * puts it above layers added since the last toast. No-op without Popover API support.\n */\n private _promote(): void {\n if (!this.isConnected || !this.popover) return;\n if (this.matches(\":popover-open\")) this.hidePopover();\n this.showPopover();\n }\n\n /**\n * Removes a toast immediately, cancelling its pending auto-dismiss timer if any.\n * @param id The id returned by `show()`.\n */\n dismiss(id: number) {\n const timer = this._timers.get(id);\n if (timer) {\n clearTimeout(timer);\n this._timers.delete(id);\n }\n this._interaction.delete(id);\n this._toasts = this._toasts.filter((t) => t.id !== id);\n this._syncTicking();\n if (this._toasts.length === 0 && this.matches(\":popover-open\")) this.hidePopover();\n }\n\n override connectedCallback() {\n super.connectedCallback();\n if (\"popover\" in HTMLElement.prototype) this.popover = \"manual\";\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n for (const timer of this._timers.values()) clearTimeout(timer);\n this._timers.clear();\n if (this._tickTimer) clearInterval(this._tickTimer);\n this._tickTimer = null;\n }\n\n /** Schedules (or reschedules) the real auto-dismiss timeout for a toast. */\n private _scheduleTimer(id: number, ms: number): void {\n this._timers.set(\n id,\n setTimeout(() => this.dismiss(id), ms),\n );\n }\n\n /** Freezes a toast's countdown at its current remaining time. */\n private _pause(id: number): void {\n const index = this._toasts.findIndex((t) => t.id === id);\n if (index === -1) return;\n const toast = this._toasts[index];\n if (toast.duration === 0 || toast.paused) return;\n const timer = this._timers.get(id);\n if (timer) {\n clearTimeout(timer);\n this._timers.delete(id);\n }\n const remaining = Math.max(0, toast.endTime - Date.now());\n const next = [...this._toasts];\n next[index] = { ...toast, paused: true, remaining };\n this._toasts = next;\n this._syncTicking();\n }\n\n /** Resumes a paused toast's countdown for whatever time was remaining. */\n private _resume(id: number): void {\n const index = this._toasts.findIndex((t) => t.id === id);\n if (index === -1) return;\n const toast = this._toasts[index];\n if (toast.duration === 0 || !toast.paused) return;\n this._scheduleTimer(id, toast.remaining);\n const next = [...this._toasts];\n next[index] = { ...toast, paused: false, endTime: Date.now() + toast.remaining };\n this._toasts = next;\n this._syncTicking();\n }\n\n /** Starts or stops the shared display-only tick, matching whether any countdown is actually running. */\n private _syncTicking(): void {\n const needsTicking = this._toasts.some((t) => t.duration > 0 && !t.paused);\n if (needsTicking && !this._tickTimer) {\n this._tickTimer = setInterval(() => this.requestUpdate(), 250);\n } else if (!needsTicking && this._tickTimer) {\n clearInterval(this._tickTimer);\n this._tickTimer = null;\n }\n }\n\n /** Reads (creating if absent) a toast's hover/focus tracking record. */\n private _interactionState(id: number): { hovered: boolean; focusWithin: boolean } {\n let state = this._interaction.get(id);\n if (!state) {\n state = { hovered: false, focusWithin: false };\n this._interaction.set(id, state);\n }\n return state;\n }\n\n private _onMouseEnter(id: number): void {\n this._interactionState(id).hovered = true;\n this._pause(id);\n }\n\n private _onMouseLeave(id: number): void {\n const state = this._interactionState(id);\n state.hovered = false;\n if (!state.focusWithin) this._resume(id);\n }\n\n private _onFocusIn(id: number): void {\n this._interactionState(id).focusWithin = true;\n this._pause(id);\n }\n\n /** Rechecks focus-within on a microtask, since focusout fires before the new focus target settles. */\n private _onFocusOut(id: number, event: FocusEvent): void {\n const el = event.currentTarget as HTMLElement;\n queueMicrotask(() => {\n const state = this._interactionState(id);\n state.focusWithin = el.matches(\":focus-within\");\n if (!state.hovered && !state.focusWithin) this._resume(id);\n });\n }\n\n /** Whole seconds remaining until auto-dismiss, for the countdown number. */\n private _secondsLeft(t: Toast): number {\n const ms = t.paused ? t.remaining : Math.max(0, t.endTime - Date.now());\n return Math.max(0, Math.ceil(ms / 1000));\n }\n\n /**\n * Returns the decorative status icon for a variant, sized as a standalone\n * 18px glyph to match the dismiss button.\n * @param variant The toast variant.\n */\n private _variantIcon(variant: ToastVariant) {\n switch (variant) {\n case \"success\":\n return iconCheckCircle(18);\n case \"error\":\n return iconExclamationCircle(18);\n case \"warning\":\n return iconExclamationTriangle(18);\n default:\n return iconInfo(18);\n }\n }\n\n override render() {\n if (this._toasts.length === 0) return nothing;\n return html`\n ${this._toasts.map(\n (t) => html`\n <div\n class=\"toast ${t.variant} ${t.duration > 0 ? \"has-countdown\" : \"\"}\"\n role=${t.variant === \"error\" ? \"alert\" : \"status\"}\n aria-atomic=\"true\"\n @mouseenter=${() => this._onMouseEnter(t.id)}\n @mouseleave=${() => this._onMouseLeave(t.id)}\n @focusin=${() => this._onFocusIn(t.id)}\n @focusout=${(e: FocusEvent) => this._onFocusOut(t.id, e)}\n >\n <span class=\"icon\" aria-hidden=\"true\">${this._variantIcon(t.variant)}</span>\n <div class=\"content\">\n <span class=\"message\">${t.message}</span>\n ${t.description ? html`<span class=\"description\">${t.description}</span>` : nothing}\n </div>\n <div class=\"actions\">\n ${t.duration > 0\n ? html`\n <div class=\"countdown\" aria-hidden=\"true\" style=\"--toast-duration: ${t.duration}ms\">\n <svg class=\"ring\" viewBox=\"0 0 24 24\">\n <circle class=\"ring-track\" cx=\"12\" cy=\"12\" r=${RING_RADIUS}></circle>\n <circle class=\"ring-progress\" cx=\"12\" cy=\"12\" r=${RING_RADIUS}></circle>\n </svg>\n <span class=\"countdown-number\">${this._secondsLeft(t)}</span>\n </div>\n `\n : nothing}\n <button class=\"close\" aria-label=\"Dismiss notification\" @click=${() => this.dismiss(t.id)}>\n <span aria-hidden=\"true\">${iconX(18)}</span>\n </button>\n </div>\n </div>\n `,\n )}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"toast-notification\": ToastNotification;\n }\n}\n\nfunction getToast(): ToastNotification | null {\n return document.querySelector(\"toast-notification\");\n}\n\n/** Shows an error toast. Use for connection/network failures, not validation errors. */\nexport function notifyError(message: string, description?: string) {\n getToast()?.show(message, { variant: \"error\", description });\n}\n\n/** Shows a success toast. */\nexport function notifySuccess(message: string, description?: string) {\n getToast()?.show(message, { variant: \"success\", description });\n}\n\n/** Shows an info toast. */\nexport function notifyInfo(message: string, description?: string) {\n getToast()?.show(message, { variant: \"info\", description });\n}\n\n/** Shows a warning toast. */\nexport function notifyWarning(message: string, description?: string) {\n getToast()?.show(message, { variant: \"warning\", description });\n}\n"]}
|
package/dist/tokens.css
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
--ui-button-background-hover: var(--ui-primary-hover, #4338ca);
|
|
7
7
|
--ui-button-background-active: var(--ui-button-background, var(--ui-primary, #4f46e5));
|
|
8
8
|
--ui-button-border: transparent;
|
|
9
|
+
--ui-button-text: var(--ui-on-accent, #ffffff);
|
|
10
|
+
--ui-button-danger-text: var(--ui-on-accent, #ffffff);
|
|
9
11
|
--ui-button-secondary-background: none;
|
|
10
12
|
--ui-button-secondary-background-hover: none;
|
|
11
13
|
--ui-button-secondary-background-active: var(--ui-button-secondary-background, none);
|
|
@@ -44,8 +46,10 @@
|
|
|
44
46
|
--ui-surface-muted: #f8fafc;
|
|
45
47
|
--ui-highlight: #fde68a;
|
|
46
48
|
--ui-tooltip: #0f172a;
|
|
49
|
+
--ui-tooltip-text: #ffffff;
|
|
47
50
|
--ui-hover-overlay: rgb(255 255 255 / 0.32);
|
|
48
51
|
--ui-overlay: rgb(15 23 42 / 0.45);
|
|
52
|
+
--ui-overlay-text: #ffffff;
|
|
49
53
|
--ui-radius: 0.5rem;
|
|
50
54
|
--ui-radius-sm: 0.25rem;
|
|
51
55
|
--ui-border-width: 1px;
|
|
@@ -74,7 +78,7 @@
|
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
@media (prefers-color-scheme: dark) {
|
|
77
|
-
:root:not([data-theme="light"]):not([data-theme="gradient"]):not([data-theme="metro"]):not([data-theme="blueprint"]) {
|
|
81
|
+
:root:not([data-theme="light"]):not([data-theme="gradient"]):not([data-theme="metro"]):not([data-theme="blueprint"]):not([data-theme="developer-light"]) {
|
|
78
82
|
color-scheme: dark;
|
|
79
83
|
--ui-primary: #6366f1;
|
|
80
84
|
--ui-primary-hover: #818cf8;
|
|
@@ -123,6 +127,34 @@
|
|
|
123
127
|
--ui-focus-ring: 0 0 0 3px rgb(99 102 241 / 0.45);
|
|
124
128
|
}
|
|
125
129
|
|
|
130
|
+
:root[data-theme="developer-dark"] {
|
|
131
|
+
color-scheme: dark;
|
|
132
|
+
--ui-primary: #83c167;
|
|
133
|
+
--ui-primary-hover: #a3d488;
|
|
134
|
+
--ui-info: #e08a4a;
|
|
135
|
+
--ui-info-hover: #e8a06a;
|
|
136
|
+
--ui-danger: #e0705f;
|
|
137
|
+
--ui-danger-hover: #e88b7d;
|
|
138
|
+
--ui-success: #83c167;
|
|
139
|
+
--ui-warning: #d8a657;
|
|
140
|
+
--ui-warning-hover: #e0b877;
|
|
141
|
+
--ui-on-accent: #0e0d0b;
|
|
142
|
+
--ui-text: #d8d3c5;
|
|
143
|
+
--ui-text-muted: #8b8270;
|
|
144
|
+
--ui-border: #211f19;
|
|
145
|
+
--ui-surface: #0e0d0b;
|
|
146
|
+
--ui-surface-muted: #161410;
|
|
147
|
+
--ui-highlight: rgb(131 193 103 / 0.25);
|
|
148
|
+
--ui-tooltip: #050504;
|
|
149
|
+
--ui-hover-overlay: rgb(255 255 255 / 0.12);
|
|
150
|
+
--ui-overlay: rgb(5 4 4 / 0.6);
|
|
151
|
+
--ui-focus-ring: 0 0 0 3px rgb(131 193 103 / 0.45);
|
|
152
|
+
--ui-radius: 0.25rem;
|
|
153
|
+
--ui-radius-sm: 0.125rem;
|
|
154
|
+
--ui-numeric: tabular-nums;
|
|
155
|
+
--ui-font: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
156
|
+
}
|
|
157
|
+
|
|
126
158
|
:root[data-theme="light"] {
|
|
127
159
|
color-scheme: light;
|
|
128
160
|
}
|
|
@@ -204,3 +236,30 @@
|
|
|
204
236
|
--ui-numeric: tabular-nums;
|
|
205
237
|
--ui-font: "Space Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
206
238
|
}
|
|
239
|
+
|
|
240
|
+
:root[data-theme="developer-light"] {
|
|
241
|
+
color-scheme: light;
|
|
242
|
+
--ui-text: #1a1813;
|
|
243
|
+
--ui-text-muted: #6b6255;
|
|
244
|
+
--ui-surface: #f3eee1;
|
|
245
|
+
--ui-surface-muted: #e8e1cf;
|
|
246
|
+
--ui-border: #d9d0ba;
|
|
247
|
+
--ui-tooltip: #1a1813;
|
|
248
|
+
--ui-overlay: rgb(26 24 19 / 0.45);
|
|
249
|
+
--ui-hover-overlay: rgb(255 255 255 / 0.32);
|
|
250
|
+
--ui-highlight: #f0dfa0;
|
|
251
|
+
--ui-primary: #457032;
|
|
252
|
+
--ui-primary-hover: #3a6329;
|
|
253
|
+
--ui-info: #8f5124;
|
|
254
|
+
--ui-info-hover: #7a4420;
|
|
255
|
+
--ui-danger: #a8402f;
|
|
256
|
+
--ui-danger-hover: #8c3625;
|
|
257
|
+
--ui-success: #457032;
|
|
258
|
+
--ui-warning: #7c5d24;
|
|
259
|
+
--ui-warning-hover: #5e4419;
|
|
260
|
+
--ui-focus-ring: 0 0 0 3px rgb(69 112 50 / 0.35);
|
|
261
|
+
--ui-radius: 0.25rem;
|
|
262
|
+
--ui-radius-sm: 0.125rem;
|
|
263
|
+
--ui-numeric: tabular-nums;
|
|
264
|
+
--ui-font: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
265
|
+
}
|
package/dist/tokens.d.ts
CHANGED
|
@@ -110,6 +110,64 @@ export declare const metroTokenValues: Record<string, string>;
|
|
|
110
110
|
* otherwise lose its edge entirely.
|
|
111
111
|
*/
|
|
112
112
|
export declare const blueprintTokenValues: Record<string, string>;
|
|
113
|
+
/**
|
|
114
|
+
* "Developer dark" theme overrides, applied via `data-theme="developer-dark"`
|
|
115
|
+
* on `<html>` (see `generate-tokens-css.mjs`) — a true dark palette, not one
|
|
116
|
+
* layered on the light palette, so it is handled like `"dark"` itself: its own
|
|
117
|
+
* explicit `:root[data-theme="developer-dark"]` block layered over
|
|
118
|
+
* `darkTokenValues` (not the light palette), needing no dark-media-query
|
|
119
|
+
* exclusion (see `scripts/tokens-css.mjs`'s `darkThemes` list, which merges
|
|
120
|
+
* this map over `darkTokenValues` before emitting the block). Only tokens
|
|
121
|
+
* that differ from `darkTokenValues` need to be listed here; anything not
|
|
122
|
+
* repeated falls through to the same dark default `"dark"` itself uses, which
|
|
123
|
+
* is why this list happens to repeat nearly all of `darkTokenValues`'s own
|
|
124
|
+
* keys — a dark theme rarely agrees with the *other* dark theme's colors.
|
|
125
|
+
* Shape/type tokens not present in `darkTokenValues` either (radius-pill,
|
|
126
|
+
* shadow, border-width, label-transform) fall through one level further, to
|
|
127
|
+
* the light palette's defaults, via the ordinary `:root` cascade.
|
|
128
|
+
*
|
|
129
|
+
* Modeled on a real reference (a monospace, editor/terminal-chrome developer
|
|
130
|
+
* tool marketing page): near-black warm ink-well background, a warm off-white
|
|
131
|
+
* foreground, and one accent green used for links, focus rings, and button
|
|
132
|
+
* fills — with dark ink (not white) as the fill's foreground, since the
|
|
133
|
+
* accent itself is light enough to carry dark text at high contrast (8.3:1),
|
|
134
|
+
* matching the reference's own "ink CTA that fills with the accent" button.
|
|
135
|
+
*
|
|
136
|
+
* Like `blueprintTokenValues`, this is a "wide" theme that also retunes shape
|
|
137
|
+
* and type: `--ui-font` retargets to a monospace stack (falls through to the
|
|
138
|
+
* system mono stack with zero webfont, same technique as blueprint's "Space
|
|
139
|
+
* Mono"), corners are small but not squared (2–4px, not 0 — this theme reads
|
|
140
|
+
* as a dark code editor, not blueprint's flattened spec sheet), and
|
|
141
|
+
* `--ui-numeric: tabular-nums` keeps the diff/stat figures from jittering.
|
|
142
|
+
* Unlike `blueprint`, chrome labels stay sentence-case (`--ui-label-transform`
|
|
143
|
+
* is left at its default) — the reference's own section labels are lowercase
|
|
144
|
+
* `snake_case`, not shouted.
|
|
145
|
+
*/
|
|
146
|
+
export declare const developerDarkTokenValues: Record<string, string>;
|
|
147
|
+
/**
|
|
148
|
+
* "Developer light" theme overrides, applied via `data-theme="developer-light"`
|
|
149
|
+
* on `<html>` (see `generate-tokens-css.mjs`) — the light counterpart to
|
|
150
|
+
* `developerDarkTokenValues` above. The reference this pair is modeled on
|
|
151
|
+
* never shipped a light mode (its own light-mode toggle is a running joke
|
|
152
|
+
* that refuses to switch); this theme exists anyway, built from the two
|
|
153
|
+
* colors that joke's own tooltip already uses (a warm cream bubble with near-
|
|
154
|
+
* black ink) — the closest thing the reference gives to "what its light mode
|
|
155
|
+
* would have looked like."
|
|
156
|
+
*
|
|
157
|
+
* Layered on the light palette like `gradient`/`metro`/`blueprint` (needs the
|
|
158
|
+
* dark-media-query exclusion, hence `lightThemes` in `generate-tokens-css.mjs`
|
|
159
|
+
* rather than `darkThemes`), so only the differences from `tokenValues` are
|
|
160
|
+
* listed here — same convention as `blueprintTokenValues`.
|
|
161
|
+
*
|
|
162
|
+
* The accent green is darkened one step further than `developerDarkTokenValues`'s
|
|
163
|
+
* brighter green — that brighter green fails contrast against a light paper
|
|
164
|
+
* both as plain text (1.85:1) and as a white-on-fill button (2.15:1); this
|
|
165
|
+
* darker step clears both (5.0:1 text, 5.8:1 white-on-fill), so this theme
|
|
166
|
+
* keeps `--ui-on-accent` at its default white rather than reusing the dark
|
|
167
|
+
* theme's ink-on-accent trick, which does not have enough contrast at this
|
|
168
|
+
* darker shade (3.65:1 unbolded).
|
|
169
|
+
*/
|
|
170
|
+
export declare const developerLightTokenValues: Record<string, string>;
|
|
113
171
|
/**
|
|
114
172
|
* Historically a shared `:host { --ui-x: var(--ui-x, fallback); } ` block,
|
|
115
173
|
* re-declaring every token on each component's own host element as a
|
package/dist/tokens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAiM9C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqBlD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyCtD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAanD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA+DvD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAoC3D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA2B5D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,MAAM,yBAAQ,CAAC"}
|
package/dist/tokens.js
CHANGED
|
@@ -25,6 +25,14 @@ export const tokenValues = {
|
|
|
25
25
|
"--ui-button-background-hover": "var(--ui-primary-hover, #4338ca)",
|
|
26
26
|
"--ui-button-background-active": "var(--ui-button-background, var(--ui-primary, #4f46e5))",
|
|
27
27
|
"--ui-button-border": "transparent",
|
|
28
|
+
// The primary/danger fill's own text color, split out from --ui-on-accent
|
|
29
|
+
// (which every button used directly until now): --ui-on-accent means "text
|
|
30
|
+
// on any solid semantic fill" and a theme may need to darken it for a light
|
|
31
|
+
// accent color (see developerDarkTokenValues), but that darkening should
|
|
32
|
+
// only reach the button itself if the theme wants it to. Defaults to
|
|
33
|
+
// --ui-on-accent unchanged, so every existing theme renders identically.
|
|
34
|
+
"--ui-button-text": "var(--ui-on-accent, #ffffff)",
|
|
35
|
+
"--ui-button-danger-text": "var(--ui-on-accent, #ffffff)",
|
|
28
36
|
// The bordered, transparent-background secondary variant's equivalents —
|
|
29
37
|
// shared with confirm-dialog's Cancel button, which is the same visual
|
|
30
38
|
// pattern. Defaults reproduce today's literal secondary styling exactly
|
|
@@ -107,8 +115,19 @@ export const tokenValues = {
|
|
|
107
115
|
"--ui-surface-muted": "#f8fafc", // slate-50
|
|
108
116
|
"--ui-highlight": "#fde68a", // amber-200 — transient "just changed" flash
|
|
109
117
|
"--ui-tooltip": "#0f172a", // slate-900
|
|
118
|
+
// The tooltip's own foreground, kept separate from --ui-on-accent: that
|
|
119
|
+
// token means "text on a solid *semantic* fill" (a button, a toast), which
|
|
120
|
+
// a theme may need to darken if it makes those fills light (see
|
|
121
|
+
// developerDarkTokenValues). --ui-tooltip's own fill is a dedicated dark
|
|
122
|
+
// surface in every theme regardless, so its text stays white unconditionally.
|
|
123
|
+
"--ui-tooltip-text": "#ffffff",
|
|
110
124
|
"--ui-hover-overlay": "rgb(255 255 255 / 0.32)",
|
|
111
125
|
"--ui-overlay": "rgb(15 23 42 / 0.45)", // slate-900 / 45%
|
|
126
|
+
// Same reasoning as --ui-tooltip-text: a control drawn directly on the
|
|
127
|
+
// --ui-overlay scrim (photo-gallery's arrow buttons) needs text/icon
|
|
128
|
+
// contrast against that always-dark backdrop, not against whatever a theme
|
|
129
|
+
// repoints --ui-on-accent to for its semantic fills.
|
|
130
|
+
"--ui-overlay-text": "#ffffff",
|
|
112
131
|
// Shape / depth
|
|
113
132
|
"--ui-radius": "0.5rem", // rounded-lg
|
|
114
133
|
"--ui-radius-sm": "0.25rem", // rounded
|
|
@@ -406,6 +425,122 @@ export const blueprintTokenValues = {
|
|
|
406
425
|
"--ui-numeric": "tabular-nums",
|
|
407
426
|
"--ui-font": '"Space Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',
|
|
408
427
|
};
|
|
428
|
+
/**
|
|
429
|
+
* "Developer dark" theme overrides, applied via `data-theme="developer-dark"`
|
|
430
|
+
* on `<html>` (see `generate-tokens-css.mjs`) — a true dark palette, not one
|
|
431
|
+
* layered on the light palette, so it is handled like `"dark"` itself: its own
|
|
432
|
+
* explicit `:root[data-theme="developer-dark"]` block layered over
|
|
433
|
+
* `darkTokenValues` (not the light palette), needing no dark-media-query
|
|
434
|
+
* exclusion (see `scripts/tokens-css.mjs`'s `darkThemes` list, which merges
|
|
435
|
+
* this map over `darkTokenValues` before emitting the block). Only tokens
|
|
436
|
+
* that differ from `darkTokenValues` need to be listed here; anything not
|
|
437
|
+
* repeated falls through to the same dark default `"dark"` itself uses, which
|
|
438
|
+
* is why this list happens to repeat nearly all of `darkTokenValues`'s own
|
|
439
|
+
* keys — a dark theme rarely agrees with the *other* dark theme's colors.
|
|
440
|
+
* Shape/type tokens not present in `darkTokenValues` either (radius-pill,
|
|
441
|
+
* shadow, border-width, label-transform) fall through one level further, to
|
|
442
|
+
* the light palette's defaults, via the ordinary `:root` cascade.
|
|
443
|
+
*
|
|
444
|
+
* Modeled on a real reference (a monospace, editor/terminal-chrome developer
|
|
445
|
+
* tool marketing page): near-black warm ink-well background, a warm off-white
|
|
446
|
+
* foreground, and one accent green used for links, focus rings, and button
|
|
447
|
+
* fills — with dark ink (not white) as the fill's foreground, since the
|
|
448
|
+
* accent itself is light enough to carry dark text at high contrast (8.3:1),
|
|
449
|
+
* matching the reference's own "ink CTA that fills with the accent" button.
|
|
450
|
+
*
|
|
451
|
+
* Like `blueprintTokenValues`, this is a "wide" theme that also retunes shape
|
|
452
|
+
* and type: `--ui-font` retargets to a monospace stack (falls through to the
|
|
453
|
+
* system mono stack with zero webfont, same technique as blueprint's "Space
|
|
454
|
+
* Mono"), corners are small but not squared (2–4px, not 0 — this theme reads
|
|
455
|
+
* as a dark code editor, not blueprint's flattened spec sheet), and
|
|
456
|
+
* `--ui-numeric: tabular-nums` keeps the diff/stat figures from jittering.
|
|
457
|
+
* Unlike `blueprint`, chrome labels stay sentence-case (`--ui-label-transform`
|
|
458
|
+
* is left at its default) — the reference's own section labels are lowercase
|
|
459
|
+
* `snake_case`, not shouted.
|
|
460
|
+
*/
|
|
461
|
+
export const developerDarkTokenValues = {
|
|
462
|
+
"--ui-primary": "#83c167",
|
|
463
|
+
"--ui-primary-hover": "#a3d488",
|
|
464
|
+
"--ui-info": "#e08a4a",
|
|
465
|
+
"--ui-info-hover": "#e8a06a",
|
|
466
|
+
"--ui-danger": "#e0705f",
|
|
467
|
+
"--ui-danger-hover": "#e88b7d",
|
|
468
|
+
"--ui-success": "#83c167",
|
|
469
|
+
"--ui-warning": "#d8a657",
|
|
470
|
+
"--ui-warning-hover": "#e0b877",
|
|
471
|
+
// Dark ink, not white — the accent itself is light enough (8.3:1 against
|
|
472
|
+
// it) to carry dark text, and that ink-on-green fill is the reference's own
|
|
473
|
+
// CTA look.
|
|
474
|
+
"--ui-on-accent": "#0e0d0b",
|
|
475
|
+
"--ui-text": "#d8d3c5",
|
|
476
|
+
"--ui-text-muted": "#8b8270",
|
|
477
|
+
"--ui-border": "#211f19",
|
|
478
|
+
"--ui-surface": "#0e0d0b",
|
|
479
|
+
// Lighter than --ui-surface, same direction as darkTokenValues' own
|
|
480
|
+
// surface-muted (an elevated panel reads lighter, not darker, once the base
|
|
481
|
+
// is already near-black).
|
|
482
|
+
"--ui-surface-muted": "#161410",
|
|
483
|
+
// A translucent accent wash rather than a hand-picked solid, so the flash
|
|
484
|
+
// stays legible without depending on exactly which dark literal the surface
|
|
485
|
+
// ends up at.
|
|
486
|
+
"--ui-highlight": "rgb(131 193 103 / 0.25)",
|
|
487
|
+
"--ui-tooltip": "#050504",
|
|
488
|
+
"--ui-hover-overlay": "rgb(255 255 255 / 0.12)",
|
|
489
|
+
"--ui-overlay": "rgb(5 4 4 / 0.6)",
|
|
490
|
+
"--ui-focus-ring": "0 0 0 3px rgb(131 193 103 / 0.45)",
|
|
491
|
+
"--ui-radius": "0.25rem",
|
|
492
|
+
"--ui-radius-sm": "0.125rem",
|
|
493
|
+
"--ui-numeric": "tabular-nums",
|
|
494
|
+
"--ui-font": '"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',
|
|
495
|
+
};
|
|
496
|
+
/**
|
|
497
|
+
* "Developer light" theme overrides, applied via `data-theme="developer-light"`
|
|
498
|
+
* on `<html>` (see `generate-tokens-css.mjs`) — the light counterpart to
|
|
499
|
+
* `developerDarkTokenValues` above. The reference this pair is modeled on
|
|
500
|
+
* never shipped a light mode (its own light-mode toggle is a running joke
|
|
501
|
+
* that refuses to switch); this theme exists anyway, built from the two
|
|
502
|
+
* colors that joke's own tooltip already uses (a warm cream bubble with near-
|
|
503
|
+
* black ink) — the closest thing the reference gives to "what its light mode
|
|
504
|
+
* would have looked like."
|
|
505
|
+
*
|
|
506
|
+
* Layered on the light palette like `gradient`/`metro`/`blueprint` (needs the
|
|
507
|
+
* dark-media-query exclusion, hence `lightThemes` in `generate-tokens-css.mjs`
|
|
508
|
+
* rather than `darkThemes`), so only the differences from `tokenValues` are
|
|
509
|
+
* listed here — same convention as `blueprintTokenValues`.
|
|
510
|
+
*
|
|
511
|
+
* The accent green is darkened one step further than `developerDarkTokenValues`'s
|
|
512
|
+
* brighter green — that brighter green fails contrast against a light paper
|
|
513
|
+
* both as plain text (1.85:1) and as a white-on-fill button (2.15:1); this
|
|
514
|
+
* darker step clears both (5.0:1 text, 5.8:1 white-on-fill), so this theme
|
|
515
|
+
* keeps `--ui-on-accent` at its default white rather than reusing the dark
|
|
516
|
+
* theme's ink-on-accent trick, which does not have enough contrast at this
|
|
517
|
+
* darker shade (3.65:1 unbolded).
|
|
518
|
+
*/
|
|
519
|
+
export const developerLightTokenValues = {
|
|
520
|
+
"--ui-text": "#1a1813",
|
|
521
|
+
"--ui-text-muted": "#6b6255",
|
|
522
|
+
"--ui-surface": "#f3eee1",
|
|
523
|
+
"--ui-surface-muted": "#e8e1cf",
|
|
524
|
+
"--ui-border": "#d9d0ba",
|
|
525
|
+
"--ui-tooltip": "#1a1813",
|
|
526
|
+
"--ui-overlay": "rgb(26 24 19 / 0.45)",
|
|
527
|
+
"--ui-hover-overlay": "rgb(255 255 255 / 0.32)",
|
|
528
|
+
"--ui-highlight": "#f0dfa0",
|
|
529
|
+
"--ui-primary": "#457032",
|
|
530
|
+
"--ui-primary-hover": "#3a6329",
|
|
531
|
+
"--ui-info": "#8f5124",
|
|
532
|
+
"--ui-info-hover": "#7a4420",
|
|
533
|
+
"--ui-danger": "#a8402f",
|
|
534
|
+
"--ui-danger-hover": "#8c3625",
|
|
535
|
+
"--ui-success": "#457032",
|
|
536
|
+
"--ui-warning": "#7c5d24",
|
|
537
|
+
"--ui-warning-hover": "#5e4419",
|
|
538
|
+
"--ui-focus-ring": "0 0 0 3px rgb(69 112 50 / 0.35)",
|
|
539
|
+
"--ui-radius": "0.25rem",
|
|
540
|
+
"--ui-radius-sm": "0.125rem",
|
|
541
|
+
"--ui-numeric": "tabular-nums",
|
|
542
|
+
"--ui-font": '"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',
|
|
543
|
+
};
|
|
409
544
|
/**
|
|
410
545
|
* Historically a shared `:host { --ui-x: var(--ui-x, fallback); } ` block,
|
|
411
546
|
* re-declaring every token on each component's own host element as a
|