@redneckz/wildless-cms-uni-blocks 0.1.8 → 0.2.10

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 (92) hide show
  1. package/dist/Blocks.d.ts +1 -4
  2. package/dist/Blocks.js +2 -0
  3. package/dist/Blocks.js.map +1 -1
  4. package/dist/ContentPage.d.ts +1 -2
  5. package/dist/ContentPage.js.map +1 -1
  6. package/dist/ContentPageHead.d.ts +6 -0
  7. package/dist/ContentPageHead.js +11 -0
  8. package/dist/ContentPageHead.js.map +1 -0
  9. package/dist/Img.d.ts +7 -0
  10. package/dist/Img.js +11 -0
  11. package/dist/Img.js.map +1 -0
  12. package/dist/RichText.d.ts +1 -0
  13. package/dist/RichText.js +3 -2
  14. package/dist/RichText.js.map +1 -1
  15. package/dist/TextWithImage.d.ts +9 -0
  16. package/dist/TextWithImage.js +9 -0
  17. package/dist/TextWithImage.js.map +1 -0
  18. package/dist/common.css +1 -1
  19. package/dist/content-page-repository/ContentPageRepository.d.ts +6 -0
  20. package/dist/content-page-repository/ContentPageRepository.js +35 -0
  21. package/dist/content-page-repository/ContentPageRepository.js.map +1 -0
  22. package/dist/content-page-repository/TransformationOptions.d.ts +4 -0
  23. package/dist/content-page-repository/TransformationOptions.js +2 -0
  24. package/dist/content-page-repository/TransformationOptions.js.map +1 -0
  25. package/dist/content-page-repository/index.d.ts +1 -0
  26. package/dist/content-page-repository/index.js +5 -0
  27. package/dist/content-page-repository/index.js.map +1 -0
  28. package/dist/content-page-repository/mapJSON.d.ts +1 -0
  29. package/dist/content-page-repository/mapJSON.js +25 -0
  30. package/dist/content-page-repository/mapJSON.js.map +1 -0
  31. package/dist/content-page-repository/transformContentPage.d.ts +3 -0
  32. package/dist/content-page-repository/transformContentPage.js +27 -0
  33. package/dist/content-page-repository/transformContentPage.js.map +1 -0
  34. package/dist/content-page-repository/transformMarkdown.d.ts +1 -0
  35. package/dist/content-page-repository/transformMarkdown.js +19 -0
  36. package/dist/content-page-repository/transformMarkdown.js.map +1 -0
  37. package/dist/content-page-repository/transformPicture.d.ts +3 -0
  38. package/dist/content-page-repository/transformPicture.js +47 -0
  39. package/dist/content-page-repository/transformPicture.js.map +1 -0
  40. package/dist/gatsby/GatsbyPage.d.ts +1 -2
  41. package/dist/gatsby/GatsbyPage.js.map +1 -1
  42. package/dist/index.d.ts +2 -2
  43. package/dist/index.js +3 -1
  44. package/dist/index.js.map +1 -1
  45. package/dist/types.d.ts +30 -4
  46. package/dist/types.js.map +1 -1
  47. package/lib/Blocks.d.ts +1 -4
  48. package/lib/Blocks.js +2 -0
  49. package/lib/Blocks.js.map +1 -1
  50. package/lib/ContentPage.d.ts +1 -2
  51. package/lib/ContentPage.js.map +1 -1
  52. package/lib/ContentPageHead.d.ts +6 -0
  53. package/lib/ContentPageHead.js +9 -0
  54. package/lib/ContentPageHead.js.map +1 -0
  55. package/lib/Img.d.ts +7 -0
  56. package/lib/Img.js +8 -0
  57. package/lib/Img.js.map +1 -0
  58. package/lib/RichText.d.ts +1 -0
  59. package/lib/RichText.js +3 -2
  60. package/lib/RichText.js.map +1 -1
  61. package/lib/TextWithImage.d.ts +9 -0
  62. package/lib/TextWithImage.js +7 -0
  63. package/lib/TextWithImage.js.map +1 -0
  64. package/lib/content-page-repository/ContentPageRepository.d.ts +6 -0
  65. package/lib/content-page-repository/ContentPageRepository.js +29 -0
  66. package/lib/content-page-repository/ContentPageRepository.js.map +1 -0
  67. package/lib/content-page-repository/TransformationOptions.d.ts +4 -0
  68. package/lib/content-page-repository/TransformationOptions.js +2 -0
  69. package/lib/content-page-repository/TransformationOptions.js.map +1 -0
  70. package/lib/content-page-repository/index.d.ts +1 -0
  71. package/lib/content-page-repository/index.js +2 -0
  72. package/lib/content-page-repository/index.js.map +1 -0
  73. package/lib/content-page-repository/mapJSON.d.ts +1 -0
  74. package/lib/content-page-repository/mapJSON.js +22 -0
  75. package/lib/content-page-repository/mapJSON.js.map +1 -0
  76. package/lib/content-page-repository/transformContentPage.d.ts +3 -0
  77. package/lib/content-page-repository/transformContentPage.js +21 -0
  78. package/lib/content-page-repository/transformContentPage.js.map +1 -0
  79. package/lib/content-page-repository/transformMarkdown.d.ts +1 -0
  80. package/lib/content-page-repository/transformMarkdown.js +13 -0
  81. package/lib/content-page-repository/transformMarkdown.js.map +1 -0
  82. package/lib/content-page-repository/transformPicture.d.ts +3 -0
  83. package/lib/content-page-repository/transformPicture.js +41 -0
  84. package/lib/content-page-repository/transformPicture.js.map +1 -0
  85. package/lib/gatsby/GatsbyPage.d.ts +1 -2
  86. package/lib/gatsby/GatsbyPage.js.map +1 -1
  87. package/lib/index.d.ts +2 -2
  88. package/lib/index.js +1 -0
  89. package/lib/index.js.map +1 -1
  90. package/lib/types.d.ts +30 -4
  91. package/lib/types.js.map +1 -1
  92. package/package.json +12 -3
