@takumi-rs/helpers 2.4.1 → 2.4.2

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/emoji.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-4kGcvc-Q.cjs"),t=/\uFE0F/g,n=/\p{Extended_Pictographic}/u,r=/^(?:\p{Regional_Indicator}){2}$/u,i=/^[#*0-9]\uFE0F?\u20E3$/u;function a(e){let n=e.indexOf(`‍`)<0?e.replace(t,``):e,r=``;for(let e=0,t=0;e<n.length;e++){let i=n.charCodeAt(e);if(t){let e=(65536+(t-55296<<10)+(i-56320)).toString(16);r+=(r?`-`:``)+e,t=0}else 55296<=i&&i<=56319?t=i:r+=(r?`-`:``)+i.toString(16)}return r}const o={twemoji:e=>`https://cdn.jsdelivr.net/gh/jdecked/twemoji@17.0.2/assets/svg/${e.toLowerCase()}.svg`,openmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/openmoji@2.0.0/svg/`,blobmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/blob@2.0.0/svg/`,noto:e=>`https://cdn.jsdelivr.net/gh/googlefonts/noto-emoji@v2.051/svg/emoji_u${e.toLowerCase().replaceAll(`-`,`_`)}.svg`,fluent:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_color.svg`,fluentFlat:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_flat.svg`};function s(e,t){let n=a(e),r=o[t];return typeof r==`function`?r(n):`${r}${n.toUpperCase()}.svg`}let c;function l(){return c===void 0&&(c=typeof Intl<`u`&&typeof Intl.Segmenter==`function`?new Intl.Segmenter(`en`,{granularity:`grapheme`}):null),c}function u(e){let t=l();return t?Array.from(t.segment(e)):Array.from(e).map(e=>({segment:e}))}function d(e){return n.test(e)||r.test(e)||i.test(e)}function f(t,n){let r=[],i=``,a=u(t.text);for(let{segment:t}of a)d(t)?(i&&=(r.push(e.l({text:i})),``),r.push(e.i({src:s(t,n),style:{display:`inline-block`,width:`1em`,height:`1em`,margin:`0 0.05em 0 0.1em`,verticalAlign:`-0.1em`}}))):i+=t;return i&&r.push(e.l({text:i})),r}function p(t,n){if(t.type===`text`){if(u(t.text).some(({segment:e})=>d(e))){let{type:r,...i}=t;return e.t({...i,children:f(t,n)})}}else if(t.type===`container`&&t.children)return{...t,children:t.children.map(e=>e&&p(e,n))};return t}exports.extractEmojis=p;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-4kGcvc-Q.cjs"),t=/\uFE0F/g,n=/\p{Extended_Pictographic}/u,r=/^(?:\p{Regional_Indicator}){2}$/u,i=/^[#*0-9]\uFE0F?\u20E3$/u;function a(e){return[...e.indexOf(`‍`)<0?e.replace(t,``):e].map(e=>e.codePointAt(0)?.toString(16)).join(`-`)}const o={twemoji:e=>`https://cdn.jsdelivr.net/gh/jdecked/twemoji@17.0.2/assets/svg/${e.toLowerCase()}.svg`,openmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/openmoji@2.0.0/svg/`,blobmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/blob@2.0.0/svg/`,noto:e=>`https://cdn.jsdelivr.net/gh/googlefonts/noto-emoji@v2.051/svg/emoji_u${e.toLowerCase().replaceAll(`-`,`_`)}.svg`,fluent:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_color.svg`,fluentFlat:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_flat.svg`};function s(e,t){let n=a(e),r=o[t];return typeof r==`function`?r(n):`${r}${n.toUpperCase()}.svg`}const c=new Intl.Segmenter(`en`,{granularity:`grapheme`});function l(e){return Array.from(c.segment(e))}function u(e){return n.test(e)||r.test(e)||i.test(e)}function d(t,n){let r=[],i=``,a=l(t.text);for(let{segment:t}of a)u(t)?(i&&=(r.push(e.l({text:i})),``),r.push(e.i({src:s(t,n),style:{display:`inline-block`,width:`1em`,height:`1em`,margin:`0 0.05em 0 0.1em`,verticalAlign:`-0.1em`}}))):i+=t;return i&&r.push(e.l({text:i})),r}function f(t,n){if(t.type===`text`){if(l(t.text).some(({segment:e})=>u(e))){let{type:r,...i}=t;return e.t({...i,children:d(t,n)})}}else if(t.type===`container`&&t.children)return{...t,children:t.children.map(e=>e&&f(e,n))};return t}exports.extractEmojis=f;
package/dist/emoji.mjs CHANGED
@@ -1 +1 @@
1
- import{i as e,l as t,t as n}from"./helpers-CVQCT1Rh.mjs";const r=/\uFE0F/g,i=/\p{Extended_Pictographic}/u,a=/^(?:\p{Regional_Indicator}){2}$/u,o=/^[#*0-9]\uFE0F?\u20E3$/u;function s(e){let t=e.indexOf(`‍`)<0?e.replace(r,``):e,n=``;for(let e=0,r=0;e<t.length;e++){let i=t.charCodeAt(e);if(r){let e=(65536+(r-55296<<10)+(i-56320)).toString(16);n+=(n?`-`:``)+e,r=0}else 55296<=i&&i<=56319?r=i:n+=(n?`-`:``)+i.toString(16)}return n}const c={twemoji:e=>`https://cdn.jsdelivr.net/gh/jdecked/twemoji@17.0.2/assets/svg/${e.toLowerCase()}.svg`,openmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/openmoji@2.0.0/svg/`,blobmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/blob@2.0.0/svg/`,noto:e=>`https://cdn.jsdelivr.net/gh/googlefonts/noto-emoji@v2.051/svg/emoji_u${e.toLowerCase().replaceAll(`-`,`_`)}.svg`,fluent:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_color.svg`,fluentFlat:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_flat.svg`};function l(e,t){let n=s(e),r=c[t];return typeof r==`function`?r(n):`${r}${n.toUpperCase()}.svg`}let u;function d(){return u===void 0&&(u=typeof Intl<`u`&&typeof Intl.Segmenter==`function`?new Intl.Segmenter(`en`,{granularity:`grapheme`}):null),u}function f(e){let t=d();return t?Array.from(t.segment(e)):Array.from(e).map(e=>({segment:e}))}function p(e){return i.test(e)||a.test(e)||o.test(e)}function m(n,r){let i=[],a=``,o=f(n.text);for(let{segment:n}of o)p(n)?(a&&=(i.push(t({text:a})),``),i.push(e({src:l(n,r),style:{display:`inline-block`,width:`1em`,height:`1em`,margin:`0 0.05em 0 0.1em`,verticalAlign:`-0.1em`}}))):a+=n;return a&&i.push(t({text:a})),i}function h(e,t){if(e.type===`text`){if(f(e.text).some(({segment:e})=>p(e))){let{type:r,...i}=e;return n({...i,children:m(e,t)})}}else if(e.type===`container`&&e.children)return{...e,children:e.children.map(e=>e&&h(e,t))};return e}export{h as extractEmojis};
1
+ import{i as e,l as t,t as n}from"./helpers-CVQCT1Rh.mjs";const r=/\uFE0F/g,i=/\p{Extended_Pictographic}/u,a=/^(?:\p{Regional_Indicator}){2}$/u,o=/^[#*0-9]\uFE0F?\u20E3$/u;function s(e){return[...e.indexOf(`‍`)<0?e.replace(r,``):e].map(e=>e.codePointAt(0)?.toString(16)).join(`-`)}const c={twemoji:e=>`https://cdn.jsdelivr.net/gh/jdecked/twemoji@17.0.2/assets/svg/${e.toLowerCase()}.svg`,openmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/openmoji@2.0.0/svg/`,blobmoji:`https://cdn.jsdelivr.net/npm/@svgmoji/blob@2.0.0/svg/`,noto:e=>`https://cdn.jsdelivr.net/gh/googlefonts/noto-emoji@v2.051/svg/emoji_u${e.toLowerCase().replaceAll(`-`,`_`)}.svg`,fluent:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_color.svg`,fluentFlat:e=>`https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${e.toLowerCase()}_flat.svg`};function l(e,t){let n=s(e),r=c[t];return typeof r==`function`?r(n):`${r}${n.toUpperCase()}.svg`}const u=new Intl.Segmenter(`en`,{granularity:`grapheme`});function d(e){return Array.from(u.segment(e))}function f(e){return i.test(e)||a.test(e)||o.test(e)}function p(n,r){let i=[],a=``,o=d(n.text);for(let{segment:n}of o)f(n)?(a&&=(i.push(t({text:a})),``),i.push(e({src:l(n,r),style:{display:`inline-block`,width:`1em`,height:`1em`,margin:`0 0.05em 0 0.1em`,verticalAlign:`-0.1em`}}))):a+=n;return a&&i.push(t({text:a})),i}function m(e,t){if(e.type===`text`){if(d(e.text).some(({segment:e})=>f(e))){let{type:r,...i}=e;return n({...i,children:p(e,t)})}}else if(e.type===`container`&&e.children)return{...e,children:e.children.map(e=>e&&m(e,t))};return e}export{m as extractEmojis};
package/dist/jsx.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-4kGcvc-Q.cjs"),t=require("./utils-Ko9FNHlu.cjs");let n;function r(e,t){return typeof e==`object`&&e&&t in e?e[t]:void 0}function i(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function a(e){let t=r(e,`__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE`);if(typeof t==`object`&&t&&`H`in t){let e=t;return{get:()=>e.H,set:t=>{e.H=t}}}let n=r(r(e,`__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED`),`ReactCurrentDispatcher`);if(typeof n==`object`&&n&&`current`in n){let e=n;return{get:()=>e.current,set:t=>{e.current=t}}}return null}function o(){return n??=import(`react`).then(e=>a(e.default??e)).catch(()=>null),n}function s(e,t){return e.contexts.has(t)?e.contexts.get(t):r(t,`_currentValue`)}const c=()=>{};function l(e,t){let n=t=>s(e,t),r=0;return{readContext:n,useContext:n,use:e=>{if(i(e)){if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:e}return n(e)},useState:e=>[typeof e==`function`?e():e,c],useReducer:(e,t,n)=>[n?n(t):t,c],useMemo:e=>e(),useCallback:e=>e,useRef:e=>({current:e}),useEffect:c,useLayoutEffect:c,useInsertionEffect:c,useImperativeHandle:c,useDebugValue:c,useDeferredValue:e=>e,useTransition:()=>[!1,c],useOptimistic:e=>[e,c],useActionState:(e,t)=>[t,c,!1],useSyncExternalStore:(e,t,n)=>(n??t)(),useId:()=>`:t${t}-${r++}:`,useCacheRefresh:()=>c,useHostTransitionStatus:()=>({pending:!1,data:null,method:null,action:null})}}async function u(e,t,n){let r=await o();if(!r)return e(t);let a=n.ids.current++;for(let o=0;;o++){let s=r.get();r.set(l(n,a));let c;try{return e(t)}catch(e){c=e}finally{r.set(s)}if(!i(c)||o>=64)throw c;await d(c)}}async function d(e){try{e.value=await e,e.status=`fulfilled`}catch(t){e.reason=t,e.status=`rejected`}}function f(e){return typeof e==`string`||typeof e==`number`}function p(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function m(e){let n=[];for(let r in e)Object.hasOwn(e,r)&&n.push(`${t.t(r)}:${String(e[r]).trim()}`);return n.join(`;`)}const h=new Set(`stopColor.stopOpacity.strokeWidth.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.fillRule.clipRule.colorInterpolationFilters.floodColor.floodOpacity.accentHeight.alignmentBaseline.arabicForm.baselineShift.capHeight.clipPath.clipPathUnits.colorInterpolation.colorProfile.colorRendering.enableBackground.fillOpacity.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.horizAdvX.horizOriginX.imageRendering.letterSpacing.lightingColor.markerEnd.markerMid.markerStart.overlinePosition.overlineThickness.paintOrder.preserveAspectRatio.pointerEvents.shapeRendering.strokeMiterlimit.strokeOpacity.textAnchor.textDecoration.textRendering.transformOrigin.underlinePosition.underlineThickness.unicodeBidi.unicodeRange.unitsPerEm.vectorEffect.vertAdvY.vertOriginX.vertOriginY.vAlphabetic.vHanging.vIdeographic.vMathematical.wordSpacing.writingMode`.split(`.`));function g(e,n){if(e===`children`||n==null)return;let r;if(r=e===`className`?`class`:h.has(e)?t.t(e):e,typeof n==`boolean`)return`${r}="${String(n)}"`;if(e===`style`&&typeof n==`object`){let e=m(n);if(e)return`style="${p(e)}"`}return`${r}="${p(String(n))}"`}function _(e,t,n){let r=!1;for(let n in e){if(!Object.hasOwn(e,n))continue;let i=g(n,e[n]);i!==void 0&&(t.push(` `,i),n===`xmlns`&&(r=!0))}n&&!r&&t.push(` xmlns="http://www.w3.org/2000/svg"`)}const v=(e,n,r)=>{let i=e.props||{};if(t.n(e.type)){y(e.type(e.props),n,!1);return}if(typeof e.type==`symbol`||typeof e.type!=`string`)return;n.push(`<`,e.type),_(i,n,r&&e.type===`svg`);let a=i.children;n.push(`>`),y(a,n,!1),n.push(`</`,e.type,`>`)};function y(e,n,r){if(!(e==null||e===!1)){if(f(e)){n.push(String(e));return}if(Array.isArray(e)){for(let t of e)y(t,n,!1);return}t.c(e)&&v(e,n,r)}}function b(e){let t=[];return y(e,t,!0),t.join(``)}function x({width:e,height:t,data:n,premultiplied:r,...i}){return{type:`img`,props:{...i,src:{width:e,height:t,data:n,premultiplied:r}},key:null}}function S(){return{nodes:[],stylesheets:[]}}async function C(n,r){let i=await w(n,{defaultStyles:T(r),presets:t.u(r?.defaultStyles),tailwindClassesProperty:r?.tailwindClassesProperty??`tw`,contexts:new Map,ids:{current:0}}),a=i.nodes,o;return o=a.length===0?e.t({}):a.length===1&&a[0]!==void 0?a[0]:e.t({children:a,style:{width:e.a(100),height:e.a(100)}}),{node:o,stylesheets:i.stylesheets}}async function w(n,r){return n==null||n===!1?S():n instanceof Promise?w(await n,r):typeof n==`object`&&Symbol.iterator in n?q(n,r):t.c(n)?await B(n,r):{nodes:[e.l({text:String(n),preset:r.presets?.span})],stylesheets:[]}}function T(e){return e&&`defaultStyles`in e?e.defaultStyles??t.d:t.d}const E=Symbol.for(`react.context`),D=Symbol.for(`react.provider`),O=Symbol.for(`react.consumer`);function k(e,t){let n=e.type;if(typeof n!=`object`||!n)return;let i=r(n,`$$typeof`);if(i===D)return A(e,r(n,`_context`),t);if(i===O)return M(e,r(n,`_context`)??n,t);if(i===E)return typeof F(e)==`function`?M(e,n,t):A(e,n,t)}function A(e,t,n){let i=new Map(n.contexts);return i.set(t,r(e.props,`value`)),K(e,{...n,contexts:i})}function j(e){return typeof e==`function`}function M(e,t,n){let r=F(e);return j(r)?w(r(s(n,t)),n):K(e,n)}async function N(e,t,n){return w(await u(e,t,n),n)}function P(e,n){if(!(typeof e.type!=`object`||e.type===null)){if(t.a(e.type)&&`render`in e.type){let t=e.type;return N(e=>t.render(e,null),e.props,n)}if(t.s(e.type)&&`type`in e.type){let r=e.type.type;return t.n(r)?N(r,e.props,n):B({...e,type:r},n)}}}function F(e){if(typeof e.props==`object`&&e.props!==null&&`children`in e.props)return e.props.children}function I(e){if(!t.c(e))return;let n=F(e);if(typeof n==`string`)return n;if(typeof n==`number`)return String(n);if(Array.isArray(n)||typeof n==`object`&&n&&Symbol.iterator in n)return z(n);if(t.c(n)&&t.o(n))return I(n)}function L(e){let t=[];for(let n of e){let e=R(n);if(e===void 0)return;t.push(e)}return t.join(``)}function R(e){if(typeof e==`string`)return e;if(typeof e==`number`)return String(e);if(e==null||typeof e==`boolean`||typeof e==`symbol`)return``;if(typeof e==`object`&&Symbol.iterator in e)return L(e);if(!t.c(e))return;if(t.o(e))return R(F(e));let n=F(e);return n===void 0?``:typeof n==`object`&&n&&Symbol.iterator in n?L(n):R(n)}function z(e){let n=[],r=!1;for(let i of e){if(t.c(i))return;if(typeof i==`string`){r=!0,n.push(i);continue}if(typeof i==`number`){r=!0,n.push(String(i));continue}return}if(r)return n.join(``)}async function B(n,r){let i=k(n,r);if(i!==void 0)return i;if(t.n(n.type))return N(n.type,n.props,r);let a=P(n,r);if(a!==void 0)return a;if(t.o(n))return K(n,r);if(t.r(n,`style`)){let e=R(F(n));return{nodes:[],stylesheets:e&&e.length>0?[e]:[]}}if(typeof n.type!=`string`||t.i(n.type))return S();let o=G(n,r);if(t.r(n,`br`))return{nodes:[e.l({text:`
2
- `,preset:r.presets?.br,...o})],stylesheets:[]};if(t.r(n,`img`))return{nodes:[V(n,r)],stylesheets:[]};if(t.r(n,`svg`))return{nodes:[H(n,r)],stylesheets:[]};let s=I(n);if(s!==void 0)return{nodes:[e.l({text:s,...o})],stylesheets:[]};let c=await K(n,r);return{nodes:[e.t({children:c.nodes,...o})],stylesheets:c.stylesheets}}function V(t,n){if(!t.props.src)throw Error(`Image element must have a 'src' prop.`);let r=G(t,n),i=t.props.width===void 0?void 0:Number(t.props.width),a=t.props.height===void 0?void 0:Number(t.props.height);return e.i({src:t.props.src,width:i,height:a,...r})}function H(t,n){let r=G(t,n);return e.i({src:b(t),width:t.props.width===void 0?void 0:Number(t.props.width),height:t.props.height===void 0?void 0:Number(t.props.height),...r})}function U(e,t){let n=t.presets,r=n&&typeof e.type==`string`&&e.type in n?n[e.type]:void 0,i=typeof e.props==`object`&&e.props!==null&&`style`in e.props&&typeof e.props.style==`object`&&e.props.style!==null?e.props.style:void 0;if(!i)return{preset:r};for(let e in i)if(Object.hasOwn(i,e))return{preset:r,style:i};return{preset:r}}function W(e,t){let n=t.tailwindClassesProperty;if(typeof e.props!=`object`||e.props===null||!(n in e.props))return;let r=e.props[n];if(typeof r==`string`)return r}function G(e,n){let r=e.props,{preset:i,style:a}=U(e,n),o=W(e,n),s=t.l(r,n.tailwindClassesProperty);return{tagName:typeof e.type==`string`?e.type:void 0,className:r.className??r.class,id:r.id,dir:r.dir,lang:r.lang,attributes:s,tw:o,style:a,preset:i}}function K(e,t){let n=F(e);return n===void 0?Promise.resolve(S()):w(n,t)}async function q(e,t){let n=[],r=new Set,i=0;for(let a of e){let e=i;i+=1;let o=w(a,t).then(t=>{n[e]=t}).finally(()=>r.delete(o));r.add(o),r.size>=8&&await Promise.race(r)}await Promise.all(r);let a=[],o=[];for(let e of n)e&&(a.push(...e.nodes),o.push(...e.stylesheets));return{nodes:a,stylesheets:o}}exports.Bitmap=x,exports.defaultStylePresets=t.d,exports.fromJsx=C;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-4kGcvc-Q.cjs"),t=require("./utils-Ko9FNHlu.cjs");let n;function r(e,t){return typeof e==`object`&&e&&t in e?e[t]:void 0}function i(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function a(e){let t=r(e,`__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE`);if(typeof t==`object`&&t&&`H`in t){let e=t;return{get:()=>e.H,set:t=>{e.H=t}}}let n=r(r(e,`__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED`),`ReactCurrentDispatcher`);if(typeof n==`object`&&n&&`current`in n){let e=n;return{get:()=>e.current,set:t=>{e.current=t}}}return null}function o(){return n??=import(`react`).then(e=>a(e.default??e)).catch(()=>null),n}function s(e,t){return e.contexts.has(t)?e.contexts.get(t):r(t,`_currentValue`)}const c=()=>{};function l(e,t){let n=t=>s(e,t),r=0;return{readContext:n,useContext:n,use:e=>{if(i(e)){if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:e}return n(e)},useState:e=>[typeof e==`function`?e():e,c],useReducer:(e,t,n)=>[n?n(t):t,c],useMemo:e=>e(),useCallback:e=>e,useRef:e=>({current:e}),useEffect:c,useLayoutEffect:c,useInsertionEffect:c,useImperativeHandle:c,useDebugValue:c,useDeferredValue:e=>e,useTransition:()=>[!1,c],useOptimistic:e=>[e,c],useActionState:(e,t)=>[t,c,!1],useSyncExternalStore:(e,t,n)=>(n??t)(),useId:()=>`:t${t}-${r++}:`,useCacheRefresh:()=>c,useHostTransitionStatus:()=>({pending:!1,data:null,method:null,action:null})}}async function u(e,t,n){let r=await o();if(!r)return e(t);let a=n.ids.current++;for(let o=0;;o++){let s=r.get();r.set(l(n,a));let c;try{return e(t)}catch(e){c=e}finally{r.set(s)}if(!i(c)||o>=64)throw c;await d(c)}}async function d(e){try{e.value=await e,e.status=`fulfilled`}catch(t){e.reason=t,e.status=`rejected`}}function f(e){return typeof e==`string`||typeof e==`number`}function p(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function m(e){let n=[];for(let r in e)Object.hasOwn(e,r)&&n.push(`${t.t(r)}:${String(e[r]).trim()}`);return n.join(`;`)}const h=new Set(`stopColor.stopOpacity.strokeWidth.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.fillRule.clipRule.colorInterpolationFilters.floodColor.floodOpacity.accentHeight.alignmentBaseline.arabicForm.baselineShift.capHeight.clipPath.clipPathUnits.colorInterpolation.colorProfile.colorRendering.enableBackground.fillOpacity.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.horizAdvX.horizOriginX.imageRendering.letterSpacing.lightingColor.markerEnd.markerMid.markerStart.overlinePosition.overlineThickness.paintOrder.preserveAspectRatio.pointerEvents.shapeRendering.strokeMiterlimit.strokeOpacity.textAnchor.textDecoration.textRendering.transformOrigin.underlinePosition.underlineThickness.unicodeBidi.unicodeRange.unitsPerEm.vectorEffect.vertAdvY.vertOriginX.vertOriginY.vAlphabetic.vHanging.vIdeographic.vMathematical.wordSpacing.writingMode`.split(`.`));function g(e,n){if(e===`children`||n==null)return;let r;if(r=e===`className`?`class`:h.has(e)?t.t(e):e,typeof n==`boolean`)return`${r}="${String(n)}"`;if(e===`style`&&typeof n==`object`){let e=m(n);if(e)return`style="${p(e)}"`}return`${r}="${p(String(n))}"`}function _(e,t,n){let r=!1;for(let n in e){if(!Object.hasOwn(e,n))continue;let i=g(n,e[n]);i!==void 0&&(t.push(` `,i),n===`xmlns`&&(r=!0))}n&&!r&&t.push(` xmlns="http://www.w3.org/2000/svg"`)}const v=(e,n,r)=>{let i=e.props||{};if(t.n(e.type)){y(e.type(e.props),n,!1);return}if(typeof e.type==`symbol`||typeof e.type!=`string`)return;n.push(`<`,e.type),_(i,n,r&&e.type===`svg`);let a=i.children;n.push(`>`),y(a,n,!1),n.push(`</`,e.type,`>`)};function y(e,n,r){if(!(e==null||e===!1)){if(f(e)){n.push(String(e));return}if(Array.isArray(e)){for(let t of e)y(t,n,!1);return}t.c(e)&&v(e,n,r)}}function b(e){let t=[];return y(e,t,!0),t.join(``)}function x({width:e,height:t,data:n,premultiplied:r,...i}){return{type:`img`,props:{...i,src:{width:e,height:t,data:n,premultiplied:r}},key:null}}function S(){return{nodes:[],stylesheets:[]}}async function C(n,r){let i=await w(n,{defaultStyles:T(r),presets:t.u(r?.defaultStyles),tailwindClassesProperty:r?.tailwindClassesProperty??`tw`,contexts:new Map,ids:{current:0}}),a=i.nodes,o;return o=a.length===0?e.t({}):a.length===1&&a[0]!==void 0?a[0]:e.t({children:a,style:{width:e.a(100),height:e.a(100)}}),{node:o,stylesheets:i.stylesheets}}async function w(n,r){return n==null||n===!1?S():n instanceof Promise?w(await n,r):typeof n==`object`&&Symbol.iterator in n?K(n,r):t.c(n)?await z(n,r):{nodes:[e.l({text:String(n),preset:r.presets?.span})],stylesheets:[]}}function T(e){return e&&`defaultStyles`in e?e.defaultStyles??t.d:t.d}const E=Symbol.for(`react.context`),D=Symbol.for(`react.provider`),O=Symbol.for(`react.consumer`);function k(e,t){let n=e.type;if(typeof n!=`object`||!n)return;let i=r(n,`$$typeof`);if(i===D)return A(e,r(n,`_context`),t);if(i===O)return j(e,r(n,`_context`)??n,t);if(i===E)return typeof P(e)==`function`?j(e,n,t):A(e,n,t)}function A(e,t,n){let i=new Map(n.contexts);return i.set(t,r(e.props,`value`)),G(e,{...n,contexts:i})}function j(e,n,r){let i=P(e);return t.n(i)?w(i(s(r,n)),r):G(e,r)}async function M(e,t,n){return w(await u(e,t,n),n)}function N(e,n){if(!(typeof e.type!=`object`||e.type===null)){if(t.a(e.type)&&`render`in e.type){let t=e.type;return M(e=>t.render(e,null),e.props,n)}if(t.s(e.type)&&`type`in e.type){let r=e.type.type;return t.n(r)?M(r,e.props,n):z({...e,type:r},n)}}}function P(e){if(typeof e.props==`object`&&e.props!==null&&`children`in e.props)return e.props.children}function F(e){if(!t.c(e))return;let n=P(e);if(typeof n==`string`)return n;if(typeof n==`number`)return String(n);if(Array.isArray(n)||typeof n==`object`&&n&&Symbol.iterator in n)return R(n);if(t.c(n)&&t.o(n))return F(n)}function I(e){let t=[];for(let n of e){let e=L(n);if(e===void 0)return;t.push(e)}return t.join(``)}function L(e){if(typeof e==`string`)return e;if(typeof e==`number`)return String(e);if(e==null||typeof e==`boolean`||typeof e==`symbol`)return``;if(typeof e==`object`&&Symbol.iterator in e)return I(e);if(!t.c(e))return;if(t.o(e))return L(P(e));let n=P(e);return n===void 0?``:typeof n==`object`&&n&&Symbol.iterator in n?I(n):L(n)}function R(e){let n=[],r=!1;for(let i of e){if(t.c(i))return;if(typeof i==`string`){r=!0,n.push(i);continue}if(typeof i==`number`){r=!0,n.push(String(i));continue}return}if(r)return n.join(``)}async function z(n,r){let i=k(n,r);if(i!==void 0)return i;if(t.n(n.type))return M(n.type,n.props,r);let a=N(n,r);if(a!==void 0)return a;if(t.o(n))return G(n,r);if(t.r(n,`style`)){let e=L(P(n));return{nodes:[],stylesheets:e&&e.length>0?[e]:[]}}if(typeof n.type!=`string`||t.i(n.type))return S();let o=W(n,r);if(t.r(n,`br`))return{nodes:[e.l({text:`
2
+ `,preset:r.presets?.br,...o})],stylesheets:[]};if(t.r(n,`img`))return{nodes:[B(n,r)],stylesheets:[]};if(t.r(n,`svg`))return{nodes:[V(n,r)],stylesheets:[]};let s=F(n);if(s!==void 0)return{nodes:[e.l({text:s,...o})],stylesheets:[]};let c=await G(n,r);return{nodes:[e.t({children:c.nodes,...o})],stylesheets:c.stylesheets}}function B(t,n){if(!t.props.src)throw Error(`Image element must have a 'src' prop.`);let r=W(t,n),i=t.props.width===void 0?void 0:Number(t.props.width),a=t.props.height===void 0?void 0:Number(t.props.height);return e.i({src:t.props.src,width:i,height:a,...r})}function V(t,n){let r=W(t,n);return e.i({src:b(t),width:t.props.width===void 0?void 0:Number(t.props.width),height:t.props.height===void 0?void 0:Number(t.props.height),...r})}function H(e,t){let n=t.presets,r=n&&typeof e.type==`string`&&e.type in n?n[e.type]:void 0,i=typeof e.props==`object`&&e.props!==null&&`style`in e.props&&typeof e.props.style==`object`&&e.props.style!==null?e.props.style:void 0;if(!i)return{preset:r};for(let e in i)if(Object.hasOwn(i,e))return{preset:r,style:i};return{preset:r}}function U(e,t){let n=t.tailwindClassesProperty;if(typeof e.props!=`object`||e.props===null||!(n in e.props))return;let r=e.props[n];if(typeof r==`string`)return r}function W(e,n){let r=e.props,{preset:i,style:a}=H(e,n),o=U(e,n),s=t.l(r,n.tailwindClassesProperty);return{tagName:typeof e.type==`string`?e.type:void 0,className:r.className??r.class,id:r.id,dir:r.dir,lang:r.lang,attributes:s,tw:o,style:a,preset:i}}function G(e,t){let n=P(e);return n===void 0?Promise.resolve(S()):w(n,t)}async function K(e,t){let n=[],r=new Set,i=0;for(let a of e){let e=i;i+=1;let o=w(a,t).then(t=>{n[e]=t}).finally(()=>r.delete(o));r.add(o),r.size>=8&&await Promise.race(r)}await Promise.all(r);let a=[],o=[];for(let e of n)e&&(a.push(...e.nodes),o.push(...e.stylesheets));return{nodes:a,stylesheets:o}}exports.Bitmap=x,exports.defaultStylePresets=t.d,exports.fromJsx=C;
package/dist/jsx.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{a as e,i as t,l as n,t as r}from"./helpers-CVQCT1Rh.mjs";import{a as i,c as a,d as o,i as s,l as c,n as l,o as u,r as d,s as f,t as p,u as m}from"./utils-C0juSwEF.mjs";let h;function g(e,t){return typeof e==`object`&&e&&t in e?e[t]:void 0}function _(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function v(e){let t=g(e,`__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE`);if(typeof t==`object`&&t&&`H`in t){let e=t;return{get:()=>e.H,set:t=>{e.H=t}}}let n=g(g(e,`__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED`),`ReactCurrentDispatcher`);if(typeof n==`object`&&n&&`current`in n){let e=n;return{get:()=>e.current,set:t=>{e.current=t}}}return null}function y(){return h??=import(`react`).then(e=>v(e.default??e)).catch(()=>null),h}function b(e,t){return e.contexts.has(t)?e.contexts.get(t):g(t,`_currentValue`)}const x=()=>{};function ee(e,t){let n=t=>b(e,t),r=0;return{readContext:n,useContext:n,use:e=>{if(_(e)){if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:e}return n(e)},useState:e=>[typeof e==`function`?e():e,x],useReducer:(e,t,n)=>[n?n(t):t,x],useMemo:e=>e(),useCallback:e=>e,useRef:e=>({current:e}),useEffect:x,useLayoutEffect:x,useInsertionEffect:x,useImperativeHandle:x,useDebugValue:x,useDeferredValue:e=>e,useTransition:()=>[!1,x],useOptimistic:e=>[e,x],useActionState:(e,t)=>[t,x,!1],useSyncExternalStore:(e,t,n)=>(n??t)(),useId:()=>`:t${t}-${r++}:`,useCacheRefresh:()=>x,useHostTransitionStatus:()=>({pending:!1,data:null,method:null,action:null})}}async function te(e,t,n){let r=await y();if(!r)return e(t);let i=n.ids.current++;for(let a=0;;a++){let o=r.get();r.set(ee(n,i));let s;try{return e(t)}catch(e){s=e}finally{r.set(o)}if(!_(s)||a>=64)throw s;await S(s)}}async function S(e){try{e.value=await e,e.status=`fulfilled`}catch(t){e.reason=t,e.status=`rejected`}}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function T(e){let t=[];for(let n in e)Object.hasOwn(e,n)&&t.push(`${p(n)}:${String(e[n]).trim()}`);return t.join(`;`)}const E=new Set(`stopColor.stopOpacity.strokeWidth.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.fillRule.clipRule.colorInterpolationFilters.floodColor.floodOpacity.accentHeight.alignmentBaseline.arabicForm.baselineShift.capHeight.clipPath.clipPathUnits.colorInterpolation.colorProfile.colorRendering.enableBackground.fillOpacity.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.horizAdvX.horizOriginX.imageRendering.letterSpacing.lightingColor.markerEnd.markerMid.markerStart.overlinePosition.overlineThickness.paintOrder.preserveAspectRatio.pointerEvents.shapeRendering.strokeMiterlimit.strokeOpacity.textAnchor.textDecoration.textRendering.transformOrigin.underlinePosition.underlineThickness.unicodeBidi.unicodeRange.unitsPerEm.vectorEffect.vertAdvY.vertOriginX.vertOriginY.vAlphabetic.vHanging.vIdeographic.vMathematical.wordSpacing.writingMode`.split(`.`));function D(e,t){if(e===`children`||t==null)return;let n;if(n=e===`className`?`class`:E.has(e)?p(e):e,typeof t==`boolean`)return`${n}="${String(t)}"`;if(e===`style`&&typeof t==`object`){let e=T(t);if(e)return`style="${w(e)}"`}return`${n}="${w(String(t))}"`}function O(e,t,n){let r=!1;for(let n in e){if(!Object.hasOwn(e,n))continue;let i=D(n,e[n]);i!==void 0&&(t.push(` `,i),n===`xmlns`&&(r=!0))}n&&!r&&t.push(` xmlns="http://www.w3.org/2000/svg"`)}const k=(e,t,n)=>{let r=e.props||{};if(l(e.type)){A(e.type(e.props),t,!1);return}if(typeof e.type==`symbol`||typeof e.type!=`string`)return;t.push(`<`,e.type),O(r,t,n&&e.type===`svg`);let i=r.children;t.push(`>`),A(i,t,!1),t.push(`</`,e.type,`>`)};function A(e,t,n){if(!(e==null||e===!1)){if(C(e)){t.push(String(e));return}if(Array.isArray(e)){for(let n of e)A(n,t,!1);return}a(e)&&k(e,t,n)}}function j(e){let t=[];return A(e,t,!0),t.join(``)}function M({width:e,height:t,data:n,premultiplied:r,...i}){return{type:`img`,props:{...i,src:{width:e,height:t,data:n,premultiplied:r}},key:null}}function N(){return{nodes:[],stylesheets:[]}}async function P(t,n){let i=await F(t,{defaultStyles:I(n),presets:m(n?.defaultStyles),tailwindClassesProperty:n?.tailwindClassesProperty??`tw`,contexts:new Map,ids:{current:0}}),a=i.nodes,o;return o=a.length===0?r({}):a.length===1&&a[0]!==void 0?a[0]:r({children:a,style:{width:e(100),height:e(100)}}),{node:o,stylesheets:i.stylesheets}}async function F(e,t){return e==null||e===!1?N():e instanceof Promise?F(await e,t):typeof e==`object`&&Symbol.iterator in e?oe(e,t):a(e)?await Z(e,t):{nodes:[n({text:String(e),preset:t.presets?.span})],stylesheets:[]}}function I(e){return e&&`defaultStyles`in e?e.defaultStyles??o:o}const L=Symbol.for(`react.context`),R=Symbol.for(`react.provider`),z=Symbol.for(`react.consumer`);function B(e,t){let n=e.type;if(typeof n!=`object`||!n)return;let r=g(n,`$$typeof`);if(r===R)return V(e,g(n,`_context`),t);if(r===z)return U(e,g(n,`_context`)??n,t);if(r===L)return typeof K(e)==`function`?U(e,n,t):V(e,n,t)}function V(e,t,n){let r=new Map(n.contexts);return r.set(t,g(e.props,`value`)),$(e,{...n,contexts:r})}function H(e){return typeof e==`function`}function U(e,t,n){let r=K(e);return H(r)?F(r(b(n,t)),n):$(e,n)}async function W(e,t,n){return F(await te(e,t,n),n)}function G(e,t){if(!(typeof e.type!=`object`||e.type===null)){if(i(e.type)&&`render`in e.type){let n=e.type;return W(e=>n.render(e,null),e.props,t)}if(f(e.type)&&`type`in e.type){let n=e.type.type;return l(n)?W(n,e.props,t):Z({...e,type:n},t)}}}function K(e){if(typeof e.props==`object`&&e.props!==null&&`children`in e.props)return e.props.children}function q(e){if(!a(e))return;let t=K(e);if(typeof t==`string`)return t;if(typeof t==`number`)return String(t);if(Array.isArray(t)||typeof t==`object`&&t&&Symbol.iterator in t)return X(t);if(a(t)&&u(t))return q(t)}function J(e){let t=[];for(let n of e){let e=Y(n);if(e===void 0)return;t.push(e)}return t.join(``)}function Y(e){if(typeof e==`string`)return e;if(typeof e==`number`)return String(e);if(e==null||typeof e==`boolean`||typeof e==`symbol`)return``;if(typeof e==`object`&&Symbol.iterator in e)return J(e);if(!a(e))return;if(u(e))return Y(K(e));let t=K(e);return t===void 0?``:typeof t==`object`&&t&&Symbol.iterator in t?J(t):Y(t)}function X(e){let t=[],n=!1;for(let r of e){if(a(r))return;if(typeof r==`string`){n=!0,t.push(r);continue}if(typeof r==`number`){n=!0,t.push(String(r));continue}return}if(n)return t.join(``)}async function Z(e,t){let i=B(e,t);if(i!==void 0)return i;if(l(e.type))return W(e.type,e.props,t);let a=G(e,t);if(a!==void 0)return a;if(u(e))return $(e,t);if(d(e,`style`)){let t=Y(K(e));return{nodes:[],stylesheets:t&&t.length>0?[t]:[]}}if(typeof e.type!=`string`||s(e.type))return N();let o=Q(e,t);if(d(e,`br`))return{nodes:[n({text:`
2
- `,preset:t.presets?.br,...o})],stylesheets:[]};if(d(e,`img`))return{nodes:[ne(e,t)],stylesheets:[]};if(d(e,`svg`))return{nodes:[re(e,t)],stylesheets:[]};let c=q(e);if(c!==void 0)return{nodes:[n({text:c,...o})],stylesheets:[]};let f=await $(e,t);return{nodes:[r({children:f.nodes,...o})],stylesheets:f.stylesheets}}function ne(e,n){if(!e.props.src)throw Error(`Image element must have a 'src' prop.`);let r=Q(e,n),i=e.props.width===void 0?void 0:Number(e.props.width),a=e.props.height===void 0?void 0:Number(e.props.height);return t({src:e.props.src,width:i,height:a,...r})}function re(e,n){let r=Q(e,n);return t({src:j(e),width:e.props.width===void 0?void 0:Number(e.props.width),height:e.props.height===void 0?void 0:Number(e.props.height),...r})}function ie(e,t){let n=t.presets,r=n&&typeof e.type==`string`&&e.type in n?n[e.type]:void 0,i=typeof e.props==`object`&&e.props!==null&&`style`in e.props&&typeof e.props.style==`object`&&e.props.style!==null?e.props.style:void 0;if(!i)return{preset:r};for(let e in i)if(Object.hasOwn(i,e))return{preset:r,style:i};return{preset:r}}function ae(e,t){let n=t.tailwindClassesProperty;if(typeof e.props!=`object`||e.props===null||!(n in e.props))return;let r=e.props[n];if(typeof r==`string`)return r}function Q(e,t){let n=e.props,{preset:r,style:i}=ie(e,t),a=ae(e,t),o=c(n,t.tailwindClassesProperty);return{tagName:typeof e.type==`string`?e.type:void 0,className:n.className??n.class,id:n.id,dir:n.dir,lang:n.lang,attributes:o,tw:a,style:i,preset:r}}function $(e,t){let n=K(e);return n===void 0?Promise.resolve(N()):F(n,t)}async function oe(e,t){let n=[],r=new Set,i=0;for(let a of e){let e=i;i+=1;let o=F(a,t).then(t=>{n[e]=t}).finally(()=>r.delete(o));r.add(o),r.size>=8&&await Promise.race(r)}await Promise.all(r);let a=[],o=[];for(let e of n)e&&(a.push(...e.nodes),o.push(...e.stylesheets));return{nodes:a,stylesheets:o}}export{M as Bitmap,o as defaultStylePresets,P as fromJsx};
1
+ import{a as e,i as t,l as n,t as r}from"./helpers-CVQCT1Rh.mjs";import{a as i,c as a,d as o,i as s,l as c,n as l,o as u,r as d,s as f,t as p,u as m}from"./utils-C0juSwEF.mjs";let h;function g(e,t){return typeof e==`object`&&e&&t in e?e[t]:void 0}function _(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function v(e){let t=g(e,`__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE`);if(typeof t==`object`&&t&&`H`in t){let e=t;return{get:()=>e.H,set:t=>{e.H=t}}}let n=g(g(e,`__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED`),`ReactCurrentDispatcher`);if(typeof n==`object`&&n&&`current`in n){let e=n;return{get:()=>e.current,set:t=>{e.current=t}}}return null}function y(){return h??=import(`react`).then(e=>v(e.default??e)).catch(()=>null),h}function b(e,t){return e.contexts.has(t)?e.contexts.get(t):g(t,`_currentValue`)}const x=()=>{};function ee(e,t){let n=t=>b(e,t),r=0;return{readContext:n,useContext:n,use:e=>{if(_(e)){if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:e}return n(e)},useState:e=>[typeof e==`function`?e():e,x],useReducer:(e,t,n)=>[n?n(t):t,x],useMemo:e=>e(),useCallback:e=>e,useRef:e=>({current:e}),useEffect:x,useLayoutEffect:x,useInsertionEffect:x,useImperativeHandle:x,useDebugValue:x,useDeferredValue:e=>e,useTransition:()=>[!1,x],useOptimistic:e=>[e,x],useActionState:(e,t)=>[t,x,!1],useSyncExternalStore:(e,t,n)=>(n??t)(),useId:()=>`:t${t}-${r++}:`,useCacheRefresh:()=>x,useHostTransitionStatus:()=>({pending:!1,data:null,method:null,action:null})}}async function te(e,t,n){let r=await y();if(!r)return e(t);let i=n.ids.current++;for(let a=0;;a++){let o=r.get();r.set(ee(n,i));let s;try{return e(t)}catch(e){s=e}finally{r.set(o)}if(!_(s)||a>=64)throw s;await S(s)}}async function S(e){try{e.value=await e,e.status=`fulfilled`}catch(t){e.reason=t,e.status=`rejected`}}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function T(e){let t=[];for(let n in e)Object.hasOwn(e,n)&&t.push(`${p(n)}:${String(e[n]).trim()}`);return t.join(`;`)}const E=new Set(`stopColor.stopOpacity.strokeWidth.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.fillRule.clipRule.colorInterpolationFilters.floodColor.floodOpacity.accentHeight.alignmentBaseline.arabicForm.baselineShift.capHeight.clipPath.clipPathUnits.colorInterpolation.colorProfile.colorRendering.enableBackground.fillOpacity.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.horizAdvX.horizOriginX.imageRendering.letterSpacing.lightingColor.markerEnd.markerMid.markerStart.overlinePosition.overlineThickness.paintOrder.preserveAspectRatio.pointerEvents.shapeRendering.strokeMiterlimit.strokeOpacity.textAnchor.textDecoration.textRendering.transformOrigin.underlinePosition.underlineThickness.unicodeBidi.unicodeRange.unitsPerEm.vectorEffect.vertAdvY.vertOriginX.vertOriginY.vAlphabetic.vHanging.vIdeographic.vMathematical.wordSpacing.writingMode`.split(`.`));function D(e,t){if(e===`children`||t==null)return;let n;if(n=e===`className`?`class`:E.has(e)?p(e):e,typeof t==`boolean`)return`${n}="${String(t)}"`;if(e===`style`&&typeof t==`object`){let e=T(t);if(e)return`style="${w(e)}"`}return`${n}="${w(String(t))}"`}function O(e,t,n){let r=!1;for(let n in e){if(!Object.hasOwn(e,n))continue;let i=D(n,e[n]);i!==void 0&&(t.push(` `,i),n===`xmlns`&&(r=!0))}n&&!r&&t.push(` xmlns="http://www.w3.org/2000/svg"`)}const k=(e,t,n)=>{let r=e.props||{};if(l(e.type)){A(e.type(e.props),t,!1);return}if(typeof e.type==`symbol`||typeof e.type!=`string`)return;t.push(`<`,e.type),O(r,t,n&&e.type===`svg`);let i=r.children;t.push(`>`),A(i,t,!1),t.push(`</`,e.type,`>`)};function A(e,t,n){if(!(e==null||e===!1)){if(C(e)){t.push(String(e));return}if(Array.isArray(e)){for(let n of e)A(n,t,!1);return}a(e)&&k(e,t,n)}}function j(e){let t=[];return A(e,t,!0),t.join(``)}function M({width:e,height:t,data:n,premultiplied:r,...i}){return{type:`img`,props:{...i,src:{width:e,height:t,data:n,premultiplied:r}},key:null}}function N(){return{nodes:[],stylesheets:[]}}async function P(t,n){let i=await F(t,{defaultStyles:I(n),presets:m(n?.defaultStyles),tailwindClassesProperty:n?.tailwindClassesProperty??`tw`,contexts:new Map,ids:{current:0}}),a=i.nodes,o;return o=a.length===0?r({}):a.length===1&&a[0]!==void 0?a[0]:r({children:a,style:{width:e(100),height:e(100)}}),{node:o,stylesheets:i.stylesheets}}async function F(e,t){return e==null||e===!1?N():e instanceof Promise?F(await e,t):typeof e==`object`&&Symbol.iterator in e?ae(e,t):a(e)?await X(e,t):{nodes:[n({text:String(e),preset:t.presets?.span})],stylesheets:[]}}function I(e){return e&&`defaultStyles`in e?e.defaultStyles??o:o}const L=Symbol.for(`react.context`),R=Symbol.for(`react.provider`),z=Symbol.for(`react.consumer`);function B(e,t){let n=e.type;if(typeof n!=`object`||!n)return;let r=g(n,`$$typeof`);if(r===R)return V(e,g(n,`_context`),t);if(r===z)return H(e,g(n,`_context`)??n,t);if(r===L)return typeof G(e)==`function`?H(e,n,t):V(e,n,t)}function V(e,t,n){let r=new Map(n.contexts);return r.set(t,g(e.props,`value`)),$(e,{...n,contexts:r})}function H(e,t,n){let r=G(e);return l(r)?F(r(b(n,t)),n):$(e,n)}async function U(e,t,n){return F(await te(e,t,n),n)}function W(e,t){if(!(typeof e.type!=`object`||e.type===null)){if(i(e.type)&&`render`in e.type){let n=e.type;return U(e=>n.render(e,null),e.props,t)}if(f(e.type)&&`type`in e.type){let n=e.type.type;return l(n)?U(n,e.props,t):X({...e,type:n},t)}}}function G(e){if(typeof e.props==`object`&&e.props!==null&&`children`in e.props)return e.props.children}function K(e){if(!a(e))return;let t=G(e);if(typeof t==`string`)return t;if(typeof t==`number`)return String(t);if(Array.isArray(t)||typeof t==`object`&&t&&Symbol.iterator in t)return Y(t);if(a(t)&&u(t))return K(t)}function q(e){let t=[];for(let n of e){let e=J(n);if(e===void 0)return;t.push(e)}return t.join(``)}function J(e){if(typeof e==`string`)return e;if(typeof e==`number`)return String(e);if(e==null||typeof e==`boolean`||typeof e==`symbol`)return``;if(typeof e==`object`&&Symbol.iterator in e)return q(e);if(!a(e))return;if(u(e))return J(G(e));let t=G(e);return t===void 0?``:typeof t==`object`&&t&&Symbol.iterator in t?q(t):J(t)}function Y(e){let t=[],n=!1;for(let r of e){if(a(r))return;if(typeof r==`string`){n=!0,t.push(r);continue}if(typeof r==`number`){n=!0,t.push(String(r));continue}return}if(n)return t.join(``)}async function X(e,t){let i=B(e,t);if(i!==void 0)return i;if(l(e.type))return U(e.type,e.props,t);let a=W(e,t);if(a!==void 0)return a;if(u(e))return $(e,t);if(d(e,`style`)){let t=J(G(e));return{nodes:[],stylesheets:t&&t.length>0?[t]:[]}}if(typeof e.type!=`string`||s(e.type))return N();let o=Q(e,t);if(d(e,`br`))return{nodes:[n({text:`
2
+ `,preset:t.presets?.br,...o})],stylesheets:[]};if(d(e,`img`))return{nodes:[Z(e,t)],stylesheets:[]};if(d(e,`svg`))return{nodes:[ne(e,t)],stylesheets:[]};let c=K(e);if(c!==void 0)return{nodes:[n({text:c,...o})],stylesheets:[]};let f=await $(e,t);return{nodes:[r({children:f.nodes,...o})],stylesheets:f.stylesheets}}function Z(e,n){if(!e.props.src)throw Error(`Image element must have a 'src' prop.`);let r=Q(e,n),i=e.props.width===void 0?void 0:Number(e.props.width),a=e.props.height===void 0?void 0:Number(e.props.height);return t({src:e.props.src,width:i,height:a,...r})}function ne(e,n){let r=Q(e,n);return t({src:j(e),width:e.props.width===void 0?void 0:Number(e.props.width),height:e.props.height===void 0?void 0:Number(e.props.height),...r})}function re(e,t){let n=t.presets,r=n&&typeof e.type==`string`&&e.type in n?n[e.type]:void 0,i=typeof e.props==`object`&&e.props!==null&&`style`in e.props&&typeof e.props.style==`object`&&e.props.style!==null?e.props.style:void 0;if(!i)return{preset:r};for(let e in i)if(Object.hasOwn(i,e))return{preset:r,style:i};return{preset:r}}function ie(e,t){let n=t.tailwindClassesProperty;if(typeof e.props!=`object`||e.props===null||!(n in e.props))return;let r=e.props[n];if(typeof r==`string`)return r}function Q(e,t){let n=e.props,{preset:r,style:i}=re(e,t),a=ie(e,t),o=c(n,t.tailwindClassesProperty);return{tagName:typeof e.type==`string`?e.type:void 0,className:n.className??n.class,id:n.id,dir:n.dir,lang:n.lang,attributes:o,tw:a,style:i,preset:r}}function $(e,t){let n=G(e);return n===void 0?Promise.resolve(N()):F(n,t)}async function ae(e,t){let n=[],r=new Set,i=0;for(let a of e){let e=i;i+=1;let o=F(a,t).then(t=>{n[e]=t}).finally(()=>r.delete(o));r.add(o),r.size>=8&&await Promise.race(r)}await Promise.all(r);let a=[],o=[];for(let e of n)e&&(a.push(...e.nodes),o.push(...e.stylesheets));return{nodes:a,stylesheets:o}}export{M as Bitmap,o as defaultStylePresets,P as fromJsx};
package/dist/renderer.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./fonts-DI_b5zLT.cjs");function t(e){return e instanceof Uint8Array||e instanceof ArrayBuffer||typeof Buffer<`u`&&Buffer.isBuffer(e)}function n(e){return t(e)?e:typeof e.data==`function`?e.data():e.data}function r(e){return t(e)?e:`key`in e&&e.key?e.key:typeof e.data==`function`?`${e.name??``}:${e.weight??``}:${e.style??``}`:e.data}async function i(e){let{sources:t=[],cache:n}=Array.isArray(e)?{sources:e}:e,r=new Map;for(let e of t)r.set(e.src,e);return Promise.all([...r.values()].map(async({src:e,data:t,cache:r})=>({src:e,data:typeof t==`function`?await t():t,cache:r??n})))}var a=class{registerInner;byKey=new Map;byData=new WeakMap;constructor(e){this.registerInner=e}getFont(e){return typeof e==`string`?this.byKey.get(e):this.byData.get(e)}setFont(e,t){typeof e==`string`?this.byKey.set(e,t):this.byData.set(e,t)}deleteFont(e){typeof e==`string`?this.byKey.delete(e):this.byData.delete(e)}async register(i){let a=typeof i==`string`?e.n(i):i,o=r(a),s=this.getFont(o);if(s)return s;let c=n(a),l=Promise.resolve(c).then(e=>this.registerInner(t(a)?e:{...a,data:e})).catch(e=>{throw this.deleteFont(o),e});return this.setFont(o,l),l}async prepareFonts(e){if(!e)return;let t=await Promise.all(e.map(e=>this.register(e)));return[...new Set(t.flat().map(e=>e.name))]}async resolveResources(e,t,n){let r=await this.prepareFonts(e);return{images:t?await i(t):void 0,fontFamilies:n??r}}};async function o(t,n,r){let{fonts:i,fontFamilies:a,signal:o,images:s,...c}=n;o?.throwIfAborted();let l=await i,u=await t.resolveResources(l&&e.i({fonts:l,source:r}),s,a);return o?.throwIfAborted(),{options:{...c,...u},signal:o}}exports.FontRegistry=a,exports.prepareRenderInput=o,exports.resolveImageLoaders=i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./fonts-DI_b5zLT.cjs");function t(e){return e instanceof Uint8Array||e instanceof ArrayBuffer||typeof Buffer<`u`&&Buffer.isBuffer(e)}function n(e){return e instanceof ArrayBuffer?new Uint8Array(e):e}function r(e){return t(e)?e:typeof e.data==`function`?e.data():e.data}function i(e){return t(e)?e:`key`in e&&e.key?e.key:typeof e.data==`function`?`${e.name??``}:${e.weight??``}:${e.style??``}`:e.data}async function a(e){let{sources:t=[],cache:r}=Array.isArray(e)?{sources:e}:e,i=new Map;for(let e of t)i.set(e.src,e);return Promise.all([...i.values()].map(async({src:e,data:t,cache:i})=>({src:e,data:n(typeof t==`function`?await t():t),cache:i??r})))}var o=class{registerInner;byKey=new Map;byData=new WeakMap;constructor(e){this.registerInner=e}getFont(e){return typeof e==`string`?this.byKey.get(e):this.byData.get(e)}setFont(e,t){typeof e==`string`?this.byKey.set(e,t):this.byData.set(e,t)}deleteFont(e){typeof e==`string`?this.byKey.delete(e):this.byData.delete(e)}async register(a){let o=typeof a==`string`?e.n(a):a,s=i(o),c=this.getFont(s);if(c)return c;let l=r(o),u=Promise.resolve(l).then(e=>{let r=n(e);return this.registerInner(t(o)?r:{...o,data:r})}).catch(e=>{throw this.deleteFont(s),e});return this.setFont(s,u),u}async prepareFonts(e){if(!e)return;let t=await Promise.all(e.map(e=>this.register(e)));return[...new Set(t.flat().map(e=>e.name))]}async resolveResources(e,t,n){let r=await this.prepareFonts(e);return{images:t?await a(t):void 0,fontFamilies:n??r}}};async function s(t,n,r){let{fonts:i,fontFamilies:a,signal:o,images:s,...c}=n;o?.throwIfAborted();let l=await i,u=await t.resolveResources(l&&e.i({fonts:l,source:r}),s,a);return o?.throwIfAborted(),{options:{...c,...u},signal:o}}exports.FontRegistry=o,exports.prepareRenderInput=s,exports.resolveImageLoaders=a;
package/dist/renderer.mjs CHANGED
@@ -1 +1 @@
1
- import{i as e,n as t}from"./fonts-BXhtO--P.mjs";function n(e){return e instanceof Uint8Array||e instanceof ArrayBuffer||typeof Buffer<`u`&&Buffer.isBuffer(e)}function r(e){return n(e)?e:typeof e.data==`function`?e.data():e.data}function i(e){return n(e)?e:`key`in e&&e.key?e.key:typeof e.data==`function`?`${e.name??``}:${e.weight??``}:${e.style??``}`:e.data}async function a(e){let{sources:t=[],cache:n}=Array.isArray(e)?{sources:e}:e,r=new Map;for(let e of t)r.set(e.src,e);return Promise.all([...r.values()].map(async({src:e,data:t,cache:r})=>({src:e,data:typeof t==`function`?await t():t,cache:r??n})))}var o=class{registerInner;byKey=new Map;byData=new WeakMap;constructor(e){this.registerInner=e}getFont(e){return typeof e==`string`?this.byKey.get(e):this.byData.get(e)}setFont(e,t){typeof e==`string`?this.byKey.set(e,t):this.byData.set(e,t)}deleteFont(e){typeof e==`string`?this.byKey.delete(e):this.byData.delete(e)}async register(e){let a=typeof e==`string`?t(e):e,o=i(a),s=this.getFont(o);if(s)return s;let c=r(a),l=Promise.resolve(c).then(e=>this.registerInner(n(a)?e:{...a,data:e})).catch(e=>{throw this.deleteFont(o),e});return this.setFont(o,l),l}async prepareFonts(e){if(!e)return;let t=await Promise.all(e.map(e=>this.register(e)));return[...new Set(t.flat().map(e=>e.name))]}async resolveResources(e,t,n){let r=await this.prepareFonts(e);return{images:t?await a(t):void 0,fontFamilies:n??r}}};async function s(t,n,r){let{fonts:i,fontFamilies:a,signal:o,images:s,...c}=n;o?.throwIfAborted();let l=await i,u=await t.resolveResources(l&&e({fonts:l,source:r}),s,a);return o?.throwIfAborted(),{options:{...c,...u},signal:o}}export{o as FontRegistry,s as prepareRenderInput,a as resolveImageLoaders};
1
+ import{i as e,n as t}from"./fonts-BXhtO--P.mjs";function n(e){return e instanceof Uint8Array||e instanceof ArrayBuffer||typeof Buffer<`u`&&Buffer.isBuffer(e)}function r(e){return e instanceof ArrayBuffer?new Uint8Array(e):e}function i(e){return n(e)?e:typeof e.data==`function`?e.data():e.data}function a(e){return n(e)?e:`key`in e&&e.key?e.key:typeof e.data==`function`?`${e.name??``}:${e.weight??``}:${e.style??``}`:e.data}async function o(e){let{sources:t=[],cache:n}=Array.isArray(e)?{sources:e}:e,i=new Map;for(let e of t)i.set(e.src,e);return Promise.all([...i.values()].map(async({src:e,data:t,cache:i})=>({src:e,data:r(typeof t==`function`?await t():t),cache:i??n})))}var s=class{registerInner;byKey=new Map;byData=new WeakMap;constructor(e){this.registerInner=e}getFont(e){return typeof e==`string`?this.byKey.get(e):this.byData.get(e)}setFont(e,t){typeof e==`string`?this.byKey.set(e,t):this.byData.set(e,t)}deleteFont(e){typeof e==`string`?this.byKey.delete(e):this.byData.delete(e)}async register(e){let o=typeof e==`string`?t(e):e,s=a(o),c=this.getFont(s);if(c)return c;let l=i(o),u=Promise.resolve(l).then(e=>{let t=r(e);return this.registerInner(n(o)?t:{...o,data:t})}).catch(e=>{throw this.deleteFont(s),e});return this.setFont(s,u),u}async prepareFonts(e){if(!e)return;let t=await Promise.all(e.map(e=>this.register(e)));return[...new Set(t.flat().map(e=>e.name))]}async resolveResources(e,t,n){let r=await this.prepareFonts(e);return{images:t?await o(t):void 0,fontFamilies:n??r}}};async function c(t,n,r){let{fonts:i,fontFamilies:a,signal:o,images:s,...c}=n;o?.throwIfAborted();let l=await i,u=await t.resolveResources(l&&e({fonts:l,source:r}),s,a);return o?.throwIfAborted(),{options:{...c,...u},signal:o}}export{s as FontRegistry,c as prepareRenderInput,o as resolveImageLoaders};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takumi-rs/helpers",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "Utility helpers for converting JSX/HTML to Takumi node trees, loading fonts, and processing emoji.",
5
5
  "keywords": [
6
6
  "css",