es-blur 1.0.0 → 2.0.0
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/.github/workflows/lint.yml +20 -0
- package/.github/workflows/smoke.yml +10 -0
- package/README.md +3 -3
- package/auto.d.ts +3 -0
- package/auto.js +1 -3
- package/eslint.config.mjs +3 -0
- package/implementation.d.ts +8 -0
- package/implementation.js +5 -4
- package/index.js +25 -3
- package/name.d.ts +1 -0
- package/name.js +1 -0
- package/package.json +12 -2
- package/polyfill.d.ts +3 -0
- package/polyfill.js +4 -5
- package/shim-helper.d.ts +20 -0
- package/shim-helper.js +17 -13
- package/shim.d.ts +2 -0
- package/shim.js +6 -16
- package/t.js +0 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: 10xly Code Quality
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["**"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["**"]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
quality-check:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: actions/setup-node@v4
|
|
15
|
+
with:
|
|
16
|
+
node-version: "25"
|
|
17
|
+
- name: Install
|
|
18
|
+
run: npm install
|
|
19
|
+
- name: Run 10xly Lint
|
|
20
|
+
run: npx eslint . --max-warnings 0
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# es-blur
|
|
1
|
+
# es-blur
|
|
2
2
|
|
|
3
|
-
A drop-in shim/polyfill/replacement for `window.blur()
|
|
3
|
+
A drop-in shim/polyfill/replacement for `window.blur()`. Sort of follows the es-shims API because why not?
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -26,7 +26,7 @@ console.log(blur) // Output: [Function: blur]
|
|
|
26
26
|
If you just want to require the implementation, do this instead:
|
|
27
27
|
|
|
28
28
|
```js
|
|
29
|
-
var blur = require('es-blur
|
|
29
|
+
var blur = require('es-blur')()
|
|
30
30
|
|
|
31
31
|
console.log(blur) // Output: [Function: blur]
|
|
32
32
|
```
|
package/auto.d.ts
ADDED
package/auto.js
CHANGED
package/implementation.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable no-var */
|
|
2
|
+
var setFunctionName = require("set-function-name")
|
|
3
|
+
var $Function = require("standard-objects-function")
|
|
4
|
+
var name = require("./name")
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = blur;
|
|
6
|
+
module.exports = setFunctionName($Function(), name)
|
package/index.js
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
)
|
|
1
|
+
/* eslint-disable no-var */
|
|
2
|
+
|
|
3
|
+
var defineProperties = require("define-properties")
|
|
4
|
+
|
|
5
|
+
var implementation = require("./implementation")
|
|
6
|
+
var getPolyfill = require("./polyfill")
|
|
7
|
+
var shim = require("./shim")
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line one-var
|
|
10
|
+
var polyfill = getPolyfill()
|
|
11
|
+
|
|
12
|
+
function getBlur() {
|
|
13
|
+
return polyfill
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
defineProperties(getBlur, {
|
|
17
|
+
// eslint-disable-next-line object-shorthand
|
|
18
|
+
getPolyfill: getPolyfill,
|
|
19
|
+
// eslint-disable-next-line object-shorthand
|
|
20
|
+
implementation: implementation,
|
|
21
|
+
// eslint-disable-next-line object-shorthand
|
|
22
|
+
shim: shim,
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
module.exports = getBlur
|
package/name.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export = "blur"
|
package/name.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = "blur"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-blur",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A drop-in shim/polyfill/replacement for `window.blur() that works as far down as ES3.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"blur",
|
|
@@ -23,7 +23,17 @@
|
|
|
23
23
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
+
"@10xly/global": "^1.1.1",
|
|
27
|
+
"@10xly/strict-equals": "^1.0.1",
|
|
28
|
+
"@not-js/not": "^1.1.1",
|
|
26
29
|
"const": "^1.0.0",
|
|
27
|
-
"define-properties": "^1.2.1"
|
|
30
|
+
"define-properties": "^1.2.1",
|
|
31
|
+
"lodash.stubobject": "^4.13.0",
|
|
32
|
+
"set-function-name": "^2.0.2",
|
|
33
|
+
"standard-objects-function": "^1.0.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@10xly/eslint-config": "*",
|
|
37
|
+
"eslint": "^9.39.3"
|
|
28
38
|
}
|
|
29
39
|
}
|
package/polyfill.d.ts
ADDED
package/polyfill.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable no-var */
|
|
2
|
+
var implementation = require("./implementation")
|
|
3
|
+
var constant = require("const")
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
var constant = require("const");
|
|
5
|
-
|
|
6
|
-
module.exports = constant(implementation);
|
|
5
|
+
module.exports = constant(implementation)
|
package/shim-helper.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type GetPolyfill<T> = () => T
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a shim function that installs a polyfill onto an object property
|
|
5
|
+
* using define-properties (non-enumerable, non-configurable if already native).
|
|
6
|
+
*
|
|
7
|
+
* @param object - The target object to install the polyfill on
|
|
8
|
+
* @param property - The property name to shim
|
|
9
|
+
* @param getPolyfill - A function that returns the polyfill implementation
|
|
10
|
+
* @returns A `shim()` function that installs the polyfill and returns it
|
|
11
|
+
*/
|
|
12
|
+
declare function shimHelper<TObject extends object, TKey extends string, TPolyfill>(
|
|
13
|
+
object: TObject,
|
|
14
|
+
property: TKey,
|
|
15
|
+
getPolyfill: GetPolyfill<TPolyfill>
|
|
16
|
+
): () => TPolyfill
|
|
17
|
+
|
|
18
|
+
export = shimHelper
|
|
19
|
+
|
|
20
|
+
// this ts defintion was by claude
|
package/shim-helper.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable no-var */
|
|
2
2
|
|
|
3
|
-
var define = require("define-properties")
|
|
3
|
+
var define = require("define-properties")
|
|
4
|
+
// eslint-disable-next-line one-var
|
|
5
|
+
var isNotEqual = require("@not-js/not")(require("@10xly/strict-equals"))
|
|
4
6
|
|
|
5
7
|
module.exports = function shimHelper(object, property, getPolyfill) {
|
|
6
8
|
return function shim() {
|
|
7
|
-
var polyfill = getPolyfill()
|
|
8
|
-
|
|
9
|
-
o
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
var polyfill = getPolyfill()
|
|
10
|
+
// eslint-disable-next-line one-var, id-length
|
|
11
|
+
var o = require("lodash.stubobject")()
|
|
12
|
+
o[property] = polyfill
|
|
13
|
+
// eslint-disable-next-line one-var, vars-on-top, id-length
|
|
14
|
+
var p = require("lodash.stubobject")()
|
|
15
|
+
p[property] = function okfinenowthisfunctionhasanameyouhappynoweslint() {
|
|
16
|
+
return isNotEqual(object[property], polyfill)
|
|
17
|
+
}
|
|
18
|
+
define(object, o, p)
|
|
19
|
+
return polyfill
|
|
20
|
+
}
|
|
21
|
+
}
|
package/shim.d.ts
ADDED
package/shim.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable no-var */
|
|
2
2
|
|
|
3
|
-
var getPolyfill = require("./polyfill")
|
|
4
|
-
var shimHelper = require("./shim-helper")
|
|
3
|
+
var getPolyfill = require("./polyfill")
|
|
4
|
+
var shimHelper = require("./shim-helper")
|
|
5
|
+
var globalObj = require("@10xly/global")
|
|
5
6
|
|
|
6
7
|
function shim() {
|
|
7
|
-
|
|
8
|
-
shimHelper(window, "blur", getPolyfill)();
|
|
9
|
-
} catch {}
|
|
10
|
-
try {
|
|
11
|
-
shimHelper(global, "blur", getPolyfill)();
|
|
12
|
-
} catch {}
|
|
13
|
-
try {
|
|
14
|
-
shimHelper(self, "blur", getPolyfill)();
|
|
15
|
-
} catch {}
|
|
16
|
-
try {
|
|
17
|
-
shimHelper(globalThis, "blur", getPolyfill)();
|
|
18
|
-
} catch {}
|
|
8
|
+
shimHelper(globalObj, require("./name"), getPolyfill)()
|
|
19
9
|
}
|
|
20
10
|
|
|
21
|
-
module.exports = shim
|
|
11
|
+
module.exports = shim
|
package/t.js
DELETED