@jupytergis/jupytergis-core 0.5.0 → 0.6.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.
package/lib/factory.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console';
2
1
  import { ICollaborativeDrive } from '@jupyter/collaborative-drive';
2
+ import { JupyterGISDocumentWidget } from '@jupytergis/base';
3
3
  import { JupyterGISModel, IJupyterGISTracker, IJGISExternalCommandRegistry } from '@jupytergis/schema';
4
- import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
5
4
  import { IEditorMimeTypeService } from '@jupyterlab/codeeditor';
5
+ import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console';
6
6
  import { ABCWidgetFactory, DocumentRegistry } from '@jupyterlab/docregistry';
7
- import { CommandRegistry } from '@lumino/commands';
8
- import { JupyterGISDocumentWidget } from '@jupytergis/base';
7
+ import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
9
8
  import { ServiceManager } from '@jupyterlab/services';
9
+ import { CommandRegistry } from '@lumino/commands';
10
10
  interface IOptions extends DocumentRegistry.IWidgetFactoryOptions {
11
11
  tracker: IJupyterGISTracker;
12
12
  commands: CommandRegistry;
package/lib/factory.js CHANGED
@@ -9,8 +9,8 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
+ import { JupyterGISPanel, JupyterGISDocumentWidget, ToolbarWidget, } from '@jupytergis/base';
12
13
  import { ABCWidgetFactory } from '@jupyterlab/docregistry';
13
- import { JupyterGISPanel, JupyterGISDocumentWidget, ToolbarWidget } from '@jupytergis/base';
14
14
  export class JupyterGISDocumentWidgetFactory extends ABCWidgetFactory {
15
15
  constructor(options) {
16
16
  var _a;
@@ -37,6 +37,9 @@ export class JupyterGISDocumentWidgetFactory extends ABCWidgetFactory {
37
37
  }
38
38
  const { model } = context;
39
39
  model.filePath = context.localPath;
40
+ context.pathChanged.connect(() => {
41
+ model.filePath = context.localPath;
42
+ });
40
43
  if (this._contentsManager) {
41
44
  model.contentsManager = this._contentsManager;
42
45
  }
@@ -47,12 +50,12 @@ export class JupyterGISDocumentWidgetFactory extends ABCWidgetFactory {
47
50
  mimeTypeService: this.options.mimeTypeService,
48
51
  rendermime: this.options.rendermime,
49
52
  consoleTracker: this.options.consoleTracker,
50
- commandRegistry: this.options.commands
53
+ commandRegistry: this.options.commands,
51
54
  });
52
55
  const toolbar = new ToolbarWidget({
53
56
  commands: this._commands,
54
57
  model,
55
- externalCommands: this._externalCommandRegistry.getCommands()
58
+ externalCommands: this._externalCommandRegistry.getCommands(),
56
59
  });
57
60
  return new JupyterGISDocumentWidget({ context, content, toolbar });
58
61
  }
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import jgisPlugin from './jgisplugin/plugins';
2
- import { externalCommandRegistryPlugin, formSchemaRegistryPlugin, layerBrowserRegistryPlugin, trackerPlugin, annotationPlugin } from './plugin';
2
+ import { externalCommandRegistryPlugin, formSchemaRegistryPlugin, layerBrowserRegistryPlugin, trackerPlugin, annotationPlugin, } from './plugin';
3
3
  export * from './factory';
4
4
  export default [
5
5
  trackerPlugin,
@@ -7,5 +7,5 @@ export default [
7
7
  formSchemaRegistryPlugin,
8
8
  externalCommandRegistryPlugin,
9
9
  layerBrowserRegistryPlugin,
10
- annotationPlugin
10
+ annotationPlugin,
11
11
  ];
@@ -1,4 +1,4 @@
1
- import { JupyterGISModel } from '@jupytergis/schema';
1
+ import { JupyterGISModel, } from '@jupytergis/schema';
2
2
  /**
3
3
  * A Model factory to create new instances of JupyterGISModel.
4
4
  */
@@ -69,7 +69,7 @@ export class JupyterGISModelFactory {
69
69
  sharedModel: options.sharedModel,
70
70
  languagePreference: options.languagePreference,
71
71
  annotationModel: this._annotationModel,
72
- settingRegistry: this._settingRegistry
72
+ settingRegistry: this._settingRegistry,
73
73
  });
74
74
  model.initSettings();
75
75
  return model;
@@ -1,17 +1,17 @@
1
- import { ICollaborativeDrive } from '@jupyter/collaborative-drive';
2
- import { IAnnotationToken, IJGISExternalCommandRegistryToken, IJupyterGISDocTracker, JupyterGISDoc, SCHEMA_VERSION } from '@jupytergis/schema';
3
- import { ICommandPalette, IThemeManager } from '@jupyterlab/apputils';
1
+ import { ICollaborativeDrive, } from '@jupyter/collaborative-drive';
2
+ import { CommandIDs, logoIcon, logoMiniIcon } from '@jupytergis/base';
3
+ import { IAnnotationToken, IJGISExternalCommandRegistryToken, IJupyterGISDocTracker, JupyterGISDoc, SCHEMA_VERSION, ProcessingMerge, } from '@jupytergis/schema';
4
+ import { ICommandPalette, IThemeManager, } from '@jupyterlab/apputils';
4
5
  import { IEditorServices } from '@jupyterlab/codeeditor';
5
6
  import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console';
6
7
  import { PageConfig } from '@jupyterlab/coreutils';
8
+ import { MimeDocumentFactory } from '@jupyterlab/docregistry';
7
9
  import { IFileBrowserFactory } from '@jupyterlab/filebrowser';
8
10
  import { ILauncher } from '@jupyterlab/launcher';
9
11
  import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
10
12
  import { ISettingRegistry } from '@jupyterlab/settingregistry';
11
- import { CommandIDs, logoIcon, logoMiniIcon } from '@jupytergis/base';
12
13
  import { JupyterGISDocumentWidgetFactory } from '../factory';
13
14
  import { JupyterGISModelFactory } from './modelfactory';
14
- import { MimeDocumentFactory } from '@jupyterlab/docregistry';
15
15
  const FACTORY = 'JupyterGIS .jgis Viewer';
16
16
  const CONTENT_TYPE = 'jgis';
17
17
  const PALETTE_CATEGORY = 'JupyterGIS';
@@ -41,7 +41,7 @@ const activate = async (app, tracker, themeManager, browserFactory, externalComm
41
41
  contentFactory,
42
42
  rendermime,
43
43
  mimeTypeService: editorServices.mimeTypeService,
44
- consoleTracker
44
+ consoleTracker,
45
45
  });
46
46
  // Registering the widget factory
47
47
  app.docRegistry.addWidgetFactory(widgetFactory);
@@ -51,13 +51,13 @@ const activate = async (app, tracker, themeManager, browserFactory, externalComm
51
51
  modelName: MODEL_NAME,
52
52
  name: 'JSON Editor',
53
53
  primaryFileType: app.docRegistry.getFileType('json'),
54
- fileTypes: [CONTENT_TYPE]
54
+ fileTypes: [CONTENT_TYPE],
55
55
  });
56
56
  app.docRegistry.addWidgetFactory(mimeDocumentFactory);
57
57
  // Creating and registering the model factory for our custom DocumentModel
58
58
  const modelFactory = new JupyterGISModelFactory({
59
59
  annotationModel,
60
- settingRegistry
60
+ settingRegistry,
61
61
  });
62
62
  app.docRegistry.addModelFactory(modelFactory);
63
63
  // register the filetype
@@ -68,7 +68,7 @@ const activate = async (app, tracker, themeManager, browserFactory, externalComm
68
68
  extensions: ['.jgis', '.JGIS'],
69
69
  fileFormat: 'text',
70
70
  contentType: CONTENT_TYPE,
71
- icon: logoMiniIcon
71
+ icon: logoMiniIcon,
72
72
  });
73
73
  const jGISSharedModelFactory = () => {
74
74
  return new JupyterGISDoc();
@@ -98,7 +98,7 @@ const activate = async (app, tracker, themeManager, browserFactory, externalComm
98
98
  });
99
99
  });
100
100
  app.commands.addCommand(CommandIDs.createNew, {
101
- label: args => 'GIS File',
101
+ label: args => { var _a; return (_a = args['label']) !== null && _a !== void 0 ? _a : 'GIS Project'; },
102
102
  caption: 'Create a new JGIS Editor',
103
103
  icon: args => logoIcon,
104
104
  execute: async (args) => {
@@ -111,22 +111,22 @@ const activate = async (app, tracker, themeManager, browserFactory, externalComm
111
111
  let model = await app.serviceManager.contents.newUntitled({
112
112
  path: cwd,
113
113
  type: 'file',
114
- ext: '.jGIS'
114
+ ext: '.jGIS',
115
115
  });
116
116
  model = await app.serviceManager.contents.save(model.path, Object.assign(Object.assign({}, model), { format: 'text', size: undefined, content: `{\n\t"schemaVersion": "${SCHEMA_VERSION}",\n\t"layers": {},\n\t"sources": {},\n\t"options": {"latitude": 0, "longitude": 0, "zoom": 0, "bearing": 0, "pitch": 0, "projection": "EPSG:3857"},\n\t"layerTree": [],\n\t"metadata": {}\n}` }));
117
117
  // Open the newly created file with the 'Editor'
118
118
  return app.commands.execute('docmanager:open', {
119
119
  path: model.path,
120
- factory: FACTORY
120
+ factory: FACTORY,
121
121
  });
122
- }
122
+ },
123
123
  });
124
124
  // Add the command to the launcher
125
125
  if (launcher) {
126
126
  launcher.add({
127
127
  command: CommandIDs.createNew,
128
128
  category: 'Other',
129
- rank: 1
129
+ rank: 1,
130
130
  });
131
131
  }
132
132
  // Add the command to the palette
@@ -134,39 +134,48 @@ const activate = async (app, tracker, themeManager, browserFactory, externalComm
134
134
  palette.addItem({
135
135
  command: CommandIDs.createNew,
136
136
  args: { isPalette: true },
137
- category: PALETTE_CATEGORY
137
+ category: PALETTE_CATEGORY,
138
138
  });
139
139
  palette.addItem({
140
140
  command: CommandIDs.openLayerBrowser,
141
- category: 'JupyterGIS'
141
+ category: 'JupyterGIS',
142
142
  });
143
143
  // Layers and Sources
144
144
  palette.addItem({
145
145
  command: CommandIDs.newRasterEntry,
146
- category: 'JupyterGIS'
146
+ category: 'JupyterGIS',
147
147
  });
148
148
  palette.addItem({
149
149
  command: CommandIDs.newVectorTileEntry,
150
- category: 'JupyterGIS'
150
+ category: 'JupyterGIS',
151
151
  });
152
152
  palette.addItem({
153
153
  command: CommandIDs.newGeoJSONEntry,
154
- category: 'JupyterGIS'
154
+ category: 'JupyterGIS',
155
155
  });
156
156
  palette.addItem({
157
157
  command: CommandIDs.newHillshadeEntry,
158
- category: 'JupyterGIS'
158
+ category: 'JupyterGIS',
159
159
  });
160
160
  // Layer and group actions
161
161
  palette.addItem({
162
162
  command: CommandIDs.moveLayerToNewGroup,
163
- category: 'JupyterGIS'
164
- });
165
- palette.addItem({
166
- command: CommandIDs.buffer,
167
- category: 'JupyterGIS'
163
+ category: 'JupyterGIS',
168
164
  });
165
+ for (const processingElement of ProcessingMerge) {
166
+ palette.addItem({
167
+ command: processingElement.name,
168
+ category: 'JupyterGIS',
169
+ });
170
+ }
169
171
  }
172
+ // Inject “New JupyterGIS file” into the File Browser context menu
173
+ app.contextMenu.addItem({
174
+ command: CommandIDs.createNew,
175
+ selector: '.jp-DirListing',
176
+ rank: 55,
177
+ args: { label: 'New JupyterGIS Project' },
178
+ });
170
179
  };
171
180
  const jGISPlugin = {
172
181
  id: 'jupyterGIS:jGISplugin',
@@ -180,10 +189,10 @@ const jGISPlugin = {
180
189
  IRenderMimeRegistry,
181
190
  IConsoleTracker,
182
191
  IAnnotationToken,
183
- ISettingRegistry
192
+ ISettingRegistry,
184
193
  ],
185
194
  optional: [ILauncher, ICommandPalette, ICollaborativeDrive],
186
195
  autoStart: true,
187
- activate
196
+ activate,
188
197
  };
189
198
  export default jGISPlugin;
package/lib/plugin.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { AnnotationModel } from '@jupytergis/base';
2
- import { IAnnotationToken, IJGISExternalCommandRegistryToken, IJGISFormSchemaRegistryToken, IJGISLayerBrowserRegistryToken, IJupyterGISDocTracker } from '@jupytergis/schema';
2
+ import { IAnnotationToken, IJGISExternalCommandRegistryToken, IJGISFormSchemaRegistryToken, IJGISLayerBrowserRegistryToken, IJupyterGISDocTracker, } from '@jupytergis/schema';
3
3
  import { WidgetTracker } from '@jupyterlab/apputils';
4
+ import { IDocumentManager } from '@jupyterlab/docmanager';
4
5
  import { IMainMenu } from '@jupyterlab/mainmenu';
5
6
  import { ITranslator } from '@jupyterlab/translation';
6
- import { IDocumentManager } from '@jupyterlab/docmanager';
7
7
  import { JupyterGISExternalCommandRegistry } from './externalcommand';
8
8
  import { JupyterGISLayerBrowserRegistry } from './layerBrowserRegistry';
9
9
  import { JupyterGISFormSchemaRegistry } from './schemaregistry';
@@ -16,11 +16,11 @@ export const trackerPlugin = {
16
16
  provides: IJupyterGISDocTracker,
17
17
  activate: (app, translator, mainMenu) => {
18
18
  const tracker = new WidgetTracker({
19
- namespace: NAME_SPACE
19
+ namespace: NAME_SPACE,
20
20
  });
21
21
  console.log('jupytergis:core:tracker is activated!');
22
22
  return tracker;
23
- }
23
+ },
24
24
  };
25
25
  export const formSchemaRegistryPlugin = {
26
26
  id: 'jupytergis:core:form-schema-registry',
@@ -30,7 +30,7 @@ export const formSchemaRegistryPlugin = {
30
30
  activate: (app, docmanager) => {
31
31
  const registry = new JupyterGISFormSchemaRegistry(docmanager);
32
32
  return registry;
33
- }
33
+ },
34
34
  };
35
35
  export const externalCommandRegistryPlugin = {
36
36
  id: 'jupytergis:core:external-command-registry',
@@ -40,7 +40,7 @@ export const externalCommandRegistryPlugin = {
40
40
  activate: (app) => {
41
41
  const registry = new JupyterGISExternalCommandRegistry();
42
42
  return registry;
43
- }
43
+ },
44
44
  };
45
45
  export const layerBrowserRegistryPlugin = {
46
46
  id: 'jupytergis:core:layer-browser-registry',
@@ -51,7 +51,7 @@ export const layerBrowserRegistryPlugin = {
51
51
  console.log('jupytergis:core:layer-browser-registry is activated');
52
52
  const registry = new JupyterGISLayerBrowserRegistry();
53
53
  return registry;
54
- }
54
+ },
55
55
  };
56
56
  export const annotationPlugin = {
57
57
  id: 'jupytergis:core:annotation',
@@ -61,11 +61,11 @@ export const annotationPlugin = {
61
61
  activate: (app, tracker) => {
62
62
  var _a;
63
63
  const annotationModel = new AnnotationModel({
64
- model: (_a = tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.model
64
+ model: (_a = tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.model,
65
65
  });
66
66
  tracker.currentChanged.connect((_, changed) => {
67
67
  annotationModel.model = (changed === null || changed === void 0 ? void 0 : changed.model) || undefined;
68
68
  });
69
69
  return annotationModel;
70
- }
70
+ },
71
71
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupytergis/jupytergis-core",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "JupyterGIS core extension",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -54,8 +54,8 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@jupyter/collaborative-drive": "^3.0.0",
57
- "@jupytergis/base": "^0.5.0",
58
- "@jupytergis/schema": "^0.5.0",
57
+ "@jupytergis/base": "^0.6.1",
58
+ "@jupytergis/schema": "^0.6.1",
59
59
  "@jupyterlab/application": "^4.3.0",
60
60
  "@jupyterlab/apputils": "^4.3.0",
61
61
  "@jupyterlab/docregistry": "^4.3.0",
package/style/base.css CHANGED
@@ -3,3 +3,7 @@
3
3
 
4
4
  https://jupyterlab.readthedocs.io/en/stable/developer/css.html
5
5
  */
6
+
7
+ jp-toolbar.jpcad-toolbar-widget .jp-MenuBar-anonymousIcon {
8
+ position: unset !important;
9
+ }