aliascss 1.1.20 → 1.2.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.
@@ -48,8 +48,7 @@ export let classPrinter = {
48
48
  if (el.getAttribute('class'))
49
49
  attrValue += ' ' + el.getAttribute('class');
50
50
  // if acss-class
51
- if (el.getAttribute('acss-class'))
52
- attrValue += ' ' + el.getAttribute('acss-class');
51
+ // if (el.getAttribute('acss-class')) attrValue += ' ' + el.getAttribute('acss-class');
53
52
  // new Update
54
53
  [...el.attributes].map((each) => {
55
54
  // ------------
@@ -98,25 +97,24 @@ export let classPrinter = {
98
97
  if (!attrValue.trim())
99
98
  return;
100
99
  // has-test-group(for live update only)
101
- if (el.getAttribute('acss-group-test')) {
102
- const result = statementMaker.group(attrValue, el.getAttribute('acss-group-test') || '');
103
- const styleTag = document.querySelector('style#' + el.getAttribute('acss-group-test'));
104
- if (result) {
105
- if (styleTag) {
106
- styleTag.innerHTML = '';
107
- const createNewGroup = document.createTextNode(result);
108
- styleTag.appendChild(createNewGroup);
109
- // return true;
110
- }
111
- else {
112
- const styleTag = document.createElement('style');
113
- styleTag.id = el.getAttribute('acss-group-test');
114
- document.getElementsByTagName('head')[0].appendChild(styleTag);
115
- const createNewGroup = document.createTextNode(result);
116
- styleTag.appendChild(createNewGroup);
117
- }
100
+ /* if (el.getAttribute('acss-group-test')) {
101
+ const result = statementMaker.group(attrValue, el.getAttribute('acss-group-test')||'');
102
+ const styleTag = document.querySelector('style#' + el.getAttribute('acss-group-test'));
103
+ if (result) {
104
+ if (styleTag) {
105
+ styleTag.innerHTML = '';
106
+ const createNewGroup = document.createTextNode(result);
107
+ styleTag.appendChild(createNewGroup);
108
+ // return true;
109
+ } else {
110
+ const styleTag: any = document.createElement('style');
111
+ styleTag.id = el.getAttribute('acss-group-test');
112
+ document.getElementsByTagName('head')[0].appendChild(styleTag);
113
+ const createNewGroup = document.createTextNode(result);
114
+ styleTag.appendChild(createNewGroup);
118
115
  }
119
- }
116
+ }
117
+ } */
120
118
  // -----------------------end of for live update
121
119
  // get class and trim out white spaces
122
120
  const tmpClassList = attrValue.trim().split(/\s+/);
@@ -169,8 +167,7 @@ export let classPrinter = {
169
167
  }
170
168
  });
171
169
  // if acss-class
172
- if (el.getAttribute('acss-class'))
173
- attrValue += ' ' + el.getAttribute('acss-class');
170
+ // if (el.getAttribute('acss-class')) attrValue += ' ' + el.getAttribute('acss-class');
174
171
  // if has value to process
175
172
  if (!attrValue.trim())
176
173
  return;
@@ -204,13 +201,15 @@ export let classPrinter = {
204
201
  statement += processOuterHtml ? processOuterHtml : '';
205
202
  // <template> element
206
203
  Array.prototype.forEach.call($el.querySelectorAll('template'), (template) => {
207
- Array.prototype.forEach.call(template.content.querySelectorAll('[class],[acss-class]'), (e) => {
204
+ // Array.prototype.forEach.call(template.content.querySelectorAll('[class],[acss-class]'), (e) => {
205
+ Array.prototype.forEach.call(template.content.querySelectorAll('[class]'), (e) => {
208
206
  const result = this.compileElement(e, classList);
209
207
  statement += result ? result : '';
210
208
  });
211
209
  });
212
210
  // <html>
213
- Array.prototype.forEach.call($el.querySelectorAll('[class],[acss-class]'), (e) => {
211
+ // Array.prototype.forEach.call($el.querySelectorAll('[class],[acss-class]'), (e) => {
212
+ Array.prototype.forEach.call($el.querySelectorAll('[class]'), (e) => {
214
213
  const result = this.compileElement(e, classList);
215
214
  statement += result ? result : '';
216
215
  });
@@ -223,12 +222,14 @@ export let classPrinter = {
223
222
  $root.dispatchEvent(new CustomEvent('acss:init', { bubbles: true, detail: { aliascss: this } }));
224
223
  // <template> element
225
224
  Array.prototype.forEach.call($root.querySelectorAll('template'), (template) => {
226
- Array.prototype.forEach.call(template.content.querySelectorAll('[class],[acss-class]'), (e) => {
225
+ // Array.prototype.forEach.call(template.content.querySelectorAll('[class],[acss-class]'), (e) => {
226
+ Array.prototype.forEach.call(template.content.querySelectorAll('[class]'), (e) => {
227
227
  this.print(e);
228
228
  });
229
229
  });
230
230
  // <html>
231
- Array.prototype.forEach.call($root.querySelectorAll('[class],[acss-class]'), (e) => {
231
+ // Array.prototype.forEach.call($root.querySelectorAll('[class],[acss-class]'), (e) => {
232
+ Array.prototype.forEach.call($root.querySelectorAll('[class]'), (e) => {
232
233
  this.print(e);
233
234
  });
234
235
  },
@@ -1,5 +1,5 @@
1
1
  const attribute = {
2
- test: /^[-]?[\[][a-zA-Z0-9-_:]+([~*$^]?[=][a-zA-Z0-9-_:/.]+)?[\]]/,
2
+ test: /^[-,]?[\[][a-zA-Z0-9-_:]+([~*$^]?[=][a-zA-Z0-9-_:/.]+)?[\]]/,
3
3
  process(className) {
4
4
  const match = className.match(this.test);
5
5
  if (match) {
@@ -1,5 +1,5 @@
1
1
  const element = {
2
- test: /^_[_]?[A-Za-z0-9_\.]+(?=[_[-])/,
2
+ test: /^_[_]?[A-Za-z0-9_\.,]+(?=[_[-])/,
3
3
  process(className) {
4
4
  const match = className.match(this.test);
5
5
  if (match) {
@@ -2,6 +2,7 @@ import prefix, { createRegexForPseudo } from './PseudoPrefixNew.js';
2
2
  import extractPrefix from './extractPrefix.js';
3
3
  export default function PseudoEleStateNew(data) {
4
4
  var _a;
5
+ // const match=createRegexForPseudo({...prefix,'--KKK':','});
5
6
  const match = createRegexForPseudo(prefix);
6
7
  if (!match.test(data))
7
8
  return null;
@@ -51,7 +52,7 @@ export default function PseudoEleStateNew(data) {
51
52
  return [cn, `${alias}(${cont})`];
52
53
  }
53
54
  else if (/(^-(-not|-has|-is|-where|-n|-hs|-w|-is)[-_])/.test(data)) {
54
- const mch = data.match(/(^-(-not|-has|-is|-where|-n|-hs|-w|-is)([_-]+[a-zA-Z0-9\.]+)(?=[-|_]))/);
55
+ const mch = data.match(/(^-(-not|-has|-is|-where|-n|-hs|-w|-is)([_-]+[a-zA-Z0-9\.,]+)(?=[-|_]))/);
55
56
  const cn = (mch === null || mch === void 0 ? void 0 : mch[1]) ? data.replace(mch[1], '') : '';
56
57
  const alias = (mch === null || mch === void 0 ? void 0 : mch[2]) ? prefix['-' + mch[2].replace(/-$/, '')] : '';
57
58
  const cont = (_a = PseudoEleStateNew((mch === null || mch === void 0 ? void 0 : mch[3]) + '-dn')) === null || _a === void 0 ? void 0 : _a[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aliascss",
3
- "version": "1.1.20",
3
+ "version": "1.2.0",
4
4
  "description": "AliasCSS is a CSS post processor.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",