css-blank-pseudo 2.0.0 → 3.0.3

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/package.json CHANGED
@@ -1,74 +1,58 @@
1
1
  {
2
2
  "name": "css-blank-pseudo",
3
- "version": "2.0.0",
3
+ "version": "3.0.3",
4
4
  "description": "Style form elements when they are empty",
5
5
  "author": "Jonathan Neal <jonathantneal@hotmail.com>",
6
6
  "license": "CC0-1.0",
7
- "repository": "csstools/css-blank-pseudo",
8
- "homepage": "https://github.com/csstools/css-blank-pseudo#readme",
9
- "bugs": "https://github.com/csstools/css-blank-pseudo/issues",
10
- "main": "index.js",
11
- "module": "index.mjs",
12
- "bin": {
13
- "css-blank-pseudo": "cli.js"
7
+ "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/css-blank-pseudo#readme",
8
+ "bugs": "https://github.com/csstools/postcss-plugins/issues",
9
+ "main": "dist/index.cjs",
10
+ "module": "dist/index.mjs",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.mjs",
14
+ "require": "./dist/index.cjs",
15
+ "default": "./dist/index.mjs"
16
+ },
17
+ "./browser": {
18
+ "import": "./dist/browser.mjs",
19
+ "require": "./dist/browser.cjs",
20
+ "default": "./dist/browser.mjs"
21
+ },
22
+ "./browser-global": {
23
+ "default": "./dist/browser-global.js"
24
+ }
14
25
  },
15
26
  "files": [
16
- "browser.js",
17
- "browser-legacy.js",
18
- "cli.js",
19
- "index.js",
20
- "index.js.map",
21
- "index.mjs",
22
- "index.mjs.map",
23
- "legacy.js",
24
- "legacy.js.map",
25
- "legacy.mjs",
26
- "legacy.mjs.map",
27
- "postcss.js",
28
- "postcss.js.map",
29
- "postcss.mjs",
30
- "postcss.mjs.map"
27
+ "CHANGELOG.md",
28
+ "LICENSE.md",
29
+ "README.md",
30
+ "dist",
31
+ "browser.js"
31
32
  ],
33
+ "bin": {
34
+ "css-blank-pseudo": "dist/cli.cjs"
35
+ },
32
36
  "scripts": {
33
- "build": "npm run build:browser && npm run build:cli && npm run build:node && npm run build:postcss",
34
- "build:browser": "cross-env NODE_ENV=browser rollup --config .rollup.js --silent && cross-env NODE_ENV=browser:legacy rollup --config .rollup.js --silent",
35
- "build:cli": "cross-env NODE_ENV=cli rollup --config .rollup.js --silent",
36
- "build:postcss": "cross-env NODE_ENV=postcss rollup --config .rollup.js --silent",
37
- "build:node": "rollup --config .rollup.js --silent && cross-env NODE_ENV=legacy rollup --config .rollup.js --silent",
38
- "prepublishOnly": "npm test && npm run build",
39
- "pretest:postcss": "npm run build:postcss",
40
- "test": "npm run test:js && npm run test:postcss",
41
- "test:js": "eslint src/{*,**/*}.js --cache --ignore-path .gitignore --quiet",
42
- "test:postcss": "postcss-tape --plugin postcss.js"
37
+ "build": "rollup -c ../../rollup/default.js && npm run copy-browser-scripts-to-old-location",
38
+ "clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"",
39
+ "copy-browser-scripts-to-old-location": "node -e \"fs.copyFileSync('./dist/browser-global.js', './browser.js'); fs.copyFileSync('./dist/browser-global.js', './browser-legacy.js')\"",
40
+ "lint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
41
+ "prepublishOnly": "npm run clean && npm run build && npm run test",
42
+ "stryker": "stryker run --logLevel error",
43
+ "test": "node .tape.mjs && npm run test:exports",
44
+ "test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs",
45
+ "cli": "css-blank-pseudo",
46
+ "test:exports": "node ./test/_import.mjs && node ./test/_require.cjs"
43
47
  },
44
48
  "engines": {
45
- "node": ">=10.0.0"
46
- },
47
- "peerDependencies": {
48
- "postcss": "^8.3"
49
+ "node": "^12 || ^14 || >=16"
49
50
  },
50
- "devDependencies": {
51
- "@babel/core": "^7.15.5",
52
- "@babel/preset-env": "^7.15.6",
53
- "@rollup/plugin-babel": "^5.3.0",
54
- "cross-env": "^7.0.3",
55
- "eslint": "^7.32.0",
56
- "postcss": "^8.3.6",
57
- "postcss-tape": "^6.0.1",
58
- "pre-commit": "^1.2.2",
59
- "rollup": "^2.56.3",
60
- "rollup-plugin-terser": "^7.0.2"
51
+ "dependencies": {
52
+ "postcss-selector-parser": "^6.0.9"
61
53
  },
62
- "eslintConfig": {
63
- "env": {
64
- "browser": true,
65
- "es6": true,
66
- "node": true
67
- },
68
- "parserOptions": {
69
- "sourceType": "module"
70
- },
71
- "root": true
54
+ "peerDependencies": {
55
+ "postcss": "^8.4"
72
56
  },
73
57
  "keywords": [
74
58
  "postcss",
@@ -86,5 +70,13 @@
86
70
  "input",
87
71
  "select",
88
72
  "textarea"
89
- ]
73
+ ],
74
+ "repository": {
75
+ "type": "git",
76
+ "url": "https://github.com/csstools/postcss-plugins.git",
77
+ "directory": "plugins/css-blank-pseudo"
78
+ },
79
+ "volta": {
80
+ "extends": "../../package.json"
81
+ }
90
82
  }
