initial commit

This commit is contained in:
Zoe
2023-01-03 09:29:04 -06:00
commit 7851137d88
12889 changed files with 2557443 additions and 0 deletions

70
node_modules/ultrahtml/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,70 @@
export declare type Node = DocumentNode | ElementNode | TextNode | CommentNode | DoctypeNode;
export declare type NodeType = typeof DOCUMENT_NODE | typeof ELEMENT_NODE | typeof TEXT_NODE | typeof COMMENT_NODE | typeof DOCTYPE_NODE;
export interface Location {
start: number;
end: number;
}
interface BaseNode {
type: NodeType;
loc: [Location, Location];
parent: Node;
[key: string]: any;
}
interface LiteralNode extends BaseNode {
value: string;
}
interface ParentNode extends BaseNode {
children: Node[];
}
export interface DocumentNode extends Omit<ParentNode, "parent"> {
type: typeof DOCUMENT_NODE;
attributes: Record<string, string>;
parent: undefined;
}
export interface ElementNode extends ParentNode {
type: typeof ELEMENT_NODE;
name: string;
attributes: Record<string, string>;
}
export interface TextNode extends LiteralNode {
type: typeof TEXT_NODE;
}
export interface CommentNode extends LiteralNode {
type: typeof COMMENT_NODE;
}
export interface DoctypeNode extends LiteralNode {
type: typeof DOCTYPE_NODE;
}
export declare const DOCUMENT_NODE = 0;
export declare const ELEMENT_NODE = 1;
export declare const TEXT_NODE = 2;
export declare const COMMENT_NODE = 3;
export declare const DOCTYPE_NODE = 4;
export declare function h(type: any, props?: null | Record<string, any>, ...children: any[]): ElementNode;
export declare const Fragment: unique symbol;
export declare function parse(input: string | ReturnType<typeof html>): any;
export interface Visitor {
(node: Node, parent?: Node, index?: number): void | Promise<void>;
}
export interface VisitorSync {
(node: Node, parent?: Node, index?: number): void;
}
export declare const RenderFn: unique symbol;
export declare function __unsafeHTML(str: string): {
value: string;
};
export declare function __unsafeRenderFn(node: ElementNode, fn: (props: Record<string, any>, ...children: Node[]) => Node): ElementNode;
export declare function attrs(attributes: Record<string, string>): {
value: string;
};
export declare function html(tmpl: TemplateStringsArray, ...vals: any[]): {
value: string;
};
export declare function walk(node: Node, callback: Visitor): Promise<void>;
export declare function walkSync(node: Node, callback: VisitorSync): void;
export declare function render(node: Node): Promise<string>;
export interface Transformer {
(node: Node): Node | Promise<Node>;
}
export declare function transform(markup: string | Node, transformers?: Transformer[]): Promise<string>;
export {};

