react-datocms 1.6.9 → 2.1.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.
Files changed (50) hide show
  1. package/README.md +158 -60
  2. package/dist/cjs/Image/__tests__/index.test.js +32 -28
  3. package/dist/cjs/Image/__tests__/index.test.js.map +1 -1
  4. package/dist/cjs/Image/index.js +27 -15
  5. package/dist/cjs/Image/index.js.map +1 -1
  6. package/dist/cjs/Seo/__tests__/index.test.js +272 -37
  7. package/dist/cjs/Seo/__tests__/index.test.js.map +1 -1
  8. package/dist/cjs/Seo/index.js +13 -60
  9. package/dist/cjs/Seo/index.js.map +1 -1
  10. package/dist/cjs/Seo/remixUtils.js +33 -0
  11. package/dist/cjs/Seo/remixUtils.js.map +1 -0
  12. package/dist/cjs/Seo/renderMetaTags.js +40 -0
  13. package/dist/cjs/Seo/renderMetaTags.js.map +1 -0
  14. package/dist/cjs/Seo/renderMetaTagsToString.js +22 -0
  15. package/dist/cjs/Seo/renderMetaTagsToString.js.map +1 -0
  16. package/dist/cjs/Seo/types.js +5 -0
  17. package/dist/cjs/Seo/types.js.map +1 -0
  18. package/dist/cjs/useQuerySubscription/index.js +1 -1
  19. package/dist/cjs/useQuerySubscription/index.js.map +1 -1
  20. package/dist/esm/Image/__tests__/index.test.js +36 -32
  21. package/dist/esm/Image/__tests__/index.test.js.map +1 -1
  22. package/dist/esm/Image/index.d.ts +17 -4
  23. package/dist/esm/Image/index.js +30 -18
  24. package/dist/esm/Image/index.js.map +1 -1
  25. package/dist/esm/Seo/__tests__/index.test.js +271 -36
  26. package/dist/esm/Seo/__tests__/index.test.js.map +1 -1
  27. package/dist/esm/Seo/index.d.ts +4 -12
  28. package/dist/esm/Seo/index.js +4 -55
  29. package/dist/esm/Seo/index.js.map +1 -1
  30. package/dist/esm/Seo/remixUtils.d.ts +6 -0
  31. package/dist/esm/Seo/remixUtils.js +29 -0
  32. package/dist/esm/Seo/remixUtils.js.map +1 -0
  33. package/dist/esm/Seo/renderMetaTags.d.ts +3 -0
  34. package/dist/esm/Seo/renderMetaTags.js +33 -0
  35. package/dist/esm/Seo/renderMetaTags.js.map +1 -0
  36. package/dist/esm/Seo/renderMetaTagsToString.d.ts +2 -0
  37. package/dist/esm/Seo/renderMetaTagsToString.js +18 -0
  38. package/dist/esm/Seo/renderMetaTagsToString.js.map +1 -0
  39. package/dist/esm/Seo/types.d.ts +37 -0
  40. package/dist/esm/Seo/types.js +4 -0
  41. package/dist/esm/Seo/types.js.map +1 -0
  42. package/dist/esm/useQuerySubscription/index.js +1 -1
  43. package/dist/esm/useQuerySubscription/index.js.map +1 -1
  44. package/dist/types/Image/index.d.ts +17 -4
  45. package/dist/types/Seo/index.d.ts +4 -12
  46. package/dist/types/Seo/remixUtils.d.ts +6 -0
  47. package/dist/types/Seo/renderMetaTags.d.ts +3 -0
  48. package/dist/types/Seo/renderMetaTagsToString.d.ts +2 -0
  49. package/dist/types/Seo/types.d.ts +37 -0
  50. package/package.json +1 -1
