@jupytergis/jupytergis-core 0.1.5 → 0.1.7
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,5 +1,5 @@
|
|
|
1
1
|
import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console';
|
|
2
|
-
import { ICollaborativeDrive } from '@jupyter/
|
|
2
|
+
import { ICollaborativeDrive } from '@jupyter/collaborative-drive';
|
|
3
3
|
import { JupyterGISModel, IJupyterGISTracker, IJGISExternalCommandRegistry } from '@jupytergis/schema';
|
|
4
4
|
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
|
|
5
5
|
import { IEditorMimeTypeService } from '@jupyterlab/codeeditor';
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
import { ICollaborativeDrive } from '@jupyter/
|
|
1
|
+
import { ICollaborativeDrive } from '@jupyter/collaborative-drive';
|
|
2
2
|
import { IJGISExternalCommandRegistryToken, IJupyterGISDocTracker, JupyterGISDoc } from '@jupytergis/schema';
|
|
3
3
|
import { ICommandPalette, IThemeManager } from '@jupyterlab/apputils';
|
|
4
4
|
import { IEditorServices } from '@jupyterlab/codeeditor';
|
|
5
5
|
import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console';
|
|
6
|
+
import { PageConfig } from '@jupyterlab/coreutils';
|
|
6
7
|
import { IFileBrowserFactory } from '@jupyterlab/filebrowser';
|
|
7
8
|
import { ILauncher } from '@jupyterlab/launcher';
|
|
8
9
|
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
|
|
9
|
-
import { CommandIDs, logoIcon } from '@jupytergis/base';
|
|
10
|
+
import { CommandIDs, logoIcon, logoMiniIcon } from '@jupytergis/base';
|
|
10
11
|
import { JupyterGISWidgetFactory } from '../factory';
|
|
11
12
|
import { JupyterGISModelFactory } from './modelfactory';
|
|
13
|
+
import { MimeDocumentFactory } from '@jupyterlab/docregistry';
|
|
12
14
|
const FACTORY = 'JupyterGIS .jgis Viewer';
|
|
15
|
+
const CONTENT_TYPE = 'jgis';
|
|
13
16
|
const PALETTE_CATEGORY = 'JupyterGIS';
|
|
17
|
+
const MODEL_NAME = 'jupytergis-jgismodel';
|
|
14
18
|
const activate = (app, tracker, themeManager, browserFactory, externalCommandRegistry, contentFactory, editorServices, rendermime, consoleTracker, launcher, palette, drive) => {
|
|
19
|
+
if (PageConfig.getOption('jgis_expose_maps')) {
|
|
20
|
+
window.jupytergisMaps = {};
|
|
21
|
+
}
|
|
15
22
|
const widgetFactory = new JupyterGISWidgetFactory({
|
|
16
23
|
name: FACTORY,
|
|
17
|
-
modelName:
|
|
18
|
-
fileTypes: [
|
|
19
|
-
defaultFor: [
|
|
24
|
+
modelName: MODEL_NAME,
|
|
25
|
+
fileTypes: [CONTENT_TYPE],
|
|
26
|
+
defaultFor: [CONTENT_TYPE],
|
|
20
27
|
tracker,
|
|
21
28
|
commands: app.commands,
|
|
22
29
|
externalCommandRegistry,
|
|
@@ -29,35 +36,57 @@ const activate = (app, tracker, themeManager, browserFactory, externalCommandReg
|
|
|
29
36
|
});
|
|
30
37
|
// Registering the widget factory
|
|
31
38
|
app.docRegistry.addWidgetFactory(widgetFactory);
|
|
39
|
+
const mimeDocumentFactory = new MimeDocumentFactory({
|
|
40
|
+
dataType: 'json',
|
|
41
|
+
rendermime,
|
|
42
|
+
modelName: MODEL_NAME,
|
|
43
|
+
name: 'JSON Editor',
|
|
44
|
+
primaryFileType: app.docRegistry.getFileType('json'),
|
|
45
|
+
fileTypes: [CONTENT_TYPE]
|
|
46
|
+
});
|
|
47
|
+
app.docRegistry.addWidgetFactory(mimeDocumentFactory);
|
|
32
48
|
// Creating and registering the model factory for our custom DocumentModel
|
|
33
49
|
const modelFactory = new JupyterGISModelFactory();
|
|
34
50
|
app.docRegistry.addModelFactory(modelFactory);
|
|
35
51
|
// register the filetype
|
|
36
52
|
app.docRegistry.addFileType({
|
|
37
|
-
name:
|
|
53
|
+
name: CONTENT_TYPE,
|
|
38
54
|
displayName: 'JGIS',
|
|
39
55
|
mimeTypes: ['text/json'],
|
|
40
56
|
extensions: ['.jgis', '.JGIS'],
|
|
41
57
|
fileFormat: 'text',
|
|
42
|
-
contentType:
|
|
58
|
+
contentType: CONTENT_TYPE,
|
|
59
|
+
icon: logoMiniIcon
|
|
43
60
|
});
|
|
44
61
|
const jGISSharedModelFactory = () => {
|
|
45
62
|
return new JupyterGISDoc();
|
|
46
63
|
};
|
|
47
64
|
if (drive) {
|
|
48
|
-
drive.sharedModelFactory.registerDocumentFactory(
|
|
65
|
+
drive.sharedModelFactory.registerDocumentFactory(CONTENT_TYPE, jGISSharedModelFactory);
|
|
49
66
|
}
|
|
50
67
|
widgetFactory.widgetCreated.connect((sender, widget) => {
|
|
68
|
+
widget.title.icon = logoIcon;
|
|
51
69
|
widget.context.pathChanged.connect(() => {
|
|
52
70
|
tracker.save(widget);
|
|
53
71
|
});
|
|
54
72
|
themeManager.themeChanged.connect((_, changes) => widget.context.model.themeChanged.emit(changes));
|
|
55
|
-
tracker.add(widget);
|
|
56
73
|
app.shell.activateById('jupytergis::leftControlPanel');
|
|
57
74
|
app.shell.activateById('jupytergis::rightControlPanel');
|
|
75
|
+
tracker
|
|
76
|
+
.add(widget)
|
|
77
|
+
.then(() => {
|
|
78
|
+
Object.values(CommandIDs).forEach(id => {
|
|
79
|
+
if (app.commands.hasCommand(id)) {
|
|
80
|
+
app.commands.notifyCommandChanged(id);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
})
|
|
84
|
+
.catch(e => {
|
|
85
|
+
console.error('Cannot update JupyterGIS commands', e);
|
|
86
|
+
});
|
|
58
87
|
});
|
|
59
88
|
app.commands.addCommand(CommandIDs.createNew, {
|
|
60
|
-
label: args => '
|
|
89
|
+
label: args => 'GIS File',
|
|
61
90
|
caption: 'Create a new JGIS Editor',
|
|
62
91
|
icon: args => logoIcon,
|
|
63
92
|
execute: async (args) => {
|
|
@@ -72,7 +101,7 @@ const activate = (app, tracker, themeManager, browserFactory, externalCommandReg
|
|
|
72
101
|
type: 'file',
|
|
73
102
|
ext: '.jGIS'
|
|
74
103
|
});
|
|
75
|
-
model = await app.serviceManager.contents.save(model.path, Object.assign(Object.assign({}, model), { format: 'text', size: undefined, content: '{\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": []
|
|
104
|
+
model = await app.serviceManager.contents.save(model.path, Object.assign(Object.assign({}, model), { format: 'text', size: undefined, content: '{\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}' }));
|
|
76
105
|
// Open the newly created file with the 'Editor'
|
|
77
106
|
return app.commands.execute('docmanager:open', {
|
|
78
107
|
path: model.path,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupytergis/jupytergis-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "JupyterGIS core extension",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -52,23 +52,23 @@
|
|
|
52
52
|
"watch:labextension": "jupyter labextension watch ."
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@jupyter/
|
|
56
|
-
"@jupytergis/base": "^0.1.
|
|
57
|
-
"@jupytergis/schema": "^0.1.
|
|
58
|
-
"@jupyterlab/application": "^4.
|
|
59
|
-
"@jupyterlab/apputils": "^4.
|
|
60
|
-
"@jupyterlab/docregistry": "^4.
|
|
61
|
-
"@jupyterlab/filebrowser": "^4.
|
|
62
|
-
"@jupyterlab/launcher": "^4.
|
|
63
|
-
"@jupyterlab/mainmenu": "^4.
|
|
64
|
-
"@jupyterlab/services": "^7.
|
|
65
|
-
"@jupyterlab/translation": "^4.
|
|
66
|
-
"@jupyterlab/ui-components": "^4.
|
|
55
|
+
"@jupyter/collaborative-drive": "^3.0.0",
|
|
56
|
+
"@jupytergis/base": "^0.1.7",
|
|
57
|
+
"@jupytergis/schema": "^0.1.7",
|
|
58
|
+
"@jupyterlab/application": "^4.3.0",
|
|
59
|
+
"@jupyterlab/apputils": "^4.3.0",
|
|
60
|
+
"@jupyterlab/docregistry": "^4.3.0",
|
|
61
|
+
"@jupyterlab/filebrowser": "^4.3.0",
|
|
62
|
+
"@jupyterlab/launcher": "^4.3.0",
|
|
63
|
+
"@jupyterlab/mainmenu": "^4.3.0",
|
|
64
|
+
"@jupyterlab/services": "^7.3.0",
|
|
65
|
+
"@jupyterlab/translation": "^4.3.0",
|
|
66
|
+
"@jupyterlab/ui-components": "^4.3.0",
|
|
67
67
|
"@lumino/commands": "^2.0.0",
|
|
68
68
|
"util": "^0.12.5"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@jupyterlab/builder": "^4.
|
|
71
|
+
"@jupyterlab/builder": "^4.3.0",
|
|
72
72
|
"@types/json-schema": "^7.0.11",
|
|
73
73
|
"@types/react": "^18.0.26",
|
|
74
74
|
"@types/react-addons-linked-state-mixin": "^0.14.22",
|