@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,318 @@
|
|
|
1
|
+
/*
|
|
2
|
+
validation/index.ts — Lit port of components/validation/index.jsx.
|
|
3
|
+
|
|
4
|
+
<xm-file-validation-block> — unified upload + validation surface.
|
|
5
|
+
Combines a drop/picker zone and a validation error in one bordered
|
|
6
|
+
block, separated by a hairline divider.
|
|
7
|
+
|
|
8
|
+
Properties:
|
|
9
|
+
state "idle" | "dragging" | "valid" | "invalid" | "error-no-file"
|
|
10
|
+
file { ext, name, summary } — JS object property
|
|
11
|
+
error { code, fileName, path, rule, message } — JS object property
|
|
12
|
+
hint string — drop-row secondary copy
|
|
13
|
+
fileCsv string — convenience attribute:
|
|
14
|
+
"ext,name,summary" hydrates `file` for static HTML
|
|
15
|
+
errorJson string — convenience: JSON-encoded error object
|
|
16
|
+
|
|
17
|
+
Events (all bubble, composed):
|
|
18
|
+
file-pick — picker click intent (host opens <input type=file>)
|
|
19
|
+
file-drop — detail: { file: File }
|
|
20
|
+
error-dismiss
|
|
21
|
+
copy-path — detail: { path }
|
|
22
|
+
|
|
23
|
+
Light DOM. components/validation/index.css must be loaded in the host page.
|
|
24
|
+
|
|
25
|
+
VALIDATION_PRESETS and VALIDATION_TITLE are also exported for reuse.
|
|
26
|
+
*/
|
|
27
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
28
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
29
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
30
|
+
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;
|
|
31
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
32
|
+
};
|
|
33
|
+
import { LitElement, html, svg, nothing } from "lit";
|
|
34
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
35
|
+
export const VALIDATION_TITLE = {
|
|
36
|
+
size: "File too large",
|
|
37
|
+
ext: "Wrong file type",
|
|
38
|
+
parse: "Couldn't parse file",
|
|
39
|
+
shape: "Unexpected structure",
|
|
40
|
+
empty: "Empty file",
|
|
41
|
+
read: "Read error",
|
|
42
|
+
};
|
|
43
|
+
export const VALIDATION_PRESETS = {
|
|
44
|
+
shape: {
|
|
45
|
+
code: "shape",
|
|
46
|
+
fileName: "domains.yml",
|
|
47
|
+
path: "/agents",
|
|
48
|
+
rule: "required",
|
|
49
|
+
message: 'Definitions file is missing required field "agents".',
|
|
50
|
+
file: { ext: "yml", name: "domains.yml", summary: "8.4 KB · 4 agents, 12 tools" },
|
|
51
|
+
},
|
|
52
|
+
parse: {
|
|
53
|
+
code: "parse",
|
|
54
|
+
fileName: "domains.yml",
|
|
55
|
+
path: "12:5",
|
|
56
|
+
rule: "yaml",
|
|
57
|
+
message: "Couldn't parse file. Unexpected token at line 12, column 5 — check indentation and quoting.",
|
|
58
|
+
},
|
|
59
|
+
size: {
|
|
60
|
+
code: "size",
|
|
61
|
+
fileName: "huge-export.json",
|
|
62
|
+
rule: "max-size",
|
|
63
|
+
message: "File is 412 KB. Maximum allowed size is 200 KB.",
|
|
64
|
+
file: { ext: "json", name: "huge-export.json", summary: "412 KB · over the 200 KB limit" },
|
|
65
|
+
},
|
|
66
|
+
ext: {
|
|
67
|
+
code: "ext",
|
|
68
|
+
fileName: "config.txt",
|
|
69
|
+
rule: "ext",
|
|
70
|
+
message: "Only .yml, .yaml, and .json files are accepted.",
|
|
71
|
+
file: { ext: "yml", name: "config.txt", summary: "1.2 KB · unsupported extension" },
|
|
72
|
+
},
|
|
73
|
+
empty: {
|
|
74
|
+
code: "empty",
|
|
75
|
+
fileName: "empty.json",
|
|
76
|
+
rule: "non-empty",
|
|
77
|
+
message: "File is empty. Upload a valid YAML or JSON definitions file.",
|
|
78
|
+
file: { ext: "json", name: "empty.json", summary: "0 B · no content" },
|
|
79
|
+
},
|
|
80
|
+
read: {
|
|
81
|
+
code: "read",
|
|
82
|
+
fileName: "domains.json",
|
|
83
|
+
rule: "io",
|
|
84
|
+
message: "Couldn't read the file from disk. Try selecting it again or check permissions.",
|
|
85
|
+
file: { ext: "json", name: "domains.json", summary: "permission denied" },
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
const SHELL = (size, strokeWidth, paths) => svg `
|
|
89
|
+
<svg width="${size}" height="${size}" viewBox="0 0 24 24" fill="none"
|
|
90
|
+
stroke="currentColor" stroke-width="${strokeWidth}"
|
|
91
|
+
stroke-linecap="round" stroke-linejoin="round" class="ds-icon">
|
|
92
|
+
${paths}
|
|
93
|
+
</svg>
|
|
94
|
+
`;
|
|
95
|
+
const I_ALERT = (s = 12) => SHELL(s, 1.8, svg `
|
|
96
|
+
<circle cx="12" cy="12" r="10" />
|
|
97
|
+
<path d="M12 8v5M12 16h.01" />
|
|
98
|
+
`);
|
|
99
|
+
const I_CLOSE = (s = 12) => SHELL(s, 2, svg `
|
|
100
|
+
<path d="M6 6l12 12M18 6L6 18" />
|
|
101
|
+
`);
|
|
102
|
+
const I_COPY = (s = 11) => SHELL(s, 2, svg `
|
|
103
|
+
<rect x="9" y="9" width="11" height="11" rx="2" />
|
|
104
|
+
<path d="M5 15V5a2 2 0 0 1 2-2h10" />
|
|
105
|
+
`);
|
|
106
|
+
const I_UPLOAD = (s = 14) => SHELL(s, 1.8, svg `
|
|
107
|
+
<path d="M12 16V4M6 10l6-6 6 6" />
|
|
108
|
+
<path d="M4 20h16" />
|
|
109
|
+
`);
|
|
110
|
+
const I_CHECK = (s = 10) => SHELL(s, 2.4, svg `
|
|
111
|
+
<path d="M5 12l4 4 10-10" />
|
|
112
|
+
`);
|
|
113
|
+
let XmFileValidationBlock = class XmFileValidationBlock extends LitElement {
|
|
114
|
+
constructor() {
|
|
115
|
+
super(...arguments);
|
|
116
|
+
this.state = "idle";
|
|
117
|
+
this.file = null;
|
|
118
|
+
this.error = null;
|
|
119
|
+
this.hint = "";
|
|
120
|
+
this.fileCsv = "";
|
|
121
|
+
this.errorJson = "";
|
|
122
|
+
this._copyState = "idle";
|
|
123
|
+
this._onCopyPath = async () => {
|
|
124
|
+
const path = this.error?.path;
|
|
125
|
+
if (!path)
|
|
126
|
+
return;
|
|
127
|
+
this._emit("copy-path", { path });
|
|
128
|
+
if (navigator.clipboard) {
|
|
129
|
+
try {
|
|
130
|
+
await navigator.clipboard.writeText(path);
|
|
131
|
+
this._copyState = "copied";
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
this._copyState = "failed";
|
|
135
|
+
}
|
|
136
|
+
setTimeout(() => { this._copyState = "idle"; }, 1500);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
this._onDismiss = () => this._emit("error-dismiss", {});
|
|
140
|
+
}
|
|
141
|
+
createRenderRoot() {
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
connectedCallback() {
|
|
145
|
+
super.connectedCallback();
|
|
146
|
+
// Make the host transparent to flex/grid layout — matches the React
|
|
147
|
+
// tree where <FileValidationBlock> renders the <div class="ds-fvb">
|
|
148
|
+
// directly with no wrapper between it and the parent.
|
|
149
|
+
if (!this.style.display)
|
|
150
|
+
this.style.display = "contents";
|
|
151
|
+
if (this.fileCsv && !this.file) {
|
|
152
|
+
const parts = this.fileCsv.split(",").map((s) => s.trim());
|
|
153
|
+
const ext = parts[0] ?? "";
|
|
154
|
+
const name = parts[1] ?? "";
|
|
155
|
+
const summary = parts[2] ?? "";
|
|
156
|
+
this.file = { ext, name, summary };
|
|
157
|
+
}
|
|
158
|
+
if (this.errorJson && !this.error) {
|
|
159
|
+
try {
|
|
160
|
+
this.error = JSON.parse(this.errorJson);
|
|
161
|
+
}
|
|
162
|
+
catch (_) { /* malformed — leave error null */ }
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
_emit(name, detail) {
|
|
166
|
+
this.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true }));
|
|
167
|
+
}
|
|
168
|
+
_renderDropRow() {
|
|
169
|
+
const handleClick = () => this._emit("file-pick", {});
|
|
170
|
+
const handleDragOver = (e) => {
|
|
171
|
+
e.preventDefault();
|
|
172
|
+
const target = e.currentTarget;
|
|
173
|
+
target.dataset["dragging"] = "1";
|
|
174
|
+
};
|
|
175
|
+
const handleDragLeave = (e) => {
|
|
176
|
+
const target = e.currentTarget;
|
|
177
|
+
delete target.dataset["dragging"];
|
|
178
|
+
};
|
|
179
|
+
const handleDrop = (e) => {
|
|
180
|
+
e.preventDefault();
|
|
181
|
+
const target = e.currentTarget;
|
|
182
|
+
delete target.dataset["dragging"];
|
|
183
|
+
const file = e.dataTransfer?.files?.[0];
|
|
184
|
+
if (file)
|
|
185
|
+
this._emit("file-drop", { file });
|
|
186
|
+
};
|
|
187
|
+
return html `
|
|
188
|
+
<div
|
|
189
|
+
class="ds-fvb__drop"
|
|
190
|
+
role="button"
|
|
191
|
+
tabindex="0"
|
|
192
|
+
@click=${handleClick}
|
|
193
|
+
@dragover=${handleDragOver}
|
|
194
|
+
@dragleave=${handleDragLeave}
|
|
195
|
+
@drop=${handleDrop}
|
|
196
|
+
>
|
|
197
|
+
${I_UPLOAD()}
|
|
198
|
+
<div class="ds-fvb__drop-primary">
|
|
199
|
+
${this.state === "dragging" ? "Drop to upload" : "Choose file or drop here"}
|
|
200
|
+
</div>
|
|
201
|
+
<div class="ds-fvb__drop-secondary">
|
|
202
|
+
${this.hint || "YAML or JSON · up to 200 KB"}
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
`;
|
|
206
|
+
}
|
|
207
|
+
_renderFileRow(invalid) {
|
|
208
|
+
const file = this.file;
|
|
209
|
+
if (!file)
|
|
210
|
+
return nothing;
|
|
211
|
+
const ext = (file.ext || "yml").toLowerCase();
|
|
212
|
+
const extLabel = ext.toUpperCase();
|
|
213
|
+
return html `
|
|
214
|
+
<div class="ds-fvb__file">
|
|
215
|
+
<div class="ds-fvb__file-row">
|
|
216
|
+
<div class="ds-fvb__file-name">
|
|
217
|
+
<span class="ds-ext-badge ds-ext-${ext}">${extLabel}</span>
|
|
218
|
+
<span class="ds-fvb__file-name-label">${file.name}</span>
|
|
219
|
+
${invalid
|
|
220
|
+
? html `<span class="ds-invalid-mark" aria-label="Invalid">${I_ALERT()}</span>`
|
|
221
|
+
: html `<span class="ds-valid-tick" aria-label="Valid">${I_CHECK()}</span>`}
|
|
222
|
+
</div>
|
|
223
|
+
<div class="ds-fvb__file-actions"><slot name="actions"></slot></div>
|
|
224
|
+
</div>
|
|
225
|
+
${file.summary
|
|
226
|
+
? html `<div class="ds-fvb__file-sub">${file.summary}</div>`
|
|
227
|
+
: nothing}
|
|
228
|
+
</div>
|
|
229
|
+
`;
|
|
230
|
+
}
|
|
231
|
+
_renderErrorRow(showMeta) {
|
|
232
|
+
const error = this.error;
|
|
233
|
+
if (!error)
|
|
234
|
+
return nothing;
|
|
235
|
+
const code = error.code ?? "shape";
|
|
236
|
+
const { fileName, path, rule, message } = error;
|
|
237
|
+
const title = VALIDATION_TITLE[code] || "Validation error";
|
|
238
|
+
const copyLabel = this._copyState === "copied"
|
|
239
|
+
? "Copied"
|
|
240
|
+
: this._copyState === "failed"
|
|
241
|
+
? "Copy failed"
|
|
242
|
+
: "Copy path";
|
|
243
|
+
return html `
|
|
244
|
+
<div class="ds-fvb__error" role="alert">
|
|
245
|
+
<span class="ds-fvb__error-icon" aria-hidden="true">${I_ALERT()}</span>
|
|
246
|
+
<div class="ds-fvb__error-title" title="${message}">${title}</div>
|
|
247
|
+
<button
|
|
248
|
+
type="button"
|
|
249
|
+
class="ds-fvb__error-dismiss"
|
|
250
|
+
aria-label="Dismiss error"
|
|
251
|
+
title="Dismiss error"
|
|
252
|
+
@click=${this._onDismiss}
|
|
253
|
+
>${I_CLOSE(10)}</button>
|
|
254
|
+
|
|
255
|
+
<p class="ds-fvb__error-message" title="${message}">${message}</p>
|
|
256
|
+
|
|
257
|
+
${showMeta && (fileName || path || rule)
|
|
258
|
+
? html `
|
|
259
|
+
<div class="ds-fvb__meta">
|
|
260
|
+
${fileName
|
|
261
|
+
? html `<span class="ds-mono ds-fvb__filename" title="${fileName}">${fileName}</span>`
|
|
262
|
+
: nothing}
|
|
263
|
+
${path ? html `<span class="ds-mono ds-fvb__path">${path}</span>` : nothing}
|
|
264
|
+
${rule ? html `<span class="ds-fvb__rule">${rule}</span>` : nothing}
|
|
265
|
+
${path
|
|
266
|
+
? html `<button
|
|
267
|
+
type="button"
|
|
268
|
+
class="ds-fvb__copy"
|
|
269
|
+
@click=${this._onCopyPath}
|
|
270
|
+
title="Copy JSON pointer to clipboard"
|
|
271
|
+
>${I_COPY()}<span>${copyLabel}</span></button>`
|
|
272
|
+
: nothing}
|
|
273
|
+
</div>
|
|
274
|
+
`
|
|
275
|
+
: nothing}
|
|
276
|
+
</div>
|
|
277
|
+
`;
|
|
278
|
+
}
|
|
279
|
+
render() {
|
|
280
|
+
const state = this.state;
|
|
281
|
+
const showFile = (state === "valid" || state === "invalid") && this.file;
|
|
282
|
+
const showDrop = state === "idle" || state === "dragging" || state === "error-no-file";
|
|
283
|
+
const showError = (state === "invalid" || state === "error-no-file") && this.error;
|
|
284
|
+
const showDivider = (showFile || showDrop) && showError;
|
|
285
|
+
return html `
|
|
286
|
+
<div class="ds-fvb ds-fvb--${state}">
|
|
287
|
+
${showFile ? this._renderFileRow(state === "invalid") : nothing}
|
|
288
|
+
${showDrop ? this._renderDropRow() : nothing}
|
|
289
|
+
${showDivider ? html `<div class="ds-fvb__divider" aria-hidden="true"></div>` : nothing}
|
|
290
|
+
${showError ? this._renderErrorRow(state === "error-no-file") : nothing}
|
|
291
|
+
</div>
|
|
292
|
+
`;
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
__decorate([
|
|
296
|
+
property({ type: String })
|
|
297
|
+
], XmFileValidationBlock.prototype, "state", void 0);
|
|
298
|
+
__decorate([
|
|
299
|
+
property({ attribute: false })
|
|
300
|
+
], XmFileValidationBlock.prototype, "file", void 0);
|
|
301
|
+
__decorate([
|
|
302
|
+
property({ attribute: false })
|
|
303
|
+
], XmFileValidationBlock.prototype, "error", void 0);
|
|
304
|
+
__decorate([
|
|
305
|
+
property({ type: String })
|
|
306
|
+
], XmFileValidationBlock.prototype, "hint", void 0);
|
|
307
|
+
__decorate([
|
|
308
|
+
property({ type: String, attribute: "file-csv" })
|
|
309
|
+
], XmFileValidationBlock.prototype, "fileCsv", void 0);
|
|
310
|
+
__decorate([
|
|
311
|
+
property({ type: String, attribute: "error-json" })
|
|
312
|
+
], XmFileValidationBlock.prototype, "errorJson", void 0);
|
|
313
|
+
__decorate([
|
|
314
|
+
state()
|
|
315
|
+
], XmFileValidationBlock.prototype, "_copyState", void 0);
|
|
316
|
+
XmFileValidationBlock = __decorate([
|
|
317
|
+
customElement("xm-file-validation-block")
|
|
318
|
+
], XmFileValidationBlock);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import "./components/primitives/index.js";
|
|
2
|
+
export * from "./components/alert/index.js";
|
|
3
|
+
export * from "./components/app-bar/index.js";
|
|
4
|
+
export * from "./components/artifact/index.js";
|
|
5
|
+
export * from "./components/autocomplete/index.js";
|
|
6
|
+
export * from "./components/avatar/index.js";
|
|
7
|
+
export * from "./components/avatar-group/index.js";
|
|
8
|
+
export * from "./components/badge/index.js";
|
|
9
|
+
export * from "./components/brand-mark/index.js";
|
|
10
|
+
export * from "./components/breadcrumbs/index.js";
|
|
11
|
+
export * from "./components/bubble/index.js";
|
|
12
|
+
export * from "./components/button/index.js";
|
|
13
|
+
export * from "./components/card/index.js";
|
|
14
|
+
export * from "./components/chat/index.js";
|
|
15
|
+
export * from "./components/checkbox/index.js";
|
|
16
|
+
export * from "./components/chip/index.js";
|
|
17
|
+
export * from "./components/chip-group/index.js";
|
|
18
|
+
export * from "./components/code/index.js";
|
|
19
|
+
export * from "./components/composer/index.js";
|
|
20
|
+
export * from "./components/data-table/index.js";
|
|
21
|
+
export * from "./components/dialog/index.js";
|
|
22
|
+
export * from "./components/divider/index.js";
|
|
23
|
+
export * from "./components/empty-state/index.js";
|
|
24
|
+
export * from "./components/expansion-panel/index.js";
|
|
25
|
+
export * from "./components/field/index.js";
|
|
26
|
+
export * from "./components/file-input/index.js";
|
|
27
|
+
export * from "./components/form/index.js";
|
|
28
|
+
export * from "./components/grid/index.js";
|
|
29
|
+
export * from "./components/kbd/index.js";
|
|
30
|
+
export * from "./components/list/index.js";
|
|
31
|
+
export * from "./components/list-item/index.js";
|
|
32
|
+
export * from "./components/menu/index.js";
|
|
33
|
+
export * from "./components/navigation-drawer/index.js";
|
|
34
|
+
export * from "./components/overlay/index.js";
|
|
35
|
+
export * from "./components/pagination/index.js";
|
|
36
|
+
export * from "./components/progress/index.js";
|
|
37
|
+
export * from "./components/radio-group/index.js";
|
|
38
|
+
export * from "./components/select/index.js";
|
|
39
|
+
export * from "./components/sidebar-item/index.js";
|
|
40
|
+
export * from "./components/skeleton/index.js";
|
|
41
|
+
export * from "./components/slider/index.js";
|
|
42
|
+
export * from "./components/snackbar/index.js";
|
|
43
|
+
export * from "./components/stack/index.js";
|
|
44
|
+
export * from "./components/switch/index.js";
|
|
45
|
+
export * from "./components/table/index.js";
|
|
46
|
+
export * from "./components/tabs/index.js";
|
|
47
|
+
export * from "./components/text-field/index.js";
|
|
48
|
+
export * from "./components/textarea/index.js";
|
|
49
|
+
export * from "./components/tooltip/index.js";
|
|
50
|
+
export * from "./components/validation/index.js";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// lit/index.ts — barrel entry for the Lit component bundle.
|
|
2
|
+
//
|
|
3
|
+
// Importing this module registers every <xm-*> custom element (a side
|
|
4
|
+
// effect of each component module) and re-exports each component's public
|
|
5
|
+
// values and types. Consumers also need the token stylesheet once on :root:
|
|
6
|
+
// import "@xmesh/system-design/styles";
|
|
7
|
+
//
|
|
8
|
+
// Generated by scripts/gen-barrel.mjs — do not edit by hand.
|
|
9
|
+
// primitives first: shared <xm-icon>/<xm-spinner> + named icon elements.
|
|
10
|
+
import "./components/primitives/index.js";
|
|
11
|
+
export * from "./components/alert/index.js";
|
|
12
|
+
export * from "./components/app-bar/index.js";
|
|
13
|
+
export * from "./components/artifact/index.js";
|
|
14
|
+
export * from "./components/autocomplete/index.js";
|
|
15
|
+
export * from "./components/avatar/index.js";
|
|
16
|
+
export * from "./components/avatar-group/index.js";
|
|
17
|
+
export * from "./components/badge/index.js";
|
|
18
|
+
export * from "./components/brand-mark/index.js";
|
|
19
|
+
export * from "./components/breadcrumbs/index.js";
|
|
20
|
+
export * from "./components/bubble/index.js";
|
|
21
|
+
export * from "./components/button/index.js";
|
|
22
|
+
export * from "./components/card/index.js";
|
|
23
|
+
export * from "./components/chat/index.js";
|
|
24
|
+
export * from "./components/checkbox/index.js";
|
|
25
|
+
export * from "./components/chip/index.js";
|
|
26
|
+
export * from "./components/chip-group/index.js";
|
|
27
|
+
export * from "./components/code/index.js";
|
|
28
|
+
export * from "./components/composer/index.js";
|
|
29
|
+
export * from "./components/data-table/index.js";
|
|
30
|
+
export * from "./components/dialog/index.js";
|
|
31
|
+
export * from "./components/divider/index.js";
|
|
32
|
+
export * from "./components/empty-state/index.js";
|
|
33
|
+
export * from "./components/expansion-panel/index.js";
|
|
34
|
+
export * from "./components/field/index.js";
|
|
35
|
+
export * from "./components/file-input/index.js";
|
|
36
|
+
export * from "./components/form/index.js";
|
|
37
|
+
export * from "./components/grid/index.js";
|
|
38
|
+
export * from "./components/kbd/index.js";
|
|
39
|
+
export * from "./components/list/index.js";
|
|
40
|
+
export * from "./components/list-item/index.js";
|
|
41
|
+
export * from "./components/menu/index.js";
|
|
42
|
+
export * from "./components/navigation-drawer/index.js";
|
|
43
|
+
export * from "./components/overlay/index.js";
|
|
44
|
+
export * from "./components/pagination/index.js";
|
|
45
|
+
export * from "./components/progress/index.js";
|
|
46
|
+
export * from "./components/radio-group/index.js";
|
|
47
|
+
export * from "./components/select/index.js";
|
|
48
|
+
export * from "./components/sidebar-item/index.js";
|
|
49
|
+
export * from "./components/skeleton/index.js";
|
|
50
|
+
export * from "./components/slider/index.js";
|
|
51
|
+
export * from "./components/snackbar/index.js";
|
|
52
|
+
export * from "./components/stack/index.js";
|
|
53
|
+
export * from "./components/switch/index.js";
|
|
54
|
+
export * from "./components/table/index.js";
|
|
55
|
+
export * from "./components/tabs/index.js";
|
|
56
|
+
export * from "./components/text-field/index.js";
|
|
57
|
+
export * from "./components/textarea/index.js";
|
|
58
|
+
export * from "./components/tooltip/index.js";
|
|
59
|
+
export * from "./components/validation/index.js";
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xmesh/system-design",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"description": "Design-system reference and Lit component library for the xmesh chat product.",
|
|
10
|
+
"exports": {
|
|
11
|
+
"./lit": {
|
|
12
|
+
"types": "./dist/lit/index.d.ts",
|
|
13
|
+
"import": "./dist/lit/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./lit/*": {
|
|
16
|
+
"types": "./dist/lit/components/*/index.d.ts",
|
|
17
|
+
"import": "./dist/lit/components/*/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./styles": "./styles/index.css",
|
|
20
|
+
"./styles/*": "./styles/*",
|
|
21
|
+
"./assets/*": "./assets/*"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"styles",
|
|
26
|
+
"assets",
|
|
27
|
+
"colors_and_type.css"
|
|
28
|
+
],
|
|
29
|
+
"sideEffects": [
|
|
30
|
+
"**/*.css",
|
|
31
|
+
"./dist/lit/**",
|
|
32
|
+
"./styles/**"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"serve": "npm-run-all --parallel watch:lit serve:static",
|
|
36
|
+
"serve:static": "npx --yes http-server . -p 8080 -c-1 -o /lit/preview/",
|
|
37
|
+
"build:lit": "tsc -p lit/tsconfig.json",
|
|
38
|
+
"watch:lit": "tsc -p lit/tsconfig.json --watch --preserveWatchOutput",
|
|
39
|
+
"build:dist": "node scripts/build-dist.mjs",
|
|
40
|
+
"gen:barrel": "node scripts/gen-barrel.mjs",
|
|
41
|
+
"screenshot": "node scripts/screenshot.mjs",
|
|
42
|
+
"shoot-all": "node scripts/screenshot.mjs --all",
|
|
43
|
+
"shoot:storybook": "node scripts/shoot-storybook.mjs",
|
|
44
|
+
"shoot:storybook:build": "node scripts/shoot-storybook.mjs --build --theme=both",
|
|
45
|
+
"check": "bash scripts/check.sh",
|
|
46
|
+
"check:tokens": "bash scripts/check-tokens.sh",
|
|
47
|
+
"check:structure": "bash scripts/check-structure.sh",
|
|
48
|
+
"check:previews": "bash scripts/check-previews.sh",
|
|
49
|
+
"check:bem": "bash scripts/check-bem.sh",
|
|
50
|
+
"check:contrast": "node scripts/check-contrast.mjs",
|
|
51
|
+
"audit:contrast": "node scripts/check-contrast.mjs --audit",
|
|
52
|
+
"check:spacing": "node scripts/check-spacing.mjs",
|
|
53
|
+
"prepublishOnly": "npm run build:dist",
|
|
54
|
+
"release": "npm publish",
|
|
55
|
+
"sb:prep": "npm run build:lit && node scripts/gen-storybook-register.mjs",
|
|
56
|
+
"storybook": "npm run sb:prep && storybook dev -p 6006 --no-open",
|
|
57
|
+
"storybook:dev": "storybook dev -p 6006 --no-open",
|
|
58
|
+
"storybook:watch": "npm run sb:prep && npm-run-all --parallel watch:lit storybook:dev",
|
|
59
|
+
"storybook:react": "storybook dev -p 6007 -c .storybook-react --no-open",
|
|
60
|
+
"build-storybook": "npm run sb:prep && storybook build -o storybook-static",
|
|
61
|
+
"build-storybook:react": "storybook build -c .storybook-react -o storybook-static-react"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"lit": "^3.2.0"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@storybook/addon-a11y": "^9.0.0",
|
|
68
|
+
"@storybook/addon-docs": "^9.0.0",
|
|
69
|
+
"@storybook/react-vite": "^9.0.0",
|
|
70
|
+
"@storybook/web-components-vite": "^9.0.0",
|
|
71
|
+
"http-server": "^14.1.1",
|
|
72
|
+
"lit": "^3.2.0",
|
|
73
|
+
"npm-run-all": "^4.1.5",
|
|
74
|
+
"playwright": "^1.49.0",
|
|
75
|
+
"react": "^18.3.1",
|
|
76
|
+
"react-dom": "^18.3.1",
|
|
77
|
+
"storybook": "^9.0.0",
|
|
78
|
+
"typescript": "^5.6.3",
|
|
79
|
+
"vite": "^6.0.0"
|
|
80
|
+
}
|
|
81
|
+
}
|