@antadesign/anta 0.1.1-dev.6 → 0.1.1-dev.8
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 +13 -2
- package/dist/components/Button.d.ts +113 -0
- package/dist/components/Button.js +100 -0
- package/dist/components/Button.module.css +2 -0
- package/dist/components/Icon.d.ts +2 -1
- package/dist/components/Progress.d.ts +4 -2
- package/dist/components/Sticker.d.ts +31 -0
- package/dist/components/Sticker.js +17 -0
- package/dist/components/StickerAnimated.d.ts +23 -0
- package/dist/components/StickerAnimated.js +28 -0
- package/dist/components/Text.d.ts +2 -1
- package/dist/components/Title.d.ts +6 -4
- package/dist/components/Tooltip.d.ts +55 -0
- package/dist/components/Tooltip.js +26 -0
- package/dist/components/__generated__/stickers/angry-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/angry-animated.js +7 -0
- package/dist/components/__generated__/stickers/angry.d.ts +3 -0
- package/dist/components/__generated__/stickers/angry.js +7 -0
- package/dist/components/__generated__/stickers/ask-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/ask-animated.js +7 -0
- package/dist/components/__generated__/stickers/ask.d.ts +3 -0
- package/dist/components/__generated__/stickers/ask.js +7 -0
- package/dist/components/__generated__/stickers/balance-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/balance-animated.js +7 -0
- package/dist/components/__generated__/stickers/balance.d.ts +3 -0
- package/dist/components/__generated__/stickers/balance.js +7 -0
- package/dist/components/__generated__/stickers/butterfly-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/butterfly-animated.js +7 -0
- package/dist/components/__generated__/stickers/butterfly-snake-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/butterfly-snake-animated.js +7 -0
- package/dist/components/__generated__/stickers/butterfly-snake.d.ts +3 -0
- package/dist/components/__generated__/stickers/butterfly-snake.js +7 -0
- package/dist/components/__generated__/stickers/butterfly.d.ts +3 -0
- package/dist/components/__generated__/stickers/butterfly.js +7 -0
- package/dist/components/__generated__/stickers/catch-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/catch-animated.js +7 -0
- package/dist/components/__generated__/stickers/catch.d.ts +3 -0
- package/dist/components/__generated__/stickers/catch.js +7 -0
- package/dist/components/__generated__/stickers/clap-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/clap-animated.js +7 -0
- package/dist/components/__generated__/stickers/clap.d.ts +3 -0
- package/dist/components/__generated__/stickers/clap.js +7 -0
- package/dist/components/__generated__/stickers/coding-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/coding-animated.js +7 -0
- package/dist/components/__generated__/stickers/coding.d.ts +3 -0
- package/dist/components/__generated__/stickers/coding.js +7 -0
- package/dist/components/__generated__/stickers/cowboy-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/cowboy-animated.js +7 -0
- package/dist/components/__generated__/stickers/cowboy.d.ts +3 -0
- package/dist/components/__generated__/stickers/cowboy.js +7 -0
- package/dist/components/__generated__/stickers/dance-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/dance-animated.js +7 -0
- package/dist/components/__generated__/stickers/dance.d.ts +3 -0
- package/dist/components/__generated__/stickers/dance.js +7 -0
- package/dist/components/__generated__/stickers/detective-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/detective-animated.js +7 -0
- package/dist/components/__generated__/stickers/detective.d.ts +3 -0
- package/dist/components/__generated__/stickers/detective.js +7 -0
- package/dist/components/__generated__/stickers/disapprove-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/disapprove-animated.js +7 -0
- package/dist/components/__generated__/stickers/disapprove.d.ts +3 -0
- package/dist/components/__generated__/stickers/disapprove.js +7 -0
- package/dist/components/__generated__/stickers/distracted-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/distracted-animated.js +7 -0
- package/dist/components/__generated__/stickers/distracted.d.ts +3 -0
- package/dist/components/__generated__/stickers/distracted.js +7 -0
- package/dist/components/__generated__/stickers/dive-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/dive-animated.js +7 -0
- package/dist/components/__generated__/stickers/dive.d.ts +3 -0
- package/dist/components/__generated__/stickers/dive.js +7 -0
- package/dist/components/__generated__/stickers/eat-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/eat-animated.js +7 -0
- package/dist/components/__generated__/stickers/eat.d.ts +3 -0
- package/dist/components/__generated__/stickers/eat.js +7 -0
- package/dist/components/__generated__/stickers/facepalm-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/facepalm-animated.js +7 -0
- package/dist/components/__generated__/stickers/facepalm.d.ts +3 -0
- package/dist/components/__generated__/stickers/facepalm.js +7 -0
- package/dist/components/__generated__/stickers/failed-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/failed-animated.js +7 -0
- package/dist/components/__generated__/stickers/failed.d.ts +3 -0
- package/dist/components/__generated__/stickers/failed.js +7 -0
- package/dist/components/__generated__/stickers/found-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/found-animated.js +7 -0
- package/dist/components/__generated__/stickers/found.d.ts +3 -0
- package/dist/components/__generated__/stickers/found.js +7 -0
- package/dist/components/__generated__/stickers/grow-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/grow-animated.js +7 -0
- package/dist/components/__generated__/stickers/grow.d.ts +3 -0
- package/dist/components/__generated__/stickers/grow.js +7 -0
- package/dist/components/__generated__/stickers/handstand-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/handstand-animated.js +7 -0
- package/dist/components/__generated__/stickers/handstand.d.ts +3 -0
- package/dist/components/__generated__/stickers/handstand.js +7 -0
- package/dist/components/__generated__/stickers/heart-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/heart-animated.js +7 -0
- package/dist/components/__generated__/stickers/heart.d.ts +3 -0
- package/dist/components/__generated__/stickers/heart.js +7 -0
- package/dist/components/__generated__/stickers/hello-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/hello-animated.js +7 -0
- package/dist/components/__generated__/stickers/hello.d.ts +3 -0
- package/dist/components/__generated__/stickers/hello.js +7 -0
- package/dist/components/__generated__/stickers/idea-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/idea-animated.js +7 -0
- package/dist/components/__generated__/stickers/idea.d.ts +3 -0
- package/dist/components/__generated__/stickers/idea.js +7 -0
- package/dist/components/__generated__/stickers/index.d.ts +99 -0
- package/dist/components/__generated__/stickers/index.js +198 -0
- package/dist/components/__generated__/stickers/laugh-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/laugh-animated.js +7 -0
- package/dist/components/__generated__/stickers/laugh.d.ts +3 -0
- package/dist/components/__generated__/stickers/laugh.js +7 -0
- package/dist/components/__generated__/stickers/love-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/love-animated.js +7 -0
- package/dist/components/__generated__/stickers/love.d.ts +3 -0
- package/dist/components/__generated__/stickers/love.js +7 -0
- package/dist/components/__generated__/stickers/nap-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/nap-animated.js +7 -0
- package/dist/components/__generated__/stickers/nap.d.ts +3 -0
- package/dist/components/__generated__/stickers/nap.js +7 -0
- package/dist/components/__generated__/stickers/party-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/party-animated.js +7 -0
- package/dist/components/__generated__/stickers/party.d.ts +3 -0
- package/dist/components/__generated__/stickers/party.js +7 -0
- package/dist/components/__generated__/stickers/passed-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/passed-animated.js +7 -0
- package/dist/components/__generated__/stickers/passed.d.ts +3 -0
- package/dist/components/__generated__/stickers/passed.js +7 -0
- package/dist/components/__generated__/stickers/peekaboo-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/peekaboo-animated.js +7 -0
- package/dist/components/__generated__/stickers/peekaboo.d.ts +3 -0
- package/dist/components/__generated__/stickers/peekaboo.js +7 -0
- package/dist/components/__generated__/stickers/pizza-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/pizza-animated.js +7 -0
- package/dist/components/__generated__/stickers/pizza.d.ts +3 -0
- package/dist/components/__generated__/stickers/pizza.js +7 -0
- package/dist/components/__generated__/stickers/puzzle-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/puzzle-animated.js +7 -0
- package/dist/components/__generated__/stickers/puzzle.d.ts +3 -0
- package/dist/components/__generated__/stickers/puzzle.js +7 -0
- package/dist/components/__generated__/stickers/sad-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/sad-animated.js +7 -0
- package/dist/components/__generated__/stickers/sad.d.ts +3 -0
- package/dist/components/__generated__/stickers/sad.js +7 -0
- package/dist/components/__generated__/stickers/scared-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/scared-animated.js +7 -0
- package/dist/components/__generated__/stickers/scared.d.ts +3 -0
- package/dist/components/__generated__/stickers/scared.js +7 -0
- package/dist/components/__generated__/stickers/scroll-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/scroll-animated.js +7 -0
- package/dist/components/__generated__/stickers/scroll.d.ts +3 -0
- package/dist/components/__generated__/stickers/scroll.js +7 -0
- package/dist/components/__generated__/stickers/search-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/search-animated.js +7 -0
- package/dist/components/__generated__/stickers/search.d.ts +3 -0
- package/dist/components/__generated__/stickers/search.js +7 -0
- package/dist/components/__generated__/stickers/shield-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/shield-animated.js +7 -0
- package/dist/components/__generated__/stickers/shield.d.ts +3 -0
- package/dist/components/__generated__/stickers/shield.js +7 -0
- package/dist/components/__generated__/stickers/shocked-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/shocked-animated.js +7 -0
- package/dist/components/__generated__/stickers/shocked.d.ts +3 -0
- package/dist/components/__generated__/stickers/shocked.js +7 -0
- package/dist/components/__generated__/stickers/sleep-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/sleep-animated.js +7 -0
- package/dist/components/__generated__/stickers/sleep.d.ts +3 -0
- package/dist/components/__generated__/stickers/sleep.js +7 -0
- package/dist/components/__generated__/stickers/stressed-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/stressed-animated.js +7 -0
- package/dist/components/__generated__/stickers/stressed.d.ts +3 -0
- package/dist/components/__generated__/stickers/stressed.js +7 -0
- package/dist/components/__generated__/stickers/suspicious-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/suspicious-animated.js +7 -0
- package/dist/components/__generated__/stickers/suspicious.d.ts +3 -0
- package/dist/components/__generated__/stickers/suspicious.js +7 -0
- package/dist/components/__generated__/stickers/thanks-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/thanks-animated.js +7 -0
- package/dist/components/__generated__/stickers/thanks.d.ts +3 -0
- package/dist/components/__generated__/stickers/thanks.js +7 -0
- package/dist/components/__generated__/stickers/think-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/think-animated.js +7 -0
- package/dist/components/__generated__/stickers/think-of-you-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/think-of-you-animated.js +7 -0
- package/dist/components/__generated__/stickers/think-of-you.d.ts +3 -0
- package/dist/components/__generated__/stickers/think-of-you.js +7 -0
- package/dist/components/__generated__/stickers/think.d.ts +3 -0
- package/dist/components/__generated__/stickers/think.js +7 -0
- package/dist/components/__generated__/stickers/thumbs-up-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/thumbs-up-animated.js +7 -0
- package/dist/components/__generated__/stickers/thumbs-up.d.ts +3 -0
- package/dist/components/__generated__/stickers/thumbs-up.js +7 -0
- package/dist/components/__generated__/stickers/vacation-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/vacation-animated.js +7 -0
- package/dist/components/__generated__/stickers/vacation.d.ts +3 -0
- package/dist/components/__generated__/stickers/vacation.js +7 -0
- package/dist/components/__generated__/stickers/wait-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/wait-animated.js +7 -0
- package/dist/components/__generated__/stickers/wait.d.ts +3 -0
- package/dist/components/__generated__/stickers/wait.js +7 -0
- package/dist/components/__generated__/stickers/wink-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/wink-animated.js +7 -0
- package/dist/components/__generated__/stickers/wink.d.ts +3 -0
- package/dist/components/__generated__/stickers/wink.js +7 -0
- package/dist/components/__generated__/stickers/work-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/work-animated.js +7 -0
- package/dist/components/__generated__/stickers/work.d.ts +3 -0
- package/dist/components/__generated__/stickers/work.js +7 -0
- package/dist/components/__generated__/stickers/zen-animated.d.ts +3 -0
- package/dist/components/__generated__/stickers/zen-animated.js +7 -0
- package/dist/components/__generated__/stickers/zen.d.ts +3 -0
- package/dist/components/__generated__/stickers/zen.js +7 -0
- package/dist/elements/a-button.css +733 -0
- package/dist/elements/a-button.d.ts +11 -0
- package/dist/elements/a-button.js +78 -0
- package/dist/elements/a-icon.css +30 -10
- package/dist/elements/a-icon.d.ts +2 -0
- package/dist/elements/a-icon.js +3 -0
- package/dist/elements/a-icon.shapes.css +9 -1
- package/dist/elements/a-icon.shapes.d.ts +3 -1
- package/dist/elements/a-icon.shapes.js +2 -0
- package/dist/elements/a-progress.css +7 -9
- package/dist/elements/a-progress.d.ts +1 -0
- package/dist/elements/a-progress.js +2 -0
- package/dist/elements/a-sticker-animated.css +9 -0
- package/dist/elements/a-sticker-animated.d.ts +39 -0
- package/dist/elements/a-sticker-animated.js +81 -0
- package/dist/elements/a-sticker.css +9 -0
- package/dist/elements/a-sticker.d.ts +19 -0
- package/dist/elements/a-sticker.js +32 -0
- package/dist/elements/a-text.css +6 -3
- package/dist/elements/a-text.d.ts +1 -0
- package/dist/elements/a-text.js +2 -0
- package/dist/elements/a-tooltip.css +42 -0
- package/dist/elements/a-tooltip.d.ts +61 -0
- package/dist/elements/a-tooltip.js +411 -0
- package/dist/elements/index.d.ts +21 -5
- package/dist/elements/index.js +18 -18
- package/dist/general_types.d.ts +110 -6
- package/dist/generate-stickers.mjs +293 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/jsx-runtime.d.ts +6 -1
- package/dist/reset.css +31 -28
- package/dist/tokens.css +186 -182
- package/package.json +18 -4
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* generate-stickers.mjs — read a folder of per-sticker subfolders and emit
|
|
4
|
+
* one per-sticker TS module per mode (static + animated) under the chosen
|
|
5
|
+
* output folder, plus a barrel index that re-exports them.
|
|
6
|
+
*
|
|
7
|
+
* Expected source layout:
|
|
8
|
+
*
|
|
9
|
+
* stickers/
|
|
10
|
+
* coding/
|
|
11
|
+
* coding.json — Lottie animation (drives Sticker{Name}Animated)
|
|
12
|
+
* coding.svg — static pose (drives Sticker{Name})
|
|
13
|
+
* vacation/
|
|
14
|
+
* vacation.json
|
|
15
|
+
* vacation.svg
|
|
16
|
+
* …
|
|
17
|
+
*
|
|
18
|
+
*
|
|
19
|
+
* Collision detection — when `--internal` is NOT passed (i.e. consumer
|
|
20
|
+
* run), the generator warns if a generated name collides with one of
|
|
21
|
+
* anta's built-in stickers. Anta's own build passes `--internal`.
|
|
22
|
+
*
|
|
23
|
+
* node scripts/generate-stickers.mjs --input ./stickers --output ./src/components/__generated__/stickers
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import fs from "node:fs";
|
|
27
|
+
import path from "node:path";
|
|
28
|
+
|
|
29
|
+
// Anta's built-in sticker names. Consumers who generate a same-named
|
|
30
|
+
// sticker get a warning; their generated module will resolve to the same
|
|
31
|
+
// import path and shadow ours. Keep this list in sync with the canonical
|
|
32
|
+
// names under ./stickers/<name>/.
|
|
33
|
+
const DEFAULT_BUILT_IN = [
|
|
34
|
+
"angry",
|
|
35
|
+
"ask",
|
|
36
|
+
"balance",
|
|
37
|
+
"butterfly",
|
|
38
|
+
"butterfly-snake",
|
|
39
|
+
"catch",
|
|
40
|
+
"clap",
|
|
41
|
+
"coding",
|
|
42
|
+
"cowboy",
|
|
43
|
+
"dance",
|
|
44
|
+
"detective",
|
|
45
|
+
"disapprove",
|
|
46
|
+
"distracted",
|
|
47
|
+
"dive",
|
|
48
|
+
"eat",
|
|
49
|
+
"facepalm",
|
|
50
|
+
"failed",
|
|
51
|
+
"found",
|
|
52
|
+
"grow",
|
|
53
|
+
"handstand",
|
|
54
|
+
"heart",
|
|
55
|
+
"hello",
|
|
56
|
+
"idea",
|
|
57
|
+
"laugh",
|
|
58
|
+
"love",
|
|
59
|
+
"nap",
|
|
60
|
+
"party",
|
|
61
|
+
"passed",
|
|
62
|
+
"peekaboo",
|
|
63
|
+
"pizza",
|
|
64
|
+
"puzzle",
|
|
65
|
+
"sad",
|
|
66
|
+
"scared",
|
|
67
|
+
"scroll",
|
|
68
|
+
"search",
|
|
69
|
+
"shield",
|
|
70
|
+
"shocked",
|
|
71
|
+
"sleep",
|
|
72
|
+
"stressed",
|
|
73
|
+
"suspicious",
|
|
74
|
+
"thanks",
|
|
75
|
+
"think",
|
|
76
|
+
"think-of-you",
|
|
77
|
+
"thumbs-up",
|
|
78
|
+
"vacation",
|
|
79
|
+
"wait",
|
|
80
|
+
"wink",
|
|
81
|
+
"work",
|
|
82
|
+
"zen",
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
function pascalCase(name) {
|
|
86
|
+
return name
|
|
87
|
+
.split(/[-_\s]+/)
|
|
88
|
+
.filter(Boolean)
|
|
89
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
90
|
+
.join("");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function componentName(base) {
|
|
94
|
+
return `Sticker${pascalCase(base)}`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export async function generate({ input, output, internal = false } = {}) {
|
|
98
|
+
if (!input) throw new Error("generate-stickers: --input is required");
|
|
99
|
+
if (!output) throw new Error("generate-stickers: --output is required");
|
|
100
|
+
|
|
101
|
+
const inDir = path.resolve(input);
|
|
102
|
+
const outDir = path.resolve(output);
|
|
103
|
+
if (!fs.existsSync(inDir)) {
|
|
104
|
+
throw new Error(`generate-stickers: input folder not found: ${inDir}`);
|
|
105
|
+
}
|
|
106
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
107
|
+
|
|
108
|
+
// Each immediate subfolder of inDir is one sticker. The folder name is
|
|
109
|
+
// the canonical sticker name.
|
|
110
|
+
const subdirs = fs
|
|
111
|
+
.readdirSync(inDir, { withFileTypes: true })
|
|
112
|
+
.filter((d) => d.isDirectory())
|
|
113
|
+
.map((d) => d.name)
|
|
114
|
+
.sort();
|
|
115
|
+
|
|
116
|
+
if (subdirs.length === 0) {
|
|
117
|
+
console.warn(`generate-stickers: no sticker subfolders in ${inDir}`);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Clear out previous generated files so renamed/removed stickers don't
|
|
121
|
+
// leave stale modules behind. Keep index.ts (about to be rewritten) and
|
|
122
|
+
// the per-sticker static + animated file names we're about to write.
|
|
123
|
+
// Naming convention: `<name>.ts` is the static (default) sticker;
|
|
124
|
+
// `<name>-animated.ts` is the Lottie-backed animated variant.
|
|
125
|
+
const keep = new Set([
|
|
126
|
+
"index.ts",
|
|
127
|
+
...subdirs.flatMap((n) => [`${n}.ts`, `${n}-animated.ts`]),
|
|
128
|
+
]);
|
|
129
|
+
for (const existing of fs.readdirSync(outDir)) {
|
|
130
|
+
if (!keep.has(existing) && /\.ts$/.test(existing)) {
|
|
131
|
+
fs.unlinkSync(path.join(outDir, existing));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const exports = [];
|
|
136
|
+
const skipped = [];
|
|
137
|
+
const builtInSet = internal ? new Set() : new Set(DEFAULT_BUILT_IN);
|
|
138
|
+
const collisions = [];
|
|
139
|
+
|
|
140
|
+
for (const name of subdirs) {
|
|
141
|
+
const subdir = path.join(inDir, name);
|
|
142
|
+
const lottiePath = path.join(subdir, `${name}.json`);
|
|
143
|
+
const svgPath = path.join(subdir, `${name}.svg`);
|
|
144
|
+
const hasLottie = fs.existsSync(lottiePath);
|
|
145
|
+
const hasSvg = fs.existsSync(svgPath) && fs.statSync(svgPath).size > 0;
|
|
146
|
+
if (!hasLottie && !hasSvg) {
|
|
147
|
+
skipped.push(`${name} (no ${name}.json or ${name}.svg)`);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (builtInSet.has(name)) collisions.push(name);
|
|
151
|
+
const cname = componentName(name);
|
|
152
|
+
const animatedName = `${cname}Animated`;
|
|
153
|
+
|
|
154
|
+
// Static module — the default. Emitted whenever a non-empty SVG
|
|
155
|
+
// exists. Imports the `Sticker` runtime wrapper from the package
|
|
156
|
+
// root `@antadesign/anta` (same root specifier the icon codegen
|
|
157
|
+
// uses — no bespoke runtime subpath). Lives at `<name>.ts` so the
|
|
158
|
+
// import path matches the bare sticker name.
|
|
159
|
+
//
|
|
160
|
+
// Two exports: the JSX `Sticker{Name}` component (React/Preact),
|
|
161
|
+
// and the raw `svg` string (vanilla JS / non-JSX consumers, who
|
|
162
|
+
// assign it to an `<a-sticker>` element's `svg` attribute).
|
|
163
|
+
// Bundlers tree-shake the unused one.
|
|
164
|
+
if (hasSvg) {
|
|
165
|
+
const svg = fs.readFileSync(svgPath, "utf8");
|
|
166
|
+
const lines = [
|
|
167
|
+
"/* Auto-generated by @antadesign/anta. Do not edit by hand. */",
|
|
168
|
+
"",
|
|
169
|
+
"import { Sticker, type StickerProps } from '@antadesign/anta'",
|
|
170
|
+
"",
|
|
171
|
+
`export const svg = ${JSON.stringify(svg)}`,
|
|
172
|
+
"",
|
|
173
|
+
`export const ${cname} = (props: StickerProps) => Sticker({ ...props, svg })`,
|
|
174
|
+
"",
|
|
175
|
+
];
|
|
176
|
+
fs.writeFileSync(path.join(outDir, `${name}.ts`), lines.join("\n"));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Animated module — emitted whenever a Lottie JSON exists. Each
|
|
180
|
+
// module lives in `<name>-animated.ts` so importing only the static
|
|
181
|
+
// sticker (`<name>.ts`) never drags the Lottie payload. Bundlers
|
|
182
|
+
// tree-shake per-file when the barrel uses `export { … } from
|
|
183
|
+
// './foo'`. Imports the `StickerAnimated` runtime wrapper from the
|
|
184
|
+
// package root `@antadesign/anta`.
|
|
185
|
+
//
|
|
186
|
+
// The animation is exported as a JSON *string* (not the parsed
|
|
187
|
+
// object). `<a-sticker-animated>` receives it via its `animation`
|
|
188
|
+
// attribute and parses it once on set. Two exports: the JSX
|
|
189
|
+
// `Sticker{Name}Animated` component, and the raw `animationJson`
|
|
190
|
+
// string (vanilla JS / non-JSX consumers who call
|
|
191
|
+
// `el.setAttribute('animation', animationJson)`).
|
|
192
|
+
if (hasLottie) {
|
|
193
|
+
const lottieJson = fs.readFileSync(lottiePath, "utf8");
|
|
194
|
+
const lines = [
|
|
195
|
+
"/* Auto-generated by @antadesign/anta. Do not edit by hand. */",
|
|
196
|
+
"",
|
|
197
|
+
"import { StickerAnimated, type StickerAnimatedProps } from '@antadesign/anta'",
|
|
198
|
+
"",
|
|
199
|
+
`export const animationJson = ${JSON.stringify(lottieJson)}`,
|
|
200
|
+
"",
|
|
201
|
+
`export const ${animatedName} = (props: StickerAnimatedProps) => StickerAnimated({ ...props, animation: animationJson })`,
|
|
202
|
+
"",
|
|
203
|
+
];
|
|
204
|
+
fs.writeFileSync(
|
|
205
|
+
path.join(outDir, `${name}-animated.ts`),
|
|
206
|
+
lines.join("\n"),
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
exports.push({
|
|
211
|
+
base: name,
|
|
212
|
+
componentName: cname,
|
|
213
|
+
hasLottie,
|
|
214
|
+
hasSvg,
|
|
215
|
+
animatedName,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Barrel — alphabetical for stable diffs, side-effect free so unused
|
|
220
|
+
// stickers tree-shake. Each export references the correct per-mode
|
|
221
|
+
// file so importing only the static variant doesn't pull the animated
|
|
222
|
+
// module (and vice versa).
|
|
223
|
+
const reExports = [];
|
|
224
|
+
for (const {
|
|
225
|
+
base,
|
|
226
|
+
componentName,
|
|
227
|
+
hasLottie,
|
|
228
|
+
hasSvg,
|
|
229
|
+
animatedName,
|
|
230
|
+
} of exports) {
|
|
231
|
+
if (hasSvg) reExports.push(`export { ${componentName} } from './${base}'`);
|
|
232
|
+
if (hasLottie)
|
|
233
|
+
reExports.push(`export { ${animatedName} } from './${base}-animated'`);
|
|
234
|
+
}
|
|
235
|
+
const indexLines = [
|
|
236
|
+
"/* Auto-generated by @antadesign/anta. Do not edit by hand. */",
|
|
237
|
+
"",
|
|
238
|
+
"export type { StickerProps, StickerAnimatedProps } from '@antadesign/anta'",
|
|
239
|
+
"",
|
|
240
|
+
...reExports,
|
|
241
|
+
"",
|
|
242
|
+
];
|
|
243
|
+
fs.writeFileSync(path.join(outDir, "index.ts"), indexLines.join("\n"));
|
|
244
|
+
|
|
245
|
+
if (collisions.length > 0) {
|
|
246
|
+
console.warn(
|
|
247
|
+
`generate-stickers: ${collisions.length} sticker name(s) collide with Anta's built-in stickers: ` +
|
|
248
|
+
`${collisions.join(", ")}. ` +
|
|
249
|
+
`Consumers importing from \`@antadesign/anta/stickers\` get Anta's; your generated barrel exposes yours under its own import path.`,
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
console.log(
|
|
254
|
+
`generate-stickers: wrote ${exports.length} sticker${exports.length === 1 ? "" : "s"} to ${outDir}`,
|
|
255
|
+
);
|
|
256
|
+
if (skipped.length) {
|
|
257
|
+
console.warn(
|
|
258
|
+
`generate-stickers: skipped ${skipped.length} (${skipped.join(", ")})`,
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
return { stickers: exports };
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function parseArgs(argv) {
|
|
265
|
+
const out = {};
|
|
266
|
+
for (let i = 0; i < argv.length; i++) {
|
|
267
|
+
const arg = argv[i];
|
|
268
|
+
if (arg.startsWith("--")) {
|
|
269
|
+
const key = arg.slice(2);
|
|
270
|
+
const next = argv[i + 1];
|
|
271
|
+
if (next && !next.startsWith("--")) {
|
|
272
|
+
out[key] = next;
|
|
273
|
+
i++;
|
|
274
|
+
} else {
|
|
275
|
+
out[key] = true;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return out;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const isMain = process.argv[1]?.endsWith("generate-stickers.mjs");
|
|
283
|
+
if (isMain) {
|
|
284
|
+
const args = parseArgs(process.argv.slice(2));
|
|
285
|
+
generate({
|
|
286
|
+
input: args.input,
|
|
287
|
+
output: args.output,
|
|
288
|
+
internal: args.internal === true,
|
|
289
|
+
}).catch((e) => {
|
|
290
|
+
console.error(e.message);
|
|
291
|
+
process.exit(1);
|
|
292
|
+
});
|
|
293
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -24,7 +24,15 @@ export { Title } from './components/Title';
|
|
|
24
24
|
export type { TitleProps } from './components/Title';
|
|
25
25
|
export { Icon } from './components/Icon';
|
|
26
26
|
export type { IconProps } from './components/Icon';
|
|
27
|
+
export { Button } from './components/Button';
|
|
28
|
+
export type { ButtonProps, BaseButtonProps, ContentMode, SubmitMode, PriorityMode, } from './components/Button';
|
|
27
29
|
export { ICON_SHAPES, ICON_SYNONYMS } from './elements/a-icon.shapes';
|
|
30
|
+
export { Sticker } from './components/Sticker';
|
|
31
|
+
export type { StickerProps } from './components/Sticker';
|
|
32
|
+
export { StickerAnimated } from './components/StickerAnimated';
|
|
33
|
+
export type { StickerAnimatedProps } from './components/StickerAnimated';
|
|
34
|
+
export { Tooltip } from './components/Tooltip';
|
|
35
|
+
export type { TooltipProps } from './components/Tooltip';
|
|
28
36
|
export type { BaseProps, BaseAttributes } from './general_types';
|
|
29
37
|
export { configure } from './jsx-runtime';
|
|
30
38
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2,14 +2,22 @@ import { Progress } from "./components/Progress";
|
|
|
2
2
|
import { Text } from "./components/Text";
|
|
3
3
|
import { Title } from "./components/Title";
|
|
4
4
|
import { Icon } from "./components/Icon";
|
|
5
|
+
import { Button } from "./components/Button";
|
|
5
6
|
import { ICON_SHAPES, ICON_SYNONYMS } from "./elements/a-icon.shapes";
|
|
7
|
+
import { Sticker } from "./components/Sticker";
|
|
8
|
+
import { StickerAnimated } from "./components/StickerAnimated";
|
|
9
|
+
import { Tooltip } from "./components/Tooltip";
|
|
6
10
|
import { configure } from "./jsx-runtime";
|
|
7
11
|
export {
|
|
12
|
+
Button,
|
|
8
13
|
ICON_SHAPES,
|
|
9
14
|
ICON_SYNONYMS,
|
|
10
15
|
Icon,
|
|
11
16
|
Progress,
|
|
17
|
+
Sticker,
|
|
18
|
+
StickerAnimated,
|
|
12
19
|
Text,
|
|
13
20
|
Title,
|
|
21
|
+
Tooltip,
|
|
14
22
|
configure
|
|
15
23
|
};
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare function configure(jsx: JsxFunction, Fragment?: ComponentType): v
|
|
|
22
22
|
export declare function jsx(type: ComponentType, props: Record<string, unknown> | null, key?: string | number): unknown;
|
|
23
23
|
export declare function jsxs(type: ComponentType, props: Record<string, unknown> | null, key?: string | number): unknown;
|
|
24
24
|
export { _Fragment as Fragment };
|
|
25
|
-
import type { AProgressAttributes, ATextAttributes, ATitleAttributes, AIconAttributes, BaseAttributes } from './general_types';
|
|
25
|
+
import type { AProgressAttributes, ATextAttributes, ATitleAttributes, AIconAttributes, AButtonAttributes, AStickerAttributes, AStickerAnimatedAttributes, ATooltipAttributes, BaseAttributes } from './general_types';
|
|
26
26
|
export declare namespace JSX {
|
|
27
27
|
type IntrinsicElements = React.JSX.IntrinsicElements & {
|
|
28
28
|
'a-progress': AProgressAttributes;
|
|
@@ -33,5 +33,10 @@ export declare namespace JSX {
|
|
|
33
33
|
'a-text': ATextAttributes;
|
|
34
34
|
'a-title': ATitleAttributes;
|
|
35
35
|
'a-icon': AIconAttributes;
|
|
36
|
+
'a-button': AButtonAttributes;
|
|
37
|
+
'a-button-label': BaseAttributes;
|
|
38
|
+
'a-sticker': AStickerAttributes;
|
|
39
|
+
'a-sticker-animated': AStickerAnimatedAttributes;
|
|
40
|
+
'a-tooltip': ATooltipAttributes;
|
|
36
41
|
};
|
|
37
42
|
}
|
package/dist/reset.css
CHANGED
|
@@ -72,6 +72,12 @@
|
|
|
72
72
|
font-weight: 600;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/* Keep inline `<code>` from inflating the line box of the prose it
|
|
76
|
+
sits in — `1em` pins its line height to its own font size. */
|
|
77
|
+
code {
|
|
78
|
+
line-height: 1em;
|
|
79
|
+
}
|
|
80
|
+
|
|
75
81
|
/* Prose lists (ul, ol) get a tight 3ch left padding so markers
|
|
76
82
|
hug the text, and items get a small bottom margin so
|
|
77
83
|
consecutive ones breathe. Markers are toned all the way down
|
|
@@ -102,41 +108,38 @@
|
|
|
102
108
|
/* Global link defaults. Hairline underline at 75% alpha;
|
|
103
109
|
underline goes to currentColor (100%) and 1px on hover. Color
|
|
104
110
|
comes from --link-color tokens, which auto-flip in dark mode.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
111
|
+
`:not([role="button"])` excludes anchor-buttons (`<a role="button">`,
|
|
112
|
+
e.g. `<Button href>`): `a:link`/`a:visited` are pseudo-classes with the
|
|
113
|
+
same (0,1,1) specificity as `a[role="button"]`, so without the exclusion
|
|
114
|
+
they'd tie and win on source order, giving buttons link colour +
|
|
115
|
+
underline. Other contexts (nav, headings) still override as needed. */
|
|
116
|
+
a:not([role="button"]),
|
|
117
|
+
a:not([role="button"]):link,
|
|
118
|
+
a:not([role="button"]):visited {
|
|
108
119
|
color: var(--link-color);
|
|
109
120
|
text-decoration: underline;
|
|
110
121
|
text-decoration-style: solid;
|
|
111
|
-
text-decoration-color: color-mix(in
|
|
122
|
+
text-decoration-color: color-mix(in srgb, currentColor 75%, transparent);
|
|
112
123
|
text-decoration-thickness: 0.5px;
|
|
113
124
|
text-underline-offset: 3px;
|
|
114
125
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
keeps the chroma intact: mixing toward `transparent` interpolates
|
|
131
|
-
in OKLCH and pulls L/C toward zero, which washes the result out.
|
|
132
|
-
`calc(c * 1.5)` bumps the saturation modestly above the source
|
|
133
|
-
token so the highlight reads as clearly brand-coloured rather
|
|
134
|
-
than a neutral grey. No `color` override on the selection, so
|
|
135
|
-
the selected text keeps its original color and contrast is
|
|
136
|
-
preserved automatically. `--text-1-brand` inverts between light
|
|
137
|
-
and dark, so the effect tracks the active palette unaided. */
|
|
126
|
+
/* Hover only on real-pointer devices — gating avoids the sticky hover
|
|
127
|
+
color that lingers after a tap on touch screens. */
|
|
128
|
+
@media (hover: hover) and (pointer: fine) {
|
|
129
|
+
a:not([role="button"]):hover {
|
|
130
|
+
color: var(--link-color-hover);
|
|
131
|
+
/* Underline color is left as the resting hairline (the base rule's
|
|
132
|
+
`currentColor` mix) — only the thickness grows on hover. */
|
|
133
|
+
text-decoration-thickness: 1px;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
a:not([role="button"]):active {
|
|
137
|
+
text-decoration-color: color-mix(in srgb, currentColor 75%, transparent);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* Text selection — brand color at 15% alpha. */
|
|
138
141
|
::selection {
|
|
139
|
-
background:
|
|
142
|
+
background: color-mix(in srgb, var(--text-1-brand), transparent 85%);
|
|
140
143
|
}
|
|
141
144
|
|
|
142
145
|
/* ───── Tables ───────────────────────────────────────────────── */
|