@takumi-rs/helpers 0.34.0 → 0.35.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/README.md +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/jsx/jsx.cjs +1 -1
- package/dist/jsx/jsx.d.cts +1 -1
- package/dist/jsx/jsx.d.ts +1 -1
- package/dist/jsx/jsx.js +1 -1
- package/dist/{types-DxxXoHai.d.cts → types-COoQZHpr.d.cts} +1 -1
- package/dist/{types-DxxXoHai.d.ts → types-COoQZHpr.d.ts} +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style } 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 } from './types-COoQZHpr.cjs';
|
|
2
|
+
export { A as AnyNode, J as JsonValue, N as Node } from './types-COoQZHpr.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Represents a color with 8-bit RGBA components.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ContainerNode, P as PartialStyle, T as TextNode, I as ImageNode, S as Style } 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 } from './types-COoQZHpr.js';
|
|
2
|
+
export { A as AnyNode, J as JsonValue, N as Node } from './types-COoQZHpr.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Represents a color with 8-bit RGBA components.
|
package/dist/jsx/jsx.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var r in t)c(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&&c(e,o,{get:()=>t[o],enumerable:!(n=L(t,o))||n.enumerable});return e};var z=e=>W(c({},"__esModule",{value:!0}),e);var G={};$(G,{fromJsx:()=>J});module.exports=z(G);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 g={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,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}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: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 Z(e);if(i(e)){let t=await N(e);return Array.isArray(t)?t:t?[t]:[]}return[m(String(e))]}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[m(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 u({src:e.props.src,style:t})}function K(e){let t=h(e),r=x(e);return u({style:t,src:r})}var q={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function h(e){let t={};typeof e.type=="string"&&e.type in g&&Object.assign(t,g[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});
|
package/dist/jsx/jsx.d.cts
CHANGED
package/dist/jsx/jsx.d.ts
CHANGED
package/dist/jsx/jsx.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function c(e,t){t&&Object.keys(t).length>0&&(e.style=t)}function l(e){let t={type:"container",children:e.children};return c(t,e.style),t}function f(e,t){let r={type:"text",text:e};return c(r,t),r}function m(e){let t={type:"image",src:e.src};return c(t,e.style),t}function u(e){return{percentage:e}}var y={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,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}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:u(100),height:u(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[f(String(e))]}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[f(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 m({src:e.props.src,style:t})}function M(e){let t=R(e),r=P(e);return m({style:t,src:r})}var _={WebkitTextStroke:"textStroke",WebkitTextStrokeWidth:"textStrokeWidth",WebkitTextStrokeColor:"textStrokeColor"};function R(e){let t={};typeof e.type=="string"&&e.type in y&&Object.assign(t,y[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};
|
|
@@ -315,7 +315,7 @@ type CssValue<T> = CssGlobalKeyword | T;
|
|
|
315
315
|
/**
|
|
316
316
|
* This enum determines the layout algorithm used for the children of a node.
|
|
317
317
|
*/
|
|
318
|
-
type Display = "flex" | "grid";
|
|
318
|
+
type Display = "flex" | "grid" | "inline" | "block";
|
|
319
319
|
|
|
320
320
|
/**
|
|
321
321
|
* Represents a flex shorthand property for flex-grow, flex-shrink, and flex-basis.
|
|
@@ -315,7 +315,7 @@ type CssValue<T> = CssGlobalKeyword | T;
|
|
|
315
315
|
/**
|
|
316
316
|
* This enum determines the layout algorithm used for the children of a node.
|
|
317
317
|
*/
|
|
318
|
-
type Display = "flex" | "grid";
|
|
318
|
+
type Display = "flex" | "grid" | "inline" | "block";
|
|
319
319
|
|
|
320
320
|
/**
|
|
321
321
|
* Represents a flex shorthand property for flex-grow, flex-shrink, and flex-basis.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takumi-rs/helpers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "me@kane.tw",
|
|
6
6
|
"name": "Kane Wang",
|
|
@@ -42,8 +42,7 @@
|
|
|
42
42
|
],
|
|
43
43
|
"license": "(MIT OR Apache-2.0)",
|
|
44
44
|
"scripts": {
|
|
45
|
-
"build": "tsup-node src/index.ts src/jsx/jsx.ts --minify --dts --format esm,cjs --no-splitting"
|
|
46
|
-
"release": "npm publish --provenance"
|
|
45
|
+
"build": "tsup-node src/index.ts src/jsx/jsx.ts --minify --dts --format esm,cjs --no-splitting"
|
|
47
46
|
},
|
|
48
47
|
"type": "module"
|
|
49
48
|
}
|