css-blank-pseudo 1.0.0 → 3.0.2
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/CHANGELOG.md +62 -0
- package/README.md +34 -16
- package/browser.js +125 -2
- package/dist/browser-global.js +125 -0
- package/dist/browser-global.js.map +1 -0
- package/{legacy.js → dist/browser.cjs} +21 -22
- package/dist/browser.cjs.map +1 -0
- package/{legacy.mjs → dist/browser.mjs} +22 -21
- package/dist/browser.mjs.map +1 -0
- package/dist/cli.cjs +3 -0
- package/dist/index.cjs +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +51 -65
- package/browser-legacy.js +0 -2
- package/cli.js +0 -129
- package/index.js +0 -94
- package/index.js.map +0 -1
- package/index.mjs +0 -92
- package/index.mjs.map +0 -1
- package/legacy.js.map +0 -1
- package/legacy.mjs.map +0 -1
- package/postcss.js +0 -30
- package/postcss.js.map +0 -1
- package/postcss.mjs +0 -26
- package/postcss.mjs.map +0 -1
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;;QAEjDC,SAAS,GAAGC,MAAM,CAACF,IAAD,CAAN,CAAaC,SAA/B;QACME,IAAI,GAAGD,MAAM,CAACF,IAAD,CAAN,CAAaG,IAAb,IAAqB,OAAlC;QACMC,KAAK,GAAGF,MAAM,CAACF,IAAD,CAAN,CAAaI,KAA3B;;MAEI;IACHL,QAAQ,CAACM,aAAT,CAAuB,QAAvB;;QAEI,CAACD,KAAL,EAAY;;;GAHb,CAME,OAAOE,YAAP,EAAqB;;;;;QAGjBC,MAAM,GAAG,CAACR,QAAQ,CAACS,aAAT,IAA0BT,QAA3B,EAAqCU,WAApD;EAEAC,yBAAyB,CAACH,MAAM,CAACI,gBAAR,CAAzB;EACAD,yBAAyB,CAACH,MAAM,CAACK,iBAAR,CAAzB;EACAF,yBAAyB,CAACH,MAAM,CAACM,mBAAR,CAAzB,CAnBuD;;QAsBjDC,QAAQ,GAAG,uBAAjB,CAtBuD;;EAyBvDC,KAAK,CAACC,SAAN,CAAgBC,OAAhB,CAAwBC,IAAxB,CACCnB,QAAQ,CAACoB,gBAAT,CAA0BL,QAA1B,CADD,EAECM,IAAI,IAAI;IACPA,IAAI,CAACC,gBAAL,CAAsB,OAAtB,EAA+BC,0BAA/B;IACAA,0B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wC,wBAAP,CAAgCF,WAAW,CAACxB,SAA5C,EAAuD,OAAvD,CAAnB;UACM2B,SAAS,GAAGF,UAAU,CAACG,GAA7B;;IAEAH,UAAU,CAACG,GAAX,GAAiB,SAASA,GAAT,CAAcV,KAAd,EAAqB;;MACrCS,SAAS,CAACE,KAAV,CAAgB,IAAhB,EAAsBC,SAAtB;MAEAxB,0BAA0B,CAACuB,KAA3B,CAAiC,IAAjC;KAHD;;IAMA3C,MAAM,CAAC6C,cAAP,CAAsBP,WAAW,CAACxB,SAAlC,EAA6C,OAA7C,EAAsDyB,UAAtD;;;;;;"}
|
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 default cssBlankPseudo;
|
|
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","getOwnPropert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
|
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;;QAEjDC,SAAS,GAAGC,MAAM,CAACF,IAAD,CAAN,CAAaC,SAA/B;QACME,IAAI,GAAGD,MAAM,CAACF,IAAD,CAAN,CAAaG,IAAb,IAAqB,OAAlC;QACMC,KAAK,GAAGF,MAAM,CAACF,IAAD,CAAN,CAAaI,KAA3B;;MAEI;IACHL,QAAQ,CAACM,aAAT,CAAuB,QAAvB;;QAEI,CAACD,KAAL,EAAY;;;GAHb,CAME,OAAOE,YAAP,EAAqB;;;;;QAGjBC,MAAM,GAAG,CAACR,QAAQ,CAACS,aAAT,IAA0BT,QAA3B,EAAqCU,WAApD;EAEAC,yBAAyB,CAACH,MAAM,CAACI,gBAAR,CAAzB;EACAD,yBAAyB,CAACH,MAAM,CAACK,iBAAR,CAAzB;EACAF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UAAtD;GA1GsD;;;WA8G9CjC,4BAAT,CAAuCgC,WAAvC,EAAoD;UAC7CC,UAAU,GAAG7C,MAAM,CAAC8C,wBAAP,CAAgCF,WAAW,CAAC3B,SAA5C,EAAuD,UAAvD,CAAnB;UACM8B,SAAS,GAAGF,UAAU,CAACG,GAA7B;;IAEAH,UAAU,CAACG,GAAX,GAAiB,SAASA,GAAT,CAAcZ,KAAd,EAAqB;;MACrCW,SAAS,CAACE,KAAV,CAAgB,IAAhB,EAAsBC,SAAtB;YAEME,KAAK,GAAGvD,QAAQ,CAACwD,WAAT,CAAqB,OAArB,CAAd;MACAD,KAAK,CAACE,SAAN,CAAgB,QAAhB,EAA0B,IAA1B,EAAgC,IAAhC;WACKC,aAAL,CAAmBH,KAAnB;KALD;;IAQApD,MAAM,CAACmD,cAAP,CAAsBP,WAAW,CAAC3B,SAAlC,EAA6C,UAA7C,EAAyD4B,UAAzD;;;;;;"}
|
package/legacy.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy.mjs","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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
|
|
3
|
-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
4
|
-
|
|
5
|
-
var postcss$1 = _interopDefault(require('postcss'));
|
|
6
|
-
|
|
7
|
-
const selectorRegExp = /:blank([^\w-]|$)/gi;
|
|
8
|
-
var postcss = postcss$1.plugin('css-blank-pseudo', opts => {
|
|
9
|
-
const replaceWith = String(Object(opts).replaceWith || '[blank]');
|
|
10
|
-
const preserve = Boolean('preserve' in Object(opts) ? opts.preserve : true);
|
|
11
|
-
return root => {
|
|
12
|
-
root.walkRules(selectorRegExp, rule => {
|
|
13
|
-
const selector = rule.selector.replace(selectorRegExp, ($0, $1) => {
|
|
14
|
-
return `${replaceWith}${$1}`;
|
|
15
|
-
});
|
|
16
|
-
const clone = rule.clone({
|
|
17
|
-
selector
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
if (preserve) {
|
|
21
|
-
rule.before(clone);
|
|
22
|
-
} else {
|
|
23
|
-
rule.replaceWith(clone);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
module.exports = postcss;
|
|
30
|
-
//# sourceMappingURL=postcss.js.map
|
package/postcss.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postcss.js","sources":["src/postcss.js"],"sourcesContent":["import postcss from 'postcss';\n\nconst selectorRegExp = /:blank([^\\w-]|$)/gi;\n\nexport default postcss.plugin('css-blank-pseudo', opts => {\n\tconst replaceWith = String(Object(opts).replaceWith || '[blank]');\n\tconst preserve = Boolean('preserve' in Object(opts) ? opts.preserve : true);\n\n\treturn root => {\n\t\troot.walkRules(selectorRegExp, rule => {\n\t\t\tconst selector = rule.selector.replace(selectorRegExp, ($0, $1) => {\n\t\t\t\treturn `${replaceWith}${$1}`;\n\t\t\t});\n\n\t\t\tconst clone = rule.clone({ selector });\n\n\t\t\tif (preserve) {\n\t\t\t\trule.before(clone);\n\t\t\t} else {\n\t\t\t\trule.replaceWith(clone);\n\t\t\t}\n\t\t});\n\t};\n});\n"],"names":["selectorRegExp","postcss","plugin","opts","replaceWith","String","Object","preserve","Boolean","root","walkRules","rule","selector","replace","$0","$1","clone","before"],"mappings":";;;;;;AAEA,MAAMA,cAAc,GAAG,oBAAvB;AAEA,cAAeC,SAAO,CAACC,MAAR,CAAe,kBAAf,EAAmCC,IAAI,IAAI;QACnDC,WAAW,GAAGC,MAAM,CAACC,MAAM,CAACH,IAAD,CAAN,CAAaC,WAAb,IAA4B,SAA7B,CAA1B;QACMG,QAAQ,GAAGC,OAAO,CAAC,cAAcF,MAAM,CAACH,IAAD,CAApB,GAA6BA,IAAI,CAACI,QAAlC,GAA6C,IAA9C,CAAxB;SAEOE,IAAI,IAAI;IACdA,IAAI,CAACC,SAAL,CAAeV,cAAf,EAA+BW,IAAI,IAAI;YAChCC,QAAQ,GAAGD,IAAI,CAACC,QAAL,CAAcC,OAAd,CAAsBb,cAAtB,EAAsC,CAACc,EAAD,EAAKC,EAAL,KAAY;eAC1D,GAAEX,WAAY,GAAEW,EAAG,EAA3B;OADgB,CAAjB;YAIMC,KAAK,GAAGL,IAAI,CAACK,KAAL,CAAW;QAAEJ;OAAb,CAAd;;UAEIL,QAAJ,EAAc;QACbI,IAAI,CAACM,MAAL,CAAYD,KAAZ;OADD,MAEO;QACNL,IAAI,CAACP,WAAL,CAAiBY,KAAjB;;KAVF;GADD;CAJc,CAAf;;;;"}
|
package/postcss.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import postcss$1 from 'postcss';
|
|
2
|
-
|
|
3
|
-
const selectorRegExp = /:blank([^\w-]|$)/gi;
|
|
4
|
-
var postcss = postcss$1.plugin('css-blank-pseudo', opts => {
|
|
5
|
-
const replaceWith = String(Object(opts).replaceWith || '[blank]');
|
|
6
|
-
const preserve = Boolean('preserve' in Object(opts) ? opts.preserve : true);
|
|
7
|
-
return root => {
|
|
8
|
-
root.walkRules(selectorRegExp, rule => {
|
|
9
|
-
const selector = rule.selector.replace(selectorRegExp, ($0, $1) => {
|
|
10
|
-
return `${replaceWith}${$1}`;
|
|
11
|
-
});
|
|
12
|
-
const clone = rule.clone({
|
|
13
|
-
selector
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
if (preserve) {
|
|
17
|
-
rule.before(clone);
|
|
18
|
-
} else {
|
|
19
|
-
rule.replaceWith(clone);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export default postcss;
|
|
26
|
-
//# sourceMappingURL=postcss.mjs.map
|
package/postcss.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postcss.mjs","sources":["src/postcss.js"],"sourcesContent":["import postcss from 'postcss';\n\nconst selectorRegExp = /:blank([^\\w-]|$)/gi;\n\nexport default postcss.plugin('css-blank-pseudo', opts => {\n\tconst replaceWith = String(Object(opts).replaceWith || '[blank]');\n\tconst preserve = Boolean('preserve' in Object(opts) ? opts.preserve : true);\n\n\treturn root => {\n\t\troot.walkRules(selectorRegExp, rule => {\n\t\t\tconst selector = rule.selector.replace(selectorRegExp, ($0, $1) => {\n\t\t\t\treturn `${replaceWith}${$1}`;\n\t\t\t});\n\n\t\t\tconst clone = rule.clone({ selector });\n\n\t\t\tif (preserve) {\n\t\t\t\trule.before(clone);\n\t\t\t} else {\n\t\t\t\trule.replaceWith(clone);\n\t\t\t}\n\t\t});\n\t};\n});\n"],"names":["selectorRegExp","postcss","plugin","opts","replaceWith","String","Object","preserve","Boolean","root","walkRules","rule","selector","replace","$0","$1","clone","before"],"mappings":";;AAEA,MAAMA,cAAc,GAAG,oBAAvB;AAEA,cAAeC,SAAO,CAACC,MAAR,CAAe,kBAAf,EAAmCC,IAAI,IAAI;QACnDC,WAAW,GAAGC,MAAM,CAACC,MAAM,CAACH,IAAD,CAAN,CAAaC,WAAb,IAA4B,SAA7B,CAA1B;QACMG,QAAQ,GAAGC,OAAO,CAAC,cAAcF,MAAM,CAACH,IAAD,CAApB,GAA6BA,IAAI,CAACI,QAAlC,GAA6C,IAA9C,CAAxB;SAEOE,IAAI,IAAI;IACdA,IAAI,CAACC,SAAL,CAAeV,cAAf,EAA+BW,IAAI,IAAI;YAChCC,QAAQ,GAAGD,IAAI,CAACC,QAAL,CAAcC,OAAd,CAAsBb,cAAtB,EAAsC,CAACc,EAAD,EAAKC,EAAL,KAAY;eAC1D,GAAEX,WAAY,GAAEW,EAAG,EAA3B;OADgB,CAAjB;YAIMC,KAAK,GAAGL,IAAI,CAACK,KAAL,CAAW;QAAEJ;OAAb,CAAd;;UAEIL,QAAJ,EAAc;QACbI,IAAI,CAACM,MAAL,CAAYD,KAAZ;OADD,MAEO;QACNL,IAAI,CAACP,WAAL,CAAiBY,KAAjB;;KAVF;GADD;CAJc,CAAf;;;;"}
|