@takumi-rs/helpers 0.31.2 → 0.31.3

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,5 +1,5 @@
1
- import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as Color } from './types-COELemna.cjs';
2
- export { A as AnyNode, J as JsonValue, N as Node } from './types-COELemna.cjs';
1
+ import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as Color } from './types-DrsQhvya.cjs';
2
+ export { A as AnyNode, J as JsonValue, N as Node } from './types-DrsQhvya.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 Color } from './types-COELemna.js';
2
- export { A as AnyNode, J as JsonValue, N as Node } from './types-COELemna.js';
1
+ import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as Color } from './types-DrsQhvya.js';
2
+ export { A as AnyNode, J as JsonValue, N as Node } from './types-DrsQhvya.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/jsx/jsx.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var F=(e,t)=>{for(var r in t)f(e,r,{get:t[r],enumerable:!0})},z=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $(t))!W.call(e,i)&&i!==r&&f(e,i,{get:()=>t[i],enumerable:!(o=O(t,i))||o.enumerable});return e};var I=e=>z(f({},"__esModule",{value:!0}),e);var Q={};F(Q,{fromJsx:()=>B});module.exports=I(Q);function u(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function l(e){let t={type:"container",children:e.children};return u(t,e.style),t}function m(e,t){let r={type:"text",text:e};return u(r,t),r}function y(e){let t={type:"image",src:e.src};return u(t,e.style),t}function g(e){return{percentage:e}}function n(e){return{em:e}}function b(e,t,r,o=1){return[e,t,r,o]}var d={p:{margin:[n(1),0]},blockquote:{margin:[n(1),40]},center:{textAlign:"center"},hr:{margin:[n(.5),"auto"],borderWidth:1},h1:{fontSize:n(2),margin:[n(.67),0],fontWeight:700},h2:{fontSize:n(1.5),margin:[n(.83),0],fontWeight:700},h3:{fontSize:n(1.17),margin:[n(1),0],fontWeight:700},h4:{margin:[n(1.33),0],fontWeight:700},h5:{fontSize:n(.83),margin:[n(1.67),0],fontWeight:700},h6:{fontSize:n(.67),margin:[n(2.33),0],fontWeight:700},strong:{fontWeight:700},b:{fontWeight:700},code:{fontFamily:"monospace"},kbd:{fontFamily:"monospace"},pre:{fontFamily:"monospace",margin:[n(1),0]},mark:{backgroundColor:b(255,255,0),color:0},big:{fontSize:n(1.2)},small:{fontSize:n(1/1.2)}};function R(e,t){return e.type===t&&"props"in e}function E(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function s(e){return typeof e=="object"&&e!==null&&"type"in e}function c(e){return typeof e=="function"}var j=Symbol.for("react.forward_ref"),M=Symbol.for("react.memo"),X=Symbol.for("react.fragment");function P(e){return e.$$typeof===j}function x(e){return e.$$typeof===M}function k(e){return e.type===X}function J(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 _(e){return Object.keys(e).map(t=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(e[t]).trim()}`).join(";")}var H=["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 V(e,t){if(e==="children"||t==null)return;let r;if(e==="className"?r="class":H.includes(e)?r=E(e):r=e,typeof t=="boolean")return`${r}="${String(t)}"`;if(e==="style"&&typeof t=="object"){let o=_(t);if(o)return`style="${w(o)}"`}return`${r}="${w(String(t))}"`}function Y(e){return Object.entries(e).map(([t,r])=>V(t,r)).filter(t=>t!==void 0)}var D=(e,t)=>{let r=e.props||{};if(c(e.type))return p(e.type(e.props));if(typeof e.type=="symbol"||typeof e.type!="string")return"";let o=Y(r),i=r.children,S=Array.isArray(i)?i.map(L=>t(L)).join(""):t(i);return`<${e.type}${o.length>0?` ${o.join(" ")}`:""}>${S}</${e.type}>`},p=e=>e==null||e===!1?"":J(e)?String(e):Array.isArray(e)?e.map(p).join(""):s(e)?D(e,p):"";function C(e){let t=e.props||{};if(!("xmlns"in t)){let r={...e,props:{...t,xmlns:"http://www.w3.org/2000/svg"}};return p(r)||""}return p(e)||""}async function B(e){let t=await a(e);return t.length===0?l({}):t.length===1&&t[0]!==void 0?t[0]:l({children:t,style:{width:g(100),height:g(100)}})}async function a(e){if(e==null)return[];if(e instanceof Promise)return a(await e);if(typeof e=="object"&&Symbol.iterator in e)return U(e);if(s(e)){let t=await A(e);return Array.isArray(t)?t:t?[t]:[]}return[m(String(e))]}function K(e){if(!(typeof e.type!="object"||e.type===null)){if(P(e.type)&&"render"in e.type){let t=e.type;return a(t.render(e.props,null))}if(x(e.type)&&"type"in e.type){let r=e.type.type;if(c(r))return a(r(e.props));let o={...e,type:r};return A(o)}}}function T(e){if(!s(e))return Promise.resolve(void 0);let t=typeof e.props=="object"&&e.props!==null&&"children"in e.props?e.props.children:void 0;return typeof t=="string"?Promise.resolve(t):typeof t=="number"?Promise.resolve(String(t)):Array.isArray(t)?Promise.resolve(N(t)):typeof t=="object"&&t!==null&&Symbol.iterator in t?Promise.resolve(N(Array.from(t))):s(t)&&k(t)?T(t):Promise.resolve(void 0)}function N(e){if(!e.some(t=>s(t)))return e.map(t=>typeof t=="string"?t:typeof t=="number"?String(t):"").join("")}async function A(e){if(c(e.type))return a(e.type(e.props));let t=K(e);if(t!==void 0)return t;if(k(e))return await v(e)||[];if(R(e,"img"))return[q(e)];if(R(e,"svg"))return[Z(e)];let r=h(e.props);typeof e.type=="string"&&e.type in d&&Object.assign(r,d[e.type]);let o=await T(e);if(o!==void 0)return[m(o,r)];let i=await v(e);return[l({children:i,style:r})]}function q(e){if(!e.props.src)throw new Error("Image element must have a 'src' prop.");let t=h(e.props);return y({src:e.props.src,style:t})}function Z(e){let t=h(e.props),r=C(e);return y({style:t,src:r})}var G={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function h(e){if(typeof e!="object"||e===null)return{};let t="style"in e&&typeof e.style=="object"&&e.style!==null?e.style:{};if(Object.keys(t).length>0)for(let[r,o]of Object.entries(G))r in t&&(t[o]=t[r],delete t[r]);return t}function v(e){return typeof e.props!="object"||e.props===null||!("children"in e.props)?Promise.resolve([]):a(e.props.children)}function U(e){return Promise.all(Array.from(e).map(a)).then(t=>t.flat())}0&&(module.exports={fromJsx});
1
+ "use strict";var l=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var r in t)l(e,r,{get:t[r],enumerable:!0})},W=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of A(t))!O.call(e,o)&&o!==r&&l(e,o,{get:()=>t[o],enumerable:!(n=L(t,o))||n.enumerable});return e};var F=e=>W(l({},"__esModule",{value:!0}),e);var G={};$(G,{fromJsx:()=>D});module.exports=F(G);function m(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function c(e){let t={type:"container",children:e.children};return m(t,e.style),t}function f(e,t){let r={type:"text",text:e};return m(r,t),r}function u(e){let t={type:"image",src:e.src};return m(t,e.style),t}function g(e){return{percentage:e}}var y={p:{marginTop:"1em",marginBottom:"1em"},blockquote:{marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40},center:{textAlign:"center"},hr:{marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"auto",marginRight:"auto",borderWidth:1},h1:{fontSize:"2em",marginTop:"0.67em",marginBottom:"0.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h2:{fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold"},h3:{fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold"},h4:{marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},h5:{fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h6:{fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},u:{textDecoration:"underline"},strong:{fontWeight:"bold"},b:{fontWeight:"bold"},i:{fontStyle:"italic"},em:{fontStyle:"italic"},code:{fontFamily:"monospace"},kbd:{fontFamily:"monospace"},pre:{fontFamily:"monospace",marginTop:"1em",marginBottom:"1em"},mark:{backgroundColor:16776960,color:0},big:{fontSize:"1.2em"},small:{fontSize:"0.8em"},s:{textDecoration:"line-through"}};function d(e,t){return e.type===t&&"props"in e}function S(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(e){return typeof e=="object"&&e!==null&&"type"in e}function s(e){return typeof e=="function"}var z=Symbol.for("react.forward_ref"),I=Symbol.for("react.memo"),j=Symbol.for("react.fragment");function b(e){return e.$$typeof===z}function E(e){return e.$$typeof===I}function R(e){return e.type===j}function B(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){return Object.keys(e).map(t=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(e[t]).trim()}`).join(";")}var X=["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 J(e,t){if(e==="children"||t==null)return;let r;if(e==="className"?r="class":X.includes(e)?r=S(e):r=e,typeof t=="boolean")return`${r}="${String(t)}"`;if(e==="style"&&typeof t=="object"){let n=M(t);if(n)return`style="${P(n)}"`}return`${r}="${P(String(t))}"`}function _(e){return Object.entries(e).map(([t,r])=>J(t,r)).filter(t=>t!==void 0)}var H=(e,t)=>{let r=e.props||{};if(s(e.type))return p(e.type(e.props));if(typeof e.type=="symbol"||typeof e.type!="string")return"";let n=_(r),o=r.children,k=Array.isArray(o)?o.map(v=>t(v)).join(""):t(o);return`<${e.type}${n.length>0?` ${n.join(" ")}`:""}>${k}</${e.type}>`},p=e=>e==null||e===!1?"":B(e)?String(e):Array.isArray(e)?e.map(p).join(""):i(e)?H(e,p):"";function x(e){let t=e.props||{};if(!("xmlns"in t)){let r={...e,props:{...t,xmlns:"http://www.w3.org/2000/svg"}};return p(r)||""}return p(e)||""}async function D(e){let t=await a(e);return t.length===0?c({}):t.length===1&&t[0]!==void 0?t[0]:c({children:t,style:{width:g(100),height:g(100)}})}async function a(e){if(e==null)return[];if(e instanceof Promise)return a(await e);if(typeof e=="object"&&Symbol.iterator in e)return Z(e);if(i(e)){let t=await N(e);return Array.isArray(t)?t:t?[t]:[]}return[f(String(e))]}function V(e){if(!(typeof e.type!="object"||e.type===null)){if(b(e.type)&&"render"in e.type){let t=e.type;return a(t.render(e.props,null))}if(E(e.type)&&"type"in e.type){let r=e.type.type;if(s(r))return a(r(e.props));let n={...e,type:r};return N(n)}}}function C(e){if(!i(e))return Promise.resolve(void 0);let t=typeof e.props=="object"&&e.props!==null&&"children"in e.props?e.props.children:void 0;return typeof t=="string"?Promise.resolve(t):typeof t=="number"?Promise.resolve(String(t)):Array.isArray(t)?Promise.resolve(w(t)):typeof t=="object"&&t!==null&&Symbol.iterator in t?Promise.resolve(w(Array.from(t))):i(t)&&R(t)?C(t):Promise.resolve(void 0)}function w(e){if(!e.some(t=>i(t)))return e.map(t=>typeof t=="string"?t:typeof t=="number"?String(t):"").join("")}async function N(e){if(s(e.type))return a(e.type(e.props));let t=V(e);if(t!==void 0)return t;if(R(e))return await T(e)||[];if(d(e,"img"))return[Y(e)];if(d(e,"svg"))return[K(e)];let r=h(e.props);typeof e.type=="string"&&e.type in y&&Object.assign(r,y[e.type]);let n=await C(e);if(n!==void 0)return[f(n,r)];let o=await T(e);return[c({children:o,style:r})]}function Y(e){if(!e.props.src)throw new Error("Image element must have a 'src' prop.");let t=h(e.props);return u({src:e.props.src,style:t})}function K(e){let t=h(e.props),r=x(e);return u({style:t,src:r})}var q={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function h(e){if(typeof e!="object"||e===null)return{};let t="style"in e&&typeof e.style=="object"&&e.style!==null?e.style:{};if(Object.keys(t).length>0)for(let[r,n]of Object.entries(q))r in t&&(t[n]=t[r],delete t[r]);return t}function T(e){return typeof e.props!="object"||e.props===null||!("children"in e.props)?Promise.resolve([]):a(e.props.children)}function Z(e){return Promise.all(Array.from(e).map(a)).then(t=>t.flat())}0&&(module.exports={fromJsx});
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { N as Node } from '../types-COELemna.cjs';
2
+ import { N as Node } from '../types-DrsQhvya.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-COELemna.js';
2
+ import { N as Node } from '../types-DrsQhvya.js';
3
3
 
4
4
  type ReactElementLike = {
5
5
  type: string | symbol | ((props: unknown) => ReactElementLike) | ReactElementLike;
package/dist/jsx/jsx.js CHANGED
@@ -1 +1 @@
1
- function f(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function l(e){let t={type:"container",children:e.children};return f(t,e.style),t}function u(e,t){let r={type:"text",text:e};return f(r,t),r}function m(e){let t={type:"image",src:e.src};return f(t,e.style),t}function y(e){return{percentage:e}}function n(e){return{em:e}}function S(e,t,r,o=1){return[e,t,r,o]}var g={p:{margin:[n(1),0]},blockquote:{margin:[n(1),40]},center:{textAlign:"center"},hr:{margin:[n(.5),"auto"],borderWidth:1},h1:{fontSize:n(2),margin:[n(.67),0],fontWeight:700},h2:{fontSize:n(1.5),margin:[n(.83),0],fontWeight:700},h3:{fontSize:n(1.17),margin:[n(1),0],fontWeight:700},h4:{margin:[n(1.33),0],fontWeight:700},h5:{fontSize:n(.83),margin:[n(1.67),0],fontWeight:700},h6:{fontSize:n(.67),margin:[n(2.33),0],fontWeight:700},strong:{fontWeight:700},b:{fontWeight:700},code:{fontFamily:"monospace"},kbd:{fontFamily:"monospace"},pre:{fontFamily:"monospace",margin:[n(1),0]},mark:{backgroundColor:S(255,255,0),color:0},big:{fontSize:n(1.2)},small:{fontSize:n(1/1.2)}};function d(e,t){return e.type===t&&"props"in e}function b(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(e){return typeof e=="object"&&e!==null&&"type"in e}function c(e){return typeof e=="function"}var L=Symbol.for("react.forward_ref"),O=Symbol.for("react.memo"),$=Symbol.for("react.fragment");function E(e){return e.$$typeof===L}function P(e){return e.$$typeof===O}function R(e){return e.type===$}function W(e){return typeof e=="string"||typeof e=="number"}function x(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function F(e){return Object.keys(e).map(t=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(e[t]).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 I(e,t){if(e==="children"||t==null)return;let r;if(e==="className"?r="class":z.includes(e)?r=b(e):r=e,typeof t=="boolean")return`${r}="${String(t)}"`;if(e==="style"&&typeof t=="object"){let o=F(t);if(o)return`style="${x(o)}"`}return`${r}="${x(String(t))}"`}function j(e){return Object.entries(e).map(([t,r])=>I(t,r)).filter(t=>t!==void 0)}var M=(e,t)=>{let r=e.props||{};if(c(e.type))return p(e.type(e.props));if(typeof e.type=="symbol"||typeof e.type!="string")return"";let o=j(r),a=r.children,h=Array.isArray(a)?a.map(A=>t(A)).join(""):t(a);return`<${e.type}${o.length>0?` ${o.join(" ")}`:""}>${h}</${e.type}>`},p=e=>e==null||e===!1?"":W(e)?String(e):Array.isArray(e)?e.map(p).join(""):i(e)?M(e,p):"";function w(e){let t=e.props||{};if(!("xmlns"in t)){let r={...e,props:{...t,xmlns:"http://www.w3.org/2000/svg"}};return p(r)||""}return p(e)||""}async function te(e){let t=await s(e);return t.length===0?l({}):t.length===1&&t[0]!==void 0?t[0]:l({children:t,style:{width:y(100),height:y(100)}})}async function s(e){if(e==null)return[];if(e instanceof Promise)return s(await e);if(typeof e=="object"&&Symbol.iterator in e)return V(e);if(i(e)){let t=await T(e);return Array.isArray(t)?t:t?[t]:[]}return[u(String(e))]}function X(e){if(!(typeof e.type!="object"||e.type===null)){if(E(e.type)&&"render"in e.type){let t=e.type;return s(t.render(e.props,null))}if(P(e.type)&&"type"in e.type){let r=e.type.type;if(c(r))return s(r(e.props));let o={...e,type:r};return T(o)}}}function v(e){if(!i(e))return Promise.resolve(void 0);let t=typeof e.props=="object"&&e.props!==null&&"children"in e.props?e.props.children:void 0;return typeof t=="string"?Promise.resolve(t):typeof t=="number"?Promise.resolve(String(t)):Array.isArray(t)?Promise.resolve(C(t)):typeof t=="object"&&t!==null&&Symbol.iterator in t?Promise.resolve(C(Array.from(t))):i(t)&&R(t)?v(t):Promise.resolve(void 0)}function C(e){if(!e.some(t=>i(t)))return e.map(t=>typeof t=="string"?t:typeof t=="number"?String(t):"").join("")}async function T(e){if(c(e.type))return s(e.type(e.props));let t=X(e);if(t!==void 0)return t;if(R(e))return await N(e)||[];if(d(e,"img"))return[J(e)];if(d(e,"svg"))return[_(e)];let r=k(e.props);typeof e.type=="string"&&e.type in g&&Object.assign(r,g[e.type]);let o=await v(e);if(o!==void 0)return[u(o,r)];let a=await N(e);return[l({children:a,style:r})]}function J(e){if(!e.props.src)throw new Error("Image element must have a 'src' prop.");let t=k(e.props);return m({src:e.props.src,style:t})}function _(e){let t=k(e.props),r=w(e);return m({style:t,src:r})}var H={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function k(e){if(typeof e!="object"||e===null)return{};let t="style"in e&&typeof e.style=="object"&&e.style!==null?e.style:{};if(Object.keys(t).length>0)for(let[r,o]of Object.entries(H))r in t&&(t[o]=t[r],delete t[r]);return t}function N(e){return typeof e.props!="object"||e.props===null||!("children"in e.props)?Promise.resolve([]):s(e.props.children)}function V(e){return Promise.all(Array.from(e).map(s)).then(t=>t.flat())}export{te as fromJsx};
1
+ function l(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function c(e){let t={type:"container",children:e.children};return l(t,e.style),t}function m(e,t){let r={type:"text",text:e};return l(r,t),r}function f(e){let t={type:"image",src:e.src};return l(t,e.style),t}function u(e){return{percentage:e}}var g={p:{marginTop:"1em",marginBottom:"1em"},blockquote:{marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40},center:{textAlign:"center"},hr:{marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"auto",marginRight:"auto",borderWidth:1},h1:{fontSize:"2em",marginTop:"0.67em",marginBottom:"0.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h2:{fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold"},h3:{fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold"},h4:{marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},h5:{fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h6:{fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},u:{textDecoration:"underline"},strong:{fontWeight:"bold"},b:{fontWeight:"bold"},i:{fontStyle:"italic"},em:{fontStyle:"italic"},code:{fontFamily:"monospace"},kbd:{fontFamily:"monospace"},pre:{fontFamily:"monospace",marginTop:"1em",marginBottom:"1em"},mark:{backgroundColor:16776960,color:0},big:{fontSize:"1.2em"},small:{fontSize:"0.8em"},s:{textDecoration:"line-through"}};function y(e,t){return e.type===t&&"props"in e}function k(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function o(e){return typeof e=="object"&&e!==null&&"type"in e}function s(e){return typeof e=="function"}var v=Symbol.for("react.forward_ref"),L=Symbol.for("react.memo"),A=Symbol.for("react.fragment");function S(e){return e.$$typeof===v}function b(e){return e.$$typeof===L}function d(e){return e.type===A}function O(e){return typeof e=="string"||typeof e=="number"}function E(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $(e){return Object.keys(e).map(t=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(e[t]).trim()}`).join(";")}var W=["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(e,t){if(e==="children"||t==null)return;let r;if(e==="className"?r="class":W.includes(e)?r=k(e):r=e,typeof t=="boolean")return`${r}="${String(t)}"`;if(e==="style"&&typeof t=="object"){let n=$(t);if(n)return`style="${E(n)}"`}return`${r}="${E(String(t))}"`}function z(e){return Object.entries(e).map(([t,r])=>F(t,r)).filter(t=>t!==void 0)}var I=(e,t)=>{let r=e.props||{};if(s(e.type))return p(e.type(e.props));if(typeof e.type=="symbol"||typeof e.type!="string")return"";let n=z(r),a=r.children,h=Array.isArray(a)?a.map(N=>t(N)).join(""):t(a);return`<${e.type}${n.length>0?` ${n.join(" ")}`:""}>${h}</${e.type}>`},p=e=>e==null||e===!1?"":O(e)?String(e):Array.isArray(e)?e.map(p).join(""):o(e)?I(e,p):"";function P(e){let t=e.props||{};if(!("xmlns"in t)){let r={...e,props:{...t,xmlns:"http://www.w3.org/2000/svg"}};return p(r)||""}return p(e)||""}async function U(e){let t=await i(e);return t.length===0?c({}):t.length===1&&t[0]!==void 0?t[0]:c({children:t,style:{width:u(100),height:u(100)}})}async function i(e){if(e==null)return[];if(e instanceof Promise)return i(await e);if(typeof e=="object"&&Symbol.iterator in e)return J(e);if(o(e)){let t=await C(e);return Array.isArray(t)?t:t?[t]:[]}return[m(String(e))]}function j(e){if(!(typeof e.type!="object"||e.type===null)){if(S(e.type)&&"render"in e.type){let t=e.type;return i(t.render(e.props,null))}if(b(e.type)&&"type"in e.type){let r=e.type.type;if(s(r))return i(r(e.props));let n={...e,type:r};return C(n)}}}function T(e){if(!o(e))return Promise.resolve(void 0);let t=typeof e.props=="object"&&e.props!==null&&"children"in e.props?e.props.children:void 0;return typeof t=="string"?Promise.resolve(t):typeof t=="number"?Promise.resolve(String(t)):Array.isArray(t)?Promise.resolve(x(t)):typeof t=="object"&&t!==null&&Symbol.iterator in t?Promise.resolve(x(Array.from(t))):o(t)&&d(t)?T(t):Promise.resolve(void 0)}function x(e){if(!e.some(t=>o(t)))return e.map(t=>typeof t=="string"?t:typeof t=="number"?String(t):"").join("")}async function C(e){if(s(e.type))return i(e.type(e.props));let t=j(e);if(t!==void 0)return t;if(d(e))return await w(e)||[];if(y(e,"img"))return[B(e)];if(y(e,"svg"))return[M(e)];let r=R(e.props);typeof e.type=="string"&&e.type in g&&Object.assign(r,g[e.type]);let n=await T(e);if(n!==void 0)return[m(n,r)];let a=await w(e);return[c({children:a,style:r})]}function B(e){if(!e.props.src)throw new Error("Image element must have a 'src' prop.");let t=R(e.props);return f({src:e.props.src,style:t})}function M(e){let t=R(e.props),r=P(e);return f({style:t,src:r})}var X={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function R(e){if(typeof e!="object"||e===null)return{};let t="style"in e&&typeof e.style=="object"&&e.style!==null?e.style:{};if(Object.keys(t).length>0)for(let[r,n]of Object.entries(X))r in t&&(t[n]=t[r],delete t[r]);return t}function w(e){return typeof e.props!="object"||e.props===null||!("children"in e.props)?Promise.resolve([]):i(e.props.children)}function J(e){return Promise.all(Array.from(e).map(i)).then(t=>t.flat())}export{U as fromJsx};
@@ -716,7 +716,7 @@ type Style = {
716
716
  fontStyle: CssValue<FontStyle>;
717
717
  borderColor: CssValue<Color | null>;
718
718
  color: CssValue<Color>;
719
- fontSize: CssValue<LengthUnit>;
719
+ fontSize: CssValue<LengthUnit | null>;
720
720
  fontFamily: CssValue<FontFamily | null>;
721
721
  lineHeight: CssValue<LineHeight>;
722
722
  fontWeight: CssValue<FontWeight>;
@@ -716,7 +716,7 @@ type Style = {
716
716
  fontStyle: CssValue<FontStyle>;
717
717
  borderColor: CssValue<Color | null>;
718
718
  color: CssValue<Color>;
719
- fontSize: CssValue<LengthUnit>;
719
+ fontSize: CssValue<LengthUnit | null>;
720
720
  fontFamily: CssValue<FontFamily | null>;
721
721
  lineHeight: CssValue<LineHeight>;
722
722
  fontWeight: CssValue<FontWeight>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takumi-rs/helpers",
3
- "version": "0.31.2",
3
+ "version": "0.31.3",
4
4
  "author": {
5
5
  "email": "me@kane.tw",
6
6
  "name": "Kane Wang",