@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 CHANGED
@@ -1,4 +1,4 @@
1
- import { r as Node } from "./types-BZASl6ra.cjs";
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-BZASl6ra.mjs";
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
@@ -1,5 +1,5 @@
1
- import { r as Node } from "./types-BZASl6ra.cjs";
2
- import "./index-22uld-QT.cjs";
1
+ import { r as Node } from "./types-C0iOpAlK.cjs";
2
+ import "./index-CP8FH6-0.cjs";
3
3
  //#region src/html/index.d.ts
4
4
  declare function fromHtml(html: string): {
5
5
  node: Node;
package/dist/html.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { r as Node } from "./types-BZASl6ra.mjs";
2
- import "./index-DQecrVB5.mjs";
1
+ import { r as Node } from "./types-C0iOpAlK.mjs";
2
+ import "./index-C7GS_D7H.mjs";
3
3
  //#region src/html/index.d.ts
4
4
  declare function fromHtml(html: string): {
5
5
  node: Node;
@@ -1,4 +1,4 @@
1
- import { c as TextNode, n as ImageNode, r as Node, t as ContainerNode } from "./types-BZASl6ra.cjs";
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-BZASl6ra.mjs";
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-BZASl6ra.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-22uld-QT.cjs";
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-BZASl6ra.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-DQecrVB5.mjs";
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 r(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function i(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 a=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 o(e,n){if(e===`children`||n==null)return;let o;if(o=e===`className`?`class`:a.has(e)?t.n(e):e,typeof n==`boolean`)return`${o}="${String(n)}"`;if(e===`style`&&typeof n==`object`){let e=i(n);if(e)return`style="${r(e)}"`}return`${o}="${r(String(n))}"`}function s(e,t,n){let r=!1;for(let n in e){if(!Object.hasOwn(e,n))continue;let i=o(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 c=(e,n,r)=>{let i=e.props||{};if(t.r(e.type)){l(e.type(e.props),n,!1);return}if(typeof e.type==`symbol`||typeof e.type!=`string`)return;n.push(`<`,e.type),s(i,n,r&&e.type===`svg`);let a=i.children;n.push(`>`),l(a,n,!1),n.push(`</`,e.type,`>`)};function l(e,r,i){if(!(e==null||e===!1)){if(n(e)){r.push(String(e));return}if(Array.isArray(e)){for(let t of e)l(t,r,!1);return}t.l(e)&&c(e,r,i)}}function u(e){let t=[];return l(e,t,!0),t.join(``)}function d(){return{nodes:[],stylesheets:[]}}const f=[/Invalid hook call\./,/Cannot read properties of null \(reading 'use[A-Z][A-Za-z]+'\)/,/null is not an object \(evaluating 'dispatcher\.use[A-Z][A-Za-z]+'\)/];let p,m;async function h(n,r){let i={defaultStyles:_(r),presets:t.d(r?.defaultStyles),tailwindClassesProperty:r?.tailwindClassesProperty??`tw`},a=await g(n,i).catch(async e=>{if(!y(e))throw e;return await O(n,i)||g(n,i)}),o=a.nodes,s;return s=o.length===0?e.t({}):o.length===1&&o[0]!==void 0?o[0]:e.t({children:o,style:{width:e.a(100),height:e.a(100)}}),{node:s,stylesheets:a.stylesheets}}async function g(n,r){return n==null||n===!1?d():n instanceof Promise?g(await n,r):typeof n==`object`&&Symbol.iterator in n?B(n,r):t.l(n)?await N(n,r):{nodes:[e.l({text:String(n),preset:r.presets?.span})],stylesheets:[]}}function _(e){return e&&`defaultStyles`in e?e.defaultStyles??t.f:t.f}function v(e){return!t.l(e)||typeof e.type!=`object`||e.type===null||!(`$$typeof`in e.type)?!1:e.type.$$typeof===Symbol.for(`react.context`)||e.type.$$typeof===Symbol.for(`react.provider`)}function y(e){return e instanceof Error&&f.some(t=>t.test(e.message))}async function b(e){let t=console.error;console.error=(...e)=>{let[n]=e;typeof n==`string`&&f.some(e=>e.test(n))||t(...e)};try{return await e()}finally{console.error=t}}async function x(e,t,n){return b(()=>g(e(t),n))}function S(e,n){if(!(typeof e.type!=`object`||e.type===null)){if(t.o(e.type)&&`render`in e.type){let t=e.type;return x(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)?x(r,e.props,n):N({...e,type:r},n)}}}function C(e){if(typeof e.props==`object`&&e.props!==null&&`children`in e.props)return e.props.children}function w(e){return typeof e==`object`&&!!e&&`createElement`in e&&typeof e.createElement==`function`}function T(e){return typeof e==`object`&&!!e&&`renderToStaticMarkup`in e&&typeof e.renderToStaticMarkup==`function`}async function E(){return m??=import(`react`).then(e=>{let t=e.default??e;return w(t)?t:null}).catch(()=>null),m}async function D(){return p??=import(`react-dom/server`).then(e=>{let t=e.default??e;return T(t)?t:null}).catch(()=>null),p}async function O(e,n){let[r,i]=await Promise.all([E(),D()]);return!r||!i?null:t.t(i.renderToStaticMarkup(r.createElement(r.Fragment??void 0,null,e)),{defaultStyles:n.defaultStyles,tailwindClassesProperty:n.tailwindClassesProperty})}function k(e){if(!t.l(e))return;let n=C(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 M(n);if(t.l(n)&&t.s(n))return k(n)}function A(e){let t=[];for(let n of e){let e=j(n);if(e===void 0)return;t.push(e)}return t.join(``)}function j(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 A(e);if(!t.l(e))return;if(t.s(e))return j(C(e));let n=C(e);return n===void 0?``:typeof n==`object`&&n&&Symbol.iterator in n?A(n):j(n)}function M(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 N(n,r){if(v(n))return await O(n,r)||z(n,r);if(t.r(n.type))return x(n.type,n.props,r);let i=S(n,r);if(i!==void 0)return i;if(t.s(n))return z(n,r);if(t.i(n,`style`)){let e=j(C(n));return{nodes:[],stylesheets:e&&e.length>0?[e]:[]}}if(typeof n.type!=`string`||t.a(n.type))return d();let a=R(n,r);if(t.i(n,`br`))return{nodes:[e.l({text:`
2
- `,preset:r.presets?.span,...a})],stylesheets:[]};if(t.i(n,`img`))return{nodes:[P(n,r)],stylesheets:[]};if(t.i(n,`svg`))return{nodes:[F(n,r)],stylesheets:[]};let o=k(n);if(o!==void 0)return{nodes:[e.l({text:o,...a})],stylesheets:[]};let s=await z(n,r);return{nodes:[e.t({children:s.nodes,...a})],stylesheets:s.stylesheets}}function P(t,n){if(!t.props.src)throw Error(`Image element must have a 'src' prop.`);let r=R(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 F(t,n){let r=R(t,n);return e.i({src:u(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 I(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 L(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 R(e,n){let r=e.props,{preset:i,style:a}=I(e,n),o=L(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 z(e,t){let n=C(e);return n===void 0?Promise.resolve(d()):g(n,t)}async function B(e,t){let n=[],r=new Set,i=0;for(let a of e){let e=i;i+=1;let o=g(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=h;
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,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}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-BZASl6ra.cjs";
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-BZASl6ra.mjs";
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 h}from"./markup-D58RlLsR.mjs";function g(e){return typeof e==`string`||typeof e==`number`}function _(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function v(e){let t=[];for(let n in e)Object.hasOwn(e,n)&&t.push(`${u(n)}:${String(e[n]).trim()}`);return t.join(`;`)}const y=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 b(e,t){if(e===`children`||t==null)return;let n;if(n=e===`className`?`class`:y.has(e)?u(e):e,typeof t==`boolean`)return`${n}="${String(t)}"`;if(e===`style`&&typeof t==`object`){let e=v(t);if(e)return`style="${_(e)}"`}return`${n}="${_(String(t))}"`}function x(e,t,n){let r=!1;for(let n in e){if(!Object.hasOwn(e,n))continue;let i=b(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 S=(e,t,n)=>{let r=e.props||{};if(f(e.type)){C(e.type(e.props),t,!1);return}if(typeof e.type==`symbol`||typeof e.type!=`string`)return;t.push(`<`,e.type),x(r,t,n&&e.type===`svg`);let i=r.children;t.push(`>`),C(i,t,!1),t.push(`</`,e.type,`>`)};function C(e,t,n){if(!(e==null||e===!1)){if(g(e)){t.push(String(e));return}if(Array.isArray(e)){for(let n of e)C(n,t,!1);return}l(e)&&S(e,t,n)}}function w(e){let t=[];return C(e,t,!0),t.join(``)}function T(){return{nodes:[],stylesheets:[]}}const E=[/Invalid hook call\./,/Cannot read properties of null \(reading 'use[A-Z][A-Za-z]+'\)/,/null is not an object \(evaluating 'dispatcher\.use[A-Z][A-Za-z]+'\)/];let D,O;async function k(t,n){let i={defaultStyles:j(n),presets:o(n?.defaultStyles),tailwindClassesProperty:n?.tailwindClassesProperty??`tw`},a=await A(t,i).catch(async e=>{if(!N(e))throw e;return await H(t,i)||A(t,i)}),s=a.nodes,c;return c=s.length===0?r({}):s.length===1&&s[0]!==void 0?s[0]:r({children:s,style:{width:e(100),height:e(100)}}),{node:c,stylesheets:a.stylesheets}}async function A(e,t){return e==null||e===!1?T():e instanceof Promise?A(await e,t):typeof e==`object`&&Symbol.iterator in e?ee(e,t):l(e)?await q(e,t):{nodes:[n({text:String(e),preset:t.presets?.span})],stylesheets:[]}}function j(e){return e&&`defaultStyles`in e?e.defaultStyles??s:s}function M(e){return!l(e)||typeof e.type!=`object`||e.type===null||!(`$$typeof`in e.type)?!1:e.type.$$typeof===Symbol.for(`react.context`)||e.type.$$typeof===Symbol.for(`react.provider`)}function N(e){return e instanceof Error&&E.some(t=>t.test(e.message))}async function P(e){let t=console.error;console.error=(...e)=>{let[n]=e;typeof n==`string`&&E.some(e=>e.test(n))||t(...e)};try{return await e()}finally{console.error=t}}async function F(e,t,n){return P(()=>A(e(t),n))}function I(e,t){if(!(typeof e.type!=`object`||e.type===null)){if(d(e.type)&&`render`in e.type){let n=e.type;return F(e=>n.render(e,null),e.props,t)}if(a(e.type)&&`type`in e.type){let n=e.type.type;return f(n)?F(n,e.props,t):q({...e,type:n},t)}}}function L(e){if(typeof e.props==`object`&&e.props!==null&&`children`in e.props)return e.props.children}function R(e){return typeof e==`object`&&!!e&&`createElement`in e&&typeof e.createElement==`function`}function z(e){return typeof e==`object`&&!!e&&`renderToStaticMarkup`in e&&typeof e.renderToStaticMarkup==`function`}async function B(){return O??=import(`react`).then(e=>{let t=e.default??e;return R(t)?t:null}).catch(()=>null),O}async function V(){return D??=import(`react-dom/server`).then(e=>{let t=e.default??e;return z(t)?t:null}).catch(()=>null),D}async function H(e,t){let[n,r]=await Promise.all([B(),V()]);return!n||!r?null:m(r.renderToStaticMarkup(n.createElement(n.Fragment??void 0,null,e)),{defaultStyles:t.defaultStyles,tailwindClassesProperty:t.tailwindClassesProperty})}function U(e){if(!l(e))return;let t=L(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 K(t);if(l(t)&&p(t))return U(t)}function W(e){let t=[];for(let n of e){let e=G(n);if(e===void 0)return;t.push(e)}return t.join(``)}function G(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 W(e);if(!l(e))return;if(p(e))return G(L(e));let t=L(e);return t===void 0?``:typeof t==`object`&&t&&Symbol.iterator in t?W(t):G(t)}function K(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 q(e,t){if(M(e))return await H(e,t)||$(e,t);if(f(e.type))return F(e.type,e.props,t);let a=I(e,t);if(a!==void 0)return a;if(p(e))return $(e,t);if(c(e,`style`)){let t=G(L(e));return{nodes:[],stylesheets:t&&t.length>0?[t]:[]}}if(typeof e.type!=`string`||i(e.type))return T();let o=Q(e,t);if(c(e,`br`))return{nodes:[n({text:`
2
- `,preset:t.presets?.span,...o})],stylesheets:[]};if(c(e,`img`))return{nodes:[J(e,t)],stylesheets:[]};if(c(e,`svg`))return{nodes:[Y(e,t)],stylesheets:[]};let s=U(e);if(s!==void 0)return{nodes:[n({text:s,...o})],stylesheets:[]};let l=await $(e,t);return{nodes:[r({children:l.nodes,...o})],stylesheets:l.stylesheets}}function J(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 Y(e,n){let r=Q(e,n);return t({src:w(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 X(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 Z(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}=X(e,t),a=Z(e,t),o=h(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=L(e);return n===void 0?Promise.resolve(T()):A(n,t)}async function ee(e,t){let n=[],r=new Set,i=0;for(let a of e){let e=i;i+=1;let o=A(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,k as fromJsx};
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,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}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};
@@ -1,4 +1,4 @@
1
- import { r as Node } from "./types-BZASl6ra.cjs";
1
+ import { r as Node } from "./types-C0iOpAlK.cjs";
2
2
  //#region src/renderer.d.ts
3
3
  /**
4
4
  * Shared wrapper primitives for the `@takumi-rs/core` (napi) and `@takumi-rs/wasm` renderer
@@ -1,4 +1,4 @@
1
- import { r as Node } from "./types-BZASl6ra.mjs";
1
+ import { r as Node } from "./types-C0iOpAlK.mjs";
2
2
  //#region src/renderer.d.ts
3
3
  /**
4
4
  * Shared wrapper primitives for the `@takumi-rs/core` (napi) and `@takumi-rs/wasm` renderer
@@ -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) => ReactElementLike) | ReactElementLike;
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) => ReactElementLike) | ReactElementLike;
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",
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
- "react": "^18.0.0 || ^19.0.0",
110
- "react-dom": "^18.0.0 || ^19.0.0"
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
- "react-dom": {
116
+ "preact": {
117
+ "optional": true
118
+ },
119
+ "preact-render-to-string": {
114
120
  "optional": true
115
121
  },
116
122
  "react": {