tailwindcss 0.0.0-oxide-insiders.a7fe2fe → 0.0.0-oxide-insiders.7f555c4

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 (108) hide show
  1. package/lib/cli/build/deps.js +34 -18
  2. package/lib/cli/build/index.js +45 -12
  3. package/lib/cli/build/plugin.js +273 -90
  4. package/lib/cli/build/utils.js +56 -24
  5. package/lib/cli/build/watching.js +156 -38
  6. package/lib/cli/help/index.js +61 -16
  7. package/lib/cli/index.js +121 -62
  8. package/lib/cli/init/index.js +47 -23
  9. package/lib/cli-peer-dependencies.js +23 -13
  10. package/lib/cli.js +5 -1
  11. package/lib/corePluginList.js +7 -4
  12. package/lib/corePlugins.js +855 -386
  13. package/lib/featureFlags.js +43 -18
  14. package/lib/lib/cacheInvalidation.js +78 -30
  15. package/lib/lib/collapseAdjacentRules.js +46 -23
  16. package/lib/lib/collapseDuplicateDeclarations.js +70 -27
  17. package/lib/lib/content.js +134 -41
  18. package/lib/lib/defaultExtractor.js +201 -96
  19. package/lib/lib/detectNesting.js +38 -12
  20. package/lib/lib/evaluateTailwindFunctions.js +192 -103
  21. package/lib/lib/expandApplyAtRules.js +488 -181
  22. package/lib/lib/expandTailwindAtRules.js +240 -70
  23. package/lib/lib/findAtConfigPath.js +34 -15
  24. package/lib/lib/generateRules.js +775 -353
  25. package/lib/lib/getModuleDependencies.js +67 -29
  26. package/lib/lib/load-config.js +27 -17
  27. package/lib/lib/normalizeTailwindDirectives.js +73 -27
  28. package/lib/lib/offsets.js +227 -62
  29. package/lib/lib/partitionApplyAtRules.js +53 -29
  30. package/lib/lib/regex.js +50 -28
  31. package/lib/lib/remap-bitfield.js +86 -9
  32. package/lib/lib/resolveDefaultsAtRules.js +123 -53
  33. package/lib/lib/setupContextUtils.js +1117 -584
  34. package/lib/lib/setupTrackingContext.js +149 -58
  35. package/lib/lib/sharedState.js +71 -23
  36. package/lib/lib/substituteScreenAtRules.js +19 -9
  37. package/lib/oxide/cli/build/deps.js +46 -23
  38. package/lib/oxide/cli/build/index.js +44 -12
  39. package/lib/oxide/cli/build/plugin.js +271 -89
  40. package/lib/oxide/cli/build/utils.js +55 -24
  41. package/lib/oxide/cli/build/watching.js +153 -36
  42. package/lib/oxide/cli/help/index.js +60 -16
  43. package/lib/oxide/cli/index.js +128 -67
  44. package/lib/oxide/cli/init/index.js +40 -19
  45. package/lib/oxide/cli.js +3 -2
  46. package/lib/plugin.js +58 -31
  47. package/lib/postcss-plugins/nesting/index.js +13 -7
  48. package/lib/postcss-plugins/nesting/plugin.js +65 -20
  49. package/lib/processTailwindFeatures.js +41 -10
  50. package/lib/public/colors.js +25 -16
  51. package/lib/public/create-plugin.js +11 -6
  52. package/lib/public/default-config.js +12 -6
  53. package/lib/public/default-theme.js +12 -6
  54. package/lib/public/load-config.js +9 -5
  55. package/lib/public/resolve-config.js +10 -6
  56. package/lib/util/applyImportantSelector.js +28 -17
  57. package/lib/util/bigSign.js +9 -6
  58. package/lib/util/buildMediaQuery.js +19 -10
  59. package/lib/util/cloneDeep.js +19 -9
  60. package/lib/util/cloneNodes.js +29 -14
  61. package/lib/util/color.js +87 -47
  62. package/lib/util/colorNames.js +752 -0
  63. package/lib/util/configurePlugins.js +18 -9
  64. package/lib/util/createPlugin.js +17 -8
  65. package/lib/util/createUtilityPlugin.js +30 -16
  66. package/lib/util/dataTypes.js +189 -38
  67. package/lib/util/defaults.js +21 -9
  68. package/lib/util/escapeClassName.js +15 -9
  69. package/lib/util/escapeCommas.js +9 -6
  70. package/lib/util/flattenColorPalette.js +11 -7
  71. package/lib/util/formatVariantSelector.js +209 -60
  72. package/lib/util/getAllConfigs.js +44 -35
  73. package/lib/util/hashConfig.js +12 -8
  74. package/lib/util/isKeyframeRule.js +10 -7
  75. package/lib/util/isPlainObject.js +14 -9
  76. package/lib/util/isSyntacticallyValidPropertyValue.js +45 -14
  77. package/lib/util/log.js +20 -9
  78. package/lib/util/nameClass.js +31 -10
  79. package/lib/util/negateValue.js +28 -10
  80. package/lib/util/normalizeConfig.js +242 -63
  81. package/lib/util/normalizeScreens.js +145 -70
  82. package/lib/util/parseAnimationValue.js +64 -14
  83. package/lib/util/parseBoxShadowValue.js +63 -14
  84. package/lib/util/parseDependency.js +39 -13
  85. package/lib/util/parseGlob.js +25 -8
  86. package/lib/util/parseObjectStyles.js +29 -18
  87. package/lib/util/pluginUtils.js +196 -77
  88. package/lib/util/prefixSelector.js +31 -12
  89. package/lib/util/pseudoElements.js +116 -34
  90. package/lib/util/removeAlphaVariables.js +23 -8
  91. package/lib/util/resolveConfig.js +224 -105
  92. package/lib/util/resolveConfigPath.js +45 -15
  93. package/lib/util/responsive.js +10 -6
  94. package/lib/util/splitAtTopLevelOnly.js +46 -10
  95. package/lib/util/tap.js +11 -7
  96. package/lib/util/toColorValue.js +10 -7
  97. package/lib/util/toPath.js +28 -8
  98. package/lib/util/transformThemeValue.js +49 -14
  99. package/lib/util/validateConfig.js +25 -15
  100. package/lib/util/validateFormalSyntax.js +14 -6
  101. package/lib/util/withAlphaVariable.js +54 -30
  102. package/package.json +18 -22
  103. package/peers/index.js +57849 -43101
  104. package/src/lib/expandTailwindAtRules.js +1 -1
  105. package/src/lib/setupTrackingContext.js +1 -1
  106. package/src/util/color.js +1 -1
  107. package/src/util/colorNames.js +150 -0
  108. package/src/util/pseudoElements.js +4 -4
