react-datocms 1.6.7 → 2.1.0

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 (46) hide show
  1. package/README.md +144 -63
  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 +37 -22
  5. package/dist/cjs/Image/index.js.map +1 -1
  6. package/dist/cjs/Seo/__tests__/index.test.js +277 -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 +42 -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/esm/Image/__tests__/index.test.js +36 -32
  19. package/dist/esm/Image/__tests__/index.test.js.map +1 -1
  20. package/dist/esm/Image/index.d.ts +23 -6
  21. package/dist/esm/Image/index.js +40 -24
  22. package/dist/esm/Image/index.js.map +1 -1
  23. package/dist/esm/Seo/__tests__/index.test.js +276 -36
  24. package/dist/esm/Seo/__tests__/index.test.js.map +1 -1
  25. package/dist/esm/Seo/index.d.ts +4 -12
  26. package/dist/esm/Seo/index.js +4 -55
  27. package/dist/esm/Seo/index.js.map +1 -1
  28. package/dist/esm/Seo/remixUtils.d.ts +24 -0
  29. package/dist/esm/Seo/remixUtils.js +37 -0
  30. package/dist/esm/Seo/remixUtils.js.map +1 -0
  31. package/dist/esm/Seo/renderMetaTags.d.ts +3 -0
  32. package/dist/esm/Seo/renderMetaTags.js +33 -0
  33. package/dist/esm/Seo/renderMetaTags.js.map +1 -0
  34. package/dist/esm/Seo/renderMetaTagsToString.d.ts +2 -0
  35. package/dist/esm/Seo/renderMetaTagsToString.js +18 -0
  36. package/dist/esm/Seo/renderMetaTagsToString.js.map +1 -0
  37. package/dist/esm/Seo/types.d.ts +37 -0
  38. package/dist/esm/Seo/types.js +4 -0
  39. package/dist/esm/Seo/types.js.map +1 -0
  40. package/dist/types/Image/index.d.ts +23 -6
  41. package/dist/types/Seo/index.d.ts +4 -12
  42. package/dist/types/Seo/remixUtils.d.ts +24 -0
  43. package/dist/types/Seo/renderMetaTags.d.ts +3 -0
  44. package/dist/types/Seo/renderMetaTagsToString.d.ts +2 -0
  45. package/dist/types/Seo/types.d.ts +37 -0
  46. package/package.json +1 -1
