acinguiux-preact-components 0.0.1

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/package.json +56 -0
  2. package/src/content/themes/theme-acinguiux-amg/theme-acinguiux-amg.css +23 -0
  3. package/src/content/themes/theme-acinguiux-cafe/theme-acinguiux-cafe.css +47 -0
  4. package/src/content/themes/theme-acinguiux-energy/theme-acinguiux-energy.css +45 -0
  5. package/src/content/themes/theme-acinguiux-livewire/theme-acinguiux-livewire.css +22 -0
  6. package/src/content/themes/theme-acinguiux-livewire-italy/theme-acinguiux-livewire-italy.css +22 -0
  7. package/src/content/themes/theme-acinguiux-recharge/theme-acinguiux-recharge.css +49 -0
  8. package/src/content/themes/theme-allon/theme-allon.css +25 -0
  9. package/src/content/themes/theme-atlas/theme-atlas.css +31 -0
  10. package/src/content/themes/theme-aurvana/resources/favicon/apple-touch-icon.png +0 -0
  11. package/src/content/themes/theme-aurvana/resources/favicon/favico.ico +0 -0
  12. package/src/content/themes/theme-aurvana/resources/favicon/favicon-96x96.png +0 -0
  13. package/src/content/themes/theme-aurvana/resources/favicon/favicon.ico +0 -0
  14. package/src/content/themes/theme-aurvana/resources/favicon/favicon.png +0 -0
  15. package/src/content/themes/theme-aurvana/resources/favicon/favicon.svg +13 -0
  16. package/src/content/themes/theme-aurvana/resources/favicon/google-touch-icon.png +0 -0
  17. package/src/content/themes/theme-aurvana/resources/favicon/manifest.json +14 -0
  18. package/src/content/themes/theme-aurvana/resources/favicon/site.webmanifest +21 -0
  19. package/src/content/themes/theme-aurvana/resources/favicon/web-app-manifest-192x192.png +0 -0
  20. package/src/content/themes/theme-aurvana/resources/favicon/web-app-manifest-512x512.png +0 -0
  21. package/src/content/themes/theme-aurvana/theme-aurvana.css +49 -0
  22. package/src/content/themes/theme-base/theme-base.css +49 -0
  23. package/src/content/themes/theme-base2/resources/favicon/android-chrome-192x192.png +0 -0
  24. package/src/content/themes/theme-base2/resources/favicon/android-chrome-512x512.png +0 -0
  25. package/src/content/themes/theme-base2/resources/favicon/apple-touch-icon.png +0 -0
  26. package/src/content/themes/theme-base2/resources/favicon/favico.ico +0 -0
  27. package/src/content/themes/theme-base2/resources/favicon/favicon-16x16.png +0 -0
  28. package/src/content/themes/theme-base2/resources/favicon/favicon-32x32.png +0 -0
  29. package/src/content/themes/theme-base2/resources/favicon/favicon-96x96.png +0 -0
  30. package/src/content/themes/theme-base2/resources/favicon/favicon.ico +0 -0
  31. package/src/content/themes/theme-base2/resources/favicon/favicon.png +0 -0
  32. package/src/content/themes/theme-base2/resources/favicon/favicon.svg +9 -0
  33. package/src/content/themes/theme-base2/resources/favicon/google-touch-icon.png +0 -0
  34. package/src/content/themes/theme-base2/resources/favicon/manifest.json +14 -0
  35. package/src/content/themes/theme-base2/resources/favicon/site.webmanifest +1 -0
  36. package/src/content/themes/theme-base2/resources/favicon/web-app-manifest-192x192.png +0 -0
  37. package/src/content/themes/theme-base2/resources/favicon/web-app-manifest-512x512.png +0 -0
  38. package/src/content/themes/theme-base2/resources/fonts/acinguiux-typeface-la-heavy-221208.woff2 +0 -0
  39. package/src/content/themes/theme-base2/theme-base2.css +47 -0
  40. package/src/content/themes/theme-eco-marathon/theme-eco-marathon.css +22 -0
  41. package/src/content/themes/theme-energy-transition-campus-amsterdam/theme-energy-transition-campus-amsterdam.css +26 -0
  42. package/src/content/themes/theme-evpass/theme-evpass.css +46 -0
  43. package/src/content/themes/theme-nam-2025/resources/favicon/apple-touch-icon.png +0 -0
  44. package/src/content/themes/theme-nam-2025/resources/favicon/favico.ico +0 -0
  45. package/src/content/themes/theme-nam-2025/resources/favicon/favicon-96x96.png +0 -0
  46. package/src/content/themes/theme-nam-2025/resources/favicon/favicon.ico +0 -0
  47. package/src/content/themes/theme-nam-2025/resources/favicon/favicon.png +0 -0
  48. package/src/content/themes/theme-nam-2025/resources/favicon/favicon.svg +9 -0
  49. package/src/content/themes/theme-nam-2025/resources/favicon/google-touch-icon.png +0 -0
  50. package/src/content/themes/theme-nam-2025/resources/favicon/manifest.json +14 -0
  51. package/src/content/themes/theme-nam-2025/resources/favicon/site.webmanifest +21 -0
  52. package/src/content/themes/theme-nam-2025/resources/favicon/web-app-manifest-192x192.png +0 -0
  53. package/src/content/themes/theme-nam-2025/resources/favicon/web-app-manifest-512x512.png +0 -0
  54. package/src/content/themes/theme-nam-2025/theme-nam-2025.css +47 -0
  55. package/src/content/themes/theme-pennzoil/theme-pennzoil.css +36 -0
  56. package/src/content/themes/theme-quaker-state/theme-quaker-state.css +63 -0
  57. package/src/content/themes/theme-tafawoq/theme-tafawoq.css +26 -0
  58. package/src/content/themes/theme-vegetable/resources/favicon/apple-touch-icon.png +0 -0
  59. package/src/content/themes/theme-vegetable/resources/favicon/favico.ico +0 -0
  60. package/src/content/themes/theme-vegetable/resources/favicon/favicon-96x96.png +0 -0
  61. package/src/content/themes/theme-vegetable/resources/favicon/favicon.ico +0 -0
  62. package/src/content/themes/theme-vegetable/resources/favicon/favicon.png +0 -0
  63. package/src/content/themes/theme-vegetable/resources/favicon/favicon.svg +13 -0
  64. package/src/content/themes/theme-vegetable/resources/favicon/google-touch-icon.png +0 -0
  65. package/src/content/themes/theme-vegetable/resources/favicon/manifest.json +14 -0
  66. package/src/content/themes/theme-vegetable/resources/favicon/site.webmanifest +21 -0
  67. package/src/content/themes/theme-vegetable/resources/favicon/web-app-manifest-192x192.png +0 -0
  68. package/src/content/themes/theme-vegetable/resources/favicon/web-app-manifest-512x512.png +0 -0
  69. package/src/content/themes/theme-vegetable/theme-vegetable.css +49 -0
  70. package/src/content/themes/theme-zeolyst/resources/fonts/type-ar-medium.woff2 +0 -0
  71. package/src/content/themes/theme-zeolyst/theme-zeolyst.css +29 -0
  72. package/src/main/atoms/audio.js +16 -0
  73. package/src/main/atoms/box.js +5 -0
  74. package/src/main/atoms/button.js +40 -0
  75. package/src/main/atoms/card.js +22 -0
  76. package/src/main/atoms/form.js +30 -0
  77. package/src/main/atoms/heading.js +17 -0
  78. package/src/main/atoms/icon.js +24 -0
  79. package/src/main/atoms/img.js +131 -0
  80. package/src/main/atoms/input.js +55 -0
  81. package/src/main/atoms/link-text.js +21 -0
  82. package/src/main/atoms/link.js +60 -0
  83. package/src/main/atoms/list.js +12 -0
  84. package/src/main/atoms/logo.js +9 -0
  85. package/src/main/atoms/menu.js +10 -0
  86. package/src/main/atoms/message.js +5 -0
  87. package/src/main/atoms/nav-link.js +49 -0
  88. package/src/main/atoms/popup.js +47 -0
  89. package/src/main/atoms/rich-text.js +128 -0
  90. package/src/main/atoms/scroller.js +224 -0
  91. package/src/main/atoms/svg.js +65 -0
  92. package/src/main/atoms/table.js +32 -0
  93. package/src/main/atoms/textarea.js +10 -0
  94. package/src/main/atoms/time.js +12 -0
  95. package/src/main/atoms/video.js +100 -0
  96. package/src/main/export-main.js +12 -0
  97. package/src/main/export-matter.js +86 -0
  98. package/src/main/export-preact-hooks.js +1 -0
  99. package/src/main/export-preact.js +1 -0
  100. package/src/main/index.js +13 -0
  101. package/src/main/molecules/asset.js +23 -0
  102. package/src/main/molecules/glossary.js +44 -0
  103. package/src/main/molecules/links.js +23 -0
  104. package/src/main/molecules/promo-text.js +27 -0
  105. package/src/main/molecules/tags.js +15 -0
  106. package/src/main/molecules/tree.js +51 -0
  107. package/src/main/organisms/accordion-item.js +106 -0
  108. package/src/main/organisms/author.js +29 -0
  109. package/src/main/organisms/breadcrumb.js +69 -0
  110. package/src/main/organisms/call-to-action.js +24 -0
  111. package/src/main/organisms/carousel.js +178 -0
  112. package/src/main/organisms/cart-item.js +156 -0
  113. package/src/main/organisms/cart.js +162 -0
  114. package/src/main/organisms/contact-form.js +141 -0
  115. package/src/main/organisms/container/ab-test.js +47 -0
  116. package/src/main/organisms/container/default.js +6 -0
  117. package/src/main/organisms/container/filtered-section.js +293 -0
  118. package/src/main/organisms/container/footer.js +12 -0
  119. package/src/main/organisms/container/grid.js +44 -0
  120. package/src/main/organisms/container/header.js +13 -0
  121. package/src/main/organisms/container/list.js +7 -0
  122. package/src/main/organisms/container/main.js +6 -0
  123. package/src/main/organisms/container/raw.js +7 -0
  124. package/src/main/organisms/container/section.js +28 -0
  125. package/src/main/organisms/container.js +29 -0
  126. package/src/main/organisms/content-owner.js +15 -0
  127. package/src/main/organisms/date-entry.js +56 -0
  128. package/src/main/organisms/external-search.js +73 -0
  129. package/src/main/organisms/filtered-item.js +163 -0
  130. package/src/main/organisms/footer-item.js +17 -0
  131. package/src/main/organisms/image-gallery.js +164 -0
  132. package/src/main/organisms/last-modified.js +20 -0
  133. package/src/main/organisms/legal-footer.js +16 -0
  134. package/src/main/organisms/list-item.js +48 -0
  135. package/src/main/organisms/metadata.js +11 -0
  136. package/src/main/organisms/navigation.js +232 -0
  137. package/src/main/organisms/notification.js +87 -0
  138. package/src/main/organisms/order-tracker.js +203 -0
  139. package/src/main/organisms/page-header-banner.js +26 -0
  140. package/src/main/organisms/page-header.js +33 -0
  141. package/src/main/organisms/page-tags.js +14 -0
  142. package/src/main/organisms/page.js +260 -0
  143. package/src/main/organisms/press-release.js +24 -0
  144. package/src/main/organisms/product-admin.js +204 -0
  145. package/src/main/organisms/promo-banner.js +28 -0
  146. package/src/main/organisms/promo-bottom.js +23 -0
  147. package/src/main/organisms/promo-button.js +8 -0
  148. package/src/main/organisms/promo-card-cover.js +35 -0
  149. package/src/main/organisms/promo-card.js +33 -0
  150. package/src/main/organisms/promo-full.js +20 -0
  151. package/src/main/organisms/promo-image.js +22 -0
  152. package/src/main/organisms/promo-lure.js +22 -0
  153. package/src/main/organisms/promo-product-card.js +187 -0
  154. package/src/main/organisms/promo-product-full.js +293 -0
  155. package/src/main/organisms/promo-simple.js +23 -0
  156. package/src/main/organisms/quote.js +21 -0
  157. package/src/main/organisms/search-form.js +42 -0
  158. package/src/main/organisms/search-nav.js +66 -0
  159. package/src/main/organisms/search-result.js +53 -0
  160. package/src/main/organisms/slider.js +26 -0
  161. package/src/main/organisms/standalone-asset.js +22 -0
  162. package/src/main/organisms/tabs.js +277 -0
  163. package/src/main/organisms/topbar.js +83 -0
  164. package/src/main/organisms/web-component.js +53 -0
  165. package/src/main/routing/annotation.js +9 -0
  166. package/src/main/routing/component.js +138 -0
  167. package/src/main/routing/empty.js +5 -0
  168. package/src/main/routing/error-handler.js +64 -0
  169. package/src/main/routing/placeholder-image.svg +5 -0
  170. package/src/main/routing/router.js +219 -0
  171. package/src/main/shared/analytics.js +677 -0
  172. package/src/main/shared/bubble-event.js +11 -0
  173. package/src/main/shared/custom-element.js +21 -0
  174. package/src/main/shared/deep-selector.js +28 -0
  175. package/src/main/shared/disable-transparency.js +10 -0
  176. package/src/main/shared/format-time.js +8 -0
  177. package/src/main/shared/get-id.js +5 -0
  178. package/src/main/shared/get-meta.js +3 -0
  179. package/src/main/shared/get-size-class.js +3 -0
  180. package/src/main/shared/get-size.js +11 -0
  181. package/src/main/shared/h.js +88 -0
  182. package/src/main/shared/hash-jump.js +33 -0
  183. package/src/main/shared/icons/arrow-back.svg +1 -0
  184. package/src/main/shared/icons/arrow-down.svg +1 -0
  185. package/src/main/shared/icons/arrow-next.svg +1 -0
  186. package/src/main/shared/icons/arrow-tail-right.svg +1 -0
  187. package/src/main/shared/icons/arrow-tail-up.svg +1 -0
  188. package/src/main/shared/icons/arrow-up.svg +1 -0
  189. package/src/main/shared/icons/asset-download.svg +1 -0
  190. package/src/main/shared/icons/logo.svg +5 -0
  191. package/src/main/shared/icons/low-carbon-placeholder.svg +9 -0
  192. package/src/main/shared/icons/media-pause.svg +1 -0
  193. package/src/main/shared/icons/media-play.svg +1 -0
  194. package/src/main/shared/icons/navigation-burger.svg +1 -0
  195. package/src/main/shared/icons/navigation-close.svg +1 -0
  196. package/src/main/shared/icons/navigation-link.svg +1 -0
  197. package/src/main/shared/icons/navigation-refresh.svg +1 -0
  198. package/src/main/shared/icons/navigation-search.svg +1 -0
  199. package/src/main/shared/icons/navigation-share.svg +1 -0
  200. package/src/main/shared/icons/toggle-newwindow.svg +1 -0
  201. package/src/main/shared/icons.js +18 -0
  202. package/src/main/shared/id-from-string.js +5 -0
  203. package/src/main/shared/mark-selection.js +19 -0
  204. package/src/main/shared/register.js +26 -0
  205. package/src/main/shared/renderer.js +43 -0
  206. package/src/main/shared/simple-consent-api.js +70 -0
  207. package/src/main/shared/split-links.js +11 -0
  208. package/src/main/shared/t.js +60 -0
  209. package/src/main/shared/twind.js +837 -0
  210. package/src/main/shared/update-head.js +34 -0
  211. package/src/main/shared/update-scrollbar-width.js +30 -0
  212. package/src/main/shared/use-link.js +151 -0
  213. package/src/main/shared/use-persistent-state.js +42 -0
  214. package/src/main/shared/wait-for-dom-ready.js +6 -0
  215. package/src/main/shared/wcm-mode.js +4 -0
  216. package/src/wcs/components/acinguiux-preact-doc/acinguiux-preact-doc.js +207 -0
  217. package/src/wcs/components/admin-dashboard/admin-dashboard.js +487 -0
  218. package/src/wcs/components/admin-login/admin-login.js +91 -0
  219. package/src/wcs/components/bazaar-voice/bazaar-voice.js +56 -0
  220. package/src/wcs/components/chatbot-koreai/chatbot-koreai.js +176 -0
  221. package/src/wcs/components/chatbot-koreai/koreai-transport.js +217 -0
  222. package/src/wcs/components/chatbot-ms/chatbot-ms.js +210 -0
  223. package/src/wcs/components/chatbot-test/chatbot-test.js +44 -0
  224. package/src/wcs/components/comparison-chart/comparison-chart.js +111 -0
  225. package/src/wcs/components/consent-banner/consent-banner.js +248 -0
  226. package/src/wcs/components/consent-banner/icons/ccpa.svg +6 -0
  227. package/src/wcs/components/consent-banner/icons/info.svg +1 -0
  228. package/src/wcs/components/consent-banner/provider-onetrust.js +131 -0
  229. package/src/wcs/components/decision-tree/arrow-back.svg +3 -0
  230. package/src/wcs/components/decision-tree/badges.js +37 -0
  231. package/src/wcs/components/decision-tree/decision-tree.js +162 -0
  232. package/src/wcs/components/dynamic-contact-details/dynamic-contact-details.js +111 -0
  233. package/src/wcs/components/example-accordion/example-accordion.js +10 -0
  234. package/src/wcs/components/example-asset/example-asset.js +12 -0
  235. package/src/wcs/components/example-form/example-form.js +59 -0
  236. package/src/wcs/components/example-nested/example-nested.js +10 -0
  237. package/src/wcs/components/example-routing/example-routing.js +51 -0
  238. package/src/wcs/components/example-rtl/example-rtl.js +28 -0
  239. package/src/wcs/components/example-tabs/example-tabs.js +12 -0
  240. package/src/wcs/components/example-web-component/example-web-component.js +34 -0
  241. package/src/wcs/components/floating-button/floating-button.js +17 -0
  242. package/src/wcs/components/formstack-form/fields/address.js +38 -0
  243. package/src/wcs/components/formstack-form/fields/checkbox.js +42 -0
  244. package/src/wcs/components/formstack-form/fields/date.js +22 -0
  245. package/src/wcs/components/formstack-form/fields/description.js +8 -0
  246. package/src/wcs/components/formstack-form/fields/input.js +8 -0
  247. package/src/wcs/components/formstack-form/fields/name.js +39 -0
  248. package/src/wcs/components/formstack-form/fields/radio.js +24 -0
  249. package/src/wcs/components/formstack-form/fields/rating.js +53 -0
  250. package/src/wcs/components/formstack-form/fields/section.js +8 -0
  251. package/src/wcs/components/formstack-form/fields/select.js +10 -0
  252. package/src/wcs/components/formstack-form/fields/textarea.js +8 -0
  253. package/src/wcs/components/formstack-form/fields/wrapper.js +11 -0
  254. package/src/wcs/components/formstack-form/formstack-form.js +280 -0
  255. package/src/wcs/components/fuel-prices/fuel-prices.js +45 -0
  256. package/src/wcs/components/furniture-overview/furniture-overview.js +115 -0
  257. package/src/wcs/components/gauge-value/gauge-value.js +65 -0
  258. package/src/wcs/components/help-centre/api.js +150 -0
  259. package/src/wcs/components/help-centre/help-centre.js +400 -0
  260. package/src/wcs/components/help-centre/icon-search.svg +1 -0
  261. package/src/wcs/components/image-gen/admin-panel.js +248 -0
  262. package/src/wcs/components/image-gen/image-gen.js +385 -0
  263. package/src/wcs/components/image-gen/labels.js +37 -0
  264. package/src/wcs/components/image-gen/use-api.js +392 -0
  265. package/src/wcs/components/inspired-gallery/inspired-gallery.js +118 -0
  266. package/src/wcs/components/launch-container/launch-container.js +95 -0
  267. package/src/wcs/components/launch-container/ledger.js +140 -0
  268. package/src/wcs/components/lng-map/lng-map.js +44 -0
  269. package/src/wcs/components/mouseflow-analytics/mouseflow-analytics.js +39 -0
  270. package/src/wcs/components/msds-search/msds-search.js +127 -0
  271. package/src/wcs/components/msds-search/navigation-search.svg +3 -0
  272. package/src/wcs/components/product-catalogue/icon-back.svg +3 -0
  273. package/src/wcs/components/product-catalogue/icon-cart.svg +3 -0
  274. package/src/wcs/components/product-catalogue/icon-close.svg +3 -0
  275. package/src/wcs/components/product-catalogue/product-catalogue.js +215 -0
  276. package/src/wcs/components/product-links/icon-cart.svg +3 -0
  277. package/src/wcs/components/product-links/product-links.js +43 -0
  278. package/src/wcs/components/rio-iframe/rio-iframe.js +137 -0
  279. package/src/wcs/components/salsify-products/filter-tools.js +60 -0
  280. package/src/wcs/components/salsify-products/icon-cart.svg +3 -0
  281. package/src/wcs/components/salsify-products/process-products.js +53 -0
  282. package/src/wcs/components/salsify-products/route-tools.js +54 -0
  283. package/src/wcs/components/salsify-products/salsify-products.js +281 -0
  284. package/src/wcs/components/shout-out/shout-out.js +51 -0
  285. package/src/wcs/components/simple-chart/simple-chart.js +53 -0
  286. package/src/wcs/components/single-stat/single-stat.js +85 -0
  287. package/src/wcs/components/site-feedback/site-feedback.js +56 -0
  288. package/src/wcs/components/skds-search/navigation-search.svg +3 -0
  289. package/src/wcs/components/skds-search/skds-search.js +103 -0
  290. package/src/wcs/components/smart-banner/smart-banner.js +104 -0
  291. package/src/wcs/components/standalone-table/arrow-up-down.svg +3 -0
  292. package/src/wcs/components/standalone-table/arrow-up.svg +3 -0
  293. package/src/wcs/components/standalone-table/standalone-table.js +440 -0
  294. package/src/wcs/components/station-locator/station-locator.js +49 -0
  295. package/src/wcs/components/store-badges/badges.js +60 -0
  296. package/src/wcs/components/store-badges/store-badges.js +93 -0
  297. package/src/wcs/components/topbar-button/person.svg +1 -0
  298. package/src/wcs/components/topbar-button/topbar-button.js +22 -0
  299. package/src/wcs/components/universal-gallery/universal-gallery.js +308 -0
  300. package/src/wcs/components/zendesk-chat/zendesk-chat.js +133 -0
  301. package/src/wcs/shared/chat-bot/README.md +61 -0
  302. package/src/wcs/shared/chat-bot/chat-bot.js +216 -0
  303. package/src/wcs/shared/chat-bot/resources/arrow-next.svg +1 -0
  304. package/src/wcs/shared/chat-bot/resources/navigation-close.svg +1 -0
  305. package/src/wcs/shared/chat-bot/resources/person.svg +1 -0
  306. package/src/wcs/shared/chat-bot/resources/upload.svg +1 -0
  307. package/src/wcs/shared/filtered-data/README.md +52 -0
  308. package/src/wcs/shared/filtered-data/fetch-data.js +33 -0
  309. package/src/wcs/shared/filtered-data/filtered-data.js +337 -0
  310. package/src/wcs/shared/promo-with-popup/icon-close.svg +3 -0
  311. package/src/wcs/shared/promo-with-popup/icon-next.svg +3 -0
  312. package/src/wcs/shared/promo-with-popup/icon-prev.svg +3 -0
  313. package/src/wcs/shared/promo-with-popup/promo-with-popup.js +93 -0
