@redneckz/wildless-cms-uni-blocks 0.2.29 → 0.2.33
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 +8 -0
- package/dist/Blocks.js +17 -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 +20 -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/Header.d.ts +7 -0
- package/dist/Header/Header.js +25 -0
- package/dist/Header/Header.js.map +1 -0
- package/dist/Header/HeaderContent.d.ts +9 -0
- package/dist/Header/HeaderContent.js +2 -0
- package/dist/Header/HeaderContent.js.map +1 -0
- package/dist/Header/HeaderSecondaryMenu.d.ts +6 -0
- package/dist/Header/HeaderSecondaryMenu.js +11 -0
- package/dist/Header/HeaderSecondaryMenu.js.map +1 -0
- package/dist/Header/HeaderSecondaryMenuButton.d.ts +5 -0
- package/dist/Header/HeaderSecondaryMenuButton.js +6 -0
- package/dist/Header/HeaderSecondaryMenuButton.js.map +1 -0
- package/dist/Header/index.d.ts +3 -0
- package/dist/Header/index.js +5 -0
- package/dist/Header/index.js.map +1 -0
- package/dist/Header/isSubItemActive.d.ts +3 -0
- package/dist/Header/isSubItemActive.js +10 -0
- package/dist/Header/isSubItemActive.js.map +1 -0
- package/dist/Header/isTopItemActive.d.ts +3 -0
- package/dist/Header/isTopItemActive.js +14 -0
- package/dist/Header/isTopItemActive.js.map +1 -0
- package/dist/Header/mergeTopItems.d.ts +2 -0
- package/dist/Header/mergeTopItems.js +10 -0
- package/dist/Header/mergeTopItems.js.map +1 -0
- package/dist/Icons.d.ts +14 -0
- package/dist/Icons.js +24 -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/ProductTile.d.ts +25 -0
- package/dist/ProductTile.js +29 -0
- package/dist/ProductTile.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 +45 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/ui-kit/BlockItem.d.ts +10 -0
- package/dist/ui-kit/BlockItem.js +16 -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 +10 -0
- package/dist/ui-kit/Button.js +20 -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 +9 -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 +18 -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 +10 -0
- package/dist/ui-kit/TopItem.js +10 -0
- package/dist/ui-kit/TopItem.js.map +1 -0
- package/dist/useLink.d.ts +11 -0
- package/dist/useLink.js +21 -0
- package/dist/useLink.js.map +1 -0
- package/dist/utils/url.d.ts +4 -0
- package/dist/utils/url.js +26 -0
- package/dist/utils/url.js.map +1 -0
- package/lib/Blocks.d.ts +8 -0
- package/lib/Blocks.js +15 -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 +20 -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/Header.d.ts +7 -0
- package/lib/Header/Header.js +23 -0
- package/lib/Header/Header.js.map +1 -0
- package/lib/Header/HeaderContent.d.ts +9 -0
- package/lib/Header/HeaderContent.js +2 -0
- package/lib/Header/HeaderContent.js.map +1 -0
- package/lib/Header/HeaderSecondaryMenu.d.ts +6 -0
- package/lib/Header/HeaderSecondaryMenu.js +9 -0
- package/lib/Header/HeaderSecondaryMenu.js.map +1 -0
- package/lib/Header/HeaderSecondaryMenuButton.d.ts +5 -0
- package/lib/Header/HeaderSecondaryMenuButton.js +4 -0
- package/lib/Header/HeaderSecondaryMenuButton.js.map +1 -0
- package/lib/Header/index.d.ts +3 -0
- package/lib/Header/index.js +2 -0
- package/lib/Header/index.js.map +1 -0
- package/lib/Header/isSubItemActive.d.ts +3 -0
- package/lib/Header/isSubItemActive.js +7 -0
- package/lib/Header/isSubItemActive.js.map +1 -0
- package/lib/Header/isTopItemActive.d.ts +3 -0
- package/lib/Header/isTopItemActive.js +11 -0
- package/lib/Header/isTopItemActive.js.map +1 -0
- package/lib/Header/mergeTopItems.d.ts +2 -0
- package/lib/Header/mergeTopItems.js +7 -0
- package/lib/Header/mergeTopItems.js.map +1 -0
- package/lib/Icons.d.ts +14 -0
- package/lib/Icons.js +16 -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/ProductTile.d.ts +25 -0
- package/lib/ProductTile.js +27 -0
- package/lib/ProductTile.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 +45 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/ui-kit/BlockItem.d.ts +10 -0
- package/lib/ui-kit/BlockItem.js +14 -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 +10 -0
- package/lib/ui-kit/Button.js +18 -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 +7 -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 +18 -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 +10 -0
- package/lib/ui-kit/TopItem.js +8 -0
- package/lib/ui-kit/TopItem.js.map +1 -0
- package/lib/useLink.d.ts +11 -0
- package/lib/useLink.js +18 -0
- package/lib/useLink.js.map +1 -0
- package/lib/utils/url.d.ts +4 -0
- package/lib/utils/url.js +20 -0
- package/lib/utils/url.js.map +1 -0
- package/package.json +10 -3
|
@@ -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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AC,CAAC,CAAC,CAAC;YACjB,OAAO,CAAC,CAAC;SACV;IACH,CAAC;IAED,KAAK,UAAU,IAAI;QACjB,IAAI;YACF,MAAM,QAAQ,GAAa,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;YAC1F,IAAI,QAAQ,EAAE,KAAK,EAAE;gBACnB,OAAO,QAAQ,CAAC;aACjB;SACF;QAAC,OAAO,CAAC,EAAE;YACV,aAAa;SACd;QAED,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,wBAAwB,EAAE;gBAC/D,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,MAAM,EAAE,WAAW;iBACpB,CAAC;aACH,CAAC,CAAC;YAEH,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YAE9C,UAAU,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;AAhID,0BAgIC"}
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3
|
+
};
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.ContentPageRepository = void 0;
|
|
6
|
+
const glob_1 = __importDefault(require("glob"));
|
|
7
|
+
const util_1 = __importDefault(require("util"));
|
|
8
|
+
const transformContentPage_1 = require("./transformContentPage");
|
|
9
|
+
const find = util_1.default.promisify(glob_1.default);
|
|
10
|
+
function ContentPageRepository({ contentDir = 'content', publicDir = 'public', } = {}) {
|
|
11
|
+
async function getAllContentPages() {
|
|
12
|
+
const pagePaths = await find(`${contentDir}/**/*.page.json`);
|
|
13
|
+
return await Promise.all(pagePaths.map(readPage));
|
|
14
|
+
}
|
|
15
|
+
async function getContentPageBySlug(slug) {
|
|
16
|
+
const pages = await getAllContentPages();
|
|
17
|
+
return pages.find((content) => content.slug === slug);
|
|
18
|
+
}
|
|
19
|
+
const cache = {};
|
|
20
|
+
async function readPage(filePath) {
|
|
21
|
+
if (!(filePath in cache)) {
|
|
22
|
+
cache[filePath] = await (0, transformContentPage_1.transformContentPage)(filePath, {
|
|
23
|
+
contentDir,
|
|
24
|
+
publicDir,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return cache[filePath];
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
getAllContentPages,
|
|
31
|
+
getContentPageBySlug,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
exports.ContentPageRepository = ContentPageRepository;
|
|
35
|
+
//# sourceMappingURL=ContentPageRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentPageRepository.js","sourceRoot":"","sources":["../../src/content-page-repository/ContentPageRepository.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,gDAAwB;AAGxB,iEAA8D;AAE9D,MAAM,IAAI,GAAG,cAAI,CAAC,SAAS,CAAC,cAAI,CAAC,CAAC;AAElC,SAAgB,qBAAqB,CAAC,EACpC,UAAU,GAAG,SAAS,EACtB,SAAS,GAAG,QAAQ,MACc,EAAE;IACpC,KAAK,UAAU,kBAAkB;QAC/B,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,GAAG,UAAU,iBAAiB,CAAC,CAAC;QAC7D,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,UAAU,oBAAoB,CAAC,IAAY;QAC9C,MAAM,KAAK,GAAG,MAAM,kBAAkB,EAAE,CAAC;QACzC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,KAAK,GAAmC,EAAE,CAAC;IACjD,KAAK,UAAU,QAAQ,CAAC,QAAgB;QACtC,IAAI,CAAC,CAAC,QAAQ,IAAI,KAAK,CAAC,EAAE;YACxB,KAAK,CAAC,QAAQ,CAAC,GAAG,MAAM,IAAA,2CAAoB,EAAC,QAAQ,EAAE;gBACrD,UAAU;gBACV,SAAS;aACV,CAAC,CAAC;SACJ;QACD,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IAED,OAAO;QACL,kBAAkB;QAClB,oBAAoB;KACrB,CAAC;AACJ,CAAC;AA7BD,sDA6BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransformationOptions.js","sourceRoot":"","sources":["../../src/content-page-repository/TransformationOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ContentPageRepository } from './ContentPageRepository';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.ContentPageRepository = void 0;
|
|
3
|
+
var ContentPageRepository_1 = require("./ContentPageRepository");
|
|
4
|
+
Object.defineProperty(exports, "ContentPageRepository", { enumerable: true, get: function () { return ContentPageRepository_1.ContentPageRepository; } });
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/content-page-repository/index.ts"],"names":[],"mappings":";;AAAA,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mapJSON<T>(data: T, mapper: <In, Out = In>(value: In, key: string[]) => Promise<Out>, key?: string[]): Promise<T>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.mapJSON = void 0;
|
|
3
|
+
async function mapJSON(data, mapper, key = []) {
|
|
4
|
+
if (data === null || data === undefined)
|
|
5
|
+
return data;
|
|
6
|
+
const mappedData = await mapper(data, key);
|
|
7
|
+
if (mappedData !== data)
|
|
8
|
+
return mappedData;
|
|
9
|
+
if (Array.isArray(data)) {
|
|
10
|
+
const values = data.map((_, i) => mapJSON(_, mapper, [String(i)].concat(key)));
|
|
11
|
+
return Promise.all(values);
|
|
12
|
+
}
|
|
13
|
+
else if (typeof data === 'object' && data.toString() === '[object Object]') {
|
|
14
|
+
const subKeys = Object.keys(data);
|
|
15
|
+
const values = subKeys.map((k) => mapJSON(data[k], mapper, [k].concat(key)));
|
|
16
|
+
const pairs = (await Promise.all(values)).map((_, i) => ({
|
|
17
|
+
[subKeys[i]]: _,
|
|
18
|
+
}));
|
|
19
|
+
return Object.assign({}, ...pairs);
|
|
20
|
+
}
|
|
21
|
+
return mapper(data, key);
|
|
22
|
+
}
|
|
23
|
+
exports.mapJSON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CAAC,EAAE,EAAE,CAAC,CAAC;YACvD,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAChB,CAAC,CAAC,CAAC;QACJ,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,CAAC;KACpC;IACD,OAAO,MAAM,CAAI,IAAI,EAAE,GAAG,CAAC,CAAC;AAC9B,CAAC;AAtBD,0BAsBC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3
|
+
};
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.transformContentPage = void 0;
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const util_1 = __importDefault(require("util"));
|
|
8
|
+
const mapJSON_1 = require("./mapJSON");
|
|
9
|
+
const transformMarkdown_1 = require("./transformMarkdown");
|
|
10
|
+
const transformPicture_1 = require("./transformPicture");
|
|
11
|
+
const readFile = util_1.default.promisify(fs_1.default.readFile);
|
|
12
|
+
async function transformContentPage(pagePath, options) {
|
|
13
|
+
const content = await readFile(pagePath, 'utf8');
|
|
14
|
+
return (0, mapJSON_1.mapJSON)(JSON.parse(content), async (value, [key]) => {
|
|
15
|
+
const isMarkdown = typeof value === 'string' && key?.endsWith('__md');
|
|
16
|
+
const isPicture = value && value.src && typeof value.src === 'string';
|
|
17
|
+
if (isMarkdown) {
|
|
18
|
+
return await (0, transformMarkdown_1.transformMarkdown)(value);
|
|
19
|
+
}
|
|
20
|
+
else if (isPicture) {
|
|
21
|
+
return await (0, transformPicture_1.transformPicture)(pagePath, value, options);
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
exports.transformContentPage = transformContentPage;
|
|
27
|
+
//# sourceMappingURL=transformContentPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformContentPage.js","sourceRoot":"","sources":["../../src/content-page-repository/transformContentPage.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,uCAAoC;AAEpC,2DAAwD;AACxD,yDAAsD;AAEtD,MAAM,QAAQ,GAAG,cAAI,CAAC,SAAS,CAAC,YAAE,CAAC,QAAQ,CAAC,CAAC;AAEtC,KAAK,UAAU,oBAAoB,CACxC,QAAgB,EAChB,OAA8B;IAE9B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjD,OAAO,IAAA,iBAAO,EAAiB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAU,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE;QAC9E,MAAM,UAAU,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtE,MAAM,SAAS,GAAG,KAAK,IAAI,KAAK,CAAC,GAAG,IAAI,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC;QACtE,IAAI,UAAU,EAAE;YACd,OAAO,MAAM,IAAA,qCAAiB,EAAC,KAAK,CAAC,CAAC;SACvC;aAAM,IAAI,SAAS,EAAE;YACpB,OAAO,MAAM,IAAA,mCAAgB,EAAC,QAAQ,EAAE,KAAgB,EAAE,OAAO,CAAC,CAAC;SACpE;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC;AAfD,oDAeC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function transformMarkdown(markdown: string | null | undefined): Promise<string>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3
|
+
};
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.transformMarkdown = void 0;
|
|
6
|
+
const unified_1 = require("unified");
|
|
7
|
+
const remark_parse_1 = __importDefault(require("remark-parse"));
|
|
8
|
+
const remark_html_1 = __importDefault(require("remark-html"));
|
|
9
|
+
async function transformMarkdown(markdown) {
|
|
10
|
+
if (!markdown)
|
|
11
|
+
return '';
|
|
12
|
+
const result = await (0, unified_1.unified)().use(remark_parse_1.default).use(remark_html_1.default).process(markdown);
|
|
13
|
+
return result.toString('utf-8');
|
|
14
|
+
}
|
|
15
|
+
exports.transformMarkdown = transformMarkdown;
|
|
16
|
+
//# sourceMappingURL=transformMarkdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformMarkdown.js","sourceRoot":"","sources":["../../src/content-page-repository/transformMarkdown.ts"],"names":[],"mappings":";;;;;AAAA,qCAAkC;AAClC,gEAAuC;AACvC,8DAAqC;AAE9B,KAAK,UAAU,iBAAiB,CAAC,QAAmC;IACzE,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEzB,MAAM,MAAM,GAAG,MAAM,IAAA,iBAAO,GAAE,CAAC,GAAG,CAAC,sBAAW,CAAC,CAAC,GAAG,CAAC,qBAAU,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClF,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AALD,8CAKC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3
|
+
};
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.transformPicture = void 0;
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const sharp_1 = __importDefault(require("sharp"));
|
|
9
|
+
const util_1 = __importDefault(require("util"));
|
|
10
|
+
const mkdir = util_1.default.promisify(fs_1.default.mkdir);
|
|
11
|
+
async function transformPicture(pagePath, picture, options) {
|
|
12
|
+
const sources = picture.sources || [];
|
|
13
|
+
const [transformedPicture, ...transformedSources] = await Promise.all([picture].concat(sources).map((_) => transformImg(pagePath, picture.src, { ...options, ..._ })));
|
|
14
|
+
return {
|
|
15
|
+
...picture,
|
|
16
|
+
src: transformedPicture,
|
|
17
|
+
sources: transformedSources.map((_, i) => ({
|
|
18
|
+
...sources[i],
|
|
19
|
+
src: _,
|
|
20
|
+
})),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.transformPicture = transformPicture;
|
|
24
|
+
async function transformImg(pagePath, src, transformationOptions) {
|
|
25
|
+
const { contentDir, publicDir, format, options, size } = transformationOptions;
|
|
26
|
+
const imgPath = `${path_1.default.dirname(pagePath)}/${src}`;
|
|
27
|
+
let chain = (0, sharp_1.default)(imgPath);
|
|
28
|
+
if (size)
|
|
29
|
+
chain = chain.resize(size);
|
|
30
|
+
if (format)
|
|
31
|
+
chain = chain.toFormat(format, options);
|
|
32
|
+
const transformedSrc = transformSrc(src, transformationOptions);
|
|
33
|
+
const transformedImgPath = `${publicDir}/${path_1.default.relative(contentDir, `${path_1.default.dirname(pagePath)}/${transformedSrc}`)}`;
|
|
34
|
+
await mkdir(path_1.default.dirname(transformedImgPath), { recursive: true });
|
|
35
|
+
await chain.toFile(transformedImgPath);
|
|
36
|
+
return transformedSrc;
|
|
37
|
+
}
|
|
38
|
+
function transformSrc(src, { format, size }) {
|
|
39
|
+
const noTransform = !format && !size;
|
|
40
|
+
if (noTransform)
|
|
41
|
+
return src;
|
|
42
|
+
const suffix = [size?.width, size?.height].filter(Boolean).join('-');
|
|
43
|
+
return `${path_1.default.basename(src, path_1.default.extname(src))}${suffix ? `-${suffix}` : ''}.${String(format) || path_1.default.extname(src)}`;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=transformPicture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformPicture.js","sourceRoot":"","sources":["../../src/content-page-repository/transformPicture.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,kDAA0B;AAC1B,gDAAwB;AAIxB,MAAM,KAAK,GAAG,cAAI,CAAC,SAAS,CAAC,YAAE,CAAC,KAAK,CAAC,CAAC;AAEhC,KAAK,UAAU,gBAAgB,CACpC,QAAgB,EAChB,OAAgB,EAChB,OAA8B;IAE9B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;IACtC,MAAM,CAAC,kBAAkB,EAAE,GAAG,kBAAkB,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CACnE,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAChG,CAAC;IACF,OAAO;QACL,GAAG,OAAO;QACV,GAAG,EAAE,kBAAkB;QACvB,OAAO,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACzC,GAAG,OAAO,CAAC,CAAC,CAAC;YACb,GAAG,EAAE,CAAC;SACP,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC;AAjBD,4CAiBC;AAED,KAAK,UAAU,YAAY,CACzB,QAAgB,EAChB,GAAW,EACX,qBAAwD;IAExD,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,qBAAqB,CAAC;IAE/E,MAAM,OAAO,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,GAAG,EAAE,CAAC;IACnD,IAAI,KAAK,GAAG,IAAA,eAAK,EAAC,OAAO,CAAC,CAAC;IAC3B,IA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1
|
+
export type { BlockDef, ContentPageMeta, ContentPageDef, Img, ImgSource, Picture } from './types';
|
|
2
|
+
export type { ContentPageContext, Router } from './ContentPageContext';
|
|
3
|
+
export { Blocks } from './Blocks';
|
|
4
|
+
export { LikeAPI } from './api/LikeAPI';
|
|
5
|
+
export { ContentPageHead } from './ContentPageHead';
|
|
6
|
+
export { ContentPage } from './ContentPage';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.ContentPage = exports.ContentPageHead = exports.LikeAPI = exports.Blocks = void 0;
|
|
3
|
+
var Blocks_1 = require("./Blocks");
|
|
4
|
+
Object.defineProperty(exports, "Blocks", { enumerable: true, get: function () { return Blocks_1.Blocks; } });
|
|
5
|
+
var LikeAPI_1 = require("./api/LikeAPI");
|
|
6
|
+
Object.defineProperty(exports, "LikeAPI", { enumerable: true, get: function () { return LikeAPI_1.LikeAPI; } });
|
|
7
|
+
var ContentPageHead_1 = require("./ContentPageHead");
|
|
8
|
+
Object.defineProperty(exports, "ContentPageHead", { enumerable: true, get: function () { return ContentPageHead_1.ContentPageHead; } });
|
|
9
|
+
var ContentPage_1 = require("./ContentPage");
|
|
10
|
+
Object.defineProperty(exports, "ContentPage", { enumerable: true, get: function () { return ContentPage_1.ContentPage; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAGA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,yCAAwC;AAA/B,kGAAA,OAAO,OAAA;AAEhB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AvifOptions, FormatEnum, GifOptions, HeifOptions, JpegOptions, PngOptions, ResizeOptions, TiffOptions, WebpOptions } from 'sharp';
|
|
2
|
+
import type { HeaderContent } from './Header';
|
|
3
|
+
import type { PlaceholderContent } from './Placeholder';
|
|
4
|
+
import type { ProductTileContent } from './ProductTile';
|
|
5
|
+
import type { RichTextContent } from './RichText';
|
|
6
|
+
import type { TextContent } from './Text';
|
|
7
|
+
import type { TextWithImageContent } from './TextWithImage';
|
|
8
|
+
export declare type BlockVersion = 'primary' | 'secondary';
|
|
9
|
+
export declare type ColorPalette = 'pc' | 'bc' | 'eo';
|
|
10
|
+
export declare type BlockContent = HeaderContent | TextContent | TextWithImageContent | RichTextContent | PlaceholderContent | ProductTileContent;
|
|
11
|
+
export interface BlockDef {
|
|
12
|
+
type: string;
|
|
13
|
+
style?: string[];
|
|
14
|
+
version?: BlockVersion;
|
|
15
|
+
content?: BlockContent;
|
|
16
|
+
blocks?: BlockDef[];
|
|
17
|
+
}
|
|
18
|
+
export interface ContentPageMeta {
|
|
19
|
+
title: string;
|
|
20
|
+
slug: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
keywords?: string[];
|
|
23
|
+
robots?: string[];
|
|
24
|
+
og?: Record<string, string>;
|
|
25
|
+
}
|
|
26
|
+
export interface ContentPageDef extends ContentPageMeta {
|
|
27
|
+
style?: string[];
|
|
28
|
+
blocks?: BlockDef[];
|
|
29
|
+
likeControl?: boolean;
|
|
30
|
+
colorPalette?: ColorPalette;
|
|
31
|
+
}
|
|
32
|
+
export interface Img {
|
|
33
|
+
src: string;
|
|
34
|
+
alt?: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface ImgSource {
|
|
38
|
+
src: string;
|
|
39
|
+
format?: keyof FormatEnum;
|
|
40
|
+
options?: JpegOptions | PngOptions | WebpOptions | AvifOptions | HeifOptions | GifOptions | TiffOptions;
|
|
41
|
+
size?: ResizeOptions;
|
|
42
|
+
}
|
|
43
|
+
export interface Picture extends Img, ImgSource {
|
|
44
|
+
sources?: ImgSource[];
|
|
45
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare type BlockItemVersion = 'primary' | 'secondary';
|
|
2
|
+
export interface BlockItemContent {
|
|
3
|
+
text?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface BlockItemProps extends BlockItemContent {
|
|
6
|
+
className?: string;
|
|
7
|
+
version?: BlockItemVersion;
|
|
8
|
+
}
|
|
9
|
+
export declare const BlockItem: (props: import("@redneckz/uni-jsx").PropsWithChildren<BlockItemProps, any>, context?: any) => any;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.BlockItem = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
const listStyleMap = {
|
|
6
|
+
primary: 'bg-primary-main',
|
|
7
|
+
secondary: 'bg-white',
|
|
8
|
+
};
|
|
9
|
+
const textStyleMap = {
|
|
10
|
+
primary: 'text-primary-text',
|
|
11
|
+
secondary: 'text-white',
|
|
12
|
+
};
|
|
13
|
+
exports.BlockItem = (0, uni_jsx_1.JSX)(({ className, text, children, version = 'primary' }) => {
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `inline-block flex items-center ${className || ''}`, role: "listitem", children: [(0, jsx_runtime_1.jsx)("div", { className: `inline-block w-[8px] h-[8px] rounded-full ${listStyleMap[version]}` }), (0, jsx_runtime_1.jsx)("span", { className: `text-base font-normal font-sans mx-3 ${textStyleMap[version]}`, children: text || children })] }));
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=BlockItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockItem.js","sourceRoot":"","sources":["../../src/ui-kit/BlockItem.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAYxC,MAAM,YAAY,GAAqC;IACrD,OAAO,EAAE,iBAAiB;IAC1B,SAAS,EAAE,UAAU;CACtB,CAAC;AAEF,MAAM,YAAY,GAAqC;IACrD,OAAO,EAAE,mBAAmB;IAC5B,SAAS,EAAE,YAAY;CACxB,CAAC;AAEW,QAAA,SAAS,GAAG,IAAA,aAAG,EAC1B,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,EAAE,EAAE,EAAE;IACrD,OAAO,CACL,iCAAK,SAAS,EAAE,kCAAkC,SAAS,IAAI,EAAE,EAAE,EAAE,IAAI,EAAC,UAAU,aAClF,gCAAK,SAAS,EAAE,6CAA6C,YAAY,CAAC,OAAO,CAAC,EAAE,GAAQ,EAC5F,iCAAM,SAAS,EAAE,wCAAwC,YAAY,CAAC,OAAO,CAAC,EAAE,YAC7E,IAAI,IAAI,QAAQ,GACZ,IACH,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LinkContent } from './Link';
|
|
2
|
+
export interface BreadcrumbProps extends LinkContent {
|
|
3
|
+
className?: string;
|
|
4
|
+
onClick?: (ev: MouseEvent) => any;
|
|
5
|
+
}
|
|
6
|
+
export declare const Breadcrumb: (props: import("@redneckz/uni-jsx").PropsWithChildren<BreadcrumbProps, any>, context?: any) => any;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.Breadcrumb = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
exports.Breadcrumb = (0, uni_jsx_1.JSX)(({ text, href, target, onClick, className, children }) => {
|
|
6
|
+
if (href) {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("a", { className: `no-underline ${className || ''}`, href: href, target: target, onClick: onClick, children: (0, jsx_runtime_1.jsx)("span", { className: `${className || ''}`, children: text || children }) }));
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)("span", { className: `${className || ''}`, children: text || children }));
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=Breadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumb.js","sourceRoot":"","sources":["../../src/ui-kit/Breadcrumb.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAQ3B,QAAA,UAAU,GAAG,IAAA,aAAG,EAAkB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IACtG,IAAI,IAAI,EAAE;QACR,OAAO,CACL,8BACE,SAAS,EAAE,gBAAgB,SAAS,IAAI,EAAE,EAAE,EAC5C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,YAEhB,iCAAM,SAAS,EAAE,GAAG,SAAS,IAAI,EAAE,EAAE,YAAG,IAAI,IAAI,QAAQ,GAAQ,GAC9D,CACL,CAAC;KACH;SAAM;QACL,OAAO,CACL,iCAAM,SAAS,EAAE,GAAG,SAAS,IAAI,EAAE,EAAE,YAClC,IAAI,IAAI,QAAQ,GACZ,CACR,CAAC;KACH;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LinkContent } from './Link';
|
|
2
|
+
declare type ButtonVersion = 'primary' | 'secondary';
|
|
3
|
+
export interface ButtonProps extends LinkContent {
|
|
4
|
+
className?: string;
|
|
5
|
+
onClick?: (ev: MouseEvent) => any;
|
|
6
|
+
version?: ButtonVersion;
|
|
7
|
+
disabled?: Boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const Button: (props: import("@redneckz/uni-jsx").PropsWithChildren<ButtonProps, any>, context?: any) => any;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.Button = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
const buttonStyleMap = {
|
|
6
|
+
primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
|
|
7
|
+
secondary: 'text-primary-main bg-secondary-light hover:bg-secondary-hover active:bg-secondary-active',
|
|
8
|
+
};
|
|
9
|
+
const buttonDisabledStyleMap = {
|
|
10
|
+
primary: 'bg-secondary-dark text-secondary-text',
|
|
11
|
+
secondary: 'bg-secondary-light text-secondary-text',
|
|
12
|
+
};
|
|
13
|
+
const styleButton = 'inline-block rounded-3xl px-9 py-3.5 text-center font-sans';
|
|
14
|
+
exports.Button = (0, uni_jsx_1.JSX)(({ className, text, href, target, onClick, children, disabled, version = 'primary' }) => {
|
|
15
|
+
if (disabled) {
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)("div", { role: "button", "area-disabled": "true", className: `${styleButton} select-none ${buttonDisabledStyleMap[version]} ${className || ''}`, children: (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium", children: text || children }) }));
|
|
17
|
+
}
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)("a", { className: `${styleButton} no-underline ${buttonStyleMap[version]} ${className || ''}`, href: href, target: target, onClick: onClick, children: (0, jsx_runtime_1.jsx)("span", { className: "text-sm font-medium", children: text || children }) }));
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/ui-kit/Button.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAWxC,MAAM,cAAc,GAAkC;IACpD,OAAO,EAAE,4EAA4E;IACrF,SAAS,EACP,0FAA0F;CAC7F,CAAC;AAEF,MAAM,sBAAsB,GAAkC;IAC5D,OAAO,EAAE,uCAAuC;IAChD,SAAS,EAAE,wCAAwC;CACpD,CAAC;AAEF,MAAM,WAAW,GAAG,4DAA4D,CAAC;AAEpE,QAAA,MAAM,GAAG,IAAA,aAAG,EACvB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,EAAE,EAAE,EAAE;IACtF,IAAI,QAAQ,EAAE;QACZ,OAAO,CACL,gCACE,IAAI,EAAC,QAAQ,mBACC,MAAM,EACpB,SAAS,EAAE,GAAG,WAAW,gBAAgB,sBAAsB,CAAC,OAAO,CAAC,IACtE,SAAS,IAAI,EACf,EAAE,YAEF,iCAAM,SAAS,EAAC,qBAAqB,YAAE,IAAI,IAAI,QAAQ,GAAQ,GAC3D,CACP,CAAC;KACH;IAED,OAAO,CACL,8BACE,SAAS,EAAE,GAAG,WAAW,iBAAiB,cAAc,CAAC,OAAO,CAAC,IAAI,SAAS,IAAI,EAAE,EAAE,EACtF,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,YAEhB,iCAAM,SAAS,EAAC,qBAAqB,YAAE,IAAI,IAAI,QAAQ,GAAQ,GAC7D,CACL,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.HeaderItem = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
exports.HeaderItem = (0, uni_jsx_1.JSX)(({ className, text, href, target, active, onClick, children }) => {
|
|
6
|
+
const textStyle = active ? 'text-primary-main' : 'text-primary-text hover:text-primary-main';
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)("a", { className: `relative inline-block bg-transparent text-center no-underline ${className || ''}`, href: href, target: target, onClick: onClick, children: [(0, jsx_runtime_1.jsx)("span", { className: `font-sans font-normal text-base ${textStyle}`, children: text || children }), active ? ((0, jsx_runtime_1.jsx)("div", { className: "absolute left-0 -bottom-2 w-full h-[2px] bg-primary-main" })) : null] }));
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=HeaderItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderItem.js","sourceRoot":"","sources":["../../src/ui-kit/HeaderItem.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAK3B,QAAA,UAAU,GAAG,IAAA,aAAG,EAC3B,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/D,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,2CAA2C,CAAC;IAC7F,OAAO,CACL,+BACE,SAAS,EAAE,iEACT,SAAS,IAAI,EACf,EAAE,EACF,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,aAEhB,iCAAM,SAAS,EAAE,mCAAmC,SAAS,EAAE,YAAG,IAAI,IAAI,QAAQ,GAAQ,EACzF,MAAM,CAAC,CAAC,CAAC,CACR,gCAAK,SAAS,EAAC,0DAA0D,GAAG,CAC7E,CAAC,CAAC,CAAC,IAAI,IACN,CACL,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.LikeButton = void 0;
|
|
3
|
+
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const uni_jsx_1 = require("@redneckz/uni-jsx");
|
|
5
|
+
exports.LikeButton = (0, uni_jsx_1.JSX)(({ className, onClick }) => ((0, jsx_runtime_1.jsx)("button", { type: "button", className: `border-0 w-[36px] bg-inherit cursor-pointer ${className || ''}`, onClick: onClick, children: renderLikeIcon() })));
|
|
6
|
+
const renderLikeIcon = () => {
|
|
7
|
+
const params = {
|
|
8
|
+
stroke: '#292D32',
|
|
9
|
+
strokeLinecap: 'round',
|
|
10
|
+
strokeLinejoin: 'round',
|
|
11
|
+
strokeWidth: '1.5',
|
|
12
|
+
};
|
|
13
|
+
return ((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", { ...params, strokeMiterlimit: "10", d: "M21.48 11.95c.5-1.4-.4-2.6-1.9-2.6h-4c-.6 0-1.1-.5-1-1.2l.5-3.2c.2-.9-.4-1.9-1.3-2.2-.8-.3-1.8.1-2.2.7l-4.1 6.1M7.48 18.35l3.1 2.4c.4.4 1.3.6 1.9.6h3.8c1.2 0 2.5-.9 2.8-2.1l1.24-3.77" }), (0, jsx_runtime_1.jsx)("path", { ...params, d: "M2.38 18.35v-9.8c0-1.4.6-1.9 2-1.9h1c1.4 0 2 .5 2 1.9v9.8c0 1.4-.6 1.9-2 1.9h-1c-1.4 0-2-.5-2-1.9Z" })] }));
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=LikeButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LikeButton.js","sourceRoot":"","sources":["../../src/ui-kit/LikeButton.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAO3B,QAAA,UAAU,GAAG,IAAA,aAAG,EAAkB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CACzE,mCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,+CAA+C,SAAS,IAAI,EAAE,EAAE,EAC3E,OAAO,EAAE,OAAO,YAEf,cAAc,EAAE,GACV,CACV,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,MAAM,MAAM,GAAG;QACb,MAAM,EAAE,SAAS;QACjB,aAAa,EAAE,OAAO;QACtB,cAAc,EAAE,OAAO;QACvB,WAAW,EAAE,KAAK;KACnB,CAAC;IAEF,OAAO,CACL,iCAAK,KAAK,EAAC,4BAA4B,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAC,WAAW,aACrE,oCACM,MAAM,EACV,gBAAgB,EAAC,IAAI,EACrB,CAAC,EAAC,wLAAwL,GAC1L,EACF,oCACM,MAAM,EACV,CAAC,EAAC,oGAAoG,GACtG,IACE,CACP,CAAC;AACJ,CAAC,CAAC"}
|