@takumi-rs/helpers 0.51.1 → 0.52.1

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.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var a=(t,e)=>{for(var n in e)u(t,n,{get:e[n],enumerable:!0})},d=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of m(e))!c.call(t,o)&&o!==n&&u(t,o,{get:()=>e[o],enumerable:!(r=x(e,o))||r.enumerable});return t};var y=t=>d(u({},"__esModule",{value:!0}),t);var w={};a(w,{container:()=>p,em:()=>T,fr:()=>I,image:()=>l,percentage:()=>g,rem:()=>C,rgba:()=>S,style:()=>N,text:()=>f,vh:()=>s,vw:()=>b});module.exports=y(w);function i(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function p(t){let e={type:"container",children:t.children,tw:t.tw};return i(e,t.style),e}function f(t,e){if(typeof t=="string"){let r={type:"text",text:t};return i(r,e),r}let n={type:"text",text:t.text,tw:t.tw};return i(n,e??t.style),n}function l(t){let e={type:"image",src:t.src};return i(e,t.style),e}function N(t){return t}function g(t){return{percentage:t}}function b(t){return{vw:t}}function s(t){return{vh:t}}function T(t){return{em:t}}function C(t){return{rem:t}}function I(t){return{fr:t}}function S(t,e,n,r=1){return[t,e,n,r]}0&&(module.exports={container,em,fr,image,percentage,rem,rgba,style,text,vh,vw});
1
+ "use strict";var u=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var c=(t,e)=>{for(var n in e)u(t,n,{get:e[n],enumerable:!0})},a=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of d(e))!m.call(t,o)&&o!==n&&u(t,o,{get:()=>e[o],enumerable:!(r=x(e,o))||r.enumerable});return t};var y=t=>a(u({},"__esModule",{value:!0}),t);var s={};c(s,{container:()=>f,em:()=>w,fr:()=>C,image:()=>N,percentage:()=>g,rem:()=>T,rgba:()=>I,style:()=>p,text:()=>l,vh:()=>h,vw:()=>b});module.exports=y(s);function i(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function f(t){let e={type:"container",children:t.children,tw:t.tw};return i(e,t.style),e}function l(t,e){if(typeof t=="string"){let r={type:"text",text:t};return i(r,e),r}let n={type:"text",text:t.text,tw:t.tw};return i(n,e??t.style),n}function N(t){let e={type:"image",src:t.src,width:t.width,height:t.height,tw:t.tw};return i(e,t.style),e}function p(t){return t}function g(t){return{percentage:t}}function b(t){return{vw:t}}function h(t){return{vh:t}}function w(t){return{em:t}}function T(t){return{rem:t}}function C(t){return{fr:t}}function I(t,e,n,r=1){return[t,e,n,r]}0&&(module.exports={container,em,fr,image,percentage,rem,rgba,style,text,vh,vw});
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as ColorInput } from './types-D9v4-kzl.cjs';
2
- export { A as AnyNode, J as JsonValue, N as Node } from './types-D9v4-kzl.cjs';
1
+ import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as ColorInput } from './types-Dm5SijB6.cjs';
2
+ export { A as AnyNode, J as JsonValue, N as Node } from './types-Dm5SijB6.cjs';
3
3
 
4
4
  declare function container(props: Omit<ContainerNode, "type">): ContainerNode;
5
5
  declare function text(text: string, style?: PartialStyle): TextNode;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as ColorInput } from './types-D9v4-kzl.js';
2
- export { A as AnyNode, J as JsonValue, N as Node } from './types-D9v4-kzl.js';
1
+ import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as ColorInput } from './types-Dm5SijB6.js';
2
+ export { A as AnyNode, J as JsonValue, N as Node } from './types-Dm5SijB6.js';
3
3
 
4
4
  declare function container(props: Omit<ContainerNode, "type">): ContainerNode;