package/browser-legacy.js DELETED
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=browser-legacy.js.map
package/cli.js DELETED
@@ -1,136 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- var fs = require('fs');
4
-
5
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
6
-
7
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
8
-
9
- const selectorRegExp = /:blank([^\w-]|$)/gi;
10
-
11
- const creator = opts => {
12
- const replaceWith = String(Object(opts).replaceWith || '[blank]');
13
- const preserve = Boolean('preserve' in Object(opts) ? opts.preserve : true);
14
- return {
15
- postcssPlugin: 'css-blank-pseudo',
16
- Once: root => {
17
- root.walkRules(selectorRegExp, rule => {
18
- const selector = rule.selector.replace(selectorRegExp, ($0, $1) => {
19
- return `${replaceWith}${$1}`;
20
- });
21
- const clone = rule.clone({
22
- selector
23
- });
24
-
25
- if (preserve) {
26
- rule.before(clone);
27
- } else {
28
- rule.replaceWith(clone);
29
- }
30
- });
31
- }
32
- };
33
- };
34
-
35
- creator.postcss = true;
36
-
37
- if (process.argv.length < 3) {
38
- console.log(['CSS Blank Pseudo\n', ' Transforms CSS with :blank {}\n', 'Usage:\n', ' css-blank-pseudo source.css transformed.css', ' css-blank-pseudo --in=source.css --out=transformed.css --opts={}', ' echo "@media (prefers-color-scheme: dark) {}" | css-blank-pseudo\n'].join('\n'));
39
- process.exit(0);
40
- } // get process and plugin options from the command line
41
-
42
-
43
- const fileRegExp = /^[\w/.]+$/;
44
- const argRegExp = /^--(\w+)=("|')?(.+)\2$/;
45
- const relaxedJsonPropRegExp = /(['"])?([a-z0-9A-Z_]+)(['"])?:/g;
46
- const relaxedJsonValueRegExp = /("[a-z0-9A-Z_]+":\s*)'?([A-z0-9]+)'?([,}])/g;
47
- const argo = process.argv.slice(2).reduce((object, arg) => {
48
- const argMatch = arg.match(argRegExp);
49
- const fileMatch = arg.match(fileRegExp);
50
-
51
- if (argMatch) {
52
- object[argMatch[1]] = argMatch[3];
53
- } else if (fileMatch) {
54
- if (object.from === '<stdin>') {
55
- object.from = arg;
56
- } else if (object.to === '<stdout>') {
57
- object.to = arg;
58
- }
59
- }
60
-
61
- return object;
62
- }, {
63
- from: '<stdin>',
64
- to: '<stdout>',
65
- opts: 'null'
66
- }); // get css from command line arguments or stdin
67
-
68
- (argo.from === '<stdin>' ? getStdin() : readFile(argo.from)).then(css => {
69
- const pluginOpts = JSON.parse(argo.opts.replace(relaxedJsonPropRegExp, '"$2": ').replace(relaxedJsonValueRegExp, '$1"$2"$3'));
70
- const processOptions = Object.assign({
71
- from: argo.from,
72
- to: argo.to || argo.from
73
- }, argo.map ? {
74
- map: JSON.parse(argo.map)
75
- } : {});
76
- const result = creator.process(css, processOptions, pluginOpts);
77
-
78
- if (argo.to === '<stdout>') {
79
- return result.css;
80
- } else {
81
- return writeFile(argo.to, result.css).then(() => `CSS was written to "${argo.to}"`);
82
- }
83
- }).then(result => {
84
- console.log(result);
85
- process.exit(0);
86
- }, error => {
87
- console.error(error);
88
- process.exit(1);
89
- });
90
-
91
- function readFile(pathname) {
92
- return new Promise((resolve, reject) => {
93
- fs__default['default'].readFile(pathname, 'utf8', (error, data) => {
94
- if (error) {
95
- reject(error);
96
- } else {
97
- resolve(data);
98
- }
99
- });
100
- });
101
- }
102
-
103
- function writeFile(pathname, data) {
104
- return new Promise((resolve, reject) => {
105
- fs__default['default'].writeFile(pathname, data, (error, content) => {
106
- if (error) {
107
- reject(error);
108
- } else {
109
- resolve(content);
110
- }
111
- });
112
- });
113
- }
114
-
115
- function getStdin() {
116
- return new Promise(resolve => {
117
- let data = '';
118
-
119
- if (process.stdin.isTTY) {
120
- resolve(data);
121
- } else {
122
- process.stdin.setEncoding('utf8');
123
- process.stdin.on('readable', () => {
124
- let chunk;
125
-
126
- while (chunk = process.stdin.read()) {
127
- data += chunk;
128
- }
129
- });
130
- process.stdin.on('end', () => {
131
- resolve(data);
132
- });
133
- }
134
- });
135
- }
136
- //# sourceMappingURL=cli.js.map
package/index.js DELETED
@@ -1,94 +0,0 @@
1
- 'use strict';
2
-
3
- function cssBlankPseudo(document, opts) {
4
- // configuration
5
- const className = Object(opts).className;
6
- const attr = Object(opts).attr || 'blank';
7
- const force = Object(opts).force;
8
-
9
- try {
10
- document.querySelector(':blank');
11
-
12
- if (!force) {
13
- return;
14
- }
15
- } catch (ignoredError) {
16
- /* do nothing and continue */
17
- } // observe value changes on <input>, <select>, and <textarea>
18
-
19
-
20
- const window = (document.ownerDocument || document).defaultView;
21
- observeValueOfHTMLElement(window.HTMLInputElement);
22
- observeValueOfHTMLElement(window.HTMLSelectElement);
23
- observeValueOfHTMLElement(window.HTMLTextAreaElement); // form control elements selector
24
-
25
- const selector = 'input,select,textarea'; // conditionally update all form control elements
26
-
27
- Array.prototype.forEach.call(document.querySelectorAll(selector), node => {
28
- node.addEventListener('input', configureCssBlankAttribute);
29
- configureCssBlankAttribute.call(node);
30
- }); // conditionally observe added or unobserve removed form control elements
31
-
32
- new MutationObserver(mutationsList => {
33
- mutationsList.forEach(mutation => {
34
- if (mutation.addedNodes) {
35
- mutation.addedNodes.forEach(node => {
36
- if (node.nodeType === 1 && node.matches(selector)) {
37
- node.addEventListener('input', configureCssBlankAttribute);
38
- configureCssBlankAttribute.call(node);
39
- }
40
- });
41
- }
42
-
43
- if (mutation.removedNodes) {
44
- mutation.removedNodes.forEach(node => {
45
- if (node.nodeType === 1 && node.matches(selector)) {
46
- node.removeEventListener('input', configureCssBlankAttribute);
47
- }
48
- });
49
- }
50
- });
51
- }).observe(document, {
52
- childList: true,
53
- subtree: true
54
- }); // update a form control element’s css-blank attribute
55
-
56
- function configureCssBlankAttribute() {
57
- if (this.value) {
58
- if (attr) {
59
- this.removeAttribute(attr);
60
- }
61
-
62
- if (className) {
63
- this.classList.remove(className);
64
- }
65
-
66
- this.removeAttribute('blank');
67
- } else {
68
- if (attr) {
69
- this.setAttribute('blank', attr);
70
- }
71
-
72
- if (className) {
73
- this.classList.add(className);
74
- }
75
- }
76
- } // observe changes to the "value" property on an HTML Element
77
-
78
-
79
- function observeValueOfHTMLElement(HTMLElement) {
80
- const descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'value');
81
- const nativeSet = descriptor.set;
82
-
83
- descriptor.set = function set(value) {
84
- // eslint-disable-line no-unused-vars
85
- nativeSet.apply(this, arguments);
86
- configureCssBlankAttribute.apply(this);
87
- };
88
-
89
- Object.defineProperty(HTMLElement.prototype, 'value', descriptor);
90
- }
91
- }
92
-
93
- module.exports = cssBlankPseudo;
94
- //# sourceMappingURL=index.js.map
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["src/browser.js"],"sourcesContent":["export default function cssBlankPseudo (document, opts) {\n\t// configuration\n\tconst className = Object(opts).className;\n\tconst attr = Object(opts).attr || 'blank';\n\tconst force = Object(opts).force;\n\n\ttry {\n\t\tdocument.querySelector(':blank');\n\n\t\tif (!force) {\n\t\t\treturn;\n\t\t}\n\t} catch (ignoredError) { /* do nothing and continue */ }\n\n\t// observe value changes on <input>, <select>, and <textarea>\n\tconst window = (document.ownerDocument || document).defaultView;\n\n\tobserveValueOfHTMLElement(window.HTMLInputElement);\n\tobserveValueOfHTMLElement(window.HTMLSelectElement);\n\tobserveValueOfHTMLElement(window.HTMLTextAreaElement);\n\n\t// form control elements selector\n\tconst selector = 'input,select,textarea';\n\n\t// conditionally update all form control elements\n\tArray.prototype.forEach.call(\n\t\tdocument.querySelectorAll(selector),\n\t\tnode => {\n\t\t\tnode.addEventListener('input', configureCssBlankAttribute);\n\t\t\tconfigureCssBlankAttribute.call(node);\n\t\t}\n\t);\n\n\t// conditionally observe added or unobserve removed form control elements\n\tnew MutationObserver(mutationsList => {\n\t\tmutationsList.forEach(mutation => {\n\t\t\tif (mutation.addedNodes) {\n\t\t\t\tmutation.addedNodes.forEach(\n\t\t\t\t\tnode => {\n\t\t\t\t\t\tif (node.nodeType === 1 && node.matches(selector)) {\n\t\t\t\t\t\t\tnode.addEventListener('input', configureCssBlankAttribute);\n\t\t\t\t\t\t\tconfigureCssBlankAttribute.call(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (mutation.removedNodes) {\n\t\t\t\tmutation.removedNodes.forEach(\n\t\t\t\t\tnode => {\n\t\t\t\t\t\tif (node.nodeType === 1 && node.matches(selector)) {\n\t\t\t\t\t\t\tnode.removeEventListener('input', configureCssBlankAttribute);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}).observe(document, { childList: true, subtree: true });\n\n\t// update a form control element’s css-blank attribute\n\tfunction configureCssBlankAttribute () {\n\t\tif (this.value) {\n\t\t\tif (attr) {\n\t\t\t\tthis.removeAttribute(attr);\n\t\t\t}\n\n\t\t\tif (className) {\n\t\t\t\tthis.classList.remove(className);\n\t\t\t}\n\t\t\tthis.removeAttribute('blank');\n\t\t} else {\n\t\t\tif (attr) {\n\t\t\t\tthis.setAttribute('blank', attr);\n\t\t\t}\n\n\t\t\tif (className) {\n\t\t\t\tthis.classList.add(className);\n\t\t\t}\n\t\t}\n\t}\n\n\t// observe changes to the \"value\" property on an HTML Element\n\tfunction observeValueOfHTMLElement (HTMLElement) {\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'value');\n\t\tconst nativeSet = descriptor.set;\n\n\t\tdescriptor.set = function set (value) { // eslint-disable-line no-unused-vars\n\t\t\tnativeSet.apply(this, arguments);\n\n\t\t\tconfigureCssBlankAttribute.apply(this);\n\t\t}\n\n\t\tObject.defineProperty(HTMLElement.prototype, 'value', descriptor);\n\t}\n}\n"],"names":["cssBlankPseudo","document","opts","className","Object","attr","force","querySelector","ignoredError","window","ownerDocument","defaultView","observeValueOfHTMLElement","HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","selector","Array","prototype","forEach","call","querySelectorAll","node","addEventListener","configureCssBlankAttribute","MutationObserver","mutationsList","mutation","addedNodes","nodeType","matches","removedNodes","removeEventListener","observe","childList","subtree","value","removeAttribute","classList","remove","setAttribute","add","HTMLElement","descriptor","getOwnPropertyDescriptor","nativeSet","set","apply","arguments","defineProperty"],"mappings":";;AAAe,SAASA,cAAT,CAAyBC,QAAzB,EAAmCC,IAAnC,EAAyC;AACvD;AACA,QAAMC,SAAS,GAAGC,MAAM,CAACF,IAAD,CAAN,CAAaC,SAA/B;AACA,QAAME,IAAI,GAAGD,MAAM,CAACF,IAAD,CAAN,CAAaG,IAAb,IAAqB,OAAlC;AACA,QAAMC,KAAK,GAAGF,MAAM,CAACF,IAAD,CAAN,CAAaI,KAA3B;;AAEA,MAAI;AACHL,IAAAA,QAAQ,CAACM,aAAT,CAAuB,QAAvB;;AAEA,QAAI,CAACD,KAAL,EAAY;AACX;AACA;AACD,GAND,CAME,OAAOE,YAAP,EAAqB;AAAE;AAA+B,GAZD;;;AAevD,QAAMC,MAAM,GAAG,CAACR,QAAQ,CAACS,aAAT,IAA0BT,QAA3B,EAAqCU,WAApD;AAEAC,EAAAA,yBAA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AuBGS,OAvBH,CAuBWhC,QAvBX,EAuBqB;AAAEiC,IAAAA,SAAS,EAAE,IAAb;AAAmBC,IAAAA,OAAO,EAAE;AAA5B,GAvBrB,EAlCuD;;AA4DvD,WAASX,0BAAT,GAAuC;AACtC,QAAI,KAAKY,KAAT,EAAgB;AACf,UAAI/B,IAAJ,EAAU;AACT,aAAKgC,eAAL,CAAqBhC,IAArB;AACA;;AAED,UAAIF,SAAJ,EAAe;AACd,aAAKmC,SAAL,CAAeC,MAAf,CAAsBpC,SAAtB;AACA;;AACD,WAAKkC,eAAL,CAAqB,OAArB;AACA,KATD,MASO;AACN,UAAIhC,IAAJ,EAAU;AACT,aAAKmC,YAAL,CAAkB,OAAlB,EAA2BnC,IAA3B;AACA;;AAED,UAAIF,SAAJ,EAAe;AACd,aAAKmC,SAAL,CAAeG,GAAf,CAAmBtC,SAAnB;AACA;AACD;AACD,GA/EsD;;;AAkFvD,WAASS,yBAAT,CAAoC8B,WAApC,EAAiD;AAChD,UAAMC,UAAU,GAAGvC,MAAM,CAACwC,wBAAP,CAAgCF,WAAW,CAACxB,SAA5C,EAAuD,OAAvD,CAAnB;AACA,UAAM2B,SAAS,GAAGF,UAAU,CAACG,GAA7B;;AAEAH,IAAAA,UAAU,CAACG,GAAX,GAAiB,SAASA,GAAT,CAAcV,KAAd,EAAqB;AAAE;AACvCS,MAAAA,SAAS,CAACE,KAAV,CAAgB,IAAhB,EAAsBC,SAAtB;AAEAxB,MAAAA,0BAA0B,CAACuB,KAA3B,CAAiC,IAAjC;AACA,KAJD;;AAMA3C,IAAAA,MAAM,CAAC6C,cAAP,CAAsBP,WAAW,CAACxB,SAAlC,EAA6C,OAA7C,EAAsDyB,UAAtD;AACA;AACD;;;;"}
package/index.mjs DELETED
@@ -1,92 +0,0 @@
1
- function cssBlankPseudo(document, opts) {
2
- // configuration
3
- const className = Object(opts).className;
4
- const attr = Object(opts).attr || 'blank';
5
- const force = Object(opts).force;
6
-
7
- try {
8
- document.querySelector(':blank');
9
-
10
- if (!force) {
11
- return;
12
- }
13
- } catch (ignoredError) {
14
- /* do nothing and continue */
15
- } // observe value changes on <input>, <select>, and <textarea>
16
-
17
-
18
- const window = (document.ownerDocument || document).defaultView;
19
- observeValueOfHTMLElement(window.HTMLInputElement);
20
- observeValueOfHTMLElement(window.HTMLSelectElement);
21
- observeValueOfHTMLElement(window.HTMLTextAreaElement); // form control elements selector
22
-
23
- const selector = 'input,select,textarea'; // conditionally update all form control elements
24
-
25
- Array.prototype.forEach.call(document.querySelectorAll(selector), node => {
26
- node.addEventListener('input', configureCssBlankAttribute);
27
- configureCssBlankAttribute.call(node);
28
- }); // conditionally observe added or unobserve removed form control elements
29
-
30
- new MutationObserver(mutationsList => {
31
- mutationsList.forEach(mutation => {
32
- if (mutation.addedNodes) {
33
- mutation.addedNodes.forEach(node => {
34
- if (node.nodeType === 1 && node.matches(selector)) {
35
- node.addEventListener('input', configureCssBlankAttribute);
36
- configureCssBlankAttribute.call(node);
37
- }
38
- });
39
- }
40
-
41
- if (mutation.removedNodes) {
42
- mutation.removedNodes.forEach(node => {
43
- if (node.nodeType === 1 && node.matches(selector)) {
44
- node.removeEventListener('input', configureCssBlankAttribute);
45
- }
46
- });
47
- }
48
- });
49
- }).observe(document, {
50
- childList: true,
51
- subtree: true
52
- }); // update a form control element’s css-blank attribute
53
-
54
- function configureCssBlankAttribute() {
55
- if (this.value) {
56
- if (attr) {
57
- this.removeAttribute(attr);
58
- }
59
-
60
- if (className) {
61
- this.classList.remove(className);
62
- }
63
-
64
- this.removeAttribute('blank');
65
- } else {
66
- if (attr) {
67
- this.setAttribute('blank', attr);
68
- }
69
-
70
- if (className) {
71
- this.classList.add(className);
72
- }
73
- }
74
- } // observe changes to the "value" property on an HTML Element
75
-
76
-
77
- function observeValueOfHTMLElement(HTMLElement) {
78
- const descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'value');
79
- const nativeSet = descriptor.set;
80
-
81
- descriptor.set = function set(value) {
82
- // eslint-disable-line no-unused-vars
83
- nativeSet.apply(this, arguments);
84
- configureCssBlankAttribute.apply(this);
85
- };
86
-
87
- Object.defineProperty(HTMLElement.prototype, 'value', descriptor);
88
- }
89
- }
90
-
91
- export { cssBlankPseudo as default };
92
- //# sourceMappingURL=index.mjs.map
package/index.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":["src/browser.js"],"sourcesContent":["export default function cssBlankPseudo (document, opts) {\n\t// configuration\n\tconst className = Object(opts).className;\n\tconst attr = Object(opts).attr || 'blank';\n\tconst force = Object(opts).force;\n\n\ttry {\n\t\tdocument.querySelector(':blank');\n\n\t\tif (!force) {\n\t\t\treturn;\n\t\t}\n\t} catch (ignoredError) { /* do nothing and continue */ }\n\n\t// observe value changes on <input>, <select>, and <textarea>\n\tconst window = (document.ownerDocument || document).defaultView;\n\n\tobserveValueOfHTMLElement(window.HTMLInputElement);\n\tobserveValueOfHTMLElement(window.HTMLSelectElement);\n\tobserveValueOfHTMLElement(window.HTMLTextAreaElement);\n\n\t// form control elements selector\n\tconst selector = 'input,select,textarea';\n\n\t// conditionally update all form control elements\n\tArray.prototype.forEach.call(\n\t\tdocument.querySelectorAll(selector),\n\t\tnode => {\n\t\t\tnode.addEventListener('input', configureCssBlankAttribute);\n\t\t\tconfigureCssBlankAttribute.call(node);\n\t\t}\n\t);\n\n\t// conditionally observe added or unobserve removed form control elements\n\tnew MutationObserver(mutationsList => {\n\t\tmutationsList.forEach(mutation => {\n\t\t\tif (mutation.addedNodes) {\n\t\t\t\tmutation.addedNodes.forEach(\n\t\t\t\t\tnode => {\n\t\t\t\t\t\tif (node.nodeType === 1 && node.matches(selector)) {\n\t\t\t\t\t\t\tnode.addEventListener('input', configureCssBlankAttribute);\n\t\t\t\t\t\t\tconfigureCssBlankAttribute.call(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (mutation.removedNodes) {\n\t\t\t\tmutation.removedNodes.forEach(\n\t\t\t\t\tnode => {\n\t\t\t\t\t\tif (node.nodeType === 1 && node.matches(selector)) {\n\t\t\t\t\t\t\tnode.removeEventListener('input', configureCssBlankAttribute);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}).observe(document, { childList: true, subtree: true });\n\n\t// update a form control element’s css-blank attribute\n\tfunction configureCssBlankAttribute () {\n\t\tif (this.value) {\n\t\t\tif (attr) {\n\t\t\t\tthis.removeAttribute(attr);\n\t\t\t}\n\n\t\t\tif (className) {\n\t\t\t\tthis.classList.remove(className);\n\t\t\t}\n\t\t\tthis.removeAttribute('blank');\n\t\t} else {\n\t\t\tif (attr) {\n\t\t\t\tthis.setAttribute('blank', attr);\n\t\t\t}\n\n\t\t\tif (className) {\n\t\t\t\tthis.classList.add(className);\n\t\t\t}\n\t\t}\n\t}\n\n\t// observe changes to the \"value\" property on an HTML Element\n\tfunction observeValueOfHTMLElement (HTMLElement) {\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'value');\n\t\tconst nativeSet = descriptor.set;\n\n\t\tdescriptor.set = function set (value) { // eslint-disable-line no-unused-vars\n\t\t\tnativeSet.apply(this, arguments);\n\n\t\t\tconfigureCssBlankAttribute.apply(this);\n\t\t}\n\n\t\tObject.defineProperty(HTMLElement.prototype, 'value', descriptor);\n\t}\n}\n"],"names":["cssBlankPseudo","document","opts","className","Object","attr","force","querySelector","ignoredError","window","ownerDocument","defaultView","observeValueOfHTMLElement","HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","selector","Array","prototype","forEach","call","querySelectorAll","node","addEventListener","configureCssBlankAttribute","MutationObserver","mutationsList","mutation","addedNodes","nodeType","matches","removedNodes","removeEventListener","observe","childList","subtree","value","removeAttribute","classList","remove","setAttribute","add","HTMLElement","descriptor","getOwnPropertyDescriptor","nativeSet","set","apply","arguments","defineProperty"],"mappings":"AAAe,SAASA,cAAT,CAAyBC,QAAzB,EA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G,GAA7B;;AAEAH,IAAAA,UAAU,CAACG,GAAX,GAAiB,SAASA,GAAT,CAAcV,KAAd,EAAqB;AAAE;AACvCS,MAAAA,SAAS,CAACE,KAAV,CAAgB,IAAhB,EAAsBC,SAAtB;AAEAxB,MAAAA,0BAA0B,CAACuB,KAA3B,CAAiC,IAAjC;AACA,KAJD;;AAMA3C,IAAAA,MAAM,CAAC6C,cAAP,CAAsBP,WAAW,CAACxB,SAAlC,EAA6C,OAA7C,EAAsDyB,UAAtD;AACA;AACD;;;;"}
package/legacy.js DELETED
@@ -1,121 +0,0 @@
1
- 'use strict';
2
-
3
- function cssBlankPseudo(document, opts) {
4
- // configuration
5
- const className = Object(opts).className;
6
- const attr = Object(opts).attr || 'blank';
7
- const force = Object(opts).force;
8
-
9
- try {
10
- document.querySelector(':blank');
11
-
12
- if (!force) {
13
- return;
14
- }
15
- } catch (ignoredError) {
16
- /* do nothing and continue */
17
- } // observe value changes on <input>, <select>, and <textarea>
18
-
19
-
20
- const window = (document.ownerDocument || document).defaultView;
21
- observeValueOfHTMLElement(window.HTMLInputElement);
22
- observeValueOfHTMLElement(window.HTMLSelectElement);
23
- observeValueOfHTMLElement(window.HTMLTextAreaElement);
24
- observeSelectedOfHTMLElement(window.HTMLOptionElement); // form control elements selector
25
-
26
- const selector = 'INPUT,SELECT,TEXTAREA';
27
- const selectorRegExp = /^(INPUT|SELECT|TEXTAREA)$/; // conditionally update all form control elements
28
-
29
- Array.prototype.forEach.call(document.querySelectorAll(selector), node => {
30
- if (node.nodeName === 'SELECT') {
31
- node.addEventListener('change', configureCssBlankAttribute);
32
- } else {
33
- node.addEventListener('input', configureCssBlankAttribute);
34
- }
35
-
36
- configureCssBlankAttribute.call(node);
37
- }); // conditionally observe added or unobserve removed form control elements
38
-
39
- new MutationObserver(mutationsList => {
40
- mutationsList.forEach(mutation => {
41
- Array.prototype.forEach.call(mutation.addedNodes || [], node => {
42
- if (node.nodeType === 1 && selectorRegExp.test(node.nodeName)) {
43
- if (node.nodeName === 'SELECT') {
44
- node.addEventListener('change', configureCssBlankAttribute);
45
- } else {
46
- node.addEventListener('input', configureCssBlankAttribute);
47
- }
48
-
49
- configureCssBlankAttribute.call(node);
50
- }
51
- });
52
- Array.prototype.forEach.call(mutation.removedNodes || [], node => {
53
- if (node.nodeType === 1 && selectorRegExp.test(node.nodeName)) {
54
- if (node.nodeName === 'SELECT') {
55
- node.removeEventListener('change', configureCssBlankAttribute);
56
- } else {
57
- node.removeEventListener('input', configureCssBlankAttribute);
58
- }
59
- }
60
- });
61
- });
62
- }).observe(document, {
63
- childList: true,
64
- subtree: true
65
- }); // update a form control element’s css-blank attribute
66
-
67
- function configureCssBlankAttribute() {
68
- if (this.value || this.nodeName === 'SELECT' && this.options[this.selectedIndex].value) {
69
- if (attr) {
70
- this.removeAttribute(attr);
71
- }
72
-
73
- if (className) {
74
- this.classList.remove(className);
75
- }
76
-
77
- this.removeAttribute('blank');
78
- } else {
79
- if (attr) {
80
- this.setAttribute('blank', attr);
81
- }
82
-
83
- if (className) {
84
- this.classList.add(className);
85
- }
86
- }
87
- } // observe changes to the "value" property on an HTML Element
88
-
89
-
90
- function observeValueOfHTMLElement(HTMLElement) {
91
- const descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'value');
92
- const nativeSet = descriptor.set;
93
-
94
- descriptor.set = function set(value) {
95
- // eslint-disable-line no-unused-vars
96
- nativeSet.apply(this, arguments);
97
- configureCssBlankAttribute.apply(this);
98
- };
99
-
100
- Object.defineProperty(HTMLElement.prototype, 'value', descriptor);
101
- } // observe changes to the "selected" property on an HTML Element
102
-
103
-
104
- function observeSelectedOfHTMLElement(HTMLElement) {
105
- const descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'selected');
106
- const nativeSet = descriptor.set;
107
-
108
- descriptor.set = function set(value) {
109
- // eslint-disable-line no-unused-vars
110
- nativeSet.apply(this, arguments);
111
- const event = document.createEvent('Event');
112
- event.initEvent('change', true, true);
113
- this.dispatchEvent(event);
114
- };
115
-
116
- Object.defineProperty(HTMLElement.prototype, 'selected', descriptor);
117
- }
118
- }
119
-
120
- module.exports = cssBlankPseudo;
121
- //# sourceMappingURL=legacy.js.map
package/legacy.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"legacy.js","sources":["src/browser-legacy.js"],"sourcesContent":["export default function cssBlankPseudo (document, opts) {\n\t// configuration\n\tconst className = Object(opts).className;\n\tconst attr = Object(opts).attr || 'blank';\n\tconst force = Object(opts).force;\n\n\ttry {\n\t\tdocument.querySelector(':blank');\n\n\t\tif (!force) {\n\t\t\treturn;\n\t\t}\n\t} catch (ignoredError) { /* do nothing and continue */ }\n\n\t// observe value changes on <input>, <select>, and <textarea>\n\tconst window = (document.ownerDocument || document).defaultView;\n\n\tobserveValueOfHTMLElement(window.HTMLInputElement);\n\tobserveValueOfHTMLElement(window.HTMLSelectElement);\n\tobserveValueOfHTMLElement(window.HTMLTextAreaElement);\n\tobserveSelectedOfHTMLElement(window.HTMLOptionElement);\n\n\t// form control elements selector\n\tconst selector = 'INPUT,SELECT,TEXTAREA';\n\tconst selectorRegExp = /^(INPUT|SELECT|TEXTAREA)$/;\n\n\t// conditionally update all form control elements\n\tArray.prototype.forEach.call(\n\t\tdocument.querySelectorAll(selector),\n\t\tnode => {\n\t\t\tif (node.nodeName === 'SELECT') {\n\t\t\t\tnode.addEventListener('change', configureCssBlankAttribute);\n\t\t\t} else {\n\t\t\t\tnode.addEventListener('input', configureCssBlankAttribute);\n\t\t\t}\n\n\t\t\tconfigureCssBlankAttribute.call(node);\n\t\t}\n\t);\n\n\t// conditionally observe added or unobserve removed form control elements\n\tnew MutationObserver(mutationsList => {\n\t\tmutationsList.forEach(mutation => {\n\t\t\tArray.prototype.forEach.call(\n\t\t\t\tmutation.addedNodes || [],\n\t\t\t\tnode => {\n\t\t\t\t\tif (node.nodeType === 1 && selectorRegExp.test(node.nodeName)) {\n\t\t\t\t\t\tif (node.nodeName === 'SELECT') {\n\t\t\t\t\t\t\tnode.addEventListener('change', configureCssBlankAttribute);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnode.addEventListener('input', configureCssBlankAttribute);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconfigureCssBlankAttribute.call(node);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tArray.prototype.forEach.call(\n\t\t\t\tmutation.removedNodes || [],\n\t\t\t\tnode => {\n\t\t\t\t\tif (node.nodeType === 1 && selectorRegExp.test(node.nodeName)) {\n\t\t\t\t\t\tif (node.nodeName === 'SELECT') {\n\t\t\t\t\t\t\tnode.removeEventListener('change', configureCssBlankAttribute);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnode.removeEventListener('input', configureCssBlankAttribute);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\t}).observe(document, { childList: true, subtree: true });\n\n\t// update a form control element’s css-blank attribute\n\tfunction configureCssBlankAttribute () {\n\t\tif (this.value || this.nodeName === 'SELECT' && this.options[this.selectedIndex].value) {\n\t\t\tif (attr) {\n\t\t\t\tthis.removeAttribute(attr);\n\t\t\t}\n\n\t\t\tif (className) {\n\t\t\t\tthis.classList.remove(className);\n\t\t\t}\n\t\t\tthis.removeAttribute('blank');\n\t\t} else {\n\t\t\tif (attr) {\n\t\t\t\tthis.setAttribute('blank', attr);\n\t\t\t}\n\n\t\t\tif (className) {\n\t\t\t\tthis.classList.add(className);\n\t\t\t}\n\t\t}\n\t}\n\n\t// observe changes to the \"value\" property on an HTML Element\n\tfunction observeValueOfHTMLElement (HTMLElement) {\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'value');\n\t\tconst nativeSet = descriptor.set;\n\n\t\tdescriptor.set = function set (value) { // eslint-disable-line no-unused-vars\n\t\t\tnativeSet.apply(this, arguments);\n\n\t\t\tconfigureCssBlankAttribute.apply(this);\n\t\t}\n\n\t\tObject.defineProperty(HTMLElement.prototype, 'value', descriptor);\n\t}\n\n\t// observe changes to the \"selected\" property on an HTML Element\n\tfunction observeSelectedOfHTMLElement (HTMLElement) {\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'selected');\n\t\tconst nativeSet = descriptor.set;\n\n\t\tdescriptor.set = function set (value) { // eslint-disable-line no-unused-vars\n\t\t\tnativeSet.apply(this, arguments);\n\n\t\t\tconst event = document.createEvent('Event');\n\t\t\tevent.initEvent('change', true, true);\n\t\t\tthis.dispatchEvent(event);\n\t\t}\n\n\t\tObject.defineProperty(HTMLElement.prototype, 'selected', descriptor);\n\t}\n}\n"],"names":["cssBlankPseudo","document","opts","className","Object","attr","force","querySelector","ignoredError","window","ownerDocument","defaultView","observeValueOfHTMLElement","HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","observeSelectedOfHTMLElement","HTMLOptionElement","selector","selectorRegExp","Array","prototype","forEach","call","querySelectorAll","node","nodeName","addEventListener","configureCssBlankAttribute","MutationObserver","mutationsList","mutation","addedNodes","nodeType","test","removedNodes","removeEventListener","observe","childList","subtree","value","options","selectedIndex","removeAttribute","classList","remove","setAttribute","add","HTMLElement","descriptor","getOwnPropertyDescriptor","nativeSet","set","apply","arguments","defineProperty","event","createEvent","initEvent","dispatchEvent"],"mappings":";;AAAe,SAASA,cAAT,CAAyBC,QAAzB,EAAmCC,IAAnC,EAAyC;AACvD;AACA,QAAMC,SAAS,GAAGC,MAAM,CAACF,IAAD,CAAN,CAAaC,SAA/B;AACA,QAAME,IAAI,GAAGD,MAAM,CAACF,IAAD,CAAN,CAAaG,IAAb,IAAqB,OAAlC;AACA,QAAMC,KAAK,GAAGF,MAAM,CAACF,IAAD,CAAN,CAAaI,KAA3B;;AAEA,MAAI;AACHL,IAAAA,QAAQ,CAACM,aAAT,CAAuB,QAAvB;;AAEA,QAAI,CAACD,KAAL,EAAY;AACX;AACA;AACD,GAND,CAME,OAAOE,YAAP,EAAqB;AAAE;AAA+B,GAZD;;;A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