@once-ui-system/core 1.7.12 → 1.7.13
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/AGENTS.md +53 -0
- package/README.md +27 -0
- package/agent/once-ui-codegen.mdc +27 -0
- package/ai/catalog.json +2 -2
- package/ai/components/ContextMenu.json +2 -2
- package/ai/components/Table.json +17 -2
- package/ai/manifest.json +2 -2
- package/ai/spec.json +22 -7
- package/dist/AGENTS.md +53 -0
- package/dist/README.md +27 -0
- package/dist/agent/once-ui-codegen.mdc +27 -0
- package/dist/ai/catalog.json +2 -2
- package/dist/ai/components/ContextMenu.json +2 -2
- package/dist/ai/components/Table.json +17 -2
- package/dist/ai/manifest.json +2 -2
- package/dist/ai/spec.json +22 -7
- package/dist/components/ContextMenu.d.ts +2 -2
- package/dist/components/ContextMenu.d.ts.map +1 -1
- package/dist/components/ContextMenu.js +3 -3
- package/dist/components/ContextMenu.js.map +1 -1
- package/dist/components/ElementType.d.ts.map +1 -1
- package/dist/components/ElementType.js +6 -4
- package/dist/components/ElementType.js.map +1 -1
- package/dist/components/Media.d.ts.map +1 -1
- package/dist/components/Media.js +6 -3
- package/dist/components/Media.js.map +1 -1
- package/dist/components/MediaVideoPlayer.d.ts +12 -0
- package/dist/components/MediaVideoPlayer.d.ts.map +1 -0
- package/dist/components/MediaVideoPlayer.js +246 -0
- package/dist/components/MediaVideoPlayer.js.map +1 -0
- package/dist/components/MediaVideoPlayer.module.scss +90 -0
- package/dist/components/Table.d.ts +34 -6
- package/dist/components/Table.d.ts.map +1 -1
- package/dist/components/Table.js +114 -30
- package/dist/components/Table.js.map +1 -1
- package/dist/components/Table.module.scss +174 -3
- package/dist/components/ThemeInit.d.ts.map +1 -1
- package/dist/components/ThemeInit.js +2 -1
- package/dist/components/ThemeInit.js.map +1 -1
- package/dist/components/Timeline.d.ts +1 -1
- package/dist/components/Timeline.d.ts.map +1 -1
- package/dist/components/Timeline.js +16 -52
- package/dist/components/Timeline.js.map +1 -1
- package/dist/data/emoji-data.json +8 -0
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +7 -2
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/code/CodeBlock.impl.d.ts.map +1 -1
- package/dist/modules/code/CodeBlock.impl.js +11 -5
- package/dist/modules/code/CodeBlock.impl.js.map +1 -1
- package/dist/modules/seo/Schema.d.ts.map +1 -1
- package/dist/modules/seo/Schema.js +3 -4
- package/dist/modules/seo/Schema.js.map +1 -1
- package/dist/package.json +22 -3
- package/dist/server/og-url-validation.d.ts +10 -0
- package/dist/server/og-url-validation.d.ts.map +1 -0
- package/dist/server/og-url-validation.js +234 -0
- package/dist/server/og-url-validation.js.map +1 -0
- package/dist/server/og-utils.d.ts +5 -2
- package/dist/server/og-utils.d.ts.map +1 -1
- package/dist/server/og-utils.js +39 -14
- package/dist/server/og-utils.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/safe-html.d.ts +19 -0
- package/dist/utils/safe-html.d.ts.map +1 -0
- package/dist/utils/safe-html.js +43 -0
- package/dist/utils/safe-html.js.map +1 -0
- package/package.json +23 -3
- package/scripts/copy-files.js +103 -0
- package/scripts/generate-ai-spec.js +464 -0
- package/scripts/generate-emoji-data.js +128 -0
- package/scripts/init-agent.js +156 -0
- package/scripts/validate-ai-code.js +149 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @once-ui-system/core — agent harness
|
|
2
|
+
|
|
3
|
+
This package ships an agent-first codegen harness under `ai/`. Use it when **writing Once UI code**, not full MDX documentation pages.
|
|
4
|
+
|
|
5
|
+
## Entry point
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
@once-ui-system/core/ai/manifest.json
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or from disk:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
node_modules/@once-ui-system/core/ai/manifest.json
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Bootstrap workflow
|
|
18
|
+
|
|
19
|
+
1. Read `ai/manifest.json`
|
|
20
|
+
2. Load bootstrap files: `ai/rules.compact.md` + `ai/catalog.json` (~6KB)
|
|
21
|
+
3. Match intent via `ai/tasks/index.json` → e.g. `ai/tasks/pricing.json`
|
|
22
|
+
4. Fetch component slices listed in the task bundle (`ai/components/*.json`)
|
|
23
|
+
5. Read the gold example referenced by the task; for production fidelity, read Pro blocks from `ai/examples/blocks/manifest.json`
|
|
24
|
+
6. Validate generated code: `npx once-ui-validate-ai-code path/to/file.tsx`
|
|
25
|
+
|
|
26
|
+
## npm exports
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
// Readable paths (version-pinned to your install)
|
|
30
|
+
import manifest from '@once-ui-system/core/ai/manifest.json';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# One-time project setup (writes AGENTS.md + Cursor rule in consumer app)
|
|
35
|
+
npx once-ui-init-agent
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Remote fallback
|
|
39
|
+
|
|
40
|
+
If you cannot read `node_modules`, use the docs host (may not match your installed version exactly):
|
|
41
|
+
|
|
42
|
+
- https://docs.once-ui.com/ai/manifest.json
|
|
43
|
+
- https://docs.once-ui.com/ai/rules.compact.md
|
|
44
|
+
- https://docs.once-ui.com/once-ui/ai-coding
|
|
45
|
+
|
|
46
|
+
## Key rules (summary)
|
|
47
|
+
|
|
48
|
+
- Use `Column` / `Row`, not `Flex` unless direction changes at breakpoints
|
|
49
|
+
- Use `fill`, not `fillWidth fillHeight`; use `center`, not `horizontal="center" vertical="center"`
|
|
50
|
+
- Static panels: `Column background="surface" border="neutral-alpha-weak" radius="l" padding="24"`
|
|
51
|
+
- `Card` is interactive only (`href` or `onClick`)
|
|
52
|
+
|
|
53
|
+
Full rules: `@once-ui-system/core/ai/rules.compact.md`
|
package/README.md
CHANGED
|
@@ -35,6 +35,33 @@ Learn how to set up and build with Once UI at [docs.once-ui.com](https://docs.on
|
|
|
35
35
|
npm install @once-ui-system/core
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
## AI codegen harness
|
|
39
|
+
|
|
40
|
+
This package includes an agent-first harness under `ai/` for generating Once UI code with minimal context (~6–10KB per task).
|
|
41
|
+
|
|
42
|
+
| Resource | Path |
|
|
43
|
+
|----------|------|
|
|
44
|
+
| Entry point | `@once-ui-system/core/ai/manifest.json` |
|
|
45
|
+
| Compact rules | `@once-ui-system/core/ai/rules.compact.md` |
|
|
46
|
+
| Component catalog | `@once-ui-system/core/ai/catalog.json` |
|
|
47
|
+
| Task bundles | `@once-ui-system/core/ai/tasks/index.json` |
|
|
48
|
+
|
|
49
|
+
**One-time setup in your app** (writes project `AGENTS.md` + Cursor rule):
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx once-ui-init-agent
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Validate generated code:**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx once-ui-validate-ai-code src/app/page.tsx
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Full guide: [docs.once-ui.com/once-ui/ai-coding](https://docs.once-ui.com/once-ui/ai-coding)
|
|
62
|
+
|
|
63
|
+
Machine-readable discovery: see the `onceUi` field in this package's `package.json`.
|
|
64
|
+
|
|
38
65
|
## Authors
|
|
39
66
|
|
|
40
67
|
Built and maintained by [**Lorant One**](https://lorant.one).
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Load Once UI agent harness before generating UI code
|
|
3
|
+
globs: "**/*.{tsx,jsx}"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Once UI codegen harness
|
|
8
|
+
|
|
9
|
+
Before generating or editing Once UI UI code in this project:
|
|
10
|
+
|
|
11
|
+
1. Read `@once-ui-system/core/ai/manifest.json` (or `node_modules/@once-ui-system/core/ai/manifest.json`)
|
|
12
|
+
2. Load bootstrap files from the manifest: `rules.compact.md` + `catalog.json`
|
|
13
|
+
3. Resolve intent via `ai/tasks/index.json` → fetch the matching task bundle
|
|
14
|
+
4. Fetch only the component slices listed in that task (`ai/components/*.json`)
|
|
15
|
+
5. Read the task's gold example; for production layouts, read matching Pro blocks from `ai/examples/blocks/manifest.json`
|
|
16
|
+
6. Validate output: `npx once-ui-validate-ai-code path/to/file.tsx`
|
|
17
|
+
|
|
18
|
+
## Do not
|
|
19
|
+
|
|
20
|
+
- Use full documentation MDX pages for codegen (too large; use the harness)
|
|
21
|
+
- Use `Flex direction="column"` when `Column` works; same for `Row`
|
|
22
|
+
- Use `fillWidth fillHeight` when `fill` works
|
|
23
|
+
- Use `Card` for static panels (use the surface recipe on `Column`)
|
|
24
|
+
|
|
25
|
+
## Remote fallback
|
|
26
|
+
|
|
27
|
+
https://docs.once-ui.com/ai/manifest.json
|
package/ai/catalog.json
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"className": "string",
|
|
14
14
|
"onSelect": "(value: string) => void",
|
|
15
15
|
"closeAfterClick": "boolean = true",
|
|
16
|
-
"
|
|
17
|
-
"onOpenChange": "(
|
|
16
|
+
"open": "boolean",
|
|
17
|
+
"onOpenChange": "(open: boolean) => void",
|
|
18
18
|
"selectedOption": "string",
|
|
19
19
|
"disabled": "boolean = false"
|
|
20
20
|
},
|
package/ai/components/Table.json
CHANGED
|
@@ -13,8 +13,23 @@
|
|
|
13
13
|
"StyleProps"
|
|
14
14
|
],
|
|
15
15
|
"props": {
|
|
16
|
-
"data": "!{ headers:
|
|
17
|
-
"onRowClick": "(rowIndex: number) => void"
|
|
16
|
+
"data": "!{ headers: TableHeader[]; rows: ReactNode[][]; }",
|
|
17
|
+
"onRowClick": "(rowIndex: number) => void",
|
|
18
|
+
"searchable": "boolean = false",
|
|
19
|
+
"searchPlaceholder": "string = Search...",
|
|
20
|
+
"striped": "boolean = false",
|
|
21
|
+
"hoverable": "boolean = true",
|
|
22
|
+
"compact": "boolean = false",
|
|
23
|
+
"loading": "boolean = false",
|
|
24
|
+
"emptyState": "ReactNode",
|
|
25
|
+
"actions": "TableAction[]",
|
|
26
|
+
"stickyHeader": "boolean = false",
|
|
27
|
+
"rowClassName": "(rowIndex: number) => string",
|
|
28
|
+
"cellClassName": "(rowIndex: number, cellIndex: number) => string",
|
|
29
|
+
"paginated": "boolean = false",
|
|
30
|
+
"defaultPageSize": "number = 10",
|
|
31
|
+
"pageSizeOptions": "number[] = [5, 10, 20, 50]",
|
|
32
|
+
"loadingState": "ReactNode"
|
|
18
33
|
},
|
|
19
34
|
"mixinsRef": [
|
|
20
35
|
"CommonProps",
|
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.7.
|
|
4
|
-
"generated": "2026-07-
|
|
3
|
+
"version": "1.7.13",
|
|
4
|
+
"generated": "2026-07-24",
|
|
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\"",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"TextWeight": "\"default\" | \"strong\"",
|
|
19
19
|
"TextSize": "TShirtSizes",
|
|
20
20
|
"TextVariant": "`${TextType}-${TextWeight}-${TextSize}`",
|
|
21
|
-
"IconName": "\"chevronUp\" | \"chevronDown\" | \"chevronRight\" | \"chevronLeft\" | \"chevronsLeftRight\" | \"refresh\" | \"light\" | \"dark\" | \"help\" | \"info\" | \"warning\" | \"danger\" | \"checkbox\" | \"check\" | \"copy\" | \"eyeDropper\" | \"clipboard\" | \"person\" | \"close\" | \"link\" | \"arrowUpRight\" | \"minus\" | \"plus\" | \"calendar\" | \"eye\" | \"eyeOff\" | \"search\" | \"security\" | \"sparkle\" | \"computer\" | \"minimize\" | \"maximize\" | \"smiley\" | \"paw\" | \"food\" | \"ball\" | \"world\" | \"gift\" | \"symbol\" | \"flag\" | \"wordmark\" | \"enter\" | \"play\" | \"pause\" | \"screen\" | \"document\" | \"radialGauge\" | \"linearGauge\" | \"
|
|
21
|
+
"IconName": "\"chevronUp\" | \"chevronDown\" | \"chevronRight\" | \"chevronLeft\" | \"chevronsLeftRight\" | \"refresh\" | \"light\" | \"dark\" | \"help\" | \"info\" | \"warning\" | \"danger\" | \"checkbox\" | \"check\" | \"copy\" | \"eyeDropper\" | \"clipboard\" | \"person\" | \"close\" | \"link\" | \"arrowUpRight\" | \"minus\" | \"plus\" | \"calendar\" | \"eye\" | \"eyeOff\" | \"search\" | \"security\" | \"sparkle\" | \"computer\" | \"minimize\" | \"maximize\" | \"smiley\" | \"paw\" | \"food\" | \"ball\" | \"world\" | \"gift\" | \"symbol\" | \"flag\" | \"wordmark\" | \"enter\" | \"play\" | \"pause\" | \"volume\" | \"volumeOff\" | \"screen\" | \"document\" | \"radialGauge\" | \"linearGauge\" | \"edit\" | \"trash\" | \"mail\" | \"download\""
|
|
22
22
|
},
|
|
23
23
|
"mixins": {
|
|
24
24
|
"CommonProps": {
|
|
@@ -753,8 +753,8 @@
|
|
|
753
753
|
"className": "string",
|
|
754
754
|
"onSelect": "(value: string) => void",
|
|
755
755
|
"closeAfterClick": "boolean = true",
|
|
756
|
-
"
|
|
757
|
-
"onOpenChange": "(
|
|
756
|
+
"open": "boolean",
|
|
757
|
+
"onOpenChange": "(open: boolean) => void",
|
|
758
758
|
"selectedOption": "string",
|
|
759
759
|
"disabled": "boolean = false"
|
|
760
760
|
}
|
|
@@ -2046,8 +2046,23 @@
|
|
|
2046
2046
|
"StyleProps"
|
|
2047
2047
|
],
|
|
2048
2048
|
"props": {
|
|
2049
|
-
"data": "!{ headers:
|
|
2050
|
-
"onRowClick": "(rowIndex: number) => void"
|
|
2049
|
+
"data": "!{ headers: TableHeader[]; rows: ReactNode[][]; }",
|
|
2050
|
+
"onRowClick": "(rowIndex: number) => void",
|
|
2051
|
+
"searchable": "boolean = false",
|
|
2052
|
+
"searchPlaceholder": "string = Search...",
|
|
2053
|
+
"striped": "boolean = false",
|
|
2054
|
+
"hoverable": "boolean = true",
|
|
2055
|
+
"compact": "boolean = false",
|
|
2056
|
+
"loading": "boolean = false",
|
|
2057
|
+
"emptyState": "ReactNode",
|
|
2058
|
+
"actions": "TableAction[]",
|
|
2059
|
+
"stickyHeader": "boolean = false",
|
|
2060
|
+
"rowClassName": "(rowIndex: number) => string",
|
|
2061
|
+
"cellClassName": "(rowIndex: number, cellIndex: number) => string",
|
|
2062
|
+
"paginated": "boolean = false",
|
|
2063
|
+
"defaultPageSize": "number = 10",
|
|
2064
|
+
"pageSizeOptions": "number[] = [5, 10, 20, 50]",
|
|
2065
|
+
"loadingState": "ReactNode"
|
|
2051
2066
|
}
|
|
2052
2067
|
},
|
|
2053
2068
|
"Tag": {
|
package/dist/AGENTS.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# @once-ui-system/core — agent harness
|
|
2
|
+
|
|
3
|
+
This package ships an agent-first codegen harness under `ai/`. Use it when **writing Once UI code**, not full MDX documentation pages.
|
|
4
|
+
|
|
5
|
+
## Entry point
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
@once-ui-system/core/ai/manifest.json
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or from disk:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
node_modules/@once-ui-system/core/ai/manifest.json
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Bootstrap workflow
|
|
18
|
+
|
|
19
|
+
1. Read `ai/manifest.json`
|
|
20
|
+
2. Load bootstrap files: `ai/rules.compact.md` + `ai/catalog.json` (~6KB)
|
|
21
|
+
3. Match intent via `ai/tasks/index.json` → e.g. `ai/tasks/pricing.json`
|
|
22
|
+
4. Fetch component slices listed in the task bundle (`ai/components/*.json`)
|
|
23
|
+
5. Read the gold example referenced by the task; for production fidelity, read Pro blocks from `ai/examples/blocks/manifest.json`
|
|
24
|
+
6. Validate generated code: `npx once-ui-validate-ai-code path/to/file.tsx`
|
|
25
|
+
|
|
26
|
+
## npm exports
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
// Readable paths (version-pinned to your install)
|
|
30
|
+
import manifest from '@once-ui-system/core/ai/manifest.json';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# One-time project setup (writes AGENTS.md + Cursor rule in consumer app)
|
|
35
|
+
npx once-ui-init-agent
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Remote fallback
|
|
39
|
+
|
|
40
|
+
If you cannot read `node_modules`, use the docs host (may not match your installed version exactly):
|
|
41
|
+
|
|
42
|
+
- https://docs.once-ui.com/ai/manifest.json
|
|
43
|
+
- https://docs.once-ui.com/ai/rules.compact.md
|
|
44
|
+
- https://docs.once-ui.com/once-ui/ai-coding
|
|
45
|
+
|
|
46
|
+
## Key rules (summary)
|
|
47
|
+
|
|
48
|
+
- Use `Column` / `Row`, not `Flex` unless direction changes at breakpoints
|
|
49
|
+
- Use `fill`, not `fillWidth fillHeight`; use `center`, not `horizontal="center" vertical="center"`
|
|
50
|
+
- Static panels: `Column background="surface" border="neutral-alpha-weak" radius="l" padding="24"`
|
|
51
|
+
- `Card` is interactive only (`href` or `onClick`)
|
|
52
|
+
|
|
53
|
+
Full rules: `@once-ui-system/core/ai/rules.compact.md`
|
package/dist/README.md
CHANGED
|
@@ -35,6 +35,33 @@ Learn how to set up and build with Once UI at [docs.once-ui.com](https://docs.on
|
|
|
35
35
|
npm install @once-ui-system/core
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
## AI codegen harness
|
|
39
|
+
|
|
40
|
+
This package includes an agent-first harness under `ai/` for generating Once UI code with minimal context (~6–10KB per task).
|
|
41
|
+
|
|
42
|
+
| Resource | Path |
|
|
43
|
+
|----------|------|
|
|
44
|
+
| Entry point | `@once-ui-system/core/ai/manifest.json` |
|
|
45
|
+
| Compact rules | `@once-ui-system/core/ai/rules.compact.md` |
|
|
46
|
+
| Component catalog | `@once-ui-system/core/ai/catalog.json` |
|
|
47
|
+
| Task bundles | `@once-ui-system/core/ai/tasks/index.json` |
|
|
48
|
+
|
|
49
|
+
**One-time setup in your app** (writes project `AGENTS.md` + Cursor rule):
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx once-ui-init-agent
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Validate generated code:**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx once-ui-validate-ai-code src/app/page.tsx
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Full guide: [docs.once-ui.com/once-ui/ai-coding](https://docs.once-ui.com/once-ui/ai-coding)
|
|
62
|
+
|
|
63
|
+
Machine-readable discovery: see the `onceUi` field in this package's `package.json`.
|
|
64
|
+
|
|
38
65
|
## Authors
|
|
39
66
|
|
|
40
67
|
Built and maintained by [**Lorant One**](https://lorant.one).
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Load Once UI agent harness before generating UI code
|
|
3
|
+
globs: "**/*.{tsx,jsx}"
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Once UI codegen harness
|
|
8
|
+
|
|
9
|
+
Before generating or editing Once UI UI code in this project:
|
|
10
|
+
|
|
11
|
+
1. Read `@once-ui-system/core/ai/manifest.json` (or `node_modules/@once-ui-system/core/ai/manifest.json`)
|
|
12
|
+
2. Load bootstrap files from the manifest: `rules.compact.md` + `catalog.json`
|
|
13
|
+
3. Resolve intent via `ai/tasks/index.json` → fetch the matching task bundle
|
|
14
|
+
4. Fetch only the component slices listed in that task (`ai/components/*.json`)
|
|
15
|
+
5. Read the task's gold example; for production layouts, read matching Pro blocks from `ai/examples/blocks/manifest.json`
|
|
16
|
+
6. Validate output: `npx once-ui-validate-ai-code path/to/file.tsx`
|
|
17
|
+
|
|
18
|
+
## Do not
|
|
19
|
+
|
|
20
|
+
- Use full documentation MDX pages for codegen (too large; use the harness)
|
|
21
|
+
- Use `Flex direction="column"` when `Column` works; same for `Row`
|
|
22
|
+
- Use `fillWidth fillHeight` when `fill` works
|
|
23
|
+
- Use `Card` for static panels (use the surface recipe on `Column`)
|
|
24
|
+
|
|
25
|
+
## Remote fallback
|
|
26
|
+
|
|
27
|
+
https://docs.once-ui.com/ai/manifest.json
|
package/dist/ai/catalog.json
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"className": "string",
|
|
14
14
|
"onSelect": "(value: string) => void",
|
|
15
15
|
"closeAfterClick": "boolean = true",
|
|
16
|
-
"
|
|
17
|
-
"onOpenChange": "(
|
|
16
|
+
"open": "boolean",
|
|
17
|
+
"onOpenChange": "(open: boolean) => void",
|
|
18
18
|
"selectedOption": "string",
|
|
19
19
|
"disabled": "boolean = false"
|
|
20
20
|
},
|
|
@@ -13,8 +13,23 @@
|
|
|
13
13
|
"StyleProps"
|
|
14
14
|
],
|
|
15
15
|
"props": {
|
|
16
|
-
"data": "!{ headers:
|
|
17
|
-
"onRowClick": "(rowIndex: number) => void"
|
|
16
|
+
"data": "!{ headers: TableHeader[]; rows: ReactNode[][]; }",
|
|
17
|
+
"onRowClick": "(rowIndex: number) => void",
|
|
18
|
+
"searchable": "boolean = false",
|
|
19
|
+
"searchPlaceholder": "string = Search...",
|
|
20
|
+
"striped": "boolean = false",
|
|
21
|
+
"hoverable": "boolean = true",
|
|
22
|
+
"compact": "boolean = false",
|
|
23
|
+
"loading": "boolean = false",
|
|
24
|
+
"emptyState": "ReactNode",
|
|
25
|
+
"actions": "TableAction[]",
|
|
26
|
+
"stickyHeader": "boolean = false",
|
|
27
|
+
"rowClassName": "(rowIndex: number) => string",
|
|
28
|
+
"cellClassName": "(rowIndex: number, cellIndex: number) => string",
|
|
29
|
+
"paginated": "boolean = false",
|
|
30
|
+
"defaultPageSize": "number = 10",
|
|
31
|
+
"pageSizeOptions": "number[] = [5, 10, 20, 50]",
|
|
32
|
+
"loadingState": "ReactNode"
|
|
18
33
|
},
|
|
19
34
|
"mixinsRef": [
|
|
20
35
|
"CommonProps",
|
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.7.
|
|
4
|
-
"generated": "2026-07-
|
|
3
|
+
"version": "1.7.13",
|
|
4
|
+
"generated": "2026-07-24",
|
|
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\"",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"TextWeight": "\"default\" | \"strong\"",
|
|
19
19
|
"TextSize": "TShirtSizes",
|
|
20
20
|
"TextVariant": "`${TextType}-${TextWeight}-${TextSize}`",
|
|
21
|
-
"IconName": "\"chevronUp\" | \"chevronDown\" | \"chevronRight\" | \"chevronLeft\" | \"chevronsLeftRight\" | \"refresh\" | \"light\" | \"dark\" | \"help\" | \"info\" | \"warning\" | \"danger\" | \"checkbox\" | \"check\" | \"copy\" | \"eyeDropper\" | \"clipboard\" | \"person\" | \"close\" | \"link\" | \"arrowUpRight\" | \"minus\" | \"plus\" | \"calendar\" | \"eye\" | \"eyeOff\" | \"search\" | \"security\" | \"sparkle\" | \"computer\" | \"minimize\" | \"maximize\" | \"smiley\" | \"paw\" | \"food\" | \"ball\" | \"world\" | \"gift\" | \"symbol\" | \"flag\" | \"wordmark\" | \"enter\" | \"play\" | \"pause\" | \"screen\" | \"document\" | \"radialGauge\" | \"linearGauge\" | \"
|
|
21
|
+
"IconName": "\"chevronUp\" | \"chevronDown\" | \"chevronRight\" | \"chevronLeft\" | \"chevronsLeftRight\" | \"refresh\" | \"light\" | \"dark\" | \"help\" | \"info\" | \"warning\" | \"danger\" | \"checkbox\" | \"check\" | \"copy\" | \"eyeDropper\" | \"clipboard\" | \"person\" | \"close\" | \"link\" | \"arrowUpRight\" | \"minus\" | \"plus\" | \"calendar\" | \"eye\" | \"eyeOff\" | \"search\" | \"security\" | \"sparkle\" | \"computer\" | \"minimize\" | \"maximize\" | \"smiley\" | \"paw\" | \"food\" | \"ball\" | \"world\" | \"gift\" | \"symbol\" | \"flag\" | \"wordmark\" | \"enter\" | \"play\" | \"pause\" | \"volume\" | \"volumeOff\" | \"screen\" | \"document\" | \"radialGauge\" | \"linearGauge\" | \"edit\" | \"trash\" | \"mail\" | \"download\""
|
|
22
22
|
},
|
|
23
23
|
"mixins": {
|
|
24
24
|
"CommonProps": {
|
|
@@ -753,8 +753,8 @@
|
|
|
753
753
|
"className": "string",
|
|
754
754
|
"onSelect": "(value: string) => void",
|
|
755
755
|
"closeAfterClick": "boolean = true",
|
|
756
|
-
"
|
|
757
|
-
"onOpenChange": "(
|
|
756
|
+
"open": "boolean",
|
|
757
|
+
"onOpenChange": "(open: boolean) => void",
|
|
758
758
|
"selectedOption": "string",
|
|
759
759
|
"disabled": "boolean = false"
|
|
760
760
|
}
|
|
@@ -2046,8 +2046,23 @@
|
|
|
2046
2046
|
"StyleProps"
|
|
2047
2047
|
],
|
|
2048
2048
|
"props": {
|
|
2049
|
-
"data": "!{ headers:
|
|
2050
|
-
"onRowClick": "(rowIndex: number) => void"
|
|
2049
|
+
"data": "!{ headers: TableHeader[]; rows: ReactNode[][]; }",
|
|
2050
|
+
"onRowClick": "(rowIndex: number) => void",
|
|
2051
|
+
"searchable": "boolean = false",
|
|
2052
|
+
"searchPlaceholder": "string = Search...",
|
|
2053
|
+
"striped": "boolean = false",
|
|
2054
|
+
"hoverable": "boolean = true",
|
|
2055
|
+
"compact": "boolean = false",
|
|
2056
|
+
"loading": "boolean = false",
|
|
2057
|
+
"emptyState": "ReactNode",
|
|
2058
|
+
"actions": "TableAction[]",
|
|
2059
|
+
"stickyHeader": "boolean = false",
|
|
2060
|
+
"rowClassName": "(rowIndex: number) => string",
|
|
2061
|
+
"cellClassName": "(rowIndex: number, cellIndex: number) => string",
|
|
2062
|
+
"paginated": "boolean = false",
|
|
2063
|
+
"defaultPageSize": "number = 10",
|
|
2064
|
+
"pageSizeOptions": "number[] = [5, 10, 20, 50]",
|
|
2065
|
+
"loadingState": "ReactNode"
|
|
2051
2066
|
}
|
|
2052
2067
|
},
|
|
2053
2068
|
"Tag": {
|
|
@@ -12,8 +12,8 @@ export interface ContextMenuProps {
|
|
|
12
12
|
className?: string;
|
|
13
13
|
onSelect?: (value: string) => void;
|
|
14
14
|
closeAfterClick?: boolean;
|
|
15
|
-
|
|
16
|
-
onOpenChange?: (
|
|
15
|
+
open?: boolean;
|
|
16
|
+
onOpenChange?: (open: boolean) => void;
|
|
17
17
|
selectedOption?: string;
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../src/components/ContextMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAGZ,SAAS,EAMV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAKnD,MAAM,WAAW,gBAAgB;IAC/B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,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,WAAW,yFA4UhB,CAAC;AAIF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { useState, useRef, forwardRef, useCallback, useEffect, } from "react";
|
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
5
|
import { Flex, Dropdown, ScrollLock } from ".";
|
|
6
6
|
import styles from "./ContextMenu.module.scss";
|
|
7
|
-
const ContextMenu = forwardRef(({ children, dropdown, minHeight, onSelect, closeAfterClick = true,
|
|
7
|
+
const ContextMenu = forwardRef(({ children, dropdown, minHeight, onSelect, closeAfterClick = true, open, onOpenChange, minWidth = 12, maxWidth, fillWidth = false, placement = "bottom-end", disabled = false, className, style, ...rest }, ref) => {
|
|
8
8
|
const [contextPosition, setContextPosition] = useState({ x: 0, y: 0 });
|
|
9
9
|
const [internalIsOpen, setInternalIsOpen] = useState(false);
|
|
10
10
|
const [isBrowser, setIsBrowser] = useState(false);
|
|
@@ -13,8 +13,8 @@ const ContextMenu = forwardRef(({ children, dropdown, minHeight, onSelect, close
|
|
|
13
13
|
const dropdownRef = useRef(null);
|
|
14
14
|
const previouslyFocusedElement = useRef(null);
|
|
15
15
|
// Control open state internally if not provided
|
|
16
|
-
const isControlled =
|
|
17
|
-
const isDropdownOpen = isControlled ?
|
|
16
|
+
const isControlled = open !== undefined;
|
|
17
|
+
const isDropdownOpen = isControlled ? open : internalIsOpen;
|
|
18
18
|
// Handle open state changes
|
|
19
19
|
const handleOpenChange = useCallback((open) => {
|
|
20
20
|
if (!isControlled) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.js","sourceRoot":"","sources":["../../src/components/ContextMenu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EACZ,QAAQ,EACR,MAAM,EAEN,UAAU,EAGV,WAAW,EACX,SAAS,GACV,MAAM,OAAO,CAAC;AAEf,O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,EAAE,EAAE;oCAClB,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC;oCAClB,IAAI,eAAe,EAAE,CAAC;wCACpB,gBAAgB,CAAC,KAAK,CAAC,CAAC;oCAC1B,CAAC;gCACH,CAAC,KACG,IAAI,YAEP,QAAQ,GACA,GACN,EACP,QAAQ,CAAC,IAAI,CACd,IACE,IACJ,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementType.d.ts","sourceRoot":"","sources":["../../src/components/ElementType.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ElementType.d.ts","sourceRoot":"","sources":["../../src/components/ElementType.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAIrD,KAAK,gBAAgB,GAAG;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,GACxE,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,GACvE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC;AAI1C,QAAA,MAAM,WAAW,sFA8DhB,CAAC;AAGF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -2,14 +2,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import Link from "next/link";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { Flex } from ".";
|
|
5
|
+
import { sanitizeHref } from "../utils/safe-html";
|
|
5
6
|
const isExternalLink = (url) => /^https?:\/\//.test(url);
|
|
6
7
|
const ElementType = forwardRef(({ href, type, onClick, onLinkClick, children, className, style, ...props }, ref) => {
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
const safeHref = sanitizeHref(href);
|
|
9
|
+
if (safeHref) {
|
|
10
|
+
const isExternal = isExternalLink(safeHref);
|
|
9
11
|
if (isExternal) {
|
|
10
|
-
return (_jsx("a", { href:
|
|
12
|
+
return (_jsx("a", { href: safeHref, target: "_blank", rel: "noreferrer", ref: ref, className: className, style: style, onClick: () => onLinkClick?.(), ...props, children: children }));
|
|
11
13
|
}
|
|
12
|
-
return (_jsx(Link, { href:
|
|
14
|
+
return (_jsx(Link, { href: safeHref, ref: ref, className: className, style: style, onClick: () => onLinkClick?.(), ...props, children: children }));
|
|
13
15
|
}
|
|
14
16
|
if (onClick || type === "submit" || type === "button") {
|
|
15
17
|
return (_jsx("button", { ref: ref, className: className, onClick: onClick, style: style, type: type, ...props, children: children }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementType.js","sourceRoot":"","sources":["../../src/components/ElementType.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAc,EAAa,UAAU,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"ElementType.js","sourceRoot":"","sources":["../../src/components/ElementType.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAc,EAAa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,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAA6D,KAC9D,KAAuD,YAE3D,QAAQ,GACF,CACV,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,IAAI,IACH,GAAG,EAAE,GAAgC,EACrC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,KACP,KAA8C,YAElD,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Media.d.ts","sourceRoot":"","sources":["../../src/components/Media.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,aAAa,EAA+B,SAAS,EAAE,MAAM,OAAO,CAAC;AACrF,OAAO,EAAU,IAAI,EAA6B,MAAM,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"Media.d.ts","sourceRoot":"","sources":["../../src/components/Media.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,aAAa,EAA+B,SAAS,EAAE,MAAM,OAAO,CAAC;AACrF,OAAO,EAAU,IAAI,EAA6B,MAAM,GAAG,CAAC;AAK5D,MAAM,WAAW,UAAW,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,QAAQ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