@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.
Files changed (206) hide show
  1. package/dist/Blocks.d.ts +9 -0
  2. package/dist/Blocks.js +19 -0
  3. package/dist/Blocks.js.map +1 -0
  4. package/dist/ContentPage.d.ts +19 -0
  5. package/dist/ContentPage.js +30 -0
  6. package/dist/ContentPage.js.map +1 -0
  7. package/dist/ContentPageContext.d.ts +17 -0
  8. package/dist/ContentPageContext.js +2 -0
  9. package/dist/ContentPageContext.js.map +1 -0
  10. package/dist/ContentPageHead.d.ts +6 -0
  11. package/dist/ContentPageHead.js +11 -0
  12. package/dist/ContentPageHead.js.map +1 -0
  13. package/dist/Header.d.ts +15 -0
  14. package/dist/Header.js +33 -0
  15. package/dist/Header.js.map +1 -0
  16. package/dist/Icons.d.ts +5 -0
  17. package/dist/Icons.js +12 -0
  18. package/dist/Icons.js.map +1 -0
  19. package/dist/Img.d.ts +7 -0
  20. package/dist/Img.js +12 -0
  21. package/dist/Img.js.map +1 -0
  22. package/dist/LikeControl.d.ts +6 -0
  23. package/dist/LikeControl.js +10 -0
  24. package/dist/LikeControl.js.map +1 -0
  25. package/dist/Placeholder.d.ts +6 -0
  26. package/dist/Placeholder.js +8 -0
  27. package/dist/Placeholder.js.map +1 -0
  28. package/dist/ProductBlock.d.ts +24 -0
  29. package/dist/ProductBlock.js +27 -0
  30. package/dist/ProductBlock.js.map +1 -0
  31. package/dist/ProductColumnBlock.d.ts +13 -0
  32. package/dist/ProductColumnBlock.js +11 -0
  33. package/dist/ProductColumnBlock.js.map +1 -0
  34. package/dist/RichText.d.ts +8 -0
  35. package/dist/RichText.js +10 -0
  36. package/dist/RichText.js.map +1 -0
  37. package/dist/Text.d.ts +8 -0
  38. package/dist/Text.js +8 -0
  39. package/dist/Text.js.map +1 -0
  40. package/dist/TextWithImage.d.ts +9 -0
  41. package/dist/TextWithImage.js +9 -0
  42. package/dist/TextWithImage.js.map +1 -0
  43. package/dist/api/LikeAPI.d.ts +9 -0
  44. package/dist/api/LikeAPI.js +119 -0
  45. package/dist/api/LikeAPI.js.map +1 -0
  46. package/dist/content-page-repository/ContentPageRepository.d.ts +6 -0
  47. package/dist/content-page-repository/ContentPageRepository.js +35 -0
  48. package/dist/content-page-repository/ContentPageRepository.js.map +1 -0
  49. package/dist/content-page-repository/TransformationOptions.d.ts +4 -0
  50. package/dist/content-page-repository/TransformationOptions.js +2 -0
  51. package/dist/content-page-repository/TransformationOptions.js.map +1 -0
  52. package/dist/content-page-repository/index.d.ts +1 -0
  53. package/dist/content-page-repository/index.js +5 -0
  54. package/dist/content-page-repository/index.js.map +1 -0
  55. package/dist/content-page-repository/mapJSON.d.ts +1 -0
  56. package/dist/content-page-repository/mapJSON.js +24 -0
  57. package/dist/content-page-repository/mapJSON.js.map +1 -0
  58. package/dist/content-page-repository/transformContentPage.d.ts +3 -0
  59. package/dist/content-page-repository/transformContentPage.js +27 -0
  60. package/dist/content-page-repository/transformContentPage.js.map +1 -0
  61. package/dist/content-page-repository/transformMarkdown.d.ts +1 -0
  62. package/dist/content-page-repository/transformMarkdown.js +16 -0
  63. package/dist/content-page-repository/transformMarkdown.js.map +1 -0
  64. package/dist/content-page-repository/transformPicture.d.ts +3 -0
  65. package/dist/content-page-repository/transformPicture.js +45 -0
  66. package/dist/content-page-repository/transformPicture.js.map +1 -0
  67. package/dist/index.d.ts +6 -0
  68. package/dist/index.js +11 -0
  69. package/dist/index.js.map +1 -0
  70. package/dist/types.d.ts +42 -0
  71. package/dist/types.js +2 -0
  72. package/dist/types.js.map +1 -0
  73. package/dist/ui-kit/BlockItem.d.ts +7 -0
  74. package/dist/ui-kit/BlockItem.js +8 -0
  75. package/dist/ui-kit/BlockItem.js.map +1 -0
  76. package/dist/ui-kit/Breadcrumb.d.ts +6 -0
  77. package/dist/ui-kit/Breadcrumb.js +13 -0
  78. package/dist/ui-kit/Breadcrumb.js.map +1 -0
  79. package/dist/ui-kit/Button.d.ts +9 -0
  80. package/dist/ui-kit/Button.js +12 -0
  81. package/dist/ui-kit/Button.js.map +1 -0
  82. package/dist/ui-kit/HeaderItem.d.ts +3 -0
  83. package/dist/ui-kit/HeaderItem.js +10 -0
  84. package/dist/ui-kit/HeaderItem.js.map +1 -0
  85. package/dist/ui-kit/LikeButton.d.ts +5 -0
  86. package/dist/ui-kit/LikeButton.js +15 -0
  87. package/dist/ui-kit/LikeButton.js.map +1 -0
  88. package/dist/ui-kit/Link.d.ts +5 -0
  89. package/dist/ui-kit/Link.js +2 -0
  90. package/dist/ui-kit/Link.js.map +1 -0
  91. package/dist/ui-kit/Logo.d.ts +5 -0
  92. package/dist/ui-kit/Logo.js +16 -0
  93. package/dist/ui-kit/Logo.js.map +1 -0
  94. package/dist/ui-kit/SVG.d.ts +12 -0
  95. package/dist/ui-kit/SVG.js +8 -0
  96. package/dist/ui-kit/SVG.js.map +1 -0
  97. package/dist/ui-kit/TopItem.d.ts +9 -0
  98. package/dist/ui-kit/TopItem.js +10 -0
  99. package/dist/ui-kit/TopItem.js.map +1 -0
  100. package/dist/useLink.d.ts +8 -0
  101. package/dist/useLink.js +20 -0
  102. package/dist/useLink.js.map +1 -0
  103. package/lib/Blocks.d.ts +9 -0
  104. package/lib/Blocks.js +17 -0
  105. package/lib/Blocks.js.map +1 -0
  106. package/lib/ContentPage.d.ts +19 -0
  107. package/lib/ContentPage.js +28 -0
  108. package/lib/ContentPage.js.map +1 -0
  109. package/lib/ContentPageContext.d.ts +17 -0
  110. package/lib/ContentPageContext.js +2 -0
  111. package/lib/ContentPageContext.js.map +1 -0
  112. package/lib/ContentPageHead.d.ts +6 -0
  113. package/lib/ContentPageHead.js +9 -0
  114. package/lib/ContentPageHead.js.map +1 -0
  115. package/lib/Header.d.ts +15 -0
  116. package/lib/Header.js +31 -0
  117. package/lib/Header.js.map +1 -0
  118. package/lib/Icons.d.ts +5 -0
  119. package/lib/Icons.js +10 -0
  120. package/lib/Icons.js.map +1 -0
  121. package/lib/Img.d.ts +7 -0
  122. package/lib/Img.js +9 -0
  123. package/lib/Img.js.map +1 -0
  124. package/lib/LikeControl.d.ts +6 -0
  125. package/lib/LikeControl.js +8 -0
  126. package/lib/LikeControl.js.map +1 -0
  127. package/lib/Placeholder.d.ts +6 -0
  128. package/lib/Placeholder.js +6 -0
  129. package/lib/Placeholder.js.map +1 -0
  130. package/lib/ProductBlock.d.ts +24 -0
  131. package/lib/ProductBlock.js +25 -0
  132. package/lib/ProductBlock.js.map +1 -0
  133. package/lib/ProductColumnBlock.d.ts +13 -0
  134. package/lib/ProductColumnBlock.js +9 -0
  135. package/lib/ProductColumnBlock.js.map +1 -0
  136. package/lib/RichText.d.ts +8 -0
  137. package/lib/RichText.js +8 -0
  138. package/lib/RichText.js.map +1 -0
  139. package/lib/Text.d.ts +8 -0
  140. package/lib/Text.js +6 -0
  141. package/lib/Text.js.map +1 -0
  142. package/lib/TextWithImage.d.ts +9 -0
  143. package/lib/TextWithImage.js +7 -0
  144. package/lib/TextWithImage.js.map +1 -0
  145. package/lib/api/LikeAPI.d.ts +9 -0
  146. package/lib/api/LikeAPI.js +116 -0
  147. package/lib/api/LikeAPI.js.map +1 -0
  148. package/lib/common.css +1 -0
  149. package/lib/content-page-repository/ContentPageRepository.d.ts +6 -0
  150. package/lib/content-page-repository/ContentPageRepository.js +29 -0
  151. package/lib/content-page-repository/ContentPageRepository.js.map +1 -0
  152. package/lib/content-page-repository/TransformationOptions.d.ts +4 -0
  153. package/lib/content-page-repository/TransformationOptions.js +2 -0
  154. package/lib/content-page-repository/TransformationOptions.js.map +1 -0
  155. package/lib/content-page-repository/index.d.ts +1 -0
  156. package/lib/content-page-repository/index.js +2 -0
  157. package/lib/content-page-repository/index.js.map +1 -0
  158. package/lib/content-page-repository/mapJSON.d.ts +1 -0
  159. package/lib/content-page-repository/mapJSON.js +21 -0
  160. package/lib/content-page-repository/mapJSON.js.map +1 -0
  161. package/lib/content-page-repository/transformContentPage.d.ts +3 -0
  162. package/lib/content-page-repository/transformContentPage.js +21 -0
  163. package/lib/content-page-repository/transformContentPage.js.map +1 -0
  164. package/lib/content-page-repository/transformMarkdown.d.ts +1 -0
  165. package/lib/content-page-repository/transformMarkdown.js +10 -0
  166. package/lib/content-page-repository/transformMarkdown.js.map +1 -0
  167. package/lib/content-page-repository/transformPicture.d.ts +3 -0
  168. package/lib/content-page-repository/transformPicture.js +39 -0
  169. package/lib/content-page-repository/transformPicture.js.map +1 -0
  170. package/lib/index.d.ts +6 -0
  171. package/lib/index.js +5 -0
  172. package/lib/index.js.map +1 -0
  173. package/lib/types.d.ts +42 -0
  174. package/lib/types.js +2 -0
  175. package/lib/types.js.map +1 -0
  176. package/lib/ui-kit/BlockItem.d.ts +7 -0
  177. package/lib/ui-kit/BlockItem.js +6 -0
  178. package/lib/ui-kit/BlockItem.js.map +1 -0
  179. package/lib/ui-kit/Breadcrumb.d.ts +6 -0
  180. package/lib/ui-kit/Breadcrumb.js +11 -0
  181. package/lib/ui-kit/Breadcrumb.js.map +1 -0
  182. package/lib/ui-kit/Button.d.ts +9 -0
  183. package/lib/ui-kit/Button.js +10 -0
  184. package/lib/ui-kit/Button.js.map +1 -0
  185. package/lib/ui-kit/HeaderItem.d.ts +3 -0
  186. package/lib/ui-kit/HeaderItem.js +8 -0
  187. package/lib/ui-kit/HeaderItem.js.map +1 -0
  188. package/lib/ui-kit/LikeButton.d.ts +5 -0
  189. package/lib/ui-kit/LikeButton.js +13 -0
  190. package/lib/ui-kit/LikeButton.js.map +1 -0
  191. package/lib/ui-kit/Link.d.ts +5 -0
  192. package/lib/ui-kit/Link.js +2 -0
  193. package/lib/ui-kit/Link.js.map +1 -0
  194. package/lib/ui-kit/Logo.d.ts +5 -0
  195. package/lib/ui-kit/Logo.js +14 -0
  196. package/lib/ui-kit/Logo.js.map +1 -0
  197. package/lib/ui-kit/SVG.d.ts +12 -0
  198. package/lib/ui-kit/SVG.js +6 -0
  199. package/lib/ui-kit/SVG.js.map +1 -0
  200. package/lib/ui-kit/TopItem.d.ts +9 -0
  201. package/lib/ui-kit/TopItem.js +8 -0
  202. package/lib/ui-kit/TopItem.js.map +1 -0
  203. package/lib/useLink.d.ts +8 -0
  204. package/lib/useLink.js +17 -0
  205. package/lib/useLink.js.map +1 -0
  206. package/package.json +2 -2
