@anyknown/ui 0.7.0 → 0.8.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.
Files changed (59) hide show
  1. package/README.md +7 -8
  2. package/dist/brand.css +101 -214
  3. package/dist/components/button/Button.d.ts +3 -2
  4. package/dist/components/button/Button.js +32 -48
  5. package/dist/components/checkbox/Checkbox.js +24 -48
  6. package/dist/components/dialog/Dialog.js +1 -1
  7. package/dist/components/empty-state/EmptyState.js +1 -1
  8. package/dist/components/ghost/Ghost.d.ts +16 -0
  9. package/dist/components/ghost/Ghost.js +50 -0
  10. package/dist/components/group/Group.d.ts +66 -0
  11. package/dist/components/group/Group.js +166 -0
  12. package/dist/components/handoff-receipt/HandoffReceipt.js +12 -42
  13. package/dist/components/icon/Chevron.d.ts +9 -0
  14. package/dist/components/icon/Chevron.js +6 -0
  15. package/dist/components/icon/icon.d.ts +35 -0
  16. package/dist/components/icon/icon.js +10 -0
  17. package/dist/components/icon-button/IconButton.d.ts +17 -0
  18. package/dist/components/icon-button/IconButton.js +66 -0
  19. package/dist/components/input/Input.d.ts +3 -1
  20. package/dist/components/input/Input.js +3 -2
  21. package/dist/components/page/Page.d.ts +64 -0
  22. package/dist/components/page/Page.js +163 -0
  23. package/dist/components/popover/Popover.js +1 -1
  24. package/dist/components/progress/Progress.js +49 -104
  25. package/dist/components/radio/Radio.js +17 -28
  26. package/dist/components/segmented/Segmented.d.ts +12 -0
  27. package/dist/components/segmented/Segmented.js +43 -0
  28. package/dist/components/settings-rows/SettingsRows.d.ts +25 -0
  29. package/dist/components/settings-rows/SettingsRows.js +63 -0
  30. package/dist/components/spin/Spin.d.ts +5 -0
  31. package/dist/components/spin/Spin.js +25 -0
  32. package/dist/components/status-chip/StatusChip.d.ts +18 -0
  33. package/dist/components/status-chip/StatusChip.js +68 -0
  34. package/dist/components/switch/Switch.js +20 -63
  35. package/dist/components/table/Table.d.ts +39 -0
  36. package/dist/components/table/Table.js +125 -0
  37. package/dist/components/table/TableCells.d.ts +52 -0
  38. package/dist/components/table/TableCells.js +103 -0
  39. package/dist/components/tabs/Tabs.js +16 -48
  40. package/dist/components/text/Text.js +2 -2
  41. package/dist/components/toast/Toast.js +7 -8
  42. package/dist/index.d.ts +11 -0
  43. package/dist/index.js +11 -0
  44. package/dist/themes.stylex.d.ts +33 -496
  45. package/dist/themes.stylex.js +25 -253
  46. package/dist/tokens.css +53 -126
  47. package/dist/tokens.stylex.d.ts +36 -54
  48. package/dist/tokens.stylex.js +62 -90
  49. package/package.json +1 -1
  50. package/dist/lib/paths.d.ts +0 -3
  51. package/dist/lib/paths.js +0 -11
  52. package/dist/lib/progress.d.ts +0 -2
  53. package/dist/lib/progress.js +0 -28
  54. package/dist/lib/silk.d.ts +0 -66
  55. package/dist/lib/silk.js +0 -337
  56. package/dist/lib/svgId.d.ts +0 -1
  57. package/dist/lib/svgId.js +0 -4
  58. package/dist/lib/weave.d.ts +0 -28
  59. package/dist/lib/weave.js +0 -83
