Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rsuite/document-nav

Package Overview
Dependencies
Maintainers
5
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rsuite/document-nav - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

12

lib/Content.js

@@ -7,2 +7,4 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

@@ -22,2 +24,4 @@

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -41,3 +45,5 @@

value: function render() {
var children = this.props.children;
var _props = this.props,
children = _props.children,
props = _objectWithoutProperties(_props, ['children']);

@@ -50,5 +56,5 @@ return React.createElement(

'div',
{ ref: function ref(_ref) {
_extends({ ref: function ref(_ref) {
return context.setContent(_ref);
} },
} }, props),
children

@@ -55,0 +61,0 @@ );

@@ -19,2 +19,6 @@ 'use strict';

var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _createNavItems = require('./utils/createNavItems');

@@ -48,9 +52,9 @@

var Nav = function (_React$PureComponent) {
_inherits(Nav, _React$PureComponent);
var Component = function (_React$PureComponent) {
_inherits(Component, _React$PureComponent);
function Nav(props) {
_classCallCheck(this, Nav);
function Component(props) {
_classCallCheck(this, Component);
var _this = _possibleConstructorReturn(this, (Nav.__proto__ || Object.getPrototypeOf(Nav)).call(this, props));
var _this = _possibleConstructorReturn(this, (Component.__proto__ || Object.getPrototypeOf(Component)).call(this, props));

@@ -63,3 +67,3 @@ _this.state = {

_createClass(Nav, [{
_createClass(Component, [{
key: 'getContext',

@@ -234,3 +238,3 @@ value: function getContext() {

}
fixed && this.setScrollListener(content, anchors);
this.setScrollListener(content, anchors);
}

@@ -273,3 +277,5 @@ }, {

width = _props5.width,
fixed = _props5.fixed;
fixed = _props5.fixed,
style = _props5.style,
className = _props5.className;
var navItems = this.state.navItems;

@@ -286,5 +292,9 @@

'div',
{ className: 'document-nav', style: styles, ref: function ref(_ref) {
{
className: (0, _classnames2.default)('document-nav', className),
style: _extends({}, styles, style),
ref: function ref(_ref) {
return _this4.bindPageNavRef(_ref);
} },
}
},
navItems

@@ -296,6 +306,6 @@ )

return Nav;
return Component;
}(React.PureComponent);
Nav.defaultProps = {
Component.defaultProps = {
offset: {

@@ -313,5 +323,6 @@ top: 60,

};
Nav.Item = _NavItem2.default;
Component.Item = _NavItem2.default;
exports.default = function (props) {
var Nav = function Nav(props) {
return React.createElement(

@@ -321,5 +332,9 @@ _NavContext2.default.Consumer,

function (context) {
return React.createElement(Nav, _extends({}, props, context));
return React.createElement(Component, _extends({}, props, context));
}
);
};
};
Nav.Item = _NavItem2.default;
exports.default = Nav;
{
"name": "@rsuite/document-nav",
"version": "1.0.0",
"version": "1.0.1",
"description": "Document navigation is automatically generated based on the HTML title (h1-h6) tag",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -120,3 +120,3 @@ # Document Nav

| --------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| fixed | boolean `(true)` | 是否固定在屏幕的某一个位置?仅当为 `true` 时,`offset` 属性才会生效,为 `false` 时,导航菜单跟随文档流,也没有链接高亮 |
| fixed | boolean `(true)` | 是否固定在屏幕的某一个位置?仅当为 `true` 时,`offset` 属性才会生效,为 `false` 时,导航菜单跟随文档流 |
| offset | object `({left: 'auto', top: 60})` | 定位,属性为 `top`, `right`, `bottom`, `left` |

@@ -123,0 +123,0 @@ | width | number `(250)` | 导航部分的宽。当 `fixed` 为 `true` 时,默认为 `250`, 为 `false` 时默认为 `100%` |

@@ -6,3 +6,3 @@ // @flow

type Props = {
children: React.Node,
children: React.Node
};

@@ -12,6 +12,10 @@

render() {
const { children } = this.props;
const { children, ...props } = this.props;
return (
<NavContext.Consumer>
{context => <div ref={ref => context.setContent(ref)}>{children}</div>}
{context => (
<div ref={ref => context.setContent(ref)} {...props}>
{children}
</div>
)}
</NavContext.Consumer>

@@ -18,0 +22,0 @@ );

// @flow
import * as React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import createNavItems from './utils/createNavItems';

@@ -21,3 +22,3 @@ import NavItem from './NavItem';

scrollBar: 'left' | 'right',
fixed: boolean,
fixed: boolean | 'vertical',
showOrderNumber: boolean,

@@ -43,3 +44,3 @@ once: boolean,

class Nav extends React.PureComponent<Props, State> {
class Component extends React.PureComponent<Props, State> {
static defaultProps = {

@@ -202,3 +203,3 @@ offset: {

}
fixed && this.setScrollListener(content, anchors);
this.setScrollListener(content, anchors);
}

@@ -232,3 +233,3 @@

render() {
const { offset, width, fixed } = this.props;
const { offset, width, fixed, style, className } = this.props;
const { navItems } = this.state;

@@ -242,3 +243,7 @@ const styles = {

<NavItemContext.Provider value={this.getContext()}>
<div className="document-nav" style={styles} ref={ref => this.bindPageNavRef(ref)}>
<div
className={classnames('document-nav', className)}
style={{ ...styles, ...style }}
ref={ref => this.bindPageNavRef(ref)}
>
{navItems}

@@ -251,4 +256,8 @@ </div>

export default props => (
<NavContext.Consumer>{context => <Nav {...props} {...context} />}</NavContext.Consumer>
const Nav = props => (
<NavContext.Consumer>{context => <Component {...props} {...context} />}</NavContext.Consumer>
);
Nav.Item = NavItem;
export default Nav;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc