@docusaurus/core 0.0.0-4571 → 0.0.0-4575

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.
@@ -8,7 +8,7 @@
8
8
  import React from 'react';
9
9
  import { type RouteComponentProps } from 'react-router-dom';
10
10
  import type { RouteConfig } from 'react-router-config';
11
- import type { Location } from '@docusaurus/history';
11
+ import type { Location } from 'history';
12
12
  import './nprogress.css';
13
13
  interface Props extends RouteComponentProps {
14
14
  readonly routes: RouteConfig[];
@@ -4,14 +4,20 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- /// <reference types="@docusaurus/module-type-aliases" />
8
- /// <reference types="react" />
9
- import type { LinkProps } from '@docusaurus/Link';
7
+ import React from 'react';
10
8
  import type docusaurus from '../docusaurus';
11
9
  declare global {
12
10
  interface Window {
13
11
  docusaurus: typeof docusaurus;
14
12
  }
15
13
  }
16
- declare function Link({ isNavLink, to, href, activeClassName, isActive, 'data-noBrokenLinkCheck': noBrokenLinkCheck, autoAddBaseUrl, ...props }: LinkProps): JSX.Element;
17
- export default Link;
14
+ declare const _default: React.ForwardRefExoticComponent<Pick<Partial<import("react-router-dom").NavLinkProps<unknown>> & React.ClassAttributes<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement> & {
15
+ readonly className?: string | undefined;
16
+ readonly style?: React.CSSProperties | undefined;
17
+ readonly isNavLink?: boolean | undefined;
18
+ readonly to?: string | undefined;
19
+ readonly href?: string | undefined;
20
+ readonly autoAddBaseUrl?: boolean | undefined;
21
+ readonly 'data-noBrokenLinkCheck'?: boolean | undefined;
22
+ }, "children" | "replace" | "slot" | "style" | "title" | "component" | "location" | "exact" | "sensitive" | "strict" | "id" | "dir" | "rel" | "href" | "type" | "key" | "isNavLink" | "className" | "to" | "innerRef" | "download" | "hrefLang" | "media" | "ping" | "target" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "activeClassName" | "activeStyle" | "isActive" | "data-noBrokenLinkCheck" | "autoAddBaseUrl"> & React.RefAttributes<HTMLAnchorElement>>;
23
+ export default _default;
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React, { useEffect, useRef } from 'react';
7
+ import React, { useEffect, useImperativeHandle, useRef, } from 'react';
8
8
  import { NavLink, Link as RRLink } from 'react-router-dom';
9
9
  import useDocusaurusContext from './useDocusaurusContext';
10
10
  import isInternalUrl from './isInternalUrl';
@@ -18,11 +18,13 @@ import { applyTrailingSlash } from '@docusaurus/utils-common';
18
18
  // this is because useBaseUrl() actually transforms relative links
19
19
  // like "introduction" to "/baseUrl/introduction" => bad behavior to fix
20
20
  const shouldAddBaseUrlAutomatically = (to) => to.startsWith('/');
21
- function Link({ isNavLink, to, href, activeClassName, isActive, 'data-noBrokenLinkCheck': noBrokenLinkCheck, autoAddBaseUrl = true, ...props }) {
21
+ function Link({ isNavLink, to, href, activeClassName, isActive, 'data-noBrokenLinkCheck': noBrokenLinkCheck, autoAddBaseUrl = true, ...props }, forwardedRef) {
22
22
  var _a;
23
23
  const { siteConfig: { trailingSlash, baseUrl }, } = useDocusaurusContext();
24
24
  const { withBaseUrl } = useBaseUrlUtils();
25
25
  const linksCollector = useLinksCollector();
26
+ const innerRef = useRef(null);
27
+ useImperativeHandle(forwardedRef, () => innerRef.current);
26
28
  // IMPORTANT: using to or href should not change anything
27
29
  // For example, MDX links will ALWAYS give us the href props
28
30
  // Using one prop or the other should not be used to distinguish
@@ -71,6 +73,7 @@ function Link({ isNavLink, to, href, activeClassName, isActive, 'data-noBrokenLi
71
73
  ioRef.current.observe(el);
72
74
  };
73
75
  const handleRef = (ref) => {
76
+ innerRef.current = ref;
74
77
  if (IOSupported && ref && isInternal) {
75
78
  // If IO supported and element reference found, set up Observer.
76
79
  handleIntersection(ref, () => {
@@ -107,10 +110,10 @@ function Link({ isNavLink, to, href, activeClassName, isActive, 'data-noBrokenLi
107
110
  }
108
111
  return isRegularHtmlLink ? (
109
112
  // eslint-disable-next-line jsx-a11y/anchor-has-content
110
- <a href={targetLink} {...(targetLinkUnprefixed &&
113
+ <a ref={innerRef} href={targetLink} {...(targetLinkUnprefixed &&
111
114
  !isInternal && { target: '_blank', rel: 'noopener noreferrer' })} {...props}/>) : (<LinkComponent {...props} onMouseEnter={onMouseEnter} innerRef={handleRef} to={targetLink || ''}
112
115
  // avoid "React does not recognize the `activeClassName` prop on a DOM
113
116
  // element"
114
117
  {...(isNavLink && { isActive, activeClassName })}/>);
115
118
  }
116
- export default Link;
119
+ export default React.forwardRef(Link);
@@ -4,4 +4,4 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- export * from 'react-router-dom';
7
+ export { useHistory, useLocation, Redirect, matchPath } from 'react-router-dom';
@@ -4,5 +4,4 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- // eslint-disable-next-line no-restricted-syntax
8
- export * from 'react-router-dom';
7
+ export { useHistory, useLocation, Redirect, matchPath } from 'react-router-dom';
@@ -4,6 +4,6 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import type { Location } from '@docusaurus/history';
7
+ import type { Location } from 'history';
8
8
  declare function normalizeLocation<T extends Location>(location: T): T;
9
9
  export default normalizeLocation;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docusaurus/core",
3
3
  "description": "Easy to Maintain Open Source Documentation Websites",
4
- "version": "0.0.0-4571",
4
+ "version": "0.0.0-4575",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -41,13 +41,13 @@
41
41
  "@babel/runtime": "^7.16.3",
42
42
  "@babel/runtime-corejs3": "^7.16.3",
43
43
  "@babel/traverse": "^7.16.3",
44
- "@docusaurus/cssnano-preset": "0.0.0-4571",
45
- "@docusaurus/logger": "0.0.0-4571",
46
- "@docusaurus/mdx-loader": "0.0.0-4571",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4575",
45
+ "@docusaurus/logger": "0.0.0-4575",
46
+ "@docusaurus/mdx-loader": "0.0.0-4575",
47
47
  "@docusaurus/react-loadable": "5.5.2",
48
- "@docusaurus/utils": "0.0.0-4571",
49
- "@docusaurus/utils-common": "0.0.0-4571",
50
- "@docusaurus/utils-validation": "0.0.0-4571",
48
+ "@docusaurus/utils": "0.0.0-4575",
49
+ "@docusaurus/utils-common": "0.0.0-4575",
50
+ "@docusaurus/utils-validation": "0.0.0-4575",
51
51
  "@slorber/static-site-generator-webpack-plugin": "^4.0.0",
52
52
  "@svgr/webpack": "^6.0.0",
53
53
  "autoprefixer": "^10.3.5",
@@ -104,8 +104,8 @@
104
104
  "webpackbar": "^5.0.2"
105
105
  },
106
106
  "devDependencies": {
107
- "@docusaurus/module-type-aliases": "0.0.0-4571",
108
- "@docusaurus/types": "0.0.0-4571",
107
+ "@docusaurus/module-type-aliases": "0.0.0-4575",
108
+ "@docusaurus/types": "0.0.0-4575",
109
109
  "@types/copy-webpack-plugin": "^10.1.0",
110
110
  "@types/detect-port": "^1.3.0",
111
111
  "@types/mini-css-extract-plugin": "^2.5.1",
@@ -127,5 +127,5 @@
127
127
  "engines": {
128
128
  "node": ">=14"
129
129
  },
130
- "gitHead": "dab611c05ad0d35ee11d762abb2b4402e8369a0d"
130
+ "gitHead": "6f6bea788fa928f20f1c54d60f2e1bdd47369b3f"
131
131
  }