@wyw-in-js/processor-utils 1.0.5 → 2.0.0-alpha.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.
Files changed (90) hide show
  1. package/esm/BaseProcessor.js +47 -68
  2. package/esm/BaseProcessor.js.map +1 -1
  3. package/esm/TaggedTemplateProcessor.js +32 -41
  4. package/esm/TaggedTemplateProcessor.js.map +1 -1
  5. package/esm/ast.js +72 -0
  6. package/esm/ast.js.map +1 -0
  7. package/esm/diagnostics.js +4 -0
  8. package/esm/diagnostics.js.map +1 -0
  9. package/esm/index.js +9 -7
  10. package/esm/index.js.map +1 -1
  11. package/esm/types.js +1 -1
  12. package/esm/types.js.map +1 -1
  13. package/esm/utils/buildSlug.js +2 -2
  14. package/esm/utils/buildSlug.js.map +1 -1
  15. package/esm/utils/getClassNameAndSlug.js +38 -41
  16. package/esm/utils/getClassNameAndSlug.js.map +1 -1
  17. package/esm/utils/getVariableName.js +7 -10
  18. package/esm/utils/getVariableName.js.map +1 -1
  19. package/esm/utils/stripLines.js +9 -11
  20. package/esm/utils/stripLines.js.map +1 -1
  21. package/esm/utils/templateProcessor.js +98 -118
  22. package/esm/utils/templateProcessor.js.map +1 -1
  23. package/esm/utils/throwIfInvalid.js +11 -12
  24. package/esm/utils/throwIfInvalid.js.map +1 -1
  25. package/esm/utils/toCSS.js +34 -43
  26. package/esm/utils/toCSS.js.map +1 -1
  27. package/esm/utils/toValidCSSIdentifier.js +2 -2
  28. package/esm/utils/toValidCSSIdentifier.js.map +1 -1
  29. package/esm/utils/types.js +1 -1
  30. package/esm/utils/types.js.map +1 -1
  31. package/esm/utils/units.js +79 -61
  32. package/esm/utils/units.js.map +1 -1
  33. package/esm/utils/validateParams.js +29 -39
  34. package/esm/utils/validateParams.js.map +1 -1
  35. package/package.json +15 -15
  36. package/types/BaseProcessor.d.ts +7 -13
  37. package/types/BaseProcessor.js +18 -20
  38. package/types/TaggedTemplateProcessor.d.ts +1 -1
  39. package/types/TaggedTemplateProcessor.js +9 -16
  40. package/types/ast.d.ts +95 -0
  41. package/types/ast.js +80 -0
  42. package/types/diagnostics.d.ts +9 -0
  43. package/types/diagnostics.js +3 -0
  44. package/types/index.d.ts +5 -1
  45. package/types/index.js +8 -29
  46. package/types/types.d.ts +9 -1
  47. package/types/types.js +1 -2
  48. package/types/utils/buildSlug.js +1 -4
  49. package/types/utils/getClassNameAndSlug.js +15 -18
  50. package/types/utils/getVariableName.js +1 -4
  51. package/types/utils/stripLines.js +1 -4
  52. package/types/utils/templateProcessor.d.ts +1 -1
  53. package/types/utils/templateProcessor.js +16 -55
  54. package/types/utils/throwIfInvalid.js +1 -3
  55. package/types/utils/toCSS.js +8 -13
  56. package/types/utils/toValidCSSIdentifier.js +1 -4
  57. package/types/utils/types.d.ts +4 -2
  58. package/types/utils/types.js +1 -2
  59. package/types/utils/units.js +2 -5
  60. package/types/utils/validateParams.js +2 -6
  61. package/lib/BaseProcessor.js +0 -78
  62. package/lib/BaseProcessor.js.map +0 -1
  63. package/lib/TaggedTemplateProcessor.js +0 -51
  64. package/lib/TaggedTemplateProcessor.js.map +0 -1
  65. package/lib/index.js +0 -67
  66. package/lib/index.js.map +0 -1
  67. package/lib/types.js +0 -2
  68. package/lib/types.js.map +0 -1
  69. package/lib/utils/buildSlug.js +0 -12
  70. package/lib/utils/buildSlug.js.map +0 -1
  71. package/lib/utils/getClassNameAndSlug.js +0 -50
  72. package/lib/utils/getClassNameAndSlug.js.map +0 -1
  73. package/lib/utils/getVariableName.js +0 -18
  74. package/lib/utils/getVariableName.js.map +0 -1
  75. package/lib/utils/stripLines.js +0 -22
  76. package/lib/utils/stripLines.js.map +0 -1
  77. package/lib/utils/templateProcessor.js +0 -129
  78. package/lib/utils/templateProcessor.js.map +0 -1
  79. package/lib/utils/throwIfInvalid.js +0 -35
  80. package/lib/utils/throwIfInvalid.js.map +0 -1
  81. package/lib/utils/toCSS.js +0 -58
  82. package/lib/utils/toCSS.js.map +0 -1
  83. package/lib/utils/toValidCSSIdentifier.js +0 -10
  84. package/lib/utils/toValidCSSIdentifier.js.map +0 -1
  85. package/lib/utils/types.js +0 -2
  86. package/lib/utils/types.js.map +0 -1
  87. package/lib/utils/units.js +0 -71
  88. package/lib/utils/units.js.map +0 -1
  89. package/lib/utils/validateParams.js +0 -54
  90. package/lib/utils/validateParams.js.map +0 -1
