@manyducks.co/dolla 1.1.0 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -23
- package/build.js +5 -5
- package/dist/fragment-s33qZBzz.js +1241 -0
- package/dist/fragment-s33qZBzz.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +1308 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +2 -0
- package/dist/jsx-dev-runtime.js +17 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/{lib/jsx → dist}/jsx-runtime.d.ts +3 -4
- package/dist/jsx-runtime.js +20 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/{lib → dist}/markup.d.ts +12 -13
- package/dist/modules/dolla.d.ts +87 -0
- package/dist/modules/http.d.ts +57 -0
- package/dist/modules/language.d.ts +41 -0
- package/{lib/stores → dist/modules}/render.d.ts +5 -6
- package/{lib/stores → dist/modules}/router.d.ts +37 -39
- package/{lib → dist}/nodes/cond.d.ts +1 -4
- package/{lib → dist}/nodes/html.d.ts +2 -5
- package/{lib → dist}/nodes/observer.d.ts +2 -5
- package/{lib → dist}/nodes/outlet.d.ts +1 -4
- package/{lib → dist}/nodes/portal.d.ts +1 -3
- package/{lib → dist}/nodes/repeat.d.ts +2 -5
- package/{lib → dist}/nodes/text.d.ts +1 -1
- package/{lib → dist}/signals.d.ts +35 -46
- package/{lib → dist}/types.d.ts +0 -8
- package/{lib → dist}/utils.d.ts +10 -0
- package/dist/view.d.ts +44 -0
- package/dist/views/default-crash-page.d.ts +8 -0
- package/notes/scratch.md +120 -0
- package/package.json +11 -12
- package/vite.config.js +27 -0
- package/lib/app.d.ts +0 -83
- package/lib/classes/CrashCollector.d.ts +0 -30
- package/lib/classes/DebugHub.d.ts +0 -61
- package/lib/classes/EventEmitter.d.ts +0 -44
- package/lib/index.d.ts +0 -21
- package/lib/index.js +0 -4176
- package/lib/index.js.map +0 -7
- package/lib/jsx/jsx-dev-runtime.d.ts +0 -3
- package/lib/jsx/jsx-dev-runtime.js +0 -20
- package/lib/jsx/jsx-dev-runtime.js.map +0 -7
- package/lib/jsx/jsx-runtime.js +0 -22
- package/lib/jsx/jsx-runtime.js.map +0 -7
- package/lib/signals.test.d.ts +0 -1
- package/lib/spring.d.ts +0 -0
- package/lib/state.d.ts +0 -103
- package/lib/store.d.ts +0 -59
- package/lib/stores/dialog.d.ts +0 -32
- package/lib/stores/document.d.ts +0 -11
- package/lib/stores/http.d.ts +0 -60
- package/lib/stores/language.d.ts +0 -36
- package/lib/testing/classes/MockHTTP.d.ts +0 -10
- package/lib/testing/index.d.ts +0 -4
- package/lib/testing/makeMockDOMNode.d.ts +0 -10
- package/lib/testing/makeMockFetch._test.d.ts +0 -1
- package/lib/testing/makeMockFetch.d.ts +0 -36
- package/lib/testing/makeMockFetch.test.d.ts +0 -1
- package/lib/testing/makeMockFetch.test_skip.d.ts +0 -1
- package/lib/testing/stores/dialog.d.ts +0 -6
- package/lib/testing/stores/http.d.ts +0 -13
- package/lib/testing/stores/page.d.ts +0 -7
- package/lib/testing/stores/router.d.ts +0 -12
- package/lib/testing/wrapStore._test.d.ts +0 -1
- package/lib/testing/wrapStore.d.ts +0 -8
- package/lib/testing/wrapStore.test.d.ts +0 -1
- package/lib/testing/wrapStore.test_skip.d.ts +0 -1
- package/lib/testing/wrapView.d.ts +0 -0
- package/lib/view.d.ts +0 -88
- package/lib/views/default-crash-page.d.ts +0 -7
- package/lib/views/store-scope.d.ts +0 -13
- /package/{lib → dist}/routing.d.ts +0 -0
- /package/{lib → dist}/routing.test.d.ts +0 -0
- /package/{lib → dist}/typeChecking.d.ts +0 -0
- /package/{lib → dist}/views/default-view.d.ts +0 -0
- /package/{lib → dist}/views/fragment.d.ts +0 -0
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { m, Fragment } from "../index.js";
|
|
2
|
-
function jsxDEV(element, props, key, isStaticChildren, source, self) {
|
|
3
|
-
const attributes = { ...omit(["children", "key"], props) };
|
|
4
|
-
const children = Array.isArray(props.children) ? props.children : [props.children];
|
|
5
|
-
return m(element, attributes, ...children);
|
|
6
|
-
}
|
|
7
|
-
function omit(keys, object) {
|
|
8
|
-
const result = {};
|
|
9
|
-
for (const key in object) {
|
|
10
|
-
if (!keys.includes(key)) {
|
|
11
|
-
result[key] = object[key];
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
Fragment,
|
|
18
|
-
jsxDEV
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=jsx-dev-runtime.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/jsx/jsx-dev-runtime.js"],
|
|
4
|
-
"sourcesContent": ["// This import makes sense when built\nimport { m, Fragment } from \"../index.js\";\n\nexport { Fragment };\n\nexport function jsxDEV(element, props, key, isStaticChildren, source, self) {\n const attributes = { ...omit([\"children\", \"key\"], props) };\n const children = Array.isArray(props.children) ? props.children : [props.children];\n\n return m(element, attributes, ...children);\n}\n\nfunction omit(keys, object) {\n const result = {};\n for (const key in object) {\n if (!keys.includes(key)) {\n result[key] = object[key];\n }\n }\n return result;\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,GAAG,gBAAgB;AAIrB,SAAS,OAAO,SAAS,OAAO,KAAK,kBAAkB,QAAQ,MAAM;AAC1E,QAAM,aAAa,EAAE,GAAG,KAAK,CAAC,YAAY,KAAK,GAAG,KAAK,EAAE;AACzD,QAAM,WAAW,MAAM,QAAQ,MAAM,QAAQ,IAAI,MAAM,WAAW,CAAC,MAAM,QAAQ;AAEjF,SAAO,EAAE,SAAS,YAAY,GAAG,QAAQ;AAC3C;AAEA,SAAS,KAAK,MAAM,QAAQ;AAC1B,QAAM,SAAS,CAAC;AAChB,aAAW,OAAO,QAAQ;AACxB,QAAI,CAAC,KAAK,SAAS,GAAG,GAAG;AACvB,aAAO,GAAG,IAAI,OAAO,GAAG;AAAA,IAC1B;AAAA,EACF;AACA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/lib/jsx/jsx-runtime.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { m, Fragment } from "../index.js";
|
|
2
|
-
function jsx(element, props, key) {
|
|
3
|
-
return m(element, props ? { ...omit(["children", "key"], props) } : void 0, ...[props.children]);
|
|
4
|
-
}
|
|
5
|
-
function jsxs(element, props, key) {
|
|
6
|
-
return m(element, props ? { ...omit(["children", "key"], props) } : void 0, props.children);
|
|
7
|
-
}
|
|
8
|
-
function omit(keys, object) {
|
|
9
|
-
const result = {};
|
|
10
|
-
for (const key in object) {
|
|
11
|
-
if (!keys.includes(key)) {
|
|
12
|
-
result[key] = object[key];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
Fragment,
|
|
19
|
-
jsx,
|
|
20
|
-
jsxs
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=jsx-runtime.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/jsx/jsx-runtime.js"],
|
|
4
|
-
"sourcesContent": ["// This import makes sense when built\nimport { m, Fragment } from \"../index.js\";\n\nexport { Fragment };\n\n/**\n * JSX function for elements with dynamic children.\n */\nexport function jsx(element, props, key) {\n return m(element, props ? { ...omit([\"children\", \"key\"], props) } : undefined, ...[props.children]);\n}\n\n/**\n * JSX function for elements with static children.\n */\nexport function jsxs(element, props, key) {\n return m(element, props ? { ...omit([\"children\", \"key\"], props) } : undefined, props.children);\n}\n\nfunction omit(keys, object) {\n const result = {};\n for (const key in object) {\n if (!keys.includes(key)) {\n result[key] = object[key];\n }\n }\n return result;\n}\n"],
|
|
5
|
-
"mappings": "AACA,SAAS,GAAG,gBAAgB;AAOrB,SAAS,IAAI,SAAS,OAAO,KAAK;AACvC,SAAO,EAAE,SAAS,QAAQ,EAAE,GAAG,KAAK,CAAC,YAAY,KAAK,GAAG,KAAK,EAAE,IAAI,QAAW,GAAG,CAAC,MAAM,QAAQ,CAAC;AACpG;AAKO,SAAS,KAAK,SAAS,OAAO,KAAK;AACxC,SAAO,EAAE,SAAS,QAAQ,EAAE,GAAG,KAAK,CAAC,YAAY,KAAK,GAAG,KAAK,EAAE,IAAI,QAAW,MAAM,QAAQ;AAC/F;AAEA,SAAS,KAAK,MAAM,QAAQ;AAC1B,QAAM,SAAS,CAAC;AAChB,aAAW,OAAO,QAAQ;AACxB,QAAI,CAAC,KAAK,SAAS,GAAG,GAAG;AACvB,aAAO,GAAG,IAAI,OAAO,GAAG;AAAA,IAC1B;AAAA,EACF;AACA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/lib/signals.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/spring.d.ts
DELETED
|
File without changes
|
package/lib/state.d.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { Signal } from "./signals.js";
|
|
2
|
-
declare const OBSERVE: unique symbol;
|
|
3
|
-
/**
|
|
4
|
-
* Stops the observer that created it when called.
|
|
5
|
-
*/
|
|
6
|
-
export type StopFunction = () => void;
|
|
7
|
-
type ObserveMethod<T> = (callback: (currentValue: T) => void) => StopFunction;
|
|
8
|
-
type Value<T> = T extends Readable<infer V> ? V : T extends Signal<infer V> ? V : T;
|
|
9
|
-
/**
|
|
10
|
-
* Extracts value types from an array of Readables.
|
|
11
|
-
*/
|
|
12
|
-
export type ReadableValues<T extends MaybeReadable<any>[]> = {
|
|
13
|
-
[K in keyof T]: Value<T[K]>;
|
|
14
|
-
};
|
|
15
|
-
export interface Observable<T> {
|
|
16
|
-
/**
|
|
17
|
-
* Receives the latest value with `callback` whenever the value changes.
|
|
18
|
-
* The `previousValue` is always undefined the first time the callback is called, then the same value as the last time it was called going forward.
|
|
19
|
-
*/
|
|
20
|
-
[OBSERVE]: ObserveMethod<T>;
|
|
21
|
-
}
|
|
22
|
-
export interface Readable<T> extends Observable<T> {
|
|
23
|
-
/**
|
|
24
|
-
* Returns the current value.
|
|
25
|
-
*/
|
|
26
|
-
get(): T;
|
|
27
|
-
}
|
|
28
|
-
export interface Writable<T> extends Readable<T> {
|
|
29
|
-
/**
|
|
30
|
-
* Sets a new value.
|
|
31
|
-
*/
|
|
32
|
-
set(value: T): void;
|
|
33
|
-
/**
|
|
34
|
-
* Passes the current value to `callback` and takes `callback`'s return value as the new value.
|
|
35
|
-
*/
|
|
36
|
-
update(callback: (currentValue: T) => T): void;
|
|
37
|
-
}
|
|
38
|
-
export type MaybeReadable<T> = Readable<T> | Signal<T> | T;
|
|
39
|
-
export declare function isReadable<T>(value: any): value is Readable<T>;
|
|
40
|
-
export declare function isWritable<T>(value: any): value is Writable<T>;
|
|
41
|
-
export declare function $$<T>(value: Writable<T>): Writable<T>;
|
|
42
|
-
export declare function $$<T>(value: Readable<T>): never;
|
|
43
|
-
export declare function $$<T>(value: undefined): Writable<T | undefined>;
|
|
44
|
-
export declare function $$<T>(): Writable<T | undefined>;
|
|
45
|
-
export declare function $$<T>(value: T): Writable<Value<T>>;
|
|
46
|
-
/**
|
|
47
|
-
* Creates a proxy `Writable` around an existing `Writable`.
|
|
48
|
-
* The config object contains custom `get` and `set` methods.
|
|
49
|
-
* All reads of this proxy goes through the `get` method
|
|
50
|
-
* and all writes go through `set`.
|
|
51
|
-
*/
|
|
52
|
-
export declare function $$<Source extends Writable<any>, Value>(source: Source, config: ProxyConfig<Value>): Writable<Value>;
|
|
53
|
-
/**
|
|
54
|
-
* Creates a proxy `Writable` around an existing `Readable`.
|
|
55
|
-
* The config object contains custom `get` and `set` methods.
|
|
56
|
-
* All reads of this proxy goes through the `get` method
|
|
57
|
-
* and all writes go through `set`.
|
|
58
|
-
*/
|
|
59
|
-
export declare function $$<Source extends Readable<any>, Value>(source: Source, config: ProxyConfig<Value>): Writable<Value>;
|
|
60
|
-
export declare function $<T>(value: Writable<T>): Readable<T>;
|
|
61
|
-
export declare function $<T>(value: Readable<T>): Readable<T>;
|
|
62
|
-
export declare function $<T>(value: undefined): Readable<T | undefined>;
|
|
63
|
-
export declare function $<T>(): Readable<T | undefined>;
|
|
64
|
-
export declare function $<T>(value: T): Readable<Value<T>>;
|
|
65
|
-
export declare function $<I, O>(state: MaybeReadable<I>, compute: (value: I) => O | Readable<O>): Readable<O>;
|
|
66
|
-
export declare function $<I extends MaybeReadable<any>[], O>(states: [...I], compute: (...currentValues: ReadableValues<I>) => O | Readable<O>): Readable<O>;
|
|
67
|
-
export declare function $<I1, I2, O>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, compute: (value1: I1, value2: I2) => O | Readable<O>): Readable<O>;
|
|
68
|
-
export declare function $<I1, I2, I3, O>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, compute: (value1: I1, value2: I2, value3: I3) => O | Readable<O>): Readable<O>;
|
|
69
|
-
export declare function $<I1, I2, I3, I4, O>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, state4: MaybeReadable<I4>, compute: (value1: I1, value2: I2, value3: I3, value4: I4) => O | Readable<O>): Readable<O>;
|
|
70
|
-
export declare function $<I1, I2, I3, I4, I5, O>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, state4: MaybeReadable<I4>, state5: MaybeReadable<I5>, compute: (value1: I1, value2: I2, value3: I3, value4: I4, value5: I5) => O | Readable<O>): Readable<O>;
|
|
71
|
-
export declare function $<I1, I2, I3, I4, I5, I6, O>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, state4: MaybeReadable<I4>, state5: MaybeReadable<I5>, state6: MaybeReadable<I6>, compute: (value1: I1, value2: I2, value3: I3, value4: I4, value5: I5, value6: I6) => O | Readable<O>): Readable<O>;
|
|
72
|
-
export declare function $<I1, I2, I3, I4, I5, I6, I7, O>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, state4: MaybeReadable<I4>, state5: MaybeReadable<I5>, state6: MaybeReadable<I6>, state7: MaybeReadable<I7>, compute: (value1: I1, value2: I2, value3: I3, value4: I4, value5: I5, value6: I6, value7: I7) => O | Readable<O>): Readable<O>;
|
|
73
|
-
export declare function $<I1, I2, I3, I4, I5, I6, I7, I8, O>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, state4: MaybeReadable<I4>, state5: MaybeReadable<I5>, state6: MaybeReadable<I6>, state7: MaybeReadable<I7>, state8: MaybeReadable<I8>, compute: (value1: I1, value2: I2, value3: I3, value4: I4, value5: I5, value6: I6, value7: I7, value8: I8) => O | Readable<O>): Readable<O>;
|
|
74
|
-
export declare function $<I1, I2, I3, I4, I5, I6, I7, I8, I9, O>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, state4: MaybeReadable<I4>, state5: MaybeReadable<I5>, state6: MaybeReadable<I6>, state7: MaybeReadable<I7>, state8: MaybeReadable<I8>, state9: MaybeReadable<I9>, compute: (value1: I1, value2: I2, value3: I3, value4: I4, value5: I5, value6: I6, value7: I7, value8: I8, value9: I9) => O | Readable<O>): Readable<O>;
|
|
75
|
-
export declare function $<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, O>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, state4: MaybeReadable<I4>, state5: MaybeReadable<I5>, state6: MaybeReadable<I6>, state7: MaybeReadable<I7>, state8: MaybeReadable<I8>, state9: MaybeReadable<I9>, state10: MaybeReadable<I10>, compute: (value1: I1, value2: I2, value3: I3, value4: I4, value5: I5, value6: I6, value7: I7, value8: I8, value9: I9, value10: I10) => O | Readable<O>): Readable<O>;
|
|
76
|
-
interface ProxyConfig<Value> {
|
|
77
|
-
get(): Value;
|
|
78
|
-
set(value: Value): void;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Observes a readable value. Calls `callback` each time the value changes.
|
|
82
|
-
* Returns a function to stop observing changes. This MUST be called when you are done
|
|
83
|
-
* with this observer to prevent memory leaks.
|
|
84
|
-
*/
|
|
85
|
-
export declare function observe<T>(state: Readable<T>, callback: (currentValue: T, previousValue: T) => void): StopFunction;
|
|
86
|
-
/**
|
|
87
|
-
* Observes a set of readable values.
|
|
88
|
-
* Calls `callback` with each value in the same order as `readables` each time any of their values change.
|
|
89
|
-
* Returns a function to stop observing changes. This MUST be called when you are done
|
|
90
|
-
* with this observer to prevent memory leaks.
|
|
91
|
-
*/
|
|
92
|
-
export declare function observe<T extends MaybeReadable<any>[]>(states: [...T], callback: (currentValues: ReadableValues<T>, previousValues: ReadableValues<T>) => void): StopFunction;
|
|
93
|
-
export declare function observe<I1, I2>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, callback: (value1: I1, value2: I2) => void): StopFunction;
|
|
94
|
-
export declare function observe<I1, I2, I3>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, callback: (value1: I1, value2: I2, value3: I3) => void): StopFunction;
|
|
95
|
-
export declare function observe<I1, I2, I3, I4>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, state4: MaybeReadable<I4>, callback: (value1: I1, value2: I2, value3: I3, value4: I4) => void): StopFunction;
|
|
96
|
-
export declare function observe<I1, I2, I3, I4, I5>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, state4: MaybeReadable<I4>, state5: MaybeReadable<I5>, callback: (value1: I1, value2: I2, value3: I3, value4: I4, value5: I5) => void): StopFunction;
|
|
97
|
-
export declare function observe<I1, I2, I3, I4, I5, I6>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, state4: MaybeReadable<I4>, state5: MaybeReadable<I5>, state6: MaybeReadable<I6>, callback: (value1: I1, value2: I2, value3: I3, value4: I4, value5: I5, value6: I6) => void): StopFunction;
|
|
98
|
-
export declare function observe<I1, I2, I3, I4, I5, I6, I7>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, state4: MaybeReadable<I4>, state5: MaybeReadable<I5>, state6: MaybeReadable<I6>, state7: MaybeReadable<I7>, callback: (value1: I1, value2: I2, value3: I3, value4: I4, value5: I5, value6: I6, value7: I7) => void): StopFunction;
|
|
99
|
-
export declare function observe<I1, I2, I3, I4, I5, I6, I7, I8>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, state4: MaybeReadable<I4>, state5: MaybeReadable<I5>, state6: MaybeReadable<I6>, state7: MaybeReadable<I7>, state8: MaybeReadable<I8>, callback: (value1: I1, value2: I2, value3: I3, value4: I4, value5: I5, value6: I6, value7: I7, value8: I8) => void): StopFunction;
|
|
100
|
-
export declare function observe<I1, I2, I3, I4, I5, I6, I7, I8, I9>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, state4: MaybeReadable<I4>, state5: MaybeReadable<I5>, state6: MaybeReadable<I6>, state7: MaybeReadable<I7>, state8: MaybeReadable<I8>, state9: MaybeReadable<I9>, callback: (value1: I1, value2: I2, value3: I3, value4: I4, value5: I5, value6: I6, value7: I7, value8: I8, value9: I9) => void): StopFunction;
|
|
101
|
-
export declare function observe<I1, I2, I3, I4, I5, I6, I7, I8, I9, I10>(state1: MaybeReadable<I1>, state2: MaybeReadable<I2>, state3: MaybeReadable<I3>, state4: MaybeReadable<I4>, state5: MaybeReadable<I5>, state6: MaybeReadable<I6>, state7: MaybeReadable<I7>, state8: MaybeReadable<I8>, state9: MaybeReadable<I9>, state10: MaybeReadable<I10>, callback: (value1: I1, value2: I2, value3: I3, value4: I4, value5: I5, value6: I6, value7: I7, value8: I8, value9: I9, value10: I10) => void): StopFunction;
|
|
102
|
-
export declare function unwrap<T>(value: MaybeReadable<T>): T;
|
|
103
|
-
export {};
|
package/lib/store.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { type AppContext, type ElementContext } from "./app.js";
|
|
2
|
-
import { type DebugChannel } from "./classes/DebugHub.js";
|
|
3
|
-
import { type MaybeSignal, type SignalValues, type StopFunction } from "./signals.js";
|
|
4
|
-
import type { BuiltInStores } from "./types.js";
|
|
5
|
-
export type Store<O, E> = (context: StoreContext<O>) => E | Promise<E>;
|
|
6
|
-
export interface StoreContext<Options = any> extends DebugChannel {
|
|
7
|
-
/**
|
|
8
|
-
* Returns the shared instance of `store`.
|
|
9
|
-
*/
|
|
10
|
-
getStore<T extends Store<any, any>>(store: T): ReturnType<T>;
|
|
11
|
-
/**
|
|
12
|
-
* Returns the shared instance of a built-in store.
|
|
13
|
-
*/
|
|
14
|
-
getStore<N extends keyof BuiltInStores>(name: N): BuiltInStores[N];
|
|
15
|
-
/**
|
|
16
|
-
* Runs `callback` after this store is connected.
|
|
17
|
-
*/
|
|
18
|
-
onConnected(callback: () => any): void;
|
|
19
|
-
/**
|
|
20
|
-
* Runs `callback` after this store is disconnected.
|
|
21
|
-
*/
|
|
22
|
-
onDisconnected(callback: () => any): void;
|
|
23
|
-
/**
|
|
24
|
-
* The name of this store for logging and debugging purposes.
|
|
25
|
-
*/
|
|
26
|
-
name: string;
|
|
27
|
-
/**
|
|
28
|
-
* Takes an Error object, unmounts the app and displays its crash page.
|
|
29
|
-
*/
|
|
30
|
-
crash(error: Error): void;
|
|
31
|
-
watch<T extends MaybeSignal<any>[]>(signals: [...T], callback: (...values: SignalValues<T>) => void): StopFunction;
|
|
32
|
-
/**
|
|
33
|
-
* Options this store was initialized with.
|
|
34
|
-
*/
|
|
35
|
-
options: Options;
|
|
36
|
-
}
|
|
37
|
-
export interface StoreContextSecrets {
|
|
38
|
-
appContext: AppContext;
|
|
39
|
-
elementContext: ElementContext;
|
|
40
|
-
}
|
|
41
|
-
export declare function getStoreSecrets(c: StoreContext): StoreContextSecrets;
|
|
42
|
-
export declare function store<O>(callback: Store<any, O>): Store<any, O>;
|
|
43
|
-
/**
|
|
44
|
-
* Parameters passed to the makeStore function.
|
|
45
|
-
*/
|
|
46
|
-
interface StoreConfig<O> {
|
|
47
|
-
store: Store<O, any>;
|
|
48
|
-
appContext: AppContext;
|
|
49
|
-
elementContext: ElementContext;
|
|
50
|
-
options?: O;
|
|
51
|
-
}
|
|
52
|
-
export declare function initStore<O>(config: StoreConfig<O>): {
|
|
53
|
-
readonly name: string;
|
|
54
|
-
readonly exports: any;
|
|
55
|
-
setup(): void;
|
|
56
|
-
connect(): void;
|
|
57
|
-
disconnect(): void;
|
|
58
|
-
};
|
|
59
|
-
export {};
|
package/lib/stores/dialog.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type DOMHandle } from "../markup.js";
|
|
2
|
-
import { type SettableSignal } from "../signals.js";
|
|
3
|
-
import { type StoreContext } from "../store.js";
|
|
4
|
-
import { type View } from "../view.js";
|
|
5
|
-
export interface DialogProps {
|
|
6
|
-
dialog: {
|
|
7
|
-
/**
|
|
8
|
-
* Whether the dialog is currently open.
|
|
9
|
-
*/
|
|
10
|
-
$$open: SettableSignal<boolean>;
|
|
11
|
-
/**
|
|
12
|
-
* Calls `callback` immediately after dialog has been connected.
|
|
13
|
-
*/
|
|
14
|
-
transitionIn: (callback: () => Promise<void>) => void;
|
|
15
|
-
/**
|
|
16
|
-
* Calls `callback` and awaits its Promise before disconnecting the dialog.
|
|
17
|
-
*/
|
|
18
|
-
transitionOut: (callback: () => Promise<void>) => void;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export interface OpenDialog {
|
|
22
|
-
instance: DOMHandle;
|
|
23
|
-
transitionInCallback?: () => Promise<void>;
|
|
24
|
-
transitionOutCallback?: () => Promise<void>;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Manages dialogs. Also known as modals.
|
|
28
|
-
* TODO: Describe this better.
|
|
29
|
-
*/
|
|
30
|
-
export declare function DialogStore(ctx: StoreContext): {
|
|
31
|
-
open: <P extends DialogProps>(view: View<P>, props?: Omit<P, "dialog"> | undefined) => () => void;
|
|
32
|
-
};
|
package/lib/stores/document.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type StoreContext } from "../store.js";
|
|
2
|
-
type ScreenOrientation = "landscape" | "portrait";
|
|
3
|
-
type ColorScheme = "light" | "dark";
|
|
4
|
-
export declare function DocumentStore(ctx: StoreContext): {
|
|
5
|
-
$title: import("../signals.js").Signal<string>;
|
|
6
|
-
setTitle: import("../signals.js").SignalSetter<string, string>;
|
|
7
|
-
$visibility: import("../signals.js").Signal<DocumentVisibilityState>;
|
|
8
|
-
$orientation: import("../signals.js").Signal<ScreenOrientation>;
|
|
9
|
-
$colorScheme: import("../signals.js").Signal<ColorScheme>;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
package/lib/stores/http.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { type StoreContext } from "../store.js";
|
|
2
|
-
interface HTTPStoreOptions {
|
|
3
|
-
/**
|
|
4
|
-
* The fetch function to use for requests. Pass this to mock for testing.
|
|
5
|
-
*/
|
|
6
|
-
fetch?: typeof window.fetch;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* A simple HTTP client with middleware support. Middleware applies to all requests made through this store,
|
|
10
|
-
* so it's the perfect way to handle things like auth headers and permission checks for API calls.
|
|
11
|
-
*/
|
|
12
|
-
export declare function HTTPStore(ctx: StoreContext<HTTPStoreOptions>): {
|
|
13
|
-
/**
|
|
14
|
-
* Adds a new middleware that will apply to subsequent requests.
|
|
15
|
-
* Returns a function to remove this middleware.
|
|
16
|
-
*
|
|
17
|
-
* @param middleware - A middleware function that will intercept requests.
|
|
18
|
-
*/
|
|
19
|
-
middleware(fn: HTTPMiddleware): () => void;
|
|
20
|
-
get<ResBody = unknown>(uri: string, options?: RequestOptions<never>): Promise<HTTPResponse<ResBody>>;
|
|
21
|
-
put<ResBody_1 = unknown, ReqBody = unknown>(uri: string, options?: RequestOptions<ReqBody> | undefined): Promise<HTTPResponse<ResBody_1>>;
|
|
22
|
-
patch<ResBody_2 = unknown, ReqBody_1 = unknown>(uri: string, options?: RequestOptions<ReqBody_1> | undefined): Promise<HTTPResponse<ResBody_2>>;
|
|
23
|
-
post<ResBody_3 = unknown, ReqBody_2 = unknown>(uri: string, options?: RequestOptions<ReqBody_2> | undefined): Promise<HTTPResponse<ResBody_3>>;
|
|
24
|
-
delete<ResBody_4 = unknown>(uri: string, options?: RequestOptions<never>): Promise<HTTPResponse<ResBody_4>>;
|
|
25
|
-
head<ResBody_5 = unknown, ReqBody_3 = unknown>(uri: string, options?: RequestOptions<ReqBody_3> | undefined): Promise<HTTPResponse<ResBody_5>>;
|
|
26
|
-
options<ResBody_6 = unknown, ReqBody_4 = unknown>(uri: string, options?: RequestOptions<ReqBody_4> | undefined): Promise<HTTPResponse<ResBody_6>>;
|
|
27
|
-
trace<ResBody_7 = unknown, ReqBody_5 = unknown>(uri: string, options?: RequestOptions<ReqBody_5> | undefined): Promise<HTTPResponse<ResBody_7>>;
|
|
28
|
-
};
|
|
29
|
-
export type HTTPMiddleware = (request: HTTPRequest<unknown>, next: () => Promise<HTTPResponse<unknown>>) => void | Promise<void>;
|
|
30
|
-
interface RequestOptions<ReqBody> {
|
|
31
|
-
/**
|
|
32
|
-
* Body to send with the request.
|
|
33
|
-
*/
|
|
34
|
-
body?: ReqBody;
|
|
35
|
-
/**
|
|
36
|
-
* Headers to send with the request.
|
|
37
|
-
*/
|
|
38
|
-
headers?: Record<string, any> | Headers;
|
|
39
|
-
/**
|
|
40
|
-
* Query params to interpolate into the URL.
|
|
41
|
-
*/
|
|
42
|
-
query?: Record<string, any> | URLSearchParams;
|
|
43
|
-
}
|
|
44
|
-
interface HTTPRequest<Body> {
|
|
45
|
-
method: string;
|
|
46
|
-
uri: string;
|
|
47
|
-
readonly sameOrigin: boolean;
|
|
48
|
-
headers: Headers;
|
|
49
|
-
query: URLSearchParams;
|
|
50
|
-
body: Body;
|
|
51
|
-
}
|
|
52
|
-
interface HTTPResponse<Body> {
|
|
53
|
-
method: string;
|
|
54
|
-
uri: string;
|
|
55
|
-
status: number;
|
|
56
|
-
statusText: string;
|
|
57
|
-
headers: Record<string, string>;
|
|
58
|
-
body: Body;
|
|
59
|
-
}
|
|
60
|
-
export {};
|
package/lib/stores/language.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type Signal } from "../signals.js";
|
|
2
|
-
import { type StoreContext } from "../store.js";
|
|
3
|
-
import { type Stringable } from "../types.js";
|
|
4
|
-
/**
|
|
5
|
-
* An object where values are either a translated string or another nested Translation object.
|
|
6
|
-
*/
|
|
7
|
-
type Translation = Record<string, string | Record<string, string | Record<string, string | Record<string, string>>>>;
|
|
8
|
-
export interface LanguageConfig {
|
|
9
|
-
name: string;
|
|
10
|
-
/**
|
|
11
|
-
* Path to a JSON file with translated strings for this language, a plain object containing said translations, or a callback function that returns them.
|
|
12
|
-
*/
|
|
13
|
-
translations: string | Translation | (() => Translation) | (() => Promise<Translation>);
|
|
14
|
-
}
|
|
15
|
-
type LanguageOptions = {
|
|
16
|
-
languages: LanguageConfig[];
|
|
17
|
-
/**
|
|
18
|
-
* Default language to load on startup
|
|
19
|
-
*/
|
|
20
|
-
defaultLanguage?: string;
|
|
21
|
-
};
|
|
22
|
-
export declare function LanguageStore(ctx: StoreContext<LanguageOptions>): {
|
|
23
|
-
loaded: Promise<void>;
|
|
24
|
-
$isLoaded: Signal<boolean>;
|
|
25
|
-
$currentLanguage: Signal<string | undefined>;
|
|
26
|
-
supportedLanguages: string[];
|
|
27
|
-
setLanguage: (tag: string) => Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Returns a Readable of the translated value.
|
|
30
|
-
|
|
31
|
-
* @param key - Key to the translated value.
|
|
32
|
-
* @param values - A map of {{placeholder}} names and the values to replace them with.
|
|
33
|
-
*/
|
|
34
|
-
translate(key: string, values?: Record<string, Stringable | Signal<Stringable>>): Signal<string>;
|
|
35
|
-
};
|
|
36
|
-
export {};
|
package/lib/testing/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates a `fetch`-compatible function that responds with its own mock handlers.
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* import { makeMockFetch } from "woofe/testing";
|
|
6
|
-
*
|
|
7
|
-
* // Create a mock HTTP instance
|
|
8
|
-
* const fetch = makeMockFetch((on) => {
|
|
9
|
-
* on.get("/example/route", (ctx) => {
|
|
10
|
-
* // Respond with JSON
|
|
11
|
-
* return {
|
|
12
|
-
* message: "success"
|
|
13
|
-
* }
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* on.put("/users/:id", (ctx) => {
|
|
17
|
-
* ctx.response.status = 200;
|
|
18
|
-
*
|
|
19
|
-
* return {
|
|
20
|
-
* message: `user ${ctx.request.params.id} updated`
|
|
21
|
-
* }
|
|
22
|
-
* });
|
|
23
|
-
* });
|
|
24
|
-
*
|
|
25
|
-
* fetch("/example/route")
|
|
26
|
-
* .then(res => res.json())
|
|
27
|
-
* .then(json => {
|
|
28
|
-
* console.log(json.message); // "success"
|
|
29
|
-
* });
|
|
30
|
-
*/
|
|
31
|
-
export function makeMockFetch(fn: any): {
|
|
32
|
-
(url: any, options?: {}): Promise<any>;
|
|
33
|
-
mock: {
|
|
34
|
-
calls: any[];
|
|
35
|
-
};
|
|
36
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wraps a store in a test adapter that lets you call its lifecycle methods and access its exports.
|
|
3
|
-
* You can pass any 'stores' or 'inputs' this store relies on through the config object.
|
|
4
|
-
*/
|
|
5
|
-
export function wrapStore(store: any, config?: {}): Promise<{
|
|
6
|
-
exports: any;
|
|
7
|
-
teardown(): Promise<void>;
|
|
8
|
-
}>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
package/lib/view.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { type AppContext, type ElementContext } from "./app.js";
|
|
2
|
-
import { type DebugChannel } from "./classes/DebugHub.js";
|
|
3
|
-
import { type DOMHandle, type Markup } from "./markup.js";
|
|
4
|
-
import { type MaybeSignal, Signal, type SignalValues, type StopFunction } from "./signals.js";
|
|
5
|
-
import { type Store } from "./store.js";
|
|
6
|
-
import type { BuiltInStores } from "./types.js";
|
|
7
|
-
/**
|
|
8
|
-
* Any valid value that a View can return.
|
|
9
|
-
*/
|
|
10
|
-
export type ViewResult = Node | Signal<any> | Markup | Markup[] | null;
|
|
11
|
-
export type View<P> = (props: P, context: ViewContext) => ViewResult;
|
|
12
|
-
export interface ViewContext extends DebugChannel {
|
|
13
|
-
/**
|
|
14
|
-
* A string ID unique to this view.
|
|
15
|
-
*/
|
|
16
|
-
readonly uid: string;
|
|
17
|
-
/**
|
|
18
|
-
* Returns the shared instance of `store`.
|
|
19
|
-
*/
|
|
20
|
-
getStore<T extends Store<any, any>>(store: T): ReturnType<T>;
|
|
21
|
-
/**
|
|
22
|
-
* Returns the shared instance of a built-in store.
|
|
23
|
-
*/
|
|
24
|
-
getStore<N extends keyof BuiltInStores>(name: N): BuiltInStores[N];
|
|
25
|
-
/**
|
|
26
|
-
* Runs `callback` just before this view is connected. DOM nodes are not yet attached to the page.
|
|
27
|
-
* @deprecated
|
|
28
|
-
*/
|
|
29
|
-
beforeConnect(callback: () => void): void;
|
|
30
|
-
/**
|
|
31
|
-
* Runs `callback` after this view is connected. DOM nodes are now attached to the page.
|
|
32
|
-
* @deprecated use onMount
|
|
33
|
-
*/
|
|
34
|
-
onConnected(callback: () => void): void;
|
|
35
|
-
/**
|
|
36
|
-
* Runs `callback` just before this view is disconnected. DOM nodes are still attached to the page.
|
|
37
|
-
* @deprecated
|
|
38
|
-
*/
|
|
39
|
-
beforeDisconnect(callback: () => void): void;
|
|
40
|
-
/**
|
|
41
|
-
* Runs `callback` after this view is disconnected. DOM nodes are no longer attached to the page.
|
|
42
|
-
* @deprecated use onUnmount
|
|
43
|
-
*/
|
|
44
|
-
onDisconnected(callback: () => void): void;
|
|
45
|
-
/**
|
|
46
|
-
* Registers a callback to run just after this view is mounted.
|
|
47
|
-
*/
|
|
48
|
-
onMount(callback: () => void): void;
|
|
49
|
-
/**
|
|
50
|
-
* Registers a callback to run just after this view is unmounted.
|
|
51
|
-
*/
|
|
52
|
-
onUnmount(callback: () => void): void;
|
|
53
|
-
/**
|
|
54
|
-
* The name of this view for logging and debugging purposes.
|
|
55
|
-
*/
|
|
56
|
-
name: string;
|
|
57
|
-
/**
|
|
58
|
-
* Takes an Error object, unmounts the app and displays its crash page.
|
|
59
|
-
*/
|
|
60
|
-
crash(error: Error): void;
|
|
61
|
-
/**
|
|
62
|
-
* Watch a set of signals. The callback is called when any of the signals receive a new value.
|
|
63
|
-
* Watchers will be stopped when this view is unmounted. Returns a function to stop watching early.
|
|
64
|
-
*/
|
|
65
|
-
watch<T extends MaybeSignal<any>[]>(signals: [...T], callback: (...values: SignalValues<T>) => void): StopFunction;
|
|
66
|
-
/**
|
|
67
|
-
* Returns a Markup element that displays this view's children.
|
|
68
|
-
*/
|
|
69
|
-
outlet(): Markup;
|
|
70
|
-
}
|
|
71
|
-
export interface ViewContextSecrets {
|
|
72
|
-
appContext: AppContext;
|
|
73
|
-
elementContext: ElementContext;
|
|
74
|
-
}
|
|
75
|
-
export declare function getViewSecrets(ctx: ViewContext): ViewContextSecrets;
|
|
76
|
-
export declare function view<P>(callback: View<P>): View<P>;
|
|
77
|
-
/**
|
|
78
|
-
* Parameters passed to the makeView function.
|
|
79
|
-
*/
|
|
80
|
-
interface ViewConfig<P> {
|
|
81
|
-
view: View<P>;
|
|
82
|
-
appContext: AppContext;
|
|
83
|
-
elementContext: ElementContext;
|
|
84
|
-
props: P;
|
|
85
|
-
children?: Markup[];
|
|
86
|
-
}
|
|
87
|
-
export declare function initView<P>(config: ViewConfig<P>): DOMHandle;
|
|
88
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Store } from "../store.js";
|
|
2
|
-
import { ViewContext } from "../view.js";
|
|
3
|
-
export interface StoreConfig<O, E> {
|
|
4
|
-
store: Store<O, E>;
|
|
5
|
-
options?: O;
|
|
6
|
-
}
|
|
7
|
-
export interface StoreScopeProps {
|
|
8
|
-
stores: (StoreConfig<unknown, unknown> | Store<unknown, unknown>)[];
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Creates an instance of a store available only to children of this StoreScope.
|
|
12
|
-
*/
|
|
13
|
-
export declare function StoreScope(props: StoreScopeProps, ctx: ViewContext): import("../markup.js").Markup;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|