postcss-clampwind 0.0.9 → 0.0.11

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.
@@ -158,6 +158,7 @@ var extractMaxValue = (params) => {
158
158
  if (!params) return null;
159
159
  let match = params.match(/<\s*([^),\s]+)/);
160
160
  if (match) return match[1].trim();
161
+ if (params.match(/not\s+all\s+and\s*\(\s*max-width:/)) return null;
161
162
  match = params.match(/max-width:\s*([^),\s]+)/);
162
163
  if (match) return match[1].trim();
163
164
  match = params.match(/not\s+all\s+and\s*\(\s*min-width:\s*([^),\s]+)\s*\)/);
@@ -168,6 +169,7 @@ var extractMinValue = (params) => {
168
169
  if (!params) return null;
169
170
  let match = params.match(/>=?\s*([^),\s]+)/);
170
171
  if (match) return match[1].trim();
172
+ if (params.match(/not\s+all\s+and\s*\(\s*min-width:/)) return null;
171
173
  match = params.match(/min-width:\s*([^),\s]+)/);
172
174
  if (match) return match[1].trim();
173
175
  match = params.match(/not\s+all\s+and\s*\(\s*max-width:\s*([^),\s]+)\s*\)/);
@@ -180,8 +182,8 @@ var extractMinValue = (params) => {
180
182
  // src/clampwind.js
181
183
  var clampwind = (opts = {}) => {
182
184
  return {
183
- postcssPlugin: "clampwind",
184
- prepare() {
185
+ postcssPlugin: "postcss-clampwind",
186
+ prepare(result) {
185
187
  let rootFontSize = 16;
186
188
  let spacingSize = "0.25rem";
187
189
  let customProperties = {};
@@ -345,8 +347,14 @@ var clampwind = (opts = {}) => {
345
347
  (val) => convertToRem(val, rootFontSize, spacingSize, customProperties)
346
348
  );
347
349
  if (!args || !lower || !upper) {
348
- console.warn("Invalid clamp() values", { node: decl });
349
- decl.value = ` ${decl.value} /* Invalid clamp() values */`;
350
+ result.warn(
351
+ `Invalid clamp() values: "${decl.value}". Expected format: clamp(min, preferred, max)`,
352
+ {
353
+ node: decl,
354
+ word: decl.value
355
+ }
356
+ );
357
+ decl.value = `${decl.value} /* Invalid clamp() values */`;
350
358
  return true;
351
359
  }
352
360
  const clamp = generateClamp(
@@ -454,7 +462,7 @@ var clampwind = (opts = {}) => {
454
462
  };
455
463
  return {
456
464
  // Use OnceExit to ensure Tailwind has generated its content
457
- OnceExit(root, { result }) {
465
+ OnceExit(root, { result: result2 }) {
458
466
  collectConfig(root);
459
467
  finalizeConfig();
460
468
  const processedAtRules = /* @__PURE__ */ new WeakSet();
@@ -133,6 +133,7 @@ var extractMaxValue = (params) => {
133
133
  if (!params) return null;
134
134
  let match = params.match(/<\s*([^),\s]+)/);
135
135
  if (match) return match[1].trim();
136
+ if (params.match(/not\s+all\s+and\s*\(\s*max-width:/)) return null;
136
137
  match = params.match(/max-width:\s*([^),\s]+)/);
137
138
  if (match) return match[1].trim();
138
139
  match = params.match(/not\s+all\s+and\s*\(\s*min-width:\s*([^),\s]+)\s*\)/);
@@ -143,6 +144,7 @@ var extractMinValue = (params) => {
143
144
  if (!params) return null;
144
145
  let match = params.match(/>=?\s*([^),\s]+)/);
145
146
  if (match) return match[1].trim();
147
+ if (params.match(/not\s+all\s+and\s*\(\s*min-width:/)) return null;
146
148
  match = params.match(/min-width:\s*([^),\s]+)/);
147
149
  if (match) return match[1].trim();
148
150
  match = params.match(/not\s+all\s+and\s*\(\s*max-width:\s*([^),\s]+)\s*\)/);
@@ -155,8 +157,8 @@ var extractMinValue = (params) => {
155
157
  // src/clampwind.js
156
158
  var clampwind = (opts = {}) => {
157
159
  return {
158
- postcssPlugin: "clampwind",
159
- prepare() {
160
+ postcssPlugin: "postcss-clampwind",
161
+ prepare(result) {
160
162
  let rootFontSize = 16;
161
163
  let spacingSize = "0.25rem";
162
164
  let customProperties = {};
@@ -320,8 +322,14 @@ var clampwind = (opts = {}) => {
320
322
  (val) => convertToRem(val, rootFontSize, spacingSize, customProperties)
321
323
  );
322
324
  if (!args || !lower || !upper) {
323
- console.warn("Invalid clamp() values", { node: decl });
324
- decl.value = ` ${decl.value} /* Invalid clamp() values */`;
325
+ result.warn(
326
+ `Invalid clamp() values: "${decl.value}". Expected format: clamp(min, preferred, max)`,
327
+ {
328
+ node: decl,
329
+ word: decl.value
330
+ }
331
+ );
332
+ decl.value = `${decl.value} /* Invalid clamp() values */`;
325
333
  return true;
326
334
  }
327
335
  const clamp = generateClamp(
@@ -429,7 +437,7 @@ var clampwind = (opts = {}) => {
429
437
  };
430
438
  return {
431
439
  // Use OnceExit to ensure Tailwind has generated its content
432
- OnceExit(root, { result }) {
440
+ OnceExit(root, { result: result2 }) {
433
441
  collectConfig(root);
434
442
  finalizeConfig();
435
443
  const processedAtRules = /* @__PURE__ */ new WeakSet();
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "postcss-clampwind",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "A PostCSS plugin to create fluid clamp values for any Tailwind CSS utility",
5
5
  "license": "Apache-2.0",
6
- "keywords": [
6
+ "keywords": [
7
7
  "clampwind",
8
8
  "postcss-plugin",
9
9
  "tailwindcss",
@@ -38,4 +38,4 @@
38
38
  "dev": "node scripts/build.js --watch",
39
39
  "build": "node scripts/build.js"
40
40
  }
41
- }
41
+ }