@tenoxui/moxie 0.7.0 → 0.7.1

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/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function R(h){return h.replace(/^(\d)/,"\\3$1 ").replace(/([#{}.:;?%&,@+*~'"!^$[\]()=>|/])/g,"\\$1")}function W(h){if(/^(webkit|moz|ms|o)[A-Z]/.test(h)){const e=h.match(/^(webkit|moz|ms|o)/);if(e){const s=e[0];return`-${s}${h.slice(s.length).replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}}return h.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function b(h,e,s,t,i,n){return`${h?`${h}:`:""}${e}${s?"-":""}${s}${t}${i?`/${i}${n}`:""}`}function S(h){return h.replace(/[.*+?^${}()|[\]\\/\\-]/g,"\\$&")}function _(h){if(!h)return[];const e=new Set;return Object.entries(h).forEach(([s,t])=>{t&&typeof t=="object"&&Object.keys(t).forEach(i=>{e.add(i)})}),Array.from(e)}function z({safelist:h=[],property:e={},classes:s={}}={}){const t=s,i=Object.keys(e);if(!t)return[...i,...h].sort((c,o)=>o.length-c.length);const a=[..._(t)];return[...i,...a,...h].sort((c,o)=>o.length-c.length)}function v({inputPrefixChars:h=[],safelist:e=[],property:s={},classes:t={}}={}){let i=z({safelist:e,property:s,classes:t}).map(S);i.length>0&&(i=i.join("|")+"|");const n="\\[[^\\]]+\\]",a="\\([^()]*(?:\\([^()]*\\)[^()]*)*\\)",c="\\{[^{}]*(?:\\{[^{}]*\\}[^{}]*)*\\}",o=`[${["a-zA-Z0-9_\\-",...h].join("")}]`,r=o+"+|"+o+"+(?:-(?:"+n+"|"+a+"|"+c+"))|"+o+"+(?:-(?:"+n+"|"+a+"|"+c+"))?(?:\\/[a-zA-Z0-9_\\-]+)|"+n+"|"+a+"|"+c,d=`(${i}\\[[^\\]]+\\])`,l="(?:-)",$="(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|"+n+"|"+c+"|"+a+"|(?:\\$[^\\s\\/]+))",A="([a-zA-Z%]*)",f="(?:\\/(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|"+n+"|"+c+"|"+a+"|(?:\\$[^\\s\\/]+))([a-zA-Z%]*))?";return{prefix:r,type:d,separator:l,value:$,unit:A,secondValuePattern:f,all:"^(?:("+r+"):)?"+d+l+$+A+f+"$"}}class V{constructor({property:e={},values:s={},classes:t={},prefixChars:i=[]}={}){this.property=e,this.values=s,this.classes=t,this.prefixChars=i.map(S)}parse(e,s){const t=v({safelist:s,property:this.property,classes:this.classes,inputPrefixChars:this.prefixChars}),i=e.match(new RegExp(t.all));if(i){const[,a,c,o,r,d,l]=i;return[a,c,o,r||"",d,l]}const n=e.match(new RegExp(`^(?:(${t.prefix}):)?${t.type}$`));return n?[n[1],n[2],"","",void 0,void 0]:null}processValue(e,s,t){if(!e)return"";const i=n=>n.replace(/\{([^}]+)\}/g,(a,c)=>{const o=this.values,r=o!==null?typeof o[t]=="object"?o[t][c]:o[c]:void 0;return typeof r=="string"?r:a});if(typeof this.values=="object"&&this.values!==null&&(this.values[t]&&typeof this.values[t]=="object"&&this.values[t][e]||this.values[e]))return typeof this.values[t]=="object"&&this.values[t]!==null?this.values[t][e]:this.values[e];if(e.startsWith("$"))return`var(--${e.slice(1)})`;if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("(")&&e.endsWith(")")){const n=e.slice(1,-1).replace(/\\\_/g,"m0x13c55").replace(/\_/g," ").replace(/m0x13c55/g,"_");return n.includes("{")?i(n):n.startsWith("--")?`var(${n})`:n}return e+(s||"")}processShorthand(e="",s="",t="",i,n="",a="",c="",o){const r=this.property[e];if(typeof r=="object"&&!Array.isArray(r)&&!("property"in r))return null;const d=/^(?:\(|\[)([^:]+):(.+)(?:\)|\])$/;let l=null,$=s||"";const A=$.match(d);if(A&&(l=A[1].trim(),$=A[2].trim()),(typeof r=="string"&&!r.includes(":")||Array.isArray(r))&&(!s||s.includes(l+":")||n))return null;let f;s.includes(l+":")?f=s.startsWith("(")?`(${$})`:`[${$}]`:f=s;const y=this.processValue(f,t,e),g=this.processValue(n,a,e);if(e.startsWith("[")&&e.endsWith("]")){if(!s||n)return null;const u=e.slice(1,-1).split(",").map(C=>C.trim().startsWith("--")?String(C.trim()):W(String(C.trim())));return{className:b(i,e,s,t),cssRules:u.length===1?u[0]:u,value:y,prefix:i}}if(r){if(typeof r=="object"&&"property"in r){const C=r.group&&this.values[r.group][y]?this.values[r.group][y]:t?s:y,p=typeof r.property=="function"?r.property({value:s.startsWith("[")?y:C,unit:s.startsWith("[")?"":t,secondValue:s.startsWith("[")?"":a?n:g,secondUnit:s.startsWith("[")?"":a,key:l,raw:o}):r.property;if(p&&typeof p=="object"&&!Array.isArray(p)&&"cssRules"in p){const{className:P,cssRules:j,value:w,prefix:Z}=p;return{className:P||c,cssRules:j,value:w,prefix:Z||i,isCustom:!!P}}const m=r.value||"{0}";let x;if(typeof m=="function")x=m({value:C,unit:t,secondValue:a?n:g,secondUnit:a,key:l,raw:o});else if(typeof m=="string"){const P=r.group||e,j=this.processValue(f,t,P);this.values[P]&&typeof this.values[P]=="object"&&this.values[P][f]?x=this.values[P][f]:m.includes("{")?x=this.parseValuePattern(P,m,j,"",g,""):typeof m=="string"&&!m.includes("{")?x=m:x=y}else if(Array.isArray(m)){if(!m.includes(s+t)||n)return null;x=s+t}else x=null;return(typeof r.property=="string"||Array.isArray(r.property))&&typeof m=="string"&&(s.includes(l+":")||!m.includes("{1")&&n)||(typeof r.property=="string"||Array.isArray(r.property))&&m===null||typeof r.property=="string"&&r.property.includes(":")&&s||(typeof r.property=="string"||Array.isArray(r.property))&&typeof r.value=="string"&&!r.value.includes("{")&&s?null:{className:b(i,e,s,t,n,a),cssRules:p?Array.isArray(p)?p:typeof p=="string"&&(p.includes(":")||p.includes("value:"))&&p.includes("value:")?p.slice(6):W(String(p)):null,value:m===null||p===null||p.includes(":")||p.includes("value:")?null:s.startsWith("[")?y:x,prefix:i}}const u=typeof r=="function"?r({value:s.startsWith("[")?y:t?s:y,unit:s.startsWith("[")?"":t,secondValue:s.startsWith("[")?"":a?n:g,secondUnit:s.startsWith("[")?"":a,key:l,raw:o}):r;if(u&&typeof u=="object"&&!Array.isArray(u)&&"cssRules"in u){const{className:C,cssRules:p,value:m,prefix:x}=u;return{className:C||c,cssRules:p,value:m,prefix:x||i,isCustom:!!C}}return{className:b(i,e,s,t,n,a),cssRules:u?Array.isArray(r)?u:typeof u=="string"&&(u.includes(":")||u.startsWith("value:"))&&u.startsWith("value:")?u.slice(6):W(String(u)):null,value:typeof u=="string"&&u.includes(":")?null:y,prefix:i}}return null}parseValuePattern(e,s,t,i,n,a){if(!s.includes("{0}")&&!s.includes("{1")&&!s.includes("||"))return s;const[c,o]=s.split("||").map(l=>l.trim()),r=this.processValue(t,i,e),d=this.processValue(n,a,e);if(s.includes("{0}")&&s.includes("{1")||s.includes("{1")){let l=c;if(t&&(l=l.replace(/\{0\}/g,r)),s.includes("{1")){s.includes("{1}")&&(n?l=n.startsWith("[")?d:l.replace(/\{1\}/g,d):l=o||c);const $=/\{1([^}]*)\}/g;let A;for(;(A=$.exec(l))!==null;){const f=A[0],y=A[1].trim();let g=d;!g&&y.includes("|")?g=y.split("|")[1].trim():g||(g=""),l=t.startsWith("[")?r:l.replace(f,g)}}return t?l:o||c}else return t?t.startsWith("[")?r:c.replace(/\{0\}/g,r):o||c}getParentClass(e){return Object.keys(this.classes).filter(s=>Object.prototype.hasOwnProperty.call(this.classes[s],e))}processCustomClass(e,s="",t="",i="",n="",a=""){if(!e)return null;const c=this.getParentClass(e),o=s&&e.endsWith(`-${s}${t}`);if(c.length>0){const r=c.map(d=>{const l=this.classes[d];if(!l||s&&!o&&l[e]&&!l[e].includes("{0}")&&!l[e].includes("|"))return null;const $=this.parseValuePattern(e,l[e]||"",s,t,n,a);return`${W(String(d))}: ${$}`}).filter(Boolean).join("; ");return{className:o?e:b(i,e,s,t,n,a),cssRules:r,value:null,prefix:i}}return null}process(e){try{const s=Array.isArray(e)?e:e.split(/\s+/),t=[];for(const i of s)try{if(!i)continue;const n=this.parse(i);if(!n)continue;const[a,c,o,r,d,l]=n;if(!c)continue;const $=[...n,b(a,c,o,r,d,l)],A=this.getParentClass(`${c}-${o}`).length>0?`${c}-${o}`:c;try{const f=this.processCustomClass(A,o,r,a,d,l);if(f){const{className:y,cssRules:g,prefix:u}=f;if(!g||g==="null")continue;t.push({className:R(y),cssRules:g,value:null,prefix:u,raw:$});continue}}catch(f){console.warn(`Error processing custom class "${i}":`,f)}try{const f=this.processShorthand(c,o,r,a,d,l,i,$);if(f){const{className:y,cssRules:g,value:u,prefix:C,isCustom:p}=f;if(!g||g==="null")continue;t.push({className:p?y:R(y),cssRules:g,value:u,prefix:C,raw:$})}}catch(f){console.warn(`Error processing shorthand "${i}":`,f)}}catch(n){console.warn(`Failed to process class \`${i}\`:`,n)}return t}catch(s){return console.error("Critical error in process method:",s),[]}}}exports.TenoxUI=V;exports.constructRaw=b;exports.default=V;exports.escapeCSSSelector=R;exports.regexp=v;exports.toKebabCase=W;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function R(h){return h.replace(/^(\d)/,"\\3$1 ").replace(/([#{}.:;?%&,@+*~'"!^$[\]()=>|/])/g,"\\$1")}function W(h){if(/^(webkit|moz|ms|o)[A-Z]/.test(h)){const e=h.match(/^(webkit|moz|ms|o)/);if(e){const s=e[0];return`-${s}${h.slice(s.length).replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}}return h.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function b(h,e,s,t,l,n){return`${h?`${h}:`:""}${e}${s?"-":""}${s}${t}${l?`/${l}${n}`:""}`}function S(h){return h.replace(/[.*+?^${}()|[\]\\/\\-]/g,"\\$&")}function _(h){if(!h)return[];const e=new Set;return Object.entries(h).forEach(([s,t])=>{t&&typeof t=="object"&&Object.keys(t).forEach(l=>{e.add(l)})}),Array.from(e)}function z({safelist:h=[],property:e={},classes:s={}}={}){const t=s,l=Object.keys(e);if(!t)return[...l,...h].sort((c,o)=>o.length-c.length);const a=[..._(t)];return[...l,...a,...h].sort((c,o)=>o.length-c.length)}function v({inputPrefixChars:h=[],safelist:e=[],property:s={},classes:t={}}={}){let l=z({safelist:e,property:s,classes:t}).map(S);l.length>0&&(l=l.join("|")+"|");const n="\\[[^\\]]+\\]",a="\\([^()]*(?:\\([^()]*\\)[^()]*)*\\)",c="\\{[^{}]*(?:\\{[^{}]*\\}[^{}]*)*\\}",o=`[${["a-zA-Z0-9_\\-",...h].join("")}]`,r=o+"+|"+o+"+(?:-(?:"+n+"|"+a+"|"+c+"))|"+o+"+(?:-(?:"+n+"|"+a+"|"+c+"))?(?:\\/[a-zA-Z0-9_\\-]+)|"+n+"|"+a+"|"+c,d=`(${l}\\[[^\\]]+\\])`,i="(?:-)",$="(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|"+n+"|"+c+"|"+a+"|(?:\\$[^\\s\\/]+))",A="([a-zA-Z%]*)",f="(?:\\/(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|"+n+"|"+c+"|"+a+"|(?:\\$[^\\s\\/]+))([a-zA-Z%]*))?";return{prefix:r,type:d,separator:i,value:$,unit:A,secondValuePattern:f,all:"^(?:("+r+"):)?"+d+i+$+A+f+"$"}}class V{constructor({property:e={},values:s={},classes:t={},prefixChars:l=[]}={}){this.property=e,this.values=s,this.classes=t,this.prefixChars=l.map(S)}regexp(e){return v({safelist:e,property:this.property,classes:this.classes,inputPrefixChars:this.prefixChars})}parse(e,s){const t=this.regexp(s),l=e.match(new RegExp(t.all));if(l){const[,a,c,o,r,d,i]=l;return[a,c,o,r||"",d,i]}const n=e.match(new RegExp(`^(?:(${t.prefix}):)?${t.type}$`));return n?[n[1],n[2],"","",void 0,void 0]:null}processValue(e,s,t){if(!e)return"";const l=n=>n.replace(/\{([^}]+)\}/g,(a,c)=>{const o=this.values,r=o!==null?typeof o[t]=="object"?o[t][c]:o[c]:void 0;return typeof r=="string"?r:a});if(typeof this.values=="object"&&this.values!==null&&(this.values[t]&&typeof this.values[t]=="object"&&this.values[t][e]||this.values[e]))return typeof this.values[t]=="object"&&this.values[t]!==null?this.values[t][e]:this.values[e];if(e.startsWith("$"))return`var(--${e.slice(1)})`;if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("(")&&e.endsWith(")")){const n=e.slice(1,-1).replace(/\\\_/g,"m0x13c55").replace(/\_/g," ").replace(/m0x13c55/g,"_");return n.includes("{")?l(n):n.startsWith("--")?`var(${n})`:n}return e+(s||"")}processShorthand(e="",s="",t="",l,n="",a="",c="",o){const r=this.property[e];if(typeof r=="object"&&!Array.isArray(r)&&!("property"in r))return null;const d=/^(?:\(|\[)([^:]+):(.+)(?:\)|\])$/;let i=null,$=s||"";const A=$.match(d);if(A&&(i=A[1].trim(),$=A[2].trim()),(typeof r=="string"&&!r.includes(":")||Array.isArray(r))&&(!s||s.includes(i+":")||n))return null;let f;s.includes(i+":")?f=s.startsWith("(")?`(${$})`:`[${$}]`:f=s;const y=this.processValue(f,t,e),g=this.processValue(n,a,e);if(e.startsWith("[")&&e.endsWith("]")){if(!s||n)return null;const u=e.slice(1,-1).split(",").map(C=>C.trim().startsWith("--")?String(C.trim()):W(String(C.trim())));return{className:b(l,e,s,t),cssRules:u.length===1?u[0]:u,value:y,prefix:l}}if(r){if(typeof r=="object"&&"property"in r){const C=r.group&&this.values[r.group][y]?this.values[r.group][y]:t?s:y,p=typeof r.property=="function"?r.property({value:s.startsWith("[")?y:C,unit:s.startsWith("[")?"":t,secondValue:s.startsWith("[")?"":a?n:g,secondUnit:s.startsWith("[")?"":a,key:i,raw:o}):r.property;if(p&&typeof p=="object"&&!Array.isArray(p)&&"cssRules"in p){const{className:P,cssRules:j=null,value:w=null,prefix:Z}=p;return{className:P||c,cssRules:j,value:w,prefix:Z||l,isCustom:!!P}}const m=r.value||"{0}";let x;if(typeof m=="function")x=m({value:C,unit:t,secondValue:a?n:g,secondUnit:a,key:i,raw:o});else if(typeof m=="string"){const P=r.group||e,j=this.processValue(f,t,P);this.values[P]&&typeof this.values[P]=="object"&&this.values[P][f]?x=this.values[P][f]:m.includes("{")?x=this.parseValuePattern(P,m,j,"",g,""):typeof m=="string"&&!m.includes("{")?x=m:x=y}else if(Array.isArray(m)){if(!m.includes(s+t)||n)return null;x=s+t}else x=null;return(typeof r.property=="string"||Array.isArray(r.property))&&typeof m=="string"&&(s.includes(i+":")||!m.includes("{1")&&n)||(typeof r.property=="string"||Array.isArray(r.property))&&m===null||typeof r.property=="string"&&r.property.includes(":")&&s||(typeof r.property=="string"||Array.isArray(r.property))&&typeof r.value=="string"&&!r.value.includes("{")&&s?null:{className:b(l,e,s,t,n,a),cssRules:p?Array.isArray(p)?p:typeof p=="string"&&(p.includes(":")||p.includes("value:"))&&p.includes("value:")?p.slice(6):W(String(p)):null,value:m===null||p===null||p.includes(":")||p.includes("value:")?null:s.startsWith("[")?y:x,prefix:l}}const u=typeof r=="function"?r({value:s.startsWith("[")?y:t?s:y,unit:s.startsWith("[")?"":t,secondValue:s.startsWith("[")?"":a?n:g,secondUnit:s.startsWith("[")?"":a,key:i,raw:o}):r;if(u&&typeof u=="object"&&!Array.isArray(u)&&"cssRules"in u){const{className:C,cssRules:p=null,value:m=null,prefix:x}=u;return{className:C||c,cssRules:p,value:m,prefix:x||l,isCustom:!!C}}return{className:b(l,e,s,t,n,a),cssRules:u?Array.isArray(u)?u:typeof u=="string"&&(u.includes(":")||u.startsWith("value:"))&&u.startsWith("value:")?u.slice(6):W(String(u)):null,value:typeof u=="string"&&u.includes(":")?null:y,prefix:l}}return null}parseValuePattern(e,s,t,l,n,a){if(!s.includes("{0}")&&!s.includes("{1")&&!s.includes("||"))return s;const[c,o]=s.split("||").map(i=>i.trim()),r=this.processValue(t,l,e),d=this.processValue(n,a,e);if(s.includes("{0}")&&s.includes("{1")||s.includes("{1")){let i=c;if(t&&(i=i.replace(/\{0\}/g,r)),s.includes("{1")){s.includes("{1}")&&(n?i=n.startsWith("[")?d:i.replace(/\{1\}/g,d):i=o||c);const $=/\{1([^}]*)\}/g;let A;for(;(A=$.exec(i))!==null;){const f=A[0],y=A[1].trim();let g=d;!g&&y.includes("|")?g=y.split("|")[1].trim():g||(g=""),i=t.startsWith("[")?r:i.replace(f,g)}}return t?i:o||c}else return t?t.startsWith("[")?r:c.replace(/\{0\}/g,r):o||c}getParentClass(e){return Object.keys(this.classes).filter(s=>Object.prototype.hasOwnProperty.call(this.classes[s],e))}processCustomClass(e,s="",t="",l="",n="",a=""){if(!e)return null;const c=this.getParentClass(e),o=s&&e.endsWith(`-${s}${t}`);if(c.length>0){const r=c.map(d=>{const i=this.classes[d];if(!i||s&&!o&&i[e]&&!i[e].includes("{0}")&&!i[e].includes("|"))return null;const $=this.parseValuePattern(e,i[e]||"",s,t,n,a);return`${W(String(d))}: ${$}`}).filter(Boolean).join("; ");return{className:o?e:b(l,e,s,t,n,a),cssRules:r,value:null,prefix:l}}return null}process(e){try{const s=Array.isArray(e)?e:e.split(/\s+/),t=[];for(const l of s)try{if(!l)continue;const n=this.parse(l);if(!n)continue;const[a,c,o,r,d,i]=n;if(!c)continue;const $=[...n,b(a,c,o,r,d,i)],A=this.getParentClass(`${c}-${o}`).length>0?`${c}-${o}`:c;try{const f=this.processCustomClass(A,o,r,a,d,i);if(f){const{className:y,cssRules:g,prefix:u}=f;if(!g||g==="null")continue;t.push({className:R(y),cssRules:g,value:null,prefix:u,raw:$});continue}}catch(f){console.warn(`Error processing custom class "${l}":`,f)}try{const f=this.processShorthand(c,o,r,a,d,i,l,$);if(f){const{className:y,cssRules:g,value:u,prefix:C,isCustom:p}=f;if(!g||g==="null")continue;t.push({className:p?y:R(y),cssRules:g,value:u,prefix:C,raw:$})}}catch(f){console.warn(`Error processing shorthand "${l}":`,f)}}catch(n){console.warn(`Failed to process class \`${l}\`:`,n)}return t}catch(s){return console.error("Critical error in process method:",s),[]}}}exports.TenoxUI=V;exports.constructRaw=b;exports.default=V;exports.escapeCSSSelector=R;exports.regexp=v;exports.toKebabCase=W;
package/dist/index.d.ts CHANGED
@@ -5,6 +5,15 @@ export declare class TenoxUI {
5
5
  private classes;
6
6
  private prefixChars;
7
7
  constructor({ property, values, classes, prefixChars }?: Config);
8
+ regexp(safelist?: string[]): {
9
+ prefix: string;
10
+ type: string;
11
+ separator: string;
12
+ value: string;
13
+ unit: string;
14
+ secondValuePattern: string;
15
+ all: string;
16
+ };
8
17
  parse(className: string, safelist?: string[]): Parsed;
9
18
  processValue(value: string, unit: string, group: string): string;
10
19
  processShorthand(type: string | undefined, value: string | undefined, unit: string | undefined, prefix: string | undefined, secondValue: string | undefined, secondUnit: string | undefined, className: string | undefined, raw: Parsed): ProcessedStyle | null;
package/dist/index.es.js CHANGED
@@ -3,141 +3,144 @@ function R(h) {
3
3
  }
4
4
  function P(h) {
5
5
  if (/^(webkit|moz|ms|o)[A-Z]/.test(h)) {
6
- const t = h.match(/^(webkit|moz|ms|o)/);
7
- if (t) {
8
- const s = t[0];
9
- return `-${s}${h.slice(s.length).replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`)}`;
6
+ const e = h.match(/^(webkit|moz|ms|o)/);
7
+ if (e) {
8
+ const s = e[0];
9
+ return `-${s}${h.slice(s.length).replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`)}`;
10
10
  }
11
11
  }
12
- return h.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
12
+ return h.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
13
13
  }
14
- function b(h, t, s, e, i, n) {
15
- return `${h ? `${h}:` : ""}${t}${s ? "-" : ""}${s}${e}${i ? `/${i}${n}` : ""}`;
14
+ function b(h, e, s, t, l, n) {
15
+ return `${h ? `${h}:` : ""}${e}${s ? "-" : ""}${s}${t}${l ? `/${l}${n}` : ""}`;
16
16
  }
17
17
  function V(h) {
18
18
  return h.replace(/[.*+?^${}()|[\]\\/\\-]/g, "\\$&");
19
19
  }
20
20
  function S(h) {
21
21
  if (!h) return [];
22
- const t = /* @__PURE__ */ new Set();
23
- return Object.entries(h).forEach(([s, e]) => {
24
- e && typeof e == "object" && Object.keys(e).forEach((i) => {
25
- t.add(i);
22
+ const e = /* @__PURE__ */ new Set();
23
+ return Object.entries(h).forEach(([s, t]) => {
24
+ t && typeof t == "object" && Object.keys(t).forEach((l) => {
25
+ e.add(l);
26
26
  });
27
- }), Array.from(t);
27
+ }), Array.from(e);
28
28
  }
29
29
  function Z({
30
30
  safelist: h = [],
31
- property: t = {},
31
+ property: e = {},
32
32
  classes: s = {}
33
33
  } = {}) {
34
- const e = s, i = Object.keys(t);
35
- if (!e)
36
- return [...i, ...h].sort((c, o) => o.length - c.length);
37
- const a = [...S(e)];
38
- return [...i, ...a, ...h].sort((c, o) => o.length - c.length);
34
+ const t = s, l = Object.keys(e);
35
+ if (!t)
36
+ return [...l, ...h].sort((c, o) => o.length - c.length);
37
+ const a = [...S(t)];
38
+ return [...l, ...a, ...h].sort((c, o) => o.length - c.length);
39
39
  }
40
40
  function z({
41
41
  inputPrefixChars: h = [],
42
- safelist: t = [],
42
+ safelist: e = [],
43
43
  property: s = {},
44
- classes: e = {}
44
+ classes: t = {}
45
45
  } = {}) {
46
- let i = Z({ safelist: t, property: s, classes: e }).map(
46
+ let l = Z({ safelist: e, property: s, classes: t }).map(
47
47
  V
48
48
  );
49
- i.length > 0 && (i = i.join("|") + "|");
49
+ l.length > 0 && (l = l.join("|") + "|");
50
50
  const n = "\\[[^\\]]+\\]", a = "\\([^()]*(?:\\([^()]*\\)[^()]*)*\\)", c = "\\{[^{}]*(?:\\{[^{}]*\\}[^{}]*)*\\}", o = `[${["a-zA-Z0-9_\\-", ...h].join("")}]`, r = (
51
51
  // Simple prefix (hover, md, focus, etc.)
52
52
  o + "+|" + // value-like prefix (nth-(4), max-[445px], etc.)
53
53
  o + "+(?:-(?:" + n + "|" + a + "|" + c + "))|" + // added support for custom secondValue for prefix
54
54
  o + "+(?:-(?:" + n + "|" + a + "|" + c + "))?(?:\\/[a-zA-Z0-9_\\-]+)|" + // Direct bracket, parenthesis, or brace content
55
55
  n + "|" + a + "|" + c
56
- ), d = `(${i}\\[[^\\]]+\\])`, l = "(?:-)", $ = "(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|" + // Hex colors
56
+ ), d = `(${l}\\[[^\\]]+\\])`, i = "(?:-)", $ = "(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|" + // Hex colors
57
57
  n + "|" + // Bracket content
58
58
  c + "|" + // Curly brace content
59
59
  a + "|(?:\\$[^\\s\\/]+))", A = "([a-zA-Z%]*)", f = "(?:\\/(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|" + n + "|" + c + "|" + a + "|(?:\\$[^\\s\\/]+))([a-zA-Z%]*))?";
60
60
  return {
61
61
  prefix: r,
62
62
  type: d,
63
- separator: l,
63
+ separator: i,
64
64
  value: $,
65
65
  unit: A,
66
66
  secondValuePattern: f,
67
- all: "^(?:(" + r + "):)?" + d + l + $ + A + f + "$"
67
+ all: "^(?:(" + r + "):)?" + d + i + $ + A + f + "$"
68
68
  };
69
69
  }
70
70
  class _ {
71
- constructor({ property: t = {}, values: s = {}, classes: e = {}, prefixChars: i = [] } = {}) {
72
- this.property = t, this.values = s, this.classes = e, this.prefixChars = i.map(V);
71
+ constructor({ property: e = {}, values: s = {}, classes: t = {}, prefixChars: l = [] } = {}) {
72
+ this.property = e, this.values = s, this.classes = t, this.prefixChars = l.map(V);
73
73
  }
74
- parse(t, s) {
75
- const e = z({
76
- safelist: s,
74
+ regexp(e) {
75
+ return z({
76
+ safelist: e,
77
77
  property: this.property,
78
78
  classes: this.classes,
79
79
  inputPrefixChars: this.prefixChars
80
- }), i = t.match(new RegExp(e.all));
81
- if (i) {
82
- const [, a, c, o, r, d, l] = i;
83
- return [a, c, o, r || "", d, l];
80
+ });
81
+ }
82
+ parse(e, s) {
83
+ const t = this.regexp(s), l = e.match(new RegExp(t.all));
84
+ if (l) {
85
+ const [, a, c, o, r, d, i] = l;
86
+ return [a, c, o, r || "", d, i];
84
87
  }
85
- const n = t.match(
86
- new RegExp(`^(?:(${e.prefix}):)?${e.type}$`)
88
+ const n = e.match(
89
+ new RegExp(`^(?:(${t.prefix}):)?${t.type}$`)
87
90
  );
88
91
  return n ? [n[1], n[2], "", "", void 0, void 0] : null;
89
92
  }
90
93
  // unique value parser
91
- processValue(t, s, e) {
92
- if (!t) return "";
93
- const i = (n) => n.replace(/\{([^}]+)\}/g, (a, c) => {
94
- const o = this.values, r = o !== null ? typeof o[e] == "object" ? o[e][c] : o[c] : void 0;
94
+ processValue(e, s, t) {
95
+ if (!e) return "";
96
+ const l = (n) => n.replace(/\{([^}]+)\}/g, (a, c) => {
97
+ const o = this.values, r = o !== null ? typeof o[t] == "object" ? o[t][c] : o[c] : void 0;
95
98
  return typeof r == "string" ? r : a;
96
99
  });
97
- if (typeof this.values == "object" && this.values !== null && (this.values[e] && typeof this.values[e] == "object" && this.values[e][t] || this.values[t]))
98
- return typeof this.values[e] == "object" && this.values[e] !== null ? this.values[e][t] : this.values[t];
99
- if (t.startsWith("$"))
100
- return `var(--${t.slice(1)})`;
101
- if (t.startsWith("[") && t.endsWith("]") || t.startsWith("(") && t.endsWith(")")) {
102
- const n = t.slice(1, -1).replace(/\\\_/g, "m0x13c55").replace(/\_/g, " ").replace(/m0x13c55/g, "_");
103
- return n.includes("{") ? i(n) : n.startsWith("--") ? `var(${n})` : n;
100
+ if (typeof this.values == "object" && this.values !== null && (this.values[t] && typeof this.values[t] == "object" && this.values[t][e] || this.values[e]))
101
+ return typeof this.values[t] == "object" && this.values[t] !== null ? this.values[t][e] : this.values[e];
102
+ if (e.startsWith("$"))
103
+ return `var(--${e.slice(1)})`;
104
+ if (e.startsWith("[") && e.endsWith("]") || e.startsWith("(") && e.endsWith(")")) {
105
+ const n = e.slice(1, -1).replace(/\\\_/g, "m0x13c55").replace(/\_/g, " ").replace(/m0x13c55/g, "_");
106
+ return n.includes("{") ? l(n) : n.startsWith("--") ? `var(${n})` : n;
104
107
  }
105
- return t + (s || "");
108
+ return e + (s || "");
106
109
  }
107
- processShorthand(t = "", s = "", e = "", i, n = "", a = "", c = "", o) {
108
- const r = this.property[t];
110
+ processShorthand(e = "", s = "", t = "", l, n = "", a = "", c = "", o) {
111
+ const r = this.property[e];
109
112
  if (typeof r == "object" && !Array.isArray(r) && !("property" in r))
110
113
  return null;
111
114
  const d = /^(?:\(|\[)([^:]+):(.+)(?:\)|\])$/;
112
- let l = null, $ = s || "";
115
+ let i = null, $ = s || "";
113
116
  const A = $.match(d);
114
- if (A && (l = A[1].trim(), $ = A[2].trim()), (typeof r == "string" && !r.includes(":") || Array.isArray(r)) && (!s || s.includes(l + ":") || n))
117
+ if (A && (i = A[1].trim(), $ = A[2].trim()), (typeof r == "string" && !r.includes(":") || Array.isArray(r)) && (!s || s.includes(i + ":") || n))
115
118
  return null;
116
119
  let f;
117
- s.includes(l + ":") ? f = s.startsWith("(") ? `(${$})` : `[${$}]` : f = s;
118
- const y = this.processValue(f, e, t), g = this.processValue(n, a, t);
119
- if (t.startsWith("[") && t.endsWith("]")) {
120
+ s.includes(i + ":") ? f = s.startsWith("(") ? `(${$})` : `[${$}]` : f = s;
121
+ const y = this.processValue(f, t, e), g = this.processValue(n, a, e);
122
+ if (e.startsWith("[") && e.endsWith("]")) {
120
123
  if (!s || n) return null;
121
- const u = t.slice(1, -1).split(",").map(
124
+ const u = e.slice(1, -1).split(",").map(
122
125
  (C) => C.trim().startsWith("--") ? String(C.trim()) : P(String(C.trim()))
123
126
  );
124
127
  return {
125
- className: b(i, t, s, e),
128
+ className: b(l, e, s, t),
126
129
  cssRules: u.length === 1 ? u[0] : u,
127
130
  value: y,
128
- prefix: i
131
+ prefix: l
129
132
  };
130
133
  }
131
134
  if (r) {
132
135
  if (typeof r == "object" && "property" in r) {
133
- const C = r.group && this.values[r.group][y] ? this.values[r.group][y] : e ? s : y, p = (
136
+ const C = r.group && this.values[r.group][y] ? this.values[r.group][y] : t ? s : y, p = (
134
137
  // handle `properties.property` function
135
138
  typeof r.property == "function" ? r.property({
136
139
  value: s.startsWith("[") ? y : C,
137
- unit: s.startsWith("[") ? "" : e,
140
+ unit: s.startsWith("[") ? "" : t,
138
141
  secondValue: s.startsWith("[") ? "" : a ? n : g,
139
142
  secondUnit: s.startsWith("[") ? "" : a,
140
- key: l,
143
+ key: i,
141
144
  raw: o
142
145
  }) : (
143
146
  // defaulting to string property
@@ -148,12 +151,17 @@ class _ {
148
151
  )
149
152
  );
150
153
  if (p && typeof p == "object" && !Array.isArray(p) && "cssRules" in p) {
151
- const { className: W, cssRules: j, value: v, prefix: w } = p;
154
+ const {
155
+ className: W,
156
+ cssRules: j = null,
157
+ value: v = null,
158
+ prefix: w
159
+ } = p;
152
160
  return {
153
161
  className: W || c,
154
162
  cssRules: j,
155
163
  value: v,
156
- prefix: w || i,
164
+ prefix: w || l,
157
165
  isCustom: !!W
158
166
  };
159
167
  }
@@ -162,14 +170,14 @@ class _ {
162
170
  if (typeof m == "function")
163
171
  x = m({
164
172
  value: C,
165
- unit: e,
173
+ unit: t,
166
174
  secondValue: a ? n : g,
167
175
  secondUnit: a,
168
- key: l,
176
+ key: i,
169
177
  raw: o
170
178
  });
171
179
  else if (typeof m == "string") {
172
- const W = r.group || t, j = this.processValue(f, e, W);
180
+ const W = r.group || e, j = this.processValue(f, t, W);
173
181
  this.values[W] && typeof this.values[W] == "object" && this.values[W][f] ? x = this.values[W][f] : m.includes("{") ? x = this.parseValuePattern(
174
182
  W,
175
183
  m,
@@ -179,14 +187,14 @@ class _ {
179
187
  ""
180
188
  ) : typeof m == "string" && !m.includes("{") ? x = m : x = y;
181
189
  } else if (Array.isArray(m)) {
182
- if (!m.includes(s + e) || n) return null;
183
- x = s + e;
190
+ if (!m.includes(s + t) || n) return null;
191
+ x = s + t;
184
192
  } else x = null;
185
- return (typeof r.property == "string" || Array.isArray(r.property)) && typeof m == "string" && (s.includes(l + ":") || !m.includes("{1") && n) || // check if the property is string or array of properties
193
+ return (typeof r.property == "string" || Array.isArray(r.property)) && typeof m == "string" && (s.includes(i + ":") || !m.includes("{1") && n) || // check if the property is string or array of properties
186
194
  // but the value is null
187
195
  (typeof r.property == "string" || Array.isArray(r.property)) && m === null || // check if the type is a direct rules but has `value` defined
188
196
  typeof r.property == "string" && r.property.includes(":") && s || (typeof r.property == "string" || Array.isArray(r.property)) && typeof r.value == "string" && !r.value.includes("{") && s ? null : {
189
- className: b(i, t, s, e, n, a),
197
+ className: b(l, e, s, t, n, a),
190
198
  cssRules: (
191
199
  // if not property, or when `properties.property` as function return null
192
200
  p ? Array.isArray(p) ? p : (
@@ -198,7 +206,7 @@ class _ {
198
206
  ) : null
199
207
  ),
200
208
  value: m === null || p === null || p.includes(":") || p.includes("value:") ? null : s.startsWith("[") ? y : x,
201
- prefix: i
209
+ prefix: l
202
210
  };
203
211
  }
204
212
  const u = (
@@ -207,11 +215,11 @@ class _ {
207
215
  // m-4 => margin: 4px
208
216
  // m-4rem => margin: 4rem
209
217
  typeof r == "function" ? r({
210
- value: s.startsWith("[") ? y : e ? s : y,
211
- unit: s.startsWith("[") ? "" : e,
218
+ value: s.startsWith("[") ? y : t ? s : y,
219
+ unit: s.startsWith("[") ? "" : t,
212
220
  secondValue: s.startsWith("[") ? "" : a ? n : g,
213
221
  secondUnit: s.startsWith("[") ? "" : a,
214
- key: l,
222
+ key: i,
215
223
  raw: o
216
224
  }) : (
217
225
  // e.g. { property: { bg: 'background' } }
@@ -220,90 +228,95 @@ class _ {
220
228
  )
221
229
  );
222
230
  if (u && typeof u == "object" && !Array.isArray(u) && "cssRules" in u) {
223
- const { className: C, cssRules: p, value: m, prefix: x } = u;
231
+ const {
232
+ className: C,
233
+ cssRules: p = null,
234
+ value: m = null,
235
+ prefix: x
236
+ } = u;
224
237
  return {
225
238
  className: C || c,
226
239
  cssRules: p,
227
240
  value: m,
228
- prefix: x || i,
241
+ prefix: x || l,
229
242
  isCustom: !!C
230
243
  };
231
244
  }
232
245
  return {
233
- className: b(i, t, s, e, n, a),
234
- cssRules: u ? Array.isArray(r) ? u : typeof u == "string" && (u.includes(":") || u.startsWith("value:")) && u.startsWith("value:") ? u.slice(6) : P(String(u)) : null,
246
+ className: b(l, e, s, t, n, a),
247
+ cssRules: u ? Array.isArray(u) ? u : typeof u == "string" && (u.includes(":") || u.startsWith("value:")) && u.startsWith("value:") ? u.slice(6) : P(String(u)) : null,
235
248
  value: typeof u == "string" && u.includes(":") ? null : y,
236
- prefix: i
249
+ prefix: l
237
250
  };
238
251
  }
239
252
  return null;
240
253
  }
241
- parseValuePattern(t, s, e, i, n, a) {
254
+ parseValuePattern(e, s, t, l, n, a) {
242
255
  if (!s.includes("{0}") && !s.includes("{1") && !s.includes("||"))
243
256
  return s;
244
- const [c, o] = s.split("||").map((l) => l.trim()), r = this.processValue(e, i, t), d = this.processValue(n, a, t);
257
+ const [c, o] = s.split("||").map((i) => i.trim()), r = this.processValue(t, l, e), d = this.processValue(n, a, e);
245
258
  if (s.includes("{0}") && s.includes("{1") || s.includes("{1")) {
246
- let l = c;
247
- if (e && (l = l.replace(/\{0\}/g, r)), s.includes("{1")) {
248
- s.includes("{1}") && (n ? l = n.startsWith("[") ? d : l.replace(/\{1\}/g, d) : l = o || c);
259
+ let i = c;
260
+ if (t && (i = i.replace(/\{0\}/g, r)), s.includes("{1")) {
261
+ s.includes("{1}") && (n ? i = n.startsWith("[") ? d : i.replace(/\{1\}/g, d) : i = o || c);
249
262
  const $ = /\{1([^}]*)\}/g;
250
263
  let A;
251
- for (; (A = $.exec(l)) !== null; ) {
264
+ for (; (A = $.exec(i)) !== null; ) {
252
265
  const f = A[0], y = A[1].trim();
253
266
  let g = d;
254
- !g && y.includes("|") ? g = y.split("|")[1].trim() : g || (g = ""), l = e.startsWith("[") ? r : l.replace(f, g);
267
+ !g && y.includes("|") ? g = y.split("|")[1].trim() : g || (g = ""), i = t.startsWith("[") ? r : i.replace(f, g);
255
268
  }
256
269
  }
257
- return e ? l : o || c;
270
+ return t ? i : o || c;
258
271
  } else
259
- return e ? e.startsWith("[") ? r : c.replace(/\{0\}/g, r) : o || c;
272
+ return t ? t.startsWith("[") ? r : c.replace(/\{0\}/g, r) : o || c;
260
273
  }
261
- getParentClass(t) {
274
+ getParentClass(e) {
262
275
  return Object.keys(this.classes).filter(
263
276
  (s) => Object.prototype.hasOwnProperty.call(
264
277
  this.classes[s],
265
- t
278
+ e
266
279
  )
267
280
  );
268
281
  }
269
- processCustomClass(t, s = "", e = "", i = "", n = "", a = "") {
270
- if (!t) return null;
271
- const c = this.getParentClass(t), o = s && t.endsWith(`-${s}${e}`);
282
+ processCustomClass(e, s = "", t = "", l = "", n = "", a = "") {
283
+ if (!e) return null;
284
+ const c = this.getParentClass(e), o = s && e.endsWith(`-${s}${t}`);
272
285
  if (c.length > 0) {
273
286
  const r = c.map((d) => {
274
- const l = this.classes[d];
275
- if (!l || s && !o && l[t] && !l[t].includes("{0}") && !l[t].includes("|"))
287
+ const i = this.classes[d];
288
+ if (!i || s && !o && i[e] && !i[e].includes("{0}") && !i[e].includes("|"))
276
289
  return null;
277
290
  const $ = this.parseValuePattern(
278
- t,
279
- l[t] || "",
280
- s,
281
291
  e,
292
+ i[e] || "",
293
+ s,
294
+ t,
282
295
  n,
283
296
  a
284
297
  );
285
298
  return `${P(String(d))}: ${$}`;
286
299
  }).filter(Boolean).join("; ");
287
300
  return {
288
- className: o ? t : b(i, t, s, e, n, a),
301
+ className: o ? e : b(l, e, s, t, n, a),
289
302
  cssRules: r,
290
303
  value: null,
291
- prefix: i
304
+ prefix: l
292
305
  };
293
306
  }
294
307
  return null;
295
308
  }
296
- process(t) {
309
+ process(e) {
297
310
  try {
298
- const s = Array.isArray(t) ? t : t.split(/\s+/), e = [];
299
- for (const i of s)
311
+ const s = Array.isArray(e) ? e : e.split(/\s+/), t = [];
312
+ for (const l of s)
300
313
  try {
301
- if (!i) continue;
302
- const n = this.parse(i);
314
+ if (!l) continue;
315
+ const n = this.parse(l);
303
316
  if (!n) continue;
304
- const [a, c, o, r, d, l] = n;
317
+ const [a, c, o, r, d, i] = n;
305
318
  if (!c) continue;
306
- const $ = [...n, b(a, c, o, r, d, l)], A = this.getParentClass(`${c}-${o}`).length > 0 ? `${c}-${o}` : c;
319
+ const $ = [...n, b(a, c, o, r, d, i)], A = this.getParentClass(`${c}-${o}`).length > 0 ? `${c}-${o}` : c;
307
320
  try {
308
321
  const f = this.processCustomClass(
309
322
  A,
@@ -311,12 +324,12 @@ class _ {
311
324
  r,
312
325
  a,
313
326
  d,
314
- l
327
+ i
315
328
  );
316
329
  if (f) {
317
330
  const { className: y, cssRules: g, prefix: u } = f;
318
331
  if (!g || g === "null") continue;
319
- e.push({
332
+ t.push({
320
333
  className: R(y),
321
334
  cssRules: g,
322
335
  value: null,
@@ -326,7 +339,7 @@ class _ {
326
339
  continue;
327
340
  }
328
341
  } catch (f) {
329
- console.warn(`Error processing custom class "${i}":`, f);
342
+ console.warn(`Error processing custom class "${l}":`, f);
330
343
  }
331
344
  try {
332
345
  const f = this.processShorthand(
@@ -335,14 +348,14 @@ class _ {
335
348
  r,
336
349
  a,
337
350
  d,
338
- l,
339
351
  i,
352
+ l,
340
353
  $
341
354
  );
342
355
  if (f) {
343
356
  const { className: y, cssRules: g, value: u, prefix: C, isCustom: p } = f;
344
357
  if (!g || g === "null") continue;
345
- e.push({
358
+ t.push({
346
359
  className: p ? y : R(y),
347
360
  cssRules: g,
348
361
  value: u,
@@ -351,12 +364,12 @@ class _ {
351
364
  });
352
365
  }
353
366
  } catch (f) {
354
- console.warn(`Error processing shorthand "${i}":`, f);
367
+ console.warn(`Error processing shorthand "${l}":`, f);
355
368
  }
356
369
  } catch (n) {
357
- console.warn(`Failed to process class \`${i}\`:`, n);
370
+ console.warn(`Failed to process class \`${l}\`:`, n);
358
371
  }
359
- return e;
372
+ return t;
360
373
  } catch (s) {
361
374
  return console.error("Critical error in process method:", s), [];
362
375
  }
@@ -1 +1 @@
1
- var __tenoxui_moxie__=function(b){"use strict";function R(h){return h.replace(/^(\d)/,"\\3$1 ").replace(/([#{}.:;?%&,@+*~'"!^$[\]()=>|/])/g,"\\$1")}function x(h){if(/^(webkit|moz|ms|o)[A-Z]/.test(h)){const e=h.match(/^(webkit|moz|ms|o)/);if(e){const s=e[0];return`-${s}${h.slice(s.length).replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}}return h.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function j(h,e,s,t,i,n){return`${h?`${h}:`:""}${e}${s?"-":""}${s}${t}${i?`/${i}${n}`:""}`}function _(h){return h.replace(/[.*+?^${}()|[\]\\/\\-]/g,"\\$&")}function w(h){if(!h)return[];const e=new Set;return Object.entries(h).forEach(([s,t])=>{t&&typeof t=="object"&&Object.keys(t).forEach(i=>{e.add(i)})}),Array.from(e)}function Z({safelist:h=[],property:e={},classes:s={}}={}){const t=s,i=Object.keys(e);if(!t)return[...i,...h].sort((c,a)=>a.length-c.length);const o=[...w(t)];return[...i,...o,...h].sort((c,a)=>a.length-c.length)}function v({inputPrefixChars:h=[],safelist:e=[],property:s={},classes:t={}}={}){let i=Z({safelist:e,property:s,classes:t}).map(_);i.length>0&&(i=i.join("|")+"|");const n="\\[[^\\]]+\\]",o="\\([^()]*(?:\\([^()]*\\)[^()]*)*\\)",c="\\{[^{}]*(?:\\{[^{}]*\\}[^{}]*)*\\}",a=`[${["a-zA-Z0-9_\\-",...h].join("")}]`,r=a+"+|"+a+"+(?:-(?:"+n+"|"+o+"|"+c+"))|"+a+"+(?:-(?:"+n+"|"+o+"|"+c+"))?(?:\\/[a-zA-Z0-9_\\-]+)|"+n+"|"+o+"|"+c,d=`(${i}\\[[^\\]]+\\])`,l="(?:-)",$="(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|"+n+"|"+c+"|"+o+"|(?:\\$[^\\s\\/]+))",A="([a-zA-Z%]*)",p="(?:\\/(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|"+n+"|"+c+"|"+o+"|(?:\\$[^\\s\\/]+))([a-zA-Z%]*))?";return{prefix:r,type:d,separator:l,value:$,unit:A,secondValuePattern:p,all:"^(?:("+r+"):)?"+d+l+$+A+p+"$"}}class V{constructor({property:e={},values:s={},classes:t={},prefixChars:i=[]}={}){this.property=e,this.values=s,this.classes=t,this.prefixChars=i.map(_)}parse(e,s){const t=v({safelist:s,property:this.property,classes:this.classes,inputPrefixChars:this.prefixChars}),i=e.match(new RegExp(t.all));if(i){const[,o,c,a,r,d,l]=i;return[o,c,a,r||"",d,l]}const n=e.match(new RegExp(`^(?:(${t.prefix}):)?${t.type}$`));return n?[n[1],n[2],"","",void 0,void 0]:null}processValue(e,s,t){if(!e)return"";const i=n=>n.replace(/\{([^}]+)\}/g,(o,c)=>{const a=this.values,r=a!==null?typeof a[t]=="object"?a[t][c]:a[c]:void 0;return typeof r=="string"?r:o});if(typeof this.values=="object"&&this.values!==null&&(this.values[t]&&typeof this.values[t]=="object"&&this.values[t][e]||this.values[e]))return typeof this.values[t]=="object"&&this.values[t]!==null?this.values[t][e]:this.values[e];if(e.startsWith("$"))return`var(--${e.slice(1)})`;if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("(")&&e.endsWith(")")){const n=e.slice(1,-1).replace(/\\\_/g,"m0x13c55").replace(/\_/g," ").replace(/m0x13c55/g,"_");return n.includes("{")?i(n):n.startsWith("--")?`var(${n})`:n}return e+(s||"")}processShorthand(e="",s="",t="",i,n="",o="",c="",a){const r=this.property[e];if(typeof r=="object"&&!Array.isArray(r)&&!("property"in r))return null;const d=/^(?:\(|\[)([^:]+):(.+)(?:\)|\])$/;let l=null,$=s||"";const A=$.match(d);if(A&&(l=A[1].trim(),$=A[2].trim()),(typeof r=="string"&&!r.includes(":")||Array.isArray(r))&&(!s||s.includes(l+":")||n))return null;let p;s.includes(l+":")?p=s.startsWith("(")?`(${$})`:`[${$}]`:p=s;const y=this.processValue(p,t,e),g=this.processValue(n,o,e);if(e.startsWith("[")&&e.endsWith("]")){if(!s||n)return null;const u=e.slice(1,-1).split(",").map(C=>C.trim().startsWith("--")?String(C.trim()):x(String(C.trim())));return{className:j(i,e,s,t),cssRules:u.length===1?u[0]:u,value:y,prefix:i}}if(r){if(typeof r=="object"&&"property"in r){const C=r.group&&this.values[r.group][y]?this.values[r.group][y]:t?s:y,f=typeof r.property=="function"?r.property({value:s.startsWith("[")?y:C,unit:s.startsWith("[")?"":t,secondValue:s.startsWith("[")?"":o?n:g,secondUnit:s.startsWith("[")?"":o,key:l,raw:a}):r.property;if(f&&typeof f=="object"&&!Array.isArray(f)&&"cssRules"in f){const{className:W,cssRules:S,value:z,prefix:E}=f;return{className:W||c,cssRules:S,value:z,prefix:E||i,isCustom:!!W}}const m=r.value||"{0}";let P;if(typeof m=="function")P=m({value:C,unit:t,secondValue:o?n:g,secondUnit:o,key:l,raw:a});else if(typeof m=="string"){const W=r.group||e,S=this.processValue(p,t,W);this.values[W]&&typeof this.values[W]=="object"&&this.values[W][p]?P=this.values[W][p]:m.includes("{")?P=this.parseValuePattern(W,m,S,"",g,""):typeof m=="string"&&!m.includes("{")?P=m:P=y}else if(Array.isArray(m)){if(!m.includes(s+t)||n)return null;P=s+t}else P=null;return(typeof r.property=="string"||Array.isArray(r.property))&&typeof m=="string"&&(s.includes(l+":")||!m.includes("{1")&&n)||(typeof r.property=="string"||Array.isArray(r.property))&&m===null||typeof r.property=="string"&&r.property.includes(":")&&s||(typeof r.property=="string"||Array.isArray(r.property))&&typeof r.value=="string"&&!r.value.includes("{")&&s?null:{className:j(i,e,s,t,n,o),cssRules:f?Array.isArray(f)?f:typeof f=="string"&&(f.includes(":")||f.includes("value:"))&&f.includes("value:")?f.slice(6):x(String(f)):null,value:m===null||f===null||f.includes(":")||f.includes("value:")?null:s.startsWith("[")?y:P,prefix:i}}const u=typeof r=="function"?r({value:s.startsWith("[")?y:t?s:y,unit:s.startsWith("[")?"":t,secondValue:s.startsWith("[")?"":o?n:g,secondUnit:s.startsWith("[")?"":o,key:l,raw:a}):r;if(u&&typeof u=="object"&&!Array.isArray(u)&&"cssRules"in u){const{className:C,cssRules:f,value:m,prefix:P}=u;return{className:C||c,cssRules:f,value:m,prefix:P||i,isCustom:!!C}}return{className:j(i,e,s,t,n,o),cssRules:u?Array.isArray(r)?u:typeof u=="string"&&(u.includes(":")||u.startsWith("value:"))&&u.startsWith("value:")?u.slice(6):x(String(u)):null,value:typeof u=="string"&&u.includes(":")?null:y,prefix:i}}return null}parseValuePattern(e,s,t,i,n,o){if(!s.includes("{0}")&&!s.includes("{1")&&!s.includes("||"))return s;const[c,a]=s.split("||").map(l=>l.trim()),r=this.processValue(t,i,e),d=this.processValue(n,o,e);if(s.includes("{0}")&&s.includes("{1")||s.includes("{1")){let l=c;if(t&&(l=l.replace(/\{0\}/g,r)),s.includes("{1")){s.includes("{1}")&&(n?l=n.startsWith("[")?d:l.replace(/\{1\}/g,d):l=a||c);const $=/\{1([^}]*)\}/g;let A;for(;(A=$.exec(l))!==null;){const p=A[0],y=A[1].trim();let g=d;!g&&y.includes("|")?g=y.split("|")[1].trim():g||(g=""),l=t.startsWith("[")?r:l.replace(p,g)}}return t?l:a||c}else return t?t.startsWith("[")?r:c.replace(/\{0\}/g,r):a||c}getParentClass(e){return Object.keys(this.classes).filter(s=>Object.prototype.hasOwnProperty.call(this.classes[s],e))}processCustomClass(e,s="",t="",i="",n="",o=""){if(!e)return null;const c=this.getParentClass(e),a=s&&e.endsWith(`-${s}${t}`);if(c.length>0){const r=c.map(d=>{const l=this.classes[d];if(!l||s&&!a&&l[e]&&!l[e].includes("{0}")&&!l[e].includes("|"))return null;const $=this.parseValuePattern(e,l[e]||"",s,t,n,o);return`${x(String(d))}: ${$}`}).filter(Boolean).join("; ");return{className:a?e:j(i,e,s,t,n,o),cssRules:r,value:null,prefix:i}}return null}process(e){try{const s=Array.isArray(e)?e:e.split(/\s+/),t=[];for(const i of s)try{if(!i)continue;const n=this.parse(i);if(!n)continue;const[o,c,a,r,d,l]=n;if(!c)continue;const $=[...n,j(o,c,a,r,d,l)],A=this.getParentClass(`${c}-${a}`).length>0?`${c}-${a}`:c;try{const p=this.processCustomClass(A,a,r,o,d,l);if(p){const{className:y,cssRules:g,prefix:u}=p;if(!g||g==="null")continue;t.push({className:R(y),cssRules:g,value:null,prefix:u,raw:$});continue}}catch(p){console.warn(`Error processing custom class "${i}":`,p)}try{const p=this.processShorthand(c,a,r,o,d,l,i,$);if(p){const{className:y,cssRules:g,value:u,prefix:C,isCustom:f}=p;if(!g||g==="null")continue;t.push({className:f?y:R(y),cssRules:g,value:u,prefix:C,raw:$})}}catch(p){console.warn(`Error processing shorthand "${i}":`,p)}}catch(n){console.warn(`Failed to process class \`${i}\`:`,n)}return t}catch(s){return console.error("Critical error in process method:",s),[]}}}return b.TenoxUI=V,b.constructRaw=j,b.default=V,b.escapeCSSSelector=R,b.regexp=v,b.toKebabCase=x,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),b}({});
1
+ var __tenoxui_moxie__=function(x){"use strict";function R(h){return h.replace(/^(\d)/,"\\3$1 ").replace(/([#{}.:;?%&,@+*~'"!^$[\]()=>|/])/g,"\\$1")}function b(h){if(/^(webkit|moz|ms|o)[A-Z]/.test(h)){const s=h.match(/^(webkit|moz|ms|o)/);if(s){const e=s[0];return`-${e}${h.slice(e.length).replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}}return h.replace(/[A-Z]/g,s=>`-${s.toLowerCase()}`)}function j(h,s,e,t,l,n){return`${h?`${h}:`:""}${s}${e?"-":""}${e}${t}${l?`/${l}${n}`:""}`}function _(h){return h.replace(/[.*+?^${}()|[\]\\/\\-]/g,"\\$&")}function w(h){if(!h)return[];const s=new Set;return Object.entries(h).forEach(([e,t])=>{t&&typeof t=="object"&&Object.keys(t).forEach(l=>{s.add(l)})}),Array.from(s)}function Z({safelist:h=[],property:s={},classes:e={}}={}){const t=e,l=Object.keys(s);if(!t)return[...l,...h].sort((c,a)=>a.length-c.length);const o=[...w(t)];return[...l,...o,...h].sort((c,a)=>a.length-c.length)}function v({inputPrefixChars:h=[],safelist:s=[],property:e={},classes:t={}}={}){let l=Z({safelist:s,property:e,classes:t}).map(_);l.length>0&&(l=l.join("|")+"|");const n="\\[[^\\]]+\\]",o="\\([^()]*(?:\\([^()]*\\)[^()]*)*\\)",c="\\{[^{}]*(?:\\{[^{}]*\\}[^{}]*)*\\}",a=`[${["a-zA-Z0-9_\\-",...h].join("")}]`,r=a+"+|"+a+"+(?:-(?:"+n+"|"+o+"|"+c+"))|"+a+"+(?:-(?:"+n+"|"+o+"|"+c+"))?(?:\\/[a-zA-Z0-9_\\-]+)|"+n+"|"+o+"|"+c,d=`(${l}\\[[^\\]]+\\])`,i="(?:-)",$="(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|"+n+"|"+c+"|"+o+"|(?:\\$[^\\s\\/]+))",A="([a-zA-Z%]*)",p="(?:\\/(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|"+n+"|"+c+"|"+o+"|(?:\\$[^\\s\\/]+))([a-zA-Z%]*))?";return{prefix:r,type:d,separator:i,value:$,unit:A,secondValuePattern:p,all:"^(?:("+r+"):)?"+d+i+$+A+p+"$"}}class V{constructor({property:s={},values:e={},classes:t={},prefixChars:l=[]}={}){this.property=s,this.values=e,this.classes=t,this.prefixChars=l.map(_)}regexp(s){return v({safelist:s,property:this.property,classes:this.classes,inputPrefixChars:this.prefixChars})}parse(s,e){const t=this.regexp(e),l=s.match(new RegExp(t.all));if(l){const[,o,c,a,r,d,i]=l;return[o,c,a,r||"",d,i]}const n=s.match(new RegExp(`^(?:(${t.prefix}):)?${t.type}$`));return n?[n[1],n[2],"","",void 0,void 0]:null}processValue(s,e,t){if(!s)return"";const l=n=>n.replace(/\{([^}]+)\}/g,(o,c)=>{const a=this.values,r=a!==null?typeof a[t]=="object"?a[t][c]:a[c]:void 0;return typeof r=="string"?r:o});if(typeof this.values=="object"&&this.values!==null&&(this.values[t]&&typeof this.values[t]=="object"&&this.values[t][s]||this.values[s]))return typeof this.values[t]=="object"&&this.values[t]!==null?this.values[t][s]:this.values[s];if(s.startsWith("$"))return`var(--${s.slice(1)})`;if(s.startsWith("[")&&s.endsWith("]")||s.startsWith("(")&&s.endsWith(")")){const n=s.slice(1,-1).replace(/\\\_/g,"m0x13c55").replace(/\_/g," ").replace(/m0x13c55/g,"_");return n.includes("{")?l(n):n.startsWith("--")?`var(${n})`:n}return s+(e||"")}processShorthand(s="",e="",t="",l,n="",o="",c="",a){const r=this.property[s];if(typeof r=="object"&&!Array.isArray(r)&&!("property"in r))return null;const d=/^(?:\(|\[)([^:]+):(.+)(?:\)|\])$/;let i=null,$=e||"";const A=$.match(d);if(A&&(i=A[1].trim(),$=A[2].trim()),(typeof r=="string"&&!r.includes(":")||Array.isArray(r))&&(!e||e.includes(i+":")||n))return null;let p;e.includes(i+":")?p=e.startsWith("(")?`(${$})`:`[${$}]`:p=e;const y=this.processValue(p,t,s),g=this.processValue(n,o,s);if(s.startsWith("[")&&s.endsWith("]")){if(!e||n)return null;const u=s.slice(1,-1).split(",").map(C=>C.trim().startsWith("--")?String(C.trim()):b(String(C.trim())));return{className:j(l,s,e,t),cssRules:u.length===1?u[0]:u,value:y,prefix:l}}if(r){if(typeof r=="object"&&"property"in r){const C=r.group&&this.values[r.group][y]?this.values[r.group][y]:t?e:y,f=typeof r.property=="function"?r.property({value:e.startsWith("[")?y:C,unit:e.startsWith("[")?"":t,secondValue:e.startsWith("[")?"":o?n:g,secondUnit:e.startsWith("[")?"":o,key:i,raw:a}):r.property;if(f&&typeof f=="object"&&!Array.isArray(f)&&"cssRules"in f){const{className:W,cssRules:S=null,value:z=null,prefix:E}=f;return{className:W||c,cssRules:S,value:z,prefix:E||l,isCustom:!!W}}const m=r.value||"{0}";let P;if(typeof m=="function")P=m({value:C,unit:t,secondValue:o?n:g,secondUnit:o,key:i,raw:a});else if(typeof m=="string"){const W=r.group||s,S=this.processValue(p,t,W);this.values[W]&&typeof this.values[W]=="object"&&this.values[W][p]?P=this.values[W][p]:m.includes("{")?P=this.parseValuePattern(W,m,S,"",g,""):typeof m=="string"&&!m.includes("{")?P=m:P=y}else if(Array.isArray(m)){if(!m.includes(e+t)||n)return null;P=e+t}else P=null;return(typeof r.property=="string"||Array.isArray(r.property))&&typeof m=="string"&&(e.includes(i+":")||!m.includes("{1")&&n)||(typeof r.property=="string"||Array.isArray(r.property))&&m===null||typeof r.property=="string"&&r.property.includes(":")&&e||(typeof r.property=="string"||Array.isArray(r.property))&&typeof r.value=="string"&&!r.value.includes("{")&&e?null:{className:j(l,s,e,t,n,o),cssRules:f?Array.isArray(f)?f:typeof f=="string"&&(f.includes(":")||f.includes("value:"))&&f.includes("value:")?f.slice(6):b(String(f)):null,value:m===null||f===null||f.includes(":")||f.includes("value:")?null:e.startsWith("[")?y:P,prefix:l}}const u=typeof r=="function"?r({value:e.startsWith("[")?y:t?e:y,unit:e.startsWith("[")?"":t,secondValue:e.startsWith("[")?"":o?n:g,secondUnit:e.startsWith("[")?"":o,key:i,raw:a}):r;if(u&&typeof u=="object"&&!Array.isArray(u)&&"cssRules"in u){const{className:C,cssRules:f=null,value:m=null,prefix:P}=u;return{className:C||c,cssRules:f,value:m,prefix:P||l,isCustom:!!C}}return{className:j(l,s,e,t,n,o),cssRules:u?Array.isArray(u)?u:typeof u=="string"&&(u.includes(":")||u.startsWith("value:"))&&u.startsWith("value:")?u.slice(6):b(String(u)):null,value:typeof u=="string"&&u.includes(":")?null:y,prefix:l}}return null}parseValuePattern(s,e,t,l,n,o){if(!e.includes("{0}")&&!e.includes("{1")&&!e.includes("||"))return e;const[c,a]=e.split("||").map(i=>i.trim()),r=this.processValue(t,l,s),d=this.processValue(n,o,s);if(e.includes("{0}")&&e.includes("{1")||e.includes("{1")){let i=c;if(t&&(i=i.replace(/\{0\}/g,r)),e.includes("{1")){e.includes("{1}")&&(n?i=n.startsWith("[")?d:i.replace(/\{1\}/g,d):i=a||c);const $=/\{1([^}]*)\}/g;let A;for(;(A=$.exec(i))!==null;){const p=A[0],y=A[1].trim();let g=d;!g&&y.includes("|")?g=y.split("|")[1].trim():g||(g=""),i=t.startsWith("[")?r:i.replace(p,g)}}return t?i:a||c}else return t?t.startsWith("[")?r:c.replace(/\{0\}/g,r):a||c}getParentClass(s){return Object.keys(this.classes).filter(e=>Object.prototype.hasOwnProperty.call(this.classes[e],s))}processCustomClass(s,e="",t="",l="",n="",o=""){if(!s)return null;const c=this.getParentClass(s),a=e&&s.endsWith(`-${e}${t}`);if(c.length>0){const r=c.map(d=>{const i=this.classes[d];if(!i||e&&!a&&i[s]&&!i[s].includes("{0}")&&!i[s].includes("|"))return null;const $=this.parseValuePattern(s,i[s]||"",e,t,n,o);return`${b(String(d))}: ${$}`}).filter(Boolean).join("; ");return{className:a?s:j(l,s,e,t,n,o),cssRules:r,value:null,prefix:l}}return null}process(s){try{const e=Array.isArray(s)?s:s.split(/\s+/),t=[];for(const l of e)try{if(!l)continue;const n=this.parse(l);if(!n)continue;const[o,c,a,r,d,i]=n;if(!c)continue;const $=[...n,j(o,c,a,r,d,i)],A=this.getParentClass(`${c}-${a}`).length>0?`${c}-${a}`:c;try{const p=this.processCustomClass(A,a,r,o,d,i);if(p){const{className:y,cssRules:g,prefix:u}=p;if(!g||g==="null")continue;t.push({className:R(y),cssRules:g,value:null,prefix:u,raw:$});continue}}catch(p){console.warn(`Error processing custom class "${l}":`,p)}try{const p=this.processShorthand(c,a,r,o,d,i,l,$);if(p){const{className:y,cssRules:g,value:u,prefix:C,isCustom:f}=p;if(!g||g==="null")continue;t.push({className:f?y:R(y),cssRules:g,value:u,prefix:C,raw:$})}}catch(p){console.warn(`Error processing shorthand "${l}":`,p)}}catch(n){console.warn(`Failed to process class \`${l}\`:`,n)}return t}catch(e){return console.error("Critical error in process method:",e),[]}}}return x.TenoxUI=V,x.constructRaw=j,x.default=V,x.escapeCSSSelector=R,x.regexp=v,x.toKebabCase=b,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),x}({});
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(C,b){typeof exports=="object"&&typeof module!="undefined"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(C=typeof globalThis!="undefined"?globalThis:C||self,b(C.__tenoxui_moxie__={}))})(this,function(C){"use strict";function b(h){return h.replace(/^(\d)/,"\\3$1 ").replace(/([#{}.:;?%&,@+*~'"!^$[\]()=>|/])/g,"\\$1")}function j(h){if(/^(webkit|moz|ms|o)[A-Z]/.test(h)){const s=h.match(/^(webkit|moz|ms|o)/);if(s){const e=s[0];return`-${e}${h.slice(e.length).replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}}return h.replace(/[A-Z]/g,s=>`-${s.toLowerCase()}`)}function R(h,s,e,t,i,n){return`${h?`${h}:`:""}${s}${e?"-":""}${e}${t}${i?`/${i}${n}`:""}`}function _(h){return h.replace(/[.*+?^${}()|[\]\\/\\-]/g,"\\$&")}function w(h){if(!h)return[];const s=new Set;return Object.entries(h).forEach(([e,t])=>{t&&typeof t=="object"&&Object.keys(t).forEach(i=>{s.add(i)})}),Array.from(s)}function Z({safelist:h=[],property:s={},classes:e={}}={}){const t=e,i=Object.keys(s);if(!t)return[...i,...h].sort((o,c)=>c.length-o.length);const a=[...w(t)];return[...i,...a,...h].sort((o,c)=>c.length-o.length)}function v({inputPrefixChars:h=[],safelist:s=[],property:e={},classes:t={}}={}){let i=Z({safelist:s,property:e,classes:t}).map(_);i.length>0&&(i=i.join("|")+"|");const n="\\[[^\\]]+\\]",a="\\([^()]*(?:\\([^()]*\\)[^()]*)*\\)",o="\\{[^{}]*(?:\\{[^{}]*\\}[^{}]*)*\\}",c=`[${["a-zA-Z0-9_\\-",...h].join("")}]`,r=c+"+|"+c+"+(?:-(?:"+n+"|"+a+"|"+o+"))|"+c+"+(?:-(?:"+n+"|"+a+"|"+o+"))?(?:\\/[a-zA-Z0-9_\\-]+)|"+n+"|"+a+"|"+o,g=`(${i}\\[[^\\]]+\\])`,l="(?:-)",$="(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|"+n+"|"+o+"|"+a+"|(?:\\$[^\\s\\/]+))",A="([a-zA-Z%]*)",p="(?:\\/(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|"+n+"|"+o+"|"+a+"|(?:\\$[^\\s\\/]+))([a-zA-Z%]*))?";return{prefix:r,type:g,separator:l,value:$,unit:A,secondValuePattern:p,all:"^(?:("+r+"):)?"+g+l+$+A+p+"$"}}class V{constructor({property:s={},values:e={},classes:t={},prefixChars:i=[]}={}){this.property=s,this.values=e,this.classes=t,this.prefixChars=i.map(_)}parse(s,e){const t=v({safelist:e,property:this.property,classes:this.classes,inputPrefixChars:this.prefixChars}),i=s.match(new RegExp(t.all));if(i){const[,a,o,c,r,g,l]=i;return[a,o,c,r||"",g,l]}const n=s.match(new RegExp(`^(?:(${t.prefix}):)?${t.type}$`));return n?[n[1],n[2],"","",void 0,void 0]:null}processValue(s,e,t){if(!s)return"";const i=n=>n.replace(/\{([^}]+)\}/g,(a,o)=>{const c=this.values,r=c!==null?typeof c[t]=="object"?c[t][o]:c[o]:void 0;return typeof r=="string"?r:a});if(typeof this.values=="object"&&this.values!==null&&(this.values[t]&&typeof this.values[t]=="object"&&this.values[t][s]||this.values[s]))return typeof this.values[t]=="object"&&this.values[t]!==null?this.values[t][s]:this.values[s];if(s.startsWith("$"))return`var(--${s.slice(1)})`;if(s.startsWith("[")&&s.endsWith("]")||s.startsWith("(")&&s.endsWith(")")){const n=s.slice(1,-1).replace(/\\\_/g,"m0x13c55").replace(/\_/g," ").replace(/m0x13c55/g,"_");return n.includes("{")?i(n):n.startsWith("--")?`var(${n})`:n}return s+(e||"")}processShorthand(s="",e="",t="",i,n="",a="",o="",c){const r=this.property[s];if(typeof r=="object"&&!Array.isArray(r)&&!("property"in r))return null;const g=/^(?:\(|\[)([^:]+):(.+)(?:\)|\])$/;let l=null,$=e||"";const A=$.match(g);if(A&&(l=A[1].trim(),$=A[2].trim()),(typeof r=="string"&&!r.includes(":")||Array.isArray(r))&&(!e||e.includes(l+":")||n))return null;let p;e.includes(l+":")?p=e.startsWith("(")?`(${$})`:`[${$}]`:p=e;const y=this.processValue(p,t,s),d=this.processValue(n,a,s);if(s.startsWith("[")&&s.endsWith("]")){if(!e||n)return null;const u=s.slice(1,-1).split(",").map(x=>x.trim().startsWith("--")?String(x.trim()):j(String(x.trim())));return{className:R(i,s,e,t),cssRules:u.length===1?u[0]:u,value:y,prefix:i}}if(r){if(typeof r=="object"&&"property"in r){const x=r.group&&this.values[r.group][y]?this.values[r.group][y]:t?e:y,f=typeof r.property=="function"?r.property({value:e.startsWith("[")?y:x,unit:e.startsWith("[")?"":t,secondValue:e.startsWith("[")?"":a?n:d,secondUnit:e.startsWith("[")?"":a,key:l,raw:c}):r.property;if(f&&typeof f=="object"&&!Array.isArray(f)&&"cssRules"in f){const{className:W,cssRules:S,value:z,prefix:E}=f;return{className:W||o,cssRules:S,value:z,prefix:E||i,isCustom:!!W}}const m=r.value||"{0}";let P;if(typeof m=="function")P=m({value:x,unit:t,secondValue:a?n:d,secondUnit:a,key:l,raw:c});else if(typeof m=="string"){const W=r.group||s,S=this.processValue(p,t,W);this.values[W]&&typeof this.values[W]=="object"&&this.values[W][p]?P=this.values[W][p]:m.includes("{")?P=this.parseValuePattern(W,m,S,"",d,""):typeof m=="string"&&!m.includes("{")?P=m:P=y}else if(Array.isArray(m)){if(!m.includes(e+t)||n)return null;P=e+t}else P=null;return(typeof r.property=="string"||Array.isArray(r.property))&&typeof m=="string"&&(e.includes(l+":")||!m.includes("{1")&&n)||(typeof r.property=="string"||Array.isArray(r.property))&&m===null||typeof r.property=="string"&&r.property.includes(":")&&e||(typeof r.property=="string"||Array.isArray(r.property))&&typeof r.value=="string"&&!r.value.includes("{")&&e?null:{className:R(i,s,e,t,n,a),cssRules:f?Array.isArray(f)?f:typeof f=="string"&&(f.includes(":")||f.includes("value:"))&&f.includes("value:")?f.slice(6):j(String(f)):null,value:m===null||f===null||f.includes(":")||f.includes("value:")?null:e.startsWith("[")?y:P,prefix:i}}const u=typeof r=="function"?r({value:e.startsWith("[")?y:t?e:y,unit:e.startsWith("[")?"":t,secondValue:e.startsWith("[")?"":a?n:d,secondUnit:e.startsWith("[")?"":a,key:l,raw:c}):r;if(u&&typeof u=="object"&&!Array.isArray(u)&&"cssRules"in u){const{className:x,cssRules:f,value:m,prefix:P}=u;return{className:x||o,cssRules:f,value:m,prefix:P||i,isCustom:!!x}}return{className:R(i,s,e,t,n,a),cssRules:u?Array.isArray(r)?u:typeof u=="string"&&(u.includes(":")||u.startsWith("value:"))&&u.startsWith("value:")?u.slice(6):j(String(u)):null,value:typeof u=="string"&&u.includes(":")?null:y,prefix:i}}return null}parseValuePattern(s,e,t,i,n,a){if(!e.includes("{0}")&&!e.includes("{1")&&!e.includes("||"))return e;const[o,c]=e.split("||").map(l=>l.trim()),r=this.processValue(t,i,s),g=this.processValue(n,a,s);if(e.includes("{0}")&&e.includes("{1")||e.includes("{1")){let l=o;if(t&&(l=l.replace(/\{0\}/g,r)),e.includes("{1")){e.includes("{1}")&&(n?l=n.startsWith("[")?g:l.replace(/\{1\}/g,g):l=c||o);const $=/\{1([^}]*)\}/g;let A;for(;(A=$.exec(l))!==null;){const p=A[0],y=A[1].trim();let d=g;!d&&y.includes("|")?d=y.split("|")[1].trim():d||(d=""),l=t.startsWith("[")?r:l.replace(p,d)}}return t?l:c||o}else return t?t.startsWith("[")?r:o.replace(/\{0\}/g,r):c||o}getParentClass(s){return Object.keys(this.classes).filter(e=>Object.prototype.hasOwnProperty.call(this.classes[e],s))}processCustomClass(s,e="",t="",i="",n="",a=""){if(!s)return null;const o=this.getParentClass(s),c=e&&s.endsWith(`-${e}${t}`);if(o.length>0){const r=o.map(g=>{const l=this.classes[g];if(!l||e&&!c&&l[s]&&!l[s].includes("{0}")&&!l[s].includes("|"))return null;const $=this.parseValuePattern(s,l[s]||"",e,t,n,a);return`${j(String(g))}: ${$}`}).filter(Boolean).join("; ");return{className:c?s:R(i,s,e,t,n,a),cssRules:r,value:null,prefix:i}}return null}process(s){try{const e=Array.isArray(s)?s:s.split(/\s+/),t=[];for(const i of e)try{if(!i)continue;const n=this.parse(i);if(!n)continue;const[a,o,c,r,g,l]=n;if(!o)continue;const $=[...n,R(a,o,c,r,g,l)],A=this.getParentClass(`${o}-${c}`).length>0?`${o}-${c}`:o;try{const p=this.processCustomClass(A,c,r,a,g,l);if(p){const{className:y,cssRules:d,prefix:u}=p;if(!d||d==="null")continue;t.push({className:b(y),cssRules:d,value:null,prefix:u,raw:$});continue}}catch(p){console.warn(`Error processing custom class "${i}":`,p)}try{const p=this.processShorthand(o,c,r,a,g,l,i,$);if(p){const{className:y,cssRules:d,value:u,prefix:x,isCustom:f}=p;if(!d||d==="null")continue;t.push({className:f?y:b(y),cssRules:d,value:u,prefix:x,raw:$})}}catch(p){console.warn(`Error processing shorthand "${i}":`,p)}}catch(n){console.warn(`Failed to process class \`${i}\`:`,n)}return t}catch(e){return console.error("Critical error in process method:",e),[]}}}C.TenoxUI=V,C.constructRaw=R,C.default=V,C.escapeCSSSelector=b,C.regexp=v,C.toKebabCase=j,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(C,b){typeof exports=="object"&&typeof module!="undefined"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(C=typeof globalThis!="undefined"?globalThis:C||self,b(C.__tenoxui_moxie__={}))})(this,function(C){"use strict";function b(h){return h.replace(/^(\d)/,"\\3$1 ").replace(/([#{}.:;?%&,@+*~'"!^$[\]()=>|/])/g,"\\$1")}function j(h){if(/^(webkit|moz|ms|o)[A-Z]/.test(h)){const s=h.match(/^(webkit|moz|ms|o)/);if(s){const e=s[0];return`-${e}${h.slice(e.length).replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}}return h.replace(/[A-Z]/g,s=>`-${s.toLowerCase()}`)}function R(h,s,e,t,i,n){return`${h?`${h}:`:""}${s}${e?"-":""}${e}${t}${i?`/${i}${n}`:""}`}function _(h){return h.replace(/[.*+?^${}()|[\]\\/\\-]/g,"\\$&")}function w(h){if(!h)return[];const s=new Set;return Object.entries(h).forEach(([e,t])=>{t&&typeof t=="object"&&Object.keys(t).forEach(i=>{s.add(i)})}),Array.from(s)}function Z({safelist:h=[],property:s={},classes:e={}}={}){const t=e,i=Object.keys(s);if(!t)return[...i,...h].sort((o,c)=>c.length-o.length);const a=[...w(t)];return[...i,...a,...h].sort((o,c)=>c.length-o.length)}function v({inputPrefixChars:h=[],safelist:s=[],property:e={},classes:t={}}={}){let i=Z({safelist:s,property:e,classes:t}).map(_);i.length>0&&(i=i.join("|")+"|");const n="\\[[^\\]]+\\]",a="\\([^()]*(?:\\([^()]*\\)[^()]*)*\\)",o="\\{[^{}]*(?:\\{[^{}]*\\}[^{}]*)*\\}",c=`[${["a-zA-Z0-9_\\-",...h].join("")}]`,r=c+"+|"+c+"+(?:-(?:"+n+"|"+a+"|"+o+"))|"+c+"+(?:-(?:"+n+"|"+a+"|"+o+"))?(?:\\/[a-zA-Z0-9_\\-]+)|"+n+"|"+a+"|"+o,g=`(${i}\\[[^\\]]+\\])`,l="(?:-)",$="(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|"+n+"|"+o+"|"+a+"|(?:\\$[^\\s\\/]+))",A="([a-zA-Z%]*)",p="(?:\\/(-?(?:\\d+(?:\\.\\d+)?)|(?:[a-zA-Z0-9_]+(?:-[a-zA-Z0-9_]+)*(?:-[a-zA-Z0-9_]+)*)|(?:#[0-9a-fA-F]+)|"+n+"|"+o+"|"+a+"|(?:\\$[^\\s\\/]+))([a-zA-Z%]*))?";return{prefix:r,type:g,separator:l,value:$,unit:A,secondValuePattern:p,all:"^(?:("+r+"):)?"+g+l+$+A+p+"$"}}class V{constructor({property:s={},values:e={},classes:t={},prefixChars:i=[]}={}){this.property=s,this.values=e,this.classes=t,this.prefixChars=i.map(_)}regexp(s){return v({safelist:s,property:this.property,classes:this.classes,inputPrefixChars:this.prefixChars})}parse(s,e){const t=this.regexp(e),i=s.match(new RegExp(t.all));if(i){const[,a,o,c,r,g,l]=i;return[a,o,c,r||"",g,l]}const n=s.match(new RegExp(`^(?:(${t.prefix}):)?${t.type}$`));return n?[n[1],n[2],"","",void 0,void 0]:null}processValue(s,e,t){if(!s)return"";const i=n=>n.replace(/\{([^}]+)\}/g,(a,o)=>{const c=this.values,r=c!==null?typeof c[t]=="object"?c[t][o]:c[o]:void 0;return typeof r=="string"?r:a});if(typeof this.values=="object"&&this.values!==null&&(this.values[t]&&typeof this.values[t]=="object"&&this.values[t][s]||this.values[s]))return typeof this.values[t]=="object"&&this.values[t]!==null?this.values[t][s]:this.values[s];if(s.startsWith("$"))return`var(--${s.slice(1)})`;if(s.startsWith("[")&&s.endsWith("]")||s.startsWith("(")&&s.endsWith(")")){const n=s.slice(1,-1).replace(/\\\_/g,"m0x13c55").replace(/\_/g," ").replace(/m0x13c55/g,"_");return n.includes("{")?i(n):n.startsWith("--")?`var(${n})`:n}return s+(e||"")}processShorthand(s="",e="",t="",i,n="",a="",o="",c){const r=this.property[s];if(typeof r=="object"&&!Array.isArray(r)&&!("property"in r))return null;const g=/^(?:\(|\[)([^:]+):(.+)(?:\)|\])$/;let l=null,$=e||"";const A=$.match(g);if(A&&(l=A[1].trim(),$=A[2].trim()),(typeof r=="string"&&!r.includes(":")||Array.isArray(r))&&(!e||e.includes(l+":")||n))return null;let p;e.includes(l+":")?p=e.startsWith("(")?`(${$})`:`[${$}]`:p=e;const y=this.processValue(p,t,s),d=this.processValue(n,a,s);if(s.startsWith("[")&&s.endsWith("]")){if(!e||n)return null;const u=s.slice(1,-1).split(",").map(x=>x.trim().startsWith("--")?String(x.trim()):j(String(x.trim())));return{className:R(i,s,e,t),cssRules:u.length===1?u[0]:u,value:y,prefix:i}}if(r){if(typeof r=="object"&&"property"in r){const x=r.group&&this.values[r.group][y]?this.values[r.group][y]:t?e:y,f=typeof r.property=="function"?r.property({value:e.startsWith("[")?y:x,unit:e.startsWith("[")?"":t,secondValue:e.startsWith("[")?"":a?n:d,secondUnit:e.startsWith("[")?"":a,key:l,raw:c}):r.property;if(f&&typeof f=="object"&&!Array.isArray(f)&&"cssRules"in f){const{className:W,cssRules:S=null,value:z=null,prefix:E}=f;return{className:W||o,cssRules:S,value:z,prefix:E||i,isCustom:!!W}}const m=r.value||"{0}";let P;if(typeof m=="function")P=m({value:x,unit:t,secondValue:a?n:d,secondUnit:a,key:l,raw:c});else if(typeof m=="string"){const W=r.group||s,S=this.processValue(p,t,W);this.values[W]&&typeof this.values[W]=="object"&&this.values[W][p]?P=this.values[W][p]:m.includes("{")?P=this.parseValuePattern(W,m,S,"",d,""):typeof m=="string"&&!m.includes("{")?P=m:P=y}else if(Array.isArray(m)){if(!m.includes(e+t)||n)return null;P=e+t}else P=null;return(typeof r.property=="string"||Array.isArray(r.property))&&typeof m=="string"&&(e.includes(l+":")||!m.includes("{1")&&n)||(typeof r.property=="string"||Array.isArray(r.property))&&m===null||typeof r.property=="string"&&r.property.includes(":")&&e||(typeof r.property=="string"||Array.isArray(r.property))&&typeof r.value=="string"&&!r.value.includes("{")&&e?null:{className:R(i,s,e,t,n,a),cssRules:f?Array.isArray(f)?f:typeof f=="string"&&(f.includes(":")||f.includes("value:"))&&f.includes("value:")?f.slice(6):j(String(f)):null,value:m===null||f===null||f.includes(":")||f.includes("value:")?null:e.startsWith("[")?y:P,prefix:i}}const u=typeof r=="function"?r({value:e.startsWith("[")?y:t?e:y,unit:e.startsWith("[")?"":t,secondValue:e.startsWith("[")?"":a?n:d,secondUnit:e.startsWith("[")?"":a,key:l,raw:c}):r;if(u&&typeof u=="object"&&!Array.isArray(u)&&"cssRules"in u){const{className:x,cssRules:f=null,value:m=null,prefix:P}=u;return{className:x||o,cssRules:f,value:m,prefix:P||i,isCustom:!!x}}return{className:R(i,s,e,t,n,a),cssRules:u?Array.isArray(u)?u:typeof u=="string"&&(u.includes(":")||u.startsWith("value:"))&&u.startsWith("value:")?u.slice(6):j(String(u)):null,value:typeof u=="string"&&u.includes(":")?null:y,prefix:i}}return null}parseValuePattern(s,e,t,i,n,a){if(!e.includes("{0}")&&!e.includes("{1")&&!e.includes("||"))return e;const[o,c]=e.split("||").map(l=>l.trim()),r=this.processValue(t,i,s),g=this.processValue(n,a,s);if(e.includes("{0}")&&e.includes("{1")||e.includes("{1")){let l=o;if(t&&(l=l.replace(/\{0\}/g,r)),e.includes("{1")){e.includes("{1}")&&(n?l=n.startsWith("[")?g:l.replace(/\{1\}/g,g):l=c||o);const $=/\{1([^}]*)\}/g;let A;for(;(A=$.exec(l))!==null;){const p=A[0],y=A[1].trim();let d=g;!d&&y.includes("|")?d=y.split("|")[1].trim():d||(d=""),l=t.startsWith("[")?r:l.replace(p,d)}}return t?l:c||o}else return t?t.startsWith("[")?r:o.replace(/\{0\}/g,r):c||o}getParentClass(s){return Object.keys(this.classes).filter(e=>Object.prototype.hasOwnProperty.call(this.classes[e],s))}processCustomClass(s,e="",t="",i="",n="",a=""){if(!s)return null;const o=this.getParentClass(s),c=e&&s.endsWith(`-${e}${t}`);if(o.length>0){const r=o.map(g=>{const l=this.classes[g];if(!l||e&&!c&&l[s]&&!l[s].includes("{0}")&&!l[s].includes("|"))return null;const $=this.parseValuePattern(s,l[s]||"",e,t,n,a);return`${j(String(g))}: ${$}`}).filter(Boolean).join("; ");return{className:c?s:R(i,s,e,t,n,a),cssRules:r,value:null,prefix:i}}return null}process(s){try{const e=Array.isArray(s)?s:s.split(/\s+/),t=[];for(const i of e)try{if(!i)continue;const n=this.parse(i);if(!n)continue;const[a,o,c,r,g,l]=n;if(!o)continue;const $=[...n,R(a,o,c,r,g,l)],A=this.getParentClass(`${o}-${c}`).length>0?`${o}-${c}`:o;try{const p=this.processCustomClass(A,c,r,a,g,l);if(p){const{className:y,cssRules:d,prefix:u}=p;if(!d||d==="null")continue;t.push({className:b(y),cssRules:d,value:null,prefix:u,raw:$});continue}}catch(p){console.warn(`Error processing custom class "${i}":`,p)}try{const p=this.processShorthand(o,c,r,a,g,l,i,$);if(p){const{className:y,cssRules:d,value:u,prefix:x,isCustom:f}=p;if(!d||d==="null")continue;t.push({className:f?y:b(y),cssRules:d,value:u,prefix:x,raw:$})}}catch(p){console.warn(`Error processing shorthand "${i}":`,p)}}catch(n){console.warn(`Failed to process class \`${i}\`:`,n)}return t}catch(e){return console.error("Critical error in process method:",e),[]}}}C.TenoxUI=V,C.constructRaw=R,C.default=V,C.escapeCSSSelector=b,C.regexp=v,C.toKebabCase=j,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -8,7 +8,7 @@ export type PropertyParams = {
8
8
  raw?: Parsed;
9
9
  };
10
10
  export type DirectValue = `value:${string}`;
11
- export type PropertyParamValue = GetCSSProperty | DirectValue | ((params: PropertyParams) => null | GetCSSProperty | DirectValue | ProcessedStyle);
11
+ export type PropertyParamValue = GetCSSProperty | DirectValue | ((params: PropertyParams) => null | GetCSSProperty | DirectValue | Partial<ProcessedStyle>);
12
12
  export type ValuePropType = string | string[] | ((params: PropertyParams) => string | null) | null;
13
13
  export type PropertyValue = PropertyParamValue | {
14
14
  property?: PropertyParamValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenoxui/moxie",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Very lightweight utility-first CSS engine for style generation",
5
5
  "author": "NOuSantx <nousantx@gmail.com>",
6
6
  "license": "MIT",