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.
@@ -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
@@ -0,0 +1,10 @@
1
+ name: smoke
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ smoke:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - name: pass
10
+ run: true
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # es-blur <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
1
+ # es-blur
2
2
 
3
- A drop-in shim/polyfill/replacement for `window.blur()` that works as far down as ES3.
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/implementation')
29
+ var blur = require('es-blur')()
30
30
 
31
31
  console.log(blur) // Output: [Function: blur]
32
32
  ```
package/auto.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ declare global {
2
+ var blur: typeof import("./implementation")
3
+ }
package/auto.js CHANGED
@@ -1,3 +1 @@
1
- "use strict";
2
-
3
- require("./shim")();
1
+ require("./shim")()
@@ -0,0 +1,3 @@
1
+ import config from "@10xly/eslint-config"
2
+
3
+ export default config
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The `Window.blur()` method does nothing.
3
+
4
+ * @deprecated {@link https://developer.mozilla.org/docs/Web/API/Window/blur | MDN Reference}
5
+ */
6
+ declare function blur(): void
7
+
8
+ export = blur
package/implementation.js CHANGED
@@ -1,5 +1,6 @@
1
- "use strict";
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
- function blur() {}
4
-
5
- module.exports = blur;
6
+ module.exports = setFunctionName($Function(), name)
package/index.js CHANGED
@@ -1,3 +1,25 @@
1
- throw new Error(
2
- 'Do not require es-blur directly, instead use es-blur/auto or es-blur/implementation depending on the usage. See the README for more information.'
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": "1.0.0",
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
@@ -0,0 +1,3 @@
1
+ declare function polyfill(): typeof import("./implementation")
2
+
3
+ export = polyfill
package/polyfill.js CHANGED
@@ -1,6 +1,5 @@
1
- "use strict";
1
+ /* eslint-disable no-var */
2
+ var implementation = require("./implementation")
3
+ var constant = require("const")
2
4
 
3
- var implementation = require("./implementation");
4
- var constant = require("const");
5
-
6
- module.exports = constant(implementation);
5
+ module.exports = constant(implementation)
@@ -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
- "use strict";
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
- var o = {};
9
- o[property] = polyfill;
10
- var p = {};
11
- p[property] = function () {
12
- return object[property] !== polyfill;
13
- };
14
- define(object, o, p);
15
- return polyfill;
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
@@ -0,0 +1,2 @@
1
+ export declare function shim(): void
2
+ export default shim
package/shim.js CHANGED
@@ -1,21 +1,11 @@
1
- "use strict";
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
- try {
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
@@ -1,2 +0,0 @@
1
- require('./auto')
2
- console.log(global.blur)