@takumi-rs/helpers 0.73.0 → 1.0.0-beta.0

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/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CSSProperties } from 'react';
2
- import { C as ContainerNode, T as TextNode, I as ImageNode } from './types-DS15vfPf.cjs';
3
- export { b as Node, N as NodeAttributes, a as NodeMetadata, P as PartialStyle } from './types-DS15vfPf.cjs';
2
+ import { C as ContainerNode, T as TextNode, I as ImageNode } from './types-DAQVXLBC.cjs';
3
+ export { b as Node, N as NodeAttributes, a as NodeMetadata } from './types-DAQVXLBC.cjs';
4
4
 
5
5
  declare function container(props: Omit<ContainerNode, "type">): ContainerNode;
6
6
  declare function text(text: string, style?: CSSProperties): TextNode;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CSSProperties } from 'react';
2
- import { C as ContainerNode, T as TextNode, I as ImageNode } from './types-DS15vfPf.js';
3
- export { b as Node, N as NodeAttributes, a as NodeMetadata, P as PartialStyle } from './types-DS15vfPf.js';
2
+ import { C as ContainerNode, T as TextNode, I as ImageNode } from './types-DAQVXLBC.js';
3
+ export { b as Node, N as NodeAttributes, a as NodeMetadata } from './types-DAQVXLBC.js';
4
4
 
5
5
  declare function container(props: Omit<ContainerNode, "type">): ContainerNode;
6
6
  declare function text(text: string, style?: CSSProperties): TextNode;