5
5
  declare function text(text: string, style?: PartialStyle): TextNode;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- function o(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function i(t){let e={type:"container",children:t.children,tw:t.tw};return o(e,t.style),e}function u(t,e){if(typeof t=="string"){let r={type:"text",text:t};return o(r,e),r}let n={type:"text",text:t.text,tw:t.tw};return o(n,e??t.style),n}function x(t){let e={type:"image",src:t.src};return o(e,t.style),e}function m(t){return t}function c(t){return{percentage:t}}function a(t){return{vw:t}}function d(t){return{vh:t}}function y(t){return{em:t}}function p(t){return{rem:t}}function f(t){return{fr:t}}function l(t,e,n,r=1){return[t,e,n,r]}export{i as container,y as em,f as fr,x as image,c as percentage,p as rem,l as rgba,m as style,u as text,d as vh,a as vw};
1
+ function o(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function i(t){let e={type:"container",children:t.children,tw:t.tw};return o(e,t.style),e}function u(t,e){if(typeof t=="string"){let r={type:"text",text:t};return o(r,e),r}let n={type:"text",text:t.text,tw:t.tw};return o(n,e??t.style),n}function x(t){let e={type:"image",src:t.src,width:t.width,height:t.height,tw:t.tw};return o(e,t.style),e}function d(t){return t}function m(t){return{percentage:t}}function c(t){return{vw:t}}function a(t){return{vh:t}}function y(t){return{em:t}}function f(t){return{rem:t}}function l(t){return{fr:t}}function N(t,e,n,r=1){return[t,e,n,r]}export{i as container,y as em,l as fr,x as image,m as percentage,f as rem,N as rgba,d as style,u as text,a as vh,c as vw};
package/dist/jsx/jsx.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var g=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var W=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},j=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of $(e))!I.call(t,o)&&o!==r&&g(t,o,{get:()=>e[o],enumerable:!(n=O(e,o))||n.enumerable});return t};var z=t=>j(g({},"__esModule",{value:!0}),t);var tt={};W(tt,{fromJsx:()=>K});module.exports=z(tt);function l(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function f(t){let e={type:"container",children:t.children,tw:t.tw};return l(e,t.style),e}function m(t,e){if(typeof t=="string"){let n={type:"text",text:t};return l(n,e),n}let r={type:"text",text:t.text,tw:t.tw};return l(r,e??t.style),r}function d(t){let e={type:"image",src:t.src};return l(e,t.style),e}function k(t){return{percentage:t}}var a={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:0,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 F=new Set(["head","meta","link","style","script"]);function S(t){return F.has(t.type)}function u(t,e){return t.type===e&&"props"in t}function E(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(t){return typeof t=="object"&&t!==null&&"type"in t}function p(t){return typeof t=="function"}var B=Symbol.for("react.forward_ref"),M=Symbol.for("react.memo"),H=Symbol.for("react.fragment");function P(t){return t.$$typeof===B}function w(t){return t.$$typeof===M}function R(t){return t.type===H}function _(t){return typeof t=="string"||typeof t=="number"}function T(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function D(t){return Object.keys(t).map(e=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(t[e]).trim()}`).join(";")}var V=["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 X(t,e){if(t==="children"||e==null)return;let r;if(t==="className"?r="class":V.includes(t)?r=E(t):r=t,typeof e=="boolean")return`${r}="${String(e)}"`;if(t==="style"&&typeof e=="object"){let n=D(e);if(n)return`style="${T(n)}"`}return`${r}="${T(String(e))}"`}function J(t){return Object.entries(t).map(([e,r])=>X(e,r)).filter(e=>e!==void 0)}var Y=(t,e)=>{let r=t.props||{};if(p(t.type))return c(t.type(t.props));if(typeof t.type=="symbol"||typeof t.type!="string")return"";let n=J(r),o=r.children,y=Array.isArray(o)?o.map(x=>e(x)).join(""):e(o);return`<${t.type}${n.length>0?` ${n.join(" ")}`:""}>${y}</${t.type}>`},c=t=>t==null||t===!1?"":_(t)?String(t):Array.isArray(t)?t.map(c).join(""):i(t)?Y(t,c):"";function N(t){let e=t.props||{};if(!("xmlns"in e)){let r={...t,props:{...e,xmlns:"http://www.w3.org/2000/svg"}};return c(r)||""}return c(t)||""}async function K(t){let e=await s(t);return e.length===0?f({}):e.length===1&&e[0]!==void 0?e[0]:f({children:e,style:{width:k(100),height:k(100)}})}async function s(t){if(t==null||t===!1)return[];if(t instanceof Promise)return s(await t);if(typeof t=="object"&&Symbol.iterator in t)return Q(t);if(i(t)){let e=await A(t);return Array.isArray(e)?e:e?[e]:[]}return[m(String(t),a.span)]}function q(t){if(!(typeof t.type!="object"||t.type===null)){if(P(t.type)&&"render"in t.type){let e=t.type;return s(e.render(t.props,null))}if(w(t.type)&&"type"in t.type){let r=t.type.type;if(p(r))return s(r(t.props));let n={...t,type:r};return A(n)}}}function L(t){if(!i(t))return Promise.resolve(void 0);let e=typeof t.props=="object"&&t.props!==null&&"children"in t.props?t.props.children:void 0;return typeof e=="string"?Promise.resolve(e):typeof e=="number"?Promise.resolve(String(e)):Array.isArray(e)?Promise.resolve(C(e)):typeof e=="object"&&e!==null&&Symbol.iterator in e?Promise.resolve(C(Array.from(e))):i(e)&&R(e)?L(e):Promise.resolve(void 0)}function C(t){if(!t.some(e=>i(e)))return t.map(e=>typeof e=="string"?e:typeof e=="number"?String(e):"").join("")}async function A(t){if(p(t.type))return s(t.type(t.props));let e=q(t);if(e!==void 0)return e;if(R(t))return await v(t)||[];if(S(t))return[];if(u(t,"br"))return[m(`
2
- `,a.span)];if(u(t,"img"))return[Z(t)];if(u(t,"svg"))return[G(t)];let r=b(t),n=h(t),o=await L(t);if(o!==void 0)return[m({text:o,style:r,tw:n})];let y=await v(t);return[f({children:y,style:r,tw:n})]}function Z(t){if(!t.props.src)throw new Error("Image element must have a 'src' prop.");let e=b(t),r=h(t);return d({src:t.props.src,style:e,tw:r})}function G(t){let e=b(t),r=h(t),n=N(t);return d({style:e,src:n,tw:r})}var U={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function b(t){let e={};typeof t.type=="string"&&t.type in a&&Object.assign(e,a[t.type]);let r=typeof t.props=="object"&&t.props!==null&&"style"in t.props&&typeof t.props.style=="object"&&t.props.style!==null?t.props.style:void 0;if(r&&Object.keys(r).length>0){for(let[n,o]of Object.entries(U))n in r&&(e[o]=r[n],delete r[n]);Object.assign(e,r)}return e}function h(t){if(!(typeof t.props!="object"||t.props===null||!("tw"in t.props)))return t.props.tw}function v(t){return typeof t.props!="object"||t.props===null||!("children"in t.props)?Promise.resolve([]):s(t.props.children)}function Q(t){return Promise.all(Array.from(t).map(e=>s(e))).then(e=>e.flat())}0&&(module.exports={fromJsx});
1
+ "use strict";var g=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var W=(t,e)=>{for(var n in e)g(t,n,{get:e[n],enumerable:!0})},j=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of $(e))!I.call(t,o)&&o!==n&&g(t,o,{get:()=>e[o],enumerable:!(r=O(e,o))||r.enumerable});return t};var z=t=>j(g({},"__esModule",{value:!0}),t);var tt={};W(tt,{fromJsx:()=>K});module.exports=z(tt);function l(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function f(t){let e={type:"container",children:t.children,tw:t.tw};return l(e,t.style),e}function m(t,e){if(typeof t=="string"){let r={type:"text",text:t};return l(r,e),r}let n={type:"text",text:t.text,tw:t.tw};return l(n,e??t.style),n}function d(t){let e={type:"image",src:t.src,width:t.width,height:t.height,tw:t.tw};return l(e,t.style),e}function h(t){return{percentage:t}}var a={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:0,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 F=new Set(["head","meta","link","style","script"]);function S(t){return F.has(t.type)}function u(t,e){return t.type===e&&"props"in t}function E(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(t){return typeof t=="object"&&t!==null&&"type"in t}function p(t){return typeof t=="function"}var B=Symbol.for("react.forward_ref"),M=Symbol.for("react.memo"),H=Symbol.for("react.fragment");function w(t){return t.$$typeof===B}function P(t){return t.$$typeof===M}function k(t){return t.type===H}function _(t){return typeof t=="string"||typeof t=="number"}function T(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function D(t){return Object.keys(t).map(e=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(t[e]).trim()}`).join(";")}var V=["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 X(t,e){if(t==="children"||e==null)return;let n;if(t==="className"?n="class":V.includes(t)?n=E(t):n=t,typeof e=="boolean")return`${n}="${String(e)}"`;if(t==="style"&&typeof e=="object"){let r=D(e);if(r)return`style="${T(r)}"`}return`${n}="${T(String(e))}"`}function J(t){return Object.entries(t).map(([e,n])=>X(e,n)).filter(e=>e!==void 0)}var Y=(t,e)=>{let n=t.props||{};if(p(t.type))return c(t.type(t.props));if(typeof t.type=="symbol"||typeof t.type!="string")return"";let r=J(n),o=n.children,y=Array.isArray(o)?o.map(x=>e(x)).join(""):e(o);return`<${t.type}${r.length>0?` ${r.join(" ")}`:""}>${y}</${t.type}>`},c=t=>t==null||t===!1?"":_(t)?String(t):Array.isArray(t)?t.map(c).join(""):i(t)?Y(t,c):"";function N(t){let e=t.props||{};if(!("xmlns"in e)){let n={...t,props:{...e,xmlns:"http://www.w3.org/2000/svg"}};return c(n)||""}return c(t)||""}async function K(t){let e=await s(t);return e.length===0?f({}):e.length===1&&e[0]!==void 0?e[0]:f({children:e,style:{width:h(100),height:h(100)}})}async function s(t){if(t==null||t===!1)return[];if(t instanceof Promise)return s(await t);if(typeof t=="object"&&Symbol.iterator in t)return Q(t);if(i(t)){let e=await A(t);return Array.isArray(e)?e:e?[e]:[]}return[m(String(t),a.span)]}function q(t){if(!(typeof t.type!="object"||t.type===null)){if(w(t.type)&&"render"in t.type){let e=t.type;return s(e.render(t.props,null))}if(P(t.type)&&"type"in t.type){let n=t.type.type;if(p(n))return s(n(t.props));let r={...t,type:n};return A(r)}}}function L(t){if(!i(t))return Promise.resolve(void 0);let e=typeof t.props=="object"&&t.props!==null&&"children"in t.props?t.props.children:void 0;return typeof e=="string"?Promise.resolve(e):typeof e=="number"?Promise.resolve(String(e)):Array.isArray(e)?Promise.resolve(C(e)):typeof e=="object"&&e!==null&&Symbol.iterator in e?Promise.resolve(C(Array.from(e))):i(e)&&k(e)?L(e):Promise.resolve(void 0)}function C(t){if(!t.some(e=>i(e)))return t.map(e=>typeof e=="string"?e:typeof e=="number"?String(e):"").join("")}async function A(t){if(p(t.type))return s(t.type(t.props));let e=q(t);if(e!==void 0)return e;if(k(t))return await v(t)||[];if(S(t))return[];if(u(t,"br"))return[m(`
2
+ `,a.span)];if(u(t,"img"))return[Z(t)];if(u(t,"svg"))return[G(t)];let n=R(t),r=b(t),o=await L(t);if(o!==void 0)return[m({text:o,style:n,tw:r})];let y=await v(t);return[f({children:y,style:n,tw:r})]}function Z(t){if(!t.props.src)throw new Error("Image element must have a 'src' prop.");let e=R(t),n=b(t);return d({src:t.props.src,style:e,tw:n})}function G(t){let e=R(t),n=b(t),r=N(t);return d({style:e,src:r,tw:n})}var U={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function R(t){let e={};typeof t.type=="string"&&t.type in a&&Object.assign(e,a[t.type]);let n=typeof t.props=="object"&&t.props!==null&&"style"in t.props&&typeof t.props.style=="object"&&t.props.style!==null?t.props.style:void 0;if(n&&Object.keys(n).length>0){for(let[r,o]of Object.entries(U))r in n&&(e[o]=n[r],delete n[r]);Object.assign(e,n)}return e}function b(t){if(!(typeof t.props!="object"||t.props===null||!("tw"in t.props)))return t.props.tw}function v(t){return typeof t.props!="object"||t.props===null||!("children"in t.props)?Promise.resolve([]):s(t.props.children)}function Q(t){return Promise.all(Array.from(t).map(e=>s(e))).then(e=>e.flat())}0&&(module.exports={fromJsx});
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { N as Node } from '../types-D9v4-kzl.cjs';
2
+ import { N as Node } from '../types-Dm5SijB6.cjs';
3
3
 
4
4
  type ReactElementLike = {
5
5
  type: string | symbol | ((props: unknown) => ReactElementLike) | ReactElementLike;
package/dist/jsx/jsx.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { N as Node } from '../types-D9v4-kzl.js';
2
+ import { N as Node } from '../types-Dm5SijB6.js';
3
3
 
4
4
  type ReactElementLike = {
5
5
  type: string | symbol | ((props: unknown) => ReactElementLike) | ReactElementLike;
package/dist/jsx/jsx.js CHANGED
@@ -1,2 +1,2 @@
1
- function l(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function f(t){let e={type:"container",children:t.children,tw:t.tw};return l(e,t.style),e}function m(t,e){if(typeof t=="string"){let n={type:"text",text:t};return l(n,e),n}let r={type:"text",text:t.text,tw:t.tw};return l(r,e??t.style),r}function g(t){let e={type:"image",src:t.src};return l(e,t.style),e}function d(t){return{percentage:t}}var a={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:0,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 A=new Set(["head","meta","link","style","script"]);function x(t){return A.has(t.type)}function u(t,e){return t.type===e&&"props"in t}function S(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(t){return typeof t=="object"&&t!==null&&"type"in t}function p(t){return typeof t=="function"}var O=Symbol.for("react.forward_ref"),$=Symbol.for("react.memo"),I=Symbol.for("react.fragment");function E(t){return t.$$typeof===O}function P(t){return t.$$typeof===$}function k(t){return t.type===I}function W(t){return typeof t=="string"||typeof t=="number"}function w(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function j(t){return Object.keys(t).map(e=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(t[e]).trim()}`).join(";")}var z=["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 F(t,e){if(t==="children"||e==null)return;let r;if(t==="className"?r="class":z.includes(t)?r=S(t):r=t,typeof e=="boolean")return`${r}="${String(e)}"`;if(t==="style"&&typeof e=="object"){let n=j(e);if(n)return`style="${w(n)}"`}return`${r}="${w(String(e))}"`}function B(t){return Object.entries(t).map(([e,r])=>F(e,r)).filter(e=>e!==void 0)}var M=(t,e)=>{let r=t.props||{};if(p(t.type))return c(t.type(t.props));if(typeof t.type=="symbol"||typeof t.type!="string")return"";let n=B(r),o=r.children,y=Array.isArray(o)?o.map(h=>e(h)).join(""):e(o);return`<${t.type}${n.length>0?` ${n.join(" ")}`:""}>${y}</${t.type}>`},c=t=>t==null||t===!1?"":W(t)?String(t):Array.isArray(t)?t.map(c).join(""):i(t)?M(t,c):"";function T(t){let e=t.props||{};if(!("xmlns"in e)){let r={...t,props:{...e,xmlns:"http://www.w3.org/2000/svg"}};return c(r)||""}return c(t)||""}async function et(t){let e=await s(t);return e.length===0?f({}):e.length===1&&e[0]!==void 0?e[0]:f({children:e,style:{width:d(100),height:d(100)}})}async function s(t){if(t==null||t===!1)return[];if(t instanceof Promise)return s(await t);if(typeof t=="object"&&Symbol.iterator in t)return X(t);if(i(t)){let e=await L(t);return Array.isArray(e)?e:e?[e]:[]}return[m(String(t),a.span)]}function H(t){if(!(typeof t.type!="object"||t.type===null)){if(E(t.type)&&"render"in t.type){let e=t.type;return s(e.render(t.props,null))}if(P(t.type)&&"type"in t.type){let r=t.type.type;if(p(r))return s(r(t.props));let n={...t,type:r};return L(n)}}}function v(t){if(!i(t))return Promise.resolve(void 0);let e=typeof t.props=="object"&&t.props!==null&&"children"in t.props?t.props.children:void 0;return typeof e=="string"?Promise.resolve(e):typeof e=="number"?Promise.resolve(String(e)):Array.isArray(e)?Promise.resolve(N(e)):typeof e=="object"&&e!==null&&Symbol.iterator in e?Promise.resolve(N(Array.from(e))):i(e)&&k(e)?v(e):Promise.resolve(void 0)}function N(t){if(!t.some(e=>i(e)))return t.map(e=>typeof e=="string"?e:typeof e=="number"?String(e):"").join("")}async function L(t){if(p(t.type))return s(t.type(t.props));let e=H(t);if(e!==void 0)return e;if(k(t))return await C(t)||[];if(x(t))return[];if(u(t,"br"))return[m(`
2
- `,a.span)];if(u(t,"img"))return[_(t)];if(u(t,"svg"))return[D(t)];let r=R(t),n=b(t),o=await v(t);if(o!==void 0)return[m({text:o,style:r,tw:n})];let y=await C(t);return[f({children:y,style:r,tw:n})]}function _(t){if(!t.props.src)throw new Error("Image element must have a 'src' prop.");let e=R(t),r=b(t);return g({src:t.props.src,style:e,tw:r})}function D(t){let e=R(t),r=b(t),n=T(t);return g({style:e,src:n,tw:r})}var V={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function R(t){let e={};typeof t.type=="string"&&t.type in a&&Object.assign(e,a[t.type]);let r=typeof t.props=="object"&&t.props!==null&&"style"in t.props&&typeof t.props.style=="object"&&t.props.style!==null?t.props.style:void 0;if(r&&Object.keys(r).length>0){for(let[n,o]of Object.entries(V))n in r&&(e[o]=r[n],delete r[n]);Object.assign(e,r)}return e}function b(t){if(!(typeof t.props!="object"||t.props===null||!("tw"in t.props)))return t.props.tw}function C(t){return typeof t.props!="object"||t.props===null||!("children"in t.props)?Promise.resolve([]):s(t.props.children)}function X(t){return Promise.all(Array.from(t).map(e=>s(e))).then(e=>e.flat())}export{et as fromJsx};
1
+ function l(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function f(t){let e={type:"container",children:t.children,tw:t.tw};return l(e,t.style),e}function m(t,e){if(typeof t=="string"){let r={type:"text",text:t};return l(r,e),r}let n={type:"text",text:t.text,tw:t.tw};return l(n,e??t.style),n}function g(t){let e={type:"image",src:t.src,width:t.width,height:t.height,tw:t.tw};return l(e,t.style),e}function d(t){return{percentage:t}}var a={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:0,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 A=new Set(["head","meta","link","style","script"]);function x(t){return A.has(t.type)}function u(t,e){return t.type===e&&"props"in t}function S(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(t){return typeof t=="object"&&t!==null&&"type"in t}function p(t){return typeof t=="function"}var O=Symbol.for("react.forward_ref"),$=Symbol.for("react.memo"),I=Symbol.for("react.fragment");function E(t){return t.$$typeof===O}function w(t){return t.$$typeof===$}function h(t){return t.type===I}function W(t){return typeof t=="string"||typeof t=="number"}function P(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function j(t){return Object.keys(t).map(e=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(t[e]).trim()}`).join(";")}var z=["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 F(t,e){if(t==="children"||e==null)return;let n;if(t==="className"?n="class":z.includes(t)?n=S(t):n=t,typeof e=="boolean")return`${n}="${String(e)}"`;if(t==="style"&&typeof e=="object"){let r=j(e);if(r)return`style="${P(r)}"`}return`${n}="${P(String(e))}"`}function B(t){return Object.entries(t).map(([e,n])=>F(e,n)).filter(e=>e!==void 0)}var M=(t,e)=>{let n=t.props||{};if(p(t.type))return c(t.type(t.props));if(typeof t.type=="symbol"||typeof t.type!="string")return"";let r=B(n),o=n.children,y=Array.isArray(o)?o.map(b=>e(b)).join(""):e(o);return`<${t.type}${r.length>0?` ${r.join(" ")}`:""}>${y}</${t.type}>`},c=t=>t==null||t===!1?"":W(t)?String(t):Array.isArray(t)?t.map(c).join(""):i(t)?M(t,c):"";function T(t){let e=t.props||{};if(!("xmlns"in e)){let n={...t,props:{...e,xmlns:"http://www.w3.org/2000/svg"}};return c(n)||""}return c(t)||""}async function et(t){let e=await s(t);return e.length===0?f({}):e.length===1&&e[0]!==void 0?e[0]:f({children:e,style:{width:d(100),height:d(100)}})}async function s(t){if(t==null||t===!1)return[];if(t instanceof Promise)return s(await t);if(typeof t=="object"&&Symbol.iterator in t)return X(t);if(i(t)){let e=await L(t);return Array.isArray(e)?e:e?[e]:[]}return[m(String(t),a.span)]}function H(t){if(!(typeof t.type!="object"||t.type===null)){if(E(t.type)&&"render"in t.type){let e=t.type;return s(e.render(t.props,null))}if(w(t.type)&&"type"in t.type){let n=t.type.type;if(p(n))return s(n(t.props));let r={...t,type:n};return L(r)}}}function v(t){if(!i(t))return Promise.resolve(void 0);let e=typeof t.props=="object"&&t.props!==null&&"children"in t.props?t.props.children:void 0;return typeof e=="string"?Promise.resolve(e):typeof e=="number"?Promise.resolve(String(e)):Array.isArray(e)?Promise.resolve(N(e)):typeof e=="object"&&e!==null&&Symbol.iterator in e?Promise.resolve(N(Array.from(e))):i(e)&&h(e)?v(e):Promise.resolve(void 0)}function N(t){if(!t.some(e=>i(e)))return t.map(e=>typeof e=="string"?e:typeof e=="number"?String(e):"").join("")}async function L(t){if(p(t.type))return s(t.type(t.props));let e=H(t);if(e!==void 0)return e;if(h(t))return await C(t)||[];if(x(t))return[];if(u(t,"br"))return[m(`
2
+ `,a.span)];if(u(t,"img"))return[_(t)];if(u(t,"svg"))return[D(t)];let n=k(t),r=R(t),o=await v(t);if(o!==void 0)return[m({text:o,style:n,tw:r})];let y=await C(t);return[f({children:y,style:n,tw:r})]}function _(t){if(!t.props.src)throw new Error("Image element must have a 'src' prop.");let e=k(t),n=R(t);return g({src:t.props.src,style:e,tw:n})}function D(t){let e=k(t),n=R(t),r=T(t);return g({style:e,src:r,tw:n})}var V={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function k(t){let e={};typeof t.type=="string"&&t.type in a&&Object.assign(e,a[t.type]);let n=typeof t.props=="object"&&t.props!==null&&"style"in t.props&&typeof t.props.style=="object"&&t.props.style!==null?t.props.style:void 0;if(n&&Object.keys(n).length>0){for(let[r,o]of Object.entries(V))r in n&&(e[o]=n[r],delete n[r]);Object.assign(e,n)}return e}function R(t){if(!(typeof t.props!="object"||t.props===null||!("tw"in t.props)))return t.props.tw}function C(t){return typeof t.props!="object"||t.props===null||!("children"in t.props)?Promise.resolve([]):s(t.props.children)}function X(t){return Promise.all(Array.from(t).map(e=>s(e))).then(e=>e.flat())}export{et as fromJsx};
@@ -774,37 +774,11 @@ type TextTransform = "none" | "uppercase" | "lowercase" | "capitalize";
774
774
  type TextWrapMode = "wrap" | "nowrap";
775
775
 
776
776
  /**
777
- * Represents an affine transform matrix
778
- * | a c x |
779
- * | b d y |
777
+ * | a b x |
778
+ * | c d y |
780
779
  * | 0 0 1 |
781
780
  */
782
- type Affine = {
783
- /**
784
- * Horizontal scaling / cosine of rotation
785
- */
786
- a: number;
787
- /**
788
- * Vertical shear / sine of rotation
789
- */
790
- b: number;
791
- /**
792
- * Horizontal shear / negative sine of rotation
793
- */
794
- c: number;
795
- /**
796
- * Vertical scaling / cosine of rotation
797
- */
798
- d: number;
799
- /**
800
- * Horizontal translation (always orthogonal regardless of rotation)
801
- */
802
- x: number;
803
- /**
804
- * Vertical translation (always orthogonal regardless of rotation)
805
- */
806
- y: number;
807
- };
781
+ type Affine = string;
808
782
 
809
783
  /**
810
784
  * Represents a single CSS transform operation
@@ -774,37 +774,11 @@ type TextTransform = "none" | "uppercase" | "lowercase" | "capitalize";
774
774
  type TextWrapMode = "wrap" | "nowrap";
775
775
 
776
776
  /**
777
- * Represents an affine transform matrix
778
- * | a c x |
779
- * | b d y |
777
+ * | a b x |
778
+ * | c d y |
780
779
  * | 0 0 1 |
781
780
  */
782
- type Affine = {
783
- /**
784
- * Horizontal scaling / cosine of rotation
785
- */
786
- a: number;
787
- /**
788
- * Vertical shear / sine of rotation
789
- */
790
- b: number;
791
- /**
792
- * Horizontal shear / negative sine of rotation
793
- */
794
- c: number;
795
- /**
796
- * Vertical scaling / cosine of rotation
797
- */
798
- d: number;
799
- /**
800
- * Horizontal translation (always orthogonal regardless of rotation)
801
- */
802
- x: number;
803
- /**
804
- * Vertical translation (always orthogonal regardless of rotation)
805
- */
806
- y: number;
807
- };
781
+ type Affine = string;
808
782
 
809
783
  /**
810
784
  * Represents a single CSS transform operation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takumi-rs/helpers",
3
- "version": "0.51.1",
3
+ "version": "0.52.1",
4
4
  "author": {
5
5
  "email": "me@kane.tw",
6
6
  "name": "Kane Wang",