myst-to-react 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image.d.ts.map +1 -1
- package/dist/image.js +6 -6
- package/package.json +4 -4
package/dist/image.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1D,KAAK,SAAS,GAAG,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1D,KAAK,SAAS,GAAG,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAmHrD,eAAO,MAAM,KAAK,EAAE,YAAY,CAAC,SAAS,CAczC,CAAC;AAEF,QAAA,MAAM,eAAe;;CAEpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/image.js
CHANGED
|
@@ -31,22 +31,22 @@ function alignToMargin(align) {
|
|
|
31
31
|
return {};
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
function Video({ src, urlSource, align = 'center', width, height, }) {
|
|
35
|
-
return (_jsx("video", { style: Object.assign({ width: getStyleValue(width), height: getStyleValue(height) }, alignToMargin(align)), src: src, "data-canonical-url": urlSource, autoPlay: true,
|
|
34
|
+
function Video({ id, src, urlSource, align = 'center', width, height, }) {
|
|
35
|
+
return (_jsx("video", { id: id, style: Object.assign({ width: getStyleValue(width), height: getStyleValue(height) }, alignToMargin(align)), src: src, "data-canonical-url": urlSource, autoPlay: true,
|
|
36
36
|
// For autoplay, the element needs to be muted to actually start!
|
|
37
37
|
muted: true, "webkit-playsinline": "true", playsInline: true, loop: true }));
|
|
38
38
|
}
|
|
39
|
-
function Picture({ src, srcOptimized, urlSource, align = 'center', alt, width, height, }) {
|
|
39
|
+
function Picture({ id, src, srcOptimized, urlSource, align = 'center', alt, width, height, }) {
|
|
40
40
|
if (src.endsWith('.mp4') || (urlSource === null || urlSource === void 0 ? void 0 : urlSource.endsWith('.mp4'))) {
|
|
41
|
-
return _jsx(Video, { width: width, height: height, align: align, src: src, urlSource: urlSource });
|
|
41
|
+
return (_jsx(Video, { id: id, width: width, height: height, align: align, src: src, urlSource: urlSource }));
|
|
42
42
|
}
|
|
43
|
-
const image = (_jsx("img", { style: Object.assign({ width: getStyleValue(width), height: getStyleValue(height) }, alignToMargin(align)), src: src, alt: alt, "data-canonical-url": urlSource }));
|
|
43
|
+
const image = (_jsx("img", { id: id, style: Object.assign({ width: getStyleValue(width), height: getStyleValue(height) }, alignToMargin(align)), src: src, alt: alt, "data-canonical-url": urlSource }));
|
|
44
44
|
if (!srcOptimized)
|
|
45
45
|
return image;
|
|
46
46
|
return (_jsxs("picture", { children: [_jsx("source", { srcSet: srcOptimized, type: "image/webp" }), image] }));
|
|
47
47
|
}
|
|
48
48
|
export const Image = ({ node }) => {
|
|
49
|
-
return (_jsx(Picture, { src: node.url, srcOptimized: node.urlOptimized, alt: node.alt || node.title, width: node.width || undefined, height: node.height || undefined, align: node.align,
|
|
49
|
+
return (_jsx(Picture, { id: node.html_id || node.identifier || node.key, src: node.url, srcOptimized: node.urlOptimized, alt: node.alt || node.title, width: node.width || undefined, height: node.height || undefined, align: node.align,
|
|
50
50
|
// Note that sourceUrl is for backwards compatibility
|
|
51
51
|
urlSource: node.urlSource || node.sourceUrl }));
|
|
52
52
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myst-to-react",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@heroicons/react": "^2.0.18",
|
|
24
|
-
"@myst-theme/providers": "^0.8.
|
|
24
|
+
"@myst-theme/providers": "^0.8.2",
|
|
25
25
|
"@radix-ui/react-hover-card": "^1.0.6",
|
|
26
26
|
"buffer": "^6.0.3",
|
|
27
27
|
"classnames": "^2.3.2",
|
|
28
|
-
"myst-common": "^1.1.
|
|
29
|
-
"myst-config": "^1.1.
|
|
28
|
+
"myst-common": "^1.1.35",
|
|
29
|
+
"myst-config": "^1.1.35",
|
|
30
30
|
"myst-spec": "^0.0.5",
|
|
31
31
|
"nanoid": "^4.0.2",
|
|
32
32
|
"react-syntax-highlighter": "^15.5.0",
|