@jupyterlab/settingregistry 4.0.0-alpha.2 → 4.0.0-alpha.20
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/lib/plugin-schema.json +119 -1
- package/lib/settingregistry.d.ts +52 -19
- package/lib/settingregistry.js +157 -84
- package/lib/settingregistry.js.map +1 -1
- package/lib/tokens.d.ts +100 -1
- package/lib/tokens.js +0 -1
- package/lib/tokens.js.map +1 -1
- package/package.json +16 -15
- package/src/index.ts +11 -0
- package/src/plugin-schema.json +388 -0
- package/src/settingregistry.ts +1489 -0
- package/src/tokens.ts +771 -0
package/lib/plugin-schema.json
CHANGED
|
@@ -56,6 +56,13 @@
|
|
|
56
56
|
},
|
|
57
57
|
"additionalProperties": false
|
|
58
58
|
},
|
|
59
|
+
"jupyter.lab.metadataforms": {
|
|
60
|
+
"items": {
|
|
61
|
+
"$ref": "#/definitions/metadataForm"
|
|
62
|
+
},
|
|
63
|
+
"type": "array",
|
|
64
|
+
"default": []
|
|
65
|
+
},
|
|
59
66
|
"jupyter.lab.setting-deprecated": {
|
|
60
67
|
"type": "boolean",
|
|
61
68
|
"default": false
|
|
@@ -197,23 +204,53 @@
|
|
|
197
204
|
"shortcut": {
|
|
198
205
|
"properties": {
|
|
199
206
|
"args": {
|
|
207
|
+
"title": "The arguments for the command",
|
|
200
208
|
"type": "object"
|
|
201
209
|
},
|
|
202
210
|
"command": {
|
|
211
|
+
"title": "The command id",
|
|
212
|
+
"description": "The command executed when the binding is matched.",
|
|
203
213
|
"type": "string"
|
|
204
214
|
},
|
|
205
215
|
"disabled": {
|
|
216
|
+
"description": "Whether this shortcut is disabled or not.",
|
|
206
217
|
"type": "boolean",
|
|
207
218
|
"default": false
|
|
208
219
|
},
|
|
209
220
|
"keys": {
|
|
221
|
+
"title": "The key sequence for the binding",
|
|
222
|
+
"description": "The key shortcut like `Accel A` or the sequence of shortcuts to press like [`Accel A`, `B`]",
|
|
223
|
+
"items": {
|
|
224
|
+
"type": "string"
|
|
225
|
+
},
|
|
226
|
+
"type": "array"
|
|
227
|
+
},
|
|
228
|
+
"macKeys": {
|
|
229
|
+
"title": "The key sequence for the binding on macOS",
|
|
230
|
+
"description": "The key shortcut like `Cmd A` or the sequence of shortcuts to press like [`Cmd A`, `B`]",
|
|
231
|
+
"items": {
|
|
232
|
+
"type": "string"
|
|
233
|
+
},
|
|
234
|
+
"type": "array"
|
|
235
|
+
},
|
|
236
|
+
"winKeys": {
|
|
237
|
+
"title": "The key sequence for the binding on Windows",
|
|
238
|
+
"description": "The key shortcut like `Ctrl A` or the sequence of shortcuts to press like [`Ctrl A`, `B`]",
|
|
239
|
+
"items": {
|
|
240
|
+
"type": "string"
|
|
241
|
+
},
|
|
242
|
+
"type": "array"
|
|
243
|
+
},
|
|
244
|
+
"linuxKeys": {
|
|
245
|
+
"title": "The key sequence for the binding on Linux",
|
|
246
|
+
"description": "The key shortcut like `Ctrl A` or the sequence of shortcuts to press like [`Ctrl A`, `B`]",
|
|
210
247
|
"items": {
|
|
211
248
|
"type": "string"
|
|
212
249
|
},
|
|
213
|
-
"minItems": 1,
|
|
214
250
|
"type": "array"
|
|
215
251
|
},
|
|
216
252
|
"selector": {
|
|
253
|
+
"title": "CSS selector",
|
|
217
254
|
"type": "string"
|
|
218
255
|
}
|
|
219
256
|
},
|
|
@@ -265,6 +302,87 @@
|
|
|
265
302
|
"required": ["name"],
|
|
266
303
|
"additionalProperties": false,
|
|
267
304
|
"type": "object"
|
|
305
|
+
},
|
|
306
|
+
"metadataForm": {
|
|
307
|
+
"type": "object",
|
|
308
|
+
"properties": {
|
|
309
|
+
"id": {
|
|
310
|
+
"type": "string",
|
|
311
|
+
"description": "The section ID"
|
|
312
|
+
},
|
|
313
|
+
"metadataSchema": {
|
|
314
|
+
"type": "object",
|
|
315
|
+
"items": {
|
|
316
|
+
"$ref": "#/definitions/metadataSchema"
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
"uiSchema": {
|
|
320
|
+
"type": "object"
|
|
321
|
+
},
|
|
322
|
+
"metadataOptions": {
|
|
323
|
+
"type": "object",
|
|
324
|
+
"items": {
|
|
325
|
+
"$ref": "#/definitions/metadataOptions"
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
"label": {
|
|
329
|
+
"type": "string",
|
|
330
|
+
"description": "The section label"
|
|
331
|
+
},
|
|
332
|
+
"rank": {
|
|
333
|
+
"type": "integer",
|
|
334
|
+
"description": "The rank of the section in the right panel"
|
|
335
|
+
},
|
|
336
|
+
"showModified": {
|
|
337
|
+
"type": "boolean",
|
|
338
|
+
"description": "Whether to show modified values from defaults"
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
"required": ["id", "metadataSchema"]
|
|
342
|
+
},
|
|
343
|
+
"metadataSchema": {
|
|
344
|
+
"properties": {
|
|
345
|
+
"properties": {
|
|
346
|
+
"type": "object",
|
|
347
|
+
"description": "The property set up by extension",
|
|
348
|
+
"properties": {
|
|
349
|
+
"title": {
|
|
350
|
+
"type": "string"
|
|
351
|
+
},
|
|
352
|
+
"description": {
|
|
353
|
+
"type": "string"
|
|
354
|
+
},
|
|
355
|
+
"type": {
|
|
356
|
+
"type": "string"
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
"type": "object",
|
|
362
|
+
"required": ["properties"]
|
|
363
|
+
},
|
|
364
|
+
"metadataOptions": {
|
|
365
|
+
"properties": {
|
|
366
|
+
"customRenderer": {
|
|
367
|
+
"type": "string"
|
|
368
|
+
},
|
|
369
|
+
"metadataLevel": {
|
|
370
|
+
"type": "string",
|
|
371
|
+
"enum": ["cell", "notebook"],
|
|
372
|
+
"default": "cell"
|
|
373
|
+
},
|
|
374
|
+
"cellTypes": {
|
|
375
|
+
"type": "array",
|
|
376
|
+
"items": {
|
|
377
|
+
"type": "string",
|
|
378
|
+
"enum": ["code", "markdown", "raw"]
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
"writeDefault": {
|
|
382
|
+
"type": "boolean"
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
"type": "object"
|
|
268
386
|
}
|
|
269
387
|
}
|
|
270
388
|
}
|
package/lib/settingregistry.d.ts
CHANGED
|
@@ -29,18 +29,14 @@ export declare namespace ISchemaValidator {
|
|
|
29
29
|
* A schema validation error definition.
|
|
30
30
|
*/
|
|
31
31
|
interface IError {
|
|
32
|
-
/**
|
|
33
|
-
* The path in the data where the error occurred.
|
|
34
|
-
*/
|
|
35
|
-
dataPath: string;
|
|
36
32
|
/**
|
|
37
33
|
* The keyword whose validation failed.
|
|
38
34
|
*/
|
|
39
|
-
keyword: string;
|
|
35
|
+
keyword: string | string[];
|
|
40
36
|
/**
|
|
41
37
|
* The error message.
|
|
42
38
|
*/
|
|
43
|
-
message
|
|
39
|
+
message?: string;
|
|
44
40
|
/**
|
|
45
41
|
* Optional parameter metadata that might be included in an error.
|
|
46
42
|
*/
|
|
@@ -49,6 +45,26 @@ export declare namespace ISchemaValidator {
|
|
|
49
45
|
* The path in the schema where the error occurred.
|
|
50
46
|
*/
|
|
51
47
|
schemaPath: string;
|
|
48
|
+
/**
|
|
49
|
+
* @todo handle new fields from ajv8
|
|
50
|
+
**/
|
|
51
|
+
schema?: unknown;
|
|
52
|
+
/**
|
|
53
|
+
* @todo handle new fields from ajv8
|
|
54
|
+
**/
|
|
55
|
+
instancePath: string;
|
|
56
|
+
/**
|
|
57
|
+
* @todo handle new fields from ajv8
|
|
58
|
+
**/
|
|
59
|
+
propertyName?: string;
|
|
60
|
+
/**
|
|
61
|
+
* @todo handle new fields from ajv8
|
|
62
|
+
**/
|
|
63
|
+
data?: unknown;
|
|
64
|
+
/**
|
|
65
|
+
* @todo handle new fields from ajv8
|
|
66
|
+
**/
|
|
67
|
+
parentSchema?: unknown;
|
|
52
68
|
}
|
|
53
69
|
}
|
|
54
70
|
/**
|
|
@@ -229,10 +245,35 @@ export declare class SettingRegistry implements ISettingRegistry {
|
|
|
229
245
|
private _timeout;
|
|
230
246
|
private _transformers;
|
|
231
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Base settings specified by a JSON schema.
|
|
250
|
+
*/
|
|
251
|
+
export declare class BaseSettings<T extends ISettingRegistry.IProperty = ISettingRegistry.IProperty> {
|
|
252
|
+
constructor(options: {
|
|
253
|
+
schema: T;
|
|
254
|
+
});
|
|
255
|
+
/**
|
|
256
|
+
* The plugin's schema.
|
|
257
|
+
*/
|
|
258
|
+
get schema(): T;
|
|
259
|
+
/**
|
|
260
|
+
* Checks if any fields are different from the default value.
|
|
261
|
+
*/
|
|
262
|
+
isDefault(user: ReadonlyPartialJSONObject): boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Calculate the default value of a setting by iterating through the schema.
|
|
265
|
+
*
|
|
266
|
+
* @param key - The name of the setting whose default value is calculated.
|
|
267
|
+
*
|
|
268
|
+
* @returns A calculated default JSON value for a specific setting.
|
|
269
|
+
*/
|
|
270
|
+
default(key?: string): PartialJSONValue | undefined;
|
|
271
|
+
private _schema;
|
|
272
|
+
}
|
|
232
273
|
/**
|
|
233
274
|
* A manager for a specific plugin's settings.
|
|
234
275
|
*/
|
|
235
|
-
export declare class Settings implements ISettingRegistry.ISettings {
|
|
276
|
+
export declare class Settings extends BaseSettings<ISettingRegistry.ISchema> implements ISettingRegistry.ISettings {
|
|
236
277
|
/**
|
|
237
278
|
* Instantiate a new plugin settings manager.
|
|
238
279
|
*/
|
|
@@ -258,14 +299,14 @@ export declare class Settings implements ISettingRegistry.ISettings {
|
|
|
258
299
|
*/
|
|
259
300
|
get isDisposed(): boolean;
|
|
260
301
|
get plugin(): ISettingRegistry.IPlugin;
|
|
261
|
-
/**
|
|
262
|
-
* The plugin's schema.
|
|
263
|
-
*/
|
|
264
|
-
get schema(): ISettingRegistry.ISchema;
|
|
265
302
|
/**
|
|
266
303
|
* The plugin settings raw text value.
|
|
267
304
|
*/
|
|
268
305
|
get raw(): string;
|
|
306
|
+
/**
|
|
307
|
+
* Whether the settings have been modified by the user or not.
|
|
308
|
+
*/
|
|
309
|
+
get isModified(): boolean;
|
|
269
310
|
/**
|
|
270
311
|
* The user settings.
|
|
271
312
|
*/
|
|
@@ -278,14 +319,6 @@ export declare class Settings implements ISettingRegistry.ISettings {
|
|
|
278
319
|
* Return the defaults in a commented JSON format.
|
|
279
320
|
*/
|
|
280
321
|
annotatedDefaults(): string;
|
|
281
|
-
/**
|
|
282
|
-
* Calculate the default value of a setting by iterating through the schema.
|
|
283
|
-
*
|
|
284
|
-
* @param key - The name of the setting whose default value is calculated.
|
|
285
|
-
*
|
|
286
|
-
* @returns A calculated default JSON value for a specific setting.
|
|
287
|
-
*/
|
|
288
|
-
default(key: string): PartialJSONValue | undefined;
|
|
289
322
|
/**
|
|
290
323
|
* Dispose of the plugin settings resources.
|
|
291
324
|
*/
|