@@ -1,50 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = getClassNameAndSlug;
7
- var _path = require("path");
8
- var _shared = require("@wyw-in-js/shared");
9
- var _buildSlug = require("./buildSlug");
10
- var _toValidCSSIdentifier = require("./toValidCSSIdentifier");
11
- function getClassNameAndSlug(displayName, idx, options, context) {
12
- var _context$filename;
13
- const relativeFilename = (context.root && context.filename ? (0, _path.relative)(context.root, context.filename) : (_context$filename = context.filename) !== null && _context$filename !== void 0 ? _context$filename : 'unknown').replace(/\\/g, _path.posix.sep);
14
-
15
- // Custom properties need to start with a letter, so we prefix the slug
16
- // Also use append the index of the class to the filename for uniqueness in the file
17
- const slug = (0, _toValidCSSIdentifier.toValidCSSIdentifier)(`${displayName.charAt(0).toLowerCase()}${(0, _shared.slugify)(`${relativeFilename}:${idx}`)}`);
18
-
19
- // Collect some useful replacement patterns from the filename
20
- // Available variables for the square brackets used in `classNameSlug` options
21
- const ext = (0, _path.extname)(relativeFilename);
22
- const slugVars = {
23
- hash: slug,
24
- title: displayName,
25
- index: idx,
26
- file: relativeFilename,
27
- ext,
28
- name: (0, _path.basename)(relativeFilename, ext),
29
- dir: (0, _path.dirname)(relativeFilename).split(_path.sep).pop()
30
- };
31
- let className = options.displayName ? `${(0, _toValidCSSIdentifier.toValidCSSIdentifier)(displayName)}_${slug}` : slug;
32
-
33
- // The className can be defined by the user either as fn or a string
34
- if (typeof options.classNameSlug === 'function') {
35
- try {
36
- className = (0, _toValidCSSIdentifier.toValidCSSIdentifier)(options.classNameSlug(slug, displayName, slugVars));
37
- } catch {
38
- throw new Error('classNameSlug option must return a string');
39
- }
40
- }
41
- if (typeof options.classNameSlug === 'string') {
42
- className = (0, _toValidCSSIdentifier.toValidCSSIdentifier)((0, _buildSlug.buildSlug)(options.classNameSlug, slugVars));
43
- }
44
- _shared.logger.extend('template-parse:generated-meta')(`slug: ${slug}, displayName: ${displayName}, className: ${className}`);
45
- return {
46
- className,
47
- slug
48
- };
49
- }
50
- //# sourceMappingURL=getClassNameAndSlug.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getClassNameAndSlug.js","names":["_path","require","_shared","_buildSlug","_toValidCSSIdentifier","getClassNameAndSlug","displayName","idx","options","context","_context$filename","relativeFilename","root","filename","relative","replace","posix","sep","slug","toValidCSSIdentifier","charAt","toLowerCase","slugify","ext","extname","slugVars","hash","title","index","file","name","basename","dir","dirname","split","pop","className","classNameSlug","Error","buildSlug","logger","extend"],"sources":["../../src/utils/getClassNameAndSlug.ts"],"sourcesContent":["import { basename, dirname, extname, relative, sep, posix } from 'path';\n\nimport type { ClassNameSlugVars } from '@wyw-in-js/shared';\nimport { logger, slugify } from '@wyw-in-js/shared';\n\nimport { buildSlug } from './buildSlug';\nimport { toValidCSSIdentifier } from './toValidCSSIdentifier';\nimport type { IFileContext, IOptions } from './types';\n\nexport default function getClassNameAndSlug(\n displayName: string,\n idx: number,\n options: IOptions,\n context: IFileContext\n): { className: string; slug: string } {\n const relativeFilename = (\n context.root && context.filename\n ? relative(context.root, context.filename)\n : context.filename ?? 'unknown'\n ).replace(/\\\\/g, posix.sep);\n\n // Custom properties need to start with a letter, so we prefix the slug\n // Also use append the index of the class to the filename for uniqueness in the file\n const slug = toValidCSSIdentifier(\n `${displayName.charAt(0).toLowerCase()}${slugify(\n `${relativeFilename}:${idx}`\n )}`\n );\n\n // Collect some useful replacement patterns from the filename\n // Available variables for the square brackets used in `classNameSlug` options\n const ext = extname(relativeFilename);\n const slugVars: ClassNameSlugVars = {\n hash: slug,\n title: displayName,\n index: idx,\n file: relativeFilename,\n ext,\n name: basename(relativeFilename, ext),\n dir: dirname(relativeFilename).split(sep).pop() as string,\n };\n\n let className = options.displayName\n ? `${toValidCSSIdentifier(displayName!)}_${slug!}`\n : slug!;\n\n // The className can be defined by the user either as fn or a string\n if (typeof options.classNameSlug === 'function') {\n try {\n className = toValidCSSIdentifier(\n options.classNameSlug(slug, displayName, slugVars)\n );\n } catch {\n throw new Error('classNameSlug option must return a string');\n }\n }\n\n if (typeof options.classNameSlug === 'string') {\n className = toValidCSSIdentifier(\n buildSlug(options.classNameSlug, slugVars)\n );\n }\n\n logger.extend('template-parse:generated-meta')(\n `slug: ${slug}, displayName: ${displayName}, className: ${className}`\n );\n\n return { className, slug };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAGe,SAASI,mBAAmBA,CACzCC,WAAmB,EACnBC,GAAW,EACXC,OAAiB,EACjBC,OAAqB,EACgB;EAAA,IAAAC,iBAAA;EACrC,MAAMC,gBAAgB,GAAG,CACvBF,OAAO,CAACG,IAAI,IAAIH,OAAO,CAACI,QAAQ,GAC5B,IAAAC,cAAQ,EAACL,OAAO,CAACG,IAAI,EAAEH,OAAO,CAACI,QAAQ,CAAC,IAAAH,iBAAA,GACxCD,OAAO,CAACI,QAAQ,cAAAH,iBAAA,cAAAA,iBAAA,GAAI,SAAS,EACjCK,OAAO,CAAC,KAAK,EAAEC,WAAK,CAACC,GAAG,CAAC;;EAE3B;EACA;EACA,MAAMC,IAAI,GAAG,IAAAC,0CAAoB,EAC/B,GAAGb,WAAW,CAACc,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAG,IAAAC,eAAO,EAC9C,GAAGX,gBAAgB,IAAIJ,GAAG,EAC5B,CAAC,EACH,CAAC;;EAED;EACA;EACA,MAAMgB,GAAG,GAAG,IAAAC,aAAO,EAACb,gBAAgB,CAAC;EACrC,MAAMc,QAA2B,GAAG;IAClCC,IAAI,EAAER,IAAI;IACVS,KAAK,EAAErB,WAAW;IAClBsB,KAAK,EAAErB,GAAG;IACVsB,IAAI,EAAElB,gBAAgB;IACtBY,GAAG;IACHO,IAAI,EAAE,IAAAC,cAAQ,EAACpB,gBAAgB,EAAEY,GAAG,CAAC;IACrCS,GAAG,EAAE,IAAAC,aAAO,EAACtB,gBAAgB,CAAC,CAACuB,KAAK,CAACjB,SAAG,CAAC,CAACkB,GAAG,CAAC;EAChD,CAAC;EAED,IAAIC,SAAS,GAAG5B,OAAO,CAACF,WAAW,GAC/B,GAAG,IAAAa,0CAAoB,EAACb,WAAY,CAAC,IAAIY,IAAI,EAAG,GAChDA,IAAK;;EAET;EACA,IAAI,OAAOV,OAAO,CAAC6B,aAAa,KAAK,UAAU,EAAE;IAC/C,IAAI;MACFD,SAAS,GAAG,IAAAjB,0CAAoB,EAC9BX,OAAO,CAAC6B,aAAa,CAACnB,IAAI,EAAEZ,WAAW,EAAEmB,QAAQ,CACnD,CAAC;IACH,CAAC,CAAC,MAAM;MACN,MAAM,IAAIa,KAAK,CAAC,2CAA2C,CAAC;IAC9D;EACF;EAEA,IAAI,OAAO9B,OAAO,CAAC6B,aAAa,KAAK,QAAQ,EAAE;IAC7CD,SAAS,GAAG,IAAAjB,0CAAoB,EAC9B,IAAAoB,oBAAS,EAAC/B,OAAO,CAAC6B,aAAa,EAAEZ,QAAQ,CAC3C,CAAC;EACH;EAEAe,cAAM,CAACC,MAAM,CAAC,+BAA+B,CAAC,CAC5C,SAASvB,IAAI,kBAAkBZ,WAAW,gBAAgB8B,SAAS,EACrE,CAAC;EAED,OAAO;IAAEA,SAAS;IAAElB;EAAK,CAAC;AAC5B","ignoreList":[]}
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getVariableName = getVariableName;
7
- function getVariableName(varId, rawVariableName) {
8
- switch (rawVariableName) {
9
- case 'raw':
10
- return varId;
11
- case 'dashes':
12
- return `--${varId}`;
13
- case 'var':
14
- default:
15
- return `var(--${varId})`;
16
- }
17
- }
18
- //# sourceMappingURL=getVariableName.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getVariableName.js","names":["getVariableName","varId","rawVariableName"],"sources":["../../src/utils/getVariableName.ts"],"sourcesContent":["import type { IOptions } from './types';\n\nexport function getVariableName(\n varId: string,\n rawVariableName: IOptions['variableNameConfig'] | undefined\n) {\n switch (rawVariableName) {\n case 'raw':\n return varId;\n case 'dashes':\n return `--${varId}`;\n case 'var':\n default:\n return `var(--${varId})`;\n }\n}\n"],"mappings":";;;;;;AAEO,SAASA,eAAeA,CAC7BC,KAAa,EACbC,eAA2D,EAC3D;EACA,QAAQA,eAAe;IACrB,KAAK,KAAK;MACR,OAAOD,KAAK;IACd,KAAK,QAAQ;MACX,OAAO,KAAKA,KAAK,EAAE;IACrB,KAAK,KAAK;IACV;MACE,OAAO,SAASA,KAAK,GAAG;EAC5B;AACF","ignoreList":[]}
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = stripLines;
7
- // Stripping away the new lines ensures that we preserve line numbers
8
- // This is useful in case of tools such as the stylelint pre-processor
9
- // This should be safe because strings cannot contain newline: https://www.w3.org/TR/CSS2/syndata.html#strings
10
- function stripLines(loc, text) {
11
- let result = String(text).replace(/[\r\n]+/g, ' ').trim();
12
-
13
- // If the start and end line numbers aren't same, add new lines to span the text across multiple lines
14
- if (loc.start.line !== loc.end.line) {
15
- result += '\n'.repeat(loc.end.line - loc.start.line);
16
-
17
- // Add extra spaces to offset the column
18
- result += ' '.repeat(loc.end.column);
19
- }
20
- return result;
21
- }
22
- //# sourceMappingURL=stripLines.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stripLines.js","names":["stripLines","loc","text","result","String","replace","trim","start","line","end","repeat","column"],"sources":["../../src/utils/stripLines.ts"],"sourcesContent":["import type { Location } from '@wyw-in-js/shared';\n\n// Stripping away the new lines ensures that we preserve line numbers\n// This is useful in case of tools such as the stylelint pre-processor\n// This should be safe because strings cannot contain newline: https://www.w3.org/TR/CSS2/syndata.html#strings\nexport default function stripLines(\n loc: { end: Location; start: Location },\n text: string | number\n) {\n let result = String(text)\n .replace(/[\\r\\n]+/g, ' ')\n .trim();\n\n // If the start and end line numbers aren't same, add new lines to span the text across multiple lines\n if (loc.start.line !== loc.end.line) {\n result += '\\n'.repeat(loc.end.line - loc.start.line);\n\n // Add extra spaces to offset the column\n result += ' '.repeat(loc.end.column);\n }\n\n return result;\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACe,SAASA,UAAUA,CAChCC,GAAuC,EACvCC,IAAqB,EACrB;EACA,IAAIC,MAAM,GAAGC,MAAM,CAACF,IAAI,CAAC,CACtBG,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CACxBC,IAAI,CAAC,CAAC;;EAET;EACA,IAAIL,GAAG,CAACM,KAAK,CAACC,IAAI,KAAKP,GAAG,CAACQ,GAAG,CAACD,IAAI,EAAE;IACnCL,MAAM,IAAI,IAAI,CAACO,MAAM,CAACT,GAAG,CAACQ,GAAG,CAACD,IAAI,GAAGP,GAAG,CAACM,KAAK,CAACC,IAAI,CAAC;;IAEpD;IACAL,MAAM,IAAI,GAAG,CAACO,MAAM,CAACT,GAAG,CAACQ,GAAG,CAACE,MAAM,CAAC;EACtC;EAEA,OAAOR,MAAM;AACf","ignoreList":[]}
@@ -1,129 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = templateProcessor;
7
- var _shared = require("@wyw-in-js/shared");
8
- var _getVariableName = require("./getVariableName");
9
- var _stripLines = _interopRequireDefault(require("./stripLines"));
10
- var _throwIfInvalid = _interopRequireDefault(require("./throwIfInvalid"));
11
- var _toCSS = _interopRequireWildcard(require("./toCSS"));
12
- var _units = require("./units");
13
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- /* eslint-disable no-continue */
16
- /**
17
- * This file handles transforming template literals to class names or styled components and generates CSS content.
18
- * It uses CSS code from template literals and evaluated values of lazy dependencies stored in ValueCache.
19
- */
20
-
21
- // Match any valid CSS unit not immediately followed by an alphanumeric character or underscore.
22
- const unitRegex = new RegExp(`^(?:${_units.units.join('|')})(?![a-zA-Z0-9_])`);
23
- function templateProcessor(tagProcessor, [...template], valueCache, variableNameConfig) {
24
- const sourceMapReplacements = [];
25
- // Check if the variable is referenced anywhere for basic DCE
26
- // Only works when it's assigned to a variable
27
- const {
28
- isReferenced
29
- } = tagProcessor;
30
-
31
- // Serialize the tagged template literal to a string
32
- let cssText = '';
33
- let item;
34
- // eslint-disable-next-line no-cond-assign
35
- while (item = template.shift()) {
36
- if ('type' in item) {
37
- // It's a template element
38
- cssText += item.value.cooked;
39
- continue;
40
- }
41
-
42
- // It's an expression
43
- const {
44
- ex
45
- } = item;
46
- const {
47
- end,
48
- start
49
- } = ex.loc;
50
- const beforeLength = cssText.length;
51
-
52
- // The location will be end of the current string to start of next string
53
- const next = template[0]; // template[0] is the next template element
54
- const loc = {
55
- start,
56
- end: next ? {
57
- line: next.loc.start.line,
58
- column: next.loc.start.column
59
- } : {
60
- line: end.line,
61
- column: end.column + 1
62
- }
63
- };
64
- const value = 'value' in item ? item.value : valueCache.get(item.ex.name);
65
-
66
- // Is it props based interpolation?
67
- if (item.kind === _shared.ValueType.FUNCTION || typeof value === 'function') {
68
- var _next$value$cooked;
69
- // Check if previous expression was a CSS variable that we replaced
70
- // If it has a unit after it, we need to move the unit into the interpolation
71
- // e.g. `var(--size)px` should actually be `var(--size)`
72
- // So we check if the current text starts with a unit, and add the unit to the previous interpolation
73
- // Another approach would be `calc(var(--size) * 1px), but some browsers don't support all units
74
- // https://bugzilla.mozilla.org/show_bug.cgi?id=956573
75
- const matches = (_next$value$cooked = next.value.cooked) === null || _next$value$cooked === void 0 ? void 0 : _next$value$cooked.match(unitRegex);
76
- try {
77
- if (matches) {
78
- var _next$value$cooked$su, _next$value$cooked2, _unit$length;
79
- template.shift();
80
- const [unit] = matches;
81
- const varId = tagProcessor.addInterpolation(item.ex, cssText, item.source, unit);
82
- cssText += (0, _getVariableName.getVariableName)(varId, variableNameConfig);
83
- cssText += (_next$value$cooked$su = (_next$value$cooked2 = next.value.cooked) === null || _next$value$cooked2 === void 0 ? void 0 : _next$value$cooked2.substring((_unit$length = unit === null || unit === void 0 ? void 0 : unit.length) !== null && _unit$length !== void 0 ? _unit$length : 0)) !== null && _next$value$cooked$su !== void 0 ? _next$value$cooked$su : '';
84
- } else {
85
- const varId = tagProcessor.addInterpolation(item.ex, cssText, item.source);
86
- cssText += (0, _getVariableName.getVariableName)(varId, variableNameConfig);
87
- }
88
- } catch (e) {
89
- if (e instanceof Error) {
90
- throw item.buildCodeFrameError(e.message);
91
- }
92
- throw e;
93
- }
94
- } else {
95
- (0, _throwIfInvalid.default)(tagProcessor.isValidValue.bind(tagProcessor), value, item, item.source);
96
- if (value !== undefined && typeof value !== 'function') {
97
- // Skip the blank string instead of throw ing an error
98
- if (value === '') {
99
- continue;
100
- }
101
- if ((0, _shared.hasEvalMeta)(value)) {
102
- // If it's a React component wrapped in styled, get the class name
103
- // Useful for interpolating components
104
- cssText += `.${value.__wyw_meta.className}`;
105
- } else if ((0, _toCSS.isCSSable)(value)) {
106
- // If it's a plain object or an array, convert it to a CSS string
107
- cssText += (0, _stripLines.default)(loc, (0, _toCSS.default)(value));
108
- } else {
109
- // For anything else, assume it'll be stringified
110
- cssText += (0, _stripLines.default)(loc, value);
111
- }
112
- sourceMapReplacements.push({
113
- original: loc,
114
- length: cssText.length - beforeLength
115
- });
116
- }
117
- }
118
- }
119
- const rules = tagProcessor.extractRules(valueCache, cssText, tagProcessor.location);
120
-
121
- // tagProcessor.doRuntimeReplacement(classes);
122
- if (!isReferenced && !cssText.includes(':global')) {
123
- return null;
124
- }
125
-
126
- // eslint-disable-next-line no-param-reassign
127
- return [rules, sourceMapReplacements];
128
- }
129
- //# sourceMappingURL=templateProcessor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"templateProcessor.js","names":["_shared","require","_getVariableName","_stripLines","_interopRequireDefault","_throwIfInvalid","_toCSS","_interopRequireWildcard","_units","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","unitRegex","RegExp","units","join","templateProcessor","tagProcessor","template","valueCache","variableNameConfig","sourceMapReplacements","isReferenced","cssText","item","shift","value","cooked","ex","end","start","loc","beforeLength","length","next","line","column","name","kind","ValueType","FUNCTION","_next$value$cooked","matches","match","_next$value$cooked$su","_next$value$cooked2","_unit$length","unit","varId","addInterpolation","source","getVariableName","substring","Error","buildCodeFrameError","message","throwIfInvalid","isValidValue","bind","undefined","hasEvalMeta","__wyw_meta","className","isCSSable","stripLines","toCSS","push","original","rules","extractRules","location","includes"],"sources":["../../src/utils/templateProcessor.ts"],"sourcesContent":["/* eslint-disable no-continue */\n/**\n * This file handles transforming template literals to class names or styled components and generates CSS content.\n * It uses CSS code from template literals and evaluated values of lazy dependencies stored in ValueCache.\n */\n\nimport type { TemplateElement } from '@babel/types';\n\nimport type { ExpressionValue, Replacements } from '@wyw-in-js/shared';\nimport { hasEvalMeta, ValueType } from '@wyw-in-js/shared';\n\nimport type { TaggedTemplateProcessor } from '../TaggedTemplateProcessor';\nimport type { ValueCache, Rules } from '../types';\n\nimport { getVariableName } from './getVariableName';\nimport stripLines from './stripLines';\nimport throwIfInvalid from './throwIfInvalid';\nimport toCSS, { isCSSable } from './toCSS';\nimport type { IOptions } from './types';\nimport { units } from './units';\n\n// Match any valid CSS unit not immediately followed by an alphanumeric character or underscore.\nconst unitRegex = new RegExp(`^(?:${units.join('|')})(?![a-zA-Z0-9_])`);\n\nexport default function templateProcessor(\n tagProcessor: TaggedTemplateProcessor,\n [...template]: (TemplateElement | ExpressionValue)[],\n valueCache: ValueCache,\n variableNameConfig: IOptions['variableNameConfig'] | undefined\n): [rules: Rules, sourceMapReplacements: Replacements] | null {\n const sourceMapReplacements: Replacements = [];\n // Check if the variable is referenced anywhere for basic DCE\n // Only works when it's assigned to a variable\n const { isReferenced } = tagProcessor;\n\n // Serialize the tagged template literal to a string\n let cssText = '';\n\n let item: TemplateElement | ExpressionValue | undefined;\n // eslint-disable-next-line no-cond-assign\n while ((item = template.shift())) {\n if ('type' in item) {\n // It's a template element\n cssText += item.value.cooked;\n continue;\n }\n\n // It's an expression\n const { ex } = item;\n\n const { end, start } = ex.loc!;\n const beforeLength = cssText.length;\n\n // The location will be end of the current string to start of next string\n const next = template[0] as TemplateElement; // template[0] is the next template element\n const loc = {\n start,\n end: next\n ? { line: next.loc!.start.line, column: next.loc!.start.column }\n : { line: end.line, column: end.column + 1 },\n };\n\n const value = 'value' in item ? item.value : valueCache.get(item.ex.name);\n\n // Is it props based interpolation?\n if (item.kind === ValueType.FUNCTION || typeof value === 'function') {\n // Check if previous expression was a CSS variable that we replaced\n // If it has a unit after it, we need to move the unit into the interpolation\n // e.g. `var(--size)px` should actually be `var(--size)`\n // So we check if the current text starts with a unit, and add the unit to the previous interpolation\n // Another approach would be `calc(var(--size) * 1px), but some browsers don't support all units\n // https://bugzilla.mozilla.org/show_bug.cgi?id=956573\n const matches = next.value.cooked?.match(unitRegex);\n\n try {\n if (matches) {\n template.shift();\n const [unit] = matches;\n\n const varId = tagProcessor.addInterpolation(\n item.ex,\n cssText,\n item.source,\n unit\n );\n cssText += getVariableName(varId, variableNameConfig);\n\n cssText += next.value.cooked?.substring(unit?.length ?? 0) ?? '';\n } else {\n const varId = tagProcessor.addInterpolation(\n item.ex,\n cssText,\n item.source\n );\n cssText += getVariableName(varId, variableNameConfig);\n }\n } catch (e) {\n if (e instanceof Error) {\n throw item.buildCodeFrameError(e.message);\n }\n\n throw e;\n }\n } else {\n throwIfInvalid(\n tagProcessor.isValidValue.bind(tagProcessor),\n value,\n item,\n item.source\n );\n\n if (value !== undefined && typeof value !== 'function') {\n // Skip the blank string instead of throw ing an error\n if (value === '') {\n continue;\n }\n\n if (hasEvalMeta(value)) {\n // If it's a React component wrapped in styled, get the class name\n // Useful for interpolating components\n cssText += `.${value.__wyw_meta.className}`;\n } else if (isCSSable(value)) {\n // If it's a plain object or an array, convert it to a CSS string\n cssText += stripLines(loc, toCSS(value));\n } else {\n // For anything else, assume it'll be stringified\n cssText += stripLines(loc, value);\n }\n\n sourceMapReplacements.push({\n original: loc,\n length: cssText.length - beforeLength,\n });\n }\n }\n }\n\n const rules = tagProcessor.extractRules(\n valueCache,\n cssText,\n tagProcessor.location\n );\n\n // tagProcessor.doRuntimeReplacement(classes);\n if (!isReferenced && !cssText.includes(':global')) {\n return null;\n }\n\n // eslint-disable-next-line no-param-reassign\n return [rules, sourceMapReplacements];\n}\n"],"mappings":";;;;;;AASA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,eAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,MAAA,GAAAC,uBAAA,CAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AAAgC,SAAAM,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CA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,EACJA,IAAI,CAAC0B,MACP,CAAC;MAED,IAAIxB,KAAK,KAAKiC,SAAS,IAAI,OAAOjC,KAAK,KAAK,UAAU,EAAE;QACtD;QACA,IAAIA,KAAK,KAAK,EAAE,EAAE;UAChB;QACF;QAEA,IAAI,IAAAkC,mBAAW,EAAClC,KAAK,CAAC,EAAE;UACtB;UACA;UACAH,OAAO,IAAI,IAAIG,KAAK,CAACmC,UAAU,CAACC,SAAS,EAAE;QAC7C,CAAC,MAAM,IAAI,IAAAC,gBAAS,EAACrC,KAAK,CAAC,EAAE;UAC3B;UACAH,OAAO,IAAI,IAAAyC,mBAAU,EAACjC,GAAG,EAAE,IAAAkC,cAAK,EAACvC,KAAK,CAAC,CAAC;QAC1C,CAAC,MAAM;UACL;UACAH,OAAO,IAAI,IAAAyC,mBAAU,EAACjC,GAAG,EAAEL,KAAK,CAAC;QACnC;QAEAL,qBAAqB,CAAC6C,IAAI,CAAC;UACzBC,QAAQ,EAAEpC,GAAG;UACbE,MAAM,EAAEV,OAAO,CAACU,MAAM,GAAGD;QAC3B,CAAC,CAAC;MACJ;IACF;EACF;EAEA,MAAMoC,KAAK,GAAGnD,YAAY,CAACoD,YAAY,CACrClD,UAAU,EACVI,OAAO,EACPN,YAAY,CAACqD,QACf,CAAC;;EAED;EACA,IAAI,CAAChD,YAAY,IAAI,CAACC,OAAO,CAACgD,QAAQ,CAAC,SAAS,CAAC,EAAE;IACjD,OAAO,IAAI;EACb;;EAEA;EACA,OAAO,CAACH,KAAK,EAAE/C,qBAAqB,CAAC;AACvC","ignoreList":[]}
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- const isLikeError = value => typeof value === 'object' && value !== null && 'stack' in value && 'message' in value;
8
-
9
- // Throw if we can't handle the interpolated value
10
- function throwIfInvalid(checker, value, ex, source) {
11
- // We can't use instanceof here so let's use duck typing
12
- if (isLikeError(value) && value.stack && value.message) {
13
- throw ex.buildCodeFrameError(`An error occurred when evaluating the expression:
14
-
15
- > ${value.message}.
16
-
17
- Make sure you are not using a browser or Node specific API and all the variables are available in static context.
18
- Linaria have to extract pieces of your code to resolve the interpolated values.
19
- Defining styled component or class will not work inside:
20
- - function,
21
- - class,
22
- - method,
23
- - loop,
24
- because it cannot be statically determined in which context you use them.
25
- That's why some variables may be not defined during evaluation.
26
- `);
27
- }
28
- if (checker(value)) {
29
- return;
30
- }
31
- const stringified = typeof value === 'object' ? JSON.stringify(value) : String(value);
32
- throw ex.buildCodeFrameError(`The expression evaluated to '${stringified}', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(${source})'.`);
33
- }
34
- var _default = exports.default = throwIfInvalid;
35
- //# sourceMappingURL=throwIfInvalid.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"throwIfInvalid.js","names":["isLikeError","value","throwIfInvalid","checker","ex","source","stack","message","buildCodeFrameError","stringified","JSON","stringify","String","_default","exports","default"],"sources":["../../src/utils/throwIfInvalid.ts"],"sourcesContent":["import type { BuildCodeFrameErrorFn } from '@wyw-in-js/shared';\n\nconst isLikeError = (value: unknown): value is Error =>\n typeof value === 'object' &&\n value !== null &&\n 'stack' in value &&\n 'message' in value;\n\n// Throw if we can't handle the interpolated value\nfunction throwIfInvalid<T>(\n checker: (value: unknown) => value is T,\n value: Error | unknown,\n ex: { buildCodeFrameError: BuildCodeFrameErrorFn },\n source: string\n): asserts value is T {\n // We can't use instanceof here so let's use duck typing\n if (isLikeError(value) && value.stack && value.message) {\n throw ex.buildCodeFrameError(\n `An error occurred when evaluating the expression:\n\n > ${value.message}.\n\n Make sure you are not using a browser or Node specific API and all the variables are available in static context.\n Linaria have to extract pieces of your code to resolve the interpolated values.\n Defining styled component or class will not work inside:\n - function,\n - class,\n - method,\n - loop,\n because it cannot be statically determined in which context you use them.\n That's why some variables may be not defined during evaluation.\n `\n );\n }\n\n if (checker(value)) {\n return;\n }\n\n const stringified =\n typeof value === 'object' ? JSON.stringify(value) : String(value);\n\n throw ex.buildCodeFrameError(\n `The expression evaluated to '${stringified}', which is probably a mistake. If you want it to be inserted into CSS, explicitly cast or transform the value to a string, e.g. - 'String(${source})'.`\n );\n}\n\nexport default throwIfInvalid;\n"],"mappings":";;;;;;AAEA,MAAMA,WAAW,GAAIC,KAAc,IACjC,OAAOA,KAAK,KAAK,QAAQ,IACzBA,KAAK,KAAK,IAAI,IACd,OAAO,IAAIA,KAAK,IAChB,SAAS,IAAIA,KAAK;;AAEpB;AACA,SAASC,cAAcA,CACrBC,OAAuC,EACvCF,KAAsB,EACtBG,EAAkD,EAClDC,MAAc,EACM;EACpB;EACA,IAAIL,WAAW,CAACC,KAAK,CAAC,IAAIA,KAAK,CAACK,KAAK,IAAIL,KAAK,CAACM,OAAO,EAAE;IACtD,MAAMH,EAAE,CAACI,mBAAmB,CAC1B;AACN;AACA,MAAMP,KAAK,CAACM,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OACI,CAAC;EACH;EAEA,IAAIJ,OAAO,CAACF,KAAK,CAAC,EAAE;IAClB;EACF;EAEA,MAAMQ,WAAW,GACf,OAAOR,KAAK,KAAK,QAAQ,GAAGS,IAAI,CAACC,SAAS,CAACV,KAAK,CAAC,GAAGW,MAAM,CAACX,KAAK,CAAC;EAEnE,MAAMG,EAAE,CAACI,mBAAmB,CAC1B,gCAAgCC,WAAW,8IAA8IJ,MAAM,KACjM,CAAC;AACH;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcb,cAAc","ignoreList":[]}
@@ -1,58 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = toCSS;
7
- exports.isCSSable = void 0;
8
- var _shared = require("@wyw-in-js/shared");
9
- var _units = require("./units");
10
- const isCSSPropertyValue = o => {
11
- return (0, _shared.isBoxedPrimitive)(o) || typeof o === 'string' || typeof o === 'number' && Number.isFinite(o);
12
- };
13
- const isCSSable = o => {
14
- if (isCSSPropertyValue(o)) {
15
- return true;
16
- }
17
- if (Array.isArray(o)) {
18
- return o.every(isCSSable);
19
- }
20
- if (typeof o === 'object') {
21
- return o !== null && Object.values(o).every(isCSSable);
22
- }
23
- return false;
24
- };
25
- exports.isCSSable = isCSSable;
26
- const hyphenate = s => {
27
- if (s.startsWith('--')) {
28
- // It's a custom property which is already well formatted.
29
- return s;
30
- }
31
- return s
32
- // Hyphenate CSS property names from camelCase version from JS string
33
- .replace(/([A-Z])/g, (match, p1) => `-${p1.toLowerCase()}`)
34
- // Special case for `-ms` because in JS it starts with `ms` unlike `Webkit`
35
- .replace(/^ms-/, '-ms-');
36
- };
37
-
38
- // Some tools such as polished.js output JS objects
39
- // To support them transparently, we convert JS objects to CSS strings
40
- function toCSS(o) {
41
- if (Array.isArray(o)) {
42
- return o.map(toCSS).join('\n');
43
- }
44
- if (isCSSPropertyValue(o)) {
45
- return o.valueOf().toString();
46
- }
47
- return Object.entries(o).filter(([, value]) =>
48
- // Ignore all falsy values except numbers
49
- typeof value === 'number' || value).map(([key, value]) => {
50
- if (!isCSSPropertyValue(value)) {
51
- return `${key} { ${toCSS(value)} }`;
52
- }
53
- return `${hyphenate(key)}: ${typeof value === 'number' && value !== 0 &&
54
- // Strip vendor prefixes when checking if the value is unitless
55
- !(key.replace(/^(Webkit|Moz|O|ms)([A-Z])(.+)$/, (match, p1, p2, p3) => `${p2.toLowerCase()}${p3}`) in _units.unitless) ? `${value}px` : value};`;
56
- }).join(' ');
57
- }
58
- //# sourceMappingURL=toCSS.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toCSS.js","names":["_shared","require","_units","isCSSPropertyValue","o","isBoxedPrimitive","Number","isFinite","isCSSable","Array","isArray","every","Object","values","exports","hyphenate","s","startsWith","replace","match","p1","toLowerCase","toCSS","map","join","valueOf","toString","entries","filter","value","key","p2","p3","unitless"],"sources":["../../src/utils/toCSS.ts"],"sourcesContent":["import { isBoxedPrimitive } from '@wyw-in-js/shared';\n\nimport type { CSSPropertyValue, CSSable } from '../types';\n\nimport { unitless } from './units';\n\nconst isCSSPropertyValue = (o: unknown): o is CSSPropertyValue => {\n return (\n isBoxedPrimitive(o) ||\n typeof o === 'string' ||\n (typeof o === 'number' && Number.isFinite(o))\n );\n};\n\nexport const isCSSable = (o: unknown): o is CSSable => {\n if (isCSSPropertyValue(o)) {\n return true;\n }\n\n if (Array.isArray(o)) {\n return o.every(isCSSable);\n }\n\n if (typeof o === 'object') {\n return o !== null && Object.values(o).every(isCSSable);\n }\n\n return false;\n};\n\nconst hyphenate = (s: string) => {\n if (s.startsWith('--')) {\n // It's a custom property which is already well formatted.\n return s;\n }\n return (\n s\n // Hyphenate CSS property names from camelCase version from JS string\n .replace(/([A-Z])/g, (match, p1) => `-${p1.toLowerCase()}`)\n // Special case for `-ms` because in JS it starts with `ms` unlike `Webkit`\n .replace(/^ms-/, '-ms-')\n );\n};\n\n// Some tools such as polished.js output JS objects\n// To support them transparently, we convert JS objects to CSS strings\nexport default function toCSS(o: CSSable): string {\n if (Array.isArray(o)) {\n return o.map(toCSS).join('\\n');\n }\n\n if (isCSSPropertyValue(o)) {\n return o.valueOf().toString();\n }\n\n return Object.entries(o)\n .filter(\n ([, value]) =>\n // Ignore all falsy values except numbers\n typeof value === 'number' || value\n )\n .map(([key, value]) => {\n if (!isCSSPropertyValue(value)) {\n return `${key} { ${toCSS(value)} }`;\n }\n\n return `${hyphenate(key)}: ${\n typeof value === 'number' &&\n value !== 0 &&\n // Strip vendor prefixes when checking if the value is unitless\n !(\n key.replace(\n /^(Webkit|Moz|O|ms)([A-Z])(.+)$/,\n (match, p1, p2, p3) => `${p2.toLowerCase()}${p3}`\n ) in unitless\n )\n ? `${value}px`\n : value\n };`;\n })\n .join(' ');\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAA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CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC/B;EAEA,OAAOd,MAAM,CAACe,OAAO,CAACvB,CAAC,CAAC,CACrBwB,MAAM,CACL,CAAC,GAAGC,KAAK,CAAC;EACR;EACA,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KACjC,CAAC,CACAN,GAAG,CAAC,CAAC,CAACO,GAAG,EAAED,KAAK,CAAC,KAAK;IACrB,IAAI,CAAC1B,kBAAkB,CAAC0B,KAAK,CAAC,EAAE;MAC9B,OAAO,GAAGC,GAAG,MAAMR,KAAK,CAACO,KAAK,CAAC,IAAI;IACrC;IAEA,OAAO,GAAGd,SAAS,CAACe,GAAG,CAAC,KACtB,OAAOD,KAAK,KAAK,QAAQ,IACzBA,KAAK,KAAK,CAAC;IACX;IACA,EACEC,GAAG,CAACZ,OAAO,CACT,gCAAgC,EAChC,CAACC,KAAK,EAAEC,EAAE,EAAEW,EAAE,EAAEC,EAAE,KAAK,GAAGD,EAAE,CAACV,WAAW,CAAC,CAAC,GAAGW,EAAE,EACjD,CAAC,IAAIC,eAAQ,CACd,GACG,GAAGJ,KAAK,IAAI,GACZA,KAAK,GACR;EACL,CAAC,CAAC,CACDL,IAAI,CAAC,GAAG,CAAC;AACd","ignoreList":[]}
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.toValidCSSIdentifier = toValidCSSIdentifier;
7
- function toValidCSSIdentifier(s) {
8
- return s.replace(/[^-_a-z0-9\u00A0-\uFFFF]/gi, '_').replace(/^\d/, '_');
9
- }
10
- //# sourceMappingURL=toValidCSSIdentifier.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toValidCSSIdentifier.js","names":["toValidCSSIdentifier","s","replace"],"sources":["../../src/utils/toValidCSSIdentifier.ts"],"sourcesContent":["export function toValidCSSIdentifier(s: string) {\n return s.replace(/[^-_a-z0-9\\u00A0-\\uFFFF]/gi, '_').replace(/^\\d/, '_');\n}\n"],"mappings":";;;;;;AAAO,SAASA,oBAAoBA,CAACC,CAAS,EAAE;EAC9C,OAAOA,CAAC,CAACC,OAAO,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAACA,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;AACzE","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/utils/types.ts"],"sourcesContent":["import type { TransformOptions } from '@babel/core';\n\nimport type { ClassNameFn, VariableNameFn } from '@wyw-in-js/shared';\n\nexport interface IOptions {\n classNameSlug?: string | ClassNameFn;\n displayName: boolean;\n extensions?: string[];\n variableNameConfig?: 'var' | 'dashes' | 'raw';\n variableNameSlug?: string | VariableNameFn;\n}\n\nexport type IFileContext = Pick<TransformOptions, 'root' | 'filename'>;\n"],"mappings":"","ignoreList":[]}
@@ -1,71 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.units = exports.unitless = void 0;
7
- // https://www.w3.org/TR/css-values-4/
8
- const units = exports.units = [
9
- // font relative lengths
10
- 'em', 'ex', 'cap', 'ch', 'ic', 'rem', 'lh', 'rlh',
11
- // viewport percentage lengths
12
- 'vw', 'vh', 'vi', 'vb', 'vmin', 'vmax',
13
- // absolute lengths
14
- 'cm', 'mm', 'Q', 'in', 'pc', 'pt', 'px',
15
- // angle units
16
- 'deg', 'grad', 'rad', 'turn',
17
- // duration units
18
- 's', 'ms',
19
- // frequency units
20
- 'Hz', 'kHz',
21
- // resolution units
22
- 'dpi', 'dpcm', 'dppx', 'x',
23
- // https://www.w3.org/TR/css-grid-1/#fr-unit
24
- 'fr',
25
- // percentages
26
- '%'];
27
- const unitless = exports.unitless = {
28
- animationIterationCount: true,
29
- borderImageOutset: true,
30
- borderImageSlice: true,
31
- borderImageWidth: true,
32
- boxFlex: true,
33
- boxFlexGroup: true,
34
- boxOrdinalGroup: true,
35
- columnCount: true,
36
- columns: true,
37
- flex: true,
38
- flexGrow: true,
39
- flexPositive: true,
40
- flexShrink: true,
41
- flexNegative: true,
42
- flexOrder: true,
43
- gridRow: true,
44
- gridRowEnd: true,
45
- gridRowSpan: true,
46
- gridRowStart: true,
47
- gridColumn: true,
48
- gridColumnEnd: true,
49
- gridColumnSpan: true,
50
- gridColumnStart: true,
51
- fontWeight: true,
52
- lineClamp: true,
53
- lineHeight: true,
54
- opacity: true,
55
- order: true,
56
- orphans: true,
57
- tabSize: true,
58
- widows: true,
59
- zIndex: true,
60
- zoom: true,
61
- // SVG-related properties
62
- fillOpacity: true,
63
- floodOpacity: true,
64
- stopOpacity: true,
65
- strokeDasharray: true,
66
- strokeDashoffset: true,
67
- strokeMiterlimit: true,
68
- strokeOpacity: true,
69
- strokeWidth: true
70
- };
71
- //# sourceMappingURL=units.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"units.js","names":["units","exports","unitless","animationIterationCount","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"],"sources":["../../src/utils/units.ts"],"sourcesContent":["// https://www.w3.org/TR/css-values-4/\nexport const units = [\n // font relative lengths\n 'em',\n 'ex',\n 'cap',\n 'ch',\n 'ic',\n 'rem',\n 'lh',\n 'rlh',\n\n // viewport percentage lengths\n 'vw',\n 'vh',\n 'vi',\n 'vb',\n 'vmin',\n 'vmax',\n\n // absolute lengths\n 'cm',\n 'mm',\n 'Q',\n 'in',\n 'pc',\n 'pt',\n 'px',\n\n // angle units\n 'deg',\n 'grad',\n 'rad',\n 'turn',\n\n // duration units\n 's',\n 'ms',\n\n // frequency units\n 'Hz',\n 'kHz',\n\n // resolution units\n 'dpi',\n 'dpcm',\n 'dppx',\n 'x',\n\n // https://www.w3.org/TR/css-grid-1/#fr-unit\n 'fr',\n\n // percentages\n '%',\n];\n\nexport const unitless = {\n animationIterationCount: true,\n borderImageOutset: true,\n borderImageSlice: true,\n borderImageWidth: true,\n boxFlex: true,\n boxFlexGroup: true,\n boxOrdinalGroup: true,\n columnCount: true,\n columns: true,\n flex: true,\n flexGrow: true,\n flexPositive: true,\n flexShrink: true,\n flexNegative: true,\n flexOrder: true,\n gridRow: true,\n gridRowEnd: true,\n gridRowSpan: true,\n gridRowStart: true,\n gridColumn: true,\n gridColumnEnd: true,\n gridColumnSpan: true,\n gridColumnStart: true,\n fontWeight: true,\n lineClamp: true,\n lineHeight: true,\n opacity: true,\n order: true,\n orphans: true,\n tabSize: true,\n widows: true,\n zIndex: true,\n zoom: true,\n\n // SVG-related properties\n fillOpacity: true,\n floodOpacity: true,\n stopOpacity: true,\n strokeDasharray: true,\n strokeDashoffset: true,\n strokeMiterlimit: true,\n strokeOpacity: true,\n strokeWidth: true,\n};\n"],"mappings":";;;;;;AAAA;AACO,MAAMA,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG;AACnB;AACA,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,KAAK;AAEL;AACA,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,MAAM;AAEN;AACA,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI;AAEJ;AACA,KAAK,EACL,MAAM,EACN,KAAK,EACL,MAAM;AAEN;AACA,GAAG,EACH,IAAI;AAEJ;AACA,IAAI,EACJ,KAAK;AAEL;AACA,KAAK,EACL,MAAM,EACN,MAAM,EACN,G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
6
- exports.isValidParams = isValidParams;
7
- exports.validateParams = validateParams;
8
- // ParamMapping maps each ParamName to its corresponding Param type.
9
-
10
- // GetParamByName returns the Param type based on the input type T.
11
-
12
- // If T is none of the above, return never.
13
-
14
- // MapParams iteratively maps the input ParamConstraints to their corresponding Param types.
15
-
16
- // If TNames is an empty tuple, return the result tuple.
17
-
18
- function isValidParams(params, constraints) {
19
- const length = Math.max(params.length, constraints.length);
20
- for (let i = 0; i < length; i++) {
21
- var _params$i2;
22
- if (params[i] === undefined || constraints[i] === undefined) {
23
- return false;
24
- }
25
- const constraint = constraints[i];
26
- if (constraint === '...') {
27
- return true;
28
- }
29
- if (constraint === '*') {
30
- if (params[i] === undefined) {
31
- return false;
32
- }
33
- } else if (Array.isArray(constraint)) {
34
- if (constraint.every(c => {
35
- var _params$i;
36
- return c !== ((_params$i = params[i]) === null || _params$i === void 0 ? void 0 : _params$i[0]);
37
- })) {
38
- return false;
39
- }
40
- } else if (constraint !== ((_params$i2 = params[i]) === null || _params$i2 === void 0 ? void 0 : _params$i2[0])) {
41
- return false;
42
- }
43
- }
44
- return true;
45
- }
46
- function validateParams(params, constraints, messageOrError) {
47
- if (!isValidParams(params, constraints)) {
48
- if (typeof messageOrError === 'string') {
49
- throw new Error(messageOrError);
50
- }
51
- throw messageOrError;
52
- }
53
- }
54
- //# sourceMappingURL=validateParams.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateParams.js","names":["isValidParams","params","constraints","length","Math","max","i","_params$i2","undefined","constraint","Array","isArray","every","c","_params$i","validateParams","messageOrError","Error"],"sources":["../../src/utils/validateParams.ts"],"sourcesContent":["import type { Param, Params } from '../types';\n\ntype ParamName = Param[0];\ntype ParamConstraint = ParamName | [...ParamName[]] | '*';\n\nexport type ParamConstraints =\n | [...ParamConstraint[]]\n | [...ParamConstraint[], '...'];\n\n// ParamMapping maps each ParamName to its corresponding Param type.\ntype ParamMapping = {\n [K in ParamName]: Extract<Param, readonly [K, ...unknown[]]>; // For each ParamName K, extract the corresponding Param type.\n};\n\n// GetParamByName returns the Param type based on the input type T.\ntype GetParamByName<T> = T extends '*'\n ? Param // If T is '*', return Param type.\n : T extends keyof ParamMapping // If T is a key in ParamMapping (i.e., a ParamName).\n ? ParamMapping[T] // Return the corresponding Param type from ParamMapping.\n : T extends Array<infer TNames> // If T is an array of names.\n ? TNames extends ParamName // If TNames is a ParamName.\n ? Extract<Param, readonly [TNames, ...unknown[]]> // Return the corresponding Param type.\n : never // If TNames is not a ParamName, return never.\n : never; // If T is none of the above, return never.\n\n// MapParams iteratively maps the input ParamConstraints to their corresponding Param types.\nexport type MapParams<\n TNames extends ParamConstraints,\n TRes extends Param[] = [],\n> = TNames extends [infer THead, ...infer TTail] // If TNames is a non-empty tuple.\n ? THead extends '...' // If the first element in the tuple is '...'.\n ? [...TRes, ...Params] // Append all Params to the result tuple.\n : MapParams<\n Extract<TTail, ParamConstraints>, // Extract the remaining ParamConstraints.\n [...TRes, GetParamByName<Extract<THead, ParamName | '*' | ParamName[]>>] // Append the mapped Param to the result tuple and recurse.\n >\n : TRes; // If TNames is an empty tuple, return the result tuple.\n\nexport function isValidParams<T extends ParamConstraints>(\n params: Params,\n constraints: T\n): params is MapParams<T> {\n const length = Math.max(params.length, constraints.length);\n for (let i = 0; i < length; i++) {\n if (params[i] === undefined || constraints[i] === undefined) {\n return false;\n }\n\n const constraint = constraints[i];\n if (constraint === '...') {\n return true;\n }\n\n if (constraint === '*') {\n if (params[i] === undefined) {\n return false;\n }\n } else if (Array.isArray(constraint)) {\n if (constraint.every((c) => c !== params[i]?.[0])) {\n return false;\n }\n } else if (constraint !== params[i]?.[0]) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function validateParams<T extends ParamConstraints>(\n params: Params,\n constraints: T,\n messageOrError: unknown\n): asserts params is MapParams<T> {\n if (!isValidParams(params, constraints)) {\n if (typeof messageOrError === 'string') {\n throw new Error(messageOrError);\n }\n\n throw messageOrError;\n }\n}\n"],"mappings":";;;;;;;AASA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