@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/lib/Blocks.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Header } from './Header.js';
|
|
2
|
+
import { Placeholder } from './Placeholder.js';
|
|
3
|
+
import { ProductColumnBlock } from './ProductColumnBlock.js';
|
|
4
|
+
import { RichText } from './RichText.js';
|
|
5
|
+
import { Text } from './Text.js';
|
|
6
|
+
import { TextWithImage } from './TextWithImage.js';
|
|
7
|
+
import { ProductBlock } from './ProductBlock.js';
|
|
8
|
+
export const Blocks = {
|
|
9
|
+
Header,
|
|
10
|
+
ProductColumnBlock,
|
|
11
|
+
Text,
|
|
12
|
+
TextWithImage,
|
|
13
|
+
RichText,
|
|
14
|
+
Placeholder,
|
|
15
|
+
ProductBlock,
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=Blocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Blocks.js","sourceRoot":"","sources":["../src/Blocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,MAAM;IACN,kBAAkB;IAClB,IAAI;IACJ,aAAa;IACb,QAAQ;IACR,WAAW;IACX,YAAY;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,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { Blocks } from './Blocks.js';
|
|
4
|
+
import { LikeControl } from './LikeControl.js';
|
|
5
|
+
const defaultBlockDecorator = ({ blockClassName, block, render }) => render({ blockClassName, block });
|
|
6
|
+
export const ContentPage = JSX(({ className, data: { style: pageStyle, blocks, likeControl }, context, blockDecorator = defaultBlockDecorator, }) => {
|
|
7
|
+
return (_jsxs("section", { className: "relative", children: [_jsx("div", { className: `grid grid-cols-12 ${style2className(pageStyle)} ${className}`, children: blocks?.length ? blocks.map(renderBlock) : null }), likeControl && (_jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: _jsx(LikeControl, { className: "rounded-tl-lg sticky bottom-0 pointer-events-auto", context: context }) }))] }));
|
|
8
|
+
function renderBlock(block, i) {
|
|
9
|
+
const { type } = block;
|
|
10
|
+
if (!(type in Blocks)) {
|
|
11
|
+
console.warn(`No block with "${type}" is registered`);
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const BlockComponent = Blocks[type];
|
|
15
|
+
return blockDecorator({
|
|
16
|
+
blockClassName: style2className(block.style),
|
|
17
|
+
block,
|
|
18
|
+
render: (props) => {
|
|
19
|
+
const { content, blocks } = props.block;
|
|
20
|
+
return (_jsx(BlockComponent, { className: props.blockClassName, context: context, ...content, children: blocks?.length ? blocks.map(renderBlock) : null }, `${type}-${i}`));
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
function style2className(style) {
|
|
26
|
+
return style ? style.join(' ') : '';
|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YACtD,OAAO,IAAI,CAAC;SACb;QAED,MAAM,cAAc,GAAG,MAAM,CAAC,IAA2B,CAAC,CAAC;QAC3D,OAAO,cAAc,CAAC;YACpB,cAAc,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC;YAC5C,KAAK;YACL,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBAChB,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC;gBACxC,OAAO,CACL,KAAC,cAAc,IAEb,SAAS,EAAE,KAAK,CAAC,cAAc,EAC/B,OAAO,EAAE,OAAO,KACZ,OAAO,YAEV,MAAM,EAAE,MAAM,CAAC,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,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
export const ContentPageHead = JSX(({ HeadComponent, data, children }) => {
|
|
4
|
+
const { title, description, keywords, robots, og } = data;
|
|
5
|
+
return (_jsxs(HeadComponent, { children: [_jsx("title", { children: title }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), description && _jsx("meta", { name: "description", content: description }), keywords && _jsx("meta", { name: "keywords", content: keywords.join(',') }), robots && _jsx("meta", { name: "robots", content: robots.join(',') }), og
|
|
6
|
+
? Object.entries(og).map(([key, value]) => (_jsx("meta", { name: `og:${key}`, content: value }, key)))
|
|
7
|
+
: null, children] }));
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=ContentPageHead.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentPageHead.js","sourceRoot":"","sources":["../src/ContentPageHead.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAQxC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAuB,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,MAAC,aAAa,eACZ,0BAAQ,KAAK,GAAS,EACtB,eAAM,IAAI,EAAC,UAAU,EAAC,OAAO,EAAC,qCAAqC,GAAG,EACrE,WAAW,IAAI,eAAM,IAAI,EAAC,aAAa,EAAC,OAAO,EAAE,WAAW,GAAI,EAChE,QAAQ,IAAI,eAAM,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,GAAI,EACjE,MAAM,IAAI,eAAM,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,eAAgB,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/lib/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/lib/Header.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { HeaderItem } from './ui-kit/HeaderItem.js';
|
|
4
|
+
import { Logo } from './ui-kit/Logo.js';
|
|
5
|
+
import { TopItem } from './ui-kit/TopItem.js';
|
|
6
|
+
import { useLink } from './useLink.js';
|
|
7
|
+
export const Header = JSX(({ className, context, topItems }) => {
|
|
8
|
+
const router = context.useRouter();
|
|
9
|
+
const activeTopItem = topItems?.find(isTopItemActive(router));
|
|
10
|
+
const activeSubItem = activeTopItem?.items?.find(isSubItemActive(router));
|
|
11
|
+
return (_jsxs("div", { className: `py-8 px-20 bg-white rounded-bl-3xl rounded-br-3xl ${className || ''}`, children: [_jsxs("div", { className: "flex items-center", children: [_jsx(Logo, { className: "mr-8" }), topItems?.length
|
|
12
|
+
? topItems.map((_, i) => (_jsx(TopItem, { active: _ === activeTopItem, ...useLink(context, _) }, String(i))))
|
|
13
|
+
: null] }), activeTopItem?.items?.length ? (_jsx("div", { className: "mt-10", children: activeTopItem.items.map((_) => (_jsx(HeaderItem, { className: "mr-8", active: _ === activeSubItem, ...useLink(context, _) }, _.href))) })) : null] }));
|
|
14
|
+
});
|
|
15
|
+
const isURL = (href) => href?.includes('//');
|
|
16
|
+
const withoutQuery = (href) => (href || '').replace(/\/?\?.+/, '');
|
|
17
|
+
function isTopItemActive({ href, pathname }) {
|
|
18
|
+
return (item) => {
|
|
19
|
+
const itemHref = withoutQuery(item.href);
|
|
20
|
+
if (isURL(itemHref)) {
|
|
21
|
+
return Boolean(href && href.startsWith(itemHref));
|
|
22
|
+
}
|
|
23
|
+
return Boolean(item.href && pathname.startsWith(itemHref));
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function isSubItemActive({ href, pathname }) {
|
|
27
|
+
return (item) => {
|
|
28
|
+
return withoutQuery(item.href) === (isURL(item.href) ? withoutQuery(href) : pathname);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=Header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../src/Header.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiBpC,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAc,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC1E,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAEnC,MAAM,aAAa,GAAG,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9D,MAAM,aAAa,GAAG,aAAa,EAAE,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1E,OAAO,CACL,eAAK,SAAS,EAAE,qDAAqD,SAAS,IAAI,EAAE,EAAE,aACpF,eAAK,SAAS,EAAC,mBAAmB,aAChC,KAAC,IAAI,IAAC,SAAS,EAAC,MAAM,GAAG,EACxB,QAAQ,EAAE,MAAM;wBACf,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACrB,KAAC,OAAO,IAAiB,MAAM,EAAE,CAAC,KAAK,aAAa,KAAM,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,IAA/D,MAAM,CAAC,CAAC,CAAC,CAA0D,CAClF,CAAC;wBACJ,CAAC,CAAC,IAAI,IACJ,EACL,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,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACxF,CAAC,CAAC;AACJ,CAAC"}
|
package/lib/Icons.d.ts
ADDED
package/lib/Icons.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
const CalendarIcon = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_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" }), _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" })] }));
|
|
3
|
+
const EmptyWalletIcon = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_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" }), _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" }), _jsx("path", { stroke: "#42AB44", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M7 12h7" })] }));
|
|
4
|
+
const PercentageSquareIcon = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_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" }), _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" })] }));
|
|
5
|
+
export const Icons = {
|
|
6
|
+
EmptyWalletIcon,
|
|
7
|
+
PercentageSquareIcon,
|
|
8
|
+
CalendarIcon,
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=Icons.js.map
|
package/lib/Icons.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icons.js","sourceRoot":"","sources":["../src/Icons.tsx"],"names":[],"mappings":";AAAA,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,CACzB,eAAK,KAAK,EAAC,4BAA4B,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAC,WAAW,aACrE,eACE,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,eACE,MAAM,EAAC,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|
|
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/lib/Img.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
export const Img = JSX(({ className, image }) => (_jsxs("picture", { className: className || '', children: [image.sources?.length
|
|
4
|
+
? image.sources.map(({ src, format }, index) => (_jsx("source", { srcSet: src, type: formatToMimeType(format) }, `${index}_${src}`)))
|
|
5
|
+
: null, _jsx("img", { src: image.src, alt: image.alt, title: image.title, ...image?.size })] })));
|
|
6
|
+
export function formatToMimeType(format) {
|
|
7
|
+
return format ? `image/${String(format)}` : undefined;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=Img.js.map
|
package/lib/Img.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Img.js","sourceRoot":"","sources":["../src/Img.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAQxC,MAAM,CAAC,MAAM,GAAG,GAAG,GAAG,CAAqB,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACnE,mBAAS,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,iBAAgC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,IAA9D,GAAG,KAAK,IAAI,GAAG,EAAE,CAAiD,CAChF,CAAC;YACJ,CAAC,CAAC,IAAI,EACR,cAAK,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,MAAM,UAAU,gBAAgB,CAAC,MAA2B;IAC1D,OAAO,MAAM,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC"}
|
|
@@ -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,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { LikeButton } from './ui-kit/LikeButton.js';
|
|
4
|
+
export const LikeControl = JSX(({ className, context }) => {
|
|
5
|
+
const likeService = context.useLikeService();
|
|
6
|
+
return (_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: [_jsx(LikeButton, { onClick: likeService.like }), _jsx(LikeButton, { onClick: likeService.dislike, className: "rotate-180" }), _jsx("span", { className: "select-none", children: likeService.likeCount })] }));
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=LikeControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LikeControl.js","sourceRoot":"","sources":["../src/LikeControl.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAOjD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAmB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;IAC1E,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAE7C,OAAO,CACL,eACE,SAAS,EAAE,6GACT,SAAS,IAAI,EACf,EAAE,aAEF,KAAC,UAAU,IAAC,OAAO,EAAE,WAAW,CAAC,IAAI,GAAI,EACzC,KAAC,UAAU,IAAC,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,SAAS,EAAC,YAAY,GAAG,EACnE,eAAM,SAAS,EAAC,aAAa,YAAE,WAAW,CAAC,SAAS,GAAQ,IACxD,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
export const Placeholder = JSX(({ className, children }) => {
|
|
4
|
+
return _jsx("div", { className: className || '', children: children });
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=Placeholder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Placeholder.js","sourceRoot":"","sources":["../src/Placeholder.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAQxC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAmB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC3E,OAAO,cAAK,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,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { Icons } from './Icons.js';
|
|
4
|
+
import { Img } from './Img.js';
|
|
5
|
+
import { BlockItem } from './ui-kit/BlockItem.js';
|
|
6
|
+
import { Button } from './ui-kit/Button.js';
|
|
7
|
+
import { Breadcrumb } from './ui-kit/Breadcrumb.js';
|
|
8
|
+
import { useLink } from './useLink.js';
|
|
9
|
+
export const ProductBlock = JSX((props) => {
|
|
10
|
+
const { className, context, title, description, breadcrumbs, benefits, buttons, image, items } = props;
|
|
11
|
+
return (_jsxs("section", { className: `font-sans bg-white p-11 pr-[7.5rem] rounded-[40px] flex justify-between items-stretch ${className || ''}`, children: [_jsxs("div", { className: "flex flex-col text-primary-text", children: [breadcrumbs?.length ? (_jsx("div", { className: "text-xs mb-6", children: breadcrumbs
|
|
12
|
+
.map((breadcrumb, i) => (_jsx(Breadcrumb, { ...useLink(context, { className: 'text-secondary', ...breadcrumb }) }, String(i))))
|
|
13
|
+
.reduce((prev, curr, i) => [
|
|
14
|
+
prev,
|
|
15
|
+
_jsx("span", { className: "text-secondary mx-2", children: "/" }, `delimiter_${i}`),
|
|
16
|
+
curr,
|
|
17
|
+
]) })) : null, title && (_jsx("h1", { className: "font-medium text-title2 m-0 max-w-[600px] whitespace-pre-wrap", children: title })), description && (_jsx("div", { className: "font-normal text-base max-w-[600px] mt-4", children: description })), benefits?.length ? (_jsx("div", { className: "flex gap-6 mt-7", children: benefits.map(renderBenefit) })) : null, items?.length ? (_jsx("section", { role: "list", children: items.map((_, i) => (_jsx(BlockItem, { className: "mt-6", text: _ }, String(i)))) })) : null, buttons?.length ? (_jsx("div", { className: "flex mt-auto gap-4", children: buttons.map((button, index) => renderButton(button, index, context)) })) : null] }), image && _jsx(Img, { image: image, className: "mt-auto" })] }));
|
|
18
|
+
});
|
|
19
|
+
function renderBenefit(benefit, i) {
|
|
20
|
+
return (_jsxs("div", { className: "flex gap-4 items-center", children: [benefit.icon && (_jsx("div", { className: "h-11 w-11 min-w-11 min-h-11 bg-main rounded-full p-[10px] box-border", children: Icons[benefit.icon]() })), _jsxs("div", { className: "flex gap-1 flex-col h-full", children: [_jsx("h4", { className: "font-medium text-xl m-0", children: benefit.label }), benefit.description && (_jsx("div", { className: "font-normal text-sm text-secondary", children: benefit.description }))] })] }, String(i)));
|
|
21
|
+
}
|
|
22
|
+
function renderButton(button, i, context) {
|
|
23
|
+
return button?.text ? (_jsx(Button, { ...useLink(context, button), className: "mt-8", variant: button.variant }, String(i))) : null;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=ProductBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductBlock.js","sourceRoot":"","sources":["../src/ProductBlock.tsx"],"names":[],"mappings":";AAAA,OAA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,CACtB,cAAK,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,KAAC,MAAM,OAED,OAAO,CAAC,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,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { BlockItem } from './ui-kit/BlockItem.js';
|
|
4
|
+
import { Button } from './ui-kit/Button.js';
|
|
5
|
+
import { useLink } from './useLink.js';
|
|
6
|
+
export const ProductColumnBlock = JSX(({ className, context, title, items, button, promo }) => {
|
|
7
|
+
return (_jsxs("div", { className: `relative p-8 bg-white text-black font-sans rounded-[40px] ${className || ''}`, children: [_jsx("p", { className: "text-title font-medium m-0", children: title }), items?.length ? (_jsx("section", { className: "flex flex-col", role: "list", children: items.map((_, i) => (_jsx(BlockItem, { className: "mt-6", text: _ }, String(i)))) })) : null, button?.text ? _jsx(Button, { className: "mt-12", ...useLink(context, button) }) : null, promo && (_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" }))] }));
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=ProductColumnBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductColumnBlock.js","sourceRoot":"","sources":["../src/ProductColumnBlock.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CACnC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IACtD,OAAO,CACL,eACE,SAAS,EAAE,6DAA6D,SAAS,IAAI,EAAE,EAAE,aAEzF,YAAG,SAAS,EAAC,4BAA4B,YAAE,KAAK,GAAK,EACpD,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CACf,kBAAS,SAAS,EAAC,eAAe,EAAC,IAAI,EAAC,MAAM,YAC3C,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACnB,KAAC,SAAS,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,KAAC,MAAM,IAAC,SAAS,EAAC,OAAO,KAAK,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,EAChF,KAAK,IAAI,CACR,cAAK,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/lib/RichText.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
export const RichText = JSX(({ className, __html, __md }) => {
|
|
4
|
+
const html = __html || __md;
|
|
5
|
+
const props = Object.assign({ className: className || '' }, html ? { dangerouslySetInnerHTML: { __html: html } } : {});
|
|
6
|
+
return _jsx("div", { ...props });
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=RichText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RichText.js","sourceRoot":"","sources":["../src/RichText.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAWxC,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAgB,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,iBAAS,KAAK,GAAI,CAAC;AAC5B,CAAC,CAAC,CAAC"}
|
package/lib/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/lib/Text.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
export const Text = JSX(({ className, primary, secondary, children }) => {
|
|
4
|
+
return (_jsxs("div", { className: className || '', children: [primary && _jsx("p", { className: "font-bold text-slate-700 leading-snug", children: primary }), secondary && _jsx("p", { className: "mt-2 text-sm text-slate-600", children: secondary }), children] }));
|
|
5
|
+
});
|
|
6
|
+
//# sourceMappingURL=Text.js.map
|
package/lib/Text.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAWxC,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CAAY,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IACjF,OAAO,CACL,eAAK,SAAS,EAAE,SAAS,IAAI,EAAE,aAC5B,OAAO,IAAI,YAAG,SAAS,EAAC,uCAAuC,YAAE,OAAO,GAAK,EAC7E,SAAS,IAAI,YAAG,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,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
3
|
+
import { Img } from './Img.js';
|
|
4
|
+
export const TextWithImage = JSX(({ className, primary, image }) => {
|
|
5
|
+
return (_jsxs("div", { className: className || '', children: [primary && _jsx("p", { className: "font-bold text-slate-700 leading-snug", children: primary }), image && _jsx(Img, { image: image })] }));
|
|
6
|
+
});
|
|
7
|
+
//# sourceMappingURL=TextWithImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextWithImage.js","sourceRoot":"","sources":["../src/TextWithImage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAY5B,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAqB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IACrF,OAAO,CACL,eAAK,SAAS,EAAE,SAAS,IAAI,EAAE,aAC5B,OAAO,IAAI,YAAG,SAAS,EAAC,uCAAuC,YAAE,OAAO,GAAK,EAC7E,KAAK,IAAI,KAAC,GAAG,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,116 @@
|
|
|
1
|
+
const AUTH_PREFIX = 'guest';
|
|
2
|
+
const STORAGE_KEY = 'likesToken';
|
|
3
|
+
export function LikeAPI(projectId, baseURL) {
|
|
4
|
+
async function getLikeCount(...nodeIds) {
|
|
5
|
+
if (!nodeIds.length) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
const { token: Authorization } = await auth();
|
|
9
|
+
try {
|
|
10
|
+
const response = await fetch(`/assist/v1/public/projects/${projectId}/nodes/likes`, {
|
|
11
|
+
method: 'POST',
|
|
12
|
+
mode: 'cors',
|
|
13
|
+
headers: { 'Content-Type': 'application/json', Authorization },
|
|
14
|
+
body: JSON.stringify({
|
|
15
|
+
node_ids: nodeIds,
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
const { likes } = await response.json();
|
|
19
|
+
return likes || [];
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
console.error(e);
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function like(nodeId) {
|
|
27
|
+
if (!nodeId) {
|
|
28
|
+
return 0;
|
|
29
|
+
}
|
|
30
|
+
const { token: Authorization, name } = await auth();
|
|
31
|
+
try {
|
|
32
|
+
const response = await fetch(`${baseURL}/assist/v1/public/projects/${projectId}/nodes/like`, {
|
|
33
|
+
method: 'POST',
|
|
34
|
+
mode: 'cors',
|
|
35
|
+
headers: {
|
|
36
|
+
'Content-Type': 'application/json',
|
|
37
|
+
Authorization,
|
|
38
|
+
UserID: name,
|
|
39
|
+
},
|
|
40
|
+
body: JSON.stringify({
|
|
41
|
+
node_id: nodeId,
|
|
42
|
+
user_name: name,
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
const { likes } = await response.json();
|
|
46
|
+
return likes || 0;
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
console.error(e);
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async function dislike(nodeId) {
|
|
54
|
+
if (!nodeId) {
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
57
|
+
const { token: Authorization, name } = await auth();
|
|
58
|
+
try {
|
|
59
|
+
const response = await fetch(`${baseURL}/assist/v1/public/projects/${projectId}/nodes/unlike`, {
|
|
60
|
+
method: 'POST',
|
|
61
|
+
mode: 'cors',
|
|
62
|
+
headers: {
|
|
63
|
+
'Content-Type': 'application/json',
|
|
64
|
+
Authorization,
|
|
65
|
+
UserID: name,
|
|
66
|
+
},
|
|
67
|
+
body: JSON.stringify({
|
|
68
|
+
node_id: nodeId,
|
|
69
|
+
user_name: name,
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
72
|
+
const { likes } = await response.json();
|
|
73
|
+
return likes || 0;
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
console.error(e);
|
|
77
|
+
return 0;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function auth() {
|
|
81
|
+
try {
|
|
82
|
+
const userData = JSON.parse(globalThis.localStorage.getItem(STORAGE_KEY) || '');
|
|
83
|
+
if (userData?.token) {
|
|
84
|
+
return userData;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
// do nothing
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const response = await fetch(`${baseURL}/assist/v1/public/auth`, {
|
|
92
|
+
method: 'POST',
|
|
93
|
+
mode: 'cors',
|
|
94
|
+
headers: {
|
|
95
|
+
'Content-Type': 'application/json',
|
|
96
|
+
},
|
|
97
|
+
body: JSON.stringify({
|
|
98
|
+
prefix: AUTH_PREFIX,
|
|
99
|
+
}),
|
|
100
|
+
});
|
|
101
|
+
const { token, name } = await response.json();
|
|
102
|
+
globalThis.localStorage.setItem(STORAGE_KEY, JSON.stringify({ token, name }));
|
|
103
|
+
return { token, name };
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
console.error(e);
|
|
107
|
+
return {};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
getLikeCount,
|
|
112
|
+
like,
|
|
113
|
+
dislike,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=LikeAPI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LikeAPI.js","sourceRoot":"","sources":["../../src/api/LikeAPI.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,MAAM,WAAW,GAAG,YAAY,CAAC;AAEjC,MAAM,UAAU,OAAO,CAAC,SAAiB,EAAE,OAAe;IACxD,KAAK,UAAU,YAAY,CAAC,GAAG,OAAiB;QAC9C,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACnB,OAAO,EAAE,CAAC;SACX;QAED,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QAE9C,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,8BAA8B,SAAS,cAAc,EAAE;gBAClF,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE;gBAC9D,IAAI,EAA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AU,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YAE9E,OAAO,EAAE,KAAK,EAAE,IAAI,EAAc,CAAC;SACpC;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjB,OAAO,EAAc,CAAC;SACvB;IACH,CAAC;IAED,OAAO;QACL,YAAY;QACZ,IAAI;QACJ,OAAO;KACR,CAAC;AACJ,CAAC"}
|
package/lib/common.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.absolute{position:absolute}.relative{position:relative}.sticky{position:-webkit-sticky;position:sticky}.top-4{top:1rem}.right-4{right:1rem}.bottom-0{bottom:0}.right-0{right:0}.col-auto{grid-column:auto}.col-span-1{grid-column:span 1/span 1}.col-span-2{grid-column:span 2/span 2}.col-span-3{grid-column:span 3/span 3}.col-span-4{grid-column:span 4/span 4}.col-span-5{grid-column:span 5/span 5}.col-span-6{grid-column:span 6/span 6}.col-span-7{grid-column:span 7/span 7}.col-span-8{grid-column:span 8/span 8}.col-span-9{grid-column:span 9/span 9}.col-span-10{grid-column:span 10/span 10}.col-span-11{grid-column:span 11/span 11}.col-span-12{grid-column:span 12/span 12}.col-span-full{grid-column:1/-1}.col-start-1{grid-column-start:1}.col-start-2{grid-column-start:2}.col-start-3{grid-column-start:3}.col-start-4{grid-column-start:4}.col-start-5{grid-column-start:5}.col-start-6{grid-column-start:6}.col-start-7{grid-column-start:7}.col-start-8{grid-column-start:8}.col-start-9{grid-column-start:9}.col-start-10{grid-column-start:10}.col-start-11{grid-column-start:11}.col-start-12{grid-column-start:12}.col-start-13{grid-column-start:13}.col-start-auto{grid-column-start:auto}.col-end-1{grid-column-end:1}.col-end-2{grid-column-end:2}.col-end-3{grid-column-end:3}.col-end-4{grid-column-end:4}.col-end-5{grid-column-end:5}.col-end-6{grid-column-end:6}.col-end-7{grid-column-end:7}.col-end-8{grid-column-end:8}.col-end-9{grid-column-end:9}.col-end-10{grid-column-end:10}.col-end-11{grid-column-end:11}.col-end-12{grid-column-end:12}.col-end-13{grid-column-end:13}.col-end-auto{grid-column-end:auto}.m-0{margin:0}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mr-8{margin-right:2rem}.mt-10{margin-top:2.5rem}.mb-6{margin-bottom:1.5rem}.mt-4{margin-top:1rem}.mt-7{margin-top:1.75rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.mt-8{margin-top:2rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.ml-2\.5{margin-left:.625rem}.ml-2{margin-left:.5rem}.box-border{box-sizing:border-box}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.h-8{height:2rem}.h-full{height:100%}.h-11{height:2.75rem}.h-\[2px\]{height:2px}.min-h-11{min-height:2.75rem}.w-full{width:100%}.w-8{width:2rem}.w-\[125px\]{width:125px}.w-11{width:2.75rem}.w-\[36px\]{width:36px}.w-10{width:2.5rem}.min-w-11{min-width:2.75rem}.min-w-\[7px\]{min-width:7px}.max-w-\[600px\]{max-width:600px}.rotate-180{--tw-rotate:180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-col-resize{cursor:col-resize}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.resize{resize:both}.grid-flow-col-dense{grid-auto-flow:column dense}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-5{gap:1.25rem}.gap-3{gap:.75rem}.gap-6{gap:1.5rem}.gap-4{gap:1rem}.gap-1{gap:.25rem}.whitespace-pre-wrap{white-space:pre-wrap}.rounded-full{border-radius:9999px}.rounded-\[40px\]{border-radius:40px}.rounded-3xl{border-radius:1.5rem}.rounded-tl-lg{border-top-left-radius:.5rem}.rounded-bl-3xl{border-bottom-left-radius:1.5rem}.rounded-br-3xl{border-bottom-right-radius:1.5rem}.rounded-tl-\[74px\]{border-top-left-radius:74px}.rounded-br-\[40px\]{border-bottom-right-radius:40px}.border{border-width:1px}.border-2{border-width:2px}.border-0{border-width:0}.border-b-2{border-bottom-width:2px}.border-solid{border-style:solid}.border-main{--tw-border-opacity:1;border-color:rgb(240 244 240/var(--tw-border-opacity))}.border-transparent{border-color:transparent}.border-brand{--tw-border-opacity:1;border-color:rgb(66 171 68/var(--tw-border-opacity))}.border-b-brand{--tw-border-opacity:1;border-bottom-color:rgb(66 171 68/var(--tw-border-opacity))}.bg-main{--tw-bg-opacity:1;background-color:rgb(240 244 240/var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-white{background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-promo,.bg-white{--tw-bg-opacity:1}.bg-promo{background-color:rgb(247 248 197/var(--tw-bg-opacity))}.bg-brand{--tw-bg-opacity:1;background-color:rgb(66 171 68/var(--tw-bg-opacity))}.bg-inherit{background-color:inherit}.p-20{padding:5rem}.p-2{padding:.5rem}.p-11{padding:2.75rem}.p-\[10px\]{padding:10px}.p-8{padding:2rem}.py-8{padding-bottom:2rem;padding-top:2rem}.px-20{padding-left:5rem;padding-right:5rem}.px-12{padding-left:3rem;padding-right:3rem}.py-3{padding-bottom:.75rem;padding-top:.75rem}.px-9{padding-left:2.25rem;padding-right:2.25rem}.py-3\.5{padding-bottom:.875rem;padding-top:.875rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.pt-0{padding-top:0}.pr-\[7\.5rem\]{padding-right:7.5rem}.text-center{text-align:center}.font-sans{font-family:Ubuntu,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-xs{font-size:.75rem;line-height:1rem}.text-title2{font-size:2.5rem;line-height:3rem}.text-base{font-size:1rem;line-height:1.5rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-title{font-size:2rem;line-height:2.5rem}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-bold{font-weight:700}.leading-snug{line-height:1.375}.text-primary-text{--tw-text-opacity:1;color:rgb(28 28 28/var(--tw-text-opacity))}.text-secondary{--tw-text-opacity:1;color:rgb(159 167 159/var(--tw-text-opacity))}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-slate-700{--tw-text-opacity:1;color:rgb(51 65 85/var(--tw-text-opacity))}.text-slate-600{--tw-text-opacity:1;color:rgb(71 85 105/var(--tw-text-opacity))}.text-white{color:rgb(255 255 255/var(--tw-text-opacity))}.text-brand,.text-white{--tw-text-opacity:1}.text-brand{color:rgb(66 171 68/var(--tw-text-opacity))}.no-underline{-webkit-text-decoration-line:none;text-decoration-line:none}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.rotate-180{transform:rotate(180deg)}.hover\:text-brand:hover{--tw-text-opacity:1;color:rgb(66 171 68/var(--tw-text-opacity))}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ContentPageDef } from '../types';
|
|
2
|
+
import type { TransformationOptions } from './TransformationOptions';
|
|
3
|
+
export declare function ContentPageRepository({ contentDir, publicDir, }?: Partial<TransformationOptions>): {
|
|
4
|
+
getAllContentPages: () => Promise<ContentPageDef[]>;
|
|
5
|
+
getContentPageBySlug: (slug: string) => Promise<ContentPageDef | undefined>;
|
|
6
|
+
};
|