openuispec 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +214 -0
  3. package/cli/index.ts +49 -0
  4. package/cli/init.ts +390 -0
  5. package/drift/index.ts +398 -0
  6. package/examples/taskflow/README.md +103 -0
  7. package/examples/taskflow/contracts/README.md +18 -0
  8. package/examples/taskflow/contracts/action_trigger.yaml +7 -0
  9. package/examples/taskflow/contracts/collection.yaml +7 -0
  10. package/examples/taskflow/contracts/data_display.yaml +7 -0
  11. package/examples/taskflow/contracts/feedback.yaml +7 -0
  12. package/examples/taskflow/contracts/input_field.yaml +7 -0
  13. package/examples/taskflow/contracts/nav_container.yaml +7 -0
  14. package/examples/taskflow/contracts/surface.yaml +7 -0
  15. package/examples/taskflow/contracts/x_media_player.yaml +185 -0
  16. package/examples/taskflow/flows/create_task.yaml +171 -0
  17. package/examples/taskflow/flows/edit_task.yaml +131 -0
  18. package/examples/taskflow/locales/en.json +158 -0
  19. package/examples/taskflow/openuispec.yaml +144 -0
  20. package/examples/taskflow/platform/android.yaml +32 -0
  21. package/examples/taskflow/platform/ios.yaml +39 -0
  22. package/examples/taskflow/platform/web.yaml +35 -0
  23. package/examples/taskflow/screens/calendar.yaml +23 -0
  24. package/examples/taskflow/screens/home.yaml +220 -0
  25. package/examples/taskflow/screens/profile_edit.yaml +70 -0
  26. package/examples/taskflow/screens/project_detail.yaml +65 -0
  27. package/examples/taskflow/screens/projects.yaml +142 -0
  28. package/examples/taskflow/screens/settings.yaml +178 -0
  29. package/examples/taskflow/screens/task_detail.yaml +317 -0
  30. package/examples/taskflow/tokens/color.yaml +88 -0
  31. package/examples/taskflow/tokens/elevation.yaml +27 -0
  32. package/examples/taskflow/tokens/icons.yaml +189 -0
  33. package/examples/taskflow/tokens/layout.yaml +156 -0
  34. package/examples/taskflow/tokens/motion.yaml +41 -0
  35. package/examples/taskflow/tokens/spacing.yaml +23 -0
  36. package/examples/taskflow/tokens/themes.yaml +34 -0
  37. package/examples/taskflow/tokens/typography.yaml +61 -0
  38. package/package.json +43 -0
  39. package/schema/custom-contract.schema.json +257 -0
  40. package/schema/defs/action.schema.json +272 -0
  41. package/schema/defs/adaptive.schema.json +13 -0
  42. package/schema/defs/common.schema.json +330 -0
  43. package/schema/defs/data-binding.schema.json +119 -0
  44. package/schema/defs/validation.schema.json +121 -0
  45. package/schema/flow.schema.json +164 -0
  46. package/schema/locale.schema.json +26 -0
  47. package/schema/openuispec.schema.json +287 -0
  48. package/schema/platform.schema.json +95 -0
  49. package/schema/screen.schema.json +346 -0
  50. package/schema/tokens/color.schema.json +104 -0
  51. package/schema/tokens/elevation.schema.json +84 -0
  52. package/schema/tokens/icons.schema.json +149 -0
  53. package/schema/tokens/layout.schema.json +170 -0
  54. package/schema/tokens/motion.schema.json +83 -0
  55. package/schema/tokens/spacing.schema.json +93 -0
  56. package/schema/tokens/themes.schema.json +92 -0
  57. package/schema/tokens/typography.schema.json +106 -0
  58. package/schema/validate.ts +258 -0
  59. package/spec/openuispec-v0.1.md +3677 -0
