@takumi-rs/helpers 0.39.0 → 0.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var p=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of a(t))!c.call(e,r)&&r!==n&&i(e,r,{get:()=>t[r],enumerable:!(o=m(t,r))||o.enumerable});return e};var y=e=>d(i({},"__esModule",{value:!0}),e);var P={};p(P,{container:()=>f,em:()=>C,fr:()=>h,image:()=>x,percentage:()=>b,rem:()=>S,rgba:()=>I,style:()=>N,text:()=>l,vh:()=>s,vw:()=>g});module.exports=y(P);function u(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function f(e){let t={type:"container",children:e.children};return u(t,e.style),t}function l(e,t){let n={type:"text",text:e};return u(n,t),n}function x(e){let t={type:"image",src:e.src};return u(t,e.style),t}function N(e){return e}function b(e){return{percentage:e}}function g(e){return{vw:e}}function s(e){return{vh:e}}function C(e){return{em:e}}function S(e){return{rem:e}}function h(e){return{fr:e}}function I(e,t,n,o=1){return[e,t,n,o]}0&&(module.exports={container,em,fr,image,percentage,rem,rgba,style,text,vh,vw});
1
+ "use strict";var u=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var c=(e,t)=>{for(var n in t)u(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of p(t))!a.call(e,r)&&r!==n&&u(e,r,{get:()=>t[r],enumerable:!(o=m(t,r))||o.enumerable});return e};var y=e=>d(u({},"__esModule",{value:!0}),e);var P={};c(P,{container:()=>f,em:()=>C,fr:()=>S,image:()=>x,percentage:()=>b,rem:()=>I,rgba:()=>h,style:()=>N,text:()=>l,vh:()=>s,vw:()=>g});module.exports=y(P);function i(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function f(e){let t={type:"container",children:e.children};return i(t,e.style),t}function l(e,t){let n={type:"text",text:e};return i(n,t),n}function x(e){let t={type:"image",src:e.src};return i(t,e.style),t}function N(e){return e}function b(e){return{percentage:e}}function g(e){return{vw:e}}function s(e){return{vh:e}}function C(e){return{em:e}}function I(e){return{rem:e}}function S(e){return{fr:e}}function h(e,t,n,o=1){return[e,t,n,o]}0&&(module.exports={container,em,fr,image,percentage,rem,rgba,style,text,vh,vw});
package/dist/index.d.cts CHANGED
@@ -1,10 +1,5 @@
1
- import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style } from './types-B5O1rXrN.cjs';
2
- export { A as AnyNode, J as JsonValue, N as Node } from './types-B5O1rXrN.cjs';
3
-
4
- /**
5
- * Represents a color with 8-bit RGBA components.
6
- */
7
- type Color = [number, number, number] | [number, number, number, number] | number | string;
1
+ import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as ColorInput } from './types-RqXjP68o.cjs';
2
+ export { A as AnyNode, J as JsonValue, N as Node } from './types-RqXjP68o.cjs';
8
3
 
9
4
  declare function container(props: Omit<ContainerNode, "type">): ContainerNode;
10
5
  declare function text(text: string, style?: PartialStyle): TextNode;
@@ -33,6 +28,6 @@ declare function rem(rem: number): {
33
28
  declare function fr(fr: number): {
34
29
  fr: number;
35
30
  };
36
- declare function rgba(r: number, g: number, b: number, a?: number): Color;
31
+ declare function rgba(r: number, g: number, b: number, a?: number): ColorInput;
37
32
 
38
33
  export { ContainerNode, ImageNode, PartialStyle, TextNode, container, em, fr, image, percentage, rem, rgba, style, text, vh, vw };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,5 @@
1
- import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style } from './types-B5O1rXrN.js';
2
- export { A as AnyNode, J as JsonValue, N as Node } from './types-B5O1rXrN.js';
3
-
4
- /**
5
- * Represents a color with 8-bit RGBA components.
6
- */
7
- type Color = [number, number, number] | [number, number, number, number] | number | string;
1
+ import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as ColorInput } from './types-RqXjP68o.js';
2
+ export { A as AnyNode, J as JsonValue, N as Node } from './types-RqXjP68o.js';
8
3
 
9
4
  declare function container(props: Omit<ContainerNode, "type">): ContainerNode;
10
5
  declare function text(text: string, style?: PartialStyle): TextNode;
