react-datocms 6.0.0 → 6.0.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/README.md +1 -1
- package/dist/cjs/Image/index.js +2 -1
- package/dist/cjs/Image/index.js.map +1 -1
- package/dist/cjs/SRCImage/index.js +3 -2
- package/dist/cjs/SRCImage/index.js.map +1 -1
- package/dist/cjs/SRCImage/utils.js +4 -4
- package/dist/cjs/SRCImage/utils.js.map +1 -1
- package/dist/cjs/Seo/nextUtils.js +15 -15
- package/dist/cjs/Seo/nextUtils.js.map +1 -1
- package/dist/cjs/Seo/renderMetaTags.js +1 -1
- package/dist/cjs/Seo/renderMetaTags.js.map +1 -1
- package/dist/cjs/StructuredText/index.js.map +1 -1
- package/dist/cjs/useSiteSearch/index.js +9 -31
- package/dist/cjs/useSiteSearch/index.js.map +1 -1
- package/dist/esm/Image/index.js +2 -1
- package/dist/esm/Image/index.js.map +1 -1
- package/dist/esm/SRCImage/index.js +3 -2
- package/dist/esm/SRCImage/index.js.map +1 -1
- package/dist/esm/SRCImage/utils.js +4 -4
- package/dist/esm/SRCImage/utils.js.map +1 -1
- package/dist/esm/Seo/nextUtils.js +15 -15
- package/dist/esm/Seo/nextUtils.js.map +1 -1
- package/dist/esm/Seo/renderMetaTags.js +1 -1
- package/dist/esm/Seo/renderMetaTags.js.map +1 -1
- package/dist/esm/StructuredText/index.js.map +1 -1
- package/dist/esm/useSiteSearch/index.js +2 -1
- package/dist/esm/useSiteSearch/index.js.map +1 -1
- package/dist/types/SRCImage/utils.d.ts +1 -1
- package/dist/types/Seo/remixUtils.d.ts +1 -1
- package/dist/types/Seo/renderMetaTags.d.ts +1 -1
- package/dist/types/Seo/renderMetaTagsToString.d.ts +1 -1
- package/dist/types/StructuredText/index.d.ts +3 -3
- package/dist/types/VideoPlayer/index.d.ts +1 -1
- package/dist/types/useQuerySubscription/index.d.ts +1 -1
- package/dist/types/useVideoPlayer/index.d.ts +2 -2
- package/package.json +2 -2
- package/src/Image/__tests__/__snapshots__/index.test.tsx.snap +23 -23
- package/src/Image/index.tsx +2 -1
- package/src/SRCImage/__tests__/__snapshots__/index.test.tsx.snap +12 -6
- package/src/SRCImage/index.tsx +3 -2
- package/src/SRCImage/utils.tsx +5 -5
- package/src/Seo/__tests__/index.test.tsx +1 -1
- package/src/Seo/nextUtils.ts +20 -20
- package/src/Seo/remixUtils.ts +1 -1
- package/src/Seo/renderMetaTags.tsx +2 -2
- package/src/Seo/renderMetaTagsToString.tsx +1 -1
- package/src/StructuredText/__tests__/index.test.tsx +2 -2
- package/src/StructuredText/index.tsx +10 -10
- package/src/VideoPlayer/index.tsx +1 -1
- package/src/useQuerySubscription/index.ts +4 -4
- package/src/useSiteSearch/index.tsx +2 -1
- package/src/useVideoPlayer/index.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/StructuredText/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,sBAAsB,EACtB,MAAM,EACN,cAAc,EACd,cAAc,GACf,MAAM,+CAA+C,CAAC;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/StructuredText/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,sBAAsB,EACtB,MAAM,EACN,cAAc,EACd,cAAc,GACf,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAEL,WAAW,EAMX,OAAO,EACP,YAAY,EACZ,UAAU,EACV,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,EAAqB,YAAY,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC;AAEvD,aAAa;AACb,OAAO,EAAE,cAAc,IAAI,UAAU,EAAE,CAAC;AAUxC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,UAAU,EAAE,KAAK,CAAC,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(thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
import React
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
12
13
|
import reactStringReplace from 'react-string-replace';
|
|
13
14
|
const defaultHighlighter = (text, key) => (React.createElement("mark", { key: key }, text));
|
|
14
15
|
function MatchHighlighter({ children, highlighter, context, }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/useSiteSearch/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;AAEb,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/useSiteSearch/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;AAEb,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAiGtD,MAAM,kBAAkB,GAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CACrD,8BAAM,GAAG,EAAE,GAAG,IAAG,IAAI,CAAQ,CAC9B,CAAC;AAEF,SAAS,gBAAgB,CAAC,EACxB,QAAQ,EACR,WAAW,EACX,OAAO,GAKR;IACC,OAAO,CACL,0CACG,kBAAkB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CACnE,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAC9C,CACA,CACJ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,MAAmC;;IAEnC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAI/B;QAC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a,IAEpB,eAAe,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAC5B,CACpB,CAAC,CAAC,CAAC,CACF,eAAe,CAAC,UAAU,CAAC,YAAY,CACxC;wBACD,GAAG,EAAE,eAAe;qBACrB,CAAC,CAAC;oBACH,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW;oBACvC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC;iBAClE;gBACH,CAAC,CAAC,SAAS;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ResponsiveImageType } from '../Image';
|
|
2
|
+
import type { ResponsiveImageType } from '../Image';
|
|
3
3
|
export declare function priorityProp(fetchPriority?: string): Record<string, string | undefined>;
|
|
4
4
|
export declare const buildSrcSetFromSrc: (src: string | null | undefined, width: number | undefined, candidateMultipliers: number[]) => string | undefined;
|
|
5
5
|
export declare function buildWebpSource(data: ResponsiveImageType, sizes: HTMLImageElement['sizes'] | undefined): "" | JSX.Element | null | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SeoOrFaviconTag, TitleMetaLinkTag } from './types.js';
|
|
1
|
+
import type { SeoOrFaviconTag, TitleMetaLinkTag } from './types.js';
|
|
2
2
|
export declare function renderMetaTagsToString(data: TitleMetaLinkTag[] | SeoOrFaviconTag[]): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RenderMarkRule, TransformMetaFn, TransformedMeta, renderMarkRule, renderNodeRule } from 'datocms-structured-text-generic-html-renderer';
|
|
2
|
-
import {
|
|
3
|
-
import { ReactElement } from 'react';
|
|
1
|
+
import { type RenderMarkRule, type TransformMetaFn, type TransformedMeta, renderMarkRule, renderNodeRule } from 'datocms-structured-text-generic-html-renderer';
|
|
2
|
+
import { type Node, RenderError, type RenderResult, type RenderRule, type Document as StructuredTextDocument, type StructuredText as StructuredTextGraphQlResponse, type Record as StructuredTextGraphQlResponseRecord } from 'datocms-structured-text-utils';
|
|
3
|
+
import { type ReactElement } from 'react';
|
|
4
4
|
export { renderNodeRule, renderMarkRule, RenderError };
|
|
5
5
|
export { renderNodeRule as renderRule };
|
|
6
6
|
export type { StructuredTextGraphQlResponse, StructuredTextDocument, StructuredTextGraphQlResponseRecord, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChannelErrorData, ConnectionStatus, Options } from 'datocms-listen';
|
|
1
|
+
import { type ChannelErrorData, type ConnectionStatus, type Options } from 'datocms-listen';
|
|
2
2
|
export type SubscribeToQueryOptions<QueryResult, QueryVariables> = Omit<Options<QueryResult, QueryVariables>, 'onStatusChange' | 'onUpdate' | 'onChannelError'>;
|
|
3
3
|
export type EnabledQueryListenerOptions<QueryResult, QueryVariables> = {
|
|
4
4
|
/** Whether the subscription has to be performed or not */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MuxPlayerProps } from '@mux/mux-player-react/.';
|
|
2
|
-
import { Video } from '../VideoPlayer';
|
|
1
|
+
import type { MuxPlayerProps } from '@mux/mux-player-react/.';
|
|
2
|
+
import type { Video } from '../VideoPlayer';
|
|
3
3
|
type Style = MuxPlayerProps['style'];
|
|
4
4
|
type Title = MuxPlayerProps['title'];
|
|
5
5
|
type PlaybackId = MuxPlayerProps['playbackId'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-datocms",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.2",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=8.0.0"
|
|
6
6
|
},
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
},
|
|
121
121
|
"scripts": {
|
|
122
122
|
"build": "rimraf dist && npm run tsc:types && npm run tsc:cjs && npm run tsc:esm",
|
|
123
|
-
"format": "npm run toc && biome format --write src examples/src",
|
|
123
|
+
"format": "npm run toc && biome check --apply src && biome format --write src examples/src",
|
|
124
124
|
"watch": "rimraf dist && tsc --project ./tsconfig.commonjs.json --watch",
|
|
125
125
|
"prepare": "npm run test && npm run build",
|
|
126
126
|
"test": "jest --coverage",
|
|
@@ -39,7 +39,7 @@ exports[`Image explicit sizes renders correctly 1`] = `
|
|
|
39
39
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
40
40
|
style={
|
|
41
41
|
{
|
|
42
|
-
"height": "
|
|
42
|
+
"height": "auto",
|
|
43
43
|
"left": "-5%",
|
|
44
44
|
"maxHeight": "none",
|
|
45
45
|
"maxWidth": "none",
|
|
@@ -124,7 +124,7 @@ exports[`Image layout=fill not visible renders the blur-up thumb 1`] = `
|
|
|
124
124
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
125
125
|
style={
|
|
126
126
|
{
|
|
127
|
-
"height": "
|
|
127
|
+
"height": "auto",
|
|
128
128
|
"left": "-5%",
|
|
129
129
|
"maxHeight": "none",
|
|
130
130
|
"maxWidth": "none",
|
|
@@ -183,7 +183,7 @@ exports[`Image layout=fill visible image loaded shows the image 1`] = `
|
|
|
183
183
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
184
184
|
style={
|
|
185
185
|
{
|
|
186
|
-
"height": "
|
|
186
|
+
"height": "auto",
|
|
187
187
|
"left": "-5%",
|
|
188
188
|
"maxHeight": "none",
|
|
189
189
|
"maxWidth": "none",
|
|
@@ -264,7 +264,7 @@ exports[`Image layout=fill visible renders the image (minimal data) 1`] = `
|
|
|
264
264
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
265
265
|
style={
|
|
266
266
|
{
|
|
267
|
-
"height": "
|
|
267
|
+
"height": "auto",
|
|
268
268
|
"left": "-5%",
|
|
269
269
|
"maxHeight": "none",
|
|
270
270
|
"maxWidth": "none",
|
|
@@ -343,7 +343,7 @@ exports[`Image layout=fill visible renders the image (relative URL) 1`] = `
|
|
|
343
343
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
344
344
|
style={
|
|
345
345
|
{
|
|
346
|
-
"height": "
|
|
346
|
+
"height": "auto",
|
|
347
347
|
"left": "-5%",
|
|
348
348
|
"maxHeight": "none",
|
|
349
349
|
"maxWidth": "none",
|
|
@@ -427,7 +427,7 @@ exports[`Image layout=fill visible renders the image 1`] = `
|
|
|
427
427
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
428
428
|
style={
|
|
429
429
|
{
|
|
430
|
-
"height": "
|
|
430
|
+
"height": "auto",
|
|
431
431
|
"left": "-5%",
|
|
432
432
|
"maxHeight": "none",
|
|
433
433
|
"maxWidth": "none",
|
|
@@ -519,7 +519,7 @@ exports[`Image layout=fixed not visible renders the blur-up thumb 1`] = `
|
|
|
519
519
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
520
520
|
style={
|
|
521
521
|
{
|
|
522
|
-
"height": "
|
|
522
|
+
"height": "auto",
|
|
523
523
|
"left": "-5%",
|
|
524
524
|
"maxHeight": "none",
|
|
525
525
|
"maxWidth": "none",
|
|
@@ -584,7 +584,7 @@ exports[`Image layout=fixed visible image loaded shows the image 1`] = `
|
|
|
584
584
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
585
585
|
style={
|
|
586
586
|
{
|
|
587
|
-
"height": "
|
|
587
|
+
"height": "auto",
|
|
588
588
|
"left": "-5%",
|
|
589
589
|
"maxHeight": "none",
|
|
590
590
|
"maxWidth": "none",
|
|
@@ -671,7 +671,7 @@ exports[`Image layout=fixed visible renders the image (minimal data) 1`] = `
|
|
|
671
671
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
672
672
|
style={
|
|
673
673
|
{
|
|
674
|
-
"height": "
|
|
674
|
+
"height": "auto",
|
|
675
675
|
"left": "-5%",
|
|
676
676
|
"maxHeight": "none",
|
|
677
677
|
"maxWidth": "none",
|
|
@@ -756,7 +756,7 @@ exports[`Image layout=fixed visible renders the image (relative URL) 1`] = `
|
|
|
756
756
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
757
757
|
style={
|
|
758
758
|
{
|
|
759
|
-
"height": "
|
|
759
|
+
"height": "auto",
|
|
760
760
|
"left": "-5%",
|
|
761
761
|
"maxHeight": "none",
|
|
762
762
|
"maxWidth": "none",
|
|
@@ -846,7 +846,7 @@ exports[`Image layout=fixed visible renders the image 1`] = `
|
|
|
846
846
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
847
847
|
style={
|
|
848
848
|
{
|
|
849
|
-
"height": "
|
|
849
|
+
"height": "auto",
|
|
850
850
|
"left": "-5%",
|
|
851
851
|
"maxHeight": "none",
|
|
852
852
|
"maxWidth": "none",
|
|
@@ -939,7 +939,7 @@ exports[`Image layout=intrinsic not visible renders the blur-up thumb 1`] = `
|
|
|
939
939
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
940
940
|
style={
|
|
941
941
|
{
|
|
942
|
-
"height": "
|
|
942
|
+
"height": "auto",
|
|
943
943
|
"left": "-5%",
|
|
944
944
|
"maxHeight": "none",
|
|
945
945
|
"maxWidth": "none",
|
|
@@ -1005,7 +1005,7 @@ exports[`Image layout=intrinsic visible image loaded shows the image 1`] = `
|
|
|
1005
1005
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
1006
1006
|
style={
|
|
1007
1007
|
{
|
|
1008
|
-
"height": "
|
|
1008
|
+
"height": "auto",
|
|
1009
1009
|
"left": "-5%",
|
|
1010
1010
|
"maxHeight": "none",
|
|
1011
1011
|
"maxWidth": "none",
|
|
@@ -1093,7 +1093,7 @@ exports[`Image layout=intrinsic visible renders the image (minimal data) 1`] = `
|
|
|
1093
1093
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
1094
1094
|
style={
|
|
1095
1095
|
{
|
|
1096
|
-
"height": "
|
|
1096
|
+
"height": "auto",
|
|
1097
1097
|
"left": "-5%",
|
|
1098
1098
|
"maxHeight": "none",
|
|
1099
1099
|
"maxWidth": "none",
|
|
@@ -1179,7 +1179,7 @@ exports[`Image layout=intrinsic visible renders the image (relative URL) 1`] = `
|
|
|
1179
1179
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
1180
1180
|
style={
|
|
1181
1181
|
{
|
|
1182
|
-
"height": "
|
|
1182
|
+
"height": "auto",
|
|
1183
1183
|
"left": "-5%",
|
|
1184
1184
|
"maxHeight": "none",
|
|
1185
1185
|
"maxWidth": "none",
|
|
@@ -1270,7 +1270,7 @@ exports[`Image layout=intrinsic visible renders the image 1`] = `
|
|
|
1270
1270
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
1271
1271
|
style={
|
|
1272
1272
|
{
|
|
1273
|
-
"height": "
|
|
1273
|
+
"height": "auto",
|
|
1274
1274
|
"left": "-5%",
|
|
1275
1275
|
"maxHeight": "none",
|
|
1276
1276
|
"maxWidth": "none",
|
|
@@ -1362,7 +1362,7 @@ exports[`Image layout=responsive not visible renders the blur-up thumb 1`] = `
|
|
|
1362
1362
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
1363
1363
|
style={
|
|
1364
1364
|
{
|
|
1365
|
-
"height": "
|
|
1365
|
+
"height": "auto",
|
|
1366
1366
|
"left": "-5%",
|
|
1367
1367
|
"maxHeight": "none",
|
|
1368
1368
|
"maxWidth": "none",
|
|
@@ -1427,7 +1427,7 @@ exports[`Image layout=responsive visible image loaded shows the image 1`] = `
|
|
|
1427
1427
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
1428
1428
|
style={
|
|
1429
1429
|
{
|
|
1430
|
-
"height": "
|
|
1430
|
+
"height": "auto",
|
|
1431
1431
|
"left": "-5%",
|
|
1432
1432
|
"maxHeight": "none",
|
|
1433
1433
|
"maxWidth": "none",
|
|
@@ -1514,7 +1514,7 @@ exports[`Image layout=responsive visible renders the image (minimal data) 1`] =
|
|
|
1514
1514
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
1515
1515
|
style={
|
|
1516
1516
|
{
|
|
1517
|
-
"height": "
|
|
1517
|
+
"height": "auto",
|
|
1518
1518
|
"left": "-5%",
|
|
1519
1519
|
"maxHeight": "none",
|
|
1520
1520
|
"maxWidth": "none",
|
|
@@ -1599,7 +1599,7 @@ exports[`Image layout=responsive visible renders the image (relative URL) 1`] =
|
|
|
1599
1599
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
1600
1600
|
style={
|
|
1601
1601
|
{
|
|
1602
|
-
"height": "
|
|
1602
|
+
"height": "auto",
|
|
1603
1603
|
"left": "-5%",
|
|
1604
1604
|
"maxHeight": "none",
|
|
1605
1605
|
"maxWidth": "none",
|
|
@@ -1689,7 +1689,7 @@ exports[`Image layout=responsive visible renders the image 1`] = `
|
|
|
1689
1689
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
1690
1690
|
style={
|
|
1691
1691
|
{
|
|
1692
|
-
"height": "
|
|
1692
|
+
"height": "auto",
|
|
1693
1693
|
"left": "-5%",
|
|
1694
1694
|
"maxHeight": "none",
|
|
1695
1695
|
"maxWidth": "none",
|
|
@@ -1799,7 +1799,7 @@ exports[`Image passing className and/or style renders correctly 1`] = `
|
|
|
1799
1799
|
style={
|
|
1800
1800
|
{
|
|
1801
1801
|
"border": "1px solid green ",
|
|
1802
|
-
"height": "
|
|
1802
|
+
"height": "auto",
|
|
1803
1803
|
"left": "-5%",
|
|
1804
1804
|
"maxHeight": "none",
|
|
1805
1805
|
"maxWidth": "none",
|
|
@@ -1886,7 +1886,7 @@ exports[`Image priority=true renders correctly 1`] = `
|
|
|
1886
1886
|
src="data:image/jpeg;base64,<IMAGE-DATA>"
|
|
1887
1887
|
style={
|
|
1888
1888
|
{
|
|
1889
|
-
"height": "
|
|
1889
|
+
"height": "auto",
|
|
1890
1890
|
"left": "-5%",
|
|
1891
1891
|
"maxHeight": "none",
|
|
1892
1892
|
"maxWidth": "none",
|
package/src/Image/index.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
// biome-ignore lint/style/useImportType: wrong warning
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { type CSSProperties, forwardRef, useRef } from 'react';
|
|
5
6
|
import {
|
|
@@ -204,7 +205,7 @@ export const Image = forwardRef<HTMLDivElement, ImagePropTypes>(
|
|
|
204
205
|
left: '-5%',
|
|
205
206
|
top: '-5%',
|
|
206
207
|
width: '110%',
|
|
207
|
-
height: '
|
|
208
|
+
height: 'auto',
|
|
208
209
|
maxWidth: 'none',
|
|
209
210
|
maxHeight: 'none',
|
|
210
211
|
...placeholderStyle,
|
|
@@ -18,12 +18,13 @@ exports[`Image explicit sizes renders correctly 1`] = `
|
|
|
18
18
|
srcSet="https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.25 187w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.5 375w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.75 562w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750 750w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=1.5 1125w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=2 1500w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=3 2250w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=4 3000w"
|
|
19
19
|
/>
|
|
20
20
|
<img
|
|
21
|
+
alt=""
|
|
21
22
|
loading="lazy"
|
|
22
23
|
src="https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750"
|
|
23
24
|
style={
|
|
24
25
|
{
|
|
25
26
|
"aspectRatio": "750 / 421",
|
|
26
|
-
"backgroundImage": "url(data:image/jpeg;base64,<IMAGE-DATA>)",
|
|
27
|
+
"backgroundImage": "url("data:image/jpeg;base64,<IMAGE-DATA>")",
|
|
27
28
|
"backgroundPosition": "50% 50%",
|
|
28
29
|
"backgroundRepeat": "no-repeat",
|
|
29
30
|
"backgroundSize": "cover",
|
|
@@ -66,7 +67,7 @@ exports[`Image full data renders correctly 1`] = `
|
|
|
66
67
|
style={
|
|
67
68
|
{
|
|
68
69
|
"aspectRatio": "750 / 421",
|
|
69
|
-
"backgroundImage": "url(data:image/jpeg;base64,<IMAGE-DATA>)",
|
|
70
|
+
"backgroundImage": "url("data:image/jpeg;base64,<IMAGE-DATA>")",
|
|
70
71
|
"backgroundPosition": "50% 50%",
|
|
71
72
|
"backgroundRepeat": "no-repeat",
|
|
72
73
|
"backgroundSize": "cover",
|
|
@@ -98,12 +99,13 @@ exports[`Image minimal data renders correctly 1`] = `
|
|
|
98
99
|
srcSet="https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.25 187w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.5 375w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.75 562w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750 750w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=1.5 1125w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=2 1500w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=3 2250w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=4 3000w"
|
|
99
100
|
/>
|
|
100
101
|
<img
|
|
102
|
+
alt=""
|
|
101
103
|
loading="lazy"
|
|
102
104
|
src="https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750"
|
|
103
105
|
style={
|
|
104
106
|
{
|
|
105
107
|
"aspectRatio": "750 / 421",
|
|
106
|
-
"backgroundImage": "url(data:image/jpeg;base64,<IMAGE-DATA>)",
|
|
108
|
+
"backgroundImage": "url("data:image/jpeg;base64,<IMAGE-DATA>")",
|
|
107
109
|
"backgroundPosition": "50% 50%",
|
|
108
110
|
"backgroundRepeat": "no-repeat",
|
|
109
111
|
"backgroundSize": "cover",
|
|
@@ -134,12 +136,13 @@ exports[`Image minimalDataWithRelativeUrl renders correctly 1`] = `
|
|
|
134
136
|
srcSet="/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.25 187w,/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.5 375w,/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.75 562w,/205/image.png?ar=16%3A9&fit=crop&w=750 750w,/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=1.5 1125w,/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=2 1500w,/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=3 2250w,/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=4 3000w"
|
|
135
137
|
/>
|
|
136
138
|
<img
|
|
139
|
+
alt=""
|
|
137
140
|
loading="lazy"
|
|
138
141
|
src="/205/image.png?ar=16%3A9&fit=crop&w=750"
|
|
139
142
|
style={
|
|
140
143
|
{
|
|
141
144
|
"aspectRatio": "750 / 421",
|
|
142
|
-
"backgroundImage": "url(data:image/jpeg;base64,<IMAGE-DATA>)",
|
|
145
|
+
"backgroundImage": "url("data:image/jpeg;base64,<IMAGE-DATA>")",
|
|
143
146
|
"backgroundPosition": "50% 50%",
|
|
144
147
|
"backgroundRepeat": "no-repeat",
|
|
145
148
|
"backgroundSize": "cover",
|
|
@@ -176,13 +179,14 @@ exports[`Image passing className and/or style renders correctly 1`] = `
|
|
|
176
179
|
srcSet="https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.25 187w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.5 375w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.75 562w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750 750w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=1.5 1125w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=2 1500w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=3 2250w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=4 3000w"
|
|
177
180
|
/>
|
|
178
181
|
<img
|
|
182
|
+
alt=""
|
|
179
183
|
className="class-name"
|
|
180
184
|
loading="lazy"
|
|
181
185
|
src="https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750"
|
|
182
186
|
style={
|
|
183
187
|
{
|
|
184
188
|
"aspectRatio": "750 / 421",
|
|
185
|
-
"backgroundImage": "url(data:image/jpeg;base64,<IMAGE-DATA>)",
|
|
189
|
+
"backgroundImage": "url("data:image/jpeg;base64,<IMAGE-DATA>")",
|
|
186
190
|
"backgroundPosition": "50% 50%",
|
|
187
191
|
"backgroundRepeat": "no-repeat",
|
|
188
192
|
"backgroundSize": "cover",
|
|
@@ -215,12 +219,13 @@ exports[`Image priority=true renders correctly 1`] = `
|
|
|
215
219
|
srcSet="https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.25 187w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.5 375w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.75 562w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750 750w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=1.5 1125w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=2 1500w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=3 2250w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=4 3000w"
|
|
216
220
|
/>
|
|
217
221
|
<img
|
|
222
|
+
alt=""
|
|
218
223
|
fetchpriority="high"
|
|
219
224
|
src="https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750"
|
|
220
225
|
style={
|
|
221
226
|
{
|
|
222
227
|
"aspectRatio": "750 / 421",
|
|
223
|
-
"backgroundImage": "url(data:image/jpeg;base64,<IMAGE-DATA>)",
|
|
228
|
+
"backgroundImage": "url("data:image/jpeg;base64,<IMAGE-DATA>")",
|
|
224
229
|
"backgroundPosition": "50% 50%",
|
|
225
230
|
"backgroundRepeat": "no-repeat",
|
|
226
231
|
"backgroundSize": "cover",
|
|
@@ -252,6 +257,7 @@ exports[`Image usePlaceholder=false renders correctly 1`] = `
|
|
|
252
257
|
srcSet="https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.25 187w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.5 375w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=0.75 562w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750 750w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=1.5 1125w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=2 1500w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=3 2250w,https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750&dpr=4 3000w"
|
|
253
258
|
/>
|
|
254
259
|
<img
|
|
260
|
+
alt=""
|
|
255
261
|
loading="lazy"
|
|
256
262
|
src="https://www.datocms-assets.com/205/image.png?ar=16%3A9&fit=crop&w=750"
|
|
257
263
|
style={
|
package/src/SRCImage/index.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// biome-ignore lint/style/useImportType: wrong warning
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import type { ResponsiveImageType } from '../Image';
|
|
3
4
|
import { buildRegularSource, buildWebpSource, priorityProp } from './utils.js';
|
|
@@ -48,7 +49,7 @@ export function SRCImage({
|
|
|
48
49
|
const placeholderStyle: React.CSSProperties | undefined =
|
|
49
50
|
usePlaceholder && data.base64
|
|
50
51
|
? {
|
|
51
|
-
backgroundImage: `url(${data.base64})`,
|
|
52
|
+
backgroundImage: `url("${data.base64}")`,
|
|
52
53
|
backgroundSize: 'cover',
|
|
53
54
|
backgroundRepeat: 'no-repeat',
|
|
54
55
|
backgroundPosition: '50% 50%',
|
|
@@ -82,7 +83,7 @@ export function SRCImage({
|
|
|
82
83
|
// biome-ignore lint/a11y/useAltText: We do with alt the best we can
|
|
83
84
|
<img
|
|
84
85
|
src={data.src}
|
|
85
|
-
alt={data.alt ??
|
|
86
|
+
alt={data.alt ?? ''}
|
|
86
87
|
title={data.title ?? undefined}
|
|
87
88
|
{...loadingBehaviourProps}
|
|
88
89
|
className={className}
|
package/src/SRCImage/utils.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { version } from 'react';
|
|
2
|
-
import { ResponsiveImageType } from '../Image';
|
|
2
|
+
import type { ResponsiveImageType } from '../Image';
|
|
3
3
|
|
|
4
4
|
export function priorityProp(
|
|
5
5
|
fetchPriority?: string,
|
|
6
6
|
): Record<string, string | undefined> {
|
|
7
7
|
const [majorStr, minorStr] = version.split('.');
|
|
8
|
-
const major = parseInt(majorStr, 10);
|
|
9
|
-
const minor = parseInt(minorStr, 10);
|
|
8
|
+
const major = Number.parseInt(majorStr, 10);
|
|
9
|
+
const minor = Number.parseInt(minorStr, 10);
|
|
10
10
|
if (major > 18 || (major === 18 && minor >= 3)) {
|
|
11
11
|
// In React 18.3.0 or newer, we must use camelCase
|
|
12
12
|
// prop to avoid "Warning: Invalid DOM property".
|
|
@@ -40,13 +40,13 @@ export const buildSrcSetFromSrc = (
|
|
|
40
40
|
if (maxH) {
|
|
41
41
|
url.searchParams.set(
|
|
42
42
|
'max-h',
|
|
43
|
-
`${Math.floor(parseInt(maxH) * multiplier)}`,
|
|
43
|
+
`${Math.floor(Number.parseInt(maxH) * multiplier)}`,
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
if (maxW) {
|
|
47
47
|
url.searchParams.set(
|
|
48
48
|
'max-w',
|
|
49
|
-
`${Math.floor(parseInt(maxW) * multiplier)}`,
|
|
49
|
+
`${Math.floor(Number.parseInt(maxW) * multiplier)}`,
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
}
|
package/src/Seo/nextUtils.ts
CHANGED
|
@@ -76,7 +76,7 @@ export function toNextMetadata(
|
|
|
76
76
|
const { tag, attributes, content } = datum;
|
|
77
77
|
|
|
78
78
|
if (tag === 'title') {
|
|
79
|
-
metadata
|
|
79
|
+
metadata.title = content;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
if (isSeoOrFaviconTag(datum) && isSeoMetaTag(datum)) {
|
|
@@ -88,15 +88,15 @@ export function toNextMetadata(
|
|
|
88
88
|
|
|
89
89
|
if (parts?.length === 1) {
|
|
90
90
|
if (parts[0] === 'image') {
|
|
91
|
-
metadata
|
|
91
|
+
metadata.openGraph ||= {};
|
|
92
92
|
|
|
93
|
-
metadata
|
|
94
|
-
...metadata
|
|
93
|
+
metadata.openGraph.images = {
|
|
94
|
+
...metadata.openGraph.images,
|
|
95
95
|
url: content,
|
|
96
96
|
};
|
|
97
97
|
} else {
|
|
98
|
-
metadata
|
|
99
|
-
...metadata
|
|
98
|
+
metadata.openGraph = {
|
|
99
|
+
...metadata.openGraph,
|
|
100
100
|
[camelize(parts[0])]: content,
|
|
101
101
|
};
|
|
102
102
|
}
|
|
@@ -104,17 +104,17 @@ export function toNextMetadata(
|
|
|
104
104
|
|
|
105
105
|
if (parts?.length === 2) {
|
|
106
106
|
if (parts[0] === 'image' && parts[1] === 'width') {
|
|
107
|
-
metadata
|
|
107
|
+
metadata.openGraph ||= {};
|
|
108
108
|
|
|
109
|
-
metadata
|
|
110
|
-
...metadata
|
|
109
|
+
metadata.openGraph.images = {
|
|
110
|
+
...metadata.openGraph.images,
|
|
111
111
|
width: content,
|
|
112
112
|
};
|
|
113
113
|
} else if (parts[0] === 'image' && parts[1] === 'height') {
|
|
114
|
-
metadata
|
|
114
|
+
metadata.openGraph ||= {};
|
|
115
115
|
|
|
116
|
-
metadata
|
|
117
|
-
...metadata
|
|
116
|
+
metadata.openGraph.images = {
|
|
117
|
+
...metadata.openGraph.images,
|
|
118
118
|
height: content,
|
|
119
119
|
};
|
|
120
120
|
}
|
|
@@ -131,8 +131,8 @@ export function toNextMetadata(
|
|
|
131
131
|
const [_, ...parts] = name.split(':');
|
|
132
132
|
|
|
133
133
|
if (parts?.length === 1) {
|
|
134
|
-
metadata
|
|
135
|
-
...metadata
|
|
134
|
+
metadata.twitter = {
|
|
135
|
+
...metadata.twitter,
|
|
136
136
|
[camelize(parts[0])]: content,
|
|
137
137
|
};
|
|
138
138
|
}
|
|
@@ -146,10 +146,10 @@ export function toNextMetadata(
|
|
|
146
146
|
if (isAppleTouchIconAttributes(datum.attributes)) {
|
|
147
147
|
const { sizes, href } = datum.attributes;
|
|
148
148
|
|
|
149
|
-
metadata
|
|
149
|
+
metadata.icons ||= {};
|
|
150
150
|
|
|
151
|
-
metadata
|
|
152
|
-
...(metadata
|
|
151
|
+
metadata.icons.apple = [
|
|
152
|
+
...(metadata.icons.apple || []),
|
|
153
153
|
{ url: href, sizes },
|
|
154
154
|
];
|
|
155
155
|
}
|
|
@@ -157,10 +157,10 @@ export function toNextMetadata(
|
|
|
157
157
|
if (isFaviconAttributes(datum.attributes)) {
|
|
158
158
|
const { sizes, type, rel, href } = datum.attributes;
|
|
159
159
|
|
|
160
|
-
metadata
|
|
160
|
+
metadata.icons ||= {};
|
|
161
161
|
|
|
162
|
-
metadata
|
|
163
|
-
...(metadata
|
|
162
|
+
metadata.icons.icon = [
|
|
163
|
+
...(metadata.icons.icon || []),
|
|
164
164
|
{ url: href, sizes, type, rel },
|
|
165
165
|
];
|
|
166
166
|
}
|
package/src/Seo/remixUtils.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { SeoOrFaviconTag, TitleMetaLinkTag } from './types.js';
|
|
2
|
+
import type { SeoOrFaviconTag, TitleMetaLinkTag } from './types.js';
|
|
3
3
|
|
|
4
4
|
export function renderMetaTags(
|
|
5
5
|
data: TitleMetaLinkTag[] | SeoOrFaviconTag[],
|
|
6
6
|
): JSX.Element[] {
|
|
7
7
|
return data.map(({ tag, attributes, content }) => {
|
|
8
|
-
|
|
8
|
+
const key: string[] = [tag];
|
|
9
9
|
|
|
10
10
|
if (attributes && 'property' in attributes) {
|
|
11
11
|
key.push(attributes.property);
|