@redneckz/wildless-cms-uni-blocks 0.6.42 → 0.6.44
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/bin/migration-scripts/0.6.34.js +2 -0
- package/bin/migration-scripts/0.6.43.js +29 -0
- package/bundle/ProjectSettings.d.ts +2 -0
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +122 -91
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ProductTile/ProductTileContent.d.ts +24 -2
- package/bundle/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
- package/bundle/components/ProductTile/renderBenefit.d.ts +4 -0
- package/bundle/components/ProductTile/renderImage.d.ts +3 -0
- package/bundle/content-page-repository/transformImg.d.ts +1 -1
- package/bundle/services/BlockRouter/BlockRouter.d.ts +1 -1
- package/bundle/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
- package/bundle/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
- package/bundle/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
- package/bundle/utils/normalizeURLPath.d.ts +1 -0
- package/bundle/utils/url.d.ts +1 -0
- package/dist/ProjectSettings.d.ts +2 -0
- package/dist/ProjectSettings.js +5 -0
- package/dist/ProjectSettings.js.map +1 -1
- package/dist/api/LikeAPI.js +2 -2
- package/dist/api/LikeAPI.js.map +1 -1
- package/dist/components/Header/Header.js +1 -6
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/ProductTile/ProductTile.js +9 -22
- package/dist/components/ProductTile/ProductTile.js.map +1 -1
- package/dist/components/ProductTile/ProductTileContent.d.ts +24 -2
- package/dist/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
- package/dist/components/ProductTile/renderAdditionalDescription.js +18 -0
- package/dist/components/ProductTile/renderAdditionalDescription.js.map +1 -0
- package/dist/components/ProductTile/renderBenefit.d.ts +4 -0
- package/dist/components/ProductTile/renderBenefit.js +32 -0
- package/dist/components/ProductTile/renderBenefit.js.map +1 -0
- package/dist/components/ProductTile/renderImage.d.ts +3 -0
- package/dist/components/ProductTile/renderImage.js +12 -0
- package/dist/components/ProductTile/renderImage.js.map +1 -0
- package/dist/components/TextBlock/TextBlock.js +13 -28
- package/dist/components/TextBlock/TextBlock.js.map +1 -1
- package/dist/content-page-repository/transformImg.d.ts +1 -1
- package/dist/content-page-repository/transformImg.js +4 -10
- package/dist/content-page-repository/transformImg.js.map +1 -1
- package/dist/content-page-repository/transformMarkdown.js +3 -3
- package/dist/content-page-repository/transformMarkdown.js.map +1 -1
- package/dist/hooks/useLink.js +3 -5
- package/dist/hooks/useLink.js.map +1 -1
- package/dist/hooks/useLocation.js +11 -5
- package/dist/hooks/useLocation.js.map +1 -1
- package/dist/services/BlockRouter/BlockRouter.d.ts +1 -1
- package/dist/services/BlockRouter/BlockRouter.js.map +1 -1
- package/dist/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
- package/dist/services/sitemap/checkIsHrefSameOrigin.js +1 -1
- package/dist/services/sitemap/checkIsHrefSameOrigin.js.map +1 -1
- package/dist/services/sitemap/isHrefActive.js +2 -3
- package/dist/services/sitemap/isHrefActive.js.map +1 -1
- package/dist/setup-fixture.js +3 -3
- package/dist/setup-fixture.js.map +1 -1
- package/dist/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
- package/dist/ui-kit/MarkdownText/MarkdownText.js +9 -0
- package/dist/ui-kit/MarkdownText/MarkdownText.js.map +1 -0
- package/dist/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
- package/dist/ui-kit/MarkdownText/MarkdownTextProps.js +2 -0
- package/dist/ui-kit/MarkdownText/MarkdownTextProps.js.map +1 -0
- package/dist/ui-kit/Text/Text.js +1 -5
- package/dist/ui-kit/Text/Text.js.map +1 -1
- package/dist/utils/normalizeURLPath.d.ts +1 -0
- package/dist/utils/normalizeURLPath.js +12 -0
- package/dist/utils/normalizeURLPath.js.map +1 -0
- package/dist/utils/url.d.ts +1 -0
- package/dist/utils/url.js +9 -1
- package/dist/utils/url.js.map +1 -1
- package/dist/wlc.json +3 -1
- package/lib/ProjectSettings.d.ts +2 -0
- package/lib/ProjectSettings.js +5 -0
- package/lib/ProjectSettings.js.map +1 -1
- package/lib/api/LikeAPI.js +2 -2
- package/lib/api/LikeAPI.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/Header/Header.js +1 -6
- package/lib/components/Header/Header.js.map +1 -1
- package/lib/components/ProductTile/ProductTile.js +10 -23
- package/lib/components/ProductTile/ProductTile.js.map +1 -1
- package/lib/components/ProductTile/ProductTileContent.d.ts +24 -2
- package/lib/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
- package/lib/components/ProductTile/renderAdditionalDescription.js +15 -0
- package/lib/components/ProductTile/renderAdditionalDescription.js.map +1 -0
- package/lib/components/ProductTile/renderBenefit.d.ts +4 -0
- package/lib/components/ProductTile/renderBenefit.js +29 -0
- package/lib/components/ProductTile/renderBenefit.js.map +1 -0
- package/lib/components/ProductTile/renderImage.d.ts +3 -0
- package/lib/components/ProductTile/renderImage.js +9 -0
- package/lib/components/ProductTile/renderImage.js.map +1 -0
- package/lib/components/TextBlock/TextBlock.js +13 -28
- package/lib/components/TextBlock/TextBlock.js.map +1 -1
- package/lib/content-page-repository/transformImg.d.ts +1 -1
- package/lib/content-page-repository/transformImg.js +4 -10
- package/lib/content-page-repository/transformImg.js.map +1 -1
- package/lib/content-page-repository/transformMarkdown.js +3 -3
- package/lib/content-page-repository/transformMarkdown.js.map +1 -1
- package/lib/hooks/useLink.js +3 -5
- package/lib/hooks/useLink.js.map +1 -1
- package/lib/hooks/useLocation.js +11 -5
- package/lib/hooks/useLocation.js.map +1 -1
- package/lib/services/BlockRouter/BlockRouter.d.ts +1 -1
- package/lib/services/BlockRouter/BlockRouter.js.map +1 -1
- package/lib/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
- package/lib/services/sitemap/checkIsHrefSameOrigin.js +1 -1
- package/lib/services/sitemap/checkIsHrefSameOrigin.js.map +1 -1
- package/lib/services/sitemap/isHrefActive.js +3 -4
- package/lib/services/sitemap/isHrefActive.js.map +1 -1
- package/lib/setup-fixture.js +3 -3
- package/lib/setup-fixture.js.map +1 -1
- package/lib/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
- package/lib/ui-kit/MarkdownText/MarkdownText.js +7 -0
- package/lib/ui-kit/MarkdownText/MarkdownText.js.map +1 -0
- package/lib/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
- package/lib/ui-kit/MarkdownText/MarkdownTextProps.js +2 -0
- package/lib/ui-kit/MarkdownText/MarkdownTextProps.js.map +1 -0
- package/lib/ui-kit/Text/Text.js +1 -5
- package/lib/ui-kit/Text/Text.js.map +1 -1
- package/lib/utils/normalizeURLPath.d.ts +1 -0
- package/lib/utils/normalizeURLPath.js +9 -0
- package/lib/utils/normalizeURLPath.js.map +1 -0
- package/lib/utils/url.d.ts +1 -0
- package/lib/utils/url.js +7 -0
- package/lib/utils/url.js.map +1 -1
- package/lib/wlc.json +3 -1
- package/mobile/bundle/ProjectSettings.d.ts +2 -0
- package/mobile/bundle/bundle.umd.js +39 -21
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ProductTile/ProductTileContent.d.ts +24 -2
- package/mobile/bundle/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
- package/mobile/bundle/components/ProductTile/renderBenefit.d.ts +4 -0
- package/mobile/bundle/components/ProductTile/renderImage.d.ts +3 -0
- package/mobile/bundle/content-page-repository/transformImg.d.ts +1 -1
- package/mobile/bundle/services/BlockRouter/BlockRouter.d.ts +1 -1
- package/mobile/bundle/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
- package/mobile/bundle/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
- package/mobile/bundle/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
- package/mobile/bundle/utils/normalizeURLPath.d.ts +1 -0
- package/mobile/bundle/utils/url.d.ts +1 -0
- package/mobile/dist/ProjectSettings.d.ts +2 -0
- package/mobile/dist/ProjectSettings.js +5 -0
- package/mobile/dist/ProjectSettings.js.map +1 -1
- package/mobile/dist/api/LikeAPI.js +2 -2
- package/mobile/dist/api/LikeAPI.js.map +1 -1
- package/mobile/dist/components/ProductTile/ProductTile.js +9 -22
- package/mobile/dist/components/ProductTile/ProductTile.js.map +1 -1
- package/mobile/dist/components/ProductTile/ProductTileContent.d.ts +24 -2
- package/mobile/dist/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
- package/mobile/dist/components/ProductTile/renderAdditionalDescription.js +18 -0
- package/mobile/dist/components/ProductTile/renderAdditionalDescription.js.map +1 -0
- package/mobile/dist/components/ProductTile/renderBenefit.d.ts +4 -0
- package/mobile/dist/components/ProductTile/renderBenefit.js +32 -0
- package/mobile/dist/components/ProductTile/renderBenefit.js.map +1 -0
- package/mobile/dist/components/ProductTile/renderImage.d.ts +3 -0
- package/mobile/dist/components/ProductTile/renderImage.js +12 -0
- package/mobile/dist/components/ProductTile/renderImage.js.map +1 -0
- package/mobile/dist/content-page-repository/transformImg.d.ts +1 -1
- package/mobile/dist/content-page-repository/transformImg.js +4 -10
- package/mobile/dist/content-page-repository/transformImg.js.map +1 -1
- package/mobile/dist/content-page-repository/transformMarkdown.js +3 -3
- package/mobile/dist/content-page-repository/transformMarkdown.js.map +1 -1
- package/mobile/dist/hooks/useLink.js +3 -5
- package/mobile/dist/hooks/useLink.js.map +1 -1
- package/mobile/dist/hooks/useLocation.js +11 -5
- package/mobile/dist/hooks/useLocation.js.map +1 -1
- package/mobile/dist/services/BlockRouter/BlockRouter.d.ts +1 -1
- package/mobile/dist/services/BlockRouter/BlockRouter.js.map +1 -1
- package/mobile/dist/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
- package/mobile/dist/services/sitemap/checkIsHrefSameOrigin.js +1 -1
- package/mobile/dist/services/sitemap/checkIsHrefSameOrigin.js.map +1 -1
- package/mobile/dist/services/sitemap/isHrefActive.js +2 -3
- package/mobile/dist/services/sitemap/isHrefActive.js.map +1 -1
- package/mobile/dist/setup-fixture.js +3 -3
- package/mobile/dist/setup-fixture.js.map +1 -1
- package/mobile/dist/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
- package/mobile/dist/ui-kit/MarkdownText/MarkdownText.js +9 -0
- package/mobile/dist/ui-kit/MarkdownText/MarkdownText.js.map +1 -0
- package/mobile/dist/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
- package/mobile/dist/ui-kit/MarkdownText/MarkdownTextProps.js +2 -0
- package/mobile/dist/ui-kit/MarkdownText/MarkdownTextProps.js.map +1 -0
- package/mobile/dist/ui-kit/Text/Text.js +1 -5
- package/mobile/dist/ui-kit/Text/Text.js.map +1 -1
- package/mobile/dist/utils/normalizeURLPath.d.ts +1 -0
- package/mobile/dist/utils/normalizeURLPath.js +12 -0
- package/mobile/dist/utils/normalizeURLPath.js.map +1 -0
- package/mobile/dist/utils/url.d.ts +1 -0
- package/mobile/dist/utils/url.js +9 -1
- package/mobile/dist/utils/url.js.map +1 -1
- package/mobile/dist/wlc.json +3 -1
- package/mobile/lib/ProjectSettings.d.ts +2 -0
- package/mobile/lib/ProjectSettings.js +5 -0
- package/mobile/lib/ProjectSettings.js.map +1 -1
- package/mobile/lib/api/LikeAPI.js +2 -2
- package/mobile/lib/api/LikeAPI.js.map +1 -1
- package/mobile/lib/components/ProductTile/ProductTile.js +10 -23
- package/mobile/lib/components/ProductTile/ProductTile.js.map +1 -1
- package/mobile/lib/components/ProductTile/ProductTileContent.d.ts +24 -2
- package/mobile/lib/components/ProductTile/renderAdditionalDescription.d.ts +4 -0
- package/mobile/lib/components/ProductTile/renderAdditionalDescription.js +15 -0
- package/mobile/lib/components/ProductTile/renderAdditionalDescription.js.map +1 -0
- package/mobile/lib/components/ProductTile/renderBenefit.d.ts +4 -0
- package/mobile/lib/components/ProductTile/renderBenefit.js +29 -0
- package/mobile/lib/components/ProductTile/renderBenefit.js.map +1 -0
- package/mobile/lib/components/ProductTile/renderImage.d.ts +3 -0
- package/mobile/lib/components/ProductTile/renderImage.js +9 -0
- package/mobile/lib/components/ProductTile/renderImage.js.map +1 -0
- package/mobile/lib/content-page-repository/transformImg.d.ts +1 -1
- package/mobile/lib/content-page-repository/transformImg.js +4 -10
- package/mobile/lib/content-page-repository/transformImg.js.map +1 -1
- package/mobile/lib/content-page-repository/transformMarkdown.js +3 -3
- package/mobile/lib/content-page-repository/transformMarkdown.js.map +1 -1
- package/mobile/lib/hooks/useLink.js +3 -5
- package/mobile/lib/hooks/useLink.js.map +1 -1
- package/mobile/lib/hooks/useLocation.js +11 -5
- package/mobile/lib/hooks/useLocation.js.map +1 -1
- package/mobile/lib/services/BlockRouter/BlockRouter.d.ts +1 -1
- package/mobile/lib/services/BlockRouter/BlockRouter.js.map +1 -1
- package/mobile/lib/services/sitemap/checkIsHrefSameOrigin.d.ts +2 -4
- package/mobile/lib/services/sitemap/checkIsHrefSameOrigin.js +1 -1
- package/mobile/lib/services/sitemap/checkIsHrefSameOrigin.js.map +1 -1
- package/mobile/lib/services/sitemap/isHrefActive.js +3 -4
- package/mobile/lib/services/sitemap/isHrefActive.js.map +1 -1
- package/mobile/lib/setup-fixture.js +3 -3
- package/mobile/lib/setup-fixture.js.map +1 -1
- package/mobile/lib/ui-kit/MarkdownText/MarkdownText.d.ts +2 -0
- package/mobile/lib/ui-kit/MarkdownText/MarkdownText.js +7 -0
- package/mobile/lib/ui-kit/MarkdownText/MarkdownText.js.map +1 -0
- package/mobile/lib/ui-kit/MarkdownText/MarkdownTextProps.d.ts +6 -0
- package/mobile/lib/ui-kit/MarkdownText/MarkdownTextProps.js +2 -0
- package/mobile/lib/ui-kit/MarkdownText/MarkdownTextProps.js.map +1 -0
- package/mobile/lib/ui-kit/Text/Text.js +1 -5
- package/mobile/lib/ui-kit/Text/Text.js.map +1 -1
- package/mobile/lib/utils/normalizeURLPath.d.ts +1 -0
- package/mobile/lib/utils/normalizeURLPath.js +9 -0
- package/mobile/lib/utils/normalizeURLPath.js.map +1 -0
- package/mobile/lib/utils/url.d.ts +1 -0
- package/mobile/lib/utils/url.js +7 -0
- package/mobile/lib/utils/url.js.map +1 -1
- package/mobile/lib/wlc.json +3 -1
- package/mobile/src/ProjectSettings.ts +6 -0
- package/mobile/src/api/LikeAPI.ts +2 -2
- package/mobile/src/common.css +50 -0
- package/mobile/src/components/ProductTile/ProductTile.example.json +3 -0
- package/mobile/src/components/ProductTile/ProductTile.tsx +13 -44
- package/mobile/src/components/ProductTile/ProductTile.ui.json +14 -1
- package/mobile/src/components/ProductTile/ProductTileContent.ts +26 -2
- package/mobile/src/components/ProductTile/renderAdditionalDescription.tsx +30 -0
- package/mobile/src/components/ProductTile/renderBenefit.tsx +39 -0
- package/mobile/src/components/ProductTile/renderImage.tsx +15 -0
- package/mobile/src/content-page-repository/transformImg.ts +6 -14
- package/mobile/src/content-page-repository/transformMarkdown.ts +3 -3
- package/mobile/src/hooks/useLink.ts +6 -7
- package/mobile/src/hooks/useLocation.ts +12 -6
- package/mobile/src/services/BlockRouter/BlockRouter.ts +1 -1
- package/mobile/src/services/sitemap/checkIsHrefSameOrigin.ts +5 -4
- package/mobile/src/services/sitemap/isHrefActive.ts +7 -4
- package/mobile/src/setup-fixture.ts +3 -3
- package/mobile/src/ui-kit/MarkdownText/MarkdownText.tsx +8 -0
- package/mobile/src/ui-kit/MarkdownText/MarkdownTextProps.ts +6 -0
- package/mobile/src/ui-kit/Text/Text.tsx +5 -7
- package/mobile/src/utils/normalizeURLPath.ts +10 -0
- package/mobile/src/utils/url.ts +10 -0
- package/mobile/src/wlc.json +3 -1
- package/package.json +1 -1
- package/src/ProjectSettings.ts +6 -0
- package/src/api/LikeAPI.ts +2 -2
- package/src/common.css +50 -0
- package/src/components/Header/Header.tsx +2 -10
- package/src/components/ProductTile/ProductTile.example.json +3 -0
- package/src/components/ProductTile/ProductTile.fixture.tsx +11 -4
- package/src/components/ProductTile/ProductTile.tsx +13 -44
- package/src/components/ProductTile/ProductTile.ui.json +14 -1
- package/src/components/ProductTile/ProductTileContent.ts +26 -2
- package/src/components/ProductTile/renderAdditionalDescription.tsx +30 -0
- package/src/components/ProductTile/renderBenefit.tsx +39 -0
- package/src/components/ProductTile/renderImage.tsx +15 -0
- package/src/components/TextBlock/TextBlock.tsx +49 -41
- package/src/content-page-repository/transformImg.ts +6 -14
- package/src/content-page-repository/transformMarkdown.ts +3 -3
- package/src/hooks/useLink.ts +6 -7
- package/src/hooks/useLocation.ts +12 -6
- package/src/services/BlockRouter/BlockRouter.ts +1 -1
- package/src/services/sitemap/checkIsHrefSameOrigin.ts +5 -4
- package/src/services/sitemap/isHrefActive.ts +7 -4
- package/src/setup-fixture.ts +3 -3
- package/src/ui-kit/MarkdownText/MarkdownText.tsx +8 -0
- package/src/ui-kit/MarkdownText/MarkdownTextProps.ts +6 -0
- package/src/ui-kit/Text/Text.tsx +5 -7
- package/src/utils/normalizeURLPath.ts +10 -0
- package/src/utils/url.ts +10 -0
- package/src/wlc.json +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../src/ui-kit/Text/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAUxC,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../src/ui-kit/Text/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAUxC,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAC7E,eAAM,SAAS,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,YAC/E,QAAQ,GACJ,CACR,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const normalizeURLPath: (href?: string) => string | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { projectSettings } from '../ProjectSettings.js';
|
|
2
|
+
import { isURL } from './url.js';
|
|
3
|
+
export const normalizeURLPath = (href) => {
|
|
4
|
+
if (isURL(href) || href?.startsWith('/')) {
|
|
5
|
+
return href;
|
|
6
|
+
}
|
|
7
|
+
return `${projectSettings.BASE_PATH || ''}${href}`;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=normalizeURLPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeURLPath.js","sourceRoot":"","sources":["../../src/utils/normalizeURLPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAa,EAAE,EAAE;IAChD,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE;QACxC,OAAO,IAAI,CAAC;KACb;IAED,OAAO,GAAG,eAAe,CAAC,SAAS,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;AACrD,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const isURL: (href?: string) => boolean | undefined;
|
|
2
2
|
export declare const withoutQuery: (href?: string) => string;
|
|
3
3
|
export declare const getOrigin: (href?: string) => string | undefined;
|
|
4
|
+
export declare const getPathname: (href?: string) => string | undefined;
|
|
4
5
|
export declare const getHash: (href?: string) => string | undefined;
|
|
5
6
|
export declare const isHash: (href?: string) => boolean | undefined;
|
package/mobile/lib/utils/url.js
CHANGED
|
@@ -10,6 +10,13 @@ export const getOrigin = (href) => {
|
|
|
10
10
|
const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
|
|
11
11
|
return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
|
|
12
12
|
};
|
|
13
|
+
export const getPathname = (href) => {
|
|
14
|
+
if (!href || !isURL(href)) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const url = new URL(href);
|
|
18
|
+
return url.pathname;
|
|
19
|
+
};
|
|
13
20
|
export const getHash = (href) => {
|
|
14
21
|
if (!href || !isURL(href)) {
|
|
15
22
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAa,EAAE,EAAE;IACzC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACzB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,GAAG,GAAG,IAAI,CAAC;IACjB,MAAM,cAAc,GAAG,IAAI,CAAC;IAC5B,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAEzE,OAAO,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAa,EAAE,EAAE;IACvC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACzB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEpC,OAAO,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAa,EAAE,EAAE;IACzC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACzB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,GAAG,GAAG,IAAI,CAAC;IACjB,MAAM,cAAc,GAAG,IAAI,CAAC;IAC5B,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAEzE,OAAO,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAClE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAa,EAAE,EAAE;IAC3C,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACzB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IAE1B,OAAO,GAAG,CAAC,QAAQ,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAa,EAAE,EAAE;IACvC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACzB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEpC,OAAO,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC"}
|
package/mobile/lib/wlc.json
CHANGED
|
@@ -7,6 +7,7 @@ export interface ProjectSettings {
|
|
|
7
7
|
SITEMAP?: string;
|
|
8
8
|
FOOTER?: string;
|
|
9
9
|
CDN?: string; // Should ends with "/"
|
|
10
|
+
BASE_PATH?: string; // Should ends with "/"
|
|
10
11
|
YANDEX_MAP_API_KEY?: string;
|
|
11
12
|
YANDEX_METRIKA_ID?: string;
|
|
12
13
|
}
|
|
@@ -45,6 +46,11 @@ export const projectSettings = new (class implements ProjectSettings {
|
|
|
45
46
|
get CDN() {
|
|
46
47
|
return this._.CDN;
|
|
47
48
|
}
|
|
49
|
+
get BASE_PATH() {
|
|
50
|
+
return this._.BASE_PATH && !this._.BASE_PATH.endsWith('/')
|
|
51
|
+
? `${this._.BASE_PATH}/`
|
|
52
|
+
: this._.BASE_PATH;
|
|
53
|
+
}
|
|
48
54
|
get YANDEX_MAP_API_KEY() {
|
|
49
55
|
return this._.YANDEX_MAP_API_KEY;
|
|
50
56
|
}
|
|
@@ -114,7 +114,7 @@ export function LikeAPI() {
|
|
|
114
114
|
|
|
115
115
|
async function auth(): Promise<UserData> {
|
|
116
116
|
try {
|
|
117
|
-
const userData: UserData = JSON.parse(globalThis.localStorage
|
|
117
|
+
const userData: UserData = JSON.parse(globalThis.localStorage?.getItem(STORAGE_KEY) || '');
|
|
118
118
|
if (userData?.token) {
|
|
119
119
|
return userData;
|
|
120
120
|
}
|
|
@@ -136,7 +136,7 @@ export function LikeAPI() {
|
|
|
136
136
|
|
|
137
137
|
const { token, name } = await response.json();
|
|
138
138
|
|
|
139
|
-
globalThis.localStorage
|
|
139
|
+
globalThis.localStorage?.setItem(STORAGE_KEY, JSON.stringify({ token, name }));
|
|
140
140
|
|
|
141
141
|
return { token, name } as UserData;
|
|
142
142
|
} catch (e) {
|
package/mobile/src/common.css
CHANGED
|
@@ -151,6 +151,56 @@ html {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
@layer components {
|
|
155
|
+
.md-container .h1 {
|
|
156
|
+
@apply text-h1;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.md-container .h2 {
|
|
160
|
+
@apply text-h2;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.md-container .h3 {
|
|
164
|
+
@apply text-h3;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.md-container .h4 {
|
|
168
|
+
@apply text-h4;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.md-container .h5 {
|
|
172
|
+
@apply text-h5;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.md-container .h6 {
|
|
176
|
+
@apply text-h6;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.md-container ul {
|
|
180
|
+
@apply list-inside list-disc;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.md-container ol {
|
|
184
|
+
@apply list-inside list-decimal;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.md-container p {
|
|
188
|
+
@apply text-l font-light;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.md-container li {
|
|
192
|
+
@apply text-l font-light;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.md-container li > p {
|
|
196
|
+
@apply inline;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.md-container a {
|
|
200
|
+
@apply text-primary-main;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
154
204
|
/*
|
|
155
205
|
Styling Yandex Map element
|
|
156
206
|
*/
|
|
@@ -12,14 +12,17 @@
|
|
|
12
12
|
"version": "primary",
|
|
13
13
|
"benefits": [
|
|
14
14
|
{
|
|
15
|
+
"type": "default",
|
|
15
16
|
"label": "Преимущество 1",
|
|
16
17
|
"description": "Описание"
|
|
17
18
|
},
|
|
18
19
|
{
|
|
20
|
+
"type": "default",
|
|
19
21
|
"label": "Преимущество 2",
|
|
20
22
|
"description": "Описание"
|
|
21
23
|
},
|
|
22
24
|
{
|
|
25
|
+
"type": "default",
|
|
23
26
|
"label": "Преимущество 3",
|
|
24
27
|
"description": "Описание"
|
|
25
28
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import type { BlockVersion } from '../../model/BlockVersion';
|
|
3
|
-
import {
|
|
3
|
+
import { VersionStyleMap } from '../../model/BlockVersion';
|
|
4
4
|
import type { UniBlockProps } from '../../model/JSXBlock';
|
|
5
5
|
import type { Picture } from '../../model/Picture';
|
|
6
6
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
7
7
|
import { ButtonSection } from '../../ui-kit/Button/ButtonSection';
|
|
8
|
-
import { Img } from '../../ui-kit/Img/Img';
|
|
9
8
|
import { getTileRightPadding } from '../BaseTile/getTileRightPadding';
|
|
10
9
|
import { Headline } from '../Headline/Headline';
|
|
11
|
-
import type {
|
|
10
|
+
import type { Benefit, ProductTileContent } from './ProductTileContent';
|
|
11
|
+
import { renderAdditionalDescription } from './renderAdditionalDescription';
|
|
12
|
+
import { renderBenefit } from './renderBenefit';
|
|
13
|
+
import { renderImage } from './renderImage';
|
|
12
14
|
|
|
13
15
|
export interface ProductTileProps extends ProductTileContent, UniBlockProps {}
|
|
14
16
|
|
|
@@ -43,7 +45,7 @@ export const ProductTile = JSX<ProductTileProps>(
|
|
|
43
45
|
{...rest}
|
|
44
46
|
/>
|
|
45
47
|
{renderBenefits(benefits, version, image)}
|
|
46
|
-
{
|
|
48
|
+
{renderAdditionalDescription(additionalDescription, image)}
|
|
47
49
|
{buttons?.length ? (
|
|
48
50
|
<ButtonSection buttons={buttons} className="mt-5 gap-4 z-10 text-l" />
|
|
49
51
|
) : null}
|
|
@@ -53,53 +55,20 @@ export const ProductTile = JSX<ProductTileProps>(
|
|
|
53
55
|
),
|
|
54
56
|
);
|
|
55
57
|
|
|
56
|
-
function renderBenefits(benefits:
|
|
58
|
+
function renderBenefits(benefits: Benefit[], version: BlockVersion, image?: Picture) {
|
|
59
|
+
if (!benefits.length) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
// picture width = 242px. Text can overlay picture 20px deep. Outer paddings_x = 36px. 242-36-20 = 186px
|
|
58
|
-
const
|
|
64
|
+
const benefitsWidth = image?.src ? 'max-w-[calc(100%-186px)]' : '100%';
|
|
59
65
|
|
|
60
66
|
return (
|
|
61
67
|
<div
|
|
62
68
|
className={`z-10 grid grid-cols-[max-content_1fr] auto-rows-auto gap-x-6 gap-y-2.5 items-baseline
|
|
63
|
-
${
|
|
69
|
+
${benefitsWidth}`}
|
|
64
70
|
>
|
|
65
71
|
{benefits.length ? benefits.map(renderBenefit(version)) : null}
|
|
66
72
|
</div>
|
|
67
73
|
);
|
|
68
74
|
}
|
|
69
|
-
|
|
70
|
-
const renderBenefit =
|
|
71
|
-
(version: BlockVersion = 'primary') =>
|
|
72
|
-
(benefit: TextBenefit, i: number) => {
|
|
73
|
-
const { label = '', description = '' } = benefit;
|
|
74
|
-
|
|
75
|
-
return [
|
|
76
|
-
<div key={`label-${i}`} className="text-h6">
|
|
77
|
-
{label}
|
|
78
|
-
</div>,
|
|
79
|
-
<div key={`desc-${i}`} className={`text-m-light ${VersionAdditionalStyleMap[version]}`}>
|
|
80
|
-
{description}
|
|
81
|
-
</div>,
|
|
82
|
-
];
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
function renderAdditionalDescription(additionalDescription: string, image?: Picture) {
|
|
86
|
-
// picture width = 242px. Text can overlay picture 20px deep. Outer paddings_x = 36px. 242-36-20 = 186px
|
|
87
|
-
const DESCRIPTION_WIDTH = image?.src ? 'max-w-[calc(100%-186px)]' : '100%';
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<div className={`text-m-light mt-2.5 z-10 ${DESCRIPTION_WIDTH}`}>{additionalDescription}</div>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function renderImage(image?: Picture, isImageOnRightSide?: boolean) {
|
|
95
|
-
if (!image?.src) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return (
|
|
100
|
-
<Img
|
|
101
|
-
className={`absolute ${isImageOnRightSide ? 'right-0' : 'left-0'} bottom-0`}
|
|
102
|
-
image={image}
|
|
103
|
-
/>
|
|
104
|
-
);
|
|
105
|
-
}
|
|
@@ -2,8 +2,32 @@ import type { BlockVersion } from '../../model/BlockVersion';
|
|
|
2
2
|
import type { DescriptionProps, HeadlineProps, LabelProps } from '../../model/HeadlineType';
|
|
3
3
|
import type { Picture } from '../../model/Picture';
|
|
4
4
|
import type { ButtonContent } from '../../ui-kit/Button/ButtonProps';
|
|
5
|
+
import type { MarkdownTextProps } from '../../ui-kit/MarkdownText/MarkdownTextProps';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @title Стандартный
|
|
9
|
+
*/
|
|
10
|
+
type TextBenefit = DescriptionProps &
|
|
11
|
+
LabelProps & {
|
|
12
|
+
/** @default default */
|
|
13
|
+
type: 'default';
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @title Форматированный текст
|
|
18
|
+
*/
|
|
19
|
+
type MarkdownTextContent = MarkdownTextProps & {
|
|
20
|
+
/** @default md */
|
|
21
|
+
type: 'md';
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @title Преимущество
|
|
26
|
+
* @default{
|
|
27
|
+
* "type": "default"
|
|
28
|
+
* }
|
|
29
|
+
*/
|
|
30
|
+
export type Benefit = TextBenefit | MarkdownTextContent;
|
|
7
31
|
|
|
8
32
|
/**
|
|
9
33
|
* @title Продуктовая плитка
|
|
@@ -30,7 +54,7 @@ export type ProductTileContent = HeadlineProps &
|
|
|
30
54
|
* @title Преимущества
|
|
31
55
|
* @maxItems 7
|
|
32
56
|
*/
|
|
33
|
-
benefits?:
|
|
57
|
+
benefits?: Benefit[];
|
|
34
58
|
/** @title Дополнительное описание */
|
|
35
59
|
additionalDescription?: string;
|
|
36
60
|
/** @title Картинка справа/текст слева */
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { BlockVersion } from '../../model/BlockVersion';
|
|
2
|
+
import type { Picture } from '../../model/Picture';
|
|
3
|
+
import { Paragraph } from '../../ui-kit/Paragraph/Paragraph';
|
|
4
|
+
import type { TextColor } from '../../ui-kit/Text/TextProps';
|
|
5
|
+
|
|
6
|
+
const DESCRIPTION_STYLE_MAP: Record<BlockVersion, TextColor> = {
|
|
7
|
+
primary: 'text-secondary-text',
|
|
8
|
+
secondary: 'text-white',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function renderAdditionalDescription(
|
|
12
|
+
additionalDescription?: string,
|
|
13
|
+
image?: Picture,
|
|
14
|
+
version: BlockVersion = 'primary',
|
|
15
|
+
) {
|
|
16
|
+
if (!additionalDescription) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// picture width = 242px. Text can overlay picture 20px deep. Outer paddings_x = 36px. 242-36-20 = 186px
|
|
21
|
+
const descriptionWidth = image?.src ? 'max-w-[calc(100%-186px)]' : '100%';
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className={`mt-2.5 z-10 ${descriptionWidth}`}>
|
|
25
|
+
<Paragraph size="text-m" font="font-light" color={DESCRIPTION_STYLE_MAP[version]}>
|
|
26
|
+
{additionalDescription}
|
|
27
|
+
</Paragraph>
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { BlockVersion } from '../../model/BlockVersion';
|
|
2
|
+
import { MarkdownText } from '../../ui-kit/MarkdownText/MarkdownText';
|
|
3
|
+
import { Text } from '../../ui-kit/Text/Text';
|
|
4
|
+
import type { TextColor } from '../../ui-kit/Text/TextProps';
|
|
5
|
+
import { assertUnreachable } from '../../utils/assertUnreachable';
|
|
6
|
+
import type { Benefit } from './ProductTileContent';
|
|
7
|
+
|
|
8
|
+
const LABEL_STYLE_MAP: Record<BlockVersion, TextColor> = {
|
|
9
|
+
primary: 'text-secondary-text',
|
|
10
|
+
secondary: 'text-white',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const renderBenefit =
|
|
14
|
+
(version: BlockVersion = 'primary') =>
|
|
15
|
+
// Linter doesn't understand that switch processes all cases
|
|
16
|
+
// eslint-disable-next-line consistent-return
|
|
17
|
+
(benefit: Benefit, i: number) => {
|
|
18
|
+
const { type } = benefit;
|
|
19
|
+
|
|
20
|
+
if (!(type === 'default' || type === 'md')) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
switch (type) {
|
|
25
|
+
case 'default':
|
|
26
|
+
return [
|
|
27
|
+
<Text key={`label-${i}`} size="text-h6">
|
|
28
|
+
{benefit.label}
|
|
29
|
+
</Text>,
|
|
30
|
+
<Text key={`desc-${i}`} size="text-m-light" color={LABEL_STYLE_MAP[version]}>
|
|
31
|
+
{benefit.description}
|
|
32
|
+
</Text>,
|
|
33
|
+
];
|
|
34
|
+
case 'md':
|
|
35
|
+
return <MarkdownText md={benefit.md} />;
|
|
36
|
+
default:
|
|
37
|
+
assertUnreachable(benefit);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Picture } from '../../model/Picture';
|
|
2
|
+
import { Img } from '../../ui-kit/Img/Img';
|
|
3
|
+
|
|
4
|
+
export function renderImage(image?: Picture, isImageOnRightSide?: boolean) {
|
|
5
|
+
if (!image?.src) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<Img
|
|
11
|
+
className={`absolute ${isImageOnRightSide ? 'right-0' : 'left-0'} bottom-0`}
|
|
12
|
+
image={image}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import util from 'util';
|
|
4
|
-
import sharp from 'sharp';
|
|
5
3
|
import type { ResizeOptions, Sharp } from 'sharp';
|
|
4
|
+
import sharp from 'sharp';
|
|
5
|
+
import util from 'util';
|
|
6
6
|
import type { ImageSize } from '../model/ImageSize';
|
|
7
|
-
import type { TransformationOptions } from './TransformationOptions';
|
|
8
7
|
import type { ImgAlignment, ImgSource, Picture } from '../model/Picture';
|
|
9
|
-
import { transformSrc } from './transformSrc';
|
|
10
8
|
import { isPictureSizeEmpty } from '../utils/isPictureSizeEmpty';
|
|
9
|
+
import type { TransformationOptions } from './TransformationOptions';
|
|
10
|
+
import { transformSrc } from './transformSrc';
|
|
11
11
|
|
|
12
12
|
const mkdir = util.promisify(fs.mkdir);
|
|
13
13
|
|
|
@@ -126,20 +126,12 @@ function getCompositionResizeSize(
|
|
|
126
126
|
const { width, height } = size;
|
|
127
127
|
const { width: containerWidth, height: containerHeight } = containerSize;
|
|
128
128
|
|
|
129
|
-
let widthRatio = 0;
|
|
130
|
-
let heightRatio = 0;
|
|
131
|
-
|
|
132
129
|
if (!(width || height)) {
|
|
133
130
|
return undefined;
|
|
134
131
|
}
|
|
135
132
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (height) {
|
|
141
|
-
heightRatio = containerHeight / height;
|
|
142
|
-
}
|
|
133
|
+
const widthRatio = width ? containerWidth / width : 0;
|
|
134
|
+
const heightRatio = height ? containerHeight / height : 0;
|
|
143
135
|
|
|
144
136
|
return widthRatio > heightRatio
|
|
145
137
|
? { width: Math.min(Number(width), containerWidth) }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { unified } from 'unified';
|
|
2
|
-
import remarkParse from 'remark-parse';
|
|
3
1
|
import remarkHtml from 'remark-html';
|
|
2
|
+
import remarkParse from 'remark-parse';
|
|
3
|
+
import { unified } from 'unified';
|
|
4
4
|
|
|
5
5
|
export async function transformMarkdown(markdown: string | null | undefined): Promise<string> {
|
|
6
6
|
if (!markdown) {
|
|
@@ -9,5 +9,5 @@ export async function transformMarkdown(markdown: string | null | undefined): Pr
|
|
|
9
9
|
|
|
10
10
|
const result = await unified().use(remarkParse).use(remarkHtml).process(markdown);
|
|
11
11
|
|
|
12
|
-
return result.toString('utf-8');
|
|
12
|
+
return result.toString('utf-8').replaceAll(/<h(\d)>([^<]*)<\/h\d>/g, '<p class="h$1">$2</p>');
|
|
13
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LinkProps } from '../model/LinkProps';
|
|
1
|
+
import type { LinkProps, Target } from '../model/LinkProps';
|
|
2
2
|
import { useBlockRouter } from '../services/BlockRouter/useBlockRouter';
|
|
3
3
|
import { adjustHref } from '../utils/adjustHref';
|
|
4
4
|
import { isHash, isURL } from '../utils/url';
|
|
@@ -25,11 +25,7 @@ export function useLink(): <L extends Partial<LinkProps & ClickHandler>>(
|
|
|
25
25
|
onClick: handlerDecorator((ev?: { preventDefault: () => void }) => {
|
|
26
26
|
props.onClick && props.onClick(ev);
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
const isLocalTarget = !props.target || props.target === '_self';
|
|
30
|
-
|
|
31
|
-
if (!isLocalHref || !isLocalTarget) {
|
|
32
|
-
// Default handle
|
|
28
|
+
if (isRemoteHref(href, props.target)) {
|
|
33
29
|
return;
|
|
34
30
|
}
|
|
35
31
|
|
|
@@ -37,9 +33,12 @@ export function useLink(): <L extends Partial<LinkProps & ClickHandler>>(
|
|
|
37
33
|
if (isHash(href)) {
|
|
38
34
|
blockRouter.goto(href);
|
|
39
35
|
} else {
|
|
40
|
-
router.push(href);
|
|
36
|
+
href && router.push(href);
|
|
41
37
|
}
|
|
42
38
|
}, props),
|
|
43
39
|
};
|
|
44
40
|
};
|
|
45
41
|
}
|
|
42
|
+
|
|
43
|
+
const isRemoteHref = (href?: string, target?: Target) =>
|
|
44
|
+
isURL(href) || (target && target !== '_self') || href?.startsWith('/');
|
|
@@ -15,14 +15,10 @@ interface LocationStorageData {
|
|
|
15
15
|
region: RegionData;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const localStorageLocation = globalThis?.localStorage.getItem('location');
|
|
19
|
-
const currentLocation: LocationStorageData | null = localStorageLocation
|
|
20
|
-
? JSON.parse(localStorageLocation)
|
|
21
|
-
: null;
|
|
22
|
-
|
|
23
18
|
export function useLocation(
|
|
24
19
|
defaultLocation: string,
|
|
25
20
|
): [RegionData, (newLocation: RegionData) => void] {
|
|
21
|
+
const currentLocation = getLocalStorageLocation();
|
|
26
22
|
const [location, setLocation] = useState<RegionData>(
|
|
27
23
|
currentLocation?.region ?? { name: defaultLocation },
|
|
28
24
|
);
|
|
@@ -38,7 +34,7 @@ export function useLocation(
|
|
|
38
34
|
|
|
39
35
|
const onChangeLocation = useCallback(
|
|
40
36
|
(region: RegionData) => {
|
|
41
|
-
globalThis?.
|
|
37
|
+
globalThis.localStorage?.setItem('location', JSON.stringify({ manual: true, region }));
|
|
42
38
|
setLocation(region);
|
|
43
39
|
},
|
|
44
40
|
[setLocation],
|
|
@@ -46,3 +42,13 @@ export function useLocation(
|
|
|
46
42
|
|
|
47
43
|
return [location, onChangeLocation];
|
|
48
44
|
}
|
|
45
|
+
|
|
46
|
+
const getLocalStorageLocation = (): LocationStorageData | null => {
|
|
47
|
+
const localStorageLocation = globalThis.localStorage?.getItem('location');
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
return localStorageLocation ? JSON.parse(localStorageLocation) : null;
|
|
51
|
+
} catch (_) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { Router } from '../../hooks/useRouter';
|
|
1
2
|
import { getOrigin } from '../../utils/url';
|
|
2
3
|
|
|
3
|
-
export const checkIsHrefSameOrigin = (
|
|
4
|
-
href
|
|
5
|
-
|
|
6
|
-
)
|
|
4
|
+
export const checkIsHrefSameOrigin = (href: string | undefined, router: Router) =>
|
|
5
|
+
[getOrigin(href), getOrigin(router.href)].every(
|
|
6
|
+
(link, _, arr) => Boolean(link) && link === arr[0],
|
|
7
|
+
);
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { normalizeURLPath } from '../../utils/normalizeURLPath';
|
|
2
|
+
import { getPathname, isURL, withoutQuery } from '../../utils/url';
|
|
2
3
|
|
|
3
4
|
export const isHrefActive = (
|
|
4
5
|
href: string | undefined,
|
|
5
6
|
router: { pathname?: string; href?: string },
|
|
6
7
|
cmp: (targetHref: string, baseHref: string) => boolean = (targetHref, baseHref) =>
|
|
7
8
|
baseHref.startsWith(targetHref),
|
|
8
|
-
) =>
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
) =>
|
|
10
|
+
cmp(
|
|
11
|
+
withoutQuery(normalizeURLPath(href)),
|
|
12
|
+
withoutQuery(isURL(href) ? router.href : getPathname(router.href)),
|
|
13
|
+
);
|
|
@@ -8,11 +8,11 @@ import wlc from './wlc.json';
|
|
|
8
8
|
projectSettings.setup(wlc);
|
|
9
9
|
|
|
10
10
|
useRouter.setup(() => {
|
|
11
|
-
const [
|
|
11
|
+
const [, setHref] = useState<string>(globalThis.location.href);
|
|
12
12
|
|
|
13
13
|
return {
|
|
14
|
-
href:
|
|
15
|
-
pathname: '/
|
|
14
|
+
href: `${globalThis.location.origin}${projectSettings.BASE_PATH}cards-credit`, //for header active links
|
|
15
|
+
pathname: '/cards-credit',
|
|
16
16
|
query: {},
|
|
17
17
|
push: (url: string) => {
|
|
18
18
|
globalThis.history.pushState(null, '', url);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import type { MarkdownTextProps } from './MarkdownTextProps';
|
|
3
|
+
|
|
4
|
+
export const MarkdownText = JSX<MarkdownTextProps>((props) => {
|
|
5
|
+
const { md = '' } = props;
|
|
6
|
+
|
|
7
|
+
return <div className="md-container" dangerouslySetInnerHTML={{ __html: md }} />;
|
|
8
|
+
});
|
|
@@ -8,10 +8,8 @@ interface TextProps {
|
|
|
8
8
|
font?: FontWeight;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const Text = JSX<TextProps>((
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return <span className={textClasses}>{children}</span>;
|
|
17
|
-
});
|
|
11
|
+
export const Text = JSX<TextProps>(({ size, color, align, font, children }) => (
|
|
12
|
+
<span className={['font-sans', size, color, align, font].filter(Boolean).join(' ')}>
|
|
13
|
+
{children}
|
|
14
|
+
</span>
|
|
15
|
+
));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { projectSettings } from '../ProjectSettings';
|
|
2
|
+
import { isURL } from './url';
|
|
3
|
+
|
|
4
|
+
export const normalizeURLPath = (href?: string) => {
|
|
5
|
+
if (isURL(href) || href?.startsWith('/')) {
|
|
6
|
+
return href;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return `${projectSettings.BASE_PATH || ''}${href}`;
|
|
10
|
+
};
|