center-center 0.0.17 → 0.0.18
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/docs/images/favicon.ico +0 -0
- package/docs/index.html +5 -5
- package/docs/index.mjs +95 -0
- package/package.json +5 -2
|
Binary file
|
package/docs/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
{
|
|
7
7
|
"imports": {
|
|
8
8
|
"debug": "https://esm.sh/debug",
|
|
9
|
-
"center-center": "
|
|
9
|
+
"center-center": "/assets/index.mjs"
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
</script>
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
log('%d, %d', left, top)
|
|
80
80
|
|
|
81
81
|
const {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
target: {
|
|
83
|
+
left: currentLeft,
|
|
84
|
+
top: currentTop
|
|
85
|
+
}
|
|
86
86
|
} = rects
|
|
87
87
|
|
|
88
88
|
if (currentLeft !== left) target.style.left = left + 'px'
|
package/docs/index.mjs
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import debug from 'debug'
|
|
2
|
+
import express from 'express'
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
env: {
|
|
6
|
+
PORT = 3001
|
|
7
|
+
}
|
|
8
|
+
} = process
|
|
9
|
+
|
|
10
|
+
const log = debug('center-center/docs')
|
|
11
|
+
const info = debug('center-center/docs:info')
|
|
12
|
+
const app = express()
|
|
13
|
+
|
|
14
|
+
process
|
|
15
|
+
.on('SIGHUP', async (signal) => {
|
|
16
|
+
const {
|
|
17
|
+
stdout
|
|
18
|
+
} = process
|
|
19
|
+
|
|
20
|
+
if ('clearLine' in stdout) {
|
|
21
|
+
stdout.clearLine()
|
|
22
|
+
stdout.cursorTo(0)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
log(signal)
|
|
26
|
+
|
|
27
|
+
process.exit(0)
|
|
28
|
+
})
|
|
29
|
+
.on('SIGINT', async (signal) => {
|
|
30
|
+
const {
|
|
31
|
+
stdout
|
|
32
|
+
} = process
|
|
33
|
+
|
|
34
|
+
if ('clearLine' in stdout) {
|
|
35
|
+
stdout.clearLine()
|
|
36
|
+
stdout.cursorTo(0)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
log(signal)
|
|
40
|
+
|
|
41
|
+
process.exit(0)
|
|
42
|
+
})
|
|
43
|
+
.on('SIGBREAK', async (signal) => {
|
|
44
|
+
log(signal)
|
|
45
|
+
|
|
46
|
+
process.exit(0)
|
|
47
|
+
})
|
|
48
|
+
.on('SIGQUIT', async (signal) => {
|
|
49
|
+
log(signal)
|
|
50
|
+
|
|
51
|
+
process.exit(0)
|
|
52
|
+
})
|
|
53
|
+
.on('SIGTERM', async (signal) => {
|
|
54
|
+
log(signal)
|
|
55
|
+
|
|
56
|
+
process.exit(0)
|
|
57
|
+
})
|
|
58
|
+
.on('SIGPIPE', async (signal) => {
|
|
59
|
+
log(signal)
|
|
60
|
+
})
|
|
61
|
+
.on('beforeExit', async (code) => {
|
|
62
|
+
log('beforeExit', code)
|
|
63
|
+
})
|
|
64
|
+
.on('exit', async (code) => {
|
|
65
|
+
log('exit', code)
|
|
66
|
+
})
|
|
67
|
+
.on('uncaughtException', async ({ message }) => {
|
|
68
|
+
log('uncaughtException', message)
|
|
69
|
+
|
|
70
|
+
process.exit(1)
|
|
71
|
+
})
|
|
72
|
+
.on('unhandledRejection', async (reason, promise) => {
|
|
73
|
+
log('unhandledRejection', reason, promise)
|
|
74
|
+
|
|
75
|
+
process.exit(1)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
app
|
|
79
|
+
.get('/favicon.ico', (req, res) => {
|
|
80
|
+
res.sendFile('docs/images/favicon.ico', { root: '.' })
|
|
81
|
+
})
|
|
82
|
+
.get('/assets/index.mjs', (req, res) => {
|
|
83
|
+
res.sendFile('index.mjs', { root: '.' })
|
|
84
|
+
})
|
|
85
|
+
.get('/', (req, res) => {
|
|
86
|
+
res.sendFile('docs/index.html', { root: '.' })
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
app.listen(PORT, () => {
|
|
91
|
+
info(PORT)
|
|
92
|
+
})
|
|
93
|
+
} catch ({ message }) {
|
|
94
|
+
info(message)
|
|
95
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "center-center",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "Position an element at the center center of a container",
|
|
5
5
|
"main": "./index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"lint:mts:fix": "npm run lint:mts -- --fix",
|
|
25
25
|
"test": "cross-env NODE_ENV=test mocha test --recursive",
|
|
26
26
|
"prepare": "husky install",
|
|
27
|
-
"types": "tsc"
|
|
27
|
+
"types": "tsc",
|
|
28
|
+
"start": "DEBUG=center-center* nodemon docs/index.mjs --watch ."
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
31
|
"debug": "^4.3.4"
|
|
@@ -43,8 +44,10 @@
|
|
|
43
44
|
"eslint": "^8.56.0",
|
|
44
45
|
"eslint-config-standard": "^17.1.0",
|
|
45
46
|
"eslint-config-standard-with-typescript": "^43.0.1",
|
|
47
|
+
"express": "^4.18.2",
|
|
46
48
|
"husky": "^9.0.10",
|
|
47
49
|
"mocha": "^10.2.0",
|
|
50
|
+
"nodemon": "^3.0.3",
|
|
48
51
|
"npm-run-all": "^4.1.5",
|
|
49
52
|
"typescript": "^5.3.3"
|
|
50
53
|
},
|