@redneckz/wildless-cms-uni-blocks 0.1.9 → 0.2.11

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 (98) 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/Text.js +1 -1
  13. package/dist/Text.js.map +1 -1
  14. package/dist/TextWithImage.d.ts +9 -0
  15. package/dist/TextWithImage.js +9 -0
  16. package/dist/TextWithImage.js.map +1 -0
  17. package/dist/base.css +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 +24 -0
  30. package/dist/content-page-repository/mapJSON.js.map +1 -0
  31. package/dist/content-page-repository/mapJSON.spec.d.ts +1 -0
  32. package/dist/content-page-repository/mapJSON.spec.js +25 -0
  33. package/dist/content-page-repository/mapJSON.spec.js.map +1 -0
  34. package/dist/content-page-repository/transformContentPage.d.ts +3 -0
  35. package/dist/content-page-repository/transformContentPage.js +27 -0
  36. package/dist/content-page-repository/transformContentPage.js.map +1 -0
  37. package/dist/content-page-repository/transformMarkdown.d.ts +1 -0
  38. package/dist/content-page-repository/transformMarkdown.js +16 -0
  39. package/dist/content-page-repository/transformMarkdown.js.map +1 -0
  40. package/dist/content-page-repository/transformPicture.d.ts +3 -0
  41. package/dist/content-page-repository/transformPicture.js +45 -0
  42. package/dist/content-page-repository/transformPicture.js.map +1 -0
  43. package/dist/gatsby/GatsbyPage.d.ts +1 -2
  44. package/dist/gatsby/GatsbyPage.js.map +1 -1
  45. package/dist/index.d.ts +2 -2
  46. package/dist/index.js +3 -1
  47. package/dist/index.js.map +1 -1
  48. package/dist/prettify.css +1 -0
  49. package/dist/types.d.ts +30 -4
  50. package/dist/types.js.map +1 -1
  51. package/lib/Blocks.d.ts +1 -4
  52. package/lib/Blocks.js +2 -0
  53. package/lib/Blocks.js.map +1 -1
  54. package/lib/ContentPage.d.ts +1 -2
  55. package/lib/ContentPage.js.map +1 -1
  56. package/lib/ContentPageHead.d.ts +6 -0
  57. package/lib/ContentPageHead.js +9 -0
  58. package/lib/ContentPageHead.js.map +1 -0
  59. package/lib/Img.d.ts +7 -0
  60. package/lib/Img.js +8 -0
  61. package/lib/Img.js.map +1 -0
  62. package/lib/Text.js +1 -1
  63. package/lib/Text.js.map +1 -1
  64. package/lib/TextWithImage.d.ts +9 -0
  65. package/lib/TextWithImage.js +7 -0
  66. package/lib/TextWithImage.js.map +1 -0
  67. package/lib/content-page-repository/ContentPageRepository.d.ts +6 -0
  68. package/lib/content-page-repository/ContentPageRepository.js +29 -0
  69. package/lib/content-page-repository/ContentPageRepository.js.map +1 -0
  70. package/lib/content-page-repository/TransformationOptions.d.ts +4 -0
  71. package/lib/content-page-repository/TransformationOptions.js +2 -0
  72. package/lib/content-page-repository/TransformationOptions.js.map +1 -0
  73. package/lib/content-page-repository/index.d.ts +1 -0
  74. package/lib/content-page-repository/index.js +2 -0
  75. package/lib/content-page-repository/index.js.map +1 -0
  76. package/lib/content-page-repository/mapJSON.d.ts +1 -0
  77. package/lib/content-page-repository/mapJSON.js +21 -0
  78. package/lib/content-page-repository/mapJSON.js.map +1 -0
  79. package/lib/content-page-repository/mapJSON.spec.d.ts +1 -0
  80. package/lib/content-page-repository/mapJSON.spec.js +24 -0
  81. package/lib/content-page-repository/mapJSON.spec.js.map +1 -0
  82. package/lib/content-page-repository/transformContentPage.d.ts +3 -0
  83. package/lib/content-page-repository/transformContentPage.js +21 -0
  84. package/lib/content-page-repository/transformContentPage.js.map +1 -0
  85. package/lib/content-page-repository/transformMarkdown.d.ts +1 -0
  86. package/lib/content-page-repository/transformMarkdown.js +10 -0
  87. package/lib/content-page-repository/transformMarkdown.js.map +1 -0
  88. package/lib/content-page-repository/transformPicture.d.ts +3 -0
  89. package/lib/content-page-repository/transformPicture.js +39 -0
  90. package/lib/content-page-repository/transformPicture.js.map +1 -0
  91. package/lib/gatsby/GatsbyPage.d.ts +1 -2
  92. package/lib/gatsby/GatsbyPage.js.map +1 -1
  93. package/lib/index.d.ts +2 -2
  94. package/lib/index.js +1 -0
  95. package/lib/index.js.map +1 -1
  96. package/lib/types.d.ts +30 -4
  97. package/lib/types.js.map +1 -1
  98. 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,K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AC,CAAC;AAEH,SAAS,WAAW,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAY,EAAE,CAAS;IACxE,IAAI,CAAC,CAAC,IAAI,IAAI,eAAM,CAAC,EAAE;QACrB,OAAO,CAAC,IAAI,CAAC,kBAAkB,IAAI,iBAAiB,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;KACb;IACD,MAAM,cAAc,GAAG,eAAM,CAAC,IAA2B,CAAC,CAAC;IAC3D,OAAO,CACL,uBAAC,cAAc,IAEb,SAAS,EAAE,6CAA6C,eAAe,CAAC,KAAK,CAAC,EAAE,KAC5E,OAAO,YAEV,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,IAJ7B,GAAG,IAAI,IAAI,CAAC,EAAE,CAKJ,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,CAAC"}
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,CAAC,MAA2B;IAC1D,OAAO,MAAM,IAAI,SAAS,MAAM,EAAE,CAAC;AACrC,CAAC;AAFD,4CAEC"}
package/dist/Text.js CHANGED
@@ -3,6 +3,6 @@ exports.Text = 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
5
  exports.Text = (0, uni_jsx_1.JSX)(({ className, primary, secondary, children }) => {
6
- return ((0, jsx_runtime_1.jsxs)("div", { className: className || '', children: [primary && ((0, jsx_runtime_1.jsx)("p", { className: "font-bold text-slate-700 leading-snug", children: primary })), secondary && ((0, jsx_runtime_1.jsx)("p", { className: "mt-2 text-sm text-slate-600", children: secondary })), children] }));
6
+ return ((0, jsx_runtime_1.jsxs)("div", { className: className || '', children: [primary && (0, jsx_runtime_1.jsx)("p", { className: "font-bold text-slate-700 leading-snug", children: primary }), secondary && (0, jsx_runtime_1.jsx)("p", { className: "mt-2 text-sm text-slate-600", children: secondary }), children] }));
7
7
  });