package/dist/Blocks.d.ts CHANGED
@@ -1,9 +1,6 @@
1
- import type { PlaceholderContent } from './Placeholder';
2
- import type { RichTextContent } from './RichText';
3
- import type { TextContent } from './Text';
4
- export declare type BlockContent = PlaceholderContent | TextContent | RichTextContent;
5
1
  export declare const Blocks: {
6
2
  Text: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Text").TextProps, any>, context?: any) => any;
3
+ TextWithImage: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./TextWithImage").TextWithImageProps, any>, context?: any) => any;
7
4
  RichText: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./RichText").RichTextProps, any>, context?: any) => any;
8
5
  Placeholder: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Placeholder").PlaceholderProps, any>, context?: any) => any;
9
6
  };
package/dist/Blocks.js CHANGED
@@ -3,8 +3,10 @@ exports.Blocks = void 0;
3
3
  const Placeholder_1 = require("./Placeholder");
4
4
  const RichText_1 = require("./RichText");
5
5
  const Text_1 = require("./Text");
6
+ const TextWithImage_1 = require("./TextWithImage");
6
7
  exports.Blocks = {
7
8
  Text: Text_1.Text,
9
+ TextWithImage: TextWithImage_1.TextWithImage,
8
10
  RichText: RichText_1.RichText,
9
11
  Placeholder: Placeholder_1.Placeholder,
10
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Blocks.js","sourceRoot":"","sources":["../src/Blocks.ts"],"names":[],"mappings":";;AACA,+CAA4C;AAE5C,yCAAsC;AAEtC,iCAA8B;AAIjB,QAAA,MAAM,GAAG;IACpB,IAAI,EAAJ,WAAI;IACJ,QAAQ,EAAR,mBAAQ;IACR,WAAW,EAAX,yBAAW;CACZ,CAAC"}
1
+ {"version":3,"file":"Blocks.js","sourceRoot":"","sources":["../src/Blocks.ts"],"names":[],"mappings":";;AAAA,+CAA4C;AAC5C,yCAAsC;AACtC,iCAA8B;AAC9B,mDAAgD;AAEnC,QAAA,MAAM,GAAG;IACpB,IAAI,EAAJ,WAAI;IACJ,aAAa,EAAb,6BAAa;IACb,QAAQ,EAAR,mBAAQ;IACR,WAAW,EAAX,yBAAW;CACZ,CAAC"}
@@ -1,6 +1,5 @@
1
- import type { BlockContent } from './Blocks';
2
1
  import type { ContentPageDef } from './types';
3
2
  export interface ContentPageProps {
4
- data: ContentPageDef<BlockContent>;
3
+ data: ContentPageDef;
5
4
  }
6
5
  export declare const ContentPage: (props: import("@redneckz/uni-jsx").PropsWithChildren<ContentPageProps, any>, context?: any) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"ContentPage.js","sourceRoot":"","sources":["../src/ContentPage.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,qCAAkC;AAQrB,QAAA,WAAW,GAAG,IAAA,aAAG,EAC5B,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAC1C,oCAAS,SAAS,EAAE,qBAAqB,eAAe,CAAC,SAAS,CAAC,EAAE,YAClE,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,GAC1B,CACX,CACF,CAAC;AAEF,SAAS,WAAW,CA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D,OAAO,IAAI,CAAC;KACb;IACD,MAAM,cAAc,GAAG,eAAM,CAAC,IAA2B,CAAC,CAAC;IAC3D,OAAO,CACL,uBAAC,cAAc,IAEb,SAAS,EAAE,6CAA6C,eAAe,CACrE,KAAK,CACN,EAAE,KACC,OAAO,YAEV,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,IAN7B,GAAG,IAAI,IAAI,CAAC,EAAE,CAOJ,CAClB,CAAC;AACJ,CAAC;AAED,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,6 @@
1
+ import type { ContentPageMeta } from './types';
2
+ export interface ContentPageHeadProps {
3
+ HeadComponent: Function;
4
+ data: ContentPageMeta;
5
+ }
6
+ export declare const ContentPageHead: (props: import("@redneckz/uni-jsx").PropsWithChildren<ContentPageHeadProps, any>, context?: any) => any;
@@ -0,0 +1,11 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.ContentPageHead = void 0;
3
+ const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
+ const uni_jsx_1 = require("@redneckz/uni-jsx");
5
+ exports.ContentPageHead = (0, uni_jsx_1.JSX)(({ HeadComponent, data, children }) => {
6
+ const { title, description, keywords, robots, og } = data;
7
+ return ((0, jsx_runtime_1.jsxs)(HeadComponent, { children: [(0, jsx_runtime_1.jsx)("title", { children: title }), (0, jsx_runtime_1.jsx)("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), description && (0, jsx_runtime_1.jsx)("meta", { name: "description", content: description }), keywords && (0, jsx_runtime_1.jsx)("meta", { name: "keywords", content: keywords.join(',') }), robots && (0, jsx_runtime_1.jsx)("meta", { name: "robots", content: robots.join(',') }), og
8
+ ? Object.entries(og).map(([key, value]) => ((0, jsx_runtime_1.jsx)("meta", { name: `og:${key}`, content: value }, key)))
9
+ : null, children] }));
10
+ });
11
+ //# sourceMappingURL=ContentPageHead.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentPageHead.js","sourceRoot":"","sources":["../src/ContentPageHead.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAQ3B,QAAA,eAAe,GAAG,IAAA,aAAG,EAAuB,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC7F,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;IAC1D,OAAO,CACL,wBAAC,aAAa,eACZ,4CAAQ,KAAK,GAAS,EACtB,iCAAM,IAAI,EAAC,UAAU,EAAC,OAAO,EAAC,qCAAqC,GAAG,EACrE,WAAW,IAAI,iCAAM,IAAI,EAAC,aAAa,EAAC,OAAO,EAAE,WAAW,GAAI,EAChE,QAAQ,IAAI,iCAAM,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,GAAI,EACjE,MAAM,IAAI,iCAAM,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAI,EAC3D,EAAE;gBACD,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CACvC,iCAAgB,IAAI,EAAE,MAAM,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,IAAtC,GAAG,CAAuC,CACtD,CAAC;gBACJ,CAAC,CAAC,IAAI,EACP,QAAQ,IACK,CACjB,CAAC;AACJ,CAAC,CAAC,CAAA"}
package/dist/Img.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { Picture, ImgSource } from './types';
2
+ export interface TextWithImageProps {
3
+ className?: string;
4
+ image: Picture;
5
+ }
6
+ export declare const Img: (props: import("@redneckz/uni-jsx").PropsWithChildren<TextWithImageProps, any>, context?: any) => any;
7
+ export declare function formatToMimeType(format: ImgSource['format']): string | undefined;
package/dist/Img.js ADDED
@@ -0,0 +1,11 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.formatToMimeType = exports.Img = void 0;
3
+ const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
+ const uni_jsx_1 = require("@redneckz/uni-jsx");
5
+ exports.Img = (0, uni_jsx_1.JSX)(({ className, image }) => ((0, jsx_runtime_1.jsxs)("picture", { className: className || '', children: [image.sources &&
6
+ image.sources.map(({ src, format }) => ((0, jsx_runtime_1.jsx)("source", { srcSet: src, type: formatToMimeType(format) }, src))), (0, jsx_runtime_1.jsx)("img", { src: image.src, alt: image.alt, title: image.title })] })));
7
+ function formatToMimeType(format) {
8
+ return format && `image/${format}`;
9
+ }
10
+ exports.formatToMimeType = formatToMimeType;
11
+ //# sourceMappingURL=Img.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Img.js","sourceRoot":"","sources":["../src/Img.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAQ3B,QAAA,GAAG,GAAG,IAAA,aAAG,EAAqB,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACnE,qCAAS,SAAS,EAAE,SAAS,IAAI,EAAE,aAChC,KAAK,CAAC,OAAO;YACZ,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CACrC,mCAAkB,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,IAAhD,GAAG,CAAiD,CAClE,CAAC,EACJ,gCAAK,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAI,IACnD,CACX,CAAC,CAAC;AAEH,SAAgB,gBAAgB,CAC9B,MAA2B;IAE3B,OAAO,MAAM,IAAI,SAAS,MAAM,EAAE,CAAC;AACrC,CAAC;AAJD,4CAIC"}
@@ -1,5 +1,6 @@
1
1
  export interface RichTextContent {
2
2
  __html?: string;
3
+ __md?: string;
3
4
  }
4
5
  export interface RichTextProps extends RichTextContent {
5
6
  className?: string;
package/dist/RichText.js CHANGED
@@ -2,8 +2,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
2
2
  exports.RichText = void 0;
3
3
  const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
4
  const uni_jsx_1 = require("@redneckz/uni-jsx");
5
- exports.RichText = (0, uni_jsx_1.JSX)(({ className, __html }) => {
6
- const props = Object.assign({ className: className || '' }, __html ? { dangerouslySetInnerHTML: { __html } } : {});
5
+ exports.RichText = (0, uni_jsx_1.JSX)(({ className, __html, __md }) => {
6
+ const html = __html || __md;
7
+ const props = Object.assign({ className: className || '' }, html ? { dangerouslySetInnerHTML: { __html: html } } : {});
7
8
  return (0, jsx_runtime_1.jsx)("div", { ...props });
8
9
  });
9
10
  //# sourceMappingURL=RichText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RichText.js","sourceRoot":"","sources":["../src/RichText.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAU3B,QAAA,QAAQ,GAAG,IAAA,aAAG,EAAgB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE;IACnE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CACzB,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE,EAAE,EAC9B,MAAM,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CACtD,CAAC;IACF,OAAO,mCAAS,KAAK,GAAI,CAAC;AAC5B,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"RichText.js","sourceRoot":"","sources":["../src/RichText.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAW3B,QAAA,QAAQ,GAAG,IAAA,aAAG,EAAgB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;IACzE,MAAM,IAAI,GAAG,MAAM,IAAI,IAAI,CAAC;IAC5B,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CACzB,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE,EAAE,EAC9B,IAAI,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAC1D,CAAC;IACF,OAAO,mCAAS,KAAK,GAAI,CAAC;AAC5B,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Picture } from './types';
2
+ export interface TextWithImageContent {
3
+ primary?: string;
4
+ image?: Picture;
5
+ }
6
+ export interface TextWithImageProps extends TextWithImageContent {
7
+ className?: string;
8
+ }
9
+ export declare const TextWithImage: (props: import("@redneckz/uni-jsx").PropsWithChildren<TextWithImageProps, any>, context?: any) => any;
@@ -0,0 +1,9 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.TextWithImage = void 0;
3
+ const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
+ const uni_jsx_1 = require("@redneckz/uni-jsx");
5
+ const Img_1 = require("./Img");
6
+ exports.TextWithImage = (0, uni_jsx_1.JSX)(({ className, primary, image }) => {
7
+ return ((0, jsx_runtime_1.jsxs)("div", { className: className || '', children: [primary && ((0, jsx_runtime_1.jsx)("p", { className: "font-bold text-slate-700 leading-snug", children: primary })), image && (0, jsx_runtime_1.jsx)(Img_1.Img, { image: image })] }));
8
+ });
9
+ //# sourceMappingURL=TextWithImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextWithImage.js","sourceRoot":"","sources":["../src/TextWithImage.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,+BAA4B;AAYf,QAAA,aAAa,GAAG,IAAA,aAAG,EAC9B,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IAChC,OAAO,CACL,iCAAK,SAAS,EAAE,SAAS,IAAI,EAAE,aAC5B,OAAO,IAAI,CACV,8BAAG,SAAS,EAAC,uCAAuC,YAAE,OAAO,GAAK,CACnE,EACA,KAAK,IAAI,uBAAC,SAAG,IAAC,KAAK,EAAE,KAAK,GAAI,IAC3B,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
package/dist/common.css CHANGED
@@ -1 +1 @@
1
- .mt-2{margin-top:.5rem}.block{display:block}.grid{display:grid}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.border-2{border-width:2px}.border-dashed{border-style:dashed}.border-sky-500{--tw-border-opacity:1;border-color:rgb(14 165 233/var(--tw-border-opacity))}.p-4{padding:1rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-bold{font-weight:700}.leading-snug{line-height:1.375}.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))}
1
+ .relative{position:relative}.mt-2{margin-top:.5rem}.block{display:block}.grid{display:grid}.resize{resize:both}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.border-2{border-width:2px}.border-dashed{border-style:dashed}.border-sky-500{--tw-border-opacity:1;border-color:rgb(14 165 233/var(--tw-border-opacity))}.p-4{padding:1rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-bold{font-weight:700}.leading-snug{line-height:1.375}.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))}.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)}
@@ -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,CACjC,IAAY;QAEZ,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;AA/BD,sDA+BC"}
@@ -0,0 +1,4 @@
1
+ export interface TransformationOptions {
2
+ contentDir: string;
3
+ publicDir: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
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,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,25 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.mapJSON = void 0;
3
+ async function mapJSON(data, mapper, key = []) {
4
+ if (!data)
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' &&
14
+ data.toString() === '[object Object]') {
15
+ const subKeys = Object.keys(data);
16
+ const values = subKeys.map((k) => mapJSON(data[k], mapper, [k].concat(key)));
17
+ const pairs = (await Promise.all(values)).map((_, i) => ({
18
+ [subKeys[i]]: _,
19
+ }));
20
+ return Object.assign({}, ...pairs);
21
+ }
22
+ return mapper(data, key);
23
+ }
24
+ exports.mapJSON = mapJSON;
25
+ //# sourceMappingURL=mapJSON.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapJSON.js","sourceRoot":"","sources":["../../src/content-page-repository/mapJSON.ts"],"names":[],"mappings":";;AAAO,KAAK,UAAU,OAAO,CAC3B,IAAO,EACP,MAAgE,EAChE,MAAgB,EAAE;IAElB,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,MAAM,UAAU,GAAG,MAA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TransformationOptions';
3
+ export declare function transformContentPage(pagePath: string, options: TransformationOptions): Promise<ContentPageDef>;
@@ -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,EACZ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EACnB,KAAK,EAAE,KAAU,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE;QAC1B,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,CACF,CAAC;AACJ,CAAC;AAlBD,oDAkBC"}
@@ -0,0 +1 @@
1
+ export declare function transformMarkdown(markdown: string | null | undefined): Promise<string>;
@@ -0,0 +1,19 @@
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)()
13
+ .use(remark_parse_1.default)
14
+ .use(remark_html_1.default)
15
+ .process(markdown);
16
+ return result.toString('utf-8');
17
+ }
18
+ exports.transformMarkdown = transformMarkdown;
19
+ //# 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,CACrC,QAAmC;IAEnC,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEzB,MAAM,MAAM,GAAG,MAAM,IAAA,iBAAO,GAAE;SAC3B,GAAG,CAAC,sBAAW,CAAC;SAChB,GAAG,CAAC,qBAAU,CAAC;SACf,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrB,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AAVD,8CAUC"}
@@ -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,47 @@
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]
14
+ .concat(sources)
15
+ .map((_) => transformImg(pagePath, picture.src, { ...options, ..._ })));
16
+ return {
17
+ ...picture,
18
+ src: transformedPicture,
19
+ sources: transformedSources.map((_, i) => ({
20
+ ...sources[i],
21
+ src: _,
22
+ })),
23
+ };
24
+ }
25
+ exports.transformPicture = transformPicture;
26
+ async function transformImg(pagePath, src, transformationOptions) {
27
+ const { contentDir, publicDir, format, options, size } = transformationOptions;
28
+ const imgPath = `${path_1.default.dirname(pagePath)}/${src}`;
29
+ let chain = (0, sharp_1.default)(imgPath);
30
+ if (size)
31
+ chain = chain.resize(size);
32
+ if (format)
33
+ chain = chain.toFormat(format, options);
34
+ const transformedSrc = transformSrc(src, transformationOptions);
35
+ const transformedImgPath = `${publicDir}/${path_1.default.relative(contentDir, `${path_1.default.dirname(pagePath)}/${transformedSrc}`)}`;
36
+ await mkdir(path_1.default.dirname(transformedImgPath), { recursive: true });
37
+ await chain.toFile(transformedImgPath);
38
+ return transformedSrc;
39
+ }
40
+ function transformSrc(src, { format, size }) {
41
+ const noTransform = !format && !size;
42
+ if (noTransform)
43
+ return src;
44
+ const suffix = [size?.width, size?.height].filter(Boolean).join('-');
45
+ return `${path_1.default.basename(src, path_1.default.extname(src))}${suffix ? `-${suffix}` : ''}.${format || path_1.default.extname(src)}`;
46
+ }
47
+ //# 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;SACN,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CACzE,CAAC;IACF,OAAO;QACL,GAAG,OAAO;QACV,GAAG,EAAE,kBAAkB;QACvB,OAAO,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC,CA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AAG,CAAC;IAE5B,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrE,OAAO,GAAG,cAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAC7C,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAC1B,IAAI,MAAM,IAAI,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;AACpC,CAAC"}
@@ -1,8 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { PageProps } from 'gatsby';
3
- import type { BlockContent } from '../Blocks';
4
3
  import type { ContentPageDef } from '../types';
