@nswds/app 1.84.0 → 1.85.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/index.cjs +161 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +162 -138
- package/dist/index.js.map +1 -1
- package/dist/package.json +2 -4
- package/package.json +3 -5
package/dist/index.cjs
CHANGED
|
@@ -8041,8 +8041,18 @@ var formatNumber = (num) => {
|
|
|
8041
8041
|
};
|
|
8042
8042
|
var BarLabels = ({ values }) => {
|
|
8043
8043
|
const sumValues = React5__namespace.default.useMemo(() => sumNumericArray(values), [values]);
|
|
8044
|
-
|
|
8045
|
-
|
|
8044
|
+
const prefixSums = values.reduce((acc, val, idx) => {
|
|
8045
|
+
acc.push((acc[idx - 1] ?? 0) + val);
|
|
8046
|
+
return acc;
|
|
8047
|
+
}, []);
|
|
8048
|
+
let runningSum = 0;
|
|
8049
|
+
const sumConsecutiveHiddenLabelsArr = values.map(() => 0);
|
|
8050
|
+
values.forEach((widthPercentage, index) => {
|
|
8051
|
+
const prefixSum = prefixSums[index];
|
|
8052
|
+
const showLabel = (widthPercentage >= 0.1 * sumValues || runningSum >= 0.09 * sumValues) && sumValues - prefixSum >= 0.1 * sumValues && prefixSum >= 0.1 * sumValues && prefixSum < 0.9 * sumValues;
|
|
8053
|
+
sumConsecutiveHiddenLabelsArr[index] = runningSum;
|
|
8054
|
+
runningSum = showLabel ? 0 : runningSum + widthPercentage;
|
|
8055
|
+
});
|
|
8046
8056
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8047
8057
|
"div",
|
|
8048
8058
|
{
|
|
@@ -8055,9 +8065,9 @@ var BarLabels = ({ values }) => {
|
|
|
8055
8065
|
children: [
|
|
8056
8066
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute bottom-0 left-0 flex items-center", children: "0" }),
|
|
8057
8067
|
values.map((widthPercentage, index) => {
|
|
8058
|
-
prefixSum
|
|
8068
|
+
const prefixSum = prefixSums[index];
|
|
8069
|
+
const sumConsecutiveHiddenLabels = sumConsecutiveHiddenLabelsArr[index];
|
|
8059
8070
|
const showLabel = (widthPercentage >= 0.1 * sumValues || sumConsecutiveHiddenLabels >= 0.09 * sumValues) && sumValues - prefixSum >= 0.1 * sumValues && prefixSum >= 0.1 * sumValues && prefixSum < 0.9 * sumValues;
|
|
8060
|
-
sumConsecutiveHiddenLabels = showLabel ? 0 : sumConsecutiveHiddenLabels += widthPercentage;
|
|
8061
8071
|
const widthPositionLeft = getPositionLeft(widthPercentage, sumValues);
|
|
8062
8072
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8063
8073
|
"div",
|
|
@@ -16595,12 +16605,13 @@ function DataTable({
|
|
|
16595
16605
|
search,
|
|
16596
16606
|
toolbar,
|
|
16597
16607
|
columns,
|
|
16598
|
-
data
|
|
16608
|
+
data,
|
|
16609
|
+
initialSorting = []
|
|
16599
16610
|
}) {
|
|
16600
16611
|
const [rowSelection, setRowSelection] = React5__namespace.useState({});
|
|
16601
16612
|
const [columnVisibility, setColumnVisibility] = React5__namespace.useState({});
|
|
16602
16613
|
const [columnFilters, setColumnFilters] = React5__namespace.useState([]);
|
|
16603
|
-
const [sorting, setSorting] = React5__namespace.useState(
|
|
16614
|
+
const [sorting, setSorting] = React5__namespace.useState(initialSorting);
|
|
16604
16615
|
const [globalFilter, setGlobalFilter] = React5__namespace.useState("");
|
|
16605
16616
|
const table = reactTable.useReactTable({
|
|
16606
16617
|
data,
|
|
@@ -17546,7 +17557,7 @@ function FormatToggle({ format, setFormat }) {
|
|
|
17546
17557
|
|
|
17547
17558
|
// package.json
|
|
17548
17559
|
var package_default = {
|
|
17549
|
-
version: "1.
|
|
17560
|
+
version: "1.85.0"};
|
|
17550
17561
|
var SluggerContext = React5__namespace.default.createContext(null);
|
|
17551
17562
|
function flattenText(nodes) {
|
|
17552
17563
|
if (nodes == null || typeof nodes === "boolean") return "";
|
|
@@ -18863,13 +18874,14 @@ function useSelectorHeight(selector = "header") {
|
|
|
18863
18874
|
const element = document.querySelector(selector);
|
|
18864
18875
|
if (!element) return;
|
|
18865
18876
|
elementRef.current = element;
|
|
18866
|
-
|
|
18867
|
-
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
|
|
18877
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
18878
|
+
const entry = entries[0];
|
|
18879
|
+
const target = entry?.target ?? elementRef.current;
|
|
18880
|
+
if (!target) return;
|
|
18881
|
+
setHeight(target.offsetHeight);
|
|
18871
18882
|
});
|
|
18872
|
-
resizeObserverRef.current
|
|
18883
|
+
resizeObserverRef.current = resizeObserver;
|
|
18884
|
+
resizeObserver.observe(element);
|
|
18873
18885
|
return () => {
|
|
18874
18886
|
resizeObserverRef.current?.disconnect();
|
|
18875
18887
|
};
|
|
@@ -26127,6 +26139,7 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26127
26139
|
this.treeScale = { x: 1, y: 1 };
|
|
26128
26140
|
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
26129
26141
|
this.hasTreeAnimated = false;
|
|
26142
|
+
this.layoutVersion = 0;
|
|
26130
26143
|
this.updateScheduled = false;
|
|
26131
26144
|
this.scheduleUpdate = () => this.update();
|
|
26132
26145
|
this.projectionUpdateScheduled = false;
|
|
@@ -26144,6 +26157,7 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26144
26157
|
this.nodes.forEach(cleanDirtyNodes);
|
|
26145
26158
|
};
|
|
26146
26159
|
this.resolvedRelativeTargetAt = 0;
|
|
26160
|
+
this.linkedParentVersion = 0;
|
|
26147
26161
|
this.hasProjected = false;
|
|
26148
26162
|
this.isVisible = true;
|
|
26149
26163
|
this.animationProgress = 0;
|
|
@@ -26399,6 +26413,7 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26399
26413
|
}
|
|
26400
26414
|
const prevLayout = this.layout;
|
|
26401
26415
|
this.layout = this.measure(false);
|
|
26416
|
+
this.layoutVersion++;
|
|
26402
26417
|
this.layoutCorrected = createBox();
|
|
26403
26418
|
this.isLayoutDirty = false;
|
|
26404
26419
|
this.projectionDelta = void 0;
|
|
@@ -26566,17 +26581,15 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26566
26581
|
if (!this.layout || !(layout2 || layoutId))
|
|
26567
26582
|
return;
|
|
26568
26583
|
this.resolvedRelativeTargetAt = frameData.timestamp;
|
|
26584
|
+
const relativeParent = this.getClosestProjectingParent();
|
|
26585
|
+
if (relativeParent && this.linkedParentVersion !== relativeParent.layoutVersion && !relativeParent.options.layoutRoot) {
|
|
26586
|
+
this.removeRelativeTarget();
|
|
26587
|
+
}
|
|
26569
26588
|
if (!this.targetDelta && !this.relativeTarget) {
|
|
26570
|
-
|
|
26571
|
-
|
|
26572
|
-
this.relativeParent = relativeParent;
|
|
26573
|
-
this.forceRelativeParentToResolveTarget();
|
|
26574
|
-
this.relativeTarget = createBox();
|
|
26575
|
-
this.relativeTargetOrigin = createBox();
|
|
26576
|
-
calcRelativePosition(this.relativeTargetOrigin, this.layout.layoutBox, relativeParent.layout.layoutBox);
|
|
26577
|
-
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
26589
|
+
if (relativeParent && relativeParent.layout) {
|
|
26590
|
+
this.createRelativeTarget(relativeParent, this.layout.layoutBox, relativeParent.layout.layoutBox);
|
|
26578
26591
|
} else {
|
|
26579
|
-
this.
|
|
26592
|
+
this.removeRelativeTarget();
|
|
26580
26593
|
}
|
|
26581
26594
|
}
|
|
26582
26595
|
if (!this.relativeTarget && !this.targetDelta)
|
|
@@ -26600,14 +26613,8 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26600
26613
|
}
|
|
26601
26614
|
if (this.attemptToResolveRelativeTarget) {
|
|
26602
26615
|
this.attemptToResolveRelativeTarget = false;
|
|
26603
|
-
const relativeParent = this.getClosestProjectingParent();
|
|
26604
26616
|
if (relativeParent && Boolean(relativeParent.resumingFrom) === Boolean(this.resumingFrom) && !relativeParent.options.layoutScroll && relativeParent.target && this.animationProgress !== 1) {
|
|
26605
|
-
this.relativeParent
|
|
26606
|
-
this.forceRelativeParentToResolveTarget();
|
|
26607
|
-
this.relativeTarget = createBox();
|
|
26608
|
-
this.relativeTargetOrigin = createBox();
|
|
26609
|
-
calcRelativePosition(this.relativeTargetOrigin, this.target, relativeParent.target);
|
|
26610
|
-
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
26617
|
+
this.createRelativeTarget(relativeParent, this.target, relativeParent.target);
|
|
26611
26618
|
} else {
|
|
26612
26619
|
this.relativeParent = this.relativeTarget = void 0;
|
|
26613
26620
|
}
|
|
@@ -26626,6 +26633,18 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26626
26633
|
isProjecting() {
|
|
26627
26634
|
return Boolean((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
|
|
26628
26635
|
}
|
|
26636
|
+
createRelativeTarget(relativeParent, layout2, parentLayout) {
|
|
26637
|
+
this.relativeParent = relativeParent;
|
|
26638
|
+
this.linkedParentVersion = relativeParent.layoutVersion;
|
|
26639
|
+
this.forceRelativeParentToResolveTarget();
|
|
26640
|
+
this.relativeTarget = createBox();
|
|
26641
|
+
this.relativeTargetOrigin = createBox();
|
|
26642
|
+
calcRelativePosition(this.relativeTargetOrigin, layout2, parentLayout);
|
|
26643
|
+
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
26644
|
+
}
|
|
26645
|
+
removeRelativeTarget() {
|
|
26646
|
+
this.relativeParent = this.relativeTarget = void 0;
|
|
26647
|
+
}
|
|
26629
26648
|
calcProjection() {
|
|
26630
26649
|
const lead = this.getLead();
|
|
26631
26650
|
const isShared = Boolean(this.resumingFrom) || this !== lead;
|
|
@@ -29050,9 +29069,9 @@ function SidebarMenuSkeleton({
|
|
|
29050
29069
|
showIcon = false,
|
|
29051
29070
|
...props
|
|
29052
29071
|
}) {
|
|
29053
|
-
const width = React5__namespace.
|
|
29072
|
+
const [width] = React5__namespace.useState(() => {
|
|
29054
29073
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
29055
|
-
}
|
|
29074
|
+
});
|
|
29056
29075
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29057
29076
|
"div",
|
|
29058
29077
|
{
|
|
@@ -30394,66 +30413,47 @@ function ThemeColorPaletteLoading() {
|
|
|
30394
30413
|
] }, i)) })
|
|
30395
30414
|
] });
|
|
30396
30415
|
}
|
|
30416
|
+
function getInitialThemeState(searchParams) {
|
|
30417
|
+
const themeParam = searchParams.get("theme");
|
|
30418
|
+
const primaryParam = searchParams.get("primary");
|
|
30419
|
+
const accentParam = searchParams.get("accent");
|
|
30420
|
+
const themeCategory = themeParam === "aboriginal" ? "aboriginal" : "brand";
|
|
30421
|
+
let primaryColor = "blue";
|
|
30422
|
+
let accentColor = "red";
|
|
30423
|
+
const availableColors = Object.keys(colorThemes[themeCategory]);
|
|
30424
|
+
if (primaryParam && availableColors.includes(primaryParam)) {
|
|
30425
|
+
primaryColor = primaryParam;
|
|
30426
|
+
} else if (!availableColors.includes(primaryColor)) {
|
|
30427
|
+
primaryColor = availableColors[0];
|
|
30428
|
+
}
|
|
30429
|
+
if (accentParam && availableColors.includes(accentParam) && accentParam !== primaryColor) {
|
|
30430
|
+
accentColor = accentParam;
|
|
30431
|
+
} else {
|
|
30432
|
+
const newAccent = availableColors.find((c) => c !== primaryColor);
|
|
30433
|
+
if (newAccent) accentColor = newAccent;
|
|
30434
|
+
}
|
|
30435
|
+
const neutralKey = Object.keys(colorThemes[themeCategory]).find((k) => k.toLowerCase().includes("grey")) ?? "grey";
|
|
30436
|
+
return { themeCategory, primaryColor, accentColor, greyColor: neutralKey };
|
|
30437
|
+
}
|
|
30397
30438
|
function ThemeColorPaletteContent() {
|
|
30398
30439
|
const searchParams = navigation.useSearchParams();
|
|
30399
30440
|
const baseColors = {
|
|
30400
30441
|
brand,
|
|
30401
30442
|
aboriginal
|
|
30402
30443
|
};
|
|
30444
|
+
const {
|
|
30445
|
+
themeCategory: initialThemeCategory,
|
|
30446
|
+
primaryColor: initialPrimaryColor,
|
|
30447
|
+
accentColor: initialAccentColor,
|
|
30448
|
+
greyColor: initialGreyColor
|
|
30449
|
+
} = getInitialThemeState(searchParams);
|
|
30403
30450
|
const [format, setFormat] = React5.useState("hex");
|
|
30404
30451
|
const [viewMode, setViewMode] = React5.useState("grid");
|
|
30405
|
-
const [themeCategory, setThemeCategory] = React5.useState(
|
|
30406
|
-
const [primaryColor, setPrimaryColor] = React5.useState(
|
|
30407
|
-
const [accentColor, setAccentColor] = React5.useState(
|
|
30408
|
-
const [greyColor, setGreyColor] = React5.useState(
|
|
30452
|
+
const [themeCategory, setThemeCategory] = React5.useState(initialThemeCategory);
|
|
30453
|
+
const [primaryColor, setPrimaryColor] = React5.useState(initialPrimaryColor);
|
|
30454
|
+
const [accentColor, setAccentColor] = React5.useState(initialAccentColor);
|
|
30455
|
+
const [greyColor, setGreyColor] = React5.useState(initialGreyColor);
|
|
30409
30456
|
const [sheetOpen, setSheetOpen] = React5.useState(false);
|
|
30410
|
-
const [isInitialized, setIsInitialized] = React5.useState(false);
|
|
30411
|
-
React5.useEffect(() => {
|
|
30412
|
-
const themeParam = searchParams.get("theme");
|
|
30413
|
-
const primaryParam = searchParams.get("primary");
|
|
30414
|
-
const accentParam = searchParams.get("accent");
|
|
30415
|
-
const hasUrlParams = themeParam || primaryParam || accentParam;
|
|
30416
|
-
let newCategory = themeCategory;
|
|
30417
|
-
let newPrimary = primaryColor;
|
|
30418
|
-
let newAccent = accentColor;
|
|
30419
|
-
if (themeParam && (themeParam === "brand" || themeParam === "aboriginal")) {
|
|
30420
|
-
newCategory = themeParam;
|
|
30421
|
-
setThemeCategory(themeParam);
|
|
30422
|
-
}
|
|
30423
|
-
const availableColors = Object.keys(colorThemes[newCategory]);
|
|
30424
|
-
if (primaryParam && availableColors.includes(primaryParam)) {
|
|
30425
|
-
newPrimary = primaryParam;
|
|
30426
|
-
setPrimaryColor(primaryParam);
|
|
30427
|
-
} else if (!availableColors.includes(newPrimary)) {
|
|
30428
|
-
newPrimary = availableColors[0];
|
|
30429
|
-
setPrimaryColor(newPrimary);
|
|
30430
|
-
}
|
|
30431
|
-
if (accentParam && availableColors.includes(accentParam) && accentParam !== newPrimary) {
|
|
30432
|
-
newAccent = accentParam;
|
|
30433
|
-
setAccentColor(accentParam);
|
|
30434
|
-
} else if (hasUrlParams) {
|
|
30435
|
-
const newAccentColor = availableColors.find((color2) => color2 !== newPrimary);
|
|
30436
|
-
if (newAccentColor) {
|
|
30437
|
-
newAccent = newAccentColor;
|
|
30438
|
-
setAccentColor(newAccent);
|
|
30439
|
-
}
|
|
30440
|
-
} else {
|
|
30441
|
-
if (!availableColors.includes(newAccent) || newAccent === newPrimary) {
|
|
30442
|
-
const newAccentColor = availableColors.find((color2) => color2 !== newPrimary);
|
|
30443
|
-
if (newAccentColor) {
|
|
30444
|
-
newAccent = newAccentColor;
|
|
30445
|
-
setAccentColor(newAccent);
|
|
30446
|
-
}
|
|
30447
|
-
}
|
|
30448
|
-
}
|
|
30449
|
-
const neutralKey = Object.keys(colorThemes[newCategory]).find(
|
|
30450
|
-
(k) => k.toLowerCase().includes("grey")
|
|
30451
|
-
);
|
|
30452
|
-
if (neutralKey) {
|
|
30453
|
-
setGreyColor(neutralKey);
|
|
30454
|
-
}
|
|
30455
|
-
setIsInitialized(true);
|
|
30456
|
-
}, [searchParams, themeCategory, primaryColor, accentColor]);
|
|
30457
30457
|
const filteredColorThemes = React5.useMemo(() => {
|
|
30458
30458
|
const filtered = {};
|
|
30459
30459
|
for (const category of Object.keys(colorThemes)) {
|
|
@@ -30469,27 +30469,41 @@ function ThemeColorPaletteContent() {
|
|
|
30469
30469
|
const allColors = Object.keys(filteredColorThemes[themeCategory]);
|
|
30470
30470
|
return allColors.filter((color2) => color2 !== primaryColor);
|
|
30471
30471
|
}, [filteredColorThemes, themeCategory, primaryColor]);
|
|
30472
|
-
|
|
30473
|
-
|
|
30474
|
-
const neutralKey = Object.keys(colorThemes[
|
|
30475
|
-
|
|
30476
|
-
|
|
30472
|
+
const handleThemeCategoryChange = (nextCategory) => {
|
|
30473
|
+
const availableColors = Object.keys(colorThemes[nextCategory]);
|
|
30474
|
+
const neutralKey = Object.keys(colorThemes[nextCategory]).find((k) => k.toLowerCase().includes("grey")) ?? greyColor;
|
|
30475
|
+
let nextPrimary = primaryColor;
|
|
30476
|
+
if (!availableColors.includes(nextPrimary)) {
|
|
30477
|
+
nextPrimary = availableColors[0];
|
|
30478
|
+
}
|
|
30479
|
+
let nextAccent = accentColor;
|
|
30480
|
+
if (!availableColors.includes(nextAccent) || nextAccent === nextPrimary) {
|
|
30481
|
+
const newAccent = availableColors.find((c) => c !== nextPrimary);
|
|
30482
|
+
if (newAccent) nextAccent = newAccent;
|
|
30483
|
+
}
|
|
30484
|
+
setThemeCategory(nextCategory);
|
|
30485
|
+
setPrimaryColor(nextPrimary);
|
|
30486
|
+
setAccentColor(nextAccent);
|
|
30487
|
+
setGreyColor(neutralKey);
|
|
30488
|
+
};
|
|
30489
|
+
const handlePrimaryColorChange = (nextPrimary) => {
|
|
30490
|
+
if (nextPrimary === primaryColor) return;
|
|
30491
|
+
setPrimaryColor(nextPrimary);
|
|
30492
|
+
if (nextPrimary === accentColor) {
|
|
30493
|
+
const availableColors = Object.keys(colorThemes[themeCategory]);
|
|
30494
|
+
const newAccent = availableColors.find((c) => c !== nextPrimary);
|
|
30495
|
+
if (newAccent) setAccentColor(newAccent);
|
|
30477
30496
|
}
|
|
30478
|
-
|
|
30479
|
-
|
|
30480
|
-
|
|
30481
|
-
if (availableColors.length > 1) {
|
|
30482
|
-
setAccentColor(availableColors[1]);
|
|
30483
|
-
}
|
|
30497
|
+
};
|
|
30498
|
+
const handleAccentColorChange = (nextAccent) => {
|
|
30499
|
+
if (nextAccent === primaryColor) {
|
|
30484
30500
|
return;
|
|
30485
30501
|
}
|
|
30486
|
-
|
|
30487
|
-
|
|
30488
|
-
|
|
30489
|
-
|
|
30490
|
-
|
|
30491
|
-
}
|
|
30492
|
-
}, [themeCategory, primaryColor, accentColor, greyColor, isInitialized]);
|
|
30502
|
+
setAccentColor(nextAccent);
|
|
30503
|
+
};
|
|
30504
|
+
const handleGreyColorChange = (nextGrey) => {
|
|
30505
|
+
setGreyColor(nextGrey);
|
|
30506
|
+
};
|
|
30493
30507
|
const currentColorPalette = React5.useMemo(() => {
|
|
30494
30508
|
if (!colorThemes[themeCategory] || !colorThemes[themeCategory][primaryColor] || !colorThemes[themeCategory][accentColor]) {
|
|
30495
30509
|
return [
|
|
@@ -30557,13 +30571,13 @@ function ThemeColorPaletteContent() {
|
|
|
30557
30571
|
ThemeSelector,
|
|
30558
30572
|
{
|
|
30559
30573
|
themeCategory,
|
|
30560
|
-
setThemeCategory,
|
|
30574
|
+
setThemeCategory: handleThemeCategoryChange,
|
|
30561
30575
|
primaryColor,
|
|
30562
|
-
setPrimaryColor,
|
|
30576
|
+
setPrimaryColor: handlePrimaryColorChange,
|
|
30563
30577
|
accentColor,
|
|
30564
|
-
setAccentColor,
|
|
30578
|
+
setAccentColor: handleAccentColorChange,
|
|
30565
30579
|
greyColor,
|
|
30566
|
-
setGreyColor,
|
|
30580
|
+
setGreyColor: handleGreyColorChange,
|
|
30567
30581
|
availableAccentColors,
|
|
30568
30582
|
colorThemes: filteredColorThemes
|
|
30569
30583
|
}
|
|
@@ -30593,25 +30607,17 @@ var TocContext = React5.createContext({
|
|
|
30593
30607
|
setToc: () => {
|
|
30594
30608
|
}
|
|
30595
30609
|
});
|
|
30596
|
-
function
|
|
30610
|
+
function InnerTocProvider({ children }) {
|
|
30597
30611
|
const [toc, setToc] = React5.useState(true);
|
|
30598
|
-
const pathname = navigation.usePathname();
|
|
30599
|
-
const isInitialMount = React5.useRef(true);
|
|
30600
|
-
const tocExplicitlySet = React5.useRef(false);
|
|
30601
|
-
React5.useEffect(() => {
|
|
30602
|
-
if (isInitialMount.current) {
|
|
30603
|
-
isInitialMount.current = false;
|
|
30604
|
-
return;
|
|
30605
|
-
}
|
|
30606
|
-
tocExplicitlySet.current = false;
|
|
30607
|
-
setToc(true);
|
|
30608
|
-
}, [pathname]);
|
|
30609
30612
|
const handleSetToc = (value) => {
|
|
30610
|
-
tocExplicitlySet.current = true;
|
|
30611
30613
|
setToc(value);
|
|
30612
30614
|
};
|
|
30613
30615
|
return /* @__PURE__ */ jsxRuntime.jsx(TocContext.Provider, { value: { toc, setToc: handleSetToc }, children });
|
|
30614
30616
|
}
|
|
30617
|
+
function TocProvider({ children }) {
|
|
30618
|
+
const pathname = navigation.usePathname();
|
|
30619
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InnerTocProvider, { children }, pathname);
|
|
30620
|
+
}
|
|
30615
30621
|
function useToc() {
|
|
30616
30622
|
return React5.useContext(TocContext);
|
|
30617
30623
|
}
|
|
@@ -31854,24 +31860,41 @@ var InlineCitationCarouselHeader = ({
|
|
|
31854
31860
|
...props
|
|
31855
31861
|
}
|
|
31856
31862
|
);
|
|
31863
|
+
var useCarouselIndex = () => {
|
|
31864
|
+
const api = useCarouselApi();
|
|
31865
|
+
const subscribe = React5.useCallback(
|
|
31866
|
+
(callback) => {
|
|
31867
|
+
if (!api) {
|
|
31868
|
+
return () => {
|
|
31869
|
+
};
|
|
31870
|
+
}
|
|
31871
|
+
api.on("select", callback);
|
|
31872
|
+
api.on("reInit", callback);
|
|
31873
|
+
return () => {
|
|
31874
|
+
api.off("select", callback);
|
|
31875
|
+
api.off("reInit", callback);
|
|
31876
|
+
};
|
|
31877
|
+
},
|
|
31878
|
+
[api]
|
|
31879
|
+
);
|
|
31880
|
+
const getSnapshot = React5.useCallback(() => {
|
|
31881
|
+
if (!api) {
|
|
31882
|
+
return { current: 0, count: 0 };
|
|
31883
|
+
}
|
|
31884
|
+
return {
|
|
31885
|
+
current: api.selectedScrollSnap() + 1,
|
|
31886
|
+
count: api.scrollSnapList().length
|
|
31887
|
+
};
|
|
31888
|
+
}, [api]);
|
|
31889
|
+
const { current, count } = React5.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
31890
|
+
return { current, count };
|
|
31891
|
+
};
|
|
31857
31892
|
var InlineCitationCarouselIndex = ({
|
|
31858
31893
|
children,
|
|
31859
31894
|
className,
|
|
31860
31895
|
...props
|
|
31861
31896
|
}) => {
|
|
31862
|
-
const
|
|
31863
|
-
const [current, setCurrent] = React5.useState(0);
|
|
31864
|
-
const [count, setCount] = React5.useState(0);
|
|
31865
|
-
React5.useEffect(() => {
|
|
31866
|
-
if (!api) {
|
|
31867
|
-
return;
|
|
31868
|
-
}
|
|
31869
|
-
setCount(api.scrollSnapList().length);
|
|
31870
|
-
setCurrent(api.selectedScrollSnap() + 1);
|
|
31871
|
-
api.on("select", () => {
|
|
31872
|
-
setCurrent(api.selectedScrollSnap() + 1);
|
|
31873
|
-
});
|
|
31874
|
-
}, [api]);
|
|
31897
|
+
const { current, count } = useCarouselIndex();
|
|
31875
31898
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
31876
31899
|
"div",
|
|
31877
31900
|
{
|
|
@@ -32791,17 +32814,18 @@ var Reasoning = React5.memo(
|
|
|
32791
32814
|
defaultProp: 0
|
|
32792
32815
|
});
|
|
32793
32816
|
const [hasAutoClosed, setHasAutoClosed] = React5.useState(false);
|
|
32794
|
-
const
|
|
32817
|
+
const startTimeRef = React5.useRef(null);
|
|
32795
32818
|
React5.useEffect(() => {
|
|
32796
32819
|
if (isStreaming) {
|
|
32797
|
-
if (
|
|
32798
|
-
|
|
32820
|
+
if (startTimeRef.current === null) {
|
|
32821
|
+
startTimeRef.current = Date.now();
|
|
32799
32822
|
}
|
|
32800
|
-
} else if (
|
|
32801
|
-
|
|
32802
|
-
|
|
32823
|
+
} else if (startTimeRef.current !== null) {
|
|
32824
|
+
const elapsedSeconds = Math.ceil((Date.now() - startTimeRef.current) / MS_IN_S);
|
|
32825
|
+
setDuration(elapsedSeconds);
|
|
32826
|
+
startTimeRef.current = null;
|
|
32803
32827
|
}
|
|
32804
|
-
}, [isStreaming,
|
|
32828
|
+
}, [isStreaming, setDuration]);
|
|
32805
32829
|
React5.useEffect(() => {
|
|
32806
32830
|
if (defaultOpen && !isStreaming && isOpen && !hasAutoClosed) {
|
|
32807
32831
|
const timer = setTimeout(() => {
|