@keycloakify/svelte 0.2.7 → 0.2.8

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 (127) hide show
  1. package/keycloakify-svelte/account/DefaultPage.svelte +1 -1
  2. package/keycloakify-svelte/account/Template.svelte +14 -7
  3. package/keycloakify-svelte/account/pages/Account.svelte +10 -8
  4. package/keycloakify-svelte/account/pages/Applications.svelte +8 -6
  5. package/keycloakify-svelte/account/pages/FederatedIdentity.svelte +2 -2
  6. package/keycloakify-svelte/account/pages/Log.svelte +8 -6
  7. package/keycloakify-svelte/account/pages/Password.svelte +10 -8
  8. package/keycloakify-svelte/account/pages/Sessions.svelte +8 -6
  9. package/keycloakify-svelte/account/pages/Totp.svelte +8 -6
  10. package/keycloakify-svelte/bin/200.index.js +27 -28
  11. package/keycloakify-svelte/bin/266.index.js +47 -49
  12. package/keycloakify-svelte/bin/{343.index.js → 545.index.js} +4079 -2565
  13. package/keycloakify-svelte/bin/709.index.js +40 -41
  14. package/keycloakify-svelte/bin/818.index.js +57 -59
  15. package/keycloakify-svelte/bin/index.js +626 -1903
  16. package/keycloakify-svelte/login/DefaultPage.svelte +1 -1
  17. package/keycloakify-svelte/login/Template.svelte +14 -8
  18. package/keycloakify-svelte/login/components/AddRemoveButtonsMultiValuedAttribute.svelte +6 -4
  19. package/keycloakify-svelte/login/components/AddRemoveButtonsMultiValuedAttribute.svelte.d.ts +1 -1
  20. package/keycloakify-svelte/login/components/GroupLabel.svelte +11 -9
  21. package/keycloakify-svelte/login/components/InputFieldByType.svelte +2 -2
  22. package/keycloakify-svelte/login/components/InputTag.svelte +5 -5
  23. package/keycloakify-svelte/login/components/InputTagSelects.svelte +51 -47
  24. package/keycloakify-svelte/login/components/LogoutOtherSessions.svelte +1 -1
  25. package/keycloakify-svelte/login/components/PasswordWrapper.svelte +2 -2
  26. package/keycloakify-svelte/login/components/SelectTag.svelte +21 -19
  27. package/keycloakify-svelte/login/components/TermsAcceptance.svelte +1 -1
  28. package/keycloakify-svelte/login/components/TextareaTag.svelte +6 -3
  29. package/keycloakify-svelte/login/components/UserProfileFormFields.svelte +6 -6
  30. package/keycloakify-svelte/login/pages/Code.svelte +9 -7
  31. package/keycloakify-svelte/login/pages/DeleteAccountConfirm.svelte +8 -6
  32. package/keycloakify-svelte/login/pages/DeleteCredential.svelte +8 -6
  33. package/keycloakify-svelte/login/pages/Error.svelte +2 -2
  34. package/keycloakify-svelte/login/pages/FrontchannelLogout.svelte +2 -2
  35. package/keycloakify-svelte/login/pages/IdpReviewUserProfile.svelte +8 -6
  36. package/keycloakify-svelte/login/pages/Info.svelte +2 -2
  37. package/keycloakify-svelte/login/pages/Login.svelte +10 -7
  38. package/keycloakify-svelte/login/pages/LoginConfigTotp.svelte +8 -6
  39. package/keycloakify-svelte/login/pages/LoginIdpLinkConfirm.svelte +8 -6
  40. package/keycloakify-svelte/login/pages/LoginIdpLinkConfirmOverride.svelte +8 -6
  41. package/keycloakify-svelte/login/pages/LoginIdpLinkEmail.svelte +2 -2
  42. package/keycloakify-svelte/login/pages/LoginOauth2DeviceVerifyUserCode.svelte +8 -6
  43. package/keycloakify-svelte/login/pages/LoginOauthGrant.svelte +8 -6
  44. package/keycloakify-svelte/login/pages/LoginOtp.svelte +8 -6
  45. package/keycloakify-svelte/login/pages/LoginPageExpired.svelte +2 -2
  46. package/keycloakify-svelte/login/pages/LoginPasskeysConditionalAuthenticate.svelte +14 -7
  47. package/keycloakify-svelte/login/pages/LoginPassword.svelte +8 -6
  48. package/keycloakify-svelte/login/pages/LoginRecoveryAuthnCodeConfig.svelte +10 -7
  49. package/keycloakify-svelte/login/pages/LoginRecoveryAuthnCodeInput.svelte +8 -6
  50. package/keycloakify-svelte/login/pages/LoginResetOtp.svelte +8 -6
  51. package/keycloakify-svelte/login/pages/LoginResetPassword.svelte +8 -6
  52. package/keycloakify-svelte/login/pages/LoginUpdatePassword.svelte +8 -6
  53. package/keycloakify-svelte/login/pages/LoginUpdateProfile.svelte +8 -6
  54. package/keycloakify-svelte/login/pages/LoginUsername.svelte +9 -7
  55. package/keycloakify-svelte/login/pages/LoginVerifyEmail.svelte +2 -2
  56. package/keycloakify-svelte/login/pages/LoginX509Info.svelte +8 -6
  57. package/keycloakify-svelte/login/pages/LogoutConfirm.svelte +8 -6
  58. package/keycloakify-svelte/login/pages/Register.svelte +9 -7
  59. package/keycloakify-svelte/login/pages/SamlPostForm.svelte +2 -2
  60. package/keycloakify-svelte/login/pages/SelectAuthenticator.svelte +3 -3
  61. package/keycloakify-svelte/login/pages/Terms.svelte +8 -6
  62. package/keycloakify-svelte/login/pages/UpdateEmail.svelte +8 -6
  63. package/keycloakify-svelte/login/pages/WebauthnAuthenticate.svelte +6 -5
  64. package/keycloakify-svelte/login/pages/WebauthnError.svelte +8 -6
  65. package/keycloakify-svelte/login/pages/WebauthnRegister.svelte +6 -5
  66. package/package.json +22 -20
  67. package/src/account/DefaultPage.svelte +1 -1
  68. package/src/account/Template.svelte +14 -7
  69. package/src/account/pages/Account.svelte +10 -8
  70. package/src/account/pages/Applications.svelte +8 -6
  71. package/src/account/pages/FederatedIdentity.svelte +2 -2
  72. package/src/account/pages/Log.svelte +8 -6
  73. package/src/account/pages/Password.svelte +10 -8
  74. package/src/account/pages/Sessions.svelte +8 -6
  75. package/src/account/pages/Totp.svelte +8 -6
  76. package/src/bin/initialize-account-theme/boilerplate/KcPage.svelte +3 -3
  77. package/src/bin/initialize-account-theme/boilerplate/KcPageStory.svelte +1 -1
  78. package/src/bin/initialize-account-theme/initialize-account-theme.ts +2 -1
  79. package/src/login/DefaultPage.svelte +1 -1
  80. package/src/login/Template.svelte +14 -8
  81. package/src/login/components/AddRemoveButtonsMultiValuedAttribute.svelte +6 -4
  82. package/src/login/components/GroupLabel.svelte +11 -9
  83. package/src/login/components/InputFieldByType.svelte +2 -2
  84. package/src/login/components/InputTag.svelte +5 -5
  85. package/src/login/components/InputTagSelects.svelte +51 -47
  86. package/src/login/components/LogoutOtherSessions.svelte +1 -1
  87. package/src/login/components/PasswordWrapper.svelte +2 -2
  88. package/src/login/components/SelectTag.svelte +21 -19
  89. package/src/login/components/TermsAcceptance.svelte +1 -1
  90. package/src/login/components/TextareaTag.svelte +6 -3
  91. package/src/login/components/UserProfileFormFields.svelte +6 -6
  92. package/src/login/pages/Code.svelte +9 -7
  93. package/src/login/pages/DeleteAccountConfirm.svelte +8 -6
  94. package/src/login/pages/DeleteCredential.svelte +8 -6
  95. package/src/login/pages/Error.svelte +2 -2
  96. package/src/login/pages/FrontchannelLogout.svelte +2 -2
  97. package/src/login/pages/IdpReviewUserProfile.svelte +8 -6
  98. package/src/login/pages/Info.svelte +2 -2
  99. package/src/login/pages/Login.svelte +10 -7
  100. package/src/login/pages/LoginConfigTotp.svelte +8 -6
  101. package/src/login/pages/LoginIdpLinkConfirm.svelte +8 -6
  102. package/src/login/pages/LoginIdpLinkConfirmOverride.svelte +8 -6
  103. package/src/login/pages/LoginIdpLinkEmail.svelte +2 -2
  104. package/src/login/pages/LoginOauth2DeviceVerifyUserCode.svelte +8 -6
  105. package/src/login/pages/LoginOauthGrant.svelte +8 -6
  106. package/src/login/pages/LoginOtp.svelte +8 -6
  107. package/src/login/pages/LoginPageExpired.svelte +2 -2
  108. package/src/login/pages/LoginPasskeysConditionalAuthenticate.svelte +14 -7
  109. package/src/login/pages/LoginPassword.svelte +8 -6
  110. package/src/login/pages/LoginRecoveryAuthnCodeConfig.svelte +10 -7
  111. package/src/login/pages/LoginRecoveryAuthnCodeInput.svelte +8 -6
  112. package/src/login/pages/LoginResetOtp.svelte +8 -6
  113. package/src/login/pages/LoginResetPassword.svelte +8 -6
  114. package/src/login/pages/LoginUpdatePassword.svelte +8 -6
  115. package/src/login/pages/LoginUpdateProfile.svelte +8 -6
  116. package/src/login/pages/LoginUsername.svelte +9 -7
  117. package/src/login/pages/LoginVerifyEmail.svelte +2 -2
  118. package/src/login/pages/LoginX509Info.svelte +8 -6
  119. package/src/login/pages/LogoutConfirm.svelte +8 -6
  120. package/src/login/pages/Register.svelte +9 -7
  121. package/src/login/pages/SamlPostForm.svelte +2 -2
  122. package/src/login/pages/SelectAuthenticator.svelte +3 -3
  123. package/src/login/pages/Terms.svelte +8 -6
  124. package/src/login/pages/UpdateEmail.svelte +8 -6
  125. package/src/login/pages/WebauthnAuthenticate.svelte +6 -5
  126. package/src/login/pages/WebauthnError.svelte +8 -6
  127. package/src/login/pages/WebauthnRegister.svelte +6 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keycloakify/svelte",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Svelte Components for Keycloakify",