package/dist/jsx/jsx.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var k=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var X=(e,t)=>{for(var r in t)k(e,r,{get:t[r],enumerable:!0})},D=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _(t))!V.call(e,i)&&i!==r&&k(e,i,{get:()=>t[i],enumerable:!(n=B(t,i))||n.enumerable});return e};var Y=e=>D(k({},"__esModule",{value:!0}),e);var fe={};X(fe,{defaultStylePresets:()=>T,fromJsx:()=>ie});module.exports=Y(fe);function h(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function N(e,t){t&&Object.keys(t).length>0&&(e.preset=t)}function w(e,t){t.tagName!==void 0&&(e.tagName=t.tagName),t.className!==void 0&&(e.className=t.className),t.id!==void 0&&(e.id=t.id),t.attributes!==void 0&&(e.attributes=t.attributes)}function R(e){let t={type:"container",children:e.children};return e.tw&&(t.tw=e.tw),w(t,e),N(t,e.preset),h(t,e.style),t}function b(e,t){if(typeof e=="string"){let n={type:"text",text:e};return h(n,t),n}let r={type:"text",text:e.text};return e.tw&&(r.tw=e.tw),w(r,e),N(r,e.preset),h(r,t??e.style),r}function E(e){let t={type:"image",src:e.src,width:e.width,height:e.height};return e.tw&&(t.tw=e.tw),w(t,e),N(t,e.preset),h(t,e.style),t}function P(e){return`${e}%`}var T={body:{margin:8},p:{marginTop:"1em",marginBottom:"1em",display:"block"},blockquote:{marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40,display:"block"},center:{textAlign:"center",display:"block"},hr:{marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"auto",marginRight:"auto",borderWidth:1,display:"block"},h1:{fontSize:"2em",marginTop:"0.67em",marginBottom:"0.67em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h2:{fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h3:{fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h4:{marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h5:{fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h6:{fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},u:{textDecoration:"underline",display:"inline"},strong:{fontWeight:"bold",display:"inline"},b:{fontWeight:"bold",display:"inline"},i:{fontStyle:"italic",display:"inline"},em:{fontStyle:"italic",display:"inline"},code:{fontFamily:"monospace",display:"inline"},kbd:{fontFamily:"monospace",display:"inline"},pre:{fontFamily:"monospace",margin:"1em 0",display:"block"},mark:{backgroundColor:"yellow",color:"black",display:"inline"},big:{fontSize:"1.2em",display:"inline"},small:{fontSize:"0.8em",display:"inline"},s:{textDecoration:"line-through",display:"inline"},span:{display:"inline"},img:{display:"inline"},svg:{display:"inline"}};var K=new Set(["head","meta","link","style","script"]);function F(e){return K.has(e.type)}function u(e,t){return e.type===t&&"props"in e}function L(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function c(e){return typeof e=="object"&&e!==null&&"type"in e}function d(e){return typeof e=="function"}var U=Symbol.for("react.forward_ref"),q=Symbol.for("react.memo"),Z=Symbol.for("react.fragment");function $(e){return e.$$typeof===U}function A(e){return e.$$typeof===q}function x(e){return e.type===Z}function G(e){return typeof e=="string"||typeof e=="number"}function J(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Q(e){return Object.keys(e).map(t=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(e[t]).trim()}`).join(";")}var ee=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"]);function te(e,t){if(e==="children"||t==null)return;let r;if(e==="className"?r="class":ee.has(e)?r=L(e):r=e,typeof t=="boolean")return`${r}="${String(t)}"`;if(e==="style"&&typeof t=="object"){let n=Q(t);if(n)return`style="${J(n)}"`}return`${r}="${J(String(t))}"`}function re(e){return Object.entries(e).map(([t,r])=>te(t,r)).filter(t=>t!==void 0)}var ne=(e,t)=>{let r=e.props||{};if(d(e.type))return m(e.type(e.props));if(typeof e.type=="symbol"||typeof e.type!="string")return"";let n=re(r),i=r.children,o=Array.isArray(i)?i.map(s=>t(s)).join(""):t(i);return`<${e.type}${n.length>0?` ${n.join(" ")}`:""}>${o}</${e.type}>`},m=e=>e==null||e===!1?"":G(e)?String(e):Array.isArray(e)?e.map(m).join(""):c(e)?ne(e,m):"";function I(e){let t=e.props||{};if(!("xmlns"in t)){let r={...e,props:{...t,xmlns:"http://www.w3.org/2000/svg"}};return m(r)||""}return m(e)||""}async function ie(e,t){let r=await l(e,{presets:oe(t),tailwindClassesProperty:t?.tailwindClassesProperty??"tw"}),n=r.nodes,i;return n.length===0?i=R({}):n.length===1&&n[0]!==void 0?i=n[0]:i=R({children:n,style:{width:P(100),height:P(100)}}),{node:i,stylesheets:r.stylesheets}}async function l(e,t){return e==null||e===!1?{nodes:[],stylesheets:[]}:e instanceof Promise?l(await e,t):typeof e=="object"&&Symbol.iterator in e?pe(e,t):c(e)?await W(e,t):{nodes:[b({text:String(e),preset:t.presets?.span})],stylesheets:[]}}function C(e,t){let r={};for(let[n,i]of Object.entries(e))n==="children"||n==="className"||n==="id"||n==="style"||n===t||n==="ref"||n==="key"||n==="dangerouslySetInnerHTML"||n==="suppressHydrationWarning"||i==null||i===!1||typeof i=="function"||typeof i=="symbol"||typeof i!="object"&&(r[n]=i===!0?"":String(i));if(Object.keys(r).length!==0)return r}function oe(e){if(e?.defaultStyles!==!1)return e?.defaultStyles??T}function se(e,t){if(!(typeof e.type!="object"||e.type===null)){if($(e.type)&&"render"in e.type){let r=e.type;return l(r.render(e.props,null),t)}if(A(e.type)&&"type"in e.type){let n=e.type.type;if(d(n))return l(n(e.props),t);let i={...e,type:n};return W(i,t)}}}function y(e){if(typeof e.props=="object"&&e.props!==null&&"children"in e.props)return e.props.children}function M(e){if(!c(e))return;let t=y(e);if(typeof t=="string")return t;if(typeof t=="number")return String(t);if(Array.isArray(t)||typeof t=="object"&&t!==null&&Symbol.iterator in t)return z(t);if(c(t)&&x(t))return M(t)}function j(e){let t="";for(let r of e){let n=S(r);if(n===void 0)return;t+=n}return t}function S(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(!c(e))return;if(x(e))return S(y(e));let t=y(e);return t===void 0?"":typeof t=="object"&&t!==null&&Symbol.iterator in t?j(t):S(t)}function z(e){let t="";for(let r of e){if(c(r))return;if(typeof r=="string"){t+=r;continue}if(typeof r=="number"){t+=String(r);continue}return}return t}async function W(e,t){if(d(e.type))return l(e.type(e.props),t);let r=se(e,t);if(r!==void 0)return r;if(x(e))return H(e,t);if(u(e,"style")){let f=S(y(e));return{nodes:[],stylesheets:f&&f.length>0?[f]:[]}}if(typeof e.type!="string"||F(e))return{nodes:[],stylesheets:[]};let n=e.props,i=C(n,t.tailwindClassesProperty);if(u(e,"br"))return{nodes:[b({text:`
2
- `,preset:t.presets?.span,tagName:"br",className:e.props.className,id:e.props.id,attributes:i})],stylesheets:[]};if(u(e,"img"))return{nodes:[ae(e,t)],stylesheets:[]};if(u(e,"svg"))return{nodes:[ce(e,t)],stylesheets:[]};let{preset:o,style:s}=v(e,t),a=O(e,t),g=M(e);if(g!==void 0)return{nodes:[b({text:g,preset:o,style:s,tw:a,className:n.className,id:n.id,attributes:i,tagName:e.type})],stylesheets:[]};let p=await H(e,t);return{nodes:[R({children:p.nodes,preset:o,style:s,tw:a,tagName:e.type,className:n.className,id:n.id,attributes:i})],stylesheets:p.stylesheets}}function ae(e,t){if(!e.props.src)throw new Error("Image element must have a 'src' prop.");let{preset:r,style:n}=v(e,t),i=O(e,t),o=e.props.width!==void 0?Number(e.props.width):void 0,s=e.props.height!==void 0?Number(e.props.height):void 0;return E({src:e.props.src,width:o,height:s,preset:r,style:n,tw:i,className:e.props.className,id:e.props.id,attributes:C(e.props,t.tailwindClassesProperty),tagName:"img"})}function ce(e,t){let{preset:r,style:n}=v(e,t),i=O(e,t),o=I(e),s=e.props.width!==void 0?Number(e.props.width):void 0,a=e.props.height!==void 0?Number(e.props.height):void 0;return E({preset:r,width:s,height:a,style:n,src:o,tw:i,className:e.props.className,id:e.props.id,attributes:C(e.props,t.tailwindClassesProperty),tagName:"svg"})}function v(e,t){let r,n,i=t.presets;i&&typeof e.type=="string"&&e.type in i&&(r=i[e.type]);let o=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(o){for(let s in o)if(Object.hasOwn(o,s)){n=o;break}}return{preset:r,style:n}}function O(e,t){let r=t.tailwindClassesProperty;if(typeof e.props!="object"||e.props===null||!(r in e.props))return;let n=e.props[r];if(typeof n=="string")return n}function H(e,t){let r=y(e);return r===void 0?Promise.resolve({nodes:[],stylesheets:[]}):l(r,t)}var le=8;async function pe(e,t){let r=[],n=new Set,i=0;for(let a of e){let g=i;i+=1;let p=l(a,t).then(f=>{r[g]=f}).finally(()=>n.delete(p));n.add(p),n.size>=le&&await Promise.race(n)}await Promise.all(n);let o=[],s=[];for(let a of r)a&&(o.push(...a.nodes),s.push(...a.stylesheets));return{nodes:o,stylesheets:s}}0&&(module.exports={defaultStylePresets,fromJsx});
1
+ "use strict";var k=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var X=(e,t)=>{for(var r in t)k(e,r,{get:t[r],enumerable:!0})},D=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _(t))!V.call(e,o)&&o!==r&&k(e,o,{get:()=>t[o],enumerable:!(n=B(t,o))||n.enumerable});return e};var Y=e=>D(k({},"__esModule",{value:!0}),e);var fe={};X(fe,{defaultStylePresets:()=>T,fromJsx:()=>oe});module.exports=Y(fe);function h(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function N(e,t){t&&Object.keys(t).length>0&&(e.preset=t)}function w(e,t){t.tagName!==void 0&&(e.tagName=t.tagName),t.className!==void 0&&(e.className=t.className),t.id!==void 0&&(e.id=t.id),t.attributes!==void 0&&(e.attributes=t.attributes)}function R(e){let t={type:"container",children:e.children};return e.tw&&(t.tw=e.tw),w(t,e),N(t,e.preset),h(t,e.style),t}function b(e,t){if(typeof e=="string"){let n={type:"text",text:e};return h(n,t),n}let r={type:"text",text:e.text};return e.tw&&(r.tw=e.tw),w(r,e),N(r,e.preset),h(r,t??e.style),r}function E(e){let t={type:"image",src:e.src,width:e.width,height:e.height};return e.tw&&(t.tw=e.tw),w(t,e),N(t,e.preset),h(t,e.style),t}function P(e){return`${e}%`}var T={html:{display:"block"},head:{display:"none"},meta:{display:"none"},title:{display:"none"},link:{display:"none"},style:{display:"none"},script:{display:"none"},body:{margin:8,display:"block"},p:{marginTop:"1em",marginBottom:"1em",display:"block"},blockquote:{marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40,display:"block"},center:{textAlign:"center",display:"block"},hr:{marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"auto",marginRight:"auto",borderWidth:1,display:"block"},h1:{fontSize:"2em",marginTop:"0.67em",marginBottom:"0.67em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h2:{fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h3:{fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h4:{marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h5:{fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h6:{fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},u:{textDecoration:"underline"},strong:{fontWeight:"bold"},b:{fontWeight:"bold"},i:{fontStyle:"italic"},em:{fontStyle:"italic"},code:{fontFamily:"monospace"},kbd:{fontFamily:"monospace"},pre:{fontFamily:"monospace",margin:"1em 0",display:"block"},mark:{backgroundColor:"yellow",color:"black"},big:{fontSize:"1.2em"},small:{fontSize:"0.8em"},s:{textDecoration:"line-through"},div:{display:"block"}};var K=new Set(["head","meta","link","style","script"]);function F(e){return K.has(e.type)}function u(e,t){return e.type===t&&"props"in e}function L(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function c(e){return typeof e=="object"&&e!==null&&"type"in e}function d(e){return typeof e=="function"}var U=Symbol.for("react.forward_ref"),q=Symbol.for("react.memo"),Z=Symbol.for("react.fragment");function $(e){return e.$$typeof===U}function A(e){return e.$$typeof===q}function x(e){return e.type===Z}function G(e){return typeof e=="string"||typeof e=="number"}function J(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Q(e){return Object.keys(e).map(t=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(e[t]).trim()}`).join(";")}var ee=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"]);function te(e,t){if(e==="children"||t==null)return;let r;if(e==="className"?r="class":ee.has(e)?r=L(e):r=e,typeof t=="boolean")return`${r}="${String(t)}"`;if(e==="style"&&typeof t=="object"){let n=Q(t);if(n)return`style="${J(n)}"`}return`${r}="${J(String(t))}"`}function re(e){return Object.entries(e).map(([t,r])=>te(t,r)).filter(t=>t!==void 0)}var ne=(e,t)=>{let r=e.props||{};if(d(e.type))return m(e.type(e.props));if(typeof e.type=="symbol"||typeof e.type!="string")return"";let n=re(r),o=r.children,i=Array.isArray(o)?o.map(s=>t(s)).join(""):t(o);return`<${e.type}${n.length>0?` ${n.join(" ")}`:""}>${i}</${e.type}>`},m=e=>e==null||e===!1?"":G(e)?String(e):Array.isArray(e)?e.map(m).join(""):c(e)?ne(e,m):"";function I(e){let t=e.props||{};if(!("xmlns"in t)){let r={...e,props:{...t,xmlns:"http://www.w3.org/2000/svg"}};return m(r)||""}return m(e)||""}async function oe(e,t){let r=await l(e,{presets:ie(t),tailwindClassesProperty:t?.tailwindClassesProperty??"tw"}),n=r.nodes,o;return n.length===0?o=R({}):n.length===1&&n[0]!==void 0?o=n[0]:o=R({children:n,style:{width:P(100),height:P(100)}}),{node:o,stylesheets:r.stylesheets}}async function l(e,t){return e==null||e===!1?{nodes:[],stylesheets:[]}:e instanceof Promise?l(await e,t):typeof e=="object"&&Symbol.iterator in e?pe(e,t):c(e)?await W(e,t):{nodes:[b({text:String(e),preset:t.presets?.span})],stylesheets:[]}}function C(e,t){let r={};for(let[n,o]of Object.entries(e))n==="children"||n==="className"||n==="id"||n==="style"||n===t||n==="ref"||n==="key"||n==="dangerouslySetInnerHTML"||n==="suppressHydrationWarning"||o==null||o===!1||typeof o=="function"||typeof o=="symbol"||typeof o!="object"&&(r[n]=o===!0?"":String(o));if(Object.keys(r).length!==0)return r}function ie(e){if(e?.defaultStyles!==!1)return e?.defaultStyles??T}function se(e,t){if(!(typeof e.type!="object"||e.type===null)){if($(e.type)&&"render"in e.type){let r=e.type;return l(r.render(e.props,null),t)}if(A(e.type)&&"type"in e.type){let n=e.type.type;if(d(n))return l(n(e.props),t);let o={...e,type:n};return W(o,t)}}}function y(e){if(typeof e.props=="object"&&e.props!==null&&"children"in e.props)return e.props.children}function M(e){if(!c(e))return;let t=y(e);if(typeof t=="string")return t;if(typeof t=="number")return String(t);if(Array.isArray(t)||typeof t=="object"&&t!==null&&Symbol.iterator in t)return z(t);if(c(t)&&x(t))return M(t)}function j(e){let t="";for(let r of e){let n=S(r);if(n===void 0)return;t+=n}return t}function S(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(!c(e))return;if(x(e))return S(y(e));let t=y(e);return t===void 0?"":typeof t=="object"&&t!==null&&Symbol.iterator in t?j(t):S(t)}function z(e){let t="";for(let r of e){if(c(r))return;if(typeof r=="string"){t+=r;continue}if(typeof r=="number"){t+=String(r);continue}return}return t}async function W(e,t){if(d(e.type))return l(e.type(e.props),t);let r=se(e,t);if(r!==void 0)return r;if(x(e))return H(e,t);if(u(e,"style")){let f=S(y(e));return{nodes:[],stylesheets:f&&f.length>0?[f]:[]}}if(typeof e.type!="string"||F(e))return{nodes:[],stylesheets:[]};let n=e.props,o=C(n,t.tailwindClassesProperty);if(u(e,"br"))return{nodes:[b({text:`
2
+ `,preset:t.presets?.span,tagName:"br",className:e.props.className,id:e.props.id,attributes:o})],stylesheets:[]};if(u(e,"img"))return{nodes:[ae(e,t)],stylesheets:[]};if(u(e,"svg"))return{nodes:[ce(e,t)],stylesheets:[]};let{preset:i,style:s}=v(e,t),a=O(e,t),g=M(e);if(g!==void 0)return{nodes:[b({text:g,preset:i,style:s,tw:a,className:n.className,id:n.id,attributes:o,tagName:e.type})],stylesheets:[]};let p=await H(e,t);return{nodes:[R({children:p.nodes,preset:i,style:s,tw:a,tagName:e.type,className:n.className,id:n.id,attributes:o})],stylesheets:p.stylesheets}}function ae(e,t){if(!e.props.src)throw new Error("Image element must have a 'src' prop.");let{preset:r,style:n}=v(e,t),o=O(e,t),i=e.props.width!==void 0?Number(e.props.width):void 0,s=e.props.height!==void 0?Number(e.props.height):void 0;return E({src:e.props.src,width:i,height:s,preset:r,style:n,tw:o,className:e.props.className,id:e.props.id,attributes:C(e.props,t.tailwindClassesProperty),tagName:"img"})}function ce(e,t){let{preset:r,style:n}=v(e,t),o=O(e,t),i=I(e),s=e.props.width!==void 0?Number(e.props.width):void 0,a=e.props.height!==void 0?Number(e.props.height):void 0;return E({preset:r,width:s,height:a,style:n,src:i,tw:o,className:e.props.className,id:e.props.id,attributes:C(e.props,t.tailwindClassesProperty),tagName:"svg"})}function v(e,t){let r,n,o=t.presets;o&&typeof e.type=="string"&&e.type in o&&(r=o[e.type]);let 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){for(let s in i)if(Object.hasOwn(i,s)){n=i;break}}return{preset:r,style:n}}function O(e,t){let r=t.tailwindClassesProperty;if(typeof e.props!="object"||e.props===null||!(r in e.props))return;let n=e.props[r];if(typeof n=="string")return n}function H(e,t){let r=y(e);return r===void 0?Promise.resolve({nodes:[],stylesheets:[]}):l(r,t)}var le=8;async function pe(e,t){let r=[],n=new Set,o=0;for(let a of e){let g=o;o+=1;let p=l(a,t).then(f=>{r[g]=f}).finally(()=>n.delete(p));n.add(p),n.size>=le&&await Promise.race(n)}await Promise.all(n);let i=[],s=[];for(let a of r)a&&(i.push(...a.nodes),s.push(...a.stylesheets));return{nodes:i,stylesheets:s}}0&&(module.exports={defaultStylePresets,fromJsx});
@@ -1,5 +1,5 @@
1
1
  import { JSX, CSSProperties, ReactNode } from 'react';
