@canopycanopycanopy/b-ber-grammar-iframe 3.0.6 → 3.0.7-canary.9
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/helpers.js +33 -32
- package/package.json +7 -7
package/dist/helpers.js
CHANGED
|
@@ -16,13 +16,19 @@ exports.createIframe = createIframe;
|
|
|
16
16
|
exports.createIframeInline = createIframeInline;
|
|
17
17
|
exports.prepare = prepare;
|
|
18
18
|
exports.supported = supported;
|
|
19
|
+
var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
|
|
20
|
+
var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
|
|
21
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
22
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
|
19
23
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
20
24
|
var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State"));
|
|
21
25
|
var _bBerLib = require("@canopycanopycanopy/b-ber-lib");
|
|
22
26
|
var _utils = require("@canopycanopycanopy/b-ber-lib/utils");
|
|
23
27
|
var _bBerGrammarAttributes = require("@canopycanopycanopy/b-ber-grammar-attributes");
|
|
28
|
+
var _bBerShapesDirectives = require("@canopycanopycanopy/b-ber-shapes-directives");
|
|
29
|
+
const _excluded = ["id", "commentStart", "commentEnd", "mediaType", "attrString", "source", "caption"];
|
|
24
30
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
26
32
|
function supported(build) {
|
|
27
33
|
return build === 'reader' || build === 'web';
|
|
28
34
|
}
|
|
@@ -52,7 +58,7 @@ function prepare({
|
|
|
52
58
|
(0, _utils.ensureSource)(attrsObject, type, fileName, lineNumber);
|
|
53
59
|
(0, _utils.ensurePoster)(attrsObject, type);
|
|
54
60
|
(0, _utils.ensureSupportedClassNames)(attrsObject, supported);
|
|
55
|
-
return {
|
|
61
|
+
return _objectSpread(_objectSpread({}, attrsObject), {}, {
|
|
56
62
|
id: figureId,
|
|
57
63
|
attrString: (0, _bBerGrammarAttributes.attributesString)(attrsObject, {
|
|
58
64
|
classes: true
|
|
@@ -68,11 +74,8 @@ function prepare({
|
|
|
68
74
|
mime: null,
|
|
69
75
|
pageOrder: _State.default.figures.length,
|
|
70
76
|
source: _bBerLib.Url.ensureDecoded(attrsObject.source),
|
|
71
|
-
poster: attrsObject.poster
|
|
72
|
-
|
|
73
|
-
height: attrsObject.height,
|
|
74
|
-
title: attrsObject.title
|
|
75
|
-
};
|
|
77
|
+
poster: attrsObject.poster
|
|
78
|
+
});
|
|
76
79
|
}
|
|
77
80
|
function createIframe({
|
|
78
81
|
id,
|
|
@@ -88,34 +91,32 @@ function createIframe({
|
|
|
88
91
|
</figure>
|
|
89
92
|
</div>`;
|
|
90
93
|
}
|
|
91
|
-
function createIframeInline({
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
94
|
+
function createIframeInline(data) {
|
|
95
|
+
var _context;
|
|
96
|
+
const {
|
|
97
|
+
id,
|
|
98
|
+
commentStart,
|
|
99
|
+
commentEnd,
|
|
100
|
+
mediaType,
|
|
101
|
+
attrString: containerAttrsString,
|
|
102
|
+
source,
|
|
103
|
+
caption
|
|
104
|
+
} = data,
|
|
105
|
+
rest = (0, _objectWithoutProperties2.default)(data, _excluded);
|
|
106
|
+
const defaults = {
|
|
107
|
+
allow: 'fullscreen autoplay',
|
|
108
|
+
frameborder: '0'
|
|
109
|
+
};
|
|
110
|
+
const iframeAttrs = (0, _reduce.default)(_context = (0, _entries.default)(_objectSpread(_objectSpread({}, defaults), rest))).call(_context, (acc, [key, val]) => {
|
|
111
|
+
if (!_bBerShapesDirectives.htmlIframeAttributes.has(key) || val === '') return acc;
|
|
112
|
+
return (0, _concat.default)(acc).call(acc, `${key}="${val}"`);
|
|
113
|
+
}, []);
|
|
114
|
+
const iframeAttrsString = iframeAttrs.join(' ');
|
|
103
115
|
return `
|
|
104
116
|
${commentStart}
|
|
105
117
|
<section class="${mediaType} figure__large figure__inline">
|
|
106
|
-
<div id="${id}"${
|
|
107
|
-
<iframe
|
|
108
|
-
src="${source}"
|
|
109
|
-
title="${title}"
|
|
110
|
-
width="${width}"
|
|
111
|
-
height="${height}"
|
|
112
|
-
webkitallowfullscreen="webkitallowfullscreen"
|
|
113
|
-
mozallowfullscreen="mozallowfullscreen"
|
|
114
|
-
allowfullscreen="allowfullscreen"
|
|
115
|
-
allow="autoplay"
|
|
116
|
-
frameborder="0"
|
|
117
|
-
scrolling="no"
|
|
118
|
-
>
|
|
118
|
+
<div id="${id}"${containerAttrsString}>
|
|
119
|
+
<iframe src="${source}" ${iframeAttrsString}>
|
|
119
120
|
</iframe>
|
|
120
121
|
</div>
|
|
121
122
|
${(0, _utils.renderCaption)(caption, mediaType)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopycanopycanopy/b-ber-grammar-iframe",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7-canary.9+327cd6d2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"rimraf": "^2.7.1"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@canopycanopycanopy/b-ber-grammar-attributes": "3.0.
|
|
29
|
-
"@canopycanopycanopy/b-ber-lib": "3.0.
|
|
30
|
-
"@canopycanopycanopy/b-ber-logger": "3.0.
|
|
31
|
-
"@canopycanopycanopy/b-ber-parser-figure": "3.0.
|
|
32
|
-
"@canopycanopycanopy/b-ber-shapes-directives": "3.0.
|
|
28
|
+
"@canopycanopycanopy/b-ber-grammar-attributes": "3.0.7-canary.9+327cd6d2",
|
|
29
|
+
"@canopycanopycanopy/b-ber-lib": "3.0.7-canary.9+327cd6d2",
|
|
30
|
+
"@canopycanopycanopy/b-ber-logger": "3.0.7-canary.9+327cd6d2",
|
|
31
|
+
"@canopycanopycanopy/b-ber-parser-figure": "3.0.7-canary.9+327cd6d2",
|
|
32
|
+
"@canopycanopycanopy/b-ber-shapes-directives": "3.0.7-canary.9+327cd6d2",
|
|
33
33
|
"fs-extra": "^8.1.0",
|
|
34
34
|
"lodash": "^4.17.21",
|
|
35
35
|
"lodash.isundefined": "^3.0.1",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"url": "https://maxwellsimmer.com"
|
|
53
53
|
}
|
|
54
54
|
],
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "327cd6d23093ed174f7cced283d3c670e000c183"
|
|
56
56
|
}
|