5
4
  import '@redneckz/wildless-cms-uni-blocks/dist/common.css';
6
- declare type PageData<D extends string> = Record<D, ContentPageDef<BlockContent>>;
5
+ declare type PageData<D extends string> = Record<D, ContentPageDef>;
7
6
  export declare const GatsbyPage: <D extends string>(discriminator: D) => ({ data }: PageProps<PageData<D>, object, unknown, object>) => JSX.Element;
8
7
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"GatsbyPage.js","sourceRoot":"","sources":["../../src/gatsby/GatsbyPage.tsx"],"names":[],"mappings":";;;;;;AAAA,+CAA0C;AAE1C,oEAAwC;AAExC,gDAA6C;AAG7C,6DAA2D;AAE3D,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,qBAAc,CAAC;AACrC,IAAA,eAAK,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAIV,MAAM,UAAU,GACrB,CAAmB,aAAgB,EAAE,EAAE,CACvC,CAAC,EAAE,IAAI,EAA0B,EAAE,EAAE,CACnC,uBAAC,yBAAW,IAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,GAAI,CAAC;AAHlC,QAAA,UAAU,cAGwB"}
1
+ {"version":3,"file":"GatsbyPage.js","sourceRoot":"","sources":["../../src/gatsby/GatsbyPage.tsx"],"names":[],"mappings":";;;;;;AAAA,+CAA0C;AAE1C,oEAAwC;AACxC,gDAA6C;AAG7C,6DAA2D;AAE3D,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,qBAAc,CAAC;AACrC,IAAA,eAAK,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAIV,MAAM,UAAU,GACrB,CAAmB,aAAgB,EAAE,EAAE,CACvC,CAAC,EAAE,IAAI,EAA0B,EAAE,EAAE,CACnC,uBAAC,yBAAW,IAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,GAAI,CAAC;AAHlC,QAAA,UAAU,cAGwB"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { BlockDef, ContentPageDef } from './types';
2
- export type { BlockContent } from './Blocks';
1
+ export type { BlockDef, ContentPageMeta, ContentPageDef, Img, ImgSource, Picture, } from './types';
3
2
  export { Blocks } from './Blocks';
3
+ export { ContentPageHead } from './ContentPageHead';
4
4
  export { ContentPage } from './ContentPage';
package/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.ContentPage = exports.Blocks = void 0;
2
+ exports.ContentPage = exports.ContentPageHead = exports.Blocks = void 0;
3
3
  var Blocks_1 = require("./Blocks");
4
4
  Object.defineProperty(exports, "Blocks", { enumerable: true, get: function () { return Blocks_1.Blocks; } });
5
+ var ContentPageHead_1 = require("./ContentPageHead");
6
+ Object.defineProperty(exports, "ContentPageHead", { enumerable: true, get: function () { return ContentPageHead_1.ContentPageHead; } });
5
7
  var ContentPage_1 = require("./ContentPage");
6
8
  Object.defineProperty(exports, "ContentPage", { enumerable: true, get: function () { return ContentPage_1.ContentPage; } });
7
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAGA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AAEf,6CAA4C;AAAnC,0GAAA,WAAW,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AASA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AAEf,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA"}
package/dist/types.d.ts CHANGED
@@ -1,14 +1,40 @@
1
- export interface BlockDef<BlockContent> {
1
+ import type { AvifOptions, FormatEnum, GifOptions, HeifOptions, JpegOptions, PngOptions, ResizeOptions, TiffOptions, WebpOptions } from 'sharp';
2
+ import type { PlaceholderContent } from './Placeholder';
3
+ import type { RichTextContent } from './RichText';
4
+ import type { TextContent } from './Text';
5
+ import type { TextWithImageContent } from './TextWithImage';
6
+ export declare type BlockContent = TextContent | TextWithImageContent | RichTextContent | PlaceholderContent;
7
+ export interface BlockDef {
2
8
  type: string;
3
9
  style?: string[];
4
10
  content?: BlockContent;
5
- blocks?: BlockDef<BlockContent>[];
11
+ blocks?: BlockDef[];
6
12
  }
7
- export interface ContentPageDef<BlockContent> {
13
+ export interface ContentPageMeta {
8
14
  title: string;
9
15
  slug: string;
16
+ description?: string;
17
+ keywords?: string[];
18
+ robots?: string[];
19
+ og?: Record<string, string>;
20
+ }
21
+ export interface ContentPageDef extends ContentPageMeta {
10
22
  style?: string[];
11
- blocks?: BlockDef<BlockContent>[];
23
+ blocks?: BlockDef[];
24
+ }
25
+ export interface Img {
26
+ src: string;
27
+ alt?: string;
28
+ title?: string;
29
+ }
30
+ export interface ImgSource {
31
+ src: string;
32
+ format?: keyof FormatEnum;
33
+ options?: JpegOptions | PngOptions | WebpOptions | AvifOptions | HeifOptions | GifOptions | TiffOptions;
34
+ size?: ResizeOptions;
35
+ }
36
+ export interface Picture extends Img, ImgSource {
37
+ sources?: ImgSource[];
12
38
  }
13
39
  export declare const GraphQL: {
14
40
  Block: string;
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;AAca,QAAA,OAAO,GAAG;IACrB,KAAK,EAAE;;;;;;;;;;;;;GAaN;IACD,IAAI,EAAE;;;;;;GAML;CACF,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;AAmEa,QAAA,OAAO,GAAG;IACrB,KAAK,EAAE;;;;;;;;;;;;;GAaN;IACD,IAAI,EAAE;;;;;;GAML;CACF,CAAC"}
package/lib/Blocks.d.ts CHANGED
@@ -1,9 +1,6 @@
1
- import type { PlaceholderContent } from './Placeholder';
2
- import type { RichTextContent } from './RichText';
3
- import type { TextContent } from './Text';
4
- export declare type BlockContent = PlaceholderContent | TextContent | RichTextContent;
5
1
  export declare const Blocks: {
6
2
  Text: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Text").TextProps, any>, context?: any) => any;
3
+ TextWithImage: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./TextWithImage").TextWithImageProps, any>, context?: any) => any;
7
4
  RichText: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./RichText").RichTextProps, any>, context?: any) => any;
8
5
  Placeholder: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Placeholder").PlaceholderProps, any>, context?: any) => any;
9
6
  };
package/lib/Blocks.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import { Placeholder } from './Placeholder';
2
2
  import { RichText } from './RichText';
3
3
  import { Text } from './Text';
4
+ import { TextWithImage } from './TextWithImage';
4
5
  export const Blocks = {
5
6
  Text,
7
+ TextWithImage,
6
8
  RichText,
7
9
  Placeholder,
8
10
  };
package/lib/Blocks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Blocks.js","sourceRoot":"","sources":["../src/Blocks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAI9B,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI;IACJ,QAAQ;IACR,WAAW;CACZ,CAAC"}
1
+ {"version":3,"file":"Blocks.js","sourceRoot":"","sources":["../src/Blocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI;IACJ,aAAa;IACb,QAAQ;IACR,WAAW;CACZ,CAAC"}
@@ -1,6 +1,5 @@
1
- import type { BlockContent } from './Blocks';
2
1
  import type { ContentPageDef } from './types';
3
2
  export interface ContentPageProps {
4
- data: ContentPageDef<BlockContent>;
3
+ data: ContentPageDef;
5
4
  }
6
5
  export declare const ContentPage: (props: import("@redneckz/uni-jsx").PropsWithChildren<ContentPageProps, any>, context?: any) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"ContentPage.js","sourceRoot":"","sources":["../src/ContentPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAQlC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAC5B,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAC1C,kBAAS,SAAS,EAAE,qBAAqB,eAAe,CAAC,SAAS,CAAC,EAAE,YAClE,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,GAC1B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AAC,CAAC,IAAI,IAAI,MAAM,CAAC,EAAE;QACrB,OAAO,CAAC,IAAI,CAAC,kBAAkB,IAAI,iBAAiB,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;KACb;IACD,MAAM,cAAc,GAAG,MAAM,CAAC,IAA2B,CAAC,CAAC;IAC3D,OAAO,CACL,KAAC,cAAc,IAEb,SAAS,EAAE,6CAA6C,eAAe,CACrE,KAAK,CACN,EAAE,KACC,OAAO,YAEV,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,IAN7B,GAAG,IAAI,IAAI,CAAC,EAAE,CAOJ,CAClB,CAAC;AACJ,CAAC;AAED,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,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,CAAA"}
package/lib/Img.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { Picture, ImgSource } from './types';
2
+ export interface TextWithImageProps {
3
+ className?: string;
4
+ image: Picture;
5
+ }
6
+ export declare const Img: (props: import("@redneckz/uni-jsx").PropsWithChildren<TextWithImageProps, any>, context?: any) => any;
7
+ export declare function formatToMimeType(format: ImgSource['format']): string | undefined;
package/lib/Img.js ADDED
@@ -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
+ export const Img = JSX(({ className, image }) => (_jsxs("picture", { className: className || '', children: [image.sources &&
4
+ image.sources.map(({ src, format }) => (_jsx("source", { srcSet: src, type: formatToMimeType(format) }, src))), _jsx("img", { src: image.src, alt: image.alt, title: image.title })] })));
5
+ export function formatToMimeType(format) {
6
+ return format && `image/${format}`;
7
+ }
8
+ //# 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;YACZ,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CACrC,iBAAkB,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,IAAhD,GAAG,CAAiD,CAClE,CAAC,EACJ,cAAK,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAI,IACnD,CACX,CAAC,CAAC;AAEH,MAAM,UAAU,gBAAgB,CAC9B,MAA2B;IAE3B,OAAO,MAAM,IAAI,SAAS,MAAM,EAAE,CAAC;AACrC,CAAC"}
package/lib/RichText.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export interface RichTextContent {
2
2
  __html?: string;
3
+ __md?: string;
3
4
  }
4
5
  export interface RichTextProps extends RichTextContent {
5
6
  className?: string;
package/lib/RichText.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
2
  import { JSX } from '@redneckz/uni-jsx';
3
- export const RichText = JSX(({ className, __html }) => {
4
- const props = Object.assign({ className: className || '' }, __html ? { dangerouslySetInnerHTML: { __html } } : {});
3
+ export const RichText = JSX(({ className, __html, __md }) => {
4
+ const html = __html || __md;
5
+ const props = Object.assign({ className: className || '' }, html ? { dangerouslySetInnerHTML: { __html: html } } : {});
5
6
  return _jsx("div", { ...props });
6
7
  });
7
8
  //# sourceMappingURL=RichText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RichText.js","sourceRoot":"","sources":["../src/RichText.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAUxC,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAgB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE;IACnE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CACzB,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE,EAAE,EAC9B,MAAM,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CACtD,CAAC;IACF,OAAO,iBAAS,KAAK,GAAI,CAAC;AAC5B,CAAC,CAAC,CAAC"}
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"}
@@ -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';
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,CAC9B,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IAChC,OAAO,CACL,eAAK,SAAS,EAAE,SAAS,IAAI,EAAE,aAC5B,OAAO,IAAI,CACV,YAAG,SAAS,EAAC,uCAAuC,YAAE,OAAO,GAAK,CACnE,EACA,KAAK,IAAI,KAAC,GAAG,IAAC,KAAK,EAAE,KAAK,GAAI,IAC3B,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -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,29 @@
1
+ import glob from 'glob';
2
+ import util from 'util';
3
+ import { transformContentPage } from './transformContentPage';
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,CACjC,IAAY;QAEZ,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';
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,22 @@
1
+ export async function mapJSON(data, mapper, key = []) {
2
+ if (!data)
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' &&
12
+ data.toString() === '[object Object]') {
13
+ const subKeys = Object.keys(data);
14
+ const values = subKeys.map((k) => mapJSON(data[k], mapper, [k].concat(key)));
15
+ const pairs = (await Promise.all(values)).map((_, i) => ({
16
+ [subKeys[i]]: _,
17
+ }));
18
+ return Object.assign({}, ...pairs);
19
+ }
20
+ return mapper(data, key);
21
+ }
22
+ //# 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,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,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,CAC/B,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAC5C,CAAC;QACF,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAQ,CAAC;KACnC;SAAM,IACL,OAAO,IAAI,KAAK,QAAQ;QACvB,IAAY,CAAC,QAAQ,EAAE,KAAK,iBAAiB,EAC9C;QACA,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAC1C,CAAC;QACF,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';
4
+ import { transformMarkdown } from './transformMarkdown';
5
+ import { transformPicture } from './transformPicture';
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,CACZ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EACnB,KAAK,EAAE,KAAU,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE;QAC1B,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,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function transformMarkdown(markdown: string | null | undefined): Promise<string>;
@@ -0,0 +1,13 @@
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()
8
+ .use(remarkParse)
9
+ .use(remarkHtml)
10
+ .process(markdown);
11
+ return result.toString('utf-8');
12
+ }
13
+ //# 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,CACrC,QAAmC;IAEnC,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEzB,MAAM,MAAM,GAAG,MAAM,OAAO,EAAE;SAC3B,GAAG,CAAC,WAAW,CAAC;SAChB,GAAG,CAAC,UAAU,CAAC;SACf,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrB,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,41 @@
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]
9
+ .concat(sources)
10
+ .map((_) => transformImg(pagePath, picture.src, { ...options, ..._ })));
11
+ return {
12
+ ...picture,
13
+ src: transformedPicture,
14
+ sources: transformedSources.map((_, i) => ({
15
+ ...sources[i],
16
+ src: _,
17
+ })),
18
+ };
19
+ }
20
+ async function transformImg(pagePath, src, transformationOptions) {
21
+ const { contentDir, publicDir, format, options, size } = transformationOptions;
22
+ const imgPath = `${path.dirname(pagePath)}/${src}`;
23
+ let chain = sharp(imgPath);
24
+ if (size)
25
+ chain = chain.resize(size);
26
+ if (format)
27
+ chain = chain.toFormat(format, options);
28
+ const transformedSrc = transformSrc(src, transformationOptions);
29
+ const transformedImgPath = `${publicDir}/${path.relative(contentDir, `${path.dirname(pagePath)}/${transformedSrc}`)}`;
30
+ await mkdir(path.dirname(transformedImgPath), { recursive: true });
31
+ await chain.toFile(transformedImgPath);
32
+ return transformedSrc;
33
+ }
34
+ function transformSrc(src, { format, size }) {
35
+ const noTransform = !format && !size;
36
+ if (noTransform)
37
+ return src;
38
+ const suffix = [size?.width, size?.height].filter(Boolean).join('-');
39
+ return `${path.basename(src, path.extname(src))}${suffix ? `-${suffix}` : ''}.${format || path.extname(src)}`;
40
+ }
41
+ //# sourceMappingURL=transformPicture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformPicture.js","sourceRoot":"","sources":["../../src/content-page-repository/transformPicture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAEvC,MA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,kBAAkB,GAAG,GAAG,SAAS,IAAI,IAAI,CAAC,QAAQ,CACtD,UAAU,EACV,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,cAAc,EAAE,CAC9C,EAAE,CAAC;IAEJ,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACnE,MAAM,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAEvC,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,SAAS,YAAY,CACnB,GAAW,EACX,EAAE,MAAM,EAAE,IAAI,EAAqC;IAEnD,MAAM,WAAW,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC;IACrC,IAAI,WAAW;QAAE,OAAO,GAAG,CAAC;IAE5B,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrE,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAC7C,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAC1B,IAAI,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;AACpC,CAAC"}
@@ -1,8 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { PageProps } from 'gatsby';
3
- import type { BlockContent } from '../Blocks';
4
3
  import type { ContentPageDef } from '../types';
5
4
  import '@redneckz/wildless-cms-uni-blocks/dist/common.css';
6
- declare type PageData<D extends string> = Record<D, ContentPageDef<BlockContent>>;
5
+ declare type PageData<D extends string> = Record<D, ContentPageDef>;
7
6
  export declare const GatsbyPage: <D extends string>(discriminator: D) => ({ data }: PageProps<PageData<D>, object, unknown, object>) => JSX.Element;
8
7
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"GatsbyPage.js","sourceRoot":"","sources":["../../src/gatsby/GatsbyPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,mDAAmD,CAAC;AAE3D,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,OAAc,CAAC;AACrC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAIjB,MAAM,CAAC,MAAM,UAAU,GACrB,CAAmB,aAAgB,EAAE,EAAE,CACvC,CAAC,EAAE,IAAI,EAA0B,EAAE,EAAE,CACnC,KAAC,WAAW,IAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,GAAI,CAAC"}
1
+ {"version":3,"file":"GatsbyPage.js","sourceRoot":"","sources":["../../src/gatsby/GatsbyPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,mDAAmD,CAAC;AAE3D,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,OAAc,CAAC;AACrC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAIjB,MAAM,CAAC,MAAM,UAAU,GACrB,CAAmB,aAAgB,EAAE,EAAE,CACvC,CAAC,EAAE,IAAI,EAA0B,EAAE,EAAE,CACnC,KAAC,WAAW,IAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,GAAI,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { BlockDef, ContentPageDef } from './types';
2
- export type { BlockContent } from './Blocks';
1
+ export type { BlockDef, ContentPageMeta, ContentPageDef, Img, ImgSource, Picture, } from './types';
3
2
  export { Blocks } from './Blocks';
3
+ export { ContentPageHead } from './ContentPageHead';
4
4
  export { ContentPage } from './ContentPage';
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { Blocks } from './Blocks';
2
+ export { ContentPageHead } from './ContentPageHead';
2
3
  export { ContentPage } from './ContentPage';
3
4
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
package/lib/types.d.ts CHANGED
@@ -1,14 +1,40 @@
1
- export interface BlockDef<BlockContent> {
1
+ import type { AvifOptions, FormatEnum, GifOptions, HeifOptions, JpegOptions, PngOptions, ResizeOptions, TiffOptions, WebpOptions } from 'sharp';
2
+ import type { PlaceholderContent } from './Placeholder';
3
+ import type { RichTextContent } from './RichText';
4
+ import type { TextContent } from './Text';
5
+ import type { TextWithImageContent } from './TextWithImage';
6
+ export declare type BlockContent = TextContent | TextWithImageContent | RichTextContent | PlaceholderContent;
7
+ export interface BlockDef {
2
8
  type: string;
3
9
  style?: string[];
4
10
  content?: BlockContent;
5
- blocks?: BlockDef<BlockContent>[];
11
+ blocks?: BlockDef[];
6
12
  }
7
- export interface ContentPageDef<BlockContent> {
13
+ export interface ContentPageMeta {
8
14
  title: string;
9
15
  slug: string;
16
+ description?: string;
17
+ keywords?: string[];
18
+ robots?: string[];
19
+ og?: Record<string, string>;
20
+ }
21
+ export interface ContentPageDef extends ContentPageMeta {
10
22
  style?: string[];
11
- blocks?: BlockDef<BlockContent>[];
23
+ blocks?: BlockDef[];
24
+ }
25
+ export interface Img {
26
+ src: string;
27
+ alt?: string;
28
+ title?: string;
29
+ }
30
+ export interface ImgSource {
31
+ src: string;
32
+ format?: keyof FormatEnum;
33
+ options?: JpegOptions | PngOptions | WebpOptions | AvifOptions | HeifOptions | GifOptions | TiffOptions;
34
+ size?: ResizeOptions;
35
+ }
36
+ export interface Picture extends Img, ImgSource {
37
+ sources?: ImgSource[];
12
38
  }
13
39
  export declare const GraphQL: {
14
40
  Block: string;
package/lib/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,KAAK,EAAE;;;;;;;;;;;;;GAaN;IACD,IAAI,EAAE;;;;;;GAML;CACF,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAmEA,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,KAAK,EAAE;;;;;;;;;;;;;GAaN;IACD,IAAI,EAAE;;;;;;GAML;CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.1.8",
3
+ "version": "0.2.10",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "style": "./dist/common.css",
@@ -23,10 +23,16 @@
23
23
  "scripts": {
24
24
  "build": "rimraf ./lib && tsc --build --verbose && npm run build:commonjs && npm run build:style",
25
25
  "build:commonjs": "rimraf ./dist && tsc --module commonjs --noImplicitUseStrict --outDir dist",
26
- "build:style": "postcss './src/**/*.css' --env production --dir ./dist"
26
+ "build:style": "postcss './src/**/*.css' --env production --dir ./dist",
27
+ "test": "jest --coverage"
27
28
  },
28
29
  "dependencies": {
29
- "@redneckz/uni-jsx": "^0.1.3"
30
+ "@redneckz/uni-jsx": "^0.1.3",
31
+ "glob": "^8.0.1",
32
+ "remark-html": "^15.0.1",
33
+ "remark-parse": "^10.0.1",
34
+ "sharp": "^0.30.4",
35
+ "unified": "^10.1.2"
30
36
  },
31
37
  "peerDependencies": {
32
38
  "gatsby": "^4.11.3"
@@ -37,13 +43,16 @@
37
43
  }
38
44
  },
39
45
  "devDependencies": {
46
+ "@types/jest": "^27.4.1",
40
47
  "autoprefixer": "^10.4.4",
41
48
  "cssnano": "^5.1.7",
49
+ "jest": "^27.5.1",
42
50
  "postcss": "^8.4.12",
43
51
  "postcss-cli": "^9.1.0",
44
52
  "prettier": "2.6.2",
45
53
  "rimraf": "^3.0.2",
46
54
  "tailwindcss": "^3.0.24",
55
+ "ts-jest": "^27.1.4",
47
56
  "typescript": "^4.6.3"
48
57
  }
49
58
  }