@jupyterlab/settingregistry 4.0.0-alpha.9 → 4.0.0-beta.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.
@@ -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
@@ -295,6 +302,87 @@
295
302
  "required": ["name"],
296
303
  "additionalProperties": false,
297
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"
298
386
  }
299
387
  }
300
388
  }
@@ -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: string;
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
  /**
@@ -137,10 +153,12 @@ export declare class SettingRegistry implements ISettingRegistry {
137
153
  *
138
154
  * @param plugin - The name of the plugin whose settings are being loaded.
139
155
  *
156
+ * @param forceTransform - An optional parameter to force replay the transforms methods.
157
+ *
140
158
  * @returns A promise that resolves with a plugin settings object or rejects
141
159
  * if the plugin is not found.
142
160
  */
143
- load(plugin: string): Promise<ISettingRegistry.ISettings>;
161
+ load(plugin: string, forceTransform?: boolean): Promise<ISettingRegistry.ISettings>;
144
162
  /**
145
163
  * Reload a plugin's settings into the registry even if they already exist.
146
164
  *
@@ -228,11 +246,37 @@ export declare class SettingRegistry implements ISettingRegistry {
228
246
  private _ready;
229
247
  private _timeout;
230
248
  private _transformers;
249
+ private _unloadedPlugins;
250
+ }
251
+ /**
252
+ * Base settings specified by a JSON schema.
253
+ */
254
+ export declare class BaseSettings<T extends ISettingRegistry.IProperty = ISettingRegistry.IProperty> {
255
+ constructor(options: {
256
+ schema: T;
257
+ });
258
+ /**
259
+ * The plugin's schema.
260
+ */
261
+ get schema(): T;
262
+ /**
263
+ * Checks if any fields are different from the default value.
264
+ */
265
+ isDefault(user: ReadonlyPartialJSONObject): boolean;
266
+ /**
267
+ * Calculate the default value of a setting by iterating through the schema.
268
+ *
269
+ * @param key - The name of the setting whose default value is calculated.
270
+ *
271
+ * @returns A calculated default JSON value for a specific setting.
272
+ */
273
+ default(key?: string): PartialJSONValue | undefined;
274
+ private _schema;
231
275
  }
232
276
  /**
233
277
  * A manager for a specific plugin's settings.
234
278
  */
235
- export declare class Settings implements ISettingRegistry.ISettings {
279
+ export declare class Settings extends BaseSettings<ISettingRegistry.ISchema> implements ISettingRegistry.ISettings {
236
280
  /**
237
281
  * Instantiate a new plugin settings manager.
238
282
  */
@@ -258,18 +302,13 @@ export declare class Settings implements ISettingRegistry.ISettings {
258
302
  */
259
303
  get isDisposed(): boolean;
260
304
  get plugin(): ISettingRegistry.IPlugin;
261
- /**
262
- * The plugin's schema.
263
- */
264
- get schema(): ISettingRegistry.ISchema;
265
305
  /**
266
306
  * The plugin settings raw text value.
267
307
  */
268
308
  get raw(): string;
269
309
  /**
270
- * Checks if any fields are different from the default value.
310
+ * Whether the settings have been modified by the user or not.
271
311
  */
272
- isDefault(user: ReadonlyPartialJSONObject): boolean;
273
312
  get isModified(): boolean;
274
313
  /**
275
314
  * The user settings.
@@ -283,14 +322,6 @@ export declare class Settings implements ISettingRegistry.ISettings {
283
322
  * Return the defaults in a commented JSON format.
284
323
  */
285
324
  annotatedDefaults(): string;
286
- /**
287
- * Calculate the default value of a setting by iterating through the schema.
288
- *
289
- * @param key - The name of the setting whose default value is calculated.
290
- *
291
- * @returns A calculated default JSON value for a specific setting.
292
- */
293
- default(key?: string): PartialJSONValue | undefined;
294
325
  /**
295
326
  * Dispose of the plugin settings resources.
296
327
  */