@jupytergis/jupytergis-lab 0.4.5 → 0.6.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/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { CommandIDs, ControlPanelModel, GlobalStateDbManager, LeftPanelWidget, RightPanelWidget, addCommands, createDefaultLayerRegistry, logoMiniIcon } from '@jupytergis/base';
2
- import { IAnnotationToken, IJGISFormSchemaRegistryToken, IJGISLayerBrowserRegistryToken, IJupyterGISDocTracker } from '@jupytergis/schema';
3
- import { ILayoutRestorer } from '@jupyterlab/application';
1
+ import { CommandIDs, ControlPanelModel, GlobalStateDbManager, LeftPanelWidget, RightPanelWidget, addCommands, createDefaultLayerRegistry, logoMiniIcon, rasterSubMenu, vectorSubMenu, } from '@jupytergis/base';
2
+ import { IAnnotationToken, IJGISFormSchemaRegistryToken, IJGISLayerBrowserRegistryToken, IJupyterGISDocTracker, ProcessingMerge, } from '@jupytergis/schema';
3
+ import { ILayoutRestorer, } from '@jupyterlab/application';
4
4
  import { ICompletionProviderManager } from '@jupyterlab/completer';
5
5
  import { IMainMenu } from '@jupyterlab/mainmenu';
6
6
  import { IStateDB } from '@jupyterlab/statedb';
@@ -15,7 +15,7 @@ const plugin = {
15
15
  IJupyterGISDocTracker,
16
16
  IJGISFormSchemaRegistryToken,
17
17
  IJGISLayerBrowserRegistryToken,
18
- IStateDB
18
+ IStateDB,
19
19
  ],
20
20
  optional: [IMainMenu, ITranslator, ICompletionProviderManager],
