@takumi-rs/helpers 0.44.0 → 0.45.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.cjs +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/jsx/jsx.cjs +2 -2
- package/dist/jsx/jsx.d.cts +7 -10
- package/dist/jsx/jsx.d.ts +7 -10
- package/dist/jsx/jsx.js +2 -2
- package/dist/{types-D3LLAlez.d.cts → types-BOxuFk68.d.cts} +41 -64
- package/dist/{types-D3LLAlez.d.ts → types-BOxuFk68.d.ts} +41 -64
- package/package.json +2 -11
- package/dist/jsx/create-tailwind-fn.cjs +0 -1
- package/dist/jsx/create-tailwind-fn.d.cts +0 -15
- package/dist/jsx/create-tailwind-fn.d.ts +0 -15
- package/dist/jsx/create-tailwind-fn.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var u=Object.defineProperty;var
|
|
1
|
+
"use strict";var u=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var a=(t,e)=>{for(var n in e)u(t,n,{get:e[n],enumerable:!0})},d=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of m(e))!c.call(t,o)&&o!==n&&u(t,o,{get:()=>e[o],enumerable:!(r=x(e,o))||r.enumerable});return t};var y=t=>d(u({},"__esModule",{value:!0}),t);var w={};a(w,{container:()=>p,em:()=>T,fr:()=>I,image:()=>l,percentage:()=>g,rem:()=>C,rgba:()=>S,style:()=>N,text:()=>f,vh:()=>s,vw:()=>b});module.exports=y(w);function i(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function p(t){let e={type:"container",children:t.children,tw:t.tw};return i(e,t.style),e}function f(t,e){if(typeof t=="string"){let r={type:"text",text:t};return i(r,e),r}let n={type:"text",text:t.text,tw:t.tw};return i(n,e??t.style),n}function l(t){let e={type:"image",src:t.src};return i(e,t.style),e}function N(t){return t}function g(t){return{percentage:t}}function b(t){return{vw:t}}function s(t){return{vh:t}}function T(t){return{em:t}}function C(t){return{rem:t}}function I(t){return{fr:t}}function S(t,e,n,r=1){return[t,e,n,r]}0&&(module.exports={container,em,fr,image,percentage,rem,rgba,style,text,vh,vw});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as ColorInput } from './types-
|
|
2
|
-
export { A as AnyNode, J as JsonValue, N as Node } from './types-
|
|
1
|
+
import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as ColorInput } from './types-BOxuFk68.cjs';
|
|
2
|
+
export { A as AnyNode, J as JsonValue, N as Node } from './types-BOxuFk68.cjs';
|
|
3
3
|
|
|
4
4
|
declare function container(props: Omit<ContainerNode, "type">): ContainerNode;
|
|
5
5
|
declare function text(text: string, style?: PartialStyle): TextNode;
|
|
6
|
+
declare function text(props: Omit<TextNode, "type">): TextNode;
|
|
6
7
|
declare function image(props: Omit<ImageNode, "type">): ImageNode;
|
|
7
8
|
declare function style(style: PartialStyle): Partial<Style>;
|
|
8
9
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as ColorInput } from './types-
|
|
2
|
-
export { A as AnyNode, J as JsonValue, N as Node } from './types-
|
|
1
|
+
import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style, a as ColorInput } from './types-BOxuFk68.js';
|
|
2
|
+
export { A as AnyNode, J as JsonValue, N as Node } from './types-BOxuFk68.js';
|
|
3
3
|
|
|
4
4
|
declare function container(props: Omit<ContainerNode, "type">): ContainerNode;
|
|
5
5
|
declare function text(text: string, style?: PartialStyle): TextNode;
|
|
6
|
+
declare function text(props: Omit<TextNode, "type">): TextNode;
|
|
6
7
|
declare function image(props: Omit<ImageNode, "type">): ImageNode;
|
|
7
8
|
declare function style(style: PartialStyle): Partial<Style>;
|
|
8
9
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function o(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function i(t){let e={type:"container",children:t.children,tw:t.tw};return o(e,t.style),e}function u(t,e){if(typeof t=="string"){let r={type:"text",text:t};return o(r,e),r}let n={type:"text",text:t.text,tw:t.tw};return o(n,e??t.style),n}function x(t){let e={type:"image",src:t.src};return o(e,t.style),e}function m(t){return t}function c(t){return{percentage:t}}function a(t){return{vw:t}}function d(t){return{vh:t}}function y(t){return{em:t}}function p(t){return{rem:t}}function f(t){return{fr:t}}function l(t,e,n,r=1){return[t,e,n,r]}export{i as container,y as em,f as fr,x as image,c as percentage,p as rem,l as rgba,m as style,u as text,d as vh,a as vw};
|
package/dist/jsx/jsx.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`,
|
|
1
|
+
"use strict";var g=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var W=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},j=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of $(e))!I.call(t,o)&&o!==r&&g(t,o,{get:()=>e[o],enumerable:!(n=O(e,o))||n.enumerable});return t};var z=t=>j(g({},"__esModule",{value:!0}),t);var tt={};W(tt,{fromJsx:()=>K});module.exports=z(tt);function l(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function f(t){let e={type:"container",children:t.children,tw:t.tw};return l(e,t.style),e}function m(t,e){if(typeof t=="string"){let n={type:"text",text:t};return l(n,e),n}let r={type:"text",text:t.text,tw:t.tw};return l(r,e??t.style),r}function d(t){let e={type:"image",src:t.src};return l(e,t.style),e}function k(t){return{percentage:t}}var a={body:{margin:8},p:{marginTop:"1em",marginBottom:"1em",display:"block"},blockquote:{marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40,display:"block"},center:{textAlign:"center",display:"block"},hr:{marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"auto",marginRight:"auto",borderWidth:1,display:"block"},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",margin:"1em 0",display:"block"},mark:{backgroundColor:"yellow",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"}};var F=new Set(["head","meta","link","style","script"]);function S(t){return F.has(t.type)}function u(t,e){return t.type===e&&"props"in t}function E(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(t){return typeof t=="object"&&t!==null&&"type"in t}function p(t){return typeof t=="function"}var B=Symbol.for("react.forward_ref"),M=Symbol.for("react.memo"),H=Symbol.for("react.fragment");function P(t){return t.$$typeof===B}function w(t){return t.$$typeof===M}function R(t){return t.type===H}function _(t){return typeof t=="string"||typeof t=="number"}function T(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function D(t){return Object.keys(t).map(e=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(t[e]).trim()}`).join(";")}var V=["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":V.includes(t)?r=E(t):r=t,typeof e=="boolean")return`${r}="${String(e)}"`;if(t==="style"&&typeof e=="object"){let n=D(e);if(n)return`style="${T(n)}"`}return`${r}="${T(String(e))}"`}function J(t){return Object.entries(t).map(([e,r])=>X(e,r)).filter(e=>e!==void 0)}var Y=(t,e)=>{let r=t.props||{};if(p(t.type))return c(t.type(t.props));if(typeof t.type=="symbol"||typeof t.type!="string")return"";let n=J(r),o=r.children,y=Array.isArray(o)?o.map(x=>e(x)).join(""):e(o);return`<${t.type}${n.length>0?` ${n.join(" ")}`:""}>${y}</${t.type}>`},c=t=>t==null||t===!1?"":_(t)?String(t):Array.isArray(t)?t.map(c).join(""):i(t)?Y(t,c):"";function N(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 K(t){let e=await s(t);return e.length===0?f({}):e.length===1&&e[0]!==void 0?e[0]:f({children:e,style:{width:k(100),height:k(100)}})}async function s(t){if(t==null||t===!1)return[];if(t instanceof Promise)return s(await t);if(typeof t=="object"&&Symbol.iterator in t)return Q(t);if(i(t)){let e=await A(t);return Array.isArray(e)?e:e?[e]:[]}return[m(String(t),a.span)]}function q(t){if(!(typeof t.type!="object"||t.type===null)){if(P(t.type)&&"render"in t.type){let e=t.type;return s(e.render(t.props,null))}if(w(t.type)&&"type"in t.type){let r=t.type.type;if(p(r))return s(r(t.props));let n={...t,type:r};return A(n)}}}function L(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(C(e)):typeof e=="object"&&e!==null&&Symbol.iterator in e?Promise.resolve(C(Array.from(e))):i(e)&&R(e)?L(e):Promise.resolve(void 0)}function C(t){if(!t.some(e=>i(e)))return t.map(e=>typeof e=="string"?e:typeof e=="number"?String(e):"").join("")}async function A(t){if(p(t.type))return s(t.type(t.props));let e=q(t);if(e!==void 0)return e;if(R(t))return await v(t)||[];if(S(t))return[];if(u(t,"br"))return[m(`
|
|
2
|
+
`,a.span)];if(u(t,"img"))return[Z(t)];if(u(t,"svg"))return[G(t)];let r=b(t),n=h(t),o=await L(t);if(o!==void 0)return[m({text:o,style:r,tw:n})];let y=await v(t);return[f({children:y,style:r,tw:n})]}function Z(t){if(!t.props.src)throw new Error("Image element must have a 'src' prop.");let e=b(t),r=h(t);return d({src:t.props.src,style:e,tw:r})}function G(t){let e=b(t),r=h(t),n=N(t);return d({style:e,src:n,tw:r})}var U={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function b(t){let e={};typeof t.type=="string"&&t.type in a&&Object.assign(e,a[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(U))n in r&&(e[o]=r[n],delete r[n]);Object.assign(e,r)}return e}function h(t){if(!(typeof t.props!="object"||t.props===null||!("tw"in t.props)))return t.props.tw}function v(t){return typeof t.props!="object"||t.props===null||!("children"in t.props)?Promise.resolve([]):s(t.props.children)}function Q(t){return Promise.all(Array.from(t).map(e=>s(e))).then(e=>e.flat())}0&&(module.exports={fromJsx});
|
package/dist/jsx/jsx.d.cts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { N as Node } from '../types-
|
|
3
|
-
import { createTailwindFn } from './create-tailwind-fn.cjs';
|
|
4
|
-
import 'twrnc';
|
|
2
|
+
import { N as Node } from '../types-BOxuFk68.cjs';
|
|
5
3
|
|
|
6
4
|
type ReactElementLike = {
|
|
7
5
|
type: string | symbol | ((props: unknown) => ReactElementLike) | ReactElementLike;
|
|
@@ -9,12 +7,11 @@ type ReactElementLike = {
|
|
|
9
7
|
$$typeof?: symbol;
|
|
10
8
|
};
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
tailwindFn?: ReturnType<typeof createTailwindFn>;
|
|
10
|
+
declare module "react" {
|
|
11
|
+
interface DOMAttributes<T> {
|
|
12
|
+
tw?: string;
|
|
13
|
+
}
|
|
17
14
|
}
|
|
18
|
-
declare function fromJsx(element: ReactNode | ReactElementLike
|
|
15
|
+
declare function fromJsx(element: ReactNode | ReactElementLike): Promise<Node>;
|
|
19
16
|
|
|
20
|
-
export {
|
|
17
|
+
export { fromJsx };
|
package/dist/jsx/jsx.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { N as Node } from '../types-
|
|
3
|
-
import { createTailwindFn } from './create-tailwind-fn.js';
|
|
4
|
-
import 'twrnc';
|
|
2
|
+
import { N as Node } from '../types-BOxuFk68.js';
|
|
5
3
|
|
|
6
4
|
type ReactElementLike = {
|
|
7
5
|
type: string | symbol | ((props: unknown) => ReactElementLike) | ReactElementLike;
|
|
@@ -9,12 +7,11 @@ type ReactElementLike = {
|
|
|
9
7
|
$$typeof?: symbol;
|
|
10
8
|
};
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
tailwindFn?: ReturnType<typeof createTailwindFn>;
|
|
10
|
+
declare module "react" {
|
|
11
|
+
interface DOMAttributes<T> {
|
|
12
|
+
tw?: string;
|
|
13
|
+
}
|
|
17
14
|
}
|
|
18
|
-
declare function fromJsx(element: ReactNode | ReactElementLike
|
|
15
|
+
declare function fromJsx(element: ReactNode | ReactElementLike): Promise<Node>;
|
|
19
16
|
|
|
20
|
-
export {
|
|
17
|
+
export { fromJsx };
|
package/dist/jsx/jsx.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
2
|
-
`,
|
|
1
|
+
function l(t,e){e&&Object.keys(e).length>0&&(t.style=e)}function f(t){let e={type:"container",children:t.children,tw:t.tw};return l(e,t.style),e}function m(t,e){if(typeof t=="string"){let n={type:"text",text:t};return l(n,e),n}let r={type:"text",text:t.text,tw:t.tw};return l(r,e??t.style),r}function g(t){let e={type:"image",src:t.src};return l(e,t.style),e}function d(t){return{percentage:t}}var a={body:{margin:8},p:{marginTop:"1em",marginBottom:"1em",display:"block"},blockquote:{marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40,display:"block"},center:{textAlign:"center",display:"block"},hr:{marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"auto",marginRight:"auto",borderWidth:1,display:"block"},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",margin:"1em 0",display:"block"},mark:{backgroundColor:"yellow",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"}};var A=new Set(["head","meta","link","style","script"]);function x(t){return A.has(t.type)}function u(t,e){return t.type===e&&"props"in t}function S(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function i(t){return typeof t=="object"&&t!==null&&"type"in t}function p(t){return typeof t=="function"}var O=Symbol.for("react.forward_ref"),$=Symbol.for("react.memo"),I=Symbol.for("react.fragment");function E(t){return t.$$typeof===O}function P(t){return t.$$typeof===$}function k(t){return t.type===I}function W(t){return typeof t=="string"||typeof t=="number"}function w(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function j(t){return Object.keys(t).map(e=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}:${String(t[e]).trim()}`).join(";")}var z=["stopColor","stopOpacity","strokeWidth","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","fillRule","clipRule","colorInterpolationFilters","floodColor","floodOpacity","accentHeight","alignmentBaseline","arabicForm","baselineShift","capHeight","clipPath","clipPathUnits","colorInterpolation","colorProfile","colorRendering","enableBackground","fillOpacity","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","horizAdvX","horizOriginX","imageRendering","letterSpacing","lightingColor","markerEnd","markerMid","markerStart","overlinePosition","overlineThickness","paintOrder","preserveAspectRatio","pointerEvents","shapeRendering","strokeMiterlimit","strokeOpacity","textAnchor","textDecoration","textRendering","transformOrigin","underlinePosition","underlineThickness","unicodeBidi","unicodeRange","unitsPerEm","vectorEffect","vertAdvY","vertOriginX","vertOriginY","vAlphabetic","vHanging","vIdeographic","vMathematical","wordSpacing","writingMode"];function F(t,e){if(t==="children"||e==null)return;let r;if(t==="className"?r="class":z.includes(t)?r=S(t):r=t,typeof e=="boolean")return`${r}="${String(e)}"`;if(t==="style"&&typeof e=="object"){let n=j(e);if(n)return`style="${w(n)}"`}return`${r}="${w(String(e))}"`}function B(t){return Object.entries(t).map(([e,r])=>F(e,r)).filter(e=>e!==void 0)}var M=(t,e)=>{let r=t.props||{};if(p(t.type))return c(t.type(t.props));if(typeof t.type=="symbol"||typeof t.type!="string")return"";let n=B(r),o=r.children,y=Array.isArray(o)?o.map(h=>e(h)).join(""):e(o);return`<${t.type}${n.length>0?` ${n.join(" ")}`:""}>${y}</${t.type}>`},c=t=>t==null||t===!1?"":W(t)?String(t):Array.isArray(t)?t.map(c).join(""):i(t)?M(t,c):"";function T(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 et(t){let e=await s(t);return e.length===0?f({}):e.length===1&&e[0]!==void 0?e[0]:f({children:e,style:{width:d(100),height:d(100)}})}async function s(t){if(t==null||t===!1)return[];if(t instanceof Promise)return s(await t);if(typeof t=="object"&&Symbol.iterator in t)return X(t);if(i(t)){let e=await L(t);return Array.isArray(e)?e:e?[e]:[]}return[m(String(t),a.span)]}function H(t){if(!(typeof t.type!="object"||t.type===null)){if(E(t.type)&&"render"in t.type){let e=t.type;return s(e.render(t.props,null))}if(P(t.type)&&"type"in t.type){let r=t.type.type;if(p(r))return s(r(t.props));let n={...t,type:r};return L(n)}}}function v(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(N(e)):typeof e=="object"&&e!==null&&Symbol.iterator in e?Promise.resolve(N(Array.from(e))):i(e)&&k(e)?v(e):Promise.resolve(void 0)}function N(t){if(!t.some(e=>i(e)))return t.map(e=>typeof e=="string"?e:typeof e=="number"?String(e):"").join("")}async function L(t){if(p(t.type))return s(t.type(t.props));let e=H(t);if(e!==void 0)return e;if(k(t))return await C(t)||[];if(x(t))return[];if(u(t,"br"))return[m(`
|
|
2
|
+
`,a.span)];if(u(t,"img"))return[_(t)];if(u(t,"svg"))return[D(t)];let r=R(t),n=b(t),o=await v(t);if(o!==void 0)return[m({text:o,style:r,tw:n})];let y=await C(t);return[f({children:y,style:r,tw:n})]}function _(t){if(!t.props.src)throw new Error("Image element must have a 'src' prop.");let e=R(t),r=b(t);return g({src:t.props.src,style:e,tw:r})}function D(t){let e=R(t),r=b(t),n=T(t);return g({style:e,src:n,tw:r})}var V={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function R(t){let e={};typeof t.type=="string"&&t.type in a&&Object.assign(e,a[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(V))n in r&&(e[o]=r[n],delete r[n]);Object.assign(e,r)}return e}function b(t){if(!(typeof t.props!="object"||t.props===null||!("tw"in t.props)))return t.props.tw}function C(t){return typeof t.props!="object"||t.props===null||!("children"in t.props)?Promise.resolve([]):s(t.props.children)}function X(t){return Promise.all(Array.from(t).map(e=>s(e))).then(e=>e.flat())}export{et as fromJsx};
|
|
@@ -158,10 +158,18 @@ type PositionKeywordY = "top" | "center" | "bottom";
|
|
|
158
158
|
*/
|
|
159
159
|
type PositionComponent = PositionKeywordX | PositionKeywordY | LengthUnit;
|
|
160
160
|
|
|
161
|
+
/**
|
|
162
|
+
* A pair of values for horizontal and vertical axes.
|
|
163
|
+
*/
|
|
164
|
+
type SpacePair<T> = T | {
|
|
165
|
+
x: T;
|
|
166
|
+
y: T;
|
|
167
|
+
} | string;
|
|
168
|
+
|
|
161
169
|
/**
|
|
162
170
|
* Parsed `background-position` value for one layer.
|
|
163
171
|
*/
|
|
164
|
-
type BackgroundPosition =
|
|
172
|
+
type BackgroundPosition = SpacePair<PositionComponent>;
|
|
165
173
|
|
|
166
174
|
/**
|
|
167
175
|
* A list of `background-position` values (one per layer).
|
|
@@ -176,16 +184,7 @@ type BackgroundRepeatStyle = "repeat" | "no-repeat" | "space" | "round";
|
|
|
176
184
|
/**
|
|
177
185
|
* Combined repeat for X and Y axes.
|
|
178
186
|
*/
|
|
179
|
-
type BackgroundRepeat =
|
|
180
|
-
/**
|
|
181
|
-
* Repeat style along the X axis.
|
|
182
|
-
*/
|
|
183
|
-
x: BackgroundRepeatStyle;
|
|
184
|
-
/**
|
|
185
|
-
* Repeat style along the Y axis.
|
|
186
|
-
*/
|
|
187
|
-
y: BackgroundRepeatStyle;
|
|
188
|
-
};
|
|
187
|
+
type BackgroundRepeat = [BackgroundRepeatStyle, BackgroundRepeatStyle];
|
|
189
188
|
|
|
190
189
|
/**
|
|
191
190
|
* A list of background-repeat values (layered).
|
|
@@ -216,16 +215,7 @@ type BackgroundSizes = Array<BackgroundSize> | string;
|
|
|
216
215
|
/**
|
|
217
216
|
* Represents a position for circle() and ellipse() functions.
|
|
218
217
|
*/
|
|
219
|
-
type ShapePosition =
|
|
220
|
-
/**
|
|
221
|
-
* X-axis position component
|
|
222
|
-
*/
|
|
223
|
-
x: LengthUnit;
|
|
224
|
-
/**
|
|
225
|
-
* Y-axis position component
|
|
226
|
-
*/
|
|
227
|
-
y: LengthUnit;
|
|
228
|
-
};
|
|
218
|
+
type ShapePosition = SpacePair<LengthUnit>;
|
|
229
219
|
|
|
230
220
|
/**
|
|
231
221
|
* Represents radius values for circle() and ellipse() functions.
|
|
@@ -307,20 +297,6 @@ type PathShape = {
|
|
|
307
297
|
path: string;
|
|
308
298
|
};
|
|
309
299
|
|
|
310
|
-
/**
|
|
311
|
-
* Represents a single coordinate pair in a polygon.
|
|
312
|
-
*/
|
|
313
|
-
type PolygonCoordinate = {
|
|
314
|
-
/**
|
|
315
|
-
* X coordinate
|
|
316
|
-
*/
|
|
317
|
-
x: LengthUnit;
|
|
318
|
-
/**
|
|
319
|
-
* Y coordinate
|
|
320
|
-
*/
|
|
321
|
-
y: LengthUnit;
|
|
322
|
-
};
|
|
323
|
-
|
|
324
300
|
/**
|
|
325
301
|
* Represents a polygon() shape.
|
|
326
302
|
*/
|
|
@@ -332,7 +308,7 @@ type PolygonShape = {
|
|
|
332
308
|
/**
|
|
333
309
|
* List of coordinate pairs defining the polygon vertices
|
|
334
310
|
*/
|
|
335
|
-
coordinates: Array<
|
|
311
|
+
coordinates: Array<SpacePair<LengthUnit>>;
|
|
336
312
|
};
|
|
337
313
|
|
|
338
314
|
/**
|
|
@@ -430,7 +406,7 @@ type CssValue<T> = CssGlobalKeyword | T;
|
|
|
430
406
|
/**
|
|
431
407
|
* This enum determines the layout algorithm used for the children of a node.
|
|
432
408
|
*/
|
|
433
|
-
type Display = "flex" | "grid" | "inline" | "block";
|
|
409
|
+
type Display = "none" | "flex" | "grid" | "inline" | "block";
|
|
434
410
|
|
|
435
411
|
/**
|
|
436
412
|
* Represents a single CSS filter operation
|
|
@@ -517,17 +493,17 @@ type FontVariationSettings = string;
|
|
|
517
493
|
type FontWeight = string | number;
|
|
518
494
|
|
|
519
495
|
/**
|
|
520
|
-
* Represents
|
|
521
|
-
*
|
|
522
|
-
* Can be either a single value applied to both axes, or separate values
|
|
523
|
-
* for horizontal and vertical spacing.
|
|
496
|
+
* Represents the direction of the grid auto flow.
|
|
524
497
|
*/
|
|
525
|
-
type
|
|
498
|
+
type GridDirection = "row" | "column";
|
|
526
499
|
|
|
527
500
|
/**
|
|
528
|
-
* Represents the
|
|
501
|
+
* Represents the flow of the grid auto placement.
|
|
529
502
|
*/
|
|
530
|
-
type GridAutoFlow =
|
|
503
|
+
type GridAutoFlow = {
|
|
504
|
+
direction: GridDirection;
|
|
505
|
+
dense: boolean;
|
|
506
|
+
} | string;
|
|
531
507
|
|
|
532
508
|
/**
|
|
533
509
|
* Represents a grid placement keyword
|
|
@@ -690,7 +666,7 @@ type Overflow = "visible" | "hidden";
|
|
|
690
666
|
* Can be either a single value applied to both axes, or separate values
|
|
691
667
|
* for horizontal and vertical overflow.
|
|
692
668
|
*/
|
|
693
|
-
type Overflows = Overflow
|
|
669
|
+
type Overflows = SpacePair<Overflow>;
|
|
694
670
|
|
|
695
671
|
/**
|
|
696
672
|
* Controls how text should be overflowed.
|
|
@@ -712,14 +688,6 @@ type PercentageNumber = string | number;
|
|
|
712
688
|
*/
|
|
713
689
|
type Position = "relative" | "absolute";
|
|
714
690
|
|
|
715
|
-
/**
|
|
716
|
-
* Represents a 2D scale for CSS scale property
|
|
717
|
-
*/
|
|
718
|
-
type Scale = {
|
|
719
|
-
x: number;
|
|
720
|
-
y: number;
|
|
721
|
-
} | string;
|
|
722
|
-
|
|
723
691
|
/**
|
|
724
692
|
* Text alignment options for text rendering.
|
|
725
693
|
*
|
|
@@ -855,14 +823,6 @@ type Transform = {
|
|
|
855
823
|
*/
|
|
856
824
|
type Transforms = Array<Transform> | string;
|
|
857
825
|
|
|
858
|
-
/**
|
|
859
|
-
* Represents a 2D translation for CSS translate property
|
|
860
|
-
*/
|
|
861
|
-
type Translate = {
|
|
862
|
-
x: LengthUnit;
|
|
863
|
-
y: LengthUnit;
|
|
864
|
-
} | string;
|
|
865
|
-
|
|
866
826
|
/**
|
|
867
827
|
* Controls how whitespace should be collapsed.
|
|
868
828
|
*/
|
|
@@ -900,16 +860,22 @@ type Style = {
|
|
|
900
860
|
minHeight: CssValue<LengthUnit>;
|
|
901
861
|
aspectRatio: CssValue<AspectRatio>;
|
|
902
862
|
padding: CssValue<Sides<LengthUnit>>;
|
|
863
|
+
paddingInline: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
864
|
+
paddingBlock: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
903
865
|
paddingTop: CssValue<CssOption<LengthUnit>>;
|
|
904
866
|
paddingRight: CssValue<CssOption<LengthUnit>>;
|
|
905
867
|
paddingBottom: CssValue<CssOption<LengthUnit>>;
|
|
906
868
|
paddingLeft: CssValue<CssOption<LengthUnit>>;
|
|
907
869
|
margin: CssValue<Sides<LengthUnit>>;
|
|
870
|
+
marginInline: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
871
|
+
marginBlock: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
908
872
|
marginTop: CssValue<CssOption<LengthUnit>>;
|
|
909
873
|
marginRight: CssValue<CssOption<LengthUnit>>;
|
|
910
874
|
marginBottom: CssValue<CssOption<LengthUnit>>;
|
|
911
875
|
marginLeft: CssValue<CssOption<LengthUnit>>;
|
|
912
876
|
inset: CssValue<Sides<LengthUnit>>;
|
|
877
|
+
insetInline: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
878
|
+
insetBlock: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
913
879
|
top: CssValue<CssOption<LengthUnit>>;
|
|
914
880
|
right: CssValue<CssOption<LengthUnit>>;
|
|
915
881
|
bottom: CssValue<CssOption<LengthUnit>>;
|
|
@@ -925,15 +891,21 @@ type Style = {
|
|
|
925
891
|
flexBasis: CssValue<CssOption<LengthUnit>>;
|
|
926
892
|
position: CssValue<Position>;
|
|
927
893
|
rotate: CssValue<CssOption<Angle>>;
|
|
928
|
-
scale: CssValue<CssOption<
|
|
894
|
+
scale: CssValue<CssOption<SpacePair<PercentageNumber>>>;
|
|
895
|
+
scaleX: CssValue<CssOption<PercentageNumber>>;
|
|
896
|
+
scaleY: CssValue<CssOption<PercentageNumber>>;
|
|
929
897
|
transform: CssValue<CssOption<Transforms>>;
|
|
930
898
|
transformOrigin: CssValue<CssOption<BackgroundPosition>>;
|
|
931
|
-
translate: CssValue<CssOption<
|
|
899
|
+
translate: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
900
|
+
translateX: CssValue<CssOption<LengthUnit>>;
|
|
901
|
+
translateY: CssValue<CssOption<LengthUnit>>;
|
|
932
902
|
maskImage: CssValue<CssOption<BackgroundImages>>;
|
|
933
903
|
maskSize: CssValue<CssOption<BackgroundSizes>>;
|
|
934
904
|
maskPosition: CssValue<CssOption<BackgroundPositions>>;
|
|
935
905
|
maskRepeat: CssValue<CssOption<BackgroundRepeats>>;
|
|
936
|
-
gap: CssValue<
|
|
906
|
+
gap: CssValue<SpacePair<LengthUnit>>;
|
|
907
|
+
columnGap: CssValue<CssOption<LengthUnit>>;
|
|
908
|
+
rowGap: CssValue<CssOption<LengthUnit>>;
|
|
937
909
|
flex: CssValue<CssOption<Flex>>;
|
|
938
910
|
flexGrow: CssValue<CssOption<FlexGrow>>;
|
|
939
911
|
flexShrink: CssValue<CssOption<FlexGrow>>;
|
|
@@ -943,6 +915,8 @@ type Style = {
|
|
|
943
915
|
borderBottomRightRadius: CssValue<CssOption<LengthUnit>>;
|
|
944
916
|
borderBottomLeftRadius: CssValue<CssOption<LengthUnit>>;
|
|
945
917
|
borderWidth: CssValue<CssOption<Sides<LengthUnit>>>;
|
|
918
|
+
borderInlineWidth: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
919
|
+
borderBlockWidth: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
946
920
|
borderTopWidth: CssValue<CssOption<LengthUnit>>;
|
|
947
921
|
borderRightWidth: CssValue<CssOption<LengthUnit>>;
|
|
948
922
|
borderBottomWidth: CssValue<CssOption<LengthUnit>>;
|
|
@@ -1014,11 +988,13 @@ type ContainerNode = {
|
|
|
1014
988
|
type: "container";
|
|
1015
989
|
style?: PartialStyle;
|
|
1016
990
|
children?: Node[];
|
|
991
|
+
tw?: string;
|
|
1017
992
|
};
|
|
1018
993
|
type TextNode = {
|
|
1019
994
|
type: "text";
|
|
1020
995
|
text: string;
|
|
1021
996
|
style?: PartialStyle;
|
|
997
|
+
tw?: string;
|
|
1022
998
|
};
|
|
1023
999
|
type ImageNode = {
|
|
1024
1000
|
type: "image";
|
|
@@ -1026,6 +1002,7 @@ type ImageNode = {
|
|
|
1026
1002
|
width?: number;
|
|
1027
1003
|
height?: number;
|
|
1028
1004
|
style?: PartialStyle;
|
|
1005
|
+
tw?: string;
|
|
1029
1006
|
};
|
|
1030
1007
|
|
|
1031
1008
|
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 };
|
|
@@ -158,10 +158,18 @@ type PositionKeywordY = "top" | "center" | "bottom";
|
|
|
158
158
|
*/
|
|
159
159
|
type PositionComponent = PositionKeywordX | PositionKeywordY | LengthUnit;
|
|
160
160
|
|
|
161
|
+
/**
|
|
162
|
+
* A pair of values for horizontal and vertical axes.
|
|
163
|
+
*/
|
|
164
|
+
type SpacePair<T> = T | {
|
|
165
|
+
x: T;
|
|
166
|
+
y: T;
|
|
167
|
+
} | string;
|
|
168
|
+
|
|
161
169
|
/**
|
|
162
170
|
* Parsed `background-position` value for one layer.
|
|
163
171
|
*/
|
|
164
|
-
type BackgroundPosition =
|
|
172
|
+
type BackgroundPosition = SpacePair<PositionComponent>;
|
|
165
173
|
|
|
166
174
|
/**
|
|
167
175
|
* A list of `background-position` values (one per layer).
|
|
@@ -176,16 +184,7 @@ type BackgroundRepeatStyle = "repeat" | "no-repeat" | "space" | "round";
|
|
|
176
184
|
/**
|
|
177
185
|
* Combined repeat for X and Y axes.
|
|
178
186
|
*/
|
|
179
|
-
type BackgroundRepeat =
|
|
180
|
-
/**
|
|
181
|
-
* Repeat style along the X axis.
|
|
182
|
-
*/
|
|
183
|
-
x: BackgroundRepeatStyle;
|
|
184
|
-
/**
|
|
185
|
-
* Repeat style along the Y axis.
|
|
186
|
-
*/
|
|
187
|
-
y: BackgroundRepeatStyle;
|
|
188
|
-
};
|
|
187
|
+
type BackgroundRepeat = [BackgroundRepeatStyle, BackgroundRepeatStyle];
|
|
189
188
|
|
|
190
189
|
/**
|
|
191
190
|
* A list of background-repeat values (layered).
|
|
@@ -216,16 +215,7 @@ type BackgroundSizes = Array<BackgroundSize> | string;
|
|
|
216
215
|
/**
|
|
217
216
|
* Represents a position for circle() and ellipse() functions.
|
|
218
217
|
*/
|
|
219
|
-
type ShapePosition =
|
|
220
|
-
/**
|
|
221
|
-
* X-axis position component
|
|
222
|
-
*/
|
|
223
|
-
x: LengthUnit;
|
|
224
|
-
/**
|
|
225
|
-
* Y-axis position component
|
|
226
|
-
*/
|
|
227
|
-
y: LengthUnit;
|
|
228
|
-
};
|
|
218
|
+
type ShapePosition = SpacePair<LengthUnit>;
|
|
229
219
|
|
|
230
220
|
/**
|
|
231
221
|
* Represents radius values for circle() and ellipse() functions.
|
|
@@ -307,20 +297,6 @@ type PathShape = {
|
|
|
307
297
|
path: string;
|
|
308
298
|
};
|
|
309
299
|
|
|
310
|
-
/**
|
|
311
|
-
* Represents a single coordinate pair in a polygon.
|
|
312
|
-
*/
|
|
313
|
-
type PolygonCoordinate = {
|
|
314
|
-
/**
|
|
315
|
-
* X coordinate
|
|
316
|
-
*/
|
|
317
|
-
x: LengthUnit;
|
|
318
|
-
/**
|
|
319
|
-
* Y coordinate
|
|
320
|
-
*/
|
|
321
|
-
y: LengthUnit;
|
|
322
|
-
};
|
|
323
|
-
|
|
324
300
|
/**
|
|
325
301
|
* Represents a polygon() shape.
|
|
326
302
|
*/
|
|
@@ -332,7 +308,7 @@ type PolygonShape = {
|
|
|
332
308
|
/**
|
|
333
309
|
* List of coordinate pairs defining the polygon vertices
|
|
334
310
|
*/
|
|
335
|
-
coordinates: Array<
|
|
311
|
+
coordinates: Array<SpacePair<LengthUnit>>;
|
|
336
312
|
};
|
|
337
313
|
|
|
338
314
|
/**
|
|
@@ -430,7 +406,7 @@ type CssValue<T> = CssGlobalKeyword | T;
|
|
|
430
406
|
/**
|
|
431
407
|
* This enum determines the layout algorithm used for the children of a node.
|
|
432
408
|
*/
|
|
433
|
-
type Display = "flex" | "grid" | "inline" | "block";
|
|
409
|
+
type Display = "none" | "flex" | "grid" | "inline" | "block";
|
|
434
410
|
|
|
435
411
|
/**
|
|
436
412
|
* Represents a single CSS filter operation
|
|
@@ -517,17 +493,17 @@ type FontVariationSettings = string;
|
|
|
517
493
|
type FontWeight = string | number;
|
|
518
494
|
|
|
519
495
|
/**
|
|
520
|
-
* Represents
|
|
521
|
-
*
|
|
522
|
-
* Can be either a single value applied to both axes, or separate values
|
|
523
|
-
* for horizontal and vertical spacing.
|
|
496
|
+
* Represents the direction of the grid auto flow.
|
|
524
497
|
*/
|
|
525
|
-
type
|
|
498
|
+
type GridDirection = "row" | "column";
|
|
526
499
|
|
|
527
500
|
/**
|
|
528
|
-
* Represents the
|
|
501
|
+
* Represents the flow of the grid auto placement.
|
|
529
502
|
*/
|
|
530
|
-
type GridAutoFlow =
|
|
503
|
+
type GridAutoFlow = {
|
|
504
|
+
direction: GridDirection;
|
|
505
|
+
dense: boolean;
|
|
506
|
+
} | string;
|
|
531
507
|
|
|
532
508
|
/**
|
|
533
509
|
* Represents a grid placement keyword
|
|
@@ -690,7 +666,7 @@ type Overflow = "visible" | "hidden";
|
|
|
690
666
|
* Can be either a single value applied to both axes, or separate values
|
|
691
667
|
* for horizontal and vertical overflow.
|
|
692
668
|
*/
|
|
693
|
-
type Overflows = Overflow
|
|
669
|
+
type Overflows = SpacePair<Overflow>;
|
|
694
670
|
|
|
695
671
|
/**
|
|
696
672
|
* Controls how text should be overflowed.
|
|
@@ -712,14 +688,6 @@ type PercentageNumber = string | number;
|
|
|
712
688
|
*/
|
|
713
689
|
type Position = "relative" | "absolute";
|
|
714
690
|
|
|
715
|
-
/**
|
|
716
|
-
* Represents a 2D scale for CSS scale property
|
|
717
|
-
*/
|
|
718
|
-
type Scale = {
|
|
719
|
-
x: number;
|
|
720
|
-
y: number;
|
|
721
|
-
} | string;
|
|
722
|
-
|
|
723
691
|
/**
|
|
724
692
|
* Text alignment options for text rendering.
|
|
725
693
|
*
|
|
@@ -855,14 +823,6 @@ type Transform = {
|
|
|
855
823
|
*/
|
|
856
824
|
type Transforms = Array<Transform> | string;
|
|
857
825
|
|
|
858
|
-
/**
|
|
859
|
-
* Represents a 2D translation for CSS translate property
|
|
860
|
-
*/
|
|
861
|
-
type Translate = {
|
|
862
|
-
x: LengthUnit;
|
|
863
|
-
y: LengthUnit;
|
|
864
|
-
} | string;
|
|
865
|
-
|
|
866
826
|
/**
|
|
867
827
|
* Controls how whitespace should be collapsed.
|
|
868
828
|
*/
|
|
@@ -900,16 +860,22 @@ type Style = {
|
|
|
900
860
|
minHeight: CssValue<LengthUnit>;
|
|
901
861
|
aspectRatio: CssValue<AspectRatio>;
|
|
902
862
|
padding: CssValue<Sides<LengthUnit>>;
|
|
863
|
+
paddingInline: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
864
|
+
paddingBlock: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
903
865
|
paddingTop: CssValue<CssOption<LengthUnit>>;
|
|
904
866
|
paddingRight: CssValue<CssOption<LengthUnit>>;
|
|
905
867
|
paddingBottom: CssValue<CssOption<LengthUnit>>;
|
|
906
868
|
paddingLeft: CssValue<CssOption<LengthUnit>>;
|
|
907
869
|
margin: CssValue<Sides<LengthUnit>>;
|
|
870
|
+
marginInline: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
871
|
+
marginBlock: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
908
872
|
marginTop: CssValue<CssOption<LengthUnit>>;
|
|
909
873
|
marginRight: CssValue<CssOption<LengthUnit>>;
|
|
910
874
|
marginBottom: CssValue<CssOption<LengthUnit>>;
|
|
911
875
|
marginLeft: CssValue<CssOption<LengthUnit>>;
|
|
912
876
|
inset: CssValue<Sides<LengthUnit>>;
|
|
877
|
+
insetInline: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
878
|
+
insetBlock: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
913
879
|
top: CssValue<CssOption<LengthUnit>>;
|
|
914
880
|
right: CssValue<CssOption<LengthUnit>>;
|
|
915
881
|
bottom: CssValue<CssOption<LengthUnit>>;
|
|
@@ -925,15 +891,21 @@ type Style = {
|
|
|
925
891
|
flexBasis: CssValue<CssOption<LengthUnit>>;
|
|
926
892
|
position: CssValue<Position>;
|
|
927
893
|
rotate: CssValue<CssOption<Angle>>;
|
|
928
|
-
scale: CssValue<CssOption<
|
|
894
|
+
scale: CssValue<CssOption<SpacePair<PercentageNumber>>>;
|
|
895
|
+
scaleX: CssValue<CssOption<PercentageNumber>>;
|
|
896
|
+
scaleY: CssValue<CssOption<PercentageNumber>>;
|
|
929
897
|
transform: CssValue<CssOption<Transforms>>;
|
|
930
898
|
transformOrigin: CssValue<CssOption<BackgroundPosition>>;
|
|
931
|
-
translate: CssValue<CssOption<
|
|
899
|
+
translate: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
900
|
+
translateX: CssValue<CssOption<LengthUnit>>;
|
|
901
|
+
translateY: CssValue<CssOption<LengthUnit>>;
|
|
932
902
|
maskImage: CssValue<CssOption<BackgroundImages>>;
|
|
933
903
|
maskSize: CssValue<CssOption<BackgroundSizes>>;
|
|
934
904
|
maskPosition: CssValue<CssOption<BackgroundPositions>>;
|
|
935
905
|
maskRepeat: CssValue<CssOption<BackgroundRepeats>>;
|
|
936
|
-
gap: CssValue<
|
|
906
|
+
gap: CssValue<SpacePair<LengthUnit>>;
|
|
907
|
+
columnGap: CssValue<CssOption<LengthUnit>>;
|
|
908
|
+
rowGap: CssValue<CssOption<LengthUnit>>;
|
|
937
909
|
flex: CssValue<CssOption<Flex>>;
|
|
938
910
|
flexGrow: CssValue<CssOption<FlexGrow>>;
|
|
939
911
|
flexShrink: CssValue<CssOption<FlexGrow>>;
|
|
@@ -943,6 +915,8 @@ type Style = {
|
|
|
943
915
|
borderBottomRightRadius: CssValue<CssOption<LengthUnit>>;
|
|
944
916
|
borderBottomLeftRadius: CssValue<CssOption<LengthUnit>>;
|
|
945
917
|
borderWidth: CssValue<CssOption<Sides<LengthUnit>>>;
|
|
918
|
+
borderInlineWidth: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
919
|
+
borderBlockWidth: CssValue<CssOption<SpacePair<LengthUnit>>>;
|
|
946
920
|
borderTopWidth: CssValue<CssOption<LengthUnit>>;
|
|
947
921
|
borderRightWidth: CssValue<CssOption<LengthUnit>>;
|
|
948
922
|
borderBottomWidth: CssValue<CssOption<LengthUnit>>;
|
|
@@ -1014,11 +988,13 @@ type ContainerNode = {
|
|
|
1014
988
|
type: "container";
|
|
1015
989
|
style?: PartialStyle;
|
|
1016
990
|
children?: Node[];
|
|
991
|
+
tw?: string;
|
|
1017
992
|
};
|
|
1018
993
|
type TextNode = {
|
|
1019
994
|
type: "text";
|
|
1020
995
|
text: string;
|
|
1021
996
|
style?: PartialStyle;
|
|
997
|
+
tw?: string;
|
|
1022
998
|
};
|
|
1023
999
|
type ImageNode = {
|
|
1024
1000
|
type: "image";
|
|
@@ -1026,6 +1002,7 @@ type ImageNode = {
|
|
|
1026
1002
|
width?: number;
|
|
1027
1003
|
height?: number;
|
|
1028
1004
|
style?: PartialStyle;
|
|
1005
|
+
tw?: string;
|
|
1029
1006
|
};
|
|
1030
1007
|
|
|
1031
1008
|
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.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "me@kane.tw",
|
|
6
6
|
"name": "Kane Wang",
|
|
@@ -9,9 +9,6 @@
|
|
|
9
9
|
"repository": {
|
|
10
10
|
"url": "git+https://github.com/kane50613/takumi.git"
|
|
11
11
|
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"twrnc": "^4.10.1"
|
|
14
|
-
},
|
|
15
12
|
"devDependencies": {
|
|
16
13
|
"@types/bun": "catalog:",
|
|
17
14
|
"@types/react": "^19.2.2",
|
|
@@ -35,12 +32,6 @@
|
|
|
35
32
|
"import": "./dist/jsx/jsx.js",
|
|
36
33
|
"require": "./dist/jsx/jsx.cjs",
|
|
37
34
|
"default": "./dist/jsx/jsx.js"
|
|
38
|
-
},
|
|
39
|
-
"./jsx/create-tailwind-fn": {
|
|
40
|
-
"types": "./dist/jsx/create-tailwind-fn.d.ts",
|
|
41
|
-
"import": "./dist/jsx/create-tailwind-fn.js",
|
|
42
|
-
"require": "./dist/jsx/create-tailwind-fn.cjs",
|
|
43
|
-
"default": "./dist/jsx/create-tailwind-fn.js"
|
|
44
35
|
}
|
|
45
36
|
},
|
|
46
37
|
"files": [
|
|
@@ -51,7 +42,7 @@
|
|
|
51
42
|
],
|
|
52
43
|
"license": "(MIT OR Apache-2.0)",
|
|
53
44
|
"scripts": {
|
|
54
|
-
"build": "tsup-node src/index.ts src/jsx/jsx.ts src/jsx/create-tailwind-fn.ts --minify --dts --format esm,cjs --no-splitting"
|
|
45
|
+
"build": "tsup-node src/index.ts src/jsx/jsx.ts src/jsx/create-tailwind-fn.ts --clean --minify --dts --format esm,cjs --no-splitting"
|
|
55
46
|
},
|
|
56
47
|
"type": "module"
|
|
57
48
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var n=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var t=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var l=(p,r)=>{for(var e in r)n(p,e,{get:r[e],enumerable:!0})},w=(p,r,e,x)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of t(r))!d.call(p,o)&&o!==e&&n(p,o,{get:()=>r[o],enumerable:!(x=i(r,o))||x.enumerable});return p};var b=p=>w(n({},"__esModule",{value:!0}),p);var h={};l(h,{createTailwindFn:()=>g});module.exports=b(h);var a=require("twrnc/create"),s={handler({addUtilities:p}){p({"shadow-sm":{boxShadow:"0 1px 2px 0 rgb(0 0 0 / 0.05)"},shadow:{boxShadow:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)"},"shadow-md":{boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)"},"shadow-lg":{boxShadow:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)"},"shadow-xl":{boxShadow:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"},"shadow-2xl":{boxShadow:"0 25px 50px -12px rgb(0 0 0 / 0.25)"},"shadow-inner":{boxShadow:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)"},"shadow-none":{boxShadow:"0 0 #0000"},block:{display:"block"},inline:{display:"inline"},grid:{display:"grid"}})}};function g(p){let r=(0,a.create)({...p,plugins:[...p?.plugins??[],s]},"web",{major:0,minor:0,patch:0});return function(...x){let o=r.style(...x);return typeof o.lineHeight=="number"&&(o.lineHeight=`${o.lineHeight}px`),o.shadowColor&&typeof o.boxShadow=="string"&&(o.boxShadow=o.boxShadow.replace(/rgba?\([^)]+\)/g,o.shadowColor.toString())),o}}0&&(module.exports={createTailwindFn});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as twrnc from 'twrnc';
|
|
2
|
-
import { TwConfig } from 'twrnc';
|
|
3
|
-
|
|
4
|
-
declare module "react" {
|
|
5
|
-
interface HTMLAttributes<T> {
|
|
6
|
-
tw?: string;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @description Creates a function that can be used to parse tailwind classes into inline styles.
|
|
11
|
-
* @param config The tailwind config to use.
|
|
12
|
-
*/
|
|
13
|
-
declare function createTailwindFn(config?: TwConfig): (...args: Parameters<(...inputs: twrnc.ClassInput[]) => twrnc.Style>) => twrnc.Style;
|
|
14
|
-
|
|
15
|
-
export { createTailwindFn };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as twrnc from 'twrnc';
|
|
2
|
-
import { TwConfig } from 'twrnc';
|
|
3
|
-
|
|
4
|
-
declare module "react" {
|
|
5
|
-
interface HTMLAttributes<T> {
|
|
6
|
-
tw?: string;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @description Creates a function that can be used to parse tailwind classes into inline styles.
|
|
11
|
-
* @param config The tailwind config to use.
|
|
12
|
-
*/
|
|
13
|
-
declare function createTailwindFn(config?: TwConfig): (...args: Parameters<(...inputs: twrnc.ClassInput[]) => twrnc.Style>) => twrnc.Style;
|
|
14
|
-
|
|
15
|
-
export { createTailwindFn };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{create as x}from"twrnc/create";var n={handler({addUtilities:p}){p({"shadow-sm":{boxShadow:"0 1px 2px 0 rgb(0 0 0 / 0.05)"},shadow:{boxShadow:"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)"},"shadow-md":{boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)"},"shadow-lg":{boxShadow:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)"},"shadow-xl":{boxShadow:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"},"shadow-2xl":{boxShadow:"0 25px 50px -12px rgb(0 0 0 / 0.25)"},"shadow-inner":{boxShadow:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)"},"shadow-none":{boxShadow:"0 0 #0000"},block:{display:"block"},inline:{display:"inline"},grid:{display:"grid"}})}};function t(p){let r=x({...p,plugins:[...p?.plugins??[],n]},"web",{major:0,minor:0,patch:0});return function(...e){let o=r.style(...e);return typeof o.lineHeight=="number"&&(o.lineHeight=`${o.lineHeight}px`),o.shadowColor&&typeof o.boxShadow=="string"&&(o.boxShadow=o.boxShadow.replace(/rgba?\([^)]+\)/g,o.shadowColor.toString())),o}}export{t as createTailwindFn};
|