@@ -1,12 +1,4 @@
1
- /// <reference types="react" />
2
- export declare type SeoMetaTagType = {
3
- /** the tag for the meta information */
4
- tag: string;
5
- /** the inner content of the meta tag */
6
- content: string | null;
7
- /** the HTML attributes to attach to the meta tag */
8
- attributes: Record<string, string> | null;
9
- };
10
- export declare type ToMetaTagsType = SeoMetaTagType[];
11
- export declare const renderMetaTags: (data: SeoMetaTagType[]) => JSX.Element[];
12
- export declare const renderMetaTagsToString: (data: SeoMetaTagType[]) => string;
1
+ export * from './types';
2
+ export * from './remixUtils';
3
+ export * from './renderMetaTags';
4
+ export * from './renderMetaTagsToString';
@@ -1,56 +1,5 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import React from "react";
13
- export var renderMetaTags = function (data) {
14
- return data.map(function (_a) {
15
- var tag = _a.tag, attributes = _a.attributes, content = _a.content;
16
- var key = [tag];
17
- if (attributes && "property" in attributes) {
18
- key.push(attributes.property);
19
- }
20
- if (attributes && "name" in attributes) {
21
- key.push(attributes.name);
22
- }
23
- if (attributes && "rel" in attributes) {
24
- key.push(attributes.rel);
25
- }
26
- if (attributes && "sizes" in attributes) {
27
- key.push(attributes.sizes);
28
- }
29
- var Tag = tag;
30
- return (React.createElement(Tag, __assign({ key: key.join("-") }, attributes), content));
31
- });
32
- };
33
- var serializeAttributes = function (attributes) {
34
- if (!attributes) {
35
- return "";
36
- }
37
- var serializedAttrs = [];
38
- for (var key in attributes) {
39
- if (Object.prototype.hasOwnProperty.call(attributes, key)) {
40
- serializedAttrs.push(key + "=\"" + attributes[key] + "\"");
41
- }
42
- }
43
- return " " + serializedAttrs.join(" ");
44
- };
45
- export var renderMetaTagsToString = function (data) {
46
- return data
47
- .map(function (_a) {
48
- var tag = _a.tag, attributes = _a.attributes, content = _a.content;
49
- if (content) {
50
- return "<" + tag + serializeAttributes(attributes) + ">" + content + "</" + tag + ">";
51
- }
52
- return "<" + tag + serializeAttributes(attributes) + " />";
53
- })
54
- .join("\n");
55
- };
1
+ export * from './types';
2
+ export * from './remixUtils';
3
+ export * from './renderMetaTags';
4
+ export * from './renderMetaTagsToString';
56
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Seo/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,MAAM,CAAC,IAAM,cAAc,GAAG,UAAU,IAAsB;IAC5D,OAAO,IAAI,CAAC,GAAG,CAAC,UAAC,EAA4B;YAA1B,GAAG,SAAA,EAAE,UAAU,gBAAA,EAAE,OAAO,aAAA;QACzC,IAAI,GAAG,GAAa,CAAC,GAAG,CAAC,CAAC;QAE1B,IAAI,UAAU,IAAI,UAAU,IAAI,UAAU,EAAE;YAC1C,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;SAC/B;QAED,IAAI,UAAU,IAAI,MAAM,IAAI,UAAU,EAAE;YACtC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SAC3B;QAED,IAAI,UAAU,IAAI,KAAK,IAAI,UAAU,EAAE;YACrC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;SAC1B;QAED,IAAI,UAAU,IAAI,OAAO,IAAI,UAAU,EAAE;YACvC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;SAC5B;QAED,IAAM,GAAG,GAAG,GAAgC,CAAC;QAE7C,OAAO,CACL,oBAAC,GAAG,aAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAM,UAAU,GACpC,OAAO,CACJ,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,IAAM,mBAAmB,GAAG,UAAC,UAAyC;IACpE,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,EAAE,CAAC;KACX;IAED,IAAM,eAAe,GAAG,EAAE,CAAC;IAE3B,KAAK,IAAM,GAAG,IAAI,UAAU,EAAE;QAC5B,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE;YACzD,eAAe,CAAC,IAAI,CAAI,GAAG,WAAK,UAAU,CAAC,GAAG,CAAC,OAAG,CAAC,CAAC;SACrD;KACF;IAED,OAAO,GAAG,GAAG,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,sBAAsB,GAAG,UAAU,IAAsB;IACpE,OAAO,IAAI;SACR,GAAG,CAAC,UAAC,EAA4B;YAA1B,GAAG,SAAA,EAAE,UAAU,gBAAA,EAAE,OAAO,aAAA;QAC9B,IAAI,OAAO,EAAE;YACX,OAAO,MAAI,GAAG,GAAG,mBAAmB,CAAC,UAAU,CAAC,SAAI,OAAO,UAAK,GAAG,MAAG,CAAC;SACxE;QAED,OAAO,MAAI,GAAG,GAAG,mBAAmB,CAAC,UAAU,CAAC,QAAK,CAAC;IACxD,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Seo/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { SeoOrFaviconTag } from './types';
2
+ interface RemixHtmlMetaDescriptor {
3
+ [name: string]: string | string[];
4
+ }
5
+ interface RemixHtmlLinkDescriptor {
6
+ href: string;
7
+ crossOrigin?: 'anonymous' | 'use-credentials';
8
+ rel: string;
9
+ media?: string;
10
+ integrity?: string;
11
+ hrefLang?: string;
12
+ type?: string;
13
+ referrerPolicy?: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'same-origin' | 'origin' | 'strict-origin' | 'origin-when-cross-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
14
+ sizes?: string;
15
+ imagesrcset?: string;
16
+ imagesizes?: string;
17
+ as?: string;
18
+ color?: string;
19
+ disabled?: boolean;
20
+ title?: string;
21
+ }
22
+ export declare function toRemixMeta(metaTags: null | SeoOrFaviconTag[]): RemixHtmlMetaDescriptor;
23
+ export declare function toRemixLinks(metaTags: null | SeoOrFaviconTag[]): RemixHtmlLinkDescriptor[];
24
+ export {};
@@ -0,0 +1,37 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ export function toRemixMeta(metaTags) {
13
+ if (!metaTags) {
14
+ return {};
15
+ }
16
+ return metaTags.reduce(function (acc, tag) {
17
+ var _a;
18
+ if (tag.tag === 'title') {
19
+ return tag.content ? __assign(__assign({}, acc), { title: tag.content }) : acc;
20
+ }
21
+ if (tag.tag === 'link') {
22
+ return acc;
23
+ }
24
+ return __assign(__assign({}, acc), (_a = {}, _a['property' in tag.attributes
25
+ ? tag.attributes.property
26
+ : tag.attributes.name] = tag.attributes.content, _a));
27
+ }, {});
28
+ }
29
+ export function toRemixLinks(metaTags) {
30
+ if (!metaTags) {
31
+ return [];
32
+ }
33
+ return metaTags
34
+ .filter(function (tag) { return tag.tag === 'link'; })
35
+ .map(function (tag) { return tag.attributes; });
36
+ }
37
+ //# sourceMappingURL=remixUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remixUtils.js","sourceRoot":"","sources":["../../../src/Seo/remixUtils.ts"],"names":[],"mappings":";;;;;;;;;;;AAiCA,MAAM,UAAU,WAAW,CACzB,QAAkC;IAElC,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,EAAE,CAAC;KACX;IAED,OAAO,QAAQ,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,GAAG;;QAC9B,IAAI,GAAG,CAAC,GAAG,KAAK,OAAO,EAAE;YACvB,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,uBAAM,GAAG,KAAE,KAAK,EAAE,GAAG,CAAC,OAAO,IAAG,CAAC,CAAC,GAAG,CAAC;SAC3D;QAED,IAAI,GAAG,CAAC,GAAG,KAAK,MAAM,EAAE;YACtB,OAAO,GAAG,CAAC;SACZ;QAED,6BACK,GAAG,gBACL,UAAU,IAAI,GAAG,CAAC,UAAU;YAC3B,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ;YACzB,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAG,GAAG,CAAC,UAAU,CAAC,OAAO,OAChD;IACJ,CAAC,EAAE,EAA6B,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,QAAkC;IAElC,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,EAAE,CAAC;KACX;IAED,OAAO,QAAQ;SACZ,MAAM,CAAC,UAAC,GAAG,IAAwB,OAAA,GAAG,CAAC,GAAG,KAAK,MAAM,EAAlB,CAAkB,CAAC;SACtD,GAAG,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,UAAU,EAAd,CAAc,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { SeoOrFaviconTag } from './types';
3
+ export declare function renderMetaTags(data: SeoOrFaviconTag[]): JSX.Element[];
@@ -0,0 +1,33 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import React from 'react';
13
+ export function renderMetaTags(data) {
14
+ return data.map(function (_a) {
15
+ var tag = _a.tag, attributes = _a.attributes, content = _a.content;
16
+ var key = [tag];
17
+ if (attributes && 'property' in attributes) {
18
+ key.push(attributes.property);
19
+ }
20
+ if (attributes && 'name' in attributes) {
21
+ key.push(attributes.name);
22
+ }
23
+ if (attributes && 'rel' in attributes) {
24
+ key.push(attributes.rel);
25
+ }
26
+ if (attributes && 'sizes' in attributes) {
27
+ key.push(attributes.sizes);
28
+ }
29
+ var Tag = tag;
30
+ return (React.createElement(Tag, __assign({ key: key.join('-') }, attributes), content));
31
+ });
32
+ }
33
+ //# sourceMappingURL=renderMetaTags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderMetaTags.js","sourceRoot":"","sources":["../../../src/Seo/renderMetaTags.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,UAAU,cAAc,CAAC,IAAuB;IACpD,OAAO,IAAI,CAAC,GAAG,CAAC,UAAC,EAA4B;YAA1B,GAAG,SAAA,EAAE,UAAU,gBAAA,EAAE,OAAO,aAAA;QACzC,IAAI,GAAG,GAAa,CAAC,GAAG,CAAC,CAAC;QAE1B,IAAI,UAAU,IAAI,UAAU,IAAI,UAAU,EAAE;YAC1C,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;SAC/B;QAED,IAAI,UAAU,IAAI,MAAM,IAAI,UAAU,EAAE;YACtC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SAC3B;QAED,IAAI,UAAU,IAAI,KAAK,IAAI,UAAU,EAAE;YACrC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;SAC1B;QAED,IAAI,UAAU,IAAI,OAAO,IAAI,UAAU,EAAE;YACvC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;SAC5B;QAED,IAAM,GAAG,GAAG,GAAG,CAAC;QAEhB,OAAO,CACL,oBAAC,GAAG,aAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAM,UAAU,GACpC,OAAO,CACJ,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { SeoOrFaviconTag } from "./types";
2
+ export declare function renderMetaTagsToString(data: SeoOrFaviconTag[]): string;
@@ -0,0 +1,18 @@
1
+ export function renderMetaTagsToString(data) {
2
+ return data
3
+ .map(function (tag) {
4
+ if (tag.tag === 'title') {
5
+ return "<title>" + tag.content + "</title>";
6
+ }
7
+ var serializedAttrs = [];
8
+ for (var key in tag.attributes) {
9
+ if (Object.prototype.hasOwnProperty.call(tag.attributes, key)) {
10
+ serializedAttrs.push(key + "=\"" + tag.attributes[key] + "\"");
11
+ }
12
+ }
13
+ return "<" + tag.tag + " " + serializedAttrs.join(' ') + " />";
14
+ })
15
+ .join('\n');
16
+ }
17
+ ;
18
+ //# sourceMappingURL=renderMetaTagsToString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderMetaTagsToString.js","sourceRoot":"","sources":["../../../src/Seo/renderMetaTagsToString.tsx"],"names":[],"mappings":"AAEA,MAAM,UAAU,sBAAsB,CAAC,IAAuB;IAC5D,OAAO,IAAI;SACR,GAAG,CAAC,UAAC,GAAG;QACP,IAAI,GAAG,CAAC,GAAG,KAAK,OAAO,EAAE;YACvB,OAAO,YAAU,GAAG,CAAC,OAAO,aAAU,CAAC;SACxC;QAED,IAAM,eAAe,GAAG,EAAE,CAAC;QAE3B,KAAK,IAAM,GAAG,IAAI,GAAG,CAAC,UAAU,EAAE;YAChC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE;gBAC7D,eAAe,CAAC,IAAI,CAAI,GAAG,WAAM,GAAG,CAAC,UAAkB,CAAC,GAAG,CAAC,OAAG,CAAC,CAAC;aAClE;SACF;QAED,OAAO,MAAI,GAAG,CAAC,GAAG,SAAI,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,QAAK,CAAC;IACvD,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAAA,CAAC"}
@@ -0,0 +1,37 @@
1
+ export interface SeoTitleTag {
2
+ tag: 'title';
3
+ content: string | null;
4
+ attributes?: null;
5
+ }
6
+ export interface RegularMetaAttributes {
7
+ name: string;
8
+ content: string;
9
+ }
10
+ export interface OgMetaAttributes {
11
+ property: string;
12
+ content: string;
13
+ }
14
+ export interface SeoMetaTag {
15
+ tag: 'meta';
16
+ content?: null;
17
+ attributes: RegularMetaAttributes | OgMetaAttributes;
18
+ }
19
+ export interface FaviconAttributes {
20
+ sizes: string;
21
+ type: string;
22
+ rel: string;
23
+ href: string;
24
+ }
25
+ export interface AppleTouchIconAttributes {
26
+ sizes: string;
27
+ rel: 'apple-touch-icon';
28
+ href: string;
29
+ }
30
+ export interface SeoLinkTag {
31
+ tag: 'link';
32
+ content?: null;
33
+ attributes: FaviconAttributes | AppleTouchIconAttributes;
34
+ }
35
+ export declare type SeoTag = SeoTitleTag | SeoMetaTag;
36
+ export declare type FaviconTag = SeoMetaTag | SeoLinkTag;
37
+ export declare type SeoOrFaviconTag = SeoTag | FaviconTag;
@@ -0,0 +1,4 @@
1
+ ;
2
+ ;
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/Seo/types.tsx"],"names":[],"mappings":"AASC,CAAC;AAKD,CAAC"}
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import "intersection-observer";
1
+ import React, { CSSProperties } from 'react';
2
+ import 'intersection-observer';
3
3
  export declare type ResponsiveImageType = {
4
4
  /** The aspect ratio (width/height) of the image */
5
5
  aspectRatio: number;
@@ -39,14 +39,31 @@ declare type ImagePropTypes = {
39
39
  intersectionThreshold?: number;
40
40
  /** 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 */
41
41
  intersectionMargin?: string;
42
- /** Wheter enable lazy loading or not */
42
+ /** Whether enable lazy loading or not */
43
43
  lazyLoad?: boolean;
44
44
  /** Additional CSS rules to add to the root node */
45
45
  style?: React.CSSProperties;
46
46
  /** Additional CSS rules to add to the image inside the `<picture />` tag */
47
47
  pictureStyle?: React.CSSProperties;
48
- /** Wheter the image wrapper should explicitely declare the width of the image or keep it fluid */
49
- explicitWidth?: boolean;
48
+ /**
49
+ * The layout behavior of the image as the viewport changes size
50
+ *
51
+ * Possible values:
52
+ *
53
+ * * `intrinsic` (default): the image will scale the dimensions down for smaller viewports, but maintain the original dimensions for larger viewports
54
+ * * `fixed`: the image dimensions will not change as the viewport changes (no responsiveness) similar to the native img element
55
+ * * `responsive`: the image will scale the dimensions down for smaller viewports and scale up for larger viewports
56
+ * * `fill`: image will stretch both width and height to the dimensions of the parent element, provided the parent element is `relative`
57
+ * */
58
+ layout?: 'intrinsic' | 'fixed' | 'responsive' | 'fill';
59
+ /** Defines how the image will fit into its parent container when using layout="fill" */
60
+ objectFit?: CSSProperties['objectFit'];
61
+ /** Defines how the image is positioned within its parent element when using layout="fill". */
62
+ objectPosition?: CSSProperties['objectPosition'];
63
+ /** Triggered when the image finishes loading */
64
+ onLoad?(): void;
65
+ /** Whether the component should use a blurred image placeholder */
66
+ usePlaceholder?: boolean;
50
67
  };
51
- export declare const Image: React.FC<ImagePropTypes>;
68
+ export declare const Image: React.ForwardRefExoticComponent<ImagePropTypes & React.RefAttributes<HTMLDivElement>>;
52
69
  export {};
@@ -1,12 +1,4 @@
1
- /// <reference types="react" />
2
- export declare type SeoMetaTagType = {
3
- /** the tag for the meta information */
4
- tag: string;
5
- /** the inner content of the meta tag */
6
- content: string | null;
7
- /** the HTML attributes to attach to the meta tag */
8
- attributes: Record<string, string> | null;
9
- };
10
- export declare type ToMetaTagsType = SeoMetaTagType[];
11
- export declare const renderMetaTags: (data: SeoMetaTagType[]) => JSX.Element[];
12
- export declare const renderMetaTagsToString: (data: SeoMetaTagType[]) => string;
1
+ export * from './types';
2
+ export * from './remixUtils';
3
+ export * from './renderMetaTags';
4
+ export * from './renderMetaTagsToString';
@@ -0,0 +1,24 @@
1
+ import { SeoOrFaviconTag } from './types';
2
+ interface RemixHtmlMetaDescriptor {
3
+ [name: string]: string | string[];
4
+ }
5
+ interface RemixHtmlLinkDescriptor {
6
+ href: string;
7
+ crossOrigin?: 'anonymous' | 'use-credentials';
8
+ rel: string;
9
+ media?: string;
10
+ integrity?: string;
11
+ hrefLang?: string;
12
+ type?: string;
13
+ referrerPolicy?: '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'same-origin' | 'origin' | 'strict-origin' | 'origin-when-cross-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
14
+ sizes?: string;
15
+ imagesrcset?: string;
16
+ imagesizes?: string;
17
+ as?: string;
18
+ color?: string;
19
+ disabled?: boolean;
20
+ title?: string;
21
+ }
22
+ export declare function toRemixMeta(metaTags: null | SeoOrFaviconTag[]): RemixHtmlMetaDescriptor;
23
+ export declare function toRemixLinks(metaTags: null | SeoOrFaviconTag[]): RemixHtmlLinkDescriptor[];
24
+ export {};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { SeoOrFaviconTag } from './types';
3
+ export declare function renderMetaTags(data: SeoOrFaviconTag[]): JSX.Element[];
@@ -0,0 +1,2 @@
1
+ import { SeoOrFaviconTag } from "./types";
2
+ export declare function renderMetaTagsToString(data: SeoOrFaviconTag[]): string;
@@ -0,0 +1,37 @@
1
+ export interface SeoTitleTag {
2
+ tag: 'title';
3
+ content: string | null;
4
+ attributes?: null;
5
+ }
6
+ export interface RegularMetaAttributes {
7
+ name: string;
8
+ content: string;
9
+ }
10
+ export interface OgMetaAttributes {
11
+ property: string;
12
+ content: string;
13
+ }
14
+ export interface SeoMetaTag {
15
+ tag: 'meta';
16
+ content?: null;
17
+ attributes: RegularMetaAttributes | OgMetaAttributes;
18
+ }
19
+ export interface FaviconAttributes {
20
+ sizes: string;
21
+ type: string;
22
+ rel: string;
23
+ href: string;
24
+ }
25
+ export interface AppleTouchIconAttributes {
26
+ sizes: string;
27
+ rel: 'apple-touch-icon';
28
+ href: string;
29
+ }
30
+ export interface SeoLinkTag {
31
+ tag: 'link';
32
+ content?: null;
33
+ attributes: FaviconAttributes | AppleTouchIconAttributes;
34
+ }
35
+ export declare type SeoTag = SeoTitleTag | SeoMetaTag;
36
+ export declare type FaviconTag = SeoMetaTag | SeoLinkTag;
37
+ export declare type SeoOrFaviconTag = SeoTag | FaviconTag;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-datocms",
3
- "version": "1.6.7",
3
+ "version": "2.1.0",
4
4
  "types": "dist/types/index.d.ts",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",