weapp-tailwindcss 4.12.0 → 5.0.0-next.2

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 (313) hide show
  1. package/dist/babel/index.d.ts +3 -0
  2. package/dist/bundlers/gulp/index.d.ts +7 -0
  3. package/dist/bundlers/shared/cache.d.ts +16 -0
  4. package/dist/bundlers/shared/css-cleanup.d.ts +4 -0
  5. package/dist/bundlers/shared/css-imports.d.ts +8 -0
  6. package/dist/bundlers/shared/generator-candidates.d.ts +5 -0
  7. package/dist/bundlers/shared/generator-css.d.ts +43 -0
  8. package/dist/bundlers/shared/module-graph.d.ts +5 -0
  9. package/dist/bundlers/shared/run-tasks.d.ts +2 -0
  10. package/dist/bundlers/vite/bundle-entries.d.ts +14 -0
  11. package/dist/bundlers/vite/bundle-state.d.ts +43 -0
  12. package/dist/bundlers/vite/css-finalizer.d.ts +22 -0
  13. package/dist/bundlers/vite/generate-bundle.d.ts +33 -0
  14. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +21 -0
  15. package/dist/bundlers/vite/index.d.ts +3 -0
  16. package/dist/bundlers/vite/js-precheck.d.ts +1 -0
  17. package/dist/bundlers/vite/query.d.ts +15 -0
  18. package/dist/bundlers/vite/resolve-app-type.d.ts +2 -0
  19. package/dist/bundlers/vite/rewrite-css-imports.d.ts +11 -0
  20. package/dist/bundlers/vite/runtime-affecting-signature.d.ts +2 -0
  21. package/dist/bundlers/vite/source-candidates.d.ts +15 -0
  22. package/dist/bundlers/vite/utils.d.ts +9 -0
  23. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +20 -0
  24. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +14 -0
  25. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +15 -0
  26. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +9 -0
  27. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +17 -0
  28. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +19 -0
  29. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +9 -0
  30. package/dist/bundlers/webpack/index.d.ts +1 -0
  31. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +12 -0
  32. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +11 -0
  33. package/dist/bundlers/webpack/shared/css-imports.d.ts +6 -0
  34. package/dist/bundlers/webpack/shared/loader-anchors.d.ts +8 -0
  35. package/dist/cache/index.d.ts +38 -0
  36. package/dist/cache/md5.d.ts +1 -0
  37. package/dist/chunk-8l464Juk.js +28 -0
  38. package/dist/cli/config.d.ts +5 -0
  39. package/dist/cli/context.d.ts +16 -0
  40. package/dist/cli/doctor/constants.d.ts +7 -0
  41. package/dist/cli/doctor/types.d.ts +31 -0
  42. package/dist/cli/doctor.d.ts +4 -0
  43. package/dist/cli/helpers/options/format.d.ts +2 -0
  44. package/dist/cli/helpers/options/parse.d.ts +3 -0
  45. package/dist/cli/helpers/options/resolve.d.ts +1 -0
  46. package/dist/cli/helpers/options.d.ts +3 -0
  47. package/dist/cli/helpers/patch-cwd.d.ts +1 -0
  48. package/dist/cli/helpers.d.ts +5 -0
  49. package/dist/cli/mount-options/patch-status.d.ts +2 -0
  50. package/dist/cli/mount-options.d.ts +2 -0
  51. package/dist/cli/patch-options.d.ts +6 -0
  52. package/dist/cli/tokens.d.ts +4 -0
  53. package/dist/cli/types.d.ts +17 -0
  54. package/dist/cli/vscode-entry.d.ts +14 -0
  55. package/dist/cli/workspace/package-dirs.d.ts +3 -0
  56. package/dist/cli/workspace/patch-package.d.ts +3 -0
  57. package/dist/cli/workspace/patch-utils.d.ts +3 -0
  58. package/dist/cli/workspace/types.d.ts +11 -0
  59. package/dist/cli/workspace/workspace-globs.d.ts +2 -0
  60. package/dist/cli/workspace/workspace-io.d.ts +1 -0
  61. package/dist/cli/workspace/workspace-lock.d.ts +1 -0
  62. package/dist/cli/workspace.d.ts +2 -0
  63. package/dist/cli.d.ts +1 -2
  64. package/dist/cli.js +2425 -3524
  65. package/dist/cli.mjs +2402 -3505
  66. package/dist/constants-B-_T5UnW.mjs +44 -0
  67. package/dist/constants-p1dyh1x1.js +73 -0
  68. package/dist/constants.d.ts +13 -0
  69. package/dist/context/compiler-context-cache.d.ts +3 -0
  70. package/dist/context/custom-attributes.d.ts +2 -0
  71. package/dist/context/handlers.d.ts +6 -0
  72. package/dist/context/index.d.ts +7 -0
  73. package/dist/context/logger.d.ts +4 -0
  74. package/dist/context/tailwindcss/basedir.d.ts +1 -0
  75. package/dist/context/tailwindcss/rax.d.ts +2 -0
  76. package/dist/context/tailwindcss.d.ts +4 -0
  77. package/dist/context/workspace.d.ts +3 -0
  78. package/dist/core.d.ts +5 -21
  79. package/dist/core.js +138 -180
  80. package/dist/core.mjs +135 -180
  81. package/dist/css-imports-BbrbluP9.js +177 -0
  82. package/dist/css-imports-CSdPq_Sc.mjs +128 -0
  83. package/dist/css-macro/constants.d.ts +14 -0
  84. package/dist/css-macro/index.d.ts +15 -0
  85. package/dist/css-macro/postcss.d.ts +3 -7
  86. package/dist/css-macro/postcss.js +44 -58
  87. package/dist/css-macro/postcss.mjs +44 -56
  88. package/dist/css-macro.d.ts +1 -20
  89. package/dist/css-macro.js +37 -50
  90. package/dist/css-macro.mjs +33 -47
  91. package/dist/debug/index.d.ts +5 -0
  92. package/dist/defaults.d.ts +2 -11
  93. package/dist/defaults.js +132 -8
  94. package/dist/defaults.mjs +128 -7
  95. package/dist/escape.js +31 -54
  96. package/dist/escape.mjs +18 -25
  97. package/dist/experimental/index.d.ts +2 -0
  98. package/dist/experimental/oxc/ast-utils.d.ts +30 -0
  99. package/dist/experimental/oxc/index.d.ts +2 -0
  100. package/dist/experimental/oxc/module-specifiers.d.ts +2 -0
  101. package/dist/experimental/shared/cache.d.ts +3 -0
  102. package/dist/experimental/shared/transform.d.ts +3 -0
  103. package/dist/experimental/shared.d.ts +8 -0
  104. package/dist/experimental/swc/ast-utils.d.ts +30 -0
  105. package/dist/experimental/swc/index.d.ts +2 -0
  106. package/dist/experimental/swc/module-specifiers.d.ts +2 -0
  107. package/dist/generator/index.d.ts +11 -0
  108. package/dist/generator/options.d.ts +17 -0
  109. package/dist/generator/types.d.ts +20 -0
  110. package/dist/generator-Y-Ikv4Fu.mjs +1177 -0
  111. package/dist/generator-css-B5ejWUMv.mjs +1098 -0
  112. package/dist/generator-css-D3OdPRiS.js +1125 -0
  113. package/dist/generator-mmhXzZnv.js +1276 -0
  114. package/dist/generator.d.ts +1 -0
  115. package/dist/generator.js +19 -0
  116. package/dist/generator.mjs +2 -0
  117. package/dist/gulp.d.ts +4 -24
  118. package/dist/gulp.js +271 -13
  119. package/dist/gulp.mjs +263 -13
  120. package/dist/index.d.ts +8 -15
  121. package/dist/index.js +12 -24
  122. package/dist/index.mjs +6 -24
  123. package/dist/js/JsTokenUpdater.d.ts +14 -0
  124. package/dist/js/ModuleGraph.d.ts +18 -0
  125. package/dist/js/NodePathWalker.d.ts +33 -0
  126. package/dist/js/babel/parse.d.ts +9 -0
  127. package/dist/js/babel/process.d.ts +4 -0
  128. package/dist/js/babel.d.ts +13 -0
  129. package/dist/js/class-context.d.ts +3 -0
  130. package/dist/js/evalTransforms.d.ts +7 -0
  131. package/dist/js/handlers.d.ts +5 -0
  132. package/dist/js/index.d.ts +4 -0
  133. package/dist/js/module-graph/ignored-exports.d.ts +18 -0
  134. package/dist/js/module-graph/types.d.ts +17 -0
  135. package/dist/js/node-path-walker/export-handlers.d.ts +12 -0
  136. package/dist/js/node-path-walker/import-tokens.d.ts +24 -0
  137. package/dist/js/precheck.d.ts +2 -0
  138. package/dist/js/sourceAnalysis.d.ts +17 -0
  139. package/dist/js/syntax.d.ts +10 -0
  140. package/dist/js/taggedTemplateIgnore.d.ts +13 -0
  141. package/dist/js/types.d.ts +11 -0
  142. package/dist/lightningcss/index.d.ts +8 -0
  143. package/dist/lightningcss/style-handler/options.d.ts +3 -0
  144. package/dist/lightningcss/style-handler/selector-transform.d.ts +10 -0
  145. package/dist/lightningcss/style-handler/selector-utils.d.ts +10 -0
  146. package/dist/lightningcss/style-handler.d.ts +17 -0
  147. package/dist/loader-anchors-CNkWT8hx.js +273 -0
  148. package/dist/loader-anchors-TrU7EUr7.mjs +205 -0
  149. package/dist/logger/index.d.ts +2 -0
  150. package/dist/logger-BZ45DZJT.js +1003 -0
  151. package/dist/logger-BoVx1Dbt.mjs +935 -0
  152. package/dist/patcher-options-6gJN2EXy.js +115 -0
  153. package/dist/patcher-options-DQfR5xxT.mjs +92 -0
  154. package/dist/postcss-html-transform.d.ts +3 -3
  155. package/dist/postcss-html-transform.js +7 -10
  156. package/dist/postcss-html-transform.mjs +3 -6
  157. package/dist/postcss.d.ts +15 -0
  158. package/dist/postcss.js +280 -0
  159. package/dist/postcss.mjs +270 -0
  160. package/dist/presets/hbuilderx.d.ts +4 -0
  161. package/dist/presets/index.d.ts +3 -0
  162. package/dist/presets/shared.d.ts +10 -0
  163. package/dist/presets/taro.d.ts +4 -0
  164. package/dist/presets/uni-app-x.d.ts +16 -0
  165. package/dist/presets/uni-app.d.ts +4 -0
  166. package/dist/presets.d.ts +1 -76
  167. package/dist/presets.js +115 -163
  168. package/dist/presets.mjs +107 -163
  169. package/dist/recorder-gYSNLfOP.js +2878 -0
  170. package/dist/recorder-zsgatmkB.mjs +2763 -0
  171. package/dist/reset/index.d.ts +2 -0
  172. package/dist/reset.d.ts +1 -4
  173. package/dist/reset.js +19 -8
  174. package/dist/reset.mjs +2 -8
  175. package/dist/shared/classname-transform.d.ts +14 -0
  176. package/dist/shared/mpx.d.ts +7 -0
  177. package/dist/shared/tailwindcss-css-redirect.d.ts +1 -0
  178. package/dist/tailwindcss/index.d.ts +11 -0
  179. package/dist/tailwindcss/miniprogram.d.ts +1 -0
  180. package/dist/tailwindcss/patcher-options.d.ts +56 -0
  181. package/dist/tailwindcss/patcher-resolve.d.ts +4 -0
  182. package/dist/tailwindcss/patcher.d.ts +13 -0
  183. package/dist/tailwindcss/recorder.d.ts +13 -0
  184. package/dist/tailwindcss/remove-unsupported-css.d.ts +2 -0
  185. package/dist/tailwindcss/runtime/cache.d.ts +11 -0
  186. package/dist/tailwindcss/runtime-logs.d.ts +3 -0
  187. package/dist/tailwindcss/runtime.d.ts +29 -0
  188. package/dist/tailwindcss/targets/paths.d.ts +13 -0
  189. package/dist/tailwindcss/targets/record-io.d.ts +5 -0
  190. package/dist/tailwindcss/targets/recorder.d.ts +3 -0
  191. package/dist/tailwindcss/targets/types.d.ts +35 -0
  192. package/dist/tailwindcss/targets.d.ts +6 -0
  193. package/dist/tailwindcss/v3-engine/generator.d.ts +2 -0
  194. package/dist/tailwindcss/v3-engine/index.d.ts +4 -0
  195. package/dist/tailwindcss/v3-engine/miniprogram.d.ts +4 -0
  196. package/dist/tailwindcss/v3-engine/source.d.ts +5 -0
  197. package/dist/tailwindcss/v3-engine/types.d.ts +55 -0
  198. package/dist/tailwindcss/v4/config.d.ts +5 -0
  199. package/dist/tailwindcss/v4/css-entries.d.ts +7 -0
  200. package/dist/tailwindcss/v4/index.d.ts +2 -0
  201. package/dist/tailwindcss/v4/multi-patcher.d.ts +2 -0
  202. package/dist/tailwindcss/v4/patcher-options.d.ts +24 -0
  203. package/dist/tailwindcss/v4/patcher.d.ts +14 -0
  204. package/dist/tailwindcss/v4-engine/candidates.d.ts +2 -0
  205. package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -0
  206. package/dist/tailwindcss/v4-engine/generator.d.ts +2 -0
  207. package/dist/tailwindcss/v4-engine/index.d.ts +5 -0
  208. package/dist/tailwindcss/v4-engine/miniprogram.d.ts +5 -0
  209. package/dist/tailwindcss/v4-engine/source.d.ts +7 -0
  210. package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +1 -0
  211. package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +1 -0
  212. package/dist/tailwindcss/v4-engine/tailwind-v4-default-colors.d.ts +1 -0
  213. package/dist/tailwindcss/v4-engine/types.d.ts +19 -0
  214. package/dist/typedoc.export.d.ts +5 -0
  215. package/dist/types/base.d.ts +1 -0
  216. package/dist/types/disabled-options.d.ts +4 -0
  217. package/dist/types/index.d.ts +104 -0
  218. package/dist/types/shared.d.ts +7 -0
  219. package/dist/types/user-defined-options/general.d.ts +31 -0
  220. package/dist/types/user-defined-options/important.d.ts +37 -0
  221. package/dist/types/user-defined-options/index.d.ts +11 -0
  222. package/dist/types/user-defined-options/lifecycle.d.ts +6 -0
  223. package/dist/types/user-defined-options/matcher.d.ts +9 -0
  224. package/dist/types.d.ts +1 -150
  225. package/dist/types.js +0 -1
  226. package/dist/types.mjs +1 -1
  227. package/dist/uni-app-x/component-local-style.d.ts +19 -0
  228. package/dist/uni-app-x/index.d.ts +2 -0
  229. package/dist/uni-app-x/options.d.ts +12 -0
  230. package/dist/uni-app-x/style-isolation.d.ts +2 -0
  231. package/dist/uni-app-x/transform.d.ts +9 -0
  232. package/dist/uni-app-x/vite.d.ts +36 -0
  233. package/dist/utils/decode.d.ts +2 -0
  234. package/dist/utils/disabled.d.ts +6 -0
  235. package/dist/utils/hbuilderx.d.ts +5 -0
  236. package/dist/utils/index.d.ts +7 -0
  237. package/dist/utils/nameMatcher.d.ts +4 -0
  238. package/dist/utils/resolve-package.d.ts +1 -0
  239. package/dist/utils/uni-platform.d.ts +11 -0
  240. package/dist/utils-7DUGTFED.mjs +48 -0
  241. package/dist/utils-DmC9_In3.js +61 -0
  242. package/dist/vite-BC9U7ahn.js +2199 -0
  243. package/dist/vite-CrlzCNqz.mjs +2186 -0
  244. package/dist/vite.d.ts +4 -17
  245. package/dist/vite.js +5 -14
  246. package/dist/vite.mjs +2 -14
  247. package/dist/weapp-tw-css-import-rewrite-loader.js +59 -92
  248. package/dist/weapp-tw-runtime-classset-loader.js +31 -50
  249. package/dist/webpack-Bu6M-Hbw.mjs +441 -0
  250. package/dist/webpack-DD7A6V0u.js +456 -0
  251. package/dist/webpack.d.ts +4 -25
  252. package/dist/webpack.js +6 -17
  253. package/dist/webpack.mjs +2 -17
  254. package/dist/webpack4.d.ts +4 -26
  255. package/dist/webpack4.js +375 -481
  256. package/dist/webpack4.mjs +366 -482
  257. package/dist/wxml/Tokenizer.d.ts +15 -0
  258. package/dist/wxml/custom-attributes.d.ts +4 -0
  259. package/dist/wxml/index.d.ts +2 -0
  260. package/dist/wxml/shared.d.ts +2 -0
  261. package/dist/wxml/tokenizer/types.d.ts +18 -0
  262. package/dist/wxml/utils/codegen/legacy-rewriter.d.ts +2 -0
  263. package/dist/wxml/utils/codegen/legacy-visitor.d.ts +8 -0
  264. package/dist/wxml/utils/codegen.d.ts +2 -0
  265. package/dist/wxml/utils/custom-template.d.ts +3 -0
  266. package/dist/wxml/utils/fragment-helpers.d.ts +6 -0
  267. package/dist/wxml/utils/fragment-updater.d.ts +4 -0
  268. package/dist/wxml/utils/template-fragments.d.ts +3 -0
  269. package/dist/wxml/utils.d.ts +8 -0
  270. package/dist/wxml/whitespace.d.ts +2 -0
  271. package/generator-placeholder.css +1 -0
  272. package/package.json +19 -8
  273. package/dist/chunk-24AGZQVR.js +0 -183
  274. package/dist/chunk-3VQKDHGP.mjs +0 -179
  275. package/dist/chunk-4AFQP74Z.js +0 -24
  276. package/dist/chunk-57SOQCAU.mjs +0 -582
  277. package/dist/chunk-5ZYHNDEK.mjs +0 -2439
  278. package/dist/chunk-76S2EME4.mjs +0 -34
  279. package/dist/chunk-A5PB4KZT.js +0 -138
  280. package/dist/chunk-DUHYLR2R.js +0 -276
  281. package/dist/chunk-DYLQ6UOI.js +0 -71
  282. package/dist/chunk-E7I5TW5K.js +0 -52
  283. package/dist/chunk-FS2NOOEB.js +0 -292
  284. package/dist/chunk-HVNGIKLS.js +0 -3930
  285. package/dist/chunk-JZQBZHN5.js +0 -579
  286. package/dist/chunk-KGTVD4EP.mjs +0 -3930
  287. package/dist/chunk-NNOQDMUP.mjs +0 -10
  288. package/dist/chunk-OF6MFURR.js +0 -34
  289. package/dist/chunk-OFB2KBRP.js +0 -2442
  290. package/dist/chunk-OOHJLO5M.mjs +0 -71
  291. package/dist/chunk-PCDYXXSK.mjs +0 -1515
  292. package/dist/chunk-RKISS72P.js +0 -7
  293. package/dist/chunk-RRQZL7FQ.mjs +0 -292
  294. package/dist/chunk-XAKAD2CR.mjs +0 -138
  295. package/dist/chunk-XZP3MREK.mjs +0 -276
  296. package/dist/chunk-ZAA5ZG3D.js +0 -1518
  297. package/dist/chunk-ZCH4YINE.mjs +0 -52
  298. package/dist/cli.d.mts +0 -2
  299. package/dist/core.d.mts +0 -26
  300. package/dist/css-macro/postcss.d.mts +0 -7
  301. package/dist/css-macro.d.mts +0 -18
  302. package/dist/defaults.d.mts +0 -11
  303. package/dist/gulp.d.mts +0 -24
  304. package/dist/index-BXrmQelt.d.mts +0 -672
  305. package/dist/index-BXrmQelt.d.ts +0 -672
  306. package/dist/index.d.mts +0 -15
  307. package/dist/postcss-html-transform.d.mts +0 -2
  308. package/dist/presets.d.mts +0 -76
  309. package/dist/reset.d.mts +0 -1
  310. package/dist/types.d.mts +0 -150
  311. package/dist/vite.d.mts +0 -17
  312. package/dist/webpack.d.mts +0 -25
  313. package/dist/webpack4.d.mts +0 -26
