keycloakify 10.0.0-rc.17 → 10.0.0-rc.19
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.
- package/PUBLIC_URL.js.map +1 -1
- package/account/Template.js +5 -5
- package/account/Template.js.map +1 -1
- package/account/i18n/i18n.js +37 -29
- package/account/i18n/i18n.js.map +1 -1
- package/account/kcContext/KcContext.js.map +1 -1
- package/account/kcContext/createGetKcContext.js +20 -15
- package/account/kcContext/createGetKcContext.js.map +1 -1
- package/account/kcContext/getKcContext.js.map +1 -1
- package/account/kcContext/getKcContextFromWindow.d.ts +3 -1
- package/account/kcContext/getKcContextFromWindow.js.map +1 -1
- package/account/kcContext/kcContextMocks.js +148 -144
- package/account/kcContext/kcContextMocks.js.map +1 -1
- package/account/lib/useGetClassName.js +14 -14
- package/account/lib/useGetClassName.js.map +1 -1
- package/account/pages/Account.js +1 -1
- package/account/pages/Account.js.map +1 -1
- package/account/pages/Password.js +7 -7
- package/account/pages/Password.js.map +1 -1
- package/account/pages/Totp.js +4 -4
- package/account/pages/Totp.js.map +1 -1
- package/bin/main.js +2265 -2028
- package/bin/shared/constants.d.ts +1 -0
- package/bin/shared/constants.js +4 -3
- package/bin/shared/constants.js.map +1 -1
- package/lib/isStorybook.js +2 -1
- package/lib/isStorybook.js.map +1 -1
- package/lib/useGetClassName.js.map +1 -1
- package/login/Template.js +13 -13
- package/login/Template.js.map +1 -1
- package/login/UserProfileFormFields.js +43 -41
- package/login/UserProfileFormFields.js.map +1 -1
- package/login/i18n/baseMessages/ca.d.ts +1 -1
- package/login/i18n/baseMessages/ca.js +1 -1
- package/login/i18n/baseMessages/el.d.ts +0 -1
- package/login/i18n/baseMessages/el.js +0 -1
- package/login/i18n/baseMessages/el.js.map +1 -1
- package/login/i18n/baseMessages/en.d.ts +1 -1
- package/login/i18n/baseMessages/en.js +1 -1
- package/login/i18n/baseMessages/es.d.ts +1 -1
- package/login/i18n/baseMessages/es.js +1 -1
- package/login/i18n/baseMessages/fa.d.ts +0 -1
- package/login/i18n/baseMessages/fa.js +0 -1
- package/login/i18n/baseMessages/fa.js.map +1 -1
- package/login/i18n/baseMessages/hu.d.ts +1 -1
- package/login/i18n/baseMessages/hu.js +1 -1
- package/login/i18n/baseMessages/index.d.ts +1 -2
- package/login/i18n/baseMessages/zh-CN.d.ts +1 -1
- package/login/i18n/baseMessages/zh-CN.js +1 -1
- package/login/i18n/i18n.js +39 -31
- package/login/i18n/i18n.js.map +1 -1
- package/login/kcContext/KcContext.js.map +1 -1
- package/login/kcContext/createGetKcContext.js +30 -22
- package/login/kcContext/createGetKcContext.js.map +1 -1
- package/login/kcContext/getKcContext.js.map +1 -1
- package/login/kcContext/getKcContextFromWindow.d.ts +3 -1
- package/login/kcContext/getKcContextFromWindow.js.map +1 -1
- package/login/kcContext/kcContextMocks.js +233 -231
- package/login/kcContext/kcContextMocks.js.map +1 -1
- package/login/lib/useDownloadTerms.js.map +1 -1
- package/login/lib/useGetClassName.js +112 -112
- package/login/lib/useGetClassName.js.map +1 -1
- package/login/lib/useUserProfileForm.js +181 -181
- package/login/lib/useUserProfileForm.js.map +1 -1
- package/login/pages/DeleteAccountConfirm.js +5 -1
- package/login/pages/DeleteAccountConfirm.js.map +1 -1
- package/login/pages/FrontchannelLogout.js +1 -1
- package/login/pages/FrontchannelLogout.js.map +1 -1
- package/login/pages/Login.js.map +1 -1
- package/login/pages/LoginRecoveryAuthnCodeConfig.js +3 -3
- package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
- package/login/pages/LoginResetPassword.js.map +1 -1
- package/login/pages/LoginUsername.js.map +1 -1
- package/login/pages/WebauthnAuthenticate.js +11 -8
- package/login/pages/WebauthnAuthenticate.js.map +1 -1
- package/login/pages/WebauthnRegister.js +7 -7
- package/login/pages/WebauthnRegister.js.map +1 -1
- package/package.json +232 -226
- package/src/PUBLIC_URL.ts +4 -1
- package/src/account/Template.tsx +5 -5
- package/src/account/TemplateProps.ts +4 -1
- package/src/account/i18n/i18n.tsx +40 -30
- package/src/account/kcContext/KcContext.ts +4 -1
- package/src/account/kcContext/createGetKcContext.ts +48 -22
- package/src/account/kcContext/getKcContext.ts +3 -1
- package/src/account/kcContext/getKcContextFromWindow.ts +6 -2
- package/src/account/kcContext/kcContextMocks.ts +164 -160
- package/src/account/lib/useGetClassName.ts +15 -14
- package/src/account/pages/Account.tsx +2 -2
- package/src/account/pages/Password.tsx +8 -8
- package/src/account/pages/Totp.tsx +4 -6
- package/src/bin/copy-keycloak-resources-to-public.ts +2 -2
- package/src/bin/download-keycloak-default-theme.ts +30 -8
- package/src/bin/eject-page.ts +48 -11
- package/src/bin/initialize-email-theme.ts +25 -17
- package/src/bin/keycloakify/buildJars/buildJar.ts +179 -104
- package/src/bin/keycloakify/buildJars/buildJars.ts +35 -16
- package/src/bin/keycloakify/buildJars/extensionVersions.ts +2 -1
- package/src/bin/keycloakify/buildJars/generatePom.ts +11 -3
- package/src/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.ts +33 -8
- package/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +20 -2
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +49 -12
- package/src/bin/keycloakify/generateSrcMainResources/bringInAccountV1.ts +29 -18
- package/src/bin/keycloakify/generateSrcMainResources/generateMessageProperties.ts +35 -12
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +3 -1
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts +86 -41
- package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts +39 -15
- package/src/bin/keycloakify/generateSrcMainResources/readExtraPageNames.ts +21 -7
- package/src/bin/keycloakify/generateSrcMainResources/readFieldNameUsage.ts +34 -7
- package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +19 -5
- package/src/bin/keycloakify/keycloakify.ts +28 -9
- package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +24 -5
- package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +6 -2
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +6 -3
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +24 -6
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +49 -11
- package/src/bin/main.ts +78 -41
- package/src/bin/shared/KeycloakVersionRange.ts +3 -1
- package/src/bin/shared/buildOptions.ts +70 -43
- package/src/bin/shared/constants.ts +4 -2
- package/src/bin/shared/copyKeycloakResourcesToPublic.ts +27 -13
- package/src/bin/shared/downloadKeycloakDefaultTheme.ts +161 -218
- package/src/bin/shared/downloadKeycloakStaticResources.ts +25 -21
- package/src/bin/shared/getJarFileBasename.ts +3 -1
- package/src/bin/shared/getThemeSrcDirPath.ts +5 -2
- package/src/bin/shared/metaInfKeycloakThemes.ts +35 -8
- package/src/bin/shared/promptKeycloakVersion.ts +33 -14
- package/src/bin/start-keycloak/appBuild.ts +128 -0
- package/src/bin/start-keycloak/index.ts +1 -0
- package/src/bin/start-keycloak/keycloakifyBuild.ts +41 -0
- package/src/bin/start-keycloak/myrealm-realm-23.json +2142 -0
- package/src/bin/start-keycloak/myrealm-realm-24.json +2318 -0
- package/src/bin/start-keycloak/start-keycloak.ts +469 -0
- package/src/bin/tools/SemVer.ts +32 -13
- package/src/bin/tools/String.prototype.replaceAll.ts +9 -2
- package/src/bin/tools/crawl.ts +4 -1
- package/src/bin/tools/crc32.ts +42 -24
- package/src/bin/tools/downloadAndExtractArchive/downloadAndExtractArchive.ts +262 -0
- package/src/bin/tools/downloadAndExtractArchive/fetchProxyOptions.ts +96 -0
- package/src/bin/tools/downloadAndExtractArchive/index.ts +1 -0
- package/src/bin/tools/extractArchive.ts +132 -0
- package/src/bin/tools/fetchProxyOptions.ts +31 -8
- package/src/bin/tools/getAbsoluteAndInOsFormatPath.ts +10 -2
- package/src/bin/tools/getNpmWorkspaceRootDirPath.ts +18 -5
- package/src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts +8 -2
- package/src/bin/tools/octokit-addons/listTags.ts +15 -4
- package/src/bin/tools/partitionPromiseSettledResults.ts +12 -3
- package/src/bin/tools/readThisNpmPackageVersion.ts +5 -1
- package/src/bin/tools/transformCodebase.ts +29 -10
- package/src/bin/tools/trimIndent.ts +4 -1
- package/src/lib/isStorybook.ts +3 -1
- package/src/lib/useGetClassName.ts +12 -3
- package/src/login/Template.tsx +14 -14
- package/src/login/TemplateProps.ts +4 -1
- package/src/login/UserProfileFormFields.tsx +44 -42
- package/src/login/i18n/baseMessages/ca.ts +1 -1
- package/src/login/i18n/baseMessages/el.ts +0 -1
- package/src/login/i18n/baseMessages/en.ts +1 -1
- package/src/login/i18n/baseMessages/es.ts +1 -1
- package/src/login/i18n/baseMessages/fa.ts +0 -1
- package/src/login/i18n/baseMessages/hu.ts +1 -1
- package/src/login/i18n/baseMessages/zh-CN.ts +1 -1
- package/src/login/i18n/i18n.tsx +42 -32
- package/src/login/kcContext/KcContext.ts +8 -2
- package/src/login/kcContext/createGetKcContext.ts +84 -37
- package/src/login/kcContext/getKcContext.ts +3 -1
- package/src/login/kcContext/getKcContextFromWindow.ts +6 -2
- package/src/login/kcContext/kcContextMocks.ts +339 -325
- package/src/login/lib/useDownloadTerms.ts +6 -4
- package/src/login/lib/useGetClassName.ts +119 -112
- package/src/login/lib/useUserProfileForm.tsx +219 -205
- package/src/login/pages/DeleteAccountConfirm.tsx +9 -3
- package/src/login/pages/FrontchannelLogout.tsx +1 -1
- package/src/login/pages/Login.tsx +2 -2
- package/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx +3 -3
- package/src/login/pages/LoginResetPassword.tsx +2 -2
- package/src/login/pages/LoginUsername.tsx +2 -2
- package/src/login/pages/WebauthnAuthenticate.tsx +11 -8
- package/src/login/pages/WebauthnRegister.tsx +7 -7
- package/src/tools/AndByDiscriminatingKey.ts +12 -6
- package/src/tools/Array.prototype.every.ts +4 -1
- package/src/tools/LazyOrNot.ts +3 -1
- package/src/tools/clsx.ts +7 -1
- package/src/tools/deepAssign.ts +15 -8
- package/src/tools/deepClone.ts +3 -1
- package/src/tools/formatNumber.ts +4 -1
- package/src/tools/useConstCallback.ts +3 -1
- package/src/tools/useInsertLinkTags.ts +20 -7
- package/src/tools/useInsertScriptTags.ts +7 -2
- package/src/tools/useSetClassName.ts +4 -1
- package/src/vite-plugin/vite-plugin.ts +45 -21
- package/tools/Array.prototype.every.js +2 -1
- package/tools/Array.prototype.every.js.map +1 -1
- package/tools/clsx.js.map +1 -1
- package/tools/deepAssign.js +9 -7
- package/tools/deepAssign.js.map +1 -1
- package/tools/deepClone.js.map +1 -1
- package/tools/formatNumber.js.map +1 -1
- package/tools/useConstCallback.js.map +1 -1
- package/tools/useInsertLinkTags.js +5 -4
- package/tools/useInsertLinkTags.js.map +1 -1
- package/tools/useInsertScriptTags.js +5 -2
- package/tools/useInsertScriptTags.js.map +1 -1
- package/tools/useSetClassName.js.map +1 -1
- package/vite-plugin/index.js +985 -1651
- package/src/bin/shared/downloadAndUnzip.ts +0 -203
- package/src/bin/start-keycloak.ts +0 -309
- package/src/bin/tools/unzip.ts +0 -141
@@ -3,14 +3,22 @@ import { join as pathJoin, resolve as pathResolve, sep as pathSep } from "path";
|
|
3
3
|
import { assert } from "tsafe/assert";
|
4
4
|
import * as fs from "fs";
|
5
5
|
|
6
|
-
export function getNpmWorkspaceRootDirPath(params: {
|
6
|
+
export function getNpmWorkspaceRootDirPath(params: {
|
7
|
+
reactAppRootDirPath: string;
|
8
|
+
dependencyExpected: string;
|
9
|
+
}) {
|
7
10
|
const { reactAppRootDirPath, dependencyExpected } = params;
|
8
11
|
|
9
12
|
const npmWorkspaceRootDirPath = (function callee(depth: number): string {
|
10
|
-
const cwd = pathResolve(
|
13
|
+
const cwd = pathResolve(
|
14
|
+
pathJoin(...[reactAppRootDirPath, ...Array(depth).fill("..")])
|
15
|
+
);
|
11
16
|
|
12
17
|
try {
|
13
|
-
child_process.execSync("npm config get", {
|
18
|
+
child_process.execSync("npm config get", {
|
19
|
+
cwd,
|
20
|
+
stdio: "ignore"
|
21
|
+
});
|
14
22
|
} catch (error) {
|
15
23
|
if (String(error).includes("ENOWORKSPACES")) {
|
16
24
|
assert(cwd !== pathSep, "NPM workspace not found");
|
@@ -26,11 +34,16 @@ export function getNpmWorkspaceRootDirPath(params: { reactAppRootDirPath: string
|
|
26
34
|
|
27
35
|
assert(fs.existsSync(packageJsonFilePath));
|
28
36
|
|
29
|
-
const parsedPackageJson = JSON.parse(
|
37
|
+
const parsedPackageJson = JSON.parse(
|
38
|
+
fs.readFileSync(packageJsonFilePath).toString("utf8")
|
39
|
+
);
|
30
40
|
|
31
41
|
let isExpectedDependencyFound = false;
|
32
42
|
|
33
|
-
for (const dependenciesOrDevDependencies of [
|
43
|
+
for (const dependenciesOrDevDependencies of [
|
44
|
+
"dependencies",
|
45
|
+
"devDependencies"
|
46
|
+
] as const) {
|
34
47
|
const dependencies = parsedPackageJson[dependenciesOrDevDependencies];
|
35
48
|
|
36
49
|
if (dependencies === undefined) {
|
@@ -5,7 +5,11 @@ import { SemVer } from "../SemVer";
|
|
5
5
|
export function getLatestsSemVersionedTagFactory(params: { octokit: Octokit }) {
|
6
6
|
const { octokit } = params;
|
7
7
|
|
8
|
-
async function getLatestsSemVersionedTag(params: {
|
8
|
+
async function getLatestsSemVersionedTag(params: {
|
9
|
+
owner: string;
|
10
|
+
repo: string;
|
11
|
+
count: number;
|
12
|
+
}): Promise<
|
9
13
|
{
|
10
14
|
tag: string;
|
11
15
|
version: SemVer;
|
@@ -33,7 +37,9 @@ export function getLatestsSemVersionedTagFactory(params: { octokit: Octokit }) {
|
|
33
37
|
semVersionedTags.push({ tag, version });
|
34
38
|
}
|
35
39
|
|
36
|
-
return semVersionedTags
|
40
|
+
return semVersionedTags
|
41
|
+
.sort(({ version: vX }, { version: vY }) => SemVer.compare(vY, vX))
|
42
|
+
.slice(0, count);
|
37
43
|
}
|
38
44
|
|
39
45
|
return { getLatestsSemVersionedTag };
|
@@ -5,11 +5,19 @@ const per_page = 99;
|
|
5
5
|
export function listTagsFactory(params: { octokit: Octokit }) {
|
6
6
|
const { octokit } = params;
|
7
7
|
|
8
|
-
const octokit_repo_listTags = async (params: {
|
8
|
+
const octokit_repo_listTags = async (params: {
|
9
|
+
owner: string;
|
10
|
+
repo: string;
|
11
|
+
per_page: number;
|
12
|
+
page: number;
|
13
|
+
}) => {
|
9
14
|
return octokit.repos.listTags(params);
|
10
15
|
};
|
11
16
|
|
12
|
-
async function* listTags(params: {
|
17
|
+
async function* listTags(params: {
|
18
|
+
owner: string;
|
19
|
+
repo: string;
|
20
|
+
}): AsyncGenerator<string> {
|
13
21
|
const { owner, repo } = params;
|
14
22
|
|
15
23
|
let page = 1;
|
@@ -19,7 +27,7 @@ export function listTagsFactory(params: { octokit: Octokit }) {
|
|
19
27
|
owner,
|
20
28
|
repo,
|
21
29
|
per_page,
|
22
|
-
|
30
|
+
page: page++
|
23
31
|
});
|
24
32
|
|
25
33
|
for (const branch of resp.data.map(({ name }) => name)) {
|
@@ -33,7 +41,10 @@ export function listTagsFactory(params: { octokit: Octokit }) {
|
|
33
41
|
}
|
34
42
|
|
35
43
|
/** Returns the same "latest" tag as deno.land/x, not actually the latest though */
|
36
|
-
async function getLatestTag(params: {
|
44
|
+
async function getLatestTag(params: {
|
45
|
+
owner: string;
|
46
|
+
repo: string;
|
47
|
+
}): Promise<string | undefined> {
|
37
48
|
const { owner, repo } = params;
|
38
49
|
|
39
50
|
const itRes = await listTags({ owner, repo }).next();
|
@@ -2,10 +2,19 @@ export type PromiseSettledAndPartitioned<T> = [T[], any[]];
|
|
2
2
|
|
3
3
|
export function partitionPromiseSettledResults<T>() {
|
4
4
|
return [
|
5
|
-
(
|
5
|
+
(
|
6
|
+
[successes, failures]: PromiseSettledAndPartitioned<T>,
|
7
|
+
item: PromiseSettledResult<T>
|
8
|
+
) =>
|
6
9
|
item.status === "rejected"
|
7
|
-
? ([
|
8
|
-
|
10
|
+
? ([
|
11
|
+
successes,
|
12
|
+
[item.reason, ...failures]
|
13
|
+
] as PromiseSettledAndPartitioned<T>)
|
14
|
+
: ([
|
15
|
+
[item.value, ...successes],
|
16
|
+
failures
|
17
|
+
] as PromiseSettledAndPartitioned<T>),
|
9
18
|
[[], []] as PromiseSettledAndPartitioned<T>
|
10
19
|
] as const;
|
11
20
|
}
|
@@ -4,7 +4,11 @@ import * as fs from "fs";
|
|
4
4
|
import { join as pathJoin } from "path";
|
5
5
|
|
6
6
|
export function readThisNpmPackageVersion(): string {
|
7
|
-
const version = JSON.parse(
|
7
|
+
const version = JSON.parse(
|
8
|
+
fs
|
9
|
+
.readFileSync(pathJoin(getThisCodebaseRootDirPath(), "package.json"))
|
10
|
+
.toString("utf8")
|
11
|
+
)["version"];
|
8
12
|
|
9
13
|
assert(typeof version === "string");
|
10
14
|
|
@@ -3,7 +3,11 @@ import * as path from "path";
|
|
3
3
|
import { crawl } from "./crawl";
|
4
4
|
import { rmSync } from "../tools/fs.rmSync";
|
5
5
|
|
6
|
-
type TransformSourceCode = (params: {
|
6
|
+
type TransformSourceCode = (params: {
|
7
|
+
sourceCode: Buffer;
|
8
|
+
filePath: string;
|
9
|
+
fileRelativePath: string;
|
10
|
+
}) =>
|
7
11
|
| {
|
8
12
|
modifiedSourceCode: Buffer;
|
9
13
|
newFileName?: string;
|
@@ -15,18 +19,27 @@ type TransformSourceCode = (params: { sourceCode: Buffer; filePath: string; file
|
|
15
19
|
* If source and destination are the same this function can be used to apply the transformation in place
|
16
20
|
* like filtering out some files or modifying them.
|
17
21
|
* */
|
18
|
-
export function transformCodebase(params: {
|
22
|
+
export function transformCodebase(params: {
|
23
|
+
srcDirPath: string;
|
24
|
+
destDirPath: string;
|
25
|
+
transformSourceCode?: TransformSourceCode;
|
26
|
+
}) {
|
19
27
|
const { srcDirPath, transformSourceCode } = params;
|
20
28
|
|
21
29
|
const isTargetSameAsSource = path.relative(srcDirPath, params.destDirPath) === "";
|
22
30
|
|
23
|
-
const destDirPath = isTargetSameAsSource
|
31
|
+
const destDirPath = isTargetSameAsSource
|
32
|
+
? path.join(srcDirPath, "..", "tmp_xOsPdkPsTdzPs34sOkHs")
|
33
|
+
: params.destDirPath;
|
24
34
|
|
25
35
|
fs.mkdirSync(destDirPath, {
|
26
|
-
|
36
|
+
recursive: true
|
27
37
|
});
|
28
38
|
|
29
|
-
for (const fileRelativePath of crawl({
|
39
|
+
for (const fileRelativePath of crawl({
|
40
|
+
dirPath: srcDirPath,
|
41
|
+
returnedPathsType: "relative to dirPath"
|
42
|
+
})) {
|
30
43
|
const filePath = path.join(srcDirPath, fileRelativePath);
|
31
44
|
const destFilePath = path.join(destDirPath, fileRelativePath);
|
32
45
|
|
@@ -34,7 +47,7 @@ export function transformCodebase(params: { srcDirPath: string; destDirPath: str
|
|
34
47
|
// it using the lower level implementation.
|
35
48
|
if (transformSourceCode === undefined) {
|
36
49
|
fs.mkdirSync(path.dirname(destFilePath), {
|
37
|
-
|
50
|
+
recursive: true
|
38
51
|
});
|
39
52
|
|
40
53
|
fs.copyFileSync(filePath, destFilePath);
|
@@ -43,7 +56,7 @@ export function transformCodebase(params: { srcDirPath: string; destDirPath: str
|
|
43
56
|
}
|
44
57
|
|
45
58
|
const transformSourceCodeResult = transformSourceCode({
|
46
|
-
|
59
|
+
sourceCode: fs.readFileSync(filePath),
|
47
60
|
filePath,
|
48
61
|
fileRelativePath
|
49
62
|
});
|
@@ -53,16 +66,22 @@ export function transformCodebase(params: { srcDirPath: string; destDirPath: str
|
|
53
66
|
}
|
54
67
|
|
55
68
|
fs.mkdirSync(path.dirname(destFilePath), {
|
56
|
-
|
69
|
+
recursive: true
|
57
70
|
});
|
58
71
|
|
59
72
|
const { newFileName, modifiedSourceCode } = transformSourceCodeResult;
|
60
73
|
|
61
|
-
fs.writeFileSync(
|
74
|
+
fs.writeFileSync(
|
75
|
+
path.join(
|
76
|
+
path.dirname(destFilePath),
|
77
|
+
newFileName ?? path.basename(destFilePath)
|
78
|
+
),
|
79
|
+
modifiedSourceCode
|
80
|
+
);
|
62
81
|
}
|
63
82
|
|
64
83
|
if (isTargetSameAsSource) {
|
65
|
-
rmSync(srcDirPath, {
|
84
|
+
rmSync(srcDirPath, { recursive: true });
|
66
85
|
|
67
86
|
fs.renameSync(destDirPath, srcDirPath);
|
68
87
|
}
|
@@ -14,7 +14,10 @@ function populateTemplate(strings: TemplateStringsArray, ...args: unknown[]) {
|
|
14
14
|
if (args[i]) {
|
15
15
|
// if the interpolation value has newlines, indent the interpolation values
|
16
16
|
// using the last known string indent
|
17
|
-
const chunk = String(args[i]).replace(
|
17
|
+
const chunk = String(args[i]).replace(
|
18
|
+
/([\r?\n])/g,
|
19
|
+
"$1" + " ".repeat(lastStringLineLength)
|
20
|
+
);
|
18
21
|
chunks.push(chunk);
|
19
22
|
}
|
20
23
|
}
|
package/src/lib/isStorybook.ts
CHANGED
@@ -1,14 +1,23 @@
|
|
1
1
|
import { clsx } from "keycloakify/tools/clsx";
|
2
2
|
import { useConstCallback } from "keycloakify/tools/useConstCallback";
|
3
3
|
|
4
|
-
export function createUseClassName<ClassKey extends string>(params: {
|
4
|
+
export function createUseClassName<ClassKey extends string>(params: {
|
5
|
+
defaultClasses: Record<ClassKey, string | undefined>;
|
6
|
+
}) {
|
5
7
|
const { defaultClasses } = params;
|
6
8
|
|
7
|
-
function useGetClassName(params: {
|
9
|
+
function useGetClassName(params: {
|
10
|
+
doUseDefaultCss: boolean;
|
11
|
+
classes: Partial<Record<ClassKey, string>> | undefined;
|
12
|
+
}) {
|
8
13
|
const { classes, doUseDefaultCss } = params;
|
9
14
|
|
10
15
|
const getClassName = useConstCallback((classKey: ClassKey): string => {
|
11
|
-
return clsx(
|
16
|
+
return clsx(
|
17
|
+
classKey,
|
18
|
+
doUseDefaultCss ? defaultClasses[classKey] : undefined,
|
19
|
+
classes?.[classKey]
|
20
|
+
);
|
12
21
|
});
|
13
22
|
|
14
23
|
return { getClassName };
|
package/src/login/Template.tsx
CHANGED
@@ -41,13 +41,13 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
|
|
41
41
|
}, []);
|
42
42
|
|
43
43
|
useSetClassName({
|
44
|
-
|
45
|
-
|
44
|
+
qualifiedName: "html",
|
45
|
+
className: getClassName("kcHtmlClass")
|
46
46
|
});
|
47
47
|
|
48
48
|
useSetClassName({
|
49
|
-
|
50
|
-
|
49
|
+
qualifiedName: "body",
|
50
|
+
className: bodyClassName ?? getClassName("kcBodyClass")
|
51
51
|
});
|
52
52
|
|
53
53
|
useEffect(() => {
|
@@ -63,7 +63,7 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
|
|
63
63
|
}, []);
|
64
64
|
|
65
65
|
const { areAllStyleSheetsLoaded } = useInsertLinkTags({
|
66
|
-
|
66
|
+
hrefs: !doUseDefaultCss
|
67
67
|
? []
|
68
68
|
: [
|
69
69
|
`${url.resourcesCommonPath}/node_modules/@patternfly/patternfly/patternfly.min.css`,
|
@@ -75,17 +75,17 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
|
|
75
75
|
});
|
76
76
|
|
77
77
|
const { insertScriptTags } = useInsertScriptTags({
|
78
|
-
|
78
|
+
scriptTags: [
|
79
79
|
{
|
80
|
-
|
81
|
-
|
80
|
+
type: "module",
|
81
|
+
src: `${url.resourcesPath}/js/menu-button-links.js`
|
82
82
|
},
|
83
83
|
...(authenticationSession === undefined
|
84
84
|
? []
|
85
85
|
: [
|
86
86
|
{
|
87
|
-
|
88
|
-
|
87
|
+
type: "module",
|
88
|
+
textContent: [
|
89
89
|
`import { checkCookiesAndSetTimer } from "${url.resourcesPath}/js/authChecker.js";`,
|
90
90
|
``,
|
91
91
|
`checkCookiesAndSetTimer(`,
|
@@ -99,9 +99,9 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
|
|
99
99
|
...scripts.map(
|
100
100
|
script =>
|
101
101
|
({
|
102
|
-
|
103
|
-
|
104
|
-
} as const
|
102
|
+
type: "text/javascript",
|
103
|
+
src: script
|
104
|
+
}) as const
|
105
105
|
)
|
106
106
|
]
|
107
107
|
});
|
@@ -237,7 +237,7 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
|
|
237
237
|
<span
|
238
238
|
className={getClassName("kcAlertTitleClass")}
|
239
239
|
dangerouslySetInnerHTML={{
|
240
|
-
|
240
|
+
__html: message.summary
|
241
241
|
}}
|
242
242
|
/>
|
243
243
|
</div>
|
@@ -2,7 +2,10 @@ import type { ReactNode } from "react";
|
|
2
2
|
import type { KcContext } from "./kcContext";
|
3
3
|
import type { I18n } from "./i18n";
|
4
4
|
|
5
|
-
export type TemplateProps<
|
5
|
+
export type TemplateProps<
|
6
|
+
KcContext extends KcContext.Common,
|
7
|
+
I18nExtended extends I18n
|
8
|
+
> = {
|
6
9
|
kcContext: KcContext;
|
7
10
|
i18n: I18nExtended;
|
8
11
|
doUseDefaultCss: boolean;
|
@@ -43,7 +43,7 @@ export default function UserProfileFormFields(props: UserProfileFormFieldsProps)
|
|
43
43
|
onIsFormSubmittableValueChange(isFormSubmittable);
|
44
44
|
}, [isFormSubmittable]);
|
45
45
|
|
46
|
-
const groupNameRef = {
|
46
|
+
const groupNameRef = { current: "" };
|
47
47
|
|
48
48
|
return (
|
49
49
|
<>
|
@@ -62,7 +62,9 @@ export default function UserProfileFormFields(props: UserProfileFormFieldsProps)
|
|
62
62
|
)}
|
63
63
|
<div
|
64
64
|
className={getClassName("kcFormGroupClass")}
|
65
|
-
style={{
|
65
|
+
style={{
|
66
|
+
display: attribute.name === "password-confirm" && !doMakeUserConfirmPassword ? "none" : undefined
|
67
|
+
}}
|
66
68
|
>
|
67
69
|
<div className={getClassName("kcLabelWrapperClass")}>
|
68
70
|
<label htmlFor={attribute.name} className={getClassName("kcLabelClass")}>
|
@@ -342,9 +344,9 @@ function InputTag(props: InputFiledByTypeProps & { fieldIndex: number | undefine
|
|
342
344
|
{...Object.fromEntries(Object.entries(attribute.html5DataAnnotations ?? {}).map(([key, value]) => [`data-${key}`, value]))}
|
343
345
|
onChange={event =>
|
344
346
|
formValidationDispatch({
|
345
|
-
|
346
|
-
|
347
|
-
|
347
|
+
action: "update",
|
348
|
+
name: attribute.name,
|
349
|
+
valueOrValues: (() => {
|
348
350
|
if (fieldIndex !== undefined) {
|
349
351
|
assert(valueOrValues instanceof Array);
|
350
352
|
|
@@ -363,9 +365,9 @@ function InputTag(props: InputFiledByTypeProps & { fieldIndex: number | undefine
|
|
363
365
|
}
|
364
366
|
onBlur={() =>
|
365
367
|
props.formValidationDispatch({
|
366
|
-
|
367
|
-
|
368
|
-
|
368
|
+
action: "focus lost",
|
369
|
+
name: attribute.name,
|
370
|
+
fieldIndex: fieldIndex
|
369
371
|
})
|
370
372
|
}
|
371
373
|
/>
|
@@ -484,9 +486,9 @@ function AddRemoveButtonsMultiValuedAttribute(props: {
|
|
484
486
|
className="pf-c-button pf-m-inline pf-m-link"
|
485
487
|
onClick={() =>
|
486
488
|
dispatchFormAction({
|
487
|
-
|
488
|
-
|
489
|
-
|
489
|
+
action: "update",
|
490
|
+
name: attribute.name,
|
491
|
+
valueOrValues: values.filter((_, i) => i !== fieldIndex)
|
490
492
|
})
|
491
493
|
}
|
492
494
|
>
|
@@ -501,9 +503,9 @@ function AddRemoveButtonsMultiValuedAttribute(props: {
|
|
501
503
|
className="pf-c-button pf-m-inline pf-m-link"
|
502
504
|
onClick={() =>
|
503
505
|
dispatchFormAction({
|
504
|
-
|
505
|
-
|
506
|
-
|
506
|
+
action: "update",
|
507
|
+
name: attribute.name,
|
508
|
+
valueOrValues: [...values, ""]
|
507
509
|
})
|
508
510
|
}
|
509
511
|
>
|
@@ -527,17 +529,17 @@ function InputTagSelects(props: InputFiledByTypeProps) {
|
|
527
529
|
switch (inputType) {
|
528
530
|
case "select-radiobuttons":
|
529
531
|
return {
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
532
|
+
inputType: "radio",
|
533
|
+
classDiv: getClassName("kcInputClassRadio"),
|
534
|
+
classInput: getClassName("kcInputClassRadioInput"),
|
535
|
+
classLabel: getClassName("kcInputClassRadioLabel")
|
534
536
|
};
|
535
537
|
case "multiselect-checkboxes":
|
536
538
|
return {
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
539
|
+
inputType: "checkbox",
|
540
|
+
classDiv: getClassName("kcInputClassCheckbox"),
|
541
|
+
classInput: getClassName("kcInputClassCheckboxInput"),
|
542
|
+
classLabel: getClassName("kcInputClassCheckboxLabel")
|
541
543
|
};
|
542
544
|
}
|
543
545
|
})();
|
@@ -581,9 +583,9 @@ function InputTagSelects(props: InputFiledByTypeProps) {
|
|
581
583
|
checked={valueOrValues.includes(option)}
|
582
584
|
onChange={event =>
|
583
585
|
formValidationDispatch({
|
584
|
-
|
585
|
-
|
586
|
-
|
586
|
+
action: "update",
|
587
|
+
name: attribute.name,
|
588
|
+
valueOrValues: (() => {
|
587
589
|
const isChecked = event.target.checked;
|
588
590
|
|
589
591
|
if (valueOrValues instanceof Array) {
|
@@ -604,9 +606,9 @@ function InputTagSelects(props: InputFiledByTypeProps) {
|
|
604
606
|
}
|
605
607
|
onBlur={() =>
|
606
608
|
formValidationDispatch({
|
607
|
-
|
608
|
-
|
609
|
-
|
609
|
+
action: "focus lost",
|
610
|
+
name: attribute.name,
|
611
|
+
fieldIndex: undefined
|
610
612
|
})
|
611
613
|
}
|
612
614
|
/>
|
@@ -642,16 +644,16 @@ function TextareaTag(props: InputFiledByTypeProps) {
|
|
642
644
|
value={value}
|
643
645
|
onChange={event =>
|
644
646
|
formValidationDispatch({
|
645
|
-
|
646
|
-
|
647
|
-
|
647
|
+
action: "update",
|
648
|
+
name: attribute.name,
|
649
|
+
valueOrValues: event.target.value
|
648
650
|
})
|
649
651
|
}
|
650
652
|
onBlur={() =>
|
651
653
|
formValidationDispatch({
|
652
|
-
|
653
|
-
|
654
|
-
|
654
|
+
action: "focus lost",
|
655
|
+
name: attribute.name,
|
656
|
+
fieldIndex: undefined
|
655
657
|
})
|
656
658
|
}
|
657
659
|
/>
|
@@ -677,9 +679,9 @@ function SelectTag(props: InputFiledByTypeProps) {
|
|
677
679
|
value={valueOrValues}
|
678
680
|
onChange={event =>
|
679
681
|
formValidationDispatch({
|
680
|
-
|
681
|
-
|
682
|
-
|
682
|
+
action: "update",
|
683
|
+
name: attribute.name,
|
684
|
+
valueOrValues: (() => {
|
683
685
|
if (isMultiple) {
|
684
686
|
return Array.from(event.target.selectedOptions).map(option => option.value);
|
685
687
|
}
|
@@ -690,9 +692,9 @@ function SelectTag(props: InputFiledByTypeProps) {
|
|
690
692
|
}
|
691
693
|
onBlur={() =>
|
692
694
|
formValidationDispatch({
|
693
|
-
|
694
|
-
|
695
|
-
|
695
|
+
action: "focus lost",
|
696
|
+
name: attribute.name,
|
697
|
+
fieldIndex: undefined
|
696
698
|
})
|
697
699
|
}
|
698
700
|
>
|
@@ -702,12 +704,12 @@ function SelectTag(props: InputFiledByTypeProps) {
|
|
702
704
|
walk: {
|
703
705
|
const { inputOptionsFromValidation } = attribute.annotations;
|
704
706
|
|
705
|
-
assert(typeof inputOptionsFromValidation === "string");
|
706
|
-
|
707
707
|
if (inputOptionsFromValidation === undefined) {
|
708
708
|
break walk;
|
709
709
|
}
|
710
710
|
|
711
|
+
assert(typeof inputOptionsFromValidation === "string");
|
712
|
+
|
711
713
|
const validator = (attribute.validators as Record<string, { options?: string[] }>)[inputOptionsFromValidation];
|
712
714
|
|
713
715
|
if (validator === undefined) {
|
@@ -342,7 +342,7 @@ const messages= {
|
|
342
342
|
"locale_nl": "neerlandès",
|
343
343
|
"locale_no": "noruec",
|
344
344
|
"locale_pl": "polonès",
|
345
|
-
"
|
345
|
+
"locale_pt-BR": "portuguès (Brasil)",
|
346
346
|
"locale_ru": "rus",
|
347
347
|
"locale_sk": "eslovè",
|
348
348
|
"locale_sv": "suec",
|
@@ -349,7 +349,7 @@ const messages= {
|
|
349
349
|
"locale_nl": "Nederlands",
|
350
350
|
"locale_no": "Norsk",
|
351
351
|
"locale_pl": "Polski",
|
352
|
-
"
|
352
|
+
"locale_pt-BR": "Português (Brasil)",
|
353
353
|
"locale_ru": "Русский",
|
354
354
|
"locale_sk": "Slovenčina",
|
355
355
|
"locale_sv": "Svenska",
|
@@ -376,7 +376,7 @@ const messages= {
|
|
376
376
|
"locale_nl": "Nederlands",
|
377
377
|
"locale_no": "Norsk",
|
378
378
|
"locale_pl": "Polski",
|
379
|
-
"
|
379
|
+
"locale_pt-BR": "Português (Brasil)",
|
380
380
|
"locale_ru": "Русский",
|
381
381
|
"locale_sk": "Slovenčina",
|
382
382
|
"locale_sv": "Svenska",
|
@@ -342,7 +342,7 @@ const messages= {
|
|
342
342
|
"locale_nl": "Nederlands",
|
343
343
|
"locale_no": "Norsk",
|
344
344
|
"locale_pl": "Polski",
|
345
|
-
"
|
345
|
+
"locale_pt-BR": "Português (Brasil)",
|
346
346
|
"locale_ru": "Русский",
|
347
347
|
"locale_sk": "Slovenčina",
|
348
348
|
"locale_sv": "Svenska",
|
@@ -346,7 +346,7 @@ const messages= {
|
|
346
346
|
"locale_nl": "Nederlands",
|
347
347
|
"locale_no": "Norsk",
|
348
348
|
"locale_pl": "Polski",
|
349
|
-
"
|
349
|
+
"locale_pt-BR": "Português (Brasil)",
|
350
350
|
"locale_ru": "Русский",
|
351
351
|
"locale_sk": "Slovenčina",
|
352
352
|
"locale_sv": "Svenska",
|