center-center 0.1.3 → 0.1.5
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/eslint.config.mjs +34 -16
- package/package.json +4 -4
- package/src/common/index.d.mts +7 -3
- package/src/common/index.mjs +2 -2
- package/src/dom/index.d.mts +6 -2
- package/src/index.d.mts +7 -3
- package/src/svg/index.d.mts +7 -3
- package/src/svg/view-box/index.d.mts +6 -1
package/eslint.config.mjs
CHANGED
|
@@ -1,43 +1,56 @@
|
|
|
1
1
|
import globals from 'globals'
|
|
2
|
-
|
|
3
|
-
import
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
configs as standard
|
|
5
|
+
} from '@sequencemedia/eslint-config-standard'
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
configs as typescript
|
|
9
|
+
} from '@sequencemedia/eslint-config-typescript'
|
|
4
10
|
|
|
5
11
|
export default [
|
|
6
|
-
|
|
12
|
+
{
|
|
13
|
+
...standard.recommended,
|
|
7
14
|
files: [
|
|
8
|
-
'**/*.{mjs,cjs}'
|
|
15
|
+
'**/*.{mjs,cjs,mts,cts}'
|
|
9
16
|
],
|
|
10
17
|
ignores: [
|
|
11
18
|
'test',
|
|
12
19
|
'src'
|
|
13
20
|
],
|
|
14
21
|
languageOptions: {
|
|
22
|
+
...standard.recommended.languageOptions,
|
|
15
23
|
globals: {
|
|
16
24
|
...globals.node
|
|
17
25
|
}
|
|
18
26
|
}
|
|
19
|
-
}
|
|
20
|
-
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
...standard.recommended,
|
|
21
30
|
files: [
|
|
22
|
-
'src/**/*.{mjs,cjs}'
|
|
31
|
+
'src/**/*.{mjs,cjs,mts,cts}'
|
|
23
32
|
],
|
|
24
33
|
languageOptions: {
|
|
34
|
+
...standard.recommended.languageOptions,
|
|
25
35
|
globals: {
|
|
26
36
|
...globals.browser
|
|
27
37
|
}
|
|
28
38
|
}
|
|
29
|
-
}
|
|
30
|
-
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
...standard.recommended,
|
|
31
42
|
files: [
|
|
32
43
|
'test/**/*.{mjs,cjs}'
|
|
33
44
|
],
|
|
34
45
|
languageOptions: {
|
|
46
|
+
...standard.recommended.languageOptions,
|
|
35
47
|
globals: {
|
|
36
48
|
...globals.mocha
|
|
37
49
|
}
|
|
38
50
|
}
|
|
39
|
-
}
|
|
40
|
-
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
...typescript.recommended,
|
|
41
54
|
files: [
|
|
42
55
|
'**/*.{mts,cts}'
|
|
43
56
|
],
|
|
@@ -46,29 +59,34 @@ export default [
|
|
|
46
59
|
'src'
|
|
47
60
|
],
|
|
48
61
|
languageOptions: {
|
|
62
|
+
...typescript.recommended.languageOptions,
|
|
49
63
|
globals: {
|
|
50
64
|
...globals.node
|
|
51
65
|
}
|
|
52
66
|
}
|
|
53
|
-
}
|
|
54
|
-
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
...typescript.recommended,
|
|
55
70
|
files: [
|
|
56
71
|
'src/**/*.{mts,cts}'
|
|
57
72
|
],
|
|
58
73
|
languageOptions: {
|
|
74
|
+
...typescript.recommended.languageOptions,
|
|
59
75
|
globals: {
|
|
60
76
|
...globals.browser
|
|
61
77
|
}
|
|
62
78
|
}
|
|
63
|
-
}
|
|
64
|
-
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
...typescript.recommended,
|
|
65
82
|
files: [
|
|
66
83
|
'test/**/*.{mts,cts}'
|
|
67
84
|
],
|
|
68
85
|
languageOptions: {
|
|
86
|
+
...typescript.recommended.languageOptions,
|
|
69
87
|
globals: {
|
|
70
88
|
...globals.mocha
|
|
71
89
|
}
|
|
72
90
|
}
|
|
73
|
-
}
|
|
91
|
+
}
|
|
74
92
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "center-center",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Position an element at the center center of a container",
|
|
5
5
|
"main": "./src/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"lint": "eslint .",
|
|
20
20
|
"lint:fix": "npm run lint -- --fix",
|
|
21
21
|
"prepare": "husky",
|
|
22
|
-
"start": "DEBUG=center-center* nodemon docs/index.mjs --watch .",
|
|
22
|
+
"start": "cross-env DEBUG=center-center* nodemon docs/index.mjs --watch .",
|
|
23
23
|
"test": "cross-env NODE_ENV=test mocha test --recursive"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/core": "^7.26.0",
|
|
30
30
|
"@babel/preset-env": "^7.26.0",
|
|
31
|
-
"@sequencemedia/eslint-config-standard": "^0.
|
|
32
|
-
"@sequencemedia/eslint-config-typescript": "^0.0
|
|
31
|
+
"@sequencemedia/eslint-config-standard": "^0.2.0",
|
|
32
|
+
"@sequencemedia/eslint-config-typescript": "^0.1.0",
|
|
33
33
|
"@types/debug": "^4.1.12",
|
|
34
34
|
"chai": "^5.1.2",
|
|
35
35
|
"core-js": "^3.39.0",
|
package/src/common/index.d.mts
CHANGED
|
@@ -29,7 +29,7 @@ declare namespace CenterCenterTypes {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
declare module 'center-center/common' {
|
|
32
|
+
declare module '#center-center/common' {
|
|
33
33
|
export type ScrollingElement = CenterCenterTypes.ScrollingElement
|
|
34
34
|
export type CenterCenterRect = CenterCenterTypes.CenterCenterRect
|
|
35
35
|
export type CenterCenterRects = CenterCenterTypes.CenterCenterRects
|
|
@@ -37,9 +37,9 @@ declare module 'center-center/common' {
|
|
|
37
37
|
export function getScrollingElement (): ScrollingElement
|
|
38
38
|
export function createViewportRect (): CenterCenterRect
|
|
39
39
|
export function createDOMElementRect (element: Element): CenterCenterRect
|
|
40
|
-
export function createSVGElementRect (element:
|
|
40
|
+
export function createSVGElementRect (element: SVGGraphicsElement): CenterCenterRect
|
|
41
41
|
export function createDOMRects (container: Element, target: Element): CenterCenterRect
|
|
42
|
-
export function createSVGRects (container: Element, target:
|
|
42
|
+
export function createSVGRects (container: Element, target: SVGGraphicsElement): CenterCenterRect
|
|
43
43
|
|
|
44
44
|
export function getRectLeft (rect: CenterCenterRect): number
|
|
45
45
|
export function getRectTop (rect: CenterCenterRect): number
|
|
@@ -62,3 +62,7 @@ declare module 'center-center/common' {
|
|
|
62
62
|
export function calculateTargetX (rects: CenterCenterRects): number
|
|
63
63
|
export function calculateTargetY (rects: CenterCenterRects): number
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
declare module 'center-center/common' {
|
|
67
|
+
export * from '#center-center/common'
|
|
68
|
+
}
|
package/src/common/index.mjs
CHANGED
|
@@ -82,7 +82,7 @@ export function createDOMElementRect (element) {
|
|
|
82
82
|
/**
|
|
83
83
|
* Creates a `Rect` for an SVG element
|
|
84
84
|
*
|
|
85
|
-
* @param {
|
|
85
|
+
* @param {SVGGraphicsElement} element
|
|
86
86
|
* @returns {CenterCenterRect}
|
|
87
87
|
*/
|
|
88
88
|
export function createSVGElementRect (element) {
|
|
@@ -128,7 +128,7 @@ export function createDOMRects (container, target) {
|
|
|
128
128
|
* 3. The SVG target element
|
|
129
129
|
*
|
|
130
130
|
* @param {Element} container
|
|
131
|
-
* @param {
|
|
131
|
+
* @param {SVGGraphicsElement} target
|
|
132
132
|
* @returns {CenterCenterRects}
|
|
133
133
|
*/
|
|
134
134
|
export function createSVGRects (container, target) {
|
package/src/dom/index.d.mts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
declare module 'center-center/dom' {
|
|
1
|
+
declare module '#center-center/dom' {
|
|
2
2
|
import type {
|
|
3
3
|
CenterCenterRects
|
|
4
|
-
} from 'center-center/common'
|
|
4
|
+
} from '#center-center/common'
|
|
5
5
|
|
|
6
6
|
export function createRects (container: Element, target: Element): CenterCenterRects
|
|
7
7
|
export function calculateLeft (rects: CenterCenterRects): number
|
|
8
8
|
export function calculateTop (rects: CenterCenterRects): number
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
declare module 'center-center/dom' {
|
|
12
|
+
export * from '#center-center/dom'
|
|
13
|
+
}
|
package/src/index.d.mts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
declare module 'center-center' {
|
|
1
|
+
declare module '#center-center' {
|
|
2
2
|
export type {
|
|
3
3
|
ScrollingElement,
|
|
4
4
|
CenterCenterRects,
|
|
5
5
|
CenterCenterRect
|
|
6
|
-
} from 'center-center/common'
|
|
6
|
+
} from '#center-center/common'
|
|
7
7
|
|
|
8
8
|
export {
|
|
9
9
|
createRects,
|
|
10
10
|
calculateLeft,
|
|
11
11
|
calculateTop
|
|
12
|
-
} from '#center-center'
|
|
12
|
+
} from '#center-center/dom'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare module 'center-center' {
|
|
16
|
+
export * from '#center-center'
|
|
13
17
|
}
|
package/src/svg/index.d.mts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
declare module 'center-center/svg' {
|
|
1
|
+
declare module '#center-center/svg' {
|
|
2
2
|
import type {
|
|
3
3
|
CenterCenterRects
|
|
4
|
-
} from 'center-center/common'
|
|
4
|
+
} from '#center-center/common'
|
|
5
5
|
|
|
6
|
-
export function createRects (container: Element, target:
|
|
6
|
+
export function createRects (container: Element, target: SVGGraphicsElement): CenterCenterRects
|
|
7
7
|
export function calculateX (rects: CenterCenterRects): number
|
|
8
8
|
export function calculateX (rects: CenterCenterRects): number
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
declare module 'center-center/svg' {
|
|
12
|
+
export * from '#center-center/svg'
|
|
13
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare module 'center-center/svg/view-box' {
|
|
1
|
+
declare module '#center-center/svg/view-box' {
|
|
2
2
|
export const X: number
|
|
3
3
|
export const Y: number
|
|
4
4
|
export const W: number
|
|
@@ -16,3 +16,8 @@ declare module 'center-center/svg/view-box' {
|
|
|
16
16
|
|
|
17
17
|
export default function getViewBox (svg: Element): number[]
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
declare module 'center-center/svg/view-box' {
|
|
21
|
+
export { default } from '#center-center/svg/view-box'
|
|
22
|
+
export * from '#center-center/svg/view-box'
|
|
23
|
+
}
|