@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/tokens.d.ts CHANGED
@@ -1,8 +1,10 @@
1
+ import { CellType } from '@jupyterlab/nbformat';
1
2
  import { IDataConnector } from '@jupyterlab/statedb';
2
3
  import { PartialJSONObject, PartialJSONValue, ReadonlyPartialJSONObject, ReadonlyPartialJSONValue, Token } from '@lumino/coreutils';
3
4
  import { IDisposable } from '@lumino/disposable';
4
5
  import { ISignal } from '@lumino/signaling';
5
6
  import { ISchemaValidator } from './settingregistry';
7
+ import type { RJSFSchema, UiSchema } from '@rjsf/utils';
6
8
  /**
7
9
  * The setting registry token.
8
10
  */
@@ -216,6 +218,9 @@ export declare namespace ISettingRegistry {
216
218
  */
217
219
  disabled?: boolean;
218
220
  }
221
+ /**
222
+ * An interface describing a context menu item
223
+ */
219
224
  interface IContextMenuItem extends IMenuItem {
220
225
  /**
221
226
  * The CSS selector for the context menu item.
@@ -355,6 +360,10 @@ export declare namespace ISettingRegistry {
355
360
  * The JupyterLab shortcuts that are created by a plugin's schema.
356
361
  */
357
362
  'jupyter.lab.shortcuts'?: IShortcut[];
363
+ /**
364
+ * The JupyterLab metadata-form schema
365
+ */
366
+ 'jupyter.lab.metadataforms'?: IMetadataForm[];
358
367
  /**
359
368
  * The root schema is always an object.
360
369
  */
@@ -486,7 +495,12 @@ export declare namespace ISettingRegistry {
486
495
  */
487
496
  disabled?: boolean;
488
497
  /**
489
- * The key combination of the shortcut.
498
+ * The key sequence of the shortcut.
499
+ *
500
+ * ### Notes
501
+ *
502
+ * If this is a list like `['Ctrl A', 'B']`, the user needs to press
503
+ * `Ctrl A` followed by `B` to trigger the shortcuts.
490
504
  */
491
505
  keys: string[];
492
506
  /**
@@ -494,6 +508,91 @@ export declare namespace ISettingRegistry {
494
508
  */
495
509
  selector: string;
496
510
  }
511
+ /**
512
+ * An interface describing the metadata form.
513
+ */
514
+ interface IMetadataForm extends PartialJSONObject {
515
+ /**
516
+ * The section unique ID.
517
+ */
518
+ id: string;
519
+ /**
520
+ * The metadata schema.
521
+ */
522
+ metadataSchema: IMetadataSchema;
523
+ /**
524
+ * The ui schema as used by react-JSON-schema-form.
525
+ */
526
+ uiSchema?: {
527
+ [metadataKey: string]: UiSchema;
528
+ };
529
+ /**
530
+ * The jupyter properties.
531
+ */
532
+ metadataOptions?: {
533
+ [metadataKey: string]: IMetadataOptions;
534
+ };
535
+ /**
536
+ * The section label.
537
+ */
538
+ label?: string;
539
+ /**
540
+ * The section rank in notebooktools panel.
541
+ */
542
+ rank?: number;
543
+ /**
544
+ * Whether to show the modified field from default value.
545
+ */
546
+ showModified?: boolean;
547
+ /**
548
+ * Keep the plugin at origin of the metadata form.
549
+ */
550
+ _origin?: string;
551
+ }
552
+ /**
553
+ * The metadata schema as defined in JSON schema.
554
+ */
555
+ interface IMetadataSchema extends RJSFSchema {
556
+ /**
557
+ * The properties as defined in JSON schema, and interpretable by react-JSON-schema-form.
558
+ */
559
+ properties: {
560
+ [option: string]: any;
561
+ };
562
+ /**
563
+ * The required fields.
564
+ */
565
+ required?: string[];
566
+ /**
567
+ * Support for allOf feature of JSON schema (useful for if/then/else).
568
+ */
569
+ allOf?: Array<PartialJSONObject>;
570
+ }
571
+ /**
572
+ * Options to customize the widget, the field and the relevant metadata.
573
+ */
574
+ interface IMetadataOptions extends PartialJSONObject {
575
+ /**
576
+ * Name of a custom react widget registered.
577
+ */
578
+ customWidget?: string;
579
+ /**
580
+ * Name of a custom react field registered.
581
+ */
582
+ customField?: string;
583
+ /**
584
+ * Metadata applied to notebook or cell.
585
+ */
586
+ metadataLevel?: 'cell' | 'notebook';
587
+ /**
588
+ * Cells which should have this metadata.
589
+ */
590
+ cellTypes?: CellType[];
591
+ /**
592
+ * Whether to avoid writing default value in metadata.
593
+ */
594
+ writeDefault?: boolean;
595
+ }
497
596
  /**
498
597
  * An interface describing a toolbar item.
499
598
  */
package/lib/tokens.js CHANGED
@@ -3,7 +3,6 @@
3
3
  | Distributed under the terms of the Modified BSD License.
4
4
  |----------------------------------------------------------------------------*/
5
5
  import { Token } from '@lumino/coreutils';
6
- /* tslint:disable */
7
6
  /**
8
7
  * The setting registry token.
9
8
  */
package/lib/tokens.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAG/E,OAAO,EAKL,KAAK,EACN,MAAM,mBAAmB,CAAC;AAK3B,oBAAoB;AACpB;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,KAAK,CACvC,wCAAwC,CACzC,CAAC"}
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAI/E,OAAO,EAKL,KAAK,EACN,MAAM,mBAAmB,CAAC;AAM3B;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,KAAK,CACvC,wCAAwC,CACzC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlab/settingregistry",
3
- "version": "4.0.0-alpha.2",
3
+ "version": "4.0.0-alpha.20",
4
4
  "description": "Settings registry for Jupyterlab",
5
5
  "homepage": "https://github.com/jupyterlab/jupyterlab",
6
6
  "bugs": {
@@ -21,7 +21,9 @@
21
21
  "files": [
22
22
  "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
23
23
  "schema/*.json",
24
- "style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
24
+ "style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
25
+ "src/**/*.{ts,tsx}",
26
+ "src/plugin-schema.json"
25
27
  ],
26
28
  "scripts": {
27
29
  "build": "tsc -b",
@@ -35,22 +37,21 @@
35
37
  "watch": "tsc -b --watch"
36
38
  },
37
39
  "dependencies": {
38
- "@jupyterlab/statedb": "^4.0.0-alpha.2",
39
- "@lumino/commands": "^1.19.0",
40
- "@lumino/coreutils": "^1.11.1",
41
- "@lumino/disposable": "^1.10.1",
42
- "@lumino/signaling": "^1.10.1",
43
- "ajv": "^6.12.3",
44
- "json5": "^2.1.1"
40
+ "@jupyterlab/nbformat": "^4.0.0-alpha.20",
41
+ "@jupyterlab/statedb": "^4.0.0-alpha.20",
42
+ "@lumino/commands": "^2.0.0-rc.0",
43
+ "@lumino/coreutils": "^2.0.0-rc.0",
44
+ "@lumino/disposable": "^2.0.0-rc.0",
45
+ "@lumino/signaling": "^2.0.0-rc.0",
46
+ "@rjsf/utils": "^5.1.0",
47
+ "ajv": "^8.12.0",
48
+ "json5": "^2.2.3"
45
49
  },
46
50
  "devDependencies": {
47
- "@jupyterlab/testutils": "^4.0.0-alpha.2",
48
- "@types/jest": "^26.0.10",
49
- "@types/json5": "^0.0.30",
50
- "jest": "^26.4.2",
51
+ "@jupyterlab/testing": "^4.0.0-alpha.20",
52
+ "@types/jest": "^29.2.0",
51
53
  "rimraf": "~3.0.0",
52
- "ts-jest": "^26.3.0",
53
- "typescript": "~4.5.2"
54
+ "typescript": "~5.0.0-beta"
54
55
  },
55
56
  "publishConfig": {
56
57
  "access": "public"
package/src/index.ts ADDED
@@ -0,0 +1,11 @@
1
+ /* -----------------------------------------------------------------------------
2
+ | Copyright (c) Jupyter Development Team.
3
+ | Distributed under the terms of the Modified BSD License.
4
+ |----------------------------------------------------------------------------*/
5
+ /**
6
+ * @packageDocumentation
7
+ * @module settingregistry
8
+ */
9
+
10
+ export * from './settingregistry';
11
+ export * from './tokens';
@@ -0,0 +1,388 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "title": "JupyterLab Plugin Settings/Preferences Schema",
4
+ "description": "JupyterLab plugin settings/preferences schema",
5
+ "version": "1.0.0",
6
+ "type": "object",
7
+ "additionalProperties": true,
8
+ "properties": {
9
+ "jupyter.lab.internationalization": {
10
+ "type": "object",
11
+ "properties": {
12
+ "selectors": {
13
+ "type": "array",
14
+ "items": {
15
+ "type": "string",
16
+ "minLength": 1
17
+ }
18
+ },
19
+ "domain": {
20
+ "type": "string",
21
+ "minLength": 1
22
+ }
23
+ }
24
+ },
25
+ "jupyter.lab.menus": {
26
+ "type": "object",
27
+ "properties": {
28
+ "main": {
29
+ "title": "Main menu entries",
30
+ "description": "List of menu items to add to the main menubar.",
31
+ "items": {
32
+ "$ref": "#/definitions/menu"
33
+ },
34
+ "type": "array",
35
+ "default": []
36
+ },
37
+ "context": {
38
+ "title": "The application context menu.",
39
+ "description": "List of context menu items.",
40
+ "items": {
41
+ "allOf": [
42
+ { "$ref": "#/definitions/menuItem" },
43
+ {
44
+ "properties": {
45
+ "selector": {
46
+ "description": "The CSS selector for the context menu item.",
47
+ "type": "string"
48
+ }
49
+ }
50
+ }
51
+ ]
52
+ },
53
+ "type": "array",
54
+ "default": []
55
+ }
56
+ },
57
+ "additionalProperties": false
58
+ },
59
+ "jupyter.lab.metadataforms": {
60
+ "items": {
61
+ "$ref": "#/definitions/metadataForm"
62
+ },
63
+ "type": "array",
64
+ "default": []
65
+ },
66
+ "jupyter.lab.setting-deprecated": {
67
+ "type": "boolean",
68
+ "default": false
69
+ },
70
+ "jupyter.lab.setting-icon": {
71
+ "type": "string",
72
+ "default": ""
73
+ },
74
+ "jupyter.lab.setting-icon-class": {
75
+ "type": "string",
76
+ "default": ""
77
+ },
78
+ "jupyter.lab.setting-icon-label": {
79
+ "type": "string",
80
+ "default": "Plugin"
81
+ },
82
+ "jupyter.lab.shortcuts": {
83
+ "items": {
84
+ "$ref": "#/definitions/shortcut"
85
+ },
86
+ "type": "array",
87
+ "default": []
88
+ },
89
+ "jupyter.lab.toolbars": {
90
+ "properties": {
91
+ "^\\w[\\w-\\.]*$": {
92
+ "items": {
93
+ "$ref": "#/definitions/toolbarItem"
94
+ },
95
+ "type": "array",
96
+ "default": []
97
+ }
98
+ },
99
+ "type": "object",
100
+ "default": {}
101
+ },
102
+ "jupyter.lab.transform": {
103
+ "type": "boolean",
104
+ "default": false
105
+ }
106
+ },
107
+ "definitions": {
108
+ "menu": {
109
+ "properties": {
110
+ "disabled": {
111
+ "description": "Whether the menu is disabled or not",
112
+ "type": "boolean",
113
+ "default": false
114
+ },
115
+ "icon": {
116
+ "description": "Menu icon id",
117
+ "type": "string"
118
+ },
119
+ "id": {
120
+ "description": "Menu unique id",
121
+ "oneOf": [
122
+ {
123
+ "type": "string",
124
+ "enum": [
125
+ "jp-menu-file",
126
+ "jp-menu-file-new",
127
+ "jp-menu-edit",
128
+ "jp-menu-help",
129
+ "jp-menu-kernel",
130
+ "jp-menu-run",
131
+ "jp-menu-settings",
132
+ "jp-menu-view",
133
+ "jp-menu-tabs"
134
+ ]
135
+ },
136
+ { "type": "string", "pattern": "[a-z][a-z0-9\\-_]+" }
137
+ ]
138
+ },
139
+ "items": {
140
+ "description": "Menu items",
141
+ "type": "array",
142
+ "items": {
143
+ "$ref": "#/definitions/menuItem"
144
+ }
145
+ },
146
+ "label": {
147
+ "description": "Menu label",
148
+ "type": "string"
149
+ },
150
+ "mnemonic": {
151
+ "description": "Mnemonic index for the label",
152
+ "type": "number",
153
+ "minimum": -1,
154
+ "default": -1
155
+ },
156
+ "rank": {
157
+ "description": "Menu rank",
158
+ "type": "number",
159
+ "minimum": 0
160
+ }
161
+ },
162
+ "required": ["id"],
163
+ "type": "object"
164
+ },
165
+ "menuItem": {
166
+ "properties": {
167
+ "args": {
168
+ "description": "Command arguments",
169
+ "type": "object"
170
+ },
171
+ "command": {
172
+ "description": "Command id",
173
+ "type": "string"
174
+ },
175
+ "disabled": {
176
+ "description": "Whether the item is disabled or not",
177
+ "type": "boolean",
178
+ "default": false
179
+ },
180
+ "type": {
181
+ "description": "Item type",
182
+ "type": "string",
183
+ "enum": ["command", "submenu", "separator"],
184
+ "default": "command"
185
+ },
186
+ "rank": {
187
+ "description": "Item rank",
188
+ "type": "number",
189
+ "minimum": 0
190
+ },
191
+ "submenu": {
192
+ "oneOf": [
193
+ {
194
+ "$ref": "#/definitions/menu"
195
+ },
196
+ {
197
+ "type": "null"
198
+ }
199
+ ]
200
+ }
201
+ },
202
+ "type": "object"
203
+ },
204
+ "shortcut": {
205
+ "properties": {
206
+ "args": {
207
+ "title": "The arguments for the command",
208
+ "type": "object"
209
+ },
210
+ "command": {
211
+ "title": "The command id",
212
+ "description": "The command executed when the binding is matched.",
213
+ "type": "string"
214
+ },
215
+ "disabled": {
216
+ "description": "Whether this shortcut is disabled or not.",
217
+ "type": "boolean",
218
+ "default": false
219
+ },
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`]",
247
+ "items": {
248
+ "type": "string"
249
+ },
250
+ "type": "array"
251
+ },
252
+ "selector": {
253
+ "title": "CSS selector",
254
+ "type": "string"
255
+ }
256
+ },
257
+ "required": ["command", "keys", "selector"],
258
+ "type": "object"
259
+ },
260
+ "toolbarItem": {
261
+ "properties": {
262
+ "name": {
263
+ "title": "Unique name",
264
+ "type": "string"
265
+ },
266
+ "args": {
267
+ "title": "Command arguments",
268
+ "type": "object"
269
+ },
270
+ "command": {
271
+ "title": "Command id",
272
+ "type": "string",
273
+ "default": ""
274
+ },
275
+ "disabled": {
276
+ "title": "Whether the item is ignored or not",
277
+ "type": "boolean",
278
+ "default": false
279
+ },
280
+ "icon": {
281
+ "title": "Item icon id",
282
+ "description": "If defined, it will override the command icon",
283
+ "type": "string"
284
+ },
285
+ "label": {
286
+ "title": "Item label",
287
+ "description": "If defined, it will override the command label",
288
+ "type": "string"
289
+ },
290
+ "type": {
291
+ "title": "Item type",
292
+ "type": "string",
293
+ "enum": ["command", "spacer"]
294
+ },
295
+ "rank": {
296
+ "title": "Item rank",
297
+ "type": "number",
298
+ "minimum": 0,
299
+ "default": 50
300
+ }
301
+ },
302
+ "required": ["name"],
303
+ "additionalProperties": false,
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"
386
+ }
387
+ }
388
+ }