1
node_modules/ultrahtml/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
var A=0,L=1,R=2,k=3,$=4;function X(t,n={},...o){let r={type:1,name:typeof t=="function"?t.name:t,attributes:n||{},children:o.map(e=>typeof e=="string"?{type:2,value:O(String(e))}:e),parent:void 0,loc:[]};return typeof t=="function"&&w(r,t),r}var S=Symbol("Fragment"),_=new Set(["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),g=new Set(["script","style"]),v=/([\@\.a-z0-9_\:\-]*)\s*?=?\s*?(['"]?)([\s\S]*?)\2\s+/gim,i=/(?:<(\/?)([a-zA-Z][a-zA-Z0-9\:-]*)(?:\s([^>]*?))?((?:\s*\/)?)>|(<\!\-\-)([\s\S]*?)(\-\->)|(<\!)([\s\S]*?)(>))/gm;function M(t){let n={},o;if(t)for(v.lastIndex=0,t=" "+(t||"")+" ";o=v.exec(t);)o[0]!==" "&&(n[o[1]]=o[3]);return n}function P(t){let n=typeof t=="string"?t:t.value,o,r,e,s,l,d,N,E,a,c=[];i.lastIndex=0,r=o={type:0,children:[]};let u=0;function y(){s=n.substring(u,i.lastIndex-e[0].length),s&&r.children.push({type:2,value:s,parent:r})}for(;e=i.exec(n);){if(d=e[5]||e[8],N=e[6]||e[9],E=e[7]||e[10],g.has(r.name)&&e[2]!==r.name){l=i.lastIndex-e[0].length,r.children.length>0&&(r.children[0].value+=e[0]);continue}else if(d==="<!--"){if(l=i.lastIndex-e[0].length,g.has(r.name))continue;a={type:3,value:N,parent:r,loc:[{start:l,end:l+d.length},{start:i.lastIndex-E.length,end:i.lastIndex}]},c.push(a),a.parent.children.push(a)}else if(d==="<!")l=i.lastIndex-e[0].length,a={type:4,value:N,parent:r,loc:[{start:l,end:l+d.length},{start:i.lastIndex-E.length,end:i.lastIndex}]},c.push(a),a.parent.children.push(a);else if(e[1]!=="/")if(y(),g.has(r.name)){u=i.lastIndex,y();continue}else a={type:1,name:e[2]+"",attributes:M(e[3]),parent:r,children:[],loc:[{start:i.lastIndex-e[0].length,end:i.lastIndex}]},c.push(a),a.parent.children.push(a),e[4]&&e[4].indexOf("/")>-1||_.has(a.name)?(a.loc[1]=a.loc[0],a.isSelfClosingTag=!0):r=a;else y(),e[2]+""===r.name?(a=r,r=a.parent,a.loc.push({start:i.lastIndex-e[0].length,end:i.lastIndex}),s=n.substring(a.loc[0].end,a.loc[1].start),a.children.length===0&&a.children.push({type:2,value:s,parent:r})):e[2]+""===c[c.length-1].name&&c[c.length-1].isSelfClosingTag===!0&&(a=c[c.length-1],a.loc.push({start:i.lastIndex-e[0].length,end:i.lastIndex}));u=i.lastIndex}return s=n.slice(u),r.children.push({type:2,value:s,parent:r}),o}var h=class{constructor(n){this.callback=n}async visit(n,o,r){if(await this.callback(n,o,r),Array.isArray(n.children)){let e=[];for(let s=0;s<n.children.length;s++){let l=n.children[s];e.push(this.visit(l,n,s))}await Promise.all(e)}}},m=class{constructor(n){this.callback=n}visit(n,o,r){if(this.callback(n,o,r),Array.isArray(n.children))for(let e=0;e<n.children.length;e++){let s=n.children[e];this.visit(s,n,e)}}},p=Symbol("HTMLString"),b=Symbol("AttrString"),x=Symbol("RenderFn");function f(t,n=[p]){let o={value:t};for(let r of n)Object.defineProperty(o,r,{value:!0,enumerable:!1,writable:!1});return o}function j(t){return f(t)}function w(t,n){return Object.defineProperty(t,x,{value:n,enumerable:!1}),t}var I={"&":"&amp;","<":"&lt;",">":"&gt;"};function O(t){return t.replace(/[&<>]/g,n=>I[n]||n)}function T(t){let n="";for(let[o,r]of Object.entries(t))n+=` ${o}="${r}"`;return f(n,[p,b])}function V(t,...n){let o="";for(let r=0;r<t.length;r++){o+=t[r];let e=n[r];o.endsWith("...")&&e&&typeof e=="object"?(o=o.slice(0,-3).trimEnd(),o+=T(e).value):e&&e[b]?(o=o.trimEnd(),o+=e.value):e&&e[p]?o+=e.value:typeof e=="string"?o+=O(e):(e||e===0)&&(o+=String(e))}return f(o)}function F(t,n){return new h(n).visit(t)}function H(t,n){return new m(n).visit(t)}async function C(t){let{name:n,attributes:o={}}=t,r=await Promise.all(t.children.map(e=>D(e))).then(e=>e.join(""));if(x in t){let e=await t[x](o,f(r));return e&&e[p]?e.value:O(String(e))}return n===S?r:_.has(n)?`<${t.name}${T(o).value}>`:`<${t.name}${T(o).value}>${r}</${t.name}>`}async function D(t){switch(t.type){case 0:return Promise.all(t.children.map(n=>D(n))).then(n=>n.join(""));case 1:return C(t);case 2:return`${t.value}`;case 3:return`<!--${t.value}-->`;case 4:return`<!${t.value}>`}}async function U(t,n=[]){if(!Array.isArray(n))throw new Error(`Invalid second argument for \`transform\`! Expected \`Transformer[]\` but got \`${typeof n}\``);let r=typeof t=="string"?P(t):t;for(let e of n)r=await e(r);return D(r)}export{k as COMMENT_NODE,$ as DOCTYPE_NODE,A as DOCUMENT_NODE,L as ELEMENT_NODE,S as Fragment,x as RenderFn,R as TEXT_NODE,j as __unsafeHTML,w as __unsafeRenderFn,T as attrs,X as h,V as html,P as parse,D as render,U as transform,F as walk,H as walkSync};

