react-datocms 4.1.3 → 4.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.
- package/README.md +34 -6
- package/dist/cjs/Image/index.js +68 -74
- package/dist/cjs/Image/index.js.map +1 -1
- package/dist/cjs/Image/useInView.js +3 -14
- package/dist/cjs/Image/useInView.js.map +1 -1
- package/dist/cjs/Seo/index.js +1 -1
- package/dist/cjs/Seo/nextUtils.js +28 -49
- package/dist/cjs/Seo/nextUtils.js.map +1 -1
- package/dist/cjs/Seo/remixUtils.js +6 -18
- package/dist/cjs/Seo/remixUtils.js.map +1 -1
- package/dist/cjs/Seo/renderMetaTags.js +6 -18
- package/dist/cjs/Seo/renderMetaTags.js.map +1 -1
- package/dist/cjs/Seo/renderMetaTagsToString.js +7 -7
- package/dist/cjs/Seo/renderMetaTagsToString.js.map +1 -1
- package/dist/cjs/Seo/types.js +31 -51
- package/dist/cjs/Seo/types.js.map +1 -1
- package/dist/cjs/StructuredText/index.js +40 -52
- package/dist/cjs/StructuredText/index.js.map +1 -1
- package/dist/cjs/VideoPlayer/index.js +67 -0
- package/dist/cjs/VideoPlayer/index.js.map +1 -0
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/useQuerySubscription/index.js +25 -70
- package/dist/cjs/useQuerySubscription/index.js.map +1 -1
- package/dist/cjs/useSiteSearch/index.js +71 -123
- package/dist/cjs/useSiteSearch/index.js.map +1 -1
- package/dist/cjs/useVideoPlayer/index.js +31 -0
- package/dist/cjs/useVideoPlayer/index.js.map +1 -0
- package/dist/esm/Image/index.js +62 -68
- package/dist/esm/Image/index.js.map +1 -1
- package/dist/esm/Seo/nextUtils.js +26 -47
- package/dist/esm/Seo/nextUtils.js.map +1 -1
- package/dist/esm/Seo/remixUtils.js +5 -17
- package/dist/esm/Seo/remixUtils.js.map +1 -1
- package/dist/esm/Seo/renderMetaTags.js +4 -16
- package/dist/esm/Seo/renderMetaTags.js.map +1 -1
- package/dist/esm/Seo/renderMetaTagsToString.js +6 -6
- package/dist/esm/Seo/renderMetaTagsToString.js.map +1 -1
- package/dist/esm/Seo/types.js +30 -50
- package/dist/esm/Seo/types.js.map +1 -1
- package/dist/esm/StructuredText/index.js +33 -45
- package/dist/esm/StructuredText/index.js.map +1 -1
- package/dist/esm/VideoPlayer/index.js +38 -0
- package/dist/esm/VideoPlayer/index.js.map +1 -0
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/useQuerySubscription/index.js +22 -67
- package/dist/esm/useQuerySubscription/index.js.map +1 -1
- package/dist/esm/useSiteSearch/index.js +65 -117
- package/dist/esm/useSiteSearch/index.js.map +1 -1
- package/dist/esm/useVideoPlayer/index.js +27 -0
- package/dist/esm/useVideoPlayer/index.js.map +1 -0
- package/dist/types/Seo/nextUtils.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 +2 -2
- package/dist/types/VideoPlayer/index.d.ts +26 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/useVideoPlayer/index.d.ts +17 -0
- package/package.json +44 -49
- package/src/Image/__tests__/__snapshots__/index.test.tsx.snap +91 -91
- package/src/Image/__tests__/index.test.tsx +2 -2
- package/src/Image/index.tsx +11 -9
- package/src/Seo/__tests__/__snapshots__/index.test.tsx.snap +53 -53
- package/src/Seo/__tests__/index.test.tsx +1 -1
- package/src/Seo/nextUtils.ts +1 -1
- package/src/Seo/remixUtils.ts +1 -1
- package/src/Seo/renderMetaTags.tsx +1 -1
- package/src/Seo/renderMetaTagsToString.tsx +1 -1
- package/src/StructuredText/__tests__/__snapshots__/index.test.tsx.snap +58 -58
- package/src/StructuredText/__tests__/index.test.tsx +5 -5
- package/src/StructuredText/index.tsx +10 -10
- package/src/VideoPlayer/index.tsx +107 -0
- package/src/{setupTests.ts → __tests__/setup.ts} +4 -1
- package/src/index.ts +4 -1
- package/src/useQuerySubscription/index.ts +6 -6
- package/src/useVideoPlayer/__tests__/index.test.tsx +98 -0
- package/src/useVideoPlayer/index.ts +68 -0
- package/dist/cjs/Image/__tests__/index.test.js +0 -99
- package/dist/cjs/Image/__tests__/index.test.js.map +0 -1
- package/dist/cjs/Seo/__tests__/index.test.js +0 -330
- package/dist/cjs/Seo/__tests__/index.test.js.map +0 -1
- package/dist/cjs/StructuredText/__tests__/index.test.js +0 -243
- package/dist/cjs/StructuredText/__tests__/index.test.js.map +0 -1
- package/dist/cjs/setupTests.js +0 -11
- package/dist/cjs/setupTests.js.map +0 -1
- package/dist/esm/Image/__tests__/index.test.d.ts +0 -1
- package/dist/esm/Image/__tests__/index.test.js +0 -74
- package/dist/esm/Image/__tests__/index.test.js.map +0 -1
- package/dist/esm/Image/index.d.ts +0 -93
- package/dist/esm/Image/useInView.d.ts +0 -1
- package/dist/esm/Seo/__tests__/index.test.d.ts +0 -1
- package/dist/esm/Seo/__tests__/index.test.js +0 -305
- package/dist/esm/Seo/__tests__/index.test.js.map +0 -1
- package/dist/esm/Seo/index.d.ts +0 -5
- package/dist/esm/Seo/nextUtils.d.ts +0 -48
- package/dist/esm/Seo/remixUtils.d.ts +0 -6
- package/dist/esm/Seo/renderMetaTags.d.ts +0 -3
- package/dist/esm/Seo/renderMetaTagsToString.d.ts +0 -2
- package/dist/esm/Seo/types.d.ts +0 -55
- package/dist/esm/StructuredText/__tests__/index.test.d.ts +0 -1
- package/dist/esm/StructuredText/__tests__/index.test.js +0 -218
- package/dist/esm/StructuredText/__tests__/index.test.js.map +0 -1
- package/dist/esm/StructuredText/index.d.ts +0 -52
- package/dist/esm/index.d.ts +0 -5
- package/dist/esm/setupTests.d.ts +0 -1
- package/dist/esm/setupTests.js +0 -6
- package/dist/esm/setupTests.js.map +0 -1
- package/dist/esm/useQuerySubscription/index.d.ts +0 -20
- package/dist/esm/useSiteSearch/index.d.ts +0 -83
- package/dist/types/Image/__tests__/index.test.d.ts +0 -1
- package/dist/types/Seo/__tests__/index.test.d.ts +0 -1
- package/dist/types/StructuredText/__tests__/index.test.d.ts +0 -1
- package/dist/types/setupTests.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
<!--datocms-autoinclude-header start-->
|
|
2
|
+
<a href="https://www.datocms.com/"><img src="https://www.datocms.com/images/full_logo.svg" height="60"></a>
|
|
3
|
+
|
|
4
|
+
👉 [Visit the DatoCMS homepage](https://www.datocms.com) or see [What is DatoCMS?](#what-is-datocms)
|
|
5
|
+
<!--datocms-autoinclude-header end-->
|
|
6
|
+
|
|
1
7
|
# react-datocms
|
|
2
8
|
|
|
3
9
|
  [](https://travis-ci.org/datocms/react-datocms)
|
|
4
10
|
|
|
5
11
|
A set of components and utilities to work faster with [DatoCMS](https://www.datocms.com/) in React environments. Integrates seamlessy with DatoCMS's [GraphQL Content Delivery API](https://www.datocms.com/docs/content-delivery-api) and [Real-time Updates API](https://www.datocms.com/docs/real-time-updates-api).
|
|
6
12
|
|
|
7
|
-
<br /><br />
|
|
8
|
-
<a href="https://www.datocms.com/">
|
|
9
|
-
<img src="https://www.datocms.com/images/full_logo.svg" height="60">
|
|
10
|
-
</a>
|
|
11
|
-
<br /><br />
|
|
12
|
-
|
|
13
13
|
# Installation
|
|
14
14
|
|
|
15
15
|
```
|
|
@@ -22,6 +22,7 @@ This package offers different components and hooks. Please refer to one of the f
|
|
|
22
22
|
|
|
23
23
|
* [`<Image />` component for responsive/progressive images](./docs/image.md)
|
|
24
24
|
* [`<StructuredText />` component](./docs/structured-text.md)
|
|
25
|
+
* [`<VideoPlayer />` component](./docs/video-player.md)
|
|
25
26
|
* [`useQuerySubscription()` hook for live, real-time updates of content](./docs/live-real-time-updates.md)
|
|
26
27
|
* [`useSiteSearch()` hook to render a DatoCMS Site Search form widget](./docs/site-search.md)
|
|
27
28
|
* [`renderMetaTags()` and other helpers to render social share, SEO and Favicon meta tags](./docs/meta-tags.md)
|
|
@@ -50,3 +51,30 @@ npm run watch
|
|
|
50
51
|
```
|
|
51
52
|
|
|
52
53
|
This will re-compile the package everytime you make a change, and the example project will pick those changes instantly.
|
|
54
|
+
|
|
55
|
+
<!--datocms-autoinclude-footer start-->
|
|
56
|
+
-----------------
|
|
57
|
+
# What is DatoCMS?
|
|
58
|
+
<a href="https://www.datocms.com/"><img src="https://www.datocms.com/images/full_logo.svg" height="60"></a>
|
|
59
|
+
|
|
60
|
+
[DatoCMS](https://www.datocms.com/) is the REST & GraphQL Headless CMS for the modern web.
|
|
61
|
+
|
|
62
|
+
Trusted by over 25,000 enterprise businesses, agency partners, and individuals across the world, DatoCMS users create online content at scale from a central hub and distribute it via API. We ❤️ our [developers](https://www.datocms.com/team/best-cms-for-developers), [content editors](https://www.datocms.com/team/content-creators) and [marketers](https://www.datocms.com/team/cms-digital-marketing)!
|
|
63
|
+
|
|
64
|
+
**Quick links:**
|
|
65
|
+
|
|
66
|
+
- ⚡️ Get started with a [free DatoCMS account](https://dashboard.datocms.com/signup)
|
|
67
|
+
- 🔖 Go through the [docs](https://www.datocms.com/docs)
|
|
68
|
+
- ⚙️ Get [support from us and the community](https://community.datocms.com/)
|
|
69
|
+
- 🆕 Stay up to date on new features and fixes on the [changelog](https://www.datocms.com/product-updates)
|
|
70
|
+
|
|
71
|
+
**Our featured repos:**
|
|
72
|
+
- [datocms/react-datocms](https://github.com/datocms/react-datocms): React helper components for images, Structured Text rendering, and more
|
|
73
|
+
- [datocms/js-rest-api-clients](https://github.com/datocms/js-rest-api-clients): Node and browser JavaScript clients for updating and administering your content. For frontend fetches, we recommend using our [GraphQL Content Delivery API](https://www.datocms.com/docs/content-delivery-api) instead.
|
|
74
|
+
- [datocms/cli](https://github.com/datocms/cli): Command-line interface that includes our [Contentful importer](https://github.com/datocms/cli/tree/main/packages/cli-plugin-contentful) and [Wordpress importer](https://github.com/datocms/cli/tree/main/packages/cli-plugin-wordpress)
|
|
75
|
+
- [datocms/plugins](https://github.com/datocms/plugins): Example plugins we've made that extend the editor/admin dashboard
|
|
76
|
+
- [datocms/gatsby-source-datocms](https://github.com/datocms/gatsby-source-datocms): Our Gatsby source plugin to pull data from DatoCMS
|
|
77
|
+
- Frontend examples in different frameworks: [Next.js](https://github.com/datocms/nextjs-demo), [Vue](https://github.com/datocms/vue-datocms) and [Nuxt](https://github.com/datocms/nuxtjs-demo), [Svelte](https://github.com/datocms/datocms-svelte) and [SvelteKit](https://github.com/datocms/sveltekit-demo), [Astro](https://github.com/datocms/datocms-astro-blog-demo), [Remix](https://github.com/datocms/remix-example). See [all our starter templates](https://www.datocms.com/marketplace/starters).
|
|
78
|
+
|
|
79
|
+
Or see [all our public repos](https://github.com/orgs/datocms/repositories?q=&type=public&language=&sort=stargazers)
|
|
80
|
+
<!--datocms-autoinclude-footer end-->
|
package/dist/cjs/Image/index.js
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
"use strict";
|
|
3
|
-
|
|
4
|
-
__assign = Object.assign || function(t) {
|
|
5
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
-
s = arguments[i];
|
|
7
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
-
t[p] = s[p];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
return __assign.apply(this, arguments);
|
|
13
|
-
};
|
|
2
|
+
'use client';
|
|
14
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
4
|
if (k2 === undefined) k2 = k;
|
|
16
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -34,31 +23,30 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
34
23
|
__setModuleDefault(result, mod);
|
|
35
24
|
return result;
|
|
36
25
|
};
|
|
37
|
-
exports
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
27
|
exports.Image = void 0;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
const universal_base64_1 = require("universal-base64");
|
|
30
|
+
const useInView_js_1 = require("./useInView.js");
|
|
31
|
+
const isSsr = typeof window === 'undefined';
|
|
32
|
+
const isIntersectionObserverAvailable = isSsr
|
|
44
33
|
? false
|
|
45
34
|
: !!window.IntersectionObserver;
|
|
46
35
|
function fetchPriorityProp(fetchPriority) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
const [majorStr, minorStr] = react_1.version.split('.');
|
|
37
|
+
const major = parseInt(majorStr, 10);
|
|
38
|
+
const minor = parseInt(minorStr, 10);
|
|
50
39
|
if (major > 18 || (major === 18 && minor >= 3)) {
|
|
51
40
|
// In React 18.3.0 or newer, we must use camelCase
|
|
52
41
|
// prop to avoid "Warning: Invalid DOM property".
|
|
53
42
|
// See https://github.com/facebook/react/pull/25927
|
|
54
|
-
return { fetchPriority
|
|
43
|
+
return { fetchPriority };
|
|
55
44
|
}
|
|
56
45
|
// In React 18.2.0 or older, we must use lowercase prop
|
|
57
46
|
// to avoid "Warning: Invalid DOM property".
|
|
58
47
|
return { fetchpriority: fetchPriority };
|
|
59
48
|
}
|
|
60
|
-
|
|
61
|
-
var lazyLoad = _a.lazyLoad, inView = _a.inView, loaded = _a.loaded;
|
|
49
|
+
const imageAddStrategy = ({ lazyLoad, inView, loaded }) => {
|
|
62
50
|
if (!lazyLoad) {
|
|
63
51
|
return true;
|
|
64
52
|
}
|
|
@@ -70,8 +58,7 @@ var imageAddStrategy = function (_a) {
|
|
|
70
58
|
}
|
|
71
59
|
return true;
|
|
72
60
|
};
|
|
73
|
-
|
|
74
|
-
var lazyLoad = _a.lazyLoad, loaded = _a.loaded;
|
|
61
|
+
const imageShowStrategy = ({ lazyLoad, loaded }) => {
|
|
75
62
|
if (!lazyLoad) {
|
|
76
63
|
return true;
|
|
77
64
|
}
|
|
@@ -83,46 +70,45 @@ var imageShowStrategy = function (_a) {
|
|
|
83
70
|
}
|
|
84
71
|
return true;
|
|
85
72
|
};
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
const bogusBaseUrl = 'https://example.com/';
|
|
74
|
+
const buildSrcSet = (src, width, candidateMultipliers) => {
|
|
88
75
|
if (!(src && width)) {
|
|
89
76
|
return undefined;
|
|
90
77
|
}
|
|
91
78
|
return candidateMultipliers
|
|
92
|
-
.map(
|
|
93
|
-
|
|
79
|
+
.map((multiplier) => {
|
|
80
|
+
const url = new URL(src, bogusBaseUrl);
|
|
94
81
|
if (multiplier !== 1) {
|
|
95
|
-
url.searchParams.set('dpr',
|
|
96
|
-
|
|
97
|
-
|
|
82
|
+
url.searchParams.set('dpr', `${multiplier}`);
|
|
83
|
+
const maxH = url.searchParams.get('max-h');
|
|
84
|
+
const maxW = url.searchParams.get('max-w');
|
|
98
85
|
if (maxH) {
|
|
99
|
-
url.searchParams.set('max-h',
|
|
86
|
+
url.searchParams.set('max-h', `${Math.floor(parseInt(maxH) * multiplier)}`);
|
|
100
87
|
}
|
|
101
88
|
if (maxW) {
|
|
102
|
-
url.searchParams.set('max-w',
|
|
89
|
+
url.searchParams.set('max-w', `${Math.floor(parseInt(maxW) * multiplier)}`);
|
|
103
90
|
}
|
|
104
91
|
}
|
|
105
|
-
|
|
92
|
+
const finalWidth = Math.floor(width * multiplier);
|
|
106
93
|
if (finalWidth < 50) {
|
|
107
94
|
return null;
|
|
108
95
|
}
|
|
109
|
-
return
|
|
96
|
+
return `${url.toString().replace(bogusBaseUrl, '/')} ${finalWidth}w`;
|
|
110
97
|
})
|
|
111
98
|
.filter(Boolean)
|
|
112
99
|
.join(',');
|
|
113
100
|
};
|
|
114
|
-
exports.Image = (0, react_1.forwardRef)(
|
|
115
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
var handleLoad = function () {
|
|
101
|
+
exports.Image = (0, react_1.forwardRef)(({ className, fadeInDuration = 500, intersectionTreshold, intersectionThreshold, intersectionMargin, pictureClassName, lazyLoad: rawLazyLoad = true, style, pictureStyle, layout = 'intrinsic', objectFit, objectPosition, data, onLoad, usePlaceholder = true, priority = false, sizes, srcSetCandidates = [0.25, 0.5, 0.75, 1, 1.5, 2, 3, 4], placeholderClassName, placeholderStyle, }, ref) => {
|
|
102
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
103
|
+
const lazyLoad = priority ? false : rawLazyLoad;
|
|
104
|
+
const [loaded, setLoaded] = (0, react_1.useState)(false);
|
|
105
|
+
const imageRef = (0, react_1.useRef)(null);
|
|
106
|
+
const handleLoad = () => {
|
|
121
107
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad();
|
|
122
108
|
setLoaded(true);
|
|
123
109
|
};
|
|
124
110
|
// https://stackoverflow.com/q/39777833/266535
|
|
125
|
-
(0, react_1.useEffect)(
|
|
111
|
+
(0, react_1.useEffect)(() => {
|
|
126
112
|
if (!imageRef.current) {
|
|
127
113
|
return;
|
|
128
114
|
}
|
|
@@ -130,67 +116,75 @@ exports.Image = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
130
116
|
handleLoad();
|
|
131
117
|
}
|
|
132
118
|
}, []);
|
|
133
|
-
|
|
119
|
+
const [viewRef, inView] = (0, useInView_js_1.useInView)({
|
|
134
120
|
threshold: intersectionThreshold || intersectionTreshold || 0,
|
|
135
121
|
rootMargin: intersectionMargin || '0px 0px 0px 0px',
|
|
136
122
|
triggerOnce: true,
|
|
137
|
-
fallbackInView: true
|
|
138
|
-
})
|
|
139
|
-
|
|
123
|
+
fallbackInView: true,
|
|
124
|
+
});
|
|
125
|
+
const callbackRef = (0, react_1.useCallback)((_ref) => {
|
|
140
126
|
viewRef(_ref);
|
|
141
127
|
if (ref) {
|
|
142
128
|
ref.current = _ref;
|
|
143
129
|
}
|
|
144
130
|
}, [viewRef]);
|
|
145
|
-
|
|
131
|
+
const absolutePositioning = {
|
|
146
132
|
position: 'absolute',
|
|
147
133
|
left: 0,
|
|
148
134
|
top: 0,
|
|
149
135
|
width: '100%',
|
|
150
136
|
height: '100%',
|
|
151
137
|
maxWidth: 'none',
|
|
152
|
-
maxHeight: 'none'
|
|
138
|
+
maxHeight: 'none',
|
|
153
139
|
};
|
|
154
|
-
|
|
155
|
-
lazyLoad
|
|
156
|
-
inView
|
|
157
|
-
loaded
|
|
140
|
+
const addImage = imageAddStrategy({
|
|
141
|
+
lazyLoad,
|
|
142
|
+
inView,
|
|
143
|
+
loaded,
|
|
158
144
|
});
|
|
159
|
-
|
|
160
|
-
lazyLoad
|
|
161
|
-
inView
|
|
162
|
-
loaded
|
|
145
|
+
const showImage = imageShowStrategy({
|
|
146
|
+
lazyLoad,
|
|
147
|
+
inView,
|
|
148
|
+
loaded,
|
|
163
149
|
});
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
150
|
+
const webpSource = data.webpSrcSet && (react_1.default.createElement("source", { srcSet: data.webpSrcSet, sizes: (_a = sizes !== null && sizes !== void 0 ? sizes : data.sizes) !== null && _a !== void 0 ? _a : undefined, type: "image/webp" }));
|
|
151
|
+
const regularSource = (react_1.default.createElement("source", { srcSet: (_b = data.srcSet) !== null && _b !== void 0 ? _b : buildSrcSet(data.src, data.width, srcSetCandidates), sizes: (_c = sizes !== null && sizes !== void 0 ? sizes : data.sizes) !== null && _c !== void 0 ? _c : undefined }));
|
|
152
|
+
const transition = fadeInDuration > 0 ? `opacity ${fadeInDuration}ms` : undefined;
|
|
153
|
+
const placeholder = usePlaceholder && (data.bgColor || data.base64) ? (react_1.default.createElement("img", { "aria-hidden": "true", alt: "", src: (_d = data.base64) !== null && _d !== void 0 ? _d : undefined, className: placeholderClassName, style: Object.assign({ backgroundColor: (_e = data.bgColor) !== null && _e !== void 0 ? _e : undefined, objectFit,
|
|
154
|
+
objectPosition,
|
|
155
|
+
transition, opacity: showImage ? 0 : 1,
|
|
168
156
|
// During the opacity transition of the placeholder to the definitive version,
|
|
169
157
|
// hardware acceleration is triggered. This results in the browser trying to render the
|
|
170
158
|
// placeholder with your GPU, causing blurred edges. Solution: style the placeholder
|
|
171
159
|
// so the edges overflow the container
|
|
172
160
|
position: 'absolute', left: '-5%', top: '-5%', width: '110%', height: '110%', maxWidth: 'none', maxHeight: 'none' }, placeholderStyle) })) : null;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return (react_1
|
|
161
|
+
const { width, aspectRatio } = data;
|
|
162
|
+
const height = (_f = data.height) !== null && _f !== void 0 ? _f : (aspectRatio ? width / aspectRatio : 0);
|
|
163
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}"></svg>`;
|
|
164
|
+
const sizer = layout !== 'fill' ? (react_1.default.createElement("img", { className: pictureClassName, style: Object.assign({ display: 'block', width: '100%' }, pictureStyle), src: `data:image/svg+xml;base64,${(0, universal_base64_1.encode)(svg)}`, "aria-hidden": "true", alt: "" })) : null;
|
|
165
|
+
return (react_1.default.createElement("div", { ref: callbackRef, className: className, style: Object.assign(Object.assign({ overflow: 'hidden' }, (layout === 'fill'
|
|
178
166
|
? absolutePositioning
|
|
179
167
|
: layout === 'intrinsic'
|
|
180
168
|
? { position: 'relative', width: '100%', maxWidth: width }
|
|
181
169
|
: layout === 'fixed'
|
|
182
|
-
? { position: 'relative', width
|
|
170
|
+
? { position: 'relative', width }
|
|
183
171
|
: { position: 'relative', width: '100%' })), style) },
|
|
184
172
|
sizer,
|
|
185
173
|
placeholder,
|
|
186
|
-
addImage && (react_1
|
|
174
|
+
addImage && (react_1.default.createElement("picture", null,
|
|
187
175
|
webpSource,
|
|
188
176
|
regularSource,
|
|
189
|
-
data.src && (
|
|
190
|
-
|
|
191
|
-
react_1
|
|
177
|
+
data.src && (
|
|
178
|
+
// biome-ignore lint/a11y/useAltText: We do support the `alt` attribute
|
|
179
|
+
react_1.default.createElement("img", Object.assign({ ref: imageRef, src: data.src, alt: (_g = data.alt) !== null && _g !== void 0 ? _g : '', title: (_h = data.title) !== null && _h !== void 0 ? _h : undefined, onLoad: handleLoad }, fetchPriorityProp(priority ? 'high' : undefined), { className: pictureClassName, style: Object.assign(Object.assign(Object.assign({ opacity: showImage ? 1 : 0, transition }, absolutePositioning), { objectFit,
|
|
180
|
+
objectPosition }), pictureStyle) }))))),
|
|
181
|
+
react_1.default.createElement("noscript", null,
|
|
182
|
+
react_1.default.createElement("picture", null,
|
|
192
183
|
webpSource,
|
|
193
184
|
regularSource,
|
|
194
|
-
data.src && (
|
|
185
|
+
data.src && (
|
|
186
|
+
// biome-ignore lint/a11y/useAltText: We do support the `alt` attribute
|
|
187
|
+
react_1.default.createElement("img", Object.assign({ src: data.src, alt: (_j = data.alt) !== null && _j !== void 0 ? _j : '', title: (_k = data.title) !== null && _k !== void 0 ? _k : undefined, className: pictureClassName, style: Object.assign(Object.assign(Object.assign({}, absolutePositioning), { objectFit,
|
|
188
|
+
objectPosition }), pictureStyle), loading: lazyLoad ? 'lazy' : undefined }, fetchPriorityProp(priority ? 'high' : undefined))))))));
|
|
195
189
|
});
|
|
196
190
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Image/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Image/index.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,+CAQe;AACf,uDAA0C;AAC1C,iDAA2C;AAE3C,MAAM,KAAK,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;AAE5C,MAAM,+BAA+B,GAAG,KAAK;IAC3C,CAAC,CAAC,KAAK;IACP,CAAC,CAAC,CAAC,CAAC,MAAM,CA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EAC3B,KAAK,8CACH,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC1B,UAAU,IACP,mBAAmB,KACtB,SAAS;oBACT,cAAc,KACX,YAAY,KAEjB,CACH,CACO,CACX;QACD;YACE;gBACG,UAAU;gBACV,aAAa;gBACb,IAAI,CAAC,GAAG,IAAI;gBACX,uEAAuE;gBACvE,qDACE,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,GAAG,EAAE,MAAA,IAAI,CAAC,GAAG,mCAAI,EAAE,EACnB,KAAK,EAAE,MAAA,IAAI,CAAC,KAAK,mCAAI,SAAS,EAC9B,SAAS,EAAE,gBAAgB,EAC3B,KAAK,gDACA,mBAAmB,KACtB,SAAS;wBACT,cAAc,KACX,YAAY,GAEjB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IAClC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,EACpD,CACH,CACO,CACD,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
"use strict";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
exports.__esModule = true;
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
4
|
exports.useInView = void 0;
|
|
16
5
|
var react_intersection_observer_1 = require("react-intersection-observer");
|
|
17
|
-
|
|
6
|
+
Object.defineProperty(exports, "useInView", { enumerable: true, get: function () { return react_intersection_observer_1.useInView; } });
|
|
18
7
|
//# sourceMappingURL=useInView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInView.js","sourceRoot":"","sources":["../../../src/Image/useInView.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"useInView.js","sourceRoot":"","sources":["../../../src/Image/useInView.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAEb,2EAAwD;AAA/C,wHAAA,SAAS,OAAA"}
|
package/dist/cjs/Seo/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
exports
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./types.js"), exports);
|
|
18
18
|
__exportStar(require("./remixUtils.js"), exports);
|
|
19
19
|
__exportStar(require("./nextUtils.js"), exports);
|
|
@@ -1,94 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
-
if (ar || !(i in from)) {
|
|
16
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
-
ar[i] = from[i];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
-
};
|
|
22
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
3
|
exports.toNextMetadata = void 0;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return string.replace(/_([a-z])/g, function (_, letter) { return letter.toUpperCase(); });
|
|
27
|
-
};
|
|
4
|
+
const types_js_1 = require("./types.js");
|
|
5
|
+
const camelize = (string) => string.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
28
6
|
function toNextMetadata(data) {
|
|
29
|
-
|
|
30
|
-
data.forEach(
|
|
31
|
-
|
|
32
|
-
var tag = datum.tag, attributes = datum.attributes, content = datum.content;
|
|
7
|
+
const metadata = {};
|
|
8
|
+
data.forEach((datum) => {
|
|
9
|
+
const { tag, attributes, content } = datum;
|
|
33
10
|
if (tag === 'title') {
|
|
34
11
|
metadata['title'] = content;
|
|
35
12
|
}
|
|
36
13
|
if ((0, types_js_1.isSeoOrFaviconTag)(datum) && (0, types_js_1.isSeoMetaTag)(datum)) {
|
|
37
14
|
if ((0, types_js_1.isOgMetaAttributes)(datum.attributes)) {
|
|
38
|
-
|
|
15
|
+
const { property, content } = datum.attributes;
|
|
39
16
|
if (property.match(/^og:/)) {
|
|
40
|
-
|
|
17
|
+
const [_, ...parts] = property.split(':');
|
|
41
18
|
if ((parts === null || parts === void 0 ? void 0 : parts.length) === 1) {
|
|
42
19
|
if (parts[0] === 'image') {
|
|
43
20
|
metadata['openGraph'] || (metadata['openGraph'] = {});
|
|
44
|
-
metadata['openGraph']['images'] =
|
|
21
|
+
metadata['openGraph']['images'] = Object.assign(Object.assign({}, metadata['openGraph']['images']), { url: content });
|
|
45
22
|
}
|
|
46
23
|
else {
|
|
47
|
-
metadata['openGraph'] =
|
|
24
|
+
metadata['openGraph'] = Object.assign(Object.assign({}, metadata['openGraph']), { [camelize(parts[0])]: content });
|
|
48
25
|
}
|
|
49
26
|
}
|
|
50
27
|
if ((parts === null || parts === void 0 ? void 0 : parts.length) === 2) {
|
|
51
28
|
if (parts[0] === 'image' && parts[1] === 'width') {
|
|
52
29
|
metadata['openGraph'] || (metadata['openGraph'] = {});
|
|
53
|
-
metadata['openGraph']['images'] =
|
|
30
|
+
metadata['openGraph']['images'] = Object.assign(Object.assign({}, metadata['openGraph']['images']), { width: content });
|
|
54
31
|
}
|
|
55
32
|
else if (parts[0] === 'image' && parts[1] === 'height') {
|
|
56
33
|
metadata['openGraph'] || (metadata['openGraph'] = {});
|
|
57
|
-
metadata['openGraph']['images'] =
|
|
34
|
+
metadata['openGraph']['images'] = Object.assign(Object.assign({}, metadata['openGraph']['images']), { height: content });
|
|
58
35
|
}
|
|
59
36
|
}
|
|
60
37
|
}
|
|
61
38
|
}
|
|
62
39
|
if ((0, types_js_1.isRegularMetaAttributes)(datum.attributes)) {
|
|
63
|
-
|
|
64
|
-
if (
|
|
40
|
+
const { name, content } = datum.attributes;
|
|
41
|
+
if (name.match(/^msapplication-/)) {
|
|
65
42
|
// Ignore: already deprecated at the release of Next 13.
|
|
66
43
|
}
|
|
67
|
-
else if (
|
|
68
|
-
|
|
44
|
+
else if (name.match(/^twitter:/)) {
|
|
45
|
+
const [_, ...parts] = name.split(':');
|
|
69
46
|
if ((parts === null || parts === void 0 ? void 0 : parts.length) === 1) {
|
|
70
|
-
metadata['twitter'] =
|
|
47
|
+
metadata['twitter'] = Object.assign(Object.assign({}, metadata['twitter']), { [camelize(parts[0])]: content });
|
|
71
48
|
}
|
|
72
49
|
}
|
|
73
50
|
else {
|
|
74
|
-
metadata[
|
|
51
|
+
metadata[name] = content;
|
|
75
52
|
}
|
|
76
53
|
}
|
|
77
54
|
}
|
|
78
55
|
if ((0, types_js_1.isSeoLinkTag)(datum)) {
|
|
79
56
|
if ((0, types_js_1.isAppleTouchIconAttributes)(datum.attributes)) {
|
|
80
|
-
|
|
57
|
+
const { sizes, href } = datum.attributes;
|
|
81
58
|
metadata['icons'] || (metadata['icons'] = {});
|
|
82
|
-
metadata['icons']['apple'] =
|
|
83
|
-
|
|
84
|
-
|
|
59
|
+
metadata['icons']['apple'] = [
|
|
60
|
+
...(metadata['icons']['apple'] || []),
|
|
61
|
+
{ url: href, sizes },
|
|
62
|
+
];
|
|
85
63
|
}
|
|
86
64
|
if ((0, types_js_1.isFaviconAttributes)(datum.attributes)) {
|
|
87
|
-
|
|
65
|
+
const { sizes, type, rel, href } = datum.attributes;
|
|
88
66
|
metadata['icons'] || (metadata['icons'] = {});
|
|
89
|
-
metadata['icons']['icon'] =
|
|
90
|
-
|
|
91
|
-
|
|
67
|
+
metadata['icons']['icon'] = [
|
|
68
|
+
...(metadata['icons']['icon'] || []),
|
|
69
|
+
{ url: href, sizes, type, rel },
|
|
70
|
+
];
|
|
92
71
|
}
|
|
93
72
|
}
|
|
94
73
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextUtils.js","sourceRoot":"","sources":["../../../src/Seo/nextUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nextUtils.js","sourceRoot":"","sources":["../../../src/Seo/nextUtils.ts"],"names":[],"mappings":";;;AAAA,yCAUoB;AAwDpB,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAE,EAAE,CAClC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AAEnE,SAAgB,cAAc,CAC5B,IAA4C;IAE5C,MAAM,QAAQ,GAAwB,EAAE,CAAC;IAEzC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,KAAK,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strict";
|
|
2
|
-
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.toRemixMeta = void 0;
|
|
15
4
|
function toRemixMeta(metaTags) {
|
|
16
5
|
if (!metaTags) {
|
|
17
6
|
return {};
|
|
18
7
|
}
|
|
19
|
-
return metaTags.reduce(
|
|
20
|
-
var _a;
|
|
8
|
+
return metaTags.reduce((acc, tag) => {
|
|
21
9
|
if (tag.tag === 'title') {
|
|
22
|
-
return tag.content ?
|
|
10
|
+
return tag.content ? Object.assign(Object.assign({}, acc), { title: tag.content }) : acc;
|
|
23
11
|
}
|
|
24
12
|
if (tag.tag === 'link') {
|
|
25
13
|
return acc;
|
|
@@ -27,9 +15,9 @@ function toRemixMeta(metaTags) {
|
|
|
27
15
|
if (!tag.attributes) {
|
|
28
16
|
return acc;
|
|
29
17
|
}
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
return Object.assign(Object.assign({}, acc), { ['property' in tag.attributes
|
|
19
|
+
? tag.attributes.property
|
|
20
|
+
: tag.attributes.name]: tag.attributes.content });
|
|
33
21
|
}, {});
|
|
34
22
|
}
|
|
35
23
|
exports.toRemixMeta = toRemixMeta;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remixUtils.js","sourceRoot":"","sources":["../../../src/Seo/remixUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remixUtils.js","sourceRoot":"","sources":["../../../src/Seo/remixUtils.ts"],"names":[],"mappings":";;;AAMA,SAAgB,WAAW,CACzB,QAAuD;IAEvD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAQ,QAA+B,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC1D,IAAI,GAAG,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;YACxB,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,iCAAM,GAAG,KAAE,KAAK,EAAE,GAAG,CAAC,OAAO,IAAG,CAAC,CAAC,GAAG,CAAC;QAC5D,CAAC;QAED,IAAI,GAAG,CAAC,GAAG,KAAK,MAAM,EAAE,CAAC;YACvB,OAAO,GAAG,CAAC;QACb,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;YACpB,OAAO,GAAG,CAAC;QACb,CAAC;QAED,uCACK,GAAG,KACN,CAAC,UAAU,IAAI,GAAG,CAAC,UAAU;gBAC3B,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ;gBACzB,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,IAChD;IACJ,CAAC,EAAE,EAA6B,CAAC,CAAC;AACpC,CAAC;AA3BD,kCA2BC"}
|