@glazeen/mod-sdk 0.0.0-stage → 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.
@@ -0,0 +1,276 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://unpkg.com/@glazeen/mod-sdk/schema/bearbar.mod.schema.json",
4
+ "title": "bearbar mod manifest",
5
+ "description": "bearbar.mod.json: describes a bearbar dock widget mod.",
6
+ "type": "object",
7
+ "required": ["id", "name", "version", "tile"],
8
+ "properties": {
9
+ "$schema": {
10
+ "type": "string"
11
+ },
12
+ "id": {
13
+ "description": "Unique id. A mod in the user folder overrides a bundled mod with the same id.",
14
+ "type": "string",
15
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{1,63}$"
16
+ },
17
+ "name": {
18
+ "description": "Shown in the widget picker.",
19
+ "type": "string",
20
+ "minLength": 1,
21
+ "pattern": "\\S"
22
+ },
23
+ "version": {
24
+ "description": "The mod's own version, ideally semver like \"1.0.0\".",
25
+ "type": "string",
26
+ "minLength": 1
27
+ },
28
+ "apiVersion": {
29
+ "description": "Mod API version the mod targets. Missing means 1.",
30
+ "type": "integer",
31
+ "minimum": 1
32
+ },
33
+ "description": {
34
+ "description": "Shown in the widget picker.",
35
+ "type": "string"
36
+ },
37
+ "author": {
38
+ "description": "Shown in the widget picker when there is no description.",
39
+ "type": "string"
40
+ },
41
+ "category": {
42
+ "description": "Ignored: mods are always listed under Mods.",
43
+ "deprecated": true
44
+ },
45
+ "sizes": {
46
+ "description": "Tile width in dock units for each supported size. Default { \"m\": 2 }.",
47
+ "type": "object",
48
+ "properties": {
49
+ "s": {
50
+ "$ref": "#/$defs/units",
51
+ "description": "Small tile width, in dock units."
52
+ },
53
+ "m": {
54
+ "$ref": "#/$defs/units",
55
+ "description": "Medium tile width, in dock units."
56
+ },
57
+ "l": {
58
+ "$ref": "#/$defs/units",
59
+ "description": "Large tile width, in dock units."
60
+ }
61
+ },
62
+ "additionalProperties": false,
63
+ "minProperties": 1
64
+ },
65
+ "tile": {
66
+ "description": "The tile page: an .html file relative to the mod folder.",
67
+ "$ref": "#/$defs/pagePath",
68
+ "default": "tile.html"
69
+ },
70
+ "panel": {
71
+ "description": "Optional popup page (.html), opened with bb.panel.open().",
72
+ "$ref": "#/$defs/pagePath"
73
+ },
74
+ "panelSize": {
75
+ "description": "Panel size in DIP.",
76
+ "type": "object",
77
+ "required": ["width", "height"],
78
+ "properties": {
79
+ "width": {
80
+ "type": "number",
81
+ "exclusiveMinimum": 0
82
+ },
83
+ "height": {
84
+ "type": "number",
85
+ "exclusiveMinimum": 0
86
+ }
87
+ },
88
+ "additionalProperties": false
89
+ },
90
+ "permissions": {
91
+ "type": "array",
92
+ "uniqueItems": true,
93
+ "items": {
94
+ "anyOf": [
95
+ {
96
+ "const": "open-url",
97
+ "description": "bb.openUrl() opens http(s) links in the default browser."
98
+ },
99
+ {
100
+ "const": "system",
101
+ "description": "bb.on('system') receives CPU and RAM usage."
102
+ },
103
+ {
104
+ "description": "bb.fetch() to this host over https. net:*.example.com covers subdomains.",
105
+ "type": "string",
106
+ "pattern": "^net:(\\*\\.)?[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*$"
107
+ }
108
+ ]
109
+ },
110
+ "description": "What the mod may do beyond its sandbox."
111
+ },
112
+ "settings": {
113
+ "description": "The settings popup is generated from this. Values arrive as bb.config.",
114
+ "type": "object",
115
+ "additionalProperties": {
116
+ "$ref": "#/$defs/settingField"
117
+ }
118
+ }
119
+ },
120
+ "$defs": {
121
+ "units": {
122
+ "type": "number",
123
+ "exclusiveMinimum": 0
124
+ },
125
+ "settingField": {
126
+ "type": "object",
127
+ "required": ["type", "label"],
128
+ "properties": {
129
+ "type": {
130
+ "enum": ["text", "number", "toggle", "select"]
131
+ }
132
+ },
133
+ "oneOf": [
134
+ {
135
+ "properties": {
136
+ "type": {
137
+ "const": "text"
138
+ },
139
+ "label": {
140
+ "description": "Shown next to the control.",
141
+ "type": "string"
142
+ },
143
+ "description": {
144
+ "description": "Help text shown under the control.",
145
+ "type": "string"
146
+ },
147
+ "visibleWhen": {
148
+ "$ref": "#/$defs/visibleWhen"
149
+ },
150
+ "default": {
151
+ "type": "string"
152
+ },
153
+ "placeholder": {
154
+ "type": "string"
155
+ }
156
+ },
157
+ "additionalProperties": false
158
+ },
159
+ {
160
+ "properties": {
161
+ "type": {
162
+ "const": "number"
163
+ },
164
+ "label": {
165
+ "description": "Shown next to the control.",
166
+ "type": "string"
167
+ },
168
+ "description": {
169
+ "description": "Help text shown under the control.",
170
+ "type": "string"
171
+ },
172
+ "visibleWhen": {
173
+ "$ref": "#/$defs/visibleWhen"
174
+ },
175
+ "default": {
176
+ "type": "number"
177
+ },
178
+ "min": {
179
+ "type": "number"
180
+ },
181
+ "max": {
182
+ "type": "number"
183
+ },
184
+ "step": {
185
+ "type": "number",
186
+ "exclusiveMinimum": 0
187
+ }
188
+ },
189
+ "additionalProperties": false
190
+ },
191
+ {
192
+ "properties": {
193
+ "type": {
194
+ "const": "toggle"
195
+ },
196
+ "label": {
197
+ "description": "Shown next to the control.",
198
+ "type": "string"
199
+ },
200
+ "description": {
201
+ "description": "Help text shown under the control.",
202
+ "type": "string"
203
+ },
204
+ "visibleWhen": {
205
+ "$ref": "#/$defs/visibleWhen"
206
+ },
207
+ "default": {
208
+ "type": "boolean"
209
+ }
210
+ },
211
+ "additionalProperties": false
212
+ },
213
+ {
214
+ "properties": {
215
+ "type": {
216
+ "const": "select"
217
+ },
218
+ "label": {
219
+ "description": "Shown next to the control.",
220
+ "type": "string"
221
+ },
222
+ "description": {
223
+ "description": "Help text shown under the control.",
224
+ "type": "string"
225
+ },
226
+ "visibleWhen": {
227
+ "$ref": "#/$defs/visibleWhen"
228
+ },
229
+ "default": {
230
+ "description": "One of the option values.",
231
+ "type": "string"
232
+ },
233
+ "options": {
234
+ "type": "array",
235
+ "minItems": 1,
236
+ "items": {
237
+ "type": "object",
238
+ "required": ["value", "label"],
239
+ "properties": {
240
+ "value": {
241
+ "type": "string"
242
+ },
243
+ "label": {
244
+ "type": "string"
245
+ }
246
+ },
247
+ "additionalProperties": false
248
+ }
249
+ }
250
+ },
251
+ "additionalProperties": false,
252
+ "required": ["options"]
253
+ }
254
+ ]
255
+ },
256
+ "pagePath": {
257
+ "type": "string",
258
+ "pattern": "^(?![A-Za-z][A-Za-z0-9+.-]*:|[\\\\/])(?!(?:.*[\\\\/])?\\.\\.(?:[\\\\/]|$)).+\\.[Hh][Tt][Mm][Ll]$"
259
+ },
260
+ "visibleWhen": {
261
+ "description": "Show the field only while another setting has this value.",
262
+ "type": "object",
263
+ "required": ["field", "equals"],
264
+ "properties": {
265
+ "field": {
266
+ "description": "Key of another setting.",
267
+ "type": "string"
268
+ },
269
+ "equals": {
270
+ "type": ["string", "number", "boolean"]
271
+ }
272
+ },
273
+ "additionalProperties": false
274
+ }
275
+ }
276
+ }