tailwindcss 0.0.0-insiders.ea139f2 → 0.0.0-insiders.ea4e1cd

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 (236) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +15 -7
  3. package/colors.d.ts +3 -0
  4. package/colors.js +2 -1
  5. package/defaultConfig.d.ts +3 -0
  6. package/defaultConfig.js +2 -1
  7. package/defaultTheme.d.ts +4 -0
  8. package/defaultTheme.js +2 -1
  9. package/lib/cli/build/deps.js +62 -0
  10. package/lib/cli/build/index.js +54 -0
  11. package/lib/cli/build/plugin.js +378 -0
  12. package/lib/cli/build/utils.js +88 -0
  13. package/lib/cli/build/watching.js +182 -0
  14. package/lib/cli/help/index.js +73 -0
  15. package/lib/cli/index.js +230 -0
  16. package/lib/cli/init/index.js +63 -0
  17. package/lib/cli-peer-dependencies.js +28 -7
  18. package/lib/cli.js +4 -703
  19. package/lib/corePluginList.js +12 -3
  20. package/lib/corePlugins.js +2373 -1863
  21. package/lib/css/preflight.css +10 -8
  22. package/lib/featureFlags.js +49 -26
  23. package/lib/index.js +1 -31
  24. package/lib/lib/cacheInvalidation.js +92 -0
  25. package/lib/lib/collapseAdjacentRules.js +30 -10
  26. package/lib/lib/collapseDuplicateDeclarations.js +60 -4
  27. package/lib/lib/content.js +181 -0
  28. package/lib/lib/defaultExtractor.js +243 -0
  29. package/lib/lib/detectNesting.js +21 -10
  30. package/lib/lib/evaluateTailwindFunctions.js +115 -50
  31. package/lib/lib/expandApplyAtRules.js +467 -161
  32. package/lib/lib/expandTailwindAtRules.js +160 -133
  33. package/lib/lib/findAtConfigPath.js +46 -0
  34. package/lib/lib/generateRules.js +553 -200
  35. package/lib/lib/getModuleDependencies.js +88 -37
  36. package/lib/lib/load-config.js +42 -0
  37. package/lib/lib/normalizeTailwindDirectives.js +46 -33
  38. package/lib/lib/offsets.js +306 -0
  39. package/lib/lib/partitionApplyAtRules.js +58 -0
  40. package/lib/lib/regex.js +74 -0
  41. package/lib/lib/remap-bitfield.js +89 -0
  42. package/lib/lib/resolveDefaultsAtRules.js +98 -58
  43. package/lib/lib/setupContextUtils.js +773 -321
  44. package/lib/lib/setupTrackingContext.js +70 -75
  45. package/lib/lib/sharedState.js +78 -10
  46. package/lib/lib/substituteScreenAtRules.js +14 -10
  47. package/lib/oxide/cli/build/deps.js +89 -0
  48. package/lib/oxide/cli/build/index.js +53 -0
  49. package/lib/oxide/cli/build/plugin.js +375 -0
  50. package/lib/oxide/cli/build/utils.js +87 -0
  51. package/lib/oxide/cli/build/watching.js +179 -0
  52. package/lib/oxide/cli/help/index.js +72 -0
  53. package/lib/oxide/cli/index.js +214 -0
  54. package/lib/oxide/cli/init/index.js +52 -0
  55. package/lib/oxide/cli.js +5 -0
  56. package/lib/oxide/postcss-plugin.js +2 -0
  57. package/lib/plugin.js +98 -0
  58. package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
  59. package/lib/postcss-plugins/nesting/index.js +21 -0
  60. package/lib/postcss-plugins/nesting/plugin.js +89 -0
  61. package/lib/processTailwindFeatures.js +39 -26
  62. package/lib/public/colors.js +272 -246
  63. package/lib/public/create-plugin.js +9 -5
  64. package/lib/public/default-config.js +10 -6
  65. package/lib/public/default-theme.js +10 -6
  66. package/lib/public/load-config.js +12 -0
  67. package/lib/public/resolve-config.js +11 -6
  68. package/lib/util/applyImportantSelector.js +36 -0
  69. package/lib/util/bigSign.js +6 -1
  70. package/lib/util/buildMediaQuery.js +13 -6
  71. package/lib/util/cloneDeep.js +9 -6
  72. package/lib/util/cloneNodes.js +23 -3
  73. package/lib/util/color.js +70 -38
  74. package/lib/util/colorNames.js +752 -0
  75. package/lib/util/configurePlugins.js +7 -2
  76. package/lib/util/createPlugin.js +8 -6
  77. package/lib/util/createUtilityPlugin.js +16 -16
  78. package/lib/util/dataTypes.js +173 -108
  79. package/lib/util/defaults.js +14 -3
  80. package/lib/util/escapeClassName.js +13 -8
  81. package/lib/util/escapeCommas.js +7 -2
  82. package/lib/util/flattenColorPalette.js +11 -12
  83. package/lib/util/formatVariantSelector.js +228 -151
  84. package/lib/util/getAllConfigs.js +33 -12
  85. package/lib/util/hashConfig.js +9 -4
  86. package/lib/util/isKeyframeRule.js +7 -2
  87. package/lib/util/isPlainObject.js +7 -2
  88. package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +25 -15
  89. package/lib/util/log.js +27 -13
  90. package/lib/util/nameClass.js +27 -10
  91. package/lib/util/negateValue.js +25 -8
  92. package/lib/util/normalizeConfig.js +139 -65
  93. package/lib/util/normalizeScreens.js +131 -11
  94. package/lib/util/parseAnimationValue.js +44 -40
  95. package/lib/util/parseBoxShadowValue.js +34 -23
  96. package/lib/util/parseDependency.js +39 -55
  97. package/lib/util/parseGlob.js +36 -0
  98. package/lib/util/parseObjectStyles.js +15 -10
  99. package/lib/util/pluginUtils.js +159 -69
  100. package/lib/util/prefixSelector.js +30 -12
  101. package/lib/util/pseudoElements.js +229 -0
  102. package/lib/util/removeAlphaVariables.js +31 -0
  103. package/lib/util/resolveConfig.js +97 -75
  104. package/lib/util/resolveConfigPath.js +30 -12
  105. package/lib/util/responsive.js +11 -6
  106. package/lib/util/splitAtTopLevelOnly.js +51 -0
  107. package/lib/util/tap.js +6 -1
  108. package/lib/util/toColorValue.js +7 -3
  109. package/lib/util/toPath.js +26 -3
  110. package/lib/util/transformThemeValue.js +40 -30
  111. package/lib/util/validateConfig.js +37 -0
  112. package/lib/util/validateFormalSyntax.js +26 -0
  113. package/lib/util/withAlphaVariable.js +27 -15
  114. package/loadConfig.d.ts +4 -0
  115. package/loadConfig.js +2 -0
  116. package/nesting/index.js +2 -12
  117. package/package.json +66 -57
  118. package/peers/index.js +75964 -55560
  119. package/plugin.d.ts +11 -0
  120. package/plugin.js +2 -1
  121. package/resolveConfig.d.ts +12 -0
  122. package/resolveConfig.js +2 -1
  123. package/scripts/generate-types.js +105 -0
  124. package/scripts/release-channel.js +18 -0
  125. package/scripts/release-notes.js +21 -0
  126. package/scripts/swap-engines.js +40 -0
  127. package/scripts/type-utils.js +27 -0
  128. package/src/cli/build/deps.js +56 -0
  129. package/src/cli/build/index.js +49 -0
  130. package/src/cli/build/plugin.js +444 -0
  131. package/src/cli/build/utils.js +76 -0
  132. package/src/cli/build/watching.js +229 -0
  133. package/src/cli/help/index.js +70 -0
  134. package/src/cli/index.js +216 -0
  135. package/src/cli/init/index.js +79 -0
  136. package/src/cli-peer-dependencies.js +7 -1
  137. package/src/cli.js +4 -765
  138. package/src/corePluginList.js +1 -1
  139. package/src/corePlugins.js +786 -306
  140. package/src/css/preflight.css +10 -8
  141. package/src/featureFlags.js +21 -5
  142. package/src/index.js +1 -34
  143. package/src/lib/cacheInvalidation.js +52 -0
  144. package/src/lib/collapseAdjacentRules.js +21 -2
  145. package/src/lib/collapseDuplicateDeclarations.js +66 -1
  146. package/src/lib/content.js +208 -0
  147. package/src/lib/defaultExtractor.js +217 -0
  148. package/src/lib/detectNesting.js +9 -1
  149. package/src/lib/evaluateTailwindFunctions.js +79 -8
  150. package/src/lib/expandApplyAtRules.js +515 -153
  151. package/src/lib/expandTailwindAtRules.js +115 -86
  152. package/src/lib/findAtConfigPath.js +48 -0
  153. package/src/lib/generateRules.js +545 -147
  154. package/src/lib/getModuleDependencies.js +70 -30
  155. package/src/lib/load-config.ts +31 -0
  156. package/src/lib/normalizeTailwindDirectives.js +7 -1
  157. package/src/lib/offsets.js +373 -0
  158. package/src/lib/partitionApplyAtRules.js +52 -0
  159. package/src/lib/regex.js +74 -0
  160. package/src/lib/remap-bitfield.js +82 -0
  161. package/src/lib/resolveDefaultsAtRules.js +59 -17
  162. package/src/lib/setupContextUtils.js +701 -175
  163. package/src/lib/setupTrackingContext.js +51 -62
  164. package/src/lib/sharedState.js +58 -7
  165. package/src/oxide/cli/build/deps.ts +91 -0
  166. package/src/oxide/cli/build/index.ts +47 -0
  167. package/src/oxide/cli/build/plugin.ts +442 -0
  168. package/src/oxide/cli/build/utils.ts +74 -0
  169. package/src/oxide/cli/build/watching.ts +225 -0
  170. package/src/oxide/cli/help/index.ts +69 -0
  171. package/src/oxide/cli/index.ts +204 -0
  172. package/src/oxide/cli/init/index.ts +59 -0
  173. package/src/oxide/cli.ts +1 -0
  174. package/src/oxide/postcss-plugin.ts +1 -0
  175. package/src/plugin.js +107 -0
  176. package/src/postcss-plugins/nesting/README.md +42 -0
  177. package/src/postcss-plugins/nesting/index.js +13 -0
  178. package/src/postcss-plugins/nesting/plugin.js +80 -0
  179. package/src/processTailwindFeatures.js +12 -2
  180. package/src/public/colors.js +22 -0
  181. package/src/public/default-config.js +1 -1
  182. package/src/public/default-theme.js +2 -2
  183. package/src/public/load-config.js +2 -0
  184. package/src/util/applyImportantSelector.js +27 -0
  185. package/src/util/buildMediaQuery.js +5 -3
  186. package/src/util/cloneNodes.js +19 -2
  187. package/src/util/color.js +44 -12
  188. package/src/util/colorNames.js +150 -0
  189. package/src/util/dataTypes.js +51 -16
  190. package/src/util/defaults.js +6 -0
  191. package/src/util/formatVariantSelector.js +264 -144
  192. package/src/util/getAllConfigs.js +21 -2
  193. package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
  194. package/src/util/log.js +11 -7
  195. package/src/util/nameClass.js +4 -0
  196. package/src/util/negateValue.js +11 -3
  197. package/src/util/normalizeConfig.js +57 -5
  198. package/src/util/normalizeScreens.js +105 -7
  199. package/src/util/parseBoxShadowValue.js +4 -3
  200. package/src/util/parseDependency.js +37 -42
  201. package/src/util/parseGlob.js +24 -0
  202. package/src/util/pluginUtils.js +123 -24
  203. package/src/util/prefixSelector.js +30 -10
  204. package/src/util/pseudoElements.js +170 -0
  205. package/src/util/removeAlphaVariables.js +24 -0
  206. package/src/util/resolveConfig.js +74 -26
  207. package/src/util/resolveConfigPath.js +12 -1
  208. package/src/util/splitAtTopLevelOnly.js +52 -0
  209. package/src/util/toPath.js +23 -1
  210. package/src/util/transformThemeValue.js +13 -3
  211. package/src/util/validateConfig.js +26 -0
  212. package/src/util/validateFormalSyntax.js +34 -0
  213. package/src/util/withAlphaVariable.js +1 -1
  214. package/stubs/.gitignore +1 -0
  215. package/stubs/.prettierrc.json +6 -0
  216. package/stubs/{defaultConfig.stub.js → config.full.js} +206 -166
  217. package/stubs/postcss.config.js +6 -0
  218. package/stubs/tailwind.config.cjs +2 -0
  219. package/stubs/tailwind.config.js +2 -0
  220. package/stubs/tailwind.config.ts +3 -0
  221. package/types/config.d.ts +368 -0
  222. package/types/generated/.gitkeep +0 -0
  223. package/types/generated/colors.d.ts +298 -0
  224. package/types/generated/corePluginList.d.ts +1 -0
  225. package/types/generated/default-theme.d.ts +371 -0
  226. package/types/index.d.ts +7 -0
  227. package/CHANGELOG.md +0 -1843
  228. package/lib/constants.js +0 -37
  229. package/lib/lib/setupWatchingContext.js +0 -288
  230. package/nesting/plugin.js +0 -41
  231. package/scripts/install-integrations.js +0 -27
  232. package/scripts/rebuildFixtures.js +0 -68
  233. package/src/constants.js +0 -17
  234. package/src/lib/setupWatchingContext.js +0 -311
  235. /package/stubs/{simpleConfig.stub.js → config.simple.js} +0 -0
  236. /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
@@ -1,14 +1,61 @@
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";
2
26
  Object.defineProperty(exports, "__esModule", {
3
27
  value: true
4
28
  });
5
- exports.normalizeScreens = normalizeScreens;
6
- function normalizeScreens(screens) {
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) {
7
50
  if (Array.isArray(screens)) {
8
51
  return screens.map((screen)=>{
9
- if (typeof screen === 'string') {
52
+ if (root && Array.isArray(screen)) {
53
+ throw new Error("The tuple syntax is not supported for `screens`.");
54
+ }
55
+ if (typeof screen === "string") {
10
56
  return {
11
57
  name: screen.toString(),
58
+ not: false,
12
59
  values: [
13
60
  {
14
61
  min: screen,
@@ -19,9 +66,10 @@ function normalizeScreens(screens) {
19
66
  }
20
67
  let [name, options] = screen;
21
68
  name = name.toString();
22
- if (typeof options === 'string') {
69
+ if (typeof options === "string") {
23
70
  return {
24
71
  name,
72
+ not: false,
25
73
  values: [
26
74
  {
27
75
  min: options,
@@ -33,23 +81,95 @@ function normalizeScreens(screens) {
33
81
  if (Array.isArray(options)) {
34
82
  return {
35
83
  name,
36
- values: options.map((option)=>resolveValue(option)
37
- )
84
+ not: false,
85
+ values: options.map((option)=>resolveValue(option))
38
86
  };
39
87
  }
40
88
  return {
41
89
  name,
90
+ not: false,
42
91
  values: [
43
92
  resolveValue(options)
44
93
  ]
45
94
  };
46
95
  });
47
96
  }
48
- return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {
49
- }));
97
+ return normalizeScreens(Object.entries(screens !== null && screens !== void 0 ? screens : {}), false);
98
+ }
99
+ function isScreenSortable(screen) {
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,
118
+ reason: null
119
+ };
120
+ }
121
+ function compareScreens(type, a, z) {
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] = [
139
+ aMax,
140
+ aMin
141
+ ];
142
+ if (z.not) [zMin, zMax] = [
143
+ zMax,
144
+ zMin
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" ? [
151
+ aMin,
152
+ zMin
153
+ ] : [
154
+ zMax,
155
+ aMax
156
+ ];
157
+ return aValue - zValue;
158
+ }
159
+ function toScreen(value, type) {
160
+ if (typeof value === "object") {
161
+ return value;
162
+ }
163
+ return {
164
+ name: "arbitrary-screen",
165
+ values: [
166
+ {
167
+ [type]: value
168
+ }
169
+ ]
170
+ };
50
171
  }
51
- function resolveValue({ 'min-width': _minWidth , min =_minWidth , max , raw } = {
52
- }) {
172
+ function resolveValue({ "min-width": _minWidth , min =_minWidth , max , raw } = {}) {
53
173
  return {
54
174
  min,
55
175
  max,
@@ -2,38 +2,43 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.default = parseAnimationValue;
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return parseAnimationValue;
9
+ }
10
+ });
6
11
  const DIRECTIONS = new Set([
7
- 'normal',
8
- 'reverse',
9
- 'alternate',
10
- 'alternate-reverse'
12
+ "normal",
13
+ "reverse",
14
+ "alternate",
15
+ "alternate-reverse"
11
16
  ]);
12
17
  const PLAY_STATES = new Set([
13
- 'running',
14
- 'paused'
18
+ "running",
19
+ "paused"
15
20
  ]);
16
21
  const FILL_MODES = new Set([
17
- 'none',
18
- 'forwards',
19
- 'backwards',
20
- 'both'
22
+ "none",
23
+ "forwards",
24
+ "backwards",
25
+ "both"
21
26
  ]);
22
27
  const ITERATION_COUNTS = new Set([
23
- 'infinite'
28
+ "infinite"
24
29
  ]);
25
30
  const TIMINGS = new Set([
26
- 'linear',
27
- 'ease',
28
- 'ease-in',
29
- 'ease-out',
30
- 'ease-in-out',
31
- 'step-start',
32
- 'step-end',
31
+ "linear",
32
+ "ease",
33
+ "ease-in",
34
+ "ease-out",
35
+ "ease-in-out",
36
+ "step-start",
37
+ "step-end"
33
38
  ]);
34
39
  const TIMING_FNS = [
35
- 'cubic-bezier',
36
- 'steps'
40
+ "cubic-bezier",
41
+ "steps"
37
42
  ];
38
43
  const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
39
44
  ;
@@ -51,34 +56,33 @@ function parseAnimationValue(input) {
51
56
  let parts = value.split(SPACE);
52
57
  let seen = new Set();
53
58
  for (let part of parts){
54
- if (!seen.has('DIRECTIONS') && DIRECTIONS.has(part)) {
59
+ if (!seen.has("DIRECTIONS") && DIRECTIONS.has(part)) {
55
60
  result.direction = part;
56
- seen.add('DIRECTIONS');
57
- } else if (!seen.has('PLAY_STATES') && PLAY_STATES.has(part)) {
61
+ seen.add("DIRECTIONS");
62
+ } else if (!seen.has("PLAY_STATES") && PLAY_STATES.has(part)) {
58
63
  result.playState = part;
59
- seen.add('PLAY_STATES');
60
- } else if (!seen.has('FILL_MODES') && FILL_MODES.has(part)) {
64
+ seen.add("PLAY_STATES");
65
+ } else if (!seen.has("FILL_MODES") && FILL_MODES.has(part)) {
61
66
  result.fillMode = part;
62
- seen.add('FILL_MODES');
63
- } else if (!seen.has('ITERATION_COUNTS') && (ITERATION_COUNTS.has(part) || DIGIT.test(part))) {
67
+ seen.add("FILL_MODES");
68
+ } else if (!seen.has("ITERATION_COUNTS") && (ITERATION_COUNTS.has(part) || DIGIT.test(part))) {
64
69
  result.iterationCount = part;
65
- seen.add('ITERATION_COUNTS');
66
- } else if (!seen.has('TIMING_FUNCTION') && TIMINGS.has(part)) {
70
+ seen.add("ITERATION_COUNTS");
71
+ } else if (!seen.has("TIMING_FUNCTION") && TIMINGS.has(part)) {
67
72
  result.timingFunction = part;
68
- seen.add('TIMING_FUNCTION');
69
- } else if (!seen.has('TIMING_FUNCTION') && TIMING_FNS.some((f)=>part.startsWith(`${f}(`)
70
- )) {
73
+ seen.add("TIMING_FUNCTION");
74
+ } else if (!seen.has("TIMING_FUNCTION") && TIMING_FNS.some((f)=>part.startsWith(`${f}(`))) {
71
75
  result.timingFunction = part;
72
- seen.add('TIMING_FUNCTION');
73
- } else if (!seen.has('DURATION') && TIME.test(part)) {
76
+ seen.add("TIMING_FUNCTION");
77
+ } else if (!seen.has("DURATION") && TIME.test(part)) {
74
78
  result.duration = part;
75
- seen.add('DURATION');
76
- } else if (!seen.has('DELAY') && TIME.test(part)) {
79
+ seen.add("DURATION");
80
+ } else if (!seen.has("DELAY") && TIME.test(part)) {
77
81
  result.delay = part;
78
- seen.add('DELAY');
79
- } else if (!seen.has('NAME')) {
82
+ seen.add("DELAY");
83
+ } else if (!seen.has("NAME")) {
80
84
  result.name = part;
81
- seen.add('NAME');
85
+ seen.add("NAME");
82
86
  } else {
83
87
  if (!result.unknown) result.unknown = [];
84
88
  result.unknown.push(part);
@@ -2,22 +2,33 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.parseBoxShadowValue = parseBoxShadowValue;
6
- exports.formatBoxShadowValue = formatBoxShadowValue;
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ parseBoxShadowValue: function() {
13
+ return parseBoxShadowValue;
14
+ },
15
+ formatBoxShadowValue: function() {
16
+ return formatBoxShadowValue;
17
+ }
18
+ });
19
+ const _splitAtTopLevelOnly = require("./splitAtTopLevelOnly");
7
20
  let KEYWORDS = new Set([
8
- 'inset',
9
- 'inherit',
10
- 'initial',
11
- 'revert',
12
- 'unset'
21
+ "inset",
22
+ "inherit",
23
+ "initial",
24
+ "revert",
25
+ "unset"
13
26
  ]);
14
- let COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
15
- ;
16
27
  let SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
17
28
  ;
18
- let LENGTH = /^-?(\d+)(.*?)$/g;
29
+ let LENGTH = /^-?(\d+|\.\d+)(.*?)$/g;
19
30
  function parseBoxShadowValue(input) {
20
- let shadows = input.split(COMMA);
31
+ let shadows = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(input, ",");
21
32
  return shadows.map((shadow)=>{
22
33
  let value = shadow.trim();
23
34
  let result = {
@@ -29,22 +40,22 @@ function parseBoxShadowValue(input) {
29
40
  // Reset index, since the regex is stateful.
30
41
  LENGTH.lastIndex = 0;
31
42
  // Keyword
32
- if (!seen.has('KEYWORD') && KEYWORDS.has(part)) {
43
+ if (!seen.has("KEYWORD") && KEYWORDS.has(part)) {
33
44
  result.keyword = part;
34
- seen.add('KEYWORD');
45
+ seen.add("KEYWORD");
35
46
  } else if (LENGTH.test(part)) {
36
- if (!seen.has('X')) {
47
+ if (!seen.has("X")) {
37
48
  result.x = part;
38
- seen.add('X');
39
- } else if (!seen.has('Y')) {
49
+ seen.add("X");
50
+ } else if (!seen.has("Y")) {
40
51
  result.y = part;
41
- seen.add('Y');
42
- } else if (!seen.has('BLUR')) {
52
+ seen.add("Y");
53
+ } else if (!seen.has("BLUR")) {
43
54
  result.blur = part;
44
- seen.add('BLUR');
45
- } else if (!seen.has('SPREAD')) {
55
+ seen.add("BLUR");
56
+ } else if (!seen.has("SPREAD")) {
46
57
  result.spread = part;
47
- seen.add('SPREAD');
58
+ seen.add("SPREAD");
48
59
  }
49
60
  } else {
50
61
  if (!result.color) {
@@ -72,6 +83,6 @@ function formatBoxShadowValue(shadows) {
72
83
  shadow.blur,
73
84
  shadow.spread,
74
85
  shadow.color
75
- ].filter(Boolean).join(' ');
76
- }).join(', ');
86
+ ].filter(Boolean).join(" ");
87
+ }).join(", ");
77
88
  }
@@ -1,63 +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";
2
9
  Object.defineProperty(exports, "__esModule", {
3
10
  value: true
4
11
  });
5
- exports.default = parseDependency;
6
- var _isGlob = _interopRequireDefault(require("is-glob"));
7
- var _globParent = _interopRequireDefault(require("glob-parent"));
8
- var _path = _interopRequireDefault(require("path"));
9
- function _interopRequireDefault(obj) {
10
- return obj && obj.__esModule ? obj : {
11
- default: obj
12
- };
13
- }
14
- // Based on `glob-base`
15
- // https://github.com/micromatch/glob-base/blob/master/index.js
16
- function parseGlob(pattern) {
17
- let glob = pattern;
18
- let base = (0, _globParent).default(pattern);
19
- if (base !== '.') {
20
- glob = pattern.substr(base.length);
21
- if (glob.charAt(0) === '/') {
22
- glob = glob.substr(1);
23
- }
24
- }
25
- if (glob.substr(0, 2) === './') {
26
- glob = glob.substr(2);
27
- }
28
- if (glob.charAt(0) === '/') {
29
- glob = glob.substr(1);
12
+ Object.defineProperty(exports, "default", {
13
+ enumerable: true,
14
+ get: function() {
15
+ return parseDependency;
30
16
  }
31
- return {
32
- base,
33
- glob
34
- };
35
- }
36
- function parseDependency(normalizedFileOrGlob) {
37
- if (normalizedFileOrGlob.startsWith('!')) {
38
- return null;
17
+ });
18
+ function parseDependency(contentPath) {
19
+ if (contentPath.ignore) {
20
+ return [];
39
21
  }
40
- let message;
41
- if ((0, _isGlob).default(normalizedFileOrGlob)) {
42
- let { base , glob } = parseGlob(normalizedFileOrGlob);
43
- message = {
44
- type: 'dir-dependency',
45
- dir: _path.default.resolve(base),
46
- glob
47
- };
48
- } else {
49
- message = {
50
- type: 'dependency',
51
- file: _path.default.resolve(normalizedFileOrGlob)
52
- };
22
+ if (!contentPath.glob) {
23
+ return [
24
+ {
25
+ type: "dependency",
26
+ file: contentPath.base
27
+ }
28
+ ];
53
29
  }
54
- // rollup-plugin-postcss does not support dir-dependency messages
55
- // but directories can be watched in the same way as files
56
- if (message.type === 'dir-dependency' && process.env.ROLLUP_WATCH === 'true') {
57
- message = {
58
- type: 'dependency',
59
- file: message.dir
60
- };
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
+ ];
61
39
  }
62
- return message;
40
+ return [
41
+ {
42
+ type: "dir-dependency",
43
+ dir: contentPath.base,
44
+ glob: contentPath.glob
45
+ }
46
+ ];
63
47
  }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
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) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
17
+ function parseGlob(pattern) {
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 {
33
+ base,
34
+ glob
35
+ };
36
+ }
@@ -2,11 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.default = parseObjectStyles;
6
- var _postcss = _interopRequireDefault(require("postcss"));
7
- var _postcssNested = _interopRequireDefault(require("postcss-nested"));
8
- var _postcssJs = _interopRequireDefault(require("postcss-js"));
9
- 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) {
10
15
  return obj && obj.__esModule ? obj : {
11
16
  default: obj
12
17
  };
@@ -18,14 +23,14 @@ function parseObjectStyles(styles) {
18
23
  ]);
19
24
  }
20
25
  return styles.flatMap((style)=>{
21
- return (0, _postcss).default([
22
- (0, _postcssNested).default({
26
+ return (0, _postcss.default)([
27
+ (0, _postcssnested.default)({
23
28
  bubble: [
24
- 'screen'
29
+ "screen"
25
30
  ]
26
- }),
31
+ })
27
32
  ]).process(style, {
28
- parser: _postcssJs.default
33
+ parser: _postcssjs.default
29
34
  }).root.nodes;
30
35
  });
31
36
  }