@openpawlabs/diy-guides-ui 1.7.2 → 1.7.3
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/components/GuideLayout/GuideLayout.d.ts +4 -4
- package/dist/components/GuideLayout/GuideLayout.d.ts.map +1 -1
- package/dist/components/GuideLayout/GuideLayout.stories.d.ts +1 -1
- package/dist/components/GuideLayout/GuideLayout.stories.d.ts.map +1 -1
- package/dist/components/GuideStepList/GuideStepList.d.ts +2 -3
- package/dist/components/GuideStepList/GuideStepList.d.ts.map +1 -1
- package/dist/context/guideScrollMargin.d.ts +26 -7
- package/dist/context/guideScrollMargin.d.ts.map +1 -1
- package/dist/diy-guides-ui.cjs +6 -6
- package/dist/diy-guides-ui.cjs.map +1 -1
- package/dist/diy-guides-ui.js +2838 -2693
- package/dist/diy-guides-ui.js.map +1 -1
- package/dist/hooks/useGuideStepUrlSync.d.ts +8 -5
- package/dist/hooks/useGuideStepUrlSync.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/utils/pickActiveGuideStep.d.ts +32 -14
- package/dist/utils/pickActiveGuideStep.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -5,15 +5,18 @@ export interface UseGuideStepUrlSyncOptions {
|
|
|
5
5
|
rootRef: RefObject<HTMLElement | null>;
|
|
6
6
|
/** Overview anchor from `GuideLayout` — used when the URL has no step. */
|
|
7
7
|
guideTopRef?: RefObject<HTMLElement | null> | null;
|
|
8
|
+
/** Top of `GuideLayout.Content` — bounds the overview region for URL sync. */
|
|
9
|
+
guideContentRef?: RefObject<HTMLElement | null> | null;
|
|
8
10
|
stepNumbers: number[];
|
|
9
11
|
mode?: GuideStepUrlMode;
|
|
10
12
|
stepUrlKey?: string;
|
|
11
|
-
/**
|
|
13
|
+
/** Step scroll margin (px) — parent offset plus library progress-bar clearance. */
|
|
12
14
|
scrollMarginTop?: number;
|
|
15
|
+
/** Overview scroll margin (px) — parent offset only. */
|
|
16
|
+
overviewScrollMarginTop?: number;
|
|
13
17
|
/**
|
|
14
|
-
* Fraction of a
|
|
15
|
-
* to stay active.
|
|
16
|
-
* over. @default 0.2
|
|
18
|
+
* Fraction of a section's height that must remain visible below fixed chrome for
|
|
19
|
+
* it to stay active. Applies to the overview and steps alike. @default 0.2
|
|
17
20
|
*/
|
|
18
21
|
activeStepMinVisibleRatio?: number;
|
|
19
22
|
onActiveStepChange?: (step: number | null) => void;
|
|
@@ -22,5 +25,5 @@ export interface UseGuideStepUrlSyncOptions {
|
|
|
22
25
|
* Keeps the page URL in sync with the guide step in view and smooth-scrolls when
|
|
23
26
|
* the URL names a step (including on load and `hashchange`).
|
|
24
27
|
*/
|
|
25
|
-
export declare function useGuideStepUrlSync({ enabled, rootRef, guideTopRef, stepNumbers, mode, stepUrlKey, scrollMarginTop, activeStepMinVisibleRatio, onActiveStepChange, }: UseGuideStepUrlSyncOptions): void;
|
|
28
|
+
export declare function useGuideStepUrlSync({ enabled, rootRef, guideTopRef, guideContentRef, stepNumbers, mode, stepUrlKey, scrollMarginTop, overviewScrollMarginTop, activeStepMinVisibleRatio, onActiveStepChange, }: UseGuideStepUrlSyncOptions): void;
|
|
26
29
|
//# sourceMappingURL=useGuideStepUrlSync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGuideStepUrlSync.d.ts","sourceRoot":"","sources":["../../src/hooks/useGuideStepUrlSync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useGuideStepUrlSync.d.ts","sourceRoot":"","sources":["../../src/hooks/useGuideStepUrlSync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvE,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACvC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACnD,8EAA8E;IAC9E,eAAe,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACvD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wDAAwD;IACxD,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC;;;OAGG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACpD;AAgBD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,OAAO,EACP,WAAkB,EAClB,eAAsB,EACtB,WAAW,EACX,IAAa,EACb,UAAmB,EACnB,eAAmB,EACnB,uBAA2B,EAC3B,yBAA+B,EAC/B,kBAAkB,GACnB,EAAE,0BAA0B,QAoP5B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type { GuideStepProps, GuideStepBulletProps, GuideStepBulletVariant, Guid
|
|
|
17
17
|
export { GuideStepList } from "./components/GuideStepList";
|
|
18
18
|
export type { GuideStepListProps, GuideProgress, } from "./components/GuideStepList";
|
|
19
19
|
export { guideStepUrlId, parseGuideStepFromHash, parseGuideStepFromSearch, readGuideStepFromLocation, buildGuideStepUrl, type GuideStepUrlMode, } from "./utils/guideStepUrl";
|
|
20
|
-
export { computeGuideStepScrollMarginTop, useGuideScrollMargin, GuideScrollMarginContext, } from "./context/guideScrollMargin";
|
|
20
|
+
export { computeGuideLibraryScrollMarginTop, computeGuideOverviewScrollMarginTop, computeGuideStepScrollMarginTop, computeParentScrollMarginTop, useGuideContentRef, useGuideScrollMargin, GuideScrollMarginContext, } from "./context/guideScrollMargin";
|
|
21
21
|
export { GuideLayout } from "./components/GuideLayout";
|
|
22
22
|
export type { GuideLayoutProps, GuideLayoutHeaderProps, GuideLayoutIntroProps, } from "./components/GuideLayout";
|
|
23
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAG5B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,EACL,KAAK,WAAW,EAChB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,YAAY,EACV,oBAAoB,EACpB,UAAU,GACX,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EACL,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,gBAAgB,EAChB,yBAAyB,EACzB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAA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BAA+B,EAC/B,4BAA4B,EAC5B,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,19 +1,37 @@
|
|
|
1
|
-
/** Fraction of a
|
|
2
|
-
export declare function getStepVisibleRatio(rect: DOMRect, innerHeight?: number): number;
|
|
1
|
+
/** Fraction of a section's height visible below fixed chrome at the top of the viewport. */
|
|
2
|
+
export declare function getStepVisibleRatio(rect: DOMRect, innerHeight?: number, contentInsetTop?: number): number;
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* not take over until every earlier step has fallen below that threshold.
|
|
4
|
+
* Overview region from the guide top anchor through the top of `GuideLayout.Content`
|
|
5
|
+
* (header, intro, and sidebar — not the steps).
|
|
7
6
|
*/
|
|
8
|
-
export declare function
|
|
9
|
-
/**
|
|
10
|
-
export declare function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
export declare function getOverviewRect(guideTopRect: DOMRect | null, contentTopRect: DOMRect | null): DOMRect | null;
|
|
8
|
+
/** True when the viewport has reached (or nearly reached) the document bottom. */
|
|
9
|
+
export declare function isAtPageBottom(scrollY?: number, innerHeight?: number, thresholdPx?: number): boolean;
|
|
10
|
+
export interface PickActiveGuideSectionOptions {
|
|
11
|
+
overviewRect: DOMRect | null;
|
|
12
|
+
overviewContentInsetTop: number;
|
|
13
|
+
stepNumbers: number[];
|
|
14
|
+
getStepRect: (step: number) => DOMRect | null;
|
|
16
15
|
activeStepMinVisibleRatio: number;
|
|
16
|
+
stepContentInsetTop: number;
|
|
17
17
|
innerHeight?: number;
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* When true, the final step wins if the reader has reached the document bottom.
|
|
20
|
+
* Pass `isAtPageBottom()` from scroll handlers; defaults to `false`.
|
|
21
|
+
*/
|
|
22
|
+
atPageBottom?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Picks the active guide section while scrolling. The overview (`null`) competes
|
|
26
|
+
* with steps using the same `activeStepMinVisibleRatio` rule — the earliest
|
|
27
|
+
* section with enough visible area below its content inset wins, except the
|
|
28
|
+
* final step wins when the reader reaches the document bottom or has scrolled it
|
|
29
|
+
* into the primary reading position (top at or above the step content inset).
|
|
30
|
+
*/
|
|
31
|
+
export declare function pickActiveGuideSection({ overviewRect, overviewContentInsetTop, stepNumbers, getStepRect, activeStepMinVisibleRatio, stepContentInsetTop, innerHeight, atPageBottom, }: PickActiveGuideSectionOptions): number | null;
|
|
32
|
+
/**
|
|
33
|
+
* Picks the active step while scrolling — overview is not considered.
|
|
34
|
+
* @deprecated Prefer `pickActiveGuideSection` when an overview region is available.
|
|
35
|
+
*/
|
|
36
|
+
export declare function pickActiveGuideStep(stepNumbers: number[], activeStepMinVisibleRatio: number, getRect: (step: number) => DOMRect | null, innerHeight?: number, contentInsetTop?: number): number | null;
|
|
19
37
|
//# sourceMappingURL=pickActiveGuideStep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickActiveGuideStep.d.ts","sourceRoot":"","sources":["../../src/utils/pickActiveGuideStep.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"pickActiveGuideStep.d.ts","sourceRoot":"","sources":["../../src/utils/pickActiveGuideStep.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,OAAO,EACb,WAAW,GAAE,MAA2B,EACxC,eAAe,GAAE,MAAU,GAC1B,MAAM,CAUR;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,OAAO,GAAG,IAAI,EAC5B,cAAc,EAAE,OAAO,GAAG,IAAI,GAC7B,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