@redneckz/wildless-cms-uni-blocks 0.1.9 → 0.1.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.
package/dist/Blocks.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import type { PlaceholderContent } from './Placeholder';
2
2
  import type { RichTextContent } from './RichText';
3
3
  import type { TextContent } from './Text';
4
- export declare type BlockContent = PlaceholderContent | TextContent | RichTextContent;
4
+ import type { TextWithImageContent } from './TextWithImage';
5
+ export declare type BlockContent = TextContent | TextWithImageContent | RichTextContent | PlaceholderContent;
5
6
  export declare const Blocks: {
6
7
  Text: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Text").TextProps, any>, context?: any) => any;
8
+ TextWithImage: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./TextWithImage").TextWithImageProps, any>, context?: any) => any;
7
9
  RichText: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./RichText").RichTextProps, any>, context?: any) => any;
8
10
  Placeholder: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Placeholder").PlaceholderProps, any>, context?: any) => any;
9
11
  };
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":";;AACA,+CAA4C;AAE5C,yCAAsC;AAEtC,iCAA8B;AAE9B,mDAAgD;AAQnC,QAAA,MAAM,GAAG;IACpB,IAAI,EAAJ,WAAI;IACJ,aAAa,EAAb,6BAAa;IACb,QAAQ,EAAR,mBAAQ;IACR,WAAW,EAAX,yBAAW;CACZ,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,CAC9B,MAA2B;IAE3B,OAAO,MAAM,IAAI,SAAS,MAAM,EAAE,CAAC;AACrC,CAAC;AAJD,4CAIC"}
@@ -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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { BlockDef, ContentPageDef } from './types';
1
+ export type { BlockDef, ContentPageDef, Img, ImgSource, Picture } from './types';
2
2
  export type { BlockContent } from './Blocks';
3
3
  export { Blocks } from './Blocks';
4
4
  export { ContentPage } from './ContentPage';
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { AvifOptions, FormatEnum, GifOptions, HeifOptions, JpegOptions, PngOptions, ResizeOptions, TiffOptions, WebpOptions } from 'sharp';
1
2
  export interface BlockDef<BlockContent> {
2
3
  type: string;
3
4
  style?: string[];
@@ -10,6 +11,20 @@ export interface ContentPageDef<BlockContent> {
10
11
  style?: string[];
11
12
  blocks?: BlockDef<BlockContent>[];
12
13
  }
14
+ export interface Img {
15
+ src: string;
16
+ alt?: string;
17
+ title?: string;
18
+ }
19
+ export interface ImgSource {
20
+ src: string;
21
+ format?: keyof FormatEnum;
22
+ options?: JpegOptions | PngOptions | WebpOptions | AvifOptions | HeifOptions | GifOptions | TiffOptions;
23
+ size?: ResizeOptions;
24
+ }
25
+ export interface Picture extends Img, ImgSource {
26
+ sources: ImgSource[];
27
+ }
13
28
  export declare const GraphQL: {
14
29
  Block: string;
15
30
  Page: 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":";;AAkDa,QAAA,OAAO,GAAG;IACrB,KAAK,EAAE;;;;;;;;;;;;;GAaN;IACD,IAAI,EAAE;;;;;;GAML;CACF,CAAC"}
package/lib/Blocks.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import type { PlaceholderContent } from './Placeholder';
2
2
  import type { RichTextContent } from './RichText';
3
3
  import type { TextContent } from './Text';
4
- export declare type BlockContent = PlaceholderContent | TextContent | RichTextContent;
4
+ import type { TextWithImageContent } from './TextWithImage';
5
+ export declare type BlockContent = TextContent | TextWithImageContent | RichTextContent | PlaceholderContent;
5
6
  export declare const Blocks: {
6
7
  Text: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Text").TextProps, any>, context?: any) => any;
8
+ TextWithImage: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./TextWithImage").TextWithImageProps, any>, context?: any) => any;
7
9
  RichText: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./RichText").RichTextProps, any>, context?: any) => any;
8
10
  Placeholder: (props: import("@redneckz/uni-jsx").PropsWithChildren<import("./Placeholder").PlaceholderProps, any>, context?: any) => any;
9
11
  };
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":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAQhD,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI;IACJ,aAAa;IACb,QAAQ;IACR,WAAW;CACZ,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,CAC9B,MAA2B;IAE3B,OAAO,MAAM,IAAI,SAAS,MAAM,EAAE,CAAC;AACrC,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"}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { BlockDef, ContentPageDef } from './types';
1
+ export type { BlockDef, ContentPageDef, Img, ImgSource, Picture } from './types';
2
2
  export type { BlockContent } from './Blocks';
3
3
  export { Blocks } from './Blocks';
4
4
  export { ContentPage } from './ContentPage';
package/lib/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { AvifOptions, FormatEnum, GifOptions, HeifOptions, JpegOptions, PngOptions, ResizeOptions, TiffOptions, WebpOptions } from 'sharp';
1
2
  export interface BlockDef<BlockContent> {
2
3
  type: string;
3
4
  style?: string[];
@@ -10,6 +11,20 @@ export interface ContentPageDef<BlockContent> {
10
11
  style?: string[];
11
12
  blocks?: BlockDef<BlockContent>[];
12
13
  }
14
+ export interface Img {
15
+ src: string;
16
+ alt?: string;
17
+ title?: string;
18
+ }
19
+ export interface ImgSource {
20
+ src: string;
21
+ format?: keyof FormatEnum;
22
+ options?: JpegOptions | PngOptions | WebpOptions | AvifOptions | HeifOptions | GifOptions | TiffOptions;
23
+ size?: ResizeOptions;
24
+ }
25
+ export interface Picture extends Img, ImgSource {
26
+ sources: ImgSource[];
27
+ }
13
28
  export declare const GraphQL: {
14
29
  Block: string;
15
30
  Page: 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":"AAkDA,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.1.10",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "style": "./dist/common.css",
@@ -29,11 +29,15 @@
29
29
  "@redneckz/uni-jsx": "^0.1.3"
30
30
  },
31
31
  "peerDependencies": {
32
- "gatsby": "^4.11.3"
32
+ "gatsby": "^4.11.3",
33
+ "sharp": "^0.30.4"
33
34
  },
34
35
  "peerDependenciesMeta": {
35
36
  "gatsby": {
36
37
  "optional": true
38
+ },
39
+ "sharp": {
40
+ "optional": true
37
41
  }
38
42
  },
39
43
  "devDependencies": {