init
This commit is contained in:
commit
ee537a781b
8
deno.json
Normal file
8
deno.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"tasks": {
|
||||||
|
"dev": "deno run --watch main.ts"
|
||||||
|
},
|
||||||
|
"imports": {
|
||||||
|
"@std/assert": "jsr:@std/assert@1"
|
||||||
|
}
|
||||||
|
}
|
||||||
34
main.ts
Normal file
34
main.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
type EnumDefinition = Record<string, string>;
|
||||||
|
type EnumBlock = Record<string, EnumDefinition&{_:string}>;
|
||||||
|
|
||||||
|
function Block<Fields extends EnumBlock>(options:Fields):{[F in keyof Fields]:{[E in keyof Fields[F]]:Fields}}
|
||||||
|
{
|
||||||
|
const list = [];
|
||||||
|
let fieldLookup = {};
|
||||||
|
|
||||||
|
const proxyOuter = new Proxy({}, {get(_target, propName){
|
||||||
|
fieldLookup = options[propName];
|
||||||
|
list.push(fieldLookup._);
|
||||||
|
return proxyInner
|
||||||
|
}});
|
||||||
|
|
||||||
|
const proxyInner = new Proxy({}, {get(_target, valName){
|
||||||
|
list.push(`:${fieldLookup[valName]};`);
|
||||||
|
console.log(list);
|
||||||
|
return proxyOuter;
|
||||||
|
}});
|
||||||
|
|
||||||
|
return proxyOuter;
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = Block({
|
||||||
|
Pos:{_:"position", Abs:"absolute", Rel:"relative"},
|
||||||
|
Display:{_:"display", Flex:"flex", Grid:"grid", None:"none", Block:"block", InlineBlock:"inline-block"}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default styles
|
||||||
|
|
||||||
|
function Sheet<UserClasses extends Record<string, typeof styles>>(userClasses:UserClasses):{[Class in keyof UserClasses]:string}
|
||||||
|
{
|
||||||
|
return new Proxy({}, {get(_target, className){}});
|
||||||
|
}
|
||||||
10
main_test.ts
Normal file
10
main_test.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import * as Test from "@std/assert";
|
||||||
|
|
||||||
|
Deno.test(function()
|
||||||
|
{
|
||||||
|
|
||||||
|
Test.assertEquals();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user