grep-components 2.10.0-GREPF-2677.1 → 2.10.0-GREPF-2716.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/components/AppBar/stories/AppBarStory.stories.d.ts +0 -2
- package/dist/components/GrepDialog/stories/dialog.stories.d.ts +1 -8
- package/dist/components/ToC/components/nav-tree-node.d.ts +9 -0
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/setupTests.d.ts +0 -1
- package/package.json +4 -5
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { IAuthorizedPage } from '../types';
|
|
3
2
|
export declare const v0colors: {
|
|
4
3
|
primary: string;
|
|
5
4
|
secondary: string;
|
|
@@ -15,7 +14,6 @@ export declare const v0colors: {
|
|
|
15
14
|
white: string;
|
|
16
15
|
lightGrey: string;
|
|
17
16
|
};
|
|
18
|
-
export declare const navbarPages: IAuthorizedPage[];
|
|
19
17
|
declare const _default: {
|
|
20
18
|
title: string;
|
|
21
19
|
excludeStories: string[];
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const content = "Some content";
|
|
3
|
-
export declare const openText = "Open dialog";
|
|
4
|
-
export declare const title = "Title text";
|
|
5
|
-
export declare const Component: React.FC<{
|
|
6
|
-
actions?: JSX.Element[];
|
|
7
|
-
}>;
|
|
1
|
+
import { JSX } from 'react';
|
|
8
2
|
declare const _default: {
|
|
9
3
|
title: string;
|
|
10
4
|
decorators: ((storyFn: any) => JSX.Element)[];
|
|
11
|
-
excludeStories: string[];
|
|
12
5
|
};
|
|
13
6
|
export default _default;
|
|
14
7
|
export declare const Standard: {
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react';
|
|
2
2
|
import { ContextTreeElement, ContextTree } from '../utils/tree-builder';
|
|
3
|
+
/**
|
|
4
|
+
* @TODO fix later
|
|
5
|
+
* cheat, https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoViewIfNeeded
|
|
6
|
+
*/
|
|
7
|
+
declare global {
|
|
8
|
+
interface HTMLElement {
|
|
9
|
+
scrollIntoViewIfNeeded: VoidFunction;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
3
12
|
export interface GrepTableOfContentNavTreeNodeProps {
|
|
4
13
|
node: ContextTreeElement;
|
|
5
14
|
className?: string;
|
package/dist/index.js
CHANGED
|
@@ -3170,9 +3170,11 @@ const useContentElements = (container, selector, options) => {
|
|
|
3170
3170
|
});
|
|
3171
3171
|
// start observing
|
|
3172
3172
|
observer.observe(container, config);
|
|
3173
|
+
console.debug('observing container', container);
|
|
3173
3174
|
// stop observing when unmounted
|
|
3174
3175
|
return () => {
|
|
3175
3176
|
observer.disconnect();
|
|
3177
|
+
console.debug('observing disconnected', container);
|
|
3176
3178
|
};
|
|
3177
3179
|
}, [container, config, getElements]);
|
|
3178
3180
|
return elements;
|
|
@@ -12887,7 +12889,7 @@ var lodash_throttleExports = requireLodash_throttle();
|
|
|
12887
12889
|
var throttle = /*@__PURE__*/getDefaultExportFromCjs(lodash_throttleExports);
|
|
12888
12890
|
|
|
12889
12891
|
const generateElementId = (element) => {
|
|
12890
|
-
const tmpId = element.innerText
|
|
12892
|
+
const tmpId = element.innerText.replace(/\s/g, '-').toLowerCase();
|
|
12891
12893
|
let id = tmpId, index = 1;
|
|
12892
12894
|
while (document.getElementById(id)) {
|
|
12893
12895
|
id = `${tmpId}-${++index}`;
|
|
@@ -12957,7 +12959,9 @@ const GrepTableOfContentProvider = ({ ...props }) => {
|
|
|
12957
12959
|
setSelected(element);
|
|
12958
12960
|
}, 50);
|
|
12959
12961
|
target.addEventListener('scroll', onScroll, false);
|
|
12962
|
+
console.debug('scroll observer attached');
|
|
12960
12963
|
return () => {
|
|
12964
|
+
console.debug('scroll observer detached');
|
|
12961
12965
|
return target.removeEventListener('scroll', onScroll);
|
|
12962
12966
|
};
|
|
12963
12967
|
}, [scrollTarget, setSelected, offsetTop, getViewportElement]);
|
|
@@ -12968,11 +12972,13 @@ const GrepTableOfContentProvider = ({ ...props }) => {
|
|
|
12968
12972
|
// observe changes in hash
|
|
12969
12973
|
useEffect(() => {
|
|
12970
12974
|
if (hash && elements[hash]) {
|
|
12975
|
+
console.debug('anchor change, setting selected element');
|
|
12971
12976
|
setSelected(elements[hash], true);
|
|
12972
12977
|
}
|
|
12973
12978
|
}, [hash, setSelected]);
|
|
12974
12979
|
// set selected element on initial load
|
|
12975
12980
|
if (!initialized && elements && elements[hash]) {
|
|
12981
|
+
console.debug('setting initial selected element');
|
|
12976
12982
|
setSelected(elements[hash], true);
|
|
12977
12983
|
setInitialized(true);
|
|
12978
12984
|
}
|
|
@@ -13025,7 +13031,8 @@ const GrepTableOfContentNavTreeNode = (props) => {
|
|
|
13025
13031
|
useEffect(() => {
|
|
13026
13032
|
const link = linkRef.current;
|
|
13027
13033
|
if (isSelected) {
|
|
13028
|
-
link?.
|
|
13034
|
+
link?.scrollIntoViewIfNeeded();
|
|
13035
|
+
//setTimeout(() => link?.scrollIntoViewIfNeeded(), 2000);
|
|
13029
13036
|
}
|
|
13030
13037
|
else if (link === document.activeElement) {
|
|
13031
13038
|
link?.blur();
|
|
@@ -13050,6 +13057,7 @@ const GrepTableOfContentNavTreeNode = (props) => {
|
|
|
13050
13057
|
};
|
|
13051
13058
|
return (React__default.createElement("li", { key: index, "data-lvl": lvl, className: className, style: style },
|
|
13052
13059
|
React__default.createElement(Link, { ref: linkRef, className: clsx(styles.link, isSelected && `${styles.link}--selected`), href: url, tabIndex: tabIndex, onClick: (event) => {
|
|
13060
|
+
console.debug('node click', node);
|
|
13053
13061
|
event.preventDefault();
|
|
13054
13062
|
event.stopPropagation();
|
|
13055
13063
|
doSelect(true);
|