2
- import { b as Node } from '../types-DS15vfPf.cjs';
2
+ import { b as Node } from '../types-DAQVXLBC.cjs';
3
3
 
4
4
  declare const defaultStylePresets: Partial<Record<keyof JSX.IntrinsicElements, CSSProperties>>;
5
5
 
package/dist/jsx/jsx.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { JSX, CSSProperties, ReactNode } from 'react';
2
- import { b as Node } from '../types-DS15vfPf.js';
2
+ import { b as Node } from '../types-DAQVXLBC.js';
3
3
 
4
4
  declare const defaultStylePresets: Partial<Record<keyof JSX.IntrinsicElements, CSSProperties>>;
5
5
 
package/dist/jsx/jsx.js CHANGED
@@ -1,2 +1,2 @@
1
- function h(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function k(e,t){t&&Object.keys(t).length>0&&(e.preset=t)}function N(e,t){t.tagName!==void 0&&(e.tagName=t.tagName),t.className!==void 0&&(e.className=t.className),t.id!==void 0&&(e.id=t.id),t.attributes!==void 0&&(e.attributes=t.attributes)}function R(e){let t={type:"container",children:e.children};return e.tw&&(t.tw=e.tw),N(t,e),k(t,e.preset),h(t,e.style),t}function b(e,t){if(typeof e=="string"){let n={type:"text",text:e};return h(n,t),n}let r={type:"text",text:e.text};return e.tw&&(r.tw=e.tw),N(r,e),k(r,e.preset),h(r,t??e.style),r}function w(e){let t={type:"image",src:e.src,width:e.width,height:e.height};return e.tw&&(t.tw=e.tw),N(t,e),k(t,e.preset),h(t,e.style),t}function E(e){return`${e}%`}var v={body:{margin:8},p:{marginTop:"1em",marginBottom:"1em",display:"block"},blockquote:{marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40,display:"block"},center:{textAlign:"center",display:"block"},hr:{marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"auto",marginRight:"auto",borderWidth:1,display:"block"},h1:{fontSize:"2em",marginTop:"0.67em",marginBottom:"0.67em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h2:{fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h3:{fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h4:{marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h5:{fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h6:{fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},u:{textDecoration:"underline",display:"inline"},strong:{fontWeight:"bold",display:"inline"},b:{fontWeight:"bold",display:"inline"},i:{fontStyle:"italic",display:"inline"},em:{fontStyle:"italic",display:"inline"},code:{fontFamily:"monospace",display:"inline"},kbd:{fontFamily:"monospace",display:"inline"},pre:{fontFamily:"monospace",margin:"1em 0",display:"block"},mark:{backgroundColor:"yellow",color:"black",display:"inline"},big:{fontSize:"1.2em",display:"inline"},small:{fontSize:"0.8em",display:"inline"},s:{textDecoration:"line-through",display:"inline"},span:{display:"inline"},img:{display:"inline"},svg:{display:"inline"}};var W=new Set(["head","meta","link","style","script"]);function O(e){return W.has(e.type)}function u(e,t){return e.type===t&&"props"in e}function F(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function c(e){return typeof e=="object"&&e!==null&&"type"in e}function d(e){return typeof e=="function"}var B=Symbol.for("react.forward_ref"),_=Symbol.for("react.memo"),V=Symbol.for("react.fragment");function L(e){return e.$$typeof===B}function $(e){return e.$$typeof===_}function x(e){return e.type===V}function X(e){return typeof e=="string"||typeof e=="number"}function A(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function D(e){return Object.keys(e).map(t=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(e[t]).trim()}`).join(";")}var Y=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"]);function K(e,t){if(e==="children"||t==null)return;let r;if(e==="className"?r="class":Y.has(e)?r=F(e):r=e,typeof t=="boolean")return`${r}="${String(t)}"`;if(e==="style"&&typeof t=="object"){let n=D(t);if(n)return`style="${A(n)}"`}return`${r}="${A(String(t))}"`}function U(e){return Object.entries(e).map(([t,r])=>K(t,r)).filter(t=>t!==void 0)}var q=(e,t)=>{let r=e.props||{};if(d(e.type))return m(e.type(e.props));if(typeof e.type=="symbol"||typeof e.type!="string")return"";let n=U(r),i=r.children,o=Array.isArray(i)?i.map(s=>t(s)).join(""):t(i);return`<${e.type}${n.length>0?` ${n.join(" ")}`:""}>${o}</${e.type}>`},m=e=>e==null||e===!1?"":X(e)?String(e):Array.isArray(e)?e.map(m).join(""):c(e)?q(e,m):"";function J(e){let t=e.props||{};if(!("xmlns"in t)){let r={...e,props:{...t,xmlns:"http://www.w3.org/2000/svg"}};return m(r)||""}return m(e)||""}async function ue(e,t){let r=await l(e,{presets:Z(t),tailwindClassesProperty:t?.tailwindClassesProperty??"tw"}),n=r.nodes,i;return n.length===0?i=R({}):n.length===1&&n[0]!==void 0?i=n[0]:i=R({children:n,style:{width:E(100),height:E(100)}}),{node:i,stylesheets:r.stylesheets}}async function l(e,t){return e==null||e===!1?{nodes:[],stylesheets:[]}:e instanceof Promise?l(await e,t):typeof e=="object"&&Symbol.iterator in e?re(e,t):c(e)?await M(e,t):{nodes:[b({text:String(e),preset:t.presets?.span})],stylesheets:[]}}function P(e,t){let r={};for(let[n,i]of Object.entries(e))n==="children"||n==="className"||n==="id"||n==="style"||n===t||n==="ref"||n==="key"||n==="dangerouslySetInnerHTML"||n==="suppressHydrationWarning"||i==null||i===!1||typeof i=="function"||typeof i=="symbol"||typeof i!="object"&&(r[n]=i===!0?"":String(i));if(Object.keys(r).length!==0)return r}function Z(e){if(e?.defaultStyles!==!1)return e?.defaultStyles??v}function G(e,t){if(!(typeof e.type!="object"||e.type===null)){if(L(e.type)&&"render"in e.type){let r=e.type;return l(r.render(e.props,null),t)}if($(e.type)&&"type"in e.type){let n=e.type.type;if(d(n))return l(n(e.props),t);let i={...e,type:n};return M(i,t)}}}function y(e){if(typeof e.props=="object"&&e.props!==null&&"children"in e.props)return e.props.children}function H(e){if(!c(e))return;let t=y(e);if(typeof t=="string")return t;if(typeof t=="number")return String(t);if(Array.isArray(t)||typeof t=="object"&&t!==null&&Symbol.iterator in t)return j(t);if(c(t)&&x(t))return H(t)}function I(e){let t="";for(let r of e){let n=S(r);if(n===void 0)return;t+=n}return t}function S(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(!c(e))return;if(x(e))return S(y(e));let t=y(e);return t===void 0?"":typeof t=="object"&&t!==null&&Symbol.iterator in t?I(t):S(t)}function j(e){let t="";for(let r of e){if(c(r))return;if(typeof r=="string"){t+=r;continue}if(typeof r=="number"){t+=String(r);continue}return}return t}async function M(e,t){if(d(e.type))return l(e.type(e.props),t);let r=G(e,t);if(r!==void 0)return r;if(x(e))return z(e,t);if(u(e,"style")){let f=S(y(e));return{nodes:[],stylesheets:f&&f.length>0?[f]:[]}}if(typeof e.type!="string"||O(e))return{nodes:[],stylesheets:[]};let n=e.props,i=P(n,t.tailwindClassesProperty);if(u(e,"br"))return{nodes:[b({text:`
2
- `,preset:t.presets?.span,tagName:"br",className:e.props.className,id:e.props.id,attributes:i})],stylesheets:[]};if(u(e,"img"))return{nodes:[Q(e,t)],stylesheets:[]};if(u(e,"svg"))return{nodes:[ee(e,t)],stylesheets:[]};let{preset:o,style:s}=T(e,t),a=C(e,t),g=H(e);if(g!==void 0)return{nodes:[b({text:g,preset:o,style:s,tw:a,className:n.className,id:n.id,attributes:i,tagName:e.type})],stylesheets:[]};let p=await z(e,t);return{nodes:[R({children:p.nodes,preset:o,style:s,tw:a,tagName:e.type,className:n.className,id:n.id,attributes:i})],stylesheets:p.stylesheets}}function Q(e,t){if(!e.props.src)throw new Error("Image element must have a 'src' prop.");let{preset:r,style:n}=T(e,t),i=C(e,t),o=e.props.width!==void 0?Number(e.props.width):void 0,s=e.props.height!==void 0?Number(e.props.height):void 0;return w({src:e.props.src,width:o,height:s,preset:r,style:n,tw:i,className:e.props.className,id:e.props.id,attributes:P(e.props,t.tailwindClassesProperty),tagName:"img"})}function ee(e,t){let{preset:r,style:n}=T(e,t),i=C(e,t),o=J(e),s=e.props.width!==void 0?Number(e.props.width):void 0,a=e.props.height!==void 0?Number(e.props.height):void 0;return w({preset:r,width:s,height:a,style:n,src:o,tw:i,className:e.props.className,id:e.props.id,attributes:P(e.props,t.tailwindClassesProperty),tagName:"svg"})}function T(e,t){let r,n,i=t.presets;i&&typeof e.type=="string"&&e.type in i&&(r=i[e.type]);let o=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(o){for(let s in o)if(Object.hasOwn(o,s)){n=o;break}}return{preset:r,style:n}}function C(e,t){let r=t.tailwindClassesProperty;if(typeof e.props!="object"||e.props===null||!(r in e.props))return;let n=e.props[r];if(typeof n=="string")return n}function z(e,t){let r=y(e);return r===void 0?Promise.resolve({nodes:[],stylesheets:[]}):l(r,t)}var te=8;async function re(e,t){let r=[],n=new Set,i=0;for(let a of e){let g=i;i+=1;let p=l(a,t).then(f=>{r[g]=f}).finally(()=>n.delete(p));n.add(p),n.size>=te&&await Promise.race(n)}await Promise.all(n);let o=[],s=[];for(let a of r)a&&(o.push(...a.nodes),s.push(...a.stylesheets));return{nodes:o,stylesheets:s}}export{v as defaultStylePresets,ue as fromJsx};
1
+ function h(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function k(e,t){t&&Object.keys(t).length>0&&(e.preset=t)}function N(e,t){t.tagName!==void 0&&(e.tagName=t.tagName),t.className!==void 0&&(e.className=t.className),t.id!==void 0&&(e.id=t.id),t.attributes!==void 0&&(e.attributes=t.attributes)}function R(e){let t={type:"container",children:e.children};return e.tw&&(t.tw=e.tw),N(t,e),k(t,e.preset),h(t,e.style),t}function b(e,t){if(typeof e=="string"){let n={type:"text",text:e};return h(n,t),n}let r={type:"text",text:e.text};return e.tw&&(r.tw=e.tw),N(r,e),k(r,e.preset),h(r,t??e.style),r}function w(e){let t={type:"image",src:e.src,width:e.width,height:e.height};return e.tw&&(t.tw=e.tw),N(t,e),k(t,e.preset),h(t,e.style),t}function E(e){return`${e}%`}var v={html:{display:"block"},head:{display:"none"},meta:{display:"none"},title:{display:"none"},link:{display:"none"},style:{display:"none"},script:{display:"none"},body:{margin:8,display:"block"},p:{marginTop:"1em",marginBottom:"1em",display:"block"},blockquote:{marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40,display:"block"},center:{textAlign:"center",display:"block"},hr:{marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"auto",marginRight:"auto",borderWidth:1,display:"block"},h1:{fontSize:"2em",marginTop:"0.67em",marginBottom:"0.67em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h2:{fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h3:{fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h4:{marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h5:{fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h6:{fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},u:{textDecoration:"underline"},strong:{fontWeight:"bold"},b:{fontWeight:"bold"},i:{fontStyle:"italic"},em:{fontStyle:"italic"},code:{fontFamily:"monospace"},kbd:{fontFamily:"monospace"},pre:{fontFamily:"monospace",margin:"1em 0",display:"block"},mark:{backgroundColor:"yellow",color:"black"},big:{fontSize:"1.2em"},small:{fontSize:"0.8em"},s:{textDecoration:"line-through"},div:{display:"block"}};var W=new Set(["head","meta","link","style","script"]);function O(e){return W.has(e.type)}function u(e,t){return e.type===t&&"props"in e}function F(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function c(e){return typeof e=="object"&&e!==null&&"type"in e}function d(e){return typeof e=="function"}var B=Symbol.for("react.forward_ref"),_=Symbol.for("react.memo"),V=Symbol.for("react.fragment");function L(e){return e.$$typeof===B}function $(e){return e.$$typeof===_}function x(e){return e.type===V}function X(e){return typeof e=="string"||typeof e=="number"}function A(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function D(e){return Object.keys(e).map(t=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(e[t]).trim()}`).join(";")}var Y=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"]);function K(e,t){if(e==="children"||t==null)return;let r;if(e==="className"?r="class":Y.has(e)?r=F(e):r=e,typeof t=="boolean")return`${r}="${String(t)}"`;if(e==="style"&&typeof t=="object"){let n=D(t);if(n)return`style="${A(n)}"`}return`${r}="${A(String(t))}"`}function U(e){return Object.entries(e).map(([t,r])=>K(t,r)).filter(t=>t!==void 0)}var q=(e,t)=>{let r=e.props||{};if(d(e.type))return m(e.type(e.props));if(typeof e.type=="symbol"||typeof e.type!="string")return"";let n=U(r),o=r.children,i=Array.isArray(o)?o.map(s=>t(s)).join(""):t(o);return`<${e.type}${n.length>0?` ${n.join(" ")}`:""}>${i}</${e.type}>`},m=e=>e==null||e===!1?"":X(e)?String(e):Array.isArray(e)?e.map(m).join(""):c(e)?q(e,m):"";function J(e){let t=e.props||{};if(!("xmlns"in t)){let r={...e,props:{...t,xmlns:"http://www.w3.org/2000/svg"}};return m(r)||""}return m(e)||""}async function ue(e,t){let r=await l(e,{presets:Z(t),tailwindClassesProperty:t?.tailwindClassesProperty??"tw"}),n=r.nodes,o;return n.length===0?o=R({}):n.length===1&&n[0]!==void 0?o=n[0]:o=R({children:n,style:{width:E(100),height:E(100)}}),{node:o,stylesheets:r.stylesheets}}async function l(e,t){return e==null||e===!1?{nodes:[],stylesheets:[]}:e instanceof Promise?l(await e,t):typeof e=="object"&&Symbol.iterator in e?re(e,t):c(e)?await M(e,t):{nodes:[b({text:String(e),preset:t.presets?.span})],stylesheets:[]}}function P(e,t){let r={};for(let[n,o]of Object.entries(e))n==="children"||n==="className"||n==="id"||n==="style"||n===t||n==="ref"||n==="key"||n==="dangerouslySetInnerHTML"||n==="suppressHydrationWarning"||o==null||o===!1||typeof o=="function"||typeof o=="symbol"||typeof o!="object"&&(r[n]=o===!0?"":String(o));if(Object.keys(r).length!==0)return r}function Z(e){if(e?.defaultStyles!==!1)return e?.defaultStyles??v}function G(e,t){if(!(typeof e.type!="object"||e.type===null)){if(L(e.type)&&"render"in e.type){let r=e.type;return l(r.render(e.props,null),t)}if($(e.type)&&"type"in e.type){let n=e.type.type;if(d(n))return l(n(e.props),t);let o={...e,type:n};return M(o,t)}}}function y(e){if(typeof e.props=="object"&&e.props!==null&&"children"in e.props)return e.props.children}function H(e){if(!c(e))return;let t=y(e);if(typeof t=="string")return t;if(typeof t=="number")return String(t);if(Array.isArray(t)||typeof t=="object"&&t!==null&&Symbol.iterator in t)return j(t);if(c(t)&&x(t))return H(t)}function I(e){let t="";for(let r of e){let n=S(r);if(n===void 0)return;t+=n}return t}function S(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(!c(e))return;if(x(e))return S(y(e));let t=y(e);return t===void 0?"":typeof t=="object"&&t!==null&&Symbol.iterator in t?I(t):S(t)}function j(e){let t="";for(let r of e){if(c(r))return;if(typeof r=="string"){t+=r;continue}if(typeof r=="number"){t+=String(r);continue}return}return t}async function M(e,t){if(d(e.type))return l(e.type(e.props),t);let r=G(e,t);if(r!==void 0)return r;if(x(e))return z(e,t);if(u(e,"style")){let f=S(y(e));return{nodes:[],stylesheets:f&&f.length>0?[f]:[]}}if(typeof e.type!="string"||O(e))return{nodes:[],stylesheets:[]};let n=e.props,o=P(n,t.tailwindClassesProperty);if(u(e,"br"))return{nodes:[b({text:`
2
+ `,preset:t.presets?.span,tagName:"br",className:e.props.className,id:e.props.id,attributes:o})],stylesheets:[]};if(u(e,"img"))return{nodes:[Q(e,t)],stylesheets:[]};if(u(e,"svg"))return{nodes:[ee(e,t)],stylesheets:[]};let{preset:i,style:s}=T(e,t),a=C(e,t),g=H(e);if(g!==void 0)return{nodes:[b({text:g,preset:i,style:s,tw:a,className:n.className,id:n.id,attributes:o,tagName:e.type})],stylesheets:[]};let p=await z(e,t);return{nodes:[R({children:p.nodes,preset:i,style:s,tw:a,tagName:e.type,className:n.className,id:n.id,attributes:o})],stylesheets:p.stylesheets}}function Q(e,t){if(!e.props.src)throw new Error("Image element must have a 'src' prop.");let{preset:r,style:n}=T(e,t),o=C(e,t),i=e.props.width!==void 0?Number(e.props.width):void 0,s=e.props.height!==void 0?Number(e.props.height):void 0;return w({src:e.props.src,width:i,height:s,preset:r,style:n,tw:o,className:e.props.className,id:e.props.id,attributes:P(e.props,t.tailwindClassesProperty),tagName:"img"})}function ee(e,t){let{preset:r,style:n}=T(e,t),o=C(e,t),i=J(e),s=e.props.width!==void 0?Number(e.props.width):void 0,a=e.props.height!==void 0?Number(e.props.height):void 0;return w({preset:r,width:s,height:a,style:n,src:i,tw:o,className:e.props.className,id:e.props.id,attributes:P(e.props,t.tailwindClassesProperty),tagName:"svg"})}function T(e,t){let r,n,o=t.presets;o&&typeof e.type=="string"&&e.type in o&&(r=o[e.type]);let 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){for(let s in i)if(Object.hasOwn(i,s)){n=i;break}}return{preset:r,style:n}}function C(e,t){let r=t.tailwindClassesProperty;if(typeof e.props!="object"||e.props===null||!(r in e.props))return;let n=e.props[r];if(typeof n=="string")return n}function z(e,t){let r=y(e);return r===void 0?Promise.resolve({nodes:[],stylesheets:[]}):l(r,t)}var te=8;async function re(e,t){let r=[],n=new Set,o=0;for(let a of e){let g=o;o+=1;let p=l(a,t).then(f=>{r[g]=f}).finally(()=>n.delete(p));n.add(p),n.size>=te&&await Promise.race(n)}await Promise.all(n);let i=[],s=[];for(let a of r)a&&(i.push(...a.nodes),s.push(...a.stylesheets));return{nodes:i,stylesheets:s}}export{v as defaultStylePresets,ue as fromJsx};
@@ -10,10 +10,6 @@ type NodeMetadata = {
10
10
  style?: CSSProperties;
11
11
  preset?: CSSProperties;
12
12
  };
13
- /**
14
- * @deprecated Use {import("csstype").Properties} or {import("react").CSSProperties} instead
15
- */
16
- type PartialStyle = CSSProperties;
17
13
  type Node = ContainerNode | TextNode | ImageNode;
18
14
  type ContainerNode = NodeMetadata & {
19
15
  type: "container";
@@ -30,4 +26,4 @@ type ImageNode = NodeMetadata & {
30
26
  height?: number;
31
27
  };
32
28
 
33
- export type { ContainerNode as C, ImageNode as I, NodeAttributes as N, PartialStyle as P, TextNode as T, NodeMetadata as a, Node as b };
29
+ export type { ContainerNode as C, ImageNode as I, NodeAttributes as N, TextNode as T, NodeMetadata as a, Node as b };
@@ -10,10 +10,6 @@ type NodeMetadata = {
10
10
  style?: CSSProperties;
11
11
  preset?: CSSProperties;
12
12
  };
13
- /**
14
- * @deprecated Use {import("csstype").Properties} or {import("react").CSSProperties} instead
15
- */
16
- type PartialStyle = CSSProperties;
17
13
  type Node = ContainerNode | TextNode | ImageNode;
18
14
  type ContainerNode = NodeMetadata & {
19
15
  type: "container";
@@ -30,4 +26,4 @@ type ImageNode = NodeMetadata & {
30
26
  height?: number;
31
27
  };
32
28
 
33
- export type { ContainerNode as C, ImageNode as I, NodeAttributes as N, PartialStyle as P, TextNode as T, NodeMetadata as a, Node as b };
29
+ export type { ContainerNode as C, ImageNode as I, NodeAttributes as N, TextNode as T, NodeMetadata as a, Node as b };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takumi-rs/helpers",
3
- "version": "0.73.0",
3
+ "version": "1.0.0-beta.0",
4
4
  "author": {
5
5
  "email": "me@kane.tw",
6
6
  "name": "Kane Wang",