@@ -33,6 +28,6 @@ declare function rem(rem: number): {
33
28
  declare function fr(fr: number): {
34
29
  fr: number;
35
30
  };
36
- declare function rgba(r: number, g: number, b: number, a?: number): Color;
31
+ declare function rgba(r: number, g: number, b: number, a?: number): ColorInput;
37
32
 
38
33
  export { ContainerNode, ImageNode, PartialStyle, TextNode, container, em, fr, image, percentage, rem, rgba, style, text, vh, vw };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- function r(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function i(e){let t={type:"container",children:e.children};return r(t,e.style),t}function u(e,t){let n={type:"text",text:e};return r(n,t),n}function m(e){let t={type:"image",src:e.src};return r(t,e.style),t}function a(e){return e}function c(e){return{percentage:e}}function p(e){return{vw:e}}function d(e){return{vh:e}}function y(e){return{em:e}}function f(e){return{rem:e}}function l(e){return{fr:e}}function x(e,t,n,o=1){return[e,t,n,o]}export{i as container,y as em,l as fr,m as image,c as percentage,f as rem,x as rgba,a as style,u as text,d as vh,p as vw};
1
+ function r(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function u(e){let t={type:"container",children:e.children};return r(t,e.style),t}function i(e,t){let n={type:"text",text:e};return r(n,t),n}function m(e){let t={type:"image",src:e.src};return r(t,e.style),t}function p(e){return e}function a(e){return{percentage:e}}function c(e){return{vw:e}}function d(e){return{vh:e}}function y(e){return{em:e}}function f(e){return{rem:e}}function l(e){return{fr:e}}function x(e,t,n,o=1){return[e,t,n,o]}export{u as container,y as em,l as fr,m as image,a as percentage,f as rem,x as rgba,p as style,i as text,d as vh,c as vw};
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 $=(e,t)=>{for(var r in t)f(e,r,{get:t[r],enumerable:!0})},W=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of A(t))!O.call(e,o)&&o!==r&&f(e,o,{get:()=>t[o],enumerable:!(n=L(t,o))||n.enumerable});return e};var z=e=>W(f({},"__esModule",{value:!0}),e);var G={};$(G,{fromJsx:()=>J});module.exports=z(G);function m(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function l(e){let t={type:"container",children:e.children};return m(t,e.style),t}function u(e,t){let r={type:"text",text:e};return m(r,t),r}function y(e){let t={type:"image",src:e.src};return m(t,e.style),t}function g(e){return{percentage:e}}var c={p:{marginTop:"1em",marginBottom:"1em",display:"block"},blockquote:{marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40,display:"block"},center:{textAlign:"center",display:"inline"},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",display:"block"},h2:{fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h3:{fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h4:{marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h5:{fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h6:{fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},u:{textDecoration:"underline",display:"inline"},strong:{fontWeight:"bold",display:"inline"},b:{fontWeight:"bold",display:"inline"},i:{fontStyle:"italic",display:"inline"},em:{fontStyle:"italic",display:"inline"},code:{fontFamily:"monospace",display:"inline"},kbd:{fontFamily:"monospace",display:"inline"},pre:{fontFamily:"monospace",marginTop:"1em",marginBottom:"1em",display:"inline"},mark:{backgroundColor:16776960,color:0,display:"inline"},big:{fontSize:"1.2em",display:"inline"},small:{fontSize:"0.8em",display:"inline"},s:{textDecoration:"line-through",display:"inline"},span:{display:"inline"},img:{display:"inline"},svg:{display:"inline"}};function d(e,t){return e.type===t&&"props"in e}function b(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(e){return typeof e=="object"&&e!==null&&"type"in e}function s(e){return typeof e=="function"}var F=Symbol.for("react.forward_ref"),j=Symbol.for("react.memo"),I=Symbol.for("react.fragment");function S(e){return e.$$typeof===F}function E(e){return e.$$typeof===j}function R(e){return e.type===I}function B(e){return typeof e=="string"||typeof e=="number"}function P(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function M(e){return Object.keys(e).map(t=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(e[t]).trim()}`).join(";")}var _=["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(e,t){if(e==="children"||t==null)return;let r;if(e==="className"?r="class":_.includes(e)?r=b(e):r=e,typeof t=="boolean")return`${r}="${String(t)}"`;if(e==="style"&&typeof t=="object"){let n=M(t);if(n)return`style="${P(n)}"`}return`${r}="${P(String(t))}"`}function X(e){return Object.entries(e).map(([t,r])=>H(t,r)).filter(t=>t!==void 0)}var D=(e,t)=>{let r=e.props||{};if(s(e.type))return p(e.type(e.props));if(typeof e.type=="symbol"||typeof e.type!="string")return"";let n=X(r),o=r.children,k=Array.isArray(o)?o.map(v=>t(v)).join(""):t(o);return`<${e.type}${n.length>0?` ${n.join(" ")}`:""}>${k}</${e.type}>`},p=e=>e==null||e===!1?"":B(e)?String(e):Array.isArray(e)?e.map(p).join(""):i(e)?D(e,p):"";function x(e){let t=e.props||{};if(!("xmlns"in t)){let r={...e,props:{...t,xmlns:"http://www.w3.org/2000/svg"}};return p(r)||""}return p(e)||""}async function J(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||e===!1)return[];if(e instanceof Promise)return a(await e);if(typeof e=="object"&&Symbol.iterator in e)return Z(e);if(i(e)){let t=await N(e);return Array.isArray(t)?t:t?[t]:[]}return[u(String(e),c.span)]}function V(e){if(!(typeof e.type!="object"||e.type===null)){if(S(e.type)&&"render"in e.type){let t=e.type;return a(t.render(e.props,null))}if(E(e.type)&&"type"in e.type){let r=e.type.type;if(s(r))return a(r(e.props));let n={...e,type:r};return N(n)}}}function C(e){if(!i(e))return Promise.resolve(void 0);let t=typeof e.props=="object"&&e.props!==null&&"children"in e.props?e.props.children:void 0;return typeof t=="string"?Promise.resolve(t):typeof t=="number"?Promise.resolve(String(t)):Array.isArray(t)?Promise.resolve(T(t)):typeof t=="object"&&t!==null&&Symbol.iterator in t?Promise.resolve(T(Array.from(t))):i(t)&&R(t)?C(t):Promise.resolve(void 0)}function T(e){if(!e.some(t=>i(t)))return e.map(t=>typeof t=="string"?t:typeof t=="number"?String(t):"").join("")}async function N(e){if(s(e.type))return a(e.type(e.props));let t=V(e);if(t!==void 0)return t;if(R(e))return await w(e)||[];if(d(e,"img"))return[Y(e)];if(d(e,"svg"))return[K(e)];let r=h(e),n=await C(e);if(n!==void 0)return[u(n,r)];let o=await w(e);return[l({children:o,style:r})]}function Y(e){if(!e.props.src)throw new Error("Image element must have a 'src' prop.");let t=h(e);return y({src:e.props.src,style:t})}function K(e){let t=h(e),r=x(e);return y({style:t,src:r})}var q={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function h(e){let t={};typeof e.type=="string"&&e.type in c&&Object.assign(t,c[e.type]);let r=typeof e.props=="object"&&e.props!==null&&"style"in e.props&&typeof e.props.style=="object"&&e.props.style!==null?e.props.style:void 0;if(r&&Object.keys(r).length>0){for(let[n,o]of Object.entries(q))n in r&&(t[o]=r[n],delete r[n]);Object.assign(t,r)}return t}function w(e){return typeof e.props!="object"||e.props===null||!("children"in e.props)?Promise.resolve([]):a(e.props.children)}function Z(e){return Promise.all(Array.from(e).map(a)).then(t=>t.flat())}0&&(module.exports={fromJsx});
1
+ "use strict";var f=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var r in t)f(e,r,{get:t[r],enumerable:!0})},I=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of A(t))!O.call(e,o)&&o!==r&&f(e,o,{get:()=>t[o],enumerable:!(n=L(t,o))||n.enumerable});return e};var W=e=>I(f({},"__esModule",{value:!0}),e);var G={};$(G,{fromJsx:()=>J});module.exports=W(G);function m(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function l(e){let t={type:"container",children:e.children};return m(t,e.style),t}function u(e,t){let r={type:"text",text:e};return m(r,t),r}function y(e){let t={type:"image",src:e.src};return m(t,e.style),t}function g(e){return{percentage:e}}var c={p:{marginTop:"1em",marginBottom:"1em",display:"block"},blockquote:{marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40,display:"block"},center:{textAlign:"center",display:"inline"},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",display:"block"},h2:{fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h3:{fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h4:{marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h5:{fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h6:{fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},u:{textDecoration:"underline",display:"inline"},strong:{fontWeight:"bold",display:"inline"},b:{fontWeight:"bold",display:"inline"},i:{fontStyle:"italic",display:"inline"},em:{fontStyle:"italic",display:"inline"},code:{fontFamily:"monospace",display:"inline"},kbd:{fontFamily:"monospace",display:"inline"},pre:{fontFamily:"monospace",marginTop:"1em",marginBottom:"1em",display:"inline"},mark:{backgroundColor:16776960,color:0,display:"inline"},big:{fontSize:"1.2em",display:"inline"},small:{fontSize:"0.8em",display:"inline"},s:{textDecoration:"line-through",display:"inline"},span:{display:"inline"},img:{display:"inline"},svg:{display:"inline"}};function d(e,t){return e.type===t&&"props"in e}function b(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(e){return typeof e=="object"&&e!==null&&"type"in e}function s(e){return typeof e=="function"}var z=Symbol.for("react.forward_ref"),F=Symbol.for("react.memo"),j=Symbol.for("react.fragment");function S(e){return e.$$typeof===z}function E(e){return e.$$typeof===F}function R(e){return e.type===j}function B(e){return typeof e=="string"||typeof e=="number"}function P(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function M(e){return Object.keys(e).map(t=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(e[t]).trim()}`).join(";")}var _=["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(e,t){if(e==="children"||t==null)return;let r;if(e==="className"?r="class":_.includes(e)?r=b(e):r=e,typeof t=="boolean")return`${r}="${String(t)}"`;if(e==="style"&&typeof t=="object"){let n=M(t);if(n)return`style="${P(n)}"`}return`${r}="${P(String(t))}"`}function X(e){return Object.entries(e).map(([t,r])=>H(t,r)).filter(t=>t!==void 0)}var D=(e,t)=>{let r=e.props||{};if(s(e.type))return p(e.type(e.props));if(typeof e.type=="symbol"||typeof e.type!="string")return"";let n=X(r),o=r.children,k=Array.isArray(o)?o.map(v=>t(v)).join(""):t(o);return`<${e.type}${n.length>0?` ${n.join(" ")}`:""}>${k}</${e.type}>`},p=e=>e==null||e===!1?"":B(e)?String(e):Array.isArray(e)?e.map(p).join(""):i(e)?D(e,p):"";function x(e){let t=e.props||{};if(!("xmlns"in t)){let r={...e,props:{...t,xmlns:"http://www.w3.org/2000/svg"}};return p(r)||""}return p(e)||""}async function J(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||e===!1)return[];if(e instanceof Promise)return a(await e);if(typeof e=="object"&&Symbol.iterator in e)return Z(e);if(i(e)){let t=await N(e);return Array.isArray(t)?t:t?[t]:[]}return[u(String(e),c.span)]}function V(e){if(!(typeof e.type!="object"||e.type===null)){if(S(e.type)&&"render"in e.type){let t=e.type;return a(t.render(e.props,null))}if(E(e.type)&&"type"in e.type){let r=e.type.type;if(s(r))return a(r(e.props));let n={...e,type:r};return N(n)}}}function C(e){if(!i(e))return Promise.resolve(void 0);let t=typeof e.props=="object"&&e.props!==null&&"children"in e.props?e.props.children:void 0;return typeof t=="string"?Promise.resolve(t):typeof t=="number"?Promise.resolve(String(t)):Array.isArray(t)?Promise.resolve(T(t)):typeof t=="object"&&t!==null&&Symbol.iterator in t?Promise.resolve(T(Array.from(t))):i(t)&&R(t)?C(t):Promise.resolve(void 0)}function T(e){if(!e.some(t=>i(t)))return e.map(t=>typeof t=="string"?t:typeof t=="number"?String(t):"").join("")}async function N(e){if(s(e.type))return a(e.type(e.props));let t=V(e);if(t!==void 0)return t;if(R(e))return await w(e)||[];if(d(e,"img"))return[Y(e)];if(d(e,"svg"))return[K(e)];let r=h(e),n=await C(e);if(n!==void 0)return[u(n,r)];let o=await w(e);return[l({children:o,style:r})]}function Y(e){if(!e.props.src)throw new Error("Image element must have a 'src' prop.");let t=h(e);return y({src:e.props.src,style:t})}function K(e){let t=h(e),r=x(e);return y({style:t,src:r})}var q={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function h(e){let t={};typeof e.type=="string"&&e.type in c&&Object.assign(t,c[e.type]);let r=typeof e.props=="object"&&e.props!==null&&"style"in e.props&&typeof e.props.style=="object"&&e.props.style!==null?e.props.style:void 0;if(r&&Object.keys(r).length>0){for(let[n,o]of Object.entries(q))n in r&&(t[o]=r[n],delete r[n]);Object.assign(t,r)}return t}function w(e){return typeof e.props!="object"||e.props===null||!("children"in e.props)?Promise.resolve([]):a(e.props.children)}function Z(e){return Promise.all(Array.from(e).map(a)).then(t=>t.flat())}0&&(module.exports={fromJsx});
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { N as Node } from '../types-B5O1rXrN.cjs';
2
+ import { N as Node } from '../types-RqXjP68o.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-B5O1rXrN.js';
2
+ import { N as Node } from '../types-RqXjP68o.js';
3
3
 
4
4
  type ReactElementLike = {
5
5
  type: string | symbol | ((props: unknown) => ReactElementLike) | ReactElementLike;
package/dist/jsx/jsx.js CHANGED
@@ -1 +1 @@
1
- function f(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function l(e){let t={type:"container",children:e.children};return f(t,e.style),t}function m(e,t){let r={type:"text",text:e};return f(r,t),r}function u(e){let t={type:"image",src:e.src};return f(t,e.style),t}function y(e){return{percentage:e}}var c={p:{marginTop:"1em",marginBottom:"1em",display:"block"},blockquote:{marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40,display:"block"},center:{textAlign:"center",display:"inline"},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",display:"block"},h2:{fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h3:{fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h4:{marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h5:{fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h6:{fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},u:{textDecoration:"underline",display:"inline"},strong:{fontWeight:"bold",display:"inline"},b:{fontWeight:"bold",display:"inline"},i:{fontStyle:"italic",display:"inline"},em:{fontStyle:"italic",display:"inline"},code:{fontFamily:"monospace",display:"inline"},kbd:{fontFamily:"monospace",display:"inline"},pre:{fontFamily:"monospace",marginTop:"1em",marginBottom:"1em",display:"inline"},mark:{backgroundColor:16776960,color:0,display:"inline"},big:{fontSize:"1.2em",display:"inline"},small:{fontSize:"0.8em",display:"inline"},s:{textDecoration:"line-through",display:"inline"},span:{display:"inline"},img:{display:"inline"},svg:{display:"inline"}};function g(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 s(e){return typeof e=="function"}var v=Symbol.for("react.forward_ref"),L=Symbol.for("react.memo"),A=Symbol.for("react.fragment");function b(e){return e.$$typeof===v}function S(e){return e.$$typeof===L}function d(e){return e.type===A}function O(e){return typeof e=="string"||typeof e=="number"}function E(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $(e){return Object.keys(e).map(t=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(e[t]).trim()}`).join(";")}var W=["stopColor","stopOpacity","strokeWidth","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","fillRule","clipRule","colorInterpolationFilters","floodColor","floodOpacity","accentHeight","alignmentBaseline","arabicForm","baselineShift","capHeight","clipPath","clipPathUnits","colorInterpolation","colorProfile","colorRendering","enableBackground","fillOpacity","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","horizAdvX","horizOriginX","imageRendering","letterSpacing","lightingColor","markerEnd","markerMid","markerStart","overlinePosition","overlineThickness","paintOrder","preserveAspectRatio","pointerEvents","shapeRendering","strokeMiterlimit","strokeOpacity","textAnchor","textDecoration","textRendering","transformOrigin","underlinePosition","underlineThickness","unicodeBidi","unicodeRange","unitsPerEm","vectorEffect","vertAdvY","vertOriginX","vertOriginY","vAlphabetic","vHanging","vIdeographic","vMathematical","wordSpacing","writingMode"];function z(e,t){if(e==="children"||t==null)return;let r;if(e==="className"?r="class":W.includes(e)?r=k(e):r=e,typeof t=="boolean")return`${r}="${String(t)}"`;if(e==="style"&&typeof t=="object"){let n=$(t);if(n)return`style="${E(n)}"`}return`${r}="${E(String(t))}"`}function F(e){return Object.entries(e).map(([t,r])=>z(t,r)).filter(t=>t!==void 0)}var j=(e,t)=>{let r=e.props||{};if(s(e.type))return p(e.type(e.props));if(typeof e.type=="symbol"||typeof e.type!="string")return"";let n=F(r),o=r.children,h=Array.isArray(o)?o.map(N=>t(N)).join(""):t(o);return`<${e.type}${n.length>0?` ${n.join(" ")}`:""}>${h}</${e.type}>`},p=e=>e==null||e===!1?"":O(e)?String(e):Array.isArray(e)?e.map(p).join(""):i(e)?j(e,p):"";function P(e){let t=e.props||{};if(!("xmlns"in t)){let r={...e,props:{...t,xmlns:"http://www.w3.org/2000/svg"}};return p(r)||""}return p(e)||""}async function U(e){let t=await a(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 a(e){if(e==null||e===!1)return[];if(e instanceof Promise)return a(await e);if(typeof e=="object"&&Symbol.iterator in e)return H(e);if(i(e)){let t=await C(e);return Array.isArray(t)?t:t?[t]:[]}return[m(String(e),c.span)]}function I(e){if(!(typeof e.type!="object"||e.type===null)){if(b(e.type)&&"render"in e.type){let t=e.type;return a(t.render(e.props,null))}if(S(e.type)&&"type"in e.type){let r=e.type.type;if(s(r))return a(r(e.props));let n={...e,type:r};return C(n)}}}function w(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(x(t)):typeof t=="object"&&t!==null&&Symbol.iterator in t?Promise.resolve(x(Array.from(t))):i(t)&&d(t)?w(t):Promise.resolve(void 0)}function x(e){if(!e.some(t=>i(t)))return e.map(t=>typeof t=="string"?t:typeof t=="number"?String(t):"").join("")}async function C(e){if(s(e.type))return a(e.type(e.props));let t=I(e);if(t!==void 0)return t;if(d(e))return await T(e)||[];if(g(e,"img"))return[B(e)];if(g(e,"svg"))return[M(e)];let r=R(e),n=await w(e);if(n!==void 0)return[m(n,r)];let o=await T(e);return[l({children:o,style:r})]}function B(e){if(!e.props.src)throw new Error("Image element must have a 'src' prop.");let t=R(e);return u({src:e.props.src,style:t})}function M(e){let t=R(e),r=P(e);return u({style:t,src:r})}var _={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function R(e){let t={};typeof e.type=="string"&&e.type in c&&Object.assign(t,c[e.type]);let r=typeof e.props=="object"&&e.props!==null&&"style"in e.props&&typeof e.props.style=="object"&&e.props.style!==null?e.props.style:void 0;if(r&&Object.keys(r).length>0){for(let[n,o]of Object.entries(_))n in r&&(t[o]=r[n],delete r[n]);Object.assign(t,r)}return t}function T(e){return typeof e.props!="object"||e.props===null||!("children"in e.props)?Promise.resolve([]):a(e.props.children)}function H(e){return Promise.all(Array.from(e).map(a)).then(t=>t.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 m(e,t){let r={type:"text",text:e};return f(r,t),r}function u(e){let t={type:"image",src:e.src};return f(t,e.style),t}function y(e){return{percentage:e}}var c={p:{marginTop:"1em",marginBottom:"1em",display:"block"},blockquote:{marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40,display:"block"},center:{textAlign:"center",display:"inline"},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",display:"block"},h2:{fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h3:{fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h4:{marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h5:{fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},h6:{fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold",display:"block"},u:{textDecoration:"underline",display:"inline"},strong:{fontWeight:"bold",display:"inline"},b:{fontWeight:"bold",display:"inline"},i:{fontStyle:"italic",display:"inline"},em:{fontStyle:"italic",display:"inline"},code:{fontFamily:"monospace",display:"inline"},kbd:{fontFamily:"monospace",display:"inline"},pre:{fontFamily:"monospace",marginTop:"1em",marginBottom:"1em",display:"inline"},mark:{backgroundColor:16776960,color:0,display:"inline"},big:{fontSize:"1.2em",display:"inline"},small:{fontSize:"0.8em",display:"inline"},s:{textDecoration:"line-through",display:"inline"},span:{display:"inline"},img:{display:"inline"},svg:{display:"inline"}};function g(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 s(e){return typeof e=="function"}var v=Symbol.for("react.forward_ref"),L=Symbol.for("react.memo"),A=Symbol.for("react.fragment");function b(e){return e.$$typeof===v}function S(e){return e.$$typeof===L}function d(e){return e.type===A}function O(e){return typeof e=="string"||typeof e=="number"}function E(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $(e){return Object.keys(e).map(t=>`${t.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(e[t]).trim()}`).join(";")}var 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 n=$(t);if(n)return`style="${E(n)}"`}return`${r}="${E(String(t))}"`}function z(e){return Object.entries(e).map(([t,r])=>W(t,r)).filter(t=>t!==void 0)}var F=(e,t)=>{let r=e.props||{};if(s(e.type))return p(e.type(e.props));if(typeof e.type=="symbol"||typeof e.type!="string")return"";let n=z(r),o=r.children,h=Array.isArray(o)?o.map(N=>t(N)).join(""):t(o);return`<${e.type}${n.length>0?` ${n.join(" ")}`:""}>${h}</${e.type}>`},p=e=>e==null||e===!1?"":O(e)?String(e):Array.isArray(e)?e.map(p).join(""):i(e)?F(e,p):"";function P(e){let t=e.props||{};if(!("xmlns"in t)){let r={...e,props:{...t,xmlns:"http://www.w3.org/2000/svg"}};return p(r)||""}return p(e)||""}async function U(e){let t=await a(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 a(e){if(e==null||e===!1)return[];if(e instanceof Promise)return a(await e);if(typeof e=="object"&&Symbol.iterator in e)return H(e);if(i(e)){let t=await C(e);return Array.isArray(t)?t:t?[t]:[]}return[m(String(e),c.span)]}function j(e){if(!(typeof e.type!="object"||e.type===null)){if(b(e.type)&&"render"in e.type){let t=e.type;return a(t.render(e.props,null))}if(S(e.type)&&"type"in e.type){let r=e.type.type;if(s(r))return a(r(e.props));let n={...e,type:r};return C(n)}}}function w(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(x(t)):typeof t=="object"&&t!==null&&Symbol.iterator in t?Promise.resolve(x(Array.from(t))):i(t)&&d(t)?w(t):Promise.resolve(void 0)}function x(e){if(!e.some(t=>i(t)))return e.map(t=>typeof t=="string"?t:typeof t=="number"?String(t):"").join("")}async function C(e){if(s(e.type))return a(e.type(e.props));let t=j(e);if(t!==void 0)return t;if(d(e))return await T(e)||[];if(g(e,"img"))return[B(e)];if(g(e,"svg"))return[M(e)];let r=R(e),n=await w(e);if(n!==void 0)return[m(n,r)];let o=await T(e);return[l({children:o,style:r})]}function B(e){if(!e.props.src)throw new Error("Image element must have a 'src' prop.");let t=R(e);return u({src:e.props.src,style:t})}function M(e){let t=R(e),r=P(e);return u({style:t,src:r})}var _={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function R(e){let t={};typeof e.type=="string"&&e.type in c&&Object.assign(t,c[e.type]);let r=typeof e.props=="object"&&e.props!==null&&"style"in e.props&&typeof e.props.style=="object"&&e.props.style!==null?e.props.style:void 0;if(r&&Object.keys(r).length>0){for(let[n,o]of Object.entries(_))n in r&&(t[o]=r[n],delete r[n]);Object.assign(t,r)}return t}function T(e){return typeof e.props!="object"||e.props===null||!("children"in e.props)?Promise.resolve([]):a(e.props.children)}function H(e){return Promise.all(Array.from(e).map(a)).then(t=>t.flat())}export{U as fromJsx};
@@ -235,6 +235,143 @@ type BackgroundSize = "Cover" | "Contain" | {
235
235
  */
236
236
  type BackgroundSizes = Array<BackgroundSize> | string;
237
237
 
238
+ /**
239
+ * Represents a position for circle() and ellipse() functions.
240
+ */
241
+ type ShapePosition = {
242
+ /**
243
+ * X-axis position component
244
+ */
245
+ x: LengthUnit;
246
+ /**
247
+ * Y-axis position component
248
+ */
249
+ y: LengthUnit;
250
+ };
251
+
252
+ /**
253
+ * Represents radius values for circle() and ellipse() functions.
254
+ */
255
+ type ShapeRadius = "closest-side" | "farthest-side" | LengthUnit;
256
+
257
+ /**
258
+ * Represents a circle() shape.
259
+ */
260
+ type CircleShape = {
261
+ /**
262
+ * The radius of the circle
263
+ */
264
+ radius: ShapeRadius;
265
+ /**
266
+ * The center position of the circle
267
+ */
268
+ position: ShapePosition;
269
+ };
270
+
271
+ /**
272
+ * Represents an ellipse() shape.
273
+ */
274
+ type EllipseShape = {
275
+ /**
276
+ * The horizontal radius
277
+ */
278
+ radiusX: ShapeRadius;
279
+ /**
280
+ * The vertical radius
281
+ */
282
+ radiusY: ShapeRadius;
283
+ /**
284
+ * The center position of the ellipse
285
+ */
286
+ position: ShapePosition;
287
+ };
288
+
289
+ /**
290
+ * Represents the values for the four sides of a box (top, right, bottom, left).
291
+ */
292
+ type Sides<T> = string | [T, T, T, T] | [T, T] | T;
293
+
294
+ /**
295
+ * Represents an inset() rectangle shape.
296
+ *
297
+ * The inset() function creates an inset rectangle, with its size defined by the offset distance
298
+ * of each of the four sides of its container and, optionally, rounded corners.
299
+ */
300
+ type InsetShape = {
301
+ /**
302
+ * Sides of the inset.
303
+ */
304
+ inset: Sides<LengthUnit>;
305
+ /**
306
+ * Optional border radius for rounded corners
307
+ */
308
+ borderRadius: Sides<LengthUnit> | null;
309
+ };
310
+
311
+ /**
312
+ * Represents the fill rule used for determining the interior of shapes.
313
+ *
314
+ * Corresponds to the SVG fill-rule attribute and is used in polygon(), path(), and shape() functions.
315
+ */
316
+ type FillRule = "non-zero" | "even-odd";
317
+
318
+ /**
319
+ * Represents a path() shape using an SVG path string.
320
+ */
321
+ type PathShape = {
322
+ /**
323
+ * The fill rule to use
324
+ */
325
+ fillRule: FillRule | null;
326
+ /**
327
+ * SVG path data string
328
+ */
329
+ path: string;
330
+ };
331
+
332
+ /**
333
+ * Represents a single coordinate pair in a polygon.
334
+ */
335
+ type PolygonCoordinate = {
336
+ /**
337
+ * X coordinate
338
+ */
339
+ x: LengthUnit;
340
+ /**
341
+ * Y coordinate
342
+ */
343
+ y: LengthUnit;
344
+ };
345
+
346
+ /**
347
+ * Represents a polygon() shape.
348
+ */
349
+ type PolygonShape = {
350
+ /**
351
+ * The fill rule to use
352
+ */
353
+ fillRule: FillRule | null;
354
+ /**
355
+ * List of coordinate pairs defining the polygon vertices
356
+ */
357
+ coordinates: Array<PolygonCoordinate>;
358
+ };
359
+
360
+ /**
361
+ * Represents a basic shape function for clip-path.
362
+ */
363
+ type BasicShape = ({
364
+ type: "inset";
365
+ } & InsetShape) | ({
366
+ type: "circle";
367
+ } & CircleShape) | ({
368
+ type: "ellipse";
369
+ } & EllipseShape) | ({
370
+ type: "polygon";
371
+ } & PolygonShape) | ({
372
+ type: "path";
373
+ } & PathShape) | string;
374
+
238
375
  /**
239
376
  * Represents border style options (currently only solid is supported).
240
377
  */
@@ -605,11 +742,6 @@ type Scale = {
605
742
  y: number;
606
743
  } | string;
607
744
 
608
- /**
609
- * Represents the values for the four sides of a box (top, right, bottom, left).
610
- */
611
- type Sides<T> = string | [T, T, T, T] | [T, T] | T;
612
-
613
745
  /**
614
746
  * Text alignment options for text rendering.
615
747
  *
@@ -863,6 +995,8 @@ type Style = {
863
995
  imageRendering: CssValue<ImageScalingAlgorithm>;
864
996
  overflowWrap: CssValue<OverflowWrap>;
865
997
  wordBreak: CssValue<WordBreak>;
998
+ clipPath: CssValue<CssOption<BasicShape>>;
999
+ clipRule: CssValue<FillRule>;
866
1000
  };
867
1001
 
868
1002
  type JsonValue = string | number | boolean | null | JsonValue[] | {
@@ -892,4 +1026,4 @@ type ImageNode = {
892
1026
  style?: PartialStyle;
893
1027
  };
894
1028
 
895
- export type { AnyNode as A, ContainerNode as C, ImageNode as I, JsonValue as J, Node as N, PartialStyle as P, Style as S, TextNode as T };
1029
+ export type { AnyNode as A, ContainerNode as C, ImageNode as I, JsonValue as J, Node as N, PartialStyle as P, Style as S, TextNode as T, ColorInput as a };
@@ -235,6 +235,143 @@ type BackgroundSize = "Cover" | "Contain" | {
235
235
  */
236
236
  type BackgroundSizes = Array<BackgroundSize> | string;
237
237
 
238
+ /**
239
+ * Represents a position for circle() and ellipse() functions.
240
+ */
241
+ type ShapePosition = {
242
+ /**
243
+ * X-axis position component
244
+ */
245
+ x: LengthUnit;
246
+ /**
247
+ * Y-axis position component
248
+ */
249
+ y: LengthUnit;
250
+ };
251
+
252
+ /**
253
+ * Represents radius values for circle() and ellipse() functions.
254
+ */
255
+ type ShapeRadius = "closest-side" | "farthest-side" | LengthUnit;
256
+
257
+ /**
258
+ * Represents a circle() shape.
259
+ */
260
+ type CircleShape = {
261
+ /**
262
+ * The radius of the circle
263
+ */
264
+ radius: ShapeRadius;
265
+ /**
266
+ * The center position of the circle
267
+ */
268
+ position: ShapePosition;
269
+ };
270
+
271
+ /**
272
+ * Represents an ellipse() shape.
273
+ */
274
+ type EllipseShape = {
275
+ /**
276
+ * The horizontal radius
277
+ */
278
+ radiusX: ShapeRadius;
279
+ /**
280
+ * The vertical radius
281
+ */
282
+ radiusY: ShapeRadius;
283
+ /**
284
+ * The center position of the ellipse
285
+ */
286
+ position: ShapePosition;
287
+ };
288
+
289
+ /**
290
+ * Represents the values for the four sides of a box (top, right, bottom, left).
291
+ */
292
+ type Sides<T> = string | [T, T, T, T] | [T, T] | T;
293
+
294
+ /**
295
+ * Represents an inset() rectangle shape.
296
+ *
297
+ * The inset() function creates an inset rectangle, with its size defined by the offset distance
298
+ * of each of the four sides of its container and, optionally, rounded corners.
299
+ */
300
+ type InsetShape = {
301
+ /**
302
+ * Sides of the inset.
303
+ */
304
+ inset: Sides<LengthUnit>;
305
+ /**
306
+ * Optional border radius for rounded corners
307
+ */
308
+ borderRadius: Sides<LengthUnit> | null;
309
+ };
310
+
311
+ /**
312
+ * Represents the fill rule used for determining the interior of shapes.
313
+ *
314
+ * Corresponds to the SVG fill-rule attribute and is used in polygon(), path(), and shape() functions.
315
+ */
316
+ type FillRule = "non-zero" | "even-odd";
317
+
318
+ /**
319
+ * Represents a path() shape using an SVG path string.
320
+ */
321
+ type PathShape = {
322
+ /**
323
+ * The fill rule to use
324
+ */
325
+ fillRule: FillRule | null;
326
+ /**
327
+ * SVG path data string
328
+ */
329
+ path: string;
330
+ };
331
+
332
+ /**
333
+ * Represents a single coordinate pair in a polygon.
334
+ */
335
+ type PolygonCoordinate = {
336
+ /**
337
+ * X coordinate
338
+ */
339
+ x: LengthUnit;
340
+ /**
341
+ * Y coordinate
342
+ */
343
+ y: LengthUnit;
344
+ };
345
+
346
+ /**
347
+ * Represents a polygon() shape.
348
+ */
349
+ type PolygonShape = {
350
+ /**
351
+ * The fill rule to use
352
+ */
353
+ fillRule: FillRule | null;
354
+ /**
355
+ * List of coordinate pairs defining the polygon vertices
356
+ */
357
+ coordinates: Array<PolygonCoordinate>;
358
+ };
359
+
360
+ /**
361
+ * Represents a basic shape function for clip-path.
362
+ */
363
+ type BasicShape = ({
364
+ type: "inset";
365
+ } & InsetShape) | ({
366
+ type: "circle";
367
+ } & CircleShape) | ({
368
+ type: "ellipse";
369
+ } & EllipseShape) | ({
370
+ type: "polygon";
371
+ } & PolygonShape) | ({
372
+ type: "path";
373
+ } & PathShape) | string;
374
+
238
375
  /**
239
376
  * Represents border style options (currently only solid is supported).
240
377
  */
@@ -605,11 +742,6 @@ type Scale = {
605
742
  y: number;
606
743
  } | string;
607
744
 
608
- /**
609
- * Represents the values for the four sides of a box (top, right, bottom, left).
610
- */
611
- type Sides<T> = string | [T, T, T, T] | [T, T] | T;
612
-
613
745
  /**
614
746
  * Text alignment options for text rendering.
615
747
  *
@@ -863,6 +995,8 @@ type Style = {
863
995
  imageRendering: CssValue<ImageScalingAlgorithm>;
864
996
  overflowWrap: CssValue<OverflowWrap>;
865
997
  wordBreak: CssValue<WordBreak>;
998
+ clipPath: CssValue<CssOption<BasicShape>>;
999
+ clipRule: CssValue<FillRule>;
866
1000
  };
867
1001
 
868
1002
  type JsonValue = string | number | boolean | null | JsonValue[] | {
@@ -892,4 +1026,4 @@ type ImageNode = {
892
1026
  style?: PartialStyle;
893
1027
  };
894
1028
 
895
- export type { AnyNode as A, ContainerNode as C, ImageNode as I, JsonValue as J, Node as N, PartialStyle as P, Style as S, TextNode as T };
1029
+ export type { AnyNode as A, ContainerNode as C, ImageNode as I, JsonValue as J, Node as N, PartialStyle as P, Style as S, TextNode as T, ColorInput as a };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takumi-rs/helpers",
3
- "version": "0.39.0",
3
+ "version": "0.40.1",
4
4
  "author": {
5
5
  "email": "me@kane.tw",
6
6
  "name": "Kane Wang",
@@ -14,7 +14,7 @@
14
14
  "@types/react": "^19.2.2",
15
15
  "@types/react-dom": "^19.2.2",
16
16
  "bun-plugin-dts": "^0.3.0",
17
- "lucide-react": "^0.547.0",
17
+ "lucide-react": "^0.548.0",
18
18
  "react": "^19.2.0",
19
19
  "react-dom": "^19.2.0",
20
20
  "tsup": "^8.5.0",