@wiajs/core 1.1.21 → 1.1.23
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/jsx-runtime.js +34 -107
- package/dist/jsxRuntime.d.ts +60 -0
- package/dist/jsxRuntime.js +2 -0
- package/dist/jsxRuntime.js.map +1 -0
- package/dist/jsxRuntime.module.js +2 -0
- package/dist/jsxRuntime.module.js.map +1 -0
- package/dist/jsxRuntime.umd.js +2 -0
- package/dist/jsxRuntime.umd.js.map +1 -0
- package/package.json +9 -3
- package/dist/jsx-dev-runtime.js +0 -111
package/dist/jsx-runtime.js
CHANGED
|
@@ -1,113 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const svgNs = 'http://www.w3.org/2000/svg';
|
|
13
|
-
const mathmlNs = 'http://www.w3.org/1998/Math/MathML';
|
|
14
|
-
const properties = new Set(['value']);
|
|
15
|
-
const internalKeys = new Set(['_', 'children', 'ref']);
|
|
16
|
-
const extensions = new Map([['style', (node, value, key) => {
|
|
17
|
-
if ('string' == typeof value) {
|
|
18
|
-
node.setAttribute(key, value);
|
|
19
|
-
} else {
|
|
20
|
-
for (key in value) {
|
|
21
|
-
if (key.startsWith('-')) {
|
|
22
|
-
node.style.setProperty(key, value[key]);
|
|
23
|
-
} else {
|
|
24
|
-
node.style[key] = value[key];
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}], ['$', (node, value, key) => {
|
|
29
|
-
for (key in value) {
|
|
30
|
-
node.addEventListener(key, value[key]);
|
|
31
|
-
}
|
|
32
|
-
}]]);
|
|
33
|
-
const appendChildren = (content, node) => Array.isArray(content) ? content.some(i => appendChildren(i, node)) : false !== content && null != content && node.append(content);
|
|
34
|
-
const Fragment = content => (appendChildren(content, content = new DocumentFragment()), content);
|
|
35
|
-
const jsx = (tag, props) => {
|
|
36
|
-
let key,
|
|
37
|
-
value,
|
|
38
|
-
node = props._ ? document.createElementNS(props._, tag) : document.createElement(tag, props.is ? {
|
|
39
|
-
is: props.is
|
|
40
|
-
} : key);
|
|
41
|
-
for (key in props) {
|
|
42
|
-
if (!internalKeys.has(key)) {
|
|
43
|
-
value = props[key];
|
|
44
|
-
if (extensions.has(key)) {
|
|
45
|
-
extensions.get(key)(node, value, key);
|
|
46
|
-
} else if (properties.has(key) || key.startsWith('on')) {
|
|
47
|
-
node[key] = value;
|
|
48
|
-
} else if (null != value) {
|
|
49
|
-
if ('boolean' != typeof value || key.startsWith('-', 4)) {
|
|
50
|
-
node.setAttribute(key, value);
|
|
51
|
-
} else if (value) {
|
|
52
|
-
node.setAttribute(key, '');
|
|
53
|
-
}
|
|
1
|
+
// replace react, use by @babel/plugin-transform-react-jsx
|
|
2
|
+
/* eslint-disable prefer-rest-params */
|
|
3
|
+
function jsx(tag, props) {
|
|
4
|
+
const attrs = props || {};
|
|
5
|
+
const children = props.children || [];
|
|
6
|
+
|
|
7
|
+
const attrsString = Object.keys(attrs)
|
|
8
|
+
.map((attr) => {
|
|
9
|
+
if (attr[0] === '_') {
|
|
10
|
+
if (attrs[attr]) return attr.replace('_', '');
|
|
11
|
+
return '';
|
|
54
12
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
value.current = node;
|
|
63
|
-
}
|
|
13
|
+
return `${attr}="${attrs[attr]}"`;
|
|
14
|
+
})
|
|
15
|
+
.filter((attr) => !!attr)
|
|
16
|
+
.join(' ');
|
|
17
|
+
|
|
18
|
+
if (['path', 'img', 'circle', 'polygon', 'line', 'input'].indexOf(tag) >= 0) {
|
|
19
|
+
return `<${tag} ${attrsString} />`.trim();
|
|
64
20
|
}
|
|
65
|
-
|
|
21
|
+
const childrenContent = children
|
|
22
|
+
.filter((c) => !!c)
|
|
23
|
+
.map((c) => (Array.isArray(c) ? c.join('') : c))
|
|
24
|
+
.join('');
|
|
25
|
+
return `<${tag} ${attrsString}>${childrenContent}</${tag}>`.trim();
|
|
66
26
|
};
|
|
67
27
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const parseFromString = html => jsx('template', {
|
|
73
|
-
ref(node) {
|
|
74
|
-
node.innerHTML = html;
|
|
75
|
-
}
|
|
76
|
-
}).content;
|
|
77
|
-
const Template = props => /*#__PURE__*/parseFromString(props.children);
|
|
28
|
+
function Fragment(props) {
|
|
29
|
+
return props.children;
|
|
30
|
+
}
|
|
78
31
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
text.textContent = initContent = content;
|
|
84
|
-
}
|
|
85
|
-
}];
|
|
86
|
-
};
|
|
32
|
+
exports.Fragment = Fragment;
|
|
33
|
+
exports.jsx = jsx;
|
|
34
|
+
exports.jsxs = jsx;
|
|
35
|
+
exports.jsxDEV = jsx;
|
|
87
36
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
var jsx_1 = jsxRuntime.jsx = jsx;
|
|
93
|
-
var jsxs = jsxRuntime.jsxs = jsx;
|
|
94
|
-
var mathmlNs_1 = jsxRuntime.mathmlNs = mathmlNs;
|
|
95
|
-
var parseFromString_1 = jsxRuntime.parseFromString = parseFromString;
|
|
96
|
-
var properties_1 = jsxRuntime.properties = properties;
|
|
97
|
-
var svgNs_1 = jsxRuntime.svgNs = svgNs;
|
|
98
|
-
var useRef_1 = jsxRuntime.useRef = useRef;
|
|
99
|
-
var useText_1 = jsxRuntime.useText = useText;
|
|
100
|
-
|
|
101
|
-
exports.Fragment = Fragment_1;
|
|
102
|
-
exports.Template = Template_1;
|
|
103
|
-
exports.appendChildren = appendChildren_1;
|
|
104
|
-
exports.default = jsxRuntime;
|
|
105
|
-
exports.extensions = extensions_1;
|
|
106
|
-
exports.jsx = jsx_1;
|
|
107
|
-
exports.jsxs = jsxs;
|
|
108
|
-
exports.mathmlNs = mathmlNs_1;
|
|
109
|
-
exports.parseFromString = parseFromString_1;
|
|
110
|
-
exports.properties = properties_1;
|
|
111
|
-
exports.svgNs = svgNs_1;
|
|
112
|
-
exports.useRef = useRef_1;
|
|
113
|
-
exports.useText = useText_1;
|
|
37
|
+
// "browser": "./dist/jsx-runtime.module.js",
|
|
38
|
+
// "umd": "./dist/jsxRuntime.umd.js",
|
|
39
|
+
// "import": "./dist/jsxRuntime.mjs",
|
|
40
|
+
// "require": "./dist/jsxRuntime.js"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export { Fragment } from '../../';
|
|
2
|
+
import {
|
|
3
|
+
ComponentType,
|
|
4
|
+
ComponentChild,
|
|
5
|
+
ComponentChildren,
|
|
6
|
+
VNode,
|
|
7
|
+
Attributes
|
|
8
|
+
} from '../../';
|
|
9
|
+
import { JSXInternal } from '../../src/jsx';
|
|
10
|
+
|
|
11
|
+
export function jsx(
|
|
12
|
+
type: string,
|
|
13
|
+
props: JSXInternal.HTMLAttributes &
|
|
14
|
+
JSXInternal.SVGAttributes &
|
|
15
|
+
Record<string, any> & { children?: ComponentChild },
|
|
16
|
+
key?: string
|
|
17
|
+
): VNode<any>;
|
|
18
|
+
export function jsx<P>(
|
|
19
|
+
type: ComponentType<P>,
|
|
20
|
+
props: Attributes & P & { children?: ComponentChild },
|
|
21
|
+
key?: string
|
|
22
|
+
): VNode<any>;
|
|
23
|
+
|
|
24
|
+
export function jsxs(
|
|
25
|
+
type: string,
|
|
26
|
+
props: JSXInternal.HTMLAttributes &
|
|
27
|
+
JSXInternal.SVGAttributes &
|
|
28
|
+
Record<string, any> & { children?: ComponentChild[] },
|
|
29
|
+
key?: string
|
|
30
|
+
): VNode<any>;
|
|
31
|
+
export function jsxs<P>(
|
|
32
|
+
type: ComponentType<P>,
|
|
33
|
+
props: Attributes & P & { children?: ComponentChild[] },
|
|
34
|
+
key?: string
|
|
35
|
+
): VNode<any>;
|
|
36
|
+
|
|
37
|
+
export function jsxDEV(
|
|
38
|
+
type: string,
|
|
39
|
+
props: JSXInternal.HTMLAttributes &
|
|
40
|
+
JSXInternal.SVGAttributes &
|
|
41
|
+
Record<string, any> & { children?: ComponentChildren },
|
|
42
|
+
key?: string
|
|
43
|
+
): VNode<any>;
|
|
44
|
+
export function jsxDEV<P>(
|
|
45
|
+
type: ComponentType<P>,
|
|
46
|
+
props: Attributes & P & { children?: ComponentChildren },
|
|
47
|
+
key?: string
|
|
48
|
+
): VNode<any>;
|
|
49
|
+
|
|
50
|
+
// These are not expected to be used manually, but by a JSX transform
|
|
51
|
+
export function jsxTemplate(
|
|
52
|
+
template: string[],
|
|
53
|
+
...expressions: any[]
|
|
54
|
+
): VNode<any>;
|
|
55
|
+
export function jsxAttr(name: string, value: any): string | null;
|
|
56
|
+
export function jsxEscape<T>(
|
|
57
|
+
value: T
|
|
58
|
+
): string | null | VNode<any> | Array<string | null | VNode>;
|
|
59
|
+
|
|
60
|
+
export { JSXInternal as JSX };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var r=require("preact"),e=/["&<]/;function t(r){if(0===r.length||!1===e.test(r))return r;for(var t=0,n=0,o="",f="";n<r.length;n++){switch(r.charCodeAt(n)){case 34:f=""";break;case 38:f="&";break;case 60:f="<";break;default:continue}n!==t&&(o+=r.slice(t,n)),o+=f,t=n+1}return n!==t&&(o+=r.slice(t,n)),o}var n=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,o=0,f=Array.isArray;function i(e,t,n,f,i,u){t||(t={});var a,c,p=t;if("ref"in p)for(c in p={},t)"ref"==c?a=t[c]:p[c]=t[c];var l={type:e,props:p,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--o,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===p[c]&&(p[c]=a[c]);return r.options.vnode&&r.options.vnode(l),l}var u={},a=/[A-Z]/g;Object.defineProperty(exports,"Fragment",{enumerable:!0,get:function(){return r.Fragment}}),exports.jsx=i,exports.jsxAttr=function(e,o){if(r.options.attr){var f=r.options.attr(e,o);if("string"==typeof f)return f}if("ref"===e||"key"===e)return"";if("style"===e&&"object"==typeof o){var i="";for(var c in o){var p=o[c];if(null!=p&&""!==p){var l="-"==c[0]?c:u[c]||(u[c]=c.replace(a,"-$&").toLowerCase()),_=";";"number"!=typeof p||l.startsWith("--")||n.test(l)||(_="px;"),i=i+l+":"+p+_}}return e+'="'+i+'"'}return null==o||!1===o||"function"==typeof o||"object"==typeof o?"":!0===o?e:e+'="'+t(o)+'"'},exports.jsxDEV=i,exports.jsxEscape=function r(e){if(null==e||"boolean"==typeof e||"function"==typeof e)return null;if("object"==typeof e){if(void 0===e.constructor)return e;if(f(e)){for(var n=0;n<e.length;n++)e[n]=r(e[n]);return e}}return t(""+e)},exports.jsxTemplate=function(e){var t=i(r.Fragment,{tpl:e,exprs:[].slice.call(arguments,1)});return t.key=t.__v,t},exports.jsxs=i;
|
|
2
|
+
//# sourceMappingURL=jsxRuntime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsxRuntime.js","sources":["../src/utils.js","../../src/constants.js","../src/index.js"],"sourcesContent":["const ENCODED_ENTITIES = /[\"&<]/;\r\n\r\n/** @param {string} str */\r\nexport function encodeEntities(str) {\r\n\t// Skip all work for strings with no entities needing encoding:\r\n\tif (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str;\r\n\r\n\tlet last = 0,\r\n\t\ti = 0,\r\n\t\tout = '',\r\n\t\tch = '';\r\n\r\n\t// Seek forward in str until the next entity char:\r\n\tfor (; i < str.length; i++) {\r\n\t\tswitch (str.charCodeAt(i)) {\r\n\t\t\tcase 34:\r\n\t\t\t\tch = '"';\r\n\t\t\t\tbreak;\r\n\t\t\tcase 38:\r\n\t\t\t\tch = '&';\r\n\t\t\t\tbreak;\r\n\t\t\tcase 60:\r\n\t\t\t\tch = '<';\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tcontinue;\r\n\t\t}\r\n\t\t// Append skipped/buffered characters and the encoded entity:\r\n\t\tif (i !== last) out += str.slice(last, i);\r\n\t\tout += ch;\r\n\t\t// Start the next seek/buffer after the entity's offset:\r\n\t\tlast = i + 1;\r\n\t}\r\n\tif (i !== last) out += str.slice(last, i);\r\n\treturn out;\r\n}\r\n","/** Normal hydration that attaches to a DOM tree but does not diff it. */\r\nexport const MODE_HYDRATE = 1 << 5;\r\n/** Signifies this VNode suspended on the previous render */\r\nexport const MODE_SUSPENDED = 1 << 7;\r\n/** Indicates that this node needs to be inserted while patching children */\r\nexport const INSERT_VNODE = 1 << 16;\r\n/** Indicates a VNode has been matched with another VNode in the diff */\r\nexport const MATCHED = 1 << 17;\r\n\r\n/** Reset all mode flags */\r\nexport const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);\r\n\r\nexport const EMPTY_OBJ = /** @type {any} */ ({});\r\nexport const EMPTY_ARR = [];\r\nexport const IS_NON_DIMENSIONAL =\r\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\r\n","import { options, Fragment } from 'preact';\r\nimport { encodeEntities } from './utils';\r\nimport { IS_NON_DIMENSIONAL } from '../../src/constants';\r\n\r\nlet vnodeId = 0;\r\n\r\nconst isArray = Array.isArray;\r\n\r\n/**\r\n * @fileoverview\r\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\r\n * - jsx(type, props, key)\r\n * - jsxs(type, props, key)\r\n * - jsxDEV(type, props, key, __source, __self)\r\n *\r\n * The implementation of createVNode here is optimized for performance.\r\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\r\n */\r\n\r\n/**\r\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\r\n * @param {VNode['type']} type\r\n * @param {VNode['props']} props\r\n * @param {VNode['key']} [key]\r\n * @param {unknown} [isStaticChildren]\r\n * @param {unknown} [__source]\r\n * @param {unknown} [__self]\r\n */\r\nfunction createVNode(type, props, key, isStaticChildren, __source, __self) {\r\n\tif (!props) props = {};\r\n\t// We'll want to preserve `ref` in props to get rid of the need for\r\n\t// forwardRef components in the future, but that should happen via\r\n\t// a separate PR.\r\n\tlet normalizedProps = props,\r\n\t\tref,\r\n\t\ti;\r\n\r\n\tif ('ref' in normalizedProps) {\r\n\t\tnormalizedProps = {};\r\n\t\tfor (i in props) {\r\n\t\t\tif (i == 'ref') {\r\n\t\t\t\tref = props[i];\r\n\t\t\t} else {\r\n\t\t\t\tnormalizedProps[i] = props[i];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/** @type {VNode & { __source: any; __self: any }} */\r\n\tconst vnode = {\r\n\t\ttype,\r\n\t\tprops: normalizedProps,\r\n\t\tkey,\r\n\t\tref,\r\n\t\t_children: null,\r\n\t\t_parent: null,\r\n\t\t_depth: 0,\r\n\t\t_dom: null,\r\n\t\t_nextDom: undefined,\r\n\t\t_component: null,\r\n\t\tconstructor: undefined,\r\n\t\t_original: --vnodeId,\r\n\t\t_index: -1,\r\n\t\t_flags: 0,\r\n\t\t__source,\r\n\t\t__self\r\n\t};\r\n\r\n\t// If a Component VNode, check for and apply defaultProps.\r\n\t// Note: `type` is often a String, and can be `undefined` in development.\r\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\r\n\t\tfor (i in ref)\r\n\t\t\tif (typeof normalizedProps[i] === 'undefined') {\r\n\t\t\t\tnormalizedProps[i] = ref[i];\r\n\t\t\t}\r\n\t}\r\n\r\n\tif (options.vnode) options.vnode(vnode);\r\n\treturn vnode;\r\n}\r\n\r\n/**\r\n * Create a template vnode. This function is not expected to be\r\n * used directly, but rather through a precompile JSX transform\r\n * @param {string[]} templates\r\n * @param {Array<string | null | VNode>} exprs\r\n * @returns {VNode}\r\n */\r\nfunction jsxTemplate(templates, ...exprs) {\r\n\tconst vnode = createVNode(Fragment, { tpl: templates, exprs });\r\n\t// Bypass render to string top level Fragment optimization\r\n\tvnode.key = vnode._vnode;\r\n\treturn vnode;\r\n}\r\n\r\nconst JS_TO_CSS = {};\r\nconst CSS_REGEX = /[A-Z]/g;\r\n\r\n/**\r\n * Serialize an HTML attribute to a string. This function is not\r\n * expected to be used directly, but rather through a precompile\r\n * JSX transform\r\n * @param {string} name The attribute name\r\n * @param {*} value The attribute value\r\n * @returns {string}\r\n */\r\nfunction jsxAttr(name, value) {\r\n\tif (options.attr) {\r\n\t\tconst result = options.attr(name, value);\r\n\t\tif (typeof result === 'string') return result;\r\n\t}\r\n\r\n\tif (name === 'ref' || name === 'key') return '';\r\n\tif (name === 'style' && typeof value === 'object') {\r\n\t\tlet str = '';\r\n\t\tfor (let prop in value) {\r\n\t\t\tlet val = value[prop];\r\n\t\t\tif (val != null && val !== '') {\r\n\t\t\t\tconst name =\r\n\t\t\t\t\tprop[0] == '-'\r\n\t\t\t\t\t\t? prop\r\n\t\t\t\t\t\t: JS_TO_CSS[prop] ||\r\n\t\t\t\t\t\t\t(JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());\r\n\r\n\t\t\t\tlet suffix = ';';\r\n\t\t\t\tif (\r\n\t\t\t\t\ttypeof val === 'number' &&\r\n\t\t\t\t\t// Exclude custom-attributes\r\n\t\t\t\t\t!name.startsWith('--') &&\r\n\t\t\t\t\t!IS_NON_DIMENSIONAL.test(name)\r\n\t\t\t\t) {\r\n\t\t\t\t\tsuffix = 'px;';\r\n\t\t\t\t}\r\n\t\t\t\tstr = str + name + ':' + val + suffix;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn name + '=\"' + str + '\"';\r\n\t}\r\n\r\n\tif (\r\n\t\tvalue == null ||\r\n\t\tvalue === false ||\r\n\t\ttypeof value === 'function' ||\r\n\t\ttypeof value === 'object'\r\n\t) {\r\n\t\treturn '';\r\n\t} else if (value === true) return name;\r\n\r\n\treturn name + '=\"' + encodeEntities(value) + '\"';\r\n}\r\n\r\n/**\r\n * Escape a dynamic child passed to `jsxTemplate`. This function\r\n * is not expected to be used directly, but rather through a\r\n * precompile JSX transform\r\n * @param {*} value\r\n * @returns {string | null | VNode | Array<string | null | VNode>}\r\n */\r\nfunction jsxEscape(value) {\r\n\tif (\r\n\t\tvalue == null ||\r\n\t\ttypeof value === 'boolean' ||\r\n\t\ttypeof value === 'function'\r\n\t) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tif (typeof value === 'object') {\r\n\t\t// Check for VNode\r\n\t\tif (value.constructor === undefined) return value;\r\n\r\n\t\tif (isArray(value)) {\r\n\t\t\tfor (let i = 0; i < value.length; i++) {\r\n\t\t\t\tvalue[i] = jsxEscape(value[i]);\r\n\t\t\t}\r\n\t\t\treturn value;\r\n\t\t}\r\n\t}\r\n\r\n\treturn encodeEntities('' + value);\r\n}\r\n\r\nexport {\r\n\tcreateVNode as jsx,\r\n\tcreateVNode as jsxs,\r\n\tcreateVNode as jsxDEV,\r\n\tFragment,\r\n\t// precompiled JSX transform\r\n\tjsxTemplate,\r\n\tjsxAttr,\r\n\tjsxEscape\r\n};\r\n"],"names":["ENCODED_ENTITIES","encodeEntities","str","length","test","last","i","out","ch","charCodeAt","slice","IS_NON_DIMENSIONAL","vnodeId","isArray","Array","createVNode","type","props","key","isStaticChildren","__source","__self","ref","normalizedProps","vnode","__k","__","__b","__e","__d","undefined","__c","constructor","__v","__i","__u","defaultProps","options","JS_TO_CSS","CSS_REGEX","name","value","attr","result","prop","val","replace","toLowerCase","suffix","startsWith","jsxEscape","templates","Fragment","tpl","exprs","call","arguments"],"mappings":"wBAAMA,EAAmB,QAGlB,SAASC,EAAeC,GAE9B,GAAmB,IAAfA,EAAIC,SAA+C,IAA/BH,EAAiBI,KAAKF,GAAgB,OAAOA,EAQrE,IANA,IAAIG,EAAO,EACVC,EAAI,EACJ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r){if(0===r.length||!1===t.test(r))return r;for(var e=0,n=0,o="",f="";n<r.length;n++){switch(r.charCodeAt(n)){case 34:f=""";break;case 38:f="&";break;case 60:f="<";break;default:continue}n!==e&&(o+=r.slice(e,n)),o+=f,e=n+1}return n!==e&&(o+=r.slice(e,n)),o}var o=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,f=0,i=Array.isArray;function u(e,t,n,o,i,u){t||(t={});var a,c,p=t;if("ref"in p)for(c in p={},t)"ref"==c?a=t[c]:p[c]=t[c];var l={type:e,props:p,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--f,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===p[c]&&(p[c]=a[c]);return r.vnode&&r.vnode(l),l}function a(r){var t=u(e,{tpl:r,exprs:[].slice.call(arguments,1)});return t.key=t.__v,t}var c={},p=/[A-Z]/g;function l(e,t){if(r.attr){var f=r.attr(e,t);if("string"==typeof f)return f}if("ref"===e||"key"===e)return"";if("style"===e&&"object"==typeof t){var i="";for(var u in t){var a=t[u];if(null!=a&&""!==a){var l="-"==u[0]?u:c[u]||(c[u]=u.replace(p,"-$&").toLowerCase()),_=";";"number"!=typeof a||l.startsWith("--")||o.test(l)||(_="px;"),i=i+l+":"+a+_}}return e+'="'+i+'"'}return null==t||!1===t||"function"==typeof t||"object"==typeof t?"":!0===t?e:e+'="'+n(t)+'"'}function _(r){if(null==r||"boolean"==typeof r||"function"==typeof r)return null;if("object"==typeof r){if(void 0===r.constructor)return r;if(i(r)){for(var e=0;e<r.length;e++)r[e]=_(r[e]);return r}}return n(""+r)}export{u as jsx,l as jsxAttr,u as jsxDEV,_ as jsxEscape,a as jsxTemplate,u as jsxs};
|
|
2
|
+
//# sourceMappingURL=jsxRuntime.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsxRuntime.module.js","sources":["../src/utils.js","../../src/constants.js","../src/index.js"],"sourcesContent":["const ENCODED_ENTITIES = /[\"&<]/;\r\n\r\n/** @param {string} str */\r\nexport function encodeEntities(str) {\r\n\t// Skip all work for strings with no entities needing encoding:\r\n\tif (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str;\r\n\r\n\tlet last = 0,\r\n\t\ti = 0,\r\n\t\tout = '',\r\n\t\tch = '';\r\n\r\n\t// Seek forward in str until the next entity char:\r\n\tfor (; i < str.length; i++) {\r\n\t\tswitch (str.charCodeAt(i)) {\r\n\t\t\tcase 34:\r\n\t\t\t\tch = '"';\r\n\t\t\t\tbreak;\r\n\t\t\tcase 38:\r\n\t\t\t\tch = '&';\r\n\t\t\t\tbreak;\r\n\t\t\tcase 60:\r\n\t\t\t\tch = '<';\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tcontinue;\r\n\t\t}\r\n\t\t// Append skipped/buffered characters and the encoded entity:\r\n\t\tif (i !== last) out += str.slice(last, i);\r\n\t\tout += ch;\r\n\t\t// Start the next seek/buffer after the entity's offset:\r\n\t\tlast = i + 1;\r\n\t}\r\n\tif (i !== last) out += str.slice(last, i);\r\n\treturn out;\r\n}\r\n","/** Normal hydration that attaches to a DOM tree but does not diff it. */\r\nexport const MODE_HYDRATE = 1 << 5;\r\n/** Signifies this VNode suspended on the previous render */\r\nexport const MODE_SUSPENDED = 1 << 7;\r\n/** Indicates that this node needs to be inserted while patching children */\r\nexport const INSERT_VNODE = 1 << 16;\r\n/** Indicates a VNode has been matched with another VNode in the diff */\r\nexport const MATCHED = 1 << 17;\r\n\r\n/** Reset all mode flags */\r\nexport const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);\r\n\r\nexport const EMPTY_OBJ = /** @type {any} */ ({});\r\nexport const EMPTY_ARR = [];\r\nexport const IS_NON_DIMENSIONAL =\r\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\r\n","import { options, Fragment } from 'preact';\r\nimport { encodeEntities } from './utils';\r\nimport { IS_NON_DIMENSIONAL } from '../../src/constants';\r\n\r\nlet vnodeId = 0;\r\n\r\nconst isArray = Array.isArray;\r\n\r\n/**\r\n * @fileoverview\r\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\r\n * - jsx(type, props, key)\r\n * - jsxs(type, props, key)\r\n * - jsxDEV(type, props, key, __source, __self)\r\n *\r\n * The implementation of createVNode here is optimized for performance.\r\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\r\n */\r\n\r\n/**\r\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\r\n * @param {VNode['type']} type\r\n * @param {VNode['props']} props\r\n * @param {VNode['key']} [key]\r\n * @param {unknown} [isStaticChildren]\r\n * @param {unknown} [__source]\r\n * @param {unknown} [__self]\r\n */\r\nfunction createVNode(type, props, key, isStaticChildren, __source, __self) {\r\n\tif (!props) props = {};\r\n\t// We'll want to preserve `ref` in props to get rid of the need for\r\n\t// forwardRef components in the future, but that should happen via\r\n\t// a separate PR.\r\n\tlet normalizedProps = props,\r\n\t\tref,\r\n\t\ti;\r\n\r\n\tif ('ref' in normalizedProps) {\r\n\t\tnormalizedProps = {};\r\n\t\tfor (i in props) {\r\n\t\t\tif (i == 'ref') {\r\n\t\t\t\tref = props[i];\r\n\t\t\t} else {\r\n\t\t\t\tnormalizedProps[i] = props[i];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/** @type {VNode & { __source: any; __self: any }} */\r\n\tconst vnode = {\r\n\t\ttype,\r\n\t\tprops: normalizedProps,\r\n\t\tkey,\r\n\t\tref,\r\n\t\t_children: null,\r\n\t\t_parent: null,\r\n\t\t_depth: 0,\r\n\t\t_dom: null,\r\n\t\t_nextDom: undefined,\r\n\t\t_component: null,\r\n\t\tconstructor: undefined,\r\n\t\t_original: --vnodeId,\r\n\t\t_index: -1,\r\n\t\t_flags: 0,\r\n\t\t__source,\r\n\t\t__self\r\n\t};\r\n\r\n\t// If a Component VNode, check for and apply defaultProps.\r\n\t// Note: `type` is often a String, and can be `undefined` in development.\r\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\r\n\t\tfor (i in ref)\r\n\t\t\tif (typeof normalizedProps[i] === 'undefined') {\r\n\t\t\t\tnormalizedProps[i] = ref[i];\r\n\t\t\t}\r\n\t}\r\n\r\n\tif (options.vnode) options.vnode(vnode);\r\n\treturn vnode;\r\n}\r\n\r\n/**\r\n * Create a template vnode. This function is not expected to be\r\n * used directly, but rather through a precompile JSX transform\r\n * @param {string[]} templates\r\n * @param {Array<string | null | VNode>} exprs\r\n * @returns {VNode}\r\n */\r\nfunction jsxTemplate(templates, ...exprs) {\r\n\tconst vnode = createVNode(Fragment, { tpl: templates, exprs });\r\n\t// Bypass render to string top level Fragment optimization\r\n\tvnode.key = vnode._vnode;\r\n\treturn vnode;\r\n}\r\n\r\nconst JS_TO_CSS = {};\r\nconst CSS_REGEX = /[A-Z]/g;\r\n\r\n/**\r\n * Serialize an HTML attribute to a string. This function is not\r\n * expected to be used directly, but rather through a precompile\r\n * JSX transform\r\n * @param {string} name The attribute name\r\n * @param {*} value The attribute value\r\n * @returns {string}\r\n */\r\nfunction jsxAttr(name, value) {\r\n\tif (options.attr) {\r\n\t\tconst result = options.attr(name, value);\r\n\t\tif (typeof result === 'string') return result;\r\n\t}\r\n\r\n\tif (name === 'ref' || name === 'key') return '';\r\n\tif (name === 'style' && typeof value === 'object') {\r\n\t\tlet str = '';\r\n\t\tfor (let prop in value) {\r\n\t\t\tlet val = value[prop];\r\n\t\t\tif (val != null && val !== '') {\r\n\t\t\t\tconst name =\r\n\t\t\t\t\tprop[0] == '-'\r\n\t\t\t\t\t\t? prop\r\n\t\t\t\t\t\t: JS_TO_CSS[prop] ||\r\n\t\t\t\t\t\t\t(JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());\r\n\r\n\t\t\t\tlet suffix = ';';\r\n\t\t\t\tif (\r\n\t\t\t\t\ttypeof val === 'number' &&\r\n\t\t\t\t\t// Exclude custom-attributes\r\n\t\t\t\t\t!name.startsWith('--') &&\r\n\t\t\t\t\t!IS_NON_DIMENSIONAL.test(name)\r\n\t\t\t\t) {\r\n\t\t\t\t\tsuffix = 'px;';\r\n\t\t\t\t}\r\n\t\t\t\tstr = str + name + ':' + val + suffix;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn name + '=\"' + str + '\"';\r\n\t}\r\n\r\n\tif (\r\n\t\tvalue == null ||\r\n\t\tvalue === false ||\r\n\t\ttypeof value === 'function' ||\r\n\t\ttypeof value === 'object'\r\n\t) {\r\n\t\treturn '';\r\n\t} else if (value === true) return name;\r\n\r\n\treturn name + '=\"' + encodeEntities(value) + '\"';\r\n}\r\n\r\n/**\r\n * Escape a dynamic child passed to `jsxTemplate`. This function\r\n * is not expected to be used directly, but rather through a\r\n * precompile JSX transform\r\n * @param {*} value\r\n * @returns {string | null | VNode | Array<string | null | VNode>}\r\n */\r\nfunction jsxEscape(value) {\r\n\tif (\r\n\t\tvalue == null ||\r\n\t\ttypeof value === 'boolean' ||\r\n\t\ttypeof value === 'function'\r\n\t) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tif (typeof value === 'object') {\r\n\t\t// Check for VNode\r\n\t\tif (value.constructor === undefined) return value;\r\n\r\n\t\tif (isArray(value)) {\r\n\t\t\tfor (let i = 0; i < value.length; i++) {\r\n\t\t\t\tvalue[i] = jsxEscape(value[i]);\r\n\t\t\t}\r\n\t\t\treturn value;\r\n\t\t}\r\n\t}\r\n\r\n\treturn encodeEntities('' + value);\r\n}\r\n\r\nexport {\r\n\tcreateVNode as jsx,\r\n\tcreateVNode as jsxs,\r\n\tcreateVNode as jsxDEV,\r\n\tFragment,\r\n\t// precompiled JSX transform\r\n\tjsxTemplate,\r\n\tjsxAttr,\r\n\tjsxEscape\r\n};\r\n"],"names":["ENCODED_ENTITIES","encodeEntities","str","length","test","last","i","out","ch","charCodeAt","slice","IS_NON_DIMENSIONAL","vnodeId","isArray","Array","createVNode","type","props","key","isStaticChildren","__source","__self","ref","normalizedProps","vnode","__k","__","__b","__e","__d","undefined","__c","constructor","__v","__i","__u","defaultProps","options","jsxTemplate","templates","Fragment","tpl","exprs","call","arguments","JS_TO_CSS","CSS_REGEX","jsxAttr","name","value","attr","result","prop","val","replace","toLowerCase","suffix","startsWith","jsxEscape"],"mappings":"4EAAA,IAAMA,EAAmB,QAGlB,SAASC,EAAeC,GAE9B,GAAmB,IAAfA,EAAIC,SAA+C,IAA/BH,EAAiBI,KAAKF,GAAgB,OAAOA,EAQrE,IANA,IAAIG,EAAO,EACVC,EAAI,EACJC,EAAM,GACNC,EAAK,GAGCF,EAAIJ,EAAIC,OAAQG,IAAK,CAC3B,OAAQJ,EAAIO,WAAWH,IACtB,KAAK,GACJE,EAAK,SACL,MACD,KAAO,GACNA,EAAK,QACL,MACD,KAAK,GACJA,EAAK,OACL,MACD,QACC,SAGEF,IAAMD,IAAME,GAAOL,EAAIQ,MAAML,EAAMC,IACvCC,GAAOC,EAEPH,EAAOC,EAAI,CACZ,CAEA,OADIA,IAAMD,IAAME,GAAOL,EAAIQ,MAAML,EAAMC,IAChCC,CACR,CCrBO,IAAMI,EACZ,oECXGC,EAAU,EAERC,EAAUC,MAAMD,QAsBtB,SAASE,EAAYC,EAAMC,EAAOC,EAAKC,EAAkBC,EAAUC,GAC7DJ,IAAOA,EAAQ,CAAA,GAIpB,IACCK,EACAhB,EAFGiB,EAAkBN,EAItB,GAAI,QAASM,EAEZ,IAAKjB,KADLiB,EAAkB,CAAE,EACVN,EACA,OAALX,EACHgB,EAAML,EAAMX,GAEZiB,EAAgBjB,GAAKW,EAAMX,GAM9B,IAAMkB,EAAQ,CACbR,KAAAA,EACAC,MAAOM,EACPL,IAAAA,EACAI,IAAAA,EACAG,IAAW,KACXC,GAAS,KACTC,IAAQ,EACRC,IAAM,KACNC,SAAUC,EACVC,IAAY,KACZC,iBAA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U,MAATA,GACiB,kBAAVA,GACU,mBAAVA,EAEP,OACD,KAEA,GAAqB,iBAAVA,EAAoB,CAE9B,QAA0BnB,IAAtBmB,EAAMjB,YAA2B,OAAOiB,EAE5C,GAAIpC,EAAQoC,GAAQ,CACnB,IAAK,IAAI3C,EAAI,EAAGA,EAAI2C,EAAM9C,OAAQG,IACjC2C,EAAM3C,GAAKoD,EAAUT,EAAM3C,IAE5B,OAAO2C,CACR,CACD,CAEA,OAAOhD,EAAe,GAAKgD,EAC5B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],r):r((e||self).jsxRuntime={},e.preact)}(this,function(e,r){var n=/["&<]/;function t(e){if(0===e.length||!1===n.test(e))return e;for(var r=0,t=0,o="",f="";t<e.length;t++){switch(e.charCodeAt(t)){case 34:f=""";break;case 38:f="&";break;case 60:f="<";break;default:continue}t!==r&&(o+=e.slice(r,t)),o+=f,r=t+1}return t!==r&&(o+=e.slice(r,t)),o}var o=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,f=0,i=Array.isArray;function u(e,n,t,o,i,u){n||(n={});var a,c,l=n;if("ref"in l)for(c in l={},n)"ref"==c?a=n[c]:l[c]=n[c];var p={type:e,props:l,key:t,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--f,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(a=e.defaultProps))for(c in a)void 0===l[c]&&(l[c]=a[c]);return r.options.vnode&&r.options.vnode(p),p}var a={},c=/[A-Z]/g;Object.defineProperty(e,"Fragment",{enumerable:!0,get:function(){return r.Fragment}}),e.jsx=u,e.jsxAttr=function(e,n){if(r.options.attr){var f=r.options.attr(e,n);if("string"==typeof f)return f}if("ref"===e||"key"===e)return"";if("style"===e&&"object"==typeof n){var i="";for(var u in n){var l=n[u];if(null!=l&&""!==l){var p="-"==u[0]?u:a[u]||(a[u]=u.replace(c,"-$&").toLowerCase()),_=";";"number"!=typeof l||p.startsWith("--")||o.test(p)||(_="px;"),i=i+p+":"+l+_}}return e+'="'+i+'"'}return null==n||!1===n||"function"==typeof n||"object"==typeof n?"":!0===n?e:e+'="'+t(n)+'"'},e.jsxDEV=u,e.jsxEscape=function e(r){if(null==r||"boolean"==typeof r||"function"==typeof r)return null;if("object"==typeof r){if(void 0===r.constructor)return r;if(i(r)){for(var n=0;n<r.length;n++)r[n]=e(r[n]);return r}}return t(""+r)},e.jsxTemplate=function(e){var n=u(r.Fragment,{tpl:e,exprs:[].slice.call(arguments,1)});return n.key=n.__v,n},e.jsxs=u});
|
|
2
|
+
//# sourceMappingURL=jsxRuntime.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsxRuntime.umd.js","sources":["../src/utils.js","../../src/constants.js","../src/index.js"],"sourcesContent":["const ENCODED_ENTITIES = /[\"&<]/;\r\n\r\n/** @param {string} str */\r\nexport function encodeEntities(str) {\r\n\t// Skip all work for strings with no entities needing encoding:\r\n\tif (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str;\r\n\r\n\tlet last = 0,\r\n\t\ti = 0,\r\n\t\tout = '',\r\n\t\tch = '';\r\n\r\n\t// Seek forward in str until the next entity char:\r\n\tfor (; i < str.length; i++) {\r\n\t\tswitch (str.charCodeAt(i)) {\r\n\t\t\tcase 34:\r\n\t\t\t\tch = '"';\r\n\t\t\t\tbreak;\r\n\t\t\tcase 38:\r\n\t\t\t\tch = '&';\r\n\t\t\t\tbreak;\r\n\t\t\tcase 60:\r\n\t\t\t\tch = '<';\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tcontinue;\r\n\t\t}\r\n\t\t// Append skipped/buffered characters and the encoded entity:\r\n\t\tif (i !== last) out += str.slice(last, i);\r\n\t\tout += ch;\r\n\t\t// Start the next seek/buffer after the entity's offset:\r\n\t\tlast = i + 1;\r\n\t}\r\n\tif (i !== last) out += str.slice(last, i);\r\n\treturn out;\r\n}\r\n","/** Normal hydration that attaches to a DOM tree but does not diff it. */\r\nexport const MODE_HYDRATE = 1 << 5;\r\n/** Signifies this VNode suspended on the previous render */\r\nexport const MODE_SUSPENDED = 1 << 7;\r\n/** Indicates that this node needs to be inserted while patching children */\r\nexport const INSERT_VNODE = 1 << 16;\r\n/** Indicates a VNode has been matched with another VNode in the diff */\r\nexport const MATCHED = 1 << 17;\r\n\r\n/** Reset all mode flags */\r\nexport const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);\r\n\r\nexport const EMPTY_OBJ = /** @type {any} */ ({});\r\nexport const EMPTY_ARR = [];\r\nexport const IS_NON_DIMENSIONAL =\r\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\r\n","import { options, Fragment } from 'preact';\r\nimport { encodeEntities } from './utils';\r\nimport { IS_NON_DIMENSIONAL } from '../../src/constants';\r\n\r\nlet vnodeId = 0;\r\n\r\nconst isArray = Array.isArray;\r\n\r\n/**\r\n * @fileoverview\r\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\r\n * - jsx(type, props, key)\r\n * - jsxs(type, props, key)\r\n * - jsxDEV(type, props, key, __source, __self)\r\n *\r\n * The implementation of createVNode here is optimized for performance.\r\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\r\n */\r\n\r\n/**\r\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\r\n * @param {VNode['type']} type\r\n * @param {VNode['props']} props\r\n * @param {VNode['key']} [key]\r\n * @param {unknown} [isStaticChildren]\r\n * @param {unknown} [__source]\r\n * @param {unknown} [__self]\r\n */\r\nfunction createVNode(type, props, key, isStaticChildren, __source, __self) {\r\n\tif (!props) props = {};\r\n\t// We'll want to preserve `ref` in props to get rid of the need for\r\n\t// forwardRef components in the future, but that should happen via\r\n\t// a separate PR.\r\n\tlet normalizedProps = props,\r\n\t\tref,\r\n\t\ti;\r\n\r\n\tif ('ref' in normalizedProps) {\r\n\t\tnormalizedProps = {};\r\n\t\tfor (i in props) {\r\n\t\t\tif (i == 'ref') {\r\n\t\t\t\tref = props[i];\r\n\t\t\t} else {\r\n\t\t\t\tnormalizedProps[i] = props[i];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/** @type {VNode & { __source: any; __self: any }} */\r\n\tconst vnode = {\r\n\t\ttype,\r\n\t\tprops: normalizedProps,\r\n\t\tkey,\r\n\t\tref,\r\n\t\t_children: null,\r\n\t\t_parent: null,\r\n\t\t_depth: 0,\r\n\t\t_dom: null,\r\n\t\t_nextDom: undefined,\r\n\t\t_component: null,\r\n\t\tconstructor: undefined,\r\n\t\t_original: --vnodeId,\r\n\t\t_index: -1,\r\n\t\t_flags: 0,\r\n\t\t__source,\r\n\t\t__self\r\n\t};\r\n\r\n\t// If a Component VNode, check for and apply defaultProps.\r\n\t// Note: `type` is often a String, and can be `undefined` in development.\r\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\r\n\t\tfor (i in ref)\r\n\t\t\tif (typeof normalizedProps[i] === 'undefined') {\r\n\t\t\t\tnormalizedProps[i] = ref[i];\r\n\t\t\t}\r\n\t}\r\n\r\n\tif (options.vnode) options.vnode(vnode);\r\n\treturn vnode;\r\n}\r\n\r\n/**\r\n * Create a template vnode. This function is not expected to be\r\n * used directly, but rather through a precompile JSX transform\r\n * @param {string[]} templates\r\n * @param {Array<string | null | VNode>} exprs\r\n * @returns {VNode}\r\n */\r\nfunction jsxTemplate(templates, ...exprs) {\r\n\tconst vnode = createVNode(Fragment, { tpl: templates, exprs });\r\n\t// Bypass render to string top level Fragment optimization\r\n\tvnode.key = vnode._vnode;\r\n\treturn vnode;\r\n}\r\n\r\nconst JS_TO_CSS = {};\r\nconst CSS_REGEX = /[A-Z]/g;\r\n\r\n/**\r\n * Serialize an HTML attribute to a string. This function is not\r\n * expected to be used directly, but rather through a precompile\r\n * JSX transform\r\n * @param {string} name The attribute name\r\n * @param {*} value The attribute value\r\n * @returns {string}\r\n */\r\nfunction jsxAttr(name, value) {\r\n\tif (options.attr) {\r\n\t\tconst result = options.attr(name, value);\r\n\t\tif (typeof result === 'string') return result;\r\n\t}\r\n\r\n\tif (name === 'ref' || name === 'key') return '';\r\n\tif (name === 'style' && typeof value === 'object') {\r\n\t\tlet str = '';\r\n\t\tfor (let prop in value) {\r\n\t\t\tlet val = value[prop];\r\n\t\t\tif (val != null && val !== '') {\r\n\t\t\t\tconst name =\r\n\t\t\t\t\tprop[0] == '-'\r\n\t\t\t\t\t\t? prop\r\n\t\t\t\t\t\t: JS_TO_CSS[prop] ||\r\n\t\t\t\t\t\t\t(JS_TO_CSS[prop] = prop.replace(CSS_REGEX, '-$&').toLowerCase());\r\n\r\n\t\t\t\tlet suffix = ';';\r\n\t\t\t\tif (\r\n\t\t\t\t\ttypeof val === 'number' &&\r\n\t\t\t\t\t// Exclude custom-attributes\r\n\t\t\t\t\t!name.startsWith('--') &&\r\n\t\t\t\t\t!IS_NON_DIMENSIONAL.test(name)\r\n\t\t\t\t) {\r\n\t\t\t\t\tsuffix = 'px;';\r\n\t\t\t\t}\r\n\t\t\t\tstr = str + name + ':' + val + suffix;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn name + '=\"' + str + '\"';\r\n\t}\r\n\r\n\tif (\r\n\t\tvalue == null ||\r\n\t\tvalue === false ||\r\n\t\ttypeof value === 'function' ||\r\n\t\ttypeof value === 'object'\r\n\t) {\r\n\t\treturn '';\r\n\t} else if (value === true) return name;\r\n\r\n\treturn name + '=\"' + encodeEntities(value) + '\"';\r\n}\r\n\r\n/**\r\n * Escape a dynamic child passed to `jsxTemplate`. This function\r\n * is not expected to be used directly, but rather through a\r\n * precompile JSX transform\r\n * @param {*} value\r\n * @returns {string | null | VNode | Array<string | null | VNode>}\r\n */\r\nfunction jsxEscape(value) {\r\n\tif (\r\n\t\tvalue == null ||\r\n\t\ttypeof value === 'boolean' ||\r\n\t\ttypeof value === 'function'\r\n\t) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tif (typeof value === 'object') {\r\n\t\t// Check for VNode\r\n\t\tif (value.constructor === undefined) return value;\r\n\r\n\t\tif (isArray(value)) {\r\n\t\t\tfor (let i = 0; i < value.length; i++) {\r\n\t\t\t\tvalue[i] = jsxEscape(value[i]);\r\n\t\t\t}\r\n\t\t\treturn value;\r\n\t\t}\r\n\t}\r\n\r\n\treturn encodeEntities('' + value);\r\n}\r\n\r\nexport {\r\n\tcreateVNode as jsx,\r\n\tcreateVNode as jsxs,\r\n\tcreateVNode as jsxDEV,\r\n\tFragment,\r\n\t// precompiled JSX transform\r\n\tjsxTemplate,\r\n\tjsxAttr,\r\n\tjsxEscape\r\n};\r\n"],"names":["ENCODED_ENTITIES","encodeEntities","str","length","test","last","i","out","ch","charCodeAt","slice","IS_NON_DIMENSIONAL","vnodeId","isArray","Array","createVNode","type","props","key","isStaticChildren","__source","__self","ref","normalizedProps","vnode","__k","__","__b","__e","__d","undefined","__c","constructor","__v","__i","__u","defaultProps","options","JS_TO_CSS","CSS_REGEX","name","value","attr","result","prop","val","replace","toLowerCase","suffix","startsWith","jsxEscape","templates","Fragment","tpl","exprs","call","arguments"],"mappings":"0QAAA,IAAMA,EAAmB,QAGlB,SAASC,EAAeC,GAE9B,GAAmB,IAAfA,EAAIC,SAA+C,IAA/BH,EAAiBI,KAAKF,GAAgB,OAAOA,EAQrE,IANA,IAAIG,EAAO,EACVC,EAAI,EACJC,EAAM,GACNC,EAAK,GAGCF,EAAIJ,EAAIC,OAAQG,IAAK,CAC3B,OAAQJ,EAAIO,WAAWH,IACtB,KAAK,GACJE,EAAK,SACL,MACD,KAAO,GACNA,EAAK,QACL,MACD,KAAK,GACJA,EAAK,OACL,MACD,QACC,SAGEF,IAAMD,IAAME,GAAOL,EAAIQ,MAAML,EAAMC,IACvCC,GAAOC,EAEPH,EAAOC,E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,EACAN,EAAUM,KACVN,EAAUM,GAAQA,EAAKE,QAAQP,EAAW,OAAOQ,eAEjDC,EAAS,IAEG,iBAARH,GAENL,EAAKS,WAAW,OAChBtC,EAAmBP,KAAKoC,KAEzBQ,EAAS,OAEV9C,EAAMA,EAAMsC,EAAO,IAAMK,EAAMG,CAChC,CACD,CACA,OAAOR,EAAO,KAAOtC,EAAM,GAC5B,CAEA,OACU,MAATuC,IACU,IAAVA,GACiB,mBAAVA,GACU,iBAAVA,EAEA,IACa,IAAVA,EAAuBD,EAE3BA,EAAO,KAAOvC,EAAewC,GAAS,GAC9C,yBASA,SAASS,EAAUT,GAClB,GACU,MAATA,GACiB,kBAAVA,GACU,mBAAVA,EAEP,OACD,KAEA,GAAqB,iBAAVA,EAAoB,CAE9B,QAA0BX,IAAtBW,EAAMT,YAA2B,OAAOS,EAE5C,GAAI5B,EAAQ4B,GAAQ,CACnB,IAAK,IAAInC,EAAI,EAAGA,EAAImC,EAAMtC,OAAQG,IACjCmC,EAAMnC,GAAK4C,EAAUT,EAAMnC,IAE5B,OAAOmC,CACR,CACD,CAEA,OAAOxC,EAAe,GAAKwC,EAC5B,gBA5FA,SAAqBU,GACpB,IAAM3B,EAAQT,EAAYqC,EAAQA,SAAE,CAAEC,IAAKF,EAAWG,MAAK5C,GAAAA,MAAA6C,KAAAC,UAAA,KAG3D,OADAhC,EAAMN,IAAMM,EAAKS,IACVT,CACR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wiajs/core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.23",
|
|
4
4
|
"description": "wia app core package",
|
|
5
5
|
"main": "./dist/core.cjs",
|
|
6
6
|
"module": "./dist/core.mjs",
|
|
@@ -12,8 +12,14 @@
|
|
|
12
12
|
"import": "./dist/core.mjs",
|
|
13
13
|
"default": "./dist/core.mjs"
|
|
14
14
|
},
|
|
15
|
-
"./jsx-runtime":
|
|
16
|
-
|
|
15
|
+
"./jsx-runtime": {
|
|
16
|
+
"types": "./dist/jsxRuntime.d.ts",
|
|
17
|
+
"default": "./dist/jsx-runtime.js"
|
|
18
|
+
},
|
|
19
|
+
"./jsx-dev-runtime": {
|
|
20
|
+
"types": "./dist/jsxRuntime.d.ts",
|
|
21
|
+
"default": "./dist/jsx-runtime.js"
|
|
22
|
+
},
|
|
17
23
|
"./util/*": [
|
|
18
24
|
"./util/*.js",
|
|
19
25
|
"./util/*.d.ts"
|
package/dist/jsx-dev-runtime.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* wia core v1.1.20
|
|
3
|
-
* (c) 2015-2024 Sibyl Yu and contributors
|
|
4
|
-
* Released under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
-
|
|
10
|
-
var jsxDevRuntime = {};
|
|
11
|
-
|
|
12
|
-
const svgNs = 'http://www.w3.org/2000/svg';
|
|
13
|
-
const mathmlNs = 'http://www.w3.org/1998/Math/MathML';
|
|
14
|
-
const properties = new Set(['value']);
|
|
15
|
-
const internalKeys = new Set(['_', 'children', 'ref']);
|
|
16
|
-
const extensions = new Map([['style', (node, value, key) => {
|
|
17
|
-
if ('string' == typeof value) {
|
|
18
|
-
node.setAttribute(key, value);
|
|
19
|
-
} else {
|
|
20
|
-
for (key in value) {
|
|
21
|
-
if (key.startsWith('-')) {
|
|
22
|
-
node.style.setProperty(key, value[key]);
|
|
23
|
-
} else {
|
|
24
|
-
node.style[key] = value[key];
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}], ['$', (node, value, key) => {
|
|
29
|
-
for (key in value) {
|
|
30
|
-
node.addEventListener(key, value[key]);
|
|
31
|
-
}
|
|
32
|
-
}]]);
|
|
33
|
-
const appendChildren = (content, node) => Array.isArray(content) ? content.some(i => appendChildren(i, node)) : false !== content && null != content && node.append(content);
|
|
34
|
-
const Fragment = content => (appendChildren(content, content = new DocumentFragment()), content);
|
|
35
|
-
const jsx = (tag, props) => {
|
|
36
|
-
let key,
|
|
37
|
-
value,
|
|
38
|
-
node = props._ ? document.createElementNS(props._, tag) : document.createElement(tag, props.is ? {
|
|
39
|
-
is: props.is
|
|
40
|
-
} : key);
|
|
41
|
-
for (key in props) {
|
|
42
|
-
if (!internalKeys.has(key)) {
|
|
43
|
-
value = props[key];
|
|
44
|
-
if (extensions.has(key)) {
|
|
45
|
-
extensions.get(key)(node, value, key);
|
|
46
|
-
} else if (properties.has(key) || key.startsWith('on')) {
|
|
47
|
-
node[key] = value;
|
|
48
|
-
} else if (null != value) {
|
|
49
|
-
if ('boolean' != typeof value || key.startsWith('-', 4)) {
|
|
50
|
-
node.setAttribute(key, value);
|
|
51
|
-
} else if (value) {
|
|
52
|
-
node.setAttribute(key, '');
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
appendChildren(props.children, 'template' == tag ? node.content : node);
|
|
58
|
-
if (value = props.ref) {
|
|
59
|
-
if ('function' == typeof value) {
|
|
60
|
-
value(node);
|
|
61
|
-
} else {
|
|
62
|
-
value.current = node;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return node;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const useRef = current => ({
|
|
69
|
-
current
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const parseFromString = html => jsx('template', {
|
|
73
|
-
ref(node) {
|
|
74
|
-
node.innerHTML = html;
|
|
75
|
-
}
|
|
76
|
-
}).content;
|
|
77
|
-
const Template = props => /*#__PURE__*/parseFromString(props.children);
|
|
78
|
-
|
|
79
|
-
const useText = initContent => {
|
|
80
|
-
const text = new Text(initContent);
|
|
81
|
-
return [text, content => {
|
|
82
|
-
if (initContent !== content) {
|
|
83
|
-
text.textContent = initContent = content;
|
|
84
|
-
}
|
|
85
|
-
}];
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
var Fragment_1 = jsxDevRuntime.Fragment = Fragment;
|
|
89
|
-
var Template_1 = jsxDevRuntime.Template = Template;
|
|
90
|
-
var appendChildren_1 = jsxDevRuntime.appendChildren = appendChildren;
|
|
91
|
-
var extensions_1 = jsxDevRuntime.extensions = extensions;
|
|
92
|
-
var jsxDEV = jsxDevRuntime.jsxDEV = jsx;
|
|
93
|
-
var mathmlNs_1 = jsxDevRuntime.mathmlNs = mathmlNs;
|
|
94
|
-
var parseFromString_1 = jsxDevRuntime.parseFromString = parseFromString;
|
|
95
|
-
var properties_1 = jsxDevRuntime.properties = properties;
|
|
96
|
-
var svgNs_1 = jsxDevRuntime.svgNs = svgNs;
|
|
97
|
-
var useRef_1 = jsxDevRuntime.useRef = useRef;
|
|
98
|
-
var useText_1 = jsxDevRuntime.useText = useText;
|
|
99
|
-
|
|
100
|
-
exports.Fragment = Fragment_1;
|
|
101
|
-
exports.Template = Template_1;
|
|
102
|
-
exports.appendChildren = appendChildren_1;
|
|
103
|
-
exports.default = jsxDevRuntime;
|
|
104
|
-
exports.extensions = extensions_1;
|
|
105
|
-
exports.jsxDEV = jsxDEV;
|
|
106
|
-
exports.mathmlNs = mathmlNs_1;
|
|
107
|
-
exports.parseFromString = parseFromString_1;
|
|
108
|
-
exports.properties = properties_1;
|
|
109
|
-
exports.svgNs = svgNs_1;
|
|
110
|
-
exports.useRef = useRef_1;
|
|
111
|
-
exports.useText = useText_1;
|