@@ -0,0 +1,29 @@
1
+ import glob from 'glob';
2
+ import util from 'util';
3
+ import { transformContentPage } from './transformContentPage.js';
4
+ const find = util.promisify(glob);
5
+ export function ContentPageRepository({ contentDir = 'content', publicDir = 'public', } = {}) {
6
+ async function getAllContentPages() {
7
+ const pagePaths = await find(`${contentDir}/**/*.page.json`);
8
+ return await Promise.all(pagePaths.map(readPage));
9
+ }
10
+ async function getContentPageBySlug(slug) {
11
+ const pages = await getAllContentPages();
12
+ return pages.find((content) => content.slug === slug);
13
+ }
14
+ const cache = {};
15
+ async function readPage(filePath) {
16
+ if (!(filePath in cache)) {
17
+ cache[filePath] = await transformContentPage(filePath, {
18
+ contentDir,
19
+ publicDir,
20
+ });
21
+ }
22
+ return cache[filePath];
23
+ }
24
+ return {
25
+ getAllContentPages,
26
+ getContentPageBySlug,
27
+ };
28
+ }
29
+ //# sourceMappingURL=ContentPageRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentPageRepository.js","sourceRoot":"","sources":["../../src/content-page-repository/ContentPageRepository.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAElC,MAAM,UAAU,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,oBAAoB,CAAC,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"}
@@ -0,0 +1,4 @@
1
+ export interface TransformationOptions {
2
+ contentDir: string;
3
+ publicDir: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TransformationOptions.js.map
@@ -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,2 @@
1
+ export { ContentPageRepository } from './ContentPageRepository.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/content-page-repository/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -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,21 @@
1
+ export async function mapJSON(data, mapper, key = []) {
2
+ if (data === null || data === undefined)
3
+ return data;
4
+ const mappedData = await mapper(data, key);
5
+ if (mappedData !== data)
6
+ return mappedData;
7
+ if (Array.isArray(data)) {
8
+ const values = data.map((_, i) => mapJSON(_, mapper, [String(i)].concat(key)));
9
+ return Promise.all(values);
10
+ }
11
+ else if (typeof data === 'object' && data.toString() === '[object Object]') {
12
+ const subKeys = Object.keys(data);
13
+ const values = subKeys.map((k) => mapJSON(data[k], mapper, [k].concat(key)));
14
+ const pairs = (await Promise.all(values)).map((_, i) => ({
15
+ [subKeys[i]]: _,
16
+ }));
17
+ return Object.assign({}, ...pairs);
18
+ }
19
+ return mapper(data, key);
20
+ }
21
+ //# sourceMappingURL=mapJSON.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapJSON.js","sourceRoot":"","sources":["../../src/content-page-repository/mapJSON.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,IAAO,EACP,MAAgE,EAChE,MAAgB,EAAE;IAElB,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAErD,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC3C,IAAI,UAAU,KAAK,IAAI;QAAE,OAAO,UAAe,CAAC;IAEhD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACvB,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC/E,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAQ,CAAC;KACnC;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAK,IAAY,CAAC,QAAQ,EAAE,KAAK,iBAAiB,EAAE;QACrF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAW,CAAC,CAAC;QACzC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC7E,MAAM,KAAK,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,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"}
@@ -0,0 +1,3 @@
1
+ import type { ContentPageDef } from '../types';
2
+ import type { TransformationOptions } from './TransformationOptions';
3
+ export declare function transformContentPage(pagePath: string, options: TransformationOptions): Promise<ContentPageDef>;
@@ -0,0 +1,21 @@
1
+ import fs from 'fs';
2
+ import util from 'util';
3
+ import { mapJSON } from './mapJSON.js';
4
+ import { transformMarkdown } from './transformMarkdown.js';
5
+ import { transformPicture } from './transformPicture.js';
6
+ const readFile = util.promisify(fs.readFile);
7
+ export async function transformContentPage(pagePath, options) {
8
+ const content = await readFile(pagePath, 'utf8');
9
+ return mapJSON(JSON.parse(content), async (value, [key]) => {
10
+ const isMarkdown = typeof value === 'string' && key?.endsWith('__md');
11
+ const isPicture = value && value.src && typeof value.src === 'string';
12
+ if (isMarkdown) {
13
+ return await transformMarkdown(value);
14
+ }
15
+ else if (isPicture) {
16
+ return await transformPicture(pagePath, value, options);
17
+ }
18
+ return value;
19
+ });
20
+ }
21
+ //# sourceMappingURL=transformContentPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformContentPage.js","sourceRoot":"","sources":["../../src/content-page-repository/transformContentPage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAE7C,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,QAAgB,EAChB,OAA8B;IAE9B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjD,OAAO,OAAO,CAAiB,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,iBAAiB,CAAC,KAAK,CAAC,CAAC;SACvC;aAAM,IAAI,SAAS,EAAE;YACpB,OAAO,MAAM,gBAAgB,CAAC,QAAQ,EAAE,KAAgB,EAAE,OAAO,CAAC,CAAC;SACpE;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function transformMarkdown(markdown: string | null | undefined): Promise<string>;
@@ -0,0 +1,10 @@
1
+ import { unified } from 'unified';
2
+ import remarkParse from 'remark-parse';
3
+ import remarkHtml from 'remark-html';
4
+ export async function transformMarkdown(markdown) {
5
+ if (!markdown)
6
+ return '';
7
+ const result = await unified().use(remarkParse).use(remarkHtml).process(markdown);
8
+ return result.toString('utf-8');
9
+ }
10
+ //# sourceMappingURL=transformMarkdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformMarkdown.js","sourceRoot":"","sources":["../../src/content-page-repository/transformMarkdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,QAAmC;IACzE,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEzB,MAAM,MAAM,GAAG,MAAM,OAAO,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClF,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Picture } from '../types';
2
+ import type { TransformationOptions } from './TransformationOptions';
3
+ export declare function transformPicture(pagePath: string, picture: Picture, options: TransformationOptions): Promise<Picture>;
@@ -0,0 +1,39 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import sharp from 'sharp';
4
+ import util from 'util';
5
+ const mkdir = util.promisify(fs.mkdir);
6
+ export async function transformPicture(pagePath, picture, options) {
7
+ const sources = picture.sources || [];
8
+ const [transformedPicture, ...transformedSources] = await Promise.all([picture].concat(sources).map((_) => transformImg(pagePath, picture.src, { ...options, ..._ })));
9
+ return {
10
+ ...picture,
11
+ src: transformedPicture,
12
+ sources: transformedSources.map((_, i) => ({
13
+ ...sources[i],
14
+ src: _,
15
+ })),
16
+ };
17
+ }
18
+ async function transformImg(pagePath, src, transformationOptions) {
19
+ const { contentDir, publicDir, format, options, size } = transformationOptions;
20
+ const imgPath = `${path.dirname(pagePath)}/${src}`;
21
+ let chain = sharp(imgPath);
22
+ if (size)
23
+ chain = chain.resize(size);
24
+ if (format)
25
+ chain = chain.toFormat(format, options);
26
+ const transformedSrc = transformSrc(src, transformationOptions);
27
+ const transformedImgPath = `${publicDir}/${path.relative(contentDir, `${path.dirname(pagePath)}/${transformedSrc}`)}`;
28
+ await mkdir(path.dirname(transformedImgPath), { recursive: true });
29
+ await chain.toFile(transformedImgPath);
30
+ return transformedSrc;
31
+ }
32
+ function transformSrc(src, { format, size }) {
33
+ const noTransform = !format && !size;
34
+ if (noTransform)
35
+ return src;
36
+ const suffix = [size?.width, size?.height].filter(Boolean).join('-');
37
+ return `${path.basename(src, path.extname(src))}${suffix ? `-${suffix}` : ''}.${String(format) || path.extname(src)}`;
38
+ }
39
+ //# sourceMappingURL=transformPicture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformPicture.js","sourceRoot":"","sources":["../../src/content-page-repository/transformPicture.ts"],"names":[],"mappings":"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"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,6 @@
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/lib/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { Blocks } from './Blocks.js';
2
+ export { LikeAPI } from './api/LikeAPI.js';
3
+ export { ContentPageHead } from './ContentPageHead.js';
4
+ export { ContentPage } from './ContentPage.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
package/lib/types.d.ts ADDED
@@ -0,0 +1,42 @@
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 { ProductColumnBlockContent } from './ProductColumnBlock';
5
+ import type { RichTextContent } from './RichText';
6
+ import type { TextContent } from './Text';
7
+ import type { TextWithImageContent } from './TextWithImage';
8
+ import type { ProductBlockContent } from './ProductBlock';
9
+ export declare type BlockContent = ProductColumnBlockContent | HeaderContent | TextContent | TextWithImageContent | RichTextContent | PlaceholderContent | ProductBlockContent;
10
+ export interface BlockDef {
11
+ type: string;
12
+ style?: string[];
13
+ content?: BlockContent;
14
+ blocks?: BlockDef[];
15
+ }
16
+ export interface ContentPageMeta {
17
+ title: string;
18
+ slug: string;
19
+ description?: string;
20
+ keywords?: string[];
21
+ robots?: string[];
22
+ og?: Record<string, string>;
23
+ }
24
+ export interface ContentPageDef extends ContentPageMeta {
25
+ style?: string[];
26
+ blocks?: BlockDef[];
27
+ likeControl?: boolean;
28
+ }
29
+ export interface Img {
30
+ src: string;
31
+ alt?: string;
32
+ title?: string;
33
+ }
34
+ export interface ImgSource {
35
+ src: string;
36
+ format?: keyof FormatEnum;
37
+ options?: JpegOptions | PngOptions | WebpOptions | AvifOptions | HeifOptions | GifOptions | TiffOptions;
38
+ size?: ResizeOptions;
39
+ }
40
+ export interface Picture extends Img, ImgSource {
41
+ sources?: ImgSource[];
42
+ }
package/lib/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export interface BlockItemContent {
2
+ text?: string;
3
+ }
4
+ export interface BlockItemProps extends BlockItemContent {
5
+ className?: string;
6
+ }
7
+ export declare const BlockItem: (props: import("@redneckz/uni-jsx").PropsWithChildren<BlockItemProps, any>, context?: any) => any;
@@ -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 BlockItem = JSX(({ className, text, children }) => {
4
+ return (_jsxs("div", { className: `inline-block flex items-center ${className || ''}`, role: "listitem", children: [_jsx("div", { className: "inline-block min-w-[7px] h-[2px] bg-brand" }), _jsx("span", { className: "text-base text-secondary font-normal font-sans mx-3", children: text || children })] }));
5
+ });
6
+ //# sourceMappingURL=BlockItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlockItem.js","sourceRoot":"","sources":["../../src/ui-kit/BlockItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAUxC,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAiB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC7E,OAAO,CACL,eAAK,SAAS,EAAE,kCAAkC,SAAS,IAAI,EAAE,EAAE,EAAE,IAAI,EAAC,UAAU,aAClF,cAAK,SAAS,EAAC,2CAA2C,GAAO,EACjE,eAAM,SAAS,EAAC,qDAAqD,YAClE,IAAI,IAAI,QAAQ,GACZ,IACH,CACP,CAAC;AACJ,CAAC,CAAC,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,11 @@
1
+ import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
+ import { JSX } from '@redneckz/uni-jsx';
3
+ export const Breadcrumb = JSX(({ text, href, target, onClick, className, children }) => {
4
+ if (href) {
5
+ return (_jsx("a", { className: `no-underline ${className || ''}`, href: href, target: target, onClick: onClick, children: _jsx("span", { className: `${className || ''}`, children: text || children }) }));
6
+ }
7
+ else {
8
+ return (_jsx("span", { className: `${className || ''}`, children: text || children }));
9
+ }
10
+ });
11
+ //# sourceMappingURL=Breadcrumb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Breadcrumb.js","sourceRoot":"","sources":["../../src/ui-kit/Breadcrumb.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAQxC,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAkB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IACtG,IAAI,IAAI,EAAE;QACR,OAAO,CACL,YACE,SAAS,EAAE,gBAAgB,SAAS,IAAI,EAAE,EAAE,EAC5C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,YAEhB,eAAM,SAAS,EAAE,GAAG,SAAS,IAAI,EAAE,EAAE,YAAG,IAAI,IAAI,QAAQ,GAAQ,GAC9D,CACL,CAAC;KACH;SAAM;QACL,OAAO,CACL,eAAM,SAAS,EAAE,GAAG,SAAS,IAAI,EAAE,EAAE,YAClC,IAAI,IAAI,QAAQ,GACZ,CACR,CAAC;KACH;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { LinkContent } from './Link';
2
+ declare type ButtonVariant = 'primary' | 'secondary';
3
+ export interface ButtonProps extends LinkContent {
4
+ className?: string;
5
+ onClick?: (ev: MouseEvent) => any;
6
+ variant?: ButtonVariant;
7
+ }
8
+ export declare const Button: (props: import("@redneckz/uni-jsx").PropsWithChildren<ButtonProps, any>, context?: any) => any;
9
+ export {};
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
+ import { JSX } from '@redneckz/uni-jsx';
3
+ const variantStyleMap = {
4
+ primary: 'text-white bg-brand',
5
+ secondary: 'text-brand bg-main',
6
+ };
7
+ export const Button = JSX(({ className, text, href, target, onClick, children, variant = 'primary' }) => {
8
+ return (_jsx("a", { className: `inline-block rounded-3xl px-9 py-3.5 text-center font-sans no-underline ${variantStyleMap[variant]} ${className || ''}`, href: href, target: target, onClick: onClick, children: _jsx("span", { className: "text-sm font-medium", children: text || children }) }));
9
+ });
10
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/ui-kit/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAUxC,MAAM,eAAe,GAAkC;IACrD,OAAO,EAAE,qBAAqB;IAC9B,SAAS,EAAE,oBAAoB;CAChC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CACvB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,EAAE,EAAE,EAAE;IAC5E,OAAO,CACL,YACE,SAAS,EAAE,2EACT,eAAe,CAAC,OAAO,CACzB,IAAI,SAAS,IAAI,EAAE,EAAE,EACrB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,YAEhB,eAAM,SAAS,EAAC,qBAAqB,YAAE,IAAI,IAAI,QAAQ,GAAQ,GAC7D,CACL,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TopItemProps } from './TopItem';
2
+ export declare type HeaderItemProps = TopItemProps;
3
+ export declare const HeaderItem: (props: import("@redneckz/uni-jsx").PropsWithChildren<TopItemProps, any>, context?: any) => any;
@@ -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 HeaderItem = JSX(({ className, text, href, target, active, onClick, children }) => {
4
+ const linkStyle = active ? 'border-b-brand' : 'border-transparent';
5
+ const textStyle = active ? 'text-brand' : 'text-black hover:text-brand';
6
+ return (_jsx("a", { className: `${linkStyle} border-0 border-b-2 border-solid inline-block bg-transparent py-2 text-center font-sans no-underline ${className || ''}`, href: href, target: target, onClick: onClick, children: _jsx("span", { className: `${textStyle} text-base font-normal`, children: text || children }) }));
7
+ });
8
+ //# sourceMappingURL=HeaderItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderItem.js","sourceRoot":"","sources":["../../src/ui-kit/HeaderItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAKxC,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAC3B,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,gBAAgB,CAAC,CAAC,CAAC,oBAAoB,CAAC;IACnE,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,6BAA6B,CAAC;IACxE,OAAO,CACL,YACE,SAAS,EAAE,GAAG,SAAS,yGACrB,SAAS,IAAI,EACf,EAAE,EACF,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,YAEhB,eAAM,SAAS,EAAE,GAAG,SAAS,wBAAwB,YAAG,IAAI,IAAI,QAAQ,GAAQ,GAC9E,CACL,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ export interface LikeButtonProps {
2
+ className?: string;
3
+ onClick?: (ev: MouseEvent) => any;
4
+ }
5
+ export declare const LikeButton: (props: import("@redneckz/uni-jsx").PropsWithChildren<LikeButtonProps, any>, context?: any) => any;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
+ import { JSX } from '@redneckz/uni-jsx';
3
+ export const LikeButton = JSX(({ className, onClick }) => (_jsx("button", { type: "button", className: `border-0 w-[36px] bg-inherit cursor-pointer ${className || ''}`, onClick: onClick, children: renderLikeIcon() })));
4
+ const renderLikeIcon = () => {
5
+ const params = {
6
+ stroke: '#292D32',
7
+ strokeLinecap: 'round',
8
+ strokeLinejoin: 'round',
9
+ strokeWidth: '1.5',
10
+ };
11
+ return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_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" }), _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" })] }));
12
+ };
13
+ //# sourceMappingURL=LikeButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LikeButton.js","sourceRoot":"","sources":["../../src/ui-kit/LikeButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAOxC,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAkB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CACzE,iBACE,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,eAAK,KAAK,EAAC,4BAA4B,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAC,WAAW,aACrE,kBACM,MAAM,EACV,gBAAgB,EAAC,IAAI,EACrB,CAAC,EAAC,wLAAwL,GAC1L,EACF,kBACM,MAAM,EACV,CAAC,EAAC,oGAAoG,GACtG,IACE,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export interface LinkContent {
2
+ text?: string;
3
+ href?: string;
4
+ target?: '_blank' | '_self' | '_parent' | '_top' | string;
5
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/ui-kit/Link.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export interface LogoProps {
2
+ className?: string;
3
+ href?: string;
4
+ }
5
+ export declare const Logo: (props: import("@redneckz/uni-jsx").PropsWithChildren<LogoProps, any>, context?: any) => any;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
+ import { JSX } from '@redneckz/uni-jsx';
3
+ import { SVG } from './SVG.js';
4
+ const LOGO_PATHS = [
5
+ 'm13.72 25.51 4.42-4.33v-2.95l-4.42 4.32v2.96Zm0-10.98 4.42-4.35V7.41l-4.42 4.31v2.8Zm0 3.63 4.42-4.33v-2.78l-4.42 4.32v2.8ZM12.46 7.44l-.6-.56V0h-.66v6.22l-.58-.57V0h-.67v5l-.59-.58V0H8.7v6.56l4.44 4.33V0h-.67v7.44Zm1.26 14.35 4.42-4.33v-2.78L13.72 19v2.8Zm-5.03-.61 4.44 4.33v-2.96l-4.44-4.32v2.95Zm8.79-16.76-.59.58V0h-.66v5.66l-.6.56V0h-.66v6.87l-.58.57V0h-.67v10.9l4.42-4.34V0h-.66v4.42Zm-8.79 5.76 4.44 4.35v-2.8L8.69 7.4v2.77Zm0 3.65 4.44 4.33v-2.8l-4.44-4.3v2.77Zm0 3.63 4.44 4.33V19l-4.44-4.31v2.78Zm26.37 2.29H24.3a2.25 2.25 0 0 0 .36-1.22 2.32 2.32 0 0 0-2.33-2.31 2.32 2.32 0 0 0-2.31 2.31c0 .5.16.96.43 1.34a.74.74 0 0 0-.33.61c0 .26.14.49.33.62a2.32 2.32 0 0 0-.43 1.34 2.31 2.31 0 0 0 2.31 2.31 2.32 2.32 0 0 0 2.33-2.31c0-.45-.13-.87-.36-1.22h8.01v.49h-.8v.68h.8v.7h-.8v1.3h.8v-.58h1.17v.58h.79v-1.3h-.79v-.7h.79v-.68h-.79v-.5h1.58a.56.56 0 0 0 .56-.56v-.34a.57.57 0 0 0-.56-.56Zm-11.53 2.7a1.2 1.2 0 0 1-2.4 0c0-.24.08-.47.2-.66l.34-.56a.97.97 0 0 1-.34-.75c0-.3.13-.56.33-.74l-.32-.56a1.13 1.13 0 0 1-.2-.66 1.2 1.2 0 0 1 2.4 0c0 .49-.56 1.65-.56 1.65v.62c-.01.01.55 1.17.55 1.66ZM4.67 18.34v2.89c0 2.75 1.2 4.53 1.9 5.21l4.58 4.5c1.28 1.25 1.5 1.66 1.79 2.37v-3.2c0-2.84-1.44-3.94-2.19-4.67-1.73-1.68-2.89-2.8-3.82-3.73a8.98 8.98 0 0 1-2.26-3.37Zm6.08 14.24c-1.73-1.7-2.89-2.8-3.82-3.73a10 10 0 0 1-2.25-2.98v2.49a7.87 7.87 0 0 0 1.89 5.24l4.58 4.47c1.28 1.25 1.5 1.85 1.79 2.55v-3.37c0-2.85-1.45-3.95-2.19-4.67Z',
6
+ 'M19.88 5.34c-.32 0-.64 0-.96.02V6.7a18.5 18.5 0 1 1 .95 36.94A18.5 18.5 0 0 1 1.35 25.17c0-5.67 2.55-10.73 6.58-14.13V9.32A19.78 19.78 0 0 0 0 25.17C0 36.12 8.9 45 19.88 45a19.85 19.85 0 0 0 19.86-19.83c0-10.95-8.9-19.83-19.87-19.83Z',
7
+ 'M33.93 35.53c.3-.41.6-.85.87-1.3v-2.66h-.87v3.96Zm2.54-4.92c.12-.4.24-.78.34-1.16h-2.88v.7h.43c.77-.02 1.63-.03 2.11.46Zm-19.19-1.27h-.78v7.91h.78v-7.9Z',
8
+ 'M14.7 27.83h2.58c.67 0 1.14.14 1.4.4.27.25.4.72.4 1.38v7.4c0 .66-.12 1.12-.4 1.38-.4.41-1.16.41-1.78.41l-.4-.01v3.5l.78.14v-2.88c1.2 0 1.97-.4 2.34-1.22v4.29h.26l.5-.01V29.74c0-.68.13-1.16.4-1.43.25-.27.72-.4 1.37-.4.67 0 1.65-.1 2.16.4.26.27.38.76.38 1.43v3.8h-1.77v-4.06h-.77v12.99c.26-.03.5-.07.77-.12V34.3h1.77v7.64c.36-.1.72-.21 1.08-.34v-7c0-.8.19-1.4 1-1.67l-.9-4.87h1.8l.3 5.31h.22l.3-5.31h1.88l-1.01 4.87c.84.3 1.01.81 1.01 1.66v4.53a16.63 16.63 0 0 0 1.5-1.27v-9.83h5.25l.1-.72H24.93l.17.89c-.38-.72-1.12-1.08-2.2-1.08h-.77c-1.3 0-2.1.52-2.4 1.55-.27-1.08-1.1-1.62-2.46-1.62h-3.36v14.52c.26.09.52.18.78.25V27.84Zm16.29 5.58-.85-.8.85-4.37v5.17Z',
9
+ 'M27.66 40.79c.27-.14.55-.28.8-.43v-5.98h-.8v6.4Z',
10
+ ];
11
+ export const Logo = JSX(({ className, href, children }) => {
12
+ return (_jsxs("a", { className: `inline-flex items-center font-sans no-underline ${className || ''}`, href: href || 'https://rshb.ru/', target: "_blank", children: [_jsx(SVG, { className: "text-brand w-10", viewBox: "0 0 40 45", paths: LOGO_PATHS.map((d) => ({ d })) }), _jsx("span", { className: "text-black text-base font-medium ml-2.5", children: children || 'Россельхозбанк' })] }));
13
+ });
14
+ //# sourceMappingURL=Logo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logo.js","sourceRoot":"","sources":["../../src/ui-kit/Logo.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAO5B,MAAM,UAAU,GAAG;IACjB,w5CAAw5C;IACx5C,2OAA2O;IAC3O,0JAA0J;IAC1J,gpBAAgpB;IAChpB,kDAAkD;CACnD,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CAAY,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;IACnE,OAAO,CACL,aACE,SAAS,EAAE,mDAAmD,SAAS,IAAI,EAAE,EAAE,EAC/E,IAAI,EAAE,IAAI,IAAI,kBAAkB,EAChC,MAAM,EAAC,QAAQ,aAEf,KAAC,GAAG,IAAC,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAC,WAAW,EAAC,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAI,EAC9F,eAAM,SAAS,EAAC,yCAAyC,YACtD,QAAQ,IAAI,gBAAgB,GACxB,IACL,CACL,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ interface SVGPath {
2
+ d: string;
3
+ fill?: string;
4
+ }
5
+ export interface SVGProps {
6
+ className?: string;
7
+ viewBox?: string;
8
+ fill?: string;
9
+ paths: SVGPath[];
10
+ }
11
+ export declare const SVG: (props: import("@redneckz/uni-jsx").PropsWithChildren<SVGProps, any>, context?: any) => any;
12
+ export {};
@@ -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 SVG = JSX(({ className, viewBox, fill = 'none', paths }) => {
4
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: className, viewBox: viewBox, fill: fill, children: paths.map(({ d, fill }, i) => _jsx("path", { d: d, fill: fill || 'currentColor' }, i)) }));
5
+ });
6
+ //# sourceMappingURL=SVG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SVG.js","sourceRoot":"","sources":["../../src/ui-kit/SVG.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAcxC,MAAM,CAAC,MAAM,GAAG,GAAG,GAAG,CAAW,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IAChF,OAAO,CACL,cAAK,KAAK,EAAC,4BAA4B,EAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,YACvF,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,eAAc,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,cAAc,IAArC,CAAC,CAAwC,CAAC,GAChF,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { LinkContent } from './Link';
2
+ export interface TopItemContent extends LinkContent {
3
+ active?: boolean;
4
+ }
5
+ export interface TopItemProps extends TopItemContent {
6
+ className?: string;
7
+ onClick?: (ev: MouseEvent) => any;
8
+ }
9
+ export declare const TopItem: (props: import("@redneckz/uni-jsx").PropsWithChildren<TopItemProps, any>, context?: any) => any;
@@ -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 TopItem = JSX(({ className, text, href, target, active, onClick, children }) => {
4
+ const linkStyle = active ? 'border-brand rounded-3xl' : 'border-transparent';
5
+ const textStyle = active ? 'text-brand' : 'text-black hover:text-brand';
6
+ return (_jsx("a", { className: `${linkStyle} border border-solid inline-block bg-transparent px-4 py-2 text-center font-sans no-underline ${className || ''}`, href: href, target: target, onClick: onClick, children: _jsx("span", { className: `${textStyle} text-base font-normal`, children: text || children }) }));
7
+ });
8
+ //# sourceMappingURL=TopItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TopItem.js","sourceRoot":"","sources":["../../src/ui-kit/TopItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAYxC,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CACxB,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,0BAA0B,CAAC,CAAC,CAAC,oBAAoB,CAAC;IAC7E,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,6BAA6B,CAAC;IACxE,OAAO,CACL,YACE,SAAS,EAAE,GAAG,SAAS,iGACrB,SAAS,IAAI,EACf,EAAE,EACF,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,YAEhB,eAAM,SAAS,EAAE,GAAG,SAAS,wBAAwB,YAAG,IAAI,IAAI,QAAQ,GAAQ,GAC9E,CACL,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ContentPageContext } from './ContentPageContext';
2
+ import type { LinkContent } from './ui-kit/Link';
3
+ export declare function useLink({ useRouter, handlerDecorator }: ContentPageContext, link: Partial<LinkContent>): {
4
+ onClick: (ev: MouseEvent) => void;
5
+ text?: string | undefined;
6
+ href?: string | undefined;
7
+ target?: string | undefined;
8
+ };
package/lib/useLink.js ADDED
@@ -0,0 +1,17 @@
1
+ const defaultHandlerDecorator = (_) => _;
2
+ export function useLink({ useRouter, handlerDecorator = defaultHandlerDecorator }, link) {
3
+ const router = useRouter();
4
+ const { href, target } = link;
5
+ return {
6
+ ...link,
7
+ onClick: handlerDecorator((ev) => {
8
+ const isLocalHref = href && !href.includes('//');
9
+ const isLocalTarget = !target || target === '_self';
10
+ if (isLocalHref && isLocalTarget) {
11
+ ev.preventDefault();
12
+ router.push(href);
13
+ }
14
+ }),
15
+ };
16
+ }
17
+ //# sourceMappingURL=useLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLink.js","sourceRoot":"","sources":["../src/useLink.ts"],"names":[],"mappings":"AAGA,MAAM,uBAAuB,GAAoC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAE1E,MAAM,UAAU,OAAO,CACrB,EAAE,SAAS,EAAE,gBAAgB,GAAG,uBAAuB,EAAsB,EAC7E,IAA0B;IAE1B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC9B,OAAO;QACL,GAAG,IAAI;QACP,OAAO,EAAE,gBAAgB,CAAC,CAAC,EAAc,EAAE,EAAE;YAC3C,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACjD,MAAM,aAAa,GAAG,CAAC,MAAM,IAAI,MAAM,KAAK,OAAO,CAAC;YACpD,IAAI,WAAW,IAAI,aAAa,EAAE;gBAChC,EAAE,CAAC,cAAc,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACnB;QACH,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.2.29",
3
+ "version": "0.2.30",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -96,4 +96,4 @@
96
96
  "webpack": "^5.72.0",
97
97
  "webpack-cli": "^4.9.2"
98
98
  }
99
- }
99
+ }