myoperator-ui 0.0.99 → 0.0.100

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.
Files changed (2) hide show
  1. package/dist/index.js +25 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -114,7 +114,31 @@ function prefixClassString(classString, prefix) {
114
114
  return classString.split(" ").map((cls) => {
115
115
  if (!cls) return cls;
116
116
  if ((cls.startsWith("aria-") || cls.startsWith("data-")) && !cls.includes("[") && !cls.includes(":")) return cls;
117
- const variantMatch = cls.match(/^(([a-z][a-z0-9]*(-[a-z0-9]+)*:)|((data|aria)-\[[^\]]+\]:))+/);
117
+ if (cls.startsWith("[&") || cls.startsWith("[&_")) {
118
+ let depth = 0;
119
+ let closeBracket = -1;
120
+ for (let i = 0; i < cls.length; i++) {
121
+ if (cls[i] === "[") depth++;
122
+ else if (cls[i] === "]") {
123
+ depth--;
124
+ if (depth === 0 && cls[i + 1] === ":") {
125
+ closeBracket = i;
126
+ break;
127
+ }
128
+ }
129
+ }
130
+ if (closeBracket !== -1) {
131
+ const selector = cls.slice(0, closeBracket + 2);
132
+ const utility = cls.slice(closeBracket + 2);
133
+ if (!utility) return cls;
134
+ if (utility.startsWith("-")) {
135
+ return `${selector}-${prefix}${utility.slice(1)}`;
136
+ }
137
+ return `${selector}${prefix}${utility}`;
138
+ }
139
+ return cls;
140
+ }
141
+ const variantMatch = cls.match(/^(([a-z][a-z0-9]*(-[a-z0-9]+)*:)|((data|aria|group|peer)(\/[a-z0-9-]+)?-?\[[^\]]+\]:))+/);
118
142
  if (variantMatch) {
119
143
  const variants = variantMatch[0];
120
144
  const utility = cls.slice(variants.length);
@@ -127,16 +151,6 @@ function prefixClassString(classString, prefix) {
127
151
  if (cls.startsWith("-") && cls.length > 1) {
128
152
  return `-${prefix}${cls.slice(1)}`;
129
153
  }
130
- if (cls.startsWith("[&")) {
131
- const closeBracket = cls.indexOf("]:");
132
- if (closeBracket !== -1) {
133
- const selector = cls.slice(0, closeBracket + 2);
134
- const utility = cls.slice(closeBracket + 2);
135
- if (!utility) return cls;
136
- return `${selector}${prefix}${utility}`;
137
- }
138
- return cls;
139
- }
140
154
  return `${prefix}${cls}`;
141
155
  }).join(" ");
142
156
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myoperator-ui",
3
- "version": "0.0.99",
3
+ "version": "0.0.100",
4
4
  "description": "CLI for adding myOperator UI components to your project",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",