@webiny/app 6.4.5-beta.0 → 6.6.0-alpha.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.
- package/config/RouterConfig.d.ts +1 -3
- package/core/Plugins.d.ts +2 -1
- package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/ErrorOverlay.js +9 -15
- package/errors/overlay/ErrorOverlay.js.map +1 -0
- package/errors/overlay/GqlErrorOverlay.js.map +1 -0
- package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/LocalAwsLambdaTimeoutMessage.js +3 -6
- package/errors/overlay/LocalAwsLambdaTimeoutMessage.js.map +1 -0
- package/errors/overlay/StyledComponents.d.ts +7 -0
- package/errors/overlay/StyledComponents.js +10 -0
- package/errors/overlay/StyledComponents.js.map +1 -0
- package/errors/overlay/Typography.js.map +1 -0
- package/errors/overlay/assets/close_24px.js.map +1 -0
- package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/createErrorOverlay.js +2 -2
- package/errors/overlay/createErrorOverlay.js.map +1 -0
- package/features/router/HistoryRouterGateway.d.ts +3 -0
- package/features/router/HistoryRouterGateway.js +12 -0
- package/features/router/HistoryRouterGateway.js.map +1 -1
- package/features/router/Route.d.ts +1 -1
- package/features/router/RouterPresenter.d.ts +2 -0
- package/features/router/RouterPresenter.js +10 -0
- package/features/router/RouterPresenter.js.map +1 -1
- package/features/router/RouterRepository.d.ts +2 -0
- package/features/router/RouterRepository.js +8 -2
- package/features/router/RouterRepository.js.map +1 -1
- package/features/router/abstractions.d.ts +9 -0
- package/features/router/abstractions.js.map +1 -1
- package/index.d.ts +0 -3
- package/index.js +0 -3
- package/package.json +9 -22
- package/plugins/image.d.ts +1 -1
- package/presentation/router/components/RouteParamsSync.d.ts +22 -0
- package/presentation/router/components/RouteParamsSync.js +53 -0
- package/presentation/router/components/RouteParamsSync.js.map +1 -0
- package/presentation/router/hooks/useRoute.d.ts +1 -0
- package/presentation/router/hooks/useRoute.js +2 -1
- package/presentation/router/hooks/useRoute.js.map +1 -1
- package/presentation/router/hooks/useRouter.d.ts +1 -0
- package/presentation/router/hooks/useRouter.js +1 -0
- package/presentation/router/hooks/useRouter.js.map +1 -1
- package/presentation/router/index.d.ts +2 -0
- package/presentation/router/index.js +1 -0
- package/types.d.ts +0 -21
- package/apollo-client/InMemoryCache.d.ts +0 -8
- package/apollo-client/InMemoryCache.js +0 -18
- package/apollo-client/InMemoryCache.js.map +0 -1
- package/apollo-client/IntrospectionFragmentMatcher.d.ts +0 -11
- package/apollo-client/IntrospectionFragmentMatcher.js +0 -33
- package/apollo-client/IntrospectionFragmentMatcher.js.map +0 -1
- package/hooks/useAutocomplete/index.d.ts +0 -1
- package/hooks/useAutocomplete/index.js +0 -1
- package/hooks/useAutocomplete/useAutocomplete.d.ts +0 -11
- package/hooks/useAutocomplete/useAutocomplete.js +0 -17
- package/hooks/useAutocomplete/useAutocomplete.js.map +0 -1
- package/hooks/useDataList/functions/getData.d.ts +0 -2
- package/hooks/useDataList/functions/getData.js +0 -5
- package/hooks/useDataList/functions/getData.js.map +0 -1
- package/hooks/useDataList/functions/getError.d.ts +0 -2
- package/hooks/useDataList/functions/getError.js +0 -5
- package/hooks/useDataList/functions/getError.js.map +0 -1
- package/hooks/useDataList/functions/getMeta.d.ts +0 -2
- package/hooks/useDataList/functions/getMeta.js +0 -5
- package/hooks/useDataList/functions/getMeta.js.map +0 -1
- package/hooks/useDataList/functions/index.d.ts +0 -3
- package/hooks/useDataList/functions/index.js +0 -3
- package/hooks/useDataList/functions/searchDataByKey.d.ts +0 -2
- package/hooks/useDataList/functions/searchDataByKey.js +0 -13
- package/hooks/useDataList/functions/searchDataByKey.js.map +0 -1
- package/hooks/useDataList/index.d.ts +0 -1
- package/hooks/useDataList/index.js +0 -1
- package/hooks/useDataList/useDataList.d.ts +0 -35
- package/hooks/useDataList/useDataList.js +0 -142
- package/hooks/useDataList/useDataList.js.map +0 -1
- package/hooks/useDataList/utils/index.d.ts +0 -1
- package/hooks/useDataList/utils/index.js +0 -1
- package/hooks/useDataList/utils/prepareLoadListParams.d.ts +0 -10
- package/hooks/useDataList/utils/prepareLoadListParams.js +0 -29
- package/hooks/useDataList/utils/prepareLoadListParams.js.map +0 -1
- package/plugins/AddQuerySelectionPlugin.d.ts +0 -22
- package/plugins/AddQuerySelectionPlugin.js +0 -47
- package/plugins/AddQuerySelectionPlugin.js.map +0 -1
- package/plugins/ApolloCacheObjectIdPlugin.d.ts +0 -15
- package/plugins/ApolloCacheObjectIdPlugin.js +0 -17
- package/plugins/ApolloCacheObjectIdPlugin.js.map +0 -1
- package/plugins/ApolloDynamicLink.d.ts +0 -7
- package/plugins/ApolloDynamicLink.js +0 -29
- package/plugins/ApolloDynamicLink.js.map +0 -1
- package/plugins/ApolloLinkPlugin.d.ts +0 -13
- package/plugins/ApolloLinkPlugin.js +0 -23
- package/plugins/ApolloLinkPlugin.js.map +0 -1
- package/plugins/ConsoleLinkPlugin.d.ts +0 -8
- package/plugins/ConsoleLinkPlugin.js +0 -24
- package/plugins/ConsoleLinkPlugin.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +0 -8
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +0 -69
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin/Typography.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +0 -1
- package/plugins/NetworkErrorLinkPlugin.d.ts +0 -10
- package/plugins/NetworkErrorLinkPlugin.js +0 -53
- package/plugins/NetworkErrorLinkPlugin.js.map +0 -1
- package/plugins/OmitTypenameLinkPlugin.d.ts +0 -8
- package/plugins/OmitTypenameLinkPlugin.js +0 -16
- package/plugins/OmitTypenameLinkPlugin.js.map +0 -1
- package/plugins/TenantHeaderLinkPlugin.d.ts +0 -10
- package/plugins/TenantHeaderLinkPlugin.js +0 -28
- package/plugins/TenantHeaderLinkPlugin.js.map +0 -1
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/ErrorOverlay.d.ts +0 -0
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/GqlErrorOverlay.d.ts +0 -0
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/GqlErrorOverlay.js +0 -0
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/LocalAwsLambdaTimeoutMessage.d.ts +0 -0
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/Typography.d.ts +0 -0
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/Typography.js +0 -0
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/assets/close_24px.js +0 -0
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/assets/close_24px.svg +0 -0
- /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/createErrorOverlay.d.ts +0 -0
package/config/RouterConfig.d.ts
CHANGED
|
@@ -25,7 +25,5 @@ export declare const RouterConfig: (({ priority, children }: import("@webiny/rea
|
|
|
25
25
|
displayName: string;
|
|
26
26
|
}>) => (props: unknown) => React.JSX.Element;
|
|
27
27
|
};
|
|
28
|
-
useRouterConfig:
|
|
29
|
-
routes: RouteConfig[];
|
|
30
|
-
};
|
|
28
|
+
useRouterConfig: typeof useRouterConfig;
|
|
31
29
|
};
|
package/core/Plugins.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export declare const PluginsContext: React.Context<boolean>;
|
|
|
3
3
|
interface PluginsProviderComponentProps {
|
|
4
4
|
children: React.JSX.Element[];
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
declare const PluginsProviderComponent: ({ children }: PluginsProviderComponentProps) => React.JSX.Element;
|
|
7
|
+
export declare const PluginsProvider: React.MemoExoticComponent<typeof PluginsProviderComponent>;
|
|
7
8
|
/**
|
|
8
9
|
* @param children
|
|
9
10
|
* @deprecated This component should not be used directly. Use the <Plugin> component to create plugins.
|
|
@@ -10,32 +10,26 @@ const ErrorOverlay = (props)=>{
|
|
|
10
10
|
const [open, setOpen] = useState(true);
|
|
11
11
|
if (!open) return null;
|
|
12
12
|
return /*#__PURE__*/ react.createElement(OverlayWrapper, null, /*#__PURE__*/ react.createElement("div", {
|
|
13
|
-
className: "
|
|
13
|
+
className: "box-border flex flex-col w-full h-full overflow-auto bg-white p-4"
|
|
14
14
|
}, /*#__PURE__*/ react.createElement("div", {
|
|
15
|
-
className: "
|
|
15
|
+
className: "flex justify-between items-center mb-4"
|
|
16
16
|
}, /*#__PURE__*/ react.createElement("div", {
|
|
17
|
-
className: "
|
|
17
|
+
className: "text-[color:var(--mdc-theme-error)]"
|
|
18
18
|
}, /*#__PURE__*/ react.createElement(Typography, {
|
|
19
19
|
use: "headline"
|
|
20
|
-
}, title)), false !== closeable && /*#__PURE__*/ react.createElement("div", {
|
|
21
|
-
className: "header__action"
|
|
22
|
-
}, /*#__PURE__*/ react.createElement("span", {
|
|
20
|
+
}, title)), false !== closeable && /*#__PURE__*/ react.createElement("div", null, /*#__PURE__*/ react.createElement("span", {
|
|
23
21
|
onClick: ()=>setOpen(false)
|
|
24
|
-
}, /*#__PURE__*/ react.createElement(ReactComponent, null)))), /*#__PURE__*/ react.createElement("div", {
|
|
25
|
-
className: "
|
|
26
|
-
}, /*#__PURE__*/ react.createElement("div", {
|
|
27
|
-
className: "
|
|
28
|
-
}, message), description && /*#__PURE__*/ react.createElement("div", {
|
|
29
|
-
className: "body__description"
|
|
30
|
-
}, description)), /*#__PURE__*/ react.createElement("div", {
|
|
31
|
-
className: "footer"
|
|
22
|
+
}, /*#__PURE__*/ react.createElement(ReactComponent, null)))), /*#__PURE__*/ react.createElement("div", null, /*#__PURE__*/ react.createElement("div", {
|
|
23
|
+
className: "mb-4"
|
|
24
|
+
}, message), description && /*#__PURE__*/ react.createElement("div", null, description)), /*#__PURE__*/ react.createElement("div", {
|
|
25
|
+
className: "text-[color:var(--mdc-theme-text-secondary-on-background)]"
|
|
32
26
|
}, /*#__PURE__*/ react.createElement(Typography, {
|
|
33
27
|
use: "body"
|
|
34
28
|
}, t`
|
|
35
29
|
This screen is only visible if {message} environment variable is set.
|
|
36
30
|
Read more about it in the {link}. `({
|
|
37
31
|
message: /*#__PURE__*/ react.createElement("span", {
|
|
38
|
-
className: "
|
|
32
|
+
className: "bg-[rgba(251,245,180,0.5)] px-1 rounded-[6px] font-mono"
|
|
39
33
|
}, "`REACT_APP_DEBUG=true`"),
|
|
40
34
|
link: /*#__PURE__*/ react.createElement("a", {
|
|
41
35
|
href: ENVIRONMENT_VARIABLES_ARTICLE_LINK,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors/overlay/ErrorOverlay.js","sources":["../../../src/errors/overlay/ErrorOverlay.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { Typography } from \"./Typography.js\";\nimport { i18n } from \"../../i18n/index.js\";\nimport { OverlayWrapper } from \"./StyledComponents.js\";\nimport { ReactComponent as CloseIcon } from \"./assets/close_24px.svg\";\n\nconst t = i18n.ns(\"app/graphql/error-overlay\");\n\nconst ENVIRONMENT_VARIABLES_ARTICLE_LINK =\n \"https://www.webiny.com/docs/how-to-guides/environment-variables\";\n\ntype ErrorOverlayProps = Partial<{\n title: React.ReactNode;\n message: React.ReactNode;\n description: React.ReactNode;\n closeable?: boolean;\n}>;\n\nexport const ErrorOverlay = (props: ErrorOverlayProps) => {\n const { title = \"An error occurred\", message, description, closeable } = props;\n const [open, setOpen] = useState(true);\n if (!open) {\n return null;\n }\n\n return (\n <OverlayWrapper>\n <div className={\"box-border flex flex-col w-full h-full overflow-auto bg-white p-4\"}>\n <div className={\"flex justify-between items-center mb-4\"}>\n <div className={\"text-[color:var(--mdc-theme-error)]\"}>\n <Typography use={\"headline\"}>{title}</Typography>\n </div>\n {closeable !== false && (\n <div>\n <span onClick={() => setOpen(false)}>\n <CloseIcon />\n </span>\n </div>\n )}\n </div>\n <div>\n <div className={\"mb-4\"}>{message}</div>\n {description && <div>{description}</div>}\n </div>\n <div className={\"text-[color:var(--mdc-theme-text-secondary-on-background)]\"}>\n <Typography use={\"body\"}>\n {t`\n This screen is only visible if {message} environment variable is set.\n Read more about it in the {link}. `({\n message: (\n <span\n className={\n \"bg-[rgba(251,245,180,0.5)] px-1 rounded-[6px] font-mono\"\n }\n >\n `REACT_APP_DEBUG=true`\n </span>\n ),\n link: (\n <a\n href={ENVIRONMENT_VARIABLES_ARTICLE_LINK}\n target={\"_blank\"}\n rel={\"noreferrer noopener\"}\n >\n environment variables article\n </a>\n )\n })}\n <br />\n {t`Open your browser's developer console to further inspect this error.`}\n </Typography>\n </div>\n </div>\n </OverlayWrapper>\n );\n};\n"],"names":["t","i18n","ENVIRONMENT_VARIABLES_ARTICLE_LINK","ErrorOverlay","props","title","message","description","closeable","open","setOpen","useState","OverlayWrapper","Typography","CloseIcon"],"mappings":";;;;;AAMA,MAAMA,IAAIC,KAAK,EAAE,CAAC;AAElB,MAAMC,qCACF;AASG,MAAMC,eAAe,CAACC;IACzB,MAAM,EAAEC,QAAQ,mBAAmB,EAAEC,OAAO,EAAEC,WAAW,EAAEC,SAAS,EAAE,GAAGJ;IACzE,MAAM,CAACK,MAAMC,QAAQ,GAAGC,SAAS;IACjC,IAAI,CAACF,MACD,OAAO;IAGX,OAAO,WAAP,GACI,oBAACG,gBAAcA,MAAAA,WAAAA,GACX,oBAAC;QAAI,WAAW;qBACZ,oBAAC;QAAI,WAAW;qBACZ,oBAAC;QAAI,WAAW;qBACZ,oBAACC,YAAUA;QAAC,KAAK;OAAaR,SAEjCG,AAAc,UAAdA,aAAuB,WAAT,GACX,oBAAC,2BACG,oBAAC;QAAK,SAAS,IAAME,QAAQ;qBACzB,oBAACI,gBAASA,UAAAA,WAAAA,GAK1B,oBAAC,2BACG,oBAAC;QAAI,WAAW;OAASR,UACxBC,eAAe,WAAfA,GAAe,oBAAC,aAAKA,eAAAA,WAAAA,GAE1B,oBAAC;QAAI,WAAW;qBACZ,oBAACM,YAAUA;QAAC,KAAK;OACZb,CAAC,CAAC;;0DAE+B,CAAC,CAAC;QAChC,SAAS,WAAT,GACI,oBAAC;YACG,WACI;WAEP;QAIL,MAAM,WAAN,GACI,oBAAC;YACG,MAAME;YACN,QAAQ;YACR,KAAK;WACR;IAIT,kBACA,oBAAC,aACAF,CAAC,CAAC,oEAAoE,CAAC;AAMhG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors/overlay/GqlErrorOverlay.js","sources":["../../../src/errors/overlay/GqlErrorOverlay.tsx"],"sourcesContent":["import React from \"react\";\nimport get from \"lodash/get.js\";\nimport { Typography } from \"./Typography.js\";\nimport { i18n } from \"../../i18n/index.js\";\nimport { Pre } from \"./StyledComponents.js\";\nimport { ErrorOverlay } from \"./ErrorOverlay.js\";\n\nconst t = i18n.ns(\"app/graphql/error-overlay\");\n\ninterface ErrorOverlayProps {\n query: string;\n networkError: {\n message: string;\n result?: {\n error?: {\n stack?: string;\n };\n };\n };\n}\n\nexport const GqlErrorOverlay = (props: ErrorOverlayProps) => {\n const { query, networkError } = props;\n const stackTrace = get(networkError, \"result.error.stack\");\n\n const title = networkError.message;\n\n const message = (\n <>\n <Typography use={\"subtitle\"}>{t`Error occurred while executing operation:`}</Typography>\n <Pre>\n <code>{query}</code>\n </Pre>\n </>\n );\n\n let description: React.ReactNode = null;\n if (stackTrace) {\n description = (\n <>\n <Typography use={\"subtitle\"}>{t`Complete stack trace:`}</Typography>\n <Pre>\n <code>{stackTrace}</code>\n </Pre>\n </>\n );\n }\n\n return <ErrorOverlay title={title} message={message} description={description} />;\n};\n"],"names":["t","i18n","GqlErrorOverlay","props","query","networkError","stackTrace","get","title","message","Typography","Pre","description","ErrorOverlay"],"mappings":";;;;;;AAOA,MAAMA,IAAIC,KAAK,EAAE,CAAC;AAcX,MAAMC,kBAAkB,CAACC;IAC5B,MAAM,EAAEC,KAAK,EAAEC,YAAY,EAAE,GAAGF;IAChC,MAAMG,aAAaC,IAAIF,cAAc;IAErC,MAAMG,QAAQH,aAAa,OAAO;IAElC,MAAMI,UAAU,WAAVA,GACF,wDACI,oBAACC,YAAUA;QAAC,KAAK;OAAaV,CAAC,CAAC,yCAAyC,CAAC,iBAC1E,oBAACW,KAAGA,MAAAA,WAAAA,GACA,oBAAC,cAAMP;IAKnB,IAAIQ,cAA+B;IACnC,IAAIN,YACAM,cAAc,WAAdA,GACI,wDACI,oBAACF,YAAUA;QAAC,KAAK;OAAaV,CAAC,CAAC,qBAAqB,CAAC,iBACtD,oBAACW,KAAGA,MAAAA,WAAAA,GACA,oBAAC,cAAML;IAMvB,OAAO,WAAP,GAAO,oBAACO,cAAYA;QAAC,OAAOL;QAAO,SAASC;QAAS,aAAaG;;AACtE"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import react from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
font-size: 0.85rem;
|
|
6
|
-
line-height: 1rem;
|
|
7
|
-
`;
|
|
2
|
+
const Code = ({ children })=>/*#__PURE__*/ react.createElement("code", {
|
|
3
|
+
className: "font-mono text-[0.85rem] leading-[1rem]"
|
|
4
|
+
}, children);
|
|
8
5
|
const LocalAwsLambdaTimeoutMessage = ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, "Local AWS Lambda function execution timed out.", /*#__PURE__*/ react.createElement("br", null), /*#__PURE__*/ react.createElement("br", null), "Did you stop the\xa0", /*#__PURE__*/ react.createElement("a", {
|
|
9
6
|
href: "https://www.webiny.com/docs/core-development-concepts/basics/watch-command",
|
|
10
7
|
rel: "noreferrer noopener",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors/overlay/LocalAwsLambdaTimeoutMessage.js","sources":["../../../src/errors/overlay/LocalAwsLambdaTimeoutMessage.tsx"],"sourcesContent":["import React from \"react\";\n\nconst Code = ({ children }: { children: React.ReactNode }) => (\n <code className={\"font-mono text-[0.85rem] leading-[1rem]\"}>{children}</code>\n);\n\nexport const LocalAwsLambdaTimeoutMessage = () => (\n <>\n Local AWS Lambda function execution timed out.\n <br />\n <br />\n Did you stop the \n <a\n href={\"https://www.webiny.com/docs/core-development-concepts/basics/watch-command\"}\n rel={\"noreferrer noopener\"}\n target={\"_blank\"}\n >\n <Code>webiny watch</Code>\n </a>\n command? If so, please restart the command or deploy your changes via the \n <a\n href={\"https://www.webiny.com/docs/core-development-concepts/basics/project-deployment\"}\n rel={\"noreferrer noopener\"}\n target={\"_blank\"}\n >\n <Code>webiny deploy</Code>\n </a>\n command. For example: <Code>yarn webiny deploy api --env dev</Code>.\n <br />\n <br />\n Learn more: \n <a\n href={\"https://webiny.link/local-aws-lambda-development\"}\n rel={\"noreferrer noopener\"}\n target={\"_blank\"}\n >\n https://webiny.link/local-aws-lambda-development\n </a>\n </>\n);\n"],"names":["Code","children","LocalAwsLambdaTimeoutMessage"],"mappings":";AAEA,MAAMA,OAAO,CAAC,EAAEC,QAAQ,EAAiC,iBACrD,oBAAC;QAAK,WAAW;OAA4CA;AAG1D,MAAMC,+BAA+B,kBACxC,0CAAE,gEAEE,oBAAC,2BACD,oBAAC,aAAK,sCAEN,oBAAC;QACG,MAAM;QACN,KAAK;QACL,QAAQ;qBAER,oBAACF,MAAIA,MAAC,kBACN,mGAEJ,oBAAC;QACG,MAAM;QACN,KAAK;QACL,QAAQ;qBAER,oBAACA,MAAIA,MAAC,mBACN,4CACwB,oBAACA,MAAIA,MAAC,qCAAuC,mBACzE,oBAAC,2BACD,oBAAC,aAAK,iCAEN,oBAAC;QACG,MAAM;QACN,KAAK;QACL,QAAQ;OACX"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface WrapperProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare const OverlayWrapper: ({ children }: WrapperProps) => React.JSX.Element;
|
|
6
|
+
export declare const Pre: ({ children }: WrapperProps) => React.JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
const OverlayWrapper = ({ children })=>/*#__PURE__*/ react.createElement("div", {
|
|
3
|
+
className: "fixed top-0 left-0 w-screen h-screen z-[105]"
|
|
4
|
+
}, children);
|
|
5
|
+
const Pre = ({ children })=>/*#__PURE__*/ react.createElement("pre", {
|
|
6
|
+
className: "relative block p-[0.5em] my-[0.5em] overflow-x-auto whitespace-pre-wrap rounded text-inherit bg-[rgba(251,245,180,0.3)] [&_code]:font-mono [&_code]:text-[0.85rem] [&_code]:leading-[1rem]"
|
|
7
|
+
}, children);
|
|
8
|
+
export { OverlayWrapper, Pre };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=StyledComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors/overlay/StyledComponents.js","sources":["../../../src/errors/overlay/StyledComponents.tsx"],"sourcesContent":["import React from \"react\";\n\ninterface WrapperProps {\n children: React.ReactNode;\n}\n\n// z-index 105 is intentionally above Dialogs (whose highest z-index is 100).\nexport const OverlayWrapper = ({ children }: WrapperProps) => (\n <div className={\"fixed top-0 left-0 w-screen h-screen z-[105]\"}>{children}</div>\n);\n\nexport const Pre = ({ children }: WrapperProps) => (\n <pre\n className={\n \"relative block p-[0.5em] my-[0.5em] overflow-x-auto whitespace-pre-wrap rounded text-inherit bg-[rgba(251,245,180,0.3)] [&_code]:font-mono [&_code]:text-[0.85rem] [&_code]:leading-[1rem]\"\n }\n >\n {children}\n </pre>\n);\n"],"names":["OverlayWrapper","children","Pre"],"mappings":";AAOO,MAAMA,iBAAiB,CAAC,EAAEC,QAAQ,EAAgB,iBACrD,oBAAC;QAAI,WAAW;OAAiDA;AAG9D,MAAMC,MAAM,CAAC,EAAED,QAAQ,EAAgB,iBAC1C,oBAAC;QACG,WACI;OAGHA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors/overlay/Typography.js","sources":["../../../src/errors/overlay/Typography.tsx"],"sourcesContent":["import React from \"react\";\n\nexport declare type TypographyT = \"headline\" | \"body\" | \"subtitle\";\n\nexport interface TypographyProps {\n use: TypographyT;\n children?: React.ReactNode;\n className?: string;\n}\n\nexport const Typography = (props: TypographyProps) => {\n const { children, use, className } = props;\n\n if (use === \"headline\") {\n return <h4 className={className}>{children}</h4>;\n }\n\n return <p className={className}>{children}</p>;\n};\n"],"names":["Typography","props","children","use","className"],"mappings":";AAUO,MAAMA,aAAa,CAACC;IACvB,MAAM,EAAEC,QAAQ,EAAEC,GAAG,EAAEC,SAAS,EAAE,GAAGH;IAErC,IAAIE,AAAQ,eAARA,KACA,OAAO,WAAP,GAAO,oBAAC;QAAG,WAAWC;OAAYF;IAGtC,OAAO,WAAP,GAAO,oBAAC;QAAE,WAAWE;OAAYF;AACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors/overlay/assets/close_24px.js","sources":["../../../../src/errors/overlay/assets/close_24px.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgClose24Px = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={24} height={24} viewBox=\"0 0 24 24\" {...props}><path fill=\"none\" d=\"M0 0h24v24H0z\" /><path d=\"M18.3 5.71a.996.996 0 0 0-1.41 0L12 10.59 7.11 5.7A.996.996 0 1 0 5.7 7.11L10.59 12 5.7 16.89a.996.996 0 1 0 1.41 1.41L12 13.41l4.89 4.89a.996.996 0 1 0 1.41-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4\" /></svg>;\nexport { SvgClose24Px as ReactComponent };\nexport default \"__RSLIB_SVGR_AUTO_PUBLIC_PATH__static/svg/close_24px.33adaadc.svg\";"],"names":["SvgClose24Px","props"],"mappings":";;AACA,MAAMA,eAAeC,CAAAA,QAAAA,WAAAA,GAAS,sCAAC;QAAI,OAAM;QAA6B,OAAO;QAAI,QAAQ;QAAI,SAAQ;QAAa,GAAGA,KAAK;qBAAE,sCAAC;QAAK,MAAK;QAAO,GAAE;sBAAkB,sCAAC;QAAK,GAAE;;AAE1K"}
|
|
@@ -9,7 +9,7 @@ const createErrorOverlay = (params)=>{
|
|
|
9
9
|
const root = createRoot(container);
|
|
10
10
|
root.render(element);
|
|
11
11
|
};
|
|
12
|
-
const
|
|
13
|
-
export default
|
|
12
|
+
const overlay_createErrorOverlay = createErrorOverlay;
|
|
13
|
+
export default overlay_createErrorOverlay;
|
|
14
14
|
|
|
15
15
|
//# sourceMappingURL=createErrorOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors/overlay/createErrorOverlay.js","sources":["../../../src/errors/overlay/createErrorOverlay.tsx"],"sourcesContent":["import type React from \"react\";\nimport { createRoot } from \"react-dom/client\";\n\ninterface CreateErrorOverlayParams {\n element: React.ReactElement;\n closeable?: boolean;\n}\n\nconst createErrorOverlay = (params: CreateErrorOverlayParams): void => {\n const { element } = params;\n // If the element already present in DOM, return immediately.\n if (document.getElementById(\"overlay-root\")) {\n return;\n }\n // Create root element to hold React tree.\n const container: HTMLDivElement = document.createElement(\"div\");\n container.id = \"overlay-root\";\n // Insert root element into body.\n const body: HTMLBodyElement = document.getElementsByTagName(\"body\")[0];\n body.appendChild(container);\n // Mount the ErrorOverlay component into root element.\n const root = createRoot(container);\n root.render(element);\n};\n\nexport default createErrorOverlay;\n"],"names":["createErrorOverlay","params","element","document","container","body","root","createRoot"],"mappings":";AAQA,MAAMA,qBAAqB,CAACC;IACxB,MAAM,EAAEC,OAAO,EAAE,GAAGD;IAEpB,IAAIE,SAAS,cAAc,CAAC,iBACxB;IAGJ,MAAMC,YAA4BD,SAAS,aAAa,CAAC;IACzDC,UAAU,EAAE,GAAG;IAEf,MAAMC,OAAwBF,SAAS,oBAAoB,CAAC,OAAO,CAAC,EAAE;IACtEE,KAAK,WAAW,CAACD;IAEjB,MAAME,OAAOC,WAAWH;IACxBE,KAAK,MAAM,CAACJ;AAChB;AAEA,mCAAeF"}
|
|
@@ -11,9 +11,12 @@ export declare class HistoryRouterGateway implements RouterGateway.Interface {
|
|
|
11
11
|
constructor(history: History, baseUrl: string);
|
|
12
12
|
addGuard(config: RouteTransitionGuardConfig): GuardDisposer;
|
|
13
13
|
goToRoute(name: string, params: z.ZodTypeAny): void;
|
|
14
|
+
replaceRoute(name: string, params: z.ZodTypeAny): void;
|
|
15
|
+
goBack(): void;
|
|
14
16
|
setRoutes(routes: RouteDefinition[]): void;
|
|
15
17
|
destroy(): void;
|
|
16
18
|
pushState(url: string): void;
|
|
19
|
+
replaceState(url: string): void;
|
|
17
20
|
private resolvePathname;
|
|
18
21
|
private findBlockingGuard;
|
|
19
22
|
private installBlocker;
|
|
@@ -25,6 +25,15 @@ class HistoryRouterGateway {
|
|
|
25
25
|
const baseUrl = this.router.getBaseUrl();
|
|
26
26
|
this.history.push(RouteUrl.fromPattern(route.path, params, baseUrl));
|
|
27
27
|
}
|
|
28
|
+
replaceRoute(name, params) {
|
|
29
|
+
const route = this.router.findRoute(name);
|
|
30
|
+
if (!route) return void console.warn(`Route "${name}" not found.`);
|
|
31
|
+
const baseUrl = this.router.getBaseUrl();
|
|
32
|
+
this.history.replace(RouteUrl.fromPattern(route.path, params, baseUrl));
|
|
33
|
+
}
|
|
34
|
+
goBack() {
|
|
35
|
+
this.history.back();
|
|
36
|
+
}
|
|
28
37
|
setRoutes(routes) {
|
|
29
38
|
this.router.setRoutes(routes);
|
|
30
39
|
const queryParams = Object.fromEntries(new URLSearchParams(this.history.location.search).entries());
|
|
@@ -39,6 +48,9 @@ class HistoryRouterGateway {
|
|
|
39
48
|
pushState(url) {
|
|
40
49
|
this.history.push(url);
|
|
41
50
|
}
|
|
51
|
+
replaceState(url) {
|
|
52
|
+
this.history.replace(url);
|
|
53
|
+
}
|
|
42
54
|
async resolvePathname(pathname, queryParams) {
|
|
43
55
|
const result = this.router.resolve(pathname, queryParams);
|
|
44
56
|
if (!result) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/router/HistoryRouterGateway.js","sources":["../../../src/features/router/HistoryRouterGateway.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport type { History } from \"history\";\nimport type { RouteDefinition, RouteTransitionGuardConfig, GuardDisposer } from \"./abstractions.js\";\nimport { RouterGateway } from \"./abstractions.js\";\nimport { RouteUrl } from \"./RouteUrl.js\";\nimport { Router } from \"./Router.js\";\n\nexport class HistoryRouterGateway implements RouterGateway.Interface {\n private readonly history: History;\n private readonly router: Router;\n private stopListening: () => void;\n private unblock: (() => void) | undefined;\n private guards = new Set<RouteTransitionGuardConfig>();\n\n constructor(history: History, baseUrl: string) {\n this.history = history;\n this.router = new Router(baseUrl);\n\n this.stopListening = history.listen(async ({ location }) => {\n const queryParams = Object.fromEntries(new URLSearchParams(location.search).entries());\n this.resolvePathname(location.pathname, queryParams);\n });\n }\n\n addGuard(config: RouteTransitionGuardConfig): GuardDisposer {\n const hadGuards = this.guards.size > 0;\n this.guards.add(config);\n if (!hadGuards) {\n this.installBlocker();\n }\n return () => {\n this.guards.delete(config);\n if (this.guards.size === 0) {\n this.removeBlocker();\n }\n };\n }\n\n goToRoute(name: string, params: z.ZodTypeAny): void {\n const route = this.router.findRoute(name);\n if (!route) {\n console.warn(`Route \"${name}\" not found.`);\n return;\n }\n\n const baseUrl = this.router.getBaseUrl();\n this.history.push(RouteUrl.fromPattern(route.path, params, baseUrl));\n }\n\n setRoutes(routes: RouteDefinition[]) {\n this.router.setRoutes(routes);\n\n const queryParams = Object.fromEntries(\n new URLSearchParams(this.history.location.search).entries()\n );\n const currentPathname = this.history.location.pathname;\n this.resolvePathname(currentPathname, queryParams);\n }\n\n destroy(): void {\n this.stopListening();\n this.removeBlocker();\n this.guards.clear();\n }\n\n pushState(url: string): void {\n this.history.push(url);\n }\n\n private async resolvePathname(pathname: string, queryParams?: Record<string, unknown>) {\n const result = this.router.resolve(pathname, queryParams);\n if (!result) {\n return;\n }\n\n const { matchedRoute, onMatch } = result;\n\n onMatch(matchedRoute);\n }\n\n private findBlockingGuard(): RouteTransitionGuardConfig | undefined {\n for (const config of this.guards) {\n if (config.guard()) {\n return config;\n }\n }\n return undefined;\n }\n\n private installBlocker(): void {\n if (this.unblock) {\n this.unblock();\n }\n\n this.unblock = this.history.block(tx => {\n const blockingGuard = this.findBlockingGuard();\n if (blockingGuard) {\n let resolved = false;\n\n blockingGuard.onBlocked({\n continue: () => {\n if (!resolved) {\n resolved = true;\n this.removeBlockerAndRetry(tx);\n }\n },\n cancel: () => {\n resolved = true;\n // Do nothing — history v5 already reverted the URL.\n }\n });\n } else {\n this.removeBlockerAndRetry(tx);\n }\n });\n }\n\n private removeBlocker(): void {\n if (this.unblock) {\n this.unblock();\n this.unblock = undefined;\n }\n }\n\n private removeBlockerAndRetry(tx: { retry: () => void }): void {\n // We must remove the blocker before retrying because history v5's\n // allowTx() always returns false when any blocker is registered.\n this.removeBlocker();\n\n // Listen for the next navigation to complete, then reinstall the\n // blocker only if guards are still active.\n const unlisten = this.history.listen(() => {\n unlisten();\n if (this.guards.size > 0) {\n this.installBlocker();\n }\n });\n\n tx.retry();\n }\n}\n"],"names":["HistoryRouterGateway","history","baseUrl","Set","Router","location","queryParams","Object","URLSearchParams","config","hadGuards","name","params","route","console","RouteUrl","routes","currentPathname","url","pathname","result","matchedRoute","onMatch","tx","blockingGuard","resolved","undefined","unlisten"],"mappings":";;AAOO,MAAMA;IAOT,YAAYC,OAAgB,EAAEC,OAAe,CAAE;aAFvC,MAAM,GAAG,IAAIC;QAGjB,IAAI,CAAC,OAAO,GAAGF;QACf,IAAI,CAAC,MAAM,GAAG,IAAIG,OAAOF;QAEzB,IAAI,CAAC,aAAa,GAAGD,QAAQ,MAAM,CAAC,OAAO,EAAEI,QAAQ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AAO,CAAC,IAAI,CAACA;IACtB;IAEA,MAAc,gBAAgBC,QAAgB,EAAEb,WAAqC,EAAE;QACnF,MAAMc,SAAS,IAAI,CAAC,MAAM,CAAC,OAAO,CAACD,UAAUb;QAC7C,IAAI,CAACc,QACD;QAGJ,MAAM,EAAEC,YAAY,EAAEC,OAAO,EAAE,GAAGF;QAElCE,QAAQD;IACZ;IAEQ,oBAA4D;QAChE,KAAK,MAAMZ,UAAU,IAAI,CAAC,MAAM,CAC5B,IAAIA,OAAO,KAAK,IACZ,OAAOA;IAInB;IAEQ,iBAAuB;QAC3B,IAAI,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,OAAO;QAGhB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAACc,CAAAA;YAC9B,MAAMC,gBAAgB,IAAI,CAAC,iBAAiB;YAC5C,IAAIA,eAAe;gBACf,IAAIC,WAAW;gBAEfD,cAAc,SAAS,CAAC;oBACpB,UAAU;wBACN,IAAI,CAACC,UAAU;4BACXA,WAAW;4BACX,IAAI,CAAC,qBAAqB,CAACF;wBAC/B;oBACJ;oBACA,QAAQ;wBACJE,WAAW;oBAEf;gBACJ;YACJ,OACI,IAAI,CAAC,qBAAqB,CAACF;QAEnC;IACJ;IAEQ,gBAAsB;QAC1B,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,IAAI,CAAC,OAAO;YACZ,IAAI,CAAC,OAAO,GAAGG;QACnB;IACJ;IAEQ,sBAAsBH,EAAyB,EAAQ;QAG3D,IAAI,CAAC,aAAa;QAIlB,MAAMI,WAAW,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;YACjCA;YACA,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,GACnB,IAAI,CAAC,cAAc;QAE3B;QAEAJ,GAAG,KAAK;IACZ;AACJ"}
|
|
1
|
+
{"version":3,"file":"features/router/HistoryRouterGateway.js","sources":["../../../src/features/router/HistoryRouterGateway.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport type { History } from \"history\";\nimport type { RouteDefinition, RouteTransitionGuardConfig, GuardDisposer } from \"./abstractions.js\";\nimport { RouterGateway } from \"./abstractions.js\";\nimport { RouteUrl } from \"./RouteUrl.js\";\nimport { Router } from \"./Router.js\";\n\nexport class HistoryRouterGateway implements RouterGateway.Interface {\n private readonly history: History;\n private readonly router: Router;\n private stopListening: () => void;\n private unblock: (() => void) | undefined;\n private guards = new Set<RouteTransitionGuardConfig>();\n\n constructor(history: History, baseUrl: string) {\n this.history = history;\n this.router = new Router(baseUrl);\n\n this.stopListening = history.listen(async ({ location }) => {\n const queryParams = Object.fromEntries(new URLSearchParams(location.search).entries());\n this.resolvePathname(location.pathname, queryParams);\n });\n }\n\n addGuard(config: RouteTransitionGuardConfig): GuardDisposer {\n const hadGuards = this.guards.size > 0;\n this.guards.add(config);\n if (!hadGuards) {\n this.installBlocker();\n }\n return () => {\n this.guards.delete(config);\n if (this.guards.size === 0) {\n this.removeBlocker();\n }\n };\n }\n\n goToRoute(name: string, params: z.ZodTypeAny): void {\n const route = this.router.findRoute(name);\n if (!route) {\n console.warn(`Route \"${name}\" not found.`);\n return;\n }\n\n const baseUrl = this.router.getBaseUrl();\n this.history.push(RouteUrl.fromPattern(route.path, params, baseUrl));\n }\n\n replaceRoute(name: string, params: z.ZodTypeAny): void {\n const route = this.router.findRoute(name);\n if (!route) {\n console.warn(`Route \"${name}\" not found.`);\n return;\n }\n\n const baseUrl = this.router.getBaseUrl();\n this.history.replace(RouteUrl.fromPattern(route.path, params, baseUrl));\n }\n\n goBack(): void {\n this.history.back();\n }\n\n setRoutes(routes: RouteDefinition[]) {\n this.router.setRoutes(routes);\n\n const queryParams = Object.fromEntries(\n new URLSearchParams(this.history.location.search).entries()\n );\n const currentPathname = this.history.location.pathname;\n this.resolvePathname(currentPathname, queryParams);\n }\n\n destroy(): void {\n this.stopListening();\n this.removeBlocker();\n this.guards.clear();\n }\n\n pushState(url: string): void {\n this.history.push(url);\n }\n\n replaceState(url: string): void {\n this.history.replace(url);\n }\n\n private async resolvePathname(pathname: string, queryParams?: Record<string, unknown>) {\n const result = this.router.resolve(pathname, queryParams);\n if (!result) {\n return;\n }\n\n const { matchedRoute, onMatch } = result;\n\n onMatch(matchedRoute);\n }\n\n private findBlockingGuard(): RouteTransitionGuardConfig | undefined {\n for (const config of this.guards) {\n if (config.guard()) {\n return config;\n }\n }\n return undefined;\n }\n\n private installBlocker(): void {\n if (this.unblock) {\n this.unblock();\n }\n\n this.unblock = this.history.block(tx => {\n const blockingGuard = this.findBlockingGuard();\n if (blockingGuard) {\n let resolved = false;\n\n blockingGuard.onBlocked({\n continue: () => {\n if (!resolved) {\n resolved = true;\n this.removeBlockerAndRetry(tx);\n }\n },\n cancel: () => {\n resolved = true;\n // Do nothing — history v5 already reverted the URL.\n }\n });\n } else {\n this.removeBlockerAndRetry(tx);\n }\n });\n }\n\n private removeBlocker(): void {\n if (this.unblock) {\n this.unblock();\n this.unblock = undefined;\n }\n }\n\n private removeBlockerAndRetry(tx: { retry: () => void }): void {\n // We must remove the blocker before retrying because history v5's\n // allowTx() always returns false when any blocker is registered.\n this.removeBlocker();\n\n // Listen for the next navigation to complete, then reinstall the\n // blocker only if guards are still active.\n const unlisten = this.history.listen(() => {\n unlisten();\n if (this.guards.size > 0) {\n this.installBlocker();\n }\n });\n\n tx.retry();\n }\n}\n"],"names":["HistoryRouterGateway","history","baseUrl","Set","Router","location","queryParams","Object","URLSearchParams","config","hadGuards","name","params","route","console","RouteUrl","routes","currentPathname","url","pathname","result","matchedRoute","onMatch","tx","blockingGuard","resolved","undefined","unlisten"],"mappings":";;AAOO,MAAMA;IAOT,YAAYC,OAAgB,EAAEC,OAAe,CAAE;aAFvC,MAAM,GAAG,IAAIC;QAGjB,IAAI,CAAC,OAAO,GAAGF;QACf,IAAI,CAAC,MAAM,GAAG,IAAIG,OAAOF;QAEzB,IAAI,CAAC,aAAa,GAAGD,QAAQ,MAAM,CAAC,OAAO,EAAEI,Q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ACF;QAEnC;IACJ;IAEQ,gBAAsB;QAC1B,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,IAAI,CAAC,OAAO;YACZ,IAAI,CAAC,OAAO,GAAGG;QACnB;IACJ;IAEQ,sBAAsBH,EAAyB,EAAQ;QAG3D,IAAI,CAAC,aAAa;QAIlB,MAAMI,WAAW,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;YACjCA;YACA,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,GACnB,IAAI,CAAC,cAAc;QAE3B;QAEAJ,GAAG,KAAK;IACZ;AACJ"}
|
|
@@ -13,7 +13,7 @@ export declare class Route<TParams extends RouteParamsDefinition | undefined = u
|
|
|
13
13
|
private readonly schema;
|
|
14
14
|
constructor(route: RouteParams<TParams>);
|
|
15
15
|
get name(): string;
|
|
16
|
-
get path(): `/${string}
|
|
16
|
+
get path(): "*" | `/${string}`;
|
|
17
17
|
get params(): TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined;
|
|
18
18
|
private coerceParams;
|
|
19
19
|
}
|
|
@@ -9,7 +9,9 @@ declare class RouterPresenterImpl implements Abstraction.Interface {
|
|
|
9
9
|
bootstrap: (routes: Route[]) => void;
|
|
10
10
|
goToRoute: (route: any, params?: any) => void;
|
|
11
11
|
setRouteParams: (cb: any) => void;
|
|
12
|
+
replaceRouteParams: (cb: any) => void;
|
|
12
13
|
getLink: (route: any, params?: any) => string;
|
|
14
|
+
goBack: () => void;
|
|
13
15
|
addTransitionGuard: (config: RouteTransitionGuardConfig) => GuardDisposer;
|
|
14
16
|
isTransitionBlocked: () => boolean;
|
|
15
17
|
unblockTransition: () => void;
|
|
@@ -16,7 +16,17 @@ class RouterPresenterImpl {
|
|
|
16
16
|
const newParams = cb(matchedRoute?.params ?? {});
|
|
17
17
|
this.goToRoute(currentRoute, newParams);
|
|
18
18
|
};
|
|
19
|
+
this.replaceRouteParams = (cb)=>{
|
|
20
|
+
const currentRoute = this.routerRepository.getCurrentRoute();
|
|
21
|
+
if (!currentRoute) return;
|
|
22
|
+
const matchedRoute = this.routerRepository.getMatchedRoute();
|
|
23
|
+
const newParams = cb(matchedRoute?.params ?? {});
|
|
24
|
+
this.routerRepository.replaceRoute(currentRoute, newParams);
|
|
25
|
+
};
|
|
19
26
|
this.getLink = (route, params)=>this.routerRepository.getLink(route, params);
|
|
27
|
+
this.goBack = ()=>{
|
|
28
|
+
this.routerRepository.goBack();
|
|
29
|
+
};
|
|
20
30
|
this.addTransitionGuard = (config)=>this.routerRepository.addGuard(config);
|
|
21
31
|
this.isTransitionBlocked = ()=>this.routerRepository.isBlocked();
|
|
22
32
|
this.unblockTransition = ()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/router/RouterPresenter.js","sources":["../../../src/features/router/RouterPresenter.ts"],"sourcesContent":["import { makeAutoObservable, toJS } from \"mobx\";\nimport { createImplementation } from \"@webiny/di\";\nimport { Route } from \"./Route.js\";\nimport {\n RouterRepository,\n RouterPresenter as Abstraction,\n type RouteTransitionGuardConfig,\n type GuardDisposer\n} from \"./abstractions.js\";\n\nclass RouterPresenterImpl implements Abstraction.Interface {\n private routerRepository: RouterRepository.Interface;\n\n constructor(routerRepository: RouterRepository.Interface) {\n this.routerRepository = routerRepository;\n\n makeAutoObservable(this);\n }\n\n get vm() {\n return {\n currentRoute: toJS(this.routerRepository.getMatchedRoute())\n };\n }\n\n bootstrap = (routes: Route[]) => {\n this.routerRepository.registerRoutes(routes);\n };\n\n goToRoute = (route: any, params?: any) => {\n this.routerRepository.goToRoute(route, params);\n };\n\n setRouteParams = (cb: any) => {\n const currentRoute = this.routerRepository.getCurrentRoute();\n if (!currentRoute) {\n return;\n }\n\n const matchedRoute = this.routerRepository.getMatchedRoute();\n const newParams = cb(matchedRoute?.params ?? {});\n this.goToRoute(currentRoute, newParams);\n };\n\n getLink = (route: any, params?: any) => {\n return this.routerRepository.getLink(route, params);\n };\n\n addTransitionGuard = (config: RouteTransitionGuardConfig): GuardDisposer => {\n return this.routerRepository.addGuard(config);\n };\n\n isTransitionBlocked = (): boolean => {\n return this.routerRepository.isBlocked();\n };\n\n unblockTransition = (): void => {\n this.routerRepository.unblock();\n };\n\n confirmTransition = (): void => {\n this.routerRepository.confirmTransition();\n };\n\n cancelTransition = (): void => {\n this.routerRepository.cancelTransition();\n };\n\n destroy = () => {\n this.routerRepository.destroy();\n };\n}\n\nexport const RouterPresenter = createImplementation({\n abstraction: Abstraction,\n implementation: RouterPresenterImpl,\n dependencies: [RouterRepository]\n});\n"],"names":["RouterPresenterImpl","routerRepository","routes","route","params","cb","currentRoute","matchedRoute","newParams","config","makeAutoObservable","toJS","RouterPresenter","createImplementation","Abstraction","RouterRepository"],"mappings":";;;AAUA,MAAMA;IAGF,YAAYC,gBAA4C,CAAE;aAY1D,SAAS,GAAG,CAACC;YACT,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAACA;QACzC;aAEA,SAAS,GAAG,CAACC,OAAYC;YACrB,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAACD,OAAOC;QAC3C;aAEA,cAAc,GAAG,CAACC;YACd,MAAMC,eAAe,IAAI,CAAC,gBAAgB,CAAC,eAAe;YAC1D,IAAI,CAACA,cACD;YAGJ,MAAMC,eAAe,IAAI,CAAC,gBAAgB,CAAC,eAAe;YAC1D,MAAMC,YAAYH,GAAGE,cAAc,UAAU,CAAC;YAC9C,IAAI,CAAC,SAAS,CAACD,cAAcE;QACjC;aAEA,OAAO,GAAG,CAACL,OAAYC,SACZ,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAACD,OAAOC;aAGhD,kBAAkB,GAAG,CAACK,SACX,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAACA;aAG1C,mBAAmB,GAAG,IACX,IAAI,CAAC,gBAAgB,CAAC,SAAS;aAG1C,iBAAiB,GAAG;YAChB,IAAI,CAAC,gBAAgB,CAAC,OAAO;QACjC;aAEA,iBAAiB,GAAG;YAChB,IAAI,CAAC,gBAAgB,CAAC,iBAAiB;QAC3C;aAEA,gBAAgB,GAAG;YACf,IAAI,CAAC,gBAAgB,CAAC,gBAAgB;QAC1C;aAEA,OAAO,GAAG;YACN,IAAI,CAAC,gBAAgB,CAAC,OAAO;QACjC;
|
|
1
|
+
{"version":3,"file":"features/router/RouterPresenter.js","sources":["../../../src/features/router/RouterPresenter.ts"],"sourcesContent":["import { makeAutoObservable, toJS } from \"mobx\";\nimport { createImplementation } from \"@webiny/di\";\nimport { Route } from \"./Route.js\";\nimport {\n RouterRepository,\n RouterPresenter as Abstraction,\n type RouteTransitionGuardConfig,\n type GuardDisposer\n} from \"./abstractions.js\";\n\nclass RouterPresenterImpl implements Abstraction.Interface {\n private routerRepository: RouterRepository.Interface;\n\n constructor(routerRepository: RouterRepository.Interface) {\n this.routerRepository = routerRepository;\n\n makeAutoObservable(this);\n }\n\n get vm() {\n return {\n currentRoute: toJS(this.routerRepository.getMatchedRoute())\n };\n }\n\n bootstrap = (routes: Route[]) => {\n this.routerRepository.registerRoutes(routes);\n };\n\n goToRoute = (route: any, params?: any) => {\n this.routerRepository.goToRoute(route, params);\n };\n\n setRouteParams = (cb: any) => {\n const currentRoute = this.routerRepository.getCurrentRoute();\n if (!currentRoute) {\n return;\n }\n\n const matchedRoute = this.routerRepository.getMatchedRoute();\n const newParams = cb(matchedRoute?.params ?? {});\n this.goToRoute(currentRoute, newParams);\n };\n\n replaceRouteParams = (cb: any) => {\n const currentRoute = this.routerRepository.getCurrentRoute();\n if (!currentRoute) {\n return;\n }\n\n const matchedRoute = this.routerRepository.getMatchedRoute();\n const newParams = cb(matchedRoute?.params ?? {});\n this.routerRepository.replaceRoute(currentRoute, newParams);\n };\n\n getLink = (route: any, params?: any) => {\n return this.routerRepository.getLink(route, params);\n };\n\n goBack = (): void => {\n this.routerRepository.goBack();\n };\n\n addTransitionGuard = (config: RouteTransitionGuardConfig): GuardDisposer => {\n return this.routerRepository.addGuard(config);\n };\n\n isTransitionBlocked = (): boolean => {\n return this.routerRepository.isBlocked();\n };\n\n unblockTransition = (): void => {\n this.routerRepository.unblock();\n };\n\n confirmTransition = (): void => {\n this.routerRepository.confirmTransition();\n };\n\n cancelTransition = (): void => {\n this.routerRepository.cancelTransition();\n };\n\n destroy = () => {\n this.routerRepository.destroy();\n };\n}\n\nexport const RouterPresenter = createImplementation({\n abstraction: Abstraction,\n implementation: RouterPresenterImpl,\n dependencies: [RouterRepository]\n});\n"],"names":["RouterPresenterImpl","routerRepository","routes","route","params","cb","currentRoute","matchedRoute","newParams","config","makeAutoObservable","toJS","RouterPresenter","createImplementation","Abstraction","RouterRepository"],"mappings":";;;AAUA,MAAMA;IAGF,YAAYC,gBAA4C,CAAE;aAY1D,SAAS,GAAG,CAACC;YACT,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAACA;QACzC;aAEA,SAAS,GAAG,CAACC,OAAYC;YACrB,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAACD,OAAOC;QAC3C;aAEA,cAAc,GAAG,CAACC;YACd,MAAMC,eAAe,IAAI,CAAC,gBAAgB,CAAC,eAAe;YAC1D,IAAI,CAACA,cACD;YAGJ,MAAMC,eAAe,IAAI,CAAC,gBAAgB,CAAC,eAAe;YAC1D,MAAMC,YAAYH,GAAGE,cAAc,UAAU,CAAC;YAC9C,IAAI,CAAC,SAAS,CAACD,cAAcE;QACjC;aAEA,kBAAkB,GAAG,CAACH;YAClB,MAAMC,eAAe,IAAI,CAAC,gBAAgB,CAAC,eAAe;YAC1D,IAAI,CAACA,cACD;YAGJ,MAAMC,eAAe,IAAI,CAAC,gBAAgB,CAAC,eAAe;YAC1D,MAAMC,YAAYH,GAAGE,cAAc,UAAU,CAAC;YAC9C,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAACD,cAAcE;QACrD;aAEA,OAAO,GAAG,CAACL,OAAYC,SACZ,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAACD,OAAOC;aAGhD,MAAM,GAAG;YACL,IAAI,CAAC,gBAAgB,CAAC,MAAM;QAChC;aAEA,kBAAkB,GAAG,CAACK,SACX,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAACA;aAG1C,mBAAmB,GAAG,IACX,IAAI,CAAC,gBAAgB,CAAC,SAAS;aAG1C,iBAAiB,GAAG;YAChB,IAAI,CAAC,gBAAgB,CAAC,OAAO;QACjC;aAEA,iBAAiB,GAAG;YAChB,IAAI,CAAC,gBAAgB,CAAC,iBAAiB;QAC3C;aAEA,gBAAgB,GAAG;YACf,IAAI,CAAC,gBAAgB,CAAC,gBAAgB;QAC1C;aAEA,OAAO,GAAG;YACN,IAAI,CAAC,gBAAgB,CAAC,OAAO;QACjC;QAvEI,IAAI,CAAC,gBAAgB,GAAGR;QAExBS,mBAAmB,IAAI;IAC3B;IAEA,IAAI,KAAK;QACL,OAAO;YACH,cAAcC,KAAK,IAAI,CAAC,gBAAgB,CAAC,eAAe;QAC5D;IACJ;AA+DJ;AAEO,MAAMC,kCAAkBC,qBAAqB;IAChD,aAAaC;IACb,gBAAgBd;IAChB,cAAc;QAACe;KAAiB;AACpC"}
|
|
@@ -14,6 +14,8 @@ declare class RouterRepositoryImpl implements Abstractions.RouterRepository.Inte
|
|
|
14
14
|
registerRoutes: (routes: Route[]) => void;
|
|
15
15
|
getLink<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, params?: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined): string;
|
|
16
16
|
goToRoute<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined): void;
|
|
17
|
+
replaceRoute<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined): void;
|
|
18
|
+
goBack(): void;
|
|
17
19
|
addGuard(config: RouteTransitionGuardConfig): GuardDisposer;
|
|
18
20
|
isBlocked(): boolean;
|
|
19
21
|
unblock(): void;
|
|
@@ -41,6 +41,12 @@ class RouterRepositoryImpl {
|
|
|
41
41
|
goToRoute(route, params) {
|
|
42
42
|
this.gateway.goToRoute(route.name, params);
|
|
43
43
|
}
|
|
44
|
+
replaceRoute(route, params) {
|
|
45
|
+
this.gateway.replaceRoute(route.name, params);
|
|
46
|
+
}
|
|
47
|
+
goBack() {
|
|
48
|
+
this.gateway.goBack();
|
|
49
|
+
}
|
|
44
50
|
addGuard(config) {
|
|
45
51
|
const gatewayGuard = {
|
|
46
52
|
guard: ()=>{
|
|
@@ -96,10 +102,10 @@ class RouterRepositoryImpl {
|
|
|
96
102
|
if (!route) return;
|
|
97
103
|
const params = "function" == typeof route.params?.parse ? route.params.parse(matchedRoute.params) : matchedRoute.params;
|
|
98
104
|
runInAction(()=>{
|
|
99
|
-
|
|
105
|
+
this.currentRoute = {
|
|
100
106
|
...matchedRoute,
|
|
101
107
|
params
|
|
102
|
-
}
|
|
108
|
+
};
|
|
103
109
|
});
|
|
104
110
|
}
|
|
105
111
|
getRouteByName(name) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/router/RouterRepository.js","sources":["../../../src/features/router/RouterRepository.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from \"mobx\";\nimport type {\n MatchedRoute,\n RouteDefinition,\n RouteTransitionGuardConfig,\n GuardDisposer,\n TransitionController\n} from \"./abstractions.js\";\nimport * as Abstractions from \"./abstractions.js\";\nimport { Route, RouteParamsDefinition, RouteParamsInfer } from \"./Route.js\";\nimport { RouteUrl } from \"./RouteUrl.js\";\n\nconst INIT_ROUTE = { name: \"__init__\", path: \"\", pathname: \"\", params: {} };\n\nclass RouterRepositoryImpl implements Abstractions.RouterRepository.Interface {\n private gateway: Abstractions.RouterGateway.Interface;\n private currentRoute: MatchedRoute = INIT_ROUTE;\n private routes: Route<any>[] = [];\n private pendingTransition: TransitionController | undefined;\n private forceUnblocked = false;\n private guardDisposers = new Map<RouteTransitionGuardConfig, GuardDisposer>();\n\n constructor(gateway: Abstractions.RouterGateway.Interface) {\n this.gateway = gateway;\n\n makeAutoObservable(this, {\n pendingTransition: false,\n forceUnblocked: false\n } as any);\n }\n\n getMatchedRoute() {\n return this.currentRoute.name !== INIT_ROUTE.name ? this.currentRoute : undefined;\n }\n\n getCurrentRoute(): Route<any> | undefined {\n return this.routes.find(route => route.name === this.currentRoute.name);\n }\n\n registerRoutes = (routes: Route[]) => {\n this.routes = routes;\n const routesWithAction = routes.map<RouteDefinition>(this.routeWithAction);\n\n this.gateway.setRoutes(routesWithAction);\n };\n\n getLink<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n params?: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n ): string {\n return RouteUrl.fromPattern(route.path, params);\n }\n\n goToRoute<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n ): void {\n this.gateway.goToRoute(route.name, params);\n }\n\n addGuard(config: RouteTransitionGuardConfig): GuardDisposer {\n const gatewayGuard: RouteTransitionGuardConfig = {\n guard: () => {\n if (this.forceUnblocked) {\n this.forceUnblocked = false;\n return false;\n }\n return config.guard();\n },\n onBlocked: (controller: TransitionController) => {\n this.pendingTransition = controller;\n config.onBlocked(controller);\n }\n };\n\n const disposeGatewayGuard = this.gateway.addGuard(gatewayGuard);\n\n const dispose = () => {\n this.guardDisposers.delete(config);\n disposeGatewayGuard();\n };\n\n this.guardDisposers.set(config, dispose);\n return dispose;\n }\n\n isBlocked(): boolean {\n return this.pendingTransition !== undefined;\n }\n\n unblock(): void {\n this.forceUnblocked = true;\n if (this.pendingTransition) {\n this.forceUnblocked = false;\n const tx = this.pendingTransition;\n this.pendingTransition = undefined;\n tx.continue();\n } else {\n // No pending transition — expire the flag after the current\n // call stack so it only covers synchronous navigations that\n // follow immediately (e.g. router.goToRoute on the next line).\n setTimeout(() => {\n this.forceUnblocked = false;\n }, 0);\n }\n }\n\n confirmTransition(): void {\n const tx = this.pendingTransition;\n this.pendingTransition = undefined;\n if (tx) {\n tx.continue();\n }\n }\n\n cancelTransition(): void {\n if (this.pendingTransition) {\n this.pendingTransition.cancel();\n this.pendingTransition = undefined;\n }\n }\n\n destroy() {\n this.gateway.destroy();\n }\n\n private routeWithAction = (route: Route<any>) => {\n return {\n name: route.name,\n path: route.path,\n onMatch: this.transitionToRoute.bind(this)\n };\n };\n\n private async transitionToRoute(matchedRoute: MatchedRoute) {\n const route = this.getRouteByName(matchedRoute.name);\n if (!route) {\n return;\n }\n\n const params =\n typeof route.params?.parse === \"function\"\n ? route.params.parse(matchedRoute.params)\n : matchedRoute.params;\n\n runInAction(() => {\n
|
|
1
|
+
{"version":3,"file":"features/router/RouterRepository.js","sources":["../../../src/features/router/RouterRepository.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from \"mobx\";\nimport type {\n MatchedRoute,\n RouteDefinition,\n RouteTransitionGuardConfig,\n GuardDisposer,\n TransitionController\n} from \"./abstractions.js\";\nimport * as Abstractions from \"./abstractions.js\";\nimport { Route, RouteParamsDefinition, RouteParamsInfer } from \"./Route.js\";\nimport { RouteUrl } from \"./RouteUrl.js\";\n\nconst INIT_ROUTE = { name: \"__init__\", path: \"\", pathname: \"\", params: {} };\n\nclass RouterRepositoryImpl implements Abstractions.RouterRepository.Interface {\n private gateway: Abstractions.RouterGateway.Interface;\n private currentRoute: MatchedRoute = INIT_ROUTE;\n private routes: Route<any>[] = [];\n private pendingTransition: TransitionController | undefined;\n private forceUnblocked = false;\n private guardDisposers = new Map<RouteTransitionGuardConfig, GuardDisposer>();\n\n constructor(gateway: Abstractions.RouterGateway.Interface) {\n this.gateway = gateway;\n\n makeAutoObservable(this, {\n pendingTransition: false,\n forceUnblocked: false\n } as any);\n }\n\n getMatchedRoute() {\n return this.currentRoute.name !== INIT_ROUTE.name ? this.currentRoute : undefined;\n }\n\n getCurrentRoute(): Route<any> | undefined {\n return this.routes.find(route => route.name === this.currentRoute.name);\n }\n\n registerRoutes = (routes: Route[]) => {\n this.routes = routes;\n const routesWithAction = routes.map<RouteDefinition>(this.routeWithAction);\n\n this.gateway.setRoutes(routesWithAction);\n };\n\n getLink<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n params?: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n ): string {\n return RouteUrl.fromPattern(route.path, params);\n }\n\n goToRoute<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n ): void {\n this.gateway.goToRoute(route.name, params);\n }\n\n replaceRoute<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n ): void {\n this.gateway.replaceRoute(route.name, params);\n }\n\n goBack(): void {\n this.gateway.goBack();\n }\n\n addGuard(config: RouteTransitionGuardConfig): GuardDisposer {\n const gatewayGuard: RouteTransitionGuardConfig = {\n guard: () => {\n if (this.forceUnblocked) {\n this.forceUnblocked = false;\n return false;\n }\n return config.guard();\n },\n onBlocked: (controller: TransitionController) => {\n this.pendingTransition = controller;\n config.onBlocked(controller);\n }\n };\n\n const disposeGatewayGuard = this.gateway.addGuard(gatewayGuard);\n\n const dispose = () => {\n this.guardDisposers.delete(config);\n disposeGatewayGuard();\n };\n\n this.guardDisposers.set(config, dispose);\n return dispose;\n }\n\n isBlocked(): boolean {\n return this.pendingTransition !== undefined;\n }\n\n unblock(): void {\n this.forceUnblocked = true;\n if (this.pendingTransition) {\n this.forceUnblocked = false;\n const tx = this.pendingTransition;\n this.pendingTransition = undefined;\n tx.continue();\n } else {\n // No pending transition — expire the flag after the current\n // call stack so it only covers synchronous navigations that\n // follow immediately (e.g. router.goToRoute on the next line).\n setTimeout(() => {\n this.forceUnblocked = false;\n }, 0);\n }\n }\n\n confirmTransition(): void {\n const tx = this.pendingTransition;\n this.pendingTransition = undefined;\n if (tx) {\n tx.continue();\n }\n }\n\n cancelTransition(): void {\n if (this.pendingTransition) {\n this.pendingTransition.cancel();\n this.pendingTransition = undefined;\n }\n }\n\n destroy() {\n this.gateway.destroy();\n }\n\n private routeWithAction = (route: Route<any>) => {\n return {\n name: route.name,\n path: route.path,\n onMatch: this.transitionToRoute.bind(this)\n };\n };\n\n private async transitionToRoute(matchedRoute: MatchedRoute) {\n const route = this.getRouteByName(matchedRoute.name);\n if (!route) {\n return;\n }\n\n const params =\n typeof route.params?.parse === \"function\"\n ? route.params.parse(matchedRoute.params)\n : matchedRoute.params;\n\n runInAction(() => {\n this.currentRoute = { ...matchedRoute, params };\n });\n }\n\n private getRouteByName(name: string) {\n return this.routes.find(existingRoute => existingRoute.name === name);\n }\n}\n\nexport const RouterRepository = Abstractions.RouterRepository.createImplementation({\n implementation: RouterRepositoryImpl,\n dependencies: [Abstractions.RouterGateway]\n});\n"],"names":["INIT_ROUTE","RouterRepositoryImpl","gateway","Map","routes","routesWithAction","route","makeAutoObservable","undefined","params","RouteUrl","config","gatewayGuard","controller","disposeGatewayGuard","dispose","tx","setTimeout","matchedRoute","runInAction","name","existingRoute","RouterRepository","Abstractions"],"mappings":";;;AAYA,MAAMA,aAAa;IAAE,MAAM;IAAY,MAAM;IAAI,UAAU;IAAI,QAAQ,CAAC;AAAE;AAE1E,MAAMC;IAQF,YAAYC,OAA6C,CAAE;aANnD,YAAY,GAAiBF;aAC7B,MAAM,GAAiB,EAAE;aAEzB,cAAc,GAAG;aACjB,cAAc,GAAG,IAAIG;aAmB7B,cAAc,GAAG,CAACC;YACd,IAAI,CAAC,MAAM,GAAGA;YACd,MAAMC,mBAAmBD,OAAO,GAAG,CAAkB,IAAI,CAAC,eAAe;YAEzE,IAAI,CAAC,OAAO,CAAC,SAAS,CAACC;QAC3B;aA6FQ,eAAe,GAAG,CAACC,QAChB;gBACH,MAAMA,MAAM,IAAI;gBAChB,MAAMA,MAAM,IAAI;gBAChB,SAAS,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI;YAC7C;QAvHA,IAAI,C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12
|
goToRoute<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, ...args: RouteParamsArgs<TParams>): void;
|
|
13
13
|
getLink<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, ...args: RouteParamsArgs<TParams>): string;
|
|
14
14
|
setRouteParams<T extends Record<string, any>>(cb: (params: T) => T): void;
|
|
15
|
+
replaceRouteParams<T extends Record<string, any>>(cb: (params: T) => T): void;
|
|
16
|
+
goBack(): void;
|
|
15
17
|
addTransitionGuard(config: RouteTransitionGuardConfig): GuardDisposer;
|
|
16
18
|
isTransitionBlocked(): boolean;
|
|
17
19
|
unblockTransition(): void;
|
|
@@ -34,7 +36,9 @@ export interface IRouterRepository {
|
|
|
34
36
|
getMatchedRoute(): MatchedRoute | undefined;
|
|
35
37
|
getCurrentRoute(): Route<any> | undefined;
|
|
36
38
|
goToRoute<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined): void;
|
|
39
|
+
replaceRoute<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined): void;
|
|
37
40
|
getLink<TParams extends RouteParamsDefinition | undefined>(route: Route<TParams>, params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined): string;
|
|
41
|
+
goBack(): void;
|
|
38
42
|
registerRoutes(routes: Route[]): void;
|
|
39
43
|
addGuard(config: RouteTransitionGuardConfig): GuardDisposer;
|
|
40
44
|
isBlocked(): boolean;
|
|
@@ -62,7 +66,12 @@ interface IRouterGateway {
|
|
|
62
66
|
goToRoute(name: string, params?: {
|
|
63
67
|
[k: string]: any;
|
|
64
68
|
}): void;
|
|
69
|
+
replaceRoute(name: string, params?: {
|
|
70
|
+
[k: string]: any;
|
|
71
|
+
}): void;
|
|
72
|
+
goBack(): void;
|
|
65
73
|
pushState(url: string): void;
|
|
74
|
+
replaceState(url: string): void;
|
|
66
75
|
addGuard(config: RouteTransitionGuardConfig): GuardDisposer;
|
|
67
76
|
destroy(): void;
|
|
68
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/router/abstractions.js","sources":["../../../src/features/router/abstractions.ts"],"sourcesContent":["import { Abstraction } from \"@webiny/di\";\nimport type { Route, RouteParamsDefinition, RouteParamsInfer } from \"./Route.js\";\nimport type { RequiredKeysOf } from \"type-fest\";\n\n/***** Presenter *****/\n\nexport type RouteParamsArgs<TParams extends RouteParamsDefinition | undefined> =\n TParams extends RouteParamsDefinition\n ? RequiredKeysOf<RouteParamsInfer<TParams>> extends never\n ? [params?: RouteParamsInfer<TParams>] // all optional → param optional\n : [params: RouteParamsInfer<TParams>] // some required → param required\n : [];\n\ninterface RouterViewModel {\n currentRoute: MatchedRoute | undefined;\n}\n\nexport interface IRouterPresenter {\n vm: RouterViewModel;\n bootstrap(routes: Route[]): void;\n goToRoute<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n ...args: RouteParamsArgs<TParams>\n ): void;\n getLink<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n ...args: RouteParamsArgs<TParams>\n ): string;\n setRouteParams<T extends Record<string, any>>(cb: (params: T) => T): void;\n addTransitionGuard(config: RouteTransitionGuardConfig): GuardDisposer;\n isTransitionBlocked(): boolean;\n unblockTransition(): void;\n confirmTransition(): void;\n cancelTransition(): void;\n destroy(): void;\n}\nexport const RouterPresenter = new Abstraction<IRouterPresenter>(\"RouterPresenter\");\n\nexport namespace RouterPresenter {\n export type Interface = IRouterPresenter;\n}\n\n/***** Repository *****/\n\nexport interface MatchedRoute<TParams = Record<string, any>> {\n // Name of the matched route.\n name: string;\n // Pathname that was used to match the route.\n pathname: string;\n // Path pattern that matched this route.\n path: string;\n // Route params extracted from the pathname.\n params: TParams;\n}\n\nexport interface IRouterRepository {\n getMatchedRoute(): MatchedRoute | undefined;\n\n getCurrentRoute(): Route<any> | undefined;\n\n goToRoute<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n ): void;\n\n getLink<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n ): string;\n\n registerRoutes(routes: Route[]): void;\n\n addGuard(config: RouteTransitionGuardConfig): GuardDisposer;\n isBlocked(): boolean;\n unblock(): void;\n confirmTransition(): void;\n cancelTransition(): void;\n\n destroy(): void;\n}\n\nexport const RouterRepository = new Abstraction<IRouterRepository>(\"RouterRepository\");\n\nexport namespace RouterRepository {\n export type Interface = IRouterRepository;\n}\n\n/***** Gateway *****/\n\nexport interface RouteDefinition {\n name: string;\n path: string;\n onMatch(route: MatchedRoute): void;\n}\n\nexport type TransitionController = {\n continue: () => void;\n cancel: () => void;\n};\n\ninterface IRouterGateway {\n setRoutes(routes: RouteDefinition[]): void;\n goToRoute(name: string, params?: { [k: string]: any }): void;\n pushState(url: string): void;\n addGuard(config: RouteTransitionGuardConfig): GuardDisposer;\n destroy(): void;\n}\n\nexport const RouterGateway = new Abstraction<IRouterGateway>(\"RouterGateway\");\n\nexport namespace RouterGateway {\n export type Interface = IRouterGateway;\n}\n\n/***** Route Transition *****/\n\nexport type GuardDisposer = () => void;\n\nexport interface RouteTransitionGuardConfig {\n /** Return true to block the transition. */\n guard: () => boolean;\n /** Called when this guard blocks a transition. Show a confirmation dialog here. */\n onBlocked: (controller: TransitionController) => void;\n}\n"],"names":["RouterPresenter","Abstraction","RouterRepository","RouterGateway"],"mappings":";
|
|
1
|
+
{"version":3,"file":"features/router/abstractions.js","sources":["../../../src/features/router/abstractions.ts"],"sourcesContent":["import { Abstraction } from \"@webiny/di\";\nimport type { Route, RouteParamsDefinition, RouteParamsInfer } from \"./Route.js\";\nimport type { RequiredKeysOf } from \"type-fest\";\n\n/***** Presenter *****/\n\nexport type RouteParamsArgs<TParams extends RouteParamsDefinition | undefined> =\n TParams extends RouteParamsDefinition\n ? RequiredKeysOf<RouteParamsInfer<TParams>> extends never\n ? [params?: RouteParamsInfer<TParams>] // all optional → param optional\n : [params: RouteParamsInfer<TParams>] // some required → param required\n : [];\n\ninterface RouterViewModel {\n currentRoute: MatchedRoute | undefined;\n}\n\nexport interface IRouterPresenter {\n vm: RouterViewModel;\n bootstrap(routes: Route[]): void;\n goToRoute<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n ...args: RouteParamsArgs<TParams>\n ): void;\n getLink<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n ...args: RouteParamsArgs<TParams>\n ): string;\n setRouteParams<T extends Record<string, any>>(cb: (params: T) => T): void;\n replaceRouteParams<T extends Record<string, any>>(cb: (params: T) => T): void;\n goBack(): void;\n addTransitionGuard(config: RouteTransitionGuardConfig): GuardDisposer;\n isTransitionBlocked(): boolean;\n unblockTransition(): void;\n confirmTransition(): void;\n cancelTransition(): void;\n destroy(): void;\n}\nexport const RouterPresenter = new Abstraction<IRouterPresenter>(\"RouterPresenter\");\n\nexport namespace RouterPresenter {\n export type Interface = IRouterPresenter;\n}\n\n/***** Repository *****/\n\nexport interface MatchedRoute<TParams = Record<string, any>> {\n // Name of the matched route.\n name: string;\n // Pathname that was used to match the route.\n pathname: string;\n // Path pattern that matched this route.\n path: string;\n // Route params extracted from the pathname.\n params: TParams;\n}\n\nexport interface IRouterRepository {\n getMatchedRoute(): MatchedRoute | undefined;\n\n getCurrentRoute(): Route<any> | undefined;\n\n goToRoute<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n ): void;\n\n replaceRoute<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n ): void;\n\n getLink<TParams extends RouteParamsDefinition | undefined>(\n route: Route<TParams>,\n params: TParams extends RouteParamsDefinition ? RouteParamsInfer<TParams> : undefined\n ): string;\n\n goBack(): void;\n\n registerRoutes(routes: Route[]): void;\n\n addGuard(config: RouteTransitionGuardConfig): GuardDisposer;\n isBlocked(): boolean;\n unblock(): void;\n confirmTransition(): void;\n cancelTransition(): void;\n\n destroy(): void;\n}\n\nexport const RouterRepository = new Abstraction<IRouterRepository>(\"RouterRepository\");\n\nexport namespace RouterRepository {\n export type Interface = IRouterRepository;\n}\n\n/***** Gateway *****/\n\nexport interface RouteDefinition {\n name: string;\n path: string;\n onMatch(route: MatchedRoute): void;\n}\n\nexport type TransitionController = {\n continue: () => void;\n cancel: () => void;\n};\n\ninterface IRouterGateway {\n setRoutes(routes: RouteDefinition[]): void;\n goToRoute(name: string, params?: { [k: string]: any }): void;\n replaceRoute(name: string, params?: { [k: string]: any }): void;\n goBack(): void;\n pushState(url: string): void;\n replaceState(url: string): void;\n addGuard(config: RouteTransitionGuardConfig): GuardDisposer;\n destroy(): void;\n}\n\nexport const RouterGateway = new Abstraction<IRouterGateway>(\"RouterGateway\");\n\nexport namespace RouterGateway {\n export type Interface = IRouterGateway;\n}\n\n/***** Route Transition *****/\n\nexport type GuardDisposer = () => void;\n\nexport interface RouteTransitionGuardConfig {\n /** Return true to block the transition. */\n guard: () => boolean;\n /** Called when this guard blocks a transition. Show a confirmation dialog here. */\n onBlocked: (controller: TransitionController) => void;\n}\n"],"names":["RouterPresenter","Abstraction","RouterRepository","RouterGateway"],"mappings":";AAsCO,MAAMA,kBAAkB,IAAIC,YAA8B;AAoD1D,MAAMC,mBAAmB,IAAID,YAA+B;AA8B5D,MAAME,gBAAgB,IAAIF,YAA4B"}
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export { AddQuerySelectionPlugin } from "./plugins/AddQuerySelectionPlugin.js";
|
|
2
|
-
export { ApolloLinkPlugin } from "./plugins/ApolloLinkPlugin.js";
|
|
3
|
-
export { ApolloCacheObjectIdPlugin, type ApolloCacheObject } from "./plugins/ApolloCacheObjectIdPlugin.js";
|
|
4
1
|
export * from "@webiny/react-composition";
|
|
5
2
|
export type { HigherOrderComponent, ComposeProps, ComposableFC } from "@webiny/react-composition";
|
|
6
3
|
export * from "./App.js";
|
package/index.js
CHANGED
|
@@ -9,9 +9,6 @@ export * from "./core/createProviderPlugin.js";
|
|
|
9
9
|
export * from "./renderApp.js";
|
|
10
10
|
export * from "./utils/createGenericContext.js";
|
|
11
11
|
export * from "./helpers/InterfaceGenerator/index.js";
|
|
12
|
-
export { AddQuerySelectionPlugin } from "./plugins/AddQuerySelectionPlugin.js";
|
|
13
|
-
export { ApolloLinkPlugin } from "./plugins/ApolloLinkPlugin.js";
|
|
14
|
-
export { ApolloCacheObjectIdPlugin } from "./plugins/ApolloCacheObjectIdPlugin.js";
|
|
15
12
|
export { DiContainerProvider, useContainer } from "./shared/di/DiContainerProvider.js";
|
|
16
13
|
export { useFeature } from "./shared/di/useFeature.js";
|
|
17
14
|
export { createFeature } from "./shared/di/createFeature.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.6.0-alpha.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -18,44 +18,31 @@
|
|
|
18
18
|
],
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@apollo/react-hooks": "3.1.5",
|
|
22
|
-
"@emotion/styled": "11.14.1",
|
|
23
21
|
"@types/react": "18.3.31",
|
|
24
22
|
"@webiny/di": "1.0.2",
|
|
25
|
-
"@webiny/feature": "6.
|
|
26
|
-
"@webiny/i18n": "6.
|
|
27
|
-
"@webiny/i18n-react": "6.
|
|
28
|
-
"@webiny/plugins": "6.
|
|
29
|
-
"@webiny/react-composition": "6.
|
|
30
|
-
"@webiny/react-properties": "6.
|
|
31
|
-
"@webiny/stdlib": "0.0.8",
|
|
32
|
-
"apollo-cache": "1.3.5",
|
|
33
|
-
"apollo-cache-inmemory": "1.6.6",
|
|
34
|
-
"apollo-client": "2.6.10",
|
|
35
|
-
"apollo-link": "1.2.14",
|
|
36
|
-
"apollo-link-context": "1.0.20",
|
|
37
|
-
"apollo-link-error": "1.1.13",
|
|
38
|
-
"apollo-link-http-common": "0.2.16",
|
|
39
|
-
"apollo-utilities": "1.3.4",
|
|
23
|
+
"@webiny/feature": "6.6.0-alpha.0",
|
|
24
|
+
"@webiny/i18n": "6.6.0-alpha.0",
|
|
25
|
+
"@webiny/i18n-react": "6.6.0-alpha.0",
|
|
26
|
+
"@webiny/plugins": "6.6.0-alpha.0",
|
|
27
|
+
"@webiny/react-composition": "6.6.0-alpha.0",
|
|
28
|
+
"@webiny/react-properties": "6.6.0-alpha.0",
|
|
40
29
|
"graphql": "16.14.2",
|
|
41
30
|
"history": "5.3.0",
|
|
42
31
|
"invariant": "2.2.4",
|
|
43
32
|
"lodash": "4.18.1",
|
|
44
33
|
"mobx": "6.16.1",
|
|
45
|
-
"nanoid": "5.1.16",
|
|
46
34
|
"react": "18.3.1",
|
|
47
35
|
"react-dom": "18.3.1",
|
|
48
|
-
"ts-invariant": "0.10.3",
|
|
49
36
|
"warning": "4.0.3",
|
|
50
37
|
"zod": "4.4.3"
|
|
51
38
|
},
|
|
52
39
|
"devDependencies": {
|
|
53
40
|
"@types/lodash": "4.17.24",
|
|
54
41
|
"@types/warning": "3.0.4",
|
|
55
|
-
"@webiny/build-tools": "6.
|
|
42
|
+
"@webiny/build-tools": "6.6.0-alpha.0",
|
|
56
43
|
"rimraf": "6.1.3",
|
|
57
44
|
"type-fest": "5.8.0",
|
|
58
|
-
"typescript": "
|
|
45
|
+
"typescript": "7.0.2",
|
|
59
46
|
"vitest": "4.1.10"
|
|
60
47
|
},
|
|
61
48
|
"publishConfig": {
|
package/plugins/image.d.ts
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Route, RouteParamsDefinition } from "../../../features/router/Route.js";
|
|
2
|
+
export interface RouteParamFieldConfig<T> {
|
|
3
|
+
param: string;
|
|
4
|
+
read: () => T | undefined;
|
|
5
|
+
write: (value: T | undefined) => void;
|
|
6
|
+
storageKey?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface RouteParamField {
|
|
9
|
+
param: string;
|
|
10
|
+
read: () => unknown;
|
|
11
|
+
write: (value: unknown) => void;
|
|
12
|
+
storageKey?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface RouteParamFieldBuilder {
|
|
15
|
+
create<T>(config: RouteParamFieldConfig<T>): RouteParamField;
|
|
16
|
+
}
|
|
17
|
+
interface RouteParamsSyncProps<TParams extends RouteParamsDefinition | undefined> {
|
|
18
|
+
route: Route<TParams>;
|
|
19
|
+
fields: (builder: RouteParamFieldBuilder) => RouteParamField[];
|
|
20
|
+
}
|
|
21
|
+
export declare function RouteParamsSync<TParams extends RouteParamsDefinition | undefined>({ route: routeDefinition, fields: buildFields }: RouteParamsSyncProps<TParams>): null;
|
|
22
|
+
export {};
|