@yugnex/nexui 2.0.0

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 (138) hide show
  1. package/LICENSE +59 -0
  2. package/css/nexui-base.css +157 -0
  3. package/css/nexui-icons.css +86 -0
  4. package/css/nexui-tokens.css +113 -0
  5. package/css/nexui.css +16 -0
  6. package/dist/assets/geometry.d.ts +98 -0
  7. package/dist/assets/geometry.d.ts.map +1 -0
  8. package/dist/assets/geometry.js +114 -0
  9. package/dist/assets/geometry.js.map +1 -0
  10. package/dist/assets/typography.d.ts +3 -0
  11. package/dist/assets/typography.d.ts.map +1 -0
  12. package/dist/assets/typography.js +178 -0
  13. package/dist/assets/typography.js.map +1 -0
  14. package/dist/core/compiler.d.ts +30 -0
  15. package/dist/core/compiler.d.ts.map +1 -0
  16. package/dist/core/compiler.js +124 -0
  17. package/dist/core/compiler.js.map +1 -0
  18. package/dist/core/cx.d.ts +7 -0
  19. package/dist/core/cx.d.ts.map +1 -0
  20. package/dist/core/cx.js +34 -0
  21. package/dist/core/cx.js.map +1 -0
  22. package/dist/core/matrix.d.ts +118 -0
  23. package/dist/core/matrix.d.ts.map +1 -0
  24. package/dist/core/matrix.js +180 -0
  25. package/dist/core/matrix.js.map +1 -0
  26. package/dist/index.d.ts +27 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +74 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/primitives/avatar.d.ts +8 -0
  31. package/dist/primitives/avatar.d.ts.map +1 -0
  32. package/dist/primitives/avatar.js +146 -0
  33. package/dist/primitives/avatar.js.map +1 -0
  34. package/dist/primitives/badge.d.ts +8 -0
  35. package/dist/primitives/badge.d.ts.map +1 -0
  36. package/dist/primitives/badge.js +88 -0
  37. package/dist/primitives/badge.js.map +1 -0
  38. package/dist/primitives/button.d.ts +10 -0
  39. package/dist/primitives/button.d.ts.map +1 -0
  40. package/dist/primitives/button.js +137 -0
  41. package/dist/primitives/button.js.map +1 -0
  42. package/dist/primitives/checkbox.d.ts +13 -0
  43. package/dist/primitives/checkbox.d.ts.map +1 -0
  44. package/dist/primitives/checkbox.js +107 -0
  45. package/dist/primitives/checkbox.js.map +1 -0
  46. package/dist/primitives/input.d.ts +14 -0
  47. package/dist/primitives/input.d.ts.map +1 -0
  48. package/dist/primitives/input.js +177 -0
  49. package/dist/primitives/input.js.map +1 -0
  50. package/dist/primitives/panel.d.ts +9 -0
  51. package/dist/primitives/panel.d.ts.map +1 -0
  52. package/dist/primitives/panel.js +101 -0
  53. package/dist/primitives/panel.js.map +1 -0
  54. package/dist/primitives/progress.d.ts +8 -0
  55. package/dist/primitives/progress.d.ts.map +1 -0
  56. package/dist/primitives/progress.js +105 -0
  57. package/dist/primitives/progress.js.map +1 -0
  58. package/dist/primitives/separator.d.ts +8 -0
  59. package/dist/primitives/separator.d.ts.map +1 -0
  60. package/dist/primitives/separator.js +69 -0
  61. package/dist/primitives/separator.js.map +1 -0
  62. package/dist/primitives/skeleton.d.ts +8 -0
  63. package/dist/primitives/skeleton.d.ts.map +1 -0
  64. package/dist/primitives/skeleton.js +61 -0
  65. package/dist/primitives/skeleton.js.map +1 -0
  66. package/dist/primitives/spinner.d.ts +8 -0
  67. package/dist/primitives/spinner.d.ts.map +1 -0
  68. package/dist/primitives/spinner.js +64 -0
  69. package/dist/primitives/spinner.js.map +1 -0
  70. package/dist/primitives/status-ring.d.ts +8 -0
  71. package/dist/primitives/status-ring.d.ts.map +1 -0
  72. package/dist/primitives/status-ring.js +101 -0
  73. package/dist/primitives/status-ring.js.map +1 -0
  74. package/dist/primitives/switch.d.ts +12 -0
  75. package/dist/primitives/switch.d.ts.map +1 -0
  76. package/dist/primitives/switch.js +124 -0
  77. package/dist/primitives/switch.js.map +1 -0
  78. package/dist/primitives/text-stream.d.ts +23 -0
  79. package/dist/primitives/text-stream.d.ts.map +1 -0
  80. package/dist/primitives/text-stream.js +167 -0
  81. package/dist/primitives/text-stream.js.map +1 -0
  82. package/dist/tokens/colors.d.ts +127 -0
  83. package/dist/tokens/colors.d.ts.map +1 -0
  84. package/dist/tokens/colors.js +135 -0
  85. package/dist/tokens/colors.js.map +1 -0
  86. package/dist/tokens/motion.d.ts +37 -0
  87. package/dist/tokens/motion.d.ts.map +1 -0
  88. package/dist/tokens/motion.js +93 -0
  89. package/dist/tokens/motion.js.map +1 -0
  90. package/dist/tokens/shadows.d.ts +34 -0
  91. package/dist/tokens/shadows.d.ts.map +1 -0
  92. package/dist/tokens/shadows.js +45 -0
  93. package/dist/tokens/shadows.js.map +1 -0
  94. package/dist/tokens/spacing.d.ts +69 -0
  95. package/dist/tokens/spacing.d.ts.map +1 -0
  96. package/dist/tokens/spacing.js +71 -0
  97. package/dist/tokens/spacing.js.map +1 -0
  98. package/dist/tokens/type.d.ts +166 -0
  99. package/dist/tokens/type.d.ts.map +1 -0
  100. package/dist/tokens/type.js +215 -0
  101. package/dist/tokens/type.js.map +1 -0
  102. package/fonts/NexuiIcons.woff2 +0 -0
  103. package/fonts/NexuiMono-Regular.otf +0 -0
  104. package/fonts/NexuiMono-Regular.woff2 +0 -0
  105. package/fonts/NexuiSans-Bold.otf +0 -0
  106. package/fonts/NexuiSans-Bold.woff2 +0 -0
  107. package/fonts/NexuiSans-Medium.otf +0 -0
  108. package/fonts/NexuiSans-Medium.woff2 +0 -0
  109. package/fonts/NexuiSans-Regular.otf +0 -0
  110. package/fonts/NexuiSans-Regular.woff2 +0 -0
  111. package/native/Cargo.toml +16 -0
  112. package/native/src/lib.rs +127 -0
  113. package/nexui-utils.css +485 -0
  114. package/package.json +58 -0
  115. package/src/assets/geometry.ts +144 -0
  116. package/src/assets/typography.ts +184 -0
  117. package/src/core/compiler.ts +139 -0
  118. package/src/core/cx.ts +50 -0
  119. package/src/core/matrix.ts +195 -0
  120. package/src/index.ts +78 -0
  121. package/src/primitives/avatar.ts +159 -0
  122. package/src/primitives/badge.ts +98 -0
  123. package/src/primitives/button.ts +149 -0
  124. package/src/primitives/checkbox.ts +113 -0
  125. package/src/primitives/input.ts +187 -0
  126. package/src/primitives/panel.ts +111 -0
  127. package/src/primitives/progress.ts +112 -0
  128. package/src/primitives/separator.ts +73 -0
  129. package/src/primitives/skeleton.ts +68 -0
  130. package/src/primitives/spinner.ts +71 -0
  131. package/src/primitives/status-ring.ts +109 -0
  132. package/src/primitives/switch.ts +134 -0
  133. package/src/primitives/text-stream.ts +187 -0
  134. package/src/tokens/colors.ts +149 -0
  135. package/src/tokens/motion.ts +97 -0
  136. package/src/tokens/shadows.ts +58 -0
  137. package/src/tokens/spacing.ts +79 -0
  138. package/src/tokens/type.ts +224 -0
