@nswds/app 1.85.0 → 1.86.0
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 +167 -135
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +168 -137
- 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",
|
|
@@ -17547,7 +17557,7 @@ function FormatToggle({ format, setFormat }) {
|
|
|
17547
17557
|
|
|
17548
17558
|
// package.json
|
|
17549
17559
|
var package_default = {
|
|
17550
|
-
version: "1.
|
|
17560
|
+
version: "1.85.1"};
|
|
17551
17561
|
var SluggerContext = React5__namespace.default.createContext(null);
|
|
17552
17562
|
function flattenText(nodes) {
|
|
17553
17563
|
if (nodes == null || typeof nodes === "boolean") return "";
|
|
@@ -18864,13 +18874,14 @@ function useSelectorHeight(selector = "header") {
|
|
|
18864
18874
|
const element = document.querySelector(selector);
|
|
18865
18875
|
if (!element) return;
|
|
18866
18876
|
elementRef.current = element;
|
|
18867
|
-
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
|
|
18871
|
-
|
|
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);
|
|
18872
18882
|
});
|
|
18873
|
-
resizeObserverRef.current
|
|
18883
|
+
resizeObserverRef.current = resizeObserver;
|
|
18884
|
+
resizeObserver.observe(element);
|
|
18874
18885
|
return () => {
|
|
18875
18886
|
resizeObserverRef.current?.disconnect();
|
|
18876
18887
|
};
|
|
@@ -26128,6 +26139,7 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26128
26139
|
this.treeScale = { x: 1, y: 1 };
|
|
26129
26140
|
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
26130
26141
|
this.hasTreeAnimated = false;
|
|
26142
|
+
this.layoutVersion = 0;
|
|
26131
26143
|
this.updateScheduled = false;
|
|
26132
26144
|
this.scheduleUpdate = () => this.update();
|
|
26133
26145
|
this.projectionUpdateScheduled = false;
|
|
@@ -26145,6 +26157,7 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26145
26157
|
this.nodes.forEach(cleanDirtyNodes);
|
|
26146
26158
|
};
|
|
26147
26159
|
this.resolvedRelativeTargetAt = 0;
|
|
26160
|
+
this.linkedParentVersion = 0;
|
|
26148
26161
|
this.hasProjected = false;
|
|
26149
26162
|
this.isVisible = true;
|
|
26150
26163
|
this.animationProgress = 0;
|
|
@@ -26400,6 +26413,7 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26400
26413
|
}
|
|
26401
26414
|
const prevLayout = this.layout;
|
|
26402
26415
|
this.layout = this.measure(false);
|
|
26416
|
+
this.layoutVersion++;
|
|
26403
26417
|
this.layoutCorrected = createBox();
|
|
26404
26418
|
this.isLayoutDirty = false;
|
|
26405
26419
|
this.projectionDelta = void 0;
|
|
@@ -26567,17 +26581,15 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26567
26581
|
if (!this.layout || !(layout2 || layoutId))
|
|
26568
26582
|
return;
|
|
26569
26583
|
this.resolvedRelativeTargetAt = frameData.timestamp;
|
|
26584
|
+
const relativeParent = this.getClosestProjectingParent();
|
|
26585
|
+
if (relativeParent && this.linkedParentVersion !== relativeParent.layoutVersion && !relativeParent.options.layoutRoot) {
|
|
26586
|
+
this.removeRelativeTarget();
|
|
26587
|
+
}
|
|
26570
26588
|
if (!this.targetDelta && !this.relativeTarget) {
|
|
26571
|
-
|
|
26572
|
-
|
|
26573
|
-
this.relativeParent = relativeParent;
|
|
26574
|
-
this.forceRelativeParentToResolveTarget();
|
|
26575
|
-
this.relativeTarget = createBox();
|
|
26576
|
-
this.relativeTargetOrigin = createBox();
|
|
26577
|
-
calcRelativePosition(this.relativeTargetOrigin, this.layout.layoutBox, relativeParent.layout.layoutBox);
|
|
26578
|
-
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
26589
|
+
if (relativeParent && relativeParent.layout) {
|
|
26590
|
+
this.createRelativeTarget(relativeParent, this.layout.layoutBox, relativeParent.layout.layoutBox);
|
|
26579
26591
|
} else {
|
|
26580
|
-
this.
|
|
26592
|
+
this.removeRelativeTarget();
|
|
26581
26593
|
}
|
|
26582
26594
|
}
|
|
26583
26595
|
if (!this.relativeTarget && !this.targetDelta)
|
|
@@ -26601,14 +26613,8 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26601
26613
|
}
|
|
26602
26614
|
if (this.attemptToResolveRelativeTarget) {
|
|
26603
26615
|
this.attemptToResolveRelativeTarget = false;
|
|
26604
|
-
const relativeParent = this.getClosestProjectingParent();
|
|
26605
26616
|
if (relativeParent && Boolean(relativeParent.resumingFrom) === Boolean(this.resumingFrom) && !relativeParent.options.layoutScroll && relativeParent.target && this.animationProgress !== 1) {
|
|
26606
|
-
this.relativeParent
|
|
26607
|
-
this.forceRelativeParentToResolveTarget();
|
|
26608
|
-
this.relativeTarget = createBox();
|
|
26609
|
-
this.relativeTargetOrigin = createBox();
|
|
26610
|
-
calcRelativePosition(this.relativeTargetOrigin, this.target, relativeParent.target);
|
|
26611
|
-
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
26617
|
+
this.createRelativeTarget(relativeParent, this.target, relativeParent.target);
|
|
26612
26618
|
} else {
|
|
26613
26619
|
this.relativeParent = this.relativeTarget = void 0;
|
|
26614
26620
|
}
|
|
@@ -26627,6 +26633,18 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26627
26633
|
isProjecting() {
|
|
26628
26634
|
return Boolean((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
|
|
26629
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
|
+
}
|
|
26630
26648
|
calcProjection() {
|
|
26631
26649
|
const lead = this.getLead();
|
|
26632
26650
|
const isShared = Boolean(this.resumingFrom) || this !== lead;
|
|
@@ -29051,9 +29069,9 @@ function SidebarMenuSkeleton({
|
|
|
29051
29069
|
showIcon = false,
|
|
29052
29070
|
...props
|
|
29053
29071
|
}) {
|
|
29054
|
-
const width = React5__namespace.
|
|
29072
|
+
const [width] = React5__namespace.useState(() => {
|
|
29055
29073
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
29056
|
-
}
|
|
29074
|
+
});
|
|
29057
29075
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29058
29076
|
"div",
|
|
29059
29077
|
{
|
|
@@ -30395,66 +30413,47 @@ function ThemeColorPaletteLoading() {
|
|
|
30395
30413
|
] }, i)) })
|
|
30396
30414
|
] });
|
|
30397
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
|
+
}
|
|
30398
30438
|
function ThemeColorPaletteContent() {
|
|
30399
30439
|
const searchParams = navigation.useSearchParams();
|
|
30400
30440
|
const baseColors = {
|
|
30401
30441
|
brand,
|
|
30402
30442
|
aboriginal
|
|
30403
30443
|
};
|
|
30444
|
+
const {
|
|
30445
|
+
themeCategory: initialThemeCategory,
|
|
30446
|
+
primaryColor: initialPrimaryColor,
|
|
30447
|
+
accentColor: initialAccentColor,
|
|
30448
|
+
greyColor: initialGreyColor
|
|
30449
|
+
} = getInitialThemeState(searchParams);
|
|
30404
30450
|
const [format, setFormat] = React5.useState("hex");
|
|
30405
30451
|
const [viewMode, setViewMode] = React5.useState("grid");
|
|
30406
|
-
const [themeCategory, setThemeCategory] = React5.useState(
|
|
30407
|
-
const [primaryColor, setPrimaryColor] = React5.useState(
|
|
30408
|
-
const [accentColor, setAccentColor] = React5.useState(
|
|
30409
|
-
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);
|
|
30410
30456
|
const [sheetOpen, setSheetOpen] = React5.useState(false);
|
|
30411
|
-
const [isInitialized, setIsInitialized] = React5.useState(false);
|
|
30412
|
-
React5.useEffect(() => {
|
|
30413
|
-
const themeParam = searchParams.get("theme");
|
|
30414
|
-
const primaryParam = searchParams.get("primary");
|
|
30415
|
-
const accentParam = searchParams.get("accent");
|
|
30416
|
-
const hasUrlParams = themeParam || primaryParam || accentParam;
|
|
30417
|
-
let newCategory = themeCategory;
|
|
30418
|
-
let newPrimary = primaryColor;
|
|
30419
|
-
let newAccent = accentColor;
|
|
30420
|
-
if (themeParam && (themeParam === "brand" || themeParam === "aboriginal")) {
|
|
30421
|
-
newCategory = themeParam;
|
|
30422
|
-
setThemeCategory(themeParam);
|
|
30423
|
-
}
|
|
30424
|
-
const availableColors = Object.keys(colorThemes[newCategory]);
|
|
30425
|
-
if (primaryParam && availableColors.includes(primaryParam)) {
|
|
30426
|
-
newPrimary = primaryParam;
|
|
30427
|
-
setPrimaryColor(primaryParam);
|
|
30428
|
-
} else if (!availableColors.includes(newPrimary)) {
|
|
30429
|
-
newPrimary = availableColors[0];
|
|
30430
|
-
setPrimaryColor(newPrimary);
|
|
30431
|
-
}
|
|
30432
|
-
if (accentParam && availableColors.includes(accentParam) && accentParam !== newPrimary) {
|
|
30433
|
-
newAccent = accentParam;
|
|
30434
|
-
setAccentColor(accentParam);
|
|
30435
|
-
} else if (hasUrlParams) {
|
|
30436
|
-
const newAccentColor = availableColors.find((color2) => color2 !== newPrimary);
|
|
30437
|
-
if (newAccentColor) {
|
|
30438
|
-
newAccent = newAccentColor;
|
|
30439
|
-
setAccentColor(newAccent);
|
|
30440
|
-
}
|
|
30441
|
-
} else {
|
|
30442
|
-
if (!availableColors.includes(newAccent) || newAccent === newPrimary) {
|
|
30443
|
-
const newAccentColor = availableColors.find((color2) => color2 !== newPrimary);
|
|
30444
|
-
if (newAccentColor) {
|
|
30445
|
-
newAccent = newAccentColor;
|
|
30446
|
-
setAccentColor(newAccent);
|
|
30447
|
-
}
|
|
30448
|
-
}
|
|
30449
|
-
}
|
|
30450
|
-
const neutralKey = Object.keys(colorThemes[newCategory]).find(
|
|
30451
|
-
(k) => k.toLowerCase().includes("grey")
|
|
30452
|
-
);
|
|
30453
|
-
if (neutralKey) {
|
|
30454
|
-
setGreyColor(neutralKey);
|
|
30455
|
-
}
|
|
30456
|
-
setIsInitialized(true);
|
|
30457
|
-
}, [searchParams, themeCategory, primaryColor, accentColor]);
|
|
30458
30457
|
const filteredColorThemes = React5.useMemo(() => {
|
|
30459
30458
|
const filtered = {};
|
|
30460
30459
|
for (const category of Object.keys(colorThemes)) {
|
|
@@ -30470,27 +30469,41 @@ function ThemeColorPaletteContent() {
|
|
|
30470
30469
|
const allColors = Object.keys(filteredColorThemes[themeCategory]);
|
|
30471
30470
|
return allColors.filter((color2) => color2 !== primaryColor);
|
|
30472
30471
|
}, [filteredColorThemes, themeCategory, primaryColor]);
|
|
30473
|
-
|
|
30474
|
-
|
|
30475
|
-
const neutralKey = Object.keys(colorThemes[
|
|
30476
|
-
|
|
30477
|
-
|
|
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);
|
|
30478
30496
|
}
|
|
30479
|
-
|
|
30480
|
-
|
|
30481
|
-
|
|
30482
|
-
if (availableColors.length > 1) {
|
|
30483
|
-
setAccentColor(availableColors[1]);
|
|
30484
|
-
}
|
|
30497
|
+
};
|
|
30498
|
+
const handleAccentColorChange = (nextAccent) => {
|
|
30499
|
+
if (nextAccent === primaryColor) {
|
|
30485
30500
|
return;
|
|
30486
30501
|
}
|
|
30487
|
-
|
|
30488
|
-
|
|
30489
|
-
|
|
30490
|
-
|
|
30491
|
-
|
|
30492
|
-
}
|
|
30493
|
-
}, [themeCategory, primaryColor, accentColor, greyColor, isInitialized]);
|
|
30502
|
+
setAccentColor(nextAccent);
|
|
30503
|
+
};
|
|
30504
|
+
const handleGreyColorChange = (nextGrey) => {
|
|
30505
|
+
setGreyColor(nextGrey);
|
|
30506
|
+
};
|
|
30494
30507
|
const currentColorPalette = React5.useMemo(() => {
|
|
30495
30508
|
if (!colorThemes[themeCategory] || !colorThemes[themeCategory][primaryColor] || !colorThemes[themeCategory][accentColor]) {
|
|
30496
30509
|
return [
|
|
@@ -30558,13 +30571,13 @@ function ThemeColorPaletteContent() {
|
|
|
30558
30571
|
ThemeSelector,
|
|
30559
30572
|
{
|
|
30560
30573
|
themeCategory,
|
|
30561
|
-
setThemeCategory,
|
|
30574
|
+
setThemeCategory: handleThemeCategoryChange,
|
|
30562
30575
|
primaryColor,
|
|
30563
|
-
setPrimaryColor,
|
|
30576
|
+
setPrimaryColor: handlePrimaryColorChange,
|
|
30564
30577
|
accentColor,
|
|
30565
|
-
setAccentColor,
|
|
30578
|
+
setAccentColor: handleAccentColorChange,
|
|
30566
30579
|
greyColor,
|
|
30567
|
-
setGreyColor,
|
|
30580
|
+
setGreyColor: handleGreyColorChange,
|
|
30568
30581
|
availableAccentColors,
|
|
30569
30582
|
colorThemes: filteredColorThemes
|
|
30570
30583
|
}
|
|
@@ -30594,25 +30607,17 @@ var TocContext = React5.createContext({
|
|
|
30594
30607
|
setToc: () => {
|
|
30595
30608
|
}
|
|
30596
30609
|
});
|
|
30597
|
-
function
|
|
30610
|
+
function InnerTocProvider({ children }) {
|
|
30598
30611
|
const [toc, setToc] = React5.useState(true);
|
|
30599
|
-
const pathname = navigation.usePathname();
|
|
30600
|
-
const isInitialMount = React5.useRef(true);
|
|
30601
|
-
const tocExplicitlySet = React5.useRef(false);
|
|
30602
|
-
React5.useEffect(() => {
|
|
30603
|
-
if (isInitialMount.current) {
|
|
30604
|
-
isInitialMount.current = false;
|
|
30605
|
-
return;
|
|
30606
|
-
}
|
|
30607
|
-
tocExplicitlySet.current = false;
|
|
30608
|
-
setToc(true);
|
|
30609
|
-
}, [pathname]);
|
|
30610
30612
|
const handleSetToc = (value) => {
|
|
30611
|
-
tocExplicitlySet.current = true;
|
|
30612
30613
|
setToc(value);
|
|
30613
30614
|
};
|
|
30614
30615
|
return /* @__PURE__ */ jsxRuntime.jsx(TocContext.Provider, { value: { toc, setToc: handleSetToc }, children });
|
|
30615
30616
|
}
|
|
30617
|
+
function TocProvider({ children }) {
|
|
30618
|
+
const pathname = navigation.usePathname();
|
|
30619
|
+
return /* @__PURE__ */ jsxRuntime.jsx(InnerTocProvider, { children }, pathname);
|
|
30620
|
+
}
|
|
30616
30621
|
function useToc() {
|
|
30617
30622
|
return React5.useContext(TocContext);
|
|
30618
30623
|
}
|
|
@@ -31855,24 +31860,41 @@ var InlineCitationCarouselHeader = ({
|
|
|
31855
31860
|
...props
|
|
31856
31861
|
}
|
|
31857
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
|
+
};
|
|
31858
31892
|
var InlineCitationCarouselIndex = ({
|
|
31859
31893
|
children,
|
|
31860
31894
|
className,
|
|
31861
31895
|
...props
|
|
31862
31896
|
}) => {
|
|
31863
|
-
const
|
|
31864
|
-
const [current, setCurrent] = React5.useState(0);
|
|
31865
|
-
const [count, setCount] = React5.useState(0);
|
|
31866
|
-
React5.useEffect(() => {
|
|
31867
|
-
if (!api) {
|
|
31868
|
-
return;
|
|
31869
|
-
}
|
|
31870
|
-
setCount(api.scrollSnapList().length);
|
|
31871
|
-
setCurrent(api.selectedScrollSnap() + 1);
|
|
31872
|
-
api.on("select", () => {
|
|
31873
|
-
setCurrent(api.selectedScrollSnap() + 1);
|
|
31874
|
-
});
|
|
31875
|
-
}, [api]);
|
|
31897
|
+
const { current, count } = useCarouselIndex();
|
|
31876
31898
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
31877
31899
|
"div",
|
|
31878
31900
|
{
|
|
@@ -32792,17 +32814,18 @@ var Reasoning = React5.memo(
|
|
|
32792
32814
|
defaultProp: 0
|
|
32793
32815
|
});
|
|
32794
32816
|
const [hasAutoClosed, setHasAutoClosed] = React5.useState(false);
|
|
32795
|
-
const
|
|
32817
|
+
const startTimeRef = React5.useRef(null);
|
|
32796
32818
|
React5.useEffect(() => {
|
|
32797
32819
|
if (isStreaming) {
|
|
32798
|
-
if (
|
|
32799
|
-
|
|
32820
|
+
if (startTimeRef.current === null) {
|
|
32821
|
+
startTimeRef.current = Date.now();
|
|
32800
32822
|
}
|
|
32801
|
-
} else if (
|
|
32802
|
-
|
|
32803
|
-
|
|
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;
|
|
32804
32827
|
}
|
|
32805
|
-
}, [isStreaming,
|
|
32828
|
+
}, [isStreaming, setDuration]);
|
|
32806
32829
|
React5.useEffect(() => {
|
|
32807
32830
|
if (defaultOpen && !isStreaming && isOpen && !hasAutoClosed) {
|
|
32808
32831
|
const timer = setTimeout(() => {
|
|
@@ -33332,6 +33355,14 @@ function usePageHeadings() {
|
|
|
33332
33355
|
}, [pathname]);
|
|
33333
33356
|
return headings;
|
|
33334
33357
|
}
|
|
33358
|
+
function useStickyOffset(extraPadding = 0) {
|
|
33359
|
+
const headerHeight = useSelectorHeight("#nsw-header");
|
|
33360
|
+
const navigationHeight = useSelectorHeight("#nsw-main-navigation");
|
|
33361
|
+
return React5.useMemo(() => {
|
|
33362
|
+
const total = headerHeight + navigationHeight + extraPadding;
|
|
33363
|
+
return total > 0 ? total : 0;
|
|
33364
|
+
}, [extraPadding, headerHeight, navigationHeight]);
|
|
33365
|
+
}
|
|
33335
33366
|
function createFormStore(opts) {
|
|
33336
33367
|
const { storageKey, initialFormData, initialFormStatus } = opts;
|
|
33337
33368
|
return zustand.create()(
|
|
@@ -33885,6 +33916,7 @@ exports.usePageHeadings = usePageHeadings;
|
|
|
33885
33916
|
exports.usePromptInputAttachments = usePromptInputAttachments;
|
|
33886
33917
|
exports.useSelectorHeight = useSelectorHeight;
|
|
33887
33918
|
exports.useSidebar = useSidebar;
|
|
33919
|
+
exports.useStickyOffset = useStickyOffset;
|
|
33888
33920
|
exports.useToc = useToc;
|
|
33889
33921
|
//# sourceMappingURL=index.cjs.map
|
|
33890
33922
|
//# sourceMappingURL=index.cjs.map
|