keycloak-theme-editor 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/LICENSE +200 -0
  2. package/README.md +147 -0
  3. package/bin/cli.js +1270 -0
  4. package/dist/assets/EditorContent-CB5V7FK7.js +134 -0
  5. package/dist/assets/RedHatDisplay-Bold-4NfIjmgI.woff2 +0 -0
  6. package/dist/assets/RedHatDisplay-BoldItalic-pTGisv8w.woff2 +0 -0
  7. package/dist/assets/RedHatDisplay-Medium-C1BzJLzv.woff2 +0 -0
  8. package/dist/assets/RedHatDisplay-MediumItalic-ZwmBpJRm.woff2 +0 -0
  9. package/dist/assets/RedHatDisplayVF-CYDHf1NI.woff2 +0 -0
  10. package/dist/assets/RedHatDisplayVF-Italic-CRpusWc8.woff2 +0 -0
  11. package/dist/assets/RedHatMono-Italic-CV5TsSDj.woff2 +0 -0
  12. package/dist/assets/RedHatMono-Regular-e08YtVYm.woff2 +0 -0
  13. package/dist/assets/RedHatMonoVF-C4fMH6Vz.woff2 +0 -0
  14. package/dist/assets/RedHatMonoVF-Italic-DGQo2ogW.woff2 +0 -0
  15. package/dist/assets/RedHatText-Italic-BLl-MYdo.woff2 +0 -0
  16. package/dist/assets/RedHatText-Medium-CFPgPIaW.woff2 +0 -0
  17. package/dist/assets/RedHatText-MediumItalic-B14GYUh6.woff2 +0 -0
  18. package/dist/assets/RedHatText-Regular-BDARZx4I.woff2 +0 -0
  19. package/dist/assets/RedHatTextVF-Italic-Dkj_WqbA.woff2 +0 -0
  20. package/dist/assets/RedHatTextVF-wYvZ7prR.woff2 +0 -0
  21. package/dist/assets/StylingPanel-BaNmfAl5.js +10 -0
  22. package/dist/assets/codemirror-CPFVGfiJ.js +12 -0
  23. package/dist/assets/fa-solid-900-DguXoeIz.woff2 +0 -0
  24. package/dist/assets/fflate-BiS96k4e.js +1 -0
  25. package/dist/assets/index-Dm1pQXDh.css +1 -0
  26. package/dist/assets/index-DtQiX03K.js +2 -0
  27. package/dist/assets/mdi-C-ens7Qz.js +1 -0
  28. package/dist/assets/patternfly-BbS2qD2Z.js +1 -0
  29. package/dist/assets/patternfly-ZUQBYYQM.css +1 -0
  30. package/dist/assets/patternfly-addons-C5K6YGth.css +1 -0
  31. package/dist/assets/patternfly.min-DYq-aGv-.css +1 -0
  32. package/dist/assets/pf-v5-pficon-Di6gTOT4.woff2 +0 -0
  33. package/dist/assets/pf-v6-pficon-Dy6oiu9u.woff2 +0 -0
  34. package/dist/assets/react-BwQcSK_q.js +9 -0
  35. package/dist/assets/vendor-DPuiCcTY.js +2 -0
  36. package/dist/assets/zustand-Cd1unGLA.js +1 -0
  37. package/dist/index.html +17 -0
  38. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay/RedHatDisplay-Black.woff2 +0 -0
  39. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay/RedHatDisplay-BlackItalic.woff2 +0 -0
  40. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay/RedHatDisplay-Bold.woff2 +0 -0
  41. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay/RedHatDisplay-BoldItalic.woff2 +0 -0
  42. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay/RedHatDisplay-Italic.woff2 +0 -0
  43. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay/RedHatDisplay-Light.woff2 +0 -0
  44. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay/RedHatDisplay-LightItalic.woff2 +0 -0
  45. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay/RedHatDisplay-Medium.woff2 +0 -0
  46. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay/RedHatDisplay-MediumItalic.woff2 +0 -0
  47. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay/RedHatDisplay-Regular.woff2 +0 -0
  48. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay/RedHatDisplayVF-Italic.woff2 +0 -0
  49. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay/RedHatDisplayVF.woff2 +0 -0
  50. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay-Black.woff2 +0 -0
  51. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay-BlackItalic.woff2 +0 -0
  52. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay-Bold.woff2 +0 -0
  53. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay-BoldItalic.woff2 +0 -0
  54. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay-Italic.woff2 +0 -0
  55. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay-Light.woff2 +0 -0
  56. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay-LightItalic.woff2 +0 -0
  57. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay-Medium.woff2 +0 -0
  58. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay-MediumItalic.woff2 +0 -0
  59. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplay-Regular.woff2 +0 -0
  60. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplayVF-Italic.woff2 +0 -0
  61. package/dist/keycloak-dev-resources/assets/fonts/RedHatDisplayVF.woff2 +0 -0
  62. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono/RedHatMono-Bold.woff2 +0 -0
  63. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono/RedHatMono-BoldItalic.woff2 +0 -0
  64. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono/RedHatMono-Italic.woff2 +0 -0
  65. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono/RedHatMono-Light.woff2 +0 -0
  66. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono/RedHatMono-LightItalic.woff2 +0 -0
  67. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono/RedHatMono-Medium.woff2 +0 -0
  68. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono/RedHatMono-MediumItalic.woff2 +0 -0
  69. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono/RedHatMono-Regular.woff2 +0 -0
  70. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono/RedHatMonoVF-Italic.woff2 +0 -0
  71. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono/RedHatMonoVF.woff2 +0 -0
  72. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono-Bold.woff2 +0 -0
  73. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono-BoldItalic.woff2 +0 -0
  74. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono-Italic.woff2 +0 -0
  75. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono-Light.woff2 +0 -0
  76. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono-LightItalic.woff2 +0 -0
  77. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono-Medium.woff2 +0 -0
  78. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono-MediumItalic.woff2 +0 -0
  79. package/dist/keycloak-dev-resources/assets/fonts/RedHatMono-Regular.woff2 +0 -0
  80. package/dist/keycloak-dev-resources/assets/fonts/RedHatMonoVF-Italic.woff2 +0 -0
  81. package/dist/keycloak-dev-resources/assets/fonts/RedHatMonoVF.woff2 +0 -0
  82. package/dist/keycloak-dev-resources/assets/fonts/RedHatText/RedHatText-Bold.woff2 +0 -0
  83. package/dist/keycloak-dev-resources/assets/fonts/RedHatText/RedHatText-BoldItalic.woff2 +0 -0
  84. package/dist/keycloak-dev-resources/assets/fonts/RedHatText/RedHatText-Italic.woff2 +0 -0
  85. package/dist/keycloak-dev-resources/assets/fonts/RedHatText/RedHatText-Light.woff2 +0 -0
  86. package/dist/keycloak-dev-resources/assets/fonts/RedHatText/RedHatText-LightItalic.woff2 +0 -0
  87. package/dist/keycloak-dev-resources/assets/fonts/RedHatText/RedHatText-Medium.woff2 +0 -0
  88. package/dist/keycloak-dev-resources/assets/fonts/RedHatText/RedHatText-MediumItalic.woff2 +0 -0
  89. package/dist/keycloak-dev-resources/assets/fonts/RedHatText/RedHatText-Regular.woff2 +0 -0
  90. package/dist/keycloak-dev-resources/assets/fonts/RedHatText/RedHatTextVF-Italic.woff2 +0 -0
  91. package/dist/keycloak-dev-resources/assets/fonts/RedHatText/RedHatTextVF.woff2 +0 -0
  92. package/dist/keycloak-dev-resources/assets/fonts/RedHatText-Bold.woff2 +0 -0
  93. package/dist/keycloak-dev-resources/assets/fonts/RedHatText-BoldItalic.woff2 +0 -0
  94. package/dist/keycloak-dev-resources/assets/fonts/RedHatText-Italic.woff2 +0 -0
  95. package/dist/keycloak-dev-resources/assets/fonts/RedHatText-Light.woff2 +0 -0
  96. package/dist/keycloak-dev-resources/assets/fonts/RedHatText-LightItalic.woff2 +0 -0
  97. package/dist/keycloak-dev-resources/assets/fonts/RedHatText-Medium.woff2 +0 -0
  98. package/dist/keycloak-dev-resources/assets/fonts/RedHatText-MediumItalic.woff2 +0 -0
  99. package/dist/keycloak-dev-resources/assets/fonts/RedHatText-Regular.woff2 +0 -0
  100. package/dist/keycloak-dev-resources/assets/fonts/RedHatTextVF-Italic.woff2 +0 -0
  101. package/dist/keycloak-dev-resources/assets/fonts/RedHatTextVF.woff2 +0 -0
  102. package/dist/keycloak-dev-resources/assets/fonts/fa-solid-900.woff2 +0 -0
  103. package/dist/keycloak-dev-resources/assets/fonts/webfonts/fa-solid-900.woff2 +0 -0
  104. package/dist/keycloak-dev-resources/img/keycloak-bg-darken.svg +1 -0
  105. package/dist/keycloak-dev-resources/img/keycloak-bg.png +0 -0
  106. package/dist/keycloak-dev-resources/img/keycloak-logo-text.svg +1 -0
  107. package/dist/keycloak-dev-resources/patternfly-addons.css +8430 -0
  108. package/dist/keycloak-dev-resources/patternfly.min.css +2 -0
  109. package/dist/keycloak-dev-resources/themes/base/login/messages/messages_en.properties +5 -0
  110. package/dist/keycloak-dev-resources/themes/base/login/mock-extension-showcase.ftl +13 -0
  111. package/dist/keycloak-dev-resources/themes/base/login/resources/css/preview.css +5 -0
  112. package/dist/keycloak-dev-resources/themes/base/login/resources/css/quick-start.css +16 -0
  113. package/dist/keycloak-dev-resources/themes/base/login/resources/css/styles.css +2 -0
  114. package/dist/keycloak-dev-resources/themes/base/login/theme.properties +143 -0
  115. package/dist/keycloak-dev-resources/themes/horizontal-card/login/footer.ftl +32 -0
  116. package/dist/keycloak-dev-resources/themes/horizontal-card/login/messages/messages_en.properties +6 -0
  117. package/dist/keycloak-dev-resources/themes/horizontal-card/login/resources/css/preview.css +5 -0
  118. package/dist/keycloak-dev-resources/themes/horizontal-card/login/resources/css/quick-start.css +31 -0
  119. package/dist/keycloak-dev-resources/themes/horizontal-card/login/resources/css/styles.css +1149 -0
  120. package/dist/keycloak-dev-resources/themes/horizontal-card/login/template.ftl +234 -0
  121. package/dist/keycloak-dev-resources/themes/horizontal-card/login/theme.properties +142 -0
  122. package/dist/keycloak-dev-resources/themes/modern-gradient/login/footer.ftl +12 -0
  123. package/dist/keycloak-dev-resources/themes/modern-gradient/login/messages/messages_en.properties +6 -0
  124. package/dist/keycloak-dev-resources/themes/modern-gradient/login/resources/css/preview.css +13 -0
  125. package/dist/keycloak-dev-resources/themes/modern-gradient/login/resources/css/quick-start.css +39 -0
  126. package/dist/keycloak-dev-resources/themes/modern-gradient/login/resources/css/styles.css +1371 -0
  127. package/dist/keycloak-dev-resources/themes/modern-gradient/login/template.ftl +296 -0
  128. package/dist/keycloak-dev-resources/themes/modern-gradient/login/theme.properties +142 -0
  129. package/dist/keycloak-dev-resources/themes/themes.json +42 -0
  130. package/dist/keycloak-dev-resources/themes/v2/login/footer.ftl +15 -0
  131. package/dist/keycloak-dev-resources/themes/v2/login/messages/messages_en.properties +5 -0
  132. package/dist/keycloak-dev-resources/themes/v2/login/mock-extension-showcase.ftl +13 -0
  133. package/dist/keycloak-dev-resources/themes/v2/login/resources/css/preview.css +5 -0
  134. package/dist/keycloak-dev-resources/themes/v2/login/resources/css/quick-start.css +16 -0
  135. package/dist/keycloak-dev-resources/themes/v2/login/resources/css/styles.css +426 -0
  136. package/dist/keycloak-dev-resources/themes/v2/login/resources/img/keycloak-bg-darken.svg +1 -0
  137. package/dist/keycloak-dev-resources/themes/v2/login/resources/img/keycloak-bg.png +0 -0
  138. package/dist/keycloak-dev-resources/themes/v2/login/resources/img/keycloak-logo-text.svg +1 -0
  139. package/dist/keycloak-dev-resources/themes/v2/login/template.ftl +287 -0
  140. package/dist/keycloak-dev-resources/themes/v2/login/theme.properties +125 -0
  141. package/dist/keycloak-upstream/base/login/cli_splash.ftl +7 -0
  142. package/dist/keycloak-upstream/base/login/code.ftl +19 -0
  143. package/dist/keycloak-upstream/base/login/delete-account-confirm.ftl +33 -0
  144. package/dist/keycloak-upstream/base/login/delete-credential.ftl +15 -0
  145. package/dist/keycloak-upstream/base/login/error.ftl +16 -0
  146. package/dist/keycloak-upstream/base/login/footer.ftl +3 -0
  147. package/dist/keycloak-upstream/base/login/frontchannel-logout.ftl +30 -0
  148. package/dist/keycloak-upstream/base/login/idp-review-user-profile.ftl +23 -0
  149. package/dist/keycloak-upstream/base/login/info.ftl +24 -0
  150. package/dist/keycloak-upstream/base/login/link-idp-action.ftl +15 -0
  151. package/dist/keycloak-upstream/base/login/login-config-totp.ftl +115 -0
  152. package/dist/keycloak-upstream/base/login/login-idp-link-confirm-override.ftl +12 -0
  153. package/dist/keycloak-upstream/base/login/login-idp-link-confirm.ftl +15 -0
  154. package/dist/keycloak-upstream/base/login/login-idp-link-email.ftl +16 -0
  155. package/dist/keycloak-upstream/base/login/login-oauth-grant.ftl +68 -0
  156. package/dist/keycloak-upstream/base/login/login-oauth2-device-verify-user-code.ftl +31 -0
  157. package/dist/keycloak-upstream/base/login/login-otp.ftl +59 -0
  158. package/dist/keycloak-upstream/base/login/login-page-expired.ftl +11 -0
  159. package/dist/keycloak-upstream/base/login/login-passkeys-conditional-authenticate.ftl +147 -0
  160. package/dist/keycloak-upstream/base/login/login-password.ftl +52 -0
  161. package/dist/keycloak-upstream/base/login/login-recovery-authn-code-config.ftl +186 -0
  162. package/dist/keycloak-upstream/base/login/login-recovery-authn-code-input.ftl +46 -0
  163. package/dist/keycloak-upstream/base/login/login-reset-otp.ftl +33 -0
  164. package/dist/keycloak-upstream/base/login/login-reset-password.ftl +39 -0
  165. package/dist/keycloak-upstream/base/login/login-update-password.ftl +77 -0
  166. package/dist/keycloak-upstream/base/login/login-update-profile.ftl +28 -0
  167. package/dist/keycloak-upstream/base/login/login-username.ftl +92 -0
  168. package/dist/keycloak-upstream/base/login/login-verify-email.ftl +36 -0
  169. package/dist/keycloak-upstream/base/login/login-x509-info.ftl +55 -0
  170. package/dist/keycloak-upstream/base/login/login.ftl +120 -0
  171. package/dist/keycloak-upstream/base/login/logout-confirm.ftl +38 -0
  172. package/dist/keycloak-upstream/base/login/passkeys.ftl +45 -0
  173. package/dist/keycloak-upstream/base/login/password-commons.ftl +12 -0
  174. package/dist/keycloak-upstream/base/login/register-commons.ftl +27 -0
  175. package/dist/keycloak-upstream/base/login/register.ftl +112 -0
  176. package/dist/keycloak-upstream/base/login/saml-post-form.ftl +25 -0
  177. package/dist/keycloak-upstream/base/login/select-authenticator.ftl +36 -0
  178. package/dist/keycloak-upstream/base/login/select-organization.ftl +23 -0
  179. package/dist/keycloak-upstream/base/login/template.ftl +204 -0
  180. package/dist/keycloak-upstream/base/login/terms.ftl +15 -0
  181. package/dist/keycloak-upstream/base/login/theme.properties +1 -0
  182. package/dist/keycloak-upstream/base/login/update-email.ftl +30 -0
  183. package/dist/keycloak-upstream/base/login/user-profile-commons.ftl +210 -0
  184. package/dist/keycloak-upstream/base/login/webauthn-authenticate.ftl +104 -0
  185. package/dist/keycloak-upstream/base/login/webauthn-error.ftl +36 -0
  186. package/dist/keycloak-upstream/base/login/webauthn-register.ftl +66 -0
  187. package/dist/keycloak-upstream/base/messages/messages_en.properties +563 -0
  188. package/dist/keycloak-upstream/base/theme-properties.json +1 -0
  189. package/dist/keycloak-upstream/v2/login/buttons.ftl +24 -0
  190. package/dist/keycloak-upstream/v2/login/code.ftl +96 -0
  191. package/dist/keycloak-upstream/v2/login/delete-account-confirm.ftl +40 -0
  192. package/dist/keycloak-upstream/v2/login/delete-credential.ftl +21 -0
  193. package/dist/keycloak-upstream/v2/login/field.ftl +162 -0
  194. package/dist/keycloak-upstream/v2/login/footer.ftl +3 -0
  195. package/dist/keycloak-upstream/v2/login/link-idp-action.ftl +21 -0
  196. package/dist/keycloak-upstream/v2/login/login-config-totp.ftl +124 -0
  197. package/dist/keycloak-upstream/v2/login/login-oauth-grant.ftl +59 -0
  198. package/dist/keycloak-upstream/v2/login/login-otp.ftl +47 -0
  199. package/dist/keycloak-upstream/v2/login/login-password.ftl +21 -0
  200. package/dist/keycloak-upstream/v2/login/login-recovery-authn-code-config.ftl +180 -0
  201. package/dist/keycloak-upstream/v2/login/login-recovery-authn-code-input.ftl +15 -0
  202. package/dist/keycloak-upstream/v2/login/login-reset-password.ftl +29 -0
  203. package/dist/keycloak-upstream/v2/login/login-update-password.ftl +32 -0
  204. package/dist/keycloak-upstream/v2/login/login-username.ftl +51 -0
  205. package/dist/keycloak-upstream/v2/login/login.ftl +56 -0
  206. package/dist/keycloak-upstream/v2/login/password-commons.ftl +8 -0
  207. package/dist/keycloak-upstream/v2/login/password-validation.ftl +53 -0
  208. package/dist/keycloak-upstream/v2/login/register-commons.ftl +27 -0
  209. package/dist/keycloak-upstream/v2/login/register.ftl +68 -0
  210. package/dist/keycloak-upstream/v2/login/select-authenticator.ftl +41 -0
  211. package/dist/keycloak-upstream/v2/login/social-providers.ftl +95 -0
  212. package/dist/keycloak-upstream/v2/login/template.ftl +266 -0
  213. package/dist/keycloak-upstream/v2/login/terms.ftl +21 -0
  214. package/dist/keycloak-upstream/v2/login/theme.properties +130 -0
  215. package/dist/keycloak-upstream/v2/login/update-email.ftl +29 -0
  216. package/dist/keycloak-upstream/v2/login/user-profile-commons.ftl +237 -0
  217. package/dist/keycloak-upstream/v2/login/webauthn-authenticate.ftl +131 -0
  218. package/dist/keycloak-upstream/v2/login/webauthn-error.ftl +35 -0
  219. package/dist/keycloak-upstream/v2/login/webauthn-register.ftl +63 -0
  220. package/dist/keycloak-upstream/v2/messages/messages_en.properties +563 -0
  221. package/dist/keycloak-upstream/v2/theme-properties.json +109 -0
  222. package/package.json +100 -0
  223. package/public/keycloak-dev-resources/img/keycloak-bg-darken.svg +1 -0
  224. package/public/keycloak-dev-resources/img/keycloak-bg.png +0 -0
  225. package/public/keycloak-dev-resources/img/keycloak-logo-text.svg +1 -0
  226. package/public/keycloak-dev-resources/themes/base/login/messages/messages_en.properties +5 -0
  227. package/public/keycloak-dev-resources/themes/base/login/mock-extension-showcase.ftl +13 -0
  228. package/public/keycloak-dev-resources/themes/base/login/resources/css/preview.css +5 -0
  229. package/public/keycloak-dev-resources/themes/base/login/resources/css/quick-start.css +16 -0
  230. package/public/keycloak-dev-resources/themes/base/login/resources/css/styles.css +2 -0
  231. package/public/keycloak-dev-resources/themes/base/login/theme.properties +143 -0
  232. package/public/keycloak-dev-resources/themes/horizontal-card/login/footer.ftl +32 -0
  233. package/public/keycloak-dev-resources/themes/horizontal-card/login/messages/messages_en.properties +6 -0
  234. package/public/keycloak-dev-resources/themes/horizontal-card/login/resources/css/preview.css +5 -0
  235. package/public/keycloak-dev-resources/themes/horizontal-card/login/resources/css/quick-start.css +31 -0
  236. package/public/keycloak-dev-resources/themes/horizontal-card/login/resources/css/styles.css +1149 -0
  237. package/public/keycloak-dev-resources/themes/horizontal-card/login/template.ftl +234 -0
  238. package/public/keycloak-dev-resources/themes/horizontal-card/login/theme.properties +142 -0
  239. package/public/keycloak-dev-resources/themes/modern-gradient/login/footer.ftl +12 -0
  240. package/public/keycloak-dev-resources/themes/modern-gradient/login/messages/messages_en.properties +6 -0
  241. package/public/keycloak-dev-resources/themes/modern-gradient/login/resources/css/preview.css +13 -0
  242. package/public/keycloak-dev-resources/themes/modern-gradient/login/resources/css/quick-start.css +39 -0
  243. package/public/keycloak-dev-resources/themes/modern-gradient/login/resources/css/styles.css +1371 -0
  244. package/public/keycloak-dev-resources/themes/modern-gradient/login/template.ftl +296 -0
  245. package/public/keycloak-dev-resources/themes/modern-gradient/login/theme.properties +142 -0
  246. package/public/keycloak-dev-resources/themes/themes.json +42 -0
  247. package/public/keycloak-dev-resources/themes/v2/login/footer.ftl +15 -0
  248. package/public/keycloak-dev-resources/themes/v2/login/messages/messages_en.properties +5 -0
  249. package/public/keycloak-dev-resources/themes/v2/login/mock-extension-showcase.ftl +13 -0
  250. package/public/keycloak-dev-resources/themes/v2/login/resources/css/preview.css +5 -0
  251. package/public/keycloak-dev-resources/themes/v2/login/resources/css/quick-start.css +16 -0
  252. package/public/keycloak-dev-resources/themes/v2/login/resources/css/styles.css +426 -0
  253. package/public/keycloak-dev-resources/themes/v2/login/resources/img/keycloak-bg-darken.svg +1 -0
  254. package/public/keycloak-dev-resources/themes/v2/login/resources/img/keycloak-bg.png +0 -0
  255. package/public/keycloak-dev-resources/themes/v2/login/resources/img/keycloak-logo-text.svg +1 -0
  256. package/public/keycloak-dev-resources/themes/v2/login/template.ftl +287 -0
  257. package/public/keycloak-dev-resources/themes/v2/login/theme.properties +125 -0
  258. package/public/keycloak-upstream/base/login/cli_splash.ftl +7 -0
  259. package/public/keycloak-upstream/base/login/code.ftl +19 -0
  260. package/public/keycloak-upstream/base/login/delete-account-confirm.ftl +33 -0
  261. package/public/keycloak-upstream/base/login/delete-credential.ftl +15 -0
  262. package/public/keycloak-upstream/base/login/error.ftl +16 -0
  263. package/public/keycloak-upstream/base/login/footer.ftl +3 -0
  264. package/public/keycloak-upstream/base/login/frontchannel-logout.ftl +30 -0
  265. package/public/keycloak-upstream/base/login/idp-review-user-profile.ftl +23 -0
  266. package/public/keycloak-upstream/base/login/info.ftl +24 -0
  267. package/public/keycloak-upstream/base/login/link-idp-action.ftl +15 -0
  268. package/public/keycloak-upstream/base/login/login-config-totp.ftl +115 -0
  269. package/public/keycloak-upstream/base/login/login-idp-link-confirm-override.ftl +12 -0
  270. package/public/keycloak-upstream/base/login/login-idp-link-confirm.ftl +15 -0
  271. package/public/keycloak-upstream/base/login/login-idp-link-email.ftl +16 -0
  272. package/public/keycloak-upstream/base/login/login-oauth-grant.ftl +68 -0
  273. package/public/keycloak-upstream/base/login/login-oauth2-device-verify-user-code.ftl +31 -0
  274. package/public/keycloak-upstream/base/login/login-otp.ftl +59 -0
  275. package/public/keycloak-upstream/base/login/login-page-expired.ftl +11 -0
  276. package/public/keycloak-upstream/base/login/login-passkeys-conditional-authenticate.ftl +147 -0
  277. package/public/keycloak-upstream/base/login/login-password.ftl +52 -0
  278. package/public/keycloak-upstream/base/login/login-recovery-authn-code-config.ftl +186 -0
  279. package/public/keycloak-upstream/base/login/login-recovery-authn-code-input.ftl +46 -0
  280. package/public/keycloak-upstream/base/login/login-reset-otp.ftl +33 -0
  281. package/public/keycloak-upstream/base/login/login-reset-password.ftl +39 -0
  282. package/public/keycloak-upstream/base/login/login-update-password.ftl +77 -0
  283. package/public/keycloak-upstream/base/login/login-update-profile.ftl +28 -0
  284. package/public/keycloak-upstream/base/login/login-username.ftl +92 -0
  285. package/public/keycloak-upstream/base/login/login-verify-email.ftl +36 -0
  286. package/public/keycloak-upstream/base/login/login-x509-info.ftl +55 -0
  287. package/public/keycloak-upstream/base/login/login.ftl +120 -0
  288. package/public/keycloak-upstream/base/login/logout-confirm.ftl +38 -0
  289. package/public/keycloak-upstream/base/login/passkeys.ftl +45 -0
  290. package/public/keycloak-upstream/base/login/password-commons.ftl +12 -0
  291. package/public/keycloak-upstream/base/login/register-commons.ftl +27 -0
  292. package/public/keycloak-upstream/base/login/register.ftl +112 -0
  293. package/public/keycloak-upstream/base/login/saml-post-form.ftl +25 -0
  294. package/public/keycloak-upstream/base/login/select-authenticator.ftl +36 -0
  295. package/public/keycloak-upstream/base/login/select-organization.ftl +23 -0
  296. package/public/keycloak-upstream/base/login/template.ftl +204 -0
  297. package/public/keycloak-upstream/base/login/terms.ftl +15 -0
  298. package/public/keycloak-upstream/base/login/theme.properties +1 -0
  299. package/public/keycloak-upstream/base/login/update-email.ftl +30 -0
  300. package/public/keycloak-upstream/base/login/user-profile-commons.ftl +210 -0
  301. package/public/keycloak-upstream/base/login/webauthn-authenticate.ftl +104 -0
  302. package/public/keycloak-upstream/base/login/webauthn-error.ftl +36 -0
  303. package/public/keycloak-upstream/base/login/webauthn-register.ftl +66 -0
  304. package/public/keycloak-upstream/base/messages/messages_en.properties +563 -0
  305. package/public/keycloak-upstream/base/theme-properties.json +1 -0
  306. package/public/keycloak-upstream/v2/login/buttons.ftl +24 -0
  307. package/public/keycloak-upstream/v2/login/code.ftl +96 -0
  308. package/public/keycloak-upstream/v2/login/delete-account-confirm.ftl +40 -0
  309. package/public/keycloak-upstream/v2/login/delete-credential.ftl +21 -0
  310. package/public/keycloak-upstream/v2/login/field.ftl +162 -0
  311. package/public/keycloak-upstream/v2/login/footer.ftl +3 -0
  312. package/public/keycloak-upstream/v2/login/link-idp-action.ftl +21 -0
  313. package/public/keycloak-upstream/v2/login/login-config-totp.ftl +124 -0
  314. package/public/keycloak-upstream/v2/login/login-oauth-grant.ftl +59 -0
  315. package/public/keycloak-upstream/v2/login/login-otp.ftl +47 -0
  316. package/public/keycloak-upstream/v2/login/login-password.ftl +21 -0
  317. package/public/keycloak-upstream/v2/login/login-recovery-authn-code-config.ftl +180 -0
  318. package/public/keycloak-upstream/v2/login/login-recovery-authn-code-input.ftl +15 -0
  319. package/public/keycloak-upstream/v2/login/login-reset-password.ftl +29 -0
  320. package/public/keycloak-upstream/v2/login/login-update-password.ftl +32 -0
  321. package/public/keycloak-upstream/v2/login/login-username.ftl +51 -0
  322. package/public/keycloak-upstream/v2/login/login.ftl +56 -0
  323. package/public/keycloak-upstream/v2/login/password-commons.ftl +8 -0
  324. package/public/keycloak-upstream/v2/login/password-validation.ftl +53 -0
  325. package/public/keycloak-upstream/v2/login/register-commons.ftl +27 -0
  326. package/public/keycloak-upstream/v2/login/register.ftl +68 -0
  327. package/public/keycloak-upstream/v2/login/select-authenticator.ftl +41 -0
  328. package/public/keycloak-upstream/v2/login/social-providers.ftl +95 -0
  329. package/public/keycloak-upstream/v2/login/template.ftl +266 -0
  330. package/public/keycloak-upstream/v2/login/terms.ftl +21 -0
  331. package/public/keycloak-upstream/v2/login/theme.properties +130 -0
  332. package/public/keycloak-upstream/v2/login/update-email.ftl +29 -0
  333. package/public/keycloak-upstream/v2/login/user-profile-commons.ftl +237 -0
  334. package/public/keycloak-upstream/v2/login/webauthn-authenticate.ftl +131 -0
  335. package/public/keycloak-upstream/v2/login/webauthn-error.ftl +35 -0
  336. package/public/keycloak-upstream/v2/login/webauthn-register.ftl +63 -0
  337. package/public/keycloak-upstream/v2/messages/messages_en.properties +563 -0
  338. package/public/keycloak-upstream/v2/theme-properties.json +109 -0
  339. package/tools/generate-preview.ts +320 -0
  340. package/tools/kc-context-mocks/index.ts +29 -0
  341. package/tools/kc-context-mocks/kc-page-story.ts +14 -0
  342. package/tools/kc-context-mocks/kc-page.ts +53 -0
  343. package/tools/preview-renderer/preview-renderer.jar +0 -0
