@takumi-rs/helpers 0.32.2 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,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-CIAK4Jh8.cjs';
2
- export { A as AnyNode, J as JsonValue, N as Node } from './types-CIAK4Jh8.cjs';
1
+ import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as Color } from './types-RqcFyzbc.cjs';
2
+ export { A as AnyNode, J as JsonValue, N as Node } from './types-RqcFyzbc.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-CIAK4Jh8.js';
2
- export { A as AnyNode, J as JsonValue, N as Node } from './types-CIAK4Jh8.js';
1
+ import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as Color } from './types-RqcFyzbc.js';
2
+ export { A as AnyNode, J as JsonValue, N as Node } from './types-RqcFyzbc.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 L=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var $=(t,e)=>{for(var r in e)f(t,r,{get:e[r],enumerable:!0})},W=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of A(e))!O.call(t,o)&&o!==r&&f(t,o,{get:()=>e[o],enumerable:!(n=L(e,o))||n.enumerable});return t};var z=t=>W(f({},"__esModule",{value:!0}),t);var G={};$(G,{fromJsx:()=>J});module.exports=z(G);function l(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function c(t){let e={type:"container",children:t.children};return l(e,t.style),e}function m(t,e){let r={type:"text",text:t};return l(r,e),r}function u(t){let e={type:"image",src:t.src};return l(e,t.style),e}function g(t){return{percentage:t}}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(t,e){return t.type===e&&"props"in t}function b(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(t){return typeof t=="object"&&t!==null&&"type"in t}function s(t){return typeof t=="function"}var F=Symbol.for("react.forward_ref"),j=Symbol.for("react.memo"),I=Symbol.for("react.fragment");function S(t){return t.$$typeof===F}function E(t){return t.$$typeof===j}function R(t){return t.type===I}function B(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 M(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 H(t,e){if(t==="children"||e==null)return;let r;if(t==="className"?r="class":_.includes(t)?r=b(t):r=t,typeof e=="boolean")return`${r}="${String(e)}"`;if(t==="style"&&typeof e=="object"){let n=M(e);if(n)return`style="${P(n)}"`}return`${r}="${P(String(e))}"`}function X(t){return Object.entries(t).map(([e,r])=>H(e,r)).filter(e=>e!==void 0)}var D=(t,e)=>{let r=t.props||{};if(s(t.type))return p(t.type(t.props));if(typeof t.type=="symbol"||typeof t.type!="string")return"";let n=X(r),o=r.children,k=Array.isArray(o)?o.map(v=>e(v)).join(""):e(o);return`<${t.type}${n.length>0?` ${n.join(" ")}`:""}>${k}</${t.type}>`},p=t=>t==null||t===!1?"":B(t)?String(t):Array.isArray(t)?t.map(p).join(""):i(t)?D(t,p):"";function x(t){let e=t.props||{};if(!("xmlns"in e)){let r={...t,props:{...e,xmlns:"http://www.w3.org/2000/svg"}};return p(r)||""}return p(t)||""}async function J(t){let e=await a(t);return e.length===0?c({}):e.length===1&&e[0]!==void 0?e[0]:c({children:e,style:{width:g(100),height:g(100)}})}async function a(t){if(t==null)return[];if(t instanceof Promise)return a(await t);if(typeof t=="object"&&Symbol.iterator in t)return Z(t);if(i(t)){let e=await N(t);return Array.isArray(e)?e:e?[e]:[]}return[m(String(t))]}function V(t){if(!(typeof t.type!="object"||t.type===null)){if(S(t.type)&&"render"in t.type){let e=t.type;return a(e.render(t.props,null))}if(E(t.type)&&"type"in t.type){let r=t.type.type;if(s(r))return a(r(t.props));let n={...t,type:r};return N(n)}}}function C(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(T(e)):typeof e=="object"&&e!==null&&Symbol.iterator in e?Promise.resolve(T(Array.from(e))):i(e)&&R(e)?C(e):Promise.resolve(void 0)}function T(t){if(!t.some(e=>i(e)))return t.map(e=>typeof e=="string"?e:typeof e=="number"?String(e):"").join("")}async function N(t){if(s(t.type))return a(t.type(t.props));let e=V(t);if(e!==void 0)return e;if(R(t))return await w(t)||[];if(d(t,"img"))return[Y(t)];if(d(t,"svg"))return[K(t)];let r=h(t),n=await C(t);if(n!==void 0)return[m(n,r)];let o=await w(t);return[c({children:o,style:r})]}function Y(t){if(!t.props.src)throw new Error("Image element must have a 'src' prop.");let e=h(t);return u({src:t.props.src,style:e})}function K(t){let e=h(t),r=x(t);return u({style:e,src:r})}var q={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function h(t){let e={};typeof t.type=="string"&&t.type in y&&Object.assign(e,y[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(q))n in r&&(e[o]=r[n],delete r[n]);Object.assign(e,r)}return e}function w(t){return typeof t.props!="object"||t.props===null||!("children"in t.props)?Promise.resolve([]):a(t.props.children)}function Z(t){return Promise.all(Array.from(t).map(a)).then(e=>e.flat())}0&&(module.exports={fromJsx});
1
+ "use strict";var f=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var $=(t,e)=>{for(var r in e)f(t,r,{get:e[r],enumerable:!0})},W=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of A(e))!O.call(t,o)&&o!==r&&f(t,o,{get:()=>e[o],enumerable:!(n=L(e,o))||n.enumerable});return t};var z=t=>W(f({},"__esModule",{value:!0}),t);var G={};$(G,{fromJsx:()=>J});module.exports=z(G);function l(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function c(t){let e={type:"container",children:t.children};return l(e,t.style),e}function m(t,e){let r={type:"text",text:t};return l(r,e),r}function u(t){let e={type:"image",src:t.src};return l(e,t.style),e}function g(t){return{percentage:t}}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(t,e){return t.type===e&&"props"in t}function b(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(t){return typeof t=="object"&&t!==null&&"type"in t}function s(t){return typeof t=="function"}var F=Symbol.for("react.forward_ref"),j=Symbol.for("react.memo"),I=Symbol.for("react.fragment");function S(t){return t.$$typeof===F}function E(t){return t.$$typeof===j}function R(t){return t.type===I}function B(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 M(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 H(t,e){if(t==="children"||e==null)return;let r;if(t==="className"?r="class":_.includes(t)?r=b(t):r=t,typeof e=="boolean")return`${r}="${String(e)}"`;if(t==="style"&&typeof e=="object"){let n=M(e);if(n)return`style="${P(n)}"`}return`${r}="${P(String(e))}"`}function X(t){return Object.entries(t).map(([e,r])=>H(e,r)).filter(e=>e!==void 0)}var D=(t,e)=>{let r=t.props||{};if(s(t.type))return p(t.type(t.props));if(typeof t.type=="symbol"||typeof t.type!="string")return"";let n=X(r),o=r.children,k=Array.isArray(o)?o.map(v=>e(v)).join(""):e(o);return`<${t.type}${n.length>0?` ${n.join(" ")}`:""}>${k}</${t.type}>`},p=t=>t==null||t===!1?"":B(t)?String(t):Array.isArray(t)?t.map(p).join(""):i(t)?D(t,p):"";function x(t){let e=t.props||{};if(!("xmlns"in e)){let r={...t,props:{...e,xmlns:"http://www.w3.org/2000/svg"}};return p(r)||""}return p(t)||""}async function J(t){let e=await a(t);return e.length===0?c({}):e.length===1&&e[0]!==void 0?e[0]:c({children:e,style:{width:g(100),height:g(100)}})}async function a(t){if(t==null||t===!1)return[];if(t instanceof Promise)return a(await t);if(typeof t=="object"&&Symbol.iterator in t)return Z(t);if(i(t)){let e=await N(t);return Array.isArray(e)?e:e?[e]:[]}return[m(String(t))]}function V(t){if(!(typeof t.type!="object"||t.type===null)){if(S(t.type)&&"render"in t.type){let e=t.type;return a(e.render(t.props,null))}if(E(t.type)&&"type"in t.type){let r=t.type.type;if(s(r))return a(r(t.props));let n={...t,type:r};return N(n)}}}function C(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(T(e)):typeof e=="object"&&e!==null&&Symbol.iterator in e?Promise.resolve(T(Array.from(e))):i(e)&&R(e)?C(e):Promise.resolve(void 0)}function T(t){if(!t.some(e=>i(e)))return t.map(e=>typeof e=="string"?e:typeof e=="number"?String(e):"").join("")}async function N(t){if(s(t.type))return a(t.type(t.props));let e=V(t);if(e!==void 0)return e;if(R(t))return await w(t)||[];if(d(t,"img"))return[Y(t)];if(d(t,"svg"))return[K(t)];let r=h(t),n=await C(t);if(n!==void 0)return[m(n,r)];let o=await w(t);return[c({children:o,style:r})]}function Y(t){if(!t.props.src)throw new Error("Image element must have a 'src' prop.");let e=h(t);return u({src:t.props.src,style:e})}function K(t){let e=h(t),r=x(t);return u({style:e,src:r})}var q={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function h(t){let e={};typeof t.type=="string"&&t.type in y&&Object.assign(e,y[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(q))n in r&&(e[o]=r[n],delete r[n]);Object.assign(e,r)}return e}function w(t){return typeof t.props!="object"||t.props===null||!("children"in t.props)?Promise.resolve([]):a(t.props.children)}function Z(t){return Promise.all(Array.from(t).map(a)).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-CIAK4Jh8.cjs';
2
+ import { N as Node } from '../types-RqcFyzbc.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-CIAK4Jh8.js';
2
+ import { N as Node } from '../types-RqcFyzbc.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(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function c(t){let e={type:"container",children:t.children};return f(e,t.style),e}function l(t,e){let r={type:"text",text:t};return f(r,e),r}function m(t){let e={type:"image",src:t.src};return f(e,t.style),e}function u(t){return{percentage:t}}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(t,e){return t.type===e&&"props"in t}function k(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(t){return typeof t=="object"&&t!==null&&"type"in t}function s(t){return typeof t=="function"}var v=Symbol.for("react.forward_ref"),L=Symbol.for("react.memo"),A=Symbol.for("react.fragment");function b(t){return t.$$typeof===v}function S(t){return t.$$typeof===L}function d(t){return t.type===A}function O(t){return typeof t=="string"||typeof t=="number"}function E(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $(t){return Object.keys(t).map(e=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(t[e]).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 z(t,e){if(t==="children"||e==null)return;let r;if(t==="className"?r="class":W.includes(t)?r=k(t):r=t,typeof e=="boolean")return`${r}="${String(e)}"`;if(t==="style"&&typeof e=="object"){let n=$(e);if(n)return`style="${E(n)}"`}return`${r}="${E(String(e))}"`}function F(t){return Object.entries(t).map(([e,r])=>z(e,r)).filter(e=>e!==void 0)}var j=(t,e)=>{let r=t.props||{};if(s(t.type))return p(t.type(t.props));if(typeof t.type=="symbol"||typeof t.type!="string")return"";let n=F(r),o=r.children,h=Array.isArray(o)?o.map(N=>e(N)).join(""):e(o);return`<${t.type}${n.length>0?` ${n.join(" ")}`:""}>${h}</${t.type}>`},p=t=>t==null||t===!1?"":O(t)?String(t):Array.isArray(t)?t.map(p).join(""):i(t)?j(t,p):"";function P(t){let e=t.props||{};if(!("xmlns"in e)){let r={...t,props:{...e,xmlns:"http://www.w3.org/2000/svg"}};return p(r)||""}return p(t)||""}async function U(t){let e=await a(t);return e.length===0?c({}):e.length===1&&e[0]!==void 0?e[0]:c({children:e,style:{width:u(100),height:u(100)}})}async function a(t){if(t==null)return[];if(t instanceof Promise)return a(await t);if(typeof t=="object"&&Symbol.iterator in t)return H(t);if(i(t)){let e=await C(t);return Array.isArray(e)?e:e?[e]:[]}return[l(String(t))]}function I(t){if(!(typeof t.type!="object"||t.type===null)){if(b(t.type)&&"render"in t.type){let e=t.type;return a(e.render(t.props,null))}if(S(t.type)&&"type"in t.type){let r=t.type.type;if(s(r))return a(r(t.props));let n={...t,type:r};return C(n)}}}function w(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(x(e)):typeof e=="object"&&e!==null&&Symbol.iterator in e?Promise.resolve(x(Array.from(e))):i(e)&&d(e)?w(e):Promise.resolve(void 0)}function x(t){if(!t.some(e=>i(e)))return t.map(e=>typeof e=="string"?e:typeof e=="number"?String(e):"").join("")}async function C(t){if(s(t.type))return a(t.type(t.props));let e=I(t);if(e!==void 0)return e;if(d(t))return await T(t)||[];if(y(t,"img"))return[B(t)];if(y(t,"svg"))return[M(t)];let r=R(t),n=await w(t);if(n!==void 0)return[l(n,r)];let o=await T(t);return[c({children:o,style:r})]}function B(t){if(!t.props.src)throw new Error("Image element must have a 'src' prop.");let e=R(t);return m({src:t.props.src,style:e})}function M(t){let e=R(t),r=P(t);return m({style:e,src:r})}var _={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function R(t){let e={};typeof t.type=="string"&&t.type in g&&Object.assign(e,g[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(_))n in r&&(e[o]=r[n],delete r[n]);Object.assign(e,r)}return e}function T(t){return typeof t.props!="object"||t.props===null||!("children"in t.props)?Promise.resolve([]):a(t.props.children)}function H(t){return Promise.all(Array.from(t).map(a)).then(e=>e.flat())}export{U as fromJsx};
1
+ function f(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function c(t){let e={type:"container",children:t.children};return f(e,t.style),e}function l(t,e){let r={type:"text",text:t};return f(r,e),r}function m(t){let e={type:"image",src:t.src};return f(e,t.style),e}function u(t){return{percentage:t}}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(t,e){return t.type===e&&"props"in t}function k(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(t){return typeof t=="object"&&t!==null&&"type"in t}function s(t){return typeof t=="function"}var v=Symbol.for("react.forward_ref"),L=Symbol.for("react.memo"),A=Symbol.for("react.fragment");function b(t){return t.$$typeof===v}function S(t){return t.$$typeof===L}function d(t){return t.type===A}function O(t){return typeof t=="string"||typeof t=="number"}function E(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $(t){return Object.keys(t).map(e=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(t[e]).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 z(t,e){if(t==="children"||e==null)return;let r;if(t==="className"?r="class":W.includes(t)?r=k(t):r=t,typeof e=="boolean")return`${r}="${String(e)}"`;if(t==="style"&&typeof e=="object"){let n=$(e);if(n)return`style="${E(n)}"`}return`${r}="${E(String(e))}"`}function F(t){return Object.entries(t).map(([e,r])=>z(e,r)).filter(e=>e!==void 0)}var j=(t,e)=>{let r=t.props||{};if(s(t.type))return p(t.type(t.props));if(typeof t.type=="symbol"||typeof t.type!="string")return"";let n=F(r),o=r.children,h=Array.isArray(o)?o.map(N=>e(N)).join(""):e(o);return`<${t.type}${n.length>0?` ${n.join(" ")}`:""}>${h}</${t.type}>`},p=t=>t==null||t===!1?"":O(t)?String(t):Array.isArray(t)?t.map(p).join(""):i(t)?j(t,p):"";function P(t){let e=t.props||{};if(!("xmlns"in e)){let r={...t,props:{...e,xmlns:"http://www.w3.org/2000/svg"}};return p(r)||""}return p(t)||""}async function U(t){let e=await a(t);return e.length===0?c({}):e.length===1&&e[0]!==void 0?e[0]:c({children:e,style:{width:u(100),height:u(100)}})}async function a(t){if(t==null||t===!1)return[];if(t instanceof Promise)return a(await t);if(typeof t=="object"&&Symbol.iterator in t)return H(t);if(i(t)){let e=await C(t);return Array.isArray(e)?e:e?[e]:[]}return[l(String(t))]}function I(t){if(!(typeof t.type!="object"||t.type===null)){if(b(t.type)&&"render"in t.type){let e=t.type;return a(e.render(t.props,null))}if(S(t.type)&&"type"in t.type){let r=t.type.type;if(s(r))return a(r(t.props));let n={...t,type:r};return C(n)}}}function w(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(x(e)):typeof e=="object"&&e!==null&&Symbol.iterator in e?Promise.resolve(x(Array.from(e))):i(e)&&d(e)?w(e):Promise.resolve(void 0)}function x(t){if(!t.some(e=>i(e)))return t.map(e=>typeof e=="string"?e:typeof e=="number"?String(e):"").join("")}async function C(t){if(s(t.type))return a(t.type(t.props));let e=I(t);if(e!==void 0)return e;if(d(t))return await T(t)||[];if(y(t,"img"))return[B(t)];if(y(t,"svg"))return[M(t)];let r=R(t),n=await w(t);if(n!==void 0)return[l(n,r)];let o=await T(t);return[c({children:o,style:r})]}function B(t){if(!t.props.src)throw new Error("Image element must have a 'src' prop.");let e=R(t);return m({src:t.props.src,style:e})}function M(t){let e=R(t),r=P(t);return m({style:e,src:r})}var _={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function R(t){let e={};typeof t.type=="string"&&t.type in g&&Object.assign(e,g[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(_))n in r&&(e[o]=r[n],delete r[n]);Object.assign(e,r)}return e}function T(t){return typeof t.props!="object"||t.props===null||!("children"in t.props)?Promise.resolve([]):a(t.props.children)}function H(t){return Promise.all(Array.from(t).map(a)).then(e=>e.flat())}export{U as fromJsx};
@@ -7,14 +7,14 @@
7
7
  type AlignItems = "normal" | "start" | "end" | "flex-start" | "flex-end" | "center" | "baseline" | "stretch";
8
8
 
9
9
  /**
10
- * Represents a aspect ratio.
10
+ * Represents an angle value in degrees.
11
11
  */
12
- type AspectRatio = number | "auto" | (string & {});
12
+ type Angle = number | string;
13
13
 
14
14
  /**
15
- * Represents an angle value in degrees.
15
+ * Represents a aspect ratio.
16
16
  */
17
- type Angle = number;
17
+ type AspectRatio = number | "auto" | (string & {});
18
18
 
19
19
  /**
20
20
  * Represents a color with 8-bit RGBA components.
@@ -317,6 +317,15 @@ type CssValue<T> = CssGlobalKeyword | T;
317
317
  */
318
318
  type Display = "flex" | "grid";
319
319
 
320
+ /**
321
+ * Represents a flex shorthand property for flex-grow, flex-shrink, and flex-basis.
322
+ */
323
+ type Flex = {
324
+ grow: number | null;
325
+ shrink: number | null;
326
+ basis: LengthUnit | null;
327
+ } | number | "auto" | "none" | string;
328
+
320
329
  /**
321
330
  * Defines the direction of flex items within a flex container.
322
331
  *
@@ -511,6 +520,14 @@ type ImageScalingAlgorithm = "auto" | "smooth" | "pixelated";
511
520
  */
512
521
  type JustifyContent = "normal" | "start" | "end" | "flex-start" | "flex-end" | "center" | "stretch" | "space-between" | "space-evenly" | "space-around";
513
522
 
523
+ /**
524
+ * Represents a line clamp value.
525
+ */
526
+ type LineClamp = {
527
+ count: number;
528
+ ellipsis: string | null;
529
+ } | number | string;
530
+
514
531
  /**
515
532
  * Represents a line height value, number value is parsed as em.
516
533
  */
@@ -535,6 +552,14 @@ type OverflowWrap = "normal" | "anywhere" | "break-word";
535
552
  */
536
553
  type Position = "relative" | "absolute";
537
554
 
555
+ /**
556
+ * Represents a 2D scale for CSS scale property
557
+ */
558
+ type Scale = {
559
+ x: number;
560
+ y: number;
561
+ } | string;
562
+
538
563
  /**
539
564
  * Represents the values for the four sides of a box (top, right, bottom, left).
540
565
  */
@@ -576,7 +601,7 @@ type TextDecoration = {
576
601
  *
577
602
  * This enum determines how text should be handled when it exceeds the container width.
578
603
  */
579
- type TextOverflow = "clip" | "ellipsis";
604
+ type TextOverflow = "clip" | "ellipsis" | string;
580
605
 
581
606
  /**
582
607
  * Represents a text shadow with all its properties.
@@ -670,6 +695,14 @@ type Transform = {
670
695
  */
671
696
  type Transforms = Array<Transform> | string;
672
697
 
698
+ /**
699
+ * Represents a 2D translation for CSS translate property
700
+ */
701
+ type Translate = {
702
+ x: LengthUnit;
703
+ y: LengthUnit;
704
+ } | string;
705
+
673
706
  /**
674
707
  * Controls how text should be broken at word boundaries.
675
708
  *
@@ -713,17 +746,21 @@ type Style = {
713
746
  alignItems: CssValue<AlignItems>;
714
747
  alignSelf: CssValue<AlignItems>;
715
748
  flexWrap: CssValue<FlexWrap>;
716
- flexBasis: CssValue<LengthUnit>;
749
+ flexBasis: CssValue<CssOption<LengthUnit>>;
717
750
  position: CssValue<Position>;
751
+ rotate: CssValue<CssOption<Angle>>;
752
+ scale: CssValue<CssOption<Scale>>;
718
753
  transform: CssValue<CssOption<Transforms>>;
719
754
  transformOrigin: CssValue<CssOption<BackgroundPosition>>;
755
+ translate: CssValue<CssOption<Translate>>;
720
756
  maskImage: CssValue<CssOption<BackgroundImages>>;
721
757
  maskSize: CssValue<CssOption<BackgroundSizes>>;
722
758
  maskPosition: CssValue<CssOption<BackgroundPositions>>;
723
759
  maskRepeat: CssValue<CssOption<BackgroundRepeats>>;
724
760
  gap: CssValue<Gap>;
725
- flexGrow: CssValue<FlexGrow>;
726
- flexShrink: CssValue<FlexGrow>;
761
+ flex: CssValue<CssOption<Flex>>;
762
+ flexGrow: CssValue<CssOption<FlexGrow>>;
763
+ flexShrink: CssValue<CssOption<FlexGrow>>;
727
764
  borderRadius: CssValue<Sides<LengthUnit>>;
728
765
  borderTopLeftRadius: CssValue<CssOption<LengthUnit>>;
729
766
  borderTopRightRadius: CssValue<CssOption<LengthUnit>>;
@@ -762,7 +799,7 @@ type Style = {
762
799
  fontWeight: CssValue<FontWeight>;
763
800
  fontVariationSettings: CssValue<CssOption<FontVariationSettings>>;
764
801
  fontFeatureSettings: CssValue<CssOption<FontFeatureSettings>>;
765
- lineClamp: CssValue<CssOption<number>>;
802
+ lineClamp: CssValue<CssOption<LineClamp>>;
766
803
  textAlign: CssValue<TextAlign>;
767
804
  textStrokeWidth: CssValue<LengthUnit>;
768
805
  textStrokeColor: CssValue<CssOption<Color>>;
@@ -7,14 +7,14 @@
7
7
  type AlignItems = "normal" | "start" | "end" | "flex-start" | "flex-end" | "center" | "baseline" | "stretch";
8
8
 
9
9
  /**
10
- * Represents a aspect ratio.
10
+ * Represents an angle value in degrees.
11
11
  */
12
- type AspectRatio = number | "auto" | (string & {});
12
+ type Angle = number | string;
13
13
 
14
14
  /**
15
- * Represents an angle value in degrees.
15
+ * Represents a aspect ratio.
16
16
  */
17
- type Angle = number;
17
+ type AspectRatio = number | "auto" | (string & {});
18
18
 
19
19
  /**
20
20
  * Represents a color with 8-bit RGBA components.
@@ -317,6 +317,15 @@ type CssValue<T> = CssGlobalKeyword | T;
317
317
  */
318
318
  type Display = "flex" | "grid";
319
319
 
320
+ /**
321
+ * Represents a flex shorthand property for flex-grow, flex-shrink, and flex-basis.
322
+ */
323
+ type Flex = {
324
+ grow: number | null;
325
+ shrink: number | null;
326
+ basis: LengthUnit | null;
327
+ } | number | "auto" | "none" | string;
328
+
320
329
  /**
321
330
  * Defines the direction of flex items within a flex container.
322
331
  *
@@ -511,6 +520,14 @@ type ImageScalingAlgorithm = "auto" | "smooth" | "pixelated";
511
520
  */
512
521
  type JustifyContent = "normal" | "start" | "end" | "flex-start" | "flex-end" | "center" | "stretch" | "space-between" | "space-evenly" | "space-around";
513
522
 
523
+ /**
524
+ * Represents a line clamp value.
525
+ */
526
+ type LineClamp = {
527
+ count: number;
528
+ ellipsis: string | null;
529
+ } | number | string;
530
+
514
531
  /**
515
532
  * Represents a line height value, number value is parsed as em.
516
533
  */
@@ -535,6 +552,14 @@ type OverflowWrap = "normal" | "anywhere" | "break-word";
535
552
  */
536
553
  type Position = "relative" | "absolute";
537
554
 
555
+ /**
556
+ * Represents a 2D scale for CSS scale property
557
+ */
558
+ type Scale = {
559
+ x: number;
560
+ y: number;
561
+ } | string;
562
+
538
563
  /**
539
564
  * Represents the values for the four sides of a box (top, right, bottom, left).
540
565
  */
@@ -576,7 +601,7 @@ type TextDecoration = {
576
601
  *
577
602
  * This enum determines how text should be handled when it exceeds the container width.
578
603
  */
579
- type TextOverflow = "clip" | "ellipsis";
604
+ type TextOverflow = "clip" | "ellipsis" | string;
580
605
 
581
606
  /**
582
607
  * Represents a text shadow with all its properties.
@@ -670,6 +695,14 @@ type Transform = {
670
695
  */
671
696
  type Transforms = Array<Transform> | string;
672
697
 
698
+ /**
699
+ * Represents a 2D translation for CSS translate property
700
+ */
701
+ type Translate = {
702
+ x: LengthUnit;
703
+ y: LengthUnit;
704
+ } | string;
705
+
673
706
  /**
674
707
  * Controls how text should be broken at word boundaries.
675
708
  *
@@ -713,17 +746,21 @@ type Style = {
713
746
  alignItems: CssValue<AlignItems>;
714
747
  alignSelf: CssValue<AlignItems>;
715
748
  flexWrap: CssValue<FlexWrap>;
716
- flexBasis: CssValue<LengthUnit>;
749
+ flexBasis: CssValue<CssOption<LengthUnit>>;
717
750
  position: CssValue<Position>;
751
+ rotate: CssValue<CssOption<Angle>>;
752
+ scale: CssValue<CssOption<Scale>>;
718
753
  transform: CssValue<CssOption<Transforms>>;
719
754
  transformOrigin: CssValue<CssOption<BackgroundPosition>>;
755
+ translate: CssValue<CssOption<Translate>>;
720
756
  maskImage: CssValue<CssOption<BackgroundImages>>;
721
757
  maskSize: CssValue<CssOption<BackgroundSizes>>;
722
758
  maskPosition: CssValue<CssOption<BackgroundPositions>>;
723
759
  maskRepeat: CssValue<CssOption<BackgroundRepeats>>;
724
760
  gap: CssValue<Gap>;
725
- flexGrow: CssValue<FlexGrow>;
726
- flexShrink: CssValue<FlexGrow>;
761
+ flex: CssValue<CssOption<Flex>>;
762
+ flexGrow: CssValue<CssOption<FlexGrow>>;
763
+ flexShrink: CssValue<CssOption<FlexGrow>>;
727
764
  borderRadius: CssValue<Sides<LengthUnit>>;
728
765
  borderTopLeftRadius: CssValue<CssOption<LengthUnit>>;
729
766
  borderTopRightRadius: CssValue<CssOption<LengthUnit>>;
@@ -762,7 +799,7 @@ type Style = {
762
799
  fontWeight: CssValue<FontWeight>;
763
800
  fontVariationSettings: CssValue<CssOption<FontVariationSettings>>;
764
801
  fontFeatureSettings: CssValue<CssOption<FontFeatureSettings>>;
765
- lineClamp: CssValue<CssOption<number>>;
802
+ lineClamp: CssValue<CssOption<LineClamp>>;
766
803
  textAlign: CssValue<TextAlign>;
767
804
  textStrokeWidth: CssValue<LengthUnit>;
768
805
  textStrokeColor: CssValue<CssOption<Color>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takumi-rs/helpers",
3
- "version": "0.32.2",
3
+ "version": "0.33.0",
4
4
  "author": {
5
5
  "email": "me@kane.tw",
6
6
  "name": "Kane Wang",
@@ -11,12 +11,12 @@
11
11
  },
12
12
  "devDependencies": {
13
13
  "@types/bun": "^1.2.23",
14
- "@types/react": "^19.1.16",
15
- "@types/react-dom": "^19.1.9",
14
+ "@types/react": "^19.2.0",
15
+ "@types/react-dom": "^19.2.0",
16
16
  "bun-plugin-dts": "^0.3.0",
17
17
  "lucide-react": "^0.544.0",
18
- "react": "^19.1.1",
19
- "react-dom": "^19.1.1",
18
+ "react": "^19.2.0",
19
+ "react-dom": "^19.2.0",
20
20
  "tsup": "^8.5.0",
21
21
  "typescript": "^5.9.3"
22
22
  },
@@ -42,7 +42,8 @@
42
42
  ],
43
43
  "license": "(MIT OR Apache-2.0)",
44
44
  "scripts": {
45
- "build": "tsup-node src/index.ts src/jsx/jsx.ts --minify --dts --format esm,cjs --no-splitting"
45
+ "build": "tsup-node src/index.ts src/jsx/jsx.ts --minify --dts --format esm,cjs --no-splitting",
46
+ "release": "npm publish --provenance"
46
47
  },
47
48
  "type": "module"
48
49
  }