@redneckz/wildless-cms-uni-blocks 0.2.29 → 0.2.30
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/dist/Blocks.d.ts +9 -0
- package/dist/Blocks.js +19 -0
- package/dist/Blocks.js.map +1 -0
- package/dist/ContentPage.d.ts +19 -0
- package/dist/ContentPage.js +30 -0
- package/dist/ContentPage.js.map +1 -0
- package/dist/ContentPageContext.d.ts +17 -0
- package/dist/ContentPageContext.js +2 -0
- package/dist/ContentPageContext.js.map +1 -0
- package/dist/ContentPageHead.d.ts +6 -0
- package/dist/ContentPageHead.js +11 -0
- package/dist/ContentPageHead.js.map +1 -0
- package/dist/Header.d.ts +15 -0
- package/dist/Header.js +33 -0
- package/dist/Header.js.map +1 -0
- package/dist/Icons.d.ts +5 -0
- package/dist/Icons.js +12 -0
- package/dist/Icons.js.map +1 -0
- package/dist/Img.d.ts +7 -0
- package/dist/Img.js +12 -0
- package/dist/Img.js.map +1 -0
- package/dist/LikeControl.d.ts +6 -0
- package/dist/LikeControl.js +10 -0
- package/dist/LikeControl.js.map +1 -0
- package/dist/Placeholder.d.ts +6 -0
- package/dist/Placeholder.js +8 -0
- package/dist/Placeholder.js.map +1 -0
- package/dist/ProductBlock.d.ts +24 -0
- package/dist/ProductBlock.js +27 -0
- package/dist/ProductBlock.js.map +1 -0
- package/dist/ProductColumnBlock.d.ts +13 -0
- package/dist/ProductColumnBlock.js +11 -0
- package/dist/ProductColumnBlock.js.map +1 -0
- package/dist/RichText.d.ts +8 -0
- package/dist/RichText.js +10 -0
- package/dist/RichText.js.map +1 -0
- package/dist/Text.d.ts +8 -0
- package/dist/Text.js +8 -0
- package/dist/Text.js.map +1 -0
- package/dist/TextWithImage.d.ts +9 -0
- package/dist/TextWithImage.js +9 -0
- package/dist/TextWithImage.js.map +1 -0
- package/dist/api/LikeAPI.d.ts +9 -0
- package/dist/api/LikeAPI.js +119 -0
- package/dist/api/LikeAPI.js.map +1 -0
- package/dist/content-page-repository/ContentPageRepository.d.ts +6 -0
- package/dist/content-page-repository/ContentPageRepository.js +35 -0
- package/dist/content-page-repository/ContentPageRepository.js.map +1 -0
- package/dist/content-page-repository/TransformationOptions.d.ts +4 -0
- package/dist/content-page-repository/TransformationOptions.js +2 -0
- package/dist/content-page-repository/TransformationOptions.js.map +1 -0
- package/dist/content-page-repository/index.d.ts +1 -0
- package/dist/content-page-repository/index.js +5 -0
- package/dist/content-page-repository/index.js.map +1 -0
- package/dist/content-page-repository/mapJSON.d.ts +1 -0
- package/dist/content-page-repository/mapJSON.js +24 -0
- package/dist/content-page-repository/mapJSON.js.map +1 -0
- package/dist/content-page-repository/transformContentPage.d.ts +3 -0
- package/dist/content-page-repository/transformContentPage.js +27 -0
- package/dist/content-page-repository/transformContentPage.js.map +1 -0
- package/dist/content-page-repository/transformMarkdown.d.ts +1 -0
- package/dist/content-page-repository/transformMarkdown.js +16 -0
- package/dist/content-page-repository/transformMarkdown.js.map +1 -0
- package/dist/content-page-repository/transformPicture.d.ts +3 -0
- package/dist/content-page-repository/transformPicture.js +45 -0
- package/dist/content-page-repository/transformPicture.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/ui-kit/BlockItem.d.ts +7 -0
- package/dist/ui-kit/BlockItem.js +8 -0
- package/dist/ui-kit/BlockItem.js.map +1 -0
- package/dist/ui-kit/Breadcrumb.d.ts +6 -0
- package/dist/ui-kit/Breadcrumb.js +13 -0
- package/dist/ui-kit/Breadcrumb.js.map +1 -0
- package/dist/ui-kit/Button.d.ts +9 -0
- package/dist/ui-kit/Button.js +12 -0
- package/dist/ui-kit/Button.js.map +1 -0
- package/dist/ui-kit/HeaderItem.d.ts +3 -0
- package/dist/ui-kit/HeaderItem.js +10 -0
- package/dist/ui-kit/HeaderItem.js.map +1 -0
- package/dist/ui-kit/LikeButton.d.ts +5 -0
- package/dist/ui-kit/LikeButton.js +15 -0
- package/dist/ui-kit/LikeButton.js.map +1 -0
- package/dist/ui-kit/Link.d.ts +5 -0
- package/dist/ui-kit/Link.js +2 -0
- package/dist/ui-kit/Link.js.map +1 -0
- package/dist/ui-kit/Logo.d.ts +5 -0
- package/dist/ui-kit/Logo.js +16 -0
- package/dist/ui-kit/Logo.js.map +1 -0
- package/dist/ui-kit/SVG.d.ts +12 -0
- package/dist/ui-kit/SVG.js +8 -0
- package/dist/ui-kit/SVG.js.map +1 -0
- package/dist/ui-kit/TopItem.d.ts +9 -0
- package/dist/ui-kit/TopItem.js +10 -0
- package/dist/ui-kit/TopItem.js.map +1 -0
- package/dist/useLink.d.ts +8 -0
- package/dist/useLink.js +20 -0
- package/dist/useLink.js.map +1 -0
- package/lib/Blocks.d.ts +9 -0
- package/lib/Blocks.js +17 -0
- package/lib/Blocks.js.map +1 -0
- package/lib/ContentPage.d.ts +19 -0
- package/lib/ContentPage.js +28 -0
- package/lib/ContentPage.js.map +1 -0
- package/lib/ContentPageContext.d.ts +17 -0
- package/lib/ContentPageContext.js +2 -0
- package/lib/ContentPageContext.js.map +1 -0
- package/lib/ContentPageHead.d.ts +6 -0
- package/lib/ContentPageHead.js +9 -0
- package/lib/ContentPageHead.js.map +1 -0
- package/lib/Header.d.ts +15 -0
- package/lib/Header.js +31 -0
- package/lib/Header.js.map +1 -0
- package/lib/Icons.d.ts +5 -0
- package/lib/Icons.js +10 -0
- package/lib/Icons.js.map +1 -0
- package/lib/Img.d.ts +7 -0
- package/lib/Img.js +9 -0
- package/lib/Img.js.map +1 -0
- package/lib/LikeControl.d.ts +6 -0
- package/lib/LikeControl.js +8 -0
- package/lib/LikeControl.js.map +1 -0
- package/lib/Placeholder.d.ts +6 -0
- package/lib/Placeholder.js +6 -0
- package/lib/Placeholder.js.map +1 -0
- package/lib/ProductBlock.d.ts +24 -0
- package/lib/ProductBlock.js +25 -0
- package/lib/ProductBlock.js.map +1 -0
- package/lib/ProductColumnBlock.d.ts +13 -0
- package/lib/ProductColumnBlock.js +9 -0
- package/lib/ProductColumnBlock.js.map +1 -0
- package/lib/RichText.d.ts +8 -0
- package/lib/RichText.js +8 -0
- package/lib/RichText.js.map +1 -0
- package/lib/Text.d.ts +8 -0
- package/lib/Text.js +6 -0
- package/lib/Text.js.map +1 -0
- package/lib/TextWithImage.d.ts +9 -0
- package/lib/TextWithImage.js +7 -0
- package/lib/TextWithImage.js.map +1 -0
- package/lib/api/LikeAPI.d.ts +9 -0
- package/lib/api/LikeAPI.js +116 -0
- package/lib/api/LikeAPI.js.map +1 -0
- package/lib/common.css +1 -0
- package/lib/content-page-repository/ContentPageRepository.d.ts +6 -0
- package/lib/content-page-repository/ContentPageRepository.js +29 -0
- package/lib/content-page-repository/ContentPageRepository.js.map +1 -0
- package/lib/content-page-repository/TransformationOptions.d.ts +4 -0
- package/lib/content-page-repository/TransformationOptions.js +2 -0
- package/lib/content-page-repository/TransformationOptions.js.map +1 -0
- package/lib/content-page-repository/index.d.ts +1 -0
- package/lib/content-page-repository/index.js +2 -0
- package/lib/content-page-repository/index.js.map +1 -0
- package/lib/content-page-repository/mapJSON.d.ts +1 -0
- package/lib/content-page-repository/mapJSON.js +21 -0
- package/lib/content-page-repository/mapJSON.js.map +1 -0
- package/lib/content-page-repository/transformContentPage.d.ts +3 -0
- package/lib/content-page-repository/transformContentPage.js +21 -0
- package/lib/content-page-repository/transformContentPage.js.map +1 -0
- package/lib/content-page-repository/transformMarkdown.d.ts +1 -0
- package/lib/content-page-repository/transformMarkdown.js +10 -0
- package/lib/content-page-repository/transformMarkdown.js.map +1 -0
- package/lib/content-page-repository/transformPicture.d.ts +3 -0
- package/lib/content-page-repository/transformPicture.js +39 -0
- package/lib/content-page-repository/transformPicture.js.map +1 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/lib/types.d.ts +42 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/ui-kit/BlockItem.d.ts +7 -0
- package/lib/ui-kit/BlockItem.js +6 -0
- package/lib/ui-kit/BlockItem.js.map +1 -0
- package/lib/ui-kit/Breadcrumb.d.ts +6 -0
- package/lib/ui-kit/Breadcrumb.js +11 -0
- package/lib/ui-kit/Breadcrumb.js.map +1 -0
- package/lib/ui-kit/Button.d.ts +9 -0
- package/lib/ui-kit/Button.js +10 -0
- package/lib/ui-kit/Button.js.map +1 -0
- package/lib/ui-kit/HeaderItem.d.ts +3 -0
- package/lib/ui-kit/HeaderItem.js +8 -0
- package/lib/ui-kit/HeaderItem.js.map +1 -0
- package/lib/ui-kit/LikeButton.d.ts +5 -0
- package/lib/ui-kit/LikeButton.js +13 -0
- package/lib/ui-kit/LikeButton.js.map +1 -0
- package/lib/ui-kit/Link.d.ts +5 -0
- package/lib/ui-kit/Link.js +2 -0
- package/lib/ui-kit/Link.js.map +1 -0
- package/lib/ui-kit/Logo.d.ts +5 -0
- package/lib/ui-kit/Logo.js +14 -0
- package/lib/ui-kit/Logo.js.map +1 -0
- package/lib/ui-kit/SVG.d.ts +12 -0
- package/lib/ui-kit/SVG.js +6 -0
- package/lib/ui-kit/SVG.js.map +1 -0
- package/lib/ui-kit/TopItem.d.ts +9 -0
- package/lib/ui-kit/TopItem.js +8 -0
- package/lib/ui-kit/TopItem.js.map +1 -0
- package/lib/useLink.d.ts +8 -0
- package/lib/useLink.js +17 -0
- package/lib/useLink.js.map +1 -0
- package/package.json +2 -2
package/dist/Blocks.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const Blocks: {
|
|
2
|
+
Header: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Header").HeaderProps, any>, context?: any) => any;
|
|
3
|
+
ProductColumnBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ProductColumnBlock").ProductColumnBlockProps, any>, context?: any) => any;
|
|
4
|
+
Text: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Text").TextProps, any>, context?: any) => any;
|
|
5
|
+
TextWithImage: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./TextWithImage").TextWithImageProps, any>, context?: any) => any;
|
|
6
|
+
RichText: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./RichText").RichTextProps, any>, context?: any) => any;
|
|
7
|
+
Placeholder: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Placeholder").PlaceholderProps, any>, context?: any) => any;
|
|
8
|
+
ProductBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./ProductBlock").ProductBlockProps, any>, context?: any) => any;
|
|
9
|
+
};
|
package/dist/Blocks.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.Blocks = void 0;
|
|
3
|
+
const Header_1 = require("./Header");
|
|
4
|
+
const Placeholder_1 = require("./Placeholder");
|
|
5
|
+
const ProductColumnBlock_1 = require("./ProductColumnBlock");
|
|
6
|
+
const RichText_1 = require("./RichText");
|
|
7
|
+
const Text_1 = require("./Text");
|
|
8
|
+
const TextWithImage_1 = require("./TextWithImage");
|
|
9
|
+
const ProductBlock_1 = require("./ProductBlock");
|
|
10
|
+
exports.Blocks = {
|
|
11
|
+
Header: Header_1.Header,
|
|
12
|
+
ProductColumnBlock: ProductColumnBlock_1.ProductColumnBlock,
|
|
13
|
+
Text: Text_1.Text,
|
|
14
|
+
TextWithImage: TextWithImage_1.TextWithImage,
|
|
15
|
+
RichText: RichText_1.RichText,
|
|
16
|
+
Placeholder: Placeholder_1.Placeholder,
|
|
17
|
+
ProductBlock: ProductBlock_1.ProductBlock,
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=Blocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Blocks.js","sourceRoot":"","sources":["../src/Blocks.ts"],"names":[],"mappings":";;AAAA,qCAAkC;AAClC,+CAA4C;AAC5C,6DAA0D;AAC1D,yCAAsC;AACtC,iCAA8B;AAC9B,mDAAgD;AAChD,iDAA8C;AAEjC,QAAA,MAAM,GAAG;IACpB,MAAM,EAAN,eAAM;IACN,kBAAkB,EAAlB,uCAAkB;IAClB,IAAI,EAAJ,WAAI;IACJ,aAAa,EAAb,6BAAa;IACb,QAAQ,EAAR,mBAAQ;IACR,WAAW,EAAX,yBAAW;IACX,YAAY,EAAZ,2BAAY;CACb,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ContentPageContext } from './ContentPageContext';
|
|
2
|
+
import type { BlockDef, ContentPageDef } from './types';
|
|
3
|
+
interface BlockDecoratorProps<VNode> {
|
|
4
|
+
blockClassName: string;
|
|
5
|
+
block: BlockDef;
|
|
6
|
+
render: (props: {
|
|
7
|
+
blockClassName: string;
|
|
8
|
+
block: BlockDef;
|
|
9
|
+
}) => VNode;
|
|
10
|
+
}
|
|
11
|
+
export declare type BlockDecorator<VNode = any> = (props: BlockDecoratorProps<VNode>) => any;
|
|
12
|
+
export interface ContentPageProps {
|
|
13
|
+
className?: string;
|
|
14
|
+
data: ContentPageDef;
|
|
15
|
+
context: ContentPageContext;
|
|
16
|
+
blockDecorator?: BlockDecorator;
|
|
17
|
+
}
|
|
18
|
+
export declare const ContentPage: (props: import("@redneckz/uni-jsx").PropsWithChildren<ContentPageProps, any>, context?: any) => any;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.ContentPage = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
const Blocks_1 = require("./Blocks");
|
|
6
|
+
const LikeControl_1 = require("./LikeControl");
|
|
7
|
+
const defaultBlockDecorator = ({ blockClassName, block, render }) => render({ blockClassName, block });
|
|
8
|
+
exports.ContentPage = (0, uni_jsx_1.JSX)(({ className, data: { style: pageStyle, blocks, likeControl }, context, blockDecorator = defaultBlockDecorator, }) => {
|
|
9
|
+
return ((0, jsx_runtime_1.jsxs)("section", { className: "relative", children: [(0, jsx_runtime_1.jsx)("div", { className: `grid grid-cols-12 ${style2className(pageStyle)} ${className}`, children: blocks?.length ? blocks.map(renderBlock) : null }), likeControl && ((0, jsx_runtime_1.jsx)("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: (0, jsx_runtime_1.jsx)(LikeControl_1.LikeControl, { className: "rounded-tl-lg sticky bottom-0 pointer-events-auto", context: context }) }))] }));
|
|
10
|
+
function renderBlock(block, i) {
|
|
11
|
+
const { type } = block;
|
|
12
|
+
if (!(type in Blocks_1.Blocks)) {
|
|
13
|
+
console.warn(`No block with "${type}" is registered`);
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const BlockComponent = Blocks_1.Blocks[type];
|
|
17
|
+
return blockDecorator({
|
|
18
|
+
blockClassName: style2className(block.style),
|
|
19
|
+
block,
|
|
20
|
+
render: (props) => {
|
|
21
|
+
const { content, blocks } = props.block;
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(BlockComponent, { className: props.blockClassName, context: context, ...content, children: blocks?.length ? blocks.map(renderBlock) : null }, `${type}-${i}`));
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
function style2className(style) {
|
|
28
|
+
return style ? style.join(' ') : '';
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ContentPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentPage.js","sourceRoot":"","sources":["../src/ContentPage.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,qCAAkC;AAClC,+CAA4C;AAmB5C,MAAM,qBAAqB,GAAmB,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAClF,MAAM,CAAC,EAAE,cAAc,E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,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,IAL3C,GAAG,IAAI,IAAI,CAAC,EAAE,CAMJ,CAClB,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CACF,CAAC;AAEF,SAAS,eAAe,CAAC,KAAkC;IACzD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Router {
|
|
2
|
+
pathname: string;
|
|
3
|
+
query: Record<string, string | string[] | undefined>;
|
|
4
|
+
href?: string;
|
|
5
|
+
basePath?: string;
|
|
6
|
+
push: (url: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export interface LikeService {
|
|
9
|
+
likeCount: number;
|
|
10
|
+
like: () => void;
|
|
11
|
+
dislike: () => void;
|
|
12
|
+
}
|
|
13
|
+
export interface ContentPageContext {
|
|
14
|
+
useRouter: () => Router;
|
|
15
|
+
useLikeService: () => LikeService;
|
|
16
|
+
handlerDecorator?: <F extends Function>(handler: F) => F;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentPageContext.js","sourceRoot":"","sources":["../src/ContentPageContext.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ContentPageMeta } from './types';
|
|
2
|
+
export interface ContentPageHeadProps {
|
|
3
|
+
HeadComponent: Function;
|
|
4
|
+
data: ContentPageMeta;
|
|
5
|
+
}
|
|
6
|
+
export declare const ContentPageHead: (props: import("@redneckz/uni-jsx").PropsWithChildren<ContentPageHeadProps, any>, context?: any) => any;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.ContentPageHead = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
exports.ContentPageHead = (0, uni_jsx_1.JSX)(({ HeadComponent, data, children }) => {
|
|
6
|
+
const { title, description, keywords, robots, og } = data;
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(HeadComponent, { children: [(0, jsx_runtime_1.jsx)("title", { children: title }), (0, jsx_runtime_1.jsx)("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), description && (0, jsx_runtime_1.jsx)("meta", { name: "description", content: description }), keywords && (0, jsx_runtime_1.jsx)("meta", { name: "keywords", content: keywords.join(',') }), robots && (0, jsx_runtime_1.jsx)("meta", { name: "robots", content: robots.join(',') }), og
|
|
8
|
+
? Object.entries(og).map(([key, value]) => ((0, jsx_runtime_1.jsx)("meta", { name: `og:${key}`, content: value }, key)))
|
|
9
|
+
: null, children] }));
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=ContentPageHead.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentPageHead.js","sourceRoot":"","sources":["../src/ContentPageHead.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAQ3B,QAAA,eAAe,GAAG,IAAA,aAAG,EAAuB,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC7F,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;IAC1D,OAAO,CACL,wBAAC,aAAa,eACZ,4CAAQ,KAAK,GAAS,EACtB,iCAAM,IAAI,EAAC,UAAU,EAAC,OAAO,EAAC,qCAAqC,GAAG,EACrE,WAAW,IAAI,iCAAM,IAAI,EAAC,aAAa,EAAC,OAAO,EAAE,WAAW,GAAI,EAChE,QAAQ,IAAI,iCAAM,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,GAAI,EACjE,MAAM,IAAI,iCAAM,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAI,EAC3D,EAAE;gBACD,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CACvC,iCAAgB,IAAI,EAAE,MAAM,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,IAAtC,GAAG,CAAuC,CACtD,CAAC;gBACJ,CAAC,CAAC,IAAI,EACP,QAAQ,IACK,CACjB,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/dist/Header.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LinkContent } from './ui-kit/Link';
|
|
2
|
+
import type { ContentPageContext } from './ContentPageContext';
|
|
3
|
+
declare type HeaderMenuItem = LinkContent;
|
|
4
|
+
interface TopMenuItem extends HeaderMenuItem {
|
|
5
|
+
items?: HeaderMenuItem[];
|
|
6
|
+
}
|
|
7
|
+
export interface HeaderContent {
|
|
8
|
+
topItems?: TopMenuItem[];
|
|
9
|
+
}
|
|
10
|
+
export interface HeaderProps extends HeaderContent {
|
|
11
|
+
className?: string;
|
|
12
|
+
context: ContentPageContext;
|
|
13
|
+
}
|
|
14
|
+
export declare const Header: (props: import("@redneckz/uni-jsx").PropsWithChildren<HeaderProps, any>, context?: any) => any;
|
|
15
|
+
export {};
|
package/dist/Header.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.Header = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
const HeaderItem_1 = require("./ui-kit/HeaderItem");
|
|
6
|
+
const Logo_1 = require("./ui-kit/Logo");
|
|
7
|
+
const TopItem_1 = require("./ui-kit/TopItem");
|
|
8
|
+
const useLink_1 = require("./useLink");
|
|
9
|
+
exports.Header = (0, uni_jsx_1.JSX)(({ className, context, topItems }) => {
|
|
10
|
+
const router = context.useRouter();
|
|
11
|
+
const activeTopItem = topItems?.find(isTopItemActive(router));
|
|
12
|
+
const activeSubItem = activeTopItem?.items?.find(isSubItemActive(router));
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `py-8 px-20 bg-white rounded-bl-3xl rounded-br-3xl ${className || ''}`, children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)(Logo_1.Logo, { className: "mr-8" }), topItems?.length
|
|
14
|
+
? topItems.map((_, i) => ((0, jsx_runtime_1.jsx)(TopItem_1.TopItem, { active: _ === activeTopItem, ...(0, useLink_1.useLink)(context, _) }, String(i))))
|
|
15
|
+
: null] }), activeTopItem?.items?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "mt-10", children: activeTopItem.items.map((_) => ((0, jsx_runtime_1.jsx)(HeaderItem_1.HeaderItem, { className: "mr-8", active: _ === activeSubItem, ...(0, useLink_1.useLink)(context, _) }, _.href))) })) : null] }));
|
|
16
|
+
});
|
|
17
|
+
const isURL = (href) => href?.includes('//');
|
|
18
|
+
const withoutQuery = (href) => (href || '').replace(/\/?\?.+/, '');
|
|
19
|
+
function isTopItemActive({ href, pathname }) {
|
|
20
|
+
return (item) => {
|
|
21
|
+
const itemHref = withoutQuery(item.href);
|
|
22
|
+
if (isURL(itemHref)) {
|
|
23
|
+
return Boolean(href && href.startsWith(itemHref));
|
|
24
|
+
}
|
|
25
|
+
return Boolean(item.href && pathname.startsWith(itemHref));
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function isSubItemActive({ href, pathname }) {
|
|
29
|
+
return (item) => {
|
|
30
|
+
return withoutQuery(item.href) === (isURL(item.href) ? withoutQuery(href) : pathname);
|
|
31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.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.Icons = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const CalendarIcon = () => ((0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("path", { stroke: "#1C1C1C", strokeLinecap: "round", strokeLinejoin: "round", strokeMiterlimit: "10", strokeWidth: "2", d: "M8 2v3M16 2v3M3.5 9.09h17M3 13.01V8.5c0-3 1.5-5 5-5h8c3.5 0 5 2 5 5V17c0 3-1.5 5-5 5H8c-3.5 0-5-2-5-5" }), (0, jsx_runtime_1.jsx)("path", { stroke: "#42AB44", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "3", d: "M15.991 13h.018M15.991 17.006h.018M11.991 13h.018M11.991 17.006h.018M7.991 13h.018M7.991 17.006h.018" })] }));
|
|
5
|
+
const EmptyWalletIcon = () => ((0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("path", { stroke: "#292D32", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M2.5 14.07v-2.56c0-2.07 1.69-3.76 3.76-3.76h11.48c2.07 0 3.76 1.69 3.76 3.76v1.44h-2.02c-.56 0-1.07.22-1.44.6-.42.41-.66 1-.6 1.63.09 1.08 1.08 1.87 2.16 1.87h1.9v1.19c0 2.07-1.69 3.76-3.76 3.76H6.26c-2.07 0-3.76-1.69-3.76-3.76M12.28 2.17a1.9 1.9 0 0 1 2.57 1.78v3.8" }), (0, jsx_runtime_1.jsx)("path", { stroke: "#292D32", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M2.5 12.41V7.84c0-1.19.73-2.25 1.84-2.67l3.97-1.5M22.56 13.97v2.06c0 .55-.44 1-1 1.02H19.6c-1.08 0-2.07-.79-2.16-1.87-.06-.63.18-1.22.6-1.63.37-.38.88-.6 1.44-.6h2.08c.56.02 1 .47 1 1.02Z" }), (0, jsx_runtime_1.jsx)("path", { stroke: "#42AB44", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M7 12h7" })] }));
|
|
6
|
+
const PercentageSquareIcon = () => ((0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("path", { stroke: "#1C1C1C", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M2 13.05V15c0 5 2 7 7 7h6c5 0 7-2 7-7V9c0-5-2-7-7-7H9C4 2 2 4 2 9" }), (0, jsx_runtime_1.jsx)("path", { stroke: "#42AB44", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "m8.32 15.27 6.54-6.54M8.73 10.37a1.23 1.23 0 1 0 0-2.46 1.23 1.23 0 0 0 0 2.46ZM15.27 16.09a1.23 1.23 0 1 0 0-2.46 1.23 1.23 0 0 0 0 2.46Z" })] }));
|
|
7
|
+
exports.Icons = {
|
|
8
|
+
EmptyWalletIcon,
|
|
9
|
+
PercentageSquareIcon,
|
|
10
|
+
CalendarIcon,
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=Icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icons.js","sourceRoot":"","sources":["../src/Icons.tsx"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,CACzB,iCAAK,KAAK,EAAC,4BAA4B,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAC,WAAW,aACrE,iCACE,MAAM,EAAC,SAAS,EAChB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,gBAAgB,EAAC,IAAI,EACrB,WAAW,EAAC,GAAG,EACf,CAAC,EAAC,uGAAuG,GACzG,EACF,iCACE,MAAM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types';
|
|
2
|
+
export interface TextWithImageProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
image: Picture;
|
|
5
|
+
}
|
|
6
|
+
export declare const Img: (props: import("@redneckz/uni-jsx").PropsWithChildren<TextWithImageProps, any>, context?: any) => any;
|
|
7
|
+
export declare function formatToMimeType(format: ImgSource['format']): string | undefined;
|
package/dist/Img.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.formatToMimeType = exports.Img = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
exports.Img = (0, uni_jsx_1.JSX)(({ className, image }) => ((0, jsx_runtime_1.jsxs)("picture", { className: className || '', children: [image.sources?.length
|
|
6
|
+
? image.sources.map(({ src, format }, index) => ((0, jsx_runtime_1.jsx)("source", { srcSet: src, type: formatToMimeType(format) }, `${index}_${src}`)))
|
|
7
|
+
: null, (0, jsx_runtime_1.jsx)("img", { src: image.src, alt: image.alt, title: image.title, ...image?.size })] })));
|
|
8
|
+
function formatToMimeType(format) {
|
|
9
|
+
return format ? `image/${String(format)}` : undefined;
|
|
10
|
+
}
|
|
11
|
+
exports.formatToMimeType = formatToMimeType;
|
|
12
|
+
//# sourceMappingURL=Img.js.map
|
package/dist/Img.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Img.js","sourceRoot":"","sources":["../src/Img.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAQ3B,QAAA,GAAG,GAAG,IAAA,aAAG,EAAqB,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACnE,qCAAS,SAAS,EAAE,SAAS,IAAI,EAAE,aAChC,KAAK,CAAC,OAAO,EAAE,MAAM;YACpB,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5C,mCAAgC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,IAA9D,GAAG,KAAK,IAAI,GAAG,EAAE,CAAiD,CAChF,CAAC;YACJ,CAAC,CAAC,IAAI,EACR,gCAAK,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,KAAM,KAAK,EAAE,IAAI,GAAI,IACpE,CACX,CAAC,CAAC;AAEH,SAAgB,gBAAgB,CAAC,MAA2B;IAC1D,OAAO,MAAM,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC;AAFD,4CAEC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ContentPageContext } from './ContentPageContext';
|
|
2
|
+
export interface LikeControlProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
context: ContentPageContext;
|
|
5
|
+
}
|
|
6
|
+
export declare const LikeControl: (props: import("@redneckz/uni-jsx").PropsWithChildren<LikeControlProps, any>, context?: any) => any;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.LikeControl = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
const LikeButton_1 = require("./ui-kit/LikeButton");
|
|
6
|
+
exports.LikeControl = (0, uni_jsx_1.JSX)(({ className, context }) => {
|
|
7
|
+
const likeService = context.useLikeService();
|
|
8
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `border-main border-2 border-solid bg-white flex w-[125px] items-center justify-center gap-3 p-2 font-sans ${className || ''}`, children: [(0, jsx_runtime_1.jsx)(LikeButton_1.LikeButton, { onClick: likeService.like }), (0, jsx_runtime_1.jsx)(LikeButton_1.LikeButton, { onClick: likeService.dislike, className: "rotate-180" }), (0, jsx_runtime_1.jsx)("span", { className: "select-none", children: likeService.likeCount })] }));
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=LikeControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LikeControl.js","sourceRoot":"","sources":["../src/LikeControl.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,oDAAiD;AAOpC,QAAA,WAAW,GAAG,IAAA,aAAG,EAAmB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;IAC1E,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAE7C,OAAO,CACL,iCACE,SAAS,EAAE,6GACT,SAAS,IAAI,EACf,EAAE,aAEF,uBAAC,uBAAU,IAAC,OAAO,EAAE,WAAW,CAAC,IAAI,GAAI,EACzC,uBAAC,uBAAU,IAAC,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,SAAS,EAAC,YAAY,GAAG,EACnE,iCAAM,SAAS,EAAC,aAAa,YAAE,WAAW,CAAC,SAAS,GAAQ,IACxD,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.Placeholder = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
exports.Placeholder = (0, uni_jsx_1.JSX)(({ className, children }) => {
|
|
6
|
+
return (0, jsx_runtime_1.jsx)("div", { className: className || '', children: children });
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=Placeholder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Placeholder.js","sourceRoot":"","sources":["../src/Placeholder.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAQ3B,QAAA,WAAW,GAAG,IAAA,aAAG,EAAmB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC3E,OAAO,gCAAK,SAAS,EAAE,SAAS,IAAI,EAAE,YAAG,QAAQ,GAAO,CAAC;AAC3D,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ContentPageContext } from './ContentPageContext';
|
|
2
|
+
import { Icons } from './Icons';
|
|
3
|
+
import { Picture } from './types';
|
|
4
|
+
import type { ButtonProps } from './ui-kit/Button';
|
|
5
|
+
import { BreadcrumbProps } from './ui-kit/Breadcrumb';
|
|
6
|
+
export interface Benefit {
|
|
7
|
+
label: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
icon?: keyof typeof Icons;
|
|
10
|
+
}
|
|
11
|
+
export interface ProductBlockContent {
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
breadcrumbs?: BreadcrumbProps[];
|
|
15
|
+
image?: Picture;
|
|
16
|
+
benefits?: Benefit[];
|
|
17
|
+
items?: string[];
|
|
18
|
+
buttons?: ButtonProps[];
|
|
19
|
+
}
|
|
20
|
+
export interface ProductBlockProps extends ProductBlockContent {
|
|
21
|
+
className?: string;
|
|
22
|
+
context: ContentPageContext;
|
|
23
|
+
}
|
|
24
|
+
export declare const ProductBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<ProductBlockProps, any>, context?: any) => any;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.ProductBlock = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
const Icons_1 = require("./Icons");
|
|
6
|
+
const Img_1 = require("./Img");
|
|
7
|
+
const BlockItem_1 = require("./ui-kit/BlockItem");
|
|
8
|
+
const Button_1 = require("./ui-kit/Button");
|
|
9
|
+
const Breadcrumb_1 = require("./ui-kit/Breadcrumb");
|
|
10
|
+
const useLink_1 = require("./useLink");
|
|
11
|
+
exports.ProductBlock = (0, uni_jsx_1.JSX)((props) => {
|
|
12
|
+
const { className, context, title, description, breadcrumbs, benefits, buttons, image, items } = props;
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)("section", { className: `font-sans bg-white p-11 pr-[7.5rem] rounded-[40px] flex justify-between items-stretch ${className || ''}`, children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col text-primary-text", children: [breadcrumbs?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "text-xs mb-6", children: breadcrumbs
|
|
14
|
+
.map((breadcrumb, i) => ((0, jsx_runtime_1.jsx)(Breadcrumb_1.Breadcrumb, { ...(0, useLink_1.useLink)(context, { className: 'text-secondary', ...breadcrumb }) }, String(i))))
|
|
15
|
+
.reduce((prev, curr, i) => [
|
|
16
|
+
prev,
|
|
17
|
+
(0, jsx_runtime_1.jsx)("span", { className: "text-secondary mx-2", children: "/" }, `delimiter_${i}`),
|
|
18
|
+
curr,
|
|
19
|
+
]) })) : null, title && ((0, jsx_runtime_1.jsx)("h1", { className: "font-medium text-title2 m-0 max-w-[600px] whitespace-pre-wrap", children: title })), description && ((0, jsx_runtime_1.jsx)("div", { className: "font-normal text-base max-w-[600px] mt-4", children: description })), benefits?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "flex gap-6 mt-7", children: benefits.map(renderBenefit) })) : null, items?.length ? ((0, jsx_runtime_1.jsx)("section", { role: "list", children: items.map((_, i) => ((0, jsx_runtime_1.jsx)(BlockItem_1.BlockItem, { className: "mt-6", text: _ }, String(i)))) })) : null, buttons?.length ? ((0, jsx_runtime_1.jsx)("div", { className: "flex mt-auto gap-4", children: buttons.map((button, index) => renderButton(button, index, context)) })) : null] }), image && (0, jsx_runtime_1.jsx)(Img_1.Img, { image: image, className: "mt-auto" })] }));
|
|
20
|
+
});
|
|
21
|
+
function renderBenefit(benefit, i) {
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-4 items-center", children: [benefit.icon && ((0, jsx_runtime_1.jsx)("div", { className: "h-11 w-11 min-w-11 min-h-11 bg-main rounded-full p-[10px] box-border", children: Icons_1.Icons[benefit.icon]() })), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1 flex-col h-full", children: [(0, jsx_runtime_1.jsx)("h4", { className: "font-medium text-xl m-0", children: benefit.label }), benefit.description && ((0, jsx_runtime_1.jsx)("div", { className: "font-normal text-sm text-secondary", children: benefit.description }))] })] }, String(i)));
|
|
23
|
+
}
|
|
24
|
+
function renderButton(button, i, context) {
|
|
25
|
+
return button?.text ? ((0, jsx_runtime_1.jsx)(Button_1.Button, { ...(0, useLink_1.useLink)(context, button), className: "mt-8", variant: button.variant }, String(i))) : null;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=ProductBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductBlock.js","sourceRoot":"","sources":["../src/ProductBlock.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,mCAAgC;AAChC,+BAA4B;AAE5B,kDAA+C;AAE/C,4CAAyC;AACzC,oDAAkE;AAClE,uCAAoC;AAuBvB,QAAA,YAAY,GAAG,IAAA,aAAG,EAAoB,CAAC,KAAK,EAAE,EAAE;IAC3D,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAC5F,KAAK,CAAC;IAER,OAAO,CACL,qCACE,SAAS,EAAE,yFACT,SAAS,IAAI,EACf,EAAE,aAEF,iCAAK,SAAS,EAAC,iCAAiC,aAC7C,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CACrB,gCAAK,SAAS,EAAC,cAA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AE,OAAO,CAAC,CAAC,GACjE,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,EACL,KAAK,IAAI,uBAAC,SAAG,IAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,SAAS,GAAG,IAC3C,CACX,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,SAAS,aAAa,CAAC,OAAgB,EAAE,CAAS;IAChD,OAAO,CACL,iCAAqB,SAAS,EAAC,yBAAyB,aACrD,OAAO,CAAC,IAAI,IAAI,CACf,gCAAK,SAAS,EAAC,sEAAsE,YAClF,aAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,GAClB,CACP,EACD,iCAAK,SAAS,EAAC,4BAA4B,aACzC,+BAAI,SAAS,EAAC,yBAAyB,YAAE,OAAO,CAAC,KAAK,GAAM,EAC3D,OAAO,CAAC,WAAW,IAAI,CACtB,gCAAK,SAAS,EAAC,oCAAoC,YAAE,OAAO,CAAC,WAAW,GAAO,CAChF,IACG,KAXE,MAAM,CAAC,CAAC,CAAC,CAYb,CACP,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,MAAmB,EAAE,CAAS,EAAE,OAA2B;IAC/E,OAAO,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CACpB,uBAAC,eAAM,OAED,IAAA,iBAAO,EAAC,OAAO,EAAE,MAAM,CAAC,EAC5B,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,MAAM,CAAC,OAAO,IAHlB,MAAM,CAAC,CAAC,CAAC,CAId,CACH,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ContentPageContext } from './ContentPageContext';
|
|
2
|
+
import type { ButtonProps } from './ui-kit/Button';
|
|
3
|
+
export interface ProductColumnBlockContent {
|
|
4
|
+
title?: string;
|
|
5
|
+
items?: string[];
|
|
6
|
+
button?: ButtonProps;
|
|
7
|
+
promo?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ProductColumnBlockProps extends ProductColumnBlockContent {
|
|
10
|
+
className?: string;
|
|
11
|
+
context: ContentPageContext;
|
|
12
|
+
}
|
|
13
|
+
export declare const ProductColumnBlock: (props: import("@redneckz/uni-jsx").PropsWithChildren<ProductColumnBlockProps, any>, context?: any) => any;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.ProductColumnBlock = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
const BlockItem_1 = require("./ui-kit/BlockItem");
|
|
6
|
+
const Button_1 = require("./ui-kit/Button");
|
|
7
|
+
const useLink_1 = require("./useLink");
|
|
8
|
+
exports.ProductColumnBlock = (0, uni_jsx_1.JSX)(({ className, context, title, items, button, promo }) => {
|
|
9
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `relative p-8 bg-white text-black font-sans rounded-[40px] ${className || ''}`, children: [(0, jsx_runtime_1.jsx)("p", { className: "text-title font-medium m-0", children: title }), items?.length ? ((0, jsx_runtime_1.jsx)("section", { className: "flex flex-col", role: "list", children: items.map((_, i) => ((0, jsx_runtime_1.jsx)(BlockItem_1.BlockItem, { className: "mt-6", text: _ }, String(i)))) })) : null, button?.text ? (0, jsx_runtime_1.jsx)(Button_1.Button, { className: "mt-12", ...(0, useLink_1.useLink)(context, button) }) : null, promo && ((0, jsx_runtime_1.jsx)("div", { className: "absolute right-0 bottom-0 bg-promo font-normal px-12 py-3 text-xl rounded-tl-[74px] rounded-br-[40px]", children: "\u0410\u043A\u0446\u0438\u044F" }))] }));
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=ProductColumnBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductColumnBlock.js","sourceRoot":"","sources":["../src/ProductColumnBlock.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,kDAA+C;AAE/C,4CAAyC;AACzC,uCAAoC;AAcvB,QAAA,kBAAkB,GAAG,IAAA,aAAG,EACnC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IACtD,OAAO,CACL,iCACE,SAAS,EAAE,6DAA6D,SAAS,IAAI,EAAE,EAAE,aAEzF,8BAAG,SAAS,EAAC,4BAA4B,YAAE,KAAK,GAAK,EACpD,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CACf,oCAAS,SAAS,EAAC,eAAe,EAAC,IAAI,EAAC,MAAM,YAC3C,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACnB,uBAAC,qBAAS,IAAiB,SAAS,EAAC,MAAM,EAAC,IAAI,EAAE,CAAC,IAAnC,MAAM,CAAC,CAAC,CAAC,CAA8B,CACxD,CAAC,GACM,CACX,CAAC,CAAC,CAAC,IAAI,EACP,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,uBAAC,eAAM,IAAC,SAAS,EAAC,OAAO,KAAK,IAAA,iBAAO,EAAC,OAAO,EAAE,MAAM,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,EAChF,KAAK,IAAI,CACR,gCAAK,SAAS,EAAC,uGAAuG,+CAEhH,CACP,IACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface RichTextContent {
|
|
2
|
+
__html?: string;
|
|
3
|
+
__md?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface RichTextProps extends RichTextContent {
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const RichText: (props: import("@redneckz/uni-jsx").PropsWithChildren<RichTextProps, any>, context?: any) => any;
|
package/dist/RichText.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.RichText = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
exports.RichText = (0, uni_jsx_1.JSX)(({ className, __html, __md }) => {
|
|
6
|
+
const html = __html || __md;
|
|
7
|
+
const props = Object.assign({ className: className || '' }, html ? { dangerouslySetInnerHTML: { __html: html } } : {});
|
|
8
|
+
return (0, jsx_runtime_1.jsx)("div", { ...props });
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=RichText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RichText.js","sourceRoot":"","sources":["../src/RichText.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAW3B,QAAA,QAAQ,GAAG,IAAA,aAAG,EAAgB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;IACzE,MAAM,IAAI,GAAG,MAAM,IAAI,IAAI,CAAC;IAC5B,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CACzB,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE,EAAE,EAC9B,IAAI,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAC1D,CAAC;IACF,OAAO,mCAAS,KAAK,GAAI,CAAC;AAC5B,CAAC,CAAC,CAAC"}
|
package/dist/Text.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface TextContent {
|
|
2
|
+
primary?: string;
|
|
3
|
+
secondary?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TextProps extends TextContent {
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const Text: (props: import("@redneckz/uni-jsx").PropsWithChildren<TextProps, any>, context?: any) => any;
|
package/dist/Text.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.Text = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
exports.Text = (0, uni_jsx_1.JSX)(({ className, primary, secondary, children }) => {
|
|
6
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: className || '', children: [primary && (0, jsx_runtime_1.jsx)("p", { className: "font-bold text-slate-700 leading-snug", children: primary }), secondary && (0, jsx_runtime_1.jsx)("p", { className: "mt-2 text-sm text-slate-600", children: secondary }), children] }));
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=Text.js.map
|
package/dist/Text.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAW3B,QAAA,IAAI,GAAG,IAAA,aAAG,EAAY,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IACjF,OAAO,CACL,iCAAK,SAAS,EAAE,SAAS,IAAI,EAAE,aAC5B,OAAO,IAAI,8BAAG,SAAS,EAAC,uCAAuC,YAAE,OAAO,GAAK,EAC7E,SAAS,IAAI,8BAAG,SAAS,EAAC,6BAA6B,YAAE,SAAS,GAAK,EACvE,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Picture } from './types';
|
|
2
|
+
export interface TextWithImageContent {
|
|
3
|
+
primary?: string;
|
|
4
|
+
image?: Picture;
|
|
5
|
+
}
|
|
6
|
+
export interface TextWithImageProps extends TextWithImageContent {
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const TextWithImage: (props: import("@redneckz/uni-jsx").PropsWithChildren<TextWithImageProps, any>, context?: any) => any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.TextWithImage = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
const Img_1 = require("./Img");
|
|
6
|
+
exports.TextWithImage = (0, uni_jsx_1.JSX)(({ className, primary, image }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: className || '', children: [primary && (0, jsx_runtime_1.jsx)("p", { className: "font-bold text-slate-700 leading-snug", children: primary }), image && (0, jsx_runtime_1.jsx)(Img_1.Img, { image: image })] }));
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=TextWithImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextWithImage.js","sourceRoot":"","sources":["../src/TextWithImage.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,+BAA4B;AAYf,QAAA,aAAa,GAAG,IAAA,aAAG,EAAqB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IACrF,OAAO,CACL,iCAAK,SAAS,EAAE,SAAS,IAAI,EAAE,aAC5B,OAAO,IAAI,8BAAG,SAAS,EAAC,uCAAuC,YAAE,OAAO,GAAK,EAC7E,KAAK,IAAI,uBAAC,SAAG,IAAC,KAAK,EAAE,KAAK,GAAI,IAC3B,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface LikeData {
|
|
2
|
+
node_id: string;
|
|
3
|
+
value: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function LikeAPI(projectId: string, baseURL: string): {
|
|
6
|
+
getLikeCount: (...nodeIds: string[]) => Promise<LikeData[]>;
|
|
7
|
+
like: (nodeId: string) => Promise<number>;
|
|
8
|
+
dislike: (nodeId: string) => Promise<number>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.LikeAPI = void 0;
|
|
3
|
+
const AUTH_PREFIX = 'guest';
|
|
4
|
+
const STORAGE_KEY = 'likesToken';
|
|
5
|
+
function LikeAPI(projectId, baseURL) {
|
|
6
|
+
async function getLikeCount(...nodeIds) {
|
|
7
|
+
if (!nodeIds.length) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
const { token: Authorization } = await auth();
|
|
11
|
+
try {
|
|
12
|
+
const response = await fetch(`/assist/v1/public/projects/${projectId}/nodes/likes`, {
|
|
13
|
+
method: 'POST',
|
|
14
|
+
mode: 'cors',
|
|
15
|
+
headers: { 'Content-Type': 'application/json', Authorization },
|
|
16
|
+
body: JSON.stringify({
|
|
17
|
+
node_ids: nodeIds,
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
const { likes } = await response.json();
|
|
21
|
+
return likes || [];
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
console.error(e);
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function like(nodeId) {
|
|
29
|
+
if (!nodeId) {
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
const { token: Authorization, name } = await auth();
|
|
33
|
+
try {
|
|
34
|
+
const response = await fetch(`${baseURL}/assist/v1/public/projects/${projectId}/nodes/like`, {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
mode: 'cors',
|
|
37
|
+
headers: {
|
|
38
|
+
'Content-Type': 'application/json',
|
|
39
|
+
Authorization,
|
|
40
|
+
UserID: name,
|
|
41
|
+
},
|
|
42
|
+
body: JSON.stringify({
|
|
43
|
+
node_id: nodeId,
|
|
44
|
+
user_name: name,
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
const { likes } = await response.json();
|
|
48
|
+
return likes || 0;
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
console.error(e);
|
|
52
|
+
return 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function dislike(nodeId) {
|
|
56
|
+
if (!nodeId) {
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
const { token: Authorization, name } = await auth();
|
|
60
|
+
try {
|
|
61
|
+
const response = await fetch(`${baseURL}/assist/v1/public/projects/${projectId}/nodes/unlike`, {
|
|
62
|
+
method: 'POST',
|
|
63
|
+
mode: 'cors',
|
|
64
|
+
headers: {
|
|
65
|
+
'Content-Type': 'application/json',
|
|
66
|
+
Authorization,
|
|
67
|
+
UserID: name,
|
|
68
|
+
},
|
|
69
|
+
body: JSON.stringify({
|
|
70
|
+
node_id: nodeId,
|
|
71
|
+
user_name: name,
|
|
72
|
+
}),
|
|
73
|
+
});
|
|
74
|
+
const { likes } = await response.json();
|
|
75
|
+
return likes || 0;
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
console.error(e);
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async function auth() {
|
|
83
|
+
try {
|
|
84
|
+
const userData = JSON.parse(globalThis.localStorage.getItem(STORAGE_KEY) || '');
|
|
85
|
+
if (userData?.token) {
|
|
86
|
+
return userData;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
// do nothing
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
const response = await fetch(`${baseURL}/assist/v1/public/auth`, {
|
|
94
|
+
method: 'POST',
|
|
95
|
+
mode: 'cors',
|
|
96
|
+
headers: {
|
|
97
|
+
'Content-Type': 'application/json',
|
|
98
|
+
},
|
|
99
|
+
body: JSON.stringify({
|
|
100
|
+
prefix: AUTH_PREFIX,
|
|
101
|
+
}),
|
|
102
|
+
});
|
|
103
|
+
const { token, name } = await response.json();
|
|
104
|
+
globalThis.localStorage.setItem(STORAGE_KEY, JSON.stringify({ token, name }));
|
|
105
|
+
return { token, name };
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
console.error(e);
|
|
109
|
+
return {};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
getLikeCount,
|
|
114
|
+
like,
|
|
115
|
+
dislike,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
exports.LikeAPI = LikeAPI;
|
|
119
|
+
//# sourceMappingURL=LikeAPI.js.map
|