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

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"]
}