@wiajs/core 1.1.20 → 1.1.22

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/core.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wia core v1.1.19
2
+ * wia core v1.1.20
3
3
  * (c) 2015-2024 Sibyl Yu and contributors
4
4
  * Released under the MIT License.
5
5
  */
package/dist/core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wia core v1.1.19
2
+ * wia core v1.1.20
3
3
  * (c) 2015-2024 Sibyl Yu and contributors
4
4
  * Released under the MIT License.
5
5
  */
package/dist/core.min.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * wia core v1.1.19
2
+ * wia core v1.1.20
3
3
  * (c) 2015-2024 Sibyl Yu and contributors
4
4
  * Released under the MIT License.
5
5
  */
6
6
  /*!
7
- * wia core v1.1.19
7
+ * wia core v1.1.20
8
8
  * (c) 2015-2024 Sibyl Yu and contributors
9
9
  * Released under the MIT License.
10
10
  */
package/dist/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wia core v1.1.19
2
+ * wia core v1.1.20
3
3
  * (c) 2015-2024 Sibyl Yu and contributors
4
4
  * Released under the MIT License.
5
5
  */
@@ -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="&quot;";break;case 38:f="&amp;";break;case 60:f="&lt;";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 = '&quot;';\r\n\t\t\t\tbreak;\r\n\t\t\tcase 38:\r\n\t\t\t\tch = '&amp;';\r\n\t\t\t\tbreak;\r\n\t\t\tcase 60:\r\n\t\t\t\tch = '&lt;';\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,EACJC,EAAM,GACNC,EAAK,GAGCF,EAAIJ,EAAIC,OAAQG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EAAgB,MAAO,GAC7C,GAAa,UAATA,GAAqC,iBAAVC,EAAoB,CAClD,IAAIvC,EAAM,GACV,IAAK,IAAI0C,KAAQH,EAAO,CACvB,IAAII,EAAMJ,EAAMG,GAChB,GAAW,MAAPC,GAAuB,KAARA,EAAY,CAC9B,IAAML,EACM,KAAXI,EAAK,GACFA,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,qCASA,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,sBA5FA,SAAqBU,GACpB,IAAM3B,EAAQT,EAAYqC,EAAQA,SAAE,CAAEC,IAAKF,EAAWG,MAAK5C,GAAAA,MAAA6C,KAAAC,UAAA,KAG3D,OADAhC,EAAMN,IAAMM,EAAKS,IACVT,CACR"}
@@ -0,0 +1,2 @@
1
+ import{options as r,Fragment as e}from"preact";export{Fragment}from"preact";var t=/["&<]/;function n(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="&quot;";break;case 38:f="&amp;";break;case 60:f="&lt;";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 = '&quot;';\r\n\t\t\t\tbreak;\r\n\t\t\tcase 38:\r\n\t\t\t\tch = '&amp;';\r\n\t\t\t\tbreak;\r\n\t\t\tcase 60:\r\n\t\t\t\tch = '&lt;';\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,iBAAaF,EACbG,MAAarB,EACbsB,KAAS,EACTC,IAAQ,EACRf,SAAAA,EACAC,O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AVA,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="&quot;";break;case 38:f="&amp;";break;case 60:f="&lt;";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 = '&quot;';\r\n\t\t\t\tbreak;\r\n\t\t\tcase 38:\r\n\t\t\t\tch = '&amp;';\r\n\t\t\t\tbreak;\r\n\t\t\tcase 60:\r\n\t\t\t\tch = '&lt;';\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,EAAI,CACZ,CAEA,OADIA,IAAMD,IAAME,GAAOL,EAAIQ,MAAML,EAAMC,IAChCC,CACR,C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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.20",
3
+ "version": "1.1.22",
4
4
  "description": "wia app core package",
5
5
  "main": "./dist/core.cjs",
6
6
  "module": "./dist/core.mjs",
@@ -12,8 +12,20 @@
12
12
  "import": "./dist/core.mjs",
13
13
  "default": "./dist/core.mjs"
14
14
  },