@@ -0,0 +1,180 @@
1
+ // @yugnex/nexui — Layout Matrix
2
+ // Encodes layout intent as a composable 32-bit bitmask.
3
+ // Bits 0-3: padding · Bits 4-7: flex/display · Bits 8-11: border-radius
4
+ // Bits 12-15: gap · Bits 16-19: width · Bits 20-23: overflow
5
+ // Compose with bitwise OR: PAD_MD | FLEX_ROW | ALIGN_CENTER | RAD_MD
6
+ export var LayoutMatrix;
7
+ (function (LayoutMatrix) {
8
+ // Padding (bits 0-3)
9
+ LayoutMatrix[LayoutMatrix["PAD_NONE"] = 0] = "PAD_NONE";
10
+ LayoutMatrix[LayoutMatrix["PAD_XS"] = 1] = "PAD_XS";
11
+ LayoutMatrix[LayoutMatrix["PAD_SM"] = 2] = "PAD_SM";
12
+ LayoutMatrix[LayoutMatrix["PAD_MD"] = 3] = "PAD_MD";
13
+ LayoutMatrix[LayoutMatrix["PAD_LG"] = 4] = "PAD_LG";
14
+ LayoutMatrix[LayoutMatrix["PAD_XL"] = 5] = "PAD_XL";
15
+ LayoutMatrix[LayoutMatrix["PAD_2XL"] = 6] = "PAD_2XL";
16
+ // Display / Flex direction (bits 4-7)
17
+ LayoutMatrix[LayoutMatrix["FLEX_ROW"] = 16] = "FLEX_ROW";
18
+ LayoutMatrix[LayoutMatrix["FLEX_COL"] = 32] = "FLEX_COL";
19
+ LayoutMatrix[LayoutMatrix["GRID_2"] = 48] = "GRID_2";
20
+ LayoutMatrix[LayoutMatrix["GRID_3"] = 64] = "GRID_3";
21
+ LayoutMatrix[LayoutMatrix["GRID_4"] = 80] = "GRID_4";
22
+ // Alignment (bits 5-6 override when used with FLEX_*)
23
+ LayoutMatrix[LayoutMatrix["ALIGN_START"] = 96] = "ALIGN_START";
24
+ LayoutMatrix[LayoutMatrix["ALIGN_CENTER"] = 112] = "ALIGN_CENTER";
25
+ LayoutMatrix[LayoutMatrix["ALIGN_END"] = 128] = "ALIGN_END";
26
+ LayoutMatrix[LayoutMatrix["ALIGN_STRETCH"] = 144] = "ALIGN_STRETCH";
27
+ // Justify content (bits 6-7 secondary)
28
+ LayoutMatrix[LayoutMatrix["JUSTIFY_START"] = 160] = "JUSTIFY_START";
29
+ LayoutMatrix[LayoutMatrix["JUSTIFY_CENTER"] = 176] = "JUSTIFY_CENTER";
30
+ LayoutMatrix[LayoutMatrix["JUSTIFY_END"] = 192] = "JUSTIFY_END";
31
+ LayoutMatrix[LayoutMatrix["JUSTIFY_BET"] = 208] = "JUSTIFY_BET";
32
+ LayoutMatrix[LayoutMatrix["JUSTIFY_AROUND"] = 224] = "JUSTIFY_AROUND";
33
+ LayoutMatrix[LayoutMatrix["JUSTIFY_EVEN"] = 240] = "JUSTIFY_EVEN";
34
+ // Border radius (bits 8-11)
35
+ LayoutMatrix[LayoutMatrix["RAD_NONE"] = 0] = "RAD_NONE";
36
+ LayoutMatrix[LayoutMatrix["RAD_XS"] = 256] = "RAD_XS";
37
+ LayoutMatrix[LayoutMatrix["RAD_SM"] = 512] = "RAD_SM";
38
+ LayoutMatrix[LayoutMatrix["RAD_MD"] = 768] = "RAD_MD";
39
+ LayoutMatrix[LayoutMatrix["RAD_LG"] = 1024] = "RAD_LG";
40
+ LayoutMatrix[LayoutMatrix["RAD_XL"] = 1280] = "RAD_XL";
41
+ LayoutMatrix[LayoutMatrix["RAD_2XL"] = 1536] = "RAD_2XL";
42
+ LayoutMatrix[LayoutMatrix["RAD_FULL"] = 1792] = "RAD_FULL";
43
+ // Gap (bits 12-15)
44
+ LayoutMatrix[LayoutMatrix["GAP_NONE"] = 0] = "GAP_NONE";
45
+ LayoutMatrix[LayoutMatrix["GAP_XS"] = 4096] = "GAP_XS";
46
+ LayoutMatrix[LayoutMatrix["GAP_SM"] = 8192] = "GAP_SM";
47
+ LayoutMatrix[LayoutMatrix["GAP_MD"] = 12288] = "GAP_MD";
48
+ LayoutMatrix[LayoutMatrix["GAP_LG"] = 16384] = "GAP_LG";
49
+ LayoutMatrix[LayoutMatrix["GAP_XL"] = 20480] = "GAP_XL";
50
+ // Width (bits 16-19)
51
+ LayoutMatrix[LayoutMatrix["W_AUTO"] = 0] = "W_AUTO";
52
+ LayoutMatrix[LayoutMatrix["W_FULL"] = 65536] = "W_FULL";
53
+ LayoutMatrix[LayoutMatrix["W_SCREEN"] = 131072] = "W_SCREEN";
54
+ LayoutMatrix[LayoutMatrix["W_FIT"] = 196608] = "W_FIT";
55
+ LayoutMatrix[LayoutMatrix["W_MIN"] = 262144] = "W_MIN";
56
+ LayoutMatrix[LayoutMatrix["W_MAX"] = 327680] = "W_MAX";
57
+ // Overflow (bits 20-23)
58
+ LayoutMatrix[LayoutMatrix["OVERFLOW_VIS"] = 0] = "OVERFLOW_VIS";
59
+ LayoutMatrix[LayoutMatrix["OVERFLOW_HIDDEN"] = 1048576] = "OVERFLOW_HIDDEN";
60
+ LayoutMatrix[LayoutMatrix["OVERFLOW_AUTO"] = 2097152] = "OVERFLOW_AUTO";
61
+ LayoutMatrix[LayoutMatrix["OVERFLOW_SCROLL"] = 3145728] = "OVERFLOW_SCROLL";
62
+ })(LayoutMatrix || (LayoutMatrix = {}));
63
+ // Maps bitmask bits to CSS strings — used by the compiler
64
+ export const MATRIX_PAD_MAP = {
65
+ 0x1: "padding:0.25rem;",
66
+ 0x2: "padding:0.5rem;",
67
+ 0x3: "padding:0.75rem;",
68
+ 0x4: "padding:1rem;",
69
+ 0x5: "padding:1.5rem;",
70
+ 0x6: "padding:2rem;",
71
+ };
72
+ export const MATRIX_DISPLAY_MAP = {
73
+ 0x10: "display:flex;flex-direction:row;",
74
+ 0x20: "display:flex;flex-direction:column;",
75
+ 0x30: "display:grid;grid-template-columns:repeat(2,1fr);",
76
+ 0x40: "display:grid;grid-template-columns:repeat(3,1fr);",
77
+ 0x50: "display:grid;grid-template-columns:repeat(4,1fr);",
78
+ 0x60: "align-items:flex-start;",
79
+ 0x70: "align-items:center;",
80
+ 0x80: "align-items:flex-end;",
81
+ 0x90: "align-items:stretch;",
82
+ 0xA0: "justify-content:flex-start;",
83
+ 0xB0: "justify-content:center;",
84
+ 0xC0: "justify-content:flex-end;",
85
+ 0xD0: "justify-content:space-between;",
86
+ 0xE0: "justify-content:space-around;",
87
+ 0xF0: "justify-content:space-evenly;",
88
+ };
89
+ export const MATRIX_RADIUS_MAP = {
90
+ 0x100: "border-radius:2px;",
91
+ 0x200: "border-radius:4px;",
92
+ 0x300: "border-radius:6px;",
93
+ 0x400: "border-radius:8px;",
94
+ 0x500: "border-radius:12px;",
95
+ 0x600: "border-radius:16px;",
96
+ 0x700: "border-radius:9999px;",
97
+ };
98
+ export const MATRIX_GAP_MAP = {
99
+ 0x1000: "gap:0.25rem;",
100
+ 0x2000: "gap:0.5rem;",
101
+ 0x3000: "gap:1rem;",
102
+ 0x4000: "gap:1.5rem;",
103
+ 0x5000: "gap:2rem;",
104
+ };
105
+ export const MATRIX_WIDTH_MAP = {
106
+ 0x10000: "width:100%;",
107
+ 0x20000: "width:100vw;",
108
+ 0x30000: "width:fit-content;",
109
+ 0x40000: "width:min-content;",
110
+ 0x50000: "width:max-content;",
111
+ };
112
+ export const MATRIX_OVERFLOW_MAP = {
113
+ 0x100000: "overflow:hidden;",
114
+ 0x200000: "overflow:auto;",
115
+ 0x300000: "overflow:scroll;",
116
+ };
117
+ // Theme token maps — CSS custom property to value
118
+ export const NEXUI_THEMES = {
119
+ void: {
120
+ "--nx-bg-void": "#05070C",
121
+ "--nx-bg-base": "#0D1117",
122
+ "--nx-bg-surface": "#161B22",
123
+ "--nx-bg-elevated": "#1C2128",
124
+ "--nx-bg-overlay": "#21262D",
125
+ "--nx-border": "rgba(255,255,255,0.08)",
126
+ "--nx-border-strong": "rgba(255,255,255,0.16)",
127
+ "--nx-border-focus": "rgba(232,144,16,0.60)",
128
+ "--nx-text": "#E6EDF3",
129
+ "--nx-text-2": "#8B949E",
130
+ "--nx-text-3": "#6E7681",
131
+ "--nx-text-4": "#484F58",
132
+ "--nx-text-inv": "#05070C",
133
+ "--nx-accent": "#E89010",
134
+ "--nx-accent-dim": "rgba(232,144,16,0.09)",
135
+ "--nx-accent-border": "rgba(232,144,16,0.22)",
136
+ "--nx-accent-text": "#F5B342",
137
+ "--nx-live": "#0FD4C6",
138
+ "--nx-live-dim": "rgba(15,212,198,0.09)",
139
+ "--nx-live-border": "rgba(15,212,198,0.22)",
140
+ "--nx-success": "#22C55E",
141
+ "--nx-success-dim": "rgba(34,197,94,0.10)",
142
+ "--nx-error": "#EF4444",
143
+ "--nx-error-dim": "rgba(239,68,68,0.10)",
144
+ "--nx-warning": "#EAB308",
145
+ "--nx-warning-dim": "rgba(234,179,8,0.10)",
146
+ "--nx-font-sans": "'NexuiSans','Inter',system-ui,-apple-system,sans-serif",
147
+ "--nx-font-mono": "'NexuiMono','JetBrains Mono','Fira Code',ui-monospace,monospace",
148
+ },
149
+ terminal: {
150
+ "--nx-bg-void": "#000000",
151
+ "--nx-bg-base": "#050505",
152
+ "--nx-bg-surface": "#0C0E12",
153
+ "--nx-bg-elevated": "#111418",
154
+ "--nx-bg-overlay": "#161B22",
155
+ "--nx-border": "#1E293B",
156
+ "--nx-border-strong": "#2D3748",
157
+ "--nx-border-focus": "rgba(16,185,129,0.60)",
158
+ "--nx-text": "#10B981",
159
+ "--nx-text-2": "#6EE7B7",
160
+ "--nx-text-3": "#34D399",
161
+ "--nx-text-4": "#065F46",
162
+ "--nx-text-inv": "#000000",
163
+ "--nx-accent": "#E89010",
164
+ "--nx-accent-dim": "rgba(232,144,16,0.09)",
165
+ "--nx-accent-border": "rgba(232,144,16,0.22)",
166
+ "--nx-accent-text": "#F5B342",
167
+ "--nx-live": "#10B981",
168
+ "--nx-live-dim": "rgba(16,185,129,0.09)",
169
+ "--nx-live-border": "rgba(16,185,129,0.22)",
170
+ "--nx-success": "#10B981",
171
+ "--nx-success-dim": "rgba(16,185,129,0.10)",
172
+ "--nx-error": "#EF4444",
173
+ "--nx-error-dim": "rgba(239,68,68,0.10)",
174
+ "--nx-warning": "#EAB308",
175
+ "--nx-warning-dim": "rgba(234,179,8,0.10)",
176
+ "--nx-font-sans": "'NexuiMono','JetBrains Mono',ui-monospace,monospace",
177
+ "--nx-font-mono": "'NexuiMono','JetBrains Mono',ui-monospace,monospace",
178
+ },
179
+ };
180
+ //# sourceMappingURL=matrix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matrix.js","sourceRoot":"","sources":["../../src/core/matrix.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,wDAAwD;AACxD,wEAAwE;AACxE,6DAA6D;AAC7D,qEAAqE;AAErE,MAAM,CAAN,IAAkB,YA8DjB;AA9DD,WAAkB,YAAY;IAC5B,qBAAqB;IACrB,uDAAgB,CAAA;IAChB,mDAAgB,CAAA;IAChB,mDAAgB,CAAA;IAChB,mDAAgB,CAAA;IAChB,mDAAgB,CAAA;IAChB,mDAAgB,CAAA;IAChB,qDAAgB,CAAA;IAEhB,sCAAsC;IACtC,wDAAiB,CAAA;IACjB,wDAAiB,CAAA;IACjB,oDAAiB,CAAA;IACjB,oDAAiB,CAAA;IACjB,oDAAiB,CAAA;IAEjB,sDAAsD;IACtD,8DAAoB,CAAA;IACpB,iEAAoB,CAAA;IACpB,2DAAoB,CAAA;IACpB,mEAAoB,CAAA;IAEpB,uCAAuC;IACvC,mEAAqB,CAAA;IACrB,qEAAqB,CAAA;IACrB,+DAAqB,CAAA;IACrB,+DAAqB,CAAA;IACr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AAC"}
@@ -0,0 +1,27 @@
1
+ export * from "./tokens/colors";
2
+ export * from "./tokens/spacing";
3
+ export * from "./tokens/motion";
4
+ export * from "./tokens/shadows";
5
+ export * from "./tokens/type";
6
+ export * from "./core/matrix";
7
+ export * from "./core/compiler";
8
+ export * from "./core/cx";
9
+ export * from "./assets/typography";
10
+ export * from "./assets/geometry";
11
+ export { NexPanel } from "./primitives/panel";
12
+ export { NexStatusRing } from "./primitives/status-ring";
13
+ export { NexTextStream } from "./primitives/text-stream";
14
+ export { NexButton } from "./primitives/button";
15
+ export { NexBadge } from "./primitives/badge";
16
+ export { NexInput } from "./primitives/input";
17
+ export { NexAvatar } from "./primitives/avatar";
18
+ export { NexProgress } from "./primitives/progress";
19
+ export { NexSwitch } from "./primitives/switch";
20
+ export { NexCheckbox } from "./primitives/checkbox";
21
+ export { NexSkeleton } from "./primitives/skeleton";
22
+ export { NexSeparator } from "./primitives/separator";
23
+ export { NexSpinner } from "./primitives/spinner";
24
+ import type { NexuiTheme } from "./core/matrix";
25
+ export declare function initializeNexuiEngine(defaultTheme?: NexuiTheme): Promise<void>;
26
+ export declare function setNexuiTheme(theme: NexuiTheme): void;
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAW,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAU,qBAAqB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAW,oBAAoB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAW,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAU,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAQ,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAU,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAQ,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAQ,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAO,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAS,sBAAsB,CAAC;AAiBrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAkBhD,wBAAsB,qBAAqB,CAAC,YAAY,GAAE,UAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAY5F;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAGrD"}
package/dist/index.js ADDED
@@ -0,0 +1,74 @@
1
+ // @yugnex/nexui — Main Entry Point v2.0
2
+ export * from "./tokens/colors";
3
+ export * from "./tokens/spacing";
4
+ export * from "./tokens/motion";
5
+ export * from "./tokens/shadows";
6
+ export * from "./tokens/type";
7
+ export * from "./core/matrix";
8
+ export * from "./core/compiler";
9
+ export * from "./core/cx";
10
+ export * from "./assets/typography";
11
+ export * from "./assets/geometry";
12
+ export { NexPanel } from "./primitives/panel";
13
+ export { NexStatusRing } from "./primitives/status-ring";
14
+ export { NexTextStream } from "./primitives/text-stream";
15
+ export { NexButton } from "./primitives/button";
16
+ export { NexBadge } from "./primitives/badge";
17
+ export { NexInput } from "./primitives/input";
18
+ export { NexAvatar } from "./primitives/avatar";
19
+ export { NexProgress } from "./primitives/progress";
20
+ export { NexSwitch } from "./primitives/switch";
21
+ export { NexCheckbox } from "./primitives/checkbox";
22
+ export { NexSkeleton } from "./primitives/skeleton";
23
+ export { NexSeparator } from "./primitives/separator";
24
+ export { NexSpinner } from "./primitives/spinner";
25
+ import { nexui_compiler } from "./core/compiler";
26
+ import { NexuiTypographySheet } from "./assets/typography";
27
+ import { NexPanel } from "./primitives/panel";
28
+ import { NexStatusRing } from "./primitives/status-ring";
29
+ import { NexTextStream } from "./primitives/text-stream";
30
+ import { NexButton } from "./primitives/button";
31
+ import { NexBadge } from "./primitives/badge";
32
+ import { NexInput } from "./primitives/input";
33
+ import { NexAvatar } from "./primitives/avatar";
34
+ import { NexProgress } from "./primitives/progress";
35
+ import { NexSwitch } from "./primitives/switch";
36
+ import { NexCheckbox } from "./primitives/checkbox";
37
+ import { NexSkeleton } from "./primitives/skeleton";
38
+ import { NexSeparator } from "./primitives/separator";
39
+ import { NexSpinner } from "./primitives/spinner";
40
+ const ELEMENTS = [
41
+ ["nex-panel", NexPanel],
42
+ ["nex-status-ring", NexStatusRing],
43
+ ["nex-text-stream", NexTextStream],
44
+ ["nex-button", NexButton],
45
+ ["nex-badge", NexBadge],
46
+ ["nex-input", NexInput],
47
+ ["nex-avatar", NexAvatar],
48
+ ["nex-progress", NexProgress],
49
+ ["nex-switch", NexSwitch],
50
+ ["nex-checkbox", NexCheckbox],
51
+ ["nex-skeleton", NexSkeleton],
52
+ ["nex-separator", NexSeparator],
53
+ ["nex-spinner", NexSpinner],
54
+ ];
55
+ export async function initializeNexuiEngine(defaultTheme = "void") {
56
+ if (typeof window === "undefined")
57
+ return;
58
+ if (!document.getElementById("yugnex-nexui-typography")) {
59
+ const s = document.createElement("style");
60
+ s.id = "yugnex-nexui-typography";
61
+ s.textContent = NexuiTypographySheet;
62
+ document.head.appendChild(s);
63
+ }
64
+ nexui_compiler.mountGlobalTheme(defaultTheme);
65
+ for (const [tag, ctor] of ELEMENTS) {
66
+ if (!customElements.get(tag))
67
+ customElements.define(tag, ctor);
68
+ }
69
+ }
70
+ export function setNexuiTheme(theme) {
71
+ nexui_compiler.switchTheme(theme);
72
+ window.dispatchEvent(new CustomEvent("nexui:theme-change", { detail: { theme } }));
73
+ }
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAExC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAW,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAU,qBAAqB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAW,oBAAoB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAW,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAU,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAQ,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAU,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAQ,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAQ,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAO,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAS,sBAAsB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;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AC;CAChC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,eAA2B,MAAM;IAC3E,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAC1C,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,yBAAyB,CAAC,EAAE,CAAC;QACxD,MAAM,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC,EAAE,GAAG,yBAAyB,CAAC;QACjC,CAAC,CAAC,WAAW,GAAG,oBAAoB,CAAC;QACrC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IACD,cAAc,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC9C,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,QAAQ,EAAE,CAAC;QACnC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,cAAc,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACjE,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAiB;IAC7C,cAAc,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,oBAAoB,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;AACrF,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare class NexAvatar extends HTMLElement {
2
+ static get observedAttributes(): string[];
3
+ constructor();
4
+ connectedCallback(): void;
5
+ attributeChangedCallback(): void;
6
+ private render;
7
+ }
8
+ //# sourceMappingURL=avatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../src/primitives/avatar.ts"],"names":[],"mappings":"AA2BA,qBAAa,SAAU,SAAQ,WAAW;IACxC,MAAM,KAAK,kBAAkB,aAE5B;;IAOD,iBAAiB;IAIjB,wBAAwB;IAIxB,OAAO,CAAC,MAAM;CAiHf"}
@@ -0,0 +1,146 @@
1
+ // @yugnex/nexui — NexAvatar Web Component
2
+ // User avatar: image with initials fallback + optional status indicator.
3
+ // Attributes:
4
+ // src: image URL
5
+ // name: full name — used for initials and alt text
6
+ // size: xs | sm | md | lg | xl (default: md)
7
+ // status: online | away | busy | offline (optional)
8
+ // shape: circle | square (default: circle)
9
+ import { nexui_compiler } from "../core/compiler";
10
+ function getInitials(name) {
11
+ const parts = name.trim().split(/\s+/).filter(Boolean);
12
+ if (parts.length === 0)
13
+ return "?";
14
+ if (parts.length === 1)
15
+ return parts[0].slice(0, 2).toUpperCase();
16
+ return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
17
+ }
18
+ // Deterministic hue from name string for initials background
19
+ function nameToHue(name) {
20
+ let hash = 0;
21
+ for (let i = 0; i < name.length; i++) {
22
+ hash = (hash * 31 + name.charCodeAt(i)) >>> 0;
23
+ }
24
+ return hash % 360;
25
+ }
26
+ export class NexAvatar extends HTMLElement {
27
+ static get observedAttributes() {
28
+ return ["src", "name", "size", "status", "shape"];
29
+ }
30
+ constructor() {
31
+ super();
32
+ this.attachShadow({ mode: "open" });
33
+ }
34
+ connectedCallback() {
35
+ this.render();
36
+ }
37
+ attributeChangedCallback() {
38
+ this.render();
39
+ }
40
+ render() {
41
+ if (!this.shadowRoot)
42
+ return;
43
+ const src = this.getAttribute("src") ?? "";
44
+ const name = this.getAttribute("name") ?? "";
45
+ const size = this.getAttribute("size") ?? "md";
46
+ const status = this.getAttribute("status") ?? "";
47
+ const shape = this.getAttribute("shape") ?? "circle";
48
+ const themeCSS = nexui_compiler.getThemeCSS(nexui_compiler.getActiveTheme(), ":host");
49
+ const sizeMap = {
50
+ xs: { px: 20, fs: 8, dot: 5 },
51
+ sm: { px: 28, fs: 11, dot: 7 },
52
+ md: { px: 36, fs: 14, dot: 9 },
53
+ lg: { px: 48, fs: 18, dot: 11 },
54
+ xl: { px: 64, fs: 24, dot: 13 },
55
+ };
56
+ const s = sizeMap[size] ?? sizeMap.md;
57
+ const borderRadius = shape === "square"
58
+ ? `${Math.round(s.px * 0.2)}px`
59
+ : "50%";
60
+ const initials = name ? getInitials(name) : "?";
61
+ const hue = nameToHue(name || "?");
62
+ const fallbackBg = `hsl(${hue}, 35%, 22%)`;
63
+ const fallbackFg = `hsl(${hue}, 70%, 72%)`;
64
+ const statusColor = {
65
+ online: "#22C55E",
66
+ away: "#EAB308",
67
+ busy: "#EF4444",
68
+ offline: "#484F58",
69
+ };
70
+ const dotColor = statusColor[status] ?? "";
71
+ const dotBorder = size === "xs" ? "1px" : "2px";
72
+ const imgContent = src
73
+ ? `<img src="${src}" alt="${name ? `Avatar of ${name}` : "User avatar"}" loading="lazy" />`
74
+ : `<span class="initials" aria-hidden="true">${initials}</span>`;
75
+ this.shadowRoot.innerHTML = `
76
+ <style>
77
+ ${themeCSS}
78
+ :host {
79
+ display: inline-block;
80
+ position: relative;
81
+ width: ${s.px}px;
82
+ height: ${s.px}px;
83
+ flex-shrink: 0;
84
+ }
85
+ .avatar {
86
+ width: ${s.px}px;
87
+ height: ${s.px}px;
88
+ border-radius: ${borderRadius};
89
+ background: ${fallbackBg};
90
+ border: 1px solid var(--nx-border, rgba(255,255,255,0.08));
91
+ overflow: hidden;
92
+ display: flex;
93
+ align-items: center;
94
+ justify-content: center;
95
+ user-select: none;
96
+ }
97
+ img {
98
+ width: 100%;
99
+ height: 100%;
100
+ object-fit: cover;
101
+ display: block;
102
+ }
103
+ .initials {
104
+ font-family: var(--nx-font-sans, system-ui, sans-serif);
105
+ font-size: ${s.fs}px;
106
+ font-weight: 600;
107
+ color: ${fallbackFg};
108
+ line-height: 1;
109
+ letter-spacing: 0.02em;
110
+ }
111
+ ${status ? `.dot {
112
+ position: absolute;
113
+ bottom: 0;
114
+ right: 0;
115
+ width: ${s.dot}px;
116
+ height: ${s.dot}px;
117
+ border-radius: 50%;
118
+ background: ${dotColor};
119
+ border: ${dotBorder} solid var(--nx-bg-base, #0D1117);
120
+ }` : ""}
121
+ </style>
122
+ <div class="avatar" role="img" aria-label="${name ? `Avatar of ${name}` : "User avatar"}" part="avatar">
123
+ ${imgContent}
124
+ </div>
125
+ ${status ? `<span class="dot" aria-label="${status}" title="${status}"></span>` : ""}
126
+ `;
127
+ // Hide initials when image loads successfully
128
+ if (src) {
129
+ const img = this.shadowRoot.querySelector("img");
130
+ const initialsEl = this.shadowRoot.querySelector(".initials");
131
+ if (img && initialsEl) {
132
+ img.addEventListener("error", () => {
133
+ img.style.display = "none";
134
+ // Create and append initials span if image fails
135
+ const span = document.createElement("span");
136
+ span.className = "initials";
137
+ span.setAttribute("aria-hidden", "true");
138
+ span.textContent = initials;
139
+ span.style.cssText = `font-family:var(--nx-font-sans,system-ui,sans-serif);font-size:${s.fs}px;font-weight:600;color:${fallbackFg};line-height:1;letter-spacing:0.02em;`;
140
+ img.parentElement?.appendChild(span);
141
+ });
142
+ }
143
+ }
144
+ }
145
+ }
146
+ //# sourceMappingURL=avatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../src/primitives/avatar.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,yEAAyE;AACzE,cAAc;AACd,uBAAuB;AACvB,wDAAwD;AACxD,kDAAkD;AAClD,uDAAuD;AACvD,+CAA+C;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,SAAS,WAAW,CAAC,IAAY;IAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,CAAC;IACnC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,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AAI,CAAC,UAAU,CAAC,aAAa,CAAmB,KAAK,CAAC,CAAC;YACnE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAkB,WAAW,CAAC,CAAC;YAC/E,IAAI,GAAG,IAAI,UAAU,EAAE,CAAC;gBACtB,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;oBACjC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;oBAC3B,iDAAiD;oBACjD,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;oBAC5C,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC;oBAC5B,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;oBACzC,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;oBAC5B,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,kEAAkE,CAAC,CAAC,EAAE,4BAA4B,UAAU,uCAAuC,CAAC;oBACzK,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;gBACvC,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ export declare class NexBadge extends HTMLElement {
2
+ static get observedAttributes(): string[];
3
+ constructor();
4
+ connectedCallback(): void;
5
+ attributeChangedCallback(): void;
6
+ private render;
7
+ }
8
+ //# sourceMappingURL=badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/primitives/badge.ts"],"names":[],"mappings":"AASA,qBAAa,QAAS,SAAQ,WAAW;IACvC,MAAM,KAAK,kBAAkB,aAE5B;;IAOD,iBAAiB;IAIjB,wBAAwB;IAIxB,OAAO,CAAC,MAAM;CAsEf"}
@@ -0,0 +1,88 @@
1
+ // @yugnex/nexui — NexBadge Web Component
2
+ // Inline status chip for labels, counts, and state indicators.
3
+ // Attributes:
4
+ // variant: default | accent | live | success | error | warning | muted
5
+ // size: sm | md
6
+ // dot: boolean — shows a pulsing presence dot before the text
7
+ import { nexui_compiler } from "../core/compiler";
8
+ export class NexBadge extends HTMLElement {
9
+ static get observedAttributes() {
10
+ return ["variant", "size", "dot"];
11
+ }
12
+ constructor() {
13
+ super();
14
+ this.attachShadow({ mode: "open" });
15
+ }
16
+ connectedCallback() {
17
+ this.render();
18
+ }
19
+ attributeChangedCallback() {
20
+ this.render();
21
+ }
22
+ render() {
23
+ if (!this.shadowRoot)
24
+ return;
25
+ const variant = this.getAttribute("variant") ?? "default";
26
+ const size = this.getAttribute("size") ?? "md";
27
+ const showDot = this.getAttribute("dot") === "true";
28
+ const themeCSS = nexui_compiler.getThemeCSS(nexui_compiler.getActiveTheme(), ":host");
29
+ const variantCSS = {
30
+ default: `background:var(--nx-bg-elevated,#1C2128); color:var(--nx-text-2,#8B949E); border:1px solid var(--nx-border,rgba(255,255,255,0.08));`,
31
+ accent: `background:var(--nx-accent-dim,rgba(232,144,16,0.09)); color:var(--nx-accent-text,#F5B342); border:1px solid var(--nx-accent-border,rgba(232,144,16,0.22));`,
32
+ live: `background:var(--nx-live-dim,rgba(15,212,198,0.09)); color:var(--nx-live,#0FD4C6); border:1px solid var(--nx-live-border,rgba(15,212,198,0.22));`,
33
+ success: `background:var(--nx-success-dim,rgba(34,197,94,0.10)); color:var(--nx-success,#22C55E); border:1px solid rgba(34,197,94,0.25);`,
34
+ error: `background:var(--nx-error-dim,rgba(239,68,68,0.10)); color:var(--nx-error,#EF4444); border:1px solid rgba(239,68,68,0.25);`,
35
+ warning: `background:var(--nx-warning-dim,rgba(234,179,8,0.10)); color:var(--nx-warning,#EAB308); border:1px solid rgba(234,179,8,0.25);`,
36
+ muted: `background:rgba(255,255,255,0.04); color:var(--nx-text-3,#6E7681); border:1px solid transparent;`,
37
+ };
38
+ const dotColor = {
39
+ default: "var(--nx-text-4,#484F58)",
40
+ accent: "var(--nx-accent,#E89010)",
41
+ live: "var(--nx-live,#0FD4C6)",
42
+ success: "var(--nx-success,#22C55E)",
43
+ error: "var(--nx-error,#EF4444)",
44
+ warning: "var(--nx-warning,#EAB308)",
45
+ muted: "var(--nx-text-4,#484F58)",
46
+ };
47
+ const sizeCSS = size === "sm"
48
+ ? `font-size:10px; padding:2px 6px; border-radius:4px; gap:4px;`
49
+ : `font-size:11px; padding:3px 8px; border-radius:5px; gap:5px;`;
50
+ const dotSize = size === "sm" ? 5 : 6;
51
+ this.shadowRoot.innerHTML = `
52
+ <style>
53
+ ${themeCSS}
54
+ :host {
55
+ display: inline-flex;
56
+ }
57
+ .badge {
58
+ display: inline-flex;
59
+ align-items: center;
60
+ font-family: var(--nx-font-mono, ui-monospace, monospace);
61
+ font-weight: 500;
62
+ letter-spacing: 0.04em;
63
+ white-space: nowrap;
64
+ line-height: 1;
65
+ ${sizeCSS}
66
+ ${variantCSS[variant] ?? variantCSS.default}
67
+ }
68
+ .dot {
69
+ width: ${dotSize}px;
70
+ height: ${dotSize}px;
71
+ border-radius: 50%;
72
+ background: ${dotColor[variant] ?? dotColor.default};
73
+ flex-shrink: 0;
74
+ animation: ${variant === "live" ? "nx-pulse 2s ease-in-out infinite" : "none"};
75
+ }
76
+ @keyframes nx-pulse {
77
+ 0%, 100% { opacity: 1; }
78
+ 50% { opacity: 0.35; }
79
+ }
80
+ </style>
81
+ <span class="badge" part="badge">
82
+ ${showDot ? '<span class="dot" aria-hidden="true"></span>' : ""}
83
+ <slot></slot>
84
+ </span>
85
+ `;
86
+ }
87
+ }
88
+ //# sourceMappingURL=badge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/primitives/badge.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,+DAA+D;AAC/D,cAAc;AACd,yEAAyE;AACzE,qBAAqB;AACrB,oEAAoE;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,QAAS,SAA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AC3B,CAAC,CAAC,8DAA8D;YAChE,CAAC,CAAC,8DAA8D,CAAC;QAEnE,MAAM,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtC,IAAI,CAAC,UAAU,CAAC,SAAS,GAAG;;UAEtB,QAAQ;;;;;;;;;;;;YAYN,OAAO;YACP,UAAU,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,OAAO;;;mBAGlC,OAAO;oBACN,OAAO;;wBAEH,QAAQ,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,OAAO;;uBAEtC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,MAAM;;;;;;;;UAQ7E,OAAO,CAAC,CAAC,CAAC,8CAA8C,CAAC,CAAC,CAAC,EAAE;;;KAGlE,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ export declare class NexButton extends HTMLElement {
2
+ private btn;
3
+ static get observedAttributes(): string[];
4
+ constructor();
5
+ connectedCallback(): void;
6
+ attributeChangedCallback(): void;
7
+ private setupDelegation;
8
+ private render;
9
+ }
10
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/primitives/button.ts"],"names":[],"mappings":"AAUA,qBAAa,SAAU,SAAQ,WAAW;IACxC,OAAO,CAAC,GAAG,CAAkC;IAE7C,MAAM,KAAK,kBAAkB,aAE5B;;IAOD,iBAAiB;IAKjB,wBAAwB;IAMxB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,MAAM;CA0Gf"}