package/bin/cli.js ADDED
@@ -0,0 +1,1270 @@
1
+ #!/usr/bin/env node
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __esm = (fn, res) => function __init() {
5
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
6
+ };
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+
12
+ // node_modules/tsafe/esm/assert.mjs
13
+ function assert(condition, msg) {
14
+ if (arguments.length === 0) {
15
+ condition = true;
16
+ }
17
+ if (refOfIs !== void 0) {
18
+ refOfIs = void 0;
19
+ return;
20
+ }
21
+ if (!condition) {
22
+ const error = new AssertionError(typeof msg === "function" ? msg() : msg);
23
+ if (Error.captureStackTrace) {
24
+ Error.captureStackTrace(error, assert);
25
+ }
26
+ throw error;
27
+ }
28
+ }
29
+ function is(value) {
30
+ const ref = {};
31
+ if (refOfIs !== void 0) {
32
+ refOfIs = void 0;
33
+ throw new Error(errorMessage);
34
+ }
35
+ refOfIs = ref;
36
+ Promise.resolve().then(() => {
37
+ if (refOfIs === ref) {
38
+ throw new Error(errorMessage);
39
+ }
40
+ });
41
+ return null;
42
+ }
43
+ var AssertionError, refOfIs, errorMessage;
44
+ var init_assert = __esm({
45
+ "node_modules/tsafe/esm/assert.mjs"() {
46
+ AssertionError = class extends Error {
47
+ constructor(msg) {
48
+ super(`Wrong assertion encountered` + (!msg ? "" : `: "${msg}"`));
49
+ this.originalMessage = msg;
50
+ Object.setPrototypeOf(this, new.target.prototype);
51
+ }
52
+ };
53
+ refOfIs = void 0;
54
+ errorMessage = "Wrong usage of the `is` function refer to https://docs.tsafe.dev/is";
55
+ }
56
+ });
57
+
58
+ // node_modules/keycloakify/tools/Object.fromEntries.js
59
+ var init_Object_fromEntries = __esm({
60
+ "node_modules/keycloakify/tools/Object.fromEntries.js"() {
61
+ if (!Object.fromEntries) {
62
+ Object.defineProperty(Object, "fromEntries", {
63
+ value: function(entries) {
64
+ if (!entries || !entries[Symbol.iterator]) {
65
+ throw new Error("Object.fromEntries() requires a single iterable argument");
66
+ }
67
+ const o = {};
68
+ Object.keys(entries).forEach((key) => {
69
+ const [k, v] = entries[key];
70
+ o[k] = v;
71
+ });
72
+ return o;
73
+ }
74
+ });
75
+ }
76
+ }
77
+ });
78
+
79
+ // node_modules/keycloakify/tools/structuredCloneButFunctions.js
80
+ function structuredCloneButFunctions(o) {
81
+ if (!(o instanceof Object)) {
82
+ return o;
83
+ }
84
+ if (typeof o === "function") {
85
+ return o;
86
+ }
87
+ if (o instanceof Array) {
88
+ return o.map(structuredCloneButFunctions);
89
+ }
90
+ return Object.fromEntries(Object.entries(o).map(([key, value]) => [key, structuredCloneButFunctions(value)]));
91
+ }
92
+ var init_structuredCloneButFunctions = __esm({
93
+ "node_modules/keycloakify/tools/structuredCloneButFunctions.js"() {
94
+ init_Object_fromEntries();
95
+ }
96
+ });
97
+
98
+ // node_modules/keycloakify/tools/deepAssign.js
99
+ function deepAssign(params) {
100
+ const { target, source } = params;
101
+ Object.keys(source).forEach((key) => {
102
+ var dereferencedSource = source[key];
103
+ if (dereferencedSource === void 0) {
104
+ delete target[key];
105
+ return;
106
+ }
107
+ if (dereferencedSource instanceof Date) {
108
+ assign({
109
+ target,
110
+ key,
111
+ value: new Date(dereferencedSource.getTime())
112
+ });
113
+ return;
114
+ }
115
+ if (dereferencedSource instanceof Array) {
116
+ assign({
117
+ target,
118
+ key,
119
+ value: structuredCloneButFunctions(dereferencedSource)
120
+ });
121
+ return;
122
+ }
123
+ if (dereferencedSource instanceof Function || !(dereferencedSource instanceof Object)) {
124
+ assign({
125
+ target,
126
+ key,
127
+ value: dereferencedSource
128
+ });
129
+ return;
130
+ }
131
+ if (!(target[key] instanceof Object)) {
132
+ target[key] = {};
133
+ }
134
+ const dereferencedTarget = target[key];
135
+ assert(is(dereferencedTarget));
136
+ assert(is(dereferencedSource));
137
+ deepAssign({
138
+ target: dereferencedTarget,
139
+ source: dereferencedSource
140
+ });
141
+ });
142
+ }
143
+ function assign(params) {
144
+ const { target, key, value } = params;
145
+ Object.defineProperty(target, key, {
146
+ enumerable: true,
147
+ writable: true,
148
+ configurable: true,
149
+ value
150
+ });
151
+ }
152
+ var init_deepAssign = __esm({
153
+ "node_modules/keycloakify/tools/deepAssign.js"() {
154
+ init_assert();
155
+ init_structuredCloneButFunctions();
156
+ }
157
+ });
158
+
159
+ // node_modules/keycloakify/bin/shared/constants.js
160
+ var WELL_KNOWN_DIRECTORY_BASE_NAME, KEYCLOAKIFY_LOGGING_VERSION, KEYCLOAKIFY_LOGGING_JAR_BASENAME;
161
+ var init_constants = __esm({
162
+ "node_modules/keycloakify/bin/shared/constants.js"() {
163
+ WELL_KNOWN_DIRECTORY_BASE_NAME = {
164
+ KEYCLOAKIFY_DEV_RESOURCES: "keycloakify-dev-resources",
165
+ RESOURCES_COMMON: "resources-common",
166
+ DIST: "dist"
167
+ };
168
+ KEYCLOAKIFY_LOGGING_VERSION = "1.0.3";
169
+ KEYCLOAKIFY_LOGGING_JAR_BASENAME = `keycloakify-logging-${KEYCLOAKIFY_LOGGING_VERSION}.jar`;
170
+ }
171
+ });
172
+
173
+ // node_modules/tsafe/esm/id.mjs
174
+ var id;
175
+ var init_id = __esm({
176
+ "node_modules/tsafe/esm/id.mjs"() {
177
+ id = (x) => x;
178
+ }
179
+ });
180
+
181
+ // node_modules/keycloakify/lib/BASE_URL.js
182
+ var BASE_URL;
183
+ var init_BASE_URL = __esm({
184
+ "node_modules/keycloakify/lib/BASE_URL.js"() {
185
+ init_assert();
186
+ BASE_URL = (() => {
187
+ vite: {
188
+ let BASE_URL2;
189
+ try {
190
+ BASE_URL2 = import.meta.env.BASE_URL;
191
+ assert(typeof BASE_URL2 === "string");
192
+ } catch (_a) {
193
+ break vite;
194
+ }
195
+ return BASE_URL2;
196
+ }
197
+ webpack: {
198
+ let BASE_URL2;
199
+ try {
200
+ BASE_URL2 = process.env.PUBLIC_URL;
201
+ assert(typeof BASE_URL2 === "string");
202
+ } catch (_b) {
203
+ break webpack;
204
+ }
205
+ return BASE_URL2 === "" ? "/" : `${BASE_URL2}/`;
206
+ }
207
+ return "/";
208
+ })();
209
+ }
210
+ });
211
+
212
+ // node_modules/keycloakify/login/KcContext/kcContextMocks.js
213
+ var kcContextMocks_exports = {};
214
+ __export(kcContextMocks_exports, {
215
+ kcContextCommonMock: () => kcContextCommonMock,
216
+ kcContextMocks: () => kcContextMocks
217
+ });
218
+ var attributesByName, resourcesPath, kcContextCommonMock, loginUrl, kcContextMocks;
219
+ var init_kcContextMocks = __esm({
220
+ "node_modules/keycloakify/login/KcContext/kcContextMocks.js"() {
221
+ init_Object_fromEntries();
222
+ init_constants();
223
+ init_id();
224
+ init_assert();
225
+ init_BASE_URL();
226
+ attributesByName = Object.fromEntries(id([
227
+ {
228
+ validators: {
229
+ length: {
230
+ "ignore.empty.value": true,
231
+ min: "3",
232
+ max: "255"
233
+ }
234
+ },
235
+ displayName: "${username}",
236
+ annotations: {},
237
+ required: true,
238
+ autocomplete: "username",
239
+ readOnly: false,
240
+ name: "username"
241
+ },
242
+ {
243
+ validators: {
244
+ length: {
245
+ max: "255",
246
+ "ignore.empty.value": true
247
+ },
248
+ email: {
249
+ "ignore.empty.value": true
250
+ },
251
+ pattern: {
252
+ "ignore.empty.value": true,
253
+ pattern: "gmail\\.com$"
254
+ }
255
+ },
256
+ displayName: "${email}",
257
+ annotations: {},
258
+ required: true,
259
+ autocomplete: "email",
260
+ readOnly: false,
261
+ name: "email"
262
+ },
263
+ {
264
+ validators: {
265
+ length: {
266
+ max: "255",
267
+ "ignore.empty.value": true
268
+ }
269
+ },
270
+ displayName: "${firstName}",
271
+ annotations: {},
272
+ required: true,
273
+ readOnly: false,
274
+ name: "firstName"
275
+ },
276
+ {
277
+ validators: {
278
+ length: {
279
+ max: "255",
280
+ "ignore.empty.value": true
281
+ }
282
+ },
283
+ displayName: "${lastName}",
284
+ annotations: {},
285
+ required: true,
286
+ readOnly: false,
287
+ name: "lastName"
288
+ }
289
+ ]).map((attribute) => [attribute.name, attribute]));
290
+ resourcesPath = `${BASE_URL}${WELL_KNOWN_DIRECTORY_BASE_NAME.KEYCLOAKIFY_DEV_RESOURCES}/login`;
291
+ kcContextCommonMock = {
292
+ themeVersion: "0.0.0",
293
+ keycloakifyVersion: "0.0.0",
294
+ themeType: "login",
295
+ themeName: "my-theme-name",
296
+ url: {
297
+ loginAction: "#",
298
+ resourcesPath,
299
+ resourcesCommonPath: `${resourcesPath}/${WELL_KNOWN_DIRECTORY_BASE_NAME.RESOURCES_COMMON}`,
300
+ loginRestartFlowUrl: "#",
301
+ loginUrl: "#",
302
+ ssoLoginInOtherTabsUrl: "#"
303
+ },
304
+ realm: {
305
+ name: "myrealm",
306
+ displayName: "myrealm",
307
+ displayNameHtml: "myrealm",
308
+ internationalizationEnabled: true,
309
+ registrationEmailAsUsername: false
310
+ },
311
+ messagesPerField: {
312
+ get: () => "",
313
+ existsError: () => false,
314
+ printIfExists: function(fieldName, text) {
315
+ return this.get(fieldName) !== "" ? text : void 0;
316
+ },
317
+ exists: function(fieldName) {
318
+ return this.get(fieldName) !== "";
319
+ },
320
+ getFirstError: function(...fieldNames) {
321
+ for (const fieldName of fieldNames) {
322
+ if (this.existsError(fieldName)) {
323
+ return this.get(fieldName);
324
+ }
325
+ }
326
+ return "";
327
+ }
328
+ },
329
+ locale: {
330
+ supported: [
331
+ /* spell-checker: disable */
332
+ ["de", "Deutsch"],
333
+ ["no", "Norsk"],
334
+ ["ru", "\u0420\u0443\u0441\u0441\u043A\u0438\u0439"],
335
+ ["sv", "Svenska"],
336
+ ["pt-BR", "Portugu\xEAs (Brasil)"],
337
+ ["lt", "Lietuvi\u0173"],
338
+ ["en", "English"],
339
+ ["it", "Italiano"],
340
+ ["fr", "Fran\xE7ais"],
341
+ ["zh-CN", "\u4E2D\u6587\u7B80\u4F53"],
342
+ ["es", "Espa\xF1ol"],
343
+ ["cs", "\u010Ce\u0161tina"],
344
+ ["ja", "\u65E5\u672C\u8A9E"],
345
+ ["sk", "Sloven\u010Dina"],
346
+ ["pl", "Polski"],
347
+ ["ca", "Catal\xE0"],
348
+ ["nl", "Nederlands"],
349
+ ["tr", "T\xFCrk\xE7e"],
350
+ ["ar", "\u0627\u0644\u0639\u0631\u0628\u064A\u0629"],
351
+ ["da", "Dansk"],
352
+ ["el", "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC"],
353
+ ["fa", "\u0641\u0627\u0631\u0633\u06CC"],
354
+ ["fi", "Suomi"],
355
+ ["hu", "Magyar"],
356
+ ["ka", "\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8"],
357
+ ["lv", "Latvie\u0161u"],
358
+ ["pt", "Portugu\xEAs"],
359
+ ["th", "\u0E44\u0E17\u0E22"],
360
+ ["uk", "\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430"],
361
+ ["zh-TW", "\u4E2D\u6587\u7E41\u9AD4"]
362
+ /* spell-checker: enable */
363
+ ].map(([languageTag, label]) => {
364
+ {
365
+ assert;
366
+ assert;
367
+ }
368
+ return {
369
+ languageTag,
370
+ label,
371
+ url: "https://gist.github.com/garronej/52baaca1bb925f2296ab32741e062b8e"
372
+ };
373
+ }),
374
+ currentLanguageTag: "en"
375
+ },
376
+ auth: {
377
+ showUsername: false,
378
+ showResetCredentials: false,
379
+ showTryAnotherWayLink: false
380
+ },
381
+ client: {
382
+ clientId: "myApp",
383
+ attributes: {}
384
+ },
385
+ scripts: [],
386
+ isAppInitiatedAction: false,
387
+ properties: {},
388
+ "x-keycloakify": {
389
+ messages: {}
390
+ }
391
+ };
392
+ loginUrl = Object.assign(Object.assign({}, kcContextCommonMock.url), { loginResetCredentialsUrl: "#", registrationUrl: "#", oauth2DeviceVerificationAction: "#", oauthAction: "#" });
393
+ kcContextMocks = [
394
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "login.ftl", url: loginUrl, realm: Object.assign(Object.assign({}, kcContextCommonMock.realm), { loginWithEmailAllowed: true, rememberMe: true, password: true, resetPasswordAllowed: true, registrationAllowed: true }), auth: kcContextCommonMock.auth, social: {
395
+ displayInfo: true
396
+ }, usernameHidden: false, login: {}, registrationDisabled: false, enableWebAuthnConditionalUI: false, authenticators: {
397
+ authenticators: []
398
+ }, challenge: "", userVerification: "not specified", rpId: "", createTimeout: "0", isUserIdentified: "false", shouldDisplayAuthenticators: false })),
399
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { url: Object.assign(Object.assign({}, loginUrl), { registrationAction: "#" }), isAppInitiatedAction: false, passwordRequired: true, recaptchaRequired: false, pageId: "register.ftl", profile: {
400
+ attributesByName
401
+ }, scripts: [
402
+ //"https://www.google.com/recaptcha/api.js"
403
+ ] })),
404
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "info.ftl", messageHeader: "<Message header>", requiredActions: void 0, skipLink: false, actionUri: "#", client: {
405
+ clientId: "myApp",
406
+ baseUrl: "#",
407
+ attributes: {}
408
+ }, message: {
409
+ type: "info",
410
+ summary: "This is the info message from the Keycloak server (in real environment, this message is localized)"
411
+ } })),
412
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "error.ftl", client: {
413
+ clientId: "myApp",
414
+ baseUrl: "#",
415
+ attributes: {}
416
+ }, message: {
417
+ type: "error",
418
+ summary: "This is the error message from the Keycloak server (in real environment, this message is localized)"
419
+ } })),
420
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "login-reset-password.ftl", realm: Object.assign(Object.assign({}, kcContextCommonMock.realm), { loginWithEmailAllowed: false, duplicateEmailsAllowed: false }), url: loginUrl, auth: {} })),
421
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "login-verify-email.ftl", user: {
422
+ email: "john.doe@gmail.com"
423
+ } })),
424
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "terms.ftl" })),
425
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "login-oauth2-device-verify-user-code.ftl", url: loginUrl })),
426
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "login-oauth-grant.ftl", oauth: {
427
+ code: "5-1N4CIzfi1aprIQjmylI-9e3spLCWW9i5d-GDcs-Sw",
428
+ clientScopesRequested: [
429
+ { consentScreenText: "${profileScopeConsentText}" },
430
+ { consentScreenText: "${rolesScopeConsentText}" },
431
+ { consentScreenText: "${emailScopeConsentText}" }
432
+ ],
433
+ client: "account"
434
+ }, url: loginUrl })),
435
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "login-otp.ftl", otpLogin: {
436
+ userOtpCredentials: [
437
+ {
438
+ id: "id1",
439
+ userLabel: "label1"
440
+ },
441
+ {
442
+ id: "id2",
443
+ userLabel: "label2"
444
+ }
445
+ ]
446
+ } })),
447
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "login-username.ftl", url: loginUrl, realm: Object.assign(Object.assign({}, kcContextCommonMock.realm), { loginWithEmailAllowed: true, rememberMe: true, password: true, resetPasswordAllowed: true, registrationAllowed: true }), social: {
448
+ displayInfo: true
449
+ }, usernameHidden: false, login: {}, registrationDisabled: false, challenge: "", userVerification: "not specified", rpId: "", createTimeout: "0", isUserIdentified: "false" })),
450
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "login-password.ftl", url: loginUrl, realm: Object.assign(Object.assign({}, kcContextCommonMock.realm), { resetPasswordAllowed: true }), enableWebAuthnConditionalUI: false, authenticators: {
451
+ authenticators: []
452
+ }, challenge: "", userVerification: "not specified", rpId: "", createTimeout: "0", isUserIdentified: "false", shouldDisplayAuthenticators: false })),
453
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "webauthn-authenticate.ftl", url: loginUrl, authenticators: {
454
+ authenticators: []
455
+ }, realm: Object.assign(Object.assign({}, kcContextCommonMock.realm), { password: true, registrationAllowed: true }), challenge: "", userVerification: "not specified", rpId: "", createTimeout: "0", isUserIdentified: "false", shouldDisplayAuthenticators: false })),
456
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "login-update-password.ftl" })),
457
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "link-idp-action.ftl", idpDisplayName: "FranceConnect" })),
458
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "login-update-profile.ftl", profile: {
459
+ attributesByName
460
+ } })),
461
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "login-idp-link-confirm.ftl", idpAlias: "FranceConnect" })),
462
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "login-idp-link-email.ftl", idpAlias: "FranceConnect", brokerContext: {
463
+ username: "anUsername"
464
+ } })),
465
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "login-config-totp.ftl", totp: {
466
+ totpSecretEncoded: "KVVF G2BY N4YX S6LB IUYT K2LH IFYE 4SBV",
467
+ qrUrl: "#",
468
+ totpSecretQrCode: "iVBORw0KGgoAAAANSUhEUgAAAPYAAAD2AQAAAADNaUdlAAACM0lEQVR4Xu3OIZJgOQwDUDFd2UxiurLAVnnbHw4YGDKtSiWOn4Gxf81//7r/+q8b4HfLGBZDK9d85NmNR+sB42sXvOYrN5P1DcgYYFTGfOlbzE8gzwy3euweGizw7cfdl34/GRhlkxjKNV+5AebPXPORX1JuB9x8ZfbyyD2y1krWAKsbMq1HnqQDaLfa77p4+MqvzEGSqvSAD/2IHW2yHaigR9tX3m8dDIYGcNf3f+gDpVBZbZU77zyJ6Rlcy+qoTMG887KAPD9hsh6a1Sv3gJUHGHUAxSMzj7zqDDe7Phmt2eG+8UsMxjRGm816MAO+8VMl1R1jGHOrZB/5Zo/WXAPgxixm9Mo96vDGrM1eOto8c4Ax4wF437mifOXlpiPzCnN7Y9l95NnEMxgMY9AAGA8fucH14Y1aVb6N/cqrmyh0BVht7k1e+bU8LK0Cg5vmVq9c5vHIjOfqxDIfeTraNVTwewa4wVe+SW5N+uP1qACeudUZbqGOfA6VZV750Noq2Xx3kpveV44ZelSV1V7KFHzkWyVrrlUwG0Pl9pWnoy3vsQoME6vKI69i5osVgwWzHT7zjmJtMcNUSVn1oYMd7ZodbgowZl45VG0uVuLPUr1yc79uaQBag/mqR34xhlWyHm1prplHboCWdZ4TeZjsK8+dI+jbz1C5hl65mcpgB5dhcj8+dGO+0Ko68+lD37JDD83dpDLzzK+TrQyaVwGj6pUboGV+7+AyN8An/pf84/7rv/4/1l4OCc/1BYMAAAAASUVORK5CYII=",
469
+ manualUrl: "#",
470
+ totpSecret: "G4nsI8lQagRMUchH8jEG",
471
+ otpCredentials: [],
472
+ supportedApplications: ["FreeOTP", "Google Authenticator"],
473
+ policy: {
474
+ algorithm: "HmacSHA1",
475
+ digits: 6,
476
+ lookAheadWindow: 1,
477
+ type: "totp",
478
+ period: 30,
479
+ getAlgorithmKey: () => "SHA1"
480
+ }
481
+ } })),
482
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "logout-confirm.ftl", url: Object.assign(Object.assign({}, kcContextCommonMock.url), { logoutConfirmAction: "Continuer?" }), client: {
483
+ clientId: "myApp",
484
+ baseUrl: "#",
485
+ attributes: {}
486
+ }, logoutConfirm: { code: "123", skipLink: false } })),
487
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "idp-review-user-profile.ftl", profile: {
488
+ attributesByName
489
+ } })),
490
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "update-email.ftl", profile: {
491
+ attributesByName: {
492
+ email: attributesByName["email"]
493
+ }
494
+ } })),
495
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "select-authenticator.ftl", auth: {
496
+ authenticationSelections: [
497
+ {
498
+ authExecId: "f607f83c-537e-42b7-99d7-c52d459afe84",
499
+ displayName: "otp-display-name",
500
+ helpText: "otp-help-text",
501
+ iconCssClass: "kcAuthenticatorOTPClass"
502
+ },
503
+ {
504
+ authExecId: "5ed881b1-84cd-4e9b-b4d9-f329ea61a58c",
505
+ displayName: "webauthn-display-name",
506
+ helpText: "webauthn-help-text",
507
+ iconCssClass: "kcAuthenticatorWebAuthnClass"
508
+ }
509
+ ]
510
+ } })),
511
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "saml-post-form.ftl", samlPost: {
512
+ url: "#"
513
+ } })),
514
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "login-page-expired.ftl" })),
515
+ id(Object.assign(Object.assign({}, kcContextCommonMock), { pageId: "frontchannel-logout.ftl", logout: {
516
+ clients: [
517
+ {
518
+ name: "myApp",
519
+ frontChannelLogoutUrl: "#"
520
+ },
521
+ {
522
+ name: "myApp2",
523
+ frontChannelLogoutUrl: "#"
524
+ }
525
+ ]
526
+ } })),
527
+ id(Object.assign(Object.assign({ pageId: "webauthn-register.ftl" }, kcContextCommonMock), { challenge: "random-challenge-string", userid: "user123", username: "johndoe", signatureAlgorithms: ["ES256", "RS256"], rpEntityName: "Example Corp", rpId: "example.com", attestationConveyancePreference: "direct", authenticatorAttachment: "platform", requireResidentKey: "required", userVerificationRequirement: "preferred", createTimeout: 6e4, excludeCredentialIds: "credId123,credId456", isSetRetry: false, isAppInitiatedAction: true })),
528
+ id(Object.assign(Object.assign({ pageId: "delete-credential.ftl" }, kcContextCommonMock), { credentialLabel: "myCredential" })),
529
+ id(Object.assign(Object.assign({ pageId: "code.ftl" }, kcContextCommonMock), { code: {
530
+ success: true,
531
+ code: "123456"
532
+ } })),
533
+ id(Object.assign(Object.assign({ pageId: "delete-account-confirm.ftl" }, kcContextCommonMock), { triggered_from_aia: true })),
534
+ id(Object.assign(Object.assign({ pageId: "login-recovery-authn-code-config.ftl" }, kcContextCommonMock), { recoveryAuthnCodesConfigBean: {
535
+ generatedRecoveryAuthnCodesList: ["code123", "code456", "code789"],
536
+ generatedRecoveryAuthnCodesAsString: "code123, code456, code789",
537
+ generatedAt: (/* @__PURE__ */ new Date()).getTime()
538
+ } })),
539
+ id(Object.assign(Object.assign({ pageId: "login-recovery-authn-code-input.ftl" }, kcContextCommonMock), { recoveryAuthnCodesInputBean: {
540
+ codeNumber: 1234
541
+ } })),
542
+ id(Object.assign(Object.assign({ pageId: "login-reset-otp.ftl" }, kcContextCommonMock), { configuredOtpCredentials: {
543
+ userOtpCredentials: [
544
+ {
545
+ id: "otpId1",
546
+ userLabel: "OTP Device 1"
547
+ },
548
+ {
549
+ id: "otpId2",
550
+ userLabel: "OTP Device 2"
551
+ },
552
+ {
553
+ id: "otpId3",
554
+ userLabel: "Backup OTP"
555
+ }
556
+ ],
557
+ selectedCredentialId: "otpId2"
558
+ } })),
559
+ id(Object.assign(Object.assign({ pageId: "login-x509-info.ftl" }, kcContextCommonMock), { x509: {
560
+ formData: {
561
+ subjectDN: "CN=John Doe, O=Example Corp, C=US",
562
+ isUserEnabled: true,
563
+ username: "johndoe"
564
+ }
565
+ } })),
566
+ id(Object.assign(Object.assign({ pageId: "webauthn-error.ftl" }, kcContextCommonMock), { isAppInitiatedAction: true })),
567
+ id(Object.assign(Object.assign({ pageId: "login-passkeys-conditional-authenticate.ftl" }, kcContextCommonMock), { url: Object.assign(Object.assign({}, kcContextCommonMock.url), { registrationUrl: "#" }), realm: Object.assign(Object.assign({}, kcContextCommonMock.realm), { password: true, registrationAllowed: true }), registrationDisabled: false, isUserIdentified: "false", challenge: "", userVerification: "not specified", rpId: "", createTimeout: 0, authenticators: {
568
+ authenticators: []
569
+ }, shouldDisplayAuthenticators: false, login: {} })),
570
+ id(Object.assign(Object.assign({ pageId: "login-idp-link-confirm-override.ftl" }, kcContextCommonMock), { url: Object.assign(Object.assign({}, kcContextCommonMock.url), { loginRestartFlowUrl: "#" }), idpDisplayName: "Google" })),
571
+ id(Object.assign(Object.assign({ pageId: "select-organization.ftl" }, kcContextCommonMock), { user: {
572
+ organizations: [
573
+ {
574
+ alias: "acme-inc",
575
+ name: "Acme Incorporated"
576
+ },
577
+ {
578
+ alias: "northwind-traders",
579
+ name: "Northwind Traders"
580
+ },
581
+ {
582
+ alias: "contoso-labs",
583
+ name: "Contoso Labs"
584
+ },
585
+ {
586
+ alias: "shared-services"
587
+ }
588
+ ]
589
+ } }))
590
+ ];
591
+ {
592
+ assert();
593
+ assert();
594
+ }
595
+ }
596
+ });
597
+
598
+ // node_modules/tsafe/esm/exclude.mjs
599
+ function exclude(target) {
600
+ const test = target instanceof Object ? (element) => target.indexOf(element) < 0 : (element) => element !== target;
601
+ return function(element) {
602
+ return test(element);
603
+ };
604
+ }
605
+ var init_exclude = __esm({
606
+ "node_modules/tsafe/esm/exclude.mjs"() {
607
+ }
608
+ });
609
+
610
+ // node_modules/keycloakify/login/KcContext/getKcContextMock.js
611
+ function createGetKcContextMock(params) {
612
+ const { kcContextExtension, kcContextExtensionPerPage, overrides: overrides_global, overridesPerPage: overridesPerPage_global } = params;
613
+ function getKcContextMock2(params2) {
614
+ var _a;
615
+ const { pageId, overrides } = params2;
616
+ const kcContextMock = structuredCloneButFunctions((_a = kcContextMocks.find((kcContextMock2) => kcContextMock2.pageId === pageId)) !== null && _a !== void 0 ? _a : Object.assign(Object.assign({}, kcContextCommonMock), { pageId }));
617
+ [
618
+ kcContextExtension,
619
+ kcContextExtensionPerPage[pageId],
620
+ overrides_global,
621
+ overridesPerPage_global === null || overridesPerPage_global === void 0 ? void 0 : overridesPerPage_global[pageId],
622
+ overrides
623
+ ].filter(exclude(void 0)).forEach((overrides2) => deepAssign({
624
+ target: kcContextMock,
625
+ source: overrides2
626
+ }));
627
+ return kcContextMock;
628
+ }
629
+ return { getKcContextMock: getKcContextMock2 };
630
+ }
631
+ var init_getKcContextMock = __esm({
632
+ "node_modules/keycloakify/login/KcContext/getKcContextMock.js"() {
633
+ init_deepAssign();
634
+ init_structuredCloneButFunctions();
635
+ init_kcContextMocks();
636
+ init_exclude();
637
+ }
638
+ });
639
+
640
+ // node_modules/keycloakify/login/KcContext/index.js
641
+ var KcContext_exports = {};
642
+ __export(KcContext_exports, {
643
+ createGetKcContextMock: () => createGetKcContextMock
644
+ });
645
+ var init_KcContext = __esm({
646
+ "node_modules/keycloakify/login/KcContext/index.js"() {
647
+ init_getKcContextMock();
648
+ }
649
+ });
650
+
651
+ // bin/cli.ts
652
+ import { createServer } from "http";
653
+ import fs2 from "fs";
654
+ import path2 from "path";
655
+ import process3 from "process";
656
+ import { program } from "commander";
657
+ import open from "open";
658
+ import sirv from "sirv";
659
+ import { watch } from "chokidar";
660
+ import { createJiti } from "jiti";
661
+
662
+ // tools/generate-preview.ts
663
+ import { spawnSync } from "child_process";
664
+ import fs from "fs";
665
+ import os from "os";
666
+ import path from "path";
667
+ import process2 from "process";
668
+
669
+ // tools/kc-context-mocks/kc-page.ts
670
+ var { createGetKcContextMock: createGetKcContextMock2 } = await Promise.resolve().then(() => (init_KcContext(), KcContext_exports));
671
+ var { kcContextMocks: kcContextMocks2 } = await Promise.resolve().then(() => (init_kcContextMocks(), kcContextMocks_exports));
672
+ var socialProviders = [
673
+ { alias: "google", providerId: "google", displayName: "Google", loginUrl: "#" },
674
+ { alias: "github", providerId: "github", displayName: "GitHub", loginUrl: "#" },
675
+ { alias: "facebook", providerId: "facebook", displayName: "Facebook", loginUrl: "#" },
676
+ { alias: "microsoft", providerId: "microsoft", displayName: "Microsoft", loginUrl: "#" }
677
+ ];
678
+ var favoritePetAttribute = {
679
+ name: "favoritePet",
680
+ displayName: "Favorite pet",
681
+ required: true,
682
+ readOnly: false,
683
+ annotations: { inputType: "select", inputOptionLabelsI18nPrefix: "favoritePet" },
684
+ html5DataAnnotations: {},
685
+ validators: { options: { options: ["dog", "cat", "bird", "reptile"] } },
686
+ values: []
687
+ };
688
+ var { getKcContextMock } = createGetKcContextMock2({
689
+ kcContextExtension: { properties: {} },
690
+ overrides: {
691
+ url: {
692
+ resourcesPath: "/keycloak-dev-resources",
693
+ resourcesCommonPath: "/keycloak-dev-resources/resources-common"
694
+ }
695
+ },
696
+ kcContextExtensionPerPage: {
697
+ "mock-extension-showcase.ftl": {
698
+ mockExtensionTitle: "KcContext mock extension showcase",
699
+ mockExtensionIntro: "This custom page demonstrates user-extensible mock fields rendered by a custom FTL template.",
700
+ mockExtensionSteps: "1) Checkout repository locally\n2) Add custom FTL page\n3) Provide page mocks\n4) Style in editor"
701
+ }
702
+ },
703
+ overridesPerPage: {
704
+ "login.ftl": { login: { username: "" }, social: { providers: socialProviders } },
705
+ "login-username.ftl": { login: { username: "" }, social: { providers: socialProviders } },
706
+ "register.ftl": {
707
+ termsAcceptanceRequired: true,
708
+ profile: {
709
+ attributesByName: {
710
+ email: { readOnly: true, values: ["john@example.com"] },
711
+ lastName: { readOnly: true, values: ["Doe"] },
712
+ favoritePet: favoritePetAttribute
713
+ }
714
+ }
715
+ }
716
+ }
717
+ });
718
+
719
+ // tools/kc-context-mocks/kc-page-story.ts
720
+ var stories = {
721
+ "login": {
722
+ "minimal": {
723
+ realm: { internationalizationEnabled: false, rememberMe: false, registrationAllowed: false, resetPasswordAllowed: false },
724
+ social: { displayInfo: false, providers: [] }
725
+ },
726
+ "invalid-state": {
727
+ realm: { rememberMe: false, resetPasswordAllowed: false },
728
+ social: { displayInfo: false, providers: [] },
729
+ message: { type: "info", summary: "infoMessage" },
730
+ messagesPerField: { username: "Invalid username or password.", password: "Invalid username or password." }
731
+ }
732
+ }
733
+ };
734
+
735
+ // tools/kc-context-mocks/index.ts
736
+ function resolveContextMocks() {
737
+ const pages = {};
738
+ const allPageIds = [
739
+ ...kcContextMocks2.map((m) => m.pageId),
740
+ "mock-extension-showcase.ftl"
741
+ ];
742
+ for (const pageId of allPageIds) {
743
+ const name = pageId.replace(".ftl", "");
744
+ const ctx = JSON.parse(JSON.stringify(getKcContextMock({ pageId })));
745
+ pages[name] = ctx;
746
+ for (const [storyId, override] of Object.entries(stories[name] ?? {})) {
747
+ pages[`${name}@${storyId}`] = JSON.parse(JSON.stringify(
748
+ getKcContextMock({ pageId, overrides: override })
749
+ ));
750
+ }
751
+ }
752
+ return { common: {}, pages };
753
+ }
754
+
755
+ // tools/generate-preview.ts
756
+ var MIN_JAVA = 25;
757
+ var isWindows = process2.platform === "win32";
758
+ var SCRIPT_TAG_PATTERN = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;
759
+ function stripScriptTags(html) {
760
+ if (!html) {
761
+ return "";
762
+ }
763
+ return html.replace(SCRIPT_TAG_PATTERN, "");
764
+ }
765
+ function readJson(filePath) {
766
+ if (!fs.existsSync(filePath)) {
767
+ return null;
768
+ }
769
+ try {
770
+ return JSON.parse(fs.readFileSync(filePath, "utf8"));
771
+ } catch {
772
+ return null;
773
+ }
774
+ }
775
+ function getJavaMajorVersion() {
776
+ const result = spawnSync("java", ["-version"], {
777
+ stdio: ["ignore", "pipe", "pipe"],
778
+ encoding: "utf8",
779
+ shell: isWindows
780
+ });
781
+ if (result.status !== 0) {
782
+ return null;
783
+ }
784
+ const match = `${result.stdout || ""}
785
+ ${result.stderr || ""}`.match(/version\s+"([^"]+)"/i);
786
+ if (!match) {
787
+ return null;
788
+ }
789
+ const major = Number.parseInt(match[1].split(/[._-]/)[0], 10);
790
+ return Number.isFinite(major) ? major : null;
791
+ }
792
+ function toForwardSlashPath(filePath) {
793
+ return filePath.replaceAll("\\", "/");
794
+ }
795
+ function mergeMocks(base, additional) {
796
+ return {
797
+ common: { ...base.common, ...additional.common },
798
+ pages: { ...base.pages, ...additional.pages }
799
+ };
800
+ }
801
+ function writeTempContextMocksFile(additionalMocks) {
802
+ const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "preview-context-mocks-"));
803
+ const filePath = path.join(tempDir, "kc-context-mocks.json");
804
+ let mocks = resolveContextMocks();
805
+ if (additionalMocks) {
806
+ mocks = mergeMocks(mocks, additionalMocks);
807
+ }
808
+ fs.writeFileSync(filePath, `${JSON.stringify(mocks, null, 2)}
809
+ `, "utf8");
810
+ return { tempDir, filePath };
811
+ }
812
+ function resolveCustomMocksPath(packageRoot) {
813
+ const envPath = process2.env.PREVIEW_CUSTOM_MOCKS;
814
+ if (envPath) {
815
+ const resolvedPath = path.isAbsolute(envPath) ? envPath : path.resolve(packageRoot, envPath);
816
+ if (fs.existsSync(resolvedPath)) {
817
+ return resolvedPath;
818
+ }
819
+ }
820
+ return void 0;
821
+ }
822
+ function runJar(params) {
823
+ const { jarPath, contextMocksPath, packageRoot, outputDir, customMocksPath } = params;
824
+ const args = [
825
+ "-jar",
826
+ jarPath,
827
+ `--context-mocks=${toForwardSlashPath(contextMocksPath)}`,
828
+ `--input=${toForwardSlashPath(path.join(packageRoot, "public/keycloak-upstream"))}`,
829
+ `--overrides=${toForwardSlashPath(path.join(packageRoot, "public/keycloak-dev-resources/themes"))}`,
830
+ `--presets=${toForwardSlashPath(path.join(packageRoot, "public/keycloak-dev-resources/themes"))}`,
831
+ `--output=${toForwardSlashPath(outputDir)}`,
832
+ ...customMocksPath ? [`--custom-mocks=${toForwardSlashPath(customMocksPath)}`] : []
833
+ ];
834
+ return spawnSync("java", args, {
835
+ stdio: "inherit",
836
+ shell: isWindows
837
+ });
838
+ }
839
+ function runMaven(pomPath, contextMocksPath, customMocksPath) {
840
+ const execArgs = [
841
+ `--context-mocks=${toForwardSlashPath(contextMocksPath)}`,
842
+ ...customMocksPath ? [`--custom-mocks=${toForwardSlashPath(customMocksPath)}`] : []
843
+ ].join(" ");
844
+ const mavenOpts = [
845
+ process2.env.MAVEN_OPTS || "",
846
+ "--enable-native-access=ALL-UNNAMED",
847
+ "--sun-misc-unsafe-memory-access=allow"
848
+ ].filter(Boolean).join(" ");
849
+ return spawnSync("mvn", [
850
+ "-f",
851
+ pomPath,
852
+ "compile",
853
+ "exec:java",
854
+ "-Dexec.mainClass=com.keycloaktheme.preview.PreviewRendererMain",
855
+ `-Dexec.args="${execArgs}"`
856
+ ], {
857
+ stdio: "inherit",
858
+ shell: isWindows,
859
+ env: { ...process2.env, MAVEN_OPTS: mavenOpts }
860
+ });
861
+ }
862
+ function resolveExpectedDataPageId(pageId) {
863
+ const normalizedPageId = pageId.trim().replace(/\.html$/i, "");
864
+ if (!normalizedPageId) {
865
+ return "login";
866
+ }
867
+ return `login-${normalizedPageId}`;
868
+ }
869
+ function validateStoryHtmlContract(params) {
870
+ const { variantId, pageId, storyId, html } = params;
871
+ const trimmed = html.trim();
872
+ if (!/<html\b/i.test(trimmed) || !/<body\b/i.test(trimmed)) {
873
+ throw new Error(
874
+ `Invalid preview story markup for ${variantId}/${pageId}/${storyId}: expected a full HTML document with <html> and <body>.`
875
+ );
876
+ }
877
+ const match = trimmed.match(/<body\b[^>]*\bdata-page-id\s*=\s*(['"])([^'"]+)\1/i);
878
+ if (!match) {
879
+ throw new Error(
880
+ `Invalid preview story markup for ${variantId}/${pageId}/${storyId}: missing body[data-page-id].`
881
+ );
882
+ }
883
+ const actualPageId = match[2];
884
+ const expectedPageId = resolveExpectedDataPageId(pageId);
885
+ if (actualPageId !== expectedPageId) {
886
+ throw new Error(
887
+ `Invalid preview story markup for ${variantId}/${pageId}/${storyId}: expected data-page-id="${expectedPageId}", got "${actualPageId}".`
888
+ );
889
+ }
890
+ }
891
+ function normalizeStoriesForPage(params) {
892
+ const { variantId, pageId, rawPage } = params;
893
+ if (!rawPage || typeof rawPage !== "object" || Array.isArray(rawPage)) {
894
+ throw new Error(`Invalid preview page payload for ${variantId}/${pageId}: expected story object.`);
895
+ }
896
+ const rawStories = rawPage;
897
+ if (typeof rawStories.default !== "string") {
898
+ throw new Error(`Invalid preview page payload for ${variantId}/${pageId}: missing default story.`);
899
+ }
900
+ const stories2 = {};
901
+ for (const [storyId, storyHtml] of Object.entries(rawStories)) {
902
+ if (typeof storyHtml !== "string") {
903
+ throw new Error(`Invalid preview story payload for ${variantId}/${pageId}/${storyId}: expected string HTML.`);
904
+ }
905
+ const sanitizedStoryHtml = stripScriptTags(storyHtml);
906
+ validateStoryHtmlContract({
907
+ variantId,
908
+ pageId,
909
+ storyId,
910
+ html: sanitizedStoryHtml
911
+ });
912
+ stories2[storyId] = sanitizedStoryHtml;
913
+ }
914
+ return stories2;
915
+ }
916
+ function normalizeVariants(raw) {
917
+ const variants = {};
918
+ for (const [variantId, pages] of Object.entries(raw.variants)) {
919
+ const variantPages = {};
920
+ for (const [pageId, rawPage] of Object.entries(pages ?? {})) {
921
+ variantPages[pageId] = normalizeStoriesForPage({
922
+ variantId,
923
+ pageId,
924
+ rawPage
925
+ });
926
+ }
927
+ variants[variantId] = variantPages;
928
+ }
929
+ return variants;
930
+ }
931
+ function generatePreview(options = {}) {
932
+ const packageRoot = options.packageRoot ?? process2.cwd();
933
+ const outputPath = options.outputPath ?? path.join(packageRoot, "src", "features", "preview", "generated", "pages.json");
934
+ const log = options.quiet ? () => {
935
+ } : (msg) => process2.stdout.write(msg);
936
+ const javaVersion = getJavaMajorVersion();
937
+ if (!javaVersion || javaVersion < MIN_JAVA) {
938
+ const error = `Java ${MIN_JAVA}+ required (found ${javaVersion ?? "none"}). Set JAVA_HOME or add java to PATH.`;
939
+ process2.stderr.write(`${error}
940
+ `);
941
+ return { success: false, outputPath, error };
942
+ }
943
+ log(`Generating preview artifacts (Java ${javaVersion})...
944
+ `);
945
+ const { tempDir, filePath } = writeTempContextMocksFile(options.additionalMocks);
946
+ const customMocksPath = options.customMocksPath ?? resolveCustomMocksPath(packageRoot);
947
+ const outputDir = path.dirname(outputPath);
948
+ fs.mkdirSync(outputDir, { recursive: true });
949
+ let result;
950
+ if (options.jarPath) {
951
+ result = runJar({
952
+ jarPath: options.jarPath,
953
+ contextMocksPath: filePath,
954
+ packageRoot,
955
+ outputDir,
956
+ customMocksPath
957
+ });
958
+ } else {
959
+ const pomPath = path.join(packageRoot, "tools", "preview-renderer", "pom.xml");
960
+ result = runMaven(pomPath, filePath, customMocksPath);
961
+ }
962
+ fs.rmSync(tempDir, { recursive: true, force: true });
963
+ if (result.status !== 0) {
964
+ return { success: false, outputPath, error: `Java renderer exited with code ${result.status}` };
965
+ }
966
+ const raw = readJson(outputPath);
967
+ if (!raw?.variants || Object.keys(raw.variants).length === 0) {
968
+ return { success: false, outputPath, error: `Generated artifact is missing variants: ${outputPath}` };
969
+ }
970
+ const variants = normalizeVariants(raw);
971
+ const pagesData = {
972
+ generatedAt: raw.generatedAt,
973
+ keycloakTag: raw.keycloakTag,
974
+ variants
975
+ };
976
+ fs.writeFileSync(outputPath, `${JSON.stringify(pagesData, null, 2)}
977
+ `, "utf8");
978
+ log("Preview generation complete.\n");
979
+ return { success: true, outputPath, pagesData };
980
+ }
981
+ var isDirectRun = process2.argv[1]?.replace(/\\/g, "/").endsWith("tools/generate-preview.ts") || process2.argv[1]?.replace(/\\/g, "/").endsWith("tools/generate-preview");
982
+ if (isDirectRun) {
983
+ const result = generatePreview();
984
+ if (!result.success) {
985
+ process2.exitCode = 1;
986
+ }
987
+ }
988
+
989
+ // bin/cli.ts
990
+ var PACKAGE_ROOT = path2.resolve(import.meta.dirname, "..");
991
+ var DEFAULT_PORT = 4800;
992
+ var MIN_JAVA2 = 25;
993
+ var sseClients = /* @__PURE__ */ new Set();
994
+ function resolveUserPagesDir(pagesArg) {
995
+ if (pagesArg) {
996
+ const resolved = path2.resolve(pagesArg);
997
+ if (!fs2.existsSync(resolved)) {
998
+ console.error(`Pages directory not found: ${resolved}`);
999
+ process3.exit(1);
1000
+ }
1001
+ return resolved;
1002
+ }
1003
+ const conventions = ["./pages", "./keycloak-theme", "./src/keycloak-theme"];
1004
+ for (const dir of conventions) {
1005
+ const resolved = path2.resolve(dir);
1006
+ if (fs2.existsSync(resolved)) {
1007
+ console.log(`Auto-discovered pages directory: ${resolved}`);
1008
+ return resolved;
1009
+ }
1010
+ }
1011
+ return void 0;
1012
+ }
1013
+ async function loadUserMocks(pagesDir) {
1014
+ const kcPagePath = path2.join(pagesDir, "kc-page.ts");
1015
+ const kcPageJsPath = path2.join(pagesDir, "kc-page.js");
1016
+ const userPageFile = fs2.existsSync(kcPagePath) ? kcPagePath : fs2.existsSync(kcPageJsPath) ? kcPageJsPath : null;
1017
+ if (!userPageFile) {
1018
+ return void 0;
1019
+ }
1020
+ console.log(`Loading user page mocks from: ${userPageFile}`);
1021
+ const jiti = createJiti(pagesDir, { interopDefault: true });
1022
+ const userPage = await jiti.import(userPageFile);
1023
+ if (!userPage.getKcContextMock || !userPage.kcContextMocks) {
1024
+ console.warn("Warning: kc-page.ts must export getKcContextMock and kcContextMocks. Skipping user mocks.");
1025
+ return void 0;
1026
+ }
1027
+ const storyPath = path2.join(pagesDir, "kc-page-story.ts");
1028
+ const storyJsPath = path2.join(pagesDir, "kc-page-story.js");
1029
+ const storyFile = fs2.existsSync(storyPath) ? storyPath : fs2.existsSync(storyJsPath) ? storyJsPath : null;
1030
+ let userStories = {};
1031
+ if (storyFile) {
1032
+ const storyModule = await jiti.import(storyFile);
1033
+ userStories = storyModule.stories ?? {};
1034
+ }
1035
+ const pages = {};
1036
+ for (const mock of userPage.kcContextMocks) {
1037
+ const name = mock.pageId.replace(".ftl", "");
1038
+ pages[name] = JSON.parse(JSON.stringify(
1039
+ userPage.getKcContextMock({ pageId: mock.pageId })
1040
+ ));
1041
+ for (const [storyId, override] of Object.entries(userStories[name] ?? {})) {
1042
+ pages[`${name}@${storyId}`] = JSON.parse(JSON.stringify(
1043
+ userPage.getKcContextMock({ pageId: mock.pageId, overrides: override })
1044
+ ));
1045
+ }
1046
+ }
1047
+ return { common: {}, pages };
1048
+ }
1049
+ function broadcastSSE(event, data) {
1050
+ const message = `event: ${event}
1051
+ data: ${data ?? ""}
1052
+
1053
+ `;
1054
+ for (const client of sseClients) {
1055
+ client.write(message);
1056
+ }
1057
+ }
1058
+ function startServer(opts) {
1059
+ const { port, distDir, pagesJsonPath, publicDir } = opts;
1060
+ const serveDist = sirv(distDir, { single: true, dev: true });
1061
+ const servePublic = sirv(publicDir, { dev: true });
1062
+ const server = createServer((req, res) => {
1063
+ const url = req.url ?? "/";
1064
+ if (url === "/api/pages.json") {
1065
+ if (!fs2.existsSync(pagesJsonPath)) {
1066
+ res.writeHead(404, { "Content-Type": "application/json" });
1067
+ res.end(JSON.stringify({ error: "pages.json not generated yet" }));
1068
+ return;
1069
+ }
1070
+ res.writeHead(200, {
1071
+ "Content-Type": "application/json",
1072
+ "Cache-Control": "no-cache"
1073
+ });
1074
+ fs2.createReadStream(pagesJsonPath).pipe(res);
1075
+ return;
1076
+ }
1077
+ if (url === "/api/events") {
1078
+ res.writeHead(200, {
1079
+ "Content-Type": "text/event-stream",
1080
+ "Cache-Control": "no-cache",
1081
+ "Connection": "keep-alive"
1082
+ });
1083
+ res.write("event: connected\ndata: \n\n");
1084
+ sseClients.add(res);
1085
+ req.on("close", () => sseClients.delete(res));
1086
+ return;
1087
+ }
1088
+ if (url.startsWith("/keycloak-upstream/") || url.startsWith("/keycloak-dev-resources/")) {
1089
+ servePublic(req, res, () => {
1090
+ res.writeHead(404);
1091
+ res.end("Not found");
1092
+ });
1093
+ return;
1094
+ }
1095
+ serveDist(req, res, () => {
1096
+ res.writeHead(404);
1097
+ res.end("Not found");
1098
+ });
1099
+ });
1100
+ server.listen(port, () => {
1101
+ console.log(`
1102
+ Keycloak Theme Editor running at:
1103
+ `);
1104
+ console.log(` http://localhost:${port}
1105
+ `);
1106
+ });
1107
+ return server;
1108
+ }
1109
+ function startWatcher(opts) {
1110
+ const { pagesDir, jarPath, outputPath, additionalMocks } = opts;
1111
+ let debounceTimer = null;
1112
+ const watcher = watch(pagesDir, {
1113
+ ignoreInitial: true,
1114
+ ignored: /(^|[/\\])\../
1115
+ // ignore dotfiles
1116
+ });
1117
+ function regenerate() {
1118
+ console.log("File change detected, regenerating previews...");
1119
+ const result = generatePreview({
1120
+ packageRoot: PACKAGE_ROOT,
1121
+ jarPath,
1122
+ outputPath,
1123
+ additionalMocks,
1124
+ quiet: true
1125
+ });
1126
+ if (result.success) {
1127
+ console.log("Previews regenerated.");
1128
+ broadcastSSE("pages-updated");
1129
+ } else {
1130
+ console.error("Preview regeneration failed:", result.error);
1131
+ }
1132
+ }
1133
+ watcher.on("all", (_event, filePath) => {
1134
+ if (!filePath.endsWith(".ftl") && !filePath.endsWith(".properties")) {
1135
+ return;
1136
+ }
1137
+ if (debounceTimer) {
1138
+ clearTimeout(debounceTimer);
1139
+ }
1140
+ debounceTimer = setTimeout(regenerate, 300);
1141
+ });
1142
+ return watcher;
1143
+ }
1144
+ function initProject() {
1145
+ const pagesDir = path2.resolve("pages");
1146
+ if (fs2.existsSync(pagesDir)) {
1147
+ console.error(`Directory already exists: ${pagesDir}`);
1148
+ process3.exit(1);
1149
+ }
1150
+ const loginDir = path2.join(pagesDir, "login");
1151
+ fs2.mkdirSync(loginDir, { recursive: true });
1152
+ fs2.writeFileSync(path2.join(loginDir, "my-custom-page.ftl"), `<#import "template.ftl" as layout>
1153
+ <@layout.registrationLayout displayMessage=true; section>
1154
+ <#if section = "header">
1155
+ \${msg("loginAccountTitle")}
1156
+ <#elseif section = "form">
1157
+ <div id="kc-form">
1158
+ <p>This is a custom page. Edit this template and it will live-reload in the editor.</p>
1159
+ </div>
1160
+ </#if>
1161
+ </@layout.registrationLayout>
1162
+ `);
1163
+ fs2.writeFileSync(path2.join(pagesDir, "kc-page.ts"), `import { createGetKcContextMock } from "keycloakify/login/KcContext";
1164
+ export { kcContextMocks } from "keycloakify/login/KcContext/kcContextMocks";
1165
+
1166
+ export const { getKcContextMock } = createGetKcContextMock({
1167
+ kcContextExtension: { properties: {} },
1168
+ overrides: {
1169
+ url: {
1170
+ resourcesPath: "/keycloak-dev-resources",
1171
+ resourcesCommonPath: "/keycloak-dev-resources/resources-common",
1172
+ },
1173
+ },
1174
+ kcContextExtensionPerPage: {
1175
+ // Add custom page context here:
1176
+ // "my-custom-page.ftl": { myField: "value" },
1177
+ },
1178
+ overridesPerPage: {},
1179
+ });
1180
+ `);
1181
+ fs2.writeFileSync(path2.join(pagesDir, "kc-page-story.ts"), `// Define story variants for different page states.
1182
+ // Each story renders the page with different mock context values.
1183
+ export const stories: Record<string, Record<string, Record<string, unknown>>> = {
1184
+ // Example:
1185
+ // "login": {
1186
+ // "with-error": {
1187
+ // message: { type: "error", summary: "Invalid credentials" },
1188
+ // },
1189
+ // },
1190
+ };
1191
+ `);
1192
+ console.log(`
1193
+ Created pages directory: ${pagesDir}
1194
+ `);
1195
+ console.log("Files:");
1196
+ console.log(" pages/login/my-custom-page.ftl \u2014 example custom FTL template");
1197
+ console.log(" pages/kc-page.ts \u2014 page context mocks (requires keycloakify)");
1198
+ console.log(" pages/kc-page-story.ts \u2014 story variants for different states");
1199
+ console.log("\nNext steps:");
1200
+ console.log(" npm install keycloakify \u2014 install keycloakify for custom page mocks");
1201
+ console.log(" npx keycloak-theme-editor \u2014 start the editor (auto-discovers ./pages)");
1202
+ console.log("");
1203
+ }
1204
+ async function main() {
1205
+ program.name("keycloak-theme-editor").description("Visual theme editor for Keycloak login pages").option("--pages <dir>", "Path to custom FTL pages directory").option("--port <number>", "Port to run the editor on", String(DEFAULT_PORT)).option("--no-open", "Do not open browser automatically");
1206
+ program.command("init").description("Scaffold a pages directory with example custom FTL + mocks").action(() => {
1207
+ initProject();
1208
+ process3.exit(0);
1209
+ });
1210
+ program.parse();
1211
+ const opts = program.opts();
1212
+ const port = Number.parseInt(opts.port, 10);
1213
+ const userPagesDir = resolveUserPagesDir(opts.pages);
1214
+ const javaVersion = getJavaMajorVersion();
1215
+ if (!javaVersion || javaVersion < MIN_JAVA2) {
1216
+ console.error(`Java ${MIN_JAVA2}+ is required (found ${javaVersion ?? "none"}).`);
1217
+ console.error("Install Java and ensure it is on your PATH, or set JAVA_HOME.");
1218
+ process3.exit(1);
1219
+ }
1220
+ const jarPath = path2.join(PACKAGE_ROOT, "tools", "preview-renderer", "preview-renderer.jar");
1221
+ const distDir = path2.join(PACKAGE_ROOT, "dist");
1222
+ const publicDir = path2.join(PACKAGE_ROOT, "public");
1223
+ const outputDir = fs2.mkdtempSync(path2.join(import.meta.dirname, ".preview-"));
1224
+ const pagesJsonPath = path2.join(outputDir, "pages.json");
1225
+ if (!fs2.existsSync(jarPath)) {
1226
+ console.error(`Renderer JAR not found at ${jarPath}`);
1227
+ console.error('Run "npm run build:jar" first, or reinstall the package.');
1228
+ process3.exit(1);
1229
+ }
1230
+ if (!fs2.existsSync(distDir)) {
1231
+ console.error(`Built SPA not found at ${distDir}`);
1232
+ console.error('Run "npm run build" first, or reinstall the package.');
1233
+ process3.exit(1);
1234
+ }
1235
+ let additionalMocks;
1236
+ if (userPagesDir) {
1237
+ additionalMocks = await loadUserMocks(userPagesDir);
1238
+ }
1239
+ console.log("Generating preview pages...");
1240
+ const result = generatePreview({
1241
+ packageRoot: PACKAGE_ROOT,
1242
+ jarPath,
1243
+ outputPath: pagesJsonPath,
1244
+ additionalMocks
1245
+ });
1246
+ if (!result.success) {
1247
+ console.error("Failed to generate previews:", result.error);
1248
+ process3.exit(1);
1249
+ }
1250
+ startServer({ port, distDir, pagesJsonPath, publicDir });
1251
+ if (userPagesDir) {
1252
+ startWatcher({ pagesDir: userPagesDir, jarPath, outputPath: pagesJsonPath, additionalMocks });
1253
+ console.log(` Watching for changes in: ${userPagesDir}`);
1254
+ }
1255
+ if (opts.open) {
1256
+ await open(`http://localhost:${port}`);
1257
+ }
1258
+ process3.on("SIGINT", () => {
1259
+ fs2.rmSync(outputDir, { recursive: true, force: true });
1260
+ process3.exit(0);
1261
+ });
1262
+ process3.on("SIGTERM", () => {
1263
+ fs2.rmSync(outputDir, { recursive: true, force: true });
1264
+ process3.exit(0);
1265
+ });
1266
+ }
1267
+ main().catch((err) => {
1268
+ console.error(err);
1269
+ process3.exit(1);
1270
+ });