@jupytergis/base 0.12.0 → 0.12.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/constants.d.ts +3 -2
- package/lib/formbuilder/objectform/StoryEditorForm.js +18 -1
- package/lib/mainview/mainView.js +4 -4
- package/lib/panelview/leftpanel.js +22 -13
- package/lib/panelview/rightpanel.js +1 -0
- package/lib/tools.d.ts +2 -1
- package/lib/tools.js +12 -4
- package/package.json +2 -3
- package/style/base.css +16 -8
- package/style/shared/tabs.css +0 -6
- package/style/storyPanel.css +7 -5
package/lib/constants.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProcessingCommandIDs } from '@jupytergis/schema';
|
|
2
2
|
import { LabIcon } from '@jupyterlab/ui-components';
|
|
3
|
+
import * as BaseCommandIDs from './commands/BaseCommandIDs';
|
|
3
4
|
/**
|
|
4
5
|
* The command IDs.
|
|
5
6
|
*/
|
|
6
|
-
export declare const CommandIDs:
|
|
7
|
+
export declare const CommandIDs: typeof BaseCommandIDs & typeof ProcessingCommandIDs;
|
|
7
8
|
interface IRegisteredIcon {
|
|
8
9
|
icon?: LabIcon;
|
|
9
10
|
iconClass?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseForm } from './baseform';
|
|
2
|
+
import { getCssVarAsColor } from "../../tools";
|
|
2
3
|
/**
|
|
3
4
|
* The form to modify story map properties.
|
|
4
5
|
*/
|
|
@@ -6,11 +7,27 @@ export class StoryEditorPropertiesForm extends BaseForm {
|
|
|
6
7
|
processSchema(data, schema, uiSchema) {
|
|
7
8
|
super.processSchema(data, schema, uiSchema);
|
|
8
9
|
this.removeFormEntry('storySegments', data, schema, uiSchema);
|
|
9
|
-
uiSchema.
|
|
10
|
+
uiSchema.presentationBgColor = {
|
|
10
11
|
'ui:widget': 'color',
|
|
11
12
|
};
|
|
12
13
|
uiSchema.presentaionTextColor = {
|
|
13
14
|
'ui:widget': 'color',
|
|
14
15
|
};
|
|
16
|
+
// Set default values from theme CSS variables when not already in data
|
|
17
|
+
const schemaProps = schema.properties;
|
|
18
|
+
if ((schemaProps === null || schemaProps === void 0 ? void 0 : schemaProps.presentationBgColor) &&
|
|
19
|
+
(data === null || data === void 0 ? void 0 : data.presentationBgColor) === undefined) {
|
|
20
|
+
const defaultBg = getCssVarAsColor('--jp-layout-color0');
|
|
21
|
+
if (defaultBg) {
|
|
22
|
+
schemaProps.presentationBgColor.default = defaultBg;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if ((schemaProps === null || schemaProps === void 0 ? void 0 : schemaProps.presentaionTextColor) &&
|
|
26
|
+
(data === null || data === void 0 ? void 0 : data.presentaionTextColor) === undefined) {
|
|
27
|
+
const defaultText = getCssVarAsColor('--jp-ui-font-color0');
|
|
28
|
+
if (defaultText) {
|
|
29
|
+
schemaProps.presentaionTextColor.default = defaultText;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
15
32
|
}
|
|
16
33
|
}
|
package/lib/mainview/mainView.js
CHANGED
|
@@ -528,7 +528,7 @@ export class MainView extends React.Component {
|
|
|
528
528
|
return;
|
|
529
529
|
}
|
|
530
530
|
const story = this._model.getSelectedStory().story;
|
|
531
|
-
const bgColor = story === null || story === void 0 ? void 0 : story.
|
|
531
|
+
const bgColor = story === null || story === void 0 ? void 0 : story.presentationBgColor;
|
|
532
532
|
const textColor = story === null || story === void 0 ? void 0 : story.presentaionTextColor;
|
|
533
533
|
// Set background color
|
|
534
534
|
if (bgColor) {
|
|
@@ -705,11 +705,11 @@ export class MainView extends React.Component {
|
|
|
705
705
|
const fullScreen = new FullScreen({
|
|
706
706
|
target: this.controlsToolbarRef.current || undefined,
|
|
707
707
|
});
|
|
708
|
-
this._zoomControl = new Zoom({
|
|
709
|
-
target: this.controlsToolbarRef.current || undefined,
|
|
710
|
-
});
|
|
711
708
|
const controls = [scaleLine, fullScreen];
|
|
712
709
|
if (this._model.jgisSettings.zoomButtonsEnabled) {
|
|
710
|
+
this._zoomControl = new Zoom({
|
|
711
|
+
target: this.controlsToolbarRef.current || undefined,
|
|
712
|
+
});
|
|
713
713
|
controls.push(this._zoomControl);
|
|
714
714
|
}
|
|
715
715
|
if (this.divRef.current) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { CommandIDs } from '../constants';
|
|
2
3
|
import { LayersBodyComponent } from './components/layers';
|
|
3
4
|
import FilterComponent from './filter-panel/Filter';
|
|
4
5
|
import { PanelTabs, TabsContent, TabsList, TabsTrigger, } from '../shared/components/Tabs';
|
|
@@ -9,6 +10,19 @@ export const LeftPanel = (props) => {
|
|
|
9
10
|
const [options, setOptions] = React.useState(props.model.getOptions());
|
|
10
11
|
const storyMapPresentationMode = (_a = options.storyMapPresentationMode) !== null && _a !== void 0 ? _a : false;
|
|
11
12
|
const [layerTree, setLayerTree] = React.useState(props.model.getLayerTree());
|
|
13
|
+
const tabInfo = [
|
|
14
|
+
!settings.layersDisabled ? { name: 'layers', title: 'Layers' } : false,
|
|
15
|
+
!settings.stacBrowserDisabled && !storyMapPresentationMode
|
|
16
|
+
? { name: 'stac', title: 'Stac Browser' }
|
|
17
|
+
: false,
|
|
18
|
+
!settings.filtersDisabled && !storyMapPresentationMode
|
|
19
|
+
? { name: 'filters', title: 'Filters' }
|
|
20
|
+
: false,
|
|
21
|
+
!settings.storyMapsDisabled
|
|
22
|
+
? { name: 'segments', title: 'Segments' }
|
|
23
|
+
: false,
|
|
24
|
+
].filter(Boolean);
|
|
25
|
+
const [curTab, setCurTab] = React.useState(tabInfo.length > 0 ? tabInfo[0].name : undefined);
|
|
12
26
|
React.useEffect(() => {
|
|
13
27
|
const onSettingsChanged = () => {
|
|
14
28
|
setSettings(Object.assign({}, props.model.jgisSettings));
|
|
@@ -18,17 +32,25 @@ export const LeftPanel = (props) => {
|
|
|
18
32
|
};
|
|
19
33
|
const updateLayerTree = () => {
|
|
20
34
|
setLayerTree(props.model.getLayerTree() || []);
|
|
35
|
+
// Need to let command know when segments get populated
|
|
36
|
+
props.commands.notifyCommandChanged(CommandIDs.toggleStoryPresentationMode);
|
|
37
|
+
};
|
|
38
|
+
const onSegmentAdded = (_sender, payload) => {
|
|
39
|
+
props.model.syncSelected({ [payload.storySegmentId]: { type: 'layer' } }, props.model.getClientId().toString());
|
|
40
|
+
setCurTab('segments');
|
|
21
41
|
};
|
|
22
42
|
props.model.settingsChanged.connect(onSettingsChanged);
|
|
23
43
|
props.model.sharedOptionsChanged.connect(onOptionsChanged);
|
|
24
44
|
props.model.sharedModel.layersChanged.connect(updateLayerTree);
|
|
25
45
|
props.model.sharedModel.layerTreeChanged.connect(updateLayerTree);
|
|
46
|
+
props.model.segmentAdded.connect(onSegmentAdded);
|
|
26
47
|
updateLayerTree();
|
|
27
48
|
return () => {
|
|
28
49
|
props.model.settingsChanged.disconnect(onSettingsChanged);
|
|
29
50
|
props.model.sharedOptionsChanged.disconnect(onOptionsChanged);
|
|
30
51
|
props.model.sharedModel.layersChanged.disconnect(updateLayerTree);
|
|
31
52
|
props.model.sharedModel.layerTreeChanged.disconnect(updateLayerTree);
|
|
53
|
+
props.model.segmentAdded.disconnect(onSegmentAdded);
|
|
32
54
|
};
|
|
33
55
|
}, [props.model]);
|
|
34
56
|
// Since story segments are technically layers they are stored in the layer tree, so we separate them
|
|
@@ -93,19 +115,6 @@ export const LeftPanel = (props) => {
|
|
|
93
115
|
settings.filtersDisabled &&
|
|
94
116
|
settings.storyMapsDisabled;
|
|
95
117
|
const leftPanelVisible = !settings.leftPanelDisabled && !allLeftTabsDisabled;
|
|
96
|
-
const tabInfo = [
|
|
97
|
-
!settings.layersDisabled ? { name: 'layers', title: 'Layers' } : false,
|
|
98
|
-
!settings.stacBrowserDisabled && !storyMapPresentationMode
|
|
99
|
-
? { name: 'stac', title: 'Stac Browser' }
|
|
100
|
-
: false,
|
|
101
|
-
!settings.filtersDisabled && !storyMapPresentationMode
|
|
102
|
-
? { name: 'filters', title: 'Filters' }
|
|
103
|
-
: false,
|
|
104
|
-
!settings.storyMapsDisabled
|
|
105
|
-
? { name: 'segments', title: 'Segments' }
|
|
106
|
-
: false,
|
|
107
|
-
].filter(Boolean);
|
|
108
|
-
const [curTab, setCurTab] = React.useState(tabInfo.length > 0 ? tabInfo[0].name : undefined);
|
|
109
118
|
return (React.createElement("div", { className: "jgis-left-panel-container", style: { display: leftPanelVisible ? 'block' : 'none' } },
|
|
110
119
|
React.createElement(PanelTabs, { curTab: curTab, className: "jgis-panel-tabs" },
|
|
111
120
|
React.createElement(TabsList, null, tabInfo.map(tab => (React.createElement(TabsTrigger, { className: "jGIS-layer-browser-category", key: tab.name, value: tab.name, onClick: () => {
|
|
@@ -49,6 +49,7 @@ export const RightPanel = props => {
|
|
|
49
49
|
const onOptionsChanged = () => {
|
|
50
50
|
const { storyMapPresentationMode } = props.model.getOptions();
|
|
51
51
|
setStoryMapPresentationMode(storyMapPresentationMode !== null && storyMapPresentationMode !== void 0 ? storyMapPresentationMode : false);
|
|
52
|
+
storyMapPresentationMode && setCurTab('storyPanel');
|
|
52
53
|
};
|
|
53
54
|
let currentlyIdentifiedFeatures = undefined;
|
|
54
55
|
const onAwerenessChanged = (_, clients) => {
|
package/lib/tools.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ export declare const debounce: (func: CallableFunction, timeout?: number) => Cal
|
|
|
5
5
|
export declare function throttle<T extends (...args: any[]) => void>(callback: T, delay?: number): T;
|
|
6
6
|
export declare function getElementFromProperty(filePath?: string | null, prop?: string | null): HTMLElement | undefined | null;
|
|
7
7
|
export declare function nearest(n: number, tol: number): number;
|
|
8
|
-
|
|
8
|
+
/** Read a CSS variable from the document root and return the value. */
|
|
9
|
+
export declare function getCssVarAsColor(cssVar: string): string;
|
|
9
10
|
/**
|
|
10
11
|
* Call the API extension
|
|
11
12
|
*
|
package/lib/tools.js
CHANGED
|
@@ -2,7 +2,6 @@ import { showErrorMessage } from '@jupyterlab/apputils';
|
|
|
2
2
|
import { PathExt, URLExt } from '@jupyterlab/coreutils';
|
|
3
3
|
import { ServerConnection } from '@jupyterlab/services';
|
|
4
4
|
import { VectorTile } from '@mapbox/vector-tile';
|
|
5
|
-
import * as d3Color from 'd3-color';
|
|
6
5
|
import { compressors } from 'hyparquet-compressors';
|
|
7
6
|
import Protobuf from 'pbf';
|
|
8
7
|
import shp from 'shpjs';
|
|
@@ -53,9 +52,18 @@ export function nearest(n, tol) {
|
|
|
53
52
|
return n;
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
/** Read a CSS variable from the document root and return the value. */
|
|
56
|
+
export function getCssVarAsColor(cssVar) {
|
|
57
|
+
if (typeof document === 'undefined') {
|
|
58
|
+
return '';
|
|
59
|
+
}
|
|
60
|
+
const value = getComputedStyle(document.documentElement)
|
|
61
|
+
.getPropertyValue(cssVar)
|
|
62
|
+
.trim();
|
|
63
|
+
if (!value) {
|
|
64
|
+
return '';
|
|
65
|
+
}
|
|
66
|
+
return value;
|
|
59
67
|
}
|
|
60
68
|
/**
|
|
61
69
|
* Call the API extension
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupytergis/base",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "A JupyterLab extension for 3D modelling.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@jupyter/collaboration": "^4",
|
|
45
45
|
"@jupyter/react-components": "^0.16.6",
|
|
46
46
|
"@jupyter/ydoc": "^2.0.0 || ^3.0.0",
|
|
47
|
-
"@jupytergis/schema": "^0.12.
|
|
47
|
+
"@jupytergis/schema": "^0.12.1",
|
|
48
48
|
"@jupyterlab/application": "^4.3.0",
|
|
49
49
|
"@jupyterlab/apputils": "^4.3.0",
|
|
50
50
|
"@jupyterlab/completer": "^4.3.0",
|
|
@@ -80,7 +80,6 @@
|
|
|
80
80
|
"clsx": "^2.1.1",
|
|
81
81
|
"cmdk": "^1.1.1",
|
|
82
82
|
"colormap": "^2.3.2",
|
|
83
|
-
"d3-color": "^3.1.0",
|
|
84
83
|
"date-fns": "^4.1.0",
|
|
85
84
|
"gdal3.js": "^2.8.1",
|
|
86
85
|
"geojson-vt": "^4.0.2",
|
package/style/base.css
CHANGED
|
@@ -95,20 +95,28 @@ button.jp-mod-styled.jp-mod-reject {
|
|
|
95
95
|
border-width: 0;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
.
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
/* Height constrained to 0.5rem less than .jGIS-Mainview-Container */
|
|
99
|
+
.jgis-right-panel-container,
|
|
100
|
+
.jgis-left-panel-container {
|
|
101
101
|
position: absolute;
|
|
102
|
-
margin:
|
|
102
|
+
margin: 0.25rem;
|
|
103
103
|
z-index: 40;
|
|
104
|
+
max-height: calc(100% - 0.5rem);
|
|
105
|
+
overflow-y: auto;
|
|
106
|
+
border-radius: 8px;
|
|
107
|
+
box-shadow:
|
|
108
|
+
0 4px 8px 0 rgba(0, 0, 0, 0.2),
|
|
109
|
+
0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.jgis-right-panel-container {
|
|
113
|
+
width: 330px;
|
|
114
|
+
right: 0;
|
|
104
115
|
}
|
|
105
116
|
|
|
106
117
|
.jgis-left-panel-container {
|
|
107
|
-
position: absolute;
|
|
108
118
|
width: 250px;
|
|
109
|
-
left:
|
|
110
|
-
margin: 5px;
|
|
111
|
-
z-index: 40;
|
|
119
|
+
left: 0;
|
|
112
120
|
}
|
|
113
121
|
|
|
114
122
|
.jgis-icon-adjust {
|
package/style/shared/tabs.css
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
justify-content: center;
|
|
5
5
|
align-items: center;
|
|
6
6
|
background-color: var(--jp-layout-color0);
|
|
7
|
-
box-shadow:
|
|
8
|
-
0 4px 8px 0 rgba(0, 0, 0, 0.2),
|
|
9
|
-
0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
|
10
|
-
border-radius: 5px;
|
|
11
7
|
}
|
|
12
8
|
.jgis-tabs-list {
|
|
13
9
|
display: inline-flex;
|
|
@@ -19,8 +15,6 @@
|
|
|
19
15
|
gap: 1rem;
|
|
20
16
|
width: 100%;
|
|
21
17
|
font-size: 9px;
|
|
22
|
-
border-top-left-radius: 5px;
|
|
23
|
-
border-top-right-radius: 5px;
|
|
24
18
|
overflow-x: scroll;
|
|
25
19
|
}
|
|
26
20
|
|
package/style/storyPanel.css
CHANGED
|
@@ -134,6 +134,8 @@
|
|
|
134
134
|
height: 100%;
|
|
135
135
|
margin: unset;
|
|
136
136
|
top: unset;
|
|
137
|
+
box-shadow: unset;
|
|
138
|
+
max-height: unset;
|
|
137
139
|
}
|
|
138
140
|
|
|
139
141
|
.jgis-specta-story-panel-container {
|
|
@@ -145,16 +147,16 @@
|
|
|
145
147
|
overflow: auto;
|
|
146
148
|
background: linear-gradient(
|
|
147
149
|
to left,
|
|
148
|
-
var(--jgis-specta-bg-color,
|
|
150
|
+
var(--jgis-specta-bg-color, --jp-layout-color0) 49%,
|
|
149
151
|
color-mix(
|
|
150
152
|
in srgb,
|
|
151
|
-
var(--jgis-specta-bg-color,
|
|
153
|
+
var(--jgis-specta-bg-color, --jp-layout-color0) 60%,
|
|
152
154
|
transparent
|
|
153
155
|
)
|
|
154
156
|
65%,
|
|
155
157
|
color-mix(
|
|
156
158
|
in srgb,
|
|
157
|
-
var(--jgis-specta-bg-color,
|
|
159
|
+
var(--jgis-specta-bg-color, --jp-layout-color0) 50%,
|
|
158
160
|
transparent
|
|
159
161
|
)
|
|
160
162
|
70%,
|
|
@@ -163,7 +165,7 @@
|
|
|
163
165
|
}
|
|
164
166
|
|
|
165
167
|
.jgis-story-viewer-panel-specta-mod {
|
|
166
|
-
width:
|
|
168
|
+
width: 45%;
|
|
167
169
|
font-size: var(--jp-ui-font-size3);
|
|
168
170
|
padding-right: 1.7rem;
|
|
169
171
|
color: var(--jgis-specta-text-color, var(--jp-ui-inverse-font-color1));
|
|
@@ -175,7 +177,7 @@
|
|
|
175
177
|
.jp-FormGroup-content
|
|
176
178
|
fieldset
|
|
177
179
|
.jp-inputFieldWrapper
|
|
178
|
-
> input#
|
|
180
|
+
> input#root_presentationBgColor,
|
|
179
181
|
.jGIS-property-panel
|
|
180
182
|
.jp-FormGroup-content
|
|
181
183
|
fieldset
|