@deck.gl/widgets 9.3.7 → 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 +628 -115
- package/dist/index.cjs +598 -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/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/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 };
|
|
1818
2296
|
}
|
|
1819
|
-
|
|
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
|
+
);
|
|
2324
|
+
}
|
|
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";
|
|
@@ -3595,7 +4108,7 @@ var __exports__ = (() => {
|
|
|
3595
4108
|
}
|
|
3596
4109
|
};
|
|
3597
4110
|
InfoWidget.defaultProps = {
|
|
3598
|
-
...
|
|
4111
|
+
...import_core13.Widget.defaultProps,
|
|
3599
4112
|
id: "info",
|
|
3600
4113
|
viewId: null,
|
|
3601
4114
|
mode: "hover",
|
|
@@ -3606,8 +4119,8 @@ var __exports__ = (() => {
|
|
|
3606
4119
|
};
|
|
3607
4120
|
|
|
3608
4121
|
// src/popup-widget.tsx
|
|
3609
|
-
var
|
|
3610
|
-
var PopupWidget = class extends
|
|
4122
|
+
var import_core14 = __toESM(require_core(), 1);
|
|
4123
|
+
var PopupWidget = class extends import_core14.Widget {
|
|
3611
4124
|
constructor(props) {
|
|
3612
4125
|
super(props);
|
|
3613
4126
|
this.className = "deck-widget-popup";
|
|
@@ -3692,7 +4205,7 @@ var __exports__ = (() => {
|
|
|
3692
4205
|
}
|
|
3693
4206
|
};
|
|
3694
4207
|
PopupWidget.defaultProps = {
|
|
3695
|
-
...
|
|
4208
|
+
...import_core14.Widget.defaultProps,
|
|
3696
4209
|
id: "info",
|
|
3697
4210
|
viewId: null,
|
|
3698
4211
|
position: [0, 0],
|
|
@@ -3709,8 +4222,8 @@ var __exports__ = (() => {
|
|
|
3709
4222
|
};
|
|
3710
4223
|
|
|
3711
4224
|
// src/context-menu-widget.tsx
|
|
3712
|
-
var
|
|
3713
|
-
var ContextMenuWidget = class extends
|
|
4225
|
+
var import_core15 = __toESM(require_core(), 1);
|
|
4226
|
+
var ContextMenuWidget = class extends import_core15.Widget {
|
|
3714
4227
|
constructor(props) {
|
|
3715
4228
|
super(props);
|
|
3716
4229
|
this.className = "deck-widget-context-menu";
|
|
@@ -3782,7 +4295,7 @@ var __exports__ = (() => {
|
|
|
3782
4295
|
}
|
|
3783
4296
|
};
|
|
3784
4297
|
ContextMenuWidget.defaultProps = {
|
|
3785
|
-
...
|
|
4298
|
+
...import_core15.Widget.defaultProps,
|
|
3786
4299
|
id: "context",
|
|
3787
4300
|
viewId: null,
|
|
3788
4301
|
menuItems: [],
|
|
@@ -3795,7 +4308,7 @@ var __exports__ = (() => {
|
|
|
3795
4308
|
};
|
|
3796
4309
|
|
|
3797
4310
|
// src/scrollbar-widget.tsx
|
|
3798
|
-
var
|
|
4311
|
+
var import_core16 = __toESM(require_core(), 1);
|
|
3799
4312
|
|
|
3800
4313
|
// src/lib/components/range-input.tsx
|
|
3801
4314
|
var wheelListenerOptions = { passive: false };
|
|
@@ -4148,7 +4661,7 @@ var __exports__ = (() => {
|
|
|
4148
4661
|
}
|
|
4149
4662
|
return value;
|
|
4150
4663
|
};
|
|
4151
|
-
var _ScrollbarWidget = class extends
|
|
4664
|
+
var _ScrollbarWidget = class extends import_core16.Widget {
|
|
4152
4665
|
constructor(props) {
|
|
4153
4666
|
const resolved = {
|
|
4154
4667
|
..._ScrollbarWidget.defaultProps,
|
|
@@ -4317,7 +4830,7 @@ var __exports__ = (() => {
|
|
|
4317
4830
|
};
|
|
4318
4831
|
var ScrollbarWidget = _ScrollbarWidget;
|
|
4319
4832
|
ScrollbarWidget.defaultProps = {
|
|
4320
|
-
...
|
|
4833
|
+
...import_core16.Widget.defaultProps,
|
|
4321
4834
|
contentBounds: null,
|
|
4322
4835
|
placement: "top-right",
|
|
4323
4836
|
viewId: null,
|
|
@@ -4342,8 +4855,8 @@ var __exports__ = (() => {
|
|
|
4342
4855
|
}
|
|
4343
4856
|
|
|
4344
4857
|
// src/icon-widget.tsx
|
|
4345
|
-
var
|
|
4346
|
-
var IconWidget = class extends
|
|
4858
|
+
var import_core17 = __toESM(require_core(), 1);
|
|
4859
|
+
var IconWidget = class extends import_core17.Widget {
|
|
4347
4860
|
constructor(props) {
|
|
4348
4861
|
super(props);
|
|
4349
4862
|
this.className = "";
|
|
@@ -4374,7 +4887,7 @@ var __exports__ = (() => {
|
|
|
4374
4887
|
}
|
|
4375
4888
|
};
|
|
4376
4889
|
IconWidget.defaultProps = {
|
|
4377
|
-
...
|
|
4890
|
+
...import_core17.Widget.defaultProps,
|
|
4378
4891
|
id: "icon",
|
|
4379
4892
|
placement: "top-left",
|
|
4380
4893
|
viewId: null,
|
|
@@ -4385,8 +4898,8 @@ var __exports__ = (() => {
|
|
|
4385
4898
|
};
|
|
4386
4899
|
|
|
4387
4900
|
// src/toggle-widget.tsx
|
|
4388
|
-
var
|
|
4389
|
-
var ToggleWidget = class extends
|
|
4901
|
+
var import_core18 = __toESM(require_core(), 1);
|
|
4902
|
+
var ToggleWidget = class extends import_core18.Widget {
|
|
4390
4903
|
constructor(props) {
|
|
4391
4904
|
super(props);
|
|
4392
4905
|
this.className = "deck-widget-toggle";
|
|
@@ -4434,7 +4947,7 @@ var __exports__ = (() => {
|
|
|
4434
4947
|
}
|
|
4435
4948
|
};
|
|
4436
4949
|
ToggleWidget.defaultProps = {
|
|
4437
|
-
...
|
|
4950
|
+
...import_core18.Widget.defaultProps,
|
|
4438
4951
|
id: "icon",
|
|
4439
4952
|
placement: "top-left",
|
|
4440
4953
|
viewId: null,
|
|
@@ -4449,8 +4962,8 @@ var __exports__ = (() => {
|
|
|
4449
4962
|
};
|
|
4450
4963
|
|
|
4451
4964
|
// src/selector-widget.tsx
|
|
4452
|
-
var
|
|
4453
|
-
var SelectorWidget = class extends
|
|
4965
|
+
var import_core19 = __toESM(require_core(), 1);
|
|
4966
|
+
var SelectorWidget = class extends import_core19.Widget {
|
|
4454
4967
|
constructor(props) {
|
|
4455
4968
|
super(props);
|
|
4456
4969
|
this.className = "deck-widget-selector";
|
|
@@ -4509,7 +5022,7 @@ var __exports__ = (() => {
|
|
|
4509
5022
|
}
|
|
4510
5023
|
};
|
|
4511
5024
|
SelectorWidget.defaultProps = {
|
|
4512
|
-
...
|
|
5025
|
+
...import_core19.Widget.defaultProps,
|
|
4513
5026
|
id: "view-selector",
|
|
4514
5027
|
placement: "top-left",
|
|
4515
5028
|
viewId: null,
|
|
@@ -4520,8 +5033,8 @@ var __exports__ = (() => {
|
|
|
4520
5033
|
};
|
|
4521
5034
|
|
|
4522
5035
|
// src/timeline-widget.tsx
|
|
4523
|
-
var
|
|
4524
|
-
var TimelineWidget = class extends
|
|
5036
|
+
var import_core20 = __toESM(require_core(), 1);
|
|
5037
|
+
var TimelineWidget = class extends import_core20.Widget {
|
|
4525
5038
|
constructor(props = {}) {
|
|
4526
5039
|
super(props);
|
|
4527
5040
|
this.id = "timeline";
|
|
@@ -4707,7 +5220,7 @@ var __exports__ = (() => {
|
|
|
4707
5220
|
}
|
|
4708
5221
|
};
|
|
4709
5222
|
TimelineWidget.defaultProps = {
|
|
4710
|
-
...
|
|
5223
|
+
...import_core20.Widget.defaultProps,
|
|
4711
5224
|
id: "timeline",
|
|
4712
5225
|
placement: "bottom-left",
|
|
4713
5226
|
viewId: null,
|
|
@@ -4728,8 +5241,8 @@ var __exports__ = (() => {
|
|
|
4728
5241
|
};
|
|
4729
5242
|
|
|
4730
5243
|
// src/screenshot-widget.tsx
|
|
4731
|
-
var
|
|
4732
|
-
var ScreenshotWidget = class extends
|
|
5244
|
+
var import_core21 = __toESM(require_core(), 1);
|
|
5245
|
+
var ScreenshotWidget = class extends import_core21.Widget {
|
|
4733
5246
|
constructor(props = {}) {
|
|
4734
5247
|
super(props);
|
|
4735
5248
|
this.className = "deck-widget-screenshot";
|
|
@@ -4778,7 +5291,7 @@ var __exports__ = (() => {
|
|
|
4778
5291
|
}
|
|
4779
5292
|
};
|
|
4780
5293
|
ScreenshotWidget.defaultProps = {
|
|
4781
|
-
...
|
|
5294
|
+
...import_core21.Widget.defaultProps,
|
|
4782
5295
|
id: "screenshot",
|
|
4783
5296
|
placement: "top-left",
|
|
4784
5297
|
viewId: null,
|
|
@@ -4789,8 +5302,8 @@ var __exports__ = (() => {
|
|
|
4789
5302
|
};
|
|
4790
5303
|
|
|
4791
5304
|
// src/theme-widget.tsx
|
|
4792
|
-
var import_core21 = __toESM(require_core(), 1);
|
|
4793
5305
|
var import_core22 = __toESM(require_core(), 1);
|
|
5306
|
+
var import_core23 = __toESM(require_core(), 1);
|
|
4794
5307
|
|
|
4795
5308
|
// src/themes.ts
|
|
4796
5309
|
var LightTheme = {
|
|
@@ -4907,7 +5420,7 @@ var __exports__ = (() => {
|
|
|
4907
5420
|
};
|
|
4908
5421
|
|
|
4909
5422
|
// src/theme-widget.tsx
|
|
4910
|
-
var ThemeWidget = class extends
|
|
5423
|
+
var ThemeWidget = class extends import_core23.Widget {
|
|
4911
5424
|
constructor(props = {}) {
|
|
4912
5425
|
super(props);
|
|
4913
5426
|
this.className = "deck-widget-theme";
|
|
@@ -4959,16 +5472,16 @@ var __exports__ = (() => {
|
|
|
4959
5472
|
/** Apply theme styling without changing internal state */
|
|
4960
5473
|
_applyTheme(themeMode, rootElement) {
|
|
4961
5474
|
const themeStyle = themeMode === "dark" ? this.props.darkModeTheme : this.props.lightModeTheme;
|
|
4962
|
-
if ((0,
|
|
5475
|
+
if ((0, import_core22._deepEqual)(themeStyle, this.appliedTheme, 1)) {
|
|
4963
5476
|
return;
|
|
4964
5477
|
}
|
|
4965
5478
|
const container = rootElement.closest(".deck-widget-container");
|
|
4966
5479
|
if (!container)
|
|
4967
5480
|
return;
|
|
4968
|
-
(0,
|
|
5481
|
+
(0, import_core22._applyStyles)(container, themeStyle);
|
|
4969
5482
|
this.appliedTheme = themeStyle;
|
|
4970
5483
|
const label = themeMode === "dark" ? this.props.darkModeLabel : this.props.lightModeLabel;
|
|
4971
|
-
|
|
5484
|
+
import_core22.log.log(1, `Switched theme to ${label}`, themeStyle)();
|
|
4972
5485
|
}
|
|
4973
5486
|
/** Read browser preference */
|
|
4974
5487
|
_getInitialThemeMode() {
|
|
@@ -4983,7 +5496,7 @@ var __exports__ = (() => {
|
|
|
4983
5496
|
}
|
|
4984
5497
|
};
|
|
4985
5498
|
ThemeWidget.defaultProps = {
|
|
4986
|
-
...
|
|
5499
|
+
...import_core23.Widget.defaultProps,
|
|
4987
5500
|
id: "theme",
|
|
4988
5501
|
placement: "top-left",
|
|
4989
5502
|
viewId: null,
|
|
@@ -4998,8 +5511,8 @@ var __exports__ = (() => {
|
|
|
4998
5511
|
};
|
|
4999
5512
|
|
|
5000
5513
|
// src/loading-widget.tsx
|
|
5001
|
-
var
|
|
5002
|
-
var LoadingWidget = class extends
|
|
5514
|
+
var import_core24 = __toESM(require_core(), 1);
|
|
5515
|
+
var LoadingWidget = class extends import_core24.Widget {
|
|
5003
5516
|
constructor(props = {}) {
|
|
5004
5517
|
super(props);
|
|
5005
5518
|
this.className = "deck-widget-loading";
|
|
@@ -5039,7 +5552,7 @@ var __exports__ = (() => {
|
|
|
5039
5552
|
}
|
|
5040
5553
|
};
|
|
5041
5554
|
LoadingWidget.defaultProps = {
|
|
5042
|
-
...
|
|
5555
|
+
...import_core24.Widget.defaultProps,
|
|
5043
5556
|
id: "loading",
|
|
5044
5557
|
placement: "top-left",
|
|
5045
5558
|
viewId: null,
|
|
@@ -5049,8 +5562,8 @@ var __exports__ = (() => {
|
|
|
5049
5562
|
};
|
|
5050
5563
|
|
|
5051
5564
|
// src/stats-widget.tsx
|
|
5052
|
-
var
|
|
5053
|
-
var
|
|
5565
|
+
var import_core25 = __toESM(require_core(), 1);
|
|
5566
|
+
var import_core26 = __toESM(require_core2(), 1);
|
|
5054
5567
|
var DEFAULT_COUNT_FORMATTER = (stat) => `${stat.name}: ${stat.count}`;
|
|
5055
5568
|
function formatTime(time) {
|
|
5056
5569
|
return time < 1e3 ? `${time.toFixed(2)}ms` : `${(time / 1e3).toFixed(2)}s`;
|
|
@@ -5066,7 +5579,7 @@ var __exports__ = (() => {
|
|
|
5066
5579
|
fps: (stat) => `${stat.name}: ${Math.round(stat.getHz())}fps`,
|
|
5067
5580
|
memory: (stat) => `${stat.name}: ${formatMemory(stat.count)}`
|
|
5068
5581
|
};
|
|
5069
|
-
var StatsWidget = class extends
|
|
5582
|
+
var StatsWidget = class extends import_core25.Widget {
|
|
5070
5583
|
constructor(props = {}) {
|
|
5071
5584
|
super(props);
|
|
5072
5585
|
this.className = "deck-widget-stats";
|
|
@@ -5173,7 +5686,7 @@ var __exports__ = (() => {
|
|
|
5173
5686
|
const metrics = this.deck?.metrics ?? {};
|
|
5174
5687
|
return Object.entries(metrics);
|
|
5175
5688
|
case "luma":
|
|
5176
|
-
return Array.from(
|
|
5689
|
+
return Array.from(import_core26.luma.stats.stats.values())[0];
|
|
5177
5690
|
case "device":
|
|
5178
5691
|
const device = this.deck?.device;
|
|
5179
5692
|
const stats = device?.statsManager.stats.values();
|
|
@@ -5209,7 +5722,7 @@ var __exports__ = (() => {
|
|
|
5209
5722
|
}
|
|
5210
5723
|
};
|
|
5211
5724
|
StatsWidget.defaultProps = {
|
|
5212
|
-
...
|
|
5725
|
+
...import_core25.Widget.defaultProps,
|
|
5213
5726
|
type: "deck",
|
|
5214
5727
|
placement: "top-left",
|
|
5215
5728
|
viewId: null,
|