diff --git a/src/gale-2.js b/src/gale-2.js new file mode 100644 index 0000000..a88df10 --- /dev/null +++ b/src/gale-2.js @@ -0,0 +1,54 @@ + + +Sheet({ + fontSize:`12px` +},{ + 1024: + { + fontSize:`14px` + } +}) + +function Prox() +{ + const obj = new Proxy({}, { + get(target, propName, receiver) + { + console.log("get:", propName) + return obj; + }, + set(target, propName, value, receiver) + { + console.log("set:", propName) + return true; + } + }) + return obj; +} + + + +// +// const sheet = {}; +// +// sheet +// .Font.size`8px`.color`#aabbcc` +// [512] +// .Font.size`10px` +// [1024] +// .Font.size`12px` +// +// +// sheet(1024, +// Font.size`12px`.color`#aabbcc` +// )(512, +// Font.size`10px`); +// + + +const p1 = Prox(); + +p1.read + +p1.write = 123; + diff --git a/types.d.ts b/types.d.ts index 30164f1..c1f0b78 100644 --- a/types.d.ts +++ b/types.d.ts @@ -43,3 +43,29 @@ declare global { } + +declare global +{ + namespace JSS + { + + type Block = Partial> + type Responsive = Record + type Unit = "px" | "em" | "rem" | "%" | "vh" | "vw" | "vmin" | "vmax" | "cm" | "mm" | "in" | "pt" | "pc" | "ch" | "ex" + type UnitValue = `${number}${Unit}` | [amount:number, unit:Unit] + + type HexNumber = "1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"|"0"|"a"|"b"|"c"|"d"|"e"|"f" + type HexTriplet = `#${HexNumber}${HexNumber}${HexNumber}` + type HexColor = `#${HexNumber}${HexNumber}${HexNumber}${HexNumber}${HexNumber}${HexNumber}` + + type Rules = { + fontSize: UnitValue, + letterSpacing: UnitValue + } + + type SheetGen =(mobile:Block, conditions?:Responsive)=> void + } + + const Sheet:JSS.SheetGen +} +