mirror of
https://github.com/MercuryWorkshop/dreamlandjs.git
synced 2025-05-16 23:50:00 -04:00
fix css and types
This commit is contained in:
parent
2d577a6a99
commit
f286085c3a
2 changed files with 11 additions and 5 deletions
14
AliceJS.d.ts
vendored
14
AliceJS.d.ts
vendored
|
@ -8,17 +8,17 @@ declare function h(
|
||||||
...children: (HTMLElement | string)[]
|
...children: (HTMLElement | string)[]
|
||||||
): Node;
|
): Node;
|
||||||
|
|
||||||
type AliceJSReferenceSink<T> = { readonly __symbol: unique symbol, readonly __signature: T };
|
type DLPointer<T> = { readonly __symbol: unique symbol, readonly __signature: T };
|
||||||
|
|
||||||
declare function use<T>(sink: T | any, mapping?: (...args: any[]) => any): AliceJSReferenceSink<T>;
|
declare function use<T>(sink: T, mapping?: (arg: T) => any): DLPointer<T>;
|
||||||
declare function useValue<T>(sink: AliceJSReferenceSink<T>): T;
|
declare function useValue<T>(trap: DLPointer<T>): T;
|
||||||
|
|
||||||
type Stateful<T> = T & { readonly symbol: unique symbol };
|
type Stateful<T> = T & { readonly symbol: unique symbol };
|
||||||
|
|
||||||
|
|
||||||
declare function stateful<T>(target: T): Stateful<T>;
|
declare function stateful<T>(target: T): Stateful<T>;
|
||||||
|
|
||||||
declare function handle<T>(references: AliceJSReferenceSink<T>, callback: (value: T) => void): void;
|
declare function handle<T>(references: DLPointer<T>, callback: (value: T) => void): void;
|
||||||
|
|
||||||
declare function css(strings: TemplateStringsArray, ...values: any): string;
|
declare function css(strings: TemplateStringsArray, ...values: any): string;
|
||||||
declare function rule(strings: TemplateStringsArray, ...values: any): string;
|
declare function rule(strings: TemplateStringsArray, ...values: any): string;
|
||||||
|
@ -30,6 +30,12 @@ interface Element {
|
||||||
$: DLComponent<any>
|
$: DLComponent<any>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface DLElement<T> extends Element {
|
||||||
|
$: T
|
||||||
|
}
|
||||||
|
|
||||||
|
declare var $el: HTMLElement;
|
||||||
|
|
||||||
type DLComponent<T> = {
|
type DLComponent<T> = {
|
||||||
css: DLCSS,
|
css: DLCSS,
|
||||||
root: Element,
|
root: Element,
|
||||||
|
|
2
css.js
2
css.js
|
@ -37,7 +37,7 @@ function tagcss(strings, values, isblock) {
|
||||||
if (values[i]) {
|
if (values[i]) {
|
||||||
const prop = values[i];
|
const prop = values[i];
|
||||||
|
|
||||||
if (isAJSReferences(prop)) {
|
if (isDLPtr(prop)) {
|
||||||
const current_i = flattened_template.length;
|
const current_i = flattened_template.length;
|
||||||
let oldparsed;
|
let oldparsed;
|
||||||
handle(prop, (val) => {
|
handle(prop, (val) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue