shinkansen-gears 1.0.47 → 1.0.52
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/jsconfig.json +11 -0
- package/package.json +9 -5
- package/src/gears/forward/index.d.mts +9 -0
- package/src/gears/index.d.mts +13 -0
- package/src/gears/index.jsx +14 -5
- package/src/gears/reverse/index.d.mts +9 -0
- package/src/index.d.mts +5 -0
- package/tsconfig.json +22 -0
package/jsconfig.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinkansen-gears",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.52",
|
|
4
4
|
"description": "Shinkansen Gears",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Shinkansen",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"pregulp": "npm run nvm",
|
|
32
32
|
"gulp": "gulp --color",
|
|
33
33
|
"prelint": "npm run nvm",
|
|
34
|
-
"lint": "cross-env NODE_ENV=production eslint . .storybook --ext .mjs --ext .cjs --ext .jsx",
|
|
34
|
+
"lint": "cross-env NODE_ENV=production eslint . .storybook --ext .mjs --ext .cjs --ext .jsx --ext .mts",
|
|
35
35
|
"lint:fix": "npm run lint -- --fix",
|
|
36
36
|
"pretest": "npm run nvm",
|
|
37
37
|
"test": "cross-env NODE_ENV=test jest --collect-coverage false --verbose --run-in-band",
|
|
@@ -53,13 +53,16 @@
|
|
|
53
53
|
"@babel/preset-env": "^7.21.5",
|
|
54
54
|
"@babel/preset-react": "^7.18.6",
|
|
55
55
|
"@babel/register": "^7.21.0",
|
|
56
|
-
"@modernpoacher/design-system": "1.0.
|
|
57
|
-
"@modernpoacher/hooks": "^1.0.
|
|
56
|
+
"@modernpoacher/design-system": "1.0.5",
|
|
57
|
+
"@modernpoacher/hooks": "^1.0.396",
|
|
58
58
|
"@sequencemedia/gulp": "^1.0.7",
|
|
59
59
|
"@storybook/addon-actions": "6.5.12",
|
|
60
60
|
"@storybook/addon-essentials": "6.5.12",
|
|
61
61
|
"@storybook/addon-links": "6.5.12",
|
|
62
62
|
"@storybook/react": "6.5.12",
|
|
63
|
+
"@types/react": "^18.2.6",
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "^5.59.2",
|
|
65
|
+
"@typescript-eslint/parser": "^5.59.2",
|
|
63
66
|
"autoprefixer": "^10.4.14",
|
|
64
67
|
"babel-plugin-module-resolver": "^5.0.0",
|
|
65
68
|
"core-js": "^3.30.2",
|
|
@@ -70,6 +73,7 @@
|
|
|
70
73
|
"enzyme-adapter-react-16": "^1.15.7",
|
|
71
74
|
"eslint": "^8.40.0",
|
|
72
75
|
"eslint-config-standard": "^17.0.0",
|
|
76
|
+
"eslint-config-standard-with-typescript": "^34.0.1",
|
|
73
77
|
"eslint-import-resolver-babel-module": "^5.3.2",
|
|
74
78
|
"eslint-plugin-import": "^2.27.5",
|
|
75
79
|
"eslint-plugin-node": "^11.1.0",
|
|
@@ -99,7 +103,7 @@
|
|
|
99
103
|
"regenerator-runtime": "^0.13.11",
|
|
100
104
|
"rimraf": "^5.0.0",
|
|
101
105
|
"sass": "^1.62.1",
|
|
102
|
-
"shinkansen-rails": "^1.0.
|
|
106
|
+
"shinkansen-rails": "^1.0.30",
|
|
103
107
|
"vinyl-paths": "^5.0.0"
|
|
104
108
|
},
|
|
105
109
|
"imports": {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
interface GearsProps {
|
|
4
|
+
reverse: {},
|
|
5
|
+
forward: {},
|
|
6
|
+
pattern: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare const Gears: (props: GearsProps) => React.JSX.Element
|
|
10
|
+
|
|
11
|
+
export function renderReverse (reverse: {}, pattern: string | void): React.JSX.Element | null
|
|
12
|
+
export function renderForward (forward: {}, pattern: string | void): React.JSX.Element | null
|
|
13
|
+
export default Gears
|
package/src/gears/index.jsx
CHANGED
|
@@ -9,6 +9,10 @@ import {
|
|
|
9
9
|
import Reverse from './reverse/index.jsx'
|
|
10
10
|
import Forward from './forward/index.jsx'
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @param {{} | void} reverse
|
|
14
|
+
* @param {string | void} pattern
|
|
15
|
+
*/
|
|
12
16
|
export function renderReverse (reverse, pattern) {
|
|
13
17
|
if (Rails.go(reverse, pattern)) {
|
|
14
18
|
const pathname = Rails.to(reverse, pattern)
|
|
@@ -23,6 +27,10 @@ export function renderReverse (reverse, pattern) {
|
|
|
23
27
|
return null
|
|
24
28
|
}
|
|
25
29
|
|
|
30
|
+
/**
|
|
31
|
+
* @param {{} | void} forward
|
|
32
|
+
* @param {string | void} pattern
|
|
33
|
+
*/
|
|
26
34
|
export function renderForward (forward, pattern) {
|
|
27
35
|
if (Rails.go(forward, pattern)) {
|
|
28
36
|
const pathname = Rails.to(forward, pattern)
|
|
@@ -43,10 +51,10 @@ export default class Gears extends Component {
|
|
|
43
51
|
/**
|
|
44
52
|
* Convert latest 'props' to an Immutable.Map() and store in 'state'
|
|
45
53
|
*
|
|
46
|
-
* @param {
|
|
47
|
-
* @param {
|
|
54
|
+
* @param {{reverse: Immutable.Map<{}, {}>, forward: Immutable.Map<{}, {}>}} props Latest props
|
|
55
|
+
* @param {{reverse: Immutable.Map<{}, {}>, forward: Immutable.Map<{}, {}>}} state Current state
|
|
48
56
|
*/
|
|
49
|
-
static getDerivedStateFromProps ({ reverse, forward }, { reverse: R, forward: F }) {
|
|
57
|
+
static getDerivedStateFromProps ({ reverse, forward }, { reverse: R, forward: F }) {
|
|
50
58
|
const r = Immutable.Map(reverse)
|
|
51
59
|
const f = Immutable.Map(forward)
|
|
52
60
|
|
|
@@ -60,8 +68,9 @@ export default class Gears extends Component {
|
|
|
60
68
|
* Compare latest 'props' and 'state' for changes to 'pattern', 'reverse' or 'forward'
|
|
61
69
|
*
|
|
62
70
|
* @param {Object} props Latest props
|
|
71
|
+
* @param {Object} state Current state
|
|
63
72
|
*/
|
|
64
|
-
shouldComponentUpdate ({ pattern }, state) {
|
|
73
|
+
shouldComponentUpdate ({ pattern }, state) {
|
|
65
74
|
const {
|
|
66
75
|
pattern: PATTERN
|
|
67
76
|
} = this.props
|
|
@@ -84,7 +93,7 @@ export default class Gears extends Component {
|
|
|
84
93
|
)
|
|
85
94
|
}
|
|
86
95
|
|
|
87
|
-
render () {
|
|
96
|
+
render () {
|
|
88
97
|
const {
|
|
89
98
|
reverse,
|
|
90
99
|
forward,
|
package/src/index.d.mts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
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-sprockets/*": [
|
|
15
|
+
"src/*"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"include": [
|
|
20
|
+
"src/*"
|
|
21
|
+
]
|
|
22
|
+
}
|