package/README.md CHANGED
@@ -15,8 +15,8 @@ A set of components and utilities to work faster with [DatoCMS](https://www.dato
15
15
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
16
16
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
17
17
 
18
- - [Demos](#demos)
19
- - [Installation](#installation)
18
+ - [Demos](#demos)
19
+ - [Installation](#installation)
20
20
  - [Live real-time updates](#live-real-time-updates)
21
21
  - [Reference](#reference)
22
22
  - [Initialization options](#initialization-options)
@@ -28,15 +28,18 @@ A set of components and utilities to work faster with [DatoCMS](https://www.dato
28
28
  - [Usage](#usage)
29
29
  - [Example](#example-1)
30
30
  - [Props](#props)
31
+ - [Layout mode](#layout-mode)
31
32
  - [The `ResponsiveImage` object](#the-responsiveimage-object)
32
33
  - [Social share, SEO and Favicon meta tags](#social-share-seo-and-favicon-meta-tags)
33
- - [Usage](#usage-1)
34
- - [Example](#example-2)
34
+ - [`renderMetaTags()`](#rendermetatags)
35
+ - [`renderMetaTagsToString()`](#rendermetatagstostring)
36
+ - [`toRemixMeta()`](#toremixmeta)
35
37
  - [Structured text](#structured-text)
36
38
  - [Basic usage](#basic-usage)
37
39
  - [Custom renderers for inline records, blocks, and links](#custom-renderers-for-inline-records-blocks-and-links)
38
- - [Override default text rendering](#override-default-rendering-of-nodes)
40
+ - [Override default rendering of nodes](#override-default-rendering-of-nodes)
39
41
  - [Props](#props-1)
42
+ - [Development](#development)
40
43
 
41
44
  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
42
45
 
@@ -237,20 +240,44 @@ export default withQuery(query)(Page);
237
240
 
238
241
  ## Props
239
242
 
240
- | prop | type | required | description | default |
241
- | --------------------- | ------------------------ | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
242
- | data | `ResponsiveImage` object | :white_check_mark: | The actual response you get from a DatoCMS `responsiveImage` GraphQL query. | |
243
- | className | string | :x: | Additional CSS className for root node | null |
244
- | style | CSS properties | :x: | Additional CSS rules to add to the root node | null |
245
- | pictureClassName | string | :x: | Additional CSS class for the image inside the inner `<picture />` tag | null |
246
- | pictureStyle | CSS properties | :x: | Additional CSS rules to add to the image inside the inner `<picture />` tag | null |
247
- | fadeInDuration | integer | :x: | Duration (in ms) of the fade-in transition effect upoad image loading | 500 |
248
- | intersectionThreshold | float | :x: | Indicate at what percentage of the placeholder visibility the loading of the image should be triggered. A value of 0 means that as soon as even one pixel is visible, the callback will be run. A value of 1.0 means that the threshold isn't considered passed until every pixel is visible. | 0 |
249
- | intersectionMargin | string | :x: | Margin around the placeholder. Can have values similar to the CSS margin property (top, right, bottom, left). The values can be percentages. This set of values serves to grow or shrink each side of the placeholder element's bounding box before computing intersections. | "0px 0px 0px 0px" |
250
- | lazyLoad | Boolean | :x: | Whether enable lazy loading or not | true |
251
- | explicitWidth | Boolean | :x: | Whether the image wrapper should explicitely declare the width of the image or keep it fluid | false |
252
- | onLoad | () => void | :x: | Function triggered when the image has finished loading | undefined |
253
- | usePlaceholder | Boolean | :x: | Whether the component should use a blurred image placeholder | true |
243
+ | prop | type | required | description | default |
244
+ | --------------------- | ------------------------------------------------ | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
245
+ | data | `ResponsiveImage` object | :white_check_mark: | The actual response you get from a DatoCMS `responsiveImage` GraphQL query | |
246
+ | layout | 'intrinsic' \| 'fixed' \| 'responsive' \| 'fill' | :x: | The layout behavior of the image as the viewport changes size | "intrinsic" |
247
+ | className | string | :x: | Additional CSS className for root node | null |
248
+ | style | CSS properties | :x: | Additional CSS rules to add to the root node | null |
249
+ | pictureClassName | string | :x: | Additional CSS class for the image inside the inner `<picture />` tag | null |
250
+ | pictureStyle | CSS properties | :x: | Additional CSS rules to add to the image inside the inner `<picture />` tag | null |
251
+ | fadeInDuration | integer | :x: | Duration (in ms) of the fade-in transition effect upoad image loading | 500 |
252
+ | intersectionThreshold | float | :x: | Indicate at what percentage of the placeholder visibility the loading of the image should be triggered. A value of 0 means that as soon as even one pixel is visible, the callback will be run. A value of 1.0 means that the threshold isn't considered passed until every pixel is visible. | 0 |
253
+ | intersectionMargin | string | :x: | Margin around the placeholder. Can have values similar to the CSS margin property (top, right, bottom, left). The values can be percentages. This set of values serves to grow or shrink each side of the placeholder element's bounding box before computing intersections. | "0px 0px 0px 0px" |
254
+ | lazyLoad | Boolean | :x: | Whether enable lazy loading or not | true |
255
+ | onLoad | () => void | :x: | Function triggered when the image has finished loading | undefined |
256
+ | usePlaceholder | Boolean | :x: | Whether the component should use a blurred image placeholder | true |
257
+
258
+ ### Layout mode
259
+
260
+ With the `layout` property, you can configure the behavior of the image as the viewport changes size:
261
+
262
+ - When `intrinsic` (default behaviour), the image will scale the dimensions down for smaller viewports, but maintain the original dimensions for larger viewports.
263
+ - When `fixed`, the image dimensions will not change as the viewport changes (no responsiveness) similar to the native `img` element.
264
+ - When `responsive`, the image will scale the dimensions down for smaller viewports and scale up for larger viewports.
265
+ - When `fill`, the image will stretch both width and height to the dimensions of the parent element, provided the parent element is relative.
266
+ - This is usually paired with the `objectFit` and `objectPosition` properties.
267
+ - Ensure the parent element has `position: relative` in their stylesheet.
268
+
269
+ Example for `layout="fill"` (useful also for background images):
270
+
271
+ ```jsx
272
+ <div style={{ position: 'relative', width: 200, height: 500 }}>
273
+ <Image
274
+ data={imageData}
275
+ layout="fill"
276
+ objectFit="cover"
277
+ objectPosition="50% 50%"
278
+ />
279
+ </div>
280
+ ```
254
281
 
255
282
  ### The `ResponsiveImage` object
256
283
 
@@ -279,59 +306,131 @@ Here's a complete recap of what `responsiveImage` offers:
279
306
 
280
307
  # Social share, SEO and Favicon meta tags
281
308
 
282
- Just like the image component, `renderMetaTags()` is a helper specially designed to work seamlessly with DatoCMS’s [`_seoMetaTags` and `faviconMetaTags` GraphQL queries](https://www.datocms.com/docs/content-delivery-api/seo) so that you can handle proper SEO in your pages with a simple one-liner.
309
+ Just like for the image component this package offers a number of utilities designed to work seamlessly with DatoCMS’s [`_seoMetaTags` and `faviconMetaTags` GraphQL queries](https://www.datocms.com/docs/content-delivery-api/seo) so that you can easily handle SEO, social shares and favicons in your pages.
283
310
 
284
- - TypeScript ready;
285
- - Compatible with any GraphQL library (Apollo, graphql-hooks, graphql-request, etc.);
286
- - Usable both client and server side;
287
- - Compatible with vanilla React, Next.js and pretty much any other React-based solution;
311
+ All the utilities take an array of `SeoOrFaviconTag`s in the exact form they're returned by the following [DatoCMS GraphQL API queries](https://www.datocms.com/docs/content-delivery-api/seo):
288
312
 
289
- ## Usage
313
+ - `_seoMetaTags` (always available on any type of record)
314
+ - `faviconMetaTags` on the global `_site` object.
290
315
 
291
- `renderMetaTags()` takes an array of `Tag`s in the exact form they're returned by the following [DatoCMS GraphQL API](https://www.datocms.com/docs/content-delivery-api/seo) queries:
316
+ ```graphql
317
+ query {
318
+ page: homepage {
319
+ title
320
+ seo: _seoMetaTags {
321
+ attributes
322
+ content
323
+ tag
324
+ }
325
+ }
292
326
 
293
- - `_seoMetaTags` query on any record, or
294
- - `faviconMetaTags` on the global `_site` object.
327
+ site: _site {
328
+ favicon: faviconMetaTags {
329
+ attributes
330
+ content
331
+ tag
332
+ }
333
+ }
334
+ }
335
+ ```
295
336
 
296
- You can `concat` multiple array of `Tag`s together and pass them to a single `renderMetaTags()` call.
337
+ You can then concat those two arrays of tags and pass them togheter to the function, ie:
297
338
 
298
- ## Example
339
+ ```js
340
+ renderMetaTags([...data.page.seo, ...data.site.favicon]);
341
+ ```
342
+
343
+ ## `renderMetaTags()`
344
+
345
+ This function generates React `<meta>` and `<link />` elements, so it is compatible with React packages like [`react-helmet`](https://www.npmjs.com/package/react-helmet).
299
346
 
300
- For a working example take a look at our [examples directory](https://github.com/datocms/react-datocms/tree/master/examples).
347
+ For a complete example take a look at our [examples directory](https://github.com/datocms/react-datocms/tree/master/examples).
301
348
 
302
349
  ```js
303
350
  import React from 'react';
304
351
  import { renderMetaTags } from 'react-datocms';
305
352
 
306
- const Page = ({ data }) => (
307
- <div>
308
- <Helmet>{renderMetaTags(data.page.seo.concat(data.site.favicon))}</Helmet>
309
- <h1>{data.page.title}</h1>
310
- </div>
311
- );
353
+ function Page({ data }) {
354
+ return (
355
+ <div>
356
+ <Helmet>
357
+ {renderMetaTags([...data.page.seo, ...data.site.favicon])}
358
+ </Helmet>
359
+ </div>
360
+ );
361
+ }
362
+ ```
312
363
 
313
- const query = gql`
314
- query {
315
- page: homepage {
316
- title
317
- seo: _seoMetaTags {
318
- attributes
319
- content
320
- tag
321
- }
322
- }
364
+ ## `renderMetaTagsToString()`
323
365
 
324
- site: _site {
325
- favicon: faviconMetaTags {
326
- attributes
327
- content
328
- tag
329
- }
330
- }
331
- }
366
+ This function generates an HTML string containing `<meta>` and `<link />` tags, so it can be used server-side.
367
+
368
+ ```js
369
+ import { renderMetaTagsToString } from 'react-datocms';
370
+
371
+ const someMoreComplexHtml = `
372
+ <html>
373
+ <head>
374
+ ${renderMetaTagsToString([...data.page.seo, ...data.site.favicon])}
375
+ </head>
376
+ </html>
332
377
  `;
378
+ ```
333
379
 
334
- export default withQuery(query)(Page);
380
+ ## `toRemixMeta()`
381
+
382
+ This function generates a `HtmlMetaDescriptor` object, compatibile with the [`meta`](https://remix.run/docs/en/v1.1.1/api/conventions#meta) export of the [Remix](https://remix.run/) framework:
383
+
384
+ ```js
385
+ import type { MetaFunction } from 'remix';
386
+ import { toRemixMeta } from 'react-datocms';
387
+
388
+ export const meta: MetaFunction = ({ data: { post } }) => {
389
+ return toRemixMeta(post.seo);
390
+ };
391
+ ```
392
+
393
+ Please note that the [`links`](https://remix.run/docs/en/v1.1.1/api/conventions#links) export [doesn't receive any loader data](https://github.com/remix-run/remix/issues/32) for performance reasons, so you cannot use it to declare favicons meta tags! The best way to render them is using `renderMetaTags` in your root component:
394
+
395
+ ```jsx
396
+ import { renderMetaTags } from 'react-datocms';
397
+
398
+ export const loader = () => {
399
+ return request({
400
+ query: `
401
+ {
402
+ site: _site {
403
+ favicon: faviconMetaTags(variants: [icon, msApplication, appleTouchIcon]) {
404
+ ...metaTagsFragment
405
+ }
406
+ }
407
+ }
408
+ ${metaTagsFragment}
409
+ `,
410
+ });
411
+ };
412
+
413
+ export default function App() {
414
+ const { site } = useLoaderData();
415
+
416
+ return (
417
+ <html lang="en">
418
+ <head>
419
+ <meta charSet="utf-8" />
420
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
421
+ <Meta />
422
+ <Links />
423
+ {renderMetaTags(site.favicon)}
424
+ </head>
425
+ <body>
426
+ <Outlet />
427
+ <ScrollRestoration />
428
+ <Scripts />
429
+ {process.env.NODE_ENV === 'development' && <LiveReload />}
430
+ </body>
431
+ </html>
432
+ );
433
+ }
335
434
  ```
336
435
 
337
436
  # Structured text
@@ -345,8 +444,7 @@ import React from 'react';
345
444
  import { StructuredText } from 'react-datocms';
346
445
 
347
446
  const Page = ({ data }) => {
348
- // data.blogPost.content ->
349
- // {
447
+ // data.blogPost.content = {
350
448
  // value: {
351
449
  // schema: "dast",
352
450
  // document: {
@@ -638,7 +736,7 @@ Note: if you override the rules for `inline_item`, `item_link` or `block` nodes,
638
736
  | customRules | `Array<RenderRule>` | :x: | Customize how document is converted in JSX (use `renderRule()` to generate) | `null` |
639
737
  | renderText | `(text: string, key: string) => ReactElement \| string \| null` | :x: | Convert a simple string text into React | `(text) => text` |
640
738
 
641
- ## Development
739
+ # Development
642
740
 
643
741
  This repository contains a number of demos/examples. You can use them to locally test your changes to the package with `npm link`:
644
742
 
@@ -655,4 +753,4 @@ Now on another terminal you can run:
655
753
  npm run watch
656
754
  ```
657
755
 
658
- This will re-compile the package everytime you make a change, and the example project will pick those changes instantly.
756
+ This will re-compile the package everytime you make a change, and the example project will pick those changes instantly.
@@ -24,41 +24,45 @@ var enzyme_1 = require("enzyme");
24
24
  var index_1 = require("../index");
25
25
  var test_utils_1 = require("react-intersection-observer/test-utils");
26
26
  var data = {
27
- alt: "DatoCMS swag",
27
+ alt: 'DatoCMS swag',
28
28
  aspectRatio: 1.7777777777777777,
29
- base64: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHBwgHBgoICAgLFQoLDhgQDg0NDh0eHREYIx8lJCIrHB0dLSs7GikyKSEuKjUlKDk1MjIyHyo4PTc+PDcxPjUBCgsLDg0OHBAQHDsoIig7Ozs7Ozs7OzsvOzs7Ozs7Ozs7Lzs7Ozs7Ozs7OzsvOzs7NTsvLy87NTU1Ly8vLzsvL//AABEIAA0AGAMBIgACEQEDEQH/xAAYAAACAwAAAAAAAAAAAAAAAAAGBwABBP/EACEQAAEEAAYDAAAAAAAAAAAAAAEAAgMEBQYHESEiFWFx/8QAFQEBAQAAAAAAAAAAAAAAAAAAAwL/xAAZEQADAAMAAAAAAAAAAAAAAAAAAQIRITH/2gAMAwEAAhEDEQA/AFxLgDWTsAd1J5TGy7hEYqNAaNgECX7sjLMQAHJTEy1Zcarfia4lJMauAxqBhLY6ZlaOzDurWvUOd3jZPfCiEh4xs//Z",
29
+ base64: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHBwgHBgoICAgLFQoLDhgQDg0NDh0eHREYIx8lJCIrHB0dLSs7GikyKSEuKjUlKDk1MjIyHyo4PTc+PDcxPjUBCgsLDg0OHBAQHDsoIig7Ozs7Ozs7OzsvOzs7Ozs7Ozs7Lzs7Ozs7Ozs7OzsvOzs7NTsvLy87NTU1Ly8vLzsvL//AABEIAA0AGAMBIgACEQEDEQH/xAAYAAACAwAAAAAAAAAAAAAAAAAGBwABBP/EACEQAAEEAAYDAAAAAAAAAAAAAAEAAgMEBQYHESEiFWFx/8QAFQEBAQAAAAAAAAAAAAAAAAAAAwL/xAAZEQADAAMAAAAAAAAAAAAAAAAAAQIRITH/2gAMAwEAAhEDEQA/AFxLgDWTsAd1J5TGy7hEYqNAaNgECX7sjLMQAHJTEy1Zcarfia4lJMauAxqBhLY6ZlaOzDurWvUOd3jZPfCiEh4xs//Z',
30
30
  height: 421,
31
- sizes: "(max-width: 750px) 100vw, 750px",
32
- src: "https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750",
33
- srcSet: "https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=0.25&fit=crop&w=750 187w,↵https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=0.5&fit=crop&w=750 375w,↵https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=0.75&fit=crop&w=750 562w,↵https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=1&fit=crop&w=750 750w,↵https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=1.5&fit=crop&w=750 1125w,↵https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=2&fit=crop&w=750 1500w,↵https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=3&fit=crop&w=750 2250w,↵https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=4&fit=crop&w=750 3000w",
34
- title: "These are awesome, we know that.",
31
+ sizes: '(max-width: 750px) 100vw, 750px',
32
+ src: 'https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750',
33
+ srcSet: 'https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=0.25&fit=crop&w=750 187w,↵https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=0.5&fit=crop&w=750 375w,↵https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=0.75&fit=crop&w=750 562w,↵https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=1&fit=crop&w=750 750w,↵https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=1.5&fit=crop&w=750 1125w,↵https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=2&fit=crop&w=750 1500w,↵https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=3&fit=crop&w=750 2250w,↵https://www.datocms-assets.com/205/image.png?ar=16%3A9&dpr=4&fit=crop&w=750 3000w',
34
+ title: 'These are awesome, we know that.',
35
35
  width: 750
36
36
  };
37
- describe("Image", function () {
37
+ describe('Image', function () {
38
38
  // intersectionThreshold is an hack to make tests work
39
39
  // we need the library to generate a different IntersectionObserver for each test
40
40
  // otherwise the IntersectionObserver mocking won't work
41
- describe("not visible", function () {
42
- it("renders the blur-up thumb", function () {
43
- var wrapper = enzyme_1.mount(React.createElement(index_1.Image, { data: data, intersectionThreshold: 0.1 }));
44
- expect(wrapper).toMatchSnapshot();
45
- });
46
- });
47
- describe("visible", function () {
48
- it("renders the image", function () {
49
- var wrapper = enzyme_1.mount(React.createElement(index_1.Image, { data: data, intersectionThreshold: 0.2 }));
50
- test_utils_1.mockAllIsIntersecting(true);
51
- wrapper.update();
52
- expect(wrapper).toMatchSnapshot();
53
- });
54
- describe("image loaded", function () {
55
- it("shows the image", function () {
56
- var wrapper = enzyme_1.mount(React.createElement(index_1.Image, { data: data, intersectionThreshold: 0.3 }));
57
- test_utils_1.mockAllIsIntersecting(true);
58
- wrapper.update();
59
- wrapper.find("img").last().simulate("load");
60
- wrapper.update();
61
- expect(wrapper).toMatchSnapshot();
41
+ ['intrinsic', 'fixed', 'responsive', 'fill'].forEach(function (layout) {
42
+ describe("layout=" + layout, function () {
43
+ describe('not visible', function () {
44
+ it('renders the blur-up thumb', function () {
45
+ var wrapper = enzyme_1.mount(React.createElement(index_1.Image, { data: data, layout: layout, intersectionThreshold: 0.1 }));
46
+ expect(wrapper).toMatchSnapshot();
47
+ });
48
+ });
49
+ describe('visible', function () {
50
+ it('renders the image', function () {
51
+ var wrapper = enzyme_1.mount(React.createElement(index_1.Image, { data: data, layout: layout, intersectionThreshold: 0.2 }));
52
+ test_utils_1.mockAllIsIntersecting(true);
53
+ wrapper.update();
54
+ expect(wrapper).toMatchSnapshot();
55
+ });
56
+ describe('image loaded', function () {
57
+ it('shows the image', function () {
58
+ var wrapper = enzyme_1.mount(React.createElement(index_1.Image, { data: data, layout: layout, intersectionThreshold: 0.3 }));
59
+ test_utils_1.mockAllIsIntersecting(true);
60
+ wrapper.update();
61
+ wrapper.find('img').last().simulate('load');
62
+ wrapper.update();
63
+ expect(wrapper).toMatchSnapshot();
64
+ });
65
+ });
62
66
  });
63
67
  });
64
68
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../src/Image/__tests__/index.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAA+B;AAC/B,iCAA+B;AAC/B,kCAAiC;AACjC,qEAA+E;AAE/E,IAAM,IAAI,GAAG;IACX,GAAG,EAAE,cAAc;IACnB,WAAW,EAAE,kBAAkB;IAC/B,MAAM,EACJ,igBAAigB;IACngB,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,iCAAiC;IACxC,GAAG,EAAE,uEAAuE;IAC5E,MAAM,EACJ,8pBAA8pB;IAChqB,KAAK,EAAE,kCAAkC;IACzC,KAAK,EAAE,GAAG;CACX,CAAC;AAEF,QAAQ,CAAC,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ACjB,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,CAAC;gBACpC,CAAC,CAAC,CAAC;gBAEH,QAAQ,CAAC,cAAc,EAAE;oBACvB,EAAE,CAAC,iBAAiB,EAAE;wBACpB,IAAM,OAAO,GAAG,cAAK,CACnB,oBAAC,aAAK,IAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,EAAE,GAAG,GAAI,CAClE,CAAC;wBACF,kCAAqB,CAAC,IAAI,CAAC,CAAC;wBAC5B,OAAO,CAAC,MAAM,EAAE,CAAC;wBACjB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;wBAC5C,OAAO,CAAC,MAAM,EAAE,CAAC;wBACjB,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,CAAC;oBACpC,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -34,9 +34,9 @@ exports.Image = void 0;
34
34
  var react_1 = __importStar(require("react"));
35
35
  require("intersection-observer");
36
36
  var react_intersection_observer_1 = require("react-intersection-observer");
37
- var isSsr = typeof window === "undefined";
37
+ var isSsr = typeof window === 'undefined';
38
38
  var universalBtoa = isSsr
39
- ? function (str) { return Buffer.from(str.toString(), "binary").toString("base64"); }
39
+ ? function (str) { return Buffer.from(str.toString(), 'binary').toString('base64'); }
40
40
  : window.btoa;
41
41
  var isIntersectionObserverAvailable = isSsr
42
42
  ? false
@@ -69,28 +69,28 @@ var imageShowStrategy = function (_a) {
69
69
  };
70
70
  exports.Image = react_1.forwardRef(function (_a, ref) {
71
71
  var _b;
72
- var className = _a.className, _c = _a.fadeInDuration, fadeInDuration = _c === void 0 ? 500 : _c, intersectionTreshold = _a.intersectionTreshold, intersectionThreshold = _a.intersectionThreshold, intersectionMargin = _a.intersectionMargin, pictureClassName = _a.pictureClassName, _d = _a.lazyLoad, lazyLoad = _d === void 0 ? true : _d, style = _a.style, pictureStyle = _a.pictureStyle, explicitWidth = _a.explicitWidth, data = _a.data, onLoad = _a.onLoad, _e = _a.usePlaceholder, usePlaceholder = _e === void 0 ? true : _e;
73
- var _f = react_1.useState(false), loaded = _f[0], setLoaded = _f[1];
72
+ var className = _a.className, _c = _a.fadeInDuration, fadeInDuration = _c === void 0 ? 500 : _c, intersectionTreshold = _a.intersectionTreshold, intersectionThreshold = _a.intersectionThreshold, intersectionMargin = _a.intersectionMargin, pictureClassName = _a.pictureClassName, _d = _a.lazyLoad, lazyLoad = _d === void 0 ? true : _d, style = _a.style, pictureStyle = _a.pictureStyle, _e = _a.layout, layout = _e === void 0 ? 'intrinsic' : _e, objectFit = _a.objectFit, objectPosition = _a.objectPosition, data = _a.data, onLoad = _a.onLoad, _f = _a.usePlaceholder, usePlaceholder = _f === void 0 ? true : _f;
73
+ var _g = react_1.useState(false), loaded = _g[0], setLoaded = _g[1];
74
74
  var handleLoad = function () {
75
75
  onLoad === null || onLoad === void 0 ? void 0 : onLoad();
76
76
  setLoaded(true);
77
77
  };
78
- var _g = react_intersection_observer_1.useInView({
78
+ var _h = react_intersection_observer_1.useInView({
79
79
  threshold: intersectionThreshold || intersectionTreshold || 0,
80
- rootMargin: intersectionMargin || "0px 0px 0px 0px",
80
+ rootMargin: intersectionMargin || '0px 0px 0px 0px',
81
81
  triggerOnce: true
82
- }), viewRef = _g[0], inView = _g[1];
82
+ }), viewRef = _h[0], inView = _h[1];
83
83
  var callbackRef = react_1.useCallback(function (_ref) {
84
84
  viewRef(_ref);
85
85
  if (ref)
86
86
  ref.current = _ref;
87
87
  }, [viewRef]);
88
88
  var absolutePositioning = {
89
- position: "absolute",
89
+ position: 'absolute',
90
90
  left: 0,
91
91
  top: 0,
92
- width: "100%",
93
- height: "100%"
92
+ width: '100%',
93
+ height: '100%'
94
94
  };
95
95
  var addImage = imageAddStrategy({
96
96
  lazyLoad: lazyLoad,
@@ -105,22 +105,34 @@ exports.Image = react_1.forwardRef(function (_a, ref) {
105
105
  var webpSource = data.webpSrcSet && (react_1["default"].createElement("source", { srcSet: data.webpSrcSet, sizes: data.sizes, type: "image/webp" }));
106
106
  var regularSource = data.srcSet && (react_1["default"].createElement("source", { srcSet: data.srcSet, sizes: data.sizes }));
107
107
  var transition = fadeInDuration > 0 ? "opacity " + fadeInDuration + "ms" : undefined;
108
- var placeholder = usePlaceholder ? (react_1["default"].createElement("div", { style: __assign({ backgroundImage: data.base64 ? "url(" + data.base64 + ")" : undefined, backgroundColor: data.bgColor, backgroundSize: "cover", opacity: showImage ? 0 : 1, transition: transition }, absolutePositioning) })) : null;
108
+ var placeholder = usePlaceholder ? (react_1["default"].createElement("img", { role: "presentation", src: data.base64, style: __assign({ backgroundColor: data.bgColor, opacity: showImage ? 0 : 1, transition: transition,
109
+ objectFit: objectFit,
110
+ objectPosition: objectPosition }, absolutePositioning) })) : null;
109
111
  var width = data.width, aspectRatio = data.aspectRatio;
110
112
  var height = data.height || width / aspectRatio;
111
113
  var svg = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" + width + "\" height=\"" + height + "\"></svg>";
112
- var sizer = (react_1["default"].createElement("img", { className: pictureClassName, style: __assign({ display: "block", width: explicitWidth ? width + "px" : "100%" }, pictureStyle), src: "data:image/svg+xml;base64," + universalBtoa(svg), role: "presentation" }));
113
- return (react_1["default"].createElement("div", { ref: callbackRef, className: className, style: __assign({ display: explicitWidth ? "inline-block" : "block", overflow: "hidden", position: "relative" }, style) },
114
+ var sizer = layout !== 'fill' ? (react_1["default"].createElement("img", { className: pictureClassName, style: {
115
+ display: 'block',
116
+ width: '100%'
117
+ }, src: "data:image/svg+xml;base64," + universalBtoa(svg), role: "presentation" })) : null;
118
+ return (react_1["default"].createElement("div", { ref: callbackRef, className: className, style: __assign(__assign({ overflow: 'hidden' }, (layout === 'fill'
119
+ ? absolutePositioning
120
+ : layout === 'intrinsic'
121
+ ? { position: 'relative', width: '100%', maxWidth: width }
122
+ : layout === 'fixed'
123
+ ? { position: 'relative', width: width }
124
+ : { position: 'relative', width: '100%' })), style) },
114
125
  sizer,
115
126
  placeholder,
116
127
  addImage && (react_1["default"].createElement("picture", null,
117
128
  webpSource,
118
129
  regularSource,
119
- data.src && (react_1["default"].createElement("img", { src: data.src, alt: data.alt, title: data.title, onLoad: handleLoad, className: pictureClassName, style: __assign(__assign(__assign({}, absolutePositioning), pictureStyle), { opacity: showImage ? 1 : 0, transition: transition }) })))),
130
+ data.src && (react_1["default"].createElement("img", { src: data.src, alt: data.alt, title: data.title, onLoad: handleLoad, className: pictureClassName, style: __assign(__assign(__assign({ opacity: showImage ? 1 : 0, transition: transition }, absolutePositioning), { objectFit: objectFit,
131
+ objectPosition: objectPosition }), pictureStyle) })))),
120
132
  react_1["default"].createElement("noscript", null,
121
133
  react_1["default"].createElement("picture", null,
122
134
  webpSource,
123
135
  regularSource,
124
- data.src && (react_1["default"].createElement("img", { src: data.src, alt: (_b = data.alt) !== null && _b !== void 0 ? _b : "", title: data.title, className: pictureClassName, style: __assign(__assign({}, absolutePositioning), pictureStyle), loading: "lazy" }))))));
136
+ data.src && (react_1["default"].createElement("img", { src: data.src, alt: (_b = data.alt) !== null && _b !== void 0 ? _b : '', title: data.title, className: pictureClassName, style: __assign(__assign({}, absolutePositioning), pictureStyle), loading: "lazy" }))))));
125
137
  });
126
138
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Image/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAiE;AACjE,iCAA+B;AAC/B,2EAAwD;AAExD,IAAM,KAAK,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;AAC5C,IAAM,aAAa,GAAG,KAAK;IACzB,CAAC,CAAC,UAAC,GAAW,IAAK,OAAA,MAA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