Skip to content

Commit

Permalink
Deployed using Blazing fast GitHub Pages deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
nin-jin committed Dec 7, 2023
1 parent 5bf93c0 commit d497fde
Show file tree
Hide file tree
Showing 13 changed files with 232 additions and 135 deletions.
35 changes: 20 additions & 15 deletions node.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ declare namespace $ {
static [Symbol.toPrimitive](): string;
static toString(): string;
destructor(): void;
static destructor(): void;
toString(): string;
static toJSON(): string;
static toJSON(): any;
toJSON(): any;
}
}
Expand Down Expand Up @@ -1122,7 +1123,7 @@ declare namespace $ {
}

declare namespace $ {
function $mol_func_is_class(func: Function): boolean;
function $mol_func_is_class<Func extends Function>(func: Func): func is Func & (new (...args: any[]) => any);
}

declare namespace $ {
Expand Down Expand Up @@ -1268,11 +1269,25 @@ declare namespace $ {
};
}

declare namespace $ {
let $mol_mem_persist: typeof $mol_wire_solid;
}

declare namespace $ {
export function $mol_wire_sync<Host extends object>(obj: Host): ObjectOrFunctionResultAwaited<Host>;
type FunctionResultAwaited<Some> = Some extends (...args: infer Args) => infer Res ? (...args: Args) => Awaited<Res> : Some;
type MethodsResultAwaited<Host extends Object> = {
[K in keyof Host]: FunctionResultAwaited<Host[K]>;
};
type ObjectOrFunctionResultAwaited<Some> = (Some extends (...args: any) => unknown ? FunctionResultAwaited<Some> : {}) & (Some extends Object ? MethodsResultAwaited<Some> : Some);
export {};
}

declare namespace $ {
class $mol_storage extends $mol_object2 {
static native(): any;
static persisted(next?: boolean): boolean;
static estimate(): number;
static native(): StorageManager;
static persisted(next?: boolean, cache?: 'cache'): boolean;
static estimate(): StorageEstimate;
static dir(): FileSystemDirectoryHandle;
}
}
Expand All @@ -1296,16 +1311,6 @@ declare namespace $ {
let $mol_action: typeof $mol_wire_method;
}

declare namespace $ {
export function $mol_wire_sync<Host extends object>(obj: Host): ObjectOrFunctionResultAwaited<Host>;
type FunctionResultAwaited<Some> = Some extends (...args: infer Args) => infer Res ? (...args: Args) => Awaited<Res> : Some;
type MethodsResultAwaited<Host extends Object> = {
[K in keyof Host]: FunctionResultAwaited<Host[K]>;
};
type ObjectOrFunctionResultAwaited<Some> = (Some extends (...args: any) => unknown ? FunctionResultAwaited<Some> : {}) & (Some extends Object ? MethodsResultAwaited<Some> : Some);
export {};
}

declare namespace $ {
function $mol_dom_parse(text: string, type?: DOMParserSupportedType): Document;
}
Expand Down
2 changes: 1 addition & 1 deletion node.deps.json

Large diffs are not rendered by default.

94 changes: 60 additions & 34 deletions node.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node.js.map

Large diffs are not rendered by default.

94 changes: 60 additions & 34 deletions node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ var $;
try {
if (!having)
return false;
if (typeof having !== 'object')
if (typeof having !== 'object' && typeof having !== 'function')
return false;
if (having instanceof $mol_delegate)
return false;
Expand Down Expand Up @@ -223,11 +223,12 @@ var $;
return this.name;
}
destructor() { }
static destructor() { }
toString() {
return this[Symbol.toStringTag] || this.constructor.name + '()';
}
static toJSON() {
return this.$.$mol_func_name(this);
return this[Symbol.toStringTag] || this.$.$mol_func_name(this);
}
toJSON() {
return this.toString();
Expand Down Expand Up @@ -4213,19 +4214,70 @@ var $;
;
"use strict";
var $;
(function ($) {
$.$mol_mem_persist = $mol_wire_solid;
})($ || ($ = {}));
//mol/mem/persist/persist.ts
;
"use strict";
var $;
(function ($) {
function $mol_wire_sync(obj) {
return new Proxy(obj, {
get(obj, field) {
const val = obj[field];
if (typeof val !== 'function')
return val;
const temp = $mol_wire_task.getter(val);
return function $mol_wire_sync(...args) {
const fiber = temp(obj, args);
return fiber.sync();
};
},
apply(obj, self, args) {
const temp = $mol_wire_task.getter(obj);
const fiber = temp(self, args);
return fiber.sync();
},
});
}
$.$mol_wire_sync = $mol_wire_sync;
})($ || ($ = {}));
//mol/wire/sync/sync.ts
;
"use strict";
var $;
(function ($) {
class $mol_storage extends $mol_object2 {
static native() {
return null;
return this.$.$mol_dom_context.navigator.storage ?? {
persisted: async () => false,
persist: async () => false,
estimate: async () => ({}),
getDirectory: async () => null,
};
}
static persisted(next) {
return false;
static persisted(next, cache) {
$mol_mem_persist();
if (cache)
return Boolean(next);
const native = this.native();
if (next && !$mol_mem_cached(() => this.persisted())) {
native.persist().then(actual => {
setTimeout(() => this.persisted(actual, 'cache'), 5000);
if (actual)
this.$.$mol_log3_rise({ place: `$mol_storage`, message: `Persist: Yes` });
else
this.$.$mol_log3_fail({ place: `$mol_storage`, message: `Persist: No` });
});
}
return next ?? $mol_wire_sync(native).persisted();
}
static estimate() {
return 0;
return $mol_wire_sync(this.native() ?? {}).estimate();
}
static dir() {
return null;
return $mol_wire_sync(this.native()).getDirectory();
}
}
__decorate([
Expand All @@ -4236,7 +4288,7 @@ var $;
], $mol_storage, "persisted", null);
$.$mol_storage = $mol_storage;
})($ || ($ = {}));
//mol/storage/storage.node.ts
//mol/storage/storage.ts
;
"use strict";
var $;
Expand Down Expand Up @@ -4307,32 +4359,6 @@ var $;
;
"use strict";
var $;
(function ($) {
function $mol_wire_sync(obj) {
return new Proxy(obj, {
get(obj, field) {
const val = obj[field];
if (typeof val !== 'function')
return val;
const temp = $mol_wire_task.getter(val);
return function $mol_wire_sync(...args) {
const fiber = temp(obj, args);
return fiber.sync();
};
},
apply(obj, self, args) {
const temp = $mol_wire_task.getter(obj);
const fiber = temp(self, args);
return fiber.sync();
},
});
}
$.$mol_wire_sync = $mol_wire_sync;
})($ || ($ = {}));
//mol/wire/sync/sync.ts
;
"use strict";
var $;
(function ($) {
function $mol_dom_parse(text, type = 'application/xhtml+xml') {
const parser = new $mol_dom_context.DOMParser();
Expand Down
Loading

0 comments on commit d497fde

Please sign in to comment.