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,170 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openuispec.org/schema/tokens/layout.schema.json",
4
+ "title": "OpenUISpec Layout Tokens",
5
+ "description": "Size classes, platform mapping, layout primitives, and content reflow rules",
6
+ "type": "object",
7
+ "required": [
8
+ "layout"
9
+ ],
10
+ "additionalProperties": false,
11
+ "properties": {
12
+ "layout": {
13
+ "type": "object",
14
+ "properties": {
15
+ "size_classes": {
16
+ "type": "object",
17
+ "description": "Size class definitions",
18
+ "properties": {
19
+ "compact": {
20
+ "$ref": "https://openuispec.org/schema/tokens/layout.schema.json#/$defs/size_class_def"
21
+ },
22
+ "regular": {
23
+ "$ref": "https://openuispec.org/schema/tokens/layout.schema.json#/$defs/size_class_def"
24
+ },
25
+ "expanded": {
26
+ "$ref": "https://openuispec.org/schema/tokens/layout.schema.json#/$defs/size_class_def"
27
+ }
28
+ },
29
+ "additionalProperties": false
30
+ },
31
+ "platform_mapping": {
32
+ "type": "object",
33
+ "description": "How each platform resolves size classes",
34
+ "properties": {
35
+ "ios": {
36
+ "$ref": "https://openuispec.org/schema/tokens/layout.schema.json#/$defs/platform_size_mapping"
37
+ },
38
+ "android": {
39
+ "$ref": "https://openuispec.org/schema/tokens/layout.schema.json#/$defs/platform_size_mapping"
40
+ },
41
+ "web": {
42
+ "$ref": "https://openuispec.org/schema/tokens/layout.schema.json#/$defs/platform_size_mapping"
43
+ }
44
+ },
45
+ "additionalProperties": false
46
+ },
47
+ "primitives": {
48
+ "type": "object",
49
+ "description": "Layout primitive definitions",
50
+ "additionalProperties": {
51
+ "$ref": "https://openuispec.org/schema/tokens/layout.schema.json#/$defs/primitive_def"
52
+ }
53
+ },
54
+ "reflow_rules": {
55
+ "type": "object",
56
+ "description": "Content reflow rules across size class boundaries",
57
+ "additionalProperties": {
58
+ "$ref": "https://openuispec.org/schema/defs/adaptive.schema.json"
59
+ }
60
+ }
61
+ },
62
+ "additionalProperties": false
63
+ }
64
+ },
65
+ "$defs": {
66
+ "size_class_def": {
67
+ "type": "object",
68
+ "properties": {
69
+ "semantic": {
70
+ "type": "string"
71
+ },
72
+ "width": {
73
+ "type": "object",
74
+ "properties": {
75
+ "min": {
76
+ "type": "integer"
77
+ },
78
+ "max": {
79
+ "type": "integer"
80
+ }
81
+ },
82
+ "additionalProperties": false
83
+ },
84
+ "columns": {
85
+ "type": "integer"
86
+ },
87
+ "margin": {
88
+ "type": "string"
89
+ },
90
+ "content_max_width": {
91
+ "type": [
92
+ "integer",
93
+ "null"
94
+ ]
95
+ },
96
+ "examples": {
97
+ "type": "string"
98
+ }
99
+ },
100
+ "additionalProperties": false
101
+ },
102
+ "platform_size_mapping": {
103
+ "type": "object",
104
+ "properties": {
105
+ "uses": {
106
+ "type": "string"
107
+ },
108
+ "compact": {
109
+ "type": "string"
110
+ },
111
+ "regular": {
112
+ "type": "string"
113
+ },
114
+ "expanded": {
115
+ "type": "string"
116
+ }
117
+ },
118
+ "additionalProperties": false
119
+ },
120
+ "primitive_def": {
121
+ "type": "object",
122
+ "properties": {
123
+ "semantic": {
124
+ "type": "string"
125
+ },
126
+ "props": {
127
+ "type": "object",
128
+ "additionalProperties": {
129
+ "type": "object",
130
+ "properties": {
131
+ "type": {
132
+ "type": "string"
133
+ },
134
+ "values": {
135
+ "type": "array",
136
+ "items": {
137
+ "type": "string"
138
+ }
139
+ },
140
+ "default": {},
141
+ "required": {
142
+ "type": "boolean"
143
+ }
144
+ },
145
+ "additionalProperties": false
146
+ }
147
+ },
148
+ "platform_mapping": {
149
+ "type": "object",
150
+ "properties": {
151
+ "ios": {
152
+ "type": "string"
153
+ },
154
+ "android": {
155
+ "type": "string"
156
+ },
157
+ "web": {
158
+ "type": "string"
159
+ }
160
+ },
161
+ "additionalProperties": false
162
+ },
163
+ "behavior": {
164
+ "type": "string"
165
+ }
166
+ },
167
+ "additionalProperties": false
168
+ }
169
+ }
170
+ }
@@ -0,0 +1,83 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openuispec.org/schema/tokens/motion.schema.json",
4
+ "title": "OpenUISpec Motion Tokens",
5
+ "description": "Animation durations, easings, reduced motion policy, and motion patterns",
6
+ "type": "object",
7
+ "required": [
8
+ "motion"
9
+ ],
10
+ "additionalProperties": false,
11
+ "properties": {
12
+ "motion": {
13
+ "type": "object",
14
+ "properties": {
15
+ "duration": {
16
+ "type": "object",
17
+ "description": "Named duration values in milliseconds",
18
+ "additionalProperties": {
19
+ "type": "integer"
20
+ }
21
+ },
22
+ "easing": {
23
+ "type": "object",
24
+ "description": "Named easing curves",
25
+ "additionalProperties": {
26
+ "type": "string"
27
+ }
28
+ },
29
+ "reduced_motion": {
30
+ "type": "string",
31
+ "description": "Policy for reduced motion preference",
32
+ "enum": [
33
+ "remove-animation",
34
+ "reduce-animation",
35
+ "respect-system"
36
+ ]
37
+ },
38
+ "patterns": {
39
+ "type": "object",
40
+ "description": "Named motion patterns for common interactions",
41
+ "additionalProperties": {
42
+ "$ref": "https://openuispec.org/schema/tokens/motion.schema.json#/$defs/motion_pattern"
43
+ }
44
+ }
45
+ },
46
+ "required": [
47
+ "duration",
48
+ "easing"
49
+ ],
50
+ "additionalProperties": false
51
+ }
52
+ },
53
+ "$defs": {
54
+ "motion_pattern": {
55
+ "type": "object",
56
+ "properties": {
57
+ "duration": {
58
+ "type": "string",
59
+ "description": "Reference to a named duration"
60
+ },
61
+ "easing": {
62
+ "type": "string",
63
+ "description": "Reference to a named easing"
64
+ },
65
+ "property": {
66
+ "type": "string",
67
+ "description": "CSS/animated property"
68
+ },
69
+ "value": {
70
+ "type": [
71
+ "number",
72
+ "string"
73
+ ]
74
+ },
75
+ "pattern": {
76
+ "type": "string",
77
+ "description": "Named animation pattern"
78
+ }
79
+ },
80
+ "additionalProperties": false
81
+ }
82
+ }
83
+ }
@@ -0,0 +1,93 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openuispec.org/schema/tokens/spacing.schema.json",
4
+ "title": "OpenUISpec Spacing Tokens",
5
+ "description": "Spacing scale, base unit, and aliases",
6
+ "type": "object",
7
+ "required": [
8
+ "spacing"
9
+ ],
10
+ "additionalProperties": false,
11
+ "properties": {
12
+ "spacing": {
13
+ "type": "object",
14
+ "properties": {
15
+ "base_unit": {
16
+ "type": "integer",
17
+ "description": "Base spacing unit in pixels"
18
+ },
19
+ "platform_flex": {
20
+ "type": "number",
21
+ "description": "Platform flexibility factor (0-1)"
22
+ },
23
+ "scale": {
24
+ "type": "object",
25
+ "description": "Named spacing scale values",
26
+ "additionalProperties": {
27
+ "$ref": "https://openuispec.org/schema/tokens/spacing.schema.json#/$defs/spacing_value"
28
+ }
29
+ },
30
+ "aliases": {
31
+ "type": "object",
32
+ "description": "Named spacing aliases for common patterns",
33
+ "additionalProperties": {
34
+ "$ref": "https://openuispec.org/schema/tokens/spacing.schema.json#/$defs/alias_value"
35
+ }
36
+ }
37
+ },
38
+ "required": [
39
+ "base_unit",
40
+ "scale"
41
+ ],
42
+ "additionalProperties": false
43
+ }
44
+ },
45
+ "$defs": {
46
+ "spacing_value": {
47
+ "description": "A spacing value \u2014 integer or base+range object",
48
+ "oneOf": [
49
+ {
50
+ "type": "integer"
51
+ },
52
+ {
53
+ "$ref": "https://openuispec.org/schema/defs/common.schema.json#/$defs/range_object"
54
+ }
55
+ ]
56
+ },
57
+ "alias_value": {
58
+ "description": "Spacing alias \u2014 a token reference string or object with directional values",
59
+ "oneOf": [
60
+ {
61
+ "type": "string"
62
+ },
63
+ {
64
+ "type": "object",
65
+ "properties": {
66
+ "all": {
67
+ "type": "string"
68
+ },
69
+ "horizontal": {
70
+ "type": "string"
71
+ },
72
+ "vertical": {
73
+ "type": "string"
74
+ },
75
+ "top": {
76
+ "type": "string"
77
+ },
78
+ "bottom": {
79
+ "type": "string"
80
+ },
81
+ "leading": {
82
+ "type": "string"
83
+ },
84
+ "trailing": {
85
+ "type": "string"
86
+ }
87
+ },
88
+ "additionalProperties": false
89
+ }
90
+ ]
91
+ }
92
+ }
93
+ }
@@ -0,0 +1,92 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openuispec.org/schema/tokens/themes.schema.json",
4
+ "title": "OpenUISpec Themes",
5
+ "description": "Theme variants with token overrides and platform capabilities",
6
+ "type": "object",
7
+ "required": [
8
+ "themes"
9
+ ],
10
+ "additionalProperties": false,
11
+ "properties": {
12
+ "themes": {
13
+ "type": "object",
14
+ "properties": {
15
+ "default": {
16
+ "type": "string",
17
+ "description": "Name of the default theme variant"
18
+ },
19
+ "variants": {
20
+ "type": "object",
21
+ "description": "Named theme variants with token overrides",
22
+ "additionalProperties": {
23
+ "$ref": "https://openuispec.org/schema/tokens/themes.schema.json#/$defs/theme_variant"
24
+ }
25
+ },
26
+ "platform": {
27
+ "type": "object",
28
+ "description": "Per-platform theme capabilities",
29
+ "properties": {
30
+ "ios": {
31
+ "type": "object",
32
+ "additionalProperties": true
33
+ },
34
+ "android": {
35
+ "type": "object",
36
+ "additionalProperties": true
37
+ },
38
+ "web": {
39
+ "type": "object",
40
+ "additionalProperties": true
41
+ }
42
+ },
43
+ "additionalProperties": false
44
+ }
45
+ },
46
+ "required": [
47
+ "default",
48
+ "variants"
49
+ ],
50
+ "additionalProperties": false
51
+ }
52
+ },
53
+ "$defs": {
54
+ "theme_variant": {
55
+ "type": "object",
56
+ "description": "A theme variant \u2014 keys are dot-notation token paths, values are override objects. 'extends' inherits from another variant.",
57
+ "properties": {
58
+ "extends": {
59
+ "type": "string"
60
+ }
61
+ },
62
+ "additionalProperties": {
63
+ "description": "Token override \u2014 object with HSL range properties and/or opacity",
64
+ "type": "object",
65
+ "properties": {
66
+ "hue": {
67
+ "type": [
68
+ "number",
69
+ "array"
70
+ ]
71
+ },
72
+ "saturation": {
73
+ "type": [
74
+ "number",
75
+ "array"
76
+ ]
77
+ },
78
+ "lightness": {
79
+ "type": [
80
+ "number",
81
+ "array"
82
+ ]
83
+ },
84
+ "opacity": {
85
+ "type": "number"
86
+ }
87
+ },
88
+ "additionalProperties": false
89
+ }
90
+ }
91
+ }
92
+ }
@@ -0,0 +1,106 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://openuispec.org/schema/tokens/typography.schema.json",
4
+ "title": "OpenUISpec Typography Tokens",
5
+ "description": "Font families and type scale definitions",
6
+ "type": "object",
7
+ "required": [
8
+ "typography"
9
+ ],
10
+ "additionalProperties": false,
11
+ "properties": {
12
+ "typography": {
13
+ "type": "object",
14
+ "properties": {
15
+ "font_family": {
16
+ "type": "object",
17
+ "description": "Named font family definitions",
18
+ "additionalProperties": {
19
+ "$ref": "https://openuispec.org/schema/tokens/typography.schema.json#/$defs/font_family_entry"
20
+ }
21
+ },
22
+ "scale": {
23
+ "type": "object",
24
+ "description": "Named type scale entries",
25
+ "additionalProperties": {
26
+ "$ref": "https://openuispec.org/schema/tokens/typography.schema.json#/$defs/scale_entry"
27
+ }
28
+ }
29
+ },
30
+ "additionalProperties": false
31
+ }
32
+ },
33
+ "$defs": {
34
+ "font_family_entry": {
35
+ "type": "object",
36
+ "properties": {
37
+ "semantic": {
38
+ "type": "string"
39
+ },
40
+ "value": {
41
+ "type": "string"
42
+ },
43
+ "fallback_strategy": {
44
+ "type": "string"
45
+ },
46
+ "platform": {
47
+ "type": "object",
48
+ "properties": {
49
+ "ios": {
50
+ "type": "object",
51
+ "additionalProperties": true
52
+ },
53
+ "android": {
54
+ "type": "object",
55
+ "additionalProperties": true
56
+ },
57
+ "web": {
58
+ "type": "object",
59
+ "additionalProperties": true
60
+ }
61
+ },
62
+ "additionalProperties": false
63
+ }
64
+ },
65
+ "required": [
66
+ "value"
67
+ ],
68
+ "additionalProperties": false
69
+ },
70
+ "scale_entry": {
71
+ "type": "object",
72
+ "properties": {
73
+ "semantic": {
74
+ "type": "string"
75
+ },
76
+ "size": {
77
+ "$ref": "https://openuispec.org/schema/defs/common.schema.json#/$defs/size_value"
78
+ },
79
+ "weight": {
80
+ "type": "integer"
81
+ },
82
+ "tracking": {
83
+ "type": "number"
84
+ },
85
+ "line_height": {
86
+ "type": "number"
87
+ },
88
+ "transform": {
89
+ "type": "string",
90
+ "enum": [
91
+ "uppercase",
92
+ "lowercase",
93
+ "capitalize",
94
+ "none"
95
+ ]
96
+ }
97
+ },
98
+ "required": [
99
+ "size",
100
+ "weight",
101
+ "line_height"
102
+ ],
103
+ "additionalProperties": false
104
+ }
105
+ }
106
+ }