shinkansen-gears 1.0.57 → 1.0.60
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/package.json +9 -8
- package/src/gears/forward/index.jsx +8 -0
- package/src/gears/index.jsx +16 -8
- package/src/gears/reverse/index.jsx +8 -0
- package/src/index.d.cts +43 -0
- package/src/index.mjs +4 -0
- package/jsconfig.json +0 -11
- package/src/gears/forward/index.d.mts +0 -9
- package/src/gears/index.d.mts +0 -18
- package/src/gears/reverse/index.d.mts +0 -9
- package/src/index.d.mts +0 -5
- package/tsconfig.json +0 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinkansen-gears",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.60",
|
|
4
4
|
"description": "Shinkansen Gears",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Shinkansen",
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
],
|
|
14
14
|
"main": "./src/index.cjs",
|
|
15
15
|
"type": "module",
|
|
16
|
-
"types": "/src/index.d.mts",
|
|
17
16
|
"author": "Jonathan Perry for Modern Poacher Limited <modernpoacher@modernpoacher.com>",
|
|
18
17
|
"license": "MIT",
|
|
19
18
|
"engines": {
|
|
@@ -32,7 +31,7 @@
|
|
|
32
31
|
"pregulp": "npm run nvm",
|
|
33
32
|
"gulp": "gulp --color",
|
|
34
33
|
"prelint": "npm run nvm",
|
|
35
|
-
"lint": "cross-env NODE_ENV=production eslint . .storybook --ext .mjs --ext .cjs --ext .jsx --ext .mts",
|
|
34
|
+
"lint": "cross-env NODE_ENV=production eslint . .storybook --ext .mjs --ext .cjs --ext .jsx --ext .mts --ext .cts",
|
|
36
35
|
"lint:fix": "npm run lint -- --fix",
|
|
37
36
|
"pretest": "npm run nvm",
|
|
38
37
|
"test": "cross-env NODE_ENV=test jest --collect-coverage false --verbose --run-in-band",
|
|
@@ -54,16 +53,16 @@
|
|
|
54
53
|
"@babel/preset-env": "^7.21.5",
|
|
55
54
|
"@babel/preset-react": "^7.18.6",
|
|
56
55
|
"@babel/register": "^7.21.0",
|
|
57
|
-
"@modernpoacher/design-system": "1.0.
|
|
58
|
-
"@modernpoacher/hooks": "^1.0.
|
|
56
|
+
"@modernpoacher/design-system": "1.0.7",
|
|
57
|
+
"@modernpoacher/hooks": "^1.0.397",
|
|
59
58
|
"@sequencemedia/gulp": "^1.0.7",
|
|
60
59
|
"@storybook/addon-actions": "6.5.12",
|
|
61
60
|
"@storybook/addon-essentials": "6.5.12",
|
|
62
61
|
"@storybook/addon-links": "6.5.12",
|
|
63
62
|
"@storybook/react": "6.5.12",
|
|
64
63
|
"@types/react": "^18.2.6",
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "^5.59.
|
|
66
|
-
"@typescript-eslint/parser": "^5.59.
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "^5.59.5",
|
|
65
|
+
"@typescript-eslint/parser": "^5.59.5",
|
|
67
66
|
"autoprefixer": "^10.4.14",
|
|
68
67
|
"babel-plugin-module-resolver": "^5.0.0",
|
|
69
68
|
"core-js": "^3.30.2",
|
|
@@ -104,10 +103,12 @@
|
|
|
104
103
|
"regenerator-runtime": "^0.13.11",
|
|
105
104
|
"rimraf": "^5.0.0",
|
|
106
105
|
"sass": "^1.62.1",
|
|
107
|
-
"shinkansen-rails": "
|
|
106
|
+
"shinkansen-rails": "1.0.34",
|
|
108
107
|
"vinyl-paths": "^5.0.0"
|
|
109
108
|
},
|
|
110
109
|
"imports": {
|
|
110
|
+
"#gears-reverse": "./src/gears/reverse/index.cjs",
|
|
111
|
+
"#gears": "./src/gears/index.cjs",
|
|
111
112
|
"#build/gulp/build/*": "./build/gulp/build/*.mjs",
|
|
112
113
|
"#build/gulp/build": "./build/gulp/build/index.mjs",
|
|
113
114
|
"#build/gulp/transform": "./build/gulp/transform/index.mjs",
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('shinkansen-gears/gears/forward').ForwardProps} ForwardProps
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
import React from 'react'
|
|
2
6
|
import PropTypes from 'prop-types'
|
|
3
7
|
|
|
@@ -5,6 +9,10 @@ import {
|
|
|
5
9
|
Link
|
|
6
10
|
} from 'react-router-dom'
|
|
7
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @param {ForwardProps}
|
|
14
|
+
* @returns {React.JSX.Element}
|
|
15
|
+
*/
|
|
8
16
|
function Forward ({ pathname }) {
|
|
9
17
|
const key = pathname.concat('-forward')
|
|
10
18
|
const to = {
|
package/src/gears/index.jsx
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('shinkansen-gears/gears').GearsProps} GearsProps
|
|
3
|
+
* @typedef {import('shinkansen-gears/gears').GearsState} GearsState
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
import React, { Component } from 'react'
|
|
2
7
|
import PropTypes from 'prop-types'
|
|
3
8
|
import Immutable from 'immutable'
|
|
@@ -10,8 +15,7 @@ import Reverse from './reverse/index.jsx'
|
|
|
10
15
|
import Forward from './forward/index.jsx'
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @param {string | void} pattern
|
|
18
|
+
* @type {(reverse: {}, pattern: string | void): React.JSX.Element | null}
|
|
15
19
|
*/
|
|
16
20
|
export function renderReverse (reverse, pattern) {
|
|
17
21
|
if (Rails.go(reverse, pattern)) {
|
|
@@ -28,8 +32,7 @@ export function renderReverse (reverse, pattern) {
|
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
/**
|
|
31
|
-
*
|
|
32
|
-
* @param {string | void} pattern
|
|
35
|
+
* @type {(reverse: {}, pattern: string | void): React.JSX.Element | null}
|
|
33
36
|
*/
|
|
34
37
|
export function renderForward (forward, pattern) {
|
|
35
38
|
if (Rails.go(forward, pattern)) {
|
|
@@ -46,13 +49,17 @@ export function renderForward (forward, pattern) {
|
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
export default class Gears extends Component {
|
|
52
|
+
/**
|
|
53
|
+
* @type {GearsState}
|
|
54
|
+
*/
|
|
49
55
|
state = {} // define state
|
|
50
56
|
|
|
51
57
|
/**
|
|
52
58
|
* Convert latest 'props' to an Immutable.Map() and store in 'state'
|
|
53
59
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
60
|
+
* @param {GearsProps} props Latest props
|
|
61
|
+
* @param {GearsState} state Current state
|
|
62
|
+
* @returns {GearsState} Derived state
|
|
56
63
|
*/
|
|
57
64
|
static getDerivedStateFromProps ({ reverse, forward }, { reverse: R, forward: F }) {
|
|
58
65
|
const r = Immutable.Map(reverse)
|
|
@@ -67,8 +74,9 @@ export default class Gears extends Component {
|
|
|
67
74
|
/**
|
|
68
75
|
* Compare latest 'props' and 'state' for changes to 'pattern', 'reverse' or 'forward'
|
|
69
76
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
77
|
+
* @param {{ pattern: string }} props Latest props
|
|
78
|
+
* @param {GearsState} state Current state
|
|
79
|
+
* @returns {boolean}
|
|
72
80
|
*/
|
|
73
81
|
shouldComponentUpdate ({ pattern }, state) {
|
|
74
82
|
const {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('shinkansen-gears/gears/reverse').ReverseProps} ReverseProps
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
import React from 'react'
|
|
2
6
|
import PropTypes from 'prop-types'
|
|
3
7
|
|
|
@@ -5,6 +9,10 @@ import {
|
|
|
5
9
|
Link
|
|
6
10
|
} from 'react-router-dom'
|
|
7
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @param {ReverseProps}
|
|
14
|
+
* @returns {React.JSX.Element}
|
|
15
|
+
*/
|
|
8
16
|
function Reverse ({ pathname }) {
|
|
9
17
|
const key = pathname.concat('-reverse')
|
|
10
18
|
const to = {
|
package/src/index.d.cts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
declare module 'shinkansen-gears/gears/reverse' {
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
export type ReverseProps = {
|
|
5
|
+
pathname: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default function Reverse (props: ReverseProps): React.JSX.Element
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module 'shinkansen-gears/gears/forward' {
|
|
12
|
+
import React from 'react'
|
|
13
|
+
|
|
14
|
+
export type ForwardProps = {
|
|
15
|
+
pathname: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function Forward (props: ForwardProps): React.JSX.Element
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare module 'shinkansen-gears/gears' {
|
|
22
|
+
import React from 'react'
|
|
23
|
+
import Immutable from 'immutable'
|
|
24
|
+
|
|
25
|
+
export type GearsProps = {
|
|
26
|
+
reverse: {},
|
|
27
|
+
forward: {},
|
|
28
|
+
pattern: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type GearsState = {
|
|
32
|
+
reverse?: Immutable.Map<{}, {}>
|
|
33
|
+
forward?: Immutable.Map<{}, {}>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function renderReverse (reverse: {}, pattern: string | void): React.JSX.Element | null
|
|
37
|
+
export function renderForward (forward: {}, pattern: string | void): React.JSX.Element | null
|
|
38
|
+
export default class Gears extends React.Component<GearsProps, GearsState> {}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare module 'shinkansen-gears' {
|
|
42
|
+
export { default as Gears } from 'shinkansen-gears/gears'
|
|
43
|
+
}
|
package/src/index.mjs
CHANGED
package/jsconfig.json
DELETED
package/src/gears/index.d.mts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
import ReverseComponent from './reverse/index.mjs'
|
|
4
|
-
import ForwardComponent from './forward/index.mjs'
|
|
5
|
-
|
|
6
|
-
type GearsProps = {
|
|
7
|
-
reverse: {},
|
|
8
|
-
forward: {},
|
|
9
|
-
pattern: string
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type GearsComponent = React.ComponentClass<GearsProps>
|
|
13
|
-
|
|
14
|
-
declare const Gears: GearsComponent
|
|
15
|
-
|
|
16
|
-
export function renderReverse (reverse: {}, pattern: string | void): ReverseComponent | null
|
|
17
|
-
export function renderForward (forward: {}, pattern: string | void): ForwardComponent | null
|
|
18
|
-
export default Gears
|
package/src/index.d.mts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "es2020",
|
|
4
|
-
"target": "es2020",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"noEmit": true,
|
|
7
|
-
"strict": true,
|
|
8
|
-
"isolatedModules": true,
|
|
9
|
-
"noImplicitAny": true,
|
|
10
|
-
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"jsx": "react",
|
|
12
|
-
"baseUrl": "./",
|
|
13
|
-
"paths": {
|
|
14
|
-
"shinkansen-gears/*": [
|
|
15
|
-
"src/*"
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"include": [
|
|
20
|
-
"src/*"
|
|
21
|
-
]
|
|
22
|
-
}
|