@@ -0,0 +1,1276 @@
1
+ const require_chunk = require("./chunk-8l464Juk.js");
2
+ const require_patcher_options = require("./patcher-options-6gJN2EXy.js");
3
+ let node_module = require("node:module");
4
+ let postcss = require("postcss");
5
+ postcss = require_chunk.__toESM(postcss);
6
+ let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
7
+ let node_path = require("node:path");
8
+ node_path = require_chunk.__toESM(node_path);
9
+ let node_process = require("node:process");
10
+ node_process = require_chunk.__toESM(node_process);
11
+ let tailwindcss_config = require("tailwindcss-config");
12
+ let tailwindcss_patch = require("tailwindcss-patch");
13
+ //#region src/tailwindcss/remove-unsupported-css.ts
14
+ /**
15
+ * 移除小程序不支持的 cascade layer 语法,同时保留 layer 内的实际规则。
16
+ */
17
+ function removeUnsupportedCascadeLayers(root) {
18
+ root.walkAtRules("layer", (atRule) => {
19
+ if (!atRule.nodes || atRule.nodes.length === 0) {
20
+ atRule.remove();
21
+ return;
22
+ }
23
+ atRule.replaceWith(...atRule.nodes);
24
+ });
25
+ }
26
+ //#endregion
27
+ //#region src/tailwindcss/miniprogram.ts
28
+ const DEFAULT_WEAPP_VARIABLE_SCOPE = "page,.tw-root,wx-root-portal-content,:host";
29
+ const CLASS_SELECTOR_RE = /(?:^|[^\w-])\.[_a-z\u00A0-\uFFFF\\-]/i;
30
+ const PSEUDO_CONTENT_SELECTOR_RE = /^(?:::before|::after|:before|:after)(?:,(?:::before|::after|:before|:after))*$/;
31
+ function hasClassSelector(selector) {
32
+ return CLASS_SELECTOR_RE.test(selector);
33
+ }
34
+ function isCustomPropertyRule(rule) {
35
+ let hasDeclaration = false;
36
+ let allCustomProperties = true;
37
+ rule.walkDecls((decl) => {
38
+ hasDeclaration = true;
39
+ if (!decl.prop.startsWith("--")) allCustomProperties = false;
40
+ });
41
+ return hasDeclaration && allCustomProperties;
42
+ }
43
+ function isPseudoContentInitRule(rule) {
44
+ const selector = rule.selector.replace(/\s+/g, "");
45
+ if (!PSEUDO_CONTENT_SELECTOR_RE.test(selector)) return false;
46
+ let hasDeclaration = false;
47
+ let onlyContentVariable = true;
48
+ rule.walkDecls((decl) => {
49
+ hasDeclaration = true;
50
+ if (decl.prop !== "--tw-content") onlyContentVariable = false;
51
+ });
52
+ return hasDeclaration && onlyContentVariable;
53
+ }
54
+ /**
55
+ * 裁剪 Tailwind 生成 CSS 中面向浏览器的 classless 规则。
56
+ *
57
+ * 生成模式面向小程序时只需要保留业务 utility 与 Tailwind 变量初始化;
58
+ * 浏览器元素 reset、表单伪元素等 classless 规则不适合直接输出到小程序。
59
+ */
60
+ function pruneMiniProgramGeneratedCss(css) {
61
+ const root = postcss.default.parse(css);
62
+ root.walkComments((comment) => {
63
+ comment.remove();
64
+ });
65
+ removeUnsupportedCascadeLayers(root);
66
+ root.walkAtRules("supports", (atRule) => {
67
+ atRule.remove();
68
+ });
69
+ root.walkRules((rule) => {
70
+ if (hasClassSelector(rule.selector)) return;
71
+ if (isPseudoContentInitRule(rule)) return;
72
+ if (isCustomPropertyRule(rule)) {
73
+ rule.selector = DEFAULT_WEAPP_VARIABLE_SCOPE;
74
+ return;
75
+ }
76
+ rule.remove();
77
+ });
78
+ root.walkAtRules((atRule) => {
79
+ if (!atRule.nodes || atRule.nodes.length === 0) atRule.remove();
80
+ });
81
+ return root.toString();
82
+ }
83
+ //#endregion
84
+ //#region src/tailwindcss/v3-engine/miniprogram.ts
85
+ const defaultStyleHandler$1 = (0, _weapp_tailwindcss_postcss.createStyleHandler)({
86
+ cssChildCombinatorReplaceValue: ["view", "text"],
87
+ cssRemoveHoverPseudoClass: true,
88
+ isMainChunk: true,
89
+ majorVersion: 3
90
+ });
91
+ async function transformTailwindV3CssToWeapp(css, options) {
92
+ return pruneMiniProgramGeneratedCss((await defaultStyleHandler$1(css, {
93
+ cssChildCombinatorReplaceValue: ["view", "text"],
94
+ cssRemoveHoverPseudoClass: true,
95
+ isMainChunk: true,
96
+ majorVersion: 3,
97
+ ...options
98
+ })).css);
99
+ }
100
+ async function transformTailwindV3CssByTarget(css, target, options) {
101
+ return target === "weapp" ? transformTailwindV3CssToWeapp(css, options) : css;
102
+ }
103
+ //#endregion
104
+ //#region src/tailwindcss/v3-engine/generator.ts
105
+ function isLegacyContentObject(value) {
106
+ return typeof value === "object" && value !== null && "files" in value;
107
+ }
108
+ function createRawContentEntries(candidates, sources) {
109
+ const entries = [];
110
+ const candidateContent = [...candidates].join(" ");
111
+ if (candidateContent.length > 0) entries.push({
112
+ raw: candidateContent,
113
+ extension: "html"
114
+ });
115
+ for (const source of sources) entries.push({
116
+ raw: source.content,
117
+ extension: source.extension ?? "html"
118
+ });
119
+ return entries;
120
+ }
121
+ function mergeContent(content, rawEntries) {
122
+ if (isLegacyContentObject(content)) return {
123
+ ...content,
124
+ relative: content.relative ?? true,
125
+ files: [...[].concat(content.files ?? []), ...rawEntries]
126
+ };
127
+ return {
128
+ relative: true,
129
+ files: [...[].concat(content ?? []), ...rawEntries]
130
+ };
131
+ }
132
+ function normalizeConfigObject(config) {
133
+ if (!config || typeof config !== "object") return config;
134
+ const maybeDefault = config.default;
135
+ if (maybeDefault && typeof maybeDefault === "object") return maybeDefault;
136
+ return config;
137
+ }
138
+ function createTailwindConfig(source, options) {
139
+ const config = { ...normalizeConfigObject(source.configObject) ?? {} };
140
+ const rawEntries = createRawContentEntries(options.candidates ?? [], options.sources ?? []);
141
+ config.content = mergeContent(config.content, rawEntries);
142
+ return config;
143
+ }
144
+ function loadTailwindcssPlugin(source) {
145
+ const requireFromProject = (0, node_module.createRequire)(`${source.cwd}/package.json`);
146
+ const requireFromRuntime = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
147
+ let plugin;
148
+ try {
149
+ plugin = requireFromProject(source.postcssPlugin);
150
+ } catch {
151
+ plugin = requireFromRuntime(source.postcssPlugin);
152
+ }
153
+ return typeof plugin === "function" ? plugin : plugin.default;
154
+ }
155
+ function collectClassSet(plugin) {
156
+ const classSet = /* @__PURE__ */ new Set();
157
+ for (const context of plugin.contextRef?.value ?? []) for (const candidate of context.classCache?.keys() ?? []) if (String(candidate) !== "*") classSet.add(candidate);
158
+ return classSet;
159
+ }
160
+ function collectDependencyMessages(result) {
161
+ const dependencies = /* @__PURE__ */ new Set();
162
+ for (const message of result.messages) if (message.type === "dependency" && typeof message.file === "string") dependencies.add(message.file);
163
+ return dependencies;
164
+ }
165
+ function createTailwindV3Engine(source) {
166
+ async function generate(options = {}) {
167
+ const { styleOptions, target = "weapp" } = options;
168
+ const tailwindcss = loadTailwindcssPlugin(source);
169
+ const result = await (0, postcss.default)([tailwindcss(createTailwindConfig(source, options))]).process(source.css, { from: void 0 });
170
+ const rawCss = result.css;
171
+ const css = await transformTailwindV3CssByTarget(rawCss, target, styleOptions);
172
+ const dependencies = collectDependencyMessages(result);
173
+ for (const dependency of source.dependencies) dependencies.add(dependency);
174
+ return {
175
+ css,
176
+ rawCss,
177
+ classSet: collectClassSet(tailwindcss),
178
+ rawCandidates: new Set(options.candidates ?? []),
179
+ dependencies: [...dependencies],
180
+ sources: [],
181
+ root: null,
182
+ target,
183
+ version: 3
184
+ };
185
+ }
186
+ return {
187
+ source,
188
+ async validateCandidates(candidates) {
189
+ return (await generate({
190
+ candidates,
191
+ target: "tailwind"
192
+ })).classSet;
193
+ },
194
+ generate
195
+ };
196
+ }
197
+ //#endregion
198
+ //#region src/tailwindcss/v3-engine/source.ts
199
+ const DEFAULT_TAILWIND_V3_CSS = [
200
+ "@tailwind base;",
201
+ "@tailwind components;",
202
+ "@tailwind utilities;"
203
+ ].join("\n");
204
+ function parseConfigParam(params) {
205
+ const value = params.trim();
206
+ return /^(['"])(.+)\1$/.exec(value)?.[2];
207
+ }
208
+ function resolveOptionalPath(value, base) {
209
+ if (!value) return;
210
+ return node_path.default.isAbsolute(value) ? value : node_path.default.resolve(base, value);
211
+ }
212
+ function resolveCssConfig(css, base) {
213
+ if (!css) return {
214
+ css,
215
+ config: void 0
216
+ };
217
+ const root = postcss.default.parse(css);
218
+ let config;
219
+ root.walkAtRules("config", (rule) => {
220
+ const configPath = parseConfigParam(rule.params);
221
+ if (!configPath) return;
222
+ if (!config) config = resolveOptionalPath(configPath, base);
223
+ rule.remove();
224
+ });
225
+ return {
226
+ config,
227
+ css: root.toString()
228
+ };
229
+ }
230
+ function getProjectRoot$1(patcher) {
231
+ return patcher.options?.projectRoot ?? node_process.default.cwd();
232
+ }
233
+ function normalizeLoadedConfig(config) {
234
+ if (!config || typeof config !== "object") return config;
235
+ const maybeDefault = config.default;
236
+ if (maybeDefault && typeof maybeDefault === "object") return maybeDefault;
237
+ return config;
238
+ }
239
+ function resolveTailwindCssPackageName(patcher) {
240
+ return require_patcher_options.resolveTailwindcssOptions(patcher.options)?.packageName ?? patcher.packageInfo?.name ?? "tailwindcss";
241
+ }
242
+ async function resolveTailwindV3Source(options = {}) {
243
+ const projectRoot = options.projectRoot ?? node_process.default.cwd();
244
+ const base = options.base ?? options.cwd ?? projectRoot;
245
+ const cssConfig = resolveCssConfig(options.css, base);
246
+ const config = resolveOptionalPath(options.config, base) ?? cssConfig.config;
247
+ const cwd = options.cwd ?? (config ? node_path.default.dirname(config) : projectRoot);
248
+ const loaded = await (0, tailwindcss_config.loadConfig)({
249
+ config,
250
+ cwd
251
+ });
252
+ return {
253
+ version: 3,
254
+ projectRoot,
255
+ cwd,
256
+ base,
257
+ css: cssConfig.css ?? options.css ?? DEFAULT_TAILWIND_V3_CSS,
258
+ config: loaded?.filepath ?? config,
259
+ configObject: normalizeLoadedConfig(loaded?.config),
260
+ dependencies: loaded?.filepath ? [loaded.filepath] : [],
261
+ packageName: options.packageName ?? "tailwindcss",
262
+ postcssPlugin: options.postcssPlugin ?? options.packageName ?? "tailwindcss"
263
+ };
264
+ }
265
+ function resolveTailwindV3SourceOptionsFromPatcher(patcher) {
266
+ const projectRoot = getProjectRoot$1(patcher);
267
+ const tailwindOptions = require_patcher_options.resolveTailwindcssOptions(patcher.options);
268
+ return {
269
+ projectRoot,
270
+ cwd: tailwindOptions?.v3?.cwd ?? tailwindOptions?.cwd ?? projectRoot,
271
+ config: tailwindOptions?.v3?.config ?? tailwindOptions?.config,
272
+ packageName: resolveTailwindCssPackageName(patcher),
273
+ postcssPlugin: tailwindOptions?.v3?.postcssPlugin ?? tailwindOptions?.postcssPlugin
274
+ };
275
+ }
276
+ function resolveTailwindV3SourceFromPatcher(patcher) {
277
+ return resolveTailwindV3Source(resolveTailwindV3SourceOptionsFromPatcher(patcher));
278
+ }
279
+ //#endregion
280
+ //#region src/tailwindcss/v4-engine/candidates.ts
281
+ const UNSUPPORTED_MINI_PROGRAM_TAILWIND_V4_CANDIDATE_RE = /(?:^|:)(?:group|peer|in|not-in)-[^\s:]*\/|(?:^|:)(?:in|not-in)-\[/;
282
+ function isUnsupportedMiniProgramTailwindV4Candidate(candidate) {
283
+ return UNSUPPORTED_MINI_PROGRAM_TAILWIND_V4_CANDIDATE_RE.test(candidate);
284
+ }
285
+ function filterUnsupportedMiniProgramTailwindV4Candidates(candidates) {
286
+ if (!candidates) return;
287
+ return new Set([...candidates].filter((candidate) => !isUnsupportedMiniProgramTailwindV4Candidate(candidate)));
288
+ }
289
+ //#endregion
290
+ //#region src/tailwindcss/v4-engine/miniprogram.ts
291
+ const defaultStyleHandler = (0, _weapp_tailwindcss_postcss.createStyleHandler)({
292
+ cssChildCombinatorReplaceValue: ["view", "text"],
293
+ cssRemoveHoverPseudoClass: true,
294
+ isMainChunk: true,
295
+ majorVersion: 4
296
+ });
297
+ const CSS_DECLARATION_URL_RE = /(:\s*)url\(([^\n\r"';[\]{}]*[[\]{}][^\n\r;]*)\)(?=\s*;)/g;
298
+ function normalizeTailwindV4GeneratedUrlValues(css) {
299
+ return css.replace(CSS_DECLARATION_URL_RE, (match, prefix, urlValue) => {
300
+ try {
301
+ return `${prefix}url("${urlValue.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}")`;
302
+ } catch {
303
+ return match;
304
+ }
305
+ });
306
+ }
307
+ async function transformTailwindV4CssToWeapp(css, options) {
308
+ return pruneMiniProgramGeneratedCss((await defaultStyleHandler(normalizeTailwindV4GeneratedUrlValues(css), {
309
+ cssChildCombinatorReplaceValue: ["view", "text"],
310
+ cssRemoveHoverPseudoClass: true,
311
+ isMainChunk: true,
312
+ majorVersion: 4,
313
+ ...options
314
+ })).css);
315
+ }
316
+ async function transformTailwindV4CssByTarget(css, target, options) {
317
+ const compatibleCss = normalizeTailwindV4GeneratedUrlValues(css);
318
+ return target === "weapp" ? transformTailwindV4CssToWeapp(compatibleCss, options) : compatibleCss;
319
+ }
320
+ //#endregion
321
+ //#region src/tailwindcss/v4-engine/tailwind-v3-default-colors.ts
322
+ const TAILWIND_V3_COLOR_STEPS = [
323
+ "50",
324
+ "100",
325
+ "200",
326
+ "300",
327
+ "400",
328
+ "500",
329
+ "600",
330
+ "700",
331
+ "800",
332
+ "900",
333
+ "950"
334
+ ];
335
+ const TAILWIND_V3_COLOR_PALETTE = {
336
+ slate: [
337
+ "#f8fafc",
338
+ "#f1f5f9",
339
+ "#e2e8f0",
340
+ "#cbd5e1",
341
+ "#94a3b8",
342
+ "#64748b",
343
+ "#475569",
344
+ "#334155",
345
+ "#1e293b",
346
+ "#0f172a",
347
+ "#020617"
348
+ ],
349
+ gray: [
350
+ "#f9fafb",
351
+ "#f3f4f6",
352
+ "#e5e7eb",
353
+ "#d1d5db",
354
+ "#9ca3af",
355
+ "#6b7280",
356
+ "#4b5563",
357
+ "#374151",
358
+ "#1f2937",
359
+ "#111827",
360
+ "#030712"
361
+ ],
362
+ zinc: [
363
+ "#fafafa",
364
+ "#f4f4f5",
365
+ "#e4e4e7",
366
+ "#d4d4d8",
367
+ "#a1a1aa",
368
+ "#71717a",
369
+ "#52525b",
370
+ "#3f3f46",
371
+ "#27272a",
372
+ "#18181b",
373
+ "#09090b"
374
+ ],
375
+ neutral: [
376
+ "#fafafa",
377
+ "#f5f5f5",
378
+ "#e5e5e5",
379
+ "#d4d4d4",
380
+ "#a3a3a3",
381
+ "#737373",
382
+ "#525252",
383
+ "#404040",
384
+ "#262626",
385
+ "#171717",
386
+ "#0a0a0a"
387
+ ],
388
+ stone: [
389
+ "#fafaf9",
390
+ "#f5f5f4",
391
+ "#e7e5e4",
392
+ "#d6d3d1",
393
+ "#a8a29e",
394
+ "#78716c",
395
+ "#57534e",
396
+ "#44403c",
397
+ "#292524",
398
+ "#1c1917",
399
+ "#0c0a09"
400
+ ],
401
+ red: [
402
+ "#fef2f2",
403
+ "#fee2e2",
404
+ "#fecaca",
405
+ "#fca5a5",
406
+ "#f87171",
407
+ "#ef4444",
408
+ "#dc2626",
409
+ "#b91c1c",
410
+ "#991b1b",
411
+ "#7f1d1d",
412
+ "#450a0a"
413
+ ],
414
+ orange: [
415
+ "#fff7ed",
416
+ "#ffedd5",
417
+ "#fed7aa",
418
+ "#fdba74",
419
+ "#fb923c",
420
+ "#f97316",
421
+ "#ea580c",
422
+ "#c2410c",
423
+ "#9a3412",
424
+ "#7c2d12",
425
+ "#431407"
426
+ ],
427
+ amber: [
428
+ "#fffbeb",
429
+ "#fef3c7",
430
+ "#fde68a",
431
+ "#fcd34d",
432
+ "#fbbf24",
433
+ "#f59e0b",
434
+ "#d97706",
435
+ "#b45309",
436
+ "#92400e",
437
+ "#78350f",
438
+ "#451a03"
439
+ ],
440
+ yellow: [
441
+ "#fefce8",
442
+ "#fef9c3",
443
+ "#fef08a",
444
+ "#fde047",
445
+ "#facc15",
446
+ "#eab308",
447
+ "#ca8a04",
448
+ "#a16207",
449
+ "#854d0e",
450
+ "#713f12",
451
+ "#422006"
452
+ ],
453
+ lime: [
454
+ "#f7fee7",
455
+ "#ecfccb",
456
+ "#d9f99d",
457
+ "#bef264",
458
+ "#a3e635",
459
+ "#84cc16",
460
+ "#65a30d",
461
+ "#4d7c0f",
462
+ "#3f6212",
463
+ "#365314",
464
+ "#1a2e05"
465
+ ],
466
+ green: [
467
+ "#f0fdf4",
468
+ "#dcfce7",
469
+ "#bbf7d0",
470
+ "#86efac",
471
+ "#4ade80",
472
+ "#22c55e",
473
+ "#16a34a",
474
+ "#15803d",
475
+ "#166534",
476
+ "#14532d",
477
+ "#052e16"
478
+ ],
479
+ emerald: [
480
+ "#ecfdf5",
481
+ "#d1fae5",
482
+ "#a7f3d0",
483
+ "#6ee7b7",
484
+ "#34d399",
485
+ "#10b981",
486
+ "#059669",
487
+ "#047857",
488
+ "#065f46",
489
+ "#064e3b",
490
+ "#022c22"
491
+ ],
492
+ teal: [
493
+ "#f0fdfa",
494
+ "#ccfbf1",
495
+ "#99f6e4",
496
+ "#5eead4",
497
+ "#2dd4bf",
498
+ "#14b8a6",
499
+ "#0d9488",
500
+ "#0f766e",
501
+ "#115e59",
502
+ "#134e4a",
503
+ "#042f2e"
504
+ ],
505
+ cyan: [
506
+ "#ecfeff",
507
+ "#cffafe",
508
+ "#a5f3fc",
509
+ "#67e8f9",
510
+ "#22d3ee",
511
+ "#06b6d4",
512
+ "#0891b2",
513
+ "#0e7490",
514
+ "#155e75",
515
+ "#164e63",
516
+ "#083344"
517
+ ],
518
+ sky: [
519
+ "#f0f9ff",
520
+ "#e0f2fe",
521
+ "#bae6fd",
522
+ "#7dd3fc",
523
+ "#38bdf8",
524
+ "#0ea5e9",
525
+ "#0284c7",
526
+ "#0369a1",
527
+ "#075985",
528
+ "#0c4a6e",
529
+ "#082f49"
530
+ ],
531
+ blue: [
532
+ "#eff6ff",
533
+ "#dbeafe",
534
+ "#bfdbfe",
535
+ "#93c5fd",
536
+ "#60a5fa",
537
+ "#3b82f6",
538
+ "#2563eb",
539
+ "#1d4ed8",
540
+ "#1e40af",
541
+ "#1e3a8a",
542
+ "#172554"
543
+ ],
544
+ indigo: [
545
+ "#eef2ff",
546
+ "#e0e7ff",
547
+ "#c7d2fe",
548
+ "#a5b4fc",
549
+ "#818cf8",
550
+ "#6366f1",
551
+ "#4f46e5",
552
+ "#4338ca",
553
+ "#3730a3",
554
+ "#312e81",
555
+ "#1e1b4b"
556
+ ],
557
+ violet: [
558
+ "#f5f3ff",
559
+ "#ede9fe",
560
+ "#ddd6fe",
561
+ "#c4b5fd",
562
+ "#a78bfa",
563
+ "#8b5cf6",
564
+ "#7c3aed",
565
+ "#6d28d9",
566
+ "#5b21b6",
567
+ "#4c1d95",
568
+ "#2e1065"
569
+ ],
570
+ purple: [
571
+ "#faf5ff",
572
+ "#f3e8ff",
573
+ "#e9d5ff",
574
+ "#d8b4fe",
575
+ "#c084fc",
576
+ "#a855f7",
577
+ "#9333ea",
578
+ "#7e22ce",
579
+ "#6b21a8",
580
+ "#581c87",
581
+ "#3b0764"
582
+ ],
583
+ fuchsia: [
584
+ "#fdf4ff",
585
+ "#fae8ff",
586
+ "#f5d0fe",
587
+ "#f0abfc",
588
+ "#e879f9",
589
+ "#d946ef",
590
+ "#c026d3",
591
+ "#a21caf",
592
+ "#86198f",
593
+ "#701a75",
594
+ "#4a044e"
595
+ ],
596
+ pink: [
597
+ "#fdf2f8",
598
+ "#fce7f3",
599
+ "#fbcfe8",
600
+ "#f9a8d4",
601
+ "#f472b6",
602
+ "#ec4899",
603
+ "#db2777",
604
+ "#be185d",
605
+ "#9d174d",
606
+ "#831843",
607
+ "#500724"
608
+ ],
609
+ rose: [
610
+ "#fff1f2",
611
+ "#ffe4e6",
612
+ "#fecdd3",
613
+ "#fda4af",
614
+ "#fb7185",
615
+ "#f43f5e",
616
+ "#e11d48",
617
+ "#be123c",
618
+ "#9f1239",
619
+ "#881337",
620
+ "#4c0519"
621
+ ]
622
+ };
623
+ function createTailwindV3DefaultColorThemeCss() {
624
+ const declarations = [" --color-black: #000;", " --color-white: #fff;"];
625
+ for (const [color, values] of Object.entries(TAILWIND_V3_COLOR_PALETTE)) for (let index = 0; index < TAILWIND_V3_COLOR_STEPS.length; index++) declarations.push(` --color-${color}-${TAILWIND_V3_COLOR_STEPS[index]}: ${values[index]};`);
626
+ return [
627
+ "@theme {",
628
+ ...declarations,
629
+ "}"
630
+ ].join("\n");
631
+ }
632
+ //#endregion
633
+ //#region src/tailwindcss/v4-engine/tailwind-v3-compatibility.ts
634
+ const TAILWIND_V3_COMPATIBILITY_THEME_CSS = [
635
+ "@theme {",
636
+ " --default-ring-width: 3px;",
637
+ " --default-ring-color: var(--color-blue-500, #3b82f6);",
638
+ " --default-outline-width: 3px;",
639
+ "",
640
+ " --shadow-xs: 0 1px rgb(0 0 0 / 0.05);",
641
+ " --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);",
642
+ " --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);",
643
+ " --drop-shadow-xs: 0 1px 1px rgb(0 0 0 / 0.05);",
644
+ " --drop-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);",
645
+ " --drop-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 1px 1px rgb(0 0 0 / 0.06);",
646
+ "",
647
+ " --blur-xs: 4px;",
648
+ " --blur-sm: 4px;",
649
+ " --blur: 8px;",
650
+ " --backdrop-blur-xs: 4px;",
651
+ " --backdrop-blur-sm: 4px;",
652
+ " --backdrop-blur: 8px;",
653
+ "",
654
+ " --radius-xs: 0.125rem;",
655
+ " --radius-sm: 0.125rem;",
656
+ " --radius: 0.25rem;",
657
+ "}",
658
+ createTailwindV3DefaultColorThemeCss()
659
+ ].join("\n");
660
+ const TAILWIND_V3_COMPATIBILITY_BASE_CSS = [
661
+ "@layer base {",
662
+ " *,",
663
+ " ::after,",
664
+ " ::before,",
665
+ " ::backdrop,",
666
+ " ::file-selector-button {",
667
+ " border-color: var(--color-gray-200, currentcolor);",
668
+ " }",
669
+ "",
670
+ " input::placeholder,",
671
+ " textarea::placeholder {",
672
+ " opacity: 1;",
673
+ " color: var(--color-gray-400, currentcolor);",
674
+ " }",
675
+ "",
676
+ " button:not(:disabled),",
677
+ " [role=\"button\"]:not(:disabled) {",
678
+ " cursor: pointer;",
679
+ " }",
680
+ "",
681
+ " dialog {",
682
+ " margin: auto;",
683
+ " }",
684
+ "}"
685
+ ].join("\n");
686
+ function applyTailwindV3CompatibilityCss(css) {
687
+ return `${TAILWIND_V3_COMPATIBILITY_THEME_CSS}\n${css}\n${TAILWIND_V3_COMPATIBILITY_BASE_CSS}`;
688
+ }
689
+ //#endregion
690
+ //#region src/tailwindcss/v4-engine/tailwind-v4-default-colors.ts
691
+ const TAILWIND_V4_COLOR_STEPS = [
692
+ "50",
693
+ "100",
694
+ "200",
695
+ "300",
696
+ "400",
697
+ "500",
698
+ "600",
699
+ "700",
700
+ "800",
701
+ "900",
702
+ "950"
703
+ ];
704
+ const TAILWIND_V4_COLOR_PALETTE = {
705
+ slate: [
706
+ "#f8fafc",
707
+ "#f1f5f9",
708
+ "#e2e8f0",
709
+ "#cad5e2",
710
+ "#90a1b9",
711
+ "#62748e",
712
+ "#45556c",
713
+ "#314158",
714
+ "#1d293d",
715
+ "#0f172b",
716
+ "#020618"
717
+ ],
718
+ gray: [
719
+ "#f9fafb",
720
+ "#f3f4f6",
721
+ "#e5e7eb",
722
+ "#d1d5dc",
723
+ "#99a1af",
724
+ "#6a7282",
725
+ "#4a5565",
726
+ "#364153",
727
+ "#1e2939",
728
+ "#101828",
729
+ "#030712"
730
+ ],
731
+ zinc: [
732
+ "#fafafa",
733
+ "#f4f4f5",
734
+ "#e4e4e7",
735
+ "#d4d4d8",
736
+ "#9f9fa9",
737
+ "#71717b",
738
+ "#52525c",
739
+ "#3f3f46",
740
+ "#27272a",
741
+ "#18181b",
742
+ "#09090b"
743
+ ],
744
+ neutral: [
745
+ "#fafafa",
746
+ "#f5f5f5",
747
+ "#e5e5e5",
748
+ "#d4d4d4",
749
+ "#a1a1a1",
750
+ "#737373",
751
+ "#525252",
752
+ "#404040",
753
+ "#262626",
754
+ "#171717",
755
+ "#0a0a0a"
756
+ ],
757
+ stone: [
758
+ "#fafaf9",
759
+ "#f5f5f4",
760
+ "#e7e5e4",
761
+ "#d6d3d1",
762
+ "#a6a09b",
763
+ "#79716b",
764
+ "#57534d",
765
+ "#44403b",
766
+ "#292524",
767
+ "#1c1917",
768
+ "#0c0a09"
769
+ ],
770
+ mauve: [
771
+ "#fafafa",
772
+ "#f3f1f3",
773
+ "#e7e4e7",
774
+ "#d7d0d7",
775
+ "#a89ea9",
776
+ "#79697b",
777
+ "#594c5b",
778
+ "#463947",
779
+ "#2a212c",
780
+ "#1d161e",
781
+ "#0c090c"
782
+ ],
783
+ olive: [
784
+ "#fbfbf9",
785
+ "#f4f4f0",
786
+ "#e8e8e3",
787
+ "#d8d8d0",
788
+ "#abab9c",
789
+ "#7c7c67",
790
+ "#5b5b4b",
791
+ "#474739",
792
+ "#2b2b22",
793
+ "#1d1d16",
794
+ "#0c0c09"
795
+ ],
796
+ mist: [
797
+ "#f9fbfb",
798
+ "#f1f3f3",
799
+ "#e3e7e8",
800
+ "#d0d6d8",
801
+ "#9ca8ab",
802
+ "#67787c",
803
+ "#4b585b",
804
+ "#394447",
805
+ "#22292b",
806
+ "#161b1d",
807
+ "#090b0c"
808
+ ],
809
+ taupe: [
810
+ "#fbfaf9",
811
+ "#f3f1f1",
812
+ "#e8e4e3",
813
+ "#d8d2d0",
814
+ "#aba09c",
815
+ "#7c6d67",
816
+ "#5b4f4b",
817
+ "#473c39",
818
+ "#2b2422",
819
+ "#1d1816",
820
+ "#0c0a09"
821
+ ],
822
+ red: [
823
+ "#fef2f2",
824
+ "#ffe2e2",
825
+ "#ffc9c9",
826
+ "#ffa2a2",
827
+ "#ff6467",
828
+ "#fb2c36",
829
+ "#e7000b",
830
+ "#c10007",
831
+ "#9f0712",
832
+ "#82181a",
833
+ "#460809"
834
+ ],
835
+ orange: [
836
+ "#fff7ed",
837
+ "#ffedd4",
838
+ "#ffd6a7",
839
+ "#ffb86a",
840
+ "#ff8904",
841
+ "#ff6900",
842
+ "#f54900",
843
+ "#ca3500",
844
+ "#9f2d00",
845
+ "#7e2a0c",
846
+ "#441306"
847
+ ],
848
+ amber: [
849
+ "#fffbeb",
850
+ "#fef3c6",
851
+ "#fee685",
852
+ "#ffd230",
853
+ "#ffb900",
854
+ "#fe9a00",
855
+ "#e17100",
856
+ "#bb4d00",
857
+ "#973c00",
858
+ "#7b3306",
859
+ "#461901"
860
+ ],
861
+ yellow: [
862
+ "#fefce8",
863
+ "#fef9c2",
864
+ "#fff085",
865
+ "#ffdf20",
866
+ "#fdc700",
867
+ "#f0b100",
868
+ "#d08700",
869
+ "#a65f00",
870
+ "#894b00",
871
+ "#733e0a",
872
+ "#432004"
873
+ ],
874
+ lime: [
875
+ "#f7fee7",
876
+ "#ecfcca",
877
+ "#d8f999",
878
+ "#bbf451",
879
+ "#9ae600",
880
+ "#7ccf00",
881
+ "#5ea500",
882
+ "#497d00",
883
+ "#3c6300",
884
+ "#35530e",
885
+ "#192e03"
886
+ ],
887
+ green: [
888
+ "#f0fdf4",
889
+ "#dcfce7",
890
+ "#b9f8cf",
891
+ "#7bf1a8",
892
+ "#05df72",
893
+ "#00c950",
894
+ "#00a63e",
895
+ "#008236",
896
+ "#016630",
897
+ "#0d542b",
898
+ "#032e15"
899
+ ],
900
+ emerald: [
901
+ "#ecfdf5",
902
+ "#d0fae5",
903
+ "#a4f4cf",
904
+ "#5ee9b5",
905
+ "#00d492",
906
+ "#00bc7d",
907
+ "#009966",
908
+ "#007a55",
909
+ "#006045",
910
+ "#004f3b",
911
+ "#002c22"
912
+ ],
913
+ teal: [
914
+ "#f0fdfa",
915
+ "#cbfbf1",
916
+ "#96f7e4",
917
+ "#46ecd5",
918
+ "#00d5be",
919
+ "#00bba7",
920
+ "#009689",
921
+ "#00786f",
922
+ "#005f5a",
923
+ "#0b4f4a",
924
+ "#022f2e"
925
+ ],
926
+ cyan: [
927
+ "#ecfeff",
928
+ "#cefafe",
929
+ "#a2f4fd",
930
+ "#53eafd",
931
+ "#00d3f2",
932
+ "#00b8db",
933
+ "#0092b8",
934
+ "#007595",
935
+ "#005f78",
936
+ "#104e64",
937
+ "#053345"
938
+ ],
939
+ sky: [
940
+ "#f0f9ff",
941
+ "#dff2fe",
942
+ "#b8e6fe",
943
+ "#74d4ff",
944
+ "#00bcff",
945
+ "#00a6f4",
946
+ "#0084d1",
947
+ "#0069a8",
948
+ "#00598a",
949
+ "#024a70",
950
+ "#052f4a"
951
+ ],
952
+ blue: [
953
+ "#eff6ff",
954
+ "#dbeafe",
955
+ "#bedbff",
956
+ "#8ec5ff",
957
+ "#51a2ff",
958
+ "#2b7fff",
959
+ "#155dfc",
960
+ "#1447e6",
961
+ "#193cb8",
962
+ "#1c398e",
963
+ "#162456"
964
+ ],
965
+ indigo: [
966
+ "#eef2ff",
967
+ "#e0e7ff",
968
+ "#c6d2ff",
969
+ "#a3b3ff",
970
+ "#7c86ff",
971
+ "#615fff",
972
+ "#4f39f6",
973
+ "#432dd7",
974
+ "#372aac",
975
+ "#312c85",
976
+ "#1e1a4d"
977
+ ],
978
+ violet: [
979
+ "#f5f3ff",
980
+ "#ede9fe",
981
+ "#ddd6ff",
982
+ "#c4b4ff",
983
+ "#a684ff",
984
+ "#8e51ff",
985
+ "#7f22fe",
986
+ "#7008e7",
987
+ "#5d0ec0",
988
+ "#4d179a",
989
+ "#2f0d68"
990
+ ],
991
+ purple: [
992
+ "#faf5ff",
993
+ "#f3e8ff",
994
+ "#e9d4ff",
995
+ "#dab2ff",
996
+ "#c27aff",
997
+ "#ad46ff",
998
+ "#9810fa",
999
+ "#8200db",
1000
+ "#6e11b0",
1001
+ "#59168b",
1002
+ "#3c0366"
1003
+ ],
1004
+ fuchsia: [
1005
+ "#fdf4ff",
1006
+ "#fae8ff",
1007
+ "#f6cfff",
1008
+ "#f4a8ff",
1009
+ "#ed6aff",
1010
+ "#e12afb",
1011
+ "#c800de",
1012
+ "#a800b7",
1013
+ "#8a0194",
1014
+ "#721378",
1015
+ "#4b004f"
1016
+ ],
1017
+ pink: [
1018
+ "#fdf2f8",
1019
+ "#fce7f3",
1020
+ "#fccee8",
1021
+ "#fda5d5",
1022
+ "#fb64b6",
1023
+ "#f6339a",
1024
+ "#e60076",
1025
+ "#c6005c",
1026
+ "#a3004c",
1027
+ "#861043",
1028
+ "#510424"
1029
+ ],
1030
+ rose: [
1031
+ "#fff1f2",
1032
+ "#ffe4e6",
1033
+ "#ffccd3",
1034
+ "#ffa1ad",
1035
+ "#ff637e",
1036
+ "#ff2056",
1037
+ "#ec003f",
1038
+ "#c70036",
1039
+ "#a50036",
1040
+ "#8b0836",
1041
+ "#4d0218"
1042
+ ]
1043
+ };
1044
+ function createTailwindV4DefaultColorThemeCss() {
1045
+ const declarations = [" --color-black: #000;", " --color-white: #fff;"];
1046
+ for (const [color, values] of Object.entries(TAILWIND_V4_COLOR_PALETTE)) for (let index = 0; index < TAILWIND_V4_COLOR_STEPS.length; index++) declarations.push(` --color-${color}-${TAILWIND_V4_COLOR_STEPS[index]}: ${values[index]};`);
1047
+ return [
1048
+ "@theme {",
1049
+ ...declarations,
1050
+ "}"
1051
+ ].join("\n");
1052
+ }
1053
+ //#endregion
1054
+ //#region src/tailwindcss/v4-engine/generator.ts
1055
+ function findLeadingImportInsertionIndex(css) {
1056
+ const importPattern = /(?:^|\n)\s*@import\b[^;]*;/g;
1057
+ let insertionIndex = 0;
1058
+ let match = importPattern.exec(css);
1059
+ while (match !== null) {
1060
+ insertionIndex = match.index + match[0].length;
1061
+ match = importPattern.exec(css);
1062
+ }
1063
+ return insertionIndex;
1064
+ }
1065
+ function applyMiniProgramTailwindV4DefaultColorCss(css) {
1066
+ const themeCss = createTailwindV4DefaultColorThemeCss();
1067
+ const insertionIndex = findLeadingImportInsertionIndex(css);
1068
+ if (insertionIndex === 0) return `${themeCss}\n${css}`;
1069
+ return `${css.slice(0, insertionIndex)}\n${themeCss}\n${css.slice(insertionIndex)}`;
1070
+ }
1071
+ function createTailwindV4Engine(source) {
1072
+ async function generate(options = {}) {
1073
+ const { scanSources = true, styleOptions, tailwindcssV3Compatibility, target = "weapp", ...patchOptions } = options;
1074
+ const sourceCss = tailwindcssV3Compatibility ?? target === "weapp" ? applyTailwindV3CompatibilityCss(source.css) : target === "weapp" ? applyMiniProgramTailwindV4DefaultColorCss(source.css) : source.css;
1075
+ const candidates = target === "weapp" ? filterUnsupportedMiniProgramTailwindV4Candidates(patchOptions.candidates) : patchOptions.candidates;
1076
+ const result = await (0, tailwindcss_patch.createTailwindV4Engine)(sourceCss === source.css ? source : {
1077
+ ...source,
1078
+ css: sourceCss
1079
+ }).generate({
1080
+ scanSources,
1081
+ ...patchOptions,
1082
+ candidates
1083
+ });
1084
+ const rawCss = result.css;
1085
+ const css = await transformTailwindV4CssByTarget(rawCss, target, styleOptions);
1086
+ return {
1087
+ ...result,
1088
+ css,
1089
+ rawCss,
1090
+ target
1091
+ };
1092
+ }
1093
+ return {
1094
+ source,
1095
+ loadDesignSystem: (0, tailwindcss_patch.createTailwindV4Engine)(source).loadDesignSystem,
1096
+ validateCandidates: (0, tailwindcss_patch.createTailwindV4Engine)(source).validateCandidates,
1097
+ generate
1098
+ };
1099
+ }
1100
+ //#endregion
1101
+ //#region src/tailwindcss/v4-engine/source.ts
1102
+ function isPostcssPluginImportTarget(value) {
1103
+ if (!value) return false;
1104
+ return value === "@tailwindcss/postcss" || value === "@tailwindcss/postcss7-compat" || value.includes("/postcss");
1105
+ }
1106
+ function uniqueDefined(values) {
1107
+ return [...new Set(values.filter((value) => typeof value === "string" && value.length > 0))];
1108
+ }
1109
+ function getProjectRoot(patcher) {
1110
+ return patcher.options?.projectRoot ?? node_process.default.cwd();
1111
+ }
1112
+ function readConfiguredV4Base(tailwindOptions) {
1113
+ const v4 = tailwindOptions?.v4;
1114
+ if (typeof v4 !== "object" || v4 === null) return;
1115
+ return v4.configuredBase;
1116
+ }
1117
+ function resolveTailwindCssImportTarget(patcher) {
1118
+ const configuredPackageName = require_patcher_options.resolveTailwindcssOptions(patcher.options)?.packageName;
1119
+ if (typeof configuredPackageName === "string" && configuredPackageName.length > 0 && !isPostcssPluginImportTarget(configuredPackageName)) return configuredPackageName;
1120
+ const packageName = patcher.packageInfo?.name;
1121
+ if (typeof packageName === "string" && packageName.length > 0 && !isPostcssPluginImportTarget(packageName)) return packageName;
1122
+ return "tailwindcss";
1123
+ }
1124
+ function resolveTailwindV4SourceOptionsFromPatcher(patcher) {
1125
+ const projectRoot = getProjectRoot(patcher);
1126
+ const tailwindOptions = require_patcher_options.resolveTailwindcssOptions(patcher.options);
1127
+ const configDir = tailwindOptions?.config ? node_path.default.dirname(tailwindOptions.config) : void 0;
1128
+ const configuredBase = readConfiguredV4Base(tailwindOptions);
1129
+ const hasCssEntries = Boolean(tailwindOptions?.v4?.cssEntries?.length);
1130
+ return {
1131
+ projectRoot,
1132
+ base: configuredBase ?? (hasCssEntries ? void 0 : tailwindOptions?.v4?.base),
1133
+ baseFallbacks: uniqueDefined([tailwindOptions?.cwd, configDir]),
1134
+ css: tailwindOptions?.v4?.css,
1135
+ cssEntries: tailwindOptions?.v4?.cssEntries,
1136
+ sources: tailwindOptions?.v4?.sources,
1137
+ packageName: resolveTailwindCssImportTarget(patcher)
1138
+ };
1139
+ }
1140
+ function resolveTailwindV4Source(options) {
1141
+ return (0, tailwindcss_patch.resolveTailwindV4Source)(options);
1142
+ }
1143
+ async function resolveTailwindV4SourceFromPatcher(patcher) {
1144
+ return (0, tailwindcss_patch.resolveTailwindV4Source)(resolveTailwindV4SourceOptionsFromPatcher(patcher));
1145
+ }
1146
+ //#endregion
1147
+ //#region src/generator/options.ts
1148
+ function normalizeWeappTailwindcssGeneratorOptions(options) {
1149
+ if (options === false) return {
1150
+ mode: "off",
1151
+ target: "weapp",
1152
+ tailwindcssV3Compatibility: true
1153
+ };
1154
+ if (options === true || options == null) return {
1155
+ mode: "auto",
1156
+ target: "weapp",
1157
+ tailwindcssV3Compatibility: true
1158
+ };
1159
+ return {
1160
+ mode: options.mode ?? "auto",
1161
+ target: options.target ?? "weapp",
1162
+ styleOptions: options.styleOptions,
1163
+ tailwindcssV3Compatibility: options.tailwindcssV3Compatibility ?? (options.target ?? "weapp") === "weapp"
1164
+ };
1165
+ }
1166
+ //#endregion
1167
+ //#region src/generator/index.ts
1168
+ function isTailwindV3Source(source) {
1169
+ return "version" in source && source.version === 3;
1170
+ }
1171
+ function createWeappTailwindcssGenerator(source) {
1172
+ return isTailwindV3Source(source) ? createTailwindV3Engine(source) : createTailwindV4Engine(source);
1173
+ }
1174
+ async function resolveTailwindSourceFromPatcher(patcher) {
1175
+ return patcher.majorVersion === 3 ? resolveTailwindV3SourceFromPatcher(patcher) : resolveTailwindV4SourceFromPatcher(patcher);
1176
+ }
1177
+ async function createWeappTailwindcssGeneratorFromPatcher(patcher) {
1178
+ return createWeappTailwindcssGenerator(await resolveTailwindSourceFromPatcher(patcher));
1179
+ }
1180
+ //#endregion
1181
+ Object.defineProperty(exports, "createWeappTailwindcssGenerator", {
1182
+ enumerable: true,
1183
+ get: function() {
1184
+ return createWeappTailwindcssGenerator;
1185
+ }
1186
+ });
1187
+ Object.defineProperty(exports, "createWeappTailwindcssGeneratorFromPatcher", {
1188
+ enumerable: true,
1189
+ get: function() {
1190
+ return createWeappTailwindcssGeneratorFromPatcher;
1191
+ }
1192
+ });
1193
+ Object.defineProperty(exports, "filterUnsupportedMiniProgramTailwindV4Candidates", {
1194
+ enumerable: true,
1195
+ get: function() {
1196
+ return filterUnsupportedMiniProgramTailwindV4Candidates;
1197
+ }
1198
+ });
1199
+ Object.defineProperty(exports, "normalizeWeappTailwindcssGeneratorOptions", {
1200
+ enumerable: true,
1201
+ get: function() {
1202
+ return normalizeWeappTailwindcssGeneratorOptions;
1203
+ }
1204
+ });
1205
+ Object.defineProperty(exports, "removeUnsupportedCascadeLayers", {
1206
+ enumerable: true,
1207
+ get: function() {
1208
+ return removeUnsupportedCascadeLayers;
1209
+ }
1210
+ });
1211
+ Object.defineProperty(exports, "resolveTailwindSourceFromPatcher", {
1212
+ enumerable: true,
1213
+ get: function() {
1214
+ return resolveTailwindSourceFromPatcher;
1215
+ }
1216
+ });
1217
+ Object.defineProperty(exports, "resolveTailwindV3Source", {
1218
+ enumerable: true,
1219
+ get: function() {
1220
+ return resolveTailwindV3Source;
1221
+ }
1222
+ });
1223
+ Object.defineProperty(exports, "resolveTailwindV3SourceFromPatcher", {
1224
+ enumerable: true,
1225
+ get: function() {
1226
+ return resolveTailwindV3SourceFromPatcher;
1227
+ }
1228
+ });
1229
+ Object.defineProperty(exports, "resolveTailwindV3SourceOptionsFromPatcher", {
1230
+ enumerable: true,
1231
+ get: function() {
1232
+ return resolveTailwindV3SourceOptionsFromPatcher;
1233
+ }
1234
+ });
1235
+ Object.defineProperty(exports, "resolveTailwindV4Source", {
1236
+ enumerable: true,
1237
+ get: function() {
1238
+ return resolveTailwindV4Source;
1239
+ }
1240
+ });
1241
+ Object.defineProperty(exports, "resolveTailwindV4SourceFromPatcher", {
1242
+ enumerable: true,
1243
+ get: function() {
1244
+ return resolveTailwindV4SourceFromPatcher;
1245
+ }
1246
+ });
1247
+ Object.defineProperty(exports, "resolveTailwindV4SourceOptionsFromPatcher", {
1248
+ enumerable: true,
1249
+ get: function() {
1250
+ return resolveTailwindV4SourceOptionsFromPatcher;
1251
+ }
1252
+ });
1253
+ Object.defineProperty(exports, "transformTailwindV3CssByTarget", {
1254
+ enumerable: true,
1255
+ get: function() {
1256
+ return transformTailwindV3CssByTarget;
1257
+ }
1258
+ });
1259
+ Object.defineProperty(exports, "transformTailwindV3CssToWeapp", {
1260
+ enumerable: true,
1261
+ get: function() {
1262
+ return transformTailwindV3CssToWeapp;
1263
+ }
1264
+ });
1265
+ Object.defineProperty(exports, "transformTailwindV4CssByTarget", {
1266
+ enumerable: true,
1267
+ get: function() {
1268
+ return transformTailwindV4CssByTarget;
1269
+ }
1270
+ });
1271
+ Object.defineProperty(exports, "transformTailwindV4CssToWeapp", {
1272
+ enumerable: true,
1273
+ get: function() {
1274
+ return transformTailwindV4CssToWeapp;
1275
+ }
1276
+ });