@@ -0,0 +1,837 @@
1
+ /**
2
+ * @file Fast minimalist utility-first CSS runtime inspired by Tailwind and Twind.
3
+ * @author Michal Kochel
4
+ */
5
+ import { LOGO } from './icons.js'
6
+
7
+ const SIZES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 96, 128]
8
+ const TWELVE = SIZES.slice(1, 13)
9
+ const WIDTHS = [0, 1, 2, 4, 8]
10
+ const OPACITIES = [0, 5, 10, 20, 25, 30, 40, 50, 60, 70, 75, 80, 90, 95, 100]
11
+ const STATES = ['hover', 'focus', 'focus-visible', 'active']
12
+ const PALETTES = ['brand1', 'brand2', 'brand3', 'brand4', 'brand5', 'system']
13
+ const HIGH_PRIORITY_RULES = ['col-start', 'row-start', 'hidden', '-none']
14
+
15
+ const SIZES_FRAC = [
16
+ ['1/2', 1 / 2],
17
+ ['1/3', 1 / 3],
18
+ ['2/3', 2 / 3],
19
+ ['1/4', 1 / 4],
20
+ ['3/4', 3 / 4],
21
+ ['1/5', 1 / 5],
22
+ ['2/5', 2 / 5],
23
+ ['3/5', 3 / 5],
24
+ ['4/5', 4 / 5]
25
+ ]
26
+
27
+ const RADII = [
28
+ ['-none', 0],
29
+ ['-sm', '3px'],
30
+ ['', '4px'],
31
+ ['-md', '6px'],
32
+ ['-lg', '8px'],
33
+ ['-xl', '12px'],
34
+ ['-2xl', '16px'],
35
+ ['-3xl', '24px'],
36
+ ['-full', '50%']
37
+ ]
38
+
39
+ const PIXEL_STEP = 4
40
+ export const MEDIUM = 600
41
+ export const LARGE = 960
42
+
43
+ const MEDIA_QUERIES = {
44
+ sm: `@media screen and (max-width: ${MEDIUM - 1}px)`,
45
+ md: `@media screen and (min-width: ${MEDIUM}px) and (max-width: ${LARGE - 1}px)`,
46
+ lg: `@media screen and (min-width: ${LARGE}px)`,
47
+ dark: '@media (prefers-color-scheme: dark)',
48
+ print: '@media print',
49
+ }
50
+
51
+ const CLASS_PARSER = new RegExp(`((?<mq>${Object.keys(MEDIA_QUERIES).join('|')}):)?((?<state>${STATES.join('|')}):)?(?<util>.+)`)
52
+
53
+ const COLORS = {
54
+ bga: 'var(--color-bga)',
55
+ bgb: 'var(--color-bgb)',
56
+ txa: 'var(--color-txa)',
57
+ txb: 'var(--color-txb)',
58
+ txc: 'var(--color-txc)'
59
+ }
60
+
61
+ const ANIMATIONS = {
62
+ expand: `
63
+ from { opacity: 0; transform: translateY(-8px) }
64
+ to { opacity: 1 }
65
+ `,
66
+ toast: `
67
+ from { opacity: 0; transform: translateY(48px) }
68
+ to { opacity: 1 }
69
+ `,
70
+ fade: `
71
+ 0% { opacity: 0 }
72
+ 100% { opacity: 1 }
73
+ `
74
+ }
75
+
76
+ const CONFIG = `:root {
77
+ /* Misc */
78
+ --acinguiux-preact: 1;
79
+ --page-width: 1300px;
80
+ --nav-width: 1400px;
81
+ --anim-time: 250ms;
82
+
83
+ /* Fonts */
84
+ --font-default: Arial, Roboto, Helvetica, sans-serif;
85
+ --font-custom: custom-font;
86
+ --font-scale: 1;
87
+
88
+ /* Logo */
89
+ --logo: url("data:image/svg+xml;utf-8,${encodeURIComponent(LOGO)}");
90
+ --logo-ratio: 1;
91
+
92
+ /* Borders */
93
+ --radius-tl-scale: 1;
94
+ --radius-tr-scale: 1;
95
+ --radius-br-scale: 1;
96
+ --radius-bl-scale: 1;
97
+
98
+ /* Transparency */
99
+ --bg-alpha: 1;
100
+ --text-alpha: 1;
101
+ --border-alpha: 1;
102
+ --decoration-alpha: 1;
103
+ --outline-alpha: 1;
104
+
105
+ /* Reference colours (paper & ink == background & text) */
106
+ --color-paper1: 0, 0%, 100%;
107
+ --color-paper2: 0, 0%, 96%;
108
+ --color-ink1: 0, 0%, 29%;
109
+ --color-ink2: var(--color-ink1);
110
+
111
+ /* Theme colours */
112
+ --color-brand1-bg: 47, 100%, 50%;
113
+ --color-brand1-text: var(--color-ink1);
114
+ --color-brand2-bg: 359, 77%, 49%;
115
+ --color-brand2-text: var(--color-paper1);
116
+ --color-brand3-bg: 212, 49%, 39%;
117
+ --color-brand3-text: var(--color-paper1);
118
+ --color-brand4-bg: 159, 100%, 26%;
119
+ --color-brand4-text: var(--color-paper1);
120
+ --color-brand5-bg: 306, 61%, 33%;
121
+ --color-brand5-text: var(--color-paper1);
122
+ --color-system-bg: 210, 78%, 16%;
123
+ --color-system-text: 0, 0%, 100%;
124
+ --color-black-bg: 0, 0%, 0%;
125
+ --color-black-text: var(--color-paper1);
126
+
127
+ /* Set default colour to brand1 */
128
+ --color-bga: var(--color-paper1);
129
+ --color-txa: var(--color-ink1);
130
+ --color-bgb: var(--color-brand1-bg);
131
+ --color-txb: var(--color-brand1-text);
132
+ --color-txc: var(--color-ink2);
133
+
134
+ /* Apply default colours */
135
+ color: hsl(var(--color-ink1));
136
+ background: hsl(var(--color-paper1));
137
+ }`
138
+
139
+ const BASE = [
140
+ '*, *::before, *::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: currentColor; margin: 0; padding: 0 }',
141
+ 'ul, ol { list-style: none }',
142
+ 'h1,h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit }',
143
+ 'input, button, textarea, select { font: inherit }',
144
+ 'body, html { height: 100% }',
145
+ 'img, video { max-width: 100%; height: auto }',
146
+ 'cite { font-style: normal }',
147
+ 'a { text-decoration: none; color: inherit }',
148
+ 'button { text-align: unset; align-items: unset; background: transparent; color: inherit }',
149
+ 'html { overflow: auto }',
150
+ // Stable gutter prevents layout shift when setting overflow to hidden (e.g. when opening a modal).
151
+ 'body { overflow-y: scroll; scrollbar-gutter: stable }',
152
+ 'svg { display: block }',
153
+ '::placeholder { color: currentColor; opacity: 0.8 }',
154
+ 'caption { text-align: left }',
155
+ '* { scrollbar-color: currentColor transparent }',
156
+ // Fix modal and non-modal dialog discrepancies.
157
+ 'dialog { position: fixed; inset-block-start: 0; inset-block-end: 0; max-width: none; max-height: none }',
158
+ // Use default scroll for print styles.
159
+ '@media print { html { overflow-y: scroll !important } }',
160
+ '@media print { body { overflow-y: visible !important } }'
161
+ ]
162
+
163
+ // -----------------------------------------------------------------------------
164
+ // Utility classes
165
+ // -----------------------------------------------------------------------------
166
+
167
+ export const UTILS = new Map([
168
+ // acinguiux-preact
169
+ ...genp('pal'),
170
+ ['font-custom', '{ font-family: var(--font-custom), var(--font-default) }'],
171
+ ['max-w-page', '{ max-width: var(--page-width) }'],
172
+ ['cq-dd-image', '{}'], // Required by AEM for the drag-and-drop to work.
173
+ ['clickable', '{}'], // Analytics clickable identifier.
174
+ ['scrollbar-stable', '{ scrollbar-gutter: stable }'],
175
+ // ---------------------------------------------------------------------------
176
+ // Layout - aspect-ratio
177
+ ['aspect-auto', '{ aspect-ratio: auto }'],
178
+ ['aspect-square', '{ aspect-ratio: 1 / 1 }'],
179
+ ['aspect-video', '{ aspect-ratio: 16 / 9 }'],
180
+ ['aspect-4/3', '{ aspect-ratio: 4 / 3 }'],
181
+ // Layout - columns
182
+ ...gen(ii => [`columns-${ii}`, `columns: ${ii}`], [...TWELVE, 'auto']),
183
+ // Layout - break-after
184
+ ...gen(ii => [`break-after-${ii}`, `break-after: ${ii}`], ['auto', 'avoid', 'all', 'avoid-page', 'page', 'left', 'right', 'column']),
185
+ // Layout - break-before
186
+ ...gen(ii => [`break-before-${ii}`, `break-before: ${ii}`], ['auto', 'avoid', 'all', 'avoid-page', 'page', 'left', 'right', 'column']),
187
+ // Layout - break-inside
188
+ ...gen(ii => [`break-inside-${ii}`, `break-inside: ${ii}`], ['auto', 'avoid', 'avoid-page', 'avoid-column']),
189
+ // Layout - box-decoration-break
190
+ ...gen(ii => [`box-decoration-${ii}`, `box-decoration-break: ${ii}`], ['clone', 'slice']),
191
+ // Layout - box-sizing
192
+ ...gen(ii => [`box-${ii}`, `box-sizing: ${ii}-box`], ['border', 'content']),
193
+ // Layout - display
194
+ ...gen(ii => [`${ii}`, `display: ${ii}`], ['inline', 'block', 'inline-block', 'flow-root', 'flex', 'inline-flex', 'grid', 'inline-grid', 'contents', 'table', 'inline-table', 'list-item']),
195
+ ['hidden', '{ display: none }'],
196
+ ['sr-only', '{ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0 }'],
197
+ ['not-sr-only', '{ position: static; width: auto; height: auto; padding: 0; margin: 0; overflow: visible; clip: auto; white-space: normal }'],
198
+ // Layout - float
199
+ ...gen(ii => [`float-${ii}`, `float: inline-${ii}`], ['start', 'end']),
200
+ ...gen(ii => [`float-${ii}`, `float: ${ii}`], ['left', 'right', 'none']),
201
+ // Layout - clear
202
+ ...gen(ii => [`clear-${ii}`, `clear: inline-${ii}`], ['start', 'end']),
203
+ ...gen(ii => [`clear-${ii}`, `clear: ${ii}`], ['left', 'right', 'both', 'none']),
204
+ // Layout - isolation
205
+ ['isolate', '{ isolation: isolate }'],
206
+ ['isolation-auto', '{ isolation: auto }'],
207
+ // Layout - object-fit
208
+ ...gen(ii => [`object-${ii}`, `object-fit: ${ii}`], ['contain', 'cover', 'fill', 'none', 'scale-down']),
209
+ // Layout - object-position
210
+ ...gen(ii => [`object-${ii.replaceAll(' ', '-')}`, `object-position: ${ii}`], ['bottom', 'center', 'left', 'left bottom', 'left top', 'right', 'right bottom', 'right top', 'top']),
211
+ // Layout - overflow
212
+ ...gen(ii => [`overflow-${ii}`, `overflow: ${ii}`], ['auto', 'hidden', 'clip', 'visible', 'scroll', 'visible']),
213
+ ...gen(ii => [`overflow-x-${ii}`, `overflow-x: ${ii}`], ['auto', 'hidden', 'clip', 'visible', 'scroll', 'visible']),
214
+ ...gen(ii => [`overflow-y-${ii}`, `overflow-y: ${ii}`], ['auto', 'hidden', 'clip', 'visible', 'scroll', 'visible']),
215
+ // Layout - overscroll-behavior
216
+ ...gen(ii => [`overscroll-${ii}`, `overscroll-behavior: ${ii}`], ['auto', 'contain', 'none']),
217
+ ...gen(ii => [`overscroll-x-${ii}`, `overscroll-behavior-x: ${ii}`], ['auto', 'contain', 'none']),
218
+ ...gen(ii => [`overscroll-y-${ii}`, `overscroll-behavior-y: ${ii}`], ['auto', 'contain', 'none']),
219
+ // Layout - position
220
+ ...gen(ii => [`${ii}`, `position: ${ii}`], ['static', 'fixed', 'absolute', 'relative', 'sticky']),
221
+ // Layout - top / right / bottom / left
222
+ ...gens('top'),
223
+ ...gens('right'),
224
+ ...gens('bottom'),
225
+ ...gens('left'),
226
+ ...gens('start', { prop: 'inset-inline-start' }),
227
+ ...gens('end', { prop: 'inset-inline-end' }),
228
+ ...gens('inset', { prop: 'inset' }),
229
+ // Layout - visibility
230
+ ['visible', '{ visibility: visible }'],
231
+ ['invisible', '{ visibility: hidden }'],
232
+ ['collapse', '{ visibility: collapse }'],
233
+ // Layout - z-index
234
+ ...gen(ii => [`z-${ii}`, `z-index: ${ii}`], [0, 10, 20, 30, 40, 50, 'auto']),
235
+ // ---------------------------------------------------------------------------
236
+ // Flexbox & Grid - flex-basis
237
+ ...gens('basis', { prop: 'flex-basis' }),
238
+ // Flexbox & Grid - flex-direction
239
+ ['flex-row', '{ flex-direction: row }'],
240
+ ['flex-row-reverse', '{ flex-direction: row-reverse }'],
241
+ ['flex-col', '{ flex-direction: column }'],
242
+ ['flex-col-reverse', '{ flex-direction: column-reverse }'],
243
+ // Flexbox & Grid - flex-wrap
244
+ ...gen(ii => [`flex-${ii}`, `flex-wrap: ${ii}`], ['nowrap', 'wrap', 'wrap-reverse']),
245
+ // Flexbox & Grid - flex
246
+ ['flex-1', '{ flex: 1 }'],
247
+ ['flex-auto', '{ flex: 1 1 auto }'],
248
+ ['flex-initial', '{ flex: 0 1 auto }'],
249
+ ['flex-none', '{ flex: none }'],
250
+ // Flexbox & Grid - flex-grow
251
+ ['grow', '{ flex-grow: 1 }'],
252
+ ['grow-0', '{ flex-grow: 0 }'],
253
+ // Flexbox & Grid - flex-shrink
254
+ ['shrink', '{ flex-shrink: 1 }'],
255
+ ['shrink-0', '{ flex-shrink: 0 }'],
256
+ // Flexbox & Grid - order
257
+ ...gen(ii => [`order-${ii}`, `order: ${ii}`], TWELVE),
258
+ ['order-first', '{ order: -9999 }'],
259
+ ['order-last', '{ order: 9999 }'],
260
+ ['order-none', '{ order: 0 }'],
261
+ // Flexbox & Grid - grid-template-columns
262
+ ...gen(ii => [`grid-cols-${ii}`, `grid-template-columns: repeat(${ii}, minmax(0, 1fr))`], TWELVE),
263
+ ['grid-cols-none', '{ grid-template-columns: none }'],
264
+ ['grid-cols-subgrid', '{ grid-template-columns: subgrid }'],
265
+ // Flexbox & Grid - grid-column
266
+ ['col-auto', '{ grid-column: auto }'],
267
+ ...gen(ii => [`col-span-${ii}`, `grid-column: span ${ii} / span ${ii}`], TWELVE),
268
+ ['col-span-full', '{ grid-column: 1 / -1 }'],
269
+ ['col-start-auto', '{ grid-column-start: auto }'],
270
+ ...gen(ii => [`col-start-${ii}`, `grid-column-start: ${ii}`], [...TWELVE, 13]),
271
+ // Flexbox & Grid - grid-template-rows
272
+ ...gen(ii => [`grid-rows-${ii}`, `grid-template-rows: repeat(${ii}, auto)`], TWELVE),
273
+ ['grid-rows-none', '{ grid-template-rows: none }'],
274
+ ['grid-rows-subgrid', '{ grid-template-rows: subgrid }'],
275
+ // Flexbox & Grid - grid-row
276
+ ['row-auto', '{ grid-row: auto }'],
277
+ ...gen(ii => [`row-span-${ii}`, `grid-row: span ${ii} / span ${ii}`], TWELVE),
278
+ ['row-span-full', '{ grid-row: 1 / -1 }'],
279
+ ['row-start-auto', '{ grid-row-start: auto }'],
280
+ ...gen(ii => [`row-start-${ii}`, `grid-row-start: ${ii}`], [...TWELVE, 13]),
281
+ // Flexbox & Grid - grid-auto-flow
282
+ ['grid-flow-row', '{ grid-auto-flow: row }'],
283
+ ['grid-flow-col', '{ grid-auto-flow: column }'],
284
+ ['grid-flow-dense', '{ grid-auto-flow: dense }'],
285
+ ['grid-flow-row-dense', '{ grid-auto-flow: row dense }'],
286
+ ['grid-flow-col-dense', '{ grid-auto-flow: column dense }'],
287
+ // Flexbox & Grid - grid-auto-columns
288
+ ['auto-cols-auto', '{ grid-auto-columns: auto }'],
289
+ ['auto-cols-min', '{ grid-auto-columns: min-content }'],
290
+ ['auto-cols-max', '{ grid-auto-columns: max-content }'],
291
+ ['auto-cols-fr', '{ grid-auto-columns: minmax(0, 1fr) }'],
292
+ // Flexbox & Grid - grid-auto-rows
293
+ ['auto-rows-auto', '{ grid-auto-rows: auto }'],
294
+ ['auto-rows-min', '{ grid-auto-rows: min-content }'],
295
+ ['auto-rows-max', '{ grid-auto-rows: max-content }'],
296
+ ['auto-rows-fr', '{ grid-auto-rows: minmax(0, 1fr) }'],
297
+ // Flexbox & Grid - gap
298
+ ...gens('gap', { fractions: false }),
299
+ ['gap-px', '{ gap: 1px }'],
300
+ ...gens('gap-x', { prop: 'column-gap', fractions: false }),
301
+ ['gap-x-px', '{ column-gap: 1px }'],
302
+ ...gens('gap-y', { prop: 'row-gap', fractions: false }),
303
+ ['gap-y-px', '{ row-gap: 1px }'],
304
+ // Flexbox & Grid - justify-content
305
+ ['justify-start', '{ justify-content: flex-start }'],
306
+ ['justify-end', '{ justify-content: flex-end }'],
307
+ ['justify-center', '{ justify-content: center }'],
308
+ ['justify-between', '{ justify-content: space-between }'],
309
+ ['justify-around', '{ justify-content: space-around }'],
310
+ ['justify-evenly', '{ justify-content: space-evenly }'],
311
+ ['justify-stretch', '{ justify-content: stretch }'],
312
+ ['justify-baseline', '{ justify-content: baseline }'],
313
+ ['justify-normal', '{ justify-content: normal }'],
314
+ // Flexbox & Grid - justify-items
315
+ ...gen(ii => [`justify-items-${ii}`, `justify-items: ${ii}`], ['start', 'end', 'center', 'stretch', 'normal']),
316
+ // Flexbox & Grid - justify-self
317
+ ...gen(ii => [`justify-self-${ii}`, `justify-self: ${ii}`], ['auto', 'start', 'end', 'center', 'stretch']),
318
+ // Flexbox & Grid - align-content
319
+ ['content-normal', '{ align-content: normal }'],
320
+ ['content-center', '{ align-content: center }'],
321
+ ['content-start', '{ align-content: flex-start }'],
322
+ ['content-end', '{ align-content: flex-end }'],
323
+ ['content-between', '{ align-content: space-between }'],
324
+ ['content-around', '{ align-content: space-around }'],
325
+ ['content-evenly', '{ align-content: space-evenly }'],
326
+ ['content-baseline', '{ align-content: baseline }'],
327
+ ['content-stretch', '{ align-content: stretch }'],
328
+ // Flexbox & Grid - align-items
329
+ ['items-start', '{ align-items: flex-start }'],
330
+ ['items-end', '{ align-items: flex-end }'],
331
+ ['items-center', '{ align-items: center }'],
332
+ ['items-baseline', '{ align-items: baseline }'],
333
+ ['items-stretch', '{ align-items: stretch }'],
334
+ // Flexbox & Grid - align-self
335
+ ['self-auto', '{ align-self: auto }'],
336
+ ['self-start', '{ align-self: flex-start }'],
337
+ ['self-end', '{ align-self: flex-end }'],
338
+ ['self-center', '{ align-self: center }'],
339
+ ['self-stretch', '{ align-self: stretch }'],
340
+ ['self-baseline', '{ align-self: baseline }'],
341
+ // Flexbox & Grid - place-content
342
+ ['place-content-center', '{ place-content: center }'],
343
+ ['place-content-start', '{ place-content: flex-start }'],
344
+ ['place-content-end', '{ place-content: flex-end }'],
345
+ ['place-content-between', '{ place-content: space-between }'],
346
+ ['place-content-around', '{ place-content: space-around }'],
347
+ ['place-content-evenly', '{ place-content: space-evenly }'],
348
+ ['place-content-baseline', '{ place-content: baseline }'],
349
+ ['place-content-stretch', '{ place-content: stretch }'],
350
+ // Flexbox & Grid - place-items
351
+ ...gen(ii => [`place-items-${ii}`, `place-items: ${ii}`], ['start', 'end', 'center', 'baseline', 'stretch']),
352
+ // Flexbox & Grid - place-self
353
+ ...gen(ii => [`place-self-${ii}`, `place-self: ${ii}`], ['auto', 'start', 'end', 'center', 'stretch']),
354
+ // ---------------------------------------------------------------------------
355
+ // Spacing - padding
356
+ ...gens('p', { prop: 'padding', fractions: true }),
357
+ ...gens('px', { prop: 'padding-inline', fractions: true }),
358
+ ...gens('py', { prop: 'padding-block', fractions: true }),
359
+ ...gens('pt', { prop: 'padding-top', fractions: true }),
360
+ ...gens('pr', { prop: 'padding-right', fractions: true }),
361
+ ...gens('pb', { prop: 'padding-bottom', fractions: true }),
362
+ ...gens('pl', { prop: 'padding-left', fractions: true }),
363
+ ...gens('ps', { prop: 'padding-inline-start', fractions: true }),
364
+ ...gens('pe', { prop: 'padding-inline-end', fractions: true }),
365
+ // Spacing - margin
366
+ ...gens('m', { prop: 'margin', fractions: true }),
367
+ ...gens('mx', { prop: 'margin-inline', fractions: true }),
368
+ ...gens('my', { prop: 'margin-block', fractions: true }),
369
+ ...gens('mt', { prop: 'margin-top', fractions: true }),
370
+ ...gens('mr', { prop: 'margin-right', fractions: true }),
371
+ ...gens('ml', { prop: 'margin-left', fractions: true }),
372
+ ...gens('mb', { prop: 'margin-bottom', fractions: true }),
373
+ ...gens('ms', { prop: 'margin-inline-start', fractions: true }),
374
+ ...gens('me', { prop: 'margin-inline-end', fractions: true }),
375
+ ...gens('space-x', { prop: 'margin-inline-end', fractions: true, next: '> :not(:last-child) ' }),
376
+ ...gens('space-y', { prop: 'margin-bottom', fractions: true, next: '> :not(:last-child) ' }),
377
+
378
+ // Sizing - width
379
+ ...gens('w', { prop: 'width', fractions: true }),
380
+ // Sizing - min-width
381
+ ...gens('min-w', { prop: 'min-width', fractions: true }),
382
+ // Sizing - max-width
383
+ ...gens('max-w', { prop: 'max-width', fractions: true }),
384
+ // Sizing - height
385
+ ...gens('h', { prop: 'height', fractions: true }),
386
+ // Sizing - min-height
387
+ ...gens('min-h', { prop: 'min-height', fractions: true }),
388
+ // Sizing - max-height
389
+ ...gens('max-h', { prop: 'max-height', fractions: true }),
390
+ // ---------------------------------------------------------------------------
391
+ // Typography - font-family
392
+ ['font-sans', '{ font-family: var(--font-default) }'],
393
+ ['font-serif', '{ font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif }'],
394
+ ['font-mono', '{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace }'],
395
+ // Typography - font-size (customised)
396
+ ['text-xs', '{ font-size: calc(11px * var(--font-scale)); line-height: 1.5 }'],
397
+ ['text-sm', '{ font-size: calc(12px * var(--font-scale)); line-height: 1.5 }'],
398
+ ['text-base', '{ font-size: calc(14px * var(--font-scale)); line-height: 1.5 }'],
399
+ ['text-lg', '{ font-size: calc(16px * var(--font-scale)); line-height: 1.5 }'],
400
+ ['text-xl', '{ font-size: calc(18px * var(--font-scale)); line-height: 1.5 }'],
401
+ ['text-2xl', '{ font-size: calc(20px * var(--font-scale)); line-height: 1.5 }'],
402
+ ['text-3xl', '{ font-size: calc(28px * var(--font-scale)); line-height: 1.5 }'],
403
+ ['text-4xl', '{ font-size: calc(32px * var(--font-scale)); line-height: 1.5 }'],
404
+ ['text-5xl', '{ font-size: calc(36px * var(--font-scale)); line-height: 1.5 }'],
405
+ ['text-6xl', '{ font-size: calc(40px * var(--font-scale)); line-height: 1.5 }'],
406
+ ['text-7xl', '{ font-size: calc(44px * var(--font-scale)); line-height: 1.5 }'],
407
+ ['text-8xl', '{ font-size: calc(60px * var(--font-scale)); line-height: 1.5 }'],
408
+ ['text-9xl', '{ font-size: calc(68px * var(--font-scale)); line-height: 1.5 }'],
409
+ // Typography - font-smoothing
410
+ ['antialiased', '{ -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale }'],
411
+ ['subpixel-antialiased', '{ -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto }'],
412
+ // Typography - font-style
413
+ ['italic', '{ font-style: italic }'],
414
+ ['not-italic', '{ font-style: normal }'],
415
+ // Typography - font-weight
416
+ ['font-thin', '{ font-weight: 100 }'],
417
+ ['font-extralight', '{ font-weight: 200 }'],
418
+ ['font-light', '{ font-weight: 300 }'],
419
+ ['font-normal', '{ font-weight: 400 }'],
420
+ ['font-medium', '{ font-weight: 500 }'],
421
+ ['font-semibold', '{ font-weight: 600 }'],
422
+ ['font-bold', '{ font-weight: 700 }'],
423
+ ['font-extrabold', '{ font-weight: 800 }'],
424
+ ['font-black', '{ font-weight: 900 }'],
425
+ // Tpyography - font-stretch
426
+ ...gen(ii => [`font-stretch-${ii}`, `font-stretch: ${ii}`], ['ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded']),
427
+ // Typography - font-variant-numeric
428
+ ['normal-nums', '{ font-variant-numeric: normal }'],
429
+ ...gen(ii => [ii, `font-variant-numeric: ${ii}`], ['ordinal', 'slashed-zero', 'lining-nums', 'oldstyle-nums', 'proportional-nums', 'tabular-nums', 'diagonal-fractions', 'stacked-fractions']),
430
+ // Typography - letter-spacing
431
+ ['tracking-tighter', '{ letter-spacing: -0.05em }'],
432
+ ['tracking-tight', '{ letter-spacing: -0.025em }'],
433
+ ['tracking-normal', '{ letter-spacing: 0 }'],
434
+ ['tracking-wide', '{ letter-spacing: 0.025em }'],
435
+ ['tracking-wider', '{ letter-spacing: 0.05em }'],
436
+ ['tracking-widest', '{ letter-spacing: 0.1em }'],
437
+ // Typography - line-clamp
438
+ ...gen(ii => [`line-clamp-${ii}`, `overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: ${ii}`], [1, 2, 3, 4, 5, 6, 'none']),
439
+ // Typography - line-height
440
+ ['leading-none', '{ line-height: 1 }'],
441
+ ['leading-tight', '{ line-height: 1.25 }'],
442
+ ['leading-snug', '{ line-height: 1.375 }'],
443
+ ['leading-normal', '{ line-height: 1.5 }'],
444
+ ['leading-relaxed', '{ line-height: 1.625 }'],
445
+ ['leading-loose', '{ line-height: 2 }'],
446
+ // Typography - list-style
447
+ ['list-image-none', '{ list-style-image: none }'],
448
+ ['list-inside', '{ list-style-position: inside }'],
449
+ ['list-outside', '{ list-style-position: outside }'],
450
+ ['list-disc', '{ list-style-type: disc }'],
451
+ ['list-decimal', '{ list-style-type: decimal }'],
452
+ ['list-none', '{ list-style-type: none }'],
453
+ // Typography - text-align
454
+ ...gen(ii => [`text-${ii}`, `text-align: ${ii}`], ['left', 'center', 'right', 'justify', 'start', 'end']),
455
+ // Typography - text-color
456
+ ...genc('text', 'color'),
457
+ // Typography - text-decoration
458
+ ...gen(ii => [ii, `text-decoration: ${ii}`], ['underline', 'overline', 'line-through']),
459
+ ['no-underline', '{ text-decoration: none }'],
460
+ // Typography - text-decoration-color
461
+ ...genc('decoration', 'text-decoration-color'),
462
+ // Typography = text-decoration-style
463
+ ...gen(ii => [`decoration-${ii}`, `text-decoration-style: ${ii}`], ['solid', 'double', 'dotted', 'dashed', 'wavy']),
464
+ // Typography - text-decoration-thickness
465
+ ['decoration-auto', '{ text-decoration-thickness: auto }'],
466
+ ['decoration-from-font', '{ text-decoration-thickness: from-font }'],
467
+ ...gen(ii => [`decoration-${ii}`, `text-decoration-thickness: ${ii}px`], WIDTHS),
468
+ // Typography - text-underline-offset
469
+ ['underline-offset-auto', '{ text-underline-offset: auto }'],
470
+ ...gen(ii => [`underline-offset-${ii}`, `text-underline-offset: ${ii}px`], WIDTHS),
471
+ // Typography - text-transform
472
+ ...gen(ii => [`${ii}`, `text-transform: ${ii}`], ['uppercase', 'lowercase', 'capitalize']),
473
+ ['normal-case', '{ text-transform: none }'],
474
+ // Typography - text-overflow
475
+ ['truncate', '{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap }'],
476
+ ['overflow-ellipsis', '{ text-overflow: ellipsis }'],
477
+ ['overflow-clip', '{ text-overflow: clip }'],
478
+ // Typography - text-wrap
479
+ ...gen(ii => [`text-${ii}`, `text-wrap: ${ii}`], ['wrap', 'nowrap', 'balance', 'pretty']),
480
+ // Typography - text-indent
481
+ ...gens('indent', { prop: 'text-indent', fractions: false }),
482
+ // Typography - vertical-align
483
+ ...gen(ii => [`align-${ii}`, `vertical-align: ${ii}`], ['baseline', 'top', 'middle', 'bottom', 'text-top', 'text-bottom', 'sub', 'super']),
484
+ // Typography - white-space
485
+ ...gen(ii => [`whitespace-${ii}`, `white-space: ${ii}`], ['normal', 'nowrap', 'pre', 'pre-line', 'pre-wrap', 'break-spaces']),
486
+ // Typography - word-break
487
+ ['break-normal', '{ overflow-wrap: normal; word-break: normal }'],
488
+ ['break-words', '{ overflow-wrap: anywhere; word-break: normal }'],
489
+ ['break-all', '{ word-break: break-all }'],
490
+ ['break-keep', '{ word-break: keep-all }'],
491
+ // Typography - hyphens
492
+ ...gen(ii => [`hyphens-${ii}`, `hyphens: ${ii}`], ['none', 'manual', 'auto']),
493
+ // Typography - content
494
+ ['content-none', '{ content: none }'],
495
+ // ---------------------------------------------------------------------------
496
+ // Backgrounds - background-attachment
497
+ ...gen(ii => [`bg-${ii}`, `background-attachment: ${ii}`], ['fixed', 'local', 'scroll']),
498
+ // Backgrounds - background-clip
499
+ ['bg-clip-border', '{ background-clip: border-box }'],
500
+ ['bg-clip-padding', '{ background-clip: padding-box }'],
501
+ ['bg-clip-content', '{ background-clip: content-box }'],
502
+ ['bg-clip-text', '{ background-clip: text }'],
503
+ // Backgrounds - background-color'
504
+ ...genc('bg', 'background-color'),
505
+ // Backgrounds - background-image - unsupported
506
+ // Backgrounds - background-origin
507
+ ...gen(ii => [`bg-${ii}`, `background-origin: ${ii}`], ['border-box', 'padding-box', 'content-box']),
508
+ // Backgrounds - background-position
509
+ ...gen(ii => [`bg-${ii}`, `background-position: ${ii}`], ['bottom', 'center', 'left', 'left bottom', 'left top', 'right', 'right bottom', 'right top', 'top']),
510
+ // Backgrounds - background-repeat
511
+ ...gen(ii => [`bg-${ii}`, `background-repeat: ${ii}`], ['repeat', 'repeat-x', 'repeat-y', 'space', 'round', 'no-repeat']),
512
+ // Backgrounds - background-size
513
+ ...gen(ii => [`bg-${ii}`, `background-size: ${ii}`], ['auto', 'cover', 'contain']),
514
+ // ---------------------------------------------------------------------------
515
+ // Borders - border-radius
516
+ ['rounded', '{ border-radius: 4px }'],
517
+ ...gen(([name, value]) => [
518
+ `rounded${name}`,
519
+ `border-radius: calc(var(--radius-tl-scale) * ${value}) calc(var(--radius-tr-scale) * ${value}) calc(var(--radius-br-scale) * ${value}) calc(var(--radius-bl-scale) * ${value})`
520
+ ], RADII),
521
+ ...gen(([name, value]) => [`rounded-tl${name}`, `border-top-left-radius: calc(${value} * var(--radius-tl-scale))`], RADII),
522
+ ...gen(([name, value]) => [`rounded-tr${name}`, `border-top-right-radius: calc(${value} * var(--radius-tr-scale))`], RADII),
523
+ ...gen(([name, value]) => [`rounded-bl${name}`, `border-bottom-left-radius: calc(${value} * var(--radius-bl-scale))`], RADII),
524
+ ...gen(([name, value]) => [`rounded-br${name}`, `border-bottom-right-radius: calc(${value} * var(--radius-br-scale))`], RADII),
525
+ // Borders - border-width
526
+ ['border', '{ border-width: 1px }'],
527
+ ...gen(ii => [`border-${ii}`, `border-width: ${ii}px`], WIDTHS),
528
+ ['border-t', '{ border-top-width: 1px }'],
529
+ ...gen(ii => [`border-t-${ii}`, `border-top-width: ${ii}px`], WIDTHS),
530
+ ['border-b', '{ border-bottom-width: 1px }'],
531
+ ...gen(ii => [`border-b-${ii}`, `border-bottom-width: ${ii}px`], WIDTHS),
532
+ ['border-l', '{ border-left-width: 1px }'],
533
+ ...gen(ii => [`border-l-${ii}`, `border-left-width: ${ii}px`], WIDTHS),
534
+ ['border-r', '{ border-right-width: 1px }'],
535
+ ...gen(ii => [`border-r-${ii}`, `border-right-width: ${ii}px`], WIDTHS),
536
+ ['border-s', '{ border-inline-start-width: 1px }'],
537
+ ...gen(ii => [`border-s-${ii}`, `border-inline-start-width: ${ii}px`], WIDTHS),
538
+ ['border-e', '{ border-inline-end-width: 1px }'],
539
+ ...gen(ii => [`border-e-${ii}`, `border-inline-end-width: ${ii}px`], WIDTHS),
540
+ // Borders - border-color
541
+ ...genc('border', 'border-color'),
542
+ // Borders - Border-style
543
+ ...gen(ii => [`border-${ii}`, `border-style: ${ii}`], ['solid', 'dashed', 'dotted', 'double', 'hidden', 'none']),
544
+ // Borders - outline-width
545
+ ...gen(ii => [`outline-${ii}`, `outline-width: ${ii}px`], WIDTHS),
546
+ // Borders - outline-color
547
+ ...genc('outline', 'outline-color'),
548
+ // Borders - outline-style
549
+ ['outline', '{ outline-style: solid }'],
550
+ ...gen(ii => [`outline-${ii}`, `outline-style: ${ii}`], ['none', 'dashed', 'dotted', 'double']),
551
+ // Borders - outline-offset
552
+ ...gen(ii => [`outline-offset-${ii}`, `outline-offset: ${ii}px`], WIDTHS),
553
+ // ---------------------------------------------------------------------------
554
+ // Effects - box-shadow (customised)
555
+ ['shadow', '{ box-shadow: inset 0 0 2px 0 hsla(0, 0%, 100%, 0.2), 0 2px 8px 0 hsla(var(--color-black-bg), 0.2) }'], // Customised.
556
+ ['shadow-md', '{ box-shadow: inset 0 0 2px 0 hsla(0, 0%, 100%, 0.2), 0 0px 16px 0 hsla(var(--color-black-bg), 0.2) }'], // Customised.
557
+ ['shadow-lg', '{ box-shadow: inset 0 0 2px 0 hsla(0, 0%, 100%, 0.2), 0 2px 16px 0 hsla(var(--color-black-bg), 0.2) }'], // Customised.
558
+ ['shadow-none', '{ box-shadow: none }'],
559
+ // Effects - text-shadow
560
+ // Effects - opacity
561
+ ...gen(ii => [`opacity-${ii}`, `opacity: ${ii / 100}`], OPACITIES),
562
+ // Effects - mix-blend-mode - unsupported
563
+ // Effects - background-blend-mode - unsupported
564
+ // ---------------------------------------------------------------------------
565
+ // Filters
566
+ ['filter-none', '{ filter: none }'],
567
+ // Filters - blur
568
+ ['blur-sm', '{ filter: blur(4px) }'],
569
+ ['blur', '{ filter: blur(4px) }'],
570
+ ['blur-md', '{ filter: blur(4px) }'],
571
+ ['blur-lg', '{ filter: blur(16px) }'],
572
+ ['blur-xl', '{ filter: blur(24px) }'],
573
+ ['blur-2xl', '{ filter: blur(40px) }'],
574
+ ['blur-3xl', '{ filter: blur(64px) }'],
575
+ ['blur-none', '{ filter: none }'],
576
+ // Filters - brightness - unsupported
577
+ // Filters - contrast - unsupported
578
+ // Filters - drop-shadow
579
+ ['drop-shadow-sm', '{ filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.05)) }'],
580
+ ['drop-shadow', '{ filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06)) }'],
581
+ ['drop-shadow-md', '{ filter: drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06)) }'],
582
+ ['drop-shadow-lg', '{ filter: drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1)) }'],
583
+ ['drop-shadow-xl', '{ filter: drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08)) }'],
584
+ ['drop-shadow-2xl', '{ filter: drop-shadow(0 25px 25px rgb(0 0 0 / 0.15)) }'],
585
+ ['drop-shadow-none', '{ filter: drop-shadow(0 0 #0000) }'],
586
+ // Filters - grayscale
587
+ ['grayscale-0', '{ filter: grayscale(0) }'],
588
+ ['grayscale', '{ filter: grayscale(100%) }'],
589
+ // Filters - hue-rotate - unsupported
590
+ // Filters - invert - unsupported
591
+ // Filters - saturate - unsupported
592
+ // Filters - sepia - unsupported
593
+ // ---------------------------------------------------------------------------
594
+ // Tables - border-collapse
595
+ ['border-collapse', '{ border-collapse: collapse }'],
596
+ ['border-separate', '{ order-collapse: separate }'],
597
+ // Tables - border-spacing
598
+ ...gens('border-spacing', { prop: 'border-spacing', fractions: false }),
599
+ // Tables - table-layout
600
+ ['table-auto', '{ table-layout: auto }'],
601
+ ['table-fixed', '{ table-layout: fixed }'],
602
+ // Tables - caption-side
603
+ ['caption-top', '{ caption-side: top }'],
604
+ ['caption-bottom', '{ caption-side: bottom }'],
605
+ // ---------------------------------------------------------------------------
606
+ // Transitions & Animations - transition-property
607
+ ['transition', '{ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; transition-duration: var(--anim-time) }'],
608
+ ['transition-none', '{ transition-property: none }'],
609
+ ['transition-all', '{ transition-property: all; transition-duration: var(--anim-time) }'],
610
+ // Transitions & Animations - transition-behavior
611
+ ['transition-normal', '{ transition-behavior: normal }'],
612
+ ['transition-discrete', '{ transition-behavior: discrete }'],
613
+ // Transitions & Animations - transition-duration - unsupported
614
+ // Transitions & Animations - transition-timing - unsupported
615
+ // Transitions & Animations - transition-delay - unsupported
616
+ // Transitions & Animations - animation
617
+ ...gen(ii => [`animate-${ii}`, `animation: ${ii} calc(var(--anim-time) * ${ii === 'delay' ? 3 : 1})`], Object.keys(ANIMATIONS)),
618
+ // ---------------------------------------------------------------------------
619
+ // Transforms - blackface-visibility - unsupported
620
+ // Transforms - perspective - unsupported
621
+ // Transforms - perspective-origin - unsupported
622
+ // Transforms - rotate
623
+ ...gen(ii => [`rotate-${ii}`, `rotate: ${ii}deg`], [90, 180, 270]),
624
+ // Transforms - scale - unsupported
625
+ // Transforms - skew - unsupported
626
+ // Transforms - transform - unsupported
627
+ // Transforms - transform-origin - unsupported
628
+ // Transforms - transform-style - unsupported
629
+ // Transforms - translate - unsupported
630
+ // ---------------------------------------------------------------------------
631
+ // Interactivity - accent-color - unsupported
632
+ // Interactivity - appearance
633
+ ['appearance-none', '{ appearance: none }'],
634
+ ['appearance-auto', '{ appearance: auto }'],
635
+ // Interactivity - caret-color - unsupported
636
+ // Interactivity - color-scheme - unsupported
637
+ // Interactivity - cursor
638
+ ...gen(ii => [`cursor-${ii}`, `cursor: ${ii}`], ['auto', 'default', 'pointer', 'wait', 'text', 'move', 'not-allowed', 'grab', 'grabbing']),
639
+ // Interactivity - field-sizing - unsupported
640
+ // Interactivity - pointer-events
641
+ ['pointer-events-none', '{ pointer-events: none }'],
642
+ ['pointer-events-auto', '{ pointer-events: auto }'],
643
+ // Interactivity - resize
644
+ ['resize-none', '{ resize: none }'],
645
+ ['resize-x', '{ resize: horizontal }'],
646
+ ['resize-y', '{ resize: vertical }'],
647
+ ['resize-both', '{ resize: both }'],
648
+ // Interactivity - scroll-behavior
649
+ ['scroll-auto', '{ scroll-behavior: auto }'],
650
+ ['scroll-smooth', '{ scroll-behavior: smooth }'],
651
+ // Interactivity - scroll-margin - unsupported
652
+ // Interactivity - scroll-padding - unsupported
653
+ // Interactivity - scroll-snap-align
654
+ ['snap-start', '{ scroll-snap-align: start }'],
655
+ ['snap-end', '{ scroll-snap-align: end }'],
656
+ ['snap-center', '{ scroll-snap-align: center }'],
657
+ ['snap-align-none', '{ scroll-snap-align: none }'],
658
+ // Interactivity - scroll-snap-stop
659
+ ['snap-stop-normal', '{ scroll-snap-stop: normal }'],
660
+ ['snap-stop-always', '{ scroll-snap-stop: always }'],
661
+ // Interactivity - scroll-snap-type
662
+ ['snap-none', '{ scroll-snap-type: none }'],
663
+ ['snap-x', '{ scroll-snap-type: x mandatory }'],
664
+ ['snap-y', '{ scroll-snap-type: y proximity }'],
665
+ ['snap-both', '{ scroll-snap-type: both proximity }'],
666
+ // Interactivity - touch-action - unsupported
667
+ // Interactivity - user-select
668
+ ['select-none', '{ user-select: none }'],
669
+ ['select-text', '{ user-select: text }'],
670
+ ['select-all', '{ user-select: all }'],
671
+ ['select-auto', '{ user-select: auto }']
672
+ // Interactivity - will-change - unsupported
673
+ // ---------------------------------------------------------------------------
674
+ // SVG - fill - unsupported
675
+ // SVG - stroke - unsupported
676
+ // SVG - stroke-width - unsupported
677
+ // ---------------------------------------------------------------------------
678
+ // Accessibility - forced-color-adjust - unsupported
679
+ ])
680
+
681
+ // -----------------------------------------------------------------------------
682
+ // Rule generators
683
+ // -----------------------------------------------------------------------------
684
+
685
+ // Generate with a list.
686
+ function * gen (func, list) {
687
+ for (const item of list) {
688
+ const [name, value] = func(item)
689
+ yield [name, `{ ${value} }`]
690
+ }
691
+ }
692
+
693
+ // Generate with sizes.
694
+ function * gens (cls, options = {}) {
695
+ const { prop = cls, fractions = true, next = '' } = options
696
+
697
+ yield [`${cls}-auto`, `${next}{ ${prop}: auto }`]
698
+ yield [`${cls}-full`, `${next}{ ${prop}: 100% }`]
699
+ yield [`${cls}-min`, `${next}{ ${prop}: min-content }`]
700
+ yield [`${cls}-max`, `${next}{ ${prop}: max-content }`]
701
+ yield [`${cls}-fit`, `${next}{ ${prop}: fit-content }`]
702
+ yield [`${cls}-px`, `${next}{ ${prop}: 1px }`]
703
+
704
+ for (const unit of ['svh', 'lvh', 'dvh', 'svw', 'lvw', 'dvw']) {
705
+ yield [`${cls}-${unit}`, `${next}{ ${prop}: 100${unit} }`]
706
+ }
707
+
708
+ if (fractions) {
709
+ for (const [s, frac] of SIZES_FRAC) {
710
+ yield [`${cls}-${s}`, `${next}{ ${prop}: ${frac * 100}% }`]
711
+ }
712
+ }
713
+
714
+ for (const s of SIZES) {
715
+ yield [`${cls}-${s}`, `${next}{ ${prop}: ${s * PIXEL_STEP}px }`]
716
+ yield [`-${cls}-${s}`, `${next}{ ${prop}: -${s * PIXEL_STEP}px }`]
717
+ }
718
+ }
719
+
720
+ // Generate colours.
721
+ function * genc (cls, prop) {
722
+ yield [`${cls}-inherit`, `{ ${prop}: inherit }`]
723
+ yield [`${cls}-transparent`, `{ ${prop}: transparent }`]
724
+ yield [`${cls}-current`, `{ ${prop}: currentColor }`]
725
+
726
+ for (const [colorName, color] of Object.entries(COLORS)) {
727
+ yield [`${cls}-${colorName}`, `{ ${prop}: hsla(${color}, var(--${cls}-alpha)) }`]
728
+
729
+ for (const value of OPACITIES) {
730
+ yield [`${cls}-${colorName}/${value}`, `{ ${prop}: hsla(${color}, ${value / 100}) }`]
731
+ }
732
+ }
733
+ }
734
+
735
+ // Generate palettes.
736
+ function generatePalettesTemplate (c1, c2, c3, c4, c5, alpha) {
737
+ return `{
738
+ --color-bga: var(--color-${c1});
739
+ --color-txa: var(--color-${c2});
740
+ --color-bgb: var(--color-${c3});
741
+ --color-txb: var(--color-${c4});
742
+ --color-txc: var(--color-${c5});
743
+ --bg-alpha: ${alpha};
744
+ }`
745
+ }
746
+
747
+ function * genp (cls) {
748
+ const tpl = generatePalettesTemplate
749
+
750
+ for (const name of PALETTES) {
751
+ yield [`${cls}-${name}`, tpl('paper1', 'ink1', `${name}-bg`, `${name}-text`, 'ink2', '1')]
752
+ yield [`${cls}-${name}-subtle`, tpl('paper2', 'ink1', `${name}-bg`, `${name}-text`, 'ink2', '1')]
753
+ yield [`${cls}-${name}-solid`, tpl(`${name}-bg`, `${name}-text`, `${name}-text`, `${name}-bg`, `${name}-text`, '1')]
754
+ }
755
+
756
+ yield [`${cls}-transparent`, tpl('black-bg', 'black-text', 'brand1-bg', 'brand1-text', 'black-text', '0')]
757
+ yield [`${cls}-semitransparent`, tpl('black-bg', 'black-text', 'brand1-bg', 'brand1-text', 'black-text', '0.6')]
758
+ // AEM outputs pal-inherited if nothing is selected. No colour change.
759
+ yield [`${cls}-inherited`, '{}']
760
+ }
761
+
762
+ // -----------------------------------------------------------------------------
763
+ // Runtime builder
764
+ // -----------------------------------------------------------------------------
765
+
766
+ const usedRules = new Set()
767
+ const sheet = createSheet()
768
+ let mqRulesStartIndex = sheet.cssRules.length
769
+
770
+ function createSheet () {
771
+ const result = new CSSStyleSheet()
772
+ for (const css of BASE) { result.insertRule(css, result.cssRules.length) }
773
+ for (const [name, keyframes] of Object.entries(ANIMATIONS)) { result.insertRule(`@keyframes ${name} { ${keyframes} }`) }
774
+ return result
775
+ }
776
+
777
+ // Rules are added in the following order.
778
+ // 1. Standard rules.
779
+ // 2. High priority standard rules.
780
+ // 3. Media query rules.
781
+ // 4. High priority media query rules.
782
+ function addRule (cls) {
783
+ // Skip if empty or already present.
784
+ if (!cls || usedRules.has(cls)) {
785
+ return
786
+ }
787
+
788
+ const { mq, state, util } = cls.match(CLASS_PARSER).groups
789
+
790
+ const css = UTILS.get(util)
791
+ if (!css) {
792
+ console.warn(`Unknown utility class: [${cls}]`)
793
+ return
794
+ }
795
+
796
+ const isHighPriority = Boolean(HIGH_PRIORITY_RULES.some(r => util.includes(r)))
797
+
798
+ // Resolve rule and index.
799
+ const escapedUtil = util.replaceAll('/', String.raw`\/`)
800
+ const utilWithState = state ? String.raw`${state}\:${escapedUtil}:${state}` : escapedUtil
801
+ let rule
802
+ let index
803
+ if (mq) {
804
+ index = isHighPriority ? sheet.cssRules.length : mqRulesStartIndex
805
+ rule = String.raw`${MEDIA_QUERIES[mq]} { .${mq}\:${utilWithState} ${css} }`
806
+ } else {
807
+ rule = `.${utilWithState} ${css}`
808
+ index = isHighPriority ? mqRulesStartIndex : 0
809
+ mqRulesStartIndex += 1
810
+ }
811
+
812
+ usedRules.add(cls)
813
+ sheet.insertRule(rule, index)
814
+ }
815
+
816
+ export function injectStyles (root) {
817
+ root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet]
818
+
819
+ // Add config.
820
+ // In order for it to be overrideable by themes, it needs to be inlined.
821
+ // This is because constructible styles will take precedence.
822
+ const hasConfig = Boolean(globalThis.getComputedStyle(document.documentElement).getPropertyValue('--acinguiux-preact'))
823
+ if (!hasConfig) {
824
+ const config = document.createElement('style')
825
+ config.id = 'tw-config'
826
+ config.textContent = CONFIG
827
+ root.head.prepend(config)
828
+ }
829
+ }
830
+
831
+ export function tw (className) {
832
+ for (const cls of (className || '').trim().split(/ +/)) {
833
+ addRule(cls)
834
+ }
835
+
836
+ return className
837
+ }