@krakenjs/jsx-pragmatic
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -5,2 +5,4 @@ # Changelog | ||
### [3.1.1](https://github.com/krakenjs/jsx-pragmatic/compare/v3.1.0...v3.1.1) (2024-10-03) | ||
## [3.1.0](https://github.com/krakenjs/jsx-pragmatic/compare/v3.0.0...v3.1.0) (2024-09-23) | ||
@@ -7,0 +9,0 @@ |
@@ -197,3 +197,2 @@ !function(root, factory) { | ||
}))); | ||
"iframe" !== el.tagName.toLowerCase() || props.srcdoc || props.src || el.setAttribute("srcdoc", ""); | ||
} | ||
@@ -200,0 +199,0 @@ var ADD_CHILDREN = ((_ADD_CHILDREN = {}).iframe = function(el, node) { |
@@ -275,3 +275,2 @@ !function(root, factory) { | ||
}))); | ||
"iframe" !== el.tagName.toLowerCase() || props.srcdoc || props.src || el.setAttribute("srcdoc", ""); | ||
} | ||
@@ -278,0 +277,0 @@ var ADD_CHILDREN = ((_ADD_CHILDREN = {}).iframe = function(el, node) { |
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("pragmatic",[],r):"object"==typeof exports?exports.pragmatic=r():e.pragmatic=r()}("undefined"!=typeof self?self:this,(function(){return function(e){var r={};function n(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)n.d(t,o,function(r){return e[r]}.bind(null,o));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return{}.hasOwnProperty.call(e,r)},n.p="",n(n.s=0)}([function(e,r,n){"use strict";n.r(r),n.d(r,"ElementNode",(function(){return i})),n.d(r,"FragmentNode",(function(){return u})),n.d(r,"TextNode",(function(){return c})),n.d(r,"ComponentNode",(function(){return a})),n.d(r,"node",(function(){return s})),n.d(r,"Fragment",(function(){return h})),n.d(r,"text",(function(){return y})),n.d(r,"dom",(function(){return M})),n.d(r,"react",(function(){return L})),n.d(r,"html",(function(){return j})),n.d(r,"preact",(function(){return A})),n.d(r,"regex",(function(){return H})),n.d(r,"NODE_TYPE",(function(){return t})),n.d(r,"Style",(function(){return S})),n.d(r,"Regex",(function(){return U})),n.d(r,"RegexText",(function(){return G})),n.d(r,"RegexWord",(function(){return k})),n.d(r,"RegexCharacters",(function(){return F})),n.d(r,"RegexGroup",(function(){return W})),n.d(r,"RegexUnion",(function(){return $}));var t={ELEMENT:"element",TEXT:"text",COMPONENT:"component",FRAGMENT:"fragment"};function o(e,r){for(var n=[],t=0;t<e.length;t++){var o=e[t].render(r);if(o)if(Array.isArray(o))for(var i=0;i<o.length;i++){var u=o[i];u&&n.push(u)}else n.push(o)}return n}var i=function(){function e(e,r,n){this.type=t.ELEMENT,this.name=void 0,this.props=void 0,this.children=void 0,this.onRender=void 0,this.name=e,this.props=r||{},this.children=n;var o=this.props.onRender;"function"==typeof o&&(this.onRender=o,delete r.onRender)}var r=e.prototype;return r.render=function(e){var r=e(this);return this.onRender&&this.onRender(r),r},r.renderChildren=function(e){return o(this.children,e)},e}(),u=function(){function e(e){this.type=t.FRAGMENT,this.children=void 0,this.children=e}return e.prototype.render=function(e){return o(this.children,e)},e}(),c=function(){function e(e){this.type=t.TEXT,this.text=void 0,this.text=e}return e.prototype.render=function(e){return e(this)},e}(),a=function(){function e(e,r,n){this.type=t.COMPONENT,this.component=void 0,this.props=void 0,this.children=void 0,this.component=e,this.props=r||{},this.children=n,this.props.children=n}var r=e.prototype;return r.renderComponent=function(e){var r=function(e){var r=p(Array.isArray(e)?e:[e]);return 1===r.length?r[0]:r.length>1?new u(r):void 0}(this.component(this.props,this.children));if(r)return r.render(e)},r.render=function(e){return e(this)},r.renderChildren=function(e){return o(this.children,e)},e}();function p(e){for(var r=[],n=0;n<e.length;n++){var o=e[n];if(o)if("string"==typeof o||"number"==typeof o)r.push(new c(o.toString()));else{if("boolean"==typeof o)continue;if(Array.isArray(o))for(var i=0,u=p(o);i<u.length;i++)r.push(u[i]);else{if(!o||o.type!==t.ELEMENT&&o.type!==t.TEXT&&o.type!==t.COMPONENT)throw new TypeError("Unrecognized node type: "+typeof o);r.push(o)}}}return r}var f,d,l,s=function(e,r){for(var n=arguments.length,t=new Array(n>2?n-2:0),o=2;o<n;o++)t[o-2]=arguments[o];if(t=p(t),"string"==typeof e)return new i(e,r,t);if("function"==typeof e)return new a(e,r,t);throw new TypeError("Expected jsx element to be a string or a function")},h=function(e,r){return r};function y(){var e=function(r){if(r.type===t.COMPONENT)return[].concat(r.renderComponent(e)).join("");if(r.type===t.ELEMENT)throw new Error("Text renderer does not support basic elements");if(r.type===t.TEXT)return r.text;throw new TypeError("Unhandleable node: "+r.type)};return e}function v(e){return null!=e}var E=((f={}).svg="http://www.w3.org/2000/svg",f),m=((d={})["xlink:href"]="http://www.w3.org/1999/xlink",d);function g(e,r){return e.createTextNode(r.text)}function T(e,r){for(var n=r.props,t=0,o=Object.keys(n);t<o.length;t++){var i=o[t],u=n[i];if(null!=u&&"el"!==i&&"innerHTML"!==i)if(i.match(/^on[A-Z][a-z]/)&&"function"==typeof u)e.addEventListener(i.slice(2).toLowerCase(),u);else if("string"==typeof u||"number"==typeof u){var c=m[i];c?e.setAttributeNS(c,i,u.toString()):e.setAttribute(i,u.toString())}else"boolean"==typeof u&&!0===u&&e.setAttribute(i,"")}"iframe"!==e.tagName.toLowerCase()||n.id||e.setAttribute("id","jsx-iframe-"+"xxxxxxxxxx".replace(/./g,(function(){return"0123456789abcdef".charAt(Math.floor(Math.random()*"0123456789abcdef".length))}))),"iframe"!==e.tagName.toLowerCase()||n.srcdoc||n.src||e.setAttribute("srcdoc","")}var w=((l={}).iframe=function(e,r){var n=r.children[0];if(1!==r.children.length||!n||n.type!==t.ELEMENT||"html"!==n.name)throw new Error("Expected only single html element node as child of iframe element");e.addEventListener("load",(function(){var r=e.contentWindow;if(!r)throw new Error("Expected frame to have contentWindow");for(var t=r.document,o=t.documentElement;o.children&&o.children.length;)o.removeChild(o.children[0]);for(var i=n.render(M({doc:t}));i.children.length;)o.appendChild(i.children[0])}))},l.script=function(e,r){var n=r.children[0];if(1!==r.children.length||!n||n.type!==t.TEXT)throw new Error("Expected only single text node as child of script element");e.text=n.text},l.default=function(e,r,n){for(var t=0,o=r.renderChildren(n);t<o.length;t++)e.appendChild(o[t])},l);function x(e,r,n,t){if(r.props.hasOwnProperty("innerHTML")){if(r.children.length)throw new Error("Expected no children to be passed when innerHTML prop is set");var o=r.props.innerHTML;if("string"!=typeof o)throw new TypeError("innerHTML prop must be string");"script"===r.name?e.text=o:(e.innerHTML=o,function(e,r){void 0===r&&(r=window.document);for(var n=0,t=e.querySelectorAll("script");n<t.length;n++){var o=t[n],i=o.parentNode;if(i){var u=r.createElement("script");u.text=o.textContent,i.replaceChild(u,o)}}}(e,n))}else(w[r.name]||w.default)(e,r,t)}function M(e){void 0===e&&(e={});var r=e.doc,n=void 0===r?document:r,o=function(e,r){if(e.type===t.COMPONENT)return e.renderComponent((function(e){return o(e,r)}));if(e.type===t.TEXT)return g(n,e);if(e.type===t.ELEMENT){var i=function(e,r,n){return e.createElementNS(n,r.name)}(n,e,r);return T(i,e),x(i,e,n,(function(e){return o(e,r)})),i}throw new TypeError("Unhandleable node")},i=function(e){if(e.type===t.COMPONENT)return e.renderComponent(i);if(e.type===t.TEXT)return g(n,e);if(e.type===t.ELEMENT){var r=E[e.name.toLowerCase()];if(r)return o(e,r);var u=function(e,r){return r.props.el?r.props.el:e.createElement(r.name)}(n,e);return T(u,e),x(u,e,n,i),u}throw new TypeError("Unhandleable node")};return i}function b(){return(b=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function N(e,r){if(null==e)return{};var n,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)r.indexOf(n=i[t])>=0||(o[n]=e[n]);return o}var C=["innerHTML","class"];function L(e){var r=(void 0===e?{}:e).React;if(!r)throw new Error("Must pass React library to react renderer");var n=function(e){if(e.type===t.COMPONENT)return r.createElement.apply(r,[function(){return e.renderComponent(n)||null},e.props].concat(e.renderChildren(n)));if(e.type===t.ELEMENT)return r.createElement.apply(r,[e.name,(o=e.props,i=o.innerHTML,b({dangerouslySetInnerHTML:i?{__html:i}:null,className:o.class},N(o,C)))].concat(e.renderChildren(n)));var o,i;if(e.type===t.TEXT)return e.text;throw new TypeError("Unhandleable node")};return n}var O={br:!0};function R(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function j(){var e=function(r){if(r.type===t.COMPONENT)return[].concat(r.renderComponent(e)).join("");if(r.type===t.ELEMENT){var n=(i=r.props,(u=Object.keys(i).filter((function(e){var r=i[e];return"innerHTML"!==e&&("string"==typeof r||"number"==typeof r||!0===r)}))).length?" "+u.map((function(e){var r=i[e];if(!0===r)return""+R(e);if("string"!=typeof r&&"number"!=typeof r)throw new TypeError("Unexpected prop type: "+typeof r);return""===r?R(e):R(e)+'="'+R(r.toString())+'"'})).join(" "):"");if(O[r.name])return"<"+r.name+n+" />";var o="string"==typeof r.props.innerHTML?r.props.innerHTML:r.renderChildren(e).join("");return"<"+r.name+n+">"+o+"</"+r.name+">"}var i,u;if(r.type===t.TEXT)return R(r.text);throw new TypeError("Unhandleable node: "+r.type)};return e}var P=["innerHTML"];function A(e){var r=(void 0===e?{}:e).Preact;if(!r)throw new Error("Must pass Preact library to react renderer");var n=function(e){if(e.type===t.COMPONENT)return r.h.apply(r,[function(){return e.renderComponent(n)||null},e.props].concat(e.renderChildren(n)));if(e.type===t.ELEMENT)return r.h.apply(r,[e.name,(o=e.props,i=o.innerHTML,b({dangerouslySetInnerHTML:i?{__html:i}:null},N(o,P)))].concat(e.renderChildren(n)));var o,i;if(e.type===t.TEXT)return e.text;throw new TypeError("Unhandleable node")};return n}function H(){var e=y();return function(r){return new RegExp(e(r))}}function S(e){var r=e.css,n=e.nonce,t=e.children;return s(h,null,s("style",{innerHTML:"string"==typeof r?r:r._getCss(),nonce:n}),t)}H.node=function(e,r){for(var n=arguments.length,t=new Array(n>2?n-2:0),o=2;o<n;o++)t[o-2]=arguments[o];var i=s.apply(void 0,[e,r].concat(t));return e.renderer?i.render(e.renderer()):i};var _=function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&")},X=function(e,r){return(r=function(e,r){if(!r)throw new Error("Must pass children to "+e);return r}(e,r)).map((function(e){return e.type===t.TEXT?new c(_(e.text)):e}))};function U(e,r){var n=e.exact,t=void 0===n||n;return r=X("RegexGroup",r),t?["^"].concat(r,["$"]):r}function G(e,r){return X("RegexText",r)}function k(e,r){return function(e,r){if(r&&r.length)throw new Error("Must not pass children to RegexWord")}(0,r),"\\w+"}function F(e,r){return["["].concat(X("RegexText",r),["]"])}function W(e,r){var n=e.repeat,t=e.repeatMin,o=e.repeatMax,i=e.name,u=e.optional,a=void 0!==u&&u,p=e.capture,f=void 0===p||p,d=e.union,l=void 0!==d&&d;if(r=X("RegexGroup",r),v(n)&&(v(t)||v(o)))throw new Error("repeat can not be used with repeatMin or repeatMax");if(i&&!f)throw new Error("Named groups must be captured");if(l){for(var s=[],h=0,y=r;h<y.length;h++)s.push(y[h]),s.push(new c("|"));s.pop(),r=s}var E=[];return E.push(f?"(":"(?:"),i&&E.push("?<"+_(i)+">"),E.push.apply(E,r),E.push(")"),v(n)&&("number"==typeof n?E.push("{"+n+"}"):!0===n&&E.push("+")),(v(t)||v(o))&&E.push("{"+(t||"")+","+(o||"")+"}"),a&&E.push("?"),E}function $(e,r){for(var n=[],t=0,o=r=X("RegexGroup",r);t<o.length;t++)n.push(o[t]),n.push("|");return n.pop(),n}U.renderer=H}])})); | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("pragmatic",[],r):"object"==typeof exports?exports.pragmatic=r():e.pragmatic=r()}("undefined"!=typeof self?self:this,(function(){return function(e){var r={};function n(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)n.d(t,o,function(r){return e[r]}.bind(null,o));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return{}.hasOwnProperty.call(e,r)},n.p="",n(n.s=0)}([function(e,r,n){"use strict";n.r(r),n.d(r,"ElementNode",(function(){return i})),n.d(r,"FragmentNode",(function(){return u})),n.d(r,"TextNode",(function(){return p})),n.d(r,"ComponentNode",(function(){return a})),n.d(r,"node",(function(){return s})),n.d(r,"Fragment",(function(){return h})),n.d(r,"text",(function(){return y})),n.d(r,"dom",(function(){return M})),n.d(r,"react",(function(){return O})),n.d(r,"html",(function(){return j})),n.d(r,"preact",(function(){return A})),n.d(r,"regex",(function(){return H})),n.d(r,"NODE_TYPE",(function(){return t})),n.d(r,"Style",(function(){return S})),n.d(r,"Regex",(function(){return U})),n.d(r,"RegexText",(function(){return G})),n.d(r,"RegexWord",(function(){return k})),n.d(r,"RegexCharacters",(function(){return F})),n.d(r,"RegexGroup",(function(){return W})),n.d(r,"RegexUnion",(function(){return $}));var t={ELEMENT:"element",TEXT:"text",COMPONENT:"component",FRAGMENT:"fragment"};function o(e,r){for(var n=[],t=0;t<e.length;t++){var o=e[t].render(r);if(o)if(Array.isArray(o))for(var i=0;i<o.length;i++){var u=o[i];u&&n.push(u)}else n.push(o)}return n}var i=function(){function e(e,r,n){this.type=t.ELEMENT,this.name=void 0,this.props=void 0,this.children=void 0,this.onRender=void 0,this.name=e,this.props=r||{},this.children=n;var o=this.props.onRender;"function"==typeof o&&(this.onRender=o,delete r.onRender)}var r=e.prototype;return r.render=function(e){var r=e(this);return this.onRender&&this.onRender(r),r},r.renderChildren=function(e){return o(this.children,e)},e}(),u=function(){function e(e){this.type=t.FRAGMENT,this.children=void 0,this.children=e}return e.prototype.render=function(e){return o(this.children,e)},e}(),p=function(){function e(e){this.type=t.TEXT,this.text=void 0,this.text=e}return e.prototype.render=function(e){return e(this)},e}(),a=function(){function e(e,r,n){this.type=t.COMPONENT,this.component=void 0,this.props=void 0,this.children=void 0,this.component=e,this.props=r||{},this.children=n,this.props.children=n}var r=e.prototype;return r.renderComponent=function(e){var r=function(e){var r=c(Array.isArray(e)?e:[e]);return 1===r.length?r[0]:r.length>1?new u(r):void 0}(this.component(this.props,this.children));if(r)return r.render(e)},r.render=function(e){return e(this)},r.renderChildren=function(e){return o(this.children,e)},e}();function c(e){for(var r=[],n=0;n<e.length;n++){var o=e[n];if(o)if("string"==typeof o||"number"==typeof o)r.push(new p(o.toString()));else{if("boolean"==typeof o)continue;if(Array.isArray(o))for(var i=0,u=c(o);i<u.length;i++)r.push(u[i]);else{if(!o||o.type!==t.ELEMENT&&o.type!==t.TEXT&&o.type!==t.COMPONENT)throw new TypeError("Unrecognized node type: "+typeof o);r.push(o)}}}return r}var f,d,l,s=function(e,r){for(var n=arguments.length,t=new Array(n>2?n-2:0),o=2;o<n;o++)t[o-2]=arguments[o];if(t=c(t),"string"==typeof e)return new i(e,r,t);if("function"==typeof e)return new a(e,r,t);throw new TypeError("Expected jsx element to be a string or a function")},h=function(e,r){return r};function y(){var e=function(r){if(r.type===t.COMPONENT)return[].concat(r.renderComponent(e)).join("");if(r.type===t.ELEMENT)throw new Error("Text renderer does not support basic elements");if(r.type===t.TEXT)return r.text;throw new TypeError("Unhandleable node: "+r.type)};return e}function v(e){return null!=e}var E=((f={}).svg="http://www.w3.org/2000/svg",f),m=((d={})["xlink:href"]="http://www.w3.org/1999/xlink",d);function g(e,r){return e.createTextNode(r.text)}function T(e,r){for(var n=r.props,t=0,o=Object.keys(n);t<o.length;t++){var i=o[t],u=n[i];if(null!=u&&"el"!==i&&"innerHTML"!==i)if(i.match(/^on[A-Z][a-z]/)&&"function"==typeof u)e.addEventListener(i.slice(2).toLowerCase(),u);else if("string"==typeof u||"number"==typeof u){var p=m[i];p?e.setAttributeNS(p,i,u.toString()):e.setAttribute(i,u.toString())}else"boolean"==typeof u&&!0===u&&e.setAttribute(i,"")}"iframe"!==e.tagName.toLowerCase()||n.id||e.setAttribute("id","jsx-iframe-"+"xxxxxxxxxx".replace(/./g,(function(){return"0123456789abcdef".charAt(Math.floor(Math.random()*"0123456789abcdef".length))})))}var w=((l={}).iframe=function(e,r){var n=r.children[0];if(1!==r.children.length||!n||n.type!==t.ELEMENT||"html"!==n.name)throw new Error("Expected only single html element node as child of iframe element");e.addEventListener("load",(function(){var r=e.contentWindow;if(!r)throw new Error("Expected frame to have contentWindow");for(var t=r.document,o=t.documentElement;o.children&&o.children.length;)o.removeChild(o.children[0]);for(var i=n.render(M({doc:t}));i.children.length;)o.appendChild(i.children[0])}))},l.script=function(e,r){var n=r.children[0];if(1!==r.children.length||!n||n.type!==t.TEXT)throw new Error("Expected only single text node as child of script element");e.text=n.text},l.default=function(e,r,n){for(var t=0,o=r.renderChildren(n);t<o.length;t++)e.appendChild(o[t])},l);function x(e,r,n,t){if(r.props.hasOwnProperty("innerHTML")){if(r.children.length)throw new Error("Expected no children to be passed when innerHTML prop is set");var o=r.props.innerHTML;if("string"!=typeof o)throw new TypeError("innerHTML prop must be string");"script"===r.name?e.text=o:(e.innerHTML=o,function(e,r){void 0===r&&(r=window.document);for(var n=0,t=e.querySelectorAll("script");n<t.length;n++){var o=t[n],i=o.parentNode;if(i){var u=r.createElement("script");u.text=o.textContent,i.replaceChild(u,o)}}}(e,n))}else(w[r.name]||w.default)(e,r,t)}function M(e){void 0===e&&(e={});var r=e.doc,n=void 0===r?document:r,o=function(e,r){if(e.type===t.COMPONENT)return e.renderComponent((function(e){return o(e,r)}));if(e.type===t.TEXT)return g(n,e);if(e.type===t.ELEMENT){var i=function(e,r,n){return e.createElementNS(n,r.name)}(n,e,r);return T(i,e),x(i,e,n,(function(e){return o(e,r)})),i}throw new TypeError("Unhandleable node")},i=function(e){if(e.type===t.COMPONENT)return e.renderComponent(i);if(e.type===t.TEXT)return g(n,e);if(e.type===t.ELEMENT){var r=E[e.name.toLowerCase()];if(r)return o(e,r);var u=function(e,r){return r.props.el?r.props.el:e.createElement(r.name)}(n,e);return T(u,e),x(u,e,n,i),u}throw new TypeError("Unhandleable node")};return i}function b(){return(b=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function N(e,r){if(null==e)return{};var n,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)r.indexOf(n=i[t])>=0||(o[n]=e[n]);return o}var C=["innerHTML","class"];function O(e){var r=(void 0===e?{}:e).React;if(!r)throw new Error("Must pass React library to react renderer");var n=function(e){if(e.type===t.COMPONENT)return r.createElement.apply(r,[function(){return e.renderComponent(n)||null},e.props].concat(e.renderChildren(n)));if(e.type===t.ELEMENT)return r.createElement.apply(r,[e.name,(o=e.props,i=o.innerHTML,b({dangerouslySetInnerHTML:i?{__html:i}:null,className:o.class},N(o,C)))].concat(e.renderChildren(n)));var o,i;if(e.type===t.TEXT)return e.text;throw new TypeError("Unhandleable node")};return n}var L={br:!0};function R(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function j(){var e=function(r){if(r.type===t.COMPONENT)return[].concat(r.renderComponent(e)).join("");if(r.type===t.ELEMENT){var n=(i=r.props,(u=Object.keys(i).filter((function(e){var r=i[e];return"innerHTML"!==e&&("string"==typeof r||"number"==typeof r||!0===r)}))).length?" "+u.map((function(e){var r=i[e];if(!0===r)return""+R(e);if("string"!=typeof r&&"number"!=typeof r)throw new TypeError("Unexpected prop type: "+typeof r);return""===r?R(e):R(e)+'="'+R(r.toString())+'"'})).join(" "):"");if(L[r.name])return"<"+r.name+n+" />";var o="string"==typeof r.props.innerHTML?r.props.innerHTML:r.renderChildren(e).join("");return"<"+r.name+n+">"+o+"</"+r.name+">"}var i,u;if(r.type===t.TEXT)return R(r.text);throw new TypeError("Unhandleable node: "+r.type)};return e}var P=["innerHTML"];function A(e){var r=(void 0===e?{}:e).Preact;if(!r)throw new Error("Must pass Preact library to react renderer");var n=function(e){if(e.type===t.COMPONENT)return r.h.apply(r,[function(){return e.renderComponent(n)||null},e.props].concat(e.renderChildren(n)));if(e.type===t.ELEMENT)return r.h.apply(r,[e.name,(o=e.props,i=o.innerHTML,b({dangerouslySetInnerHTML:i?{__html:i}:null},N(o,P)))].concat(e.renderChildren(n)));var o,i;if(e.type===t.TEXT)return e.text;throw new TypeError("Unhandleable node")};return n}function H(){var e=y();return function(r){return new RegExp(e(r))}}function S(e){var r=e.css,n=e.nonce,t=e.children;return s(h,null,s("style",{innerHTML:"string"==typeof r?r:r._getCss(),nonce:n}),t)}H.node=function(e,r){for(var n=arguments.length,t=new Array(n>2?n-2:0),o=2;o<n;o++)t[o-2]=arguments[o];var i=s.apply(void 0,[e,r].concat(t));return e.renderer?i.render(e.renderer()):i};var _=function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&")},X=function(e,r){return(r=function(e,r){if(!r)throw new Error("Must pass children to "+e);return r}(e,r)).map((function(e){return e.type===t.TEXT?new p(_(e.text)):e}))};function U(e,r){var n=e.exact,t=void 0===n||n;return r=X("RegexGroup",r),t?["^"].concat(r,["$"]):r}function G(e,r){return X("RegexText",r)}function k(e,r){return function(e,r){if(r&&r.length)throw new Error("Must not pass children to RegexWord")}(0,r),"\\w+"}function F(e,r){return["["].concat(X("RegexText",r),["]"])}function W(e,r){var n=e.repeat,t=e.repeatMin,o=e.repeatMax,i=e.name,u=e.optional,a=void 0!==u&&u,c=e.capture,f=void 0===c||c,d=e.union,l=void 0!==d&&d;if(r=X("RegexGroup",r),v(n)&&(v(t)||v(o)))throw new Error("repeat can not be used with repeatMin or repeatMax");if(i&&!f)throw new Error("Named groups must be captured");if(l){for(var s=[],h=0,y=r;h<y.length;h++)s.push(y[h]),s.push(new p("|"));s.pop(),r=s}var E=[];return E.push(f?"(":"(?:"),i&&E.push("?<"+_(i)+">"),E.push.apply(E,r),E.push(")"),v(n)&&("number"==typeof n?E.push("{"+n+"}"):!0===n&&E.push("+")),(v(t)||v(o))&&E.push("{"+(t||"")+","+(o||"")+"}"),a&&E.push("?"),E}function $(e,r){for(var n=[],t=0,o=r=X("RegexGroup",r);t<o.length;t++)n.push(o[t]),n.push("|");return n.pop(),n}U.renderer=H}])})); | ||
//# sourceMappingURL=jsx-pragmatic.min.js.map |
@@ -74,5 +74,2 @@ var _ELEMENT_DEFAULT_XML_, _ATTRIBUTE_DEFAULT_XM, _ADD_CHILDREN; | ||
} | ||
if (el.tagName.toLowerCase() === ELEMENT_TAG.IFRAME && !props.srcdoc && !props.src) { | ||
el.setAttribute("srcdoc", ""); | ||
} | ||
} | ||
@@ -79,0 +76,0 @@ var ADD_CHILDREN = (_ADD_CHILDREN = {}, _ADD_CHILDREN[ELEMENT_TAG.IFRAME] = function (el, node) { |
{ | ||
"name": "@krakenjs/jsx-pragmatic", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "Javascript module template.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -121,13 +121,2 @@ /* @flow */ | ||
} | ||
// If the element is an iframe and it has no srcdoc or src, set the srcdoc to an empty string. | ||
// Content specified via srcdoc is treated as being from the same origin as the parent document. | ||
// In some browsers (like Safari 17+), empty iframes without src or srcdoc may be treated as "anonymous," potentially blocking certain content. | ||
if ( | ||
el.tagName.toLowerCase() === ELEMENT_TAG.IFRAME && | ||
!props.srcdoc && | ||
!props.src | ||
) { | ||
el.setAttribute("srcdoc", ""); | ||
} | ||
} | ||
@@ -134,0 +123,0 @@ const ADD_CHILDREN: { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
176129
2442