@xmesh/system-design 0.0.1
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 +472 -0
- package/assets/brand-lockup-dark.svg +9 -0
- package/assets/brand-lockup-light.svg +9 -0
- package/assets/brand-mark.svg +9 -0
- package/colors_and_type.css +11 -0
- package/dist/lit/components/alert/index.css +201 -0
- package/dist/lit/components/alert/index.d.ts +25 -0
- package/dist/lit/components/alert/index.js +191 -0
- package/dist/lit/components/app-bar/index.css +80 -0
- package/dist/lit/components/app-bar/index.d.ts +19 -0
- package/dist/lit/components/app-bar/index.js +120 -0
- package/dist/lit/components/artifact/index.css +166 -0
- package/dist/lit/components/artifact/index.d.ts +37 -0
- package/dist/lit/components/artifact/index.js +294 -0
- package/dist/lit/components/autocomplete/index.css +171 -0
- package/dist/lit/components/autocomplete/index.d.ts +47 -0
- package/dist/lit/components/autocomplete/index.js +404 -0
- package/dist/lit/components/avatar/index.css +62 -0
- package/dist/lit/components/avatar/index.d.ts +19 -0
- package/dist/lit/components/avatar/index.js +112 -0
- package/dist/lit/components/avatar-group/index.css +60 -0
- package/dist/lit/components/avatar-group/index.d.ts +19 -0
- package/dist/lit/components/avatar-group/index.js +97 -0
- package/dist/lit/components/badge/index.css +72 -0
- package/dist/lit/components/badge/index.d.ts +18 -0
- package/dist/lit/components/badge/index.js +115 -0
- package/dist/lit/components/brand-mark/index.css +109 -0
- package/dist/lit/components/brand-mark/index.d.ts +24 -0
- package/dist/lit/components/brand-mark/index.js +116 -0
- package/dist/lit/components/breadcrumbs/index.css +91 -0
- package/dist/lit/components/breadcrumbs/index.d.ts +19 -0
- package/dist/lit/components/breadcrumbs/index.js +104 -0
- package/dist/lit/components/bubble/index.css +182 -0
- package/dist/lit/components/bubble/index.d.ts +72 -0
- package/dist/lit/components/bubble/index.js +617 -0
- package/dist/lit/components/button/index.css +342 -0
- package/dist/lit/components/button/index.d.ts +32 -0
- package/dist/lit/components/button/index.js +202 -0
- package/dist/lit/components/card/index.css +99 -0
- package/dist/lit/components/card/index.d.ts +20 -0
- package/dist/lit/components/card/index.js +133 -0
- package/dist/lit/components/chat/index.css +292 -0
- package/dist/lit/components/chat/index.d.ts +74 -0
- package/dist/lit/components/chat/index.js +589 -0
- package/dist/lit/components/checkbox/index.css +126 -0
- package/dist/lit/components/checkbox/index.d.ts +21 -0
- package/dist/lit/components/checkbox/index.js +138 -0
- package/dist/lit/components/chip/index.css +145 -0
- package/dist/lit/components/chip/index.d.ts +30 -0
- package/dist/lit/components/chip/index.js +230 -0
- package/dist/lit/components/chip-group/index.css +19 -0
- package/dist/lit/components/chip-group/index.d.ts +24 -0
- package/dist/lit/components/chip-group/index.js +171 -0
- package/dist/lit/components/code/index.css +42 -0
- package/dist/lit/components/code/index.d.ts +12 -0
- package/dist/lit/components/code/index.js +68 -0
- package/dist/lit/components/composer/index.css +548 -0
- package/dist/lit/components/composer/index.d.ts +67 -0
- package/dist/lit/components/composer/index.js +713 -0
- package/dist/lit/components/data-table/index.css +166 -0
- package/dist/lit/components/data-table/index.d.ts +55 -0
- package/dist/lit/components/data-table/index.js +390 -0
- package/dist/lit/components/dialog/index.css +124 -0
- package/dist/lit/components/dialog/index.d.ts +24 -0
- package/dist/lit/components/dialog/index.js +199 -0
- package/dist/lit/components/divider/index.css +27 -0
- package/dist/lit/components/divider/index.d.ts +13 -0
- package/dist/lit/components/divider/index.js +67 -0
- package/dist/lit/components/empty-state/index.css +69 -0
- package/dist/lit/components/empty-state/index.d.ts +21 -0
- package/dist/lit/components/empty-state/index.js +123 -0
- package/dist/lit/components/expansion-panel/index.css +120 -0
- package/dist/lit/components/expansion-panel/index.d.ts +22 -0
- package/dist/lit/components/expansion-panel/index.js +174 -0
- package/dist/lit/components/field/index.css +223 -0
- package/dist/lit/components/field/index.d.ts +106 -0
- package/dist/lit/components/field/index.js +388 -0
- package/dist/lit/components/file-input/index.css +257 -0
- package/dist/lit/components/file-input/index.d.ts +30 -0
- package/dist/lit/components/file-input/index.js +298 -0
- package/dist/lit/components/form/index.css +29 -0
- package/dist/lit/components/form/index.d.ts +38 -0
- package/dist/lit/components/form/index.js +192 -0
- package/dist/lit/components/grid/index.css +53 -0
- package/dist/lit/components/grid/index.d.ts +14 -0
- package/dist/lit/components/grid/index.js +82 -0
- package/dist/lit/components/kbd/index.css +35 -0
- package/dist/lit/components/kbd/index.d.ts +11 -0
- package/dist/lit/components/kbd/index.js +43 -0
- package/dist/lit/components/list/index.css +15 -0
- package/dist/lit/components/list/index.d.ts +28 -0
- package/dist/lit/components/list/index.js +188 -0
- package/dist/lit/components/list-item/index.css +119 -0
- package/dist/lit/components/list-item/index.d.ts +20 -0
- package/dist/lit/components/list-item/index.js +127 -0
- package/dist/lit/components/menu/index.css +94 -0
- package/dist/lit/components/menu/index.d.ts +47 -0
- package/dist/lit/components/menu/index.js +386 -0
- package/dist/lit/components/navigation-drawer/index.css +114 -0
- package/dist/lit/components/navigation-drawer/index.d.ts +29 -0
- package/dist/lit/components/navigation-drawer/index.js +218 -0
- package/dist/lit/components/overlay/index.css +171 -0
- package/dist/lit/components/overlay/index.d.ts +65 -0
- package/dist/lit/components/overlay/index.js +566 -0
- package/dist/lit/components/pagination/index.css +102 -0
- package/dist/lit/components/pagination/index.d.ts +22 -0
- package/dist/lit/components/pagination/index.js +184 -0
- package/dist/lit/components/primitives/index.css +504 -0
- package/dist/lit/components/primitives/index.d.ts +25 -0
- package/dist/lit/components/primitives/index.js +283 -0
- package/dist/lit/components/progress/index.css +143 -0
- package/dist/lit/components/progress/index.d.ts +23 -0
- package/dist/lit/components/progress/index.js +180 -0
- package/dist/lit/components/radio-group/index.css +178 -0
- package/dist/lit/components/radio-group/index.d.ts +35 -0
- package/dist/lit/components/radio-group/index.js +292 -0
- package/dist/lit/components/select/index.css +151 -0
- package/dist/lit/components/select/index.d.ts +50 -0
- package/dist/lit/components/select/index.js +390 -0
- package/dist/lit/components/sidebar-item/index.css +133 -0
- package/dist/lit/components/sidebar-item/index.d.ts +20 -0
- package/dist/lit/components/sidebar-item/index.js +105 -0
- package/dist/lit/components/skeleton/index.css +81 -0
- package/dist/lit/components/skeleton/index.d.ts +19 -0
- package/dist/lit/components/skeleton/index.js +119 -0
- package/dist/lit/components/slider/index.css +171 -0
- package/dist/lit/components/slider/index.d.ts +36 -0
- package/dist/lit/components/slider/index.js +302 -0
- package/dist/lit/components/snackbar/index.css +279 -0
- package/dist/lit/components/snackbar/index.d.ts +33 -0
- package/dist/lit/components/snackbar/index.js +195 -0
- package/dist/lit/components/stack/index.css +41 -0
- package/dist/lit/components/stack/index.d.ts +20 -0
- package/dist/lit/components/stack/index.js +103 -0
- package/dist/lit/components/switch/index.css +126 -0
- package/dist/lit/components/switch/index.d.ts +17 -0
- package/dist/lit/components/switch/index.js +116 -0
- package/dist/lit/components/table/index.css +85 -0
- package/dist/lit/components/table/index.d.ts +25 -0
- package/dist/lit/components/table/index.js +139 -0
- package/dist/lit/components/tabs/index.css +116 -0
- package/dist/lit/components/tabs/index.d.ts +49 -0
- package/dist/lit/components/tabs/index.js +320 -0
- package/dist/lit/components/text-field/index.css +90 -0
- package/dist/lit/components/text-field/index.d.ts +17 -0
- package/dist/lit/components/text-field/index.js +101 -0
- package/dist/lit/components/textarea/index.css +55 -0
- package/dist/lit/components/textarea/index.d.ts +26 -0
- package/dist/lit/components/textarea/index.js +124 -0
- package/dist/lit/components/tooltip/index.css +37 -0
- package/dist/lit/components/tooltip/index.d.ts +31 -0
- package/dist/lit/components/tooltip/index.js +196 -0
- package/dist/lit/components/validation/index.css +386 -0
- package/dist/lit/components/validation/index.d.ts +45 -0
- package/dist/lit/components/validation/index.js +318 -0
- package/dist/lit/index.d.ts +50 -0
- package/dist/lit/index.js +59 -0
- package/package.json +81 -0
- package/styles/README.md +346 -0
- package/styles/_elevation.css +24 -0
- package/styles/_fonts.css +6 -0
- package/styles/_layout.css +37 -0
- package/styles/_primitives.css +154 -0
- package/styles/_scroll.css +75 -0
- package/styles/_semantic.css +146 -0
- package/styles/_space.css +61 -0
- package/styles/_type.css +139 -0
- package/styles/_xmesh-extensions.css +232 -0
- package/styles/index.css +44 -0
- package/styles/md3/_color.css +102 -0
- package/styles/md3/_elevation.css +26 -0
- package/styles/md3/_motion.css +35 -0
- package/styles/md3/_shape.css +22 -0
- package/styles/md3/_state.css +22 -0
- package/styles/md3/_type.css +111 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import type { TemplateResult } from "lit";
|
|
3
|
+
type PaginationSize = "xs" | "sm" | "md" | "lg";
|
|
4
|
+
export interface PaginationPageChangeDetail {
|
|
5
|
+
page: number;
|
|
6
|
+
}
|
|
7
|
+
declare class XmPagination extends LitElement {
|
|
8
|
+
page: number;
|
|
9
|
+
total: number;
|
|
10
|
+
siblings: number;
|
|
11
|
+
size: PaginationSize;
|
|
12
|
+
render(): TemplateResult;
|
|
13
|
+
private _clamp;
|
|
14
|
+
private _goto;
|
|
15
|
+
private _pageWindow;
|
|
16
|
+
}
|
|
17
|
+
declare global {
|
|
18
|
+
interface HTMLElementTagNameMap {
|
|
19
|
+
"xm-pagination": XmPagination;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/*
|
|
2
|
+
pagination/index.ts — <xm-pagination>, numbered page controls.
|
|
3
|
+
|
|
4
|
+
<xm-pagination> — prev / numbered pages (with ellipsis truncation) / next.
|
|
5
|
+
The current page is the coral page indicator. Edge controls disable on the
|
|
6
|
+
first / last page with the shared reduced-emphasis treatment.
|
|
7
|
+
|
|
8
|
+
Authoring:
|
|
9
|
+
<xm-pagination page="5" total="20"></xm-pagination>
|
|
10
|
+
el.addEventListener("xm-pagination-page-change", (e) => e.detail.page);
|
|
11
|
+
|
|
12
|
+
Properties:
|
|
13
|
+
page Number — current page (1-based; uncontrolled-first initial)
|
|
14
|
+
total Number — total page count
|
|
15
|
+
siblings Number — page buttons on each side of current (default 1)
|
|
16
|
+
size "xs" | "sm" | "md" | "lg" (default "md")
|
|
17
|
+
|
|
18
|
+
Events (both carry detail.page: number; bubbles + composed):
|
|
19
|
+
xm-pagination-page-change canonical paging event (AGENTS.md contract)
|
|
20
|
+
change native-tier mirror (AD-8a); identical payload
|
|
21
|
+
|
|
22
|
+
Surface / ink (AD-13): a transparent control row tracing its host surface.
|
|
23
|
+
The current page is a coral chip (on-primary ink, matched to the coral fill);
|
|
24
|
+
idle pages take on-surface-variant ink. Hairline 1px borders only.
|
|
25
|
+
|
|
26
|
+
Shadow DOM; Lit from lit; sibling + primitives CSS via
|
|
27
|
+
the built-file-relative new URL(...). Prev/next chevrons are shared
|
|
28
|
+
primitives icons. BEM block `pagination`.
|
|
29
|
+
*/
|
|
30
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
31
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
32
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
33
|
+
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;
|
|
34
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35
|
+
};
|
|
36
|
+
import { LitElement, html, nothing } from "lit";
|
|
37
|
+
import { customElement, property } from "lit/decorators.js";
|
|
38
|
+
// Resolve CSS relative to the *built* file:
|
|
39
|
+
// lit/build/components/pagination/index.js → ../...
|
|
40
|
+
const PAGINATION_CSS = new URL("../pagination/index.css", import.meta.url).href;
|
|
41
|
+
const PRIMITIVES_CSS = new URL("../primitives/index.css", import.meta.url).href;
|
|
42
|
+
let XmPagination = class XmPagination extends LitElement {
|
|
43
|
+
constructor() {
|
|
44
|
+
super(...arguments);
|
|
45
|
+
this.page = 1;
|
|
46
|
+
this.total = 1;
|
|
47
|
+
this.siblings = 1;
|
|
48
|
+
this.size = "md";
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
const total = Math.max(1, Math.floor(this.total));
|
|
52
|
+
const page = this._clamp(this.page, total);
|
|
53
|
+
const size = ["xs", "sm", "md", "lg"].includes(this.size)
|
|
54
|
+
? this.size
|
|
55
|
+
: "md";
|
|
56
|
+
const tokens = this._pageWindow(page, total);
|
|
57
|
+
const atFirst = page <= 1;
|
|
58
|
+
const atLast = page >= total;
|
|
59
|
+
return html `
|
|
60
|
+
<link rel="stylesheet" href="${PRIMITIVES_CSS}" />
|
|
61
|
+
<link rel="stylesheet" href="${PAGINATION_CSS}" />
|
|
62
|
+
<style>
|
|
63
|
+
:host {
|
|
64
|
+
display: inline-block;
|
|
65
|
+
}
|
|
66
|
+
:host([hidden]) {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
70
|
+
<nav class="pagination pagination--${size}" aria-label="Pagination">
|
|
71
|
+
<button
|
|
72
|
+
type="button"
|
|
73
|
+
class="pagination__item pagination__prev"
|
|
74
|
+
aria-label="Previous page"
|
|
75
|
+
?disabled=${atFirst}
|
|
76
|
+
@click=${() => this._goto(page - 1, total)}
|
|
77
|
+
>
|
|
78
|
+
<xm-chevron-left-icon size="16"></xm-chevron-left-icon>
|
|
79
|
+
</button>
|
|
80
|
+
|
|
81
|
+
${tokens.map((token) => token === "ellipsis"
|
|
82
|
+
? html `<span class="pagination__ellipsis" aria-hidden="true">…</span>`
|
|
83
|
+
: html `
|
|
84
|
+
<button
|
|
85
|
+
type="button"
|
|
86
|
+
class="pagination__item pagination__page ${token === page
|
|
87
|
+
? "pagination__page--current"
|
|
88
|
+
: ""}"
|
|
89
|
+
aria-label="Page ${token}"
|
|
90
|
+
aria-current=${token === page ? "page" : nothing}
|
|
91
|
+
@click=${() => this._goto(token, total)}
|
|
92
|
+
>
|
|
93
|
+
${token}
|
|
94
|
+
</button>
|
|
95
|
+
`)}
|
|
96
|
+
|
|
97
|
+
<button
|
|
98
|
+
type="button"
|
|
99
|
+
class="pagination__item pagination__next"
|
|
100
|
+
aria-label="Next page"
|
|
101
|
+
?disabled=${atLast}
|
|
102
|
+
@click=${() => this._goto(page + 1, total)}
|
|
103
|
+
>
|
|
104
|
+
<xm-chevron-right-icon size="16"></xm-chevron-right-icon>
|
|
105
|
+
</button>
|
|
106
|
+
</nav>
|
|
107
|
+
`;
|
|
108
|
+
}
|
|
109
|
+
_clamp(value, total) {
|
|
110
|
+
const n = Math.floor(value);
|
|
111
|
+
if (Number.isNaN(n) || n < 1)
|
|
112
|
+
return 1;
|
|
113
|
+
if (n > total)
|
|
114
|
+
return total;
|
|
115
|
+
return n;
|
|
116
|
+
}
|
|
117
|
+
_goto(target, total) {
|
|
118
|
+
const next = this._clamp(target, total);
|
|
119
|
+
if (next === this.page)
|
|
120
|
+
return;
|
|
121
|
+
this.page = next;
|
|
122
|
+
const detail = { page: next };
|
|
123
|
+
this.dispatchEvent(new CustomEvent("xm-pagination-page-change", {
|
|
124
|
+
detail,
|
|
125
|
+
bubbles: true,
|
|
126
|
+
composed: true,
|
|
127
|
+
}));
|
|
128
|
+
this.dispatchEvent(new CustomEvent("change", {
|
|
129
|
+
detail,
|
|
130
|
+
bubbles: true,
|
|
131
|
+
composed: true,
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
// Compute the visible page window with ellipsis truncation, e.g.
|
|
135
|
+
// 1 … 4 5 6 … 20. Always shows first + last; `siblings` pages flank current.
|
|
136
|
+
_pageWindow(page, total) {
|
|
137
|
+
const siblings = Math.max(0, Math.floor(this.siblings));
|
|
138
|
+
// First + last + current + 2*siblings + 2 ellipses ≈ the dense threshold.
|
|
139
|
+
const dense = siblings * 2 + 5;
|
|
140
|
+
if (total <= dense) {
|
|
141
|
+
return Array.from({ length: total }, (_, i) => i + 1);
|
|
142
|
+
}
|
|
143
|
+
const left = Math.max(page - siblings, 1);
|
|
144
|
+
const right = Math.min(page + siblings, total);
|
|
145
|
+
const showLeftEllipsis = left > 2;
|
|
146
|
+
const showRightEllipsis = right < total - 1;
|
|
147
|
+
const tokens = [1];
|
|
148
|
+
if (showLeftEllipsis) {
|
|
149
|
+
tokens.push("ellipsis");
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
for (let p = 2; p < left; p++)
|
|
153
|
+
tokens.push(p);
|
|
154
|
+
}
|
|
155
|
+
for (let p = left; p <= right; p++) {
|
|
156
|
+
if (p !== 1 && p !== total)
|
|
157
|
+
tokens.push(p);
|
|
158
|
+
}
|
|
159
|
+
if (showRightEllipsis) {
|
|
160
|
+
tokens.push("ellipsis");
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
for (let p = right + 1; p < total; p++)
|
|
164
|
+
tokens.push(p);
|
|
165
|
+
}
|
|
166
|
+
tokens.push(total);
|
|
167
|
+
return tokens;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
__decorate([
|
|
171
|
+
property({ type: Number })
|
|
172
|
+
], XmPagination.prototype, "page", void 0);
|
|
173
|
+
__decorate([
|
|
174
|
+
property({ type: Number })
|
|
175
|
+
], XmPagination.prototype, "total", void 0);
|
|
176
|
+
__decorate([
|
|
177
|
+
property({ type: Number })
|
|
178
|
+
], XmPagination.prototype, "siblings", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
property({ type: String })
|
|
181
|
+
], XmPagination.prototype, "size", void 0);
|
|
182
|
+
XmPagination = __decorate([
|
|
183
|
+
customElement("xm-pagination")
|
|
184
|
+
], XmPagination);
|