Skip to content

Commit

Permalink
ci: check in dist folder
Browse files Browse the repository at this point in the history
  • Loading branch information
wsbrunson committed Sep 23, 2024
1 parent b21a468 commit 9d45bd2
Show file tree
Hide file tree
Showing 19 changed files with 221 additions and 383 deletions.
57 changes: 31 additions & 26 deletions dist/jsx-pragmatic-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
"iframe" !== el.tagName.toLowerCase() || props.id || el.setAttribute("id", "jsx-iframe-" + "xxxxxxxxxx".replace(/./g, (function() {
return "0123456789abcdef".charAt(Math.floor(Math.random() * "0123456789abcdef".length));
})));
"iframe" !== el.tagName.toLowerCase() || props.srcdoc || props.src || el.setAttribute("srcdoc", "");
}
var ADD_CHILDREN = ((_ADD_CHILDREN = {}).iframe = function(el, node) {
var firstChild = node.children[0];
Expand All @@ -207,37 +208,39 @@
var child = firstChild.render(function(opts) {
void 0 === opts && (opts = {});
var _opts$doc = opts.doc, doc = void 0 === _opts$doc ? document : _opts$doc;
return function domRenderer(node) {
if ("component" === node.type) return node.renderComponent(domRenderer);
var _xmlNamespaceDomRenderer = function(node, xmlNamespace) {
if ("component" === node.type) return node.renderComponent((function(childNode) {
return _xmlNamespaceDomRenderer(childNode, xmlNamespace);
}));
if ("text" === node.type) return createTextElement(doc, node);
if ("element" === node.type) {
var el = function(doc, node, xmlNamespace) {
return doc.createElementNS(xmlNamespace, node.name);
}(doc, node, xmlNamespace);
addProps(el, node);
addChildren(el, node, doc, (function(childNode) {
return _xmlNamespaceDomRenderer(childNode, xmlNamespace);
}));
return el;
}
throw new TypeError("Unhandleable node");
};
var _domRenderer = function(node) {
if ("component" === node.type) return node.renderComponent(_domRenderer);
if ("text" === node.type) return createTextElement(doc, node);
if ("element" === node.type) {
var xmlNamespace = ELEMENT_DEFAULT_XML_NAMESPACE[node.name.toLowerCase()];
if (xmlNamespace) return function xmlNamespaceDomRenderer(node, xmlNamespace) {
if ("component" === node.type) return node.renderComponent((function(childNode) {
return xmlNamespaceDomRenderer(childNode, xmlNamespace);
}));
if ("text" === node.type) return createTextElement(doc, node);
if ("element" === node.type) {
var el = function(doc, node, xmlNamespace) {
return doc.createElementNS(xmlNamespace, node.name);
}(doc, node, xmlNamespace);
addProps(el, node);
addChildren(el, node, doc, (function(childNode) {
return xmlNamespaceDomRenderer(childNode, xmlNamespace);
}));
return el;
}
throw new TypeError("Unhandleable node");
}(node, xmlNamespace);
if (xmlNamespace) return _xmlNamespaceDomRenderer(node, xmlNamespace);
var el = function(doc, node) {
return node.props.el ? node.props.el : doc.createElement(node.name);
}(doc, node);
addProps(el, node);
addChildren(el, node, doc, domRenderer);
addChildren(el, node, doc, _domRenderer);
return el;
}
throw new TypeError("Unhandleable node");
};
return _domRenderer;
}({
doc: doc
}));
Expand Down Expand Up @@ -273,13 +276,15 @@
} else (ADD_CHILDREN[node.name] || ADD_CHILDREN.default)(el, node, renderer);
}
function regex() {
var regexRenderer = _textRenderer = function(node) {
if ("component" === node.type) return [].concat(node.renderComponent(_textRenderer)).join("");
if ("element" === node.type) throw new Error("Text renderer does not support basic elements");
if ("text" === node.type) return node.text;
throw new TypeError("Unhandleable node: " + node.type);
};
var _textRenderer;
return function(nodeInstance) {
return new RegExp(function textRenderer(node) {
if ("component" === node.type) return [].concat(node.renderComponent(textRenderer)).join("");
if ("element" === node.type) throw new Error("Text renderer does not support basic elements");
if ("text" === node.type) return node.text;
throw new TypeError("Unhandleable node: " + node.type);
}(nodeInstance));
return new RegExp(regexRenderer(nodeInstance));
};
}
regex.node = function(el, props) {
Expand Down
73 changes: 40 additions & 33 deletions dist/jsx-pragmatic.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,13 @@
return children;
};
function text_text() {
return function textRenderer(node) {
if (node.type === NODE_TYPE.COMPONENT) return [].concat(node.renderComponent(textRenderer)).join("");
var _textRenderer = function(node) {
if (node.type === NODE_TYPE.COMPONENT) return [].concat(node.renderComponent(_textRenderer)).join("");
if (node.type === NODE_TYPE.ELEMENT) throw new Error("Text renderer does not support basic elements");
if (node.type === NODE_TYPE.TEXT) return node.text;
throw new TypeError("Unhandleable node: " + node.type);
};
return _textRenderer;
}
function isDefined(val) {
return null != val;
Expand All @@ -271,6 +272,7 @@
"iframe" !== el.tagName.toLowerCase() || props.id || el.setAttribute("id", "jsx-iframe-" + "xxxxxxxxxx".replace(/./g, (function() {
return "0123456789abcdef".charAt(Math.floor(Math.random() * "0123456789abcdef".length));
})));
"iframe" !== el.tagName.toLowerCase() || props.srcdoc || props.src || el.setAttribute("srcdoc", "");
}
var ADD_CHILDREN = ((_ADD_CHILDREN = {}).iframe = function(el, node) {
var firstChild = node.children[0];
Expand Down Expand Up @@ -318,37 +320,39 @@
function dom(opts) {
void 0 === opts && (opts = {});
var _opts$doc = opts.doc, doc = void 0 === _opts$doc ? document : _opts$doc;
return function domRenderer(node) {
if (node.type === NODE_TYPE.COMPONENT) return node.renderComponent(domRenderer);
var _xmlNamespaceDomRenderer = function(node, xmlNamespace) {
if (node.type === NODE_TYPE.COMPONENT) return node.renderComponent((function(childNode) {
return _xmlNamespaceDomRenderer(childNode, xmlNamespace);
}));
if (node.type === NODE_TYPE.TEXT) return createTextElement(doc, node);
if (node.type === NODE_TYPE.ELEMENT) {
var el = function(doc, node, xmlNamespace) {
return doc.createElementNS(xmlNamespace, node.name);
}(doc, node, xmlNamespace);
addProps(el, node);
addChildren(el, node, doc, (function(childNode) {
return _xmlNamespaceDomRenderer(childNode, xmlNamespace);
}));
return el;
}
throw new TypeError("Unhandleable node");
};
var _domRenderer = function(node) {
if (node.type === NODE_TYPE.COMPONENT) return node.renderComponent(_domRenderer);
if (node.type === NODE_TYPE.TEXT) return createTextElement(doc, node);
if (node.type === NODE_TYPE.ELEMENT) {
var xmlNamespace = ELEMENT_DEFAULT_XML_NAMESPACE[node.name.toLowerCase()];
if (xmlNamespace) return function xmlNamespaceDomRenderer(node, xmlNamespace) {
if (node.type === NODE_TYPE.COMPONENT) return node.renderComponent((function(childNode) {
return xmlNamespaceDomRenderer(childNode, xmlNamespace);
}));
if (node.type === NODE_TYPE.TEXT) return createTextElement(doc, node);
if (node.type === NODE_TYPE.ELEMENT) {
var el = function(doc, node, xmlNamespace) {
return doc.createElementNS(xmlNamespace, node.name);
}(doc, node, xmlNamespace);
addProps(el, node);
addChildren(el, node, doc, (function(childNode) {
return xmlNamespaceDomRenderer(childNode, xmlNamespace);
}));
return el;
}
throw new TypeError("Unhandleable node");
}(node, xmlNamespace);
if (xmlNamespace) return _xmlNamespaceDomRenderer(node, xmlNamespace);
var el = function(doc, node) {
return node.props.el ? node.props.el : doc.createElement(node.name);
}(doc, node);
addProps(el, node);
addChildren(el, node, doc, domRenderer);
addChildren(el, node, doc, _domRenderer);
return el;
}
throw new TypeError("Unhandleable node");
};
return _domRenderer;
}
function _extends() {
return (_extends = Object.assign || function(target) {
Expand All @@ -371,21 +375,22 @@
function react(_temp) {
var React = (void 0 === _temp ? {} : _temp).React;
if (!React) throw new Error("Must pass React library to react renderer");
return function reactRenderer(node) {
var _reactRenderer = function(node) {
if (node.type === NODE_TYPE.COMPONENT) return React.createElement.apply(React, [ function() {
return node.renderComponent(reactRenderer) || null;
}, node.props ].concat(node.renderChildren(reactRenderer)));
return node.renderComponent(_reactRenderer) || null;
}, node.props ].concat(node.renderChildren(_reactRenderer)));
if (node.type === NODE_TYPE.ELEMENT) return React.createElement.apply(React, [ node.name, (props = node.props,
innerHTML = props.innerHTML, _extends({
dangerouslySetInnerHTML: innerHTML ? {
__html: innerHTML
} : null,
className: props.class
}, _objectWithoutPropertiesLoose(props, _excluded))) ].concat(node.renderChildren(reactRenderer)));
}, _objectWithoutPropertiesLoose(props, _excluded))) ].concat(node.renderChildren(_reactRenderer)));
var props, innerHTML;
if (node.type === NODE_TYPE.TEXT) return node.text;
throw new TypeError("Unhandleable node");
};
return _reactRenderer;
}
var SELF_CLOSING_TAGS = {
br: !0
Expand All @@ -394,8 +399,8 @@
return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/\//g, "&#x2F;");
}
function html() {
return function htmlRenderer(node) {
if (node.type === NODE_TYPE.COMPONENT) return [].concat(node.renderComponent(htmlRenderer)).join("");
var _htmlRenderer = function(node) {
if (node.type === NODE_TYPE.COMPONENT) return [].concat(node.renderComponent(_htmlRenderer)).join("");
if (node.type === NODE_TYPE.ELEMENT) {
var renderedProps = (props = node.props, (keys = Object.keys(props).filter((function(key) {
var val = props[key];
Expand All @@ -407,32 +412,34 @@
return "" === val ? htmlEncode(key) : htmlEncode(key) + '="' + htmlEncode(val.toString()) + '"';
})).join(" ") : "");
if (SELF_CLOSING_TAGS[node.name]) return "<" + node.name + renderedProps + " />";
var renderedChildren = "string" == typeof node.props.innerHTML ? node.props.innerHTML : node.renderChildren(htmlRenderer).join("");
var renderedChildren = "string" == typeof node.props.innerHTML ? node.props.innerHTML : node.renderChildren(_htmlRenderer).join("");
return "<" + node.name + renderedProps + ">" + renderedChildren + "</" + node.name + ">";
}
var props, keys;
if (node.type === NODE_TYPE.TEXT) return htmlEncode(node.text);
throw new TypeError("Unhandleable node: " + node.type);
};
return _htmlRenderer;
}
var preact_excluded = [ "innerHTML" ];
function preact(_temp) {
var Preact = (void 0 === _temp ? {} : _temp).Preact;
if (!Preact) throw new Error("Must pass Preact library to react renderer");
return function reactRenderer(node) {
var _reactRenderer = function(node) {
if (node.type === NODE_TYPE.COMPONENT) return Preact.h.apply(Preact, [ function() {
return node.renderComponent(reactRenderer) || null;
}, node.props ].concat(node.renderChildren(reactRenderer)));
return node.renderComponent(_reactRenderer) || null;
}, node.props ].concat(node.renderChildren(_reactRenderer)));
if (node.type === NODE_TYPE.ELEMENT) return Preact.h.apply(Preact, [ node.name, (props = node.props,
innerHTML = props.innerHTML, _extends({
dangerouslySetInnerHTML: innerHTML ? {
__html: innerHTML
} : null
}, _objectWithoutPropertiesLoose(props, preact_excluded))) ].concat(node.renderChildren(reactRenderer)));
}, _objectWithoutPropertiesLoose(props, preact_excluded))) ].concat(node.renderChildren(_reactRenderer)));
var props, innerHTML;
if (node.type === NODE_TYPE.TEXT) return node.text;
throw new TypeError("Unhandleable node");
};
return _reactRenderer;
}
function regex() {
var regexRenderer = text_text();
Expand Down
Loading

0 comments on commit 9d45bd2

Please sign in to comment.