@@ -1,33 +1,153 @@
1
- "use strict";
1
+ /**
2
+ * @typedef {object} ScreenValue
3
+ * @property {number|undefined} min
4
+ * @property {number|undefined} max
5
+ * @property {string|undefined} raw
6
+ */ /**
7
+ * @typedef {object} Screen
8
+ * @property {string} name
9
+ * @property {boolean} not
10
+ * @property {ScreenValue[]} values
11
+ */ /**
12
+ * A function that normalizes the various forms that the screens object can be
13
+ * provided in.
14
+ *
15
+ * Input(s):
16
+ * - ['100px', '200px'] // Raw strings
17
+ * - { sm: '100px', md: '200px' } // Object with string values
18
+ * - { sm: { min: '100px' }, md: { max: '100px' } } // Object with object values
19
+ * - { sm: [{ min: '100px' }, { max: '200px' }] } // Object with object array (multiple values)
20
+ *
21
+ * Output(s):
22
+ * - [{ name: 'sm', values: [{ min: '100px', max: '200px' }] }] // List of objects, that contains multiple values
23
+ *
24
+ * @returns {Screen[]}
25
+ */ "use strict";
26
+ Object.defineProperty(exports, "__esModule", {
27
+ value: true
28
+ });
29
+ function _export(target, all) {
30
+ for(var name in all)Object.defineProperty(target, name, {
31
+ enumerable: true,
32
+ get: all[name]
33
+ });
34
+ }
35
+ _export(exports, {
36
+ normalizeScreens: function() {
37
+ return normalizeScreens;
38
+ },
39
+ isScreenSortable: function() {
40
+ return isScreenSortable;
41
+ },
42
+ compareScreens: function() {
43
+ return compareScreens;
44
+ },
45
+ toScreen: function() {
46
+ return toScreen;
47
+ }
48
+ });
49
+ function normalizeScreens(screens, root = true) {
50
+ if (Array.isArray(screens)) {
51
+ return screens.map((screen)=>{
52
+ if (root && Array.isArray(screen)) {
53
+ throw new Error("The tuple syntax is not supported for `screens`.");
54
+ }
55
+ if (typeof screen === "string") {
56
+ return {
57
+ name: screen.toString(),
58
+ not: false,
59
+ values: [
60
+ {
61
+ min: screen,
62
+ max: undefined
63
+ }
64
+ ]
65
+ };
66
+ }
67
+ let [name, options] = screen;
68
+ name = name.toString();
69
+ if (typeof options === "string") {
70
+ return {
71
+ name,
72
+ not: false,
73
+ values: [
74
+ {
75
+ min: options,
76
+ max: undefined
77
+ }
78
+ ]
79
+ };
80
+ }
81
+ if (Array.isArray(options)) {
82
+ return {
83
+ name,
84
+ not: false,
85
+ values: options.map((option)=>resolveValue(option))
86
+ };
87
+ }
88
+ return {
89
+ name,
90
+ not: false,
91
+ values: [
92
+ resolveValue(options)
93
+ ]
94
+ };
95
+ });
96
+ }
97
+ return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {}), false);
98
+ }
2
99
  function isScreenSortable(screen) {
3
- return 1 !== screen.values.length ? {
4
- result: !1,
5
- reason: "multiple-values"
6
- } : void 0 !== screen.values[0].raw ? {
7
- result: !1,
8
- reason: "raw-values"
9
- } : void 0 !== screen.values[0].min && void 0 !== screen.values[0].max ? {
10
- result: !1,
11
- reason: "min-and-max"
12
- } : {
13
- result: !0,
100
+ if (screen.values.length !== 1) {
101
+ return {
102
+ result: false,
103
+ reason: "multiple-values"
104
+ };
105
+ } else if (screen.values[0].raw !== undefined) {
106
+ return {
107
+ result: false,
108
+ reason: "raw-values"
109
+ };
110
+ } else if (screen.values[0].min !== undefined && screen.values[0].max !== undefined) {
111
+ return {
112
+ result: false,
113
+ reason: "min-and-max"
114
+ };
115
+ }
116
+ return {
117
+ result: true,
14
118
  reason: null
15
119
  };
16
120
  }
17
121
  function compareScreens(type, a, z) {
18
- let aScreen = toScreen(a, type), zScreen = toScreen(z, type), aSorting = isScreenSortable(aScreen), bSorting = isScreenSortable(zScreen);
19
- if ("multiple-values" === aSorting.reason || "multiple-values" === bSorting.reason) throw Error("Attempted to sort a screen with multiple values. This should never happen. Please open a bug report.");
20
- if ("raw-values" === aSorting.reason || "raw-values" === bSorting.reason) throw Error("Attempted to sort a screen with raw values. This should never happen. Please open a bug report.");
21
- if ("min-and-max" === aSorting.reason || "min-and-max" === bSorting.reason) throw Error("Attempted to sort a screen with both min and max values. This should never happen. Please open a bug report.");
22
- let { min: aMin , max: aMax } = aScreen.values[0], { min: zMin , max: zMax } = zScreen.values[0];
23
- a.not && ([aMin, aMax] = [
122
+ let aScreen = toScreen(a, type);
123
+ let zScreen = toScreen(z, type);
124
+ let aSorting = isScreenSortable(aScreen);
125
+ let bSorting = isScreenSortable(zScreen);
126
+ // These cases should never happen and indicate a bug in Tailwind CSS itself
127
+ if (aSorting.reason === "multiple-values" || bSorting.reason === "multiple-values") {
128
+ throw new Error("Attempted to sort a screen with multiple values. This should never happen. Please open a bug report.");
129
+ } else if (aSorting.reason === "raw-values" || bSorting.reason === "raw-values") {
130
+ throw new Error("Attempted to sort a screen with raw values. This should never happen. Please open a bug report.");
131
+ } else if (aSorting.reason === "min-and-max" || bSorting.reason === "min-and-max") {
132
+ throw new Error("Attempted to sort a screen with both min and max values. This should never happen. Please open a bug report.");
133
+ }
134
+ // Let the sorting begin
135
+ let { min: aMin , max: aMax } = aScreen.values[0];
136
+ let { min: zMin , max: zMax } = zScreen.values[0];
137
+ // Negating screens flip their behavior. Basically `not min-width` is `max-width`
138
+ if (a.not) [aMin, aMax] = [
24
139
  aMax,
25
140
  aMin
26
- ]), z.not && ([zMin, zMax] = [
141
+ ];
142
+ if (z.not) [zMin, zMax] = [
27
143
  zMax,
28
144
  zMin
29
- ]), aMin = void 0 === aMin ? aMin : parseFloat(aMin), aMax = void 0 === aMax ? aMax : parseFloat(aMax), zMin = void 0 === zMin ? zMin : parseFloat(zMin), zMax = void 0 === zMax ? zMax : parseFloat(zMax);
30
- let [aValue, zValue] = "min" === type ? [
145
+ ];
146
+ aMin = aMin === undefined ? aMin : parseFloat(aMin);
147
+ aMax = aMax === undefined ? aMax : parseFloat(aMax);
148
+ zMin = zMin === undefined ? zMin : parseFloat(zMin);
149
+ zMax = zMax === undefined ? zMax : parseFloat(zMax);
150
+ let [aValue, zValue] = type === "min" ? [
31
151
  aMin,
32
152
  zMin
33
153
  ] : [
@@ -37,7 +157,10 @@ function compareScreens(type, a, z) {
37
157
  return aValue - zValue;
38
158
  }
39
159
  function toScreen(value, type) {
40
- return "object" == typeof value ? value : {
160
+ if (typeof value === "object") {
161
+ return value;
162
+ }
163
+ return {
41
164
  name: "arbitrary-screen",
42
165
  values: [
43
166
  {
@@ -53,51 +176,3 @@ function resolveValue({ "min-width": _minWidth , min =_minWidth , max , raw } =
53
176
  raw
54
177
  };
55
178
  }
56
- Object.defineProperty(exports, "__esModule", {
57
- value: !0
58
- }), function(target, all) {
59
- for(var name in all)Object.defineProperty(target, name, {
60
- enumerable: !0,
61
- get: all[name]
62
- });
63
- }(exports, {
64
- normalizeScreens: ()=>function normalizeScreens(screens, root = !0) {
65
- return Array.isArray(screens) ? screens.map((screen)=>{
66
- if (root && Array.isArray(screen)) throw Error("The tuple syntax is not supported for `screens`.");
67
- if ("string" == typeof screen) return {
68
- name: screen.toString(),
69
- not: !1,
70
- values: [
71
- {
72
- min: screen,
73
- max: void 0
74
- }
75
- ]
76
- };
77
- let [name, options] = screen;
78
- return (name = name.toString(), "string" == typeof options) ? {
79
- name,
80
- not: !1,
81
- values: [
82
- {
83
- min: options,
84
- max: void 0
85
- }
86
- ]
87
- } : Array.isArray(options) ? {
88
- name,
89
- not: !1,
90
- values: options.map((option)=>resolveValue(option))
91
- } : {
92
- name,
93
- not: !1,
94
- values: [
95
- resolveValue(options)
96
- ]
97
- };
98
- }) : normalizeScreens(Object.entries(null != screens ? screens : {}), !1);
99
- },
100
- isScreenSortable: ()=>isScreenSortable,
101
- compareScreens: ()=>compareScreens,
102
- toScreen: ()=>toScreen
103
- });
@@ -1,26 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), Object.defineProperty(exports, "default", {
5
- enumerable: !0,
6
- get: ()=>parseAnimationValue
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return parseAnimationValue;
9
+ }
7
10
  });
8
11
  const DIRECTIONS = new Set([
9
12
  "normal",
10
13
  "reverse",
11
14
  "alternate",
12
15
  "alternate-reverse"
13
- ]), PLAY_STATES = new Set([
16
+ ]);
17
+ const PLAY_STATES = new Set([
14
18
  "running",
15
19
  "paused"
16
- ]), FILL_MODES = new Set([
20
+ ]);
21
+ const FILL_MODES = new Set([
17
22
  "none",
18
23
  "forwards",
19
24
  "backwards",
20
25
  "both"
21
- ]), ITERATION_COUNTS = new Set([
26
+ ]);
27
+ const ITERATION_COUNTS = new Set([
22
28
  "infinite"
23
- ]), TIMINGS = new Set([
29
+ ]);
30
+ const TIMINGS = new Set([
24
31
  "linear",
25
32
  "ease",
26
33
  "ease-in",
@@ -28,16 +35,59 @@ const DIRECTIONS = new Set([
28
35
  "ease-in-out",
29
36
  "step-start",
30
37
  "step-end"
31
- ]), TIMING_FNS = [
38
+ ]);
39
+ const TIMING_FNS = [
32
40
  "cubic-bezier",
33
41
  "steps"
34
- ], COMMA = /\,(?![^(]*\))/g, SPACE = /\ +(?![^(]*\))/g, TIME = /^(-?[\d.]+m?s)$/, DIGIT = /^(\d+)$/;
42
+ ];
43
+ const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
44
+ ;
45
+ const SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
46
+ ;
47
+ const TIME = /^(-?[\d.]+m?s)$/;
48
+ const DIGIT = /^(\d+)$/;
35
49
  function parseAnimationValue(input) {
36
- return input.split(COMMA).map((animation)=>{
37
- let value = animation.trim(), result = {
50
+ let animations = input.split(COMMA);
51
+ return animations.map((animation)=>{
52
+ let value = animation.trim();
53
+ let result = {
38
54
  value
39
- }, parts = value.split(SPACE), seen = new Set();
40
- for (let part of parts)!seen.has("DIRECTIONS") && DIRECTIONS.has(part) ? (result.direction = part, seen.add("DIRECTIONS")) : !seen.has("PLAY_STATES") && PLAY_STATES.has(part) ? (result.playState = part, seen.add("PLAY_STATES")) : !seen.has("FILL_MODES") && FILL_MODES.has(part) ? (result.fillMode = part, seen.add("FILL_MODES")) : !seen.has("ITERATION_COUNTS") && (ITERATION_COUNTS.has(part) || DIGIT.test(part)) ? (result.iterationCount = part, seen.add("ITERATION_COUNTS")) : !seen.has("TIMING_FUNCTION") && TIMINGS.has(part) ? (result.timingFunction = part, seen.add("TIMING_FUNCTION")) : !seen.has("TIMING_FUNCTION") && TIMING_FNS.some((f)=>part.startsWith(`${f}(`)) ? (result.timingFunction = part, seen.add("TIMING_FUNCTION")) : !seen.has("DURATION") && TIME.test(part) ? (result.duration = part, seen.add("DURATION")) : !seen.has("DELAY") && TIME.test(part) ? (result.delay = part, seen.add("DELAY")) : seen.has("NAME") ? (result.unknown || (result.unknown = []), result.unknown.push(part)) : (result.name = part, seen.add("NAME"));
55
+ };
56
+ let parts = value.split(SPACE);
57
+ let seen = new Set();
58
+ for (let part of parts){
59
+ if (!seen.has("DIRECTIONS") && DIRECTIONS.has(part)) {
60
+ result.direction = part;
61
+ seen.add("DIRECTIONS");
62
+ } else if (!seen.has("PLAY_STATES") && PLAY_STATES.has(part)) {
63
+ result.playState = part;
64
+ seen.add("PLAY_STATES");
65
+ } else if (!seen.has("FILL_MODES") && FILL_MODES.has(part)) {
66
+ result.fillMode = part;
67
+ seen.add("FILL_MODES");
68
+ } else if (!seen.has("ITERATION_COUNTS") && (ITERATION_COUNTS.has(part) || DIGIT.test(part))) {
69
+ result.iterationCount = part;
70
+ seen.add("ITERATION_COUNTS");
71
+ } else if (!seen.has("TIMING_FUNCTION") && TIMINGS.has(part)) {
72
+ result.timingFunction = part;
73
+ seen.add("TIMING_FUNCTION");
74
+ } else if (!seen.has("TIMING_FUNCTION") && TIMING_FNS.some((f)=>part.startsWith(`${f}(`))) {
75
+ result.timingFunction = part;
76
+ seen.add("TIMING_FUNCTION");
77
+ } else if (!seen.has("DURATION") && TIME.test(part)) {
78
+ result.duration = part;
79
+ seen.add("DURATION");
80
+ } else if (!seen.has("DELAY") && TIME.test(part)) {
81
+ result.delay = part;
82
+ seen.add("DELAY");
83
+ } else if (!seen.has("NAME")) {
84
+ result.name = part;
85
+ seen.add("NAME");
86
+ } else {
87
+ if (!result.unknown) result.unknown = [];
88
+ result.unknown.push(part);
89
+ }
90
+ }
41
91
  return result;
42
92
  });
43
93
  }
@@ -1,14 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), function(target, all) {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
5
6
  for(var name in all)Object.defineProperty(target, name, {
6
- enumerable: !0,
7
+ enumerable: true,
7
8
  get: all[name]
8
9
  });
9
- }(exports, {
10
- parseBoxShadowValue: ()=>parseBoxShadowValue,
11
- formatBoxShadowValue: ()=>formatBoxShadowValue
10
+ }
11
+ _export(exports, {
12
+ parseBoxShadowValue: function() {
13
+ return parseBoxShadowValue;
14
+ },
15
+ formatBoxShadowValue: function() {
16
+ return formatBoxShadowValue;
17
+ }
12
18
  });
13
19
  const _splitAtTopLevelOnly = require("./splitAtTopLevelOnly");
14
20
  let KEYWORDS = new Set([
@@ -17,23 +23,66 @@ let KEYWORDS = new Set([
17
23
  "initial",
18
24
  "revert",
19
25
  "unset"
20
- ]), SPACE = /\ +(?![^(]*\))/g, LENGTH = /^-?(\d+|\.\d+)(.*?)$/g;
26
+ ]);
27
+ let SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
28
+ ;
29
+ let LENGTH = /^-?(\d+|\.\d+)(.*?)$/g;
21
30
  function parseBoxShadowValue(input) {
22
- return (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(input, ",").map((shadow)=>{
23
- let value = shadow.trim(), result = {
31
+ let shadows = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(input, ",");
32
+ return shadows.map((shadow)=>{
33
+ let value = shadow.trim();
34
+ let result = {
24
35
  raw: value
25
- }, parts = value.split(SPACE), seen = new Set();
26
- for (let part of parts)LENGTH.lastIndex = 0, !seen.has("KEYWORD") && KEYWORDS.has(part) ? (result.keyword = part, seen.add("KEYWORD")) : LENGTH.test(part) ? seen.has("X") ? seen.has("Y") ? seen.has("BLUR") ? seen.has("SPREAD") || (result.spread = part, seen.add("SPREAD")) : (result.blur = part, seen.add("BLUR")) : (result.y = part, seen.add("Y")) : (result.x = part, seen.add("X")) : result.color ? (result.unknown || (result.unknown = []), result.unknown.push(part)) : result.color = part;
27
- return result.valid = void 0 !== result.x && void 0 !== result.y, result;
36
+ };
37
+ let parts = value.split(SPACE);
38
+ let seen = new Set();
39
+ for (let part of parts){
40
+ // Reset index, since the regex is stateful.
41
+ LENGTH.lastIndex = 0;
42
+ // Keyword
43
+ if (!seen.has("KEYWORD") && KEYWORDS.has(part)) {
44
+ result.keyword = part;
45
+ seen.add("KEYWORD");
46
+ } else if (LENGTH.test(part)) {
47
+ if (!seen.has("X")) {
48
+ result.x = part;
49
+ seen.add("X");
50
+ } else if (!seen.has("Y")) {
51
+ result.y = part;
52
+ seen.add("Y");
53
+ } else if (!seen.has("BLUR")) {
54
+ result.blur = part;
55
+ seen.add("BLUR");
56
+ } else if (!seen.has("SPREAD")) {
57
+ result.spread = part;
58
+ seen.add("SPREAD");
59
+ }
60
+ } else {
61
+ if (!result.color) {
62
+ result.color = part;
63
+ } else {
64
+ if (!result.unknown) result.unknown = [];
65
+ result.unknown.push(part);
66
+ }
67
+ }
68
+ }
69
+ // Check if valid
70
+ result.valid = result.x !== undefined && result.y !== undefined;
71
+ return result;
28
72
  });
29
73
  }
30
74
  function formatBoxShadowValue(shadows) {
31
- return shadows.map((shadow)=>shadow.valid ? [
75
+ return shadows.map((shadow)=>{
76
+ if (!shadow.valid) {
77
+ return shadow.raw;
78
+ }
79
+ return [
32
80
  shadow.keyword,
33
81
  shadow.x,
34
82
  shadow.y,
35
83
  shadow.blur,
36
84
  shadow.spread,
37
85
  shadow.color
38
- ].filter(Boolean).join(" ") : shadow.raw).join(", ");
86
+ ].filter(Boolean).join(" ");
87
+ }).join(", ");
39
88
  }
@@ -1,21 +1,47 @@
1
- "use strict";
1
+ // @ts-check
2
+ /**
3
+ * @typedef {{type: 'dependency', file: string} | {type: 'dir-dependency', dir: string, glob: string}} Dependency
4
+ */ /**
5
+ *
6
+ * @param {import('../lib/content.js').ContentPath} contentPath
7
+ * @returns {Dependency[]}
8
+ */ "use strict";
9
+ Object.defineProperty(exports, "__esModule", {
10
+ value: true
11
+ });
12
+ Object.defineProperty(exports, "default", {
13
+ enumerable: true,
14
+ get: function() {
15
+ return parseDependency;
16
+ }
17
+ });
2
18
  function parseDependency(contentPath) {
3
- return contentPath.ignore ? [] : contentPath.glob && "true" !== process.env.ROLLUP_WATCH ? [
19
+ if (contentPath.ignore) {
20
+ return [];
21
+ }
22
+ if (!contentPath.glob) {
23
+ return [
24
+ {
25
+ type: "dependency",
26
+ file: contentPath.base
27
+ }
28
+ ];
29
+ }
30
+ if (process.env.ROLLUP_WATCH === "true") {
31
+ // rollup-plugin-postcss does not support dir-dependency messages
32
+ // but directories can be watched in the same way as files
33
+ return [
34
+ {
35
+ type: "dependency",
36
+ file: contentPath.base
37
+ }
38
+ ];
39
+ }
40
+ return [
4
41
  {
5
42
  type: "dir-dependency",
6
43
  dir: contentPath.base,
7
44
  glob: contentPath.glob
8
45
  }
9
- ] : [
10
- {
11
- type: "dependency",
12
- file: contentPath.base
13
- }
14
46
  ];
15
47
  }
16
- Object.defineProperty(exports, "__esModule", {
17
- value: !0
18
- }), Object.defineProperty(exports, "default", {
19
- enumerable: !0,
20
- get: ()=>parseDependency
21
- });
@@ -1,18 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), Object.defineProperty(exports, "parseGlob", {
5
- enumerable: !0,
6
- get: ()=>parseGlob
3
+ value: true
7
4
  });
8
- const _globParent = function(obj) {
5
+ Object.defineProperty(exports, "parseGlob", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return parseGlob;
9
+ }
10
+ });
11
+ const _globparent = /*#__PURE__*/ _interop_require_default(require("glob-parent"));
12
+ function _interop_require_default(obj) {
9
13
  return obj && obj.__esModule ? obj : {
10
14
  default: obj
11
15
  };
12
- }(require("glob-parent"));
16
+ }
13
17
  function parseGlob(pattern) {
14
- let glob = pattern, base = (0, _globParent.default)(pattern);
15
- return "." !== base && "/" === (glob = pattern.substr(base.length)).charAt(0) && (glob = glob.substr(1)), "./" === glob.substr(0, 2) && (glob = glob.substr(2)), "/" === glob.charAt(0) && (glob = glob.substr(1)), {
18
+ let glob = pattern;
19
+ let base = (0, _globparent.default)(pattern);
20
+ if (base !== ".") {
21
+ glob = pattern.substr(base.length);
22
+ if (glob.charAt(0) === "/") {
23
+ glob = glob.substr(1);
24
+ }
25
+ }
26
+ if (glob.substr(0, 2) === "./") {
27
+ glob = glob.substr(2);
28
+ }
29
+ if (glob.charAt(0) === "/") {
30
+ glob = glob.substr(1);
31
+ }
32
+ return {
16
33
  base,
17
34
  glob
18
35
  };
@@ -1,25 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), Object.defineProperty(exports, "default", {
5
- enumerable: !0,
6
- get: ()=>function parseObjectStyles(styles) {
7
- return Array.isArray(styles) ? styles.flatMap((style)=>(0, _postcss.default)([
8
- (0, _postcssNested.default)({
9
- bubble: [
10
- "screen"
11
- ]
12
- })
13
- ]).process(style, {
14
- parser: _postcssJs.default
15
- }).root.nodes) : parseObjectStyles([
16
- styles
17
- ]);
18
- }
3
+ value: true
19
4
  });
20
- const _postcss = _interopRequireDefault(require("postcss")), _postcssNested = _interopRequireDefault(require("postcss-nested")), _postcssJs = _interopRequireDefault(require("postcss-js"));
21
- function _interopRequireDefault(obj) {
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return parseObjectStyles;
9
+ }
10
+ });
11
+ const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
12
+ const _postcssnested = /*#__PURE__*/ _interop_require_default(require("postcss-nested"));
13
+ const _postcssjs = /*#__PURE__*/ _interop_require_default(require("postcss-js"));
14
+ function _interop_require_default(obj) {
22
15
  return obj && obj.__esModule ? obj : {
23
16
  default: obj
24
17
  };
25
18
  }
19
+ function parseObjectStyles(styles) {
20
+ if (!Array.isArray(styles)) {
21
+ return parseObjectStyles([
22
+ styles
23
+ ]);
24
+ }
25
+ return styles.flatMap((style)=>{
26
+ return (0, _postcss.default)([
27
+ (0, _postcssnested.default)({
28
+ bubble: [
29
+ "screen"
30
+ ]
31
+ })
32
+ ]).process(style, {
33
+ parser: _postcssjs.default
34
+ }).root.nodes;
35
+ });
36
+ }