@deck.gl/widgets 9.3.6 → 9.4.0-alpha.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/dist/dist.dev.js +630 -115
- package/dist/index.cjs +600 -111
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/info-widget.d.ts.map +1 -1
- package/dist/info-widget.js +2 -0
- package/dist/info-widget.js.map +1 -1
- package/dist/splitter-widget.d.ts +8 -3
- package/dist/splitter-widget.d.ts.map +1 -1
- package/dist/splitter-widget.js +59 -63
- package/dist/splitter-widget.js.map +1 -1
- package/dist/view-layout/build-views-from-view-layout.d.ts +79 -0
- package/dist/view-layout/build-views-from-view-layout.d.ts.map +1 -0
- package/dist/view-layout/build-views-from-view-layout.js +588 -0
- package/dist/view-layout/build-views-from-view-layout.js.map +1 -0
- package/dist/view-layout/view-layout.d.ts +89 -0
- package/dist/view-layout/view-layout.d.ts.map +1 -0
- package/dist/view-layout/view-layout.js +75 -0
- package/dist/view-layout/view-layout.js.map +1 -0
- package/dist/zoom-widget.d.ts +4 -0
- package/dist/zoom-widget.d.ts.map +1 -1
- package/dist/zoom-widget.js +3 -2
- package/dist/zoom-widget.js.map +1 -1
- package/dist.min.js +2 -2
- package/package.json +3 -3
- package/src/index.ts +6 -1
- package/src/info-widget.tsx +2 -0
- package/src/splitter-widget.tsx +91 -84
- package/src/view-layout/build-views-from-view-layout.ts +897 -0
- package/src/view-layout/view-layout.ts +186 -0
- package/src/zoom-widget.tsx +7 -2
package/dist/index.cjs
CHANGED
|
@@ -53,7 +53,8 @@ __export(dist_exports, {
|
|
|
53
53
|
_SimpleMenu: () => SimpleMenu,
|
|
54
54
|
_SplitterWidget: () => SplitterWidget,
|
|
55
55
|
_StatsWidget: () => StatsWidget,
|
|
56
|
-
_TimelineWidget: () => TimelineWidget
|
|
56
|
+
_TimelineWidget: () => TimelineWidget,
|
|
57
|
+
buildViewsFromViewLayout: () => buildViewsFromViewLayout
|
|
57
58
|
});
|
|
58
59
|
module.exports = __toCommonJS(dist_exports);
|
|
59
60
|
|
|
@@ -170,12 +171,12 @@ var ZoomWidget = class extends import_core.Widget {
|
|
|
170
171
|
}
|
|
171
172
|
handleZoomIn() {
|
|
172
173
|
for (const viewId of this.viewIds) {
|
|
173
|
-
this.handleZoom(viewId,
|
|
174
|
+
this.handleZoom(viewId, this.props.zoomStep);
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
177
|
handleZoomOut() {
|
|
177
178
|
for (const viewId of this.viewIds) {
|
|
178
|
-
this.handleZoom(viewId, -
|
|
179
|
+
this.handleZoom(viewId, -this.props.zoomStep);
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
182
|
};
|
|
@@ -185,6 +186,7 @@ ZoomWidget.defaultProps = {
|
|
|
185
186
|
placement: "top-left",
|
|
186
187
|
orientation: "vertical",
|
|
187
188
|
transitionDuration: 200,
|
|
189
|
+
zoomStep: 1,
|
|
188
190
|
zoomInLabel: "Zoom In",
|
|
189
191
|
zoomOutLabel: "Zoom Out",
|
|
190
192
|
zoomAxis: "all",
|
|
@@ -1002,17 +1004,506 @@ FullscreenWidget.defaultProps = {
|
|
|
1002
1004
|
var import_jsx_runtime11 = require("preact/jsx-runtime");
|
|
1003
1005
|
var import_preact8 = require("preact");
|
|
1004
1006
|
var import_hooks3 = require("preact/hooks");
|
|
1007
|
+
var import_core10 = require("@deck.gl/core");
|
|
1008
|
+
|
|
1009
|
+
// dist/view-layout/view-layout.js
|
|
1005
1010
|
var import_core9 = require("@deck.gl/core");
|
|
1006
|
-
|
|
1011
|
+
var VIEW_LAYOUT_TYPES = /* @__PURE__ */ new Set(["row", "column", "overlay", "spacer"]);
|
|
1012
|
+
var VIEW_LAYOUT_ORIENTATIONS = /* @__PURE__ */ new Set(["horizontal", "vertical"]);
|
|
1013
|
+
function isViewLayout(child) {
|
|
1014
|
+
return Boolean(child && typeof child === "object" && !(child instanceof import_core9.View) && ("type" in child && VIEW_LAYOUT_TYPES.has(String(child.type)) || "orientation" in child && VIEW_LAYOUT_ORIENTATIONS.has(String(child.orientation))));
|
|
1015
|
+
}
|
|
1016
|
+
function getViewLayoutType(item) {
|
|
1017
|
+
if ("orientation" in item) {
|
|
1018
|
+
return item.orientation === "horizontal" ? "row" : "column";
|
|
1019
|
+
}
|
|
1020
|
+
return item.type;
|
|
1021
|
+
}
|
|
1022
|
+
function getViewLayoutChildren(item) {
|
|
1023
|
+
return "views" in item ? item.views : item.children;
|
|
1024
|
+
}
|
|
1025
|
+
function assertViewLayout(item) {
|
|
1026
|
+
if (!item || typeof item !== "object") {
|
|
1027
|
+
throw new Error("ViewLayout must be an object.");
|
|
1028
|
+
}
|
|
1029
|
+
const type = getViewLayoutType(item);
|
|
1030
|
+
switch (type) {
|
|
1031
|
+
case "row":
|
|
1032
|
+
case "column":
|
|
1033
|
+
case "overlay": {
|
|
1034
|
+
const children = getViewLayoutChildren(item);
|
|
1035
|
+
if (!Array.isArray(children)) {
|
|
1036
|
+
throw new Error("ViewLayout requires a children or views array.");
|
|
1037
|
+
}
|
|
1038
|
+
if (isSplitLayoutItem(item) && item.splitId) {
|
|
1039
|
+
if (children.filter(Boolean).length < 2) {
|
|
1040
|
+
throw new Error("ViewLayout with splitId requires at least two children.");
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
children.forEach(assertViewLayoutChild);
|
|
1044
|
+
break;
|
|
1045
|
+
}
|
|
1046
|
+
case "spacer":
|
|
1047
|
+
break;
|
|
1048
|
+
default:
|
|
1049
|
+
throw new Error(`Unsupported view layout item: ${String(type)}`);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
function isSplitLayoutItem(item) {
|
|
1053
|
+
const type = getViewLayoutType(item);
|
|
1054
|
+
return type === "row" || type === "column";
|
|
1055
|
+
}
|
|
1056
|
+
function assertViewLayoutChild(child) {
|
|
1057
|
+
if (!child) {
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
if (isViewLayout(child)) {
|
|
1061
|
+
assertViewLayout(child);
|
|
1062
|
+
return;
|
|
1063
|
+
}
|
|
1064
|
+
if (child instanceof import_core9.View) {
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1067
|
+
throw new Error("ViewLayout children must be deck.gl View instances or layout objects.");
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
// dist/view-layout/build-views-from-view-layout.js
|
|
1071
|
+
function buildViewsFromViewLayout(args) {
|
|
1072
|
+
var _a;
|
|
1073
|
+
assertViewLayout(args.layout);
|
|
1074
|
+
const rootRect = {
|
|
1075
|
+
x: 0,
|
|
1076
|
+
y: 0,
|
|
1077
|
+
width: Math.max(1, args.width),
|
|
1078
|
+
height: Math.max(1, args.height)
|
|
1079
|
+
};
|
|
1080
|
+
const previousViewsById = new Map((((_a = args.previous) == null ? void 0 : _a.views) ?? []).map((view) => [getViewId(view), view]).filter((entry) => Boolean(entry[0])));
|
|
1081
|
+
const outputViews = [];
|
|
1082
|
+
const rectsById = {};
|
|
1083
|
+
const splittersById = {};
|
|
1084
|
+
compileLayoutItem({
|
|
1085
|
+
item: args.layout,
|
|
1086
|
+
rect: rootRect,
|
|
1087
|
+
rootRect,
|
|
1088
|
+
outputViews,
|
|
1089
|
+
rectsById,
|
|
1090
|
+
splittersById,
|
|
1091
|
+
previousViewsById,
|
|
1092
|
+
splitValues: args.splitValues ?? {},
|
|
1093
|
+
viewPropsById: args.viewPropsById ?? {}
|
|
1094
|
+
});
|
|
1095
|
+
return {
|
|
1096
|
+
views: outputViews,
|
|
1097
|
+
rectsById,
|
|
1098
|
+
splittersById
|
|
1099
|
+
};
|
|
1100
|
+
}
|
|
1101
|
+
function compileLayoutItem(args) {
|
|
1102
|
+
const { item } = args;
|
|
1103
|
+
const type = getViewLayoutType(item);
|
|
1104
|
+
switch (type) {
|
|
1105
|
+
case "row":
|
|
1106
|
+
compileStackLayout({
|
|
1107
|
+
...args,
|
|
1108
|
+
item,
|
|
1109
|
+
orientation: "row",
|
|
1110
|
+
children: getViewLayoutChildren(item)
|
|
1111
|
+
});
|
|
1112
|
+
return;
|
|
1113
|
+
case "column":
|
|
1114
|
+
compileStackLayout({
|
|
1115
|
+
...args,
|
|
1116
|
+
item,
|
|
1117
|
+
orientation: "column",
|
|
1118
|
+
children: getViewLayoutChildren(item)
|
|
1119
|
+
});
|
|
1120
|
+
return;
|
|
1121
|
+
case "overlay":
|
|
1122
|
+
compileOverlayLayout({
|
|
1123
|
+
...args,
|
|
1124
|
+
item,
|
|
1125
|
+
children: getViewLayoutChildren(item)
|
|
1126
|
+
});
|
|
1127
|
+
return;
|
|
1128
|
+
case "spacer":
|
|
1129
|
+
return;
|
|
1130
|
+
default:
|
|
1131
|
+
throw new Error(`Unsupported view layout item: ${String(type)}`);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
function compileStackLayout(args) {
|
|
1135
|
+
const containerRect = applyInsets(args.rect, args.item.inset);
|
|
1136
|
+
const children = args.children.filter(isPresentChild);
|
|
1137
|
+
if (children.length === 0) {
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
const containerAxisLength = args.orientation === "row" ? containerRect.width : containerRect.height;
|
|
1141
|
+
const stackAxisConfig = getStackAxisConfig({
|
|
1142
|
+
children,
|
|
1143
|
+
containerAxisLength,
|
|
1144
|
+
item: args.item,
|
|
1145
|
+
orientation: args.orientation,
|
|
1146
|
+
splitValues: args.splitValues
|
|
1147
|
+
});
|
|
1148
|
+
let cursor = args.orientation === "row" ? containerRect.x : containerRect.y;
|
|
1149
|
+
for (const splitConfig of stackAxisConfig.splitConfigs) {
|
|
1150
|
+
args.splittersById[splitConfig.splitId] = {
|
|
1151
|
+
id: splitConfig.splitId,
|
|
1152
|
+
orientation: args.orientation === "row" ? "horizontal" : "vertical",
|
|
1153
|
+
x: containerRect.x / args.rootRect.width * 100,
|
|
1154
|
+
y: containerRect.y / args.rootRect.height * 100,
|
|
1155
|
+
width: containerRect.width / args.rootRect.width * 100,
|
|
1156
|
+
height: containerRect.height / args.rootRect.height * 100,
|
|
1157
|
+
split: splitConfig.split,
|
|
1158
|
+
minSplit: splitConfig.minSplit,
|
|
1159
|
+
maxSplit: splitConfig.maxSplit
|
|
1160
|
+
};
|
|
1161
|
+
}
|
|
1162
|
+
children.forEach((child, index) => {
|
|
1163
|
+
const childAxisLength = stackAxisConfig.childAxisLengths[index];
|
|
1164
|
+
const childRect = args.orientation === "row" ? {
|
|
1165
|
+
x: cursor,
|
|
1166
|
+
y: containerRect.y,
|
|
1167
|
+
width: childAxisLength,
|
|
1168
|
+
height: containerRect.height
|
|
1169
|
+
} : {
|
|
1170
|
+
x: containerRect.x,
|
|
1171
|
+
y: cursor,
|
|
1172
|
+
width: containerRect.width,
|
|
1173
|
+
height: childAxisLength
|
|
1174
|
+
};
|
|
1175
|
+
cursor += childAxisLength;
|
|
1176
|
+
compileLayoutChild({
|
|
1177
|
+
child,
|
|
1178
|
+
rect: childRect,
|
|
1179
|
+
rootRect: args.rootRect,
|
|
1180
|
+
outputViews: args.outputViews,
|
|
1181
|
+
rectsById: args.rectsById,
|
|
1182
|
+
splittersById: args.splittersById,
|
|
1183
|
+
previousViewsById: args.previousViewsById,
|
|
1184
|
+
splitValues: args.splitValues,
|
|
1185
|
+
viewPropsById: args.viewPropsById
|
|
1186
|
+
});
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
function compileOverlayLayout(args) {
|
|
1190
|
+
const containerRect = applyInsets(args.rect, args.item.inset);
|
|
1191
|
+
args.children.filter(isPresentChild).forEach((child) => compileLayoutChild({
|
|
1192
|
+
child,
|
|
1193
|
+
rect: containerRect,
|
|
1194
|
+
rootRect: args.rootRect,
|
|
1195
|
+
outputViews: args.outputViews,
|
|
1196
|
+
rectsById: args.rectsById,
|
|
1197
|
+
splittersById: args.splittersById,
|
|
1198
|
+
previousViewsById: args.previousViewsById,
|
|
1199
|
+
splitValues: args.splitValues,
|
|
1200
|
+
viewPropsById: args.viewPropsById
|
|
1201
|
+
}));
|
|
1202
|
+
}
|
|
1203
|
+
function compileLayoutChild(args) {
|
|
1204
|
+
if (isViewLayout(args.child)) {
|
|
1205
|
+
compileLayoutItem({
|
|
1206
|
+
item: args.child,
|
|
1207
|
+
rect: args.rect,
|
|
1208
|
+
rootRect: args.rootRect,
|
|
1209
|
+
outputViews: args.outputViews,
|
|
1210
|
+
rectsById: args.rectsById,
|
|
1211
|
+
splittersById: args.splittersById,
|
|
1212
|
+
previousViewsById: args.previousViewsById,
|
|
1213
|
+
splitValues: args.splitValues,
|
|
1214
|
+
viewPropsById: args.viewPropsById
|
|
1215
|
+
});
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
compileResolvedView({
|
|
1219
|
+
view: args.child,
|
|
1220
|
+
rect: args.rect,
|
|
1221
|
+
outputViews: args.outputViews,
|
|
1222
|
+
rectsById: args.rectsById,
|
|
1223
|
+
previousViewsById: args.previousViewsById,
|
|
1224
|
+
viewPropsById: args.viewPropsById
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
function getStackAxisConfig(args) {
|
|
1228
|
+
const constraints = args.children.map((child) => getStackChildAxisConstraints(child, args.orientation, args.containerAxisLength));
|
|
1229
|
+
if (args.item.splitId) {
|
|
1230
|
+
return getSplitStackAxisConfig({ ...args, constraints });
|
|
1231
|
+
}
|
|
1232
|
+
return {
|
|
1233
|
+
childAxisLengths: getConstrainedStackChildAxisLengths(args.containerAxisLength, constraints),
|
|
1234
|
+
splitConfigs: []
|
|
1235
|
+
};
|
|
1236
|
+
}
|
|
1237
|
+
function getSplitStackAxisConfig(args) {
|
|
1238
|
+
const axisLength = Math.max(args.containerAxisLength, 1);
|
|
1239
|
+
const boundaries = getDefaultSplitBoundaries(args);
|
|
1240
|
+
const splitConfigs = [];
|
|
1241
|
+
for (let index = 0; index < boundaries.length; index++) {
|
|
1242
|
+
const splitId = getSplitId(args.item.splitId, args.children.length, index);
|
|
1243
|
+
const desiredSplit = args.splitValues[splitId] ?? (args.children.length === 2 ? args.item.initialSplit : void 0) ?? boundaries[index];
|
|
1244
|
+
const { minSplit, maxSplit } = getSplitBoundaryLimits({
|
|
1245
|
+
index,
|
|
1246
|
+
boundaries,
|
|
1247
|
+
constraints: args.constraints,
|
|
1248
|
+
axisLength,
|
|
1249
|
+
item: args.item
|
|
1250
|
+
});
|
|
1251
|
+
const split = Math.min(Math.max(desiredSplit, minSplit), maxSplit);
|
|
1252
|
+
boundaries[index] = split;
|
|
1253
|
+
splitConfigs.push({ splitId, split, minSplit, maxSplit });
|
|
1254
|
+
}
|
|
1255
|
+
return {
|
|
1256
|
+
childAxisLengths: getStackAxisLengthsFromBoundaries(args.containerAxisLength, boundaries),
|
|
1257
|
+
splitConfigs
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1260
|
+
function getDefaultSplitBoundaries(args) {
|
|
1261
|
+
const childAxisLengths = getConstrainedStackChildAxisLengths(args.containerAxisLength, args.constraints);
|
|
1262
|
+
const totalLength = childAxisLengths.reduce((sum, length) => sum + length, 0);
|
|
1263
|
+
if (totalLength <= 0) {
|
|
1264
|
+
return args.children.slice(1).map((_, index) => (index + 1) / args.children.length);
|
|
1265
|
+
}
|
|
1266
|
+
let cursor = 0;
|
|
1267
|
+
return childAxisLengths.slice(0, -1).map((length) => {
|
|
1268
|
+
cursor += length;
|
|
1269
|
+
return cursor / totalLength;
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
function getSplitBoundaryLimits(args) {
|
|
1273
|
+
const previousSplit = args.index === 0 ? 0 : args.boundaries[args.index - 1];
|
|
1274
|
+
const nextSplit = args.index === args.boundaries.length - 1 ? 1 : args.boundaries[args.index + 1];
|
|
1275
|
+
const leftConstraints = args.constraints[args.index];
|
|
1276
|
+
const rightConstraints = args.constraints[args.index + 1];
|
|
1277
|
+
const leftMaxSplit = Number.isFinite(leftConstraints.maxPixels) ? previousSplit + leftConstraints.maxPixels / args.axisLength : 1;
|
|
1278
|
+
const rightMaxSplit = Number.isFinite(rightConstraints.maxPixels) ? nextSplit - rightConstraints.maxPixels / args.axisLength : 0;
|
|
1279
|
+
const minSplit = Math.max(args.item.minSplit ?? 0.05, previousSplit + leftConstraints.minPixels / args.axisLength, rightMaxSplit);
|
|
1280
|
+
const maxSplit = Math.max(minSplit, Math.min(args.item.maxSplit ?? 0.95, nextSplit - rightConstraints.minPixels / args.axisLength, leftMaxSplit));
|
|
1281
|
+
return { minSplit, maxSplit };
|
|
1282
|
+
}
|
|
1283
|
+
function getSplitId(splitId, childCount, index) {
|
|
1284
|
+
return childCount === 2 ? splitId : `${splitId}-${index}`;
|
|
1285
|
+
}
|
|
1286
|
+
function getStackAxisLengthsFromBoundaries(containerAxisLength, boundaries) {
|
|
1287
|
+
let previousBoundary = 0;
|
|
1288
|
+
const childAxisLengths = boundaries.map((boundary) => {
|
|
1289
|
+
const length = containerAxisLength * (boundary - previousBoundary);
|
|
1290
|
+
previousBoundary = boundary;
|
|
1291
|
+
return length;
|
|
1292
|
+
});
|
|
1293
|
+
childAxisLengths.push(containerAxisLength * (1 - previousBoundary));
|
|
1294
|
+
return childAxisLengths;
|
|
1295
|
+
}
|
|
1296
|
+
function getConstrainedStackChildAxisLengths(containerAxisLength, constraints) {
|
|
1297
|
+
const { childAxisLengths, flexibleChildIndexes, fixedLength } = getInitialStackChildAxisLengths(constraints);
|
|
1298
|
+
let remainingLength = Math.max(containerAxisLength - fixedLength, 0);
|
|
1299
|
+
let unsettledIndexes = flexibleChildIndexes;
|
|
1300
|
+
while (unsettledIndexes.length > 0) {
|
|
1301
|
+
const sharedLength = remainingLength / unsettledIndexes.length;
|
|
1302
|
+
const nextIndexes = [];
|
|
1303
|
+
let didClamp = false;
|
|
1304
|
+
for (const index of unsettledIndexes) {
|
|
1305
|
+
const { minPixels, maxPixels } = constraints[index];
|
|
1306
|
+
if (sharedLength < minPixels) {
|
|
1307
|
+
childAxisLengths[index] = minPixels;
|
|
1308
|
+
remainingLength -= minPixels;
|
|
1309
|
+
didClamp = true;
|
|
1310
|
+
} else if (sharedLength > maxPixels) {
|
|
1311
|
+
childAxisLengths[index] = maxPixels;
|
|
1312
|
+
remainingLength -= maxPixels;
|
|
1313
|
+
didClamp = true;
|
|
1314
|
+
} else {
|
|
1315
|
+
nextIndexes.push(index);
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
if (!didClamp) {
|
|
1319
|
+
for (const index of unsettledIndexes) {
|
|
1320
|
+
childAxisLengths[index] = sharedLength;
|
|
1321
|
+
}
|
|
1322
|
+
break;
|
|
1323
|
+
}
|
|
1324
|
+
unsettledIndexes = nextIndexes;
|
|
1325
|
+
}
|
|
1326
|
+
return childAxisLengths.map((length) => length ?? 0);
|
|
1327
|
+
}
|
|
1328
|
+
function getInitialStackChildAxisLengths(constraints) {
|
|
1329
|
+
const childAxisLengths = constraints.map(({ explicitLength }) => explicitLength);
|
|
1330
|
+
const flexibleChildIndexes = [];
|
|
1331
|
+
let fixedLength = 0;
|
|
1332
|
+
childAxisLengths.forEach((length, index) => {
|
|
1333
|
+
if (length === void 0) {
|
|
1334
|
+
flexibleChildIndexes.push(index);
|
|
1335
|
+
} else {
|
|
1336
|
+
fixedLength += length;
|
|
1337
|
+
}
|
|
1338
|
+
});
|
|
1339
|
+
return { childAxisLengths, flexibleChildIndexes, fixedLength };
|
|
1340
|
+
}
|
|
1341
|
+
function compileResolvedView(args) {
|
|
1342
|
+
const viewId = getRequiredViewId(args.view);
|
|
1343
|
+
const resolvedRect = resolveViewRectWithinParent(args.view, args.rect, args.viewPropsById[viewId]);
|
|
1344
|
+
args.rectsById[viewId] = resolvedRect;
|
|
1345
|
+
const nextProps = {
|
|
1346
|
+
...args.view.props,
|
|
1347
|
+
x: resolvedRect.x,
|
|
1348
|
+
y: resolvedRect.y,
|
|
1349
|
+
width: resolvedRect.width,
|
|
1350
|
+
height: resolvedRect.height
|
|
1351
|
+
};
|
|
1352
|
+
const previousView = args.previousViewsById.get(viewId);
|
|
1353
|
+
const nextView = previousView && previousView.constructor === args.view.constructor && arePropsEqual(previousView.props, nextProps) ? previousView : instantiateView(args.view, nextProps);
|
|
1354
|
+
args.outputViews.push(nextView);
|
|
1355
|
+
}
|
|
1356
|
+
function getStackChildAxisConstraints(child, orientation, parentAxisLength) {
|
|
1357
|
+
const axisValue = getAxisLengthValue(child, orientation);
|
|
1358
|
+
const minPixels = getPixelConstraintValue(child, "minPixels") ?? 0;
|
|
1359
|
+
const maxPixels = getPixelConstraintValue(child, "maxPixels") ?? Number.POSITIVE_INFINITY;
|
|
1360
|
+
if (axisValue === void 0) {
|
|
1361
|
+
return { minPixels, maxPixels };
|
|
1362
|
+
}
|
|
1363
|
+
const explicitLength = Math.min(Math.max(resolveLength(axisValue, parentAxisLength), minPixels), maxPixels);
|
|
1364
|
+
return { explicitLength, minPixels, maxPixels };
|
|
1365
|
+
}
|
|
1366
|
+
function resolveViewRectWithinParent(view, parentRect, overrides) {
|
|
1367
|
+
const props = { ...view.props, ...overrides };
|
|
1368
|
+
const x = parentRect.x + resolveOffset(props.x, parentRect.width);
|
|
1369
|
+
const y = parentRect.y + resolveOffset(props.y, parentRect.height);
|
|
1370
|
+
const width = resolveDimension(props.width, parentRect.width, parentRect.width);
|
|
1371
|
+
const height = resolveDimension(props.height, parentRect.height, parentRect.height);
|
|
1372
|
+
return {
|
|
1373
|
+
x,
|
|
1374
|
+
y,
|
|
1375
|
+
width,
|
|
1376
|
+
height
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
function instantiateView(view, props) {
|
|
1380
|
+
const ViewConstructor = view.constructor;
|
|
1381
|
+
return new ViewConstructor(props);
|
|
1382
|
+
}
|
|
1383
|
+
function getAxisLengthValue(child, orientation) {
|
|
1384
|
+
if (isViewLayout(child)) {
|
|
1385
|
+
return orientation === "row" ? child.width : child.height;
|
|
1386
|
+
}
|
|
1387
|
+
const props = child.props;
|
|
1388
|
+
return orientation === "row" ? props.width : props.height;
|
|
1389
|
+
}
|
|
1390
|
+
function getPixelConstraintValue(child, propName) {
|
|
1391
|
+
const value = isViewLayout(child) ? child[propName] : child.props[propName];
|
|
1392
|
+
return typeof value === "number" ? value : void 0;
|
|
1393
|
+
}
|
|
1394
|
+
function applyInsets(rect, inset) {
|
|
1395
|
+
if (!inset) {
|
|
1396
|
+
return rect;
|
|
1397
|
+
}
|
|
1398
|
+
const top = inset.top ?? 0;
|
|
1399
|
+
const right = inset.right ?? 0;
|
|
1400
|
+
const bottom = inset.bottom ?? 0;
|
|
1401
|
+
const left = inset.left ?? 0;
|
|
1402
|
+
return {
|
|
1403
|
+
x: rect.x + left,
|
|
1404
|
+
y: rect.y + top,
|
|
1405
|
+
width: Math.max(0, rect.width - left - right),
|
|
1406
|
+
height: Math.max(0, rect.height - top - bottom)
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
function resolveOffset(value, parentLength) {
|
|
1410
|
+
if (value === void 0 || value === null) {
|
|
1411
|
+
return 0;
|
|
1412
|
+
}
|
|
1413
|
+
return resolveLength(value, parentLength);
|
|
1414
|
+
}
|
|
1415
|
+
function resolveDimension(value, parentLength, fallback) {
|
|
1416
|
+
if (value === void 0 || value === null) {
|
|
1417
|
+
return fallback;
|
|
1418
|
+
}
|
|
1419
|
+
return resolveLength(value, parentLength);
|
|
1420
|
+
}
|
|
1421
|
+
function resolveLength(value, parentLength) {
|
|
1422
|
+
if (typeof value === "number") {
|
|
1423
|
+
return value;
|
|
1424
|
+
}
|
|
1425
|
+
const normalized = value.trim();
|
|
1426
|
+
if (normalized.length === 0) {
|
|
1427
|
+
throw new Error("View layout length must not be empty.");
|
|
1428
|
+
}
|
|
1429
|
+
if (normalized.startsWith("calc(") && normalized.endsWith(")")) {
|
|
1430
|
+
return resolveCalcExpression(normalized.slice(5, -1), parentLength);
|
|
1431
|
+
}
|
|
1432
|
+
return resolveLengthTerm(normalized, parentLength);
|
|
1433
|
+
}
|
|
1434
|
+
function resolveCalcExpression(expression, parentLength) {
|
|
1435
|
+
const sanitized = expression.replace(/\s+/g, "");
|
|
1436
|
+
const terms = sanitized.match(/[+-]?[^+-]+/g);
|
|
1437
|
+
if (!terms) {
|
|
1438
|
+
throw new Error(`Unsupported calc expression: calc(${expression})`);
|
|
1439
|
+
}
|
|
1440
|
+
return terms.reduce((sum, term) => sum + resolveLengthTerm(term, parentLength), 0);
|
|
1441
|
+
}
|
|
1442
|
+
function resolveLengthTerm(term, parentLength) {
|
|
1443
|
+
if (term.endsWith("%")) {
|
|
1444
|
+
return Number.parseFloat(term.slice(0, -1)) / 100 * parentLength;
|
|
1445
|
+
}
|
|
1446
|
+
if (term.endsWith("px")) {
|
|
1447
|
+
return Number.parseFloat(term.slice(0, -2));
|
|
1448
|
+
}
|
|
1449
|
+
return Number.parseFloat(term);
|
|
1450
|
+
}
|
|
1451
|
+
function getViewId(view) {
|
|
1452
|
+
const viewId = view.props.id;
|
|
1453
|
+
return typeof viewId === "string" && viewId.length > 0 ? viewId : null;
|
|
1454
|
+
}
|
|
1455
|
+
function getRequiredViewId(view) {
|
|
1456
|
+
const viewId = getViewId(view);
|
|
1457
|
+
if (!viewId) {
|
|
1458
|
+
throw new Error("Every compiled deck view must have a string id.");
|
|
1459
|
+
}
|
|
1460
|
+
return viewId;
|
|
1461
|
+
}
|
|
1462
|
+
function arePropsEqual(left, right) {
|
|
1463
|
+
if (left === right) {
|
|
1464
|
+
return true;
|
|
1465
|
+
}
|
|
1466
|
+
const leftKeys = Object.keys(left);
|
|
1467
|
+
const rightKeys = Object.keys(right);
|
|
1468
|
+
if (leftKeys.length !== rightKeys.length) {
|
|
1469
|
+
return false;
|
|
1470
|
+
}
|
|
1471
|
+
return leftKeys.every((key) => areValuesEqual(left[key], right[key]));
|
|
1472
|
+
}
|
|
1473
|
+
function areValuesEqual(left, right) {
|
|
1474
|
+
if (Object.is(left, right)) {
|
|
1475
|
+
return true;
|
|
1476
|
+
}
|
|
1477
|
+
if (Array.isArray(left) && Array.isArray(right)) {
|
|
1478
|
+
return left.length === right.length && left.every((value, index) => areValuesEqual(value, right[index]));
|
|
1479
|
+
}
|
|
1480
|
+
if (isPlainObject(left) && isPlainObject(right)) {
|
|
1481
|
+
const leftEntries = Object.keys(left);
|
|
1482
|
+
const rightEntries = Object.keys(right);
|
|
1483
|
+
return leftEntries.length === rightEntries.length && leftEntries.every((key) => areValuesEqual(left[key], right[key]));
|
|
1484
|
+
}
|
|
1485
|
+
return false;
|
|
1486
|
+
}
|
|
1487
|
+
function isPlainObject(value) {
|
|
1488
|
+
return Boolean(value) && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype;
|
|
1489
|
+
}
|
|
1490
|
+
function isPresentChild(child) {
|
|
1491
|
+
return Boolean(child);
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
// dist/splitter-widget.js
|
|
1495
|
+
function adaptViewLayout(root) {
|
|
1007
1496
|
const layoutsById = [];
|
|
1008
|
-
const
|
|
1009
|
-
function
|
|
1497
|
+
const isViewLayout2 = (v) => "views" in v;
|
|
1498
|
+
function adaptLayout(l) {
|
|
1010
1499
|
const id = layoutsById.length;
|
|
1500
|
+
const splitId = `splitter-${id}`;
|
|
1011
1501
|
const minSplit = l.minSplit ?? 0.05;
|
|
1012
1502
|
const maxSplit = l.maxSplit ?? 0.95;
|
|
1013
1503
|
const split = Math.min(Math.max(l.initialSplit ?? 0.5, minSplit), maxSplit);
|
|
1014
1504
|
const managed = {
|
|
1015
1505
|
id,
|
|
1506
|
+
splitId,
|
|
1016
1507
|
orientation: l.orientation,
|
|
1017
1508
|
views: l.views,
|
|
1018
1509
|
split,
|
|
@@ -1025,79 +1516,75 @@ function parseViewLayout(root) {
|
|
|
1025
1516
|
height: 0
|
|
1026
1517
|
};
|
|
1027
1518
|
layoutsById.push(managed);
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
const child1Y = y;
|
|
1046
|
-
let child1Width = width;
|
|
1047
|
-
let child1Height = height;
|
|
1048
|
-
let child2X = x;
|
|
1049
|
-
let child2Y = y;
|
|
1050
|
-
let child2Width = width;
|
|
1051
|
-
let child2Height = height;
|
|
1052
|
-
if (l.orientation === "horizontal") {
|
|
1053
|
-
child1Width = width * l.split;
|
|
1054
|
-
child2X = x + child1Width;
|
|
1055
|
-
child2Width = width - child1Width;
|
|
1056
|
-
} else {
|
|
1057
|
-
child1Height = height * l.split;
|
|
1058
|
-
child2Y = y + child1Height;
|
|
1059
|
-
child2Height = height - child1Height;
|
|
1060
|
-
}
|
|
1061
|
-
const [view1, view2] = l.views;
|
|
1062
|
-
if ("views" in view1) {
|
|
1063
|
-
evaluateViewLayout(view1, child1X, child1Y, child1Width, child1Height);
|
|
1064
|
-
} else {
|
|
1065
|
-
views.push(view1.clone({
|
|
1066
|
-
x: `${child1X}%`,
|
|
1067
|
-
y: `${child1Y}%`,
|
|
1068
|
-
width: `${child1Width}%`,
|
|
1069
|
-
height: `${child1Height}%`
|
|
1070
|
-
}));
|
|
1071
|
-
}
|
|
1072
|
-
if ("views" in view2) {
|
|
1073
|
-
evaluateViewLayout(view2, child2X, child2Y, child2Width, child2Height);
|
|
1074
|
-
} else {
|
|
1075
|
-
views.push(view2.clone({
|
|
1076
|
-
x: `${child2X}%`,
|
|
1077
|
-
y: `${child2Y}%`,
|
|
1078
|
-
width: `${child2Width}%`,
|
|
1079
|
-
height: `${child2Height}%`
|
|
1080
|
-
}));
|
|
1081
|
-
}
|
|
1519
|
+
const childEntries = l.views.map((view) => {
|
|
1520
|
+
if (!isViewLayout2(view)) {
|
|
1521
|
+
return { layout: view, managed: view };
|
|
1522
|
+
}
|
|
1523
|
+
const adapted = adaptLayout(view);
|
|
1524
|
+
return { layout: adapted.layout, managed: adapted.managed };
|
|
1525
|
+
});
|
|
1526
|
+
managed.views = [childEntries[0].managed, childEntries[1].managed];
|
|
1527
|
+
const layout2 = {
|
|
1528
|
+
orientation: l.orientation,
|
|
1529
|
+
splitId,
|
|
1530
|
+
initialSplit: split,
|
|
1531
|
+
minSplit,
|
|
1532
|
+
maxSplit,
|
|
1533
|
+
views: [childEntries[0].layout, childEntries[1].layout]
|
|
1534
|
+
};
|
|
1535
|
+
return { layout: layout2, managed };
|
|
1082
1536
|
}
|
|
1083
|
-
|
|
1084
|
-
return
|
|
1537
|
+
const { layout } = adaptLayout(root);
|
|
1538
|
+
return { layout, viewLayouts: layoutsById };
|
|
1539
|
+
}
|
|
1540
|
+
function evaluateViews(layout, viewLayouts, splitValues) {
|
|
1541
|
+
const compiled = buildViewsFromViewLayout({
|
|
1542
|
+
layout,
|
|
1543
|
+
width: 100,
|
|
1544
|
+
height: 100,
|
|
1545
|
+
splitValues
|
|
1546
|
+
});
|
|
1547
|
+
for (const viewLayout of viewLayouts) {
|
|
1548
|
+
const splitter = compiled.splittersById[viewLayout.splitId];
|
|
1549
|
+
if (splitter) {
|
|
1550
|
+
viewLayout.x = splitter.x;
|
|
1551
|
+
viewLayout.y = splitter.y;
|
|
1552
|
+
viewLayout.width = splitter.width;
|
|
1553
|
+
viewLayout.height = splitter.height;
|
|
1554
|
+
viewLayout.split = splitter.split;
|
|
1555
|
+
viewLayout.minSplit = splitter.minSplit;
|
|
1556
|
+
viewLayout.maxSplit = splitter.maxSplit;
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
return compiled.views.map((view) => view.clone({
|
|
1560
|
+
x: `${view.props.x}%`,
|
|
1561
|
+
y: `${view.props.y}%`,
|
|
1562
|
+
width: `${view.props.width}%`,
|
|
1563
|
+
height: `${view.props.height}%`
|
|
1564
|
+
}));
|
|
1085
1565
|
}
|
|
1086
|
-
var SplitterWidget = class extends
|
|
1566
|
+
var SplitterWidget = class extends import_core10.Widget {
|
|
1087
1567
|
constructor(props) {
|
|
1088
1568
|
super(props);
|
|
1089
1569
|
this.className = "deck-widget-splitter";
|
|
1090
1570
|
this.placement = "fill";
|
|
1571
|
+
this.splitValues = {};
|
|
1091
1572
|
this.needsUpdate = true;
|
|
1092
|
-
this.
|
|
1573
|
+
this.updateViewLayout(this.props.viewLayout);
|
|
1093
1574
|
}
|
|
1094
1575
|
setProps(props) {
|
|
1095
|
-
if (props.viewLayout && !(0,
|
|
1096
|
-
this.
|
|
1576
|
+
if (props.viewLayout && !(0, import_core10._deepEqual)(props.viewLayout, this.props.viewLayout, -1)) {
|
|
1577
|
+
this.updateViewLayout(props.viewLayout);
|
|
1097
1578
|
this.views = void 0;
|
|
1098
1579
|
}
|
|
1099
1580
|
super.setProps(props);
|
|
1100
1581
|
}
|
|
1582
|
+
updateViewLayout(viewLayout) {
|
|
1583
|
+
const adapted = adaptViewLayout(viewLayout);
|
|
1584
|
+
this.viewLayout = adapted.layout;
|
|
1585
|
+
this.viewLayouts = adapted.viewLayouts;
|
|
1586
|
+
this.splitValues = {};
|
|
1587
|
+
}
|
|
1101
1588
|
onRedraw() {
|
|
1102
1589
|
super.updateHTML();
|
|
1103
1590
|
}
|
|
@@ -1106,7 +1593,7 @@ var SplitterWidget = class extends import_core9.Widget {
|
|
|
1106
1593
|
// so we update deck props here and rerender DOM in the next onRedraw
|
|
1107
1594
|
updateHTML() {
|
|
1108
1595
|
if (!this.views) {
|
|
1109
|
-
this.views = evaluateViews(this.viewLayouts
|
|
1596
|
+
this.views = evaluateViews(this.viewLayout, this.viewLayouts, this.splitValues);
|
|
1110
1597
|
this.props.onChange(this.views.slice());
|
|
1111
1598
|
}
|
|
1112
1599
|
requestAnimationFrame(() => {
|
|
@@ -1128,8 +1615,8 @@ var SplitterWidget = class extends import_core9.Widget {
|
|
|
1128
1615
|
}
|
|
1129
1616
|
}
|
|
1130
1617
|
onChange(newSplit, layout) {
|
|
1131
|
-
|
|
1132
|
-
this.views = evaluateViews(this.viewLayouts
|
|
1618
|
+
this.splitValues = { ...this.splitValues, [layout.splitId]: newSplit };
|
|
1619
|
+
this.views = evaluateViews(this.viewLayout, this.viewLayouts, this.splitValues);
|
|
1133
1620
|
this.props.onChange(this.views.slice());
|
|
1134
1621
|
this.doUpdate();
|
|
1135
1622
|
}
|
|
@@ -1138,7 +1625,7 @@ var SplitterWidget = class extends import_core9.Widget {
|
|
|
1138
1625
|
}
|
|
1139
1626
|
};
|
|
1140
1627
|
SplitterWidget.defaultProps = {
|
|
1141
|
-
...
|
|
1628
|
+
...import_core10.Widget.defaultProps,
|
|
1142
1629
|
id: "splitter-widget",
|
|
1143
1630
|
viewLayout: void 0,
|
|
1144
1631
|
onChange: () => {
|
|
@@ -1199,7 +1686,7 @@ function Splitter({ orientation, x, y, width, height, split, minSplit, maxSplit,
|
|
|
1199
1686
|
|
|
1200
1687
|
// dist/info-widget.js
|
|
1201
1688
|
var import_jsx_runtime14 = require("preact/jsx-runtime");
|
|
1202
|
-
var
|
|
1689
|
+
var import_core11 = require("@deck.gl/core");
|
|
1203
1690
|
var import_preact9 = require("preact");
|
|
1204
1691
|
|
|
1205
1692
|
// dist/lib/components/popover.js
|
|
@@ -1314,7 +1801,7 @@ var UserContent = ({ text, html, element, ...props }) => {
|
|
|
1314
1801
|
};
|
|
1315
1802
|
|
|
1316
1803
|
// dist/info-widget.js
|
|
1317
|
-
var InfoWidget = class extends
|
|
1804
|
+
var InfoWidget = class extends import_core11.Widget {
|
|
1318
1805
|
constructor(props) {
|
|
1319
1806
|
super(props);
|
|
1320
1807
|
this.className = "deck-widget-info";
|
|
@@ -1341,11 +1828,13 @@ var InfoWidget = class extends import_core10.Widget {
|
|
|
1341
1828
|
onHover(info) {
|
|
1342
1829
|
if (this.props.mode === "hover") {
|
|
1343
1830
|
this.tooltip = this._getTooltip(info);
|
|
1831
|
+
this.updateHTML();
|
|
1344
1832
|
}
|
|
1345
1833
|
}
|
|
1346
1834
|
onClick(info) {
|
|
1347
1835
|
if (this.props.mode === "click") {
|
|
1348
1836
|
this.tooltip = this._getTooltip(info);
|
|
1837
|
+
this.updateHTML();
|
|
1349
1838
|
}
|
|
1350
1839
|
}
|
|
1351
1840
|
_getTooltip(info) {
|
|
@@ -1383,7 +1872,7 @@ var InfoWidget = class extends import_core10.Widget {
|
|
|
1383
1872
|
}
|
|
1384
1873
|
};
|
|
1385
1874
|
InfoWidget.defaultProps = {
|
|
1386
|
-
...
|
|
1875
|
+
...import_core11.Widget.defaultProps,
|
|
1387
1876
|
id: "info",
|
|
1388
1877
|
viewId: null,
|
|
1389
1878
|
mode: "hover",
|
|
@@ -1395,9 +1884,9 @@ InfoWidget.defaultProps = {
|
|
|
1395
1884
|
|
|
1396
1885
|
// dist/popup-widget.js
|
|
1397
1886
|
var import_jsx_runtime15 = require("preact/jsx-runtime");
|
|
1398
|
-
var
|
|
1887
|
+
var import_core12 = require("@deck.gl/core");
|
|
1399
1888
|
var import_preact10 = require("preact");
|
|
1400
|
-
var PopupWidget = class extends
|
|
1889
|
+
var PopupWidget = class extends import_core12.Widget {
|
|
1401
1890
|
constructor(props) {
|
|
1402
1891
|
super(props);
|
|
1403
1892
|
this.className = "deck-widget-popup";
|
|
@@ -1446,7 +1935,7 @@ var PopupWidget = class extends import_core11.Widget {
|
|
|
1446
1935
|
}
|
|
1447
1936
|
};
|
|
1448
1937
|
PopupWidget.defaultProps = {
|
|
1449
|
-
...
|
|
1938
|
+
...import_core12.Widget.defaultProps,
|
|
1450
1939
|
id: "info",
|
|
1451
1940
|
viewId: null,
|
|
1452
1941
|
position: [0, 0],
|
|
@@ -1464,9 +1953,9 @@ PopupWidget.defaultProps = {
|
|
|
1464
1953
|
|
|
1465
1954
|
// dist/context-menu-widget.js
|
|
1466
1955
|
var import_jsx_runtime16 = require("preact/jsx-runtime");
|
|
1467
|
-
var
|
|
1956
|
+
var import_core13 = require("@deck.gl/core");
|
|
1468
1957
|
var import_preact11 = require("preact");
|
|
1469
|
-
var ContextMenuWidget = class extends
|
|
1958
|
+
var ContextMenuWidget = class extends import_core13.Widget {
|
|
1470
1959
|
constructor(props) {
|
|
1471
1960
|
super(props);
|
|
1472
1961
|
this.className = "deck-widget-context-menu";
|
|
@@ -1520,7 +2009,7 @@ var ContextMenuWidget = class extends import_core12.Widget {
|
|
|
1520
2009
|
}
|
|
1521
2010
|
};
|
|
1522
2011
|
ContextMenuWidget.defaultProps = {
|
|
1523
|
-
...
|
|
2012
|
+
...import_core13.Widget.defaultProps,
|
|
1524
2013
|
id: "context",
|
|
1525
2014
|
viewId: null,
|
|
1526
2015
|
menuItems: [],
|
|
@@ -1534,7 +2023,7 @@ ContextMenuWidget.defaultProps = {
|
|
|
1534
2023
|
|
|
1535
2024
|
// dist/scrollbar-widget.js
|
|
1536
2025
|
var import_jsx_runtime18 = require("preact/jsx-runtime");
|
|
1537
|
-
var
|
|
2026
|
+
var import_core14 = require("@deck.gl/core");
|
|
1538
2027
|
var import_preact12 = require("preact");
|
|
1539
2028
|
|
|
1540
2029
|
// dist/lib/components/range-input.js
|
|
@@ -1804,7 +2293,7 @@ var clamp3 = (value, min, max) => {
|
|
|
1804
2293
|
}
|
|
1805
2294
|
return value;
|
|
1806
2295
|
};
|
|
1807
|
-
var ScrollbarWidget = class extends
|
|
2296
|
+
var ScrollbarWidget = class extends import_core14.Widget {
|
|
1808
2297
|
constructor(props) {
|
|
1809
2298
|
const resolved = {
|
|
1810
2299
|
...ScrollbarWidget.defaultProps,
|
|
@@ -1952,7 +2441,7 @@ var ScrollbarWidget = class extends import_core13.Widget {
|
|
|
1952
2441
|
}
|
|
1953
2442
|
};
|
|
1954
2443
|
ScrollbarWidget.defaultProps = {
|
|
1955
|
-
...
|
|
2444
|
+
...import_core14.Widget.defaultProps,
|
|
1956
2445
|
contentBounds: null,
|
|
1957
2446
|
placement: "top-right",
|
|
1958
2447
|
viewId: null,
|
|
@@ -1976,8 +2465,8 @@ function projectBounds(bounds, viewport, isVertical) {
|
|
|
1976
2465
|
// dist/icon-widget.js
|
|
1977
2466
|
var import_jsx_runtime19 = require("preact/jsx-runtime");
|
|
1978
2467
|
var import_preact13 = require("preact");
|
|
1979
|
-
var
|
|
1980
|
-
var IconWidget = class extends
|
|
2468
|
+
var import_core15 = require("@deck.gl/core");
|
|
2469
|
+
var IconWidget = class extends import_core15.Widget {
|
|
1981
2470
|
constructor(props) {
|
|
1982
2471
|
super(props);
|
|
1983
2472
|
this.className = "";
|
|
@@ -1995,7 +2484,7 @@ var IconWidget = class extends import_core14.Widget {
|
|
|
1995
2484
|
}
|
|
1996
2485
|
};
|
|
1997
2486
|
IconWidget.defaultProps = {
|
|
1998
|
-
...
|
|
2487
|
+
...import_core15.Widget.defaultProps,
|
|
1999
2488
|
id: "icon",
|
|
2000
2489
|
placement: "top-left",
|
|
2001
2490
|
viewId: null,
|
|
@@ -2008,8 +2497,8 @@ IconWidget.defaultProps = {
|
|
|
2008
2497
|
// dist/toggle-widget.js
|
|
2009
2498
|
var import_jsx_runtime20 = require("preact/jsx-runtime");
|
|
2010
2499
|
var import_preact14 = require("preact");
|
|
2011
|
-
var
|
|
2012
|
-
var ToggleWidget = class extends
|
|
2500
|
+
var import_core16 = require("@deck.gl/core");
|
|
2501
|
+
var ToggleWidget = class extends import_core16.Widget {
|
|
2013
2502
|
constructor(props) {
|
|
2014
2503
|
super(props);
|
|
2015
2504
|
this.className = "deck-widget-toggle";
|
|
@@ -2036,7 +2525,7 @@ var ToggleWidget = class extends import_core15.Widget {
|
|
|
2036
2525
|
}
|
|
2037
2526
|
};
|
|
2038
2527
|
ToggleWidget.defaultProps = {
|
|
2039
|
-
...
|
|
2528
|
+
...import_core16.Widget.defaultProps,
|
|
2040
2529
|
id: "icon",
|
|
2041
2530
|
placement: "top-left",
|
|
2042
2531
|
viewId: null,
|
|
@@ -2053,8 +2542,8 @@ ToggleWidget.defaultProps = {
|
|
|
2053
2542
|
// dist/selector-widget.js
|
|
2054
2543
|
var import_jsx_runtime21 = require("preact/jsx-runtime");
|
|
2055
2544
|
var import_preact15 = require("preact");
|
|
2056
|
-
var
|
|
2057
|
-
var SelectorWidget = class extends
|
|
2545
|
+
var import_core17 = require("@deck.gl/core");
|
|
2546
|
+
var SelectorWidget = class extends import_core17.Widget {
|
|
2058
2547
|
constructor(props) {
|
|
2059
2548
|
super(props);
|
|
2060
2549
|
this.className = "deck-widget-selector";
|
|
@@ -2091,7 +2580,7 @@ var SelectorWidget = class extends import_core16.Widget {
|
|
|
2091
2580
|
}
|
|
2092
2581
|
};
|
|
2093
2582
|
SelectorWidget.defaultProps = {
|
|
2094
|
-
...
|
|
2583
|
+
...import_core17.Widget.defaultProps,
|
|
2095
2584
|
id: "view-selector",
|
|
2096
2585
|
placement: "top-left",
|
|
2097
2586
|
viewId: null,
|
|
@@ -2103,9 +2592,9 @@ SelectorWidget.defaultProps = {
|
|
|
2103
2592
|
|
|
2104
2593
|
// dist/timeline-widget.js
|
|
2105
2594
|
var import_jsx_runtime22 = require("preact/jsx-runtime");
|
|
2106
|
-
var
|
|
2595
|
+
var import_core18 = require("@deck.gl/core");
|
|
2107
2596
|
var import_preact16 = require("preact");
|
|
2108
|
-
var TimelineWidget = class extends
|
|
2597
|
+
var TimelineWidget = class extends import_core18.Widget {
|
|
2109
2598
|
/**
|
|
2110
2599
|
* Returns the current time value.
|
|
2111
2600
|
* In controlled mode, returns the time prop.
|
|
@@ -2261,7 +2750,7 @@ var TimelineWidget = class extends import_core17.Widget {
|
|
|
2261
2750
|
}
|
|
2262
2751
|
};
|
|
2263
2752
|
TimelineWidget.defaultProps = {
|
|
2264
|
-
...
|
|
2753
|
+
...import_core18.Widget.defaultProps,
|
|
2265
2754
|
id: "timeline",
|
|
2266
2755
|
placement: "bottom-left",
|
|
2267
2756
|
viewId: null,
|
|
@@ -2284,8 +2773,8 @@ TimelineWidget.defaultProps = {
|
|
|
2284
2773
|
// dist/screenshot-widget.js
|
|
2285
2774
|
var import_jsx_runtime23 = require("preact/jsx-runtime");
|
|
2286
2775
|
var import_preact17 = require("preact");
|
|
2287
|
-
var
|
|
2288
|
-
var ScreenshotWidget = class extends
|
|
2776
|
+
var import_core19 = require("@deck.gl/core");
|
|
2777
|
+
var ScreenshotWidget = class extends import_core19.Widget {
|
|
2289
2778
|
constructor(props = {}) {
|
|
2290
2779
|
super(props);
|
|
2291
2780
|
this.className = "deck-widget-screenshot";
|
|
@@ -2325,7 +2814,7 @@ var ScreenshotWidget = class extends import_core18.Widget {
|
|
|
2325
2814
|
}
|
|
2326
2815
|
};
|
|
2327
2816
|
ScreenshotWidget.defaultProps = {
|
|
2328
|
-
...
|
|
2817
|
+
...import_core19.Widget.defaultProps,
|
|
2329
2818
|
id: "screenshot",
|
|
2330
2819
|
placement: "top-left",
|
|
2331
2820
|
viewId: null,
|
|
@@ -2337,8 +2826,8 @@ ScreenshotWidget.defaultProps = {
|
|
|
2337
2826
|
|
|
2338
2827
|
// dist/theme-widget.js
|
|
2339
2828
|
var import_jsx_runtime24 = require("preact/jsx-runtime");
|
|
2340
|
-
var import_core19 = require("@deck.gl/core");
|
|
2341
2829
|
var import_core20 = require("@deck.gl/core");
|
|
2830
|
+
var import_core21 = require("@deck.gl/core");
|
|
2342
2831
|
var import_preact18 = require("preact");
|
|
2343
2832
|
|
|
2344
2833
|
// dist/themes.js
|
|
@@ -2456,7 +2945,7 @@ var DarkGlassTheme = {
|
|
|
2456
2945
|
};
|
|
2457
2946
|
|
|
2458
2947
|
// dist/theme-widget.js
|
|
2459
|
-
var ThemeWidget = class extends
|
|
2948
|
+
var ThemeWidget = class extends import_core21.Widget {
|
|
2460
2949
|
constructor(props = {}) {
|
|
2461
2950
|
super(props);
|
|
2462
2951
|
this.className = "deck-widget-theme";
|
|
@@ -2499,16 +2988,16 @@ var ThemeWidget = class extends import_core20.Widget {
|
|
|
2499
2988
|
/** Apply theme styling without changing internal state */
|
|
2500
2989
|
_applyTheme(themeMode, rootElement) {
|
|
2501
2990
|
const themeStyle = themeMode === "dark" ? this.props.darkModeTheme : this.props.lightModeTheme;
|
|
2502
|
-
if ((0,
|
|
2991
|
+
if ((0, import_core20._deepEqual)(themeStyle, this.appliedTheme, 1)) {
|
|
2503
2992
|
return;
|
|
2504
2993
|
}
|
|
2505
2994
|
const container = rootElement.closest(".deck-widget-container");
|
|
2506
2995
|
if (!container)
|
|
2507
2996
|
return;
|
|
2508
|
-
(0,
|
|
2997
|
+
(0, import_core20._applyStyles)(container, themeStyle);
|
|
2509
2998
|
this.appliedTheme = themeStyle;
|
|
2510
2999
|
const label = themeMode === "dark" ? this.props.darkModeLabel : this.props.lightModeLabel;
|
|
2511
|
-
|
|
3000
|
+
import_core20.log.log(1, `Switched theme to ${label}`, themeStyle)();
|
|
2512
3001
|
}
|
|
2513
3002
|
/** Read browser preference */
|
|
2514
3003
|
_getInitialThemeMode() {
|
|
@@ -2523,7 +3012,7 @@ var ThemeWidget = class extends import_core20.Widget {
|
|
|
2523
3012
|
}
|
|
2524
3013
|
};
|
|
2525
3014
|
ThemeWidget.defaultProps = {
|
|
2526
|
-
...
|
|
3015
|
+
...import_core21.Widget.defaultProps,
|
|
2527
3016
|
id: "theme",
|
|
2528
3017
|
placement: "top-left",
|
|
2529
3018
|
viewId: null,
|
|
@@ -2540,8 +3029,8 @@ ThemeWidget.defaultProps = {
|
|
|
2540
3029
|
// dist/loading-widget.js
|
|
2541
3030
|
var import_jsx_runtime25 = require("preact/jsx-runtime");
|
|
2542
3031
|
var import_preact19 = require("preact");
|
|
2543
|
-
var
|
|
2544
|
-
var LoadingWidget = class extends
|
|
3032
|
+
var import_core22 = require("@deck.gl/core");
|
|
3033
|
+
var LoadingWidget = class extends import_core22.Widget {
|
|
2545
3034
|
constructor(props = {}) {
|
|
2546
3035
|
super(props);
|
|
2547
3036
|
this.className = "deck-widget-loading";
|
|
@@ -2575,7 +3064,7 @@ var LoadingWidget = class extends import_core21.Widget {
|
|
|
2575
3064
|
}
|
|
2576
3065
|
};
|
|
2577
3066
|
LoadingWidget.defaultProps = {
|
|
2578
|
-
...
|
|
3067
|
+
...import_core22.Widget.defaultProps,
|
|
2579
3068
|
id: "loading",
|
|
2580
3069
|
placement: "top-left",
|
|
2581
3070
|
viewId: null,
|
|
@@ -2586,8 +3075,8 @@ LoadingWidget.defaultProps = {
|
|
|
2586
3075
|
|
|
2587
3076
|
// dist/stats-widget.js
|
|
2588
3077
|
var import_jsx_runtime26 = require("preact/jsx-runtime");
|
|
2589
|
-
var
|
|
2590
|
-
var
|
|
3078
|
+
var import_core23 = require("@deck.gl/core");
|
|
3079
|
+
var import_core24 = require("@luma.gl/core");
|
|
2591
3080
|
var import_preact20 = require("preact");
|
|
2592
3081
|
var import_hooks7 = require("preact/hooks");
|
|
2593
3082
|
var DEFAULT_COUNT_FORMATTER = (stat) => `${stat.name}: ${stat.count}`;
|
|
@@ -2605,7 +3094,7 @@ var DEFAULT_FORMATTERS = {
|
|
|
2605
3094
|
fps: (stat) => `${stat.name}: ${Math.round(stat.getHz())}fps`,
|
|
2606
3095
|
memory: (stat) => `${stat.name}: ${formatMemory(stat.count)}`
|
|
2607
3096
|
};
|
|
2608
|
-
var StatsWidget = class extends
|
|
3097
|
+
var StatsWidget = class extends import_core23.Widget {
|
|
2609
3098
|
/**
|
|
2610
3099
|
* Returns the current expanded state.
|
|
2611
3100
|
* In controlled mode, returns the expanded prop.
|
|
@@ -2695,7 +3184,7 @@ var StatsWidget = class extends import_core22.Widget {
|
|
|
2695
3184
|
const metrics = ((_a = this.deck) == null ? void 0 : _a.metrics) ?? {};
|
|
2696
3185
|
return Object.entries(metrics);
|
|
2697
3186
|
case "luma":
|
|
2698
|
-
return Array.from(
|
|
3187
|
+
return Array.from(import_core24.luma.stats.stats.values())[0];
|
|
2699
3188
|
case "device":
|
|
2700
3189
|
const device = (_b = this.deck) == null ? void 0 : _b.device;
|
|
2701
3190
|
const stats = device == null ? void 0 : device.statsManager.stats.values();
|
|
@@ -2732,7 +3221,7 @@ var StatsWidget = class extends import_core22.Widget {
|
|
|
2732
3221
|
}
|
|
2733
3222
|
};
|
|
2734
3223
|
StatsWidget.defaultProps = {
|
|
2735
|
-
...
|
|
3224
|
+
...import_core23.Widget.defaultProps,
|
|
2736
3225
|
type: "deck",
|
|
2737
3226
|
placement: "top-left",
|
|
2738
3227
|
viewId: null,
|