deep-proxy #1

Merged
SethTrowbridge merged 16 commits from deep-proxy into master 2025-02-22 17:28:43 -05:00
5 changed files with 16 additions and 7 deletions
Showing only changes of commit a009f334eb - Show all commits

6
app.js
View File

@ -12,4 +12,8 @@ const sheet = Styles({
Outline:{border:"2px solid orange"}
});
const el = sheet.dom.div.Button.Outline();
const el = sheet.dom.a.Button.Outline({onclick(){console.log("clicked!")}}, "Click!");
console.log(el);
van.add(document.body, el, sheet.dom.p.Outline("paragraph!"));

View File

@ -5,6 +5,6 @@
"deno.window",
"DOM"
],
"types": ["./drill.d.ts"]
"types": ["./drill.d.ts", "./types.d.ts"]
}
}

7
drill.d.ts vendored
View File

@ -3,10 +3,9 @@ export {}
declare global {
namespace Gale
{
type Invoker =()=>HTMLElement
type Elemental<T extends string> = {[K in keyof HTMLElementTagNameMap]: Circular<T>}
type Circular<Keys extends string> = {
[K in Keys]: Circular<Keys>&Invoker;
type Elemental<T extends string> = {[K in keyof HTMLElementTagNameMap]: Circular<T, K>}
type Circular<Keys extends string, ElementName extends keyof HTMLElementTagNameMap> = {
[K in Keys]: Circular<Keys, ElementName>&Van.TagFunc<HTMLElementTagNameMap[ElementName]>;
};
}
}

View File

@ -5,6 +5,7 @@
<title>Document</title>
</head>
<body>
<script src="https://vanjs.org/code/van-1.5.3.nomodule.min.js"></script>
<script type="module" src="app.js"></script>
</body>
</html>

View File

@ -57,7 +57,12 @@ function MakeElemental(ref)
let pending = false;
let classes = [];
const collector = new Proxy(()=>{console.log("original func invoked!", pending, classes)},
const collector = new Proxy((...args)=>{
console.log("original func invoked!", pending, classes);
const element = van.tags[pending](...args);
element.className = classes.join(" ");
return element
},
{
get(target, prop, rec)
{