@takumi-rs/helpers 2.0.3 → 2.1.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/emoji.d.cts +1 -1
- package/dist/emoji.d.mts +1 -1
- package/dist/html.d.cts +2 -2
- package/dist/html.d.mts +2 -2
- package/dist/{index-22uld-QT.d.cts → index-C7GS_D7H.d.mts} +1 -1
- package/dist/{index-DQecrVB5.d.mts → index-CP8FH6-0.d.cts} +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/jsx.cjs +2 -2
- package/dist/jsx.d.cts +1 -1
- package/dist/jsx.d.mts +1 -1
- package/dist/jsx.mjs +2 -2
- package/dist/renderer.d.cts +1 -1
- package/dist/renderer.d.mts +1 -1
- package/dist/{types-BZASl6ra.d.cts → types-C0iOpAlK.d.cts} +5 -1
- package/dist/{types-BZASl6ra.d.mts → types-C0iOpAlK.d.mts} +5 -1
- package/package.json +10 -4
package/dist/emoji.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as Node } from "./types-
|
|
1
|
+
import { r as Node } from "./types-C0iOpAlK.cjs";
|
|
2
2
|
//#region src/emoji.d.ts
|
|
3
3
|
type EmojiType = "twemoji" | "blobmoji" | "noto" | "openmoji" | "fluent" | "fluentFlat";
|
|
4
4
|
declare function extractEmojis(node: Node, emojiType: EmojiType): Node;
|
package/dist/emoji.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as Node } from "./types-
|
|
1
|
+
import { r as Node } from "./types-C0iOpAlK.mjs";
|
|
2
2
|
//#region src/emoji.d.ts
|
|
3
3
|
type EmojiType = "twemoji" | "blobmoji" | "noto" | "openmoji" | "fluent" | "fluentFlat";
|
|
4
4
|
declare function extractEmojis(node: Node, emojiType: EmojiType): Node;
|
package/dist/html.d.cts
CHANGED
package/dist/html.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as TextNode, n as ImageNode, r as Node, t as ContainerNode } from "./types-
|
|
1
|
+
import { c as TextNode, n as ImageNode, r as Node, t as ContainerNode } from "./types-C0iOpAlK.mjs";
|
|
2
2
|
import { CSSProperties } from "react";
|
|
3
3
|
//#region src/google-fonts-catalog.d.ts
|
|
4
4
|
interface GoogleFontShapes {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as TextNode, n as ImageNode, r as Node, t as ContainerNode } from "./types-
|
|
1
|
+
import { c as TextNode, n as ImageNode, r as Node, t as ContainerNode } from "./types-C0iOpAlK.cjs";
|
|
2
2
|
import { CSSProperties } from "react";
|
|
3
3
|
//#region src/google-fonts-catalog.d.ts
|
|
4
4
|
interface GoogleFontShapes {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as NodeMetadata, c as TextNode, i as NodeAttributes, n as ImageNode, o as ReactElementLike, r as Node, s as TextFit, t as ContainerNode } from "./types-
|
|
2
|
-
import { C as PrepareImagesOptions, D as readBodyLimited, E as prepareImages, S as ImageFetchCache, T as fetchOk, _ as googleFonts, a as percentage, b as FetchOptions, c as style, d as vw, f as FontSubset, g as fontFromUrl, h as collectCodepoints, i as image, l as text, m as GoogleFontsOptions, n as em, o as rem, p as GoogleFontFamily, r as fr, s as rgba, t as container, u as vh, v as subsetFonts, w as defaultMaxFetchBytes, x as FetchedImage, y as FetchLike } from "./index-
|
|
1
|
+
import { a as NodeMetadata, c as TextNode, i as NodeAttributes, n as ImageNode, o as ReactElementLike, r as Node, s as TextFit, t as ContainerNode } from "./types-C0iOpAlK.cjs";
|
|
2
|
+
import { C as PrepareImagesOptions, D as readBodyLimited, E as prepareImages, S as ImageFetchCache, T as fetchOk, _ as googleFonts, a as percentage, b as FetchOptions, c as style, d as vw, f as FontSubset, g as fontFromUrl, h as collectCodepoints, i as image, l as text, m as GoogleFontsOptions, n as em, o as rem, p as GoogleFontFamily, r as fr, s as rgba, t as container, u as vh, v as subsetFonts, w as defaultMaxFetchBytes, x as FetchedImage, y as FetchLike } from "./index-CP8FH6-0.cjs";
|
|
3
3
|
export { ContainerNode, FetchLike, FetchOptions, FetchedImage, FontSubset, GoogleFontFamily, GoogleFontsOptions, ImageFetchCache, ImageNode, Node, NodeAttributes, NodeMetadata, PrepareImagesOptions, ReactElementLike, TextFit, TextNode, collectCodepoints, container, defaultMaxFetchBytes, em, fetchOk, fontFromUrl, fr, googleFonts, image, percentage, prepareImages, readBodyLimited, rem, rgba, style, subsetFonts, text, vh, vw };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as NodeMetadata, c as TextNode, i as NodeAttributes, n as ImageNode, o as ReactElementLike, r as Node, s as TextFit, t as ContainerNode } from "./types-
|
|
2
|
-
import { C as PrepareImagesOptions, D as readBodyLimited, E as prepareImages, S as ImageFetchCache, T as fetchOk, _ as googleFonts, a as percentage, b as FetchOptions, c as style, d as vw, f as FontSubset, g as fontFromUrl, h as collectCodepoints, i as image, l as text, m as GoogleFontsOptions, n as em, o as rem, p as GoogleFontFamily, r as fr, s as rgba, t as container, u as vh, v as subsetFonts, w as defaultMaxFetchBytes, x as FetchedImage, y as FetchLike } from "./index-
|
|
1
|
+
import { a as NodeMetadata, c as TextNode, i as NodeAttributes, n as ImageNode, o as ReactElementLike, r as Node, s as TextFit, t as ContainerNode } from "./types-C0iOpAlK.mjs";
|
|
2
|
+
import { C as PrepareImagesOptions, D as readBodyLimited, E as prepareImages, S as ImageFetchCache, T as fetchOk, _ as googleFonts, a as percentage, b as FetchOptions, c as style, d as vw, f as FontSubset, g as fontFromUrl, h as collectCodepoints, i as image, l as text, m as GoogleFontsOptions, n as em, o as rem, p as GoogleFontFamily, r as fr, s as rgba, t as container, u as vh, v as subsetFonts, w as defaultMaxFetchBytes, x as FetchedImage, y as FetchLike } from "./index-C7GS_D7H.mjs";
|
|
3
3
|
export { ContainerNode, FetchLike, FetchOptions, FetchedImage, FontSubset, GoogleFontFamily, GoogleFontsOptions, ImageFetchCache, ImageNode, Node, NodeAttributes, NodeMetadata, PrepareImagesOptions, ReactElementLike, TextFit, TextNode, collectCodepoints, container, defaultMaxFetchBytes, em, fetchOk, fontFromUrl, fr, googleFonts, image, percentage, prepareImages, readBodyLimited, rem, rgba, style, subsetFonts, text, vh, vw };
|
package/dist/jsx.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-4kGcvc-Q.cjs"),t=require("./markup-uM2dO3dn.cjs");function n(e){return typeof e==`string`||typeof e==`number`}function
|
|
2
|
-
`,preset:r.presets?.span,...
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-4kGcvc-Q.cjs"),t=require("./markup-uM2dO3dn.cjs");let n;function r(e,t){return typeof e==`object`&&e&&t in e?e[t]:void 0}function i(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function a(e){let t=r(e,`__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE`);if(typeof t==`object`&&t&&`H`in t){let e=t;return{get:()=>e.H,set:t=>{e.H=t}}}let n=r(r(e,`__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED`),`ReactCurrentDispatcher`);if(typeof n==`object`&&n&&`current`in n){let e=n;return{get:()=>e.current,set:t=>{e.current=t}}}return null}function o(){return n??=import(`react`).then(e=>a(e.default??e)).catch(()=>null),n}function s(e,t){return e.contexts.has(t)?e.contexts.get(t):r(t,`_currentValue`)}const c=()=>{};function l(e,t){let n=t=>s(e,t),r=0;return{readContext:n,useContext:n,use:e=>{if(i(e)){if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:e}return n(e)},useState:e=>[typeof e==`function`?e():e,c],useReducer:(e,t,n)=>[n?n(t):t,c],useMemo:e=>e(),useCallback:e=>e,useRef:e=>({current:e}),useEffect:c,useLayoutEffect:c,useInsertionEffect:c,useImperativeHandle:c,useDebugValue:c,useDeferredValue:e=>e,useTransition:()=>[!1,c],useOptimistic:e=>[e,c],useActionState:(e,t)=>[t,c,!1],useSyncExternalStore:(e,t,n)=>(n??t)(),useId:()=>`:t${t}-${r++}:`,useCacheRefresh:()=>c,useHostTransitionStatus:()=>({pending:!1,data:null,method:null,action:null})}}async function u(e,t,n){let r=await o();if(!r)return e(t);let a=n.ids.current++;for(let o=0;;o++){let s=r.get();r.set(l(n,a));let c;try{return e(t)}catch(e){c=e}finally{r.set(s)}if(!i(c)||o>=64)throw c;await d(c)}}async function d(e){try{e.value=await e,e.status=`fulfilled`}catch(t){e.reason=t,e.status=`rejected`}}function f(e){return typeof e==`string`||typeof e==`number`}function p(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function m(e){let n=[];for(let r in e)Object.hasOwn(e,r)&&n.push(`${t.n(r)}:${String(e[r]).trim()}`);return n.join(`;`)}const h=new Set(`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`.split(`.`));function g(e,n){if(e===`children`||n==null)return;let r;if(r=e===`className`?`class`:h.has(e)?t.n(e):e,typeof n==`boolean`)return`${r}="${String(n)}"`;if(e===`style`&&typeof n==`object`){let e=m(n);if(e)return`style="${p(e)}"`}return`${r}="${p(String(n))}"`}function _(e,t,n){let r=!1;for(let n in e){if(!Object.hasOwn(e,n))continue;let i=g(n,e[n]);i!==void 0&&(t.push(` `,i),n===`xmlns`&&(r=!0))}n&&!r&&t.push(` xmlns="http://www.w3.org/2000/svg"`)}const v=(e,n,r)=>{let i=e.props||{};if(t.r(e.type)){y(e.type(e.props),n,!1);return}if(typeof e.type==`symbol`||typeof e.type!=`string`)return;n.push(`<`,e.type),_(i,n,r&&e.type===`svg`);let a=i.children;n.push(`>`),y(a,n,!1),n.push(`</`,e.type,`>`)};function y(e,n,r){if(!(e==null||e===!1)){if(f(e)){n.push(String(e));return}if(Array.isArray(e)){for(let t of e)y(t,n,!1);return}t.l(e)&&v(e,n,r)}}function b(e){let t=[];return y(e,t,!0),t.join(``)}function x(){return{nodes:[],stylesheets:[]}}async function S(n,r){let i=await C(n,{defaultStyles:w(r),presets:t.d(r?.defaultStyles),tailwindClassesProperty:r?.tailwindClassesProperty??`tw`,contexts:new Map,ids:{current:0}}),a=i.nodes,o;return o=a.length===0?e.t({}):a.length===1&&a[0]!==void 0?a[0]:e.t({children:a,style:{width:e.a(100),height:e.a(100)}}),{node:o,stylesheets:i.stylesheets}}async function C(n,r){return n==null||n===!1?x():n instanceof Promise?C(await n,r):typeof n==`object`&&Symbol.iterator in n?X(n,r):t.l(n)?await U(n,r):{nodes:[e.l({text:String(n),preset:r.presets?.span})],stylesheets:[]}}function w(e){return e&&`defaultStyles`in e?e.defaultStyles??t.f:t.f}const T=Symbol.for(`react.context`),E=Symbol.for(`react.provider`),D=Symbol.for(`react.consumer`);function O(e,t){let n=e.type;if(typeof n!=`object`||!n)return;let i=r(n,`$$typeof`);if(i===E)return k(e,r(n,`_context`),t);if(i===D)return j(e,r(n,`_context`)??n,t);if(i===T)return typeof P(e)==`function`?j(e,n,t):k(e,n,t)}function k(e,t,n){let i=new Map(n.contexts);return i.set(t,r(e.props,`value`)),Y(e,{...n,contexts:i})}function A(e){return typeof e==`function`}function j(e,t,n){let r=P(e);return A(r)?C(r(s(n,t)),n):Y(e,n)}async function M(e,t,n){return C(await u(e,t,n),n)}function N(e,n){if(!(typeof e.type!=`object`||e.type===null)){if(t.o(e.type)&&`render`in e.type){let t=e.type;return M(e=>t.render(e,null),e.props,n)}if(t.c(e.type)&&`type`in e.type){let r=e.type.type;return t.r(r)?M(r,e.props,n):U({...e,type:r},n)}}}function P(e){if(typeof e.props==`object`&&e.props!==null&&`children`in e.props)return e.props.children}function F(e){return e.constructor===void 0}let I;function L(){return I??=import(`preact-render-to-string`).then(e=>{for(let t of[e.renderToStaticMarkup,e.renderToString,e.default])if(typeof t==`function`)return t;return null}).catch(()=>null)}async function R(e,n){let r=await L();return r?t.t(r(e),{defaultStyles:n.defaultStyles,tailwindClassesProperty:n.tailwindClassesProperty}):null}function z(e){if(!t.l(e))return;let n=P(e);if(typeof n==`string`)return n;if(typeof n==`number`)return String(n);if(Array.isArray(n)||typeof n==`object`&&n&&Symbol.iterator in n)return H(n);if(t.l(n)&&t.s(n))return z(n)}function B(e){let t=[];for(let n of e){let e=V(n);if(e===void 0)return;t.push(e)}return t.join(``)}function V(e){if(typeof e==`string`)return e;if(typeof e==`number`)return String(e);if(e==null||typeof e==`boolean`||typeof e==`symbol`)return``;if(typeof e==`object`&&Symbol.iterator in e)return B(e);if(!t.l(e))return;if(t.s(e))return V(P(e));let n=P(e);return n===void 0?``:typeof n==`object`&&n&&Symbol.iterator in n?B(n):V(n)}function H(e){let n=[],r=!1;for(let i of e){if(t.l(i))return;if(typeof i==`string`){r=!0,n.push(i);continue}if(typeof i==`number`){r=!0,n.push(String(i));continue}return}if(r)return n.join(``)}async function U(n,r){if(F(n)){let e=await R(n,r);if(e)return e}let i=O(n,r);if(i!==void 0)return i;if(t.r(n.type))return M(n.type,n.props,r);let a=N(n,r);if(a!==void 0)return a;if(t.s(n))return Y(n,r);if(t.i(n,`style`)){let e=V(P(n));return{nodes:[],stylesheets:e&&e.length>0?[e]:[]}}if(typeof n.type!=`string`||t.a(n.type))return x();let o=J(n,r);if(t.i(n,`br`))return{nodes:[e.l({text:`
|
|
2
|
+
`,preset:r.presets?.span,...o})],stylesheets:[]};if(t.i(n,`img`))return{nodes:[W(n,r)],stylesheets:[]};if(t.i(n,`svg`))return{nodes:[G(n,r)],stylesheets:[]};let s=z(n);if(s!==void 0)return{nodes:[e.l({text:s,...o})],stylesheets:[]};let c=await Y(n,r);return{nodes:[e.t({children:c.nodes,...o})],stylesheets:c.stylesheets}}function W(t,n){if(!t.props.src)throw Error(`Image element must have a 'src' prop.`);let r=J(t,n),i=t.props.width===void 0?void 0:Number(t.props.width),a=t.props.height===void 0?void 0:Number(t.props.height);return e.i({src:t.props.src,width:i,height:a,...r})}function G(t,n){let r=J(t,n);return e.i({src:b(t),width:t.props.width===void 0?void 0:Number(t.props.width),height:t.props.height===void 0?void 0:Number(t.props.height),...r})}function K(e,t){let n=t.presets,r=n&&typeof e.type==`string`&&e.type in n?n[e.type]:void 0,i=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(!i)return{preset:r};for(let e in i)if(Object.hasOwn(i,e))return{preset:r,style:i};return{preset:r}}function q(e,t){let n=t.tailwindClassesProperty;if(typeof e.props!=`object`||e.props===null||!(n in e.props))return;let r=e.props[n];if(typeof r==`string`)return r}function J(e,n){let r=e.props,{preset:i,style:a}=K(e,n),o=q(e,n),s=t.u(r,n.tailwindClassesProperty);return{tagName:typeof e.type==`string`?e.type:void 0,className:r.className??r.class,id:r.id,dir:r.dir,lang:r.lang,attributes:s,tw:o,style:a,preset:i}}function Y(e,t){let n=P(e);return n===void 0?Promise.resolve(x()):C(n,t)}async function X(e,t){let n=[],r=new Set,i=0;for(let a of e){let e=i;i+=1;let o=C(a,t).then(t=>{n[e]=t}).finally(()=>r.delete(o));r.add(o),r.size>=8&&await Promise.race(r)}await Promise.all(r);let a=[],o=[];for(let e of n)e&&(a.push(...e.nodes),o.push(...e.stylesheets));return{nodes:a,stylesheets:o}}exports.defaultStylePresets=t.f,exports.fromJsx=S;
|
package/dist/jsx.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as ReactElementLike, r as Node } from "./types-
|
|
1
|
+
import { o as ReactElementLike, r as Node } from "./types-C0iOpAlK.cjs";
|
|
2
2
|
import { CSSProperties, JSX, ReactNode } from "react";
|
|
3
3
|
//#region src/jsx/style-presets.d.ts
|
|
4
4
|
declare const defaultStylePresets: Partial<Record<keyof JSX.IntrinsicElements, CSSProperties>>;
|
package/dist/jsx.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as ReactElementLike, r as Node } from "./types-
|
|
1
|
+
import { o as ReactElementLike, r as Node } from "./types-C0iOpAlK.mjs";
|
|
2
2
|
import { CSSProperties, JSX, ReactNode } from "react";
|
|
3
3
|
//#region src/jsx/style-presets.d.ts
|
|
4
4
|
declare const defaultStylePresets: Partial<Record<keyof JSX.IntrinsicElements, CSSProperties>>;
|
package/dist/jsx.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,i as t,l as n,t as r}from"./helpers-CVQCT1Rh.mjs";import{a as i,c as a,d as o,f as s,i as c,l,n as u,o as d,r as f,s as p,t as m,u as
|
|
2
|
-
`,preset:t.presets?.span,...
|
|
1
|
+
import{a as e,i as t,l as n,t as r}from"./helpers-CVQCT1Rh.mjs";import{a as i,c as a,d as o,f as s,i as c,l,n as u,o as d,r as f,s as p,t as m,u as ee}from"./markup-D58RlLsR.mjs";let h;function g(e,t){return typeof e==`object`&&e&&t in e?e[t]:void 0}function _(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function v(e){let t=g(e,`__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE`);if(typeof t==`object`&&t&&`H`in t){let e=t;return{get:()=>e.H,set:t=>{e.H=t}}}let n=g(g(e,`__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED`),`ReactCurrentDispatcher`);if(typeof n==`object`&&n&&`current`in n){let e=n;return{get:()=>e.current,set:t=>{e.current=t}}}return null}function y(){return h??=import(`react`).then(e=>v(e.default??e)).catch(()=>null),h}function b(e,t){return e.contexts.has(t)?e.contexts.get(t):g(t,`_currentValue`)}const x=()=>{};function S(e,t){let n=t=>b(e,t),r=0;return{readContext:n,useContext:n,use:e=>{if(_(e)){if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:e}return n(e)},useState:e=>[typeof e==`function`?e():e,x],useReducer:(e,t,n)=>[n?n(t):t,x],useMemo:e=>e(),useCallback:e=>e,useRef:e=>({current:e}),useEffect:x,useLayoutEffect:x,useInsertionEffect:x,useImperativeHandle:x,useDebugValue:x,useDeferredValue:e=>e,useTransition:()=>[!1,x],useOptimistic:e=>[e,x],useActionState:(e,t)=>[t,x,!1],useSyncExternalStore:(e,t,n)=>(n??t)(),useId:()=>`:t${t}-${r++}:`,useCacheRefresh:()=>x,useHostTransitionStatus:()=>({pending:!1,data:null,method:null,action:null})}}async function C(e,t,n){let r=await y();if(!r)return e(t);let i=n.ids.current++;for(let a=0;;a++){let o=r.get();r.set(S(n,i));let s;try{return e(t)}catch(e){s=e}finally{r.set(o)}if(!_(s)||a>=64)throw s;await w(s)}}async function w(e){try{e.value=await e,e.status=`fulfilled`}catch(t){e.reason=t,e.status=`rejected`}}function T(e){return typeof e==`string`||typeof e==`number`}function E(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function te(e){let t=[];for(let n in e)Object.hasOwn(e,n)&&t.push(`${u(n)}:${String(e[n]).trim()}`);return t.join(`;`)}const ne=new Set(`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`.split(`.`));function re(e,t){if(e===`children`||t==null)return;let n;if(n=e===`className`?`class`:ne.has(e)?u(e):e,typeof t==`boolean`)return`${n}="${String(t)}"`;if(e===`style`&&typeof t==`object`){let e=te(t);if(e)return`style="${E(e)}"`}return`${n}="${E(String(t))}"`}function ie(e,t,n){let r=!1;for(let n in e){if(!Object.hasOwn(e,n))continue;let i=re(n,e[n]);i!==void 0&&(t.push(` `,i),n===`xmlns`&&(r=!0))}n&&!r&&t.push(` xmlns="http://www.w3.org/2000/svg"`)}const ae=(e,t,n)=>{let r=e.props||{};if(f(e.type)){D(e.type(e.props),t,!1);return}if(typeof e.type==`symbol`||typeof e.type!=`string`)return;t.push(`<`,e.type),ie(r,t,n&&e.type===`svg`);let i=r.children;t.push(`>`),D(i,t,!1),t.push(`</`,e.type,`>`)};function D(e,t,n){if(!(e==null||e===!1)){if(T(e)){t.push(String(e));return}if(Array.isArray(e)){for(let n of e)D(n,t,!1);return}l(e)&&ae(e,t,n)}}function O(e){let t=[];return D(e,t,!0),t.join(``)}function k(){return{nodes:[],stylesheets:[]}}async function A(t,n){let i=await j(t,{defaultStyles:M(n),presets:o(n?.defaultStyles),tailwindClassesProperty:n?.tailwindClassesProperty??`tw`,contexts:new Map,ids:{current:0}}),a=i.nodes,s;return s=a.length===0?r({}):a.length===1&&a[0]!==void 0?a[0]:r({children:a,style:{width:e(100),height:e(100)}}),{node:s,stylesheets:i.stylesheets}}async function j(e,t){return e==null||e===!1?k():e instanceof Promise?j(await e,t):typeof e==`object`&&Symbol.iterator in e?ue(e,t):l(e)?await X(e,t):{nodes:[n({text:String(e),preset:t.presets?.span})],stylesheets:[]}}function M(e){return e&&`defaultStyles`in e?e.defaultStyles??s:s}const N=Symbol.for(`react.context`),P=Symbol.for(`react.provider`),F=Symbol.for(`react.consumer`);function I(e,t){let n=e.type;if(typeof n!=`object`||!n)return;let r=g(n,`$$typeof`);if(r===P)return L(e,g(n,`_context`),t);if(r===F)return z(e,g(n,`_context`)??n,t);if(r===N)return typeof H(e)==`function`?z(e,n,t):L(e,n,t)}function L(e,t,n){let r=new Map(n.contexts);return r.set(t,g(e.props,`value`)),$(e,{...n,contexts:r})}function R(e){return typeof e==`function`}function z(e,t,n){let r=H(e);return R(r)?j(r(b(n,t)),n):$(e,n)}async function B(e,t,n){return j(await C(e,t,n),n)}function V(e,t){if(!(typeof e.type!=`object`||e.type===null)){if(d(e.type)&&`render`in e.type){let n=e.type;return B(e=>n.render(e,null),e.props,t)}if(a(e.type)&&`type`in e.type){let n=e.type.type;return f(n)?B(n,e.props,t):X({...e,type:n},t)}}}function H(e){if(typeof e.props==`object`&&e.props!==null&&`children`in e.props)return e.props.children}function U(e){return e.constructor===void 0}let W;function G(){return W??=import(`preact-render-to-string`).then(e=>{for(let t of[e.renderToStaticMarkup,e.renderToString,e.default])if(typeof t==`function`)return t;return null}).catch(()=>null)}async function K(e,t){let n=await G();return n?m(n(e),{defaultStyles:t.defaultStyles,tailwindClassesProperty:t.tailwindClassesProperty}):null}function q(e){if(!l(e))return;let t=H(e);if(typeof t==`string`)return t;if(typeof t==`number`)return String(t);if(Array.isArray(t)||typeof t==`object`&&t&&Symbol.iterator in t)return oe(t);if(l(t)&&p(t))return q(t)}function J(e){let t=[];for(let n of e){let e=Y(n);if(e===void 0)return;t.push(e)}return t.join(``)}function Y(e){if(typeof e==`string`)return e;if(typeof e==`number`)return String(e);if(e==null||typeof e==`boolean`||typeof e==`symbol`)return``;if(typeof e==`object`&&Symbol.iterator in e)return J(e);if(!l(e))return;if(p(e))return Y(H(e));let t=H(e);return t===void 0?``:typeof t==`object`&&t&&Symbol.iterator in t?J(t):Y(t)}function oe(e){let t=[],n=!1;for(let r of e){if(l(r))return;if(typeof r==`string`){n=!0,t.push(r);continue}if(typeof r==`number`){n=!0,t.push(String(r));continue}return}if(n)return t.join(``)}async function X(e,t){if(U(e)){let n=await K(e,t);if(n)return n}let a=I(e,t);if(a!==void 0)return a;if(f(e.type))return B(e.type,e.props,t);let o=V(e,t);if(o!==void 0)return o;if(p(e))return $(e,t);if(c(e,`style`)){let t=Y(H(e));return{nodes:[],stylesheets:t&&t.length>0?[t]:[]}}if(typeof e.type!=`string`||i(e.type))return k();let s=Q(e,t);if(c(e,`br`))return{nodes:[n({text:`
|
|
2
|
+
`,preset:t.presets?.span,...s})],stylesheets:[]};if(c(e,`img`))return{nodes:[se(e,t)],stylesheets:[]};if(c(e,`svg`))return{nodes:[ce(e,t)],stylesheets:[]};let l=q(e);if(l!==void 0)return{nodes:[n({text:l,...s})],stylesheets:[]};let u=await $(e,t);return{nodes:[r({children:u.nodes,...s})],stylesheets:u.stylesheets}}function se(e,n){if(!e.props.src)throw Error(`Image element must have a 'src' prop.`);let r=Q(e,n),i=e.props.width===void 0?void 0:Number(e.props.width),a=e.props.height===void 0?void 0:Number(e.props.height);return t({src:e.props.src,width:i,height:a,...r})}function ce(e,n){let r=Q(e,n);return t({src:O(e),width:e.props.width===void 0?void 0:Number(e.props.width),height:e.props.height===void 0?void 0:Number(e.props.height),...r})}function Z(e,t){let n=t.presets,r=n&&typeof e.type==`string`&&e.type in n?n[e.type]:void 0,i=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(!i)return{preset:r};for(let e in i)if(Object.hasOwn(i,e))return{preset:r,style:i};return{preset:r}}function le(e,t){let n=t.tailwindClassesProperty;if(typeof e.props!=`object`||e.props===null||!(n in e.props))return;let r=e.props[n];if(typeof r==`string`)return r}function Q(e,t){let n=e.props,{preset:r,style:i}=Z(e,t),a=le(e,t),o=ee(n,t.tailwindClassesProperty);return{tagName:typeof e.type==`string`?e.type:void 0,className:n.className??n.class,id:n.id,dir:n.dir,lang:n.lang,attributes:o,tw:a,style:i,preset:r}}function $(e,t){let n=H(e);return n===void 0?Promise.resolve(k()):j(n,t)}async function ue(e,t){let n=[],r=new Set,i=0;for(let a of e){let e=i;i+=1;let o=j(a,t).then(t=>{n[e]=t}).finally(()=>r.delete(o));r.add(o),r.size>=8&&await Promise.race(r)}await Promise.all(r);let a=[],o=[];for(let e of n)e&&(a.push(...e.nodes),o.push(...e.stylesheets));return{nodes:a,stylesheets:o}}export{s as defaultStylePresets,A as fromJsx};
|
package/dist/renderer.d.cts
CHANGED
package/dist/renderer.d.mts
CHANGED
|
@@ -12,8 +12,12 @@ declare module "react" {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
type NodeAttributes = Record<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* A JSX element from any React-shaped runtime; Preact vnodes fit too, so
|
|
17
|
+
* `fromJsx` and the render inputs accept them without casts.
|
|
18
|
+
*/
|
|
15
19
|
type ReactElementLike = {
|
|
16
|
-
type: string | symbol | ((props: unknown) =>
|
|
20
|
+
type: string | symbol | ((props: never) => unknown) | (new (props: never) => unknown) | ReactElementLike;
|
|
17
21
|
props: unknown;
|
|
18
22
|
$$typeof?: symbol;
|
|
19
23
|
};
|
|
@@ -12,8 +12,12 @@ declare module "react" {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
type NodeAttributes = Record<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* A JSX element from any React-shaped runtime; Preact vnodes fit too, so
|
|
17
|
+
* `fromJsx` and the render inputs accept them without casts.
|
|
18
|
+
*/
|
|
15
19
|
type ReactElementLike = {
|
|
16
|
-
type: string | symbol | ((props: unknown) =>
|
|
20
|
+
type: string | symbol | ((props: never) => unknown) | (new (props: never) => unknown) | ReactElementLike;
|
|
17
21
|
props: unknown;
|
|
18
22
|
$$typeof?: symbol;
|
|
19
23
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takumi-rs/helpers",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Utility helpers for converting JSX/HTML to Takumi node trees, loading fonts, and processing emoji.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -99,6 +99,8 @@
|
|
|
99
99
|
"@types/react": "19.2.17",
|
|
100
100
|
"@types/react-dom": "^19.2.3",
|
|
101
101
|
"lucide-react": "^1.24.0",
|
|
102
|
+
"preact": "^10.28.2",
|
|
103
|
+
"preact-render-to-string": "^6.6.4",
|
|
102
104
|
"react": "^19.2.7",
|
|
103
105
|
"react-dom": "^19.2.7",
|
|
104
106
|
"tsdown": "^0.22.4",
|
|
@@ -106,11 +108,15 @@
|
|
|
106
108
|
"unrun": "^0.3.1"
|
|
107
109
|
},
|
|
108
110
|
"peerDependencies": {
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
+
"preact": "^10.0.0",
|
|
112
|
+
"preact-render-to-string": "^6.0.0",
|
|
113
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
111
114
|
},
|
|
112
115
|
"peerDependenciesMeta": {
|
|
113
|
-
"
|
|
116
|
+
"preact": {
|
|
117
|
+
"optional": true
|
|
118
|
+
},
|
|
119
|
+
"preact-render-to-string": {
|
|
114
120
|
"optional": true
|
|
115
121
|
},
|
|
116
122
|
"react": {
|