5
5
  "keywords": [
6
6
  "keycloak",
@@ -437,36 +437,38 @@
437
437
  "svelte": "^5.0.0"
438
438
  },
439
439
  "devDependencies": {
440
- "@sveltejs/adapter-auto": "^7.0.0",
441
- "@sveltejs/kit": "^2.48.5",
442
- "@sveltejs/package": "^2.5.4",
443
- "@sveltejs/vite-plugin-svelte": "^6.2.1",
440
+ "@eslint/js": "^10.0.1",
441
+ "@sveltejs/adapter-auto": "^7.0.1",
442
+ "@sveltejs/kit": "^2.53.4",
443
+ "@sveltejs/package": "^2.5.7",
444
+ "@sveltejs/vite-plugin-svelte": "^6.2.4",
444
445
  "@types/eslint": "^9.6.1",
445
446
  "@types/node": "^24.10.1",
446
447
  "@vercel/ncc": "^0.38.4",
448
+ "chalk": "^5.6.2",
447
449
  "cli-select": "^1.1.2",
448
450
  "conventional-changelog": "^7.1.1",
449
451
  "conventional-changelog-angular": "^8.1.0",
450
- "eslint": "^9.39.1",
452
+ "eslint": "^10.0.2",
451
453
  "eslint-config-prettier": "^10.1.8",
452
- "eslint-plugin-prettier": "^5.5.4",
453
- "eslint-plugin-svelte": "^3.13.0",
454
- "eslint-plugin-unused-imports": "^4.3.0",
455
- "globals": "^16.5.0",
454
+ "eslint-plugin-prettier": "^5.5.5",
455
+ "eslint-plugin-svelte": "^3.15.0",
456
+ "eslint-plugin-unused-imports": "^4.4.1",
457
+ "globals": "^17.3.0",
456
458
  "husky": "^9.1.7",
457
- "keycloakify": "^11.11.3",
458
- "npm-check-updates": "^19.1.2",
459
- "prettier": "^3.6.2",
460
- "prettier-plugin-svelte": "^3.4.0",
461
- "publint": "^0.3.15",
462
- "svelte": "^5.43.7",
463
- "svelte-check": "^4.3.4",
459
+ "keycloakify": "^11.15.1",
460
+ "npm-check-updates": "^19.6.3",
461
+ "prettier": "^3.8.1",
462
+ "prettier-plugin-svelte": "^3.5.0",
463
+ "publint": "^0.3.17",
464
+ "svelte": "^5.53.6",
465
+ "svelte-check": "^4.4.4",
464
466
  "ts-node": "^10.9.2",
465
467
  "tsx": "4.20.4",
466
468
  "typescript": "~5.9.3",
467
- "typescript-eslint": "^8.46.4",
468
- "vite": "^7.2.2",
469
- "zod": "^4.1.12"
469
+ "typescript-eslint": "^8.56.1",
470
+ "vite": "^7.3.1",
471
+ "zod": "^4.3.6"
470
472
  },