@@ -0,0 +1,164 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openuispec.org/schema/flow.schema.json",
4
+ "title": "OpenUISpec Flow",
5
+ "description": "Navigation flow \u2014 a single root key (flow name) mapping to the flow definition",
6
+ "type": "object",
7
+ "minProperties": 1,
8
+ "maxProperties": 1,
9
+ "additionalProperties": {
10
+ "$ref": "https://openuispec.org/schema/flow.schema.json#/$defs/flow_def"
11
+ },
12
+ "$defs": {
13
+ "flow_def": {
14
+ "type": "object",
15
+ "description": "A navigation flow definition",
16
+ "properties": {
17
+ "semantic": {
18
+ "type": "string"
19
+ },
20
+ "status": {
21
+ "type": "string",
22
+ "enum": [
23
+ "stub",
24
+ "draft",
25
+ "ready"
26
+ ]
27
+ },
28
+ "params": {
29
+ "$ref": "https://openuispec.org/schema/defs/data-binding.schema.json#/$defs/params_map"
30
+ },
31
+ "entry": {
32
+ "type": "string",
33
+ "description": "Entry screen step name"
34
+ },
35
+ "screens": {
36
+ "type": "object",
37
+ "description": "Map of step names to screen definitions",
38
+ "additionalProperties": {
39
+ "$ref": "https://openuispec.org/schema/flow.schema.json#/$defs/flow_screen"
40
+ }
41
+ },
42
+ "platform_hints": {
43
+ "type": "object",
44
+ "description": "Per-platform presentation hints",
45
+ "properties": {
46
+ "ios": {
47
+ "$ref": "https://openuispec.org/schema/flow.schema.json#/$defs/platform_hint"
48
+ },
49
+ "android": {
50
+ "$ref": "https://openuispec.org/schema/flow.schema.json#/$defs/platform_hint"
51
+ },
52
+ "web": {
53
+ "$ref": "https://openuispec.org/schema/flow.schema.json#/$defs/platform_hint"
54
+ }
55
+ },
56
+ "additionalProperties": false
57
+ }
58
+ },
59
+ "required": [
60
+ "semantic",
61
+ "entry",
62
+ "screens"
63
+ ],
64
+ "additionalProperties": false
65
+ },
66
+ "flow_screen": {
67
+ "type": "object",
68
+ "description": "A screen step within a flow \u2014 either references an external screen or defines one inline",
69
+ "properties": {
70
+ "screen": {
71
+ "type": "string",
72
+ "description": "Reference to an external screen file"
73
+ },
74
+ "screen_inline": {
75
+ "$ref": "https://openuispec.org/schema/flow.schema.json#/$defs/inline_screen_def"
76
+ },
77
+ "transitions": {
78
+ "type": "object",
79
+ "description": "Map of transition names to transition definitions",
80
+ "additionalProperties": {
81
+ "$ref": "https://openuispec.org/schema/flow.schema.json#/$defs/transition_def"
82
+ }
83
+ }
84
+ },
85
+ "additionalProperties": false
86
+ },
87
+ "inline_screen_def": {
88
+ "type": "object",
89
+ "description": "An inline screen definition within a flow (same shape as screen_def)",
90
+ "properties": {
91
+ "semantic": {
92
+ "type": "string"
93
+ },
94
+ "status": {
95
+ "type": "string"
96
+ },
97
+ "params": {
98
+ "$ref": "https://openuispec.org/schema/defs/data-binding.schema.json#/$defs/params_map"
99
+ },
100
+ "data": {
101
+ "$ref": "https://openuispec.org/schema/defs/data-binding.schema.json#/$defs/data_map"
102
+ },
103
+ "state": {
104
+ "$ref": "https://openuispec.org/schema/defs/data-binding.schema.json#/$defs/state_map"
105
+ },
106
+ "layout": {
107
+ "$ref": "https://openuispec.org/schema/screen.schema.json#/$defs/layout_def"
108
+ },
109
+ "surfaces": {
110
+ "type": "object",
111
+ "additionalProperties": {
112
+ "$ref": "https://openuispec.org/schema/screen.schema.json#/$defs/surface_def"
113
+ }
114
+ }
115
+ },
116
+ "required": [
117
+ "semantic",
118
+ "layout"
119
+ ],
120
+ "additionalProperties": false
121
+ },
122
+ "transition_def": {
123
+ "type": "object",
124
+ "properties": {
125
+ "to": {
126
+ "type": "string",
127
+ "description": "Target step name"
128
+ },
129
+ "animation": {
130
+ "type": "string"
131
+ },
132
+ "feedback": {
133
+ "type": "object",
134
+ "additionalProperties": true
135
+ }
136
+ },
137
+ "required": [
138
+ "to"
139
+ ],
140
+ "additionalProperties": false
141
+ },
142
+ "platform_hint": {
143
+ "type": "object",
144
+ "properties": {
145
+ "presentation": {
146
+ "type": "string"
147
+ },
148
+ "detents": {
149
+ "type": "array",
150
+ "items": {
151
+ "type": "string"
152
+ }
153
+ },
154
+ "fullscreen": {
155
+ "type": "boolean"
156
+ },
157
+ "size": {
158
+ "type": "string"
159
+ }
160
+ },
161
+ "additionalProperties": true
162
+ }
163
+ }
164
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openuispec.org/schema/locale.schema.json",
4
+ "title": "OpenUISpec Locale",
5
+ "description": "Locale file with $locale, $direction, and translation key-value pairs (ICU MessageFormat)",
6
+ "type": "object",
7
+ "required": ["$locale", "$direction"],
8
+ "properties": {
9
+ "$locale": {
10
+ "type": "string",
11
+ "description": "Locale identifier (e.g. 'en', 'fr', 'ar')"
12
+ },
13
+ "$direction": {
14
+ "type": "string",
15
+ "enum": ["ltr", "rtl"],
16
+ "description": "Text direction"
17
+ }
18
+ },
19
+ "patternProperties": {
20
+ "^[a-zA-Z_][a-zA-Z0-9_.]*$": {
21
+ "type": "string",
22
+ "description": "Translation string (ICU MessageFormat)"
23
+ }
24
+ },
25
+ "additionalProperties": false
26
+ }
@@ -0,0 +1,287 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openuispec.org/schema/openuispec.schema.json",
4
+ "title": "OpenUISpec Root Manifest",
5
+ "description": "Root manifest file (openuispec.yaml) defining project, includes, generation, data model, and API",
6
+ "type": "object",
7
+ "required": [
8
+ "spec_version",
9
+ "project",
10
+ "includes"
11
+ ],
12
+ "additionalProperties": false,
13
+ "properties": {
14
+ "spec_version": {
15
+ "type": "string",
16
+ "description": "OpenUISpec version (e.g. '0.1')"
17
+ },
18
+ "project": {
19
+ "type": "object",
20
+ "properties": {
21
+ "name": {
22
+ "type": "string"
23
+ },
24
+ "description": {
25
+ "type": "string"
26
+ },
27
+ "icon": {
28
+ "type": "string"
29
+ }
30
+ },
31
+ "required": [
32
+ "name"
33
+ ],
34
+ "additionalProperties": false
35
+ },
36
+ "includes": {
37
+ "type": "object",
38
+ "description": "Paths to spec component directories",
39
+ "properties": {
40
+ "tokens": {
41
+ "type": "string"
42
+ },
43
+ "contracts": {
44
+ "type": "string"
45
+ },
46
+ "screens": {
47
+ "type": "string"
48
+ },
49
+ "flows": {
50
+ "type": "string"
51
+ },
52
+ "platform": {
53
+ "type": "string"
54
+ },
55
+ "locales": {
56
+ "type": "string"
57
+ }
58
+ },
59
+ "required": [
60
+ "tokens",
61
+ "contracts",
62
+ "screens",
63
+ "flows",
64
+ "platform",
65
+ "locales"
66
+ ],
67
+ "additionalProperties": false
68
+ },
69
+ "i18n": {
70
+ "type": "object",
71
+ "description": "Internationalization configuration",
72
+ "properties": {
73
+ "default_locale": {
74
+ "type": "string"
75
+ },
76
+ "supported_locales": {
77
+ "type": "array",
78
+ "items": {
79
+ "type": "string"
80
+ }
81
+ },
82
+ "fallback_strategy": {
83
+ "type": "string",
84
+ "enum": [
85
+ "default",
86
+ "key",
87
+ "empty"
88
+ ]
89
+ }
90
+ },
91
+ "required": [
92
+ "default_locale",
93
+ "supported_locales"
94
+ ],
95
+ "additionalProperties": false
96
+ },
97
+ "generation": {
98
+ "type": "object",
99
+ "description": "Code generation targets and output format",
100
+ "properties": {
101
+ "targets": {
102
+ "type": "array",
103
+ "items": {
104
+ "type": "string"
105
+ }
106
+ },
107
+ "output_format": {
108
+ "type": "object",
109
+ "description": "Per-target generation config",
110
+ "additionalProperties": {
111
+ "type": "object",
112
+ "properties": {
113
+ "language": {
114
+ "type": "string"
115
+ },
116
+ "framework": {
117
+ "type": "string"
118
+ },
119
+ "min_version": {
120
+ "type": "string"
121
+ },
122
+ "min_sdk": {
123
+ "type": "integer"
124
+ },
125
+ "bundler": {
126
+ "type": "string"
127
+ }
128
+ },
129
+ "additionalProperties": true
130
+ }
131
+ }
132
+ },
133
+ "required": [
134
+ "targets"
135
+ ],
136
+ "additionalProperties": false
137
+ },
138
+ "formatters": {
139
+ "type": "object",
140
+ "description": "Custom formatter definitions for format expressions",
141
+ "additionalProperties": {
142
+ "$ref": "https://openuispec.org/schema/openuispec.schema.json#/$defs/formatter_def"
143
+ }
144
+ },
145
+ "mappers": {
146
+ "type": "object",
147
+ "description": "Key-value mapping definitions",
148
+ "additionalProperties": {
149
+ "type": "object",
150
+ "additionalProperties": {
151
+ "type": "string"
152
+ }
153
+ }
154
+ },
155
+ "data_model": {
156
+ "type": "object",
157
+ "description": "Application data model definitions",
158
+ "additionalProperties": {
159
+ "$ref": "https://openuispec.org/schema/openuispec.schema.json#/$defs/model_def"
160
+ }
161
+ },
162
+ "custom_contracts": {
163
+ "type": "array",
164
+ "description": "Paths to custom contract definition files (x_ prefixed)",
165
+ "items": {
166
+ "type": "string"
167
+ }
168
+ },
169
+ "api": {
170
+ "type": "object",
171
+ "description": "API endpoint definitions",
172
+ "properties": {
173
+ "base_url": {
174
+ "type": "string"
175
+ },
176
+ "auth": {
177
+ "type": "string"
178
+ },
179
+ "endpoints": {
180
+ "type": "object",
181
+ "description": "Grouped API endpoints",
182
+ "additionalProperties": {
183
+ "type": "object",
184
+ "additionalProperties": {
185
+ "$ref": "https://openuispec.org/schema/openuispec.schema.json#/$defs/endpoint_def"
186
+ }
187
+ }
188
+ }
189
+ },
190
+ "required": [
191
+ "base_url",
192
+ "endpoints"
193
+ ],
194
+ "additionalProperties": false
195
+ }
196
+ },
197
+ "$defs": {
198
+ "formatter_def": {
199
+ "type": "object",
200
+ "properties": {
201
+ "input": {
202
+ "type": "string"
203
+ },
204
+ "output": {
205
+ "type": "string"
206
+ },
207
+ "mapping": {
208
+ "type": "object",
209
+ "additionalProperties": {
210
+ "type": "string"
211
+ }
212
+ }
213
+ },
214
+ "required": [
215
+ "input",
216
+ "output",
217
+ "mapping"
218
+ ],
219
+ "additionalProperties": false
220
+ },
221
+ "model_def": {
222
+ "type": "object",
223
+ "description": "Data model \u2014 map of field names to field definitions",
224
+ "additionalProperties": {
225
+ "$ref": "https://openuispec.org/schema/openuispec.schema.json#/$defs/field_def"
226
+ }
227
+ },
228
+ "field_def": {
229
+ "type": "object",
230
+ "properties": {
231
+ "type": {
232
+ "type": "string"
233
+ },
234
+ "format": {
235
+ "type": "string"
236
+ },
237
+ "required": {
238
+ "type": "boolean"
239
+ },
240
+ "max_length": {
241
+ "type": "integer"
242
+ },
243
+ "default": {},
244
+ "values": {
245
+ "type": "array",
246
+ "items": {
247
+ "type": "string"
248
+ }
249
+ }
250
+ },
251
+ "required": [
252
+ "type"
253
+ ],
254
+ "additionalProperties": false
255
+ },
256
+ "endpoint_def": {
257
+ "type": "object",
258
+ "properties": {
259
+ "method": {
260
+ "type": "string",
261
+ "enum": [
262
+ "GET",
263
+ "POST",
264
+ "PUT",
265
+ "PATCH",
266
+ "DELETE"
267
+ ]
268
+ },
269
+ "path": {
270
+ "type": "string"
271
+ },
272
+ "params": {
273
+ "type": "array",
274
+ "items": {
275
+ "type": "string"
276
+ }
277
+ },
278
+ "body": {}
279
+ },
280
+ "required": [
281
+ "method",
282
+ "path"
283
+ ],
284
+ "additionalProperties": false
285
+ }
286
+ }
287
+ }
@@ -0,0 +1,95 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openuispec.org/schema/platform.schema.json",
4
+ "title": "OpenUISpec Platform Adaptation",
5
+ "description": "Platform-specific overrides, behaviors, and generation config. Root key is the platform name.",
6
+ "type": "object",
7
+ "minProperties": 1,
8
+ "maxProperties": 1,
9
+ "additionalProperties": {
10
+ "$ref": "https://openuispec.org/schema/platform.schema.json#/$defs/platform_def"
11
+ },
12
+ "$defs": {
13
+ "platform_def": {
14
+ "type": "object",
15
+ "description": "Platform adaptation definition",
16
+ "properties": {
17
+ "framework": {
18
+ "type": "string",
19
+ "description": "UI framework (swiftui, compose, react)"
20
+ },
21
+ "language": {
22
+ "type": "string",
23
+ "description": "Programming language"
24
+ },
25
+ "min_version": {
26
+ "type": "string",
27
+ "description": "Minimum framework/OS version (iOS)"
28
+ },
29
+ "min_sdk": {
30
+ "type": "integer",
31
+ "description": "Minimum SDK version (Android)"
32
+ },
33
+ "target_sdk": {
34
+ "type": "integer",
35
+ "description": "Target SDK version (Android)"
36
+ },
37
+ "overrides": {
38
+ "type": "object",
39
+ "description": "Per-contract-family overrides",
40
+ "additionalProperties": {
41
+ "type": "object",
42
+ "description": "Variant-level overrides for a contract family",
43
+ "additionalProperties": true
44
+ }
45
+ },
46
+ "behaviors": {
47
+ "type": "object",
48
+ "description": "Platform-specific behaviors and capabilities",
49
+ "additionalProperties": true
50
+ },
51
+ "generation": {
52
+ "type": "object",
53
+ "description": "Code generation configuration",
54
+ "properties": {
55
+ "imports": {
56
+ "type": "array",
57
+ "items": {
58
+ "type": "string"
59
+ }
60
+ },
61
+ "dependencies": {
62
+ "type": "array",
63
+ "items": {
64
+ "type": "string"
65
+ }
66
+ },
67
+ "architecture": {
68
+ "type": "string"
69
+ },
70
+ "naming": {
71
+ "type": "string"
72
+ },
73
+ "bundler": {
74
+ "type": "string"
75
+ },
76
+ "css": {
77
+ "type": "string"
78
+ },
79
+ "routing": {
80
+ "type": "string"
81
+ },
82
+ "state": {
83
+ "type": "string"
84
+ }
85
+ },
86
+ "additionalProperties": true
87
+ }
88
+ },
89
+ "required": [
90
+ "framework"
91
+ ],
92
+ "additionalProperties": false
93
+ }
94
+ }
95
+ }