@@ -1,28 +0,0 @@
1
- export declare const WEAVE_SEED = 10075;
2
- export type Rand = (a: number, b: number) => number;
3
- export declare function weaveRand(seed?: number): Rand;
4
- export interface Strand {
5
- d: string;
6
- sw: string;
7
- }
8
- export interface FaceStrand extends Strand {
9
- bucket: 0 | 1 | 2 | 3 | 4;
10
- }
11
- export interface WeaveLayers {
12
- under: Strand[];
13
- seams: Strand[];
14
- face: FaceStrand[];
15
- hi: Strand[];
16
- }
17
- export interface WeaveOptions {
18
- w: number;
19
- h: number;
20
- s?: number;
21
- ox?: number;
22
- oy?: number;
23
- pitch?: number;
24
- hiCount?: number;
25
- hiSpan?: number;
26
- }
27
- export declare function buildWeave(opts: WeaveOptions, rand: Rand): WeaveLayers;
28
- export declare function buildThread(pts: [number, number][], rand: Rand): string;
package/dist/lib/weave.js DELETED
@@ -1,83 +0,0 @@
1
- // 織體幾何(TEXTURE-GUIDE §3):固定種子 → 同尺寸恆定的布。
2
- // 純函式、無 DOM,可在 module scope 預算(SSR 安全)。
3
- // 參考實作:components/button/prototype.html(唯一真相)。
4
- export const WEAVE_SEED = 10075;
5
- function mulberry32(seed) {
6
- let a = seed >>> 0;
7
- return () => {
8
- a |= 0;
9
- a = (a + 0x6d2b79f5) | 0;
10
- let t = Math.imul(a ^ (a >>> 15), 1 | a);
11
- t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
12
- return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
13
- };
14
- }
15
- // 一個元件一支 rand:weave 與縫線依序消費同一序列,織法才與 prototype 完全一致
16
- export function weaveRand(seed = WEAVE_SEED) {
17
- const rng = mulberry32(seed);
18
- return (a, b) => a + rng() * (b - a);
19
- }
20
- export function buildWeave(opts, rand) {
21
- const { w, h, s = 1, ox = 0, oy = 0, pitch = 1.2, hiCount = 4, hiSpan = 0.6 } = opts;
22
- // 共享波場:兩支長波,相位隨 y 緩慢滑移(§3.2,參數順序照抄)
23
- const W1 = rand(Math.max(120, w * 0.9), w * 1.8);
24
- const A1 = rand(1.0, 1.8);
25
- const P1 = rand(0, 6.28);
26
- const K1 = rand(0.05, 0.11);
27
- const W2 = rand(w * 1.6, w * 3);
28
- const A2 = rand(0.5, 0.9);
29
- const P2 = rand(0, 6.28);
30
- const K2 = rand(0.03, 0.07);
31
- const field = (x, y) => A1 * Math.sin((x / W1) * 6.283 + P1 + y * K1) + A2 * Math.sin((x / W2) * 6.283 + P2 + y * K2);
32
- // 取樣超出左右邊界 4px,由 clip 裁形(右緣不因 w 非 4 倍數缺一截)
33
- const staticD = (y0) => {
34
- let d = "";
35
- for (let x = -4; x <= w + 4; x += 4)
36
- d += `${d ? "L" : "M"}${((ox + x) * s).toFixed(2)},${((oy + y0 + field(x, y0)) * s).toFixed(2)}`;
37
- return d;
38
- };
39
- const under = [];
40
- for (let y = -0.8; y < h + 2.6; y += 1.5)
41
- under.push({ d: staticD(y), sw: (3.4 * s).toFixed(2) });
42
- const seams = [];
43
- for (let y = 1.6; y < h + 1; y += 2.4)
44
- seams.push({ d: staticD(y), sw: (rand(0.5, 0.8) * s).toFixed(2) });
45
- const face = [];
46
- for (let y = 0.6; y < h + 1; y += pitch + rand(-0.15, 0.15)) {
47
- const bucket = Math.min(4, Math.max(0, Math.round(4.2 - (y / h) * 3 + rand(-0.9, 0.9))));
48
- face.push({ d: staticD(y), sw: (rand(0.6, 1.4) * s).toFixed(2), bucket });
49
- }
50
- const hi = [];
51
- for (let i = 0; i < hiCount; i++) {
52
- const y = rand(2, h * hiSpan);
53
- hi.push({ d: staticD(y), sw: (rand(0.4, 0.7) * s).toFixed(2) });
54
- }
55
- return { under, seams, face, hi };
56
- }
57
- // 縫線(checkbox 的勾/橫線):折線沿弧長疊一支長波的法向微彎 — 勾也是線,不是平面 icon
58
- export function buildThread(pts, rand) {
59
- const samples = [];
60
- let L = 0;
61
- for (let i = 0; i < pts.length - 1; i++) {
62
- const [x0, y0] = pts[i];
63
- const [x1, y1] = pts[i + 1];
64
- const len = Math.hypot(x1 - x0, y1 - y0);
65
- const nx = -(y1 - y0) / len;
66
- const ny = (x1 - x0) / len;
67
- const n = Math.ceil(len);
68
- for (let j = i === 0 ? 0 : 1; j <= n; j++) {
69
- const t = j / n;
70
- samples.push({ x: x0 + (x1 - x0) * t, y: y0 + (y1 - y0) * t, nx, ny, l: L + len * t });
71
- }
72
- L += len;
73
- }
74
- const A = rand(0.25, 0.45);
75
- const WL = rand(L * 1.2, L * 2);
76
- const PH = rand(0, 6.28);
77
- let d = "";
78
- for (const p of samples) {
79
- const off = A * Math.sin((p.l / WL) * 6.283 + PH);
80
- d += `${d ? "L" : "M"}${(p.x + p.nx * off).toFixed(2)},${(p.y + p.ny * off).toFixed(2)}`;
81
- }
82
- return d;
83
- }