@once-ui-system/core 1.8.4 → 1.8.5
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.md +1 -1
- package/ai/catalog.json +2 -2
- package/ai/manifest.json +2 -2
- package/ai/spec.json +2 -2
- package/dist/ai/catalog.json +2 -2
- package/dist/ai/manifest.json +2 -2
- package/dist/ai/spec.json +2 -2
- package/dist/components/CountFx.d.ts.map +1 -1
- package/dist/components/CountFx.js +19 -7
- package/dist/components/CountFx.js.map +1 -1
- package/dist/data/emoji-data.json +10 -8
- package/dist/package.json +1 -1
- package/package.json +173 -171
- package/scripts/init-agent.js +0 -0
- package/scripts/validate-ai-code.js +0 -0
- package/dist/scripts/init-agent.js +0 -156
- package/dist/scripts/validate-ai-code.js +0 -149
package/LICENSE.md
CHANGED
package/ai/catalog.json
CHANGED
package/ai/manifest.json
CHANGED
package/ai/spec.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@once-ui-system/core",
|
|
3
|
-
"version": "1.8.
|
|
4
|
-
"generated": "2026-
|
|
3
|
+
"version": "1.8.5",
|
|
4
|
+
"generated": "2026-09-16",
|
|
5
5
|
"format": "props are 'type', 'type = default', or '!type' (required). Components with 'mixins' also accept all props of those mixins. 'extends' means all props of that component are accepted.",
|
|
6
6
|
"tokens": {
|
|
7
7
|
"StaticSpacingToken": "\"0\" | \"1\" | \"2\" | \"4\" | \"8\" | \"12\" | \"16\" | \"20\" | \"24\" | \"32\" | \"40\" | \"48\" | \"56\" | \"64\" | \"80\" | \"104\" | \"128\" | \"160\"",
|
package/dist/ai/catalog.json
CHANGED
package/dist/ai/manifest.json
CHANGED
package/dist/ai/spec.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@once-ui-system/core",
|
|
3
|
-
"version": "1.8.
|
|
4
|
-
"generated": "2026-
|
|
3
|
+
"version": "1.8.5",
|
|
4
|
+
"generated": "2026-09-16",
|
|
5
5
|
"format": "props are 'type', 'type = default', or '!type' (required). Components with 'mixins' also accept all props of those mixins. 'extends' means all props of that component are accepted.",
|
|
6
6
|
"tokens": {
|
|
7
7
|
"StaticSpacingToken": "\"0\" | \"1\" | \"2\" | \"4\" | \"8\" | \"12\" | \"16\" | \"20\" | \"24\" | \"32\" | \"40\" | \"48\" | \"56\" | \"64\" | \"80\" | \"104\" | \"128\" | \"160\"",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CountFx.d.ts","sourceRoot":"","sources":["../../src/components/CountFx.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAO,IAAI,EAAE,MAAM,GAAG,CAAC;AAE9B,MAAM,WAAW,YAAa,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,aAAa,CAAC;IAC/C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,QAAA,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"CountFx.d.ts","sourceRoot":"","sources":["../../src/components/CountFx.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAO,IAAI,EAAE,MAAM,GAAG,CAAC;AAE9B,MAAM,WAAW,YAAa,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,aAAa,CAAC;IAC/C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,QAAA,MAAM,OAAO,kGAsUX,CAAC;AAGH,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -6,6 +6,14 @@ const CountFx = forwardRef(({ value, speed = 1000, easing = "ease-out", format,
|
|
|
6
6
|
const [displayValue, setDisplayValue] = useState(value);
|
|
7
7
|
const [animationProgress, setAnimationProgress] = useState(1);
|
|
8
8
|
const animationRef = useRef(undefined);
|
|
9
|
+
// What the display currently reads, mirrored on every frame. A run starts
|
|
10
|
+
// from here rather than from the last *completed* value: when `value` is
|
|
11
|
+
// changed back mid-flight, the old code saw `value === previousValueRef`
|
|
12
|
+
// and returned early, having already cancelled the frame, stranding the
|
|
13
|
+
// number at whatever it happened to be showing.
|
|
14
|
+
const displayValueRef = useRef(value);
|
|
15
|
+
// Where the run in flight started. `smooth` renders its digit wheels from
|
|
16
|
+
// this origin, so it has to track the current run, not the last finished one.
|
|
9
17
|
const previousValueRef = useRef(value);
|
|
10
18
|
// Default format function with separator and decimals support
|
|
11
19
|
const defaultFormat = (val) => {
|
|
@@ -128,12 +136,17 @@ const CountFx = forwardRef(({ value, speed = 1000, easing = "ease-out", format,
|
|
|
128
136
|
}).reverse();
|
|
129
137
|
};
|
|
130
138
|
useEffect(() => {
|
|
131
|
-
if (value ===
|
|
139
|
+
if (value === displayValueRef.current)
|
|
132
140
|
return;
|
|
133
|
-
const startValue =
|
|
141
|
+
const startValue = displayValueRef.current;
|
|
142
|
+
previousValueRef.current = startValue;
|
|
134
143
|
const endValue = value;
|
|
135
144
|
const difference = endValue - startValue;
|
|
136
145
|
let startTime;
|
|
146
|
+
const commit = (next) => {
|
|
147
|
+
displayValueRef.current = next;
|
|
148
|
+
setDisplayValue(next);
|
|
149
|
+
};
|
|
137
150
|
const animate = (timestamp) => {
|
|
138
151
|
if (!startTime)
|
|
139
152
|
startTime = timestamp;
|
|
@@ -145,7 +158,7 @@ const CountFx = forwardRef(({ value, speed = 1000, easing = "ease-out", format,
|
|
|
145
158
|
const currentValue = decimals !== undefined
|
|
146
159
|
? parseFloat((startValue + difference * easedProgress).toFixed(decimals))
|
|
147
160
|
: Math.floor(startValue + difference * easedProgress);
|
|
148
|
-
|
|
161
|
+
commit(currentValue);
|
|
149
162
|
}
|
|
150
163
|
else if (effect === "smooth") {
|
|
151
164
|
// For smooth animation, we track progress and animate digits independently
|
|
@@ -153,7 +166,7 @@ const CountFx = forwardRef(({ value, speed = 1000, easing = "ease-out", format,
|
|
|
153
166
|
const currentValue = decimals !== undefined
|
|
154
167
|
? parseFloat((startValue + difference * easedProgress).toFixed(decimals))
|
|
155
168
|
: Math.floor(startValue + difference * easedProgress);
|
|
156
|
-
|
|
169
|
+
commit(currentValue);
|
|
157
170
|
}
|
|
158
171
|
else {
|
|
159
172
|
// Simple animation
|
|
@@ -161,15 +174,14 @@ const CountFx = forwardRef(({ value, speed = 1000, easing = "ease-out", format,
|
|
|
161
174
|
const currentStepValue = decimals !== undefined
|
|
162
175
|
? parseFloat(currentValue.toFixed(decimals))
|
|
163
176
|
: Math.floor(currentValue);
|
|
164
|
-
|
|
177
|
+
commit(currentStepValue);
|
|
165
178
|
}
|
|
166
179
|
if (progress < 1) {
|
|
167
180
|
animationRef.current = requestAnimationFrame(animate);
|
|
168
181
|
}
|
|
169
182
|
else {
|
|
170
|
-
|
|
183
|
+
commit(endValue);
|
|
171
184
|
setAnimationProgress(1);
|
|
172
|
-
previousValueRef.current = endValue;
|
|
173
185
|
}
|
|
174
186
|
};
|
|
175
187
|
if (animationRef.current) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CountFx.js","sourceRoot":"","sources":["../../src/components/CountFx.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AAa9B,MAAM,OAAO,GAAG,UAAU,CAA+B,CAAC,EACxD,KAAK,EACL,KAAK,GAAG,IAAI,EACZ,MAAM,GAAG,UAAU,EACnB,MAAM,EACN,SAAS,EACT,QAAQ,EACR,MAAM,GAAG,QAAQ,EACjB,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,GAAG,EAAE,EAAE;IACR,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC9D,MAAM,YAAY,GAAG,MAAM,CAAqB,SAAS,CAAC,CAAC;IAC3D,MAAM,gBAAgB,GAAG,MAAM,CAAS,KAAK,CAAC,CAAC;IAE/C,8DAA8D;IAC9D,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,EAAE;QACpC,IAAI,cAAc,GAAG,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAErF,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACxC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,uBAAuB,EAAE,SAAS,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B,CAAC,OAAO,EAAE,KAAK,EAAE,iBAAiB,CAAC,EACtE,QAAQ,IACJ,GACF,CACR,CAAC;IACJ,CAAC;IAED,OAAO,CACL,eAAM,GAAG,EAAE,GAAG,YACZ,MAAC,IAAI,OAAK,IAAI,aACX,WAAW,CAAC,YAAY,CAAC,EACzB,QAAQ,IACJ,GACF,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -6293,6 +6293,16 @@
|
|
|
6293
6293
|
"fly"
|
|
6294
6294
|
]
|
|
6295
6295
|
},
|
|
6296
|
+
{
|
|
6297
|
+
"char": "🪿",
|
|
6298
|
+
"description": "goose",
|
|
6299
|
+
"aliases": [
|
|
6300
|
+
"goose"
|
|
6301
|
+
],
|
|
6302
|
+
"tags": [
|
|
6303
|
+
"honk"
|
|
6304
|
+
]
|
|
6305
|
+
},
|
|
6296
6306
|
{
|
|
6297
6307
|
"char": "🐸",
|
|
6298
6308
|
"description": "frog",
|
|
@@ -15892,14 +15902,6 @@
|
|
|
15892
15902
|
],
|
|
15893
15903
|
"tags": []
|
|
15894
15904
|
},
|
|
15895
|
-
{
|
|
15896
|
-
"char": "🇺🇳",
|
|
15897
|
-
"description": "flag: United Nations",
|
|
15898
|
-
"aliases": [
|
|
15899
|
-
"united_nations"
|
|
15900
|
-
],
|
|
15901
|
-
"tags": []
|
|
15902
|
-
},
|
|
15903
15905
|
{
|
|
15904
15906
|
"char": "🇺🇸",
|
|
15905
15907
|
"description": "flag: United States",
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,171 +1,173 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@once-ui-system/core",
|
|
3
|
-
"version": "1.8.
|
|
4
|
-
"description": "Once UI for Next.js NPM package",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"once-ui",
|
|
7
|
-
"react",
|
|
8
|
-
"nextjs",
|
|
9
|
-
"scss",
|
|
10
|
-
"design system",
|
|
11
|
-
"design framework",
|
|
12
|
-
"nextjs design system",
|
|
13
|
-
"ai",
|
|
14
|
-
"agent",
|
|
15
|
-
"codegen"
|
|
16
|
-
],
|
|
17
|
-
"author": "Once UI",
|
|
18
|
-
"license": "MIT",
|
|
19
|
-
"repository": {
|
|
20
|
-
"type": "git",
|
|
21
|
-
"url": "https://github.com/once-ui-system/core.git",
|
|
22
|
-
"directory": "packages/core"
|
|
23
|
-
},
|
|
24
|
-
"bugs": {
|
|
25
|
-
"url": "https://github.com/once-ui-system/core/issues"
|
|
26
|
-
},
|
|
27
|
-
"homepage": "https://docs.once-ui.com",
|
|
28
|
-
"onceUi": {
|
|
29
|
-
"harness": "./ai/manifest.json",
|
|
30
|
-
"bootstrap": [
|
|
31
|
-
"./ai/rules.compact.md",
|
|
32
|
-
"./ai/catalog.json"
|
|
33
|
-
],
|
|
34
|
-
"tasks": "./ai/tasks/index.json",
|
|
35
|
-
"validate": "./scripts/validate-ai-code.js",
|
|
36
|
-
"initAgent": "./scripts/init-agent.js",
|
|
37
|
-
"docs": "https://docs.once-ui.com/once-ui/ai-coding"
|
|
38
|
-
},
|
|
39
|
-
"bin": {
|
|
40
|
-
"once-ui-init-agent": "./scripts/init-agent.js",
|
|
41
|
-
"once-ui-validate-ai-code": "./scripts/validate-ai-code.js"
|
|
42
|
-
},
|
|
43
|
-
"main": "dist/index.js",
|
|
44
|
-
"exports": {
|
|
45
|
-
".": {
|
|
46
|
-
"types": "./dist/index.d.ts",
|
|
47
|
-
"import": "./dist/index.js",
|
|
48
|
-
"require": "./dist/index.js"
|
|
49
|
-
},
|
|
50
|
-
"./components": {
|
|
51
|
-
"types": "./dist/components/index.d.ts",
|
|
52
|
-
"import": "./dist/components/index.js",
|
|
53
|
-
"require": "./dist/components/index.js"
|
|
54
|
-
},
|
|
55
|
-
"./components/*": {
|
|
56
|
-
"types": "./dist/components/*.d.ts",
|
|
57
|
-
"import": "./dist/components/*.js",
|
|
58
|
-
"require": "./dist/components/*.js"
|
|
59
|
-
},
|
|
60
|
-
"./contexts": {
|
|
61
|
-
"types": "./dist/contexts/index.d.ts",
|
|
62
|
-
"import": "./dist/contexts/index.js",
|
|
63
|
-
"require": "./dist/contexts/index.js"
|
|
64
|
-
},
|
|
65
|
-
"./modules": {
|
|
66
|
-
"types": "./dist/modules/index.d.ts",
|
|
67
|
-
"import": "./dist/modules/index.js",
|
|
68
|
-
"require": "./dist/modules/index.js"
|
|
69
|
-
},
|
|
70
|
-
"./icons": {
|
|
71
|
-
"types": "./dist/icons.d.ts",
|
|
72
|
-
"import": "./dist/icons.js",
|
|
73
|
-
"require": "./dist/icons.js"
|
|
74
|
-
},
|
|
75
|
-
"./types": {
|
|
76
|
-
"types": "./dist/types.d.ts",
|
|
77
|
-
"import": "./dist/types.js",
|
|
78
|
-
"require": "./dist/types.js"
|
|
79
|
-
},
|
|
80
|
-
"./interfaces": {
|
|
81
|
-
"types": "./dist/interfaces.d.ts",
|
|
82
|
-
"import": "./dist/interfaces.js",
|
|
83
|
-
"require": "./dist/interfaces.js"
|
|
84
|
-
},
|
|
85
|
-
"./css/styles.css": "./dist/css/styles.css",
|
|
86
|
-
"./css/tokens.css": "./dist/css/tokens.css",
|
|
87
|
-
"./utils": {
|
|
88
|
-
"types": "./dist/utils/index.d.ts",
|
|
89
|
-
"import": "./dist/utils/index.js",
|
|
90
|
-
"require": "./dist/utils/index.js"
|
|
91
|
-
},
|
|
92
|
-
"./hooks": {
|
|
93
|
-
"types": "./dist/hooks/index.d.ts",
|
|
94
|
-
"import": "./dist/hooks/index.js",
|
|
95
|
-
"require": "./dist/hooks/index.js"
|
|
96
|
-
},
|
|
97
|
-
"./server": {
|
|
98
|
-
"types": "./dist/server/index.d.ts",
|
|
99
|
-
"import": "./dist/server/index.js",
|
|
100
|
-
"require": "./dist/server/index.js"
|
|
101
|
-
},
|
|
102
|
-
"./ai/manifest.json": "./ai/manifest.json",
|
|
103
|
-
"./ai/spec.json": "./ai/spec.json",
|
|
104
|
-
"./ai/catalog.json": "./ai/catalog.json",
|
|
105
|
-
"./ai/gotchas.json": "./ai/gotchas.json",
|
|
106
|
-
"./ai/rules.compact.md": "./ai/rules.compact.md",
|
|
107
|
-
"./ai/rules.md": "./ai/rules.md",
|
|
108
|
-
"./ai/recipes.md": "./ai/recipes.md",
|
|
109
|
-
"./ai/tasks/*": "./ai/tasks/*",
|
|
110
|
-
"./ai/components/*": "./ai/components/*",
|
|
111
|
-
"./ai/examples/*": "./ai/examples/*",
|
|
112
|
-
"./ai/examples/blocks/*": "./ai/examples/blocks/*",
|
|
113
|
-
"./AGENTS.md": "./AGENTS.md"
|
|
114
|
-
},
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
"
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
},
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@once-ui-system/core",
|
|
3
|
+
"version": "1.8.5",
|
|
4
|
+
"description": "Once UI for Next.js NPM package",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"once-ui",
|
|
7
|
+
"react",
|
|
8
|
+
"nextjs",
|
|
9
|
+
"scss",
|
|
10
|
+
"design system",
|
|
11
|
+
"design framework",
|
|
12
|
+
"nextjs design system",
|
|
13
|
+
"ai",
|
|
14
|
+
"agent",
|
|
15
|
+
"codegen"
|
|
16
|
+
],
|
|
17
|
+
"author": "Once UI",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/once-ui-system/core.git",
|
|
22
|
+
"directory": "packages/core"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/once-ui-system/core/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://docs.once-ui.com",
|
|
28
|
+
"onceUi": {
|
|
29
|
+
"harness": "./ai/manifest.json",
|
|
30
|
+
"bootstrap": [
|
|
31
|
+
"./ai/rules.compact.md",
|
|
32
|
+
"./ai/catalog.json"
|
|
33
|
+
],
|
|
34
|
+
"tasks": "./ai/tasks/index.json",
|
|
35
|
+
"validate": "./scripts/validate-ai-code.js",
|
|
36
|
+
"initAgent": "./scripts/init-agent.js",
|
|
37
|
+
"docs": "https://docs.once-ui.com/once-ui/ai-coding"
|
|
38
|
+
},
|
|
39
|
+
"bin": {
|
|
40
|
+
"once-ui-init-agent": "./scripts/init-agent.js",
|
|
41
|
+
"once-ui-validate-ai-code": "./scripts/validate-ai-code.js"
|
|
42
|
+
},
|
|
43
|
+
"main": "dist/index.js",
|
|
44
|
+
"exports": {
|
|
45
|
+
".": {
|
|
46
|
+
"types": "./dist/index.d.ts",
|
|
47
|
+
"import": "./dist/index.js",
|
|
48
|
+
"require": "./dist/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./components": {
|
|
51
|
+
"types": "./dist/components/index.d.ts",
|
|
52
|
+
"import": "./dist/components/index.js",
|
|
53
|
+
"require": "./dist/components/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./components/*": {
|
|
56
|
+
"types": "./dist/components/*.d.ts",
|
|
57
|
+
"import": "./dist/components/*.js",
|
|
58
|
+
"require": "./dist/components/*.js"
|
|
59
|
+
},
|
|
60
|
+
"./contexts": {
|
|
61
|
+
"types": "./dist/contexts/index.d.ts",
|
|
62
|
+
"import": "./dist/contexts/index.js",
|
|
63
|
+
"require": "./dist/contexts/index.js"
|
|
64
|
+
},
|
|
65
|
+
"./modules": {
|
|
66
|
+
"types": "./dist/modules/index.d.ts",
|
|
67
|
+
"import": "./dist/modules/index.js",
|
|
68
|
+
"require": "./dist/modules/index.js"
|
|
69
|
+
},
|
|
70
|
+
"./icons": {
|
|
71
|
+
"types": "./dist/icons.d.ts",
|
|
72
|
+
"import": "./dist/icons.js",
|
|
73
|
+
"require": "./dist/icons.js"
|
|
74
|
+
},
|
|
75
|
+
"./types": {
|
|
76
|
+
"types": "./dist/types.d.ts",
|
|
77
|
+
"import": "./dist/types.js",
|
|
78
|
+
"require": "./dist/types.js"
|
|
79
|
+
},
|
|
80
|
+
"./interfaces": {
|
|
81
|
+
"types": "./dist/interfaces.d.ts",
|
|
82
|
+
"import": "./dist/interfaces.js",
|
|
83
|
+
"require": "./dist/interfaces.js"
|
|
84
|
+
},
|
|
85
|
+
"./css/styles.css": "./dist/css/styles.css",
|
|
86
|
+
"./css/tokens.css": "./dist/css/tokens.css",
|
|
87
|
+
"./utils": {
|
|
88
|
+
"types": "./dist/utils/index.d.ts",
|
|
89
|
+
"import": "./dist/utils/index.js",
|
|
90
|
+
"require": "./dist/utils/index.js"
|
|
91
|
+
},
|
|
92
|
+
"./hooks": {
|
|
93
|
+
"types": "./dist/hooks/index.d.ts",
|
|
94
|
+
"import": "./dist/hooks/index.js",
|
|
95
|
+
"require": "./dist/hooks/index.js"
|
|
96
|
+
},
|
|
97
|
+
"./server": {
|
|
98
|
+
"types": "./dist/server/index.d.ts",
|
|
99
|
+
"import": "./dist/server/index.js",
|
|
100
|
+
"require": "./dist/server/index.js"
|
|
101
|
+
},
|
|
102
|
+
"./ai/manifest.json": "./ai/manifest.json",
|
|
103
|
+
"./ai/spec.json": "./ai/spec.json",
|
|
104
|
+
"./ai/catalog.json": "./ai/catalog.json",
|
|
105
|
+
"./ai/gotchas.json": "./ai/gotchas.json",
|
|
106
|
+
"./ai/rules.compact.md": "./ai/rules.compact.md",
|
|
107
|
+
"./ai/rules.md": "./ai/rules.md",
|
|
108
|
+
"./ai/recipes.md": "./ai/recipes.md",
|
|
109
|
+
"./ai/tasks/*": "./ai/tasks/*",
|
|
110
|
+
"./ai/components/*": "./ai/components/*",
|
|
111
|
+
"./ai/examples/*": "./ai/examples/*",
|
|
112
|
+
"./ai/examples/blocks/*": "./ai/examples/blocks/*",
|
|
113
|
+
"./AGENTS.md": "./AGENTS.md"
|
|
114
|
+
},
|
|
115
|
+
"scripts": {
|
|
116
|
+
"build": "pnpm clean && pnpm generate-emoji-data && pnpm generate-ai-spec && tsc --project tsconfig.build.json && pnpm copy-files && pnpm build:css",
|
|
117
|
+
"build:css": "sass src/styles/index.scss:dist/css/styles.css src/tokens/index.scss:dist/css/tokens.css --style=compressed",
|
|
118
|
+
"copy-files": "node scripts/copy-files.js",
|
|
119
|
+
"clean": "rimraf dist",
|
|
120
|
+
"prepare": "pnpm build",
|
|
121
|
+
"lint": "biome check .",
|
|
122
|
+
"format": "biome format --write .",
|
|
123
|
+
"format:check": "biome format .",
|
|
124
|
+
"test": "vitest run",
|
|
125
|
+
"test:watch": "vitest",
|
|
126
|
+
"typecheck": "tsc --noEmit",
|
|
127
|
+
"dev": "tsc --watch --preserveWatchOutput",
|
|
128
|
+
"prepack": "pnpm build",
|
|
129
|
+
"generate-emoji-data": "node scripts/generate-emoji-data.js",
|
|
130
|
+
"generate-ai-spec": "node scripts/generate-ai-spec.js",
|
|
131
|
+
"init-agent": "node scripts/init-agent.js",
|
|
132
|
+
"validate-ai-code": "node scripts/validate-ai-code.js"
|
|
133
|
+
},
|
|
134
|
+
"dependencies": {
|
|
135
|
+
"@floating-ui/react-dom": "^2.1.9",
|
|
136
|
+
"clsx": "^2.1.1",
|
|
137
|
+
"compressorjs": "^1.3.0",
|
|
138
|
+
"date-fns": "^4.4.0",
|
|
139
|
+
"prismjs": "^1.30.0",
|
|
140
|
+
"react-icons": "^5.7.0",
|
|
141
|
+
"recharts": "^3.10.1"
|
|
142
|
+
},
|
|
143
|
+
"peerDependencies": {
|
|
144
|
+
"next": ">=15.5",
|
|
145
|
+
"react": ">=18",
|
|
146
|
+
"react-dom": ">=18",
|
|
147
|
+
"sass": "^1.77.6",
|
|
148
|
+
"sharp": "^0.33.4 || ^0.34 || ^0.35"
|
|
149
|
+
},
|
|
150
|
+
"peerDependenciesMeta": {
|
|
151
|
+
"sharp": {
|
|
152
|
+
"optional": true
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"devDependencies": {
|
|
156
|
+
"@biomejs/biome": "2.5.6",
|
|
157
|
+
"@testing-library/jest-dom": "^7.0.0",
|
|
158
|
+
"@testing-library/react": "^16.3.2",
|
|
159
|
+
"@testing-library/user-event": "^14.6.1",
|
|
160
|
+
"@types/node": "26.1.2",
|
|
161
|
+
"@types/react": "19.2.17",
|
|
162
|
+
"@types/react-dom": "19.2.3",
|
|
163
|
+
"@vitest/ui": "^4.1.10",
|
|
164
|
+
"jsdom": "^30.0.0",
|
|
165
|
+
"rimraf": "^6.1.3",
|
|
166
|
+
"typescript": "6.0.3",
|
|
167
|
+
"vitest": "^4.1.10"
|
|
168
|
+
},
|
|
169
|
+
"overrides": {
|
|
170
|
+
"@types/react": "19.2.17",
|
|
171
|
+
"@types/react-dom": "19.2.3"
|
|
172
|
+
}
|
|
173
|
+
}
|
package/scripts/init-agent.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Scaffold agent harness pointers in a consumer project.
|
|
4
|
-
* Usage: npx once-ui-init-agent [--force] [--dry-run]
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const fs = require("fs");
|
|
8
|
-
const path = require("path");
|
|
9
|
-
|
|
10
|
-
const PACKAGE_ROOT = path.join(__dirname, "..");
|
|
11
|
-
const MARKER_START = "<!-- once-ui-agent-harness:start -->";
|
|
12
|
-
const MARKER_END = "<!-- once-ui-agent-harness:end -->";
|
|
13
|
-
|
|
14
|
-
const PROJECT_AGENTS_SECTION = `${MARKER_START}
|
|
15
|
-
## Once UI codegen harness
|
|
16
|
-
|
|
17
|
-
Before generating Once UI code, load the harness from your installed package (not full doc pages):
|
|
18
|
-
|
|
19
|
-
1. Read \`node_modules/@once-ui-system/core/ai/manifest.json\`
|
|
20
|
-
2. Load bootstrap: \`ai/rules.compact.md\` + \`ai/catalog.json\`
|
|
21
|
-
3. Match intent via \`ai/tasks/index.json\` → fetch task bundle + component slices
|
|
22
|
-
4. Validate: \`npx once-ui-validate-ai-code path/to/file.tsx\`
|
|
23
|
-
|
|
24
|
-
npm exports: \`@once-ui-system/core/ai/manifest.json\`
|
|
25
|
-
|
|
26
|
-
Remote fallback: https://docs.once-ui.com/ai/manifest.json
|
|
27
|
-
${MARKER_END}
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
function parseArgs(argv) {
|
|
31
|
-
return {
|
|
32
|
-
force: argv.includes("--force"),
|
|
33
|
-
dryRun: argv.includes("--dry-run"),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function findProjectRoot(startDir = process.cwd()) {
|
|
38
|
-
let dir = path.resolve(startDir);
|
|
39
|
-
|
|
40
|
-
while (true) {
|
|
41
|
-
const pkgPath = path.join(dir, "package.json");
|
|
42
|
-
if (fs.existsSync(pkgPath)) {
|
|
43
|
-
try {
|
|
44
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
45
|
-
if (pkg.name !== "@once-ui-system/core") {
|
|
46
|
-
return dir;
|
|
47
|
-
}
|
|
48
|
-
} catch {
|
|
49
|
-
// keep walking
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const parent = path.dirname(dir);
|
|
54
|
-
if (parent === dir) {
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
dir = parent;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return path.resolve(startDir);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function upsertMarkedSection(existing, section, force) {
|
|
64
|
-
if (existing.includes(MARKER_START) && existing.includes(MARKER_END)) {
|
|
65
|
-
if (!force) {
|
|
66
|
-
return { content: existing, changed: false, reason: "AGENTS.md already contains Once UI harness section" };
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const start = existing.indexOf(MARKER_START);
|
|
70
|
-
const end = existing.indexOf(MARKER_END) + MARKER_END.length;
|
|
71
|
-
return {
|
|
72
|
-
content: `${existing.slice(0, start)}${section}${existing.slice(end)}`,
|
|
73
|
-
changed: true,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (existing.trim().length === 0) {
|
|
78
|
-
return {
|
|
79
|
-
content: `# AGENTS.md\n\n${section}\n`,
|
|
80
|
-
changed: true,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
content: `${existing.trimEnd()}\n\n${section}\n`,
|
|
86
|
-
changed: true,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function writeFile(root, relativePath, content, { dryRun, force }) {
|
|
91
|
-
const target = path.join(root, relativePath);
|
|
92
|
-
const exists = fs.existsSync(target);
|
|
93
|
-
|
|
94
|
-
if (exists && !force) {
|
|
95
|
-
const current = fs.readFileSync(target, "utf8");
|
|
96
|
-
if (current === content) {
|
|
97
|
-
return { path: target, status: "unchanged" };
|
|
98
|
-
}
|
|
99
|
-
return { path: target, status: "skipped", reason: "already exists (use --force)" };
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (dryRun) {
|
|
103
|
-
return { path: target, status: "would-write" };
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
107
|
-
fs.writeFileSync(target, content, "utf8");
|
|
108
|
-
return { path: target, status: exists ? "updated" : "created" };
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function main() {
|
|
112
|
-
const options = parseArgs(process.argv.slice(2));
|
|
113
|
-
const projectRoot = findProjectRoot();
|
|
114
|
-
const cursorRuleTemplate = fs.readFileSync(
|
|
115
|
-
path.join(PACKAGE_ROOT, "agent", "once-ui-codegen.mdc"),
|
|
116
|
-
"utf8",
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
const agentsPath = path.join(projectRoot, "AGENTS.md");
|
|
120
|
-
let agentsContent = "";
|
|
121
|
-
if (fs.existsSync(agentsPath)) {
|
|
122
|
-
agentsContent = fs.readFileSync(agentsPath, "utf8");
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const agentsResult = upsertMarkedSection(agentsContent, PROJECT_AGENTS_SECTION, options.force);
|
|
126
|
-
const results = [];
|
|
127
|
-
|
|
128
|
-
if (agentsResult.changed) {
|
|
129
|
-
results.push(
|
|
130
|
-
writeFile(projectRoot, "AGENTS.md", agentsResult.content, options),
|
|
131
|
-
);
|
|
132
|
-
} else {
|
|
133
|
-
results.push({
|
|
134
|
-
path: agentsPath,
|
|
135
|
-
status: "unchanged",
|
|
136
|
-
reason: agentsResult.reason,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
results.push(
|
|
141
|
-
writeFile(projectRoot, ".cursor/rules/once-ui-codegen.mdc", cursorRuleTemplate, options),
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
console.log(`Once UI agent harness setup (${options.dryRun ? "dry run" : "applied"})`);
|
|
145
|
-
console.log(`Project root: ${projectRoot}`);
|
|
146
|
-
for (const result of results) {
|
|
147
|
-
const suffix = result.reason ? ` (${result.reason})` : "";
|
|
148
|
-
console.log(`- ${result.status}: ${path.relative(projectRoot, result.path)}${suffix}`);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (!options.dryRun) {
|
|
152
|
-
console.log("\nNext: open a .tsx file and ask your agent to build Once UI — it should load the harness from node_modules/@once-ui-system/core/ai/");
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
main();
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Mechanical Once UI codegen validator.
|
|
4
|
-
* Usage: node scripts/validate-ai-code.js <file.tsx> [--fix]
|
|
5
|
-
* node scripts/validate-ai-code.js --stdin < file.tsx
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const fs = require("fs");
|
|
9
|
-
const path = require("path");
|
|
10
|
-
|
|
11
|
-
const ROOT = path.join(__dirname, "..");
|
|
12
|
-
const SPEC_PATH = path.join(ROOT, "ai", "spec.json");
|
|
13
|
-
|
|
14
|
-
function loadSpec() {
|
|
15
|
-
if (!fs.existsSync(SPEC_PATH)) return { components: {}, tokens: {} };
|
|
16
|
-
return JSON.parse(fs.readFileSync(SPEC_PATH, "utf8"));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function parseIconNames(spec) {
|
|
20
|
-
const raw = spec.tokens?.IconName || "";
|
|
21
|
-
const matches = raw.match(/"([^"]+)"/g) || [];
|
|
22
|
-
return new Set(matches.map((m) => m.slice(1, -1)));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function readInput(argv) {
|
|
26
|
-
const fileArg = argv.find((a) => !a.startsWith("-"));
|
|
27
|
-
if (argv.includes("--stdin")) {
|
|
28
|
-
return { source: fs.readFileSync(0, "utf8"), file: "<stdin>" };
|
|
29
|
-
}
|
|
30
|
-
if (!fileArg) {
|
|
31
|
-
console.error("Usage: validate-ai-code.js <file.tsx> [--fix] | --stdin");
|
|
32
|
-
process.exit(2);
|
|
33
|
-
}
|
|
34
|
-
return { source: fs.readFileSync(fileArg, "utf8"), file: fileArg };
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function validate(source, spec, iconNames) {
|
|
38
|
-
const issues = [];
|
|
39
|
-
|
|
40
|
-
const add = (rule, message, fix) => issues.push({ rule, message, fix });
|
|
41
|
-
|
|
42
|
-
if (/fillWidth[\s\S]{0,80}fillHeight|<Flex[^>]*direction="column"|<Flex[^>]*direction="row"/.test(source)) {
|
|
43
|
-
if (/fillWidth[\s\S]{0,120}fillHeight/.test(source)) {
|
|
44
|
-
add("layout.shorthands", "Use fill instead of fillWidth + fillHeight", "fill");
|
|
45
|
-
}
|
|
46
|
-
if (/<Flex[^>]*direction="column"/.test(source)) {
|
|
47
|
-
add("layout.shorthands", "Use Column instead of Flex direction=\"column\"", "Column");
|
|
48
|
-
}
|
|
49
|
-
if (/<Flex[^>]*direction="row"/.test(source)) {
|
|
50
|
-
add("layout.shorthands", "Use Row instead of Flex direction=\"row\"", "Row");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (/horizontal="center"[\s\S]{0,80}vertical="center"/.test(source)) {
|
|
55
|
-
add("layout.shorthands", "Use center instead of horizontal=\"center\" vertical=\"center\"", "center");
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (/position="relative"/.test(source)) {
|
|
59
|
-
add("layout.defaults", "position=\"relative\" is the default — omit it");
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (/<Button[^>]*variant="primary"/.test(source)) {
|
|
63
|
-
add("layout.defaults", "variant=\"primary\" is the Button default — omit it");
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (/#[0-9a-fA-F]{3,8}\b|rgb\s*\(|rgba\s*\(/.test(source)) {
|
|
67
|
-
add("color.tokens", "Use semantic color tokens, not hex/rgb");
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (/<img[\s>/]|<a[\s>/]|<button[\s>/]/.test(source)) {
|
|
71
|
-
add("components.primitives", "Use Once UI components (Media, SmartLink, Button) instead of raw HTML");
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const cardMatches = source.match(/<Card\b[^>]*>/g) || [];
|
|
75
|
-
for (const tag of cardMatches) {
|
|
76
|
-
if (!/\b(href|onClick)=/.test(tag)) {
|
|
77
|
-
add("Card.interactive", "Card without href/onClick — use Column + surface recipe for static panels");
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const iconPropRe = /(?:prefixIcon|suffixIcon|name)=["']([^"']+)["']/g;
|
|
83
|
-
let iconMatch;
|
|
84
|
-
while ((iconMatch = iconPropRe.exec(source)) !== null) {
|
|
85
|
-
const name = iconMatch[1];
|
|
86
|
-
if (iconNames.size && !iconNames.has(name)) {
|
|
87
|
-
add("Icon.names", `Unknown icon name "${name}" — use IconName from spec.json`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (/delay=\{[^}]*\*\s*80/.test(source)) {
|
|
92
|
-
add("RevealFx.delay", "RevealFx delay is in seconds — use index * 0.1, not index * 80");
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (/<Fade[^>]*>[\s\S]*<(Column|Row)[^>]*overflowY/.test(source)) {
|
|
96
|
-
add("Fade.edge", "Fade wrapping scroll content — use as absolute edge strip instead");
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (/style=\{\{[^}]*(gap|padding|margin|color|background):/.test(source)) {
|
|
100
|
-
add("spacing.tokens", "Use token props (gap, padding, background) instead of style={{}}");
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return issues;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function applyFixes(source, issues) {
|
|
107
|
-
let out = source;
|
|
108
|
-
for (const issue of issues) {
|
|
109
|
-
if (issue.fix === "fill") {
|
|
110
|
-
out = out.replace(/\bfillWidth\b\s*\n?\s*\bfillHeight\b/g, "fill");
|
|
111
|
-
}
|
|
112
|
-
if (issue.fix === "center") {
|
|
113
|
-
out = out.replace(/\bhorizontal="center"\s*\n?\s*vertical="center"/g, "center");
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return out;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function main() {
|
|
120
|
-
const spec = loadSpec();
|
|
121
|
-
const iconNames = parseIconNames(spec);
|
|
122
|
-
const fix = process.argv.includes("--fix");
|
|
123
|
-
const { source, file } = readInput(process.argv.slice(2));
|
|
124
|
-
|
|
125
|
-
const issues = validate(source, spec, iconNames);
|
|
126
|
-
|
|
127
|
-
if (issues.length === 0) {
|
|
128
|
-
console.log(`✓ ${file}: no mechanical issues`);
|
|
129
|
-
process.exit(0);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
console.log(`✗ ${file}: ${issues.length} issue(s)`);
|
|
133
|
-
for (const issue of issues) {
|
|
134
|
-
console.log(` [${issue.rule}] ${issue.message}`);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (fix) {
|
|
138
|
-
const fixed = applyFixes(source, issues);
|
|
139
|
-
if (fixed !== source && !process.argv.includes("--stdin")) {
|
|
140
|
-
const fileArg = process.argv.find((a) => a.endsWith(".tsx") || a.endsWith(".jsx"));
|
|
141
|
-
fs.writeFileSync(fileArg, fixed);
|
|
142
|
-
console.log(`Applied auto-fixes to ${fileArg}`);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
process.exit(1);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
main();
|