@takumi-rs/helpers 0.30.1 → 0.31.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-Bg4T_32S.cjs';
2
- export { A as AnyNode, J as JsonValue, N as Node } from './types-Bg4T_32S.cjs';
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';
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-Bg4T_32S.js';
2
- export { A as AnyNode, J as JsonValue, N as Node } from './types-Bg4T_32S.js';
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';
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 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
+ "use strict";var f=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var z=(e,t)=>{for(var r in t)f(e,r,{get:t[r],enumerable:!0})},I=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of O(t))!F.call(e,i)&&i!==r&&f(e,i,{get:()=>t[i],enumerable:!(o=$(t,i))||o.enumerable});return e};var W=e=>I(f({},"__esModule",{value:!0}),e);var U={};z(U,{fromJsx:()=>B});module.exports=W(U);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 k(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:k(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 b(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 h(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=b(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,E=Array.isArray(i)?i.map(L=>t(L)).join(""):t(i);return`<${e.type}${o.length>0?` ${o.join(" ")}`:""}>${E}</${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 G(e);if(s(e)){let t=await T(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 T(o)}}}function A(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)&&h(t)?A(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 T(e){if(c(e.type))return a(e.type(e.props));let t=K(e);if(t!==void 0)return t;if(h(e))return await v(e)||[];if(R(e,"img"))return[q(e)];if(R(e,"svg"))return[Z(e)];let r=S(e.props);typeof e.type=="string"&&e.type in d&&Object.assign(r,d[e.type]);let o=await A(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=S(e.props);return y({src:e.props.src,style:t})}function Z(e){let t=S(e.props),r=C(e);return y({style:t,src:r})}function S(e){return typeof e!="object"||e===null?{}:"style"in e&&typeof e.style=="object"?e.style:{}}function v(e){return typeof e.props!="object"||e.props===null||!("children"in e.props)?Promise.resolve([]):a(e.props.children)}function G(e){return Promise.all(Array.from(e).map(a)).then(t=>t.flat())}0&&(module.exports={fromJsx});
@@ -1,8 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
- import { N as Node } from '../types-Bg4T_32S.cjs';
2
+ import { N as Node } from '../types-COELemna.cjs';
3
3
 
4
4
  type ReactElementLike = {
5
- type: string | ((props: unknown) => ReactElementLike) | ReactElementLike;
5
+ type: string | symbol | ((props: unknown) => ReactElementLike) | ReactElementLike;
6
6
  props: unknown;
7
7
  $$typeof?: symbol;
8
8
  };
package/dist/jsx/jsx.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
- import { N as Node } from '../types-Bg4T_32S.js';
2
+ import { N as Node } from '../types-COELemna.js';
3
3
 
4
4
  type ReactElementLike = {
5
- type: string | ((props: unknown) => ReactElementLike) | ReactElementLike;
5
+ type: string | symbol | ((props: unknown) => ReactElementLike) | ReactElementLike;
6
6
  props: unknown;
7
7
  $$typeof?: symbol;
8
8
  };
package/dist/jsx/jsx.js CHANGED
@@ -1 +1 @@
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};
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 E(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:E(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 k(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"),$=Symbol.for("react.memo"),O=Symbol.for("react.fragment");function b(e){return e.$$typeof===L}function P(e){return e.$$typeof===$}function R(e){return e.type===O}function F(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 z(e){return Object.keys(e).map(t=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(e[t]).trim()}`).join(";")}var I=["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 W(e,t){if(e==="children"||t==null)return;let r;if(e==="className"?r="class":I.includes(e)?r=k(e):r=e,typeof t=="boolean")return`${r}="${String(t)}"`;if(e==="style"&&typeof t=="object"){let o=z(t);if(o)return`style="${x(o)}"`}return`${r}="${x(String(t))}"`}function j(e){return Object.entries(e).map(([t,r])=>W(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,S=Array.isArray(a)?a.map(T=>t(T)).join(""):t(a);return`<${e.type}${o.length>0?` ${o.join(" ")}`:""}>${S}</${e.type}>`},p=e=>e==null||e===!1?"":F(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 ee(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 H(e);if(i(e)){let t=await A(e);return Array.isArray(t)?t:t?[t]:[]}return[u(String(e))]}function X(e){if(!(typeof e.type!="object"||e.type===null)){if(b(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 A(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 A(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=h(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=h(e.props);return m({src:e.props.src,style:t})}function _(e){let t=h(e.props),r=w(e);return m({style:t,src:r})}function h(e){return typeof e!="object"||e===null?{}:"style"in e&&typeof e.style=="object"?e.style:{}}function N(e){return typeof e.props!="object"||e.props===null||!("children"in e.props)?Promise.resolve([]):s(e.props.children)}function H(e){return Promise.all(Array.from(e).map(s)).then(t=>t.flat())}export{ee as fromJsx};
@@ -23,27 +23,27 @@ type Color = [number, number, number] | [number, number, number, number] | numbe
23
23
  * or the 'auto' keyword for automatic sizing.
24
24
  */
25
25
  type LengthUnit = "auto" | {
26
- "percentage": number;
26
+ percentage: number;
27
27
  } | {
28
- "rem": number;
28
+ rem: number;
29
29
  } | {
30
- "em": number;
30
+ em: number;
31
31
  } | {
32
- "vh": number;
32
+ vh: number;
33
33
  } | {
34
- "vw": number;
34
+ vw: number;
35
35
  } | {
36
- "cm": number;
36
+ cm: number;
37
37
  } | {
38
- "mm": number;
38
+ mm: number;
39
39
  } | {
40
- "in": number;
40
+ in: number;
41
41
  } | {
42
- "Q": number;
42
+ Q: number;
43
43
  } | {
44
- "Pt": number;
44
+ Pt: number;
45
45
  } | {
46
- "Pc": number;
46
+ Pc: number;
47
47
  } | number | string;
48
48
 
49
49
  /**
@@ -172,7 +172,7 @@ type PositionComponent = {
172
172
  } | {
173
173
  "keyword-y": PositionKeywordY;
174
174
  } | {
175
- "length": LengthUnit;
175
+ length: LengthUnit;
176
176
  };
177
177
 
178
178
  /**
@@ -213,7 +213,7 @@ type BackgroundRepeats = Array<BackgroundRepeat> | string;
213
213
  * Parsed `background-size` for one layer.
214
214
  */
215
215
  type BackgroundSize = "Cover" | "Contain" | {
216
- "Explicit": {
216
+ Explicit: {
217
217
  /**
218
218
  * Width value for the background image.
219
219
  */
@@ -230,6 +230,20 @@ type BackgroundSize = "Cover" | "Contain" | {
230
230
  */
231
231
  type BackgroundSizes = Array<BackgroundSize> | string;
232
232
 
233
+ /**
234
+ * Represents border style options (currently only solid is supported).
235
+ */
236
+ type BorderStyle = "solid";
237
+
238
+ /**
239
+ * Parsed `border` value.
240
+ */
241
+ type Border = {
242
+ width: LengthUnit | null;
243
+ style: BorderStyle | null;
244
+ color: Color | null;
245
+ } | string;
246
+
233
247
  /**
234
248
  * Represents a box shadow with all its properties.
235
249
  *
@@ -351,7 +365,7 @@ type GridAutoFlow = "row" | "column" | "row dense" | "column dense";
351
365
  * Represents a grid placement with serde support
352
366
  */
353
367
  type GridPlacement = "auto" | {
354
- "span": number;
368
+ span: number;
355
369
  } | number | string;
356
370
 
357
371
  /**
@@ -380,7 +394,7 @@ type GridTemplateAreas = Array<Array<string>> | string;
380
394
  * Represents a grid track sizing function with serde support
381
395
  */
382
396
  type GridLengthUnit = {
383
- "fr": number;
397
+ fr: number;
384
398
  } | LengthUnit | string;
385
399
 
386
400
  /**
@@ -493,6 +507,30 @@ type Sides<T> = string | [T, T, T, T] | [T, T] | T;
493
507
  */
494
508
  type TextAlign = "left" | "right" | "center" | "justify" | "start" | "end";
495
509
 
510
+ /**
511
+ * Represents text decoration line options.
512
+ */
513
+ type TextDecorationLine = "underline" | "line-through" | "overline";
514
+
515
+ /**
516
+ * Represents a collection of text decoration lines.
517
+ */
518
+ type TextDecorationLines = Array<TextDecorationLine> | string;
519
+
520
+ /**
521
+ * Represents text decoration style options (currently only solid is supported).
522
+ */
523
+ type TextDecorationStyle = "solid";
524
+
525
+ /**
526
+ * Parsed `text-decoration` value.
527
+ */
528
+ type TextDecoration = {
529
+ line: TextDecorationLines;
530
+ style: TextDecorationStyle | null;
531
+ color: Color | null;
532
+ } | string;
533
+
496
534
  /**
497
535
  * Defines how text should be overflowed.
498
536
  *
@@ -576,15 +614,15 @@ type Affine = {
576
614
  * Represents a single CSS transform operation
577
615
  */
578
616
  type Transform = {
579
- "translate": [LengthUnit, LengthUnit];
617
+ translate: [LengthUnit, LengthUnit];
580
618
  } | {
581
- "scale": [number, number];
619
+ scale: [number, number];
582
620
  } | {
583
- "rotate": Angle;
621
+ rotate: Angle;
584
622
  } | {
585
- "skew": [Angle, Angle];
623
+ skew: [Angle, Angle];
586
624
  } | {
587
- "matrix": Affine;
625
+ matrix: Affine;
588
626
  };
589
627
 
590
628
  /**
@@ -651,12 +689,14 @@ type Style = {
651
689
  borderTopRightRadius: CssValue<LengthUnit | null>;
652
690
  borderBottomRightRadius: CssValue<LengthUnit | null>;
653
691
  borderBottomLeftRadius: CssValue<LengthUnit | null>;
654
- borderWidth: CssValue<Sides<LengthUnit>>;
692
+ borderWidth: CssValue<Sides<LengthUnit> | null>;
655
693
  borderTopWidth: CssValue<LengthUnit | null>;
656
694
  borderRightWidth: CssValue<LengthUnit | null>;
657
695
  borderBottomWidth: CssValue<LengthUnit | null>;
658
696
  borderLeftWidth: CssValue<LengthUnit | null>;
697
+ border: CssValue<Border>;
659
698
  objectFit: CssValue<ObjectFit>;
699
+ objectPosition: CssValue<BackgroundPosition>;
660
700
  backgroundImage: CssValue<BackgroundImages | null>;
661
701
  backgroundPosition: CssValue<BackgroundPositions | null>;
662
702
  backgroundSize: CssValue<BackgroundSizes | null>;
@@ -674,7 +714,7 @@ type Style = {
674
714
  textOverflow: CssValue<TextOverflow>;
675
715
  textTransform: CssValue<TextTransform>;
676
716
  fontStyle: CssValue<FontStyle>;
677
- borderColor: CssValue<Color>;
717
+ borderColor: CssValue<Color | null>;
678
718
  color: CssValue<Color>;
679
719
  fontSize: CssValue<LengthUnit>;
680
720
  fontFamily: CssValue<FontFamily | null>;
@@ -688,6 +728,9 @@ type Style = {
688
728
  textStrokeColor: CssValue<Color | null>;
689
729
  textStroke: CssValue<TextStroke | null>;
690
730
  textShadow: CssValue<TextShadows | null>;
731
+ textDecoration: CssValue<TextDecoration>;
732
+ textDecorationLine: CssValue<TextDecorationLines | null>;
733
+ textDecorationColor: CssValue<Color | null>;
691
734
  letterSpacing: CssValue<LengthUnit | null>;
692
735
  wordSpacing: CssValue<LengthUnit | null>;
693
736
  imageRendering: CssValue<ImageScalingAlgorithm>;
@@ -23,27 +23,27 @@ type Color = [number, number, number] | [number, number, number, number] | numbe
23
23
  * or the 'auto' keyword for automatic sizing.
24
24
  */
25
25
  type LengthUnit = "auto" | {
26
- "percentage": number;
26
+ percentage: number;
27
27
  } | {
28
- "rem": number;
28
+ rem: number;
29
29
  } | {
30
- "em": number;
30
+ em: number;
31
31
  } | {
32
- "vh": number;
32
+ vh: number;
33
33
  } | {
34
- "vw": number;
34
+ vw: number;
35
35
  } | {
36
- "cm": number;
36
+ cm: number;
37
37
  } | {
38
- "mm": number;
38
+ mm: number;
39
39
  } | {
40
- "in": number;
40
+ in: number;
41
41
  } | {
42
- "Q": number;
42
+ Q: number;
43
43
  } | {
44
- "Pt": number;
44
+ Pt: number;
45
45
  } | {
46
- "Pc": number;
46
+ Pc: number;
47
47
  } | number | string;
48
48
 
49
49
  /**
@@ -172,7 +172,7 @@ type PositionComponent = {
172
172
  } | {
173
173
  "keyword-y": PositionKeywordY;
174
174
  } | {
175
- "length": LengthUnit;
175
+ length: LengthUnit;
176
176
  };
177
177
 
178
178
  /**
@@ -213,7 +213,7 @@ type BackgroundRepeats = Array<BackgroundRepeat> | string;
213
213
  * Parsed `background-size` for one layer.
214
214
  */
215
215
  type BackgroundSize = "Cover" | "Contain" | {
216
- "Explicit": {
216
+ Explicit: {
217
217
  /**
218
218
  * Width value for the background image.
219
219
  */
@@ -230,6 +230,20 @@ type BackgroundSize = "Cover" | "Contain" | {
230
230
  */
231
231
  type BackgroundSizes = Array<BackgroundSize> | string;
232
232
 
233
+ /**
234
+ * Represents border style options (currently only solid is supported).
235
+ */
236
+ type BorderStyle = "solid";
237
+
238
+ /**
239
+ * Parsed `border` value.
240
+ */
241
+ type Border = {
242
+ width: LengthUnit | null;
243
+ style: BorderStyle | null;
244
+ color: Color | null;
245
+ } | string;
246
+
233
247
  /**
234
248
  * Represents a box shadow with all its properties.
235
249
  *
@@ -351,7 +365,7 @@ type GridAutoFlow = "row" | "column" | "row dense" | "column dense";
351
365
  * Represents a grid placement with serde support
352
366
  */
353
367
  type GridPlacement = "auto" | {
354
- "span": number;
368
+ span: number;
355
369
  } | number | string;
356
370
 
357
371
  /**
@@ -380,7 +394,7 @@ type GridTemplateAreas = Array<Array<string>> | string;
380
394
  * Represents a grid track sizing function with serde support
381
395
  */
382
396
  type GridLengthUnit = {
383
- "fr": number;
397
+ fr: number;
384
398
  } | LengthUnit | string;
385
399
 
386
400
  /**
@@ -493,6 +507,30 @@ type Sides<T> = string | [T, T, T, T] | [T, T] | T;
493
507
  */
494
508
  type TextAlign = "left" | "right" | "center" | "justify" | "start" | "end";
495
509
 
510
+ /**
511
+ * Represents text decoration line options.
512
+ */
513
+ type TextDecorationLine = "underline" | "line-through" | "overline";
514
+
515
+ /**
516
+ * Represents a collection of text decoration lines.
517
+ */
518
+ type TextDecorationLines = Array<TextDecorationLine> | string;
519
+
520
+ /**
521
+ * Represents text decoration style options (currently only solid is supported).
522
+ */
523
+ type TextDecorationStyle = "solid";
524
+
525
+ /**
526
+ * Parsed `text-decoration` value.
527
+ */
528
+ type TextDecoration = {
529
+ line: TextDecorationLines;
530
+ style: TextDecorationStyle | null;
531
+ color: Color | null;
532
+ } | string;
533
+
496
534
  /**
497
535
  * Defines how text should be overflowed.
498
536
  *
@@ -576,15 +614,15 @@ type Affine = {
576
614
  * Represents a single CSS transform operation
577
615
  */
578
616
  type Transform = {
579
- "translate": [LengthUnit, LengthUnit];
617
+ translate: [LengthUnit, LengthUnit];
580
618
  } | {
581
- "scale": [number, number];
619
+ scale: [number, number];
582
620
  } | {
583
- "rotate": Angle;
621
+ rotate: Angle;
584
622
  } | {
585
- "skew": [Angle, Angle];
623
+ skew: [Angle, Angle];
586
624
  } | {
587
- "matrix": Affine;
625
+ matrix: Affine;
588
626
  };
589
627
 
590
628
  /**
@@ -651,12 +689,14 @@ type Style = {
651
689
  borderTopRightRadius: CssValue<LengthUnit | null>;
652
690
  borderBottomRightRadius: CssValue<LengthUnit | null>;
653
691
  borderBottomLeftRadius: CssValue<LengthUnit | null>;
654
- borderWidth: CssValue<Sides<LengthUnit>>;
692
+ borderWidth: CssValue<Sides<LengthUnit> | null>;
655
693
  borderTopWidth: CssValue<LengthUnit | null>;
656
694
  borderRightWidth: CssValue<LengthUnit | null>;
657
695
  borderBottomWidth: CssValue<LengthUnit | null>;
658
696
  borderLeftWidth: CssValue<LengthUnit | null>;
697
+ border: CssValue<Border>;
659
698
  objectFit: CssValue<ObjectFit>;
699
+ objectPosition: CssValue<BackgroundPosition>;
660
700
  backgroundImage: CssValue<BackgroundImages | null>;
661
701
  backgroundPosition: CssValue<BackgroundPositions | null>;
662
702
  backgroundSize: CssValue<BackgroundSizes | null>;
@@ -674,7 +714,7 @@ type Style = {
674
714
  textOverflow: CssValue<TextOverflow>;
675
715
  textTransform: CssValue<TextTransform>;
676
716
  fontStyle: CssValue<FontStyle>;
677
- borderColor: CssValue<Color>;
717
+ borderColor: CssValue<Color | null>;
678
718
  color: CssValue<Color>;
679
719
  fontSize: CssValue<LengthUnit>;
680
720
  fontFamily: CssValue<FontFamily | null>;
@@ -688,6 +728,9 @@ type Style = {
688
728
  textStrokeColor: CssValue<Color | null>;
689
729
  textStroke: CssValue<TextStroke | null>;
690
730
  textShadow: CssValue<TextShadows | null>;
731
+ textDecoration: CssValue<TextDecoration>;
732
+ textDecorationLine: CssValue<TextDecorationLines | null>;
733
+ textDecorationColor: CssValue<Color | null>;
691
734
  letterSpacing: CssValue<LengthUnit | null>;
692
735
  wordSpacing: CssValue<LengthUnit | null>;
693
736
  imageRendering: CssValue<ImageScalingAlgorithm>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takumi-rs/helpers",
3
- "version": "0.30.1",
3
+ "version": "0.31.0",
4
4
  "author": {
5
5
  "email": "me@kane.tw",
6
6
  "name": "Kane Wang",