openuispec 0.1.25 → 0.1.27
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/README.md +44 -2
- package/cli/index.ts +21 -3
- package/cli/init.ts +24 -8
- package/docs/implementation-notes.md +115 -0
- package/docs/release-notes-v0.1.26.md +64 -0
- package/docs/release-notes-v0.1.27.md +28 -0
- package/drift/index.ts +375 -18
- package/examples/todo-orbit/AGENTS.md +11 -4
- package/examples/todo-orbit/CLAUDE.md +11 -4
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/java/uz/rsteam/todoorbit/ui/components/CommonComponents.kt +69 -18
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/java/uz/rsteam/todoorbit/ui/screens/TasksScreen.kt +5 -0
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/java/uz/rsteam/todoorbit/ui/sheets/EditorSheets.kt +5 -2
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/res/values/strings.xml +1 -0
- package/examples/todo-orbit/generated/android/Todo Orbit/app/src/main/res/values-ru/strings.xml +1 -0
- package/examples/todo-orbit/generated/ios/Todo Orbit/Resources/en.lproj/Localizable.strings +1 -0
- package/examples/todo-orbit/generated/ios/Todo Orbit/Resources/ru.lproj/Localizable.strings +1 -0
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Flows/RecurringRuleSheet.swift +3 -0
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Flows/TaskEditorSheet.swift +1 -0
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Screens/SettingsView.swift +2 -0
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Screens/TasksHomeView.swift +1 -0
- package/examples/todo-orbit/generated/ios/Todo Orbit/Sources/TodoOrbit/Support/AppModel.swift +1 -1
- package/examples/todo-orbit/generated/web/Todo Orbit/src/App.tsx +59 -6
- package/examples/todo-orbit/generated/web/Todo Orbit/src/styles.css +40 -0
- package/examples/todo-orbit/openuispec/README.md +24 -131
- package/examples/todo-orbit/openuispec/flows/create_recurring_rule.yaml +3 -0
- package/examples/todo-orbit/openuispec/flows/create_task.yaml +1 -0
- package/examples/todo-orbit/openuispec/flows/edit_task.yaml +1 -0
- package/examples/todo-orbit/openuispec/locales/en.json +1 -0
- package/examples/todo-orbit/openuispec/locales/ru.json +1 -0
- package/examples/todo-orbit/openuispec/screens/task_detail.yaml +1 -0
- package/examples/todo-orbit/openuispec/tokens/icons.yaml +6 -0
- package/package.json +6 -1
- package/prepare/index.ts +391 -0
- package/schema/semantic-lint.ts +592 -0
- package/schema/validate.ts +8 -9
- package/status/index.ts +187 -0
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# todo-orbit — OpenUISpec
|
|
2
2
|
|
|
3
|
-
This directory contains the **OpenUISpec** semantic UI specification for **
|
|
3
|
+
This directory contains the **OpenUISpec** semantic UI specification for **todo-orbit**.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Todo Orbit is a bilingual productivity sample that exercises task management, analytics, settings, and recurring-rule workflows across iOS, Android, and web targets.
|
|
5
|
+
**Start here:** read `openuispec.yaml` — it defines the project structure, data model, API endpoints, and generation targets (**ios, android, web**).
|
|
8
6
|
|
|
9
7
|
## Directory structure
|
|
10
8
|
|
|
@@ -13,146 +11,41 @@ Todo Orbit is a bilingual productivity sample that exercises task management, an
|
|
|
13
11
|
| `tokens/` | Design tokens — colors, typography, spacing, elevation, motion, icons, themes |
|
|
14
12
|
| `screens/` | Screen definitions — one YAML file per screen |
|
|
15
13
|
| `flows/` | Navigation flows — multi-step user journeys |
|
|
16
|
-
| `contracts/` | Component contracts — standard extensions
|
|
14
|
+
| `contracts/` | Component contracts — standard extensions and custom (`x_` prefixed) |
|
|
17
15
|
| `platform/` | Platform overrides — per-target (iOS, Android, Web) behaviors |
|
|
18
16
|
| `locales/` | Localization — i18n strings (JSON, ICU MessageFormat) |
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
```yaml
|
|
22
|
-
includes:
|
|
23
|
-
locales: "../../shared/locales" # resolved relative to openuispec.yaml
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Getting started
|
|
27
|
-
|
|
28
|
-
**Start here:** read `openuispec.yaml` — it's the root manifest that defines the project structure, data model, API endpoints, and generation targets.
|
|
29
|
-
|
|
30
|
-
### New project (no existing UI code)
|
|
31
|
-
|
|
32
|
-
1. Define your data model and API endpoints in `openuispec.yaml`
|
|
33
|
-
2. Create token files in `tokens/` (colors, typography, spacing)
|
|
34
|
-
3. Create screen specs in `screens/` (one YAML per screen)
|
|
35
|
-
4. Create navigation flows in `flows/`
|
|
36
|
-
5. Ask AI to generate native code from the spec
|
|
37
|
-
|
|
38
|
-
### Existing project (adopting OpenUISpec)
|
|
39
|
-
|
|
40
|
-
1. Scan the codebase for existing UI screens
|
|
41
|
-
2. Create a stub for each screen in `screens/`:
|
|
42
|
-
```yaml
|
|
43
|
-
screen_name:
|
|
44
|
-
semantic: "Brief description of what this screen does"
|
|
45
|
-
status: stub
|
|
46
|
-
layout:
|
|
47
|
-
type: scroll_vertical
|
|
48
|
-
```
|
|
49
|
-
3. Extract design tokens (colors, fonts, spacing) into `tokens/`
|
|
50
|
-
4. Fill in `data_model` and `api.endpoints` in `openuispec.yaml`
|
|
51
|
-
5. Spec screens incrementally: `stub` → `draft` → `ready`
|
|
18
|
+
## IMPORTANT — Read the specification before working with spec files
|
|
52
19
|
|
|
53
|
-
|
|
20
|
+
The spec format, file schemas, and generation rules are defined in the installed `openuispec` package.
|
|
21
|
+
You MUST read these reference files before creating, editing, or generating from any spec file.
|
|
22
|
+
Do NOT guess the file format — skipping this step will produce invalid YAML that fails validation.
|
|
54
23
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
24
|
+
**Find the package in this order:**
|
|
25
|
+
1. `node_modules/openuispec/` (project dependency)
|
|
26
|
+
2. Run `npm root -g` → `<prefix>/openuispec/` (global install)
|
|
27
|
+
3. Online: `https://openuispec.rsteam.uz/llms-full.txt` (if not installed)
|
|
58
28
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
3. **Online fallback:** if the package is not installed at all, fetch from:
|
|
65
|
-
- `https://openuispec.rsteam.uz/llms-full.txt` — complete spec + all JSON schemas in one file
|
|
66
|
-
- `https://openuispec.rsteam.uz/llms.txt` — concise summary with links
|
|
67
|
-
|
|
68
|
-
Inside the package:
|
|
69
|
-
- **Full specification:** `spec/openuispec-v0.1.md`
|
|
70
|
-
- **Example app:** `examples/taskflow/`
|
|
71
|
-
- **JSON Schemas:** `schema/`
|
|
72
|
-
|
|
73
|
-
## Token file structure — root wrapper key required
|
|
74
|
-
|
|
75
|
-
Every token file must have a single root key matching the token type. Do NOT put properties at the top level.
|
|
76
|
-
|
|
77
|
-
```yaml
|
|
78
|
-
# ✅ Correct — tokens/typography.yaml
|
|
79
|
-
typography:
|
|
80
|
-
font_family: ...
|
|
81
|
-
scale: ...
|
|
82
|
-
|
|
83
|
-
# ❌ Wrong — missing root wrapper key
|
|
84
|
-
font_family: ...
|
|
85
|
-
scale: ...
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Root keys: `color`, `typography`, `spacing`, `elevation`, `motion`, `layout`, `themes`, `icons`.
|
|
89
|
-
|
|
90
|
-
## File formats and schemas
|
|
91
|
-
|
|
92
|
-
**IMPORTANT:** Before creating or editing any spec file, read the corresponding JSON Schema to understand the valid structure. Do not guess the file format.
|
|
93
|
-
|
|
94
|
-
| File | Schema | Root key |
|
|
95
|
-
|------|--------|----------|
|
|
96
|
-
| `openuispec.yaml` | `openuispec.schema.json` | `spec_version` |
|
|
97
|
-
| `screens/*.yaml` | `screen.schema.json` | `<screen_id>` |
|
|
98
|
-
| `flows/*.yaml` | `flow.schema.json` | `<flow_id>` |
|
|
99
|
-
| `platform/*.yaml` | `platform.schema.json` | `platform` |
|
|
100
|
-
| `locales/*.json` | `locale.schema.json` | (object) |
|
|
101
|
-
| `contracts/<name>.yaml` | `contract.schema.json` | `<contract_name>` |
|
|
102
|
-
| `contracts/x_*.yaml` | `custom-contract.schema.json` | `<x_name>` |
|
|
103
|
-
| `tokens/color.yaml` | `tokens/color.schema.json` | `color` |
|
|
104
|
-
| `tokens/typography.yaml` | `tokens/typography.schema.json` | `typography` |
|
|
105
|
-
| `tokens/spacing.yaml` | `tokens/spacing.schema.json` | `spacing` |
|
|
106
|
-
| `tokens/elevation.yaml` | `tokens/elevation.schema.json` | `elevation` |
|
|
107
|
-
| `tokens/motion.yaml` | `tokens/motion.schema.json` | `motion` |
|
|
108
|
-
| `tokens/layout.yaml` | `tokens/layout.schema.json` | `layout` |
|
|
109
|
-
| `tokens/themes.yaml` | `tokens/themes.schema.json` | `themes` |
|
|
110
|
-
| `tokens/icons.yaml` | `tokens/icons.schema.json` | `icons` |
|
|
111
|
-
|
|
112
|
-
All schemas are in `schema/` inside the installed package. Shared type definitions (actions, data-binding, adaptive, validation, common) are in `schema/defs/`.
|
|
113
|
-
|
|
114
|
-
**Workflow:** read the schema → read an example from `examples/taskflow/` → create the YAML → run `openuispec validate`.
|
|
115
|
-
|
|
116
|
-
## Spec format quick reference
|
|
117
|
-
|
|
118
|
-
- **7 contract families:** nav_container, surface, action_trigger, input_field, data_display, collection, feedback
|
|
119
|
-
- **Custom contracts:** prefixed with `x_` (e.g., `x_media_player`)
|
|
120
|
-
- **Data binding:** `$data:`, `$state:`, `$param:`, `$t:` prefixes
|
|
121
|
-
- **Actions:** typed objects — navigate, api_call, set_state, confirm, sequence, feedback, etc.
|
|
122
|
-
- **Adaptive layout:** size classes (compact, regular, expanded) with per-section overrides
|
|
29
|
+
**Reference files inside the package (read in this order):**
|
|
30
|
+
1. `README.md` — schema tables, file format reference, root keys
|
|
31
|
+
2. `spec/openuispec-v0.1.md` — full specification (contracts, layout, expressions, etc.)
|
|
32
|
+
3. `examples/taskflow/` — complete working example with all file types
|
|
33
|
+
4. `schema/` — JSON Schemas for validation
|
|
123
34
|
|
|
124
35
|
## CLI commands
|
|
125
36
|
|
|
126
37
|
```bash
|
|
127
38
|
openuispec validate # Validate spec files against schemas
|
|
39
|
+
openuispec validate semantic # Check semantic cross-references
|
|
128
40
|
openuispec validate screens # Validate only screens
|
|
129
|
-
openuispec
|
|
130
|
-
openuispec drift --
|
|
131
|
-
openuispec
|
|
41
|
+
openuispec status # Show which targets are behind
|
|
42
|
+
openuispec drift --target ios --explain # Explain semantic spec drift since ios baseline
|
|
43
|
+
openuispec prepare --target ios # Build an AI-ready ios update bundle
|
|
44
|
+
openuispec drift --snapshot --target ios # Snapshot current state + git baseline
|
|
132
45
|
```
|
|
133
46
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
This project generates native code for: **ios, android, web**
|
|
137
|
-
|
|
138
|
-
By default, drift stores state in `generated/<target>/<project>/`. To point targets to your actual code directories, add `output_dir` to `openuispec.yaml`:
|
|
139
|
-
|
|
140
|
-
```yaml
|
|
141
|
-
generation:
|
|
142
|
-
targets: [ios, android, web]
|
|
143
|
-
output_dir:
|
|
144
|
-
web: "../web-ui/"
|
|
145
|
-
android: "../kmp-ui/"
|
|
146
|
-
ios: "../kmp-ui/iosApp/"
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
Paths are relative to `openuispec.yaml`.
|
|
47
|
+
If a target snapshot was created before baseline metadata was added, `--explain` and `status` will ask you to re-run `openuispec drift --snapshot --target <target>` for that target.
|
|
150
48
|
|
|
151
49
|
## Learn more
|
|
152
50
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
- Full spec: `spec/openuispec-v0.1.md`
|
|
156
|
-
- Example app: `examples/taskflow/`
|
|
157
|
-
- JSON Schemas: `schema/`
|
|
158
|
-
- Online reference: `https://openuispec.rsteam.uz/llms-full.txt`
|
|
51
|
+
Docs: https://openuispec.rsteam.uz
|
|
@@ -96,6 +96,7 @@ create_recurring_rule:
|
|
|
96
96
|
|
|
97
97
|
- contract: input_field
|
|
98
98
|
input_type: select
|
|
99
|
+
render_hint: segmented
|
|
99
100
|
props:
|
|
100
101
|
label: "$t:recurring_rule.field_cadence"
|
|
101
102
|
required: true
|
|
@@ -118,6 +119,7 @@ create_recurring_rule:
|
|
|
118
119
|
|
|
119
120
|
- contract: input_field
|
|
120
121
|
input_type: select
|
|
122
|
+
render_hint: dropdown
|
|
121
123
|
props:
|
|
122
124
|
label: "$t:recurring_rule.field_weekday"
|
|
123
125
|
options:
|
|
@@ -199,6 +201,7 @@ create_recurring_rule:
|
|
|
199
201
|
|
|
200
202
|
- contract: input_field
|
|
201
203
|
input_type: select
|
|
204
|
+
render_hint: segmented
|
|
202
205
|
props:
|
|
203
206
|
label: "$t:recurring_rule.field_summary_channel"
|
|
204
207
|
options:
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"analytics.empty_overdue": "No overdue tasks",
|
|
34
34
|
"analytics.empty_overdue_body": "Everything important is on track.",
|
|
35
35
|
"task_detail.status": "Status",
|
|
36
|
+
"task_detail.title": "Task details",
|
|
36
37
|
"task_detail.priority": "Priority",
|
|
37
38
|
"task_detail.notes": "Notes",
|
|
38
39
|
"task_detail.due_date": "Due date",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"analytics.empty_overdue": "Просроченных задач нет",
|
|
34
34
|
"analytics.empty_overdue_body": "Все важные задачи идут по плану.",
|
|
35
35
|
"task_detail.status": "Статус",
|
|
36
|
+
"task_detail.title": "Детали задачи",
|
|
36
37
|
"task_detail.priority": "Приоритет",
|
|
37
38
|
"task_detail.notes": "Заметки",
|
|
38
39
|
"task_detail.due_date": "Срок",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openuispec",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "A semantic UI specification format for AI-native, platform-native app development",
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"cli/",
|
|
14
14
|
"drift/",
|
|
15
|
+
"prepare/",
|
|
16
|
+
"status/",
|
|
15
17
|
"schema/",
|
|
16
18
|
"spec/",
|
|
17
19
|
"docs/",
|
|
@@ -23,6 +25,7 @@
|
|
|
23
25
|
"openuispec": "./cli/index.ts"
|
|
24
26
|
},
|
|
25
27
|
"scripts": {
|
|
28
|
+
"test": "node --import tsx --test tests/*.test.ts",
|
|
26
29
|
"validate": "tsx schema/validate.ts",
|
|
27
30
|
"validate:manifest": "tsx schema/validate.ts manifest",
|
|
28
31
|
"validate:tokens": "tsx schema/validate.ts tokens",
|
|
@@ -32,6 +35,8 @@
|
|
|
32
35
|
"validate:locales": "tsx schema/validate.ts locales",
|
|
33
36
|
"drift": "tsx drift/index.ts",
|
|
34
37
|
"drift:snapshot": "tsx drift/index.ts --snapshot --target",
|
|
38
|
+
"prepare:target": "tsx prepare/index.ts",
|
|
39
|
+
"status": "tsx status/index.ts",
|
|
35
40
|
"postinstall": "echo \"\\n ✓ openuispec installed — if upgrading, run: openuispec update-rules\\n\""
|
|
36
41
|
},
|
|
37
42
|
"dependencies": {
|