15
- "./jsx-runtime": "./dist/jsx-runtime.js",
16
- "./jsx-dev-runtime": "./dist/jsx-dev-runtime.js",
15
+ "./jsx-runtime": {
16
+ "types": "./dist/jsxRuntime.d.ts",
17
+ "browser": "./dist/jsxRuntime.module.js",
18
+ "umd": "./dist/jsxRuntime.umd.js",
19
+ "import": "./dist/jsxRuntime.mjs",
20
+ "require": "./dist/jsxRuntime.js"
21
+ },
22
+ "./jsx-dev-runtime": {
23
+ "types": "./dist/jsxRuntime.d.ts",
24
+ "browser": "./dist/jsxRuntime.module.js",
25
+ "umd": "./dist/jsxRuntime.umd.js",
26
+ "import": "./dist/jsxRuntime.mjs",
27
+ "require": "./dist/jsxRuntime.js"
28
+ },
17
29
  "./util/*": [
18
30
  "./util/*.js",
19
31
  "./util/*.d.ts"
@@ -1,43 +0,0 @@
1
- /*!
2
- * wia core v1.1.19
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
- var jsxDEV = jsxDevRuntime.jsxDEV = (tag, props, ...args) => {
13
- const attrs = props || {};
14
- const children = args || [];
15
-
16
- const attrsString = Object.keys(attrs)
17
- .map(attr => {
18
- if (attr[0] === '_') {
19
- if (attrs[attr]) return attr.replace('_', '');
20
- return '';
21
- }
22
- return `${attr}="${attrs[attr]}"`;
23
- })
24
- .filter(attr => !!attr)
25
- .join(' ');
26
-
27
- if (['path', 'img', 'circle', 'polygon', 'line', 'input'].indexOf(tag) >= 0) {
28
- return `<${tag} ${attrsString} />`.trim();
29
- }
30
- const childrenContent = children
31
- .filter(c => !!c)
32
- .map(c => (Array.isArray(c) ? c.join('') : c))
33
- .join('');
34
- return `<${tag} ${attrsString}>${childrenContent}</${tag}>`.trim();
35
- };
36
-
37
- var Fragment = jsxDevRuntime.Fragment = ({children} = {}) => {
38
- return '';
39
- };
40
-
41
- exports.Fragment = Fragment;
42
- exports.default = jsxDevRuntime;
43
- exports.jsxDEV = jsxDEV;
@@ -1,47 +0,0 @@
1
- /*!
2
- * wia core v1.1.19
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 jsxRuntime = {};
11
-
12
- function jsx(tag, props, ...args) {
13
- const attrs = props || {};
14
- const children = args || [];
15
-
16
- const attrsString = Object.keys(attrs)
17
- .map(attr => {
18
- if (attr[0] === '_') {
19
- if (attrs[attr]) return attr.replace('_', '');
20
- return '';
21
- }
22
- return `${attr}="${attrs[attr]}"`;
23
- })
24
- .filter(attr => !!attr)
25
- .join(' ');
26
-
27
- if (['path', 'img', 'circle', 'polygon', 'line', 'input'].indexOf(tag) >= 0) {
28
- return `<${tag} ${attrsString} />`.trim();
29
- }
30
- const childrenContent = children
31
- .filter(c => !!c)
32
- .map(c => (Array.isArray(c) ? c.join('') : c))
33
- .join('');
34
- return `<${tag} ${attrsString}>${childrenContent}</${tag}>`.trim();
35
- }
36
-
37
- var Fragment = jsxRuntime.Fragment = ({children} = {}) => {
38
- return '';
39
- };
40
-
41
- var jsx_1 = jsxRuntime.jsx = jsx;
42
- var jsxs = jsxRuntime.jsxs = jsx;
43
-
44
- exports.Fragment = Fragment;
45
- exports.default = jsxRuntime;
46
- exports.jsx = jsx_1;
47
- exports.jsxs = jsxs;