7
node_modules/ultrahtml/dist/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

4
node_modules/ultrahtml/dist/jsx-runtime/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import { ElementNode } from "../index.js";
import { Fragment } from "../index.js";
declare function createVNode(type: any, { children, ...attributes }: Record<string, any>, key: string, __self: string, __source: string): ElementNode;
export { createVNode as jsx, createVNode as jsxs, createVNode as jsxDEV, Fragment, };

1
node_modules/ultrahtml/dist/jsx-runtime/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
import{TEXT_NODE as a}from"../index.js";import{ELEMENT_NODE as s,Fragment as d,__unsafeRenderFn as f}from"../index.js";function g(n,{children:e,...o},i,m,u){let t={type:s,name:typeof n=="function"?n.name:n,attributes:o,children:(Array.isArray(e)?e:[e]).map(r=>typeof r=="string"?{type:a,value:r}:r),parent:void 0,loc:[]};return typeof n=="function"&&f(t,n),t}export{d as Fragment,g as jsx,g as jsxDEV,g as jsxs};

7
node_modules/ultrahtml/dist/jsx-runtime/index.js.map generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../src/jsx-runtime/index.ts"],
"sourcesContent": ["import { ElementNode, Node, TEXT_NODE } from \"../index.js\";\nimport { ELEMENT_NODE, Fragment, __unsafeRenderFn } from \"../index.js\";\n\nfunction createVNode(\n type: any,\n { children, ...attributes }: Record<string, any>,\n key: string,\n __self: string,\n __source: string\n) {\n const vnode: ElementNode = {\n type: ELEMENT_NODE,\n name: typeof type === \"function\" ? type.name : type,\n attributes,\n children: (Array.isArray(children) ? children : [children]).map((child) => {\n if (typeof child === \"string\") {\n return {\n type: TEXT_NODE,\n value: child,\n };\n }\n return child;\n }),\n parent: undefined as any,\n loc: [] as any,\n };\n\n if (typeof type === \"function\") {\n __unsafeRenderFn(vnode, type);\n }\n\n return vnode;\n}\n\nexport {\n createVNode as jsx,\n createVNode as jsxs,\n createVNode as jsxDEV,\n Fragment,\n};\n"],
"mappings": "AAAA,OAA4B,aAAAA,MAAiB,cAC7C,OAAS,gBAAAC,EAAc,YAAAC,EAAU,oBAAAC,MAAwB,cAEzD,SAASC,EACPC,EACA,CAAE,SAAAC,KAAaC,CAAW,EAC1BC,EACAC,EACAC,EACA,CACA,IAAMC,EAAqB,CACzB,KAAMV,EACN,KAAM,OAAOI,GAAS,WAAaA,EAAK,KAAOA,EAC/C,WAAAE,EACA,UAAW,MAAM,QAAQD,CAAQ,EAAIA,EAAW,CAACA,CAAQ,GAAG,IAAKM,GAC3D,OAAOA,GAAU,SACZ,CACL,KAAMZ,EACN,MAAOY,CACT,EAEKA,CACR,EACD,OAAQ,OACR,IAAK,CAAC,CACR,EAEA,OAAI,OAAOP,GAAS,YAClBF,EAAiBQ,EAAON,CAAI,EAGvBM,CACT",
"names": ["TEXT_NODE", "ELEMENT_NODE", "Fragment", "__unsafeRenderFn", "createVNode", "type", "children", "attributes", "key", "__self", "__source", "vnode", "child"]
}

6
node_modules/ultrahtml/dist/selector.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import type { Node } from './index.js';
export declare function specificity(selector: string): number;
export declare function matches(node: Node, selector: string): boolean;
export declare function querySelector(node: Node, selector: string): Node;
export declare function querySelectorAll(node: Node, selector: string): Node[];
export default querySelectorAll;

1
node_modules/ultrahtml/dist/selector.js generated vendored Normal file

File diff suppressed because one or more lines are too long

7
node_modules/ultrahtml/dist/selector.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

