@jupytergis/jupytergis-core 0.2.1 → 0.4.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.
package/lib/factory.d.ts CHANGED
@@ -5,7 +5,7 @@ import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
5
5
  import { IEditorMimeTypeService } from '@jupyterlab/codeeditor';
6
6
  import { ABCWidgetFactory, DocumentRegistry } from '@jupyterlab/docregistry';
7
7
  import { CommandRegistry } from '@lumino/commands';
8
- import { JupyterGISWidget } from '@jupytergis/base';
8
+ import { JupyterGISDocumentWidget } from '@jupytergis/base';
9
9
  import { ServiceManager } from '@jupyterlab/services';
10
10
  interface IOptions extends DocumentRegistry.IWidgetFactoryOptions {
11
11
  tracker: IJupyterGISTracker;
@@ -19,7 +19,7 @@ interface IOptions extends DocumentRegistry.IWidgetFactoryOptions {
19
19
  backendCheck?: () => boolean;
20
20
  drive?: ICollaborativeDrive | null;
21
21
  }
22
- export declare class JupyterGISWidgetFactory extends ABCWidgetFactory<JupyterGISWidget, JupyterGISModel> {
22
+ export declare class JupyterGISDocumentWidgetFactory extends ABCWidgetFactory<JupyterGISDocumentWidget, JupyterGISModel> {
23
23
  private options;
24
24
  constructor(options: IOptions);
25
25
  /**
@@ -28,7 +28,7 @@ export declare class JupyterGISWidgetFactory extends ABCWidgetFactory<JupyterGIS
28
28
  * @param context Contains the information of the file
29
29
  * @returns The widget
30
30
  */
31
- protected createNewWidget(context: DocumentRegistry.IContext<JupyterGISModel>): JupyterGISWidget;
31
+ protected createNewWidget(context: DocumentRegistry.IContext<JupyterGISModel>): JupyterGISDocumentWidget;
32
32
  private _commands;
33
33
  private _externalCommandRegistry;
34
34
  private _backendCheck?;
package/lib/factory.js CHANGED
@@ -10,8 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { ABCWidgetFactory } from '@jupyterlab/docregistry';
13
- import { JupyterGISPanel, JupyterGISWidget, ToolbarWidget } from '@jupytergis/base';
14
- export class JupyterGISWidgetFactory extends ABCWidgetFactory {
13
+ import { JupyterGISPanel, JupyterGISDocumentWidget, ToolbarWidget } from '@jupytergis/base';
14
+ export class JupyterGISDocumentWidgetFactory extends ABCWidgetFactory {
15
15
  constructor(options) {
16
16
  var _a;
17
17
  const { backendCheck, externalCommandRegistry } = options, rest = __rest(options, ["backendCheck", "externalCommandRegistry"]);
@@ -36,8 +36,9 @@ export class JupyterGISWidgetFactory extends ABCWidgetFactory {
36
36
  }
37
37
  }
38
38
  const { model } = context;
39
+ model.filePath = context.localPath;
39
40
  if (this._contentsManager) {
40
- model.setContentsManager(this._contentsManager, context.path);
41
+ model.contentsManager = this._contentsManager;
41
42
  }
42
43
  const content = new JupyterGISPanel({
43
44
  model,
@@ -53,6 +54,6 @@ export class JupyterGISWidgetFactory extends ABCWidgetFactory {
53
54
  model,
54
55
  externalCommands: this._externalCommandRegistry.getCommands()
55
56
  });
56
- return new JupyterGISWidget({ context, content, toolbar });
57
+ return new JupyterGISDocumentWidget({ context, content, toolbar });
57
58
  }
58
59
  }
@@ -9,7 +9,7 @@ export declare class JupyterGISModelFactory implements DocumentRegistry.IModelFa
9
9
  /**
10
10
  * Whether the model is collaborative or not.
11
11
  */
12
- readonly collaborative: boolean;
12
+ readonly collaborative = true;
13
13
  /**
14
14
  * The name of the model.
15
15
  *
@@ -7,7 +7,7 @@ export class JupyterGISModelFactory {
7
7
  /**
8
8
  * Whether the model is collaborative or not.
9
9
  */
10
- this.collaborative = document.querySelectorAll('[data-jupyter-lite-root]')[0] === undefined;
10
+ this.collaborative = true;
11
11
  this._disposed = false;
12
12
  this._annotationModel = options.annotationModel;
13
13
  }
@@ -8,7 +8,7 @@ import { IFileBrowserFactory } from '@jupyterlab/filebrowser';
8
8
  import { ILauncher } from '@jupyterlab/launcher';
9
9
  import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
10
10
  import { CommandIDs, logoIcon, logoMiniIcon } from '@jupytergis/base';
11
- import { JupyterGISWidgetFactory } from '../factory';
11
+ import { JupyterGISDocumentWidgetFactory } from '../factory';
12
12
  import { JupyterGISModelFactory } from './modelfactory';
13
13
  import { MimeDocumentFactory } from '@jupyterlab/docregistry';
14
14
  const FACTORY = 'JupyterGIS .jgis Viewer';
@@ -19,7 +19,7 @@ const activate = (app, tracker, themeManager, browserFactory, externalCommandReg
19
19
  if (PageConfig.getOption('jgis_expose_maps')) {
20
20
  window.jupytergisMaps = {};
21
21
  }
22
- const widgetFactory = new JupyterGISWidgetFactory({
22
+ const widgetFactory = new JupyterGISDocumentWidgetFactory({
23
23
  name: FACTORY,
24
24
  modelName: MODEL_NAME,
25
25
  fileTypes: [CONTENT_TYPE],
@@ -68,7 +68,7 @@ const activate = (app, tracker, themeManager, browserFactory, externalCommandReg
68
68
  widget.context.pathChanged.connect(() => {
69
69
  tracker.save(widget);
70
70
  });
71
- themeManager.themeChanged.connect((_, changes) => widget.context.model.themeChanged.emit(changes));
71
+ themeManager.themeChanged.connect((_, changes) => widget.model.themeChanged.emit(changes));
72
72
  app.shell.activateById('jupytergis::leftControlPanel');
73
73
  app.shell.activateById('jupytergis::rightControlPanel');
74
74
  tracker
package/lib/plugin.js CHANGED
@@ -3,6 +3,7 @@ import { IAnnotationToken, IJGISExternalCommandRegistryToken, IJGISFormSchemaReg
3
3
  import { WidgetTracker } from '@jupyterlab/apputils';
4
4
  import { IMainMenu } from '@jupyterlab/mainmenu';
5
5
  import { ITranslator } from '@jupyterlab/translation';
6
+ import { IDocumentManager } from '@jupyterlab/docmanager';
6
7
  import { JupyterGISExternalCommandRegistry } from './externalcommand';
7
8
  import { JupyterGISLayerBrowserRegistry } from './layerBrowserRegistry';
8
9
  import { JupyterGISFormSchemaRegistry } from './schemaregistry';
@@ -24,10 +25,10 @@ export const trackerPlugin = {
24
25
  export const formSchemaRegistryPlugin = {
25
26
  id: 'jupytergis:core:form-schema-registry',
26
27
  autoStart: true,
27
- requires: [],
28
+ requires: [IDocumentManager],
28
29
  provides: IJGISFormSchemaRegistryToken,
29
- activate: (app) => {
30
- const registry = new JupyterGISFormSchemaRegistry();
30
+ activate: (app, docmanager) => {
31
+ const registry = new JupyterGISFormSchemaRegistry(docmanager);
31
32
  return registry;
32
33
  }
33
34
  };
@@ -60,10 +61,10 @@ export const annotationPlugin = {
60
61
  activate: (app, tracker) => {
61
62
  var _a;
62
63
  const annotationModel = new AnnotationModel({
63
- context: (_a = tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.context
64
+ model: (_a = tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.model
64
65
  });
65
66
  tracker.currentChanged.connect((_, changed) => {
66
- annotationModel.context = (changed === null || changed === void 0 ? void 0 : changed.context) || undefined;
67
+ annotationModel.model = (changed === null || changed === void 0 ? void 0 : changed.model) || undefined;
67
68
  });
68
69
  return annotationModel;
69
70
  }
@@ -1,8 +1,11 @@
1
1
  import { IDict, IJGISFormSchemaRegistry } from '@jupytergis/schema';
2
+ import { IDocumentManager } from '@jupyterlab/docmanager';
2
3
  export declare class JupyterGISFormSchemaRegistry implements IJGISFormSchemaRegistry {
3
- constructor();
4
+ private _docManager;
5
+ constructor(docManager: IDocumentManager);
4
6
  registerSchema(name: string, schema: IDict): void;
5
7
  has(name: string): boolean;
6
8
  getSchemas(): Map<string, IDict>;
9
+ getDocManager(): IDocumentManager;
7
10
  private _registry;
8
11
  }
@@ -1,7 +1,8 @@
1
1
  import formSchema from '@jupytergis/schema/lib/_interface/forms.json';
2
2
  export class JupyterGISFormSchemaRegistry {
3
- constructor() {
3
+ constructor(docManager) {
4
4
  this._registry = new Map(Object.entries(formSchema));
5
+ this._docManager = docManager;
5
6
  }
6
7
  registerSchema(name, schema) {
7
8
  if (!this._registry.has(name)) {
@@ -17,4 +18,7 @@ export class JupyterGISFormSchemaRegistry {
17
18
  getSchemas() {
18
19
  return this._registry;
19
20
  }
21
+ getDocManager() {
22
+ return this._docManager;
23
+ }
20
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupytergis/jupytergis-core",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "description": "JupyterGIS core extension",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -53,8 +53,8 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@jupyter/collaborative-drive": "^3.0.0",
56
- "@jupytergis/base": "^0.2.1",
57
- "@jupytergis/schema": "^0.2.1",
56
+ "@jupytergis/base": "^0.4.0",
57
+ "@jupytergis/schema": "^0.4.0",
58
58
  "@jupyterlab/application": "^4.3.0",
59
59
  "@jupyterlab/apputils": "^4.3.0",
60
60
  "@jupyterlab/docregistry": "^4.3.0",