@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.
- package/LICENSE +59 -0
- package/css/nexui-base.css +157 -0
- package/css/nexui-icons.css +86 -0
- package/css/nexui-tokens.css +113 -0
- package/css/nexui.css +16 -0
- package/dist/assets/geometry.d.ts +98 -0
- package/dist/assets/geometry.d.ts.map +1 -0
- package/dist/assets/geometry.js +114 -0
- package/dist/assets/geometry.js.map +1 -0
- package/dist/assets/typography.d.ts +3 -0
- package/dist/assets/typography.d.ts.map +1 -0
- package/dist/assets/typography.js +178 -0
- package/dist/assets/typography.js.map +1 -0
- package/dist/core/compiler.d.ts +30 -0
- package/dist/core/compiler.d.ts.map +1 -0
- package/dist/core/compiler.js +124 -0
- package/dist/core/compiler.js.map +1 -0
- package/dist/core/cx.d.ts +7 -0
- package/dist/core/cx.d.ts.map +1 -0
- package/dist/core/cx.js +34 -0
- package/dist/core/cx.js.map +1 -0
- package/dist/core/matrix.d.ts +118 -0
- package/dist/core/matrix.d.ts.map +1 -0
- package/dist/core/matrix.js +180 -0
- package/dist/core/matrix.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/primitives/avatar.d.ts +8 -0
- package/dist/primitives/avatar.d.ts.map +1 -0
- package/dist/primitives/avatar.js +146 -0
- package/dist/primitives/avatar.js.map +1 -0
- package/dist/primitives/badge.d.ts +8 -0
- package/dist/primitives/badge.d.ts.map +1 -0
- package/dist/primitives/badge.js +88 -0
- package/dist/primitives/badge.js.map +1 -0
- package/dist/primitives/button.d.ts +10 -0
- package/dist/primitives/button.d.ts.map +1 -0
- package/dist/primitives/button.js +137 -0
- package/dist/primitives/button.js.map +1 -0
- package/dist/primitives/checkbox.d.ts +13 -0
- package/dist/primitives/checkbox.d.ts.map +1 -0
- package/dist/primitives/checkbox.js +107 -0
- package/dist/primitives/checkbox.js.map +1 -0
- package/dist/primitives/input.d.ts +14 -0
- package/dist/primitives/input.d.ts.map +1 -0
- package/dist/primitives/input.js +177 -0
- package/dist/primitives/input.js.map +1 -0
- package/dist/primitives/panel.d.ts +9 -0
- package/dist/primitives/panel.d.ts.map +1 -0
- package/dist/primitives/panel.js +101 -0
- package/dist/primitives/panel.js.map +1 -0
- package/dist/primitives/progress.d.ts +8 -0
- package/dist/primitives/progress.d.ts.map +1 -0
- package/dist/primitives/progress.js +105 -0
- package/dist/primitives/progress.js.map +1 -0
- package/dist/primitives/separator.d.ts +8 -0
- package/dist/primitives/separator.d.ts.map +1 -0
- package/dist/primitives/separator.js +69 -0
- package/dist/primitives/separator.js.map +1 -0
- package/dist/primitives/skeleton.d.ts +8 -0
- package/dist/primitives/skeleton.d.ts.map +1 -0
- package/dist/primitives/skeleton.js +61 -0
- package/dist/primitives/skeleton.js.map +1 -0
- package/dist/primitives/spinner.d.ts +8 -0
- package/dist/primitives/spinner.d.ts.map +1 -0
- package/dist/primitives/spinner.js +64 -0
- package/dist/primitives/spinner.js.map +1 -0
- package/dist/primitives/status-ring.d.ts +8 -0
- package/dist/primitives/status-ring.d.ts.map +1 -0
- package/dist/primitives/status-ring.js +101 -0
- package/dist/primitives/status-ring.js.map +1 -0
- package/dist/primitives/switch.d.ts +12 -0
- package/dist/primitives/switch.d.ts.map +1 -0
- package/dist/primitives/switch.js +124 -0
- package/dist/primitives/switch.js.map +1 -0
- package/dist/primitives/text-stream.d.ts +23 -0
- package/dist/primitives/text-stream.d.ts.map +1 -0
- package/dist/primitives/text-stream.js +167 -0
- package/dist/primitives/text-stream.js.map +1 -0
- package/dist/tokens/colors.d.ts +127 -0
- package/dist/tokens/colors.d.ts.map +1 -0
- package/dist/tokens/colors.js +135 -0
- package/dist/tokens/colors.js.map +1 -0
- package/dist/tokens/motion.d.ts +37 -0
- package/dist/tokens/motion.d.ts.map +1 -0
- package/dist/tokens/motion.js +93 -0
- package/dist/tokens/motion.js.map +1 -0
- package/dist/tokens/shadows.d.ts +34 -0
- package/dist/tokens/shadows.d.ts.map +1 -0
- package/dist/tokens/shadows.js +45 -0
- package/dist/tokens/shadows.js.map +1 -0
- package/dist/tokens/spacing.d.ts +69 -0
- package/dist/tokens/spacing.d.ts.map +1 -0
- package/dist/tokens/spacing.js +71 -0
- package/dist/tokens/spacing.js.map +1 -0
- package/dist/tokens/type.d.ts +166 -0
- package/dist/tokens/type.d.ts.map +1 -0
- package/dist/tokens/type.js +215 -0
- package/dist/tokens/type.js.map +1 -0
- package/fonts/NexuiIcons.woff2 +0 -0
- package/fonts/NexuiMono-Regular.otf +0 -0
- package/fonts/NexuiMono-Regular.woff2 +0 -0
- package/fonts/NexuiSans-Bold.otf +0 -0
- package/fonts/NexuiSans-Bold.woff2 +0 -0
- package/fonts/NexuiSans-Medium.otf +0 -0
- package/fonts/NexuiSans-Medium.woff2 +0 -0
- package/fonts/NexuiSans-Regular.otf +0 -0
- package/fonts/NexuiSans-Regular.woff2 +0 -0
- package/native/Cargo.toml +16 -0
- package/native/src/lib.rs +127 -0
- package/nexui-utils.css +485 -0
- package/package.json +58 -0
- package/src/assets/geometry.ts +144 -0
- package/src/assets/typography.ts +184 -0
- package/src/core/compiler.ts +139 -0
- package/src/core/cx.ts +50 -0
- package/src/core/matrix.ts +195 -0
- package/src/index.ts +78 -0
- package/src/primitives/avatar.ts +159 -0
- package/src/primitives/badge.ts +98 -0
- package/src/primitives/button.ts +149 -0
- package/src/primitives/checkbox.ts +113 -0
- package/src/primitives/input.ts +187 -0
- package/src/primitives/panel.ts +111 -0
- package/src/primitives/progress.ts +112 -0
- package/src/primitives/separator.ts +73 -0
- package/src/primitives/skeleton.ts +68 -0
- package/src/primitives/spinner.ts +71 -0
- package/src/primitives/status-ring.ts +109 -0
- package/src/primitives/switch.ts +134 -0
- package/src/primitives/text-stream.ts +187 -0
- package/src/tokens/colors.ts +149 -0
- package/src/tokens/motion.ts +97 -0
- package/src/tokens/shadows.ts +58 -0
- package/src/tokens/spacing.ts +79 -0
- package/src/tokens/type.ts +224 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../src/assets/typography.ts"],"names":[],"mappings":"AA4KA,eAAO,MAAM,oBAAoB,EAAE,MACkD,CAAC;AAGtF,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,SAAM,EAAE,KAAK,SAAO,GAAG,MAAM,CAOzF"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// @yugnex/nexui — Typography Asset
|
|
2
|
+
// Exports a complete CSS text block ready for injection via <style>.
|
|
3
|
+
// Includes: @font-face stubs, fluid type scale custom properties,
|
|
4
|
+
// and base reset for typographic elements.
|
|
5
|
+
// Inject once per page: document.head.appendChild(<style>NexuiTypographySheet</style>)
|
|
6
|
+
import { NEXUI_FONT_SIZE, NEXUI_FONT_FAMILY, NEXUI_LINE_HEIGHT } from "../tokens/type";
|
|
7
|
+
import { NEXUI_KEYFRAMES } from "../tokens/motion";
|
|
8
|
+
// @font-face declarations pointing to the in-house WOFF2 files in /fonts/.
|
|
9
|
+
// Consumers must serve the /fonts/ directory as static assets.
|
|
10
|
+
// Next.js: copy packages/nexui/fonts/ to public/nexui-fonts/ and update the paths below,
|
|
11
|
+
// OR use the path helper: import { NEXUI_FONT_PATH } from "@yugnex/nexui/assets/typography"
|
|
12
|
+
// The fonts/ directory is in the @yugnex/nexui package root (published with "files").
|
|
13
|
+
const FONT_FACE_BLOCK = `
|
|
14
|
+
@font-face {
|
|
15
|
+
font-family: 'NexuiSans';
|
|
16
|
+
font-style: normal;
|
|
17
|
+
font-weight: 400;
|
|
18
|
+
font-display: swap;
|
|
19
|
+
src: url('./fonts/NexuiSans-Regular.woff2') format('woff2');
|
|
20
|
+
}
|
|
21
|
+
@font-face {
|
|
22
|
+
font-family: 'NexuiSans';
|
|
23
|
+
font-style: normal;
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
font-display: swap;
|
|
26
|
+
src: url('./fonts/NexuiSans-Medium.woff2') format('woff2');
|
|
27
|
+
}
|
|
28
|
+
@font-face {
|
|
29
|
+
font-family: 'NexuiSans';
|
|
30
|
+
font-style: normal;
|
|
31
|
+
font-weight: 700;
|
|
32
|
+
font-display: swap;
|
|
33
|
+
src: url('./fonts/NexuiSans-Bold.woff2') format('woff2');
|
|
34
|
+
}
|
|
35
|
+
@font-face {
|
|
36
|
+
font-family: 'NexuiMono';
|
|
37
|
+
font-style: normal;
|
|
38
|
+
font-weight: 400;
|
|
39
|
+
font-display: swap;
|
|
40
|
+
src: url('./fonts/NexuiMono-Regular.woff2') format('woff2');
|
|
41
|
+
}
|
|
42
|
+
`.trim();
|
|
43
|
+
// Fluid type custom properties on :root
|
|
44
|
+
const FLUID_VARS_BLOCK = `:root {
|
|
45
|
+
--nx-fs-2xs: ${NEXUI_FONT_SIZE["2xs"]};
|
|
46
|
+
--nx-fs-xs: ${NEXUI_FONT_SIZE["xs"]};
|
|
47
|
+
--nx-fs-sm: ${NEXUI_FONT_SIZE["sm"]};
|
|
48
|
+
--nx-fs-base: ${NEXUI_FONT_SIZE["base"]};
|
|
49
|
+
--nx-fs-md: ${NEXUI_FONT_SIZE["md"]};
|
|
50
|
+
--nx-fs-lg: ${NEXUI_FONT_SIZE["lg"]};
|
|
51
|
+
--nx-fs-xl: ${NEXUI_FONT_SIZE["xl"]};
|
|
52
|
+
--nx-fs-2xl: ${NEXUI_FONT_SIZE["2xl"]};
|
|
53
|
+
--nx-fs-3xl: ${NEXUI_FONT_SIZE["3xl"]};
|
|
54
|
+
--nx-fs-4xl: ${NEXUI_FONT_SIZE["4xl"]};
|
|
55
|
+
--nx-fs-5xl: ${NEXUI_FONT_SIZE["5xl"]};
|
|
56
|
+
--nx-fs-6xl: ${NEXUI_FONT_SIZE["6xl"]};
|
|
57
|
+
--nx-fs-7xl: ${NEXUI_FONT_SIZE["7xl"]};
|
|
58
|
+
|
|
59
|
+
--nx-ff-sans: ${NEXUI_FONT_FAMILY.sans};
|
|
60
|
+
--nx-ff-mono: ${NEXUI_FONT_FAMILY.mono};
|
|
61
|
+
--nx-ff-display: ${NEXUI_FONT_FAMILY.display};
|
|
62
|
+
|
|
63
|
+
--nx-lh-tight: ${NEXUI_LINE_HEIGHT.tight};
|
|
64
|
+
--nx-lh-normal: ${NEXUI_LINE_HEIGHT.normal};
|
|
65
|
+
--nx-lh-relaxed: ${NEXUI_LINE_HEIGHT.relaxed};
|
|
66
|
+
--nx-lh-code: ${NEXUI_LINE_HEIGHT.code};
|
|
67
|
+
}`;
|
|
68
|
+
// Base typographic reset
|
|
69
|
+
const TYPE_RESET_BLOCK = `
|
|
70
|
+
*,
|
|
71
|
+
*::before,
|
|
72
|
+
*::after {
|
|
73
|
+
box-sizing: border-box;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
html {
|
|
77
|
+
-webkit-text-size-adjust: 100%;
|
|
78
|
+
tab-size: 2;
|
|
79
|
+
font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
|
|
80
|
+
-webkit-font-smoothing: antialiased;
|
|
81
|
+
-moz-osx-font-smoothing: grayscale;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
body {
|
|
85
|
+
margin: 0;
|
|
86
|
+
font-family: var(--nx-ff-sans, ${NEXUI_FONT_FAMILY.sans});
|
|
87
|
+
font-size: var(--nx-fs-base);
|
|
88
|
+
line-height: ${NEXUI_LINE_HEIGHT.relaxed};
|
|
89
|
+
color: var(--nx-text, #E6EDF3);
|
|
90
|
+
background-color: var(--nx-bg-base, #0D1117);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
code, kbd, samp, pre {
|
|
94
|
+
font-family: var(--nx-ff-mono, ${NEXUI_FONT_FAMILY.mono});
|
|
95
|
+
font-size: 0.9em;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
h1, h2, h3, h4, h5, h6 {
|
|
99
|
+
margin: 0;
|
|
100
|
+
font-family: var(--nx-ff-display, ${NEXUI_FONT_FAMILY.display});
|
|
101
|
+
line-height: ${NEXUI_LINE_HEIGHT.tight};
|
|
102
|
+
color: var(--nx-text, #E6EDF3);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
h1 { font-size: var(--nx-fs-4xl); font-weight: 700; }
|
|
106
|
+
h2 { font-size: var(--nx-fs-3xl); font-weight: 700; }
|
|
107
|
+
h3 { font-size: var(--nx-fs-2xl); font-weight: 600; }
|
|
108
|
+
h4 { font-size: var(--nx-fs-xl); font-weight: 600; }
|
|
109
|
+
h5 { font-size: var(--nx-fs-lg); font-weight: 600; }
|
|
110
|
+
h6 { font-size: var(--nx-fs-md); font-weight: 500; }
|
|
111
|
+
|
|
112
|
+
p {
|
|
113
|
+
margin: 0;
|
|
114
|
+
line-height: ${NEXUI_LINE_HEIGHT.relaxed};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
a {
|
|
118
|
+
color: var(--nx-accent-text, #F5B342);
|
|
119
|
+
text-decoration: none;
|
|
120
|
+
}
|
|
121
|
+
a:hover {
|
|
122
|
+
text-decoration: underline;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
strong, b { font-weight: 600; }
|
|
126
|
+
em, i { font-style: italic; }
|
|
127
|
+
|
|
128
|
+
small { font-size: var(--nx-fs-xs); }
|
|
129
|
+
|
|
130
|
+
pre {
|
|
131
|
+
margin: 0;
|
|
132
|
+
overflow-x: auto;
|
|
133
|
+
tab-size: 2;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* Scrollbar styling */
|
|
137
|
+
::-webkit-scrollbar { width: 6px; height: 6px; }
|
|
138
|
+
::-webkit-scrollbar-track { background: transparent; }
|
|
139
|
+
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
|
|
140
|
+
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.20); }
|
|
141
|
+
|
|
142
|
+
/* Focus visible ring (keyboard nav) */
|
|
143
|
+
:focus-visible {
|
|
144
|
+
outline: 2px solid var(--nx-accent, #E89010);
|
|
145
|
+
outline-offset: 2px;
|
|
146
|
+
}
|
|
147
|
+
:focus:not(:focus-visible) {
|
|
148
|
+
outline: none;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* Selection */
|
|
152
|
+
::selection {
|
|
153
|
+
background: rgba(232,144,16,0.25);
|
|
154
|
+
color: var(--nx-text, #E6EDF3);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* Reduced motion */
|
|
158
|
+
@media (prefers-reduced-motion: reduce) {
|
|
159
|
+
*, *::before, *::after {
|
|
160
|
+
animation-duration: 0.01ms !important;
|
|
161
|
+
animation-iteration-count: 1 !important;
|
|
162
|
+
transition-duration: 0.01ms !important;
|
|
163
|
+
scroll-behavior: auto !important;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
`.trim();
|
|
167
|
+
// All blocks composed into a single injectable string
|
|
168
|
+
export const NexuiTypographySheet = [FONT_FACE_BLOCK, FLUID_VARS_BLOCK, TYPE_RESET_BLOCK, NEXUI_KEYFRAMES].join("\n\n");
|
|
169
|
+
// Fluid type calculation exposed for custom use
|
|
170
|
+
export function fluidType(minPx, maxPx, minVp = 320, maxVp = 1440) {
|
|
171
|
+
const slope = (maxPx - minPx) / (maxVp - minVp);
|
|
172
|
+
const y = minPx - slope * minVp;
|
|
173
|
+
const yFixed = parseFloat(y.toFixed(4));
|
|
174
|
+
const slopeFixed = parseFloat((slope * 100).toFixed(4));
|
|
175
|
+
const sign = yFixed >= 0 ? "+" : "-";
|
|
176
|
+
return `clamp(${minPx}px, ${Math.abs(yFixed)}px ${sign} ${slopeFixed}vw, ${maxPx}px)`;
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=typography.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.js","sourceRoot":"","sources":["../../src/assets/typography.ts"],"names":[],"mappings":"AAAA,mCAA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;;;;;;;;;;;;iBAavB,iBAAiB,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDzC,CAAC,IAAI,EAAE,CAAC;AAET,sDAAsD;AACtD,MAAM,CAAC,MAAM,oBAAoB,GAC/B,CAAC,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEtF,gDAAgD;AAChD,MAAM,UAAU,SAAS,CAAC,KAAa,EAAE,KAAa,EAAE,KAAK,GAAG,GAAG,EAAE,KAAK,GAAG,IAAI;IAC/E,MAAM,KAAK,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;IAChD,MAAM,CAAC,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IAChC,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACrC,OAAO,SAAS,KAAK,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,UAAU,OAAO,KAAK,KAAK,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type NexuiTheme } from "./matrix";
|
|
2
|
+
export declare class NexuiStyleCompiler {
|
|
3
|
+
private sheet;
|
|
4
|
+
private cache;
|
|
5
|
+
private currentTheme;
|
|
6
|
+
private getSheet;
|
|
7
|
+
/** Inject a bitmask class into the global document stylesheet.
|
|
8
|
+
* Returns the class name. Safe for light-DOM components only.
|
|
9
|
+
* For shadow DOM components, use compileBitmaskToString(). */
|
|
10
|
+
compileBitmask(mask: number): string;
|
|
11
|
+
/** Returns a complete `<style>` text block for use inside a shadow root.
|
|
12
|
+
* Shadow DOM cannot see global document styles, so call this inside
|
|
13
|
+
* connectedCallback() and inject the result into shadowRoot. */
|
|
14
|
+
compileBitmaskToString(mask: number): string;
|
|
15
|
+
/** Returns CSS text for all currently compiled bitmask rules.
|
|
16
|
+
* Useful for SSR, test snapshots, or shadow root bulk-injection. */
|
|
17
|
+
dumpCompiledCSS(): string;
|
|
18
|
+
/** Returns a CSS custom property block for the given theme.
|
|
19
|
+
* Inject into :root for global use, or into :host for shadow DOM. */
|
|
20
|
+
getThemeCSS(theme: NexuiTheme, selector?: string): string;
|
|
21
|
+
/** Mounts theme custom properties on :root and stores active theme.
|
|
22
|
+
* Safe to call multiple times — replaces the previous theme block. */
|
|
23
|
+
mountGlobalTheme(theme?: NexuiTheme): void;
|
|
24
|
+
switchTheme(theme: NexuiTheme): void;
|
|
25
|
+
getActiveTheme(): NexuiTheme;
|
|
26
|
+
/** Returns the full CSS needed for a shadow root: theme vars + compiled bitmasks. */
|
|
27
|
+
getShadowRootCSS(masks: number[], theme?: NexuiTheme): string;
|
|
28
|
+
}
|
|
29
|
+
export declare const nexui_compiler: NexuiStyleCompiler;
|
|
30
|
+
//# sourceMappingURL=compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../src/core/compiler.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,UAAU,EAOhB,MAAM,UAAU,CAAC;AA+BlB,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,YAAY,CAAsB;IAI1C,OAAO,CAAC,QAAQ;IAShB;;mEAE+D;IACxD,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAgB3C;;qEAEiE;IAC1D,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAMnD;yEACqE;IAC9D,eAAe,IAAI,MAAM;IAUhC;0EACsE;IAC/D,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,SAAU,GAAG,MAAM;IAQjE;2EACuE;IAChE,gBAAgB,CAAC,KAAK,GAAE,UAAmB,GAAG,IAAI;IASlD,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAIpC,cAAc,IAAI,UAAU;IAInC,qFAAqF;IAC9E,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM;CAMrE;AAED,eAAO,MAAM,cAAc,oBAA2B,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// @yugnex/nexui — Style Compiler
|
|
2
|
+
// Converts LayoutMatrix bitmasks to CSS, manages theme injection,
|
|
3
|
+
// and provides shadow-DOM-safe CSS text output.
|
|
4
|
+
import { NEXUI_THEMES, MATRIX_PAD_MAP, MATRIX_DISPLAY_MAP, MATRIX_RADIUS_MAP, MATRIX_GAP_MAP, MATRIX_WIDTH_MAP, MATRIX_OVERFLOW_MAP, } from "./matrix";
|
|
5
|
+
const SELECTOR_PREFIX = "nx-m-";
|
|
6
|
+
// Bitmask masks for each field
|
|
7
|
+
const MASK_PAD = 0x00000F;
|
|
8
|
+
const MASK_DISPLAY = 0x0000F0;
|
|
9
|
+
const MASK_RADIUS = 0x000F00;
|
|
10
|
+
const MASK_GAP = 0x00F000;
|
|
11
|
+
const MASK_WIDTH = 0x0F0000;
|
|
12
|
+
const MASK_OVERFLOW = 0xF00000;
|
|
13
|
+
function bitmaskToCSSBody(mask) {
|
|
14
|
+
let css = "";
|
|
15
|
+
const pad = mask & MASK_PAD;
|
|
16
|
+
const display = mask & MASK_DISPLAY;
|
|
17
|
+
const radius = mask & MASK_RADIUS;
|
|
18
|
+
const gap = mask & MASK_GAP;
|
|
19
|
+
const width = mask & MASK_WIDTH;
|
|
20
|
+
const overflow = mask & MASK_OVERFLOW;
|
|
21
|
+
if (MATRIX_PAD_MAP[pad])
|
|
22
|
+
css += MATRIX_PAD_MAP[pad];
|
|
23
|
+
if (MATRIX_DISPLAY_MAP[display])
|
|
24
|
+
css += MATRIX_DISPLAY_MAP[display];
|
|
25
|
+
if (MATRIX_RADIUS_MAP[radius])
|
|
26
|
+
css += MATRIX_RADIUS_MAP[radius];
|
|
27
|
+
if (MATRIX_GAP_MAP[gap])
|
|
28
|
+
css += MATRIX_GAP_MAP[gap];
|
|
29
|
+
if (MATRIX_WIDTH_MAP[width])
|
|
30
|
+
css += MATRIX_WIDTH_MAP[width];
|
|
31
|
+
if (MATRIX_OVERFLOW_MAP[overflow])
|
|
32
|
+
css += MATRIX_OVERFLOW_MAP[overflow];
|
|
33
|
+
return css;
|
|
34
|
+
}
|
|
35
|
+
export class NexuiStyleCompiler {
|
|
36
|
+
constructor() {
|
|
37
|
+
this.sheet = null;
|
|
38
|
+
this.cache = new Map(); // mask → className
|
|
39
|
+
this.currentTheme = "void";
|
|
40
|
+
}
|
|
41
|
+
// ─── Global document stylesheet ───────────────────────────────────────────
|
|
42
|
+
getSheet() {
|
|
43
|
+
if (this.sheet)
|
|
44
|
+
return this.sheet;
|
|
45
|
+
const style = document.createElement("style");
|
|
46
|
+
style.id = "yugnex-nexui-engine";
|
|
47
|
+
document.head.appendChild(style);
|
|
48
|
+
this.sheet = style.sheet;
|
|
49
|
+
return this.sheet;
|
|
50
|
+
}
|
|
51
|
+
/** Inject a bitmask class into the global document stylesheet.
|
|
52
|
+
* Returns the class name. Safe for light-DOM components only.
|
|
53
|
+
* For shadow DOM components, use compileBitmaskToString(). */
|
|
54
|
+
compileBitmask(mask) {
|
|
55
|
+
if (this.cache.has(mask))
|
|
56
|
+
return this.cache.get(mask);
|
|
57
|
+
const selector = `${SELECTOR_PREFIX}${mask.toString(16).toUpperCase()}`;
|
|
58
|
+
const body = bitmaskToCSSBody(mask);
|
|
59
|
+
if (body) {
|
|
60
|
+
try {
|
|
61
|
+
const sheet = this.getSheet();
|
|
62
|
+
sheet.insertRule(`.${selector}{${body}}`, sheet.cssRules.length);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// CSSOM insertRule can fail in sandboxed frames — ignore silently
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
this.cache.set(mask, selector);
|
|
69
|
+
return selector;
|
|
70
|
+
}
|
|
71
|
+
/** Returns a complete `<style>` text block for use inside a shadow root.
|
|
72
|
+
* Shadow DOM cannot see global document styles, so call this inside
|
|
73
|
+
* connectedCallback() and inject the result into shadowRoot. */
|
|
74
|
+
compileBitmaskToString(mask) {
|
|
75
|
+
const selector = `${SELECTOR_PREFIX}${mask.toString(16).toUpperCase()}`;
|
|
76
|
+
const body = bitmaskToCSSBody(mask);
|
|
77
|
+
return body ? `.${selector}{${body}}` : "";
|
|
78
|
+
}
|
|
79
|
+
/** Returns CSS text for all currently compiled bitmask rules.
|
|
80
|
+
* Useful for SSR, test snapshots, or shadow root bulk-injection. */
|
|
81
|
+
dumpCompiledCSS() {
|
|
82
|
+
let out = "";
|
|
83
|
+
for (const [mask] of this.cache) {
|
|
84
|
+
out += this.compileBitmaskToString(mask) + "\n";
|
|
85
|
+
}
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
88
|
+
// ─── Theme management ──────────────────────────────────────────────────────
|
|
89
|
+
/** Returns a CSS custom property block for the given theme.
|
|
90
|
+
* Inject into :root for global use, or into :host for shadow DOM. */
|
|
91
|
+
getThemeCSS(theme, selector = ":root") {
|
|
92
|
+
const tokens = NEXUI_THEMES[theme];
|
|
93
|
+
const rules = Object.entries(tokens)
|
|
94
|
+
.map(([k, v]) => ` ${k}:${v};`)
|
|
95
|
+
.join("\n");
|
|
96
|
+
return `${selector}{\n${rules}\n}`;
|
|
97
|
+
}
|
|
98
|
+
/** Mounts theme custom properties on :root and stores active theme.
|
|
99
|
+
* Safe to call multiple times — replaces the previous theme block. */
|
|
100
|
+
mountGlobalTheme(theme = "void") {
|
|
101
|
+
this.currentTheme = theme;
|
|
102
|
+
const existing = document.getElementById("yugnex-nexui-theme");
|
|
103
|
+
const style = existing ?? document.createElement("style");
|
|
104
|
+
style.id = "yugnex-nexui-theme";
|
|
105
|
+
style.textContent = this.getThemeCSS(theme, ":root");
|
|
106
|
+
if (!existing)
|
|
107
|
+
document.head.appendChild(style);
|
|
108
|
+
}
|
|
109
|
+
switchTheme(theme) {
|
|
110
|
+
this.mountGlobalTheme(theme);
|
|
111
|
+
}
|
|
112
|
+
getActiveTheme() {
|
|
113
|
+
return this.currentTheme;
|
|
114
|
+
}
|
|
115
|
+
/** Returns the full CSS needed for a shadow root: theme vars + compiled bitmasks. */
|
|
116
|
+
getShadowRootCSS(masks, theme) {
|
|
117
|
+
const t = theme ?? this.currentTheme;
|
|
118
|
+
const themeBlock = this.getThemeCSS(t, ":host");
|
|
119
|
+
const matrixBlock = masks.map(m => this.compileBitmaskToString(m)).join("\n");
|
|
120
|
+
return themeBlock + "\n" + matrixBlock;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export const nexui_compiler = new NexuiStyleCompiler();
|
|
124
|
+
//# sourceMappingURL=compiler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.js","sourceRoot":"","sources":["../../src/core/compiler.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,kEAAkE;AAClE,gDAAgD;AAEhD,OAAO,EACL,YAAY,EAEZ,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAElB,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC,+BAA+B;AAC/B,MAAM,QAAQ,GAAQ,QAAQ,CAAC;AAC/B,MAAM,YAAY,GAAI,QAAQ,CAAC;AAC/B,MAAM,WAAW,GAAK,QAAQ,CAAC;AAC/B,M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,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;IAEM,WAAW,CAAC,KAAiB;QAClC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,qFAAqF;IAC9E,gBAAgB,CAAC,KAAe,EAAE,KAAkB;QACzD,MAAM,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC;QACrC,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QAChD,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9E,OAAO,UAAU,GAAG,IAAI,GAAG,WAAW,CAAC;IACzC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type CxArg = string | number | boolean | null | undefined | CxArg[] | Record<string, boolean | undefined | null>;
|
|
2
|
+
export declare function cx(...args: CxArg[]): string;
|
|
3
|
+
/** Variant helper — picks one class from a map based on a key.
|
|
4
|
+
* Useful for component variant props without template literals. */
|
|
5
|
+
export declare function cv<T extends string>(map: Record<T, string>, variant: T, fallback?: string): string;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=cx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cx.d.ts","sourceRoot":"","sources":["../../src/core/cx.ts"],"names":[],"mappings":"AAKA,KAAK,KAAK,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,KAAK,EAAE,GACP,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;AAE/C,wBAAgB,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,CAyB3C;AAED;oEACoE;AACpE,wBAAgB,EAAE,CAAC,CAAC,SAAS,MAAM,EACjC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,EACtB,OAAO,EAAE,CAAC,EACV,QAAQ,SAAK,GACZ,MAAM,CAER"}
|
package/dist/core/cx.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// @yugnex/nexui — Class Name Utility
|
|
2
|
+
// Zero dependencies. Replaces clsx / classnames.
|
|
3
|
+
// cx("a", false && "b", undefined, "c") → "a c"
|
|
4
|
+
// cx({ active: true, disabled: false }) → "active"
|
|
5
|
+
export function cx(...args) {
|
|
6
|
+
const classes = [];
|
|
7
|
+
for (const arg of args) {
|
|
8
|
+
if (!arg)
|
|
9
|
+
continue;
|
|
10
|
+
if (typeof arg === "string" || typeof arg === "number") {
|
|
11
|
+
classes.push(String(arg));
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
if (Array.isArray(arg)) {
|
|
15
|
+
const inner = cx(...arg);
|
|
16
|
+
if (inner)
|
|
17
|
+
classes.push(inner);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (typeof arg === "object") {
|
|
21
|
+
for (const [key, value] of Object.entries(arg)) {
|
|
22
|
+
if (value)
|
|
23
|
+
classes.push(key);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return classes.join(" ");
|
|
28
|
+
}
|
|
29
|
+
/** Variant helper — picks one class from a map based on a key.
|
|
30
|
+
* Useful for component variant props without template literals. */
|
|
31
|
+
export function cv(map, variant, fallback = "") {
|
|
32
|
+
return map[variant] ?? fallback;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=cx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cx.js","sourceRoot":"","sources":["../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
|
|
4
|
+
PAD_SM = 2,// 0.5rem / 8px
|
|
5
|
+
PAD_MD = 3,// 0.75rem / 12px
|
|
6
|
+
PAD_LG = 4,// 1rem / 16px
|
|
7
|
+
PAD_XL = 5,// 1.5rem / 24px
|
|
8
|
+
PAD_2XL = 6,// 2rem / 32px
|
|
9
|
+
FLEX_ROW = 16,// display:flex; flex-direction:row
|
|
10
|
+
FLEX_COL = 32,// display:flex; flex-direction:column
|
|
11
|
+
GRID_2 = 48,// display:grid; grid-template-columns:repeat(2,1fr)
|
|
12
|
+
GRID_3 = 64,// display:grid; grid-template-columns:repeat(3,1fr)
|
|
13
|
+
GRID_4 = 80,// display:grid; grid-template-columns:repeat(4,1fr)
|
|
14
|
+
ALIGN_START = 96,// align-items:flex-start
|
|
15
|
+
ALIGN_CENTER = 112,// align-items:center
|
|
16
|
+
ALIGN_END = 128,// align-items:flex-end
|
|
17
|
+
ALIGN_STRETCH = 144,// align-items:stretch
|
|
18
|
+
JUSTIFY_START = 160,// justify-content:flex-start
|
|
19
|
+
JUSTIFY_CENTER = 176,// justify-content:center
|
|
20
|
+
JUSTIFY_END = 192,// justify-content:flex-end
|
|
21
|
+
JUSTIFY_BET = 208,// justify-content:space-between
|
|
22
|
+
JUSTIFY_AROUND = 224,// justify-content:space-around
|
|
23
|
+
JUSTIFY_EVEN = 240,// justify-content:space-evenly
|
|
24
|
+
RAD_NONE = 0,
|
|
25
|
+
RAD_XS = 256,// 2px
|
|
26
|
+
RAD_SM = 512,// 4px
|
|
27
|
+
RAD_MD = 768,// 6px
|
|
28
|
+
RAD_LG = 1024,// 8px
|
|
29
|
+
RAD_XL = 1280,// 12px
|
|
30
|
+
RAD_2XL = 1536,// 16px
|
|
31
|
+
RAD_FULL = 1792,// 9999px
|
|
32
|
+
GAP_NONE = 0,
|
|
33
|
+
GAP_XS = 4096,// 0.25rem / 4px
|
|
34
|
+
GAP_SM = 8192,// 0.5rem / 8px
|
|
35
|
+
GAP_MD = 12288,// 1rem / 16px
|
|
36
|
+
GAP_LG = 16384,// 1.5rem / 24px
|
|
37
|
+
GAP_XL = 20480,// 2rem / 32px
|
|
38
|
+
W_AUTO = 0,
|
|
39
|
+
W_FULL = 65536,// width:100%
|
|
40
|
+
W_SCREEN = 131072,// width:100vw
|
|
41
|
+
W_FIT = 196608,// width:fit-content
|
|
42
|
+
W_MIN = 262144,// width:min-content
|
|
43
|
+
W_MAX = 327680,// width:max-content
|
|
44
|
+
OVERFLOW_VIS = 0,// overflow:visible (default)
|
|
45
|
+
OVERFLOW_HIDDEN = 1048576,// overflow:hidden
|
|
46
|
+
OVERFLOW_AUTO = 2097152,// overflow:auto
|
|
47
|
+
OVERFLOW_SCROLL = 3145728
|
|
48
|
+
}
|
|
49
|
+
export declare const MATRIX_PAD_MAP: Record<number, string>;
|
|
50
|
+
export declare const MATRIX_DISPLAY_MAP: Record<number, string>;
|
|
51
|
+
export declare const MATRIX_RADIUS_MAP: Record<number, string>;
|
|
52
|
+
export declare const MATRIX_GAP_MAP: Record<number, string>;
|
|
53
|
+
export declare const MATRIX_WIDTH_MAP: Record<number, string>;
|
|
54
|
+
export declare const MATRIX_OVERFLOW_MAP: Record<number, string>;
|
|
55
|
+
export declare const NEXUI_THEMES: {
|
|
56
|
+
readonly void: {
|
|
57
|
+
readonly "--nx-bg-void": "#05070C";
|
|
58
|
+
readonly "--nx-bg-base": "#0D1117";
|
|
59
|
+
readonly "--nx-bg-surface": "#161B22";
|
|
60
|
+
readonly "--nx-bg-elevated": "#1C2128";
|
|
61
|
+
readonly "--nx-bg-overlay": "#21262D";
|
|
62
|
+
readonly "--nx-border": "rgba(255,255,255,0.08)";
|
|
63
|
+
readonly "--nx-border-strong": "rgba(255,255,255,0.16)";
|
|
64
|
+
readonly "--nx-border-focus": "rgba(232,144,16,0.60)";
|
|
65
|
+
readonly "--nx-text": "#E6EDF3";
|
|
66
|
+
readonly "--nx-text-2": "#8B949E";
|
|
67
|
+
readonly "--nx-text-3": "#6E7681";
|
|
68
|
+
readonly "--nx-text-4": "#484F58";
|
|
69
|
+
readonly "--nx-text-inv": "#05070C";
|
|
70
|
+
readonly "--nx-accent": "#E89010";
|
|
71
|
+
readonly "--nx-accent-dim": "rgba(232,144,16,0.09)";
|
|
72
|
+
readonly "--nx-accent-border": "rgba(232,144,16,0.22)";
|
|
73
|
+
readonly "--nx-accent-text": "#F5B342";
|
|
74
|
+
readonly "--nx-live": "#0FD4C6";
|
|
75
|
+
readonly "--nx-live-dim": "rgba(15,212,198,0.09)";
|
|
76
|
+
readonly "--nx-live-border": "rgba(15,212,198,0.22)";
|
|
77
|
+
readonly "--nx-success": "#22C55E";
|
|
78
|
+
readonly "--nx-success-dim": "rgba(34,197,94,0.10)";
|
|
79
|
+
readonly "--nx-error": "#EF4444";
|
|
80
|
+
readonly "--nx-error-dim": "rgba(239,68,68,0.10)";
|
|
81
|
+
readonly "--nx-warning": "#EAB308";
|
|
82
|
+
readonly "--nx-warning-dim": "rgba(234,179,8,0.10)";
|
|
83
|
+
readonly "--nx-font-sans": "'NexuiSans','Inter',system-ui,-apple-system,sans-serif";
|
|
84
|
+
readonly "--nx-font-mono": "'NexuiMono','JetBrains Mono','Fira Code',ui-monospace,monospace";
|
|
85
|
+
};
|
|
86
|
+
readonly terminal: {
|
|
87
|
+
readonly "--nx-bg-void": "#000000";
|
|
88
|
+
readonly "--nx-bg-base": "#050505";
|
|
89
|
+
readonly "--nx-bg-surface": "#0C0E12";
|
|
90
|
+
readonly "--nx-bg-elevated": "#111418";
|
|
91
|
+
readonly "--nx-bg-overlay": "#161B22";
|
|
92
|
+
readonly "--nx-border": "#1E293B";
|
|
93
|
+
readonly "--nx-border-strong": "#2D3748";
|
|
94
|
+
readonly "--nx-border-focus": "rgba(16,185,129,0.60)";
|
|
95
|
+
readonly "--nx-text": "#10B981";
|
|
96
|
+
readonly "--nx-text-2": "#6EE7B7";
|
|
97
|
+
readonly "--nx-text-3": "#34D399";
|
|
98
|
+
readonly "--nx-text-4": "#065F46";
|
|
99
|
+
readonly "--nx-text-inv": "#000000";
|
|
100
|
+
readonly "--nx-accent": "#E89010";
|
|
101
|
+
readonly "--nx-accent-dim": "rgba(232,144,16,0.09)";
|
|
102
|
+
readonly "--nx-accent-border": "rgba(232,144,16,0.22)";
|
|
103
|
+
readonly "--nx-accent-text": "#F5B342";
|
|
104
|
+
readonly "--nx-live": "#10B981";
|
|
105
|
+
readonly "--nx-live-dim": "rgba(16,185,129,0.09)";
|
|
106
|
+
readonly "--nx-live-border": "rgba(16,185,129,0.22)";
|
|
107
|
+
readonly "--nx-success": "#10B981";
|
|
108
|
+
readonly "--nx-success-dim": "rgba(16,185,129,0.10)";
|
|
109
|
+
readonly "--nx-error": "#EF4444";
|
|
110
|
+
readonly "--nx-error-dim": "rgba(239,68,68,0.10)";
|
|
111
|
+
readonly "--nx-warning": "#EAB308";
|
|
112
|
+
readonly "--nx-warning-dim": "rgba(234,179,8,0.10)";
|
|
113
|
+
readonly "--nx-font-sans": "'NexuiMono','JetBrains Mono',ui-monospace,monospace";
|
|
114
|
+
readonly "--nx-font-mono": "'NexuiMono','JetBrains Mono',ui-monospace,monospace";
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
export type NexuiTheme = keyof typeof NEXUI_THEMES;
|
|
118
|
+
//# sourceMappingURL=matrix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../../src/core/matrix.ts"],"names":[],"mappings":"AAMA,0BAAkB,YAAY;IAE5B,QAAQ,IAAQ;IAChB,MAAM,IAAU,CAAI,gBAAgB;IACpC,MAAM,IAAU,CAAI,gBAAgB;IACpC,MAAM,IAAU,CAAI,iBAAiB;IACrC,MAAM,IAAU,CAAI,iBAAiB;IACrC,MAAM,IAAU,CAAI,iBAAiB;IACrC,OAAO,IAAS,CAAI,iBAAiB;IAGrC,QAAQ,KAAS,CAAG,mCAAmC;IACvD,QAAQ,KAAS,CAAG,sCAAsC;IAC1D,MA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