@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/dist.dev.js
CHANGED
|
@@ -88,7 +88,8 @@ var __exports__ = (() => {
|
|
|
88
88
|
_SimpleMenu: () => SimpleMenu,
|
|
89
89
|
_SplitterWidget: () => SplitterWidget,
|
|
90
90
|
_StatsWidget: () => StatsWidget,
|
|
91
|
-
_TimelineWidget: () => TimelineWidget
|
|
91
|
+
_TimelineWidget: () => TimelineWidget,
|
|
92
|
+
buildViewsFromViewLayout: () => buildViewsFromViewLayout
|
|
92
93
|
});
|
|
93
94
|
|
|
94
95
|
// ../core/bundle/peer-dependency.ts
|
|
@@ -724,12 +725,12 @@ var __exports__ = (() => {
|
|
|
724
725
|
}
|
|
725
726
|
handleZoomIn() {
|
|
726
727
|
for (const viewId of this.viewIds) {
|
|
727
|
-
this.handleZoom(viewId,
|
|
728
|
+
this.handleZoom(viewId, this.props.zoomStep);
|
|
728
729
|
}
|
|
729
730
|
}
|
|
730
731
|
handleZoomOut() {
|
|
731
732
|
for (const viewId of this.viewIds) {
|
|
732
|
-
this.handleZoom(viewId, -
|
|
733
|
+
this.handleZoom(viewId, -this.props.zoomStep);
|
|
733
734
|
}
|
|
734
735
|
}
|
|
735
736
|
};
|
|
@@ -739,6 +740,7 @@ var __exports__ = (() => {
|
|
|
739
740
|
placement: "top-left",
|
|
740
741
|
orientation: "vertical",
|
|
741
742
|
transitionDuration: 200,
|
|
743
|
+
zoomStep: 1,
|
|
742
744
|
zoomInLabel: "Zoom In",
|
|
743
745
|
zoomOutLabel: "Zoom Out",
|
|
744
746
|
zoomAxis: "all",
|
|
@@ -1731,17 +1733,534 @@ var __exports__ = (() => {
|
|
|
1731
1733
|
};
|
|
1732
1734
|
|
|
1733
1735
|
// src/splitter-widget.tsx
|
|
1736
|
+
var import_core11 = __toESM(require_core(), 1);
|
|
1737
|
+
|
|
1738
|
+
// src/view-layout/view-layout.ts
|
|
1734
1739
|
var import_core10 = __toESM(require_core(), 1);
|
|
1735
|
-
|
|
1740
|
+
var VIEW_LAYOUT_TYPES = /* @__PURE__ */ new Set(["row", "column", "overlay", "spacer"]);
|
|
1741
|
+
var VIEW_LAYOUT_ORIENTATIONS = /* @__PURE__ */ new Set(["horizontal", "vertical"]);
|
|
1742
|
+
function isViewLayout(child) {
|
|
1743
|
+
return Boolean(
|
|
1744
|
+
child && typeof child === "object" && !(child instanceof import_core10.View) && ("type" in child && VIEW_LAYOUT_TYPES.has(String(child.type)) || "orientation" in child && VIEW_LAYOUT_ORIENTATIONS.has(String(child.orientation)))
|
|
1745
|
+
);
|
|
1746
|
+
}
|
|
1747
|
+
function getViewLayoutType(item) {
|
|
1748
|
+
if ("orientation" in item) {
|
|
1749
|
+
return item.orientation === "horizontal" ? "row" : "column";
|
|
1750
|
+
}
|
|
1751
|
+
return item.type;
|
|
1752
|
+
}
|
|
1753
|
+
function getViewLayoutChildren(item) {
|
|
1754
|
+
return "views" in item ? item.views : item.children;
|
|
1755
|
+
}
|
|
1756
|
+
function assertViewLayout(item) {
|
|
1757
|
+
if (!item || typeof item !== "object") {
|
|
1758
|
+
throw new Error("ViewLayout must be an object.");
|
|
1759
|
+
}
|
|
1760
|
+
const type = getViewLayoutType(item);
|
|
1761
|
+
switch (type) {
|
|
1762
|
+
case "row":
|
|
1763
|
+
case "column":
|
|
1764
|
+
case "overlay": {
|
|
1765
|
+
const children = getViewLayoutChildren(item);
|
|
1766
|
+
if (!Array.isArray(children)) {
|
|
1767
|
+
throw new Error("ViewLayout requires a children or views array.");
|
|
1768
|
+
}
|
|
1769
|
+
if (isSplitLayoutItem(item) && item.splitId) {
|
|
1770
|
+
if (children.filter(Boolean).length < 2) {
|
|
1771
|
+
throw new Error("ViewLayout with splitId requires at least two children.");
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
children.forEach(assertViewLayoutChild);
|
|
1775
|
+
break;
|
|
1776
|
+
}
|
|
1777
|
+
case "spacer":
|
|
1778
|
+
break;
|
|
1779
|
+
default:
|
|
1780
|
+
throw new Error(`Unsupported view layout item: ${String(type)}`);
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
function isSplitLayoutItem(item) {
|
|
1784
|
+
const type = getViewLayoutType(item);
|
|
1785
|
+
return type === "row" || type === "column";
|
|
1786
|
+
}
|
|
1787
|
+
function assertViewLayoutChild(child) {
|
|
1788
|
+
if (!child) {
|
|
1789
|
+
return;
|
|
1790
|
+
}
|
|
1791
|
+
if (isViewLayout(child)) {
|
|
1792
|
+
assertViewLayout(child);
|
|
1793
|
+
return;
|
|
1794
|
+
}
|
|
1795
|
+
if (child instanceof import_core10.View) {
|
|
1796
|
+
return;
|
|
1797
|
+
}
|
|
1798
|
+
throw new Error("ViewLayout children must be deck.gl View instances or layout objects.");
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
// src/view-layout/build-views-from-view-layout.ts
|
|
1802
|
+
function buildViewsFromViewLayout(args) {
|
|
1803
|
+
assertViewLayout(args.layout);
|
|
1804
|
+
const rootRect = {
|
|
1805
|
+
x: 0,
|
|
1806
|
+
y: 0,
|
|
1807
|
+
width: Math.max(1, args.width),
|
|
1808
|
+
height: Math.max(1, args.height)
|
|
1809
|
+
};
|
|
1810
|
+
const previousViewsById = new Map(
|
|
1811
|
+
(args.previous?.views ?? []).map((view) => [getViewId(view), view]).filter((entry) => Boolean(entry[0]))
|
|
1812
|
+
);
|
|
1813
|
+
const outputViews = [];
|
|
1814
|
+
const rectsById = {};
|
|
1815
|
+
const splittersById = {};
|
|
1816
|
+
compileLayoutItem({
|
|
1817
|
+
item: args.layout,
|
|
1818
|
+
rect: rootRect,
|
|
1819
|
+
rootRect,
|
|
1820
|
+
outputViews,
|
|
1821
|
+
rectsById,
|
|
1822
|
+
splittersById,
|
|
1823
|
+
previousViewsById,
|
|
1824
|
+
splitValues: args.splitValues ?? {},
|
|
1825
|
+
viewPropsById: args.viewPropsById ?? {}
|
|
1826
|
+
});
|
|
1827
|
+
return {
|
|
1828
|
+
views: outputViews,
|
|
1829
|
+
rectsById,
|
|
1830
|
+
splittersById
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
function compileLayoutItem(args) {
|
|
1834
|
+
const { item } = args;
|
|
1835
|
+
const type = getViewLayoutType(item);
|
|
1836
|
+
switch (type) {
|
|
1837
|
+
case "row":
|
|
1838
|
+
compileStackLayout({
|
|
1839
|
+
...args,
|
|
1840
|
+
item,
|
|
1841
|
+
orientation: "row",
|
|
1842
|
+
children: getViewLayoutChildren(item)
|
|
1843
|
+
});
|
|
1844
|
+
return;
|
|
1845
|
+
case "column":
|
|
1846
|
+
compileStackLayout({
|
|
1847
|
+
...args,
|
|
1848
|
+
item,
|
|
1849
|
+
orientation: "column",
|
|
1850
|
+
children: getViewLayoutChildren(item)
|
|
1851
|
+
});
|
|
1852
|
+
return;
|
|
1853
|
+
case "overlay":
|
|
1854
|
+
compileOverlayLayout({
|
|
1855
|
+
...args,
|
|
1856
|
+
item,
|
|
1857
|
+
children: getViewLayoutChildren(item)
|
|
1858
|
+
});
|
|
1859
|
+
return;
|
|
1860
|
+
case "spacer":
|
|
1861
|
+
return;
|
|
1862
|
+
default:
|
|
1863
|
+
throw new Error(`Unsupported view layout item: ${String(type)}`);
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
function compileStackLayout(args) {
|
|
1867
|
+
const containerRect = applyInsets(args.rect, args.item.inset);
|
|
1868
|
+
const children = args.children.filter(isPresentChild);
|
|
1869
|
+
if (children.length === 0) {
|
|
1870
|
+
return;
|
|
1871
|
+
}
|
|
1872
|
+
const containerAxisLength = args.orientation === "row" ? containerRect.width : containerRect.height;
|
|
1873
|
+
const stackAxisConfig = getStackAxisConfig({
|
|
1874
|
+
children,
|
|
1875
|
+
containerAxisLength,
|
|
1876
|
+
item: args.item,
|
|
1877
|
+
orientation: args.orientation,
|
|
1878
|
+
splitValues: args.splitValues
|
|
1879
|
+
});
|
|
1880
|
+
let cursor = args.orientation === "row" ? containerRect.x : containerRect.y;
|
|
1881
|
+
for (const splitConfig of stackAxisConfig.splitConfigs) {
|
|
1882
|
+
args.splittersById[splitConfig.splitId] = {
|
|
1883
|
+
id: splitConfig.splitId,
|
|
1884
|
+
orientation: args.orientation === "row" ? "horizontal" : "vertical",
|
|
1885
|
+
x: containerRect.x / args.rootRect.width * 100,
|
|
1886
|
+
y: containerRect.y / args.rootRect.height * 100,
|
|
1887
|
+
width: containerRect.width / args.rootRect.width * 100,
|
|
1888
|
+
height: containerRect.height / args.rootRect.height * 100,
|
|
1889
|
+
split: splitConfig.split,
|
|
1890
|
+
minSplit: splitConfig.minSplit,
|
|
1891
|
+
maxSplit: splitConfig.maxSplit
|
|
1892
|
+
};
|
|
1893
|
+
}
|
|
1894
|
+
children.forEach((child, index) => {
|
|
1895
|
+
const childAxisLength = stackAxisConfig.childAxisLengths[index];
|
|
1896
|
+
const childRect = args.orientation === "row" ? {
|
|
1897
|
+
x: cursor,
|
|
1898
|
+
y: containerRect.y,
|
|
1899
|
+
width: childAxisLength,
|
|
1900
|
+
height: containerRect.height
|
|
1901
|
+
} : {
|
|
1902
|
+
x: containerRect.x,
|
|
1903
|
+
y: cursor,
|
|
1904
|
+
width: containerRect.width,
|
|
1905
|
+
height: childAxisLength
|
|
1906
|
+
};
|
|
1907
|
+
cursor += childAxisLength;
|
|
1908
|
+
compileLayoutChild({
|
|
1909
|
+
child,
|
|
1910
|
+
rect: childRect,
|
|
1911
|
+
rootRect: args.rootRect,
|
|
1912
|
+
outputViews: args.outputViews,
|
|
1913
|
+
rectsById: args.rectsById,
|
|
1914
|
+
splittersById: args.splittersById,
|
|
1915
|
+
previousViewsById: args.previousViewsById,
|
|
1916
|
+
splitValues: args.splitValues,
|
|
1917
|
+
viewPropsById: args.viewPropsById
|
|
1918
|
+
});
|
|
1919
|
+
});
|
|
1920
|
+
}
|
|
1921
|
+
function compileOverlayLayout(args) {
|
|
1922
|
+
const containerRect = applyInsets(args.rect, args.item.inset);
|
|
1923
|
+
args.children.filter(isPresentChild).forEach(
|
|
1924
|
+
(child) => compileLayoutChild({
|
|
1925
|
+
child,
|
|
1926
|
+
rect: containerRect,
|
|
1927
|
+
rootRect: args.rootRect,
|
|
1928
|
+
outputViews: args.outputViews,
|
|
1929
|
+
rectsById: args.rectsById,
|
|
1930
|
+
splittersById: args.splittersById,
|
|
1931
|
+
previousViewsById: args.previousViewsById,
|
|
1932
|
+
splitValues: args.splitValues,
|
|
1933
|
+
viewPropsById: args.viewPropsById
|
|
1934
|
+
})
|
|
1935
|
+
);
|
|
1936
|
+
}
|
|
1937
|
+
function compileLayoutChild(args) {
|
|
1938
|
+
if (isViewLayout(args.child)) {
|
|
1939
|
+
compileLayoutItem({
|
|
1940
|
+
item: args.child,
|
|
1941
|
+
rect: args.rect,
|
|
1942
|
+
rootRect: args.rootRect,
|
|
1943
|
+
outputViews: args.outputViews,
|
|
1944
|
+
rectsById: args.rectsById,
|
|
1945
|
+
splittersById: args.splittersById,
|
|
1946
|
+
previousViewsById: args.previousViewsById,
|
|
1947
|
+
splitValues: args.splitValues,
|
|
1948
|
+
viewPropsById: args.viewPropsById
|
|
1949
|
+
});
|
|
1950
|
+
return;
|
|
1951
|
+
}
|
|
1952
|
+
compileResolvedView({
|
|
1953
|
+
view: args.child,
|
|
1954
|
+
rect: args.rect,
|
|
1955
|
+
outputViews: args.outputViews,
|
|
1956
|
+
rectsById: args.rectsById,
|
|
1957
|
+
previousViewsById: args.previousViewsById,
|
|
1958
|
+
viewPropsById: args.viewPropsById
|
|
1959
|
+
});
|
|
1960
|
+
}
|
|
1961
|
+
function getStackAxisConfig(args) {
|
|
1962
|
+
const constraints = args.children.map(
|
|
1963
|
+
(child) => getStackChildAxisConstraints(child, args.orientation, args.containerAxisLength)
|
|
1964
|
+
);
|
|
1965
|
+
if (args.item.splitId) {
|
|
1966
|
+
return getSplitStackAxisConfig({ ...args, constraints });
|
|
1967
|
+
}
|
|
1968
|
+
return {
|
|
1969
|
+
childAxisLengths: getConstrainedStackChildAxisLengths(args.containerAxisLength, constraints),
|
|
1970
|
+
splitConfigs: []
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
function getSplitStackAxisConfig(args) {
|
|
1974
|
+
const axisLength = Math.max(args.containerAxisLength, 1);
|
|
1975
|
+
const boundaries = getDefaultSplitBoundaries(args);
|
|
1976
|
+
const splitConfigs = [];
|
|
1977
|
+
for (let index = 0; index < boundaries.length; index++) {
|
|
1978
|
+
const splitId = getSplitId(args.item.splitId, args.children.length, index);
|
|
1979
|
+
const desiredSplit = args.splitValues[splitId] ?? (args.children.length === 2 ? args.item.initialSplit : void 0) ?? boundaries[index];
|
|
1980
|
+
const { minSplit, maxSplit } = getSplitBoundaryLimits({
|
|
1981
|
+
index,
|
|
1982
|
+
boundaries,
|
|
1983
|
+
constraints: args.constraints,
|
|
1984
|
+
axisLength,
|
|
1985
|
+
item: args.item
|
|
1986
|
+
});
|
|
1987
|
+
const split = Math.min(Math.max(desiredSplit, minSplit), maxSplit);
|
|
1988
|
+
boundaries[index] = split;
|
|
1989
|
+
splitConfigs.push({ splitId, split, minSplit, maxSplit });
|
|
1990
|
+
}
|
|
1991
|
+
return {
|
|
1992
|
+
childAxisLengths: getStackAxisLengthsFromBoundaries(args.containerAxisLength, boundaries),
|
|
1993
|
+
splitConfigs
|
|
1994
|
+
};
|
|
1995
|
+
}
|
|
1996
|
+
function getDefaultSplitBoundaries(args) {
|
|
1997
|
+
const childAxisLengths = getConstrainedStackChildAxisLengths(
|
|
1998
|
+
args.containerAxisLength,
|
|
1999
|
+
args.constraints
|
|
2000
|
+
);
|
|
2001
|
+
const totalLength = childAxisLengths.reduce((sum, length) => sum + length, 0);
|
|
2002
|
+
if (totalLength <= 0) {
|
|
2003
|
+
return args.children.slice(1).map((_3, index) => (index + 1) / args.children.length);
|
|
2004
|
+
}
|
|
2005
|
+
let cursor = 0;
|
|
2006
|
+
return childAxisLengths.slice(0, -1).map((length) => {
|
|
2007
|
+
cursor += length;
|
|
2008
|
+
return cursor / totalLength;
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
function getSplitBoundaryLimits(args) {
|
|
2012
|
+
const previousSplit = args.index === 0 ? 0 : args.boundaries[args.index - 1];
|
|
2013
|
+
const nextSplit = args.index === args.boundaries.length - 1 ? 1 : args.boundaries[args.index + 1];
|
|
2014
|
+
const leftConstraints = args.constraints[args.index];
|
|
2015
|
+
const rightConstraints = args.constraints[args.index + 1];
|
|
2016
|
+
const leftMaxSplit = Number.isFinite(leftConstraints.maxPixels) ? previousSplit + leftConstraints.maxPixels / args.axisLength : 1;
|
|
2017
|
+
const rightMaxSplit = Number.isFinite(rightConstraints.maxPixels) ? nextSplit - rightConstraints.maxPixels / args.axisLength : 0;
|
|
2018
|
+
const minSplit = Math.max(
|
|
2019
|
+
args.item.minSplit ?? 0.05,
|
|
2020
|
+
previousSplit + leftConstraints.minPixels / args.axisLength,
|
|
2021
|
+
rightMaxSplit
|
|
2022
|
+
);
|
|
2023
|
+
const maxSplit = Math.max(
|
|
2024
|
+
minSplit,
|
|
2025
|
+
Math.min(
|
|
2026
|
+
args.item.maxSplit ?? 0.95,
|
|
2027
|
+
nextSplit - rightConstraints.minPixels / args.axisLength,
|
|
2028
|
+
leftMaxSplit
|
|
2029
|
+
)
|
|
2030
|
+
);
|
|
2031
|
+
return { minSplit, maxSplit };
|
|
2032
|
+
}
|
|
2033
|
+
function getSplitId(splitId, childCount, index) {
|
|
2034
|
+
return childCount === 2 ? splitId : `${splitId}-${index}`;
|
|
2035
|
+
}
|
|
2036
|
+
function getStackAxisLengthsFromBoundaries(containerAxisLength, boundaries) {
|
|
2037
|
+
let previousBoundary = 0;
|
|
2038
|
+
const childAxisLengths = boundaries.map((boundary) => {
|
|
2039
|
+
const length = containerAxisLength * (boundary - previousBoundary);
|
|
2040
|
+
previousBoundary = boundary;
|
|
2041
|
+
return length;
|
|
2042
|
+
});
|
|
2043
|
+
childAxisLengths.push(containerAxisLength * (1 - previousBoundary));
|
|
2044
|
+
return childAxisLengths;
|
|
2045
|
+
}
|
|
2046
|
+
function getConstrainedStackChildAxisLengths(containerAxisLength, constraints) {
|
|
2047
|
+
const { childAxisLengths, flexibleChildIndexes, fixedLength } = getInitialStackChildAxisLengths(constraints);
|
|
2048
|
+
let remainingLength = Math.max(containerAxisLength - fixedLength, 0);
|
|
2049
|
+
let unsettledIndexes = flexibleChildIndexes;
|
|
2050
|
+
while (unsettledIndexes.length > 0) {
|
|
2051
|
+
const sharedLength = remainingLength / unsettledIndexes.length;
|
|
2052
|
+
const nextIndexes = [];
|
|
2053
|
+
let didClamp = false;
|
|
2054
|
+
for (const index of unsettledIndexes) {
|
|
2055
|
+
const { minPixels, maxPixels } = constraints[index];
|
|
2056
|
+
if (sharedLength < minPixels) {
|
|
2057
|
+
childAxisLengths[index] = minPixels;
|
|
2058
|
+
remainingLength -= minPixels;
|
|
2059
|
+
didClamp = true;
|
|
2060
|
+
} else if (sharedLength > maxPixels) {
|
|
2061
|
+
childAxisLengths[index] = maxPixels;
|
|
2062
|
+
remainingLength -= maxPixels;
|
|
2063
|
+
didClamp = true;
|
|
2064
|
+
} else {
|
|
2065
|
+
nextIndexes.push(index);
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
if (!didClamp) {
|
|
2069
|
+
for (const index of unsettledIndexes) {
|
|
2070
|
+
childAxisLengths[index] = sharedLength;
|
|
2071
|
+
}
|
|
2072
|
+
break;
|
|
2073
|
+
}
|
|
2074
|
+
unsettledIndexes = nextIndexes;
|
|
2075
|
+
}
|
|
2076
|
+
return childAxisLengths.map((length) => length ?? 0);
|
|
2077
|
+
}
|
|
2078
|
+
function getInitialStackChildAxisLengths(constraints) {
|
|
2079
|
+
const childAxisLengths = constraints.map(({ explicitLength }) => explicitLength);
|
|
2080
|
+
const flexibleChildIndexes = [];
|
|
2081
|
+
let fixedLength = 0;
|
|
2082
|
+
childAxisLengths.forEach((length, index) => {
|
|
2083
|
+
if (length === void 0) {
|
|
2084
|
+
flexibleChildIndexes.push(index);
|
|
2085
|
+
} else {
|
|
2086
|
+
fixedLength += length;
|
|
2087
|
+
}
|
|
2088
|
+
});
|
|
2089
|
+
return { childAxisLengths, flexibleChildIndexes, fixedLength };
|
|
2090
|
+
}
|
|
2091
|
+
function compileResolvedView(args) {
|
|
2092
|
+
const viewId = getRequiredViewId(args.view);
|
|
2093
|
+
const resolvedRect = resolveViewRectWithinParent(
|
|
2094
|
+
args.view,
|
|
2095
|
+
args.rect,
|
|
2096
|
+
args.viewPropsById[viewId]
|
|
2097
|
+
);
|
|
2098
|
+
args.rectsById[viewId] = resolvedRect;
|
|
2099
|
+
const nextProps = {
|
|
2100
|
+
...args.view.props,
|
|
2101
|
+
x: resolvedRect.x,
|
|
2102
|
+
y: resolvedRect.y,
|
|
2103
|
+
width: resolvedRect.width,
|
|
2104
|
+
height: resolvedRect.height
|
|
2105
|
+
};
|
|
2106
|
+
const previousView = args.previousViewsById.get(viewId);
|
|
2107
|
+
const nextView = previousView && previousView.constructor === args.view.constructor && arePropsEqual(previousView.props, nextProps) ? previousView : instantiateView(args.view, nextProps);
|
|
2108
|
+
args.outputViews.push(nextView);
|
|
2109
|
+
}
|
|
2110
|
+
function getStackChildAxisConstraints(child, orientation, parentAxisLength) {
|
|
2111
|
+
const axisValue = getAxisLengthValue(child, orientation);
|
|
2112
|
+
const minPixels = getPixelConstraintValue(child, "minPixels") ?? 0;
|
|
2113
|
+
const maxPixels = getPixelConstraintValue(child, "maxPixels") ?? Number.POSITIVE_INFINITY;
|
|
2114
|
+
if (axisValue === void 0) {
|
|
2115
|
+
return { minPixels, maxPixels };
|
|
2116
|
+
}
|
|
2117
|
+
const explicitLength = Math.min(
|
|
2118
|
+
Math.max(resolveLength(axisValue, parentAxisLength), minPixels),
|
|
2119
|
+
maxPixels
|
|
2120
|
+
);
|
|
2121
|
+
return { explicitLength, minPixels, maxPixels };
|
|
2122
|
+
}
|
|
2123
|
+
function resolveViewRectWithinParent(view, parentRect, overrides) {
|
|
2124
|
+
const props = { ...view.props, ...overrides };
|
|
2125
|
+
const x2 = parentRect.x + resolveOffset(props.x, parentRect.width);
|
|
2126
|
+
const y3 = parentRect.y + resolveOffset(props.y, parentRect.height);
|
|
2127
|
+
const width = resolveDimension(props.width, parentRect.width, parentRect.width);
|
|
2128
|
+
const height = resolveDimension(props.height, parentRect.height, parentRect.height);
|
|
2129
|
+
return {
|
|
2130
|
+
x: x2,
|
|
2131
|
+
y: y3,
|
|
2132
|
+
width,
|
|
2133
|
+
height
|
|
2134
|
+
};
|
|
2135
|
+
}
|
|
2136
|
+
function instantiateView(view, props) {
|
|
2137
|
+
const ViewConstructor = view.constructor;
|
|
2138
|
+
return new ViewConstructor(props);
|
|
2139
|
+
}
|
|
2140
|
+
function getAxisLengthValue(child, orientation) {
|
|
2141
|
+
if (isViewLayout(child)) {
|
|
2142
|
+
return orientation === "row" ? child.width : child.height;
|
|
2143
|
+
}
|
|
2144
|
+
const props = child.props;
|
|
2145
|
+
return orientation === "row" ? props.width : props.height;
|
|
2146
|
+
}
|
|
2147
|
+
function getPixelConstraintValue(child, propName) {
|
|
2148
|
+
const value = isViewLayout(child) ? child[propName] : child.props[propName];
|
|
2149
|
+
return typeof value === "number" ? value : void 0;
|
|
2150
|
+
}
|
|
2151
|
+
function applyInsets(rect, inset) {
|
|
2152
|
+
if (!inset) {
|
|
2153
|
+
return rect;
|
|
2154
|
+
}
|
|
2155
|
+
const top = inset.top ?? 0;
|
|
2156
|
+
const right = inset.right ?? 0;
|
|
2157
|
+
const bottom = inset.bottom ?? 0;
|
|
2158
|
+
const left = inset.left ?? 0;
|
|
2159
|
+
return {
|
|
2160
|
+
x: rect.x + left,
|
|
2161
|
+
y: rect.y + top,
|
|
2162
|
+
width: Math.max(0, rect.width - left - right),
|
|
2163
|
+
height: Math.max(0, rect.height - top - bottom)
|
|
2164
|
+
};
|
|
2165
|
+
}
|
|
2166
|
+
function resolveOffset(value, parentLength) {
|
|
2167
|
+
if (value === void 0 || value === null) {
|
|
2168
|
+
return 0;
|
|
2169
|
+
}
|
|
2170
|
+
return resolveLength(value, parentLength);
|
|
2171
|
+
}
|
|
2172
|
+
function resolveDimension(value, parentLength, fallback) {
|
|
2173
|
+
if (value === void 0 || value === null) {
|
|
2174
|
+
return fallback;
|
|
2175
|
+
}
|
|
2176
|
+
return resolveLength(value, parentLength);
|
|
2177
|
+
}
|
|
2178
|
+
function resolveLength(value, parentLength) {
|
|
2179
|
+
if (typeof value === "number") {
|
|
2180
|
+
return value;
|
|
2181
|
+
}
|
|
2182
|
+
const normalized = value.trim();
|
|
2183
|
+
if (normalized.length === 0) {
|
|
2184
|
+
throw new Error("View layout length must not be empty.");
|
|
2185
|
+
}
|
|
2186
|
+
if (normalized.startsWith("calc(") && normalized.endsWith(")")) {
|
|
2187
|
+
return resolveCalcExpression(normalized.slice(5, -1), parentLength);
|
|
2188
|
+
}
|
|
2189
|
+
return resolveLengthTerm(normalized, parentLength);
|
|
2190
|
+
}
|
|
2191
|
+
function resolveCalcExpression(expression, parentLength) {
|
|
2192
|
+
const sanitized = expression.replace(/\s+/g, "");
|
|
2193
|
+
const terms = sanitized.match(/[+-]?[^+-]+/g);
|
|
2194
|
+
if (!terms) {
|
|
2195
|
+
throw new Error(`Unsupported calc expression: calc(${expression})`);
|
|
2196
|
+
}
|
|
2197
|
+
return terms.reduce((sum, term) => sum + resolveLengthTerm(term, parentLength), 0);
|
|
2198
|
+
}
|
|
2199
|
+
function resolveLengthTerm(term, parentLength) {
|
|
2200
|
+
if (term.endsWith("%")) {
|
|
2201
|
+
return Number.parseFloat(term.slice(0, -1)) / 100 * parentLength;
|
|
2202
|
+
}
|
|
2203
|
+
if (term.endsWith("px")) {
|
|
2204
|
+
return Number.parseFloat(term.slice(0, -2));
|
|
2205
|
+
}
|
|
2206
|
+
return Number.parseFloat(term);
|
|
2207
|
+
}
|
|
2208
|
+
function getViewId(view) {
|
|
2209
|
+
const viewId = view.props.id;
|
|
2210
|
+
return typeof viewId === "string" && viewId.length > 0 ? viewId : null;
|
|
2211
|
+
}
|
|
2212
|
+
function getRequiredViewId(view) {
|
|
2213
|
+
const viewId = getViewId(view);
|
|
2214
|
+
if (!viewId) {
|
|
2215
|
+
throw new Error("Every compiled deck view must have a string id.");
|
|
2216
|
+
}
|
|
2217
|
+
return viewId;
|
|
2218
|
+
}
|
|
2219
|
+
function arePropsEqual(left, right) {
|
|
2220
|
+
if (left === right) {
|
|
2221
|
+
return true;
|
|
2222
|
+
}
|
|
2223
|
+
const leftKeys = Object.keys(left);
|
|
2224
|
+
const rightKeys = Object.keys(right);
|
|
2225
|
+
if (leftKeys.length !== rightKeys.length) {
|
|
2226
|
+
return false;
|
|
2227
|
+
}
|
|
2228
|
+
return leftKeys.every((key) => areValuesEqual(left[key], right[key]));
|
|
2229
|
+
}
|
|
2230
|
+
function areValuesEqual(left, right) {
|
|
2231
|
+
if (Object.is(left, right)) {
|
|
2232
|
+
return true;
|
|
2233
|
+
}
|
|
2234
|
+
if (Array.isArray(left) && Array.isArray(right)) {
|
|
2235
|
+
return left.length === right.length && left.every((value, index) => areValuesEqual(value, right[index]));
|
|
2236
|
+
}
|
|
2237
|
+
if (isPlainObject(left) && isPlainObject(right)) {
|
|
2238
|
+
const leftEntries = Object.keys(left);
|
|
2239
|
+
const rightEntries = Object.keys(right);
|
|
2240
|
+
return leftEntries.length === rightEntries.length && leftEntries.every((key) => areValuesEqual(left[key], right[key]));
|
|
2241
|
+
}
|
|
2242
|
+
return false;
|
|
2243
|
+
}
|
|
2244
|
+
function isPlainObject(value) {
|
|
2245
|
+
return Boolean(value) && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype;
|
|
2246
|
+
}
|
|
2247
|
+
function isPresentChild(child) {
|
|
2248
|
+
return Boolean(child);
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
// src/splitter-widget.tsx
|
|
2252
|
+
function adaptViewLayout(root) {
|
|
1736
2253
|
const layoutsById = [];
|
|
1737
|
-
const
|
|
1738
|
-
function
|
|
2254
|
+
const isViewLayout2 = (v3) => "views" in v3;
|
|
2255
|
+
function adaptLayout(l3) {
|
|
1739
2256
|
const id = layoutsById.length;
|
|
2257
|
+
const splitId = `splitter-${id}`;
|
|
1740
2258
|
const minSplit = l3.minSplit ?? 0.05;
|
|
1741
2259
|
const maxSplit = l3.maxSplit ?? 0.95;
|
|
1742
2260
|
const split = Math.min(Math.max(l3.initialSplit ?? 0.5, minSplit), maxSplit);
|
|
1743
2261
|
const managed = {
|
|
1744
2262
|
id,
|
|
2263
|
+
splitId,
|
|
1745
2264
|
orientation: l3.orientation,
|
|
1746
2265
|
views: l3.views,
|
|
1747
2266
|
split,
|
|
@@ -1754,83 +2273,77 @@ var __exports__ = (() => {
|
|
|
1754
2273
|
height: 0
|
|
1755
2274
|
};
|
|
1756
2275
|
layoutsById.push(managed);
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
const child1Y = y3;
|
|
1775
|
-
let child1Width = width;
|
|
1776
|
-
let child1Height = height;
|
|
1777
|
-
let child2X = x2;
|
|
1778
|
-
let child2Y = y3;
|
|
1779
|
-
let child2Width = width;
|
|
1780
|
-
let child2Height = height;
|
|
1781
|
-
if (l3.orientation === "horizontal") {
|
|
1782
|
-
child1Width = width * l3.split;
|
|
1783
|
-
child2X = x2 + child1Width;
|
|
1784
|
-
child2Width = width - child1Width;
|
|
1785
|
-
} else {
|
|
1786
|
-
child1Height = height * l3.split;
|
|
1787
|
-
child2Y = y3 + child1Height;
|
|
1788
|
-
child2Height = height - child1Height;
|
|
1789
|
-
}
|
|
1790
|
-
const [view1, view2] = l3.views;
|
|
1791
|
-
if ("views" in view1) {
|
|
1792
|
-
evaluateViewLayout(view1, child1X, child1Y, child1Width, child1Height);
|
|
1793
|
-
} else {
|
|
1794
|
-
views.push(
|
|
1795
|
-
view1.clone({
|
|
1796
|
-
x: `${child1X}%`,
|
|
1797
|
-
y: `${child1Y}%`,
|
|
1798
|
-
width: `${child1Width}%`,
|
|
1799
|
-
height: `${child1Height}%`
|
|
1800
|
-
})
|
|
1801
|
-
);
|
|
1802
|
-
}
|
|
1803
|
-
if ("views" in view2) {
|
|
1804
|
-
evaluateViewLayout(view2, child2X, child2Y, child2Width, child2Height);
|
|
1805
|
-
} else {
|
|
1806
|
-
views.push(
|
|
1807
|
-
view2.clone({
|
|
1808
|
-
x: `${child2X}%`,
|
|
1809
|
-
y: `${child2Y}%`,
|
|
1810
|
-
width: `${child2Width}%`,
|
|
1811
|
-
height: `${child2Height}%`
|
|
1812
|
-
})
|
|
1813
|
-
);
|
|
1814
|
-
}
|
|
2276
|
+
const childEntries = l3.views.map((view) => {
|
|
2277
|
+
if (!isViewLayout2(view)) {
|
|
2278
|
+
return { layout: view, managed: view };
|
|
2279
|
+
}
|
|
2280
|
+
const adapted = adaptLayout(view);
|
|
2281
|
+
return { layout: adapted.layout, managed: adapted.managed };
|
|
2282
|
+
});
|
|
2283
|
+
managed.views = [childEntries[0].managed, childEntries[1].managed];
|
|
2284
|
+
const layout2 = {
|
|
2285
|
+
orientation: l3.orientation,
|
|
2286
|
+
splitId,
|
|
2287
|
+
initialSplit: split,
|
|
2288
|
+
minSplit,
|
|
2289
|
+
maxSplit,
|
|
2290
|
+
views: [childEntries[0].layout, childEntries[1].layout]
|
|
2291
|
+
};
|
|
2292
|
+
return { layout: layout2, managed };
|
|
1815
2293
|
}
|
|
1816
|
-
|
|
1817
|
-
return
|
|
2294
|
+
const { layout } = adaptLayout(root);
|
|
2295
|
+
return { layout, viewLayouts: layoutsById };
|
|
2296
|
+
}
|
|
2297
|
+
function evaluateViews(layout, viewLayouts, splitValues) {
|
|
2298
|
+
const compiled = buildViewsFromViewLayout({
|
|
2299
|
+
layout,
|
|
2300
|
+
width: 100,
|
|
2301
|
+
height: 100,
|
|
2302
|
+
splitValues
|
|
2303
|
+
});
|
|
2304
|
+
for (const viewLayout of viewLayouts) {
|
|
2305
|
+
const splitter = compiled.splittersById[viewLayout.splitId];
|
|
2306
|
+
if (splitter) {
|
|
2307
|
+
viewLayout.x = splitter.x;
|
|
2308
|
+
viewLayout.y = splitter.y;
|
|
2309
|
+
viewLayout.width = splitter.width;
|
|
2310
|
+
viewLayout.height = splitter.height;
|
|
2311
|
+
viewLayout.split = splitter.split;
|
|
2312
|
+
viewLayout.minSplit = splitter.minSplit;
|
|
2313
|
+
viewLayout.maxSplit = splitter.maxSplit;
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
return compiled.views.map(
|
|
2317
|
+
(view) => view.clone({
|
|
2318
|
+
x: `${view.props.x}%`,
|
|
2319
|
+
y: `${view.props.y}%`,
|
|
2320
|
+
width: `${view.props.width}%`,
|
|
2321
|
+
height: `${view.props.height}%`
|
|
2322
|
+
})
|
|
2323
|
+
);
|
|
1818
2324
|
}
|
|
1819
|
-
var SplitterWidget = class extends
|
|
2325
|
+
var SplitterWidget = class extends import_core11.Widget {
|
|
1820
2326
|
constructor(props) {
|
|
1821
2327
|
super(props);
|
|
1822
2328
|
this.className = "deck-widget-splitter";
|
|
1823
2329
|
this.placement = "fill";
|
|
2330
|
+
this.splitValues = {};
|
|
1824
2331
|
this.needsUpdate = true;
|
|
1825
|
-
this.
|
|
2332
|
+
this.updateViewLayout(this.props.viewLayout);
|
|
1826
2333
|
}
|
|
1827
2334
|
setProps(props) {
|
|
1828
|
-
if (props.viewLayout && !(0,
|
|
1829
|
-
this.
|
|
2335
|
+
if (props.viewLayout && !(0, import_core11._deepEqual)(props.viewLayout, this.props.viewLayout, -1)) {
|
|
2336
|
+
this.updateViewLayout(props.viewLayout);
|
|
1830
2337
|
this.views = void 0;
|
|
1831
2338
|
}
|
|
1832
2339
|
super.setProps(props);
|
|
1833
2340
|
}
|
|
2341
|
+
updateViewLayout(viewLayout) {
|
|
2342
|
+
const adapted = adaptViewLayout(viewLayout);
|
|
2343
|
+
this.viewLayout = adapted.layout;
|
|
2344
|
+
this.viewLayouts = adapted.viewLayouts;
|
|
2345
|
+
this.splitValues = {};
|
|
2346
|
+
}
|
|
1834
2347
|
onRedraw() {
|
|
1835
2348
|
super.updateHTML();
|
|
1836
2349
|
}
|
|
@@ -1839,7 +2352,7 @@ var __exports__ = (() => {
|
|
|
1839
2352
|
// so we update deck props here and rerender DOM in the next onRedraw
|
|
1840
2353
|
updateHTML() {
|
|
1841
2354
|
if (!this.views) {
|
|
1842
|
-
this.views = evaluateViews(this.viewLayouts
|
|
2355
|
+
this.views = evaluateViews(this.viewLayout, this.viewLayouts, this.splitValues);
|
|
1843
2356
|
this.props.onChange(this.views.slice());
|
|
1844
2357
|
}
|
|
1845
2358
|
requestAnimationFrame(() => {
|
|
@@ -1861,8 +2374,8 @@ var __exports__ = (() => {
|
|
|
1861
2374
|
}
|
|
1862
2375
|
}
|
|
1863
2376
|
onChange(newSplit, layout) {
|
|
1864
|
-
|
|
1865
|
-
this.views = evaluateViews(this.viewLayouts
|
|
2377
|
+
this.splitValues = { ...this.splitValues, [layout.splitId]: newSplit };
|
|
2378
|
+
this.views = evaluateViews(this.viewLayout, this.viewLayouts, this.splitValues);
|
|
1866
2379
|
this.props.onChange(this.views.slice());
|
|
1867
2380
|
this.doUpdate();
|
|
1868
2381
|
}
|
|
@@ -1884,7 +2397,7 @@ var __exports__ = (() => {
|
|
|
1884
2397
|
}
|
|
1885
2398
|
};
|
|
1886
2399
|
SplitterWidget.defaultProps = {
|
|
1887
|
-
...
|
|
2400
|
+
...import_core11.Widget.defaultProps,
|
|
1888
2401
|
id: "splitter-widget",
|
|
1889
2402
|
viewLayout: void 0,
|
|
1890
2403
|
onChange: () => {
|
|
@@ -1963,7 +2476,7 @@ var __exports__ = (() => {
|
|
|
1963
2476
|
}
|
|
1964
2477
|
|
|
1965
2478
|
// src/info-widget.tsx
|
|
1966
|
-
var
|
|
2479
|
+
var import_core13 = __toESM(require_core(), 1);
|
|
1967
2480
|
|
|
1968
2481
|
// ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
1969
2482
|
var min = Math.min;
|
|
@@ -3504,7 +4017,7 @@ var __exports__ = (() => {
|
|
|
3504
4017
|
};
|
|
3505
4018
|
|
|
3506
4019
|
// src/info-widget.tsx
|
|
3507
|
-
var InfoWidget = class extends
|
|
4020
|
+
var InfoWidget = class extends import_core13.Widget {
|
|
3508
4021
|
constructor(props) {
|
|
3509
4022
|
super(props);
|
|
3510
4023
|
this.className = "deck-widget-info";
|
|
@@ -3531,11 +4044,13 @@ var __exports__ = (() => {
|
|
|
3531
4044
|
onHover(info) {
|
|
3532
4045
|
if (this.props.mode === "hover") {
|
|
3533
4046
|
this.tooltip = this._getTooltip(info);
|
|
4047
|
+
this.updateHTML();
|
|
3534
4048
|
}
|
|
3535
4049
|
}
|
|
3536
4050
|
onClick(info) {
|
|
3537
4051
|
if (this.props.mode === "click") {
|
|
3538
4052
|
this.tooltip = this._getTooltip(info);
|
|
4053
|
+
this.updateHTML();
|
|
3539
4054
|
}
|
|
3540
4055
|
}
|
|
3541
4056
|
_getTooltip(info) {
|
|
@@ -3593,7 +4108,7 @@ var __exports__ = (() => {
|
|
|
3593
4108
|
}
|
|
3594
4109
|
};
|
|
3595
4110
|
InfoWidget.defaultProps = {
|
|
3596
|
-
...
|
|
4111
|
+
...import_core13.Widget.defaultProps,
|
|
3597
4112
|
id: "info",
|
|
3598
4113
|
viewId: null,
|
|
3599
4114
|
mode: "hover",
|
|
@@ -3604,8 +4119,8 @@ var __exports__ = (() => {
|
|
|
3604
4119
|
};
|
|
3605
4120
|
|
|
3606
4121
|
// src/popup-widget.tsx
|
|
3607
|
-
var
|
|
3608
|
-
var PopupWidget = class extends
|
|
4122
|
+
var import_core14 = __toESM(require_core(), 1);
|
|
4123
|
+
var PopupWidget = class extends import_core14.Widget {
|
|
3609
4124
|
constructor(props) {
|
|
3610
4125
|
super(props);
|
|
3611
4126
|
this.className = "deck-widget-popup";
|
|
@@ -3690,7 +4205,7 @@ var __exports__ = (() => {
|
|
|
3690
4205
|
}
|
|
3691
4206
|
};
|
|
3692
4207
|
PopupWidget.defaultProps = {
|
|
3693
|
-
...
|
|
4208
|
+
...import_core14.Widget.defaultProps,
|
|
3694
4209
|
id: "info",
|
|
3695
4210
|
viewId: null,
|
|
3696
4211
|
position: [0, 0],
|
|
@@ -3707,8 +4222,8 @@ var __exports__ = (() => {
|
|
|
3707
4222
|
};
|
|
3708
4223
|
|
|
3709
4224
|
// src/context-menu-widget.tsx
|
|
3710
|
-
var
|
|
3711
|
-
var ContextMenuWidget = class extends
|
|
4225
|
+
var import_core15 = __toESM(require_core(), 1);
|
|
4226
|
+
var ContextMenuWidget = class extends import_core15.Widget {
|
|
3712
4227
|
constructor(props) {
|
|
3713
4228
|
super(props);
|
|
3714
4229
|
this.className = "deck-widget-context-menu";
|
|
@@ -3780,7 +4295,7 @@ var __exports__ = (() => {
|
|
|
3780
4295
|
}
|
|
3781
4296
|
};
|
|
3782
4297
|
ContextMenuWidget.defaultProps = {
|
|
3783
|
-
...
|
|
4298
|
+
...import_core15.Widget.defaultProps,
|
|
3784
4299
|
id: "context",
|
|
3785
4300
|
viewId: null,
|
|
3786
4301
|
menuItems: [],
|
|
@@ -3793,7 +4308,7 @@ var __exports__ = (() => {
|
|
|
3793
4308
|
};
|
|
3794
4309
|
|
|
3795
4310
|
// src/scrollbar-widget.tsx
|
|
3796
|
-
var
|
|
4311
|
+
var import_core16 = __toESM(require_core(), 1);
|
|
3797
4312
|
|
|
3798
4313
|
// src/lib/components/range-input.tsx
|
|
3799
4314
|
var wheelListenerOptions = { passive: false };
|
|
@@ -4146,7 +4661,7 @@ var __exports__ = (() => {
|
|
|
4146
4661
|
}
|
|
4147
4662
|
return value;
|
|
4148
4663
|
};
|
|
4149
|
-
var _ScrollbarWidget = class extends
|
|
4664
|
+
var _ScrollbarWidget = class extends import_core16.Widget {
|
|
4150
4665
|
constructor(props) {
|
|
4151
4666
|
const resolved = {
|
|
4152
4667
|
..._ScrollbarWidget.defaultProps,
|
|
@@ -4315,7 +4830,7 @@ var __exports__ = (() => {
|
|
|
4315
4830
|
};
|
|
4316
4831
|
var ScrollbarWidget = _ScrollbarWidget;
|
|
4317
4832
|
ScrollbarWidget.defaultProps = {
|
|
4318
|
-
...
|
|
4833
|
+
...import_core16.Widget.defaultProps,
|
|
4319
4834
|
contentBounds: null,
|
|
4320
4835
|
placement: "top-right",
|
|
4321
4836
|
viewId: null,
|
|
@@ -4340,8 +4855,8 @@ var __exports__ = (() => {
|
|
|
4340
4855
|
}
|
|
4341
4856
|
|
|
4342
4857
|
// src/icon-widget.tsx
|
|
4343
|
-
var
|
|
4344
|
-
var IconWidget = class extends
|
|
4858
|
+
var import_core17 = __toESM(require_core(), 1);
|
|
4859
|
+
var IconWidget = class extends import_core17.Widget {
|
|
4345
4860
|
constructor(props) {
|
|
4346
4861
|
super(props);
|
|
4347
4862
|
this.className = "";
|
|
@@ -4372,7 +4887,7 @@ var __exports__ = (() => {
|
|
|
4372
4887
|
}
|
|
4373
4888
|
};
|
|
4374
4889
|
IconWidget.defaultProps = {
|
|
4375
|
-
...
|
|
4890
|
+
...import_core17.Widget.defaultProps,
|
|
4376
4891
|
id: "icon",
|
|
4377
4892
|
placement: "top-left",
|
|
4378
4893
|
viewId: null,
|
|
@@ -4383,8 +4898,8 @@ var __exports__ = (() => {
|
|
|
4383
4898
|
};
|
|
4384
4899
|
|
|
4385
4900
|
// src/toggle-widget.tsx
|
|
4386
|
-
var
|
|
4387
|
-
var ToggleWidget = class extends
|
|
4901
|
+
var import_core18 = __toESM(require_core(), 1);
|
|
4902
|
+
var ToggleWidget = class extends import_core18.Widget {
|
|
4388
4903
|
constructor(props) {
|
|
4389
4904
|
super(props);
|
|
4390
4905
|
this.className = "deck-widget-toggle";
|
|
@@ -4432,7 +4947,7 @@ var __exports__ = (() => {
|
|
|
4432
4947
|
}
|
|
4433
4948
|
};
|
|
4434
4949
|
ToggleWidget.defaultProps = {
|
|
4435
|
-
...
|
|
4950
|
+
...import_core18.Widget.defaultProps,
|
|
4436
4951
|
id: "icon",
|
|
4437
4952
|
placement: "top-left",
|
|
4438
4953
|
viewId: null,
|
|
@@ -4447,8 +4962,8 @@ var __exports__ = (() => {
|
|
|
4447
4962
|
};
|
|
4448
4963
|
|
|
4449
4964
|
// src/selector-widget.tsx
|
|
4450
|
-
var
|
|
4451
|
-
var SelectorWidget = class extends
|
|
4965
|
+
var import_core19 = __toESM(require_core(), 1);
|
|
4966
|
+
var SelectorWidget = class extends import_core19.Widget {
|
|
4452
4967
|
constructor(props) {
|
|
4453
4968
|
super(props);
|
|
4454
4969
|
this.className = "deck-widget-selector";
|
|
@@ -4507,7 +5022,7 @@ var __exports__ = (() => {
|
|
|
4507
5022
|
}
|
|
4508
5023
|
};
|
|
4509
5024
|
SelectorWidget.defaultProps = {
|
|
4510
|
-
...
|
|
5025
|
+
...import_core19.Widget.defaultProps,
|
|
4511
5026
|
id: "view-selector",
|
|
4512
5027
|
placement: "top-left",
|
|
4513
5028
|
viewId: null,
|
|
@@ -4518,8 +5033,8 @@ var __exports__ = (() => {
|
|
|
4518
5033
|
};
|
|
4519
5034
|
|
|
4520
5035
|
// src/timeline-widget.tsx
|
|
4521
|
-
var
|
|
4522
|
-
var TimelineWidget = class extends
|
|
5036
|
+
var import_core20 = __toESM(require_core(), 1);
|
|
5037
|
+
var TimelineWidget = class extends import_core20.Widget {
|
|
4523
5038
|
constructor(props = {}) {
|
|
4524
5039
|
super(props);
|
|
4525
5040
|
this.id = "timeline";
|
|
@@ -4705,7 +5220,7 @@ var __exports__ = (() => {
|
|
|
4705
5220
|
}
|
|
4706
5221
|
};
|
|
4707
5222
|
TimelineWidget.defaultProps = {
|
|
4708
|
-
...
|
|
5223
|
+
...import_core20.Widget.defaultProps,
|
|
4709
5224
|
id: "timeline",
|
|
4710
5225
|
placement: "bottom-left",
|
|
4711
5226
|
viewId: null,
|
|
@@ -4726,8 +5241,8 @@ var __exports__ = (() => {
|
|
|
4726
5241
|
};
|
|
4727
5242
|
|
|
4728
5243
|
// src/screenshot-widget.tsx
|
|
4729
|
-
var
|
|
4730
|
-
var ScreenshotWidget = class extends
|
|
5244
|
+
var import_core21 = __toESM(require_core(), 1);
|
|
5245
|
+
var ScreenshotWidget = class extends import_core21.Widget {
|
|
4731
5246
|
constructor(props = {}) {
|
|
4732
5247
|
super(props);
|
|
4733
5248
|
this.className = "deck-widget-screenshot";
|
|
@@ -4776,7 +5291,7 @@ var __exports__ = (() => {
|
|
|
4776
5291
|
}
|
|
4777
5292
|
};
|
|
4778
5293
|
ScreenshotWidget.defaultProps = {
|
|
4779
|
-
...
|
|
5294
|
+
...import_core21.Widget.defaultProps,
|
|
4780
5295
|
id: "screenshot",
|
|
4781
5296
|
placement: "top-left",
|
|
4782
5297
|
viewId: null,
|
|
@@ -4787,8 +5302,8 @@ var __exports__ = (() => {
|
|
|
4787
5302
|
};
|
|
4788
5303
|
|
|
4789
5304
|
// src/theme-widget.tsx
|
|
4790
|
-
var import_core21 = __toESM(require_core(), 1);
|
|
4791
5305
|
var import_core22 = __toESM(require_core(), 1);
|
|
5306
|
+
var import_core23 = __toESM(require_core(), 1);
|
|
4792
5307
|
|
|
4793
5308
|
// src/themes.ts
|
|
4794
5309
|
var LightTheme = {
|
|
@@ -4905,7 +5420,7 @@ var __exports__ = (() => {
|
|
|
4905
5420
|
};
|
|
4906
5421
|
|
|
4907
5422
|
// src/theme-widget.tsx
|
|
4908
|
-
var ThemeWidget = class extends
|
|
5423
|
+
var ThemeWidget = class extends import_core23.Widget {
|
|
4909
5424
|
constructor(props = {}) {
|
|
4910
5425
|
super(props);
|
|
4911
5426
|
this.className = "deck-widget-theme";
|
|
@@ -4957,16 +5472,16 @@ var __exports__ = (() => {
|
|
|
4957
5472
|
/** Apply theme styling without changing internal state */
|
|
4958
5473
|
_applyTheme(themeMode, rootElement) {
|
|
4959
5474
|
const themeStyle = themeMode === "dark" ? this.props.darkModeTheme : this.props.lightModeTheme;
|
|
4960
|
-
if ((0,
|
|
5475
|
+
if ((0, import_core22._deepEqual)(themeStyle, this.appliedTheme, 1)) {
|
|
4961
5476
|
return;
|
|
4962
5477
|
}
|
|
4963
5478
|
const container = rootElement.closest(".deck-widget-container");
|
|
4964
5479
|
if (!container)
|
|
4965
5480
|
return;
|
|
4966
|
-
(0,
|
|
5481
|
+
(0, import_core22._applyStyles)(container, themeStyle);
|
|
4967
5482
|
this.appliedTheme = themeStyle;
|
|
4968
5483
|
const label = themeMode === "dark" ? this.props.darkModeLabel : this.props.lightModeLabel;
|
|
4969
|
-
|
|
5484
|
+
import_core22.log.log(1, `Switched theme to ${label}`, themeStyle)();
|
|
4970
5485
|
}
|
|
4971
5486
|
/** Read browser preference */
|
|
4972
5487
|
_getInitialThemeMode() {
|
|
@@ -4981,7 +5496,7 @@ var __exports__ = (() => {
|
|
|
4981
5496
|
}
|
|
4982
5497
|
};
|
|
4983
5498
|
ThemeWidget.defaultProps = {
|
|
4984
|
-
...
|
|
5499
|
+
...import_core23.Widget.defaultProps,
|
|
4985
5500
|
id: "theme",
|
|
4986
5501
|
placement: "top-left",
|
|
4987
5502
|
viewId: null,
|
|
@@ -4996,8 +5511,8 @@ var __exports__ = (() => {
|
|
|
4996
5511
|
};
|
|
4997
5512
|
|
|
4998
5513
|
// src/loading-widget.tsx
|
|
4999
|
-
var
|
|
5000
|
-
var LoadingWidget = class extends
|
|
5514
|
+
var import_core24 = __toESM(require_core(), 1);
|
|
5515
|
+
var LoadingWidget = class extends import_core24.Widget {
|
|
5001
5516
|
constructor(props = {}) {
|
|
5002
5517
|
super(props);
|
|
5003
5518
|
this.className = "deck-widget-loading";
|
|
@@ -5037,7 +5552,7 @@ var __exports__ = (() => {
|
|
|
5037
5552
|
}
|
|
5038
5553
|
};
|
|
5039
5554
|
LoadingWidget.defaultProps = {
|
|
5040
|
-
...
|
|
5555
|
+
...import_core24.Widget.defaultProps,
|
|
5041
5556
|
id: "loading",
|
|
5042
5557
|
placement: "top-left",
|
|
5043
5558
|
viewId: null,
|
|
@@ -5047,8 +5562,8 @@ var __exports__ = (() => {
|
|
|
5047
5562
|
};
|
|
5048
5563
|
|
|
5049
5564
|
// src/stats-widget.tsx
|
|
5050
|
-
var
|
|
5051
|
-
var
|
|
5565
|
+
var import_core25 = __toESM(require_core(), 1);
|
|
5566
|
+
var import_core26 = __toESM(require_core2(), 1);
|
|
5052
5567
|
var DEFAULT_COUNT_FORMATTER = (stat) => `${stat.name}: ${stat.count}`;
|
|
5053
5568
|
function formatTime(time) {
|
|
5054
5569
|
return time < 1e3 ? `${time.toFixed(2)}ms` : `${(time / 1e3).toFixed(2)}s`;
|
|
@@ -5064,7 +5579,7 @@ var __exports__ = (() => {
|
|
|
5064
5579
|
fps: (stat) => `${stat.name}: ${Math.round(stat.getHz())}fps`,
|
|
5065
5580
|
memory: (stat) => `${stat.name}: ${formatMemory(stat.count)}`
|
|
5066
5581
|
};
|
|
5067
|
-
var StatsWidget = class extends
|
|
5582
|
+
var StatsWidget = class extends import_core25.Widget {
|
|
5068
5583
|
constructor(props = {}) {
|
|
5069
5584
|
super(props);
|
|
5070
5585
|
this.className = "deck-widget-stats";
|
|
@@ -5171,7 +5686,7 @@ var __exports__ = (() => {
|
|
|
5171
5686
|
const metrics = this.deck?.metrics ?? {};
|
|
5172
5687
|
return Object.entries(metrics);
|
|
5173
5688
|
case "luma":
|
|
5174
|
-
return Array.from(
|
|
5689
|
+
return Array.from(import_core26.luma.stats.stats.values())[0];
|
|
5175
5690
|
case "device":
|
|
5176
5691
|
const device = this.deck?.device;
|
|
5177
5692
|
const stats = device?.statsManager.stats.values();
|
|
@@ -5207,7 +5722,7 @@ var __exports__ = (() => {
|
|
|
5207
5722
|
}
|
|
5208
5723
|
};
|
|
5209
5724
|
StatsWidget.defaultProps = {
|
|
5210
|
-
...
|
|
5725
|
+
...import_core25.Widget.defaultProps,
|
|
5211
5726
|
type: "deck",
|
|
5212
5727
|
placement: "top-left",
|
|
5213
5728
|
viewId: null,
|