Avoir introducing breaking changes for CSS only setup

This commit is contained in:
garronej
2023-02-25 19:19:46 +01:00
parent 837501c948
commit 37073b42be
38 changed files with 42 additions and 53 deletions

View File

@ -1,9 +1,10 @@
import React, { lazy, Suspense } from "react";
import { __unsafe_useI18n as useI18n } from "./i18n";
import DefaultTemplate from "./pages/Template";
import type { KcContextBase } from "./kcContext/KcContextBase";
import type { KcContextBase } from "./getKcContext/KcContextBase";
import type { PageProps } from "./KcProps";
import type { I18nBase } from "./i18n";
import type { SetOptional } from "./tools/SetOptional";
const Login = lazy(() => import("./pages/Login"));
const Register = lazy(() => import("./pages/Register"));
@ -27,7 +28,7 @@ const LogoutConfirm = lazy(() => import("./pages/LogoutConfirm"));
const UpdateUserProfile = lazy(() => import("./pages/UpdateUserProfile"));
const IdpReviewUserProfile = lazy(() => import("./pages/IdpReviewUserProfile"));
export default function KcApp(props_: PageProps<KcContextBase, I18nBase>) {
export default function KcApp(props_: SetOptional<PageProps<KcContextBase, I18nBase>, "Template">) {
const { kcContext, i18n: userProvidedI18n, Template = DefaultTemplate, ...kcProps } = props_;
const i18n = (function useClosure() {

View File

@ -1,6 +1,6 @@
import { allPropertiesValuesToUndefined } from "./tools/allPropertiesValuesToUndefined";
import { assert } from "tsafe/assert";
import type { KcContextBase } from "./kcContext";
import type { KcContextBase } from "./getKcContext";
import type { ReactNode } from "react";
import { I18nBase } from "./i18n";

View File

@ -6,7 +6,7 @@ import { headInsert } from "./tools/headInsert";
import { pathJoin } from "../bin/tools/pathJoin";
import { clsx } from "./tools/clsx";
import type { TemplateProps } from "./KcProps";
import type { KcContextBase } from "./kcContext/KcContextBase";
import type { KcContextBase } from "./getKcContext/KcContextBase";
import type { I18nBase } from "./i18n";
export default function Template(props: TemplateProps<KcContextBase.Common, I18nBase>) {

View File

@ -3,7 +3,7 @@ import "minimal-polyfills/Object.fromEntries";
import React, { useEffect, useState, useRef } from "react";
import type baseMessages from "./generated_messages/18.0.1/login/en";
import { assert } from "tsafe/assert";
import type { KcContextBase } from "../kcContext/KcContextBase";
import type { KcContextBase } from "../getKcContext/KcContextBase";
import { Markdown } from "../tools/Markdown";
export const fallbackLanguageTag = "en";

View File

@ -1,4 +1,4 @@
export * from "./kcContext";
export * from "./getKcContext";
export * from "./i18n";

View File

@ -1,5 +1,5 @@
import React from "react";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,7 +1,7 @@
import React, { useState } from "react";
import { clsx } from "../tools/clsx";
import { UserProfileFormFields } from "./shared/UserProfileCommons";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,6 +1,6 @@
import React from "react";
import { assert } from "../tools/assert";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -2,7 +2,7 @@ import React, { useState } from "react";
import { clsx } from "../tools/clsx";
import { useConstCallback } from "../tools/useConstCallback";
import type { FormEventHandler } from "react";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,6 +1,6 @@
import React from "react";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,6 +1,6 @@
import React from "react";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,5 +1,5 @@
import React from "react";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -2,7 +2,7 @@ import React, { useEffect } from "react";
import { headInsert } from "../tools/headInsert";
import { pathJoin } from "../../bin/tools/pathJoin";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,5 +1,5 @@
import React from "react";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -2,7 +2,7 @@ import React, { useState } from "react";
import { clsx } from "../tools/clsx";
import { useConstCallback } from "../tools/useConstCallback";
import type { FormEventHandler } from "react";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,6 +1,6 @@
import React from "react";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,6 +1,6 @@
import React from "react";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,6 +1,6 @@
import React from "react";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -2,7 +2,7 @@ import React, { useState } from "react";
import { clsx } from "../tools/clsx";
import { useConstCallback } from "../tools/useConstCallback";
import type { FormEventHandler } from "react";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,5 +1,5 @@
import React from "react";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,6 +1,6 @@
import React from "react";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,6 +1,6 @@
import React from "react";
import { clsx } from "../tools/clsx";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,7 +1,7 @@
import React, { useState } from "react";
import { clsx } from "../tools/clsx";
import { UserProfileFormFields } from "./shared/UserProfileCommons";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,5 +1,5 @@
import React, { useReducer, useEffect } from "react";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import { assert } from "../tools/assert";
import { useCallbackFactory } from "../tools/useCallbackFactory";
import { headInsert } from "../tools/headInsert";

View File

@ -9,7 +9,7 @@ import { useConst } from "../tools/useConst";
import { useConstCallback } from "../tools/useConstCallback";
import { Markdown } from "../tools/Markdown";
import type { Extends } from "tsafe";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,7 +1,7 @@
import React, { useState } from "react";
import { clsx } from "../tools/clsx";
import { UserProfileFormFields } from "./shared/UserProfileCommons";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -3,7 +3,7 @@ import { clsx } from "../tools/clsx";
import type { MessageKeyBase } from "../i18n";
import { base64url } from "rfc4648";
import { useConstCallback } from "../tools/useConstCallback";
import type { KcContextBase } from "../kcContext";
import type { KcContextBase } from "../getKcContext";
import type { PageProps } from "../KcProps";
import type { I18nBase } from "../i18n";

View File

@ -1,6 +1,6 @@
import React, { useEffect, Fragment } from "react";
import type { KcProps } from "../../KcProps";
import type { Attribute } from "../../kcContext/KcContextBase";
import type { Attribute } from "../../getKcContext/KcContextBase";
import { clsx } from "../../tools/clsx";
import type { ReactComponent } from "../../tools/ReactComponent";
import { useCallbackFactory } from "../../tools/useCallbackFactory";

View File

@ -0,0 +1 @@
export type SetOptional<T extends Record<string, unknown>, K extends keyof T> = Omit<T, K> & Partial<Record<K, T[K]>>;

View File

@ -1,6 +1,6 @@
import "./tools/Array.prototype.every";
import React, { useMemo, useReducer, Fragment } from "react";
import type { KcContextBase, Validators, Attribute } from "./kcContext/KcContextBase";
import type { KcContextBase, Validators, Attribute } from "./getKcContext/KcContextBase";
import type { I18nBase, MessageKeyBase } from "./i18n";
import { useConstCallback } from "./tools/useConstCallback";
import { id } from "tsafe/id";