8
8
  //# sourceMappingURL=Text.js.map
package/dist/Text.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAW3B,QAAA,IAAI,GAAG,IAAA,aAAG,EACrB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC9C,OAAO,CACL,iCAAK,SAAS,EAAE,SAAS,IAAI,EAAE,aAC5B,OAAO,IAAI,CACV,8BAAG,SAAS,EAAC,uCAAuC,YAAE,OAAO,GAAK,CACnE,EACA,SAAS,IAAI,CACZ,8BAAG,SAAS,EAAC,6BAA6B,YAAE,SAAS,GAAK,CAC3D,EACA,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
1
+ {"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AAW3B,QAAA,IAAI,GAAG,IAAA,aAAG,EAAY,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IACjF,OAAO,CACL,iCAAK,SAAS,EAAE,SAAS,IAAI,EAAE,aAC5B,OAAO,IAAI,8BAAG,SAAS,EAAC,uCAAuC,YAAE,OAAO,GAAK,EAC7E,SAAS,IAAI,8BAAG,SAAS,EAAC,6BAA6B,YAAE,SAAS,GAAK,EACvE,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Picture } from './types';
2
+ export interface TextWithImageContent {
3
+ primary?: string;
4
+ image?: Picture;
5
+ }
6
+ export interface TextWithImageProps extends TextWithImageContent {
7
+ className?: string;
8
+ }
9
+ export declare const TextWithImage: (props: import("@redneckz/uni-jsx").PropsWithChildren<TextWithImageProps, any>, context?: any) => any;
@@ -0,0 +1,9 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.TextWithImage = void 0;
3
+ const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
+ const uni_jsx_1 = require("@redneckz/uni-jsx");
5
+ const Img_1 = require("./Img");
6
+ exports.TextWithImage = (0, uni_jsx_1.JSX)(({ className, primary, image }) => {
7
+ return ((0, jsx_runtime_1.jsxs)("div", { className: className || '', children: [primary && (0, jsx_runtime_1.jsx)("p", { className: "font-bold text-slate-700 leading-snug", children: primary }), image && (0, jsx_runtime_1.jsx)(Img_1.Img, { image: image })] }));
8
+ });
9
+ //# sourceMappingURL=TextWithImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextWithImage.js","sourceRoot":"","sources":["../src/TextWithImage.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,+BAA4B;AAYf,QAAA,aAAa,GAAG,IAAA,aAAG,EAAqB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IACrF,OAAO,CACL,iCAAK,SAAS,EAAE,SAAS,IAAI,EAAE,aAC5B,OAAO,IAAI,8BAAG,SAAS,EAAC,uCAAuC,YAAE,OAAO,GAAK,EAC7E,KAAK,IAAI,uBAAC,SAAG,IAAC,KAAK,EAAE,KAAK,GAAI,IAC3B,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
package/dist/base.css ADDED
@@ -0,0 +1 @@
1
+ body,html{height:100%;margin:0;padding:0}body{color:#333;font-family:Helvetica Neue,Helvetica,Arial;font-size:14px}.small{font-size:12px}*,:after,:before{box-sizing:border-box}h1{font-size:20px;margin:0}h2{font-size:14px}pre{font:12px/1.4 Consolas,Liberation Mono,Menlo,Courier,monospace;margin:0;padding:0;-moz-tab-size:2;-o-tab-size:2;tab-size:2}a{color:#0074d9;text-decoration:none}a:hover{text-decoration:underline}.strong{font-weight:700}.space-top1{padding:10px 0 0}.pad2y{padding:20px 0}.pad1y{padding:10px 0}.pad2x{padding:0 20px}.pad2{padding:20px}.pad1{padding:10px}.space-left2{padding-left:55px}.space-right2{padding-right:20px}.center{text-align:center}.clearfix{display:block}.clearfix:after{clear:both;content:"";display:block;height:0;visibility:hidden}.fl{float:left}@media only screen and (max-width:640px){.col3{max-width:100%;width:100%}.hide-mobile{display:none!important}}.quiet{color:#7f7f7f;color:rgba(0,0,0,.5)}.quiet a{opacity:.7}.fraction{background:#e8e8e8;border-radius:3px;color:#555;font-family:Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:10px;padding:4px 5px;vertical-align:middle}div.path a:link,div.path a:visited{color:#333}table.coverage{border-collapse:collapse;margin:10px 0 0;padding:0}table.coverage td{margin:0;padding:0;vertical-align:top}table.coverage td.line-count{padding:0 5px 0 20px;text-align:right}table.coverage td.line-coverage{min-width:20px;padding-right:10px;text-align:right}table.coverage td span.cline-any{display:inline-block;padding:0 5px;width:100%}.missing-if-branch{background:#333;border-radius:3px;color:#ff0;display:inline-block;margin-right:5px;padding:0 4px;position:relative}.skip-if-branch{background:#ccc;color:#fff;display:none;margin-right:10px;padding:0 4px;position:relative}.missing-if-branch .typ,.skip-if-branch .typ{color:inherit!important}.coverage-summary{border-collapse:collapse;width:100%}.coverage-summary tr{border-bottom:1px solid #bbb}.keyline-all{border:1px solid #ddd}.coverage-summary td,.coverage-summary th{padding:10px}.coverage-summary tbody{border:1px solid #bbb}.coverage-summary td{border-right:1px solid #bbb}.coverage-summary td:last-child{border-right:none}.coverage-summary th{font-weight:400;text-align:left;white-space:nowrap}.coverage-summary th.file{border-right:none!important}.coverage-summary td.abs,.coverage-summary td.pct,.coverage-summary th.abs,.coverage-summary th.pic{text-align:right}.coverage-summary td.file{white-space:nowrap}.coverage-summary td.pic{min-width:120px!important}.coverage-summary .sorter{background:url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;display:inline-block;height:10px;margin-left:.5em;width:7px}.coverage-summary .sorted .sorter{background-position:0 -20px}.coverage-summary .sorted-desc .sorter{background-position:0 -10px}.status-line{height:10px}.cbranch-no{background:#ff0!important;color:#111}.low .cover-fill,.red.solid,.status-line.low{background:#c21f39}.low .chart{border:1px solid #c21f39}.highlighted,.highlighted .cbranch-no,.highlighted .cstat-no,.highlighted .fstat-no{background:#c21f39!important}.cbranch-no,.cstat-no,.fstat-no{background:#f6c6ce}.cline-no,.low{background:#fce1e5}.cline-yes,.high{background:#e6f5d0}.cstat-yes{background:#a1d76a}.high .cover-fill,.status-line.high{background:#4d9221}.high .chart{border:1px solid #4d9221}.medium .cover-fill,.status-line.medium{background:#f9cd0b}.medium .chart{border:1px solid #f9cd0b}.medium{background:#fff4c2}.cstat-skip{background:#ddd;color:#111}.fstat-skip{background:#ddd;color:#111!important}.cbranch-skip{background:#ddd!important;color:#111}span.cline-neutral{background:#eaeaea}.coverage-summary td.empty{color:#888;line-height:1;opacity:.5;padding-bottom:4px;padding-top:4px}.cover-empty,.cover-fill{display:inline-block;height:12px}.chart{line-height:0}.cover-empty{background:#fff}.cover-full{border-right:none!important}pre.prettyprint{border:none!important;margin:0!important;padding:0!important}.com{color:#999!important}.ignore-none{color:#999;font-weight:400}.wrapper{height:auto!important;height:100%;margin:0 auto -48px;min-height:100%}.footer,.push{height:48px}
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}.inline{display:inline}.table{display:table}.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,CAAC,IAAY;QAC9C,MAAM,KAAK,GAAG,MAAM,kBAAkB,EAAE,CAAC;QACzC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,KAAK,GAAmC,EAAE,CAAC;IACjD,KAAK,UAAU,QAAQ,CAAC,QAAgB;QACtC,IAAI,CAAC,CAAC,QAAQ,IAAI,KAAK,CAAC,EAAE;YACxB,KAAK,CAAC,QAAQ,CAAC,GAAG,MAAM,IAAA,2CAAoB,EAAC,QAAQ,EAAE;gBACrD,UAAU;gBACV,SAAS;aACV,CAAC,CAAC;SACJ;QACD,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IAED,OAAO;QACL,kBAAkB;QAClB,oBAAoB;KACrB,CAAC;AACJ,CAAC;AA7BD,sDA6BC"}
@@ -0,0 +1,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,24 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ exports.mapJSON = void 0;
3
+ async function mapJSON(data, mapper, key = []) {
4
+ if (data === null || data === undefined)
5
+ return data;
6
+ const mappedData = await mapper(data, key);
7
+ if (mappedData !== data)
8
+ return mappedData;
9
+ if (Array.isArray(data)) {
10
+ const values = data.map((_, i) => mapJSON(_, mapper, [String(i)].concat(key)));
11
+ return Promise.all(values);
12
+ }
13
+ else if (typeof data === 'object' && data.toString() === '[object Object]') {
14
+ const subKeys = Object.keys(data);
15
+ const values = subKeys.map((k) => mapJSON(data[k], mapper, [k].concat(key)));
16
+ const pairs = (await Promise.all(values)).map((_, i) => ({
17
+ [subKeys[i]]: _,
18
+ }));
19
+ return Object.assign({}, ...pairs);
20
+ }
21
+ return mapper(data, key);
22
+ }
23
+ exports.mapJSON = mapJSON;
24
+ //# 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,IAAI,KA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AC;AAtBD,0BAsBC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ const mapJSON_1 = require("./mapJSON");
3
+ describe('mapJSON', () => {
4
+ it('should map scalars', async () => {
5
+ const mapper = (_) => (typeof _ === 'string' ? '<MAPPED>' : _);
6
+ expect(await (0, mapJSON_1.mapJSON)('foo', mapper)).toBe('<MAPPED>');
7
+ });
8
+ it('should map arrays', async () => {
9
+ const mapper = (_) => (Array.isArray(_) ? _.map((item) => item.toUpperCase()) : _);
10
+ expect(await (0, mapJSON_1.mapJSON)(['foo', 'bar', 'baz'], mapper)).toEqual(['FOO', 'BAR', 'BAZ']);
11
+ });
12
+ it('should map objects', async () => {
13
+ const mapper = (_) => ('bar' in _ ? { ..._, bar: '<MAPPED>' } : _);
14
+ expect(await (0, mapJSON_1.mapJSON)({ foo: { bar: 'baz' } }, mapper)).toEqual({ foo: { bar: '<MAPPED>' } });
15
+ });
16
+ it('should support async mappers', async () => {
17
+ const mapper = (_) => ('bar' in _ ? Promise.resolve({ ..._, bar: '<MAPPED>' }) : _);
18
+ expect(await (0, mapJSON_1.mapJSON)({ foo: { bar: 'baz' } }, mapper)).toEqual({ foo: { bar: '<MAPPED>' } });
19
+ });
20
+ it('should map nil values as is', async () => {
21
+ const mapper = (_) => (!_ ? '<EMPTY>' : _);
22
+ expect(await (0, mapJSON_1.mapJSON)([null, undefined, ''], mapper)).toEqual([null, undefined, '<EMPTY>']);
23
+ });
24
+ });
25
+ //# sourceMappingURL=mapJSON.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapJSON.spec.js","sourceRoot":"","sources":["../../src/content-page-repository/mapJSON.spec.ts"],"names":[],"mappings":";AAAA,uCAAoC;AAEpC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,oBAAoB,EAAE,KAAK,IAAI,EAAE;QAClC,MAAM,MAAM,GAAG,CAAC,CAAM,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K,IAAI,EAAE;QAC5C,MAAM,MAAM,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACzF,MAAM,CAAC,MAAM,IAAA,iBAAO,EAAC,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,MAAM,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChD,MAAM,CAAC,MAAM,IAAA,iBAAO,EAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;IAC7F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,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,27 @@
1
+ var __importDefault = (this && this.__importDefault) || function (mod) {
2
+ return (mod && mod.__esModule) ? mod : { "default": mod };
3
+ };
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.transformContentPage = void 0;
6
+ const fs_1 = __importDefault(require("fs"));
7
+ const util_1 = __importDefault(require("util"));
8
+ const mapJSON_1 = require("./mapJSON");
9
+ const transformMarkdown_1 = require("./transformMarkdown");
10
+ const transformPicture_1 = require("./transformPicture");
11
+ const readFile = util_1.default.promisify(fs_1.default.readFile);
12
+ async function transformContentPage(pagePath, options) {
13
+ const content = await readFile(pagePath, 'utf8');
14
+ return (0, mapJSON_1.mapJSON)(JSON.parse(content), async (value, [key]) => {
15
+ const isMarkdown = typeof value === 'string' && key?.endsWith('__md');
16
+ const isPicture = value && value.src && typeof value.src === 'string';
17
+ if (isMarkdown) {
18
+ return await (0, transformMarkdown_1.transformMarkdown)(value);
19
+ }
20
+ else if (isPicture) {
21
+ return await (0, transformPicture_1.transformPicture)(pagePath, value, options);
22
+ }
23
+ return value;
24
+ });
25
+ }
26
+ exports.transformContentPage = transformContentPage;
27
+ //# sourceMappingURL=transformContentPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformContentPage.js","sourceRoot":"","sources":["../../src/content-page-repository/transformContentPage.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,uCAAoC;AAEpC,2DAAwD;AACxD,yDAAsD;AAEtD,MAAM,QAAQ,GAAG,cAAI,CAAC,SAAS,CAAC,YAAE,CAAC,QAAQ,CAAC,CAAC;AAEtC,KAAK,UAAU,oBAAoB,CACxC,QAAgB,EAChB,OAA8B;IAE9B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjD,OAAO,IAAA,iBAAO,EAAiB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAU,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE;QAC9E,MAAM,UAAU,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtE,MAAM,SAAS,GAAG,KAAK,IAAI,KAAK,CAAC,GAAG,IAAI,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC;QACtE,IAAI,UAAU,EAAE;YACd,OAAO,MAAM,IAAA,qCAAiB,EAAC,KAAK,CAAC,CAAC;SACvC;aAAM,IAAI,SAAS,EAAE;YACpB,OAAO,MAAM,IAAA,mCAAgB,EAAC,QAAQ,EAAE,KAAgB,EAAE,OAAO,CAAC,CAAC;SACpE;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC;AAfD,oDAeC"}
@@ -0,0 +1 @@
1
+ export declare function transformMarkdown(markdown: string | null | undefined): Promise<string>;
@@ -0,0 +1,16 @@
1
+ var __importDefault = (this && this.__importDefault) || function (mod) {
2
+ return (mod && mod.__esModule) ? mod : { "default": mod };
3
+ };
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.transformMarkdown = void 0;
6
+ const unified_1 = require("unified");
7
+ const remark_parse_1 = __importDefault(require("remark-parse"));
8
+ const remark_html_1 = __importDefault(require("remark-html"));
9
+ async function transformMarkdown(markdown) {
10
+ if (!markdown)
11
+ return '';
12
+ const result = await (0, unified_1.unified)().use(remark_parse_1.default).use(remark_html_1.default).process(markdown);
13
+ return result.toString('utf-8');
14
+ }
15
+ exports.transformMarkdown = transformMarkdown;
16
+ //# sourceMappingURL=transformMarkdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformMarkdown.js","sourceRoot":"","sources":["../../src/content-page-repository/transformMarkdown.ts"],"names":[],"mappings":";;;;;AAAA,qCAAkC;AAClC,gEAAuC;AACvC,8DAAqC;AAE9B,KAAK,UAAU,iBAAiB,CAAC,QAAmC;IACzE,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEzB,MAAM,MAAM,GAAG,MAAM,IAAA,iBAAO,GAAE,CAAC,GAAG,CAAC,sBAAW,CAAC,CAAC,GAAG,CAAC,qBAAU,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClF,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AALD,8CAKC"}
@@ -0,0 +1,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,45 @@
1
+ var __importDefault = (this && this.__importDefault) || function (mod) {
2
+ return (mod && mod.__esModule) ? mod : { "default": mod };
3
+ };
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.transformPicture = void 0;
6
+ const fs_1 = __importDefault(require("fs"));
7
+ const path_1 = __importDefault(require("path"));
8
+ const sharp_1 = __importDefault(require("sharp"));
9
+ const util_1 = __importDefault(require("util"));
10
+ const mkdir = util_1.default.promisify(fs_1.default.mkdir);
11
+ async function transformPicture(pagePath, picture, options) {
12
+ const sources = picture.sources || [];
13
+ const [transformedPicture, ...transformedSources] = await Promise.all([picture].concat(sources).map((_) => transformImg(pagePath, picture.src, { ...options, ..._ })));
14
+ return {
15
+ ...picture,
16
+ src: transformedPicture,
17
+ sources: transformedSources.map((_, i) => ({
18
+ ...sources[i],
19
+ src: _,
20
+ })),
21
+ };
22
+ }
23
+ exports.transformPicture = transformPicture;
24
+ async function transformImg(pagePath, src, transformationOptions) {
25
+ const { contentDir, publicDir, format, options, size } = transformationOptions;
26
+ const imgPath = `${path_1.default.dirname(pagePath)}/${src}`;
27
+ let chain = (0, sharp_1.default)(imgPath);
28
+ if (size)
29
+ chain = chain.resize(size);
30
+ if (format)
31
+ chain = chain.toFormat(format, options);
32
+ const transformedSrc = transformSrc(src, transformationOptions);
33
+ const transformedImgPath = `${publicDir}/${path_1.default.relative(contentDir, `${path_1.default.dirname(pagePath)}/${transformedSrc}`)}`;
34
+ await mkdir(path_1.default.dirname(transformedImgPath), { recursive: true });
35
+ await chain.toFile(transformedImgPath);
36
+ return transformedSrc;
37
+ }
38
+ function transformSrc(src, { format, size }) {
39
+ const noTransform = !format && !size;
40
+ if (noTransform)
41
+ return src;
42
+ const suffix = [size?.width, size?.height].filter(Boolean).join('-');
43
+ return `${path_1.default.basename(src, path_1.default.extname(src))}${suffix ? `-${suffix}` : ''}.${format || path_1.default.extname(src)}`;
44
+ }
45
+ //# sourceMappingURL=transformPicture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformPicture.js","sourceRoot":"","sources":["../../src/content-page-repository/transformPicture.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,kDAA0B;AAC1B,gDAAwB;AAIxB,MAAM,KAAK,GAAG,cAAI,CAAC,SAAS,CAAC,YAAE,CAAC,KAAK,CAAC,CAAC;AAEhC,KAAK,UAAU,gBAAgB,CACpC,QAAgB,EAChB,OAAgB,EAChB,OAA8B;IAE9B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;IACtC,MAAM,CAAC,kBAAkB,EAAE,GAAG,kBAAkB,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CACnE,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAChG,CAAC;IACF,OAAO;QACL,GAAG,OAAO;QACV,GAAG,EAAE,kBAAkB;QACvB,OAAO,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACzC,GAAG,OAAO,CAAC,CAAC,CAAC;YACb,GAAG,EAAE,CAAC;SACP,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC;AAjBD,4CAiBC;AAED,KAAK,UAAU,YAAY,CACzB,QAAgB,EAChB,GAAW,EACX,qBAAwD;IAExD,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,qBAAqB,CAAC;IAE/E,MAAM,OA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1E,MAAM,IAAI,cAAI,CAAC,OAAO,CAAC,GAAG,CAC5B,EAAE,CAAC;AACL,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"}
@@ -0,0 +1 @@
1
+ .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.clo,.opn,.pun{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:700}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:700}.lit{color:#044}.clo,.opn,.pun{color:#440}.tag{color:#006;font-weight:700}.atn{color:#404}.atv{color:#060}}pre.prettyprint{border:1px solid #888;padding:2px}ol.linenums{margin-bottom:0;margin-top:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
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,EA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C,WAAW,CAAC,GAC1B,CACX,CAAC,CAAC;AAEH,SAAS,WAAW,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAY,EAAE,CAAS;IACxE,IAAI,CAAC,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,CAAC,KAAK,CAAC,EAAE,KAC5E,OAAO,YAEV,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,IAJ7B,GAAG,IAAI,IAAI,CAAC,EAAE,CAKJ,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,CAAC"}
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,CAAC,MAA2B;IAC1D,OAAO,MAAM,IAAI,SAAS,MAAM,EAAE,CAAC;AACrC,CAAC"}
package/lib/Text.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
2
  import { JSX } from '@redneckz/uni-jsx';
3
3
  export const Text = JSX(({ className, primary, secondary, children }) => {
4
- return (_jsxs("div", { className: className || '', children: [primary && (_jsx("p", { className: "font-bold text-slate-700 leading-snug", children: primary })), secondary && (_jsx("p", { className: "mt-2 text-sm text-slate-600", children: secondary })), children] }));
4
+ return (_jsxs("div", { className: className || '', children: [primary && _jsx("p", { className: "font-bold text-slate-700 leading-snug", children: primary }), secondary && _jsx("p", { className: "mt-2 text-sm text-slate-600", children: secondary }), children] }));
5
5
  });
6
6
  //# sourceMappingURL=Text.js.map
package/lib/Text.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAWxC,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CACrB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC9C,OAAO,CACL,eAAK,SAAS,EAAE,SAAS,IAAI,EAAE,aAC5B,OAAO,IAAI,CACV,YAAG,SAAS,EAAC,uCAAuC,YAAE,OAAO,GAAK,CACnE,EACA,SAAS,IAAI,CACZ,YAAG,SAAS,EAAC,6BAA6B,YAAE,SAAS,GAAK,CAC3D,EACA,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
1
+ {"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAWxC,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CAAY,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE;IACjF,OAAO,CACL,eAAK,SAAS,EAAE,SAAS,IAAI,EAAE,aAC5B,OAAO,IAAI,YAAG,SAAS,EAAC,uCAAuC,YAAE,OAAO,GAAK,EAC7E,SAAS,IAAI,YAAG,SAAS,EAAC,6BAA6B,YAAE,SAAS,GAAK,EACvE,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Picture } from './types';
2
+ export interface TextWithImageContent {
3
+ primary?: string;
4
+ image?: Picture;
5
+ }
6
+ export interface TextWithImageProps extends TextWithImageContent {
7
+ className?: string;
8
+ }
9
+ export declare const TextWithImage: (props: import("@redneckz/uni-jsx").PropsWithChildren<TextWithImageProps, any>, context?: any) => any;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
+ import { JSX } from '@redneckz/uni-jsx';
3
+ import { Img } from './Img';
4
+ export const TextWithImage = JSX(({ className, primary, image }) => {
5
+ return (_jsxs("div", { className: className || '', children: [primary && _jsx("p", { className: "font-bold text-slate-700 leading-snug", children: primary }), image && _jsx(Img, { image: image })] }));
6
+ });
7
+ //# sourceMappingURL=TextWithImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextWithImage.js","sourceRoot":"","sources":["../src/TextWithImage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAY5B,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAqB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IACrF,OAAO,CACL,eAAK,SAAS,EAAE,SAAS,IAAI,EAAE,aAC5B,OAAO,IAAI,YAAG,SAAS,EAAC,uCAAuC,YAAE,OAAO,GAAK,EAC7E,KAAK,IAAI,KAAC,GAAG,IAAC,KAAK,EAAE,KAAK,GAAI,IAC3B,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,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,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';
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,IAAI,CAAC,CAAC;QAClC,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 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ import { mapJSON } from './mapJSON';
2
+ describe('mapJSON', () => {
3
+ it('should map scalars', async () => {
4
+ const mapper = (_) => (typeof _ === 'string' ? '<MAPPED>' : _);
5
+ expect(await mapJSON('foo', mapper)).toBe('<MAPPED>');
6
+ });
7
+ it('should map arrays', async () => {
8
+ const mapper = (_) => (Array.isArray(_) ? _.map((item) => item.toUpperCase()) : _);
9
+ expect(await mapJSON(['foo', 'bar', 'baz'], mapper)).toEqual(['FOO', 'BAR', 'BAZ']);
10
+ });
11
+ it('should map objects', async () => {
12
+ const mapper = (_) => ('bar' in _ ? { ..._, bar: '<MAPPED>' } : _);
13
+ expect(await mapJSON({ foo: { bar: 'baz' } }, mapper)).toEqual({ foo: { bar: '<MAPPED>' } });
14
+ });
15
+ it('should support async mappers', async () => {
16
+ const mapper = (_) => ('bar' in _ ? Promise.resolve({ ..._, bar: '<MAPPED>' }) : _);
17
+ expect(await mapJSON({ foo: { bar: 'baz' } }, mapper)).toEqual({ foo: { bar: '<MAPPED>' } });
18
+ });
19
+ it('should map nil values as is', async () => {
20
+ const mapper = (_) => (!_ ? '<EMPTY>' : _);
21
+ expect(await mapJSON([null, undefined, ''], mapper)).toEqual([null, undefined, '<EMPTY>']);
22
+ });
23
+ });
24
+ //# sourceMappingURL=mapJSON.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapJSON.spec.js","sourceRoot":"","sources":["../../src/content-page-repository/mapJSON.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,oBAAoB,EAAE,KAAK,IAAI,EAAE;QAClC,MAAM,MAAM,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpE,MAAM,CAAC,MAAM,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mBAAmB,EAAE,KAAK,IAAI,EAAE;QACjC,MAAM,MAAM,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,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E,UAAU,EAAE,EAAE,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,MAAM,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChD,MAAM,CAAC,MAAM,OAAO,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;IAC7F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,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,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}` : ''}.${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":"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,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,QAAgB,EAChB,OAAgB,EAChB,OAA8B;IAE9B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;IACtC,MAAM,CAAC,kBAAkB,EAAE,GAAG,kBAAkB,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CACnE,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAChG,CAAC;IACF,OAAO;QACL,GAAG,OAAO;QACV,GAAG,EAAE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AAI,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,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,IAC1E,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAC5B,EAAE,CAAC;AACL,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.9",
3
+ "version": "0.2.11",
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
  }