@golemui/schemas 1.2.1

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.
@@ -0,0 +1,209 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://golemui.com/schemas/core/common.schema.json",
4
+ "$comment": "Owned by @golemui/schemas (libs/schemas/src/lib/core/). Implementation trees contain a generated vendored copy, identical apart from an `$id` rebased onto the implementation's own tree. Edit the source file, then run `npm run generate:schemas`.",
5
+ "title": "Golem Common Definitions",
6
+ "$defs": {
7
+ "reactiveExpression": {
8
+ "type": "string",
9
+ "description": "A reactive expression string. Use `$form` to access form data e.g. `$form.termsAccepted === true`"
10
+ },
11
+ "dotPath": {
12
+ "type": "string",
13
+ "description": "A dot-separated path to a property in the form data"
14
+ },
15
+ "uid": {
16
+ "type": "string",
17
+ "description": "Unique identifier for the widget"
18
+ },
19
+ "chunkRef": {
20
+ "type": "object",
21
+ "description": "A reference to an external chunk file whose widget array will be inlined at this position in the form",
22
+ "properties": {
23
+ "$ref": { "type": "string", "description": "Relative path to a JSON chunk file" }
24
+ },
25
+ "required": ["$ref"],
26
+ "additionalProperties": false
27
+ },
28
+ "localizable": {
29
+ "description": "A value that can be a plain string or an i18n key object. Use a plain string for static text, or `{key, default, params}` to reference a translation key.",
30
+ "oneOf": [
31
+ {
32
+ "type": "string"
33
+ },
34
+ {
35
+ "type": "object",
36
+ "properties": {
37
+ "key": {
38
+ "type": "string",
39
+ "description": "The i18n translation key"
40
+ },
41
+ "default": {
42
+ "type": "string",
43
+ "description": "Fallback text shown when the translation key is not found"
44
+ },
45
+ "params": {
46
+ "type": "object",
47
+ "description": "Interpolation parameters passed to the translation function"
48
+ }
49
+ },
50
+ "required": ["key"],
51
+ "additionalProperties": false
52
+ }
53
+ ]
54
+ },
55
+ "include": {
56
+ "description": "Show this widget only in certain form states (`{in: [stateNames]}`) or when a reactive expression is true (`{when: expr}`). If omitted the widget is always shown.",
57
+ "oneOf": [
58
+ {
59
+ "type": "object",
60
+ "properties": {
61
+ "in": {
62
+ "type": "array",
63
+ "items": {
64
+ "type": "string"
65
+ },
66
+ "description": "List of state names (defined in the form `states` map) in which this widget should be visible"
67
+ }
68
+ },
69
+ "required": ["in"],
70
+ "additionalProperties": false
71
+ },
72
+ {
73
+ "type": "object",
74
+ "properties": {
75
+ "when": {
76
+ "$ref": "#/$defs/reactiveExpression"
77
+ }
78
+ },
79
+ "required": ["when"],
80
+ "additionalProperties": false
81
+ }
82
+ ]
83
+ },
84
+ "exclude": {
85
+ "description": "Hide this widget in certain form states (`{from: [stateNames]}`) or when a reactive expression is true (`{when: expr}`). If omitted the widget is never hidden.",
86
+ "oneOf": [
87
+ {
88
+ "type": "object",
89
+ "properties": {
90
+ "from": {
91
+ "type": "array",
92
+ "items": {
93
+ "type": "string"
94
+ },
95
+ "description": "List of state names (defined in the form `states` map) in which this widget should be hidden"
96
+ }
97
+ },
98
+ "required": ["from"],
99
+ "additionalProperties": false
100
+ },
101
+ {
102
+ "type": "object",
103
+ "properties": {
104
+ "when": {
105
+ "$ref": "#/$defs/reactiveExpression"
106
+ }
107
+ },
108
+ "required": ["when"],
109
+ "additionalProperties": false
110
+ }
111
+ ]
112
+ },
113
+ "boolOrWhen": {
114
+ "description": "A static boolean or a conditional `{when: reactiveExpression}` object evaluated at runtime. Use `{when: '$form.someField === true'}` for dynamic behavior.",
115
+ "oneOf": [
116
+ {
117
+ "type": "boolean"
118
+ },
119
+ {
120
+ "type": "object",
121
+ "properties": {
122
+ "when": {
123
+ "$ref": "#/$defs/reactiveExpression"
124
+ }
125
+ },
126
+ "required": ["when"],
127
+ "additionalProperties": false
128
+ }
129
+ ]
130
+ },
131
+ "on": {
132
+ "type": "object",
133
+ "description": "Event handlers for this widget. Values are action names dispatched to the form's event bus. Each key also accepts a state-suffixed variant (`\"click.<stateName>\"`) that overrides the base handler when the named state is active.",
134
+ "properties": {
135
+ "load": {
136
+ "type": "string",
137
+ "description": "Action dispatched when the widget is first mounted"
138
+ },
139
+ "click": {
140
+ "type": "string",
141
+ "description": "Action dispatched when the user clicks the widget"
142
+ },
143
+ "change": {
144
+ "type": "string",
145
+ "description": "Action dispatched when the widget value changes"
146
+ },
147
+ "filter": {
148
+ "type": "string",
149
+ "description": "Action dispatched on search/filter input, typically used with async data sources"
150
+ },
151
+ "blur": {
152
+ "type": "string",
153
+ "description": "Action dispatched when the widget loses focus"
154
+ }
155
+ },
156
+ "patternProperties": {
157
+ "^load\\.[^.]+$": {
158
+ "type": "string",
159
+ "description": "State-suffixed load handler: used instead of `load` when the named state is active (e.g. `\"load.myState\"`)"
160
+ },
161
+ "^click\\.[^.]+$": {
162
+ "type": "string",
163
+ "description": "State-suffixed click handler: used instead of `click` when the named state is active (e.g. `\"click.myState\"`)"
164
+ },
165
+ "^change\\.[^.]+$": {
166
+ "type": "string",
167
+ "description": "State-suffixed change handler: used instead of `change` when the named state is active (e.g. `\"change.myState\"`)"
168
+ },
169
+ "^filter\\.[^.]+$": {
170
+ "type": "string",
171
+ "description": "State-suffixed filter handler: used instead of `filter` when the named state is active (e.g. `\"filter.myState\"`)"
172
+ },
173
+ "^blur\\.[^.]+$": {
174
+ "type": "string",
175
+ "description": "State-suffixed blur handler: used instead of `blur` when the named state is active (e.g. `\"blur.myState\"`)"
176
+ }
177
+ },
178
+ "additionalProperties": false
179
+ },
180
+ "baseWidget": {
181
+ "type": "object",
182
+ "description": "Base properties shared by all widgets. Root-level props that support state-suffixing (e.g. `\"label.myState\"`) are: `label`, `disabled`, `readonly`, `validator`, `size`. Any key inside `props` can also be suffixed. State names must be declared in the form `states` map.",
183
+ "properties": {
184
+ "$schema": {
185
+ "type": "string"
186
+ },
187
+ "uid": {
188
+ "$ref": "#/$defs/uid"
189
+ },
190
+ "type": {
191
+ "type": "string"
192
+ },
193
+ "size": {
194
+ "type": "number",
195
+ "description": "Column span in the form grid (1-12). Defaults to full width when omitted.",
196
+ "minimum": 1,
197
+ "maximum": 12
198
+ },
199
+ "include": {
200
+ "$ref": "#/$defs/include"
201
+ },
202
+ "exclude": {
203
+ "$ref": "#/$defs/exclude"
204
+ }
205
+ },
206
+ "required": ["type"]
207
+ }
208
+ }
209
+ }