@deck.gl/widgets 9.3.0 → 9.3.2
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/dist/dist.dev.js +36 -53
- package/dist/geocoder-widget.d.ts.map +1 -1
- package/dist/geocoder-widget.js +1 -2
- package/dist/geocoder-widget.js.map +1 -1
- package/dist/index.cjs +41 -54
- package/dist/index.cjs.map +3 -3
- package/dist/lib/geocode/geocoders.js +6 -3
- package/dist/lib/geocode/geocoders.js.map +1 -1
- package/dist/popup-widget.d.ts.map +1 -1
- package/dist/popup-widget.js +1 -1
- package/dist/popup-widget.js.map +1 -1
- package/dist/reset-view-widget.d.ts.map +1 -1
- package/dist/reset-view-widget.js +1 -2
- package/dist/reset-view-widget.js.map +1 -1
- package/dist/scrollbar-widget.d.ts +1 -0
- package/dist/scrollbar-widget.d.ts.map +1 -1
- package/dist/scrollbar-widget.js +10 -3
- package/dist/scrollbar-widget.js.map +1 -1
- package/dist/splitter-widget.d.ts +7 -7
- package/dist/splitter-widget.d.ts.map +1 -1
- package/dist/splitter-widget.js.map +1 -1
- package/dist/stylesheet.css +5 -0
- package/dist/theme-widget.d.ts +2 -2
- package/dist/theme-widget.d.ts.map +1 -1
- package/dist/theme-widget.js +14 -34
- package/dist/theme-widget.js.map +1 -1
- package/dist/zoom-widget.d.ts.map +1 -1
- package/dist/zoom-widget.js +2 -4
- package/dist/zoom-widget.js.map +1 -1
- package/dist.min.js +2 -2
- package/package.json +3 -3
- package/src/geocoder-widget.tsx +1 -2
- package/src/lib/geocode/geocoders.ts +7 -3
- package/src/popup-widget.tsx +1 -3
- package/src/reset-view-widget.tsx +1 -2
- package/src/scrollbar-widget.tsx +11 -3
- package/src/splitter-widget.tsx +14 -11
- package/src/stylesheet.css +5 -0
- package/src/theme-widget.tsx +14 -40
- package/src/zoom-widget.tsx +2 -4
package/dist/dist.dev.js
CHANGED
|
@@ -723,14 +723,12 @@ var __exports__ = (() => {
|
|
|
723
723
|
this.setViewState(viewId, nextViewState);
|
|
724
724
|
}
|
|
725
725
|
handleZoomIn() {
|
|
726
|
-
const
|
|
727
|
-
for (const viewId of viewIds) {
|
|
726
|
+
for (const viewId of this.viewIds) {
|
|
728
727
|
this.handleZoom(viewId, 1);
|
|
729
728
|
}
|
|
730
729
|
}
|
|
731
730
|
handleZoomOut() {
|
|
732
|
-
const
|
|
733
|
-
for (const viewId of viewIds) {
|
|
731
|
+
for (const viewId of this.viewIds) {
|
|
734
732
|
this.handleZoom(viewId, -1);
|
|
735
733
|
}
|
|
736
734
|
}
|
|
@@ -799,8 +797,7 @@ var __exports__ = (() => {
|
|
|
799
797
|
this.resetViewState(initialViewState);
|
|
800
798
|
}
|
|
801
799
|
resetViewState(viewState) {
|
|
802
|
-
const
|
|
803
|
-
for (const viewId of viewIds) {
|
|
800
|
+
for (const viewId of this.viewIds) {
|
|
804
801
|
const nextViewState = {
|
|
805
802
|
...viewState?.[viewId] ?? viewState
|
|
806
803
|
// only works for geospatial?
|
|
@@ -1435,9 +1432,13 @@ var __exports__ = (() => {
|
|
|
1435
1432
|
const second = parseCoordinatePart(parts[1]);
|
|
1436
1433
|
if (first === null || second === null)
|
|
1437
1434
|
return null;
|
|
1438
|
-
if (Math.abs(first) > 90 && Math.abs(second)
|
|
1435
|
+
if (Math.abs(first) > 90 && Math.abs(second) > 90) {
|
|
1436
|
+
return null;
|
|
1437
|
+
}
|
|
1438
|
+
if (Math.abs(first) > 90) {
|
|
1439
1439
|
return { longitude: first, latitude: second };
|
|
1440
|
-
}
|
|
1440
|
+
}
|
|
1441
|
+
if (Math.abs(second) > 90) {
|
|
1441
1442
|
return { longitude: second, latitude: first };
|
|
1442
1443
|
}
|
|
1443
1444
|
return { latitude: first, longitude: second };
|
|
@@ -1456,7 +1457,7 @@ var __exports__ = (() => {
|
|
|
1456
1457
|
return isNaN(value) ? null : sign * value;
|
|
1457
1458
|
}
|
|
1458
1459
|
function dmsToDecimal(s3) {
|
|
1459
|
-
const regex = /(
|
|
1460
|
+
const regex = /(-?\d+)[°d]\s*(\d+)?['′m]?\s*(\d+(?:\.\d+)?)?[\"″s]?\s*([NSEW])?/i;
|
|
1460
1461
|
const match = s3.match(regex);
|
|
1461
1462
|
if (!match)
|
|
1462
1463
|
return NaN;
|
|
@@ -1575,8 +1576,7 @@ var __exports__ = (() => {
|
|
|
1575
1576
|
);
|
|
1576
1577
|
}
|
|
1577
1578
|
flyTo(viewState) {
|
|
1578
|
-
const
|
|
1579
|
-
for (const viewId of viewIds) {
|
|
1579
|
+
for (const viewId of this.viewIds) {
|
|
1580
1580
|
if ("longitude" in viewState && "latitude" in viewState) {
|
|
1581
1581
|
this.props.onGeocode?.({
|
|
1582
1582
|
viewId,
|
|
@@ -3646,13 +3646,7 @@ var __exports__ = (() => {
|
|
|
3646
3646
|
const { marker, content, style } = this.props;
|
|
3647
3647
|
const [x2, y3] = this.viewport.project(this.props.position);
|
|
3648
3648
|
const ui = /* @__PURE__ */ u2("div", { children: [
|
|
3649
|
-
marker && /* @__PURE__ */ u2(
|
|
3650
|
-
"div",
|
|
3651
|
-
{
|
|
3652
|
-
style: { position: "absolute", left: x2, top: y3, pointerEvents: "all", cursor: "pointer" },
|
|
3653
|
-
children: /* @__PURE__ */ u2(UserContent, { ...marker, onClick: () => this._setIsOpen(true) })
|
|
3654
|
-
}
|
|
3655
|
-
),
|
|
3649
|
+
marker && /* @__PURE__ */ u2("div", { className: "deck-widget-popup-marker", style: { left: x2, top: y3 }, children: /* @__PURE__ */ u2(UserContent, { ...marker, onClick: () => this._setIsOpen(true) }) }),
|
|
3656
3650
|
this.isOpen && /* @__PURE__ */ u2(
|
|
3657
3651
|
Popover,
|
|
3658
3652
|
{
|
|
@@ -4209,6 +4203,9 @@ var __exports__ = (() => {
|
|
|
4209
4203
|
}
|
|
4210
4204
|
super.onRemove();
|
|
4211
4205
|
}
|
|
4206
|
+
getContentBounds(viewId) {
|
|
4207
|
+
return this.props.contentBounds ?? this.deck?.getView(viewId)?.controller?.maxBounds ?? null;
|
|
4208
|
+
}
|
|
4212
4209
|
updateViewport(viewport) {
|
|
4213
4210
|
if (!viewport) {
|
|
4214
4211
|
this.contentSize = 0;
|
|
@@ -4216,7 +4213,7 @@ var __exports__ = (() => {
|
|
|
4216
4213
|
this.viewportSize = 0;
|
|
4217
4214
|
return;
|
|
4218
4215
|
}
|
|
4219
|
-
const
|
|
4216
|
+
const contentBounds = this.getContentBounds(viewport.id);
|
|
4220
4217
|
const isVertical = this.isVertical();
|
|
4221
4218
|
const projectedBounds = contentBounds ? projectBounds(contentBounds, viewport, isVertical) : [0, 0];
|
|
4222
4219
|
this.contentSize = projectedBounds[1] - projectedBounds[0];
|
|
@@ -4224,8 +4221,12 @@ var __exports__ = (() => {
|
|
|
4224
4221
|
this.viewportSize = isVertical ? viewport.height : viewport.width;
|
|
4225
4222
|
}
|
|
4226
4223
|
getDecorations(viewport) {
|
|
4227
|
-
const { decorations = []
|
|
4228
|
-
if (!viewport ||
|
|
4224
|
+
const { decorations = [] } = this.props;
|
|
4225
|
+
if (!viewport || decorations.length === 0) {
|
|
4226
|
+
return [];
|
|
4227
|
+
}
|
|
4228
|
+
const contentBounds = this.getContentBounds(viewport.id);
|
|
4229
|
+
if (!contentBounds) {
|
|
4229
4230
|
return [];
|
|
4230
4231
|
}
|
|
4231
4232
|
const isVertical = this.isVertical();
|
|
@@ -4907,38 +4908,20 @@ var __exports__ = (() => {
|
|
|
4907
4908
|
this.className = "deck-widget-theme";
|
|
4908
4909
|
this.placement = "top-left";
|
|
4909
4910
|
this.themeMode = "dark";
|
|
4911
|
+
this.appliedTheme = {};
|
|
4910
4912
|
this.themeMode = this._getInitialThemeMode();
|
|
4911
4913
|
this.setProps(this.props);
|
|
4912
4914
|
}
|
|
4913
4915
|
// eslint-disable-next-line complexity
|
|
4914
4916
|
setProps(props) {
|
|
4915
|
-
const { lightModeTheme, darkModeTheme, themeMode: prevThemeMode } = this.props;
|
|
4916
4917
|
this.placement = props.placement ?? this.placement;
|
|
4917
4918
|
this.viewId = props.viewId ?? this.viewId;
|
|
4918
4919
|
super.setProps(props);
|
|
4919
|
-
const currentMode = this.getThemeMode();
|
|
4920
|
-
if (props.themeMode !== void 0 && props.themeMode !== prevThemeMode) {
|
|
4921
|
-
this._applyTheme(props.themeMode);
|
|
4922
|
-
return;
|
|
4923
|
-
}
|
|
4924
|
-
switch (currentMode) {
|
|
4925
|
-
case "light":
|
|
4926
|
-
if (props.lightModeTheme && !(0, import_core21._deepEqual)(props.lightModeTheme, lightModeTheme, 1)) {
|
|
4927
|
-
this._applyTheme("light");
|
|
4928
|
-
}
|
|
4929
|
-
break;
|
|
4930
|
-
case "dark":
|
|
4931
|
-
if (props.darkModeTheme && !(0, import_core21._deepEqual)(props.darkModeTheme, darkModeTheme, 1)) {
|
|
4932
|
-
this._applyTheme("dark");
|
|
4933
|
-
}
|
|
4934
|
-
break;
|
|
4935
|
-
default:
|
|
4936
|
-
import_core21.log.warn(`Invalid theme mode ${currentMode}`)();
|
|
4937
|
-
}
|
|
4938
4920
|
}
|
|
4939
4921
|
onRenderHTML(rootElement) {
|
|
4940
4922
|
const { lightModeLabel, darkModeLabel } = this.props;
|
|
4941
4923
|
const currentMode = this.getThemeMode();
|
|
4924
|
+
this._applyTheme(currentMode, rootElement);
|
|
4942
4925
|
B(
|
|
4943
4926
|
/* @__PURE__ */ u2(
|
|
4944
4927
|
IconButton,
|
|
@@ -4951,9 +4934,6 @@ var __exports__ = (() => {
|
|
|
4951
4934
|
rootElement
|
|
4952
4935
|
);
|
|
4953
4936
|
}
|
|
4954
|
-
onAdd() {
|
|
4955
|
-
this._applyTheme(this.getThemeMode());
|
|
4956
|
-
}
|
|
4957
4937
|
/**
|
|
4958
4938
|
* Returns the current theme mode.
|
|
4959
4939
|
* In controlled mode, returns the themeMode prop.
|
|
@@ -4968,19 +4948,22 @@ var __exports__ = (() => {
|
|
|
4968
4948
|
this.props.onThemeModeChange?.(nextMode);
|
|
4969
4949
|
if (this.props.themeMode === void 0) {
|
|
4970
4950
|
this.themeMode = nextMode;
|
|
4971
|
-
this.
|
|
4951
|
+
this.updateHTML();
|
|
4972
4952
|
}
|
|
4973
4953
|
}
|
|
4974
4954
|
/** Apply theme styling without changing internal state */
|
|
4975
|
-
_applyTheme(themeMode) {
|
|
4976
|
-
const
|
|
4977
|
-
if (
|
|
4978
|
-
|
|
4979
|
-
(0, import_core21._applyStyles)(container, themeStyle);
|
|
4980
|
-
const label = themeMode === "dark" ? this.props.darkModeLabel : this.props.lightModeLabel;
|
|
4981
|
-
import_core21.log.log(1, `Switched theme to ${label}`, themeStyle)();
|
|
4982
|
-
this.updateHTML();
|
|
4955
|
+
_applyTheme(themeMode, rootElement) {
|
|
4956
|
+
const themeStyle = themeMode === "dark" ? this.props.darkModeTheme : this.props.lightModeTheme;
|
|
4957
|
+
if ((0, import_core21._deepEqual)(themeStyle, this.appliedTheme, 1)) {
|
|
4958
|
+
return;
|
|
4983
4959
|
}
|
|
4960
|
+
const container = rootElement.closest(".deck-widget-container");
|
|
4961
|
+
if (!container)
|
|
4962
|
+
return;
|
|
4963
|
+
(0, import_core21._applyStyles)(container, themeStyle);
|
|
4964
|
+
this.appliedTheme = themeStyle;
|
|
4965
|
+
const label = themeMode === "dark" ? this.props.darkModeLabel : this.props.lightModeLabel;
|
|
4966
|
+
import_core21.log.log(1, `Switched theme to ${label}`, themeStyle)();
|
|
4984
4967
|
}
|
|
4985
4968
|
/** Read browser preference */
|
|
4986
4969
|
_getInitialThemeMode() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geocoder-widget.d.ts","sourceRoot":"","sources":["../src/geocoder-widget.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,EAAC,eAAe,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAIhE,OAAO,EAAC,KAAK,QAAQ,EAAC,kCAA+B;AACrD,OAAO,EAAC,eAAe,EAA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,MAAM,CAAC;IAChB,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE;QACnB,6BAA6B;QAC7B,MAAM,EAAE,MAAM,CAAC;QACf,+BAA+B;QAC/B,WAAW,EAAE;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAC,CAAC;KACnE,KAAK,IAAI,CAAC;CACZ,CAAC;AAEF;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,MAAM,CAAC,mBAAmB,CAAC;IAC7D,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAYhD;IAEF,SAAS,SAA0B;IACnC,SAAS,EAAE,eAAe,CAAc;IAExC,cAAc,kBAA2B;IACzC,WAAW,EAAE,MAAM,CAAM;IACzB,QAAQ,EAAE,QAAQ,CAAuB;IACzC,iBAAiB,EAAE,OAAO,CAAS;gBAEvB,KAAK,GAAE,mBAAwB;IAK3C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,IAAI;IAUnD,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IA4B5C,QAAQ,SAAU,MAAM,UAEtB;IAEF,cAAc,mBAIZ;IAEF,YAAY,UAAW,MAAM,UAS3B;IAEF,uCAAuC;IACvC,YAAY,aAGV;IAEF,uDAAuD;IACvD,kBAAkB,sBAmBhB;IAEF,wBAAwB;IACxB,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAazC;IAEF,KAAK,CAAC,SAAS,EAAE,SAAS;CA2B3B"}
|
package/dist/geocoder-widget.js
CHANGED
|
@@ -109,8 +109,7 @@ export class GeocoderWidget extends Widget {
|
|
|
109
109
|
onInput: e => this.setInput(e.target?.value || ''), onKeyPress: this.handleKeyPress }), _jsx(DropdownMenu, { menuItems: menuItems, onSelect: this.handleSelect }), this.geocodeHistory.errorText && (_jsx("div", { className: "deck-widget-geocoder-error", children: this.geocodeHistory.errorText }))] }), rootElement);
|
|
110
110
|
}
|
|
111
111
|
flyTo(viewState) {
|
|
112
|
-
const
|
|
113
|
-
for (const viewId of viewIds) {
|
|
112
|
+
for (const viewId of this.viewIds) {
|
|
114
113
|
// Call callback with geocoded coordinates
|
|
115
114
|
if ('longitude' in viewState && 'latitude' in viewState) {
|
|
116
115
|
this.props.onGeocode?.({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geocoder-widget.js","sourceRoot":"","sources":["../src/geocoder-widget.tsx"],"names":[],"mappings":";AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAErC,OAAO,EAAC,iBAAiB,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACpE,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,YAAY,EAAgB,0CAAuC;AAE3E,OAAO,EAAC,eAAe,EAAC,0CAAuC;AAC/D,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACxB,mCAAgC;AAKjC,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAEnC,mDAAmD;AACnD,MAAM,aAAa,GAAG,6aAA6a,CAAC;AAEpc,MAAM,qBAAqB,GAAa;IACtC,KAAK,EAAE,kBAAkB;IACzB,KAAK,EAAE,gBAAgB;IACvB,IAAI,EAAE,aAAa;CACpB,CAAC;AA8BF;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,MAA2B;IAuB7D,YAAY,QAA6B,EAAE;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;QATf,cAAS,GAAG,sBAAsB,CAAC;QACnC,cAAS,GAAoB,UAAU,CAAC;QAExC,mBAAc,GAAG,IAAI,eAAe,C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ewId, nextViewState);
|
|
170
170
|
}
|
|
171
171
|
handleZoomIn() {
|
|
172
|
-
|
|
173
|
-
const viewIds = this.viewId ? [this.viewId] : ((_a = this.deck) == null ? void 0 : _a.getViews().map((v) => v.id)) ?? [];
|
|
174
|
-
for (const viewId of viewIds) {
|
|
172
|
+
for (const viewId of this.viewIds) {
|
|
175
173
|
this.handleZoom(viewId, 1);
|
|
176
174
|
}
|
|
177
175
|
}
|
|
178
176
|
handleZoomOut() {
|
|
179
|
-
|
|
180
|
-
const viewIds = this.viewId ? [this.viewId] : ((_a = this.deck) == null ? void 0 : _a.getViews().map((v) => v.id)) ?? [];
|
|
181
|
-
for (const viewId of viewIds) {
|
|
177
|
+
for (const viewId of this.viewIds) {
|
|
182
178
|
this.handleZoom(viewId, -1);
|
|
183
179
|
}
|
|
184
180
|
}
|
|
@@ -230,16 +226,15 @@ var ResetViewWidget = class extends import_core2.Widget {
|
|
|
230
226
|
this.resetViewState(initialViewState);
|
|
231
227
|
}
|
|
232
228
|
resetViewState(viewState) {
|
|
233
|
-
var _a, _b
|
|
234
|
-
const
|
|
235
|
-
for (const viewId of viewIds) {
|
|
229
|
+
var _a, _b;
|
|
230
|
+
for (const viewId of this.viewIds) {
|
|
236
231
|
const nextViewState = {
|
|
237
232
|
...(viewState == null ? void 0 : viewState[viewId]) ?? viewState
|
|
238
233
|
// only works for geospatial?
|
|
239
234
|
// transitionDuration: this.props.transitionDuration,
|
|
240
235
|
// transitionInterpolator: new FlyToInterpolator()
|
|
241
236
|
};
|
|
242
|
-
(
|
|
237
|
+
(_b = (_a = this.props).onReset) == null ? void 0 : _b.call(_a, { viewId, viewState: nextViewState });
|
|
243
238
|
this.setViewState(viewId, nextViewState);
|
|
244
239
|
}
|
|
245
240
|
}
|
|
@@ -722,9 +717,13 @@ function parseCoordinates(input) {
|
|
|
722
717
|
const second = parseCoordinatePart(parts[1]);
|
|
723
718
|
if (first === null || second === null)
|
|
724
719
|
return null;
|
|
725
|
-
if (Math.abs(first) > 90 && Math.abs(second)
|
|
720
|
+
if (Math.abs(first) > 90 && Math.abs(second) > 90) {
|
|
721
|
+
return null;
|
|
722
|
+
}
|
|
723
|
+
if (Math.abs(first) > 90) {
|
|
726
724
|
return { longitude: first, latitude: second };
|
|
727
|
-
}
|
|
725
|
+
}
|
|
726
|
+
if (Math.abs(second) > 90) {
|
|
728
727
|
return { longitude: second, latitude: first };
|
|
729
728
|
}
|
|
730
729
|
return { latitude: first, longitude: second };
|
|
@@ -743,7 +742,7 @@ function parseCoordinatePart(s) {
|
|
|
743
742
|
return isNaN(value) ? null : sign * value;
|
|
744
743
|
}
|
|
745
744
|
function dmsToDecimal(s) {
|
|
746
|
-
const regex = /(
|
|
745
|
+
const regex = /(-?\d+)[°d]\s*(\d+)?['′m]?\s*(\d+(?:\.\d+)?)?[\"″s]?\s*([NSEW])?/i;
|
|
747
746
|
const match = s.match(regex);
|
|
748
747
|
if (!match)
|
|
749
748
|
return NaN;
|
|
@@ -849,11 +848,10 @@ var GeocoderWidget = class extends import_core6.Widget {
|
|
|
849
848
|
}), (0, import_jsx_runtime9.jsx)(DropdownMenu, { menuItems, onSelect: this.handleSelect }), this.geocodeHistory.errorText && (0, import_jsx_runtime9.jsx)("div", { className: "deck-widget-geocoder-error", children: this.geocodeHistory.errorText })] }), rootElement);
|
|
850
849
|
}
|
|
851
850
|
flyTo(viewState) {
|
|
852
|
-
var _a, _b
|
|
853
|
-
const
|
|
854
|
-
for (const viewId of viewIds) {
|
|
851
|
+
var _a, _b;
|
|
852
|
+
for (const viewId of this.viewIds) {
|
|
855
853
|
if ("longitude" in viewState && "latitude" in viewState) {
|
|
856
|
-
(
|
|
854
|
+
(_b = (_a = this.props).onGeocode) == null ? void 0 : _b.call(_a, {
|
|
857
855
|
viewId,
|
|
858
856
|
coordinates: {
|
|
859
857
|
longitude: viewState.longitude,
|
|
@@ -1440,7 +1438,7 @@ var PopupWidget = class extends import_core11.Widget {
|
|
|
1440
1438
|
}
|
|
1441
1439
|
const { marker, content, style } = this.props;
|
|
1442
1440
|
const [x, y] = this.viewport.project(this.props.position);
|
|
1443
|
-
const ui = (0, import_jsx_runtime15.jsxs)("div", { children: [marker && (0, import_jsx_runtime15.jsx)("div", {
|
|
1441
|
+
const ui = (0, import_jsx_runtime15.jsxs)("div", { children: [marker && (0, import_jsx_runtime15.jsx)("div", { className: "deck-widget-popup-marker", style: { left: x, top: y }, children: (0, import_jsx_runtime15.jsx)(UserContent, { ...marker, onClick: () => this._setIsOpen(true) }) }), this.isOpen && (0, import_jsx_runtime15.jsx)(Popover, { x, y, placement: this.props.placement, arrow: this.props.arrow, arrowColor: "var(--menu-background, #fff)", offset: this.props.offset, children: (0, import_jsx_runtime15.jsxs)("div", { className: `deck-widget-popup-content ${this.props.className}`, style, children: [this.props.closeButton && (0, import_jsx_runtime15.jsx)("div", { className: "deck-widget-popup-controls", style: { width: "100%", display: "flex", justifyContent: "end" }, children: (0, import_jsx_runtime15.jsx)(IconButton, { className: "deck-widget-popup-close-button", onClick: () => this._setIsOpen(false) }) }), (0, import_jsx_runtime15.jsx)(UserContent, { ...typeof content === "string" ? { text: content } : content })] }) })] });
|
|
1444
1442
|
(0, import_preact10.render)(ui, rootElement);
|
|
1445
1443
|
}
|
|
1446
1444
|
};
|
|
@@ -1847,6 +1845,10 @@ var ScrollbarWidget = class extends import_core13.Widget {
|
|
|
1847
1845
|
}
|
|
1848
1846
|
super.onRemove();
|
|
1849
1847
|
}
|
|
1848
|
+
getContentBounds(viewId) {
|
|
1849
|
+
var _a, _b, _c;
|
|
1850
|
+
return this.props.contentBounds ?? ((_c = (_b = (_a = this.deck) == null ? void 0 : _a.getView(viewId)) == null ? void 0 : _b.controller) == null ? void 0 : _c.maxBounds) ?? null;
|
|
1851
|
+
}
|
|
1850
1852
|
updateViewport(viewport) {
|
|
1851
1853
|
if (!viewport) {
|
|
1852
1854
|
this.contentSize = 0;
|
|
@@ -1854,7 +1856,7 @@ var ScrollbarWidget = class extends import_core13.Widget {
|
|
|
1854
1856
|
this.viewportSize = 0;
|
|
1855
1857
|
return;
|
|
1856
1858
|
}
|
|
1857
|
-
const
|
|
1859
|
+
const contentBounds = this.getContentBounds(viewport.id);
|
|
1858
1860
|
const isVertical = this.isVertical();
|
|
1859
1861
|
const projectedBounds = contentBounds ? projectBounds(contentBounds, viewport, isVertical) : [0, 0];
|
|
1860
1862
|
this.contentSize = projectedBounds[1] - projectedBounds[0];
|
|
@@ -1862,8 +1864,12 @@ var ScrollbarWidget = class extends import_core13.Widget {
|
|
|
1862
1864
|
this.viewportSize = isVertical ? viewport.height : viewport.width;
|
|
1863
1865
|
}
|
|
1864
1866
|
getDecorations(viewport) {
|
|
1865
|
-
const { decorations = []
|
|
1866
|
-
if (!viewport ||
|
|
1867
|
+
const { decorations = [] } = this.props;
|
|
1868
|
+
if (!viewport || decorations.length === 0) {
|
|
1869
|
+
return [];
|
|
1870
|
+
}
|
|
1871
|
+
const contentBounds = this.getContentBounds(viewport.id);
|
|
1872
|
+
if (!contentBounds) {
|
|
1867
1873
|
return [];
|
|
1868
1874
|
}
|
|
1869
1875
|
const isVertical = this.isVertical();
|
|
@@ -2453,43 +2459,22 @@ var ThemeWidget = class extends import_core20.Widget {
|
|
|
2453
2459
|
this.className = "deck-widget-theme";
|
|
2454
2460
|
this.placement = "top-left";
|
|
2455
2461
|
this.themeMode = "dark";
|
|
2462
|
+
this.appliedTheme = {};
|
|
2456
2463
|
this.themeMode = this._getInitialThemeMode();
|
|
2457
2464
|
this.setProps(this.props);
|
|
2458
2465
|
}
|
|
2459
2466
|
// eslint-disable-next-line complexity
|
|
2460
2467
|
setProps(props) {
|
|
2461
|
-
const { lightModeTheme, darkModeTheme, themeMode: prevThemeMode } = this.props;
|
|
2462
2468
|
this.placement = props.placement ?? this.placement;
|
|
2463
2469
|
this.viewId = props.viewId ?? this.viewId;
|
|
2464
2470
|
super.setProps(props);
|
|
2465
|
-
const currentMode = this.getThemeMode();
|
|
2466
|
-
if (props.themeMode !== void 0 && props.themeMode !== prevThemeMode) {
|
|
2467
|
-
this._applyTheme(props.themeMode);
|
|
2468
|
-
return;
|
|
2469
|
-
}
|
|
2470
|
-
switch (currentMode) {
|
|
2471
|
-
case "light":
|
|
2472
|
-
if (props.lightModeTheme && !(0, import_core19._deepEqual)(props.lightModeTheme, lightModeTheme, 1)) {
|
|
2473
|
-
this._applyTheme("light");
|
|
2474
|
-
}
|
|
2475
|
-
break;
|
|
2476
|
-
case "dark":
|
|
2477
|
-
if (props.darkModeTheme && !(0, import_core19._deepEqual)(props.darkModeTheme, darkModeTheme, 1)) {
|
|
2478
|
-
this._applyTheme("dark");
|
|
2479
|
-
}
|
|
2480
|
-
break;
|
|
2481
|
-
default:
|
|
2482
|
-
import_core19.log.warn(`Invalid theme mode ${currentMode}`)();
|
|
2483
|
-
}
|
|
2484
2471
|
}
|
|
2485
2472
|
onRenderHTML(rootElement) {
|
|
2486
2473
|
const { lightModeLabel, darkModeLabel } = this.props;
|
|
2487
2474
|
const currentMode = this.getThemeMode();
|
|
2475
|
+
this._applyTheme(currentMode, rootElement);
|
|
2488
2476
|
(0, import_preact18.render)((0, import_jsx_runtime24.jsx)(IconButton, { onClick: this._handleClick.bind(this), label: currentMode === "dark" ? darkModeLabel : lightModeLabel, className: currentMode === "dark" ? "deck-widget-moon" : "deck-widget-sun" }), rootElement);
|
|
2489
2477
|
}
|
|
2490
|
-
onAdd() {
|
|
2491
|
-
this._applyTheme(this.getThemeMode());
|
|
2492
|
-
}
|
|
2493
2478
|
/**
|
|
2494
2479
|
* Returns the current theme mode.
|
|
2495
2480
|
* In controlled mode, returns the themeMode prop.
|
|
@@ -2505,20 +2490,22 @@ var ThemeWidget = class extends import_core20.Widget {
|
|
|
2505
2490
|
(_b = (_a = this.props).onThemeModeChange) == null ? void 0 : _b.call(_a, nextMode);
|
|
2506
2491
|
if (this.props.themeMode === void 0) {
|
|
2507
2492
|
this.themeMode = nextMode;
|
|
2508
|
-
this.
|
|
2493
|
+
this.updateHTML();
|
|
2509
2494
|
}
|
|
2510
2495
|
}
|
|
2511
2496
|
/** Apply theme styling without changing internal state */
|
|
2512
|
-
_applyTheme(themeMode) {
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
const themeStyle = themeMode === "dark" ? this.props.darkModeTheme : this.props.lightModeTheme;
|
|
2517
|
-
(0, import_core19._applyStyles)(container, themeStyle);
|
|
2518
|
-
const label = themeMode === "dark" ? this.props.darkModeLabel : this.props.lightModeLabel;
|
|
2519
|
-
import_core19.log.log(1, `Switched theme to ${label}`, themeStyle)();
|
|
2520
|
-
this.updateHTML();
|
|
2497
|
+
_applyTheme(themeMode, rootElement) {
|
|
2498
|
+
const themeStyle = themeMode === "dark" ? this.props.darkModeTheme : this.props.lightModeTheme;
|
|
2499
|
+
if ((0, import_core19._deepEqual)(themeStyle, this.appliedTheme, 1)) {
|
|
2500
|
+
return;
|
|
2521
2501
|
}
|
|
2502
|
+
const container = rootElement.closest(".deck-widget-container");
|
|
2503
|
+
if (!container)
|
|
2504
|
+
return;
|
|
2505
|
+
(0, import_core19._applyStyles)(container, themeStyle);
|
|
2506
|
+
this.appliedTheme = themeStyle;
|
|
2507
|
+
const label = themeMode === "dark" ? this.props.darkModeLabel : this.props.lightModeLabel;
|
|
2508
|
+
import_core19.log.log(1, `Switched theme to ${label}`, themeStyle)();
|
|
2522
2509
|
}
|
|
2523
2510
|
/** Read browser preference */
|
|
2524
2511
|
_getInitialThemeMode() {
|