@takumi-rs/helpers 0.28.5 → 0.29.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.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-8M7fRh4t.cjs';
2
- export { A as AnyNode, J as JsonValue, N as Node } from './types-8M7fRh4t.cjs';
1
+ import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as Color } from './types-CV2M3RYA.cjs';
2
+ export { A as AnyNode, J as JsonValue, N as Node } from './types-CV2M3RYA.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-8M7fRh4t.js';
2
- export { A as AnyNode, J as JsonValue, N as Node } from './types-8M7fRh4t.js';
1
+ import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as Color } from './types-CV2M3RYA.js';
2
+ export { A as AnyNode, J as JsonValue, N as Node } from './types-CV2M3RYA.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 p=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var A=(t,e)=>{for(var r in e)p(t,r,{get:e[r],enumerable:!0})},$=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of L(e))!v.call(t,i)&&i!==r&&p(t,i,{get:()=>e[i],enumerable:!(o=C(e,i))||o.enumerable});return t};var O=t=>$(p({},"__esModule",{value:!0}),t);var V={};A(V,{fromJsx:()=>J});module.exports=O(V);function f(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function a(t){let e={type:"container",children:t.children};return f(e,t.style),e}function h(t,e){let r={type:"text",text:t};return f(r,e),r}function l(t){let e={type:"image",src:t.src};return f(e,t.style),e}function u(t){return{percentage:t}}function n(t){return{em:t}}function k(t,e,r,o=1){return[t,e,r,o]}var m={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:k(255,255,0),color:0},big:{fontSize:n(1.2)},small:{fontSize:n(1/1.2)}};function y(t,e){return t.type===e}function R(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"}function S(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function T(t){return typeof t=="string"||typeof t=="number"}function b(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 I(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 o=j(e);if(o)return`style="${b(o)}"`}return`${r}="${b(String(e))}"`}function F(t){return Object.entries(t).map(([e,r])=>I(e,r)).filter(e=>e!==void 0)}var W=(t,e)=>{let r=t.props||{},o=F(r),i=r.children,d=Array.isArray(i)?i.map(N=>e(N)).join(""):e(i);return`<${t.type}${o.length>0?` ${o.join(" ")}`:""}>${d}</${t.type}>`},c=t=>t==null||t===!1?"":T(t)?String(t):Array.isArray(t)?t.map(c).join(""):R(t)?W(t,c):"";function P(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)||""}var M=Symbol.for("react.forward_ref"),X=Symbol.for("react.memo");function H(t){return(typeof t=="object"||typeof t=="function")&&t!==null&&"type"in t}async function J(t){let e=await s(t);return e.length===0?a({}):e.length===1&&e[0]!==void 0?e[0]:a({children:e,style:{width:u(100),height:u(100)}})}async function s(t){if(t==null)return[];if(t instanceof Promise)return s(await t);if(typeof t=="object"&&Symbol.iterator in t)return B(t);if(H(t)){let e=await x(t);return Array.isArray(e)?e:e?[e]:[]}return[h(String(t))]}function w(t){return typeof t=="function"}function _(t){if(typeof t.type!="object"||t.type===null)return;let e=t.type;if(e.$$typeof===M&&e.render)return s(e.render(t.props,null))}function K(t){if(typeof t.type!="object"||t.type===null)return;let e=t.type;if(e.$$typeof!==X)return;let r=e.type;if(w(r))return s(r(t.props));let o={...t,type:r};return x(o)}async function x(t){if(w(t.type))return s(t.type(t.props));let e=_(t);if(e!==void 0)return e;let r=K(t);if(r!==void 0)return r;if(typeof t.type=="symbol"&&t.type===Symbol.for("react.fragment"))return await E(t)||[];if(y(t,"img"))return[D(t)];if(y(t,"svg"))return[Y(t)];let o=await E(t),i=g(t.props);return typeof t.type=="string"&&t.type in m&&Object.assign(i,m[t.type]),[a({children:o,style:i})]}function D(t){if(!t.props.src)throw new Error("Image element must have a 'src' prop.");let e=g(t.props);return l({src:t.props.src,style:e})}function Y(t){let e=g(t.props),r=P(t);return l({src:r,style:e})}function g(t){return typeof t!="object"||t===null?{}:"style"in t&&typeof t.style=="object"?t.style:{}}function E(t){return typeof t.props!="object"||t.props===null||!("children"in t.props)?Promise.resolve([]):s(t.props.children)}async function B(t){return(await Promise.all(Array.from(t).map(s))).flat()}0&&(module.exports={fromJsx});
1
+ "use strict";var f=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var $=(t,e)=>{for(var r in e)f(t,r,{get:e[r],enumerable:!0})},O=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of T(e))!L.call(t,i)&&i!==r&&f(t,i,{get:()=>e[i],enumerable:!(o=A(e,i))||o.enumerable});return t};var z=t=>O(f({},"__esModule",{value:!0}),t);var q={};$(q,{fromJsx:()=>_});module.exports=z(q);function u(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function p(t){let e={type:"container",children:t.children};return u(e,t.style),e}function S(t,e){let r={type:"text",text:t};return u(r,e),r}function m(t){let e={type:"image",src:t.src};return u(e,t.style),e}function y(t){return{percentage:t}}function n(t){return{em:t}}function k(t,e,r,o=1){return[t,e,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:k(255,255,0),color:0},big:{fontSize:n(1.2)},small:{fontSize:n(1/1.2)}};function d(t,e){return t.type===e&&"props"in t}function E(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function l(t){return typeof t=="object"&&t!==null&&"type"in t}function a(t){return typeof t=="function"}var I=Symbol.for("react.forward_ref"),F=Symbol.for("react.memo");function b(t){return t.$$typeof===I}function P(t){return t.$$typeof===F}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 M=["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":M.includes(t)?r=E(t):r=t,typeof e=="boolean")return`${r}="${String(e)}"`;if(t==="style"&&typeof e=="object"){let o=j(e);if(o)return`style="${w(o)}"`}return`${r}="${w(String(e))}"`}function H(t){return Object.entries(t).map(([e,r])=>X(e,r)).filter(e=>e!==void 0)}var J=(t,e)=>{let r=t.props||{};if(a(t.type))return c(t.type(t.props));if(typeof t.type=="symbol"||typeof t.type!="string")return"";let o=H(r),i=r.children,h=Array.isArray(i)?i.map(v=>e(v)).join(""):e(i);return`<${t.type}${o.length>0?` ${o.join(" ")}`:""}>${h}</${t.type}>`},c=t=>t==null||t===!1?"":W(t)?String(t):Array.isArray(t)?t.map(c).join(""):l(t)?J(t,c):"";function x(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 _(t){let e=await s(t);return e.length===0?p({}):e.length===1&&e[0]!==void 0?e[0]:p({children:e,style:{width:y(100),height:y(100)}})}async function s(t){if(t==null)return[];if(t instanceof Promise)return s(await t);if(typeof t=="object"&&Symbol.iterator in t)return K(t);if(l(t)){let e=await C(t);return Array.isArray(e)?e:e?[e]:[]}return[S(String(t))]}function V(t){if(!(typeof t.type!="object"||t.type===null)&&b(t.type)&&"render"in t.type){let e=t.type;return s(e.render(t.props,null))}}function D(t){if(!(typeof t.type!="object"||t.type===null)&&P(t.type)&&"type"in t.type){let r=t.type.type;if(a(r))return s(r(t.props));let o={...t,type:r};return C(o)}}async function C(t){if(a(t.type))return s(t.type(t.props));let e=V(t);if(e!==void 0)return e;let r=D(t);if(r!==void 0)return r;if(typeof t.type=="symbol"&&t.type===Symbol.for("react.fragment"))return await N(t)||[];if(d(t,"img"))return[Y(t)];if(d(t,"svg"))return[B(t)];let o=await N(t),i=R(t.props);return typeof t.type=="string"&&t.type in g&&Object.assign(i,g[t.type]),[p({children:o,style:i})]}function Y(t){if(!t.props.src)throw new Error("Image element must have a 'src' prop.");let e=R(t.props);return m({src:t.props.src,style:e})}function B(t){let e=R(t.props),r=x(t);return m({src:r,style:e})}function R(t){return typeof t!="object"||t===null?{}:"style"in t&&typeof t.style=="object"?t.style:{}}function N(t){return typeof t.props!="object"||t.props===null||!("children"in t.props)?Promise.resolve([]):s(t.props.children)}async function K(t){return(await Promise.all(Array.from(t).map(s))).flat()}0&&(module.exports={fromJsx});
@@ -1,10 +1,12 @@
1
1
  import { ReactNode } from 'react';
2
- import { N as Node } from '../types-8M7fRh4t.cjs';
2
+ import { N as Node } from '../types-CV2M3RYA.cjs';
3
3
 
4
- type ReactElementLike<K extends string = string, P = unknown> = {
5
- type: K;
6
- props: P;
4
+ type ReactElementLike = {
5
+ type: string | ((props: unknown) => ReactElementLike) | ReactElementLike;
6
+ props: unknown;
7
+ $$typeof?: symbol;
7
8
  };
9
+
8
10
  declare function fromJsx(element: ReactNode | ReactElementLike): Promise<Node>;
9
11
 
10
- export { type ReactElementLike, fromJsx };
12
+ export { fromJsx };
package/dist/jsx/jsx.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import { ReactNode } from 'react';
2
- import { N as Node } from '../types-8M7fRh4t.js';
2
+ import { N as Node } from '../types-CV2M3RYA.js';
3
3
 
4
- type ReactElementLike<K extends string = string, P = unknown> = {
5
- type: K;
6
- props: P;
4
+ type ReactElementLike = {
5
+ type: string | ((props: unknown) => ReactElementLike) | ReactElementLike;
6
+ props: unknown;
7
+ $$typeof?: symbol;
7
8
  };
9
+
8
10
  declare function fromJsx(element: ReactNode | ReactElementLike): Promise<Node>;
9
11
 
10
- export { type ReactElementLike, fromJsx };
12
+ export { fromJsx };
package/dist/jsx/jsx.js CHANGED
@@ -1 +1 @@
1
- function p(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function a(t){let e={type:"container",children:t.children};return p(e,t.style),e}function d(t,e){let r={type:"text",text:t};return p(r,e),r}function f(t){let e={type:"image",src:t.src};return p(e,t.style),e}function l(t){return{percentage:t}}function n(t){return{em:t}}function h(t,e,r,o=1){return[t,e,r,o]}var u={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:h(255,255,0),color:0},big:{fontSize:n(1.2)},small:{fontSize:n(1/1.2)}};function m(t,e){return t.type===e}function k(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"}function R(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function N(t){return typeof t=="string"||typeof t=="number"}function S(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function C(t){return Object.keys(t).map(e=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(t[e]).trim()}`).join(";")}var L=["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(t,e){if(t==="children"||e==null)return;let r;if(t==="className"?r="class":L.includes(t)?r=R(t):r=t,typeof e=="boolean")return`${r}="${String(e)}"`;if(t==="style"&&typeof e=="object"){let o=C(e);if(o)return`style="${S(o)}"`}return`${r}="${S(String(e))}"`}function A(t){return Object.entries(t).map(([e,r])=>v(e,r)).filter(e=>e!==void 0)}var $=(t,e)=>{let r=t.props||{},o=A(r),s=r.children,g=Array.isArray(s)?s.map(x=>e(x)).join(""):e(s);return`<${t.type}${o.length>0?` ${o.join(" ")}`:""}>${g}</${t.type}>`},c=t=>t==null||t===!1?"":N(t)?String(t):Array.isArray(t)?t.map(c).join(""):k(t)?$(t,c):"";function b(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)||""}var O=Symbol.for("react.forward_ref"),T=Symbol.for("react.memo");function j(t){return(typeof t=="object"||typeof t=="function")&&t!==null&&"type"in t}async function Z(t){let e=await i(t);return e.length===0?a({}):e.length===1&&e[0]!==void 0?e[0]:a({children:e,style:{width:l(100),height:l(100)}})}async function i(t){if(t==null)return[];if(t instanceof Promise)return i(await t);if(typeof t=="object"&&Symbol.iterator in t)return M(t);if(j(t)){let e=await w(t);return Array.isArray(e)?e:e?[e]:[]}return[d(String(t))]}function E(t){return typeof t=="function"}function z(t){if(typeof t.type!="object"||t.type===null)return;let e=t.type;if(e.$$typeof===O&&e.render)return i(e.render(t.props,null))}function I(t){if(typeof t.type!="object"||t.type===null)return;let e=t.type;if(e.$$typeof!==T)return;let r=e.type;if(E(r))return i(r(t.props));let o={...t,type:r};return w(o)}async function w(t){if(E(t.type))return i(t.type(t.props));let e=z(t);if(e!==void 0)return e;let r=I(t);if(r!==void 0)return r;if(typeof t.type=="symbol"&&t.type===Symbol.for("react.fragment"))return await P(t)||[];if(m(t,"img"))return[F(t)];if(m(t,"svg"))return[W(t)];let o=await P(t),s=y(t.props);return typeof t.type=="string"&&t.type in u&&Object.assign(s,u[t.type]),[a({children:o,style:s})]}function F(t){if(!t.props.src)throw new Error("Image element must have a 'src' prop.");let e=y(t.props);return f({src:t.props.src,style:e})}function W(t){let e=y(t.props),r=b(t);return f({src:r,style:e})}function y(t){return typeof t!="object"||t===null?{}:"style"in t&&typeof t.style=="object"?t.style:{}}function P(t){return typeof t.props!="object"||t.props===null||!("children"in t.props)?Promise.resolve([]):i(t.props.children)}async function M(t){return(await Promise.all(Array.from(t).map(i))).flat()}export{Z as fromJsx};
1
+ function f(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function p(t){let e={type:"container",children:t.children};return f(e,t.style),e}function h(t,e){let r={type:"text",text:t};return f(r,e),r}function u(t){let e={type:"image",src:t.src};return f(e,t.style),e}function m(t){return{percentage:t}}function n(t){return{em:t}}function S(t,e,r,o=1){return[t,e,r,o]}var y={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 g(t,e){return t.type===e&&"props"in t}function k(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function l(t){return typeof t=="object"&&t!==null&&"type"in t}function a(t){return typeof t=="function"}var v=Symbol.for("react.forward_ref"),A=Symbol.for("react.memo");function E(t){return t.$$typeof===v}function b(t){return t.$$typeof===A}function T(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 L(t){return Object.keys(t).map(e=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(t[e]).trim()}`).join(";")}var $=["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 O(t,e){if(t==="children"||e==null)return;let r;if(t==="className"?r="class":$.includes(t)?r=k(t):r=t,typeof e=="boolean")return`${r}="${String(e)}"`;if(t==="style"&&typeof e=="object"){let o=L(e);if(o)return`style="${P(o)}"`}return`${r}="${P(String(e))}"`}function z(t){return Object.entries(t).map(([e,r])=>O(e,r)).filter(e=>e!==void 0)}var I=(t,e)=>{let r=t.props||{};if(a(t.type))return c(t.type(t.props));if(typeof t.type=="symbol"||typeof t.type!="string")return"";let o=z(r),s=r.children,R=Array.isArray(s)?s.map(C=>e(C)).join(""):e(s);return`<${t.type}${o.length>0?` ${o.join(" ")}`:""}>${R}</${t.type}>`},c=t=>t==null||t===!1?"":T(t)?String(t):Array.isArray(t)?t.map(c).join(""):l(t)?I(t,c):"";function w(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 U(t){let e=await i(t);return e.length===0?p({}):e.length===1&&e[0]!==void 0?e[0]:p({children:e,style:{width:m(100),height:m(100)}})}async function i(t){if(t==null)return[];if(t instanceof Promise)return i(await t);if(typeof t=="object"&&Symbol.iterator in t)return X(t);if(l(t)){let e=await N(t);return Array.isArray(e)?e:e?[e]:[]}return[h(String(t))]}function F(t){if(!(typeof t.type!="object"||t.type===null)&&E(t.type)&&"render"in t.type){let e=t.type;return i(e.render(t.props,null))}}function W(t){if(!(typeof t.type!="object"||t.type===null)&&b(t.type)&&"type"in t.type){let r=t.type.type;if(a(r))return i(r(t.props));let o={...t,type:r};return N(o)}}async function N(t){if(a(t.type))return i(t.type(t.props));let e=F(t);if(e!==void 0)return e;let r=W(t);if(r!==void 0)return r;if(typeof t.type=="symbol"&&t.type===Symbol.for("react.fragment"))return await x(t)||[];if(g(t,"img"))return[j(t)];if(g(t,"svg"))return[M(t)];let o=await x(t),s=d(t.props);return typeof t.type=="string"&&t.type in y&&Object.assign(s,y[t.type]),[p({children:o,style:s})]}function j(t){if(!t.props.src)throw new Error("Image element must have a 'src' prop.");let e=d(t.props);return u({src:t.props.src,style:e})}function M(t){let e=d(t.props),r=w(t);return u({src:r,style:e})}function d(t){return typeof t!="object"||t===null?{}:"style"in t&&typeof t.style=="object"?t.style:{}}function x(t){return typeof t.props!="object"||t.props===null||!("children"in t.props)?Promise.resolve([]):i(t.props.children)}async function X(t){return(await Promise.all(Array.from(t).map(i))).flat()}export{U as fromJsx};
@@ -299,20 +299,19 @@ type FlexWrap = "nowrap" | "wrap" | "wrap-reverse";
299
299
 
300
300
  /**
301
301
  * Represents a font family for text rendering.
302
- * Use only the family name (no style suffixes like "Bold", "Italic", "Regular").
303
- * Multi-word names are allowed (e.g., "Noto Sans") and should be provided as-is without quotes.
302
+ * Multi value fallback is supported.
304
303
  */
305
- type FontFamily = "sans-serif" | "serif" | "monospace" | "cursive" | "fantasy" | string;
304
+ type FontFamily = string;
306
305
 
307
306
  /**
308
- * Represents font weight as a numeric value.
309
- *
310
- * This wraps a u16 value that corresponds to CSS font-weight values.
311
- * Common values include 100 (thin), 200 (extra light), 300 (light),
312
- * 400 (normal), 500 (medium), 600 (semi bold), 700 (bold),
313
- * 800 (extra bold), 900 (black).
307
+ * Controls the slant (italic/oblique) of text rendering.
308
+ */
309
+ type FontStyle = "normal" | "italic" | "oblique" | `oblique ${string}deg`;
310
+
311
+ /**
312
+ * Represents font weight value.
314
313
  */
315
- type FontWeight = number | string;
314
+ type FontWeight = string | number;
316
315
 
317
316
  /**
318
317
  * Represents spacing between flex items.
@@ -449,6 +448,11 @@ type LineHeight = number | string | LengthUnit;
449
448
  */
450
449
  type ObjectFit = "fill" | "contain" | "cover" | "scale-down" | "none";
451
450
 
451
+ /**
452
+ * Controls how text should be overflowed.
453
+ */
454
+ type OverflowWrap = "normal" | "anywhere" | "break-word";
455
+
452
456
  /**
453
457
  * Defines the positioning method for an element.
454
458
  *
@@ -476,14 +480,39 @@ type TextAlign = "left" | "right" | "center" | "justify" | "start" | "end";
476
480
  type TextOverflow = "ellipsis" | "clip";
477
481
 
478
482
  /**
479
- * Controls the slant (italic/oblique) of text rendering.
483
+ * Controls text case transformation when rendering.
480
484
  */
481
- type TextStyle = "normal" | "italic" | "oblique";
485
+ type TextTransform = "none" | "uppercase" | "lowercase" | "capitalize";
482
486
 
483
487
  /**
484
- * Controls text case transformation when rendering.
488
+ * Represents an affine transform matrix
485
489
  */
486
- type TextTransform = "none" | "uppercase" | "lowercase" | "capitalize";
490
+ type Affine = {
491
+ /**
492
+ * Horizontal scaling / cosine of rotation
493
+ */
494
+ a: number;
495
+ /**
496
+ * Vertical shear / sine of rotation
497
+ */
498
+ b: number;
499
+ /**
500
+ * Horizontal shear / negative sine of rotation
501
+ */
502
+ c: number;
503
+ /**
504
+ * Vertical scaling / cosine of rotation
505
+ */
506
+ d: number;
507
+ /**
508
+ * Horizontal translation (always orthogonal regardless of rotation)
509
+ */
510
+ x: number;
511
+ /**
512
+ * Vertical translation (always orthogonal regardless of rotation)
513
+ */
514
+ y: number;
515
+ };
487
516
 
488
517
  /**
489
518
  * Represents a single CSS transform operation
@@ -494,6 +523,10 @@ type Transform = {
494
523
  "scale": [number, number];
495
524
  } | {
496
525
  "rotate": Angle;
526
+ } | {
527
+ "skew": [Angle, Angle];
528
+ } | {
529
+ "matrix": Affine;
497
530
  };
498
531
 
499
532
  /**
@@ -501,6 +534,13 @@ type Transform = {
501
534
  */
502
535
  type Transforms = Array<Transform> | string;
503
536
 
537
+ /**
538
+ * Controls how text should be broken at word boundaries.
539
+ *
540
+ * Corresponds to CSS word-break property.
541
+ */
542
+ type WordBreak = "normal" | "break-all" | "keep-all";
543
+
504
544
  /**
505
545
  * Main styling structure that contains all layout and visual properties.
506
546
  */
@@ -788,7 +828,7 @@ type Style = {
788
828
  /**
789
829
  * Font slant style (normal, italic, oblique).
790
830
  */
791
- textStyle?: TextStyle;
831
+ fontStyle?: FontStyle;
792
832
  /**
793
833
  * Color of the element's border.
794
834
  */
@@ -825,10 +865,22 @@ type Style = {
825
865
  * Additional spacing between characters in text.
826
866
  */
827
867
  letterSpacing?: LengthUnit;
868
+ /**
869
+ * Additional spacing between words in text.
870
+ */
871
+ wordSpacing?: LengthUnit;
828
872
  /**
829
873
  * Controls how images are scaled when rendered.
830
874
  */
831
875
  imageRendering?: ImageScalingAlgorithm;
876
+ /**
877
+ * How text should be overflowed.
878
+ */
879
+ overflowWrap?: OverflowWrap;
880
+ /**
881
+ * How text should be broken at word boundaries.
882
+ */
883
+ wordBreak?: WordBreak;
832
884
  };
833
885
 
834
886
  type JsonValue = string | number | boolean | null | JsonValue[] | {
@@ -299,20 +299,19 @@ type FlexWrap = "nowrap" | "wrap" | "wrap-reverse";
299
299
 
300
300
  /**
301
301
  * Represents a font family for text rendering.
302
- * Use only the family name (no style suffixes like "Bold", "Italic", "Regular").
303
- * Multi-word names are allowed (e.g., "Noto Sans") and should be provided as-is without quotes.
302
+ * Multi value fallback is supported.
304
303
  */
305
- type FontFamily = "sans-serif" | "serif" | "monospace" | "cursive" | "fantasy" | string;
304
+ type FontFamily = string;
306
305
 
307
306
  /**
308
- * Represents font weight as a numeric value.
309
- *
310
- * This wraps a u16 value that corresponds to CSS font-weight values.
311
- * Common values include 100 (thin), 200 (extra light), 300 (light),
312
- * 400 (normal), 500 (medium), 600 (semi bold), 700 (bold),
313
- * 800 (extra bold), 900 (black).
307
+ * Controls the slant (italic/oblique) of text rendering.
308
+ */
309
+ type FontStyle = "normal" | "italic" | "oblique" | `oblique ${string}deg`;
310
+
311
+ /**
312
+ * Represents font weight value.
314
313
  */
315
- type FontWeight = number | string;
314
+ type FontWeight = string | number;
316
315
 
317
316
  /**
318
317
  * Represents spacing between flex items.
@@ -449,6 +448,11 @@ type LineHeight = number | string | LengthUnit;
449
448
  */
450
449
  type ObjectFit = "fill" | "contain" | "cover" | "scale-down" | "none";
451
450
 
451
+ /**
452
+ * Controls how text should be overflowed.
453
+ */
454
+ type OverflowWrap = "normal" | "anywhere" | "break-word";
455
+
452
456
  /**
453
457
  * Defines the positioning method for an element.
454
458
  *
@@ -476,14 +480,39 @@ type TextAlign = "left" | "right" | "center" | "justify" | "start" | "end";
476
480
  type TextOverflow = "ellipsis" | "clip";
477
481
 
478
482
  /**
479
- * Controls the slant (italic/oblique) of text rendering.
483
+ * Controls text case transformation when rendering.
480
484
  */
481
- type TextStyle = "normal" | "italic" | "oblique";
485
+ type TextTransform = "none" | "uppercase" | "lowercase" | "capitalize";
482
486
 
483
487
  /**
484
- * Controls text case transformation when rendering.
488
+ * Represents an affine transform matrix
485
489
  */
486
- type TextTransform = "none" | "uppercase" | "lowercase" | "capitalize";
490
+ type Affine = {
491
+ /**
492
+ * Horizontal scaling / cosine of rotation
493
+ */
494
+ a: number;
495
+ /**
496
+ * Vertical shear / sine of rotation
497
+ */
498
+ b: number;
499
+ /**
500
+ * Horizontal shear / negative sine of rotation
501
+ */
502
+ c: number;
503
+ /**
504
+ * Vertical scaling / cosine of rotation
505
+ */
506
+ d: number;
507
+ /**
508
+ * Horizontal translation (always orthogonal regardless of rotation)
509
+ */
510
+ x: number;
511
+ /**
512
+ * Vertical translation (always orthogonal regardless of rotation)
513
+ */
514
+ y: number;
515
+ };
487
516
 
488
517
  /**
489
518
  * Represents a single CSS transform operation
@@ -494,6 +523,10 @@ type Transform = {
494
523
  "scale": [number, number];
495
524
  } | {
496
525
  "rotate": Angle;
526
+ } | {
527
+ "skew": [Angle, Angle];
528
+ } | {
529
+ "matrix": Affine;
497
530
  };
498
531
 
499
532
  /**
@@ -501,6 +534,13 @@ type Transform = {
501
534
  */
502
535
  type Transforms = Array<Transform> | string;
503
536
 
537
+ /**
538
+ * Controls how text should be broken at word boundaries.
539
+ *
540
+ * Corresponds to CSS word-break property.
541
+ */
542
+ type WordBreak = "normal" | "break-all" | "keep-all";
543
+
504
544
  /**
505
545
  * Main styling structure that contains all layout and visual properties.
506
546
  */
@@ -788,7 +828,7 @@ type Style = {
788
828
  /**
789
829
  * Font slant style (normal, italic, oblique).
790
830
  */
791
- textStyle?: TextStyle;
831
+ fontStyle?: FontStyle;
792
832
  /**
793
833
  * Color of the element's border.
794
834
  */
@@ -825,10 +865,22 @@ type Style = {
825
865
  * Additional spacing between characters in text.
826
866
  */
827
867
  letterSpacing?: LengthUnit;
868
+ /**
869
+ * Additional spacing between words in text.
870
+ */
871
+ wordSpacing?: LengthUnit;
828
872
  /**
829
873
  * Controls how images are scaled when rendered.
830
874
  */
831
875
  imageRendering?: ImageScalingAlgorithm;
876
+ /**
877
+ * How text should be overflowed.
878
+ */
879
+ overflowWrap?: OverflowWrap;
880
+ /**
881
+ * How text should be broken at word boundaries.
882
+ */
883
+ wordBreak?: WordBreak;
832
884
  };
833
885
 
834
886
  type JsonValue = string | number | boolean | null | JsonValue[] | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takumi-rs/helpers",
3
- "version": "0.28.5",
3
+ "version": "0.29.1",
4
4
  "author": {
5
5
  "email": "me@kane.tw",
6
6
  "name": "Kane Wang",