@starlightcms/react-sdk 2.3.0 → 3.0.0-beta.2
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/cjs/ResponsiveImage/index.d.ts.map +1 -1
- package/dist/cjs/ResponsiveImage/index.js +18 -8
- package/dist/cjs/ResponsiveImage/index.js.map +1 -1
- package/dist/cjs/VisualContent/blocks/HTML/index.d.ts.map +1 -1
- package/dist/cjs/VisualContent/blocks/HTML/index.js +4 -6
- package/dist/cjs/VisualContent/blocks/HTML/index.js.map +1 -1
- package/dist/cjs/VisualContent/blocks/Header.d.ts +0 -1
- package/dist/cjs/VisualContent/blocks/Header.d.ts.map +1 -1
- package/dist/cjs/VisualContent/blocks/Header.js +5 -2
- package/dist/cjs/VisualContent/blocks/Header.js.map +1 -1
- package/dist/cjs/VisualContent/blocks/Image/index.d.ts +1 -1
- package/dist/cjs/VisualContent/blocks/Image/index.d.ts.map +1 -1
- package/dist/cjs/VisualContent/blocks/Image/index.js +51 -13
- package/dist/cjs/VisualContent/blocks/Image/index.js.map +1 -1
- package/dist/cjs/VisualContent/blocks/List/index.d.ts.map +1 -1
- package/dist/cjs/VisualContent/blocks/List/index.js +9 -11
- package/dist/cjs/VisualContent/blocks/List/index.js.map +1 -1
- package/dist/cjs/VisualContent/blocks/Paragraph.d.ts.map +1 -1
- package/dist/cjs/VisualContent/blocks/Paragraph.js +6 -3
- package/dist/cjs/VisualContent/blocks/Paragraph.js.map +1 -1
- package/dist/cjs/VisualContent/blocks/Quote.d.ts.map +1 -1
- package/dist/cjs/VisualContent/blocks/Quote.js +1 -2
- package/dist/cjs/VisualContent/blocks/Quote.js.map +1 -1
- package/dist/cjs/VisualContent/blocks/Video/index.d.ts.map +1 -1
- package/dist/cjs/VisualContent/blocks/Video/index.js +7 -6
- package/dist/cjs/VisualContent/blocks/Video/index.js.map +1 -1
- package/dist/cjs/VisualContent/index.d.ts +0 -1
- package/dist/cjs/VisualContent/index.d.ts.map +1 -1
- package/dist/cjs/VisualContent/index.js +18 -9
- package/dist/cjs/VisualContent/index.js.map +1 -1
- package/dist/cjs/VisualContent/types.d.ts +1 -1
- package/dist/cjs/VisualContent/types.d.ts.map +1 -1
- package/dist/esm/ResponsiveImage/index.d.ts.map +1 -1
- package/dist/esm/ResponsiveImage/index.js +1 -1
- package/dist/esm/ResponsiveImage/index.js.map +1 -1
- package/dist/esm/VisualContent/blocks/HTML/index.d.ts.map +1 -1
- package/dist/esm/VisualContent/blocks/HTML/index.js +4 -6
- package/dist/esm/VisualContent/blocks/HTML/index.js.map +1 -1
- package/dist/esm/VisualContent/blocks/Header.d.ts +0 -1
- package/dist/esm/VisualContent/blocks/Header.d.ts.map +1 -1
- package/dist/esm/VisualContent/blocks/Header.js +5 -2
- package/dist/esm/VisualContent/blocks/Header.js.map +1 -1
- package/dist/esm/VisualContent/blocks/Image/index.d.ts +1 -1
- package/dist/esm/VisualContent/blocks/Image/index.d.ts.map +1 -1
- package/dist/esm/VisualContent/blocks/Image/index.js +34 -6
- package/dist/esm/VisualContent/blocks/Image/index.js.map +1 -1
- package/dist/esm/VisualContent/blocks/List/index.d.ts.map +1 -1
- package/dist/esm/VisualContent/blocks/List/index.js +9 -11
- package/dist/esm/VisualContent/blocks/List/index.js.map +1 -1
- package/dist/esm/VisualContent/blocks/Paragraph.d.ts.map +1 -1
- package/dist/esm/VisualContent/blocks/Paragraph.js +6 -3
- package/dist/esm/VisualContent/blocks/Paragraph.js.map +1 -1
- package/dist/esm/VisualContent/blocks/Quote.d.ts.map +1 -1
- package/dist/esm/VisualContent/blocks/Quote.js +1 -2
- package/dist/esm/VisualContent/blocks/Quote.js.map +1 -1
- package/dist/esm/VisualContent/blocks/Video/index.d.ts.map +1 -1
- package/dist/esm/VisualContent/blocks/Video/index.js +7 -6
- package/dist/esm/VisualContent/blocks/Video/index.js.map +1 -1
- package/dist/esm/VisualContent/index.d.ts +0 -1
- package/dist/esm/VisualContent/index.d.ts.map +1 -1
- package/dist/esm/VisualContent/index.js +1 -2
- package/dist/esm/VisualContent/index.js.map +1 -1
- package/dist/esm/VisualContent/types.d.ts +1 -1
- package/dist/esm/VisualContent/types.d.ts.map +1 -1
- package/dist/styles.css +197 -0
- package/dist/styles.css.map +1 -0
- package/package.json +17 -18
- package/dist/cjs/VisualContent/blocks/HTML/styles.d.ts +0 -6
- package/dist/cjs/VisualContent/blocks/HTML/styles.d.ts.map +0 -1
- package/dist/cjs/VisualContent/blocks/HTML/styles.js +0 -13
- package/dist/cjs/VisualContent/blocks/HTML/styles.js.map +0 -1
- package/dist/cjs/VisualContent/blocks/Image/styles.d.ts +0 -19
- package/dist/cjs/VisualContent/blocks/Image/styles.d.ts.map +0 -1
- package/dist/cjs/VisualContent/blocks/Image/styles.js +0 -41
- package/dist/cjs/VisualContent/blocks/Image/styles.js.map +0 -1
- package/dist/cjs/VisualContent/blocks/List/styles.d.ts +0 -6
- package/dist/cjs/VisualContent/blocks/List/styles.d.ts.map +0 -1
- package/dist/cjs/VisualContent/blocks/List/styles.js +0 -21
- package/dist/cjs/VisualContent/blocks/List/styles.js.map +0 -1
- package/dist/cjs/VisualContent/blocks/Video/styles.d.ts +0 -14
- package/dist/cjs/VisualContent/blocks/Video/styles.d.ts.map +0 -1
- package/dist/cjs/VisualContent/blocks/Video/styles.js +0 -41
- package/dist/cjs/VisualContent/blocks/Video/styles.js.map +0 -1
- package/dist/cjs/VisualContent/styles.d.ts +0 -14
- package/dist/cjs/VisualContent/styles.d.ts.map +0 -1
- package/dist/cjs/VisualContent/styles.js +0 -89
- package/dist/cjs/VisualContent/styles.js.map +0 -1
- package/dist/esm/VisualContent/blocks/HTML/styles.d.ts +0 -6
- package/dist/esm/VisualContent/blocks/HTML/styles.d.ts.map +0 -1
- package/dist/esm/VisualContent/blocks/HTML/styles.js +0 -7
- package/dist/esm/VisualContent/blocks/HTML/styles.js.map +0 -1
- package/dist/esm/VisualContent/blocks/Image/styles.d.ts +0 -19
- package/dist/esm/VisualContent/blocks/Image/styles.d.ts.map +0 -1
- package/dist/esm/VisualContent/blocks/Image/styles.js +0 -35
- package/dist/esm/VisualContent/blocks/Image/styles.js.map +0 -1
- package/dist/esm/VisualContent/blocks/List/styles.d.ts +0 -6
- package/dist/esm/VisualContent/blocks/List/styles.d.ts.map +0 -1
- package/dist/esm/VisualContent/blocks/List/styles.js +0 -15
- package/dist/esm/VisualContent/blocks/List/styles.js.map +0 -1
- package/dist/esm/VisualContent/blocks/Video/styles.d.ts +0 -14
- package/dist/esm/VisualContent/blocks/Video/styles.d.ts.map +0 -1
- package/dist/esm/VisualContent/blocks/Video/styles.js +0 -35
- package/dist/esm/VisualContent/blocks/Video/styles.js.map +0 -1
- package/dist/esm/VisualContent/styles.d.ts +0 -14
- package/dist/esm/VisualContent/styles.d.ts.map +0 -1
- package/dist/esm/VisualContent/styles.js +0 -83
- package/dist/esm/VisualContent/styles.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ResponsiveImage/index.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAAwC,MAAM,OAAO,CAAA;AAE9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAK9C;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ResponsiveImage/index.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAAwC,MAAM,OAAO,CAAA;AAE9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAK9C;;;;;;;;;GASG;AAEH,eAAO,MAAM,oBAAoB,QAAO,SAMvC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,eAAO,MAAM,eAAe,GAAI,oFAS7B,oBAAoB,KAAG,GAAG,CAAC,OA2G7B,CAAA;AAED,YAAY,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -16,13 +16,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
16
16
|
}) : function(o, v) {
|
|
17
17
|
o["default"] = v;
|
|
18
18
|
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
26
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
37
|
exports.ResponsiveImage = exports.GlobalLazyloadStyles = void 0;
|
|
28
38
|
const react_1 = __importStar(require("react"));
|
|
@@ -164,7 +174,7 @@ const ResponsiveImage = ({ className = '', image, sizes = '', alt = typeof image
|
|
|
164
174
|
};
|
|
165
175
|
}, [source]);
|
|
166
176
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
167
|
-
react_1.default.createElement("img", { ref: imageRef, className: 'sl-lazyload ' + className, style: imageStyle, src: canLoad ? (source === null || source === void 0 ? void 0 : source.path) || image : transparentImage, srcSet: canLoad ? (sourceSet ? sourceSet : undefined) : undefined, sizes: canLoad ? (sourceSet ? sizes : undefined) : undefined, alt: alt }),
|
|
177
|
+
react_1.default.createElement("img", { ref: imageRef, className: 'sl-lazyload sl-responsive-image ' + className, style: imageStyle, src: canLoad ? (source === null || source === void 0 ? void 0 : source.path) || image : transparentImage, srcSet: canLoad ? (sourceSet ? sourceSet : undefined) : undefined, sizes: canLoad ? (sourceSet ? sizes : undefined) : undefined, alt: alt }),
|
|
168
178
|
react_1.default.createElement("noscript", null,
|
|
169
179
|
react_1.default.createElement("img", { src: (source && source.path) || image, alt: alt }))));
|
|
170
180
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ResponsiveImage/index.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;AAEZ,+CAA8E;AAI9E,MAAM,gBAAgB,GACpB,4EAA4E,CAAA;AAE9E;;;;;;;;;GASG;AACI,MAAM,oBAAoB,GAAG,GAAc,EAAE;IAClD,OAAO,CACL;QACE,6CAAQ,iCAAiC,CAAS,CACzC,CACZ,CAAA;AACH,CAAC,CAAA;AANY,QAAA,oBAAoB,wBAMhC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACI,MAAM,eAAe,GAAG,CAAC,EAC9B,SAAS,GAAG,EAAE,EACd,KAAK,EACL,KAAK,GAAG,EAAE,EACV,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAChD,SAAS,GAAG,WAAW,EACvB,UAAU,GAAG,EAAE,EACf,QAAQ,EACR,cAAc,GAAG,OAAO,GACH,EAAe,EAAE;IACtC,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAA;IAE/C,yCAAyC;IACzC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAA;IAE7C,mEAAmE;IACnE,MAAM,CAAC,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S,EAC5D,GAAG,EAAE,GAAG,GACR;QACF;YACE,uCAAK,GAAG,EAAE,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,IAAK,KAAgB,EAAE,GAAG,EAAE,GAAG,GAAI,CAC3D,CACV,CACJ,CAAA;AACH,CAAC,CAAA;AApHY,QAAA,eAAe,mBAoH3B","sourcesContent":["'use client'\n\nimport React, { ReactNode, useEffect, useMemo, useRef, useState } from 'react'\nimport { MediaObject } from '@starlightcms/js-sdk'\nimport { ResponsiveImageProps } from './types'\n\nconst transparentImage =\n 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='\n\n/**\n * Renders a `<style>` tag with a rule that disables lazy-loading when JavaScript\n * is disabled in the browser. This is useful to web crawlers that don't run\n * JS files, which is important for SEO.\n *\n * You only need to render this component once in your application,\n * preferably in the `<head>` section.\n *\n * @group ResponsiveImage\n */\nexport const GlobalLazyloadStyles = (): ReactNode => {\n return (\n <noscript>\n <style>{'img.sl-lazyload{display: none;}'}</style>\n </noscript>\n )\n}\n\n/**\n * Renders an image from a given Starlight media object. The Starlight\n * optimized image will be rendered by default if no `variation` prop is passed.\n *\n * If the `sizes` prop is passed, a responsive image will be rendered by\n * generating a \"src-set\" property.\n *\n * The image will be lazy-loaded, which means that it should only load\n * when the browser viewport gets near the image.\n *\n * @example Requesting an entry and rendering an image.\n *\n * Assume we created a \"Posts\" model with a slug of `posts`, and placed a Media\n * File field with a key of `featured_image` on it.\n *\n * ```jsx\n * import Starlight, { ResponsiveImage } from '@starlightcms/react-sdk'\n *\n * const EntryComponent = ({ slug }) => {\n * const [entry, setEntry] = useState(null)\n *\n * useEffect(async () => {\n * // This is just an example, you could fetch\n * // the entry any way you want.\n * const response = await Starlight.posts.entries.get(slug)\n *\n * setEntry(response.data)\n * }, [ slug ])\n *\n * // After fetching, the image will be on the `entry.data.featured_image` property.\n * return (\n * entry ? (\n * <article>\n * <h1>{entry.title}</h1>\n * <ResponsiveImage image={entry.data.featured_image} />\n * </article>\n * ) : (\n * <div>Loading...</div>\n * )\n * )\n * }\n *\n * ```\n *\n * @param props Component props. See {@link ResponsiveImageProps} to see the\n * available options.\n * @group ResponsiveImage\n */\nexport const ResponsiveImage = ({\n className = '',\n image,\n sizes = '',\n alt = typeof image === 'string' ? '' : image.alt,\n variation = 'optimized',\n background = '',\n lazyRoot,\n lazyRootMargin = '200px',\n}: ResponsiveImageProps): JSX.Element => {\n const imageRef = useRef<HTMLImageElement>(null)\n\n // When true, the image may load normally\n const [canLoad, setCanLoad] = useState(false)\n\n // When true, the image has been successfully loaded by the browser\n const [hasLoaded, setHasLoaded] = useState(false)\n\n // Get the optimized variation if available\n const source = useMemo(() => {\n // If the given image was a string, simply return it\n if (typeof image === 'string' || !image.files) return\n\n const chosenVariation = image.files.find(\n (file) => file.variation === variation\n )\n\n return chosenVariation\n ? chosenVariation\n : image.files.find((file) => file.variation === 'original')\n }, [image, variation])\n\n // Create a srcset\n const sourceSet = useMemo(() => {\n if (!source) return\n\n // source is only defined if image is a MediaObject, so we assert it as one\n const img = image as MediaObject\n\n const sets = []\n const large = img.files.find((file) => file.variation === 'large')\n const medium = img.files.find((file) => file.variation === 'medium')\n const thumbnail = img.files.find((file) => file.variation === 'thumbnail')\n\n if (thumbnail)\n sets.push(`${encodeURI(thumbnail.path)} ${thumbnail.meta?.width}w`)\n if (medium) sets.push(`${encodeURI(medium.path)} 600w`)\n if (large) sets.push(`${encodeURI(large.path)} 1200w`)\n sets.push(`${encodeURI(source.path)} ${source.meta?.width}w`)\n\n return sets.join(',')\n }, [source, image])\n\n const imageStyle = useMemo(() => {\n return {\n backgroundColor:\n background || hasLoaded || typeof image === 'string'\n ? 'transparent'\n : `#${source?.background_color ?? 'transparent'}`,\n }\n }, [background, source, hasLoaded, image])\n\n useEffect(() => {\n let ref: HTMLImageElement | null = null\n const observer = new IntersectionObserver(\n (entries, observer) => {\n if (entries[0].intersectionRatio > 0) {\n // Image entered the viewport, set it as loadable\n setCanLoad(true)\n\n // Stop observing the image\n observer.unobserve(ref as HTMLImageElement)\n }\n },\n {\n root: lazyRoot?.current,\n rootMargin: lazyRootMargin,\n }\n )\n\n if (imageRef.current) {\n ref = imageRef.current\n observer.observe(ref)\n }\n\n const loadHandler = () => {\n // After loading the image, the \"hasLoaded\" flag is used to hide the background color\n setHasLoaded(true)\n }\n\n ref?.addEventListener('load', loadHandler)\n\n return () => {\n if (ref) {\n observer.unobserve(ref)\n ref.removeEventListener('load', loadHandler)\n }\n }\n }, [source])\n\n return (\n <>\n <img\n ref={imageRef}\n className={'sl-lazyload ' + className}\n style={imageStyle}\n src={canLoad ? source?.path || (image as string) : transparentImage}\n srcSet={canLoad ? (sourceSet ? sourceSet : undefined) : undefined}\n sizes={canLoad ? (sourceSet ? sizes : undefined) : undefined}\n alt={alt}\n />\n <noscript>\n <img src={(source && source.path) || (image as string)} alt={alt} />\n </noscript>\n </>\n )\n}\n\nexport type { ResponsiveImageProps }\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ResponsiveImage/index.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEZ,+CAA8E;AAI9E,MAAM,gBAAgB,GACpB,4EAA4E,CAAA;AAE9E;;;;;;;;;GASG;AAEI,MAAM,oBAAoB,GAAG,GAAc,EAAE;IAClD,OAAO,CACL;QACE,6CAAQ,iCAAiC,CAAS,CACzC,CACZ,CAAA;AACH,CAAC,CAAA;AANY,QAAA,oBAAoB,wBAMhC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACI,MAAM,eAAe,GAAG,CAAC,EAC9B,SAAS,GAAG,EAAE,EACd,KAAK,EACL,KAAK,GAAG,EAAE,EACV,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,C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A,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAK,KAAgB,CAAC,CAAC,CAAC,gBAAgB,EACnE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,EACjE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,EAC5D,GAAG,EAAE,GAAG,GACR;QACF;YACE,uCAAK,GAAG,EAAE,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,IAAK,KAAgB,EAAE,GAAG,EAAE,GAAG,GAAI,CAC3D,CACV,CACJ,CAAA;AACH,CAAC,CAAA;AApHY,QAAA,eAAe,mBAoH3B","sourcesContent":["'use client'\n\nimport React, { ReactNode, useEffect, useMemo, useRef, useState } from 'react'\nimport { MediaObject } from '@starlightcms/js-sdk'\nimport { ResponsiveImageProps } from './types'\n\nconst transparentImage =\n 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='\n\n/**\n * Renders a `<style>` tag with a rule that disables lazy-loading when JavaScript\n * is disabled in the browser. This is useful to web crawlers that don't run\n * JS files, which is important for SEO.\n *\n * You only need to render this component once in your application,\n * preferably in the `<head>` section.\n *\n * @group ResponsiveImage\n */\n\nexport const GlobalLazyloadStyles = (): ReactNode => {\n return (\n <noscript>\n <style>{'img.sl-lazyload{display: none;}'}</style>\n </noscript>\n )\n}\n\n/**\n * Renders an image from a given Starlight media object. The Starlight\n * optimized image will be rendered by default if no `variation` prop is passed.\n *\n * If the `sizes` prop is passed, a responsive image will be rendered by\n * generating a \"src-set\" property.\n *\n * The image will be lazy-loaded, which means that it should only load\n * when the browser viewport gets near the image.\n *\n * @example Requesting an entry and rendering an image.\n *\n * Assume we created a \"Posts\" model with a slug of `posts`, and placed a Media\n * File field with a key of `featured_image` on it.\n *\n * ```jsx\n * import Starlight, { ResponsiveImage } from '@starlightcms/react-sdk'\n *\n * const EntryComponent = ({ slug }) => {\n * const [entry, setEntry] = useState(null)\n *\n * useEffect(async () => {\n * // This is just an example, you could fetch\n * // the entry any way you want.\n * const response = await Starlight.posts.entries.get(slug)\n *\n * setEntry(response.data)\n * }, [ slug ])\n *\n * // After fetching, the image will be on the `entry.data.featured_image` property.\n * return (\n * entry ? (\n * <article>\n * <h1>{entry.title}</h1>\n * <ResponsiveImage image={entry.data.featured_image} />\n * </article>\n * ) : (\n * <div>Loading...</div>\n * )\n * )\n * }\n *\n * ```\n *\n * @param props Component props. See {@link ResponsiveImageProps} to see the\n * available options.\n * @group ResponsiveImage\n */\nexport const ResponsiveImage = ({\n className = '',\n image,\n sizes = '',\n alt = typeof image === 'string' ? '' : image.alt,\n variation = 'optimized',\n background = '',\n lazyRoot,\n lazyRootMargin = '200px',\n}: ResponsiveImageProps): JSX.Element => {\n const imageRef = useRef<HTMLImageElement>(null)\n\n // When true, the image may load normally\n const [canLoad, setCanLoad] = useState(false)\n\n // When true, the image has been successfully loaded by the browser\n const [hasLoaded, setHasLoaded] = useState(false)\n\n // Get the optimized variation if available\n const source = useMemo(() => {\n // If the given image was a string, simply return it\n if (typeof image === 'string' || !image.files) return\n\n const chosenVariation = image.files.find(\n (file) => file.variation === variation\n )\n\n return chosenVariation\n ? chosenVariation\n : image.files.find((file) => file.variation === 'original')\n }, [image, variation])\n\n // Create a srcset\n const sourceSet = useMemo(() => {\n if (!source) return\n\n // source is only defined if image is a MediaObject, so we assert it as one\n const img = image as MediaObject\n\n const sets = []\n const large = img.files.find((file) => file.variation === 'large')\n const medium = img.files.find((file) => file.variation === 'medium')\n const thumbnail = img.files.find((file) => file.variation === 'thumbnail')\n\n if (thumbnail)\n sets.push(`${encodeURI(thumbnail.path)} ${thumbnail.meta?.width}w`)\n if (medium) sets.push(`${encodeURI(medium.path)} 600w`)\n if (large) sets.push(`${encodeURI(large.path)} 1200w`)\n sets.push(`${encodeURI(source.path)} ${source.meta?.width}w`)\n\n return sets.join(',')\n }, [source, image])\n\n const imageStyle = useMemo(() => {\n return {\n backgroundColor:\n background || hasLoaded || typeof image === 'string'\n ? 'transparent'\n : `#${source?.background_color ?? 'transparent'}`,\n }\n }, [background, source, hasLoaded, image])\n\n useEffect(() => {\n let ref: HTMLImageElement | null = null\n const observer = new IntersectionObserver(\n (entries, observer) => {\n if (entries[0].intersectionRatio > 0) {\n // Image entered the viewport, set it as loadable\n setCanLoad(true)\n\n // Stop observing the image\n observer.unobserve(ref as HTMLImageElement)\n }\n },\n {\n root: lazyRoot?.current,\n rootMargin: lazyRootMargin,\n }\n )\n\n if (imageRef.current) {\n ref = imageRef.current\n observer.observe(ref)\n }\n\n const loadHandler = () => {\n // After loading the image, the \"hasLoaded\" flag is used to hide the background color\n setHasLoaded(true)\n }\n\n ref?.addEventListener('load', loadHandler)\n\n return () => {\n if (ref) {\n observer.unobserve(ref)\n ref.removeEventListener('load', loadHandler)\n }\n }\n }, [source])\n\n return (\n <>\n <img\n ref={imageRef}\n className={'sl-lazyload sl-responsive-image ' + className}\n style={imageStyle}\n src={canLoad ? source?.path || (image as string) : transparentImage}\n srcSet={canLoad ? (sourceSet ? sourceSet : undefined) : undefined}\n sizes={canLoad ? (sourceSet ? sizes : undefined) : undefined}\n alt={alt}\n />\n <noscript>\n <img src={(source && source.path) || (image as string)} alt={alt} />\n </noscript>\n </>\n )\n}\n\nexport type { ResponsiveImageProps }\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/HTML/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/HTML/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAEjC;;;;;;;;;;GAUG;AACH,QAAA,MAAM,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,CAWxC,CAAA;AAED,eAAe,IAAI,CAAA"}
|
|
@@ -3,8 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const styles_1 = require("../../styles");
|
|
7
|
-
const styles_2 = require("./styles");
|
|
8
6
|
const react_1 = __importDefault(require("react"));
|
|
9
7
|
/**
|
|
10
8
|
* VisualContent renderer component that renders `raw` type blocks
|
|
@@ -17,9 +15,9 @@ const react_1 = __importDefault(require("react"));
|
|
|
17
15
|
* type of data this component receives.
|
|
18
16
|
* @group VisualContent Renderers
|
|
19
17
|
*/
|
|
20
|
-
const HTML = ({ data }) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
18
|
+
const HTML = ({ data }) => (react_1.default.createElement("div", { className: `sl-content-block sl-html
|
|
19
|
+
${data.isStretched ? 'sl-stretched' : ''}
|
|
20
|
+
` },
|
|
21
|
+
react_1.default.createElement("div", { className: "sl-html__root", dangerouslySetInnerHTML: { __html: data.html } })));
|
|
24
22
|
exports.default = HTML;
|
|
25
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/HTML/index.tsx"],"names":[],"mappings":";;;;;AACA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/HTML/index.tsx"],"names":[],"mappings":";;;;;AACA,kDAAiC;AAEjC;;;;;;;;;;GAUG;AACH,MAAM,IAAI,GAAmC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CACzD,uCACE,SAAS,EAAE;MACT,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;KACvC;IAED,uCACE,SAAS,EAAC,eAAe,EACzB,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,GAC9C,CACE,CACP,CAAA;AAED,kBAAe,IAAI,CAAA","sourcesContent":["import { HTMLBlock, VisualDataBlock } from '@starlightcms/js-sdk'\nimport React, { FC } from 'react'\n\n/**\n * VisualContent renderer component that renders `raw` type blocks\n * as inline HTML inside a `div` element.\n *\n * See {@doclink components/VisualContent/#customizing-components | the guide page on the VisualContent component}\n * to learn how to customize block renderer components like this one.\n *\n * @param props VisualDataBlock object. See {@link HTMLBlock} to learn the\n * type of data this component receives.\n * @group VisualContent Renderers\n */\nconst HTML: FC<VisualDataBlock<HTMLBlock>> = ({ data }) => (\n <div\n className={`sl-content-block sl-html \n ${data.isStretched ? 'sl-stretched' : ''}\n `}\n >\n <div\n className=\"sl-html__root\"\n dangerouslySetInnerHTML={{ __html: data.html }}\n />\n </div>\n)\n\nexport default HTML\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../src/VisualContent/blocks/Header.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../src/VisualContent/blocks/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGnE;;;;;;;;;;GAUG;AACH,QAAA,MAAM,MAAM,GAAI,UAAU,eAAe,CAAC,WAAW,CAAC,KAAG,GAAG,CAAC,OAe5D,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const styles_1 = require("../styles");
|
|
7
6
|
const react_1 = __importDefault(require("react"));
|
|
8
7
|
/**
|
|
9
8
|
* VisualContent renderer component that renders `header` type blocks
|
|
@@ -17,8 +16,12 @@ const react_1 = __importDefault(require("react"));
|
|
|
17
16
|
* @group VisualContent Renderers
|
|
18
17
|
*/
|
|
19
18
|
const Header = ({ data }) => {
|
|
19
|
+
const { alignment, isStretched } = data;
|
|
20
20
|
const HeaderComponent = `h${data.level}`;
|
|
21
|
-
return (react_1.default.createElement(
|
|
21
|
+
return (react_1.default.createElement("div", { className: `sl-content-block sl-header
|
|
22
|
+
${alignment ? `sl-alignment-${alignment}` : ''}
|
|
23
|
+
${isStretched ? 'sl-stretched' : ''}
|
|
24
|
+
` },
|
|
22
25
|
react_1.default.createElement(HeaderComponent, { dangerouslySetInnerHTML: { __html: data.text } })));
|
|
23
26
|
};
|
|
24
27
|
exports.default = Header;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../../../src/VisualContent/blocks/Header.tsx"],"names":[],"mappings":";;;;;AACA,
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../../../src/VisualContent/blocks/Header.tsx"],"names":[],"mappings":";;;;;AACA,kDAAyB;AAEzB;;;;;;;;;;GAUG;AACH,MAAM,MAAM,GAAG,CAAC,EAAE,IAAI,EAAgC,EAAe,EAAE;IACrE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,IAAI,CAAA;IAEvC,MAAM,eAAe,GAAG,IAAI,IAAI,CAAC,KAAK,EAAU,CAAA;IAEhD,OAAO,CACL,uCACE,SAAS,EAAE;QACT,SAAS,CAAC,CAAC,CAAC,gBAAgB,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE;QAC5C,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;OAClC;QAED,8BAAC,eAAe,IAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,GAAI,CAC/D,CACP,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,MAAM,CAAA","sourcesContent":["import { HeaderBlock, VisualDataBlock } from '@starlightcms/js-sdk'\nimport React from 'react'\n\n/**\n * VisualContent renderer component that renders `header` type blocks\n * as HTML heading elements, like `<h1>`, `<h2>`, and so on.\n *\n * See {@doclink components/VisualContent/#customizing-components | the guide page on the VisualContent component}\n * to learn how to customize block renderer components like this one.\n *\n * @param props VisualDataBlock object. See {@link HeaderBlock} to learn the\n * type of data this component receives.\n * @group VisualContent Renderers\n */\nconst Header = ({ data }: VisualDataBlock<HeaderBlock>): JSX.Element => {\n const { alignment, isStretched } = data\n\n const HeaderComponent = `h${data.level}` as 'h1'\n\n return (\n <div\n className={`sl-content-block sl-header \n ${alignment ? `sl-alignment-${alignment}` : ''}\n ${isStretched ? 'sl-stretched' : ''}\n `}\n >\n <HeaderComponent dangerouslySetInnerHTML={{ __html: data.text }} />\n </div>\n )\n}\n\nexport default Header\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/Image/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAc,EAAE,EAAE,EAAgC,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/Image/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAc,EAAE,EAAE,EAAgC,MAAM,OAAO,CAAA;AAE/D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,UAAU,CAAC,GAAG,YAAY,CA2GzD,CAAA;AAED,eAAe,KAAK,CAAA"}
|
|
@@ -15,17 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
const react_1 = __importStar(require("react"));
|
|
27
|
-
const styles_1 = require("./styles");
|
|
28
|
-
const styles_2 = require("../../styles");
|
|
29
37
|
/**
|
|
30
38
|
* VisualContent renderer component that renders `image` type blocks
|
|
31
39
|
* as a responsive image along with its caption (if defined). Optionally
|
|
@@ -44,10 +52,34 @@ const styles_2 = require("../../styles");
|
|
|
44
52
|
* @group VisualContent Renderers
|
|
45
53
|
*/
|
|
46
54
|
const Image = ({ data, sizes = '(max-width: 480px) 90vw, 70vw', }) => {
|
|
47
|
-
const { url, alt = '', files, caption, width, href, responsive } = data;
|
|
55
|
+
const { url, alt = '', files, caption, width, href, responsive, alignment, isStretched, } = data;
|
|
48
56
|
const widthType = ['auto', 'justify', 'max'].includes(width) ? width : 'fixed';
|
|
49
57
|
const [target, setTarget] = (0, react_1.useState)('_self');
|
|
50
58
|
const [originalWidth, setOriginalWidth] = (0, react_1.useState)(undefined);
|
|
59
|
+
const calculatedWidth = (0, react_1.useMemo)(() => {
|
|
60
|
+
switch (width) {
|
|
61
|
+
case 'auto':
|
|
62
|
+
return 'auto';
|
|
63
|
+
case 'justify':
|
|
64
|
+
case 'max':
|
|
65
|
+
return '100%';
|
|
66
|
+
default:
|
|
67
|
+
return width;
|
|
68
|
+
}
|
|
69
|
+
}, [width]);
|
|
70
|
+
const calculatedMaxWidth = (0, react_1.useMemo)(() => {
|
|
71
|
+
if (responsive && originalWidth && width === 'auto')
|
|
72
|
+
return originalWidth;
|
|
73
|
+
switch (width) {
|
|
74
|
+
case 'auto':
|
|
75
|
+
return '100%';
|
|
76
|
+
case 'justify':
|
|
77
|
+
case 'max':
|
|
78
|
+
return 'initial';
|
|
79
|
+
default:
|
|
80
|
+
return originalWidth;
|
|
81
|
+
}
|
|
82
|
+
}, [width, responsive, originalWidth]);
|
|
51
83
|
const srcSet = (0, react_1.useMemo)(() => {
|
|
52
84
|
return data.files.map((file) => `${file.url} ${file.width}w`).join(', ');
|
|
53
85
|
}, [data]);
|
|
@@ -60,10 +92,16 @@ const Image = ({ data, sizes = '(max-width: 480px) 90vw, 70vw', }) => {
|
|
|
60
92
|
const optimizedFile = files.find((f) => f.variation === 'optimized');
|
|
61
93
|
setOriginalWidth(optimizedFile ? optimizedFile.width.toString() + 'px' : undefined);
|
|
62
94
|
}, []);
|
|
63
|
-
return (react_1.default.createElement(
|
|
64
|
-
|
|
95
|
+
return (react_1.default.createElement("div", { className: `sl-content-block sl-image
|
|
96
|
+
${alignment ? `sl-alignment-${alignment}` : ''}
|
|
97
|
+
${isStretched || widthType === 'max' ? 'sl-stretched' : ''}
|
|
98
|
+
` },
|
|
99
|
+
react_1.default.createElement("figure", { className: `sl-figure sl-image--width-${widthType}`, style: {
|
|
100
|
+
width: calculatedWidth,
|
|
101
|
+
maxWidth: calculatedMaxWidth,
|
|
102
|
+
} },
|
|
65
103
|
href ? (react_1.default.createElement("a", { href: href, target: target },
|
|
66
|
-
react_1.default.createElement(
|
|
104
|
+
react_1.default.createElement("img", { className: "sl-image__img", src: url, alt: alt, srcSet: srcSet, sizes: responsive ? sizes : undefined }))) : (react_1.default.createElement("img", { className: "sl-image__img", src: url, alt: alt, srcSet: srcSet, sizes: responsive ? sizes : undefined })),
|
|
67
105
|
caption && (react_1.default.createElement("figcaption", { dangerouslySetInnerHTML: { __html: caption } })))));
|
|
68
106
|
};
|
|
69
107
|
exports.default = Image;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/Image/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/Image/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAA+D;AAS/D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,KAAK,GAAmD,CAAC,EAC7D,IAAI,EACJ,KAAK,GAAG,+BAA+B,GACxC,EAAE,EAAE;IACH,MAAM,EACJ,GAAG,EACH,GAAG,GAAG,EAAE,EACR,KAAK,EACL,OAAO,EACP,KAAK,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,WAAW,GACZ,GAAG,IAAI,CAAA;IAER,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,C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AAE,MAAM,EACd,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,GACrC,CACH;YACA,OAAO,IAAI,CACV,8CAAY,uBAAuB,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAI,CAC7D,CACM,CACL,CACP,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,KAAK,CAAA","sourcesContent":["import { ImageBlock, VisualDataBlock } from '@starlightcms/js-sdk'\nimport React, { FC, useEffect, useMemo, useState } from 'react'\n\n/**\n * Type used by {@link ImageComponent} to accept a `sizes` prop.\n */\nexport type ImageOptions = {\n sizes?: string\n}\n\n/**\n * VisualContent renderer component that renders `image` type blocks\n * as a responsive image along with its caption (if defined). Optionally\n * wraps the image in an anchor if a link is defined in the content.\n *\n * See {@doclink components/VisualContent/#customizing-components | the guide page on the VisualContent component}\n * to learn how to customize block renderer components like this one.\n *\n * This component also supports an optional `sizes` prop to provide better image\n * responsiveness, see {@doclink components/VisualContent/#responsive-images | the guide page on responsive images}\n * to learn more.\n *\n * @param props VisualDataBlock object. See {@link ImageBlock} to learn the\n * type of data this component receives. Also accepts\n * an optional `sizes` string prop.\n * @group VisualContent Renderers\n */\nconst Image: FC<VisualDataBlock<ImageBlock> & ImageOptions> = ({\n data,\n sizes = '(max-width: 480px) 90vw, 70vw',\n}) => {\n const {\n url,\n alt = '',\n files,\n caption,\n width,\n href,\n responsive,\n alignment,\n isStretched,\n } = data\n\n const widthType = ['auto', 'justify', 'max'].includes(width) ? width : 'fixed'\n\n const [target, setTarget] = useState('_self')\n const [originalWidth, setOriginalWidth] = useState<string | undefined>(\n undefined\n )\n\n const calculatedWidth = useMemo(() => {\n switch (width) {\n case 'auto':\n return 'auto'\n case 'justify':\n case 'max':\n return '100%'\n default:\n return width\n }\n }, [width])\n\n const calculatedMaxWidth = useMemo(() => {\n if (responsive && originalWidth && width === 'auto') return originalWidth\n\n switch (width) {\n case 'auto':\n return '100%'\n case 'justify':\n case 'max':\n return 'initial'\n default:\n return originalWidth\n }\n }, [width, responsive, originalWidth])\n\n const srcSet = useMemo(() => {\n return data.files.map((file) => `${file.url} ${file.width}w`).join(', ')\n }, [data])\n\n useEffect(() => {\n if (!href) return\n\n setTarget(\n new URL(href).origin === window.location.origin ? '_self' : '_blank'\n )\n }, [href])\n\n useEffect(() => {\n const optimizedFile = files.find((f) => f.variation === 'optimized')\n setOriginalWidth(\n optimizedFile ? optimizedFile.width.toString() + 'px' : undefined\n )\n }, [])\n\n return (\n <div\n className={`sl-content-block sl-image \n ${alignment ? `sl-alignment-${alignment}` : ''} \n ${isStretched || widthType === 'max' ? 'sl-stretched' : ''}\n `}\n >\n <figure\n className={`sl-figure sl-image--width-${widthType}`}\n style={{\n width: calculatedWidth,\n maxWidth: calculatedMaxWidth,\n }}\n >\n {href ? (\n <a href={href} target={target}>\n <img\n className=\"sl-image__img\"\n src={url}\n alt={alt}\n srcSet={srcSet}\n sizes={responsive ? sizes : undefined}\n />\n </a>\n ) : (\n <img\n className=\"sl-image__img\"\n src={url}\n alt={alt}\n srcSet={srcSet}\n sizes={responsive ? sizes : undefined}\n />\n )}\n {caption && (\n <figcaption dangerouslySetInnerHTML={{ __html: caption }} />\n )}\n </figure>\n </div>\n )\n}\n\nexport default Image\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/List/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,eAAe,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/List/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAqBjC;;;;;;;;;;GAUG;AACH,QAAA,MAAM,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,CAgBxC,CAAA;AAED,eAAe,IAAI,CAAA"}
|
|
@@ -3,15 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const styles_1 = require("../../styles");
|
|
7
|
-
const styles_2 = require("./styles");
|
|
8
6
|
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const SubList = ({ item, Wrapper }) =>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
item.items
|
|
13
|
-
item.items.map((subItem, index) => (react_1.default.createElement(SubList, { key: index, item: subItem, Wrapper: Wrapper }))))) : null));
|
|
14
|
-
};
|
|
7
|
+
const SubList = ({ item, Wrapper }) => (react_1.default.createElement("li", null,
|
|
8
|
+
react_1.default.createElement("span", { dangerouslySetInnerHTML: { __html: item.content } }),
|
|
9
|
+
item.items && item.items.length ? (react_1.default.createElement(Wrapper, null, item.items &&
|
|
10
|
+
item.items.map((subItem, index) => (react_1.default.createElement(SubList, { key: index, item: subItem, Wrapper: Wrapper }))))) : null));
|
|
15
11
|
/**
|
|
16
12
|
* VisualContent renderer component that renders `list` type blocks
|
|
17
13
|
* as `<ul>` or `<ol>` elements, depending on the list style.
|
|
@@ -24,9 +20,11 @@ const SubList = ({ item, Wrapper }) => {
|
|
|
24
20
|
* @group VisualContent Renderers
|
|
25
21
|
*/
|
|
26
22
|
const List = ({ data }) => {
|
|
27
|
-
const
|
|
28
|
-
return (react_1.default.createElement(
|
|
29
|
-
|
|
23
|
+
const ListWrapper = data.style === 'ordered' ? 'ol' : 'ul';
|
|
24
|
+
return (react_1.default.createElement("div", { className: `sl-content-block sl-list
|
|
25
|
+
${data.isStretched ? 'sl-stretched' : ''}
|
|
26
|
+
` },
|
|
27
|
+
react_1.default.createElement(ListWrapper, { className: "sl-list__root" }, data.items.map((item, index) => (react_1.default.createElement(SubList, { key: index, item: item, Wrapper: ListWrapper }))))));
|
|
30
28
|
};
|
|
31
29
|
exports.default = List;
|
|
32
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/List/index.tsx"],"names":[],"mappings":";;;;;AACA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/List/index.tsx"],"names":[],"mappings":";;;;;AACA,kDAAiC;AAOjC,MAAM,OAAO,GAAqB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CACvD;IACE,wCAAM,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,GAAI;IAC1D,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CACjC,8BAAC,OAAO,QACL,IAAI,CAAC,KAAK;QACT,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CACjC,8BAAC,OAAO,IAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAI,CACzD,CAAC,CACI,CACX,CAAC,CAAC,CAAC,IAAI,CACL,CACN,CAAA;AAED;;;;;;;;;;GAUG;AACH,MAAM,IAAI,GAAmC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IACxD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;IAE1D,OAAO,CACL,uCACE,SAAS,EAAE;QACT,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;OACvC;QAED,8BAAC,WAAW,IAAC,SAAS,EAAC,eAAe,IACnC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC/B,8BAAC,OAAO,IAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,GAAI,CAC1D,CAAC,CACU,CACV,CACP,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,IAAI,CAAA","sourcesContent":["import { ListBlock, ListItem, VisualDataBlock } from '@starlightcms/js-sdk'\nimport React, { FC } from 'react'\n\ntype SubListProps = {\n item: ListItem\n Wrapper: 'ul' | 'ol'\n}\n\nconst SubList: FC<SubListProps> = ({ item, Wrapper }) => (\n <li>\n <span dangerouslySetInnerHTML={{ __html: item.content }} />\n {item.items && item.items.length ? (\n <Wrapper>\n {item.items &&\n item.items.map((subItem, index) => (\n <SubList key={index} item={subItem} Wrapper={Wrapper} />\n ))}\n </Wrapper>\n ) : null}\n </li>\n)\n\n/**\n * VisualContent renderer component that renders `list` type blocks\n * as `<ul>` or `<ol>` elements, depending on the list style.\n *\n * See {@doclink components/VisualContent/#customizing-components | the guide page on the VisualContent component}\n * to learn how to customize block renderer components like this one.\n *\n * @param props VisualDataBlock object. See {@link ListBlock} to learn the\n * type of data this component receives.\n * @group VisualContent Renderers\n */\nconst List: FC<VisualDataBlock<ListBlock>> = ({ data }) => {\n const ListWrapper = data.style === 'ordered' ? 'ol' : 'ul'\n\n return (\n <div\n className={`sl-content-block sl-list\n ${data.isStretched ? 'sl-stretched' : ''}\n `}\n >\n <ListWrapper className=\"sl-list__root\">\n {data.items.map((item, index) => (\n <SubList key={index} item={item} Wrapper={ListWrapper} />\n ))}\n </ListWrapper>\n </div>\n )\n}\n\nexport default List\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paragraph.d.ts","sourceRoot":"","sources":["../../../../src/VisualContent/blocks/Paragraph.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"Paragraph.d.ts","sourceRoot":"","sources":["../../../../src/VisualContent/blocks/Paragraph.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAEjC;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC,eAAe,CAAC,cAAc,CAAC,CAqBlD,CAAA;AAED,eAAe,SAAS,CAAA"}
|
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const styles_1 = require("../styles");
|
|
7
6
|
const react_1 = __importDefault(require("react"));
|
|
8
7
|
/**
|
|
9
8
|
* VisualContent renderer component that renders `paragraph` type blocks
|
|
@@ -18,11 +17,15 @@ const react_1 = __importDefault(require("react"));
|
|
|
18
17
|
* @group VisualContent Renderers
|
|
19
18
|
*/
|
|
20
19
|
const Paragraph = ({ data }) => {
|
|
20
|
+
const { alignment, isStretched } = data;
|
|
21
|
+
const baseClasses = `sl-content-block sl-paragraph
|
|
22
|
+
${alignment ? `sl-alignment-${alignment}` : ''}
|
|
23
|
+
${isStretched ? 'sl-stretched' : ''}`;
|
|
21
24
|
if (!data.text)
|
|
22
|
-
return (react_1.default.createElement(
|
|
25
|
+
return (react_1.default.createElement("div", { className: `${baseClasses} empty`, "aria-hidden": true },
|
|
23
26
|
react_1.default.createElement("p", null,
|
|
24
27
|
react_1.default.createElement("br", null))));
|
|
25
|
-
return (react_1.default.createElement(
|
|
28
|
+
return (react_1.default.createElement("div", { className: baseClasses },
|
|
26
29
|
react_1.default.createElement("p", { dangerouslySetInnerHTML: { __html: data.text } })));
|
|
27
30
|
};
|
|
28
31
|
exports.default = Paragraph;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paragraph.js","sourceRoot":"","sources":["../../../../src/VisualContent/blocks/Paragraph.tsx"],"names":[],"mappings":";;;;;AACA,
|
|
1
|
+
{"version":3,"file":"Paragraph.js","sourceRoot":"","sources":["../../../../src/VisualContent/blocks/Paragraph.tsx"],"names":[],"mappings":";;;;;AACA,kDAAiC;AAEjC;;;;;;;;;;;GAWG;AACH,MAAM,SAAS,GAAwC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAClE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,IAAI,CAAA;IAEvC,MAAM,WAAW,GAAG;UACZ,SAAS,CAAC,CAAC,CAAC,gBAAgB,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE;UAC5C,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;IAE3C,IAAI,CAAC,IAAI,CAAC,IAAI;QACZ,OAAO,CACL,uCAAK,SAAS,EAAE,GAAG,WAAW,QAAQ;YACpC;gBACE,yCAAM,CACJ,CACA,CACP,CAAA;IAEH,OAAO,CACL,uCAAK,SAAS,EAAE,WAAW;QACzB,qCAAG,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,GAAI,CACjD,CACP,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,SAAS,CAAA","sourcesContent":["import { ParagraphBlock, VisualDataBlock } from '@starlightcms/js-sdk'\nimport React, { FC } from 'react'\n\n/**\n * VisualContent renderer component that renders `paragraph` type blocks\n * as `<p>` elements. Empty paragraph blocks (generally used to break\n * lines) will have an `empty` class added to them.\n *\n * See {@doclink components/VisualContent/#customizing-components | the guide page on the VisualContent component}\n * to learn how to customize block renderer components like this one.\n *\n * @param props VisualDataBlock object. See {@link ParagraphBlock} to learn the\n * type of data this component receives.\n * @group VisualContent Renderers\n */\nconst Paragraph: FC<VisualDataBlock<ParagraphBlock>> = ({ data }) => {\n const { alignment, isStretched } = data\n\n const baseClasses = `sl-content-block sl-paragraph \n ${alignment ? `sl-alignment-${alignment}` : ''}\n ${isStretched ? 'sl-stretched' : ''}`\n\n if (!data.text)\n return (\n <div className={`${baseClasses} empty`} aria-hidden>\n <p>\n <br />\n </p>\n </div>\n )\n\n return (\n <div className={baseClasses}>\n <p dangerouslySetInnerHTML={{ __html: data.text }} />\n </div>\n )\n}\n\nexport default Paragraph\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Quote.d.ts","sourceRoot":"","sources":["../../../../src/VisualContent/blocks/Quote.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"Quote.d.ts","sourceRoot":"","sources":["../../../../src/VisualContent/blocks/Quote.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAEjC;;;;;;;;;;GAUG;AACH,QAAA,MAAM,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,UAAU,CAAC,CAM1C,CAAA;AAED,eAAe,KAAK,CAAA"}
|
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const styles_1 = require("../styles");
|
|
7
6
|
const react_1 = __importDefault(require("react"));
|
|
8
7
|
/**
|
|
9
8
|
* VisualContent renderer component that renders `quote` type blocks
|
|
@@ -17,7 +16,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
17
16
|
* @group VisualContent Renderers
|
|
18
17
|
*/
|
|
19
18
|
const Quote = ({ data }) => {
|
|
20
|
-
return (react_1.default.createElement(
|
|
19
|
+
return (react_1.default.createElement("div", { className: "sl-content-block sl-quote" },
|
|
21
20
|
react_1.default.createElement("blockquote", null, data.text)));
|
|
22
21
|
};
|
|
23
22
|
exports.default = Quote;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Quote.js","sourceRoot":"","sources":["../../../../src/VisualContent/blocks/Quote.tsx"],"names":[],"mappings":";;;;;AACA,
|
|
1
|
+
{"version":3,"file":"Quote.js","sourceRoot":"","sources":["../../../../src/VisualContent/blocks/Quote.tsx"],"names":[],"mappings":";;;;;AACA,kDAAiC;AAEjC;;;;;;;;;;GAUG;AACH,MAAM,KAAK,GAAoC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAC1D,OAAO,CACL,uCAAK,SAAS,EAAC,2BAA2B;QACxC,kDAAa,IAAI,CAAC,IAAI,CAAc,CAChC,CACP,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,KAAK,CAAA","sourcesContent":["import { QuoteBlock, VisualDataBlock } from '@starlightcms/js-sdk'\nimport React, { FC } from 'react'\n\n/**\n * VisualContent renderer component that renders `quote` type blocks\n * as `<blockquote>` elements.\n *\n * See {@doclink components/VisualContent/#customizing-components | the guide page on the VisualContent component}\n * to learn how to customize block renderer components like this one.\n *\n * @param props VisualDataBlock object. See {@link QuoteBlock} to learn the\n * type of data this component receives.\n * @group VisualContent Renderers\n */\nconst Quote: FC<VisualDataBlock<QuoteBlock>> = ({ data }) => {\n return (\n <div className=\"sl-content-block sl-quote\">\n <blockquote>{data.text}</blockquote>\n </div>\n )\n}\n\nexport default Quote\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/Video/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/Video/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAEjC;;;;;;;;;;GAUG;AACH,QAAA,MAAM,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,UAAU,CAAC,CAwB1C,CAAA;AAED,eAAe,KAAK,CAAA"}
|
|
@@ -3,8 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const styles_1 = require("../../styles");
|
|
7
|
-
const styles_2 = require("./styles");
|
|
8
6
|
const react_1 = __importDefault(require("react"));
|
|
9
7
|
/**
|
|
10
8
|
* VisualContent renderer component that renders `video` type blocks
|
|
@@ -18,11 +16,14 @@ const react_1 = __importDefault(require("react"));
|
|
|
18
16
|
* @group VisualContent Renderers
|
|
19
17
|
*/
|
|
20
18
|
const Video = ({ data }) => {
|
|
21
|
-
const { html, width, caption } = data;
|
|
19
|
+
const { html, width, caption, alignment, isStretched } = data;
|
|
22
20
|
const widthType = ['auto', 'justify', 'max'].includes(width) ? width : 'fixed';
|
|
23
|
-
return (react_1.default.createElement(
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
return (react_1.default.createElement("div", { className: `sl-content-block sl-video
|
|
22
|
+
${alignment ? `sl-alignment-${alignment}` : ''}
|
|
23
|
+
${isStretched || widthType === 'max' ? 'sl-stretched' : ''}
|
|
24
|
+
` },
|
|
25
|
+
react_1.default.createElement("figure", { className: `sl-figure sl-video--width-${widthType}` },
|
|
26
|
+
react_1.default.createElement("div", { dangerouslySetInnerHTML: { __html: html }, style: { maxWidth: widthType === 'fixed' ? `${width}` : undefined } }),
|
|
26
27
|
caption && (react_1.default.createElement("figcaption", { dangerouslySetInnerHTML: { __html: caption } })))));
|
|
27
28
|
};
|
|
28
29
|
exports.default = Video;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/Video/index.tsx"],"names":[],"mappings":";;;;;AACA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/VisualContent/blocks/Video/index.tsx"],"names":[],"mappings":";;;;;AACA,kDAAiC;AAEjC;;;;;;;;;;GAUG;AACH,MAAM,KAAK,GAAoC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAC1D,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,IAAI,CAAA;IAE7D,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;IAE9E,OAAO,CACL,uCACE,SAAS,EAAE;QACT,SAAS,CAAC,CAAC,CAAC,gBAAgB,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE;QAC5C,WAAW,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;OACzD;QAED,0CAAQ,SAAS,EAAE,6BAA6B,SAAS,EAAE;YACzD,uCACE,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EACzC,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,GACnE;YAED,OAAO,IAAI,CACV,8CAAY,uBAAuB,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAI,CAC7D,CACM,CACL,CACP,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,KAAK,CAAA","sourcesContent":["import { VideoBlock, VisualDataBlock } from '@starlightcms/js-sdk'\nimport React, { FC } from 'react'\n\n/**\n * VisualContent renderer component that renders `video` type blocks\n * as a responsive video along with its caption (if defined).\n *\n * See {@doclink components/VisualContent/#customizing-components | the guide page on the VisualContent component}\n * to learn how to customize block renderer components like this one.\n *\n * @param props VisualDataBlock object. See {@link VideoBlock} to learn the\n * type of data this component receives.\n * @group VisualContent Renderers\n */\nconst Video: FC<VisualDataBlock<VideoBlock>> = ({ data }) => {\n const { html, width, caption, alignment, isStretched } = data\n\n const widthType = ['auto', 'justify', 'max'].includes(width) ? width : 'fixed'\n\n return (\n <div\n className={`sl-content-block sl-video \n ${alignment ? `sl-alignment-${alignment}` : ''}\n ${isStretched || widthType === 'max' ? 'sl-stretched' : ''}\n `}\n >\n <figure className={`sl-figure sl-video--width-${widthType}`}>\n <div\n dangerouslySetInnerHTML={{ __html: html }}\n style={{ maxWidth: widthType === 'fixed' ? `${width}` : undefined }}\n />\n\n {caption && (\n <figcaption dangerouslySetInnerHTML={{ __html: caption }} />\n )}\n </figure>\n </div>\n )\n}\n\nexport default Video\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/VisualContent/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/VisualContent/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAmB,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAC7D,OAAO,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAE1C,OAAO,MAAM,MAAM,iBAAiB,CAAA;AACpC,OAAO,KAAK,MAAM,gBAAgB,CAAA;AAClC,OAAO,IAAI,MAAM,eAAe,CAAA;AAChC,OAAO,IAAI,MAAM,eAAe,CAAA;AAChC,OAAO,KAAK,MAAM,gBAAgB,CAAA;AAYlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,eAAO,MAAM,aAAa,GAAI,kDAK3B,kBAAkB,KAAG,GAAG,CAAC,OAoD3B,CAAA;AAED,OAAO,EACL,SAAS,IAAI,kBAAkB,EAC/B,MAAM,IAAI,eAAe,EACzB,KAAK,IAAI,cAAc,EACvB,KAAK,IAAI,cAAc,EACvB,IAAI,IAAI,aAAa,EACrB,IAAI,IAAI,aAAa,EACrB,KAAK,IAAI,cAAc,GACxB,CAAA;AAED,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -16,13 +16,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
16
16
|
}) : function(o, v) {
|
|
17
17
|
o["default"] = v;
|
|
18
18
|
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
26
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
38
|
};
|
|
@@ -32,7 +42,6 @@ const Image_1 = __importDefault(require("./blocks/Image"));
|
|
|
32
42
|
exports.ImageComponent = Image_1.default;
|
|
33
43
|
const Paragraph_1 = __importDefault(require("./blocks/Paragraph"));
|
|
34
44
|
exports.ParagraphComponent = Paragraph_1.default;
|
|
35
|
-
const styles_1 = require("./styles");
|
|
36
45
|
const react_1 = __importStar(require("react"));
|
|
37
46
|
const Header_1 = __importDefault(require("./blocks/Header"));
|
|
38
47
|
exports.HeaderComponent = Header_1.default;
|
|
@@ -120,7 +129,7 @@ const VisualContent = ({ content, components = {}, excerpt = false, excerptLengt
|
|
|
120
129
|
const Component = componentList.paragraph;
|
|
121
130
|
return (react_1.default.createElement(Component, { key: block.id, id: block.id, type: block.type, data: { text: excerptText } }));
|
|
122
131
|
}
|
|
123
|
-
return (react_1.default.createElement(
|
|
132
|
+
return (react_1.default.createElement("div", { className: "sl-visual-content" }, content.blocks.map((block) => {
|
|
124
133
|
const Component = componentList[block.type];
|
|
125
134
|
if (!Component)
|
|
126
135
|
return null;
|