6
node_modules/ultrahtml/dist/transformers/inline.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import { Node } from "../index.js";
export interface InlineOptions {
/** Emit `style` attributes as objects rather than strings. */
useObjectSyntax?: boolean;
}
export default function inline(opts?: InlineOptions): (doc: Node) => Node;

2
node_modules/ultrahtml/dist/transformers/inline.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import{walkSync as ue,ELEMENT_NODE as le,TEXT_NODE as xe}from"../index.js";import{querySelectorAll as me,specificity as fe}from"../selector.js";var Y="comm",q="rule",B="decl";var G=Math.abs,C=String.fromCharCode;function D(e){return e.trim()}function P(e,r,a){return e.replace(r,a)}function X(e,r){return e.indexOf(r)}function M(e,r){return e.charCodeAt(r)|0}function A(e,r,a){return e.slice(r,a)}function O(e){return e.length}function Z(e){return e.length}function R(e,r){return r.push(e),e}var _=1,S=1,J=0,h=0,c=0,j="";function z(e,r,a,p,u,E,w){return{value:e,root:r,parent:a,type:p,props:u,children:E,line:_,column:S,length:w,return:""}}function Q(){return c}function ee(){return c=h>0?M(j,--h):0,S--,c===10&&(S=1,_--),c}function d(){return c=h<J?M(j,h++):0,S++,c===10&&(S=1,_++),c}function T(){return M(j,h)}function I(){return h}function F(e,r){return A(j,e,r)}function H(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function re(e){return _=S=1,J=O(j=e),h=0,[]}function te(e){return j="",e}function $(e){return D(F(h-1,K(e===91?e+2:e===40?e+1:e)))}function ne(e){for(;(c=T())&&c<33;)d();return H(e)>2||H(c)>3?"":" "}function oe(e,r){for(;--r&&d()&&!(c<48||c>102||c>57&&c<65||c>70&&c<97););return F(e,I()+(r<6&&T()==32&&d()==32))}function K(e){for(;d();)switch(c){case e:return h;case 34:case 39:e!==34&&e!==39&&K(c);break;case 40:e===41&&K(e);break;case 92:d();break}return h}function ae(e,r){for(;d()&&e+c!==47+10;)if(e+c===42+42&&T()===47)break;return"/*"+F(r,h-1)+"*"+C(e===47?e:d())}function ce(e){for(;!H(T());)d();return F(e,h)}function V(e){return te(W("",null,null,null,[""],e=re(e),0,[0],e))}function W(e,r,a,p,u,E,w,m,k){for(var n=0,f=0,t=w,s=0,i=0,l=0,b=1,L=1,v=1,x=0,N="",U=u,y=E,g=p,o=N;L;)switch(l=x,x=d()){case 40:if(l!=108&&M(o,t-1)==58){X(o+=P($(x),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:o+=$(x);break;case 9:case 10:case 13:case 32:o+=ne(l);break;case 92:o+=oe(I()-1,7);continue;case 47:switch(T()){case 42:case 47:R(pe(ae(d(),I()),r,a),k);break;default:o+="/"}break;case 123*b:m[n++]=O(o)*v;case 125*b:case 59:case 0:switch(x){case 0:case 125:L=0;case 59+f:i>0&&O(o)-t&&R(i>32?ie(o+";",p,a,t-1):ie(P(o," ","")+";",p,a,t-2),k);break;case 59:o+=";";default:if(R(g=se(o,r,a,n,f,u,m,N,U=[],y=[],t),E),x===123)if(f===0)W(o,r,g,g,U,E,t,m,y);else switch(s){case 100:case 109:case 115:W(e,g,g,p&&R(se(e,g,g,0,0,u,m,N,u,U=[],t),y),u,y,t,m,p?U:y);break;default:W(o,g,g,g,[""],y,0,m,y)}}n=f=i=0,b=v=1,N=o="",t=w;break;case 58:t=1+O(o),i=l;default:if(b<1){if(x==123)--b;else if(x==125&&b++==0&&ee()==125)continue}switch(o+=C(x),x*b){case 38:v=f>0?1:(o+="\f",-1);break;case 44:m[n++]=(O(o)-1)*v,v=1;break;case 64:T()===45&&(o+=$(d())),s=T(),f=t=O(N=o+=ce(I())),x++;break;case 45:l===45&&O(o)==2&&(b=0)}}return E}function se(e,r,a,p,u,E,w,m,k,n,f){for(var t=u-1,s=u===0?E:[""],i=Z(s),l=0,b=0,L=0;l<p;++l)for(var v=0,x=A(e,t+1,t=G(b=w[l])),N=e;v<i;++v)(N=D(b>0?s[v]+" "+x:P(x,/&\f/g,s[v])))&&(k[L++]=N);return z(e,r,a,u===0?q:m,k,n,f)}function pe(e,r,a){return z(e,r,a,Y,C(Q()),A(e,2,-2),0)}function ie(e,r,a,p){return z(e,r,a,B,A(e,0,p),A(e,p+1,-1),p)}function he(e){let{useObjectSyntax:r=!1}=e??{};return a=>{let p=r?[":where([style]) {}"]:[],u=[];ue(a,(n,f)=>{n.type===le&&n.name==="style"&&(p.push(n.children.map(t=>t.type===xe?t.value:"").join("")),u.push(()=>{f.children=f.children.filter(t=>t!==n)}))});for(let n of u)n();let E=p.join(`
`),w=V(E),m=new Map;for(let n of w)if(n.type==="rule"){let f=Object.fromEntries(n.children.map(t=>[t.props,t.children]));for(let t of n.props){let s=Object.assign(m.get(t)??{},f);m.set(t,s)}}let k=new Map;for(let[n,f]of Array.from(m).sort(([t],[s])=>{let i=fe(t),l=fe(s);return i>l?1:l>i?-1:0})){let t=me(a,n);for(let s of t){let i=k.get(s)??{};k.set(s,Object.assign(i,f))}}for(let[n,f]of k){let t=n.attributes.style??"",s={};for(let i of V(t))i.type==="decl"&&typeof i.props=="string"&&typeof i.children=="string"&&(s[i.props]=i.children);s=Object.assign({},f,s),r?n.attributes.style=s:n.attributes.style=`${Object.entries(s).map(([i,l])=>`${i}:${l.replace("!important","")};`).join("")}`}return a}}export{he as default};

File diff suppressed because one or more lines are too long

20
node_modules/ultrahtml/dist/transformers/sanitize.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import { Node } from "../index.js";
export interface SanitizeOptions {
/** An Array of strings indicating elements that the sanitizer should not remove. All elements not in the array will be dropped. */
allowElements?: string[];
/** An Array of strings indicating elements that the sanitizer should remove, but keeping their child elements. */
blockElements?: string[];
/** An Array of strings indicating elements (including nested elements) that the sanitizer should remove. */
dropElements?: string[];
/** An Object where each key is the attribute name and the value is an Array of allowed tag names. Matching attributes will not be removed. All attributes that are not in the array will be dropped. */
allowAttributes?: Record<string, string[]>;
/** An Object where each key is the attribute name and the value is an Array of dropped tag names. Matching attributes will be removed. */
dropAttributes?: Record<string, string[]>;
/** A Boolean value set to false (default) to remove components and their children. If set to true, components will be subject to built-in and custom configuration checks (and will be retained or dropped based on those checks). */
allowComponents?: boolean;
/** A Boolean value set to false (default) to remove custom elements and their children. If set to true, custom elements will be subject to built-in and custom configuration checks (and will be retained or dropped based on those checks). */
allowCustomElements?: boolean;
/** A Boolean value set to false (default) to remove HTML comments. Set to true in order to keep comments. */
allowComments?: boolean;
}
export default function sanitize(opts?: SanitizeOptions): (doc: Node) => Node;

1
node_modules/ultrahtml/dist/transformers/sanitize.js generated vendored Normal file
View File

@@ -0,0 +1 @@
import{ELEMENT_NODE as a,walkSync as f}from"../index.js";function p(t){var n;if(t===void 0)return{allowElements:[],dropElements:["script"],allowComponents:!1,allowCustomElements:!1,allowComments:!1};{let e=new Set([]);(n=t.allowElements)!=null&&n.includes("script")||e.add("script");for(let o of t.dropElements??[])e.add(o);return{allowComponents:!1,allowCustomElements:!1,allowComments:!1,...t,dropElements:Array.from(e)}}}function E(t){return t.name.includes("-")?"custom-element":/[\_\$A-Z]/.test(t.name[0])||t.name.includes(".")?"component":"element"}function w(t,n,e){var o,l,r;return((o=e.allowElements)==null?void 0:o.length)>0&&e.allowElements.includes(t)?"allow":((l=e.blockElements)==null?void 0:l.length)>0&&e.blockElements.includes(t)?"block":((r=e.dropElements)==null?void 0:r.length)>0&&e.dropElements.find(s=>s===t)||n==="component"&&!e.allowComponents||n==="custom-element"&&!e.allowCustomElements?"drop":"allow"}function b(t,n){var o,l,r,s,u,m,c,d;let e=t.attributes;for(let i of Object.keys(t.attributes))((o=n.allowAttributes)==null?void 0:o[i])&&((l=n.allowAttributes)==null?void 0:l[i].includes(t.name))||((s=(r=n.allowAttributes)==null?void 0:r[i])==null?void 0:s.includes("*"))||(((u=n.dropAttributes)==null?void 0:u[i])&&((m=n.dropAttributes)==null?void 0:m[i].includes(t.name))||((d=(c=n.dropAttributes)==null?void 0:c[i])==null?void 0:d.includes("*")))&&delete e[i];return e}function g(t,n,e){let o=E(n),{name:l}=n,r=w(l,o,t);return r==="drop"?()=>{e.children=e.children.filter(s=>s!==n)}:r==="block"?()=>{e.children=e.children.map(s=>s===n?s.children:s).flat(1)}:()=>{n.attributes=b(n,t)}}function N(t){let n=p(t);return e=>{let o=[];f(e,(l,r)=>{switch(l.type){case a:{o.push(g(n,l,r));return}default:return}});for(let l of o)l();return e}}export{N as default};

File diff suppressed because one or more lines are too long

6
node_modules/ultrahtml/dist/transformers/scope.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import { Node } from "../index.js";
export interface ScopeOptions {
hash?: string;
attribute?: string;
}
export default function scope(opts?: ScopeOptions): (doc: Node) => Promise<Node>;

31
node_modules/ultrahtml/dist/transformers/scope.js generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
node_modules/ultrahtml/dist/transformers/swap.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { Node } from "../index.js";
export default function swap(components?: Record<string, string | ((props: Record<string, any>, ...children: any[]) => any)>): (doc: Node) => Node;

1
node_modules/ultrahtml/dist/transformers/swap.js generated vendored Normal file
View File

@@ -0,0 +1 @@
import{RenderFn as r}from"../index.js";import{__unsafeRenderFn as i}from"../index.js";import{querySelectorAll as s}from"../selector.js";function d(t={}){return o=>{for(let[f,e]of Object.entries(t))for(let n of s(o,f))typeof e=="string"?(n.name=e,r in n&&delete n[r]):typeof e=="function"&&i(n,e);return o}}export{d as default};

7
node_modules/ultrahtml/dist/transformers/swap.js.map generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../src/transformers/swap.ts"],
"sourcesContent": ["import { ElementNode, RenderFn } from '../index.js';\nimport { Node, __unsafeRenderFn } from \"../index.js\";\nimport { querySelectorAll } from \"../selector.js\";\n\nexport default function swap(components: Record<string, string | ((props: Record<string, any>, ...children: any[]) => any)> = {}) {\n return (doc: Node): Node => {\n for (const [selector, component] of Object.entries(components)) {\n for (const node of querySelectorAll(doc, selector)) {\n if (typeof component === 'string') {\n node.name = component;\n if (RenderFn in node) {\n delete (node as any)[RenderFn]\n }\n } else if (typeof component === 'function') {\n __unsafeRenderFn(node as ElementNode, component)\n }\n }\n }\n return doc;\n };\n}\n"],
"mappings": "AAAA,OAAsB,YAAAA,MAAgB,cACtC,OAAe,oBAAAC,MAAwB,cACvC,OAAS,oBAAAC,MAAwB,iBAElB,SAARC,EAAsBC,EAAiG,CAAC,EAAG,CAChI,OAAQC,GAAoB,CAC1B,OAAW,CAACC,EAAUC,CAAS,IAAK,OAAO,QAAQH,CAAU,EAC3D,QAAWI,KAAQN,EAAiBG,EAAKC,CAAQ,EAC3C,OAAOC,GAAc,UACvBC,EAAK,KAAOD,EACRP,KAAYQ,GACd,OAAQA,EAAaR,IAEd,OAAOO,GAAc,YAC9BN,EAAiBO,EAAqBD,CAAS,EAIrD,OAAOF,CACT,CACF",
"names": ["RenderFn", "__unsafeRenderFn", "querySelectorAll", "swap", "components", "doc", "selector", "component", "node"]
}