@hraness/design-kit 0.35.0 → 0.35.2
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/AGENT_SETUP.md +4 -0
- package/ARTICLE_COPY.md +19 -7
- package/README.md +8 -2
- package/dist/{chunk-c9mhn3yb.js → chunk-4tgt8egt.js} +18 -13
- package/dist/{chunk-fjf81bww.js → chunk-6ts4955n.js} +8 -34
- package/dist/{chunk-c80g58j1.js → chunk-fmeg5cxf.js} +14 -6
- package/dist/{chunk-8xfssb9c.js → chunk-tzd7177a.js} +138 -81
- package/dist/index.js +1 -1
- package/dist/react/index.js +38 -96
- package/dist/react/platform-install.js +2 -2
- package/dist/react/server.js +2 -2
- package/dist/stylex-manifest.json +1 -1
- package/dist/stylex.css +28 -28
- package/package.json +3 -1
- package/portfolio-inventory.json +1 -1
- package/src/article-html.ts +41 -19
- package/src/react/agent-setup-prompt.stylex.ts +5 -25
- package/src/react/agent-setup-prompt.tsx +9 -18
- package/src/react/article.tsx +32 -14
- package/src/react/design-gallery.tsx +3 -0
- package/src/react/platform-install.stylex.ts +7 -36
- package/src/react/platform-install.tsx +15 -23
- package/src/react/setup-copy-button.stylex.ts +39 -0
- package/src/react/setup-copy-button.tsx +20 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SyntaxCode,
|
|
3
3
|
platformInstallClassName
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6ts4955n.js";
|
|
5
5
|
import {
|
|
6
6
|
detectPlatform,
|
|
7
7
|
isKnownPlatformId,
|
|
@@ -13,7 +13,102 @@ import {
|
|
|
13
13
|
|
|
14
14
|
// src/react/platform-install.tsx
|
|
15
15
|
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
16
|
+
|
|
17
|
+
// src/react/setup-copy-button.stylex.ts
|
|
18
|
+
import * as stylex from "@stylexjs/stylex";
|
|
19
|
+
var setupCopyButtonStyles = {
|
|
20
|
+
button: {
|
|
21
|
+
kGNEyG: "x6s0dn4",
|
|
22
|
+
kysU6D: "xjyslct",
|
|
23
|
+
kWkggS: "x17tv4j5 x1lf5oka xnwy5bs",
|
|
24
|
+
kVAM5u: "x3ugid2 x1ylmb6m",
|
|
25
|
+
kaIpWk: "x116uinm",
|
|
26
|
+
ksu8eU: "x1y0btm7",
|
|
27
|
+
kMzoRj: "xmkeg23",
|
|
28
|
+
kB7OPa: "x9f619",
|
|
29
|
+
kMwMTN: "xm06a53 x1ggml12",
|
|
30
|
+
kkrTdU: "x1ypdohk",
|
|
31
|
+
k1xSpc: "x3nfvp2 x1cfwndu",
|
|
32
|
+
kmuXW: "x2lah0s",
|
|
33
|
+
kMv6JI: "xtls1wf",
|
|
34
|
+
kGuDYH: "x1dcheo9",
|
|
35
|
+
k63SB2: "xk50ysn",
|
|
36
|
+
kOIVth: "x1neeqzj",
|
|
37
|
+
kjj79g: "xl56j7k",
|
|
38
|
+
kLWn49: "xo5v014",
|
|
39
|
+
kogj98: "x1ghz6dp",
|
|
40
|
+
kAzted: "xgbkey0",
|
|
41
|
+
kI3sdo: "x1a2a7pz xr5lfjo",
|
|
42
|
+
kInvED: "x1hl8ikr",
|
|
43
|
+
kmVPX3: "x1i4hug3",
|
|
44
|
+
$$css: true
|
|
45
|
+
},
|
|
46
|
+
icon: {
|
|
47
|
+
kZKoxP: "x1l36t39",
|
|
48
|
+
kmuXW: "x2lah0s",
|
|
49
|
+
kzqmXN: "xcdlrvm",
|
|
50
|
+
$$css: true
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
function setupCopyButtonClassName(part, caller) {
|
|
54
|
+
return [`hraness-setup-copy__${part}`, stylex.props(setupCopyButtonStyles[part]).className, caller].filter(Boolean).join(" ");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// src/react/setup-copy-button.tsx
|
|
16
58
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
59
|
+
function SetupCopyButton({
|
|
60
|
+
className,
|
|
61
|
+
iconClassName,
|
|
62
|
+
onCopy,
|
|
63
|
+
state,
|
|
64
|
+
subject,
|
|
65
|
+
failedLabel = "Copy failed"
|
|
66
|
+
}) {
|
|
67
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
68
|
+
"aria-busy": state === "copying" || undefined,
|
|
69
|
+
"aria-label": `${state === "copied" ? "Copied" : "Copy"} ${subject}`,
|
|
70
|
+
className: setupCopyButtonClassName("button", className),
|
|
71
|
+
"data-copy-state": state,
|
|
72
|
+
disabled: state === "copying",
|
|
73
|
+
onClick: onCopy,
|
|
74
|
+
type: "button",
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ jsx("svg", {
|
|
77
|
+
"aria-hidden": "true",
|
|
78
|
+
className: setupCopyButtonClassName("icon", iconClassName),
|
|
79
|
+
fill: "none",
|
|
80
|
+
focusable: "false",
|
|
81
|
+
stroke: "currentColor",
|
|
82
|
+
strokeLinecap: "round",
|
|
83
|
+
strokeLinejoin: "round",
|
|
84
|
+
strokeWidth: 2,
|
|
85
|
+
viewBox: "0 0 24 24",
|
|
86
|
+
children: state === "copied" ? /* @__PURE__ */ jsx("path", {
|
|
87
|
+
d: "M5 12.5l4.5 4.5L19 7.5"
|
|
88
|
+
}) : /* @__PURE__ */ jsxs(Fragment, {
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ jsx("rect", {
|
|
91
|
+
height: "12",
|
|
92
|
+
rx: "2",
|
|
93
|
+
width: "12",
|
|
94
|
+
x: "8",
|
|
95
|
+
y: "8"
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ jsx("path", {
|
|
98
|
+
d: "M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
})
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ jsx("span", {
|
|
104
|
+
children: state === "copied" ? "Copied" : state === "copying" ? "Copying" : state === "failed" ? failedLabel : "Copy"
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// src/react/platform-install.tsx
|
|
111
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
17
112
|
var copyResetMilliseconds = 2000;
|
|
18
113
|
function assertTargets(platforms, defaultPlatform) {
|
|
19
114
|
if (platforms.length === 0)
|
|
@@ -82,17 +177,17 @@ function PlatformMarkSymbols({
|
|
|
82
177
|
ids,
|
|
83
178
|
symbolId
|
|
84
179
|
}) {
|
|
85
|
-
return /* @__PURE__ */
|
|
180
|
+
return /* @__PURE__ */ jsx2("svg", {
|
|
86
181
|
"aria-hidden": "true",
|
|
87
182
|
className: platformInstallClassName(["markSymbols"]),
|
|
88
183
|
focusable: "false",
|
|
89
184
|
xmlns: "http://www.w3.org/2000/svg",
|
|
90
185
|
children: ids.map((id) => {
|
|
91
186
|
const mark = platformMark(id);
|
|
92
|
-
return /* @__PURE__ */
|
|
187
|
+
return /* @__PURE__ */ jsx2("symbol", {
|
|
93
188
|
id: symbolId(id),
|
|
94
189
|
viewBox: mark.viewBox,
|
|
95
|
-
children: /* @__PURE__ */
|
|
190
|
+
children: /* @__PURE__ */ jsx2("path", {
|
|
96
191
|
d: mark.path
|
|
97
192
|
})
|
|
98
193
|
}, id);
|
|
@@ -103,7 +198,7 @@ function PlatformMarkUse({
|
|
|
103
198
|
platform,
|
|
104
199
|
symbolId
|
|
105
200
|
}) {
|
|
106
|
-
return /* @__PURE__ */
|
|
201
|
+
return /* @__PURE__ */ jsx2("svg", {
|
|
107
202
|
"aria-hidden": "true",
|
|
108
203
|
className: platformInstallClassName(["icon"]),
|
|
109
204
|
"data-platform": platform,
|
|
@@ -111,97 +206,58 @@ function PlatformMarkUse({
|
|
|
111
206
|
focusable: "false",
|
|
112
207
|
viewBox: platformMark(platform).viewBox,
|
|
113
208
|
xmlns: "http://www.w3.org/2000/svg",
|
|
114
|
-
children: /* @__PURE__ */
|
|
209
|
+
children: /* @__PURE__ */ jsx2("use", {
|
|
115
210
|
href: `#${symbolId}`
|
|
116
211
|
})
|
|
117
212
|
});
|
|
118
213
|
}
|
|
119
|
-
function CopyGlyph({
|
|
120
|
-
copied
|
|
121
|
-
}) {
|
|
122
|
-
return /* @__PURE__ */ jsx("svg", {
|
|
123
|
-
"aria-hidden": "true",
|
|
124
|
-
className: platformInstallClassName(["copyIcon"]),
|
|
125
|
-
fill: "none",
|
|
126
|
-
focusable: "false",
|
|
127
|
-
stroke: "currentColor",
|
|
128
|
-
strokeLinecap: "round",
|
|
129
|
-
strokeLinejoin: "round",
|
|
130
|
-
strokeWidth: 2,
|
|
131
|
-
viewBox: "0 0 24 24",
|
|
132
|
-
children: copied ? /* @__PURE__ */ jsx("path", {
|
|
133
|
-
d: "M5 12.5l4.5 4.5L19 7.5"
|
|
134
|
-
}) : /* @__PURE__ */ jsxs(Fragment, {
|
|
135
|
-
children: [
|
|
136
|
-
/* @__PURE__ */ jsx("rect", {
|
|
137
|
-
height: "12",
|
|
138
|
-
rx: "2",
|
|
139
|
-
width: "12",
|
|
140
|
-
x: "8",
|
|
141
|
-
y: "8"
|
|
142
|
-
}),
|
|
143
|
-
/* @__PURE__ */ jsx("path", {
|
|
144
|
-
d: "M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"
|
|
145
|
-
})
|
|
146
|
-
]
|
|
147
|
-
})
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
214
|
function CommandBlock({
|
|
151
215
|
caption,
|
|
152
216
|
command,
|
|
153
217
|
copyKey,
|
|
154
218
|
onCopy,
|
|
219
|
+
note,
|
|
155
220
|
status,
|
|
156
221
|
subject
|
|
157
222
|
}) {
|
|
158
223
|
const preRef = useRef(null);
|
|
159
224
|
const state = status?.key === copyKey ? status.ok ? "copied" : "failed" : "idle";
|
|
160
|
-
return /* @__PURE__ */
|
|
225
|
+
return /* @__PURE__ */ jsxs2("div", {
|
|
161
226
|
className: platformInstallClassName(["command"]),
|
|
162
227
|
"data-copy-state": state,
|
|
163
228
|
children: [
|
|
164
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ jsxs2("div", {
|
|
165
230
|
className: platformInstallClassName(["commandBar", (caption === undefined || caption === "") && "commandBarEmpty"]),
|
|
166
231
|
children: [
|
|
167
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ jsx2("span", {
|
|
168
233
|
className: platformInstallClassName(["shell"]),
|
|
169
234
|
children: caption
|
|
170
235
|
}),
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
className:
|
|
173
|
-
"
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
copied: state === "copied"
|
|
179
|
-
}),
|
|
180
|
-
/* @__PURE__ */ jsx("span", {
|
|
181
|
-
children: state === "copied" ? "Copied" : state === "failed" ? "Select to copy" : "Copy"
|
|
182
|
-
}),
|
|
183
|
-
/* @__PURE__ */ jsxs("span", {
|
|
184
|
-
className: platformInstallClassName(["status"]),
|
|
185
|
-
children: [
|
|
186
|
-
" ",
|
|
187
|
-
subject
|
|
188
|
-
]
|
|
189
|
-
})
|
|
190
|
-
]
|
|
236
|
+
/* @__PURE__ */ jsx2(SetupCopyButton, {
|
|
237
|
+
className: "hraness-platform-install__copy",
|
|
238
|
+
iconClassName: "hraness-platform-install__copy-icon",
|
|
239
|
+
failedLabel: "Select to copy",
|
|
240
|
+
onCopy: () => onCopy(copyKey, command, subject, preRef.current),
|
|
241
|
+
state,
|
|
242
|
+
subject
|
|
191
243
|
})
|
|
192
244
|
]
|
|
193
245
|
}),
|
|
194
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ jsx2("pre", {
|
|
195
247
|
"aria-label": subject,
|
|
196
248
|
className: platformInstallClassName(["pre"]),
|
|
197
249
|
ref: preRef,
|
|
198
250
|
tabIndex: 0,
|
|
199
|
-
children: /* @__PURE__ */
|
|
251
|
+
children: /* @__PURE__ */ jsx2(SyntaxCode, {
|
|
200
252
|
className: platformInstallClassName(["code"]),
|
|
201
253
|
code: command,
|
|
202
254
|
language: "shell",
|
|
203
255
|
styles: "classes"
|
|
204
256
|
})
|
|
257
|
+
}),
|
|
258
|
+
note === undefined ? null : /* @__PURE__ */ jsx2("div", {
|
|
259
|
+
className: platformInstallClassName(["note", "commandNote"]),
|
|
260
|
+
children: note
|
|
205
261
|
})
|
|
206
262
|
]
|
|
207
263
|
});
|
|
@@ -286,25 +342,25 @@ function PlatformInstall({
|
|
|
286
342
|
event.preventDefault();
|
|
287
343
|
choose(target, true);
|
|
288
344
|
};
|
|
289
|
-
return /* @__PURE__ */
|
|
345
|
+
return /* @__PURE__ */ jsxs2("div", {
|
|
290
346
|
className: platformInstallClassName(["root"], className),
|
|
291
347
|
"data-hraness-platform-install": "",
|
|
292
348
|
"data-selected-platform": current,
|
|
293
349
|
"data-selection-source": source,
|
|
294
350
|
id,
|
|
295
351
|
children: [
|
|
296
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ jsx2(PlatformMarkSymbols, {
|
|
297
353
|
ids,
|
|
298
354
|
symbolId
|
|
299
355
|
}),
|
|
300
|
-
/* @__PURE__ */
|
|
356
|
+
/* @__PURE__ */ jsx2("div", {
|
|
301
357
|
"aria-label": label,
|
|
302
358
|
className: platformInstallClassName(["tablist"]),
|
|
303
359
|
onKeyDown,
|
|
304
360
|
role: "tablist",
|
|
305
361
|
children: platforms.map((target) => {
|
|
306
362
|
const isSelected = target.id === current;
|
|
307
|
-
return /* @__PURE__ */
|
|
363
|
+
return /* @__PURE__ */ jsxs2("button", {
|
|
308
364
|
"aria-controls": `${baseId}-panel-${target.id}`,
|
|
309
365
|
"aria-selected": isSelected,
|
|
310
366
|
className: platformInstallClassName(["tab", isSelected && "tabSelected"]),
|
|
@@ -322,11 +378,11 @@ function PlatformInstall({
|
|
|
322
378
|
tabIndex: isSelected ? 0 : -1,
|
|
323
379
|
type: "button",
|
|
324
380
|
children: [
|
|
325
|
-
/* @__PURE__ */
|
|
381
|
+
/* @__PURE__ */ jsx2(PlatformMarkUse, {
|
|
326
382
|
platform: target.id,
|
|
327
383
|
symbolId: symbolId(target.id)
|
|
328
384
|
}),
|
|
329
|
-
/* @__PURE__ */
|
|
385
|
+
/* @__PURE__ */ jsx2("span", {
|
|
330
386
|
className: platformInstallClassName(["tabLabel"]),
|
|
331
387
|
children: labelOf(target)
|
|
332
388
|
})
|
|
@@ -337,7 +393,7 @@ function PlatformInstall({
|
|
|
337
393
|
platforms.map((target) => {
|
|
338
394
|
const name = labelOf(target);
|
|
339
395
|
const alternatives = target.alternatives ?? [];
|
|
340
|
-
return /* @__PURE__ */
|
|
396
|
+
return /* @__PURE__ */ jsx2("div", {
|
|
341
397
|
"aria-labelledby": `${baseId}-tab-${target.id}`,
|
|
342
398
|
className: platformInstallClassName(["panel"]),
|
|
343
399
|
"data-availability": target.unavailable === true ? "unavailable" : "available",
|
|
@@ -345,38 +401,39 @@ function PlatformInstall({
|
|
|
345
401
|
hidden: target.id !== current,
|
|
346
402
|
id: `${baseId}-panel-${target.id}`,
|
|
347
403
|
role: "tabpanel",
|
|
348
|
-
children: /* @__PURE__ */
|
|
404
|
+
children: /* @__PURE__ */ jsxs2("div", {
|
|
349
405
|
className: platformInstallClassName(["panelBody"]),
|
|
350
406
|
children: [
|
|
351
|
-
/* @__PURE__ */
|
|
407
|
+
/* @__PURE__ */ jsxs2("p", {
|
|
352
408
|
className: platformInstallClassName(["panelLabel"]),
|
|
353
409
|
children: [
|
|
354
|
-
/* @__PURE__ */
|
|
410
|
+
/* @__PURE__ */ jsx2(PlatformMarkUse, {
|
|
355
411
|
platform: target.id,
|
|
356
412
|
symbolId: symbolId(target.id)
|
|
357
413
|
}),
|
|
358
|
-
/* @__PURE__ */
|
|
414
|
+
/* @__PURE__ */ jsx2("span", {
|
|
359
415
|
children: name
|
|
360
416
|
})
|
|
361
417
|
]
|
|
362
418
|
}),
|
|
363
|
-
target.unavailable === true ? /* @__PURE__ */
|
|
419
|
+
target.unavailable === true ? /* @__PURE__ */ jsx2("div", {
|
|
364
420
|
className: platformInstallClassName(["unavailable"]),
|
|
365
421
|
children: target.unavailableNote
|
|
366
422
|
}) : null,
|
|
367
|
-
target.command === undefined ? null : /* @__PURE__ */
|
|
423
|
+
target.command === undefined ? null : /* @__PURE__ */ jsx2(CommandBlock, {
|
|
368
424
|
caption: target.shell,
|
|
369
425
|
command: target.command,
|
|
370
426
|
copyKey: `${target.id}:primary`,
|
|
371
427
|
onCopy: copy,
|
|
428
|
+
note: target.note,
|
|
372
429
|
status,
|
|
373
430
|
subject: `${name} install command`
|
|
374
431
|
}),
|
|
375
|
-
alternatives.length === 0 ? null : /* @__PURE__ */
|
|
432
|
+
alternatives.length === 0 ? null : /* @__PURE__ */ jsx2("ul", {
|
|
376
433
|
"aria-label": `Other ways to install on ${name}`,
|
|
377
434
|
className: platformInstallClassName(["alternatives"]),
|
|
378
|
-
children: alternatives.map((alternative, index) => /* @__PURE__ */
|
|
379
|
-
children: /* @__PURE__ */
|
|
435
|
+
children: alternatives.map((alternative, index) => /* @__PURE__ */ jsx2("li", {
|
|
436
|
+
children: /* @__PURE__ */ jsx2(CommandBlock, {
|
|
380
437
|
caption: [alternative.label, alternative.shell].filter(Boolean).join(" · "),
|
|
381
438
|
command: alternative.command,
|
|
382
439
|
copyKey: `${target.id}:${index}`,
|
|
@@ -386,7 +443,7 @@ function PlatformInstall({
|
|
|
386
443
|
})
|
|
387
444
|
}, `${alternative.label}-${index}`))
|
|
388
445
|
}),
|
|
389
|
-
target.note === undefined ? null : /* @__PURE__ */
|
|
446
|
+
target.command !== undefined || target.note === undefined ? null : /* @__PURE__ */ jsx2("div", {
|
|
390
447
|
className: platformInstallClassName(["note"]),
|
|
391
448
|
children: target.note
|
|
392
449
|
})
|
|
@@ -394,7 +451,7 @@ function PlatformInstall({
|
|
|
394
451
|
})
|
|
395
452
|
}, target.id);
|
|
396
453
|
}),
|
|
397
|
-
/* @__PURE__ */
|
|
454
|
+
/* @__PURE__ */ jsx2("p", {
|
|
398
455
|
"aria-live": "polite",
|
|
399
456
|
className: platformInstallClassName(["status"]),
|
|
400
457
|
role: "status",
|
|
@@ -404,4 +461,4 @@ function PlatformInstall({
|
|
|
404
461
|
});
|
|
405
462
|
}
|
|
406
463
|
|
|
407
|
-
export { PlatformInstall };
|
|
464
|
+
export { SetupCopyButton, PlatformInstall };
|