@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stat-strip.js","sourceRoot":"","sources":["../src/stat-strip.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,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC;;;;;;;;;GASG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QA6DL,uGAAuG;QAC5E,UAAK,GAAoB,EAAE,CAAC;IAsBzD,CAAC;aAnFiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuDF;KACF,AA1DqB,CA0DpB;IAKO,MAAM;QACb,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,OAAO,CAAC;QAE5C,OAAO,IAAI,CAAA;;UAEL,MAAM,CACN,IAAI,CAAC,KAAK;QACV,wEAAwE;QACxE,wEAAwE;QACxE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EACvB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;kCAEU,IAAI,CAAC,KAAK;kCACV,IAAI,CAAC,KAAK;;WAEjC,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AAtB4B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;wCAA6B;AA9D5C,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAoFrB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** One stat highlight in a strip. */\nexport interface StatStripItem {\n /** Large figure rendered verbatim, e.g. `\"54%\"` or `\"1.2M\"`. */\n value: string;\n /** Short caption rendered beneath the figure, e.g. `\"less code\"`. */\n label: string;\n}\n\n/**\n * A headless, presentational strip of headline stats — one large figure plus\n * one muted caption per `items` entry, wrapping across lines on narrow\n * viewports. Unlike `stat-meter`, this component does not compute percentages\n * or render a fill bar: callers pass preformatted figure strings as-is and\n * `stat-strip` only lays them out for marketing, benchmark, or dashboard\n * summary rows.\n *\n * @element stat-strip\n */\n@customElement(\"stat-strip\")\nexport class StatStrip extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\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 .strip {\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 1rem 1.5rem;\n margin: 0;\n padding: 0;\n }\n\n .item {\n display: flex;\n flex: 1 1 8rem;\n flex-direction: column;\n gap: 0.25rem;\n min-width: 8rem;\n }\n\n .value {\n order: -1;\n margin: 0;\n color: var(--ui-primary, #4f46e5);\n /* The lg title tier, same as calendar-month/popover-panel/slide-panel's\n most prominent text — the shared scale is never themed for size, so\n this stays the largest available step rather than a literal. */\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-bold, 700);\n line-height: var(--ui-line-height-tight, 1.25);\n font-variant-numeric: var(--ui-numeric, normal);\n white-space: nowrap;\n }\n\n .label {\n margin: 0;\n color: var(--ui-text-muted, #64748b);\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n letter-spacing: var(--ui-tracking-wide, 0.04em);\n line-height: var(--ui-line-height-tight, 1.25);\n text-transform: var(--ui-label-transform, none);\n }\n `,\n ];\n\n /** Stats rendered in display order; each item is shown as a large figure with a caption beneath it. */\n @property({ type: Array }) items: StatStripItem[] = [];\n\n override render() {\n if (this.items.length === 0) return nothing;\n\n return html`\n <dl class=\"strip\">\n ${repeat(\n this.items,\n // Stat strips are short presentational rows with no intrinsic item IDs;\n // keying by index deliberately preserves caller-supplied display order.\n (_item, index) => index,\n (item) => html`\n <div class=\"item\">\n <dt class=\"label\">${item.label}</dt>\n <dd class=\"value\">${item.value}</dd>\n </div>\n `,\n )}\n </dl>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"stat-strip\": StatStrip;\n }\n}\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/** One rung of a {@link StepLadder} in the data-driven `items` path. */
|
|
3
|
+
export interface StepLadderItem {
|
|
4
|
+
/** The bold step title, shown immediately after the ordinal. */
|
|
5
|
+
title: string;
|
|
6
|
+
/** The muted supporting line that explains the rung's fallback guidance. */
|
|
7
|
+
description: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A flat ordered ladder of fallback steps — an escalating "try this first,
|
|
11
|
+
* then move to the next rung only if it does not solve it" list. Each rung
|
|
12
|
+
* shows a zero-padded ordinal, a bold title, and a muted description, with a
|
|
13
|
+
* hairline rule between rows.
|
|
14
|
+
*
|
|
15
|
+
* Feed it the `items` array for the plain data path, where each
|
|
16
|
+
* {@link StepLadderItem} supplies a `title` and `description`, or slot bare
|
|
17
|
+
* `<li>` steps when a rung needs links, emphasis, or other richer markup.
|
|
18
|
+
* Slotted content takes precedence over `items`; with neither, nothing is
|
|
19
|
+
* rendered. As with `spec-list`, richer wrapper elements are accepted too, but
|
|
20
|
+
* those own their own inner markup.
|
|
21
|
+
*
|
|
22
|
+
* @element step-ladder
|
|
23
|
+
* @slot - Optional `<li>` rungs or richer step markup; when present, they
|
|
24
|
+
* replace the `items` path.
|
|
25
|
+
*/
|
|
26
|
+
export declare class StepLadder extends LitElement {
|
|
27
|
+
/** The rungs for the data-driven path. Ignored when the default slot has content. */
|
|
28
|
+
items: StepLadderItem[];
|
|
29
|
+
/** Whether the default slot currently has assigned content. */
|
|
30
|
+
private _hasSlotted;
|
|
31
|
+
static styles: import("lit").CSSResult[];
|
|
32
|
+
/** Whether a slot node is real content, ignoring the whitespace ordinary indented markup leaves between children. */
|
|
33
|
+
private static _isContent;
|
|
34
|
+
/** Tracks whether the default slot has content so slotted markup can take precedence over `items`. */
|
|
35
|
+
private _onSlotChange;
|
|
36
|
+
connectedCallback(): void;
|
|
37
|
+
/** The rungs, defended against a non-array value assigned at runtime by a JS or HTML consumer. */
|
|
38
|
+
private _rows;
|
|
39
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
40
|
+
}
|
|
41
|
+
declare global {
|
|
42
|
+
interface HTMLElementTagNameMap {
|
|
43
|
+
"step-ladder": StepLadder;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=step-ladder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-ladder.d.ts","sourceRoot":"","sources":["../src/step-ladder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAKrD,wEAAwE;AACxE,MAAM,WAAW,cAAc;IAC7B,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,UAAW,SAAQ,UAAU;IACxC,qFAAqF;IAC1D,KAAK,EAAE,cAAc,EAAE,CAAM;IAExD,+DAA+D;IACtD,OAAO,CAAC,WAAW,CAAS;IAErC,OAAgB,MAAM,4BA+EpB;IAEF,qHAAqH;IACrH,OAAO,CAAC,MAAM,CAAC,UAAU;IAIzB,sGAAsG;IACtG,OAAO,CAAC,aAAa;IAKZ,iBAAiB,IAAI,IAAI,CAOjC;IAED,kGAAkG;IAClG,OAAO,CAAC,KAAK;IAIJ,MAAM,yCA4Bd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var StepLadder_1;
|
|
8
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
9
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
10
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
11
|
+
import { tokens } from "./tokens.js";
|
|
12
|
+
/**
|
|
13
|
+
* A flat ordered ladder of fallback steps — an escalating "try this first,
|
|
14
|
+
* then move to the next rung only if it does not solve it" list. Each rung
|
|
15
|
+
* shows a zero-padded ordinal, a bold title, and a muted description, with a
|
|
16
|
+
* hairline rule between rows.
|
|
17
|
+
*
|
|
18
|
+
* Feed it the `items` array for the plain data path, where each
|
|
19
|
+
* {@link StepLadderItem} supplies a `title` and `description`, or slot bare
|
|
20
|
+
* `<li>` steps when a rung needs links, emphasis, or other richer markup.
|
|
21
|
+
* Slotted content takes precedence over `items`; with neither, nothing is
|
|
22
|
+
* rendered. As with `spec-list`, richer wrapper elements are accepted too, but
|
|
23
|
+
* those own their own inner markup.
|
|
24
|
+
*
|
|
25
|
+
* @element step-ladder
|
|
26
|
+
* @slot - Optional `<li>` rungs or richer step markup; when present, they
|
|
27
|
+
* replace the `items` path.
|
|
28
|
+
*/
|
|
29
|
+
let StepLadder = class StepLadder extends LitElement {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
/** The rungs for the data-driven path. Ignored when the default slot has content. */
|
|
33
|
+
this.items = [];
|
|
34
|
+
/** Whether the default slot currently has assigned content. */
|
|
35
|
+
this._hasSlotted = false;
|
|
36
|
+
}
|
|
37
|
+
static { StepLadder_1 = this; }
|
|
38
|
+
static { this.styles = [
|
|
39
|
+
tokens,
|
|
40
|
+
css `
|
|
41
|
+
:host {
|
|
42
|
+
display: block;
|
|
43
|
+
color: var(--ui-text, #0f172a);
|
|
44
|
+
font-family: var(
|
|
45
|
+
--ui-font,
|
|
46
|
+
ui-sans-serif,
|
|
47
|
+
system-ui,
|
|
48
|
+
sans-serif,
|
|
49
|
+
"Apple Color Emoji",
|
|
50
|
+
"Segoe UI Emoji",
|
|
51
|
+
"Segoe UI Symbol",
|
|
52
|
+
"Noto Color Emoji"
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
.ladder {
|
|
56
|
+
margin: 0;
|
|
57
|
+
padding: 0;
|
|
58
|
+
list-style: none;
|
|
59
|
+
counter-reset: rung;
|
|
60
|
+
}
|
|
61
|
+
.ladder.empty {
|
|
62
|
+
display: none;
|
|
63
|
+
}
|
|
64
|
+
.rung {
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: flex-start;
|
|
67
|
+
gap: 0.75rem;
|
|
68
|
+
padding: 0.75rem 0;
|
|
69
|
+
counter-increment: rung;
|
|
70
|
+
}
|
|
71
|
+
.rung + .rung {
|
|
72
|
+
border-top: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
73
|
+
}
|
|
74
|
+
.rung::before {
|
|
75
|
+
content: counter(rung, decimal-leading-zero);
|
|
76
|
+
flex: 0 0 auto;
|
|
77
|
+
min-width: 2ch;
|
|
78
|
+
color: var(--ui-primary, #4f46e5);
|
|
79
|
+
font-size: var(--ui-font-size-sm, 0.75rem);
|
|
80
|
+
font-weight: var(--ui-font-weight-bold, 700);
|
|
81
|
+
line-height: var(--ui-line-height-normal, 1.5);
|
|
82
|
+
font-variant-numeric: var(--ui-numeric, normal);
|
|
83
|
+
}
|
|
84
|
+
.content {
|
|
85
|
+
display: flex;
|
|
86
|
+
flex: 1 1 auto;
|
|
87
|
+
flex-wrap: wrap;
|
|
88
|
+
align-items: baseline;
|
|
89
|
+
gap: 0.25rem 0.5rem;
|
|
90
|
+
min-width: 0;
|
|
91
|
+
}
|
|
92
|
+
.title {
|
|
93
|
+
color: var(--ui-text, #0f172a);
|
|
94
|
+
font-size: var(--ui-font-size, 0.875rem);
|
|
95
|
+
font-weight: var(--ui-font-weight-bold, 700);
|
|
96
|
+
line-height: var(--ui-line-height-normal, 1.5);
|
|
97
|
+
}
|
|
98
|
+
.description {
|
|
99
|
+
flex: 1 1 12rem;
|
|
100
|
+
min-width: 0;
|
|
101
|
+
color: var(--ui-text-muted, #64748b);
|
|
102
|
+
font-size: var(--ui-font-size, 0.875rem);
|
|
103
|
+
font-weight: var(--ui-font-weight-regular, 400);
|
|
104
|
+
line-height: var(--ui-line-height-normal, 1.5);
|
|
105
|
+
word-break: break-word;
|
|
106
|
+
}
|
|
107
|
+
::slotted(li) {
|
|
108
|
+
margin: 0;
|
|
109
|
+
padding: 0.75rem 0;
|
|
110
|
+
list-style: none;
|
|
111
|
+
border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
112
|
+
}
|
|
113
|
+
::slotted(li:last-of-type) {
|
|
114
|
+
border-bottom: none;
|
|
115
|
+
}
|
|
116
|
+
`,
|
|
117
|
+
]; }
|
|
118
|
+
/** Whether a slot node is real content, ignoring the whitespace ordinary indented markup leaves between children. */
|
|
119
|
+
static _isContent(node) {
|
|
120
|
+
return node.nodeType === Node.ELEMENT_NODE || (node.textContent ?? "").trim().length > 0;
|
|
121
|
+
}
|
|
122
|
+
/** Tracks whether the default slot has content so slotted markup can take precedence over `items`. */
|
|
123
|
+
_onSlotChange(event) {
|
|
124
|
+
const slot = event.target;
|
|
125
|
+
this._hasSlotted = slot.assignedNodes({ flatten: true }).some(StepLadder_1._isContent);
|
|
126
|
+
}
|
|
127
|
+
connectedCallback() {
|
|
128
|
+
super.connectedCallback();
|
|
129
|
+
// slotchange only fires after the first render, so without seeding from the
|
|
130
|
+
// light DOM here an element given both items and slotted markup renders
|
|
131
|
+
// both paths for its first update — visible to anything awaiting
|
|
132
|
+
// updateComplete, and contrary to the documented "slot wins" contract.
|
|
133
|
+
this._hasSlotted = Array.from(this.childNodes).some(StepLadder_1._isContent);
|
|
134
|
+
}
|
|
135
|
+
/** The rungs, defended against a non-array value assigned at runtime by a JS or HTML consumer. */
|
|
136
|
+
_rows() {
|
|
137
|
+
return Array.isArray(this.items) ? this.items.filter((item) => item != null) : [];
|
|
138
|
+
}
|
|
139
|
+
render() {
|
|
140
|
+
const rows = this._rows();
|
|
141
|
+
const showItems = !this._hasSlotted && rows.length > 0;
|
|
142
|
+
const empty = !this._hasSlotted && rows.length === 0;
|
|
143
|
+
return html `
|
|
144
|
+
<ol class="ladder ${empty ? "empty" : ""}">
|
|
145
|
+
${showItems
|
|
146
|
+
? repeat(rows,
|
|
147
|
+
// Ordered ladders are display-order driven and have no intrinsic
|
|
148
|
+
// item IDs, so the index is the deliberate stable key.
|
|
149
|
+
(_item, index) => index, (item) => html `
|
|
150
|
+
<li class="rung">
|
|
151
|
+
<span class="content">
|
|
152
|
+
<span class="title">${item.title}</span>
|
|
153
|
+
${item.description
|
|
154
|
+
? html `<span class="description">${item.description}</span>`
|
|
155
|
+
: nothing}
|
|
156
|
+
</span>
|
|
157
|
+
</li>
|
|
158
|
+
`)
|
|
159
|
+
: nothing}
|
|
160
|
+
<slot @slotchange=${this._onSlotChange}></slot>
|
|
161
|
+
</ol>
|
|
162
|
+
`;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
__decorate([
|
|
166
|
+
property({ type: Array })
|
|
167
|
+
], StepLadder.prototype, "items", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
state()
|
|
170
|
+
], StepLadder.prototype, "_hasSlotted", void 0);
|
|
171
|
+
StepLadder = StepLadder_1 = __decorate([
|
|
172
|
+
customElement("step-ladder")
|
|
173
|
+
], StepLadder);
|
|
174
|
+
export { StepLadder };
|
|
175
|
+
//# sourceMappingURL=step-ladder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-ladder.js","sourceRoot":"","sources":["../src/step-ladder.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC;;;;;;;;;;;;;;;;GAgBG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QACL,qFAAqF;QAC1D,UAAK,GAAqB,EAAE,CAAC;QAExD,+DAA+D;QAC9C,gBAAW,GAAG,KAAK,CAAC;IAyIvC,CAAC;;aAvIiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4EF;KACF,AA/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,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;UACpC,SAAS;YACT,CAAC,CAAC,MAAM,CACJ,IAAI;YACJ,iEAAiE;YACjE,uDAAuD;YACvD,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EACvB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;;0CAGc,IAAI,CAAC,KAAK;sBAC9B,IAAI,CAAC,WAAW;gBAChB,CAAC,CAAC,IAAI,CAAA,6BAA6B,IAAI,CAAC,WAAW,SAAS;gBAC5D,CAAC,CAAC,OAAO;;;eAGhB,CACF;YACH,CAAC,CAAC,OAAO;4BACS,IAAI,CAAC,aAAa;;KAEzC,CAAC;IACJ,CAAC;CACF,CAAA;AA5I4B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;yCAA8B;AAGvC;IAAhB,KAAK,EAAE;+CAA6B;AAL1B,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA8ItB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** One rung of a {@link StepLadder} in the data-driven `items` path. */\nexport interface StepLadderItem {\n /** The bold step title, shown immediately after the ordinal. */\n title: string;\n /** The muted supporting line that explains the rung's fallback guidance. */\n description: string;\n}\n\n/**\n * A flat ordered ladder of fallback steps — an escalating \"try this first,\n * then move to the next rung only if it does not solve it\" list. Each rung\n * shows a zero-padded ordinal, a bold title, and a muted description, with a\n * hairline rule between rows.\n *\n * Feed it the `items` array for the plain data path, where each\n * {@link StepLadderItem} supplies a `title` and `description`, or slot bare\n * `<li>` steps when a rung needs links, emphasis, or other richer markup.\n * Slotted content takes precedence over `items`; with neither, nothing is\n * rendered. As with `spec-list`, richer wrapper elements are accepted too, but\n * those own their own inner markup.\n *\n * @element step-ladder\n * @slot - Optional `<li>` rungs or richer step markup; when present, they\n * replace the `items` path.\n */\n@customElement(\"step-ladder\")\nexport class StepLadder extends LitElement {\n /** The rungs for the data-driven path. Ignored when the default slot has content. */\n @property({ type: Array }) items: StepLadderItem[] = [];\n\n /** Whether the default slot currently has assigned content. */\n @state() private _hasSlotted = false;\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 }\n .ladder {\n margin: 0;\n padding: 0;\n list-style: none;\n counter-reset: rung;\n }\n .ladder.empty {\n display: none;\n }\n .rung {\n display: flex;\n align-items: flex-start;\n gap: 0.75rem;\n padding: 0.75rem 0;\n counter-increment: rung;\n }\n .rung + .rung {\n border-top: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n .rung::before {\n content: counter(rung, decimal-leading-zero);\n flex: 0 0 auto;\n min-width: 2ch;\n color: var(--ui-primary, #4f46e5);\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-bold, 700);\n line-height: var(--ui-line-height-normal, 1.5);\n font-variant-numeric: var(--ui-numeric, normal);\n }\n .content {\n display: flex;\n flex: 1 1 auto;\n flex-wrap: wrap;\n align-items: baseline;\n gap: 0.25rem 0.5rem;\n min-width: 0;\n }\n .title {\n color: var(--ui-text, #0f172a);\n font-size: var(--ui-font-size, 0.875rem);\n font-weight: var(--ui-font-weight-bold, 700);\n line-height: var(--ui-line-height-normal, 1.5);\n }\n .description {\n flex: 1 1 12rem;\n min-width: 0;\n color: var(--ui-text-muted, #64748b);\n font-size: var(--ui-font-size, 0.875rem);\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 ::slotted(li) {\n margin: 0;\n padding: 0.75rem 0;\n list-style: none;\n border-bottom: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n }\n ::slotted(li:last-of-type) {\n border-bottom: none;\n }\n `,\n ];\n\n /** Whether a slot node is real content, ignoring the whitespace ordinary indented markup leaves between children. */\n private static _isContent(node: Node): boolean {\n return node.nodeType === Node.ELEMENT_NODE || (node.textContent ?? \"\").trim().length > 0;\n }\n\n /** Tracks whether the default slot has content so slotted markup can take precedence over `items`. */\n private _onSlotChange(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n this._hasSlotted = slot.assignedNodes({ flatten: true }).some(StepLadder._isContent);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n // slotchange only fires after the first render, so without seeding from the\n // light DOM here an element given both items and slotted markup renders\n // both paths for its first update — visible to anything awaiting\n // updateComplete, and contrary to the documented \"slot wins\" contract.\n this._hasSlotted = Array.from(this.childNodes).some(StepLadder._isContent);\n }\n\n /** The rungs, defended against a non-array value assigned at runtime by a JS or HTML consumer. */\n private _rows(): StepLadderItem[] {\n return Array.isArray(this.items) ? this.items.filter((item): item is StepLadderItem => item != null) : [];\n }\n\n override render() {\n const rows = this._rows();\n const showItems = !this._hasSlotted && rows.length > 0;\n const empty = !this._hasSlotted && rows.length === 0;\n\n return html`\n <ol class=\"ladder ${empty ? \"empty\" : \"\"}\">\n ${showItems\n ? repeat(\n rows,\n // Ordered ladders are display-order driven and have no intrinsic\n // item IDs, so the index is the deliberate stable key.\n (_item, index) => index,\n (item) => html`\n <li class=\"rung\">\n <span class=\"content\">\n <span class=\"title\">${item.title}</span>\n ${item.description\n ? html`<span class=\"description\">${item.description}</span>`\n : nothing}\n </span>\n </li>\n `,\n )\n : nothing}\n <slot @slotchange=${this._onSlotChange}></slot>\n </ol>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"step-ladder\": StepLadder;\n }\n}\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/** The visual treatment applied to one terminal transcript line. */
|
|
3
|
+
export type TerminalLineType = "prompt" | "comment" | "output";
|
|
4
|
+
/** One ordered line in the terminal transcript. */
|
|
5
|
+
export interface TerminalLine {
|
|
6
|
+
type: TerminalLineType;
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A headless, data-driven terminal transcript shell for short install or usage
|
|
11
|
+
* instructions. Callers provide a flat ordered `lines` array of
|
|
12
|
+
* `TerminalLine` objects, and the component renders each line exactly in that
|
|
13
|
+
* order with a type-driven visual treatment: `"prompt"` lines get a fixed
|
|
14
|
+
* leading `❯` marker in `--ui-primary`, `"comment"` lines render as dim italic
|
|
15
|
+
* guidance, and `"output"` lines render as plain terminal text.
|
|
16
|
+
*
|
|
17
|
+
* The panel deliberately stays dark regardless of the surrounding page theme:
|
|
18
|
+
* it reuses `--ui-tooltip` for the surface and `--ui-tooltip-text` for the
|
|
19
|
+
* main foreground (not `--ui-on-accent` — that token means "text on a solid
|
|
20
|
+
* *semantic* fill" and a theme is free to darken it for a light accent color,
|
|
21
|
+
* whereas `--ui-tooltip`'s own fill stays dark unconditionally), because this
|
|
22
|
+
* is meant to read as "the terminal" rather than as a normal page card that
|
|
23
|
+
* follows the ambient surface palette.
|
|
24
|
+
*
|
|
25
|
+
* An empty `lines` array still renders the bordered, padded shell so consumers
|
|
26
|
+
* can see that an instruction block is present but currently has no transcript
|
|
27
|
+
* content, rather than having the component silently disappear.
|
|
28
|
+
*
|
|
29
|
+
* @element terminal-block
|
|
30
|
+
*/
|
|
31
|
+
export declare class TerminalBlock extends LitElement {
|
|
32
|
+
static styles: import("lit").CSSResult[];
|
|
33
|
+
/**
|
|
34
|
+
* Ordered terminal transcript lines. Each entry is a `{ type, text }`
|
|
35
|
+
* object, and an empty array still renders the visible terminal shell.
|
|
36
|
+
*/
|
|
37
|
+
lines: TerminalLine[];
|
|
38
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
39
|
+
}
|
|
40
|
+
declare global {
|
|
41
|
+
interface HTMLElementTagNameMap {
|
|
42
|
+
"terminal-block": TerminalBlock;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=terminal-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-block.d.ts","sourceRoot":"","sources":["../src/terminal-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAK5C,oEAAoE;AACpE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE/D,mDAAmD;AACnD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBACa,aAAc,SAAQ,UAAU;IAC3C,OAAgB,MAAM,4BA2DpB;IAEF;;;OAGG;IACwB,KAAK,EAAE,YAAY,EAAE,CAAM;IAE7C,MAAM,yCAMd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAC;KACjC;CACF"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, css, html } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
10
|
+
import { tokens } from "./tokens.js";
|
|
11
|
+
/**
|
|
12
|
+
* A headless, data-driven terminal transcript shell for short install or usage
|
|
13
|
+
* instructions. Callers provide a flat ordered `lines` array of
|
|
14
|
+
* `TerminalLine` objects, and the component renders each line exactly in that
|
|
15
|
+
* order with a type-driven visual treatment: `"prompt"` lines get a fixed
|
|
16
|
+
* leading `❯` marker in `--ui-primary`, `"comment"` lines render as dim italic
|
|
17
|
+
* guidance, and `"output"` lines render as plain terminal text.
|
|
18
|
+
*
|
|
19
|
+
* The panel deliberately stays dark regardless of the surrounding page theme:
|
|
20
|
+
* it reuses `--ui-tooltip` for the surface and `--ui-tooltip-text` for the
|
|
21
|
+
* main foreground (not `--ui-on-accent` — that token means "text on a solid
|
|
22
|
+
* *semantic* fill" and a theme is free to darken it for a light accent color,
|
|
23
|
+
* whereas `--ui-tooltip`'s own fill stays dark unconditionally), because this
|
|
24
|
+
* is meant to read as "the terminal" rather than as a normal page card that
|
|
25
|
+
* follows the ambient surface palette.
|
|
26
|
+
*
|
|
27
|
+
* An empty `lines` array still renders the bordered, padded shell so consumers
|
|
28
|
+
* can see that an instruction block is present but currently has no transcript
|
|
29
|
+
* content, rather than having the component silently disappear.
|
|
30
|
+
*
|
|
31
|
+
* @element terminal-block
|
|
32
|
+
*/
|
|
33
|
+
let TerminalBlock = class TerminalBlock extends LitElement {
|
|
34
|
+
constructor() {
|
|
35
|
+
super(...arguments);
|
|
36
|
+
/**
|
|
37
|
+
* Ordered terminal transcript lines. Each entry is a `{ type, text }`
|
|
38
|
+
* object, and an empty array still renders the visible terminal shell.
|
|
39
|
+
*/
|
|
40
|
+
this.lines = [];
|
|
41
|
+
}
|
|
42
|
+
static { this.styles = [
|
|
43
|
+
tokens,
|
|
44
|
+
css `
|
|
45
|
+
:host {
|
|
46
|
+
display: block;
|
|
47
|
+
}
|
|
48
|
+
.panel {
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
margin: 0;
|
|
51
|
+
display: grid;
|
|
52
|
+
gap: 0.25rem;
|
|
53
|
+
overflow-x: auto;
|
|
54
|
+
padding: 0.75rem 1rem;
|
|
55
|
+
border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
56
|
+
border-radius: var(--ui-radius, 0.5rem);
|
|
57
|
+
background: var(--ui-tooltip, #0f172a);
|
|
58
|
+
color: var(--ui-tooltip-text, #ffffff);
|
|
59
|
+
font-family: var(
|
|
60
|
+
--ui-font-mono,
|
|
61
|
+
ui-monospace,
|
|
62
|
+
SFMono-Regular,
|
|
63
|
+
Menlo,
|
|
64
|
+
Monaco,
|
|
65
|
+
Consolas,
|
|
66
|
+
monospace
|
|
67
|
+
);
|
|
68
|
+
font-size: var(--ui-font-size, 0.875rem);
|
|
69
|
+
line-height: var(--ui-line-height-normal, 1.5);
|
|
70
|
+
white-space: normal;
|
|
71
|
+
}
|
|
72
|
+
.line {
|
|
73
|
+
display: block;
|
|
74
|
+
min-width: 0;
|
|
75
|
+
white-space: pre-wrap;
|
|
76
|
+
}
|
|
77
|
+
.prompt::before {
|
|
78
|
+
content: "❯";
|
|
79
|
+
margin-right: 0.5rem;
|
|
80
|
+
color: var(--ui-primary, #4f46e5);
|
|
81
|
+
font-weight: var(--ui-font-weight-semibold, 600);
|
|
82
|
+
}
|
|
83
|
+
.comment {
|
|
84
|
+
color: rgb(255 255 255 / 0.55);
|
|
85
|
+
font-style: italic;
|
|
86
|
+
}
|
|
87
|
+
@media (forced-colors: active) {
|
|
88
|
+
.panel {
|
|
89
|
+
border: 1px solid CanvasText;
|
|
90
|
+
background: Canvas;
|
|
91
|
+
color: CanvasText;
|
|
92
|
+
}
|
|
93
|
+
.prompt::before {
|
|
94
|
+
color: LinkText;
|
|
95
|
+
}
|
|
96
|
+
.comment {
|
|
97
|
+
color: GrayText;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
`,
|
|
101
|
+
]; }
|
|
102
|
+
render() {
|
|
103
|
+
return html `<pre class="panel">${repeat(this.lines, (_line, index) => index, (line) => html `<span class=${`line ${line.type}`}>${line.text}</span>`)}</pre>`;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
__decorate([
|
|
107
|
+
property({ type: Array })
|
|
108
|
+
], TerminalBlock.prototype, "lines", void 0);
|
|
109
|
+
TerminalBlock = __decorate([
|
|
110
|
+
customElement("terminal-block")
|
|
111
|
+
], TerminalBlock);
|
|
112
|
+
export { TerminalBlock };
|
|
113
|
+
//# sourceMappingURL=terminal-block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-block.js","sourceRoot":"","sources":["../src/terminal-block.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;AAWrC;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QA8DL;;;WAGG;QACwB,UAAK,GAAmB,EAAE,CAAC;IASxD,CAAC;aA1EiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwDF;KACF,AA3DqB,CA2DpB;IAQO,MAAM;QACb,OAAO,IAAI,CAAA,sBAAsB,MAAM,CACrC,IAAI,CAAC,KAAK,EACV,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EACvB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA,eAAe,QAAQ,IAAI,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,SAAS,CACvE,QAAQ,CAAC;IACZ,CAAC;CACF,CAAA;AAT4B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;4CAA4B;AAlE3C,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CA2EzB","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\n/** The visual treatment applied to one terminal transcript line. */\nexport type TerminalLineType = \"prompt\" | \"comment\" | \"output\";\n\n/** One ordered line in the terminal transcript. */\nexport interface TerminalLine {\n type: TerminalLineType;\n text: string;\n}\n\n/**\n * A headless, data-driven terminal transcript shell for short install or usage\n * instructions. Callers provide a flat ordered `lines` array of\n * `TerminalLine` objects, and the component renders each line exactly in that\n * order with a type-driven visual treatment: `\"prompt\"` lines get a fixed\n * leading `❯` marker in `--ui-primary`, `\"comment\"` lines render as dim italic\n * guidance, and `\"output\"` lines render as plain terminal text.\n *\n * The panel deliberately stays dark regardless of the surrounding page theme:\n * it reuses `--ui-tooltip` for the surface and `--ui-tooltip-text` for the\n * main foreground (not `--ui-on-accent` — that token means \"text on a solid\n * *semantic* fill\" and a theme is free to darken it for a light accent color,\n * whereas `--ui-tooltip`'s own fill stays dark unconditionally), because this\n * is meant to read as \"the terminal\" rather than as a normal page card that\n * follows the ambient surface palette.\n *\n * An empty `lines` array still renders the bordered, padded shell so consumers\n * can see that an instruction block is present but currently has no transcript\n * content, rather than having the component silently disappear.\n *\n * @element terminal-block\n */\n@customElement(\"terminal-block\")\nexport class TerminalBlock extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .panel {\n box-sizing: border-box;\n margin: 0;\n display: grid;\n gap: 0.25rem;\n overflow-x: auto;\n padding: 0.75rem 1rem;\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius, 0.5rem);\n background: var(--ui-tooltip, #0f172a);\n color: var(--ui-tooltip-text, #ffffff);\n font-family: var(\n --ui-font-mono,\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Monaco,\n Consolas,\n monospace\n );\n font-size: var(--ui-font-size, 0.875rem);\n line-height: var(--ui-line-height-normal, 1.5);\n white-space: normal;\n }\n .line {\n display: block;\n min-width: 0;\n white-space: pre-wrap;\n }\n .prompt::before {\n content: \"❯\";\n margin-right: 0.5rem;\n color: var(--ui-primary, #4f46e5);\n font-weight: var(--ui-font-weight-semibold, 600);\n }\n .comment {\n color: rgb(255 255 255 / 0.55);\n font-style: italic;\n }\n @media (forced-colors: active) {\n .panel {\n border: 1px solid CanvasText;\n background: Canvas;\n color: CanvasText;\n }\n .prompt::before {\n color: LinkText;\n }\n .comment {\n color: GrayText;\n }\n }\n `,\n ];\n\n /**\n * Ordered terminal transcript lines. Each entry is a `{ type, text }`\n * object, and an empty array still renders the visible terminal shell.\n */\n @property({ type: Array }) lines: TerminalLine[] = [];\n\n override render() {\n return html`<pre class=\"panel\">${repeat(\n this.lines,\n (_line, index) => index,\n (line) => html`<span class=${`line ${line.type}`}>${line.text}</span>`,\n )}</pre>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"terminal-block\": TerminalBlock;\n }\n}\n"]}
|
package/dist/tile-grid.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-grid.d.ts","sourceRoot":"","sources":["../src/tile-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAMrD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,QAAS,SAAQ,UAAU;;IACtC,OAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"tile-grid.d.ts","sourceRoot":"","sources":["../src/tile-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAMrD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,QAAS,SAAQ,UAAU;;IACtC,OAAgB,MAAM,4BAgEpB;IAEF,iFAAiF;IACjD,KAAK,EAAE,OAAO,EAAE,CAAM;IACtD,sGAAsG;IACtE,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAG/E;IACX,yEAAyE;IACzC,UAAU,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAA0B;IAChG,yFAAyF;IACzD,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAAQ;IAC3F,0GAA0G;IACrD,QAAQ,UAAS;IAyB7D,MAAM,yCA8Bd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
|
package/dist/tile-grid.js
CHANGED
|
@@ -66,6 +66,9 @@ let TileGrid = class TileGrid extends LitElement {
|
|
|
66
66
|
.tile {
|
|
67
67
|
border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
68
68
|
border-radius: var(--ui-radius, 0.5rem);
|
|
69
|
+
/* A resting tile only painted on hover, so it was see-through over
|
|
70
|
+
anything but a plain --ui-surface page. */
|
|
71
|
+
background: var(--ui-surface, #ffffff);
|
|
69
72
|
padding: 0.75rem;
|
|
70
73
|
color: var(--ui-text, #0f172a);
|
|
71
74
|
}
|
package/dist/tile-grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-grid.js","sourceRoot":"","sources":["../src/tile-grid.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,MAAM,EAAE,MAAM,0BAA0B,CAAC;A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AAC,OAAO;2BACnB,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO;yBACtB,CAAC,CAAa,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;2BAC3C,IAAI,CAAC,CAAC,CAAC,CAAC,CAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO;;kBAE5E,IAAI,CAAC,QAAQ;gBACb,CAAC,CAAC,IAAI,CAAA;;qEAE6C,YAAY,CAAC,EAAE,CAAC;oDACjC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;;qBAEpD;gBACH,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;;aAE5B,CAAC;QACJ,CAAC,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AAnEiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uCAAuB;AAEtB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yCAGpB;AAEqB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAAiE;AAEhE;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;0CAA4D;AAEtC;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;0CAAkB;AA/E3D,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAuIpB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { iconDocument } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A generic, presentational grid shell: renders one bordered card per entry\n * in `items`, with each tile's content produced by `renderTile` (default:\n * stringify). Knows nothing about what an \"item\" means — callers own the\n * data shape entirely. Modeled directly on `data-table`'s headless pattern.\n *\n * Optional `itemHref` makes whole tiles clickable (navigating via\n * `location.hash`), without hijacking clicks on nested interactive elements\n * (links/buttons) a tile's rendered content might contain.\n *\n * Optional `fileIcon` prefixes each tile with a decorative Heroicons\n * \"document\" glyph, for grids whose items represent files — the icon never\n * carries its own accessible name since the rendered tile content (e.g. a\n * filename) already identifies the item. Off by default, so it consumes no\n * layout space or markup for grids of non-file items.\n *\n * @element tile-grid\n */\n@customElement(\"tile-grid\")\nexport class TileGrid extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr));\n gap: 0.75rem;\n }\n .tile {\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius, 0.5rem);\n /* A resting tile only painted on hover, so it was see-through over\n anything but a plain --ui-surface page. */\n background: var(--ui-surface, #ffffff);\n padding: 0.75rem;\n color: var(--ui-text, #0f172a);\n }\n .tile.clickable {\n cursor: pointer;\n }\n .tile.clickable:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .tile.clickable:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .tile-body {\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n }\n .tile-icon {\n display: inline-flex;\n flex-shrink: 0;\n margin-top: 0.125rem;\n color: var(--ui-text-muted, #64748b);\n }\n .tile-content {\n min-width: 0;\n flex: 1;\n }\n @media (forced-colors: active) {\n .tile.clickable:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n /** Tile data; opaque to this component beyond what `renderTile` does with it. */\n @property({ attribute: false }) items: unknown[] = [];\n /** Stable identity for `items[i]`, used as the repeat-directive key. Defaults to the item's index. */\n @property({ attribute: false }) itemKey: (item: unknown, index: number) => string | number = (\n _item,\n index,\n ) => index;\n /** Produces a tile's rendered content for `item`. Default: stringify. */\n @property({ attribute: false }) renderTile: (item: unknown) => unknown = (item) => String(item);\n /** When set, clicking a tile (outside any nested link/button) navigates to this hash. */\n @property({ attribute: false }) itemHref: ((item: unknown) => string | null) | null = null;\n /** Prefixes each tile with a decorative \"document\" icon, for grids of file-like items. Off by default. */\n @property({ type: Boolean, attribute: \"file-icon\" }) fileIcon = false;\n\n #onTileClick(item: unknown, e: MouseEvent): void {\n if (!this.itemHref) return;\n if (this.#isNestedInteractive(e.composedPath(), e.currentTarget)) return;\n const href = this.itemHref(item);\n if (href) location.hash = href;\n }\n\n #onTileKeydown(href: string, e: KeyboardEvent): void {\n if (e.key !== \"Enter\" || e.target !== e.currentTarget) return;\n e.preventDefault();\n location.hash = href;\n }\n\n #isNestedInteractive(path: EventTarget[], tile: EventTarget | null): boolean {\n const selector =\n \"a, button, input, select, textarea, summary, [contenteditable], [role='button'], [role='link'], [tabindex]\";\n for (const target of path) {\n if (target === tile) return false;\n if (target instanceof HTMLElement && target.matches(selector)) return true;\n }\n return false;\n }\n\n override render() {\n return html`\n <div class=\"grid\">\n ${repeat(\n this.items,\n (item, i) => this.itemKey(item, i),\n (item) => {\n const href = this.itemHref?.(item) ?? null;\n return html`\n <div\n class=${href ? \"tile clickable\" : \"tile\"}\n role=${href ? \"link\" : nothing}\n tabindex=${href ? \"0\" : nothing}\n @click=${(e: MouseEvent) => this.#onTileClick(item, e)}\n @keydown=${href ? (e: KeyboardEvent) => this.#onTileKeydown(href, e) : nothing}\n >\n ${this.fileIcon\n ? html`\n <div class=\"tile-body\">\n <span class=\"tile-icon\" aria-hidden=\"true\">${iconDocument(14)}</span>\n <div class=\"tile-content\">${this.renderTile(item)}</div>\n </div>\n `\n : this.renderTile(item)}\n </div>\n `;\n },\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"tile-grid\": TileGrid;\n }\n}\n"]}
|
|
@@ -67,11 +67,18 @@ export declare class ToastNotification extends LitElement {
|
|
|
67
67
|
* @returns The toast's id — pass to `dismiss()` to remove it early.
|
|
68
68
|
*/
|
|
69
69
|
show(message: string, options?: ToastOptions): number;
|
|
70
|
+
/**
|
|
71
|
+
* Moves the stack to the top of the browser's top layer, so it renders above any native
|
|
72
|
+
* modal `<dialog>` opened earlier (a `position: fixed; z-index` stack can't). Re-showing
|
|
73
|
+
* puts it above layers added since the last toast. No-op without Popover API support.
|
|
74
|
+
*/
|
|
75
|
+
private _promote;
|
|
70
76
|
/**
|
|
71
77
|
* Removes a toast immediately, cancelling its pending auto-dismiss timer if any.
|
|
72
78
|
* @param id The id returned by `show()`.
|
|
73
79
|
*/
|
|
74
80
|
dismiss(id: number): void;
|
|
81
|
+
connectedCallback(): void;
|
|
75
82
|
disconnectedCallback(): void;
|
|
76
83
|
/** Schedules (or reschedules) the real auto-dismiss timeout for a toast. */
|
|
77
84
|
private _scheduleTimer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast-notification.d.ts","sourceRoot":"","sources":["../src/toast-notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,OAAO,EAAE,MAAM,KAAK,CAAC;AAWrD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAEpE,UAAU,YAAY;IACpB,uEAAuE;IACvE,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAsBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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cAAc;IAOtB,iEAAiE;IACjE,OAAO,CAAC,MAAM;IAiBd,0EAA0E;IAC1E,OAAO,CAAC,OAAO;IAYf,wGAAwG;IACxG,OAAO,CAAC,YAAY;IAUpB,wEAAwE;IACxE,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,UAAU;IAKlB,sGAAsG;IACtG,OAAO,CAAC,WAAW;IASnB,4EAA4E;IAC5E,OAAO,CAAC,YAAY;IAKpB;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAaX,MAAM,0DAuCd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,iBAAiB,CAAC;KACzC;CACF;AAMD,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,QAEhE;AAED,6BAA6B;AAC7B,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,QAElE;AAED,2BAA2B;AAC3B,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,QAE/D;AAED,6BAA6B;AAC7B,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,QAElE"}
|
|
@@ -76,6 +76,20 @@ let ToastNotification = class ToastNotification extends LitElement {
|
|
|
76
76
|
gap: 0.5rem;
|
|
77
77
|
width: 22.5rem;
|
|
78
78
|
pointer-events: none;
|
|
79
|
+
/* Reset the UA [popover] box (the host is a manual popover, see _promote()). */
|
|
80
|
+
inset: auto;
|
|
81
|
+
inset-block-start: 1rem;
|
|
82
|
+
inset-inline-end: 1rem;
|
|
83
|
+
margin: 0;
|
|
84
|
+
padding: 0;
|
|
85
|
+
border: 0;
|
|
86
|
+
overflow: visible;
|
|
87
|
+
background: transparent;
|
|
88
|
+
color: inherit;
|
|
89
|
+
}
|
|
90
|
+
/* An author display value would otherwise defeat the UA's display:none for a closed popover. */
|
|
91
|
+
:host([popover]:not(:popover-open)) {
|
|
92
|
+
display: none;
|
|
79
93
|
}
|
|
80
94
|
.toast {
|
|
81
95
|
pointer-events: auto;
|
|
@@ -289,8 +303,21 @@ let ToastNotification = class ToastNotification extends LitElement {
|
|
|
289
303
|
if (duration > 0)
|
|
290
304
|
this._scheduleTimer(id, duration);
|
|
291
305
|
this._syncTicking();
|
|
306
|
+
this._promote();
|
|
292
307
|
return id;
|
|
293
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* Moves the stack to the top of the browser's top layer, so it renders above any native
|
|
311
|
+
* modal `<dialog>` opened earlier (a `position: fixed; z-index` stack can't). Re-showing
|
|
312
|
+
* puts it above layers added since the last toast. No-op without Popover API support.
|
|
313
|
+
*/
|
|
314
|
+
_promote() {
|
|
315
|
+
if (!this.isConnected || !this.popover)
|
|
316
|
+
return;
|
|
317
|
+
if (this.matches(":popover-open"))
|
|
318
|
+
this.hidePopover();
|
|
319
|
+
this.showPopover();
|
|
320
|
+
}
|
|
294
321
|
/**
|
|
295
322
|
* Removes a toast immediately, cancelling its pending auto-dismiss timer if any.
|
|
296
323
|
* @param id The id returned by `show()`.
|
|
@@ -304,6 +331,13 @@ let ToastNotification = class ToastNotification extends LitElement {
|
|
|
304
331
|
this._interaction.delete(id);
|
|
305
332
|
this._toasts = this._toasts.filter((t) => t.id !== id);
|
|
306
333
|
this._syncTicking();
|
|
334
|
+
if (this._toasts.length === 0 && this.matches(":popover-open"))
|
|
335
|
+
this.hidePopover();
|
|
336
|
+
}
|
|
337
|
+
connectedCallback() {
|
|
338
|
+
super.connectedCallback();
|
|
339
|
+
if ("popover" in HTMLElement.prototype)
|
|
340
|
+
this.popover = "manual";
|
|
307
341
|
}
|
|
308
342
|
disconnectedCallback() {
|
|
309
343
|
super.disconnectedCallback();
|