myst-to-react 0.1.25 → 0.1.27
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/cjs/heading.js +1 -1
- package/dist/cjs/iframe.d.ts.map +1 -1
- package/dist/cjs/iframe.js +24 -1
- package/dist/types/iframe.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/cjs/heading.js
CHANGED
|
@@ -11,7 +11,7 @@ const classnames_1 = __importDefault(require("classnames"));
|
|
|
11
11
|
function getHelpHashText(kind) {
|
|
12
12
|
return `Link to this ${kind}`;
|
|
13
13
|
}
|
|
14
|
-
function HashLink({ id, kind, align = 'inline', children = '
|
|
14
|
+
function HashLink({ id, kind, align = 'inline', children = '¶', hover, className = 'font-normal', }) {
|
|
15
15
|
const { inCrossRef } = (0, providers_1.useXRefState)();
|
|
16
16
|
// If we are in a cross-reference popout, hide the hash links
|
|
17
17
|
if (inCrossRef)
|
package/dist/cjs/iframe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe.d.ts","sourceRoot":"","sources":["../../src/iframe.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"iframe.d.ts","sourceRoot":"","sources":["../../src/iframe.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAuB1D,eAAO,MAAM,MAAM,EAAE,YAkCpB,CAAC;AAEF,QAAA,MAAM,gBAAgB;;CAErB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/dist/cjs/iframe.js
CHANGED
|
@@ -2,12 +2,35 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IFrame = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/** This is duplicated in image, but a bit different logic */
|
|
6
|
+
function getStyleValue(width) {
|
|
7
|
+
if (typeof width === 'number' && Number.isNaN(width)) {
|
|
8
|
+
// If it is nan, return undefined.
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
if (typeof width === 'string') {
|
|
12
|
+
if (width.endsWith('%')) {
|
|
13
|
+
return getStyleValue(Number(width.replace('%', '')));
|
|
14
|
+
}
|
|
15
|
+
else if (width.endsWith('px')) {
|
|
16
|
+
const px = getStyleValue(Number(width.replace('px', '')));
|
|
17
|
+
return px ? px / 750 : 70;
|
|
18
|
+
}
|
|
19
|
+
else if (!Number.isNaN(Number(width))) {
|
|
20
|
+
return Number(width);
|
|
21
|
+
}
|
|
22
|
+
console.log(`Unknown width ${width} in getImageWidth`);
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return width;
|
|
26
|
+
}
|
|
5
27
|
const IFrame = (node) => {
|
|
28
|
+
const width = getStyleValue(node.width) || 70;
|
|
6
29
|
return ((0, jsx_runtime_1.jsx)("figure", Object.assign({ id: node.label || undefined, style: { textAlign: node.align || 'center' } }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ style: {
|
|
7
30
|
position: 'relative',
|
|
8
31
|
display: 'inline-block',
|
|
9
32
|
paddingBottom: '60%',
|
|
10
|
-
width: `min(max(${
|
|
33
|
+
width: `min(max(${width}%, 500px), 100%)`,
|
|
11
34
|
} }, { children: (0, jsx_runtime_1.jsx)("iframe", { width: "100%", height: "100%", src: node.src, allowFullScreen: true, allow: "autoplay", style: {
|
|
12
35
|
width: '100%',
|
|
13
36
|
height: '100%',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe.d.ts","sourceRoot":"","sources":["../../src/iframe.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"iframe.d.ts","sourceRoot":"","sources":["../../src/iframe.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAuB1D,eAAO,MAAM,MAAM,EAAE,YAkCpB,CAAC;AAEF,QAAA,MAAM,gBAAgB;;CAErB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myst-to-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"types": "dist/types/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"build": "npm-run-all -l clean -p build:cjs build:types"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@myst-theme/providers": "^0.1.
|
|
20
|
+
"@myst-theme/providers": "^0.1.27",
|
|
21
21
|
"@headlessui/react": "^1.7.7",
|
|
22
22
|
"@heroicons/react": "^2.0.13",
|
|
23
23
|
"@popperjs/core": "^2.11.6",
|
|
24
24
|
"buffer": "^6.0.3",
|
|
25
25
|
"classnames": "^2.3.2",
|
|
26
26
|
"myst-common": "^0.0.14",
|
|
27
|
-
"myst-config": "^0.0.
|
|
27
|
+
"myst-config": "^0.0.10",
|
|
28
28
|
"myst-spec": "^0.0.4",
|
|
29
29
|
"nanoid": "^4.0.0",
|
|
30
30
|
"react-popper": "^2.3.0",
|