471
473
  "bin": {
472
474
  "_keycloakify-custom-handler": "keycloakify-svelte/bin/index.js"
@@ -4,7 +4,7 @@
4
4
  import type { KcContext } from './KcContext';
5
5
 
6
6
  const props: PageProps<KcContext, I18n> = $props();
7
- const { kcContext: kcContext, ...rest } = props;
7
+ const { kcContext, ...rest } = $derived(props);
8
8
  const loadComponent = () => {
9
9
  switch (kcContext.pageId) {
10
10
  case 'password.ftl':
@@ -4,17 +4,17 @@
4
4
  import { useSetClassName } from '@keycloakify/svelte/tools/useSetClassName';
5
5
  import { getKcClsx } from 'keycloakify/account/lib/kcClsx';
6
6
  import { clsx } from 'keycloakify/tools/clsx';
7
- import { onMount } from 'svelte';
7
+ import { onMount, untrack } from 'svelte';
8
8
  import type { I18n } from './i18n';
9
9
  import type { KcContext } from './KcContext';
10
10
  import { kcSanitize } from 'keycloakify/lib/kcSanitize';
11
11
 
12
12
  const { kcContext, i18n, doUseDefaultCss, active, classes, children }: TemplateProps<KcContext, I18n> = $props();
13
- const { kcClsx } = getKcClsx({ doUseDefaultCss, classes });
13
+ const { kcClsx } = $derived(getKcClsx({ doUseDefaultCss, classes }));
14
14
 
15
- const { msg, msgStr, currentLanguage, enabledLanguages } = $i18n;
15
+ const { msg, msgStr, currentLanguage, enabledLanguages } = $derived($i18n);
16
16
 
17
- const { url, features, realm, message, referrer } = kcContext;
17
+ const { url, features, realm, message, referrer } = $derived(kcContext);
18
18
 
19
19
  onMount(() => {
20
20
  document.title = msgStr('accountManagementTitle');
@@ -22,15 +22,22 @@
22
22
 
23
23
  useSetClassName({
24
24
  qualifiedName: 'html',
25
- className: kcClsx('kcHtmlClass'),
25
+ className: untrack(() => kcClsx('kcHtmlClass')),
26
26
  });
27
27
 
28
28
  useSetClassName({
29
29
  qualifiedName: 'body',
30
- className: clsx('admin-console', 'user', kcClsx('kcBodyClass')),
30
+ className: clsx(
31
+ 'admin-console',
32
+ 'user',
33
+ untrack(() => kcClsx('kcBodyClass')),
34
+ ),
31
35
  });
32
36
 
33
- const { isReadyToRender } = useInitialize({ kcContext, doUseDefaultCss });
37
+ const { isReadyToRender } = useInitialize({
38
+ kcContext: untrack(() => kcContext),
39
+ doUseDefaultCss: untrack(() => doUseDefaultCss),
40
+ });
34
41
  </script>
35
42
 
36
43
  {#if $isReadyToRender}
@@ -13,19 +13,21 @@
13
13
  ...props
14
14
  }: PageProps<Extract<KcContext, { pageId: 'account.ftl' }>, I18n> = $props();
15
15
 
16
- const classes = {
16
+ const classes = $derived({
17
17
  ...props.classes,
18
18
  kcBodyClass: clsx(props.classes?.kcBodyClass, 'user'),
19
- };
20
-
21
- const { kcClsx } = getKcClsx({
22
- doUseDefaultCss,
23
- classes,
24
19
  });
25
20
 
26
- const { url, realm, messagesPerField, stateChecker, account, referrer } = kcContext;
21
+ const { kcClsx } = $derived(
22
+ getKcClsx({
23
+ doUseDefaultCss,
24
+ classes,
25
+ }),
26
+ );
27
+
28
+ const { url, realm, messagesPerField, stateChecker, account, referrer } = $derived(kcContext);
27
29
 
28
- const { msg } = $i18n;
30
+ const { msg } = $derived($i18n);
29
31
  </script>
30
32
 
31
33
  <Template
@@ -12,18 +12,20 @@
12
12
  classes,
13
13
  }: PageProps<Extract<KcContext, { pageId: 'applications.ftl' }>, I18n> = $props();
14
14
 
15
- const { kcClsx } = getKcClsx({
16
- doUseDefaultCss,
17
- classes,
18
- });
15
+ const { kcClsx } = $derived(
16
+ getKcClsx({
17
+ doUseDefaultCss,
18
+ classes,
19
+ }),
20
+ );
19
21
 
20
22
  const {
21
23
  url,
22
24
  applications: { applications },
23
25
  stateChecker,
24
- } = kcContext;
26
+ } = $derived(kcContext);
25
27
 
26
- const { msg, advancedMsg } = $i18n;
28
+ const { msg, advancedMsg } = $derived($i18n);
27
29
 
28
30
  function isArrayWithEmptyObject(variable: unknown): boolean {
29
31
  return (
@@ -11,8 +11,8 @@
11
11
  classes,
12
12
  }: PageProps<Extract<KcContext, { pageId: 'federatedIdentity.ftl' }>, I18n> = $props();
13
13
 
14
- const { url, federatedIdentity, stateChecker } = kcContext;
15
- const { msg } = $i18n;
14
+ const { url, federatedIdentity, stateChecker } = $derived(kcContext);
15
+ const { msg } = $derived($i18n);
16
16
  </script>
17
17
 
18
18
  <Template
@@ -12,14 +12,16 @@
12
12
  classes,
13
13
  }: PageProps<Extract<KcContext, { pageId: 'log.ftl' }>, I18n> = $props();
14
14
 
15
- const { kcClsx } = getKcClsx({
16
- doUseDefaultCss,
17
- classes,
18
- });
15
+ const { kcClsx } = $derived(
16
+ getKcClsx({
17
+ doUseDefaultCss,
18
+ classes,
19
+ }),
20
+ );
19
21
 
20
- const { log } = kcContext;
22
+ const { log } = $derived(kcContext);
21
23
 
22
- const { msg } = $i18n;
24
+ const { msg } = $derived($i18n);
23
25
  </script>
24
26
 
25
27
  <Template
@@ -14,18 +14,20 @@
14
14
  ...props
15
15
  }: PageProps<Extract<KcContext, { pageId: 'password.ftl' }>, I18n> = $props();
16
16
 
17
- const classes = {
17
+ const classes = $derived({
18
18
  ...props.classes,
19
19
  kcBodyClass: clsx(props.classes?.kcBodyClass, 'password'),
20
- };
21
-
22
- const { kcClsx } = getKcClsx({
23
- doUseDefaultCss,
24
- classes,
25
20
  });
26
- const { url, password, account, stateChecker } = kcContext;
27
21
 
28
- const { msgStr, msg } = $i18n;
22
+ const { kcClsx } = $derived(
23
+ getKcClsx({
24
+ doUseDefaultCss,
25
+ classes,
26
+ }),
27
+ );
28
+ const { url, password, account, stateChecker } = $derived(kcContext);
29
+
30
+ const { msgStr, msg } = $derived($i18n);
29
31
 
30
32
  const [currentPassword, setCurrentPassword] = useState('');
31
33
  const [newPassword, setNewPassword] = useState('');
@@ -12,14 +12,16 @@
12
12
  classes,
13
13
  }: PageProps<Extract<KcContext, { pageId: 'sessions.ftl' }>, I18n> = $props();
14
14
 
15
- const { kcClsx } = getKcClsx({
16
- doUseDefaultCss,
17
- classes,
18
- });
15
+ const { kcClsx } = $derived(
16
+ getKcClsx({
17
+ doUseDefaultCss,
18
+ classes,
19
+ }),
20
+ );
19
21
 
20
- const { url, stateChecker, sessions } = kcContext;
22
+ const { url, stateChecker, sessions } = $derived(kcContext);
21
23
 
22
- const { msg } = $i18n;
24
+ const { msg } = $derived($i18n);
23
25
  </script>
24
26
 
25
27
  <Template
@@ -14,14 +14,16 @@
14
14
  classes,
15
15
  }: PageProps<Extract<KcContext, { pageId: 'totp.ftl' }>, I18n> = $props();
16
16
 
17
- const { kcClsx } = getKcClsx({
18
- doUseDefaultCss,
19
- classes,
20
- });
17
+ const { kcClsx } = $derived(
18
+ getKcClsx({
19
+ doUseDefaultCss,
20
+ classes,
21
+ }),
22
+ );
21
23
 
22
- const { totp, mode, url, messagesPerField, stateChecker } = kcContext;
24
+ const { totp, mode, url, messagesPerField, stateChecker } = $derived(kcContext);
23
25
 
24
- const { msg, msgStr, advancedMsg } = $i18n;
26
+ const { msg, msgStr, advancedMsg } = $derived($i18n);
25
27
  </script>
26
28
 
27
29
  <Template
@@ -6,13 +6,13 @@
6
6
 
7
7
  const { kcContext }: { kcContext: KcContext } = $props();
8
8
 
9
- const { i18n } = useI18n({ kcContext });
10
- const page = async () => {
9
+ const { i18n } = $derived(useI18n({ kcContext }));
10
+ const page = $derived(async () => {
11
11
  switch (kcContext.pageId) {
12
12
  default:
13
13
  return import('@keycloakify/svelte/account/DefaultPage.svelte');
14
14
  }
15
- };
15
+ });
16
16
 
17
17
  const classes = {} satisfies { [key in ClassKey]?: string };
18
18
  </script>
@@ -3,7 +3,7 @@
3
3
  import { getKcContextMock, type KcPageStoryProps } from './KcPageStory';
4
4
 
5
5
  const { pageId, kcContext }: KcPageStoryProps = $props();
6
- const kcContextMock = getKcContextMock({ pageId, overrides: kcContext });
6
+ const kcContextMock = $derived(getKcContextMock({ pageId, overrides: kcContext }));
7
7
  </script>
8
8
 
9
9
  <KcPage kcContext={kcContextMock} />
@@ -26,7 +26,7 @@ export async function command(params: { buildContext: BuildContext }) {
26
26
  }
27
27
 
28
28
  exit_if_uncommitted_changes: {
29
- let hasUncommittedChanges: boolean | undefined = undefined;
29
+ let hasUncommittedChanges: boolean | undefined;
30
30
 
31
31
  try {
32
32
  hasUncommittedChanges =
@@ -73,6 +73,7 @@ export async function command(params: { buildContext: BuildContext }) {
73
73
  account: {
74
74
  isImplemented: true,
75
75
  type: accountThemeType,
76
+ hasEarlyColorSchemeScript: false,
76
77
  },
77
78
  },
78
79
  },
@@ -10,7 +10,7 @@
10
10
  doMakeUserConfirmPassword: boolean;
11
11
  };
12
12
  const props: DefaultPageProps = $props();
13
- const { kcContext: kcContext, ...rest } = props;
13
+ const { kcContext, ...rest } = $derived(props);
14
14
  const loadComponent = () => {
15
15
  switch (kcContext.pageId) {
16
16
  case 'login.ftl':
@@ -5,7 +5,7 @@
5
5
  import { kcSanitize } from 'keycloakify/lib/kcSanitize';
6
6
  import { getKcClsx } from 'keycloakify/login/lib/kcClsx';
7
7
  import { clsx } from 'keycloakify/tools/clsx';
8
- import { onMount } from 'svelte';
8
+ import { onMount, untrack } from 'svelte';
9
9
  import type { I18n } from './i18n';
10
10
  import type { KcContext } from './KcContext';
11
11
 
@@ -24,24 +24,30 @@
24
24
  classes,
25
25
  children,
26
26
  }: TemplateProps<KcContext, I18n> = $props();
27
- const { kcClsx } = getKcClsx({ doUseDefaultCss, classes });
27
+ const { kcClsx } = $derived(getKcClsx({ doUseDefaultCss, classes }));
28
28
 
29
- const { msgStr, currentLanguage, enabledLanguages } = $i18n;
29
+ const { msgStr, currentLanguage, enabledLanguages } = $derived($i18n);
30
+
31
+ const { realm, auth, url, message, isAppInitiatedAction } = $derived(kcContext);
30
32
 
31
- const { realm, auth, url, message, isAppInitiatedAction } = kcContext;
32
33
  onMount(() => {
33
- document.title = documentTitle ?? msgStr('loginTitle', kcContext.realm.displayName);
34
+ document.title = documentTitle ?? untrack(() => msgStr('loginTitle', kcContext.realm.displayName));
34
35
  });
36
+
35
37
  useSetClassName({
36
38
  qualifiedName: 'html',
37
- className: kcClsx('kcHtmlClass'),
39
+ className: untrack(() => kcClsx('kcHtmlClass')),
38
40
  });
39
41
 
40
42
  useSetClassName({
41
43
  qualifiedName: 'body',
42
- className: bodyClassName ?? kcClsx('kcBodyClass'),
44
+ className: untrack(() => bodyClassName ?? kcClsx('kcBodyClass')),
45
+ });
46
+
47
+ const { isReadyToRender } = useInitialize({
48
+ kcContext: untrack(() => kcContext),
49
+ doUseDefaultCss: untrack(() => doUseDefaultCss),
43
50
  });
44
- const { isReadyToRender } = useInitialize({ kcContext, doUseDefaultCss });
45
51
  </script>
46
52
 
47
53
  {#if $isReadyToRender}
@@ -4,7 +4,7 @@
4
4
  type FormAction,
5
5
  } from '@keycloakify/svelte/login/lib/useUserProfileForm';
6
6
  import type { Attribute } from 'keycloakify/login/KcContext';
7
- import type { EventDispatcher } from 'svelte';
7
+ import { untrack, type EventDispatcher } from 'svelte';
8
8
  import type { Readable } from 'svelte/store';
9
9
  import type { I18n } from '../i18n';
10
10
 
@@ -17,11 +17,13 @@
17
17
  };
18
18
  const { attribute, values, fieldIndex, dispatchFormAction, i18n }: AddRemoveButtonsMultiValuedAttributeProps =
19
19
  $props();
20
- const { msg } = $i18n;
20
+ const { msg } = $derived($i18n);
21
21
 
22
- const { hasAdd, hasRemove } = getButtonToDisplayForMultivaluedAttributeField({ attribute, values, fieldIndex });
22
+ const { hasAdd, hasRemove } = $derived(
23
+ getButtonToDisplayForMultivaluedAttributeField({ attribute, values, fieldIndex }),
24
+ );
23
25
 
24
- const idPostfix = `-${attribute.name}-${fieldIndex + 1}`;
26
+ const idPostfix = `-${untrack(() => attribute.name)}-${untrack(() => fieldIndex) + 1}`;
25
27
  </script>
26
28
 
27
29
  {#if hasRemove}
@@ -15,23 +15,25 @@
15
15
  kcClsx: KcClsx;
16
16
  };
17
17
  const { attribute, groupNameRef, i18n, kcClsx }: GroupLabelProps = $props();
18
- const { advancedMsg } = $i18n;
18
+ const { advancedMsg } = $derived($i18n);
19
19
 
20
20
  let isGrouplabel = $state<boolean>(false);
21
- if (attribute.group?.name !== groupNameRef.current) {
22
- groupNameRef.current = attribute.group?.name ?? '';
21
+ $effect(() => {
22
+ if (attribute.group?.name !== groupNameRef.current) {
23
+ groupNameRef.current = attribute.group?.name ?? '';
23
24
 
24
- if (groupNameRef.current !== '') {
25
- assert(attribute.group !== undefined);
26
- isGrouplabel = true;
25
+ if (groupNameRef.current !== '') {
26
+ assert(attribute.group !== undefined);
27
+ isGrouplabel = true;
28
+ }
27
29
  }
28
- }
30
+ });
29
31
 
30
- const html5DataAnnotations = {
32
+ const html5DataAnnotations = $derived({
31
33
  ...Object.fromEntries(
32
34
  Object.entries(attribute.group?.html5DataAnnotations ?? {}).map(([key, value]) => [`data-${key}`, value]),
33
35
  ),
34
- };
36
+ });
35
37
  </script>
36
38
 
37
39
  {#if isGrouplabel}
@@ -8,8 +8,8 @@
8
8
  import type { I18n } from '../i18n';
9
9
 
10
10
  let { displayableErrors, ...props }: InputFieldByTypeProps<I18n> = $props();
11
- const { attribute, valueOrValues } = props;
12
- const inputType = attribute.annotations.inputType ?? '';
11
+ const { attribute, valueOrValues } = $derived(props);
12
+ const inputType = $derived(attribute.annotations.inputType ?? '');
13
13
  </script>
14
14
 
15
15
  {#if inputType === 'hidden'}
@@ -16,9 +16,9 @@
16
16
  displayableErrors = $bindable([]),
17
17
  }: InputTagProps = $props();
18
18
 
19
- const { advancedMsgStr } = $i18n;
20
- const { inputType } = attribute.annotations;
21
- let value = $state(
19
+ const { advancedMsgStr } = $derived($i18n);
20
+ const { inputType } = $derived(attribute.annotations);
21
+ let value = $derived(
22
22
  (() => {
23
23
  if (fieldIndex !== undefined) {
24
24
  assert(valueOrValues instanceof Array);
@@ -30,11 +30,11 @@
30
30
  return valueOrValues;
31
31
  })(),
32
32
  );
33
- const html5DataAnnotations = {
33
+ const html5DataAnnotations = $derived({
34
34
  ...Object.fromEntries(
35
35
  Object.entries(attribute.group?.html5DataAnnotations ?? {}).map(([key, value]) => [`data-${key}`, value]),
36
36
  ),
37
- };
37
+ });
38
38
  </script>
39
39
 
40
40
  <input
@@ -7,59 +7,63 @@
7
7
  const { attribute, dispatchFormAction, kcClsx, i18n, valueOrValues, displayableErrors }: InputFieldByTypeProps<I18n> =
8
8
  $props();
9
9
 
10
- const { classDiv, classInput, classLabel, inputType } = (() => {
11
- const { inputType } = attribute.annotations;
12
-
13
- assert(inputType === 'select-radiobuttons' || inputType === 'multiselect-checkboxes');
14
-
15
- switch (inputType) {
16
- case 'select-radiobuttons':
17
- return {
18
- inputType: 'radio',
19
- classDiv: kcClsx('kcInputClassRadio'),
20
- classInput: kcClsx('kcInputClassRadioInput'),
21
- classLabel: kcClsx('kcInputClassRadioLabel'),
22
- };
23
- case 'multiselect-checkboxes':
24
- return {
25
- inputType: 'checkbox',
26
- classDiv: kcClsx('kcInputClassCheckbox'),
27
- classInput: kcClsx('kcInputClassCheckboxInput'),
28
- classLabel: kcClsx('kcInputClassCheckboxLabel'),
29
- };
30
- default:
31
- return {
32
- inputType: '',
33
- classDiv: '',
34
- classInput: '',
35
- classLabel: '',
36
- };
37
- }
38
- })();
39
-
40
- const options = (() => {
41
- walk: {
42
- const { inputOptionsFromValidation } = attribute.annotations;
43
-
44
- if (inputOptionsFromValidation === undefined) {
45
- break walk;
10
+ const { classDiv, classInput, classLabel, inputType } = $derived(
11
+ (() => {
12
+ const { inputType } = attribute.annotations;
13
+
14
+ assert(inputType === 'select-radiobuttons' || inputType === 'multiselect-checkboxes');
15
+
16
+ switch (inputType) {
17
+ case 'select-radiobuttons':
18
+ return {
19
+ inputType: 'radio',
20
+ classDiv: kcClsx('kcInputClassRadio'),
21
+ classInput: kcClsx('kcInputClassRadioInput'),
22
+ classLabel: kcClsx('kcInputClassRadioLabel'),
23
+ };
24
+ case 'multiselect-checkboxes':
25
+ return {
26
+ inputType: 'checkbox',
27
+ classDiv: kcClsx('kcInputClassCheckbox'),
28
+ classInput: kcClsx('kcInputClassCheckboxInput'),
29
+ classLabel: kcClsx('kcInputClassCheckboxLabel'),
30
+ };
31
+ default:
32
+ return {
33
+ inputType: '',
34
+ classDiv: '',
35
+ classInput: '',
36
+ classLabel: '',
37
+ };
46
38
  }
39
+ })(),
40
+ );
47
41
 
48
- const validator = (attribute.validators as Record<string, { options?: string[] }>)[inputOptionsFromValidation];
42
+ const options = $derived(
43
+ (() => {
44
+ walk: {
45
+ const { inputOptionsFromValidation } = attribute.annotations;
49
46
 
50
- if (validator === undefined) {
51
- break walk;
52
- }
47
+ if (inputOptionsFromValidation === undefined) {
48
+ break walk;
49
+ }
53
50
 
54
- if (validator.options === undefined) {
55
- break walk;
56
- }
51
+ const validator = (attribute.validators as Record<string, { options?: string[] }>)[inputOptionsFromValidation];
52
+
53
+ if (validator === undefined) {
54
+ break walk;
55
+ }
57
56
 
58
- return validator.options;
59
- }
57
+ if (validator.options === undefined) {
58
+ break walk;
59
+ }
60
+
61
+ return validator.options;
62
+ }
60
63
 
61
- return attribute.validators.options?.options ?? [];
62
- })();
64
+ return attribute.validators.options?.options ?? [];
65
+ })(),
66
+ );
63
67
  </script>
64
68
 
65
69
  {#each options as option (option)}
@@ -5,7 +5,7 @@
5
5
 
6
6
  const { kcClsx, i18n }: { kcClsx: KcClsx; i18n: Readable<I18n> } = $props();
7
7
 
8
- const { msg } = $i18n;
8
+ const { msg } = $derived($i18n);
9
9
  </script>
10
10
 
11
11
  <div
@@ -7,9 +7,9 @@
7
7
  import type { Readable } from 'svelte/store';
8
8
 
9
9
  const props: { kcClsx: KcClsx; i18n: Readable<I18n>; passwordInputId: string; children: Snippet } = $props();
10
- const { kcClsx, i18n, passwordInputId, children } = props;
10
+ const { kcClsx, i18n, passwordInputId, children } = $derived(props);
11
11
 
12
- const { msgStr } = $i18n;
12
+ const { msgStr } = $derived($i18n);
13
13
 
14
14
  const [isPasswordRevealed, toggleIsPasswordRevealed] = useReducer<boolean, boolean>(
15
15
  (isPasswordRevealed: boolean) => !isPasswordRevealed,