21
21
  activate: (app, tracker, formSchemaRegistry, layerBrowserRegistry, state, mainMenu, translator, completionProviderManager) => {
@@ -29,93 +29,56 @@ const plugin = {
29
29
  const stateDbManager = GlobalStateDbManager.getInstance();
30
30
  stateDbManager.initialize(state);
31
31
  addCommands(app, tracker, translator, formSchemaRegistry, layerBrowserRegistry, state, completionProviderManager);
32
- // SOURCES context menu
33
- const newSourceSubMenu = new Menu({ commands: app.commands });
34
- newSourceSubMenu.title.label = translator
35
- .load('jupyterlab')
36
- .__('Add Source');
37
- newSourceSubMenu.id = 'jp-gis-contextmenu-addSource';
38
- app.contextMenu.addItem({
39
- type: 'submenu',
40
- selector: '.jp-gis-sourcePanel',
41
- rank: 3,
42
- submenu: newSourceSubMenu
43
- });
44
- newSourceSubMenu.addItem({
45
- command: CommandIDs.newRasterSource,
46
- args: { from: 'contextMenu' }
47
- });
48
- newSourceSubMenu.addItem({
49
- command: CommandIDs.newVectorSource,
50
- args: { from: 'contextMenu' }
51
- });
52
- newSourceSubMenu.addItem({
53
- command: CommandIDs.newGeoJSONSource,
54
- args: { from: 'contextMenu' }
55
- });
56
- newSourceSubMenu.addItem({
57
- command: CommandIDs.newRasterDemSource,
58
- args: { from: 'contextMenu' }
59
- });
60
- newSourceSubMenu.addItem({
61
- command: CommandIDs.newImageSource,
62
- args: { from: 'contextMenu' }
63
- });
64
- app.contextMenu.addItem({
65
- type: 'separator',
66
- selector: '.jp-gis-sourcePanel',
67
- rank: 2
68
- });
69
32
  app.contextMenu.addItem({
70
33
  selector: '.jp-gis-source.jp-gis-sourceUnused',
71
34
  rank: 1,
72
- command: CommandIDs.removeSource
35
+ command: CommandIDs.removeSource,
73
36
  });
74
37
  app.contextMenu.addItem({
75
38
  selector: '.jp-gis-source',
76
39
  rank: 1,
77
- command: CommandIDs.renameSource
40
+ command: CommandIDs.renameSource,
78
41
  });
79
42
  // LAYERS and LAYER GROUPS context menu
80
43
  app.contextMenu.addItem({
81
44
  command: CommandIDs.symbology,
82
45
  selector: '.jp-gis-layerItem',
83
- rank: 1
46
+ rank: 1,
84
47
  });
85
48
  // Separator
86
49
  app.contextMenu.addItem({
87
50
  type: 'separator',
88
51
  selector: '.jp-gis-layerPanel',
89
- rank: 1
52
+ rank: 1,
90
53
  });
91
54
  app.contextMenu.addItem({
92
55
  command: CommandIDs.removeLayer,
93
56
  selector: '.jp-gis-layerItem',
94
- rank: 2
57
+ rank: 2,
95
58
  });
96
59
  app.contextMenu.addItem({
97
60
  command: CommandIDs.renameLayer,
98
61
  selector: '.jp-gis-layerItem',
99
- rank: 2
62
+ rank: 2,
100
63
  });
101
64
  app.contextMenu.addItem({
102
65
  command: CommandIDs.zoomToLayer,
103
66
  selector: '.jp-gis-layerItem',
104
- rank: 2
67
+ rank: 2,
105
68
  });
106
69
  // Create the Download submenu
107
70
  const downloadSubmenu = new Menu({ commands: app.commands });
108
71
  downloadSubmenu.title.label = translator.load('jupyterlab').__('Download');
109
72
  downloadSubmenu.id = 'jp-gis-contextmenu-download';
110
73
  downloadSubmenu.addItem({
111
- command: CommandIDs.downloadGeoJSON
74
+ command: CommandIDs.downloadGeoJSON,
112
75
  });
113
76
  // Add the Download submenu to the context menu
114
77
  app.contextMenu.addItem({
115
78
  type: 'submenu',
116
79
  selector: '.jp-gis-layerItem',
117
80
  rank: 2,
118
- submenu: downloadSubmenu
81
+ submenu: downloadSubmenu,
119
82
  });
120
83
  // Create the Processing submenu
121
84
  const processingSubmenu = new Menu({ commands: app.commands });
@@ -123,17 +86,16 @@ const plugin = {
123
86
  .load('jupyterlab')
124
87
  .__('Processing');
125
88
  processingSubmenu.id = 'jp-gis-contextmenu-processing';
126
- processingSubmenu.addItem({
127
- command: CommandIDs.buffer
128
- });
129
- processingSubmenu.addItem({
130
- command: CommandIDs.dissolve
131
- });
89
+ for (const processingElement of ProcessingMerge) {
90
+ processingSubmenu.addItem({
91
+ command: processingElement.name,
92
+ });
93
+ }
132
94
  app.contextMenu.addItem({
133
95
  type: 'submenu',
134
96
  selector: '.jp-gis-layerItem',
135
97
  rank: 2,
136
- submenu: processingSubmenu
98
+ submenu: processingSubmenu,
137
99
  });
138
100
  const moveLayerSubmenu = new Menu({ commands: app.commands });
139
101
  moveLayerSubmenu.title.label = translator
@@ -144,58 +106,46 @@ const plugin = {
144
106
  type: 'submenu',
145
107
  selector: '.jp-gis-layerItem',
146
108
  rank: 2,
147
- submenu: moveLayerSubmenu
109
+ submenu: moveLayerSubmenu,
148
110
  });
149
111
  app.contextMenu.opened.connect(() => buildGroupsMenu(app.contextMenu, tracker));
150
112
  app.contextMenu.addItem({
151
113
  command: CommandIDs.removeGroup,
152
114
  selector: '.jp-gis-layerGroupHeader',
153
- rank: 2
115
+ rank: 2,
154
116
  });
155
117
  app.contextMenu.addItem({
156
118
  command: CommandIDs.renameGroup,
157
119
  selector: '.jp-gis-layerGroupHeader',
158
- rank: 2
120
+ rank: 2,
159
121
  });
160
122
  // Separator
161
123
  app.contextMenu.addItem({
162
124
  type: 'separator',
163
125
  selector: '.jp-gis-layerPanel',
164
- rank: 2
126
+ rank: 2,
165
127
  });
166
128
  const newLayerSubMenu = new Menu({ commands: app.commands });
167
129
  newLayerSubMenu.title.label = translator.load('jupyterlab').__('Add Layer');
168
130
  newLayerSubMenu.id = 'jp-gis-contextmenu-addLayer';
169
- app.contextMenu.addItem({
170
- type: 'submenu',
171
- selector: '.jp-gis-layerPanel',
172
- rank: 3,
173
- submenu: newLayerSubMenu
174
- });
175
131
  newLayerSubMenu.addItem({
176
- command: CommandIDs.newRasterLayer,
177
- args: { from: 'contextMenu' }
178
- });
179
- newLayerSubMenu.addItem({
180
- command: CommandIDs.newVectorLayer,
181
- args: { from: 'contextMenu' }
182
- });
183
- newLayerSubMenu.addItem({
184
- command: CommandIDs.newHillshadeLayer,
185
- args: { from: 'contextMenu' }
132
+ type: 'submenu',
133
+ submenu: rasterSubMenu(app.commands),
186
134
  });
187
135
  newLayerSubMenu.addItem({
188
- command: CommandIDs.newImageLayer,
189
- args: { from: 'contextMenu' }
136
+ type: 'submenu',
137
+ submenu: vectorSubMenu(app.commands),
190
138
  });
191
- newLayerSubMenu.addItem({
192
- command: CommandIDs.newHeatmapLayer,
193
- args: { from: 'contextMenu' }
139
+ app.contextMenu.addItem({
140
+ type: 'submenu',
141
+ selector: '.jp-gis-layerPanel',
142
+ rank: 3,
143
+ submenu: newLayerSubMenu,
194
144
  });
195
145
  if (mainMenu) {
196
146
  populateMenus(mainMenu, isEnabled);
197
147
  }
198
- }
148
+ },
199
149
  };
200
150
  const controlPanel = {
201
151
  id: 'jupytergis:lab:controlpanel',
@@ -205,7 +155,7 @@ const controlPanel = {
205
155
  IJupyterGISDocTracker,
206
156
  IJGISFormSchemaRegistryToken,
207
157
  IStateDB,
208
- IAnnotationToken
158
+ IAnnotationToken,
209
159
  ],
210
160
  activate: (app, restorer, tracker, formSchemaRegistry, state, annotationModel) => {
211
161
  const controlModel = new ControlPanelModel({ tracker });
@@ -213,7 +163,7 @@ const controlPanel = {
213
163
  model: controlModel,
214
164
  tracker,
215
165
  state,
216
- commands: app.commands
166
+ commands: app.commands,
217
167
  });
218
168
  leftControlPanel.id = 'jupytergis::leftControlPanel';
219
169
  leftControlPanel.title.caption = 'JupyterGIS Control Panel';
@@ -222,18 +172,18 @@ const controlPanel = {
222
172
  model: controlModel,
223
173
  tracker,
224
174
  formSchemaRegistry,
225
- annotationModel
175
+ annotationModel,
226
176
  });
227
177
  rightControlPanel.id = 'jupytergis::rightControlPanel';
228
178
  rightControlPanel.title.caption = 'JupyterGIS Control Panel';
229
179
  rightControlPanel.title.icon = logoMiniIcon;
230
180
  if (restorer) {
231
- restorer.add(leftControlPanel, NAME_SPACE);
232
- restorer.add(rightControlPanel, NAME_SPACE);
181
+ restorer.add(leftControlPanel, `${NAME_SPACE}-left`);
182
+ restorer.add(rightControlPanel, `${NAME_SPACE}-right`);
233
183
  }
234
184
  app.shell.add(leftControlPanel, 'left', { rank: 2000 });
235
185
  app.shell.add(rightControlPanel, 'right', { rank: 2000 });
236
- }
186
+ },
237
187
  };
238
188
  /**
239
189
  * Populates the application menus for the notebook.
@@ -242,11 +192,11 @@ function populateMenus(mainMenu, isEnabled) {
242
192
  // Add undo/redo hooks to the edit menu.
243
193
  mainMenu.editMenu.undoers.redo.add({
244
194
  id: CommandIDs.redo,
245
- isEnabled
195
+ isEnabled,
246
196
  });
247
197
  mainMenu.editMenu.undoers.undo.add({
248
198
  id: CommandIDs.undo,
249
- isEnabled
199
+ isEnabled,
250
200
  });
251
201
  }
252
202
  /**
@@ -291,16 +241,16 @@ function buildGroupsMenu(contextMenu, tracker) {
291
241
  }
292
242
  submenu.addItem({
293
243
  command: CommandIDs.moveLayersToGroup,
294
- args: { label: '' }
244
+ args: { label: '' },
295
245
  });
296
246
  groupNames.forEach(name => {
297
247
  submenu.addItem({
298
248
  command: CommandIDs.moveLayersToGroup,
299
- args: { label: name }
249
+ args: { label: name },
300
250
  });
301
251
  });
302
252
  submenu.addItem({
303
- command: CommandIDs.moveLayerToNewGroup
253
+ command: CommandIDs.moveLayerToNewGroup,
304
254
  });
305
255
  }
306
256
  export default [plugin, controlPanel, notebookRendererPlugin];
@@ -1,13 +1,13 @@
1
1
  import { ICollaborativeDrive } from '@jupyter/collaborative-drive';
2
- import { JupyterGISOutputWidget, JupyterGISPanel, ToolbarWidget } from '@jupytergis/base';
3
- import { IJGISExternalCommandRegistryToken, IJupyterGISDocTracker, JupyterGISModel } from '@jupytergis/schema';
2
+ import { JupyterGISOutputWidget, JupyterGISPanel, ToolbarWidget, } from '@jupytergis/base';
3
+ import { IJGISExternalCommandRegistryToken, IJupyterGISDocTracker, JupyterGISModel, } from '@jupytergis/schema';
4
4
  import { showErrorMessage } from '@jupyterlab/apputils';
5
5
  import { ConsolePanel } from '@jupyterlab/console';
6
6
  import { PathExt } from '@jupyterlab/coreutils';
7
7
  import { NotebookPanel } from '@jupyterlab/notebook';
8
8
  import { MessageLoop } from '@lumino/messaging';
9
9
  import { Panel, Widget } from '@lumino/widgets';
10
- import { IJupyterYWidgetManager, JupyterYDoc, JupyterYModel } from 'yjs-widgets';
10
+ import { IJupyterYWidgetManager, JupyterYDoc, JupyterYModel, } from 'yjs-widgets';
11
11
  export const CLASS_NAME = 'jupytergis-notebook-widget';
12
12
  export class YJupyterGISModel extends JupyterYModel {
13
13
  }
@@ -26,13 +26,13 @@ export class YJupyterGISLuminoWidget extends Panel {
26
26
  toolbar = new ToolbarWidget({
27
27
  commands,
28
28
  model,
29
- externalCommands: (externalCommands === null || externalCommands === void 0 ? void 0 : externalCommands.getCommands()) || []
29
+ externalCommands: (externalCommands === null || externalCommands === void 0 ? void 0 : externalCommands.getCommands()) || [],
30
30
  });
31
31
  }
32
32
  this._jgisWidget = new JupyterGISOutputWidget({
33
33
  model,
34
34
  content,
35
- toolbar
35
+ toolbar,
36
36
  });
37
37
  this.addWidget(this._jgisWidget);
38
38
  tracker === null || tracker === void 0 ? void 0 : tracker.add(this._jgisWidget);
@@ -67,7 +67,7 @@ export const notebookRendererPlugin = {
67
67
  IJGISExternalCommandRegistryToken,
68
68
  IJupyterGISDocTracker,
69
69
  IJupyterYWidgetManager,
70
- ICollaborativeDrive
70
+ ICollaborativeDrive,
71
71
  ],
72
72
  activate: (app, externalCommandRegistry, jgisTracker, yWidgetManager, drive) => {
73
73
  if (!yWidgetManager) {
@@ -99,7 +99,7 @@ export const notebookRendererPlugin = {
99
99
  catch (e) {
100
100
  await app.serviceManager.contents.save(localPath, {
101
101
  content: btoa('{}'),
102
- format: 'base64'
102
+ format: 'base64',
103
103
  });
104
104
  }
105
105
  }
@@ -111,10 +111,10 @@ export const notebookRendererPlugin = {
111
111
  path: localPath,
112
112
  format: fileFormat,
113
113
  contentType,
114
- collaborative: true
114
+ collaborative: true,
115
115
  });
116
116
  this.jupyterGISModel = new JupyterGISModel({
117
- sharedModel: sharedModel
117
+ sharedModel: sharedModel,
118
118
  });
119
119
  this.jupyterGISModel.contentsManager = app.serviceManager.contents;
120
120
  this.jupyterGISModel.filePath = localPath;
@@ -130,7 +130,7 @@ export const notebookRendererPlugin = {
130
130
  commands: app.commands,
131
131
  model: yModel.jupyterGISModel,
132
132
  externalCommands: externalCommandRegistry,
133
- tracker: jgisTracker
133
+ tracker: jgisTracker,
134
134
  });
135
135
  this._jgisWidget = widget.jgisWidget;
136
136
  MessageLoop.sendMessage(widget, Widget.Msg.BeforeAttach);
@@ -143,5 +143,5 @@ export const notebookRendererPlugin = {
143
143
  }
144
144
  }
145
145
  yWidgetManager.registerWidget('@jupytergis:widget', YJupyterGISModelFactory, YJupyterGISWidget);
146
- }
146
+ },
147
147
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupytergis/jupytergis-lab",
3
- "version": "0.4.5",
3
+ "version": "0.6.0",
4
4
  "description": "JupyterGIS Lab 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.4.5",
57
- "@jupytergis/schema": "^0.4.5",
56
+ "@jupytergis/base": "^0.6.0",
57
+ "@jupytergis/schema": "^0.6.0",
58
58
  "@jupyterlab/application": "^4.3.0",
59
59
  "@jupyterlab/apputils": "^4.3.0",
60
60
  "@jupyterlab/completer": "^4.3.0",
package/style/base.css CHANGED
@@ -223,6 +223,7 @@ div.jGIS-toolbar-widget > div.jp-Toolbar-item:last-child {
223
223
  width: 100%;
224
224
  box-sizing: border-box;
225
225
  flex: 1;
226
+ position: relative;
226
227
  }
227
228
 
228
229
  .jGIS-Popup-Wrapper {
@@ -373,6 +374,11 @@ div.jGIS-toolbar-widget > div.jp-Toolbar-item:last-child {
373
374
  z-index: 20;
374
375
  }
375
376
 
377
+ .jGIS-Remote-Pointer-Icon {
378
+ filter: drop-shadow(-1px 0px white) drop-shadow(1px 0px white)
379
+ drop-shadow(0px -1px white) drop-shadow(0px 1px white)
380
+ drop-shadow(0px 0px 1px black);
381
+ }
376
382
  .jGIS-Remote-Pointer-Icon:hover {
377
383
  scale: 1.3;
378
384
  }
@@ -581,10 +587,6 @@ div.jGIS-toolbar-widget > div.jp-Toolbar-item:last-child {
581
587
  display: none;
582
588
  }
583
589
 
584
- .jGIS-property-panel .rjsf .errors {
585
- color: var(--jp-warn-color0);
586
- }
587
-
588
590
  .jGIS-property-panel .rjsf .errors ul,
589
591
  .jGIS-property-panel .rjsf .validationErrors ul,
590
592
  .jGIS-property-panel .rjsf .validationErrors li,
@@ -785,3 +787,46 @@ div.jGIS-toolbar-widget > div.jp-Toolbar-item:last-child {
785
787
  cursor: not-allowed;
786
788
  pointer-events: auto;
787
789
  }
790
+
791
+ .jp-gis-stop-container-wrapper {
792
+ display: flex;
793
+ flex-direction: row;
794
+ gap: 2rem;
795
+ }
796
+
797
+ .jp-gis-stop-container-wrapper > * {
798
+ flex: 1;
799
+ }
800
+
801
+ .jp-gis-stop-container-wrapper > *:only-child {
802
+ flex: 1 1 100%;
803
+ }
804
+
805
+ .jp-gis-symbology-tabs {
806
+ display: flex;
807
+ border-bottom: 1px solid #ccc;
808
+ margin: 12px 0;
809
+ }
810
+
811
+ .jp-gis-tab {
812
+ flex: 1;
813
+ text-align: center;
814
+ padding: 10px 16px;
815
+ border: none;
816
+ border-bottom: 2px solid transparent;
817
+ cursor: pointer;
818
+ font-size: var(--jp-ui-font-size2);
819
+ color: var(--jp-ui-font-color1);
820
+ background-color: var(--jp-layout-color1);
821
+ }
822
+
823
+ .jp-gis-tab:not(.active):hover {
824
+ background-color: var(--jp-layout-color2);
825
+ }
826
+
827
+ .jp-gis-tab.active {
828
+ background-color: var(--jp-layout-color2);
829
+ color: var(--jp-brand-color1);
830
+ border-bottom: 2px solid var(--jp-brand-color1);
831
+ font-weight: 500;
832
+ }