tungsten 0.6.0 → 0.6.2
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/dist/.build-complete +1 -1
- package/dist/Components.d.ts +22 -15
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +17 -3
- package/dist/Instance/Instance.d.ts +9 -5
- package/dist/Instance/Instance.d.ts.map +1 -1
- package/dist/Instance/Instance.js +101 -60
- package/dist/Servers/DevServer.d.ts.map +1 -1
- package/dist/Servers/DevServer.js +4 -0
- package/dist/Servers/ProdServer.d.ts.map +1 -1
- package/dist/Servers/ProdServer.js +4 -0
- package/dist/Store/InternalStoreSchema.d.ts +12 -1
- package/dist/Store/InternalStoreSchema.d.ts.map +1 -1
- package/dist/Store/InternalStoreSchema.js +2 -0
- package/dist/Store/StoreSubscriptions.types.d.ts +2 -2
- package/dist/Store/StoreSubscriptions.types.d.ts.map +1 -1
- package/dist/Store/getInternalStore.d.ts +3 -3
- package/dist/Store/getInternalStore.d.ts.map +1 -1
- package/dist/Store/makeStore.d.ts +30 -15
- package/dist/Store/makeStore.d.ts.map +1 -1
- package/dist/Store/makeStore.js +79 -11
- package/dist/assert.d.ts +2 -0
- package/dist/assert.d.ts.map +1 -0
- package/dist/assert.js +4 -0
- package/dist/components/Link.d.ts +0 -1
- package/dist/components/Link.d.ts.map +1 -1
- package/dist/components/Link.js +4 -6
- package/dist/hydrate/hydrate.d.ts.map +1 -1
- package/dist/hydrate/hydrate.js +0 -4
- package/dist/testing/createTestApp.d.ts +12 -0
- package/dist/testing/createTestApp.d.ts.map +1 -1
- package/dist/testing/createTestApp.js +9 -3
- package/dist/testing/host.d.ts.map +1 -1
- package/dist/testing/host.js +3 -3
- package/dist/testing/hydrateTestApp.d.ts +1 -0
- package/dist/testing/hydrateTestApp.d.ts.map +1 -1
- package/dist/testing/hydrateTestApp.js +10 -4
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/testingComponentPackage.d.ts +6 -11
- package/dist/testing/testingComponentPackage.d.ts.map +1 -1
- package/dist/testing/testingComponentPackage.js +20 -23
- package/package.json +1 -1
|
@@ -2,36 +2,51 @@ import type { Key } from '../Key.js';
|
|
|
2
2
|
import type { TungstenBaseStoreComponent } from '../Components.jsx';
|
|
3
3
|
import type { ServerDataLoading } from './ServerDataLoading.js';
|
|
4
4
|
import type { SubscribedElements } from './StoreSubscriptions.types.js';
|
|
5
|
-
export declare const $
|
|
6
|
-
export declare class StoreValueServer<T> {
|
|
5
|
+
export declare const $trueStoreValue: unique symbol;
|
|
6
|
+
export declare class StoreValueServer<T> implements TrueStoreValueInterface<T> {
|
|
7
7
|
#private;
|
|
8
|
-
readonly [$
|
|
8
|
+
readonly [$trueStoreValue] = true;
|
|
9
9
|
constructor(value: T, serverDataLoading: ServerDataLoading);
|
|
10
10
|
readonly get: () => T;
|
|
11
|
+
readonly sync: () => T;
|
|
11
12
|
readonly set: (newValue: T) => void;
|
|
12
13
|
readonly subscribe: () => void;
|
|
13
14
|
readonly unsubscribe: () => void;
|
|
14
|
-
readonly
|
|
15
|
+
readonly notify: <Fn extends ((value: T) => void)>(fn: Fn, element: TungstenBaseStoreComponent<any, any, any>) => Fn;
|
|
16
|
+
readonly stopNotify: <Fn extends ((value: T) => void)>(fn: Fn, element: TungstenBaseStoreComponent<any, any, any>) => Fn;
|
|
17
|
+
readonly stopNotifyAll: () => void;
|
|
18
|
+
}
|
|
19
|
+
export type NotifyFn<T> = (value: T) => void;
|
|
20
|
+
export interface TrueStoreValueInterface<T> {
|
|
21
|
+
readonly [$trueStoreValue]: true;
|
|
22
|
+
readonly get: () => T;
|
|
23
|
+
readonly sync: (element: TungstenBaseStoreComponent<any, any, any>) => T;
|
|
24
|
+
readonly set: (value: T) => void;
|
|
25
|
+
readonly subscribe: (element: TungstenBaseStoreComponent<any, any, any>) => void;
|
|
26
|
+
readonly unsubscribe: (element: TungstenBaseStoreComponent<any, any, any>) => void;
|
|
27
|
+
readonly notify: <Fn extends NotifyFn<T>>(fn: Fn, element: TungstenBaseStoreComponent<any, any, any>) => Fn;
|
|
28
|
+
readonly stopNotify: <Fn extends NotifyFn<T>>(fn: Fn, element: TungstenBaseStoreComponent<any, any, any>) => Fn;
|
|
29
|
+
readonly stopNotifyAll: (element: TungstenBaseStoreComponent<any, any, any>) => void;
|
|
15
30
|
}
|
|
16
|
-
export
|
|
31
|
+
export type ReadonlyTrueStoreValue<T> = Omit<TrueStoreValueInterface<T>, 'set'>;
|
|
32
|
+
export declare class StoreValue<T> implements TrueStoreValueInterface<T> {
|
|
17
33
|
#private;
|
|
18
|
-
readonly [$
|
|
34
|
+
readonly [$trueStoreValue] = true;
|
|
19
35
|
constructor(key: Key, value: T, subscribedElements: SubscribedElements);
|
|
20
36
|
readonly get: () => T;
|
|
37
|
+
readonly sync: (element: TungstenBaseStoreComponent<any, any, any>) => T;
|
|
21
38
|
readonly set: (newValue: T) => void;
|
|
22
39
|
readonly subscribe: (element: TungstenBaseStoreComponent<any, any, any>) => void;
|
|
23
40
|
readonly unsubscribe: (element: TungstenBaseStoreComponent<any, any, any>) => void;
|
|
24
|
-
readonly
|
|
41
|
+
readonly notify: <Fn extends ((value: T) => void)>(fn: Fn, element: TungstenBaseStoreComponent<any, any, any>) => Fn;
|
|
42
|
+
readonly stopNotify: <Fn extends ((value: T) => void)>(fn: Fn, element: TungstenBaseStoreComponent<any, any, any>) => Fn;
|
|
43
|
+
readonly stopNotifyAll: (element: TungstenBaseStoreComponent<any, any, any>) => void;
|
|
25
44
|
}
|
|
26
45
|
export type TrueStore<Schema> = {
|
|
27
|
-
[Property in keyof Schema]:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
readonly subscribe: (element: TungstenBaseStoreComponent<any, any, any>) => void;
|
|
32
|
-
readonly unsubscribe: (element: TungstenBaseStoreComponent<any, any, any>) => void;
|
|
33
|
-
readonly sync: (element: TungstenBaseStoreComponent<any, any, any>) => Schema[Property];
|
|
34
|
-
};
|
|
46
|
+
[Property in keyof Schema]: StoreValue<Schema[Property]>;
|
|
47
|
+
};
|
|
48
|
+
export type ReadonlyTrueStore<Schema> = {
|
|
49
|
+
[Property in keyof Schema]: ReadonlyTrueStoreValue<Schema[Property]>;
|
|
35
50
|
};
|
|
36
51
|
export declare function makeStore<Schema extends object>(schema: Schema, subscribedElements: SubscribedElements, serverDataLoading?: ServerDataLoading | null): TrueStore<Schema>;
|
|
37
52
|
//# sourceMappingURL=makeStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeStore.d.ts","sourceRoot":"","sources":["../../src/Store/makeStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"makeStore.d.ts","sourceRoot":"","sources":["../../src/Store/makeStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAUvE,eAAO,MAAM,eAAe,eAA2B,CAAA;AAIvD,qBAAa,gBAAgB,CAAC,CAAC,CAAE,YAAW,uBAAuB,CAAC,CAAC,CAAC;;IAClE,QAAQ,CAAC,CAAC,eAAe,CAAC,QAAO;gBAGrB,KAAK,EAAE,CAAC,EAAE,iBAAiB,EAAE,iBAAiB;IAI1D,QAAQ,CAAC,GAAG,UAAoB;IAChC,QAAQ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EAAE,EAAE,SAAS,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,KAAG,EAAE,CAkB/D;IACD,QAAQ,CAAC,UAAU,GAAI,EAAE,SAAS,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,EACrD,IAAI,EAAE,EAAE,SAAS,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,KAAG,EAAE,CAO/D;IACD,QAAQ,CAAC,aAAa,GAAI,SAAS,0BAA0B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,UAQ3E;CAeJ;AAED,MAAM,MAAM,SAAS,CAAC,MAAM,IAAI;KAC3B,QAAQ,IAAI,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;CAC3D,CAAA;AAGD,MAAM,MAAM,iBAAiB,CAAC,MAAM,IAAI;KACnC,QAAQ,IAAI,MAAM,MAAM,GAAG,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;CACvE,CAAA;AAGD,wBAAgB,SAAS,CAAC,MAAM,SAAS,MAAM,EAC3C,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,kBAAkB,EACtC,iBAAiB,GAAE,iBAAiB,GAAG,IAAW,GACnD,SAAS,CAAC,MAAM,CAAC,CAWnB"}
|
package/dist/Store/makeStore.js
CHANGED
|
@@ -7,20 +7,23 @@ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
|
7
7
|
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
8
8
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
9
9
|
import { objectMap } from '../objectMap.js';
|
|
10
|
+
// type Notify<T> = <Fn extends ((value: T) => void)>(fn: Fn, element: TungstenBaseStoreComponent<any, any, any>) => Fn
|
|
11
|
+
// type StopNotify<T> = Notify<T>
|
|
10
12
|
// Marks a cell as unbound - subscribe takes the component. A ComponentStore's cells are the
|
|
11
13
|
// same objects behind a proxy that binds it, and without this their types would be assignable
|
|
12
14
|
// (a () => void fits an (element) => void), so a bound store could pass for a TrueStore.
|
|
13
|
-
export const $
|
|
15
|
+
export const $trueStoreValue = Symbol('trueStoreValue');
|
|
14
16
|
// the server render is one pass, so nothing re-renders on a write: no subscribers, and subscribe
|
|
15
17
|
// is a no-op that keeps the cell's shape for the component proxy
|
|
16
18
|
var _value = /*#__PURE__*/new WeakMap();
|
|
17
19
|
var _serverDataLoading = /*#__PURE__*/new WeakMap();
|
|
18
20
|
export class StoreValueServer {
|
|
19
21
|
constructor(value, serverDataLoading) {
|
|
20
|
-
_defineProperty(this, $
|
|
22
|
+
_defineProperty(this, $trueStoreValue, true);
|
|
21
23
|
_classPrivateFieldInitSpec(this, _value, void 0);
|
|
22
24
|
_classPrivateFieldInitSpec(this, _serverDataLoading, void 0);
|
|
23
25
|
_defineProperty(this, "get", () => _classPrivateFieldGet(_value, this));
|
|
26
|
+
_defineProperty(this, "sync", () => _classPrivateFieldGet(_value, this));
|
|
24
27
|
_defineProperty(this, "set", newValue => {
|
|
25
28
|
_classPrivateFieldSet(_value, this, newValue);
|
|
26
29
|
if (_classPrivateFieldGet(_serverDataLoading, this).value) {
|
|
@@ -34,7 +37,14 @@ export class StoreValueServer {
|
|
|
34
37
|
_defineProperty(this, "unsubscribe", () => {
|
|
35
38
|
// do nothing on the server, because nothing continue past first render.
|
|
36
39
|
});
|
|
37
|
-
|
|
40
|
+
// no-ops, but they return the function as the client cells do, so a caller can keep the handle
|
|
41
|
+
_defineProperty(this, "notify", (fn, element // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
42
|
+
) => fn);
|
|
43
|
+
_defineProperty(this, "stopNotify", (fn, element // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
44
|
+
) => fn);
|
|
45
|
+
_defineProperty(this, "stopNotifyAll", () => {
|
|
46
|
+
// do nothing on the server, because nothing continue past first render.
|
|
47
|
+
});
|
|
38
48
|
_classPrivateFieldSet(_value, this, value);
|
|
39
49
|
_classPrivateFieldSet(_serverDataLoading, this, serverDataLoading);
|
|
40
50
|
}
|
|
@@ -43,15 +53,26 @@ var _key = /*#__PURE__*/new WeakMap();
|
|
|
43
53
|
var _value2 = /*#__PURE__*/new WeakMap();
|
|
44
54
|
var _subscribedElements = /*#__PURE__*/new WeakMap();
|
|
45
55
|
var _subscribers = /*#__PURE__*/new WeakMap();
|
|
56
|
+
var _notifyFunctions = /*#__PURE__*/new WeakMap();
|
|
57
|
+
var _notifyOwners = /*#__PURE__*/new WeakMap();
|
|
58
|
+
var _dropOwnerIfDone = /*#__PURE__*/new WeakMap();
|
|
46
59
|
export class StoreValue {
|
|
47
60
|
constructor(key, value, subscribedElements) {
|
|
48
|
-
_defineProperty(this, $
|
|
61
|
+
_defineProperty(this, $trueStoreValue, true);
|
|
49
62
|
/* #store: StoreSchemaClassGeneral */
|
|
50
63
|
_classPrivateFieldInitSpec(this, _key, void 0);
|
|
51
64
|
_classPrivateFieldInitSpec(this, _value2, void 0);
|
|
52
65
|
_classPrivateFieldInitSpec(this, _subscribedElements, void 0);
|
|
66
|
+
// Map<TungstenBaseComponent<any, any>, Set<Key>>
|
|
53
67
|
_classPrivateFieldInitSpec(this, _subscribers, new Set());
|
|
68
|
+
_classPrivateFieldInitSpec(this, _notifyFunctions, new Set());
|
|
69
|
+
// callbacks an element owns, so teardown can drop them without the caller keeping a handle
|
|
70
|
+
_classPrivateFieldInitSpec(this, _notifyOwners, new Map());
|
|
54
71
|
_defineProperty(this, "get", () => _classPrivateFieldGet(_value2, this));
|
|
72
|
+
_defineProperty(this, "sync", element => {
|
|
73
|
+
this.subscribe(element);
|
|
74
|
+
return _classPrivateFieldGet(_value2, this);
|
|
75
|
+
});
|
|
55
76
|
_defineProperty(this, "set", newValue => {
|
|
56
77
|
_classPrivateFieldSet(_value2, this, newValue);
|
|
57
78
|
//console.log(this.#key, 'pushing', this.#subscribers)
|
|
@@ -64,6 +85,9 @@ export class StoreValue {
|
|
|
64
85
|
//console.log('queueing update for', element.constructor.name, 'on', this.#key)
|
|
65
86
|
element.__queueUpdate();
|
|
66
87
|
}
|
|
88
|
+
for (const fn of _classPrivateFieldGet(_notifyFunctions, this)) {
|
|
89
|
+
fn(_classPrivateFieldGet(_value2, this));
|
|
90
|
+
}
|
|
67
91
|
});
|
|
68
92
|
_defineProperty(this, "subscribe", element => {
|
|
69
93
|
_classPrivateFieldGet(_subscribers, this).add(element);
|
|
@@ -78,14 +102,58 @@ export class StoreValue {
|
|
|
78
102
|
//console.log('StoreValue unsubscribe', this.#key, element)
|
|
79
103
|
_classPrivateFieldGet(_subscribers, this).delete(element);
|
|
80
104
|
//console.log('Subs', this.#subscribers)
|
|
81
|
-
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
*/
|
|
105
|
+
// keep the reverse index in step: otherwise unsubscribeAll walks keys this cell has
|
|
106
|
+
// already dropped, and the store holds the element after its last subscription
|
|
107
|
+
_classPrivateFieldGet(_dropOwnerIfDone, this).call(this, element);
|
|
85
108
|
});
|
|
86
|
-
_defineProperty(this, "
|
|
87
|
-
this.
|
|
88
|
-
|
|
109
|
+
_defineProperty(this, "notify", (fn, element) => {
|
|
110
|
+
_classPrivateFieldGet(_notifyFunctions, this).add(fn);
|
|
111
|
+
//if (element !== undefined) {
|
|
112
|
+
let owned = _classPrivateFieldGet(_notifyOwners, this).get(element);
|
|
113
|
+
if (owned === undefined) {
|
|
114
|
+
owned = new Set();
|
|
115
|
+
_classPrivateFieldGet(_notifyOwners, this).set(element, owned);
|
|
116
|
+
}
|
|
117
|
+
owned.add(fn);
|
|
118
|
+
// index the key like subscribe does, so teardown visits this cell
|
|
119
|
+
let subscriptions = _classPrivateFieldGet(_subscribedElements, this).get(element);
|
|
120
|
+
if (subscriptions === undefined) {
|
|
121
|
+
subscriptions = new Set();
|
|
122
|
+
_classPrivateFieldGet(_subscribedElements, this).set(element, subscriptions);
|
|
123
|
+
}
|
|
124
|
+
subscriptions.add(_classPrivateFieldGet(_key, this));
|
|
125
|
+
//}
|
|
126
|
+
return fn;
|
|
127
|
+
});
|
|
128
|
+
_defineProperty(this, "stopNotify", (fn, element) => {
|
|
129
|
+
_classPrivateFieldGet(_notifyFunctions, this).delete(fn);
|
|
130
|
+
//if (element !== undefined) {
|
|
131
|
+
_classPrivateFieldGet(_notifyOwners, this).get(element)?.delete(fn);
|
|
132
|
+
_classPrivateFieldGet(_dropOwnerIfDone, this).call(this, element);
|
|
133
|
+
//}
|
|
134
|
+
return fn;
|
|
135
|
+
});
|
|
136
|
+
_defineProperty(this, "stopNotifyAll", element => {
|
|
137
|
+
const owned = _classPrivateFieldGet(_notifyOwners, this).get(element);
|
|
138
|
+
if (owned === undefined) return;
|
|
139
|
+
for (const fn of owned) {
|
|
140
|
+
_classPrivateFieldGet(_notifyFunctions, this).delete(fn);
|
|
141
|
+
}
|
|
142
|
+
_classPrivateFieldGet(_notifyOwners, this).delete(element);
|
|
143
|
+
_classPrivateFieldGet(_dropOwnerIfDone, this).call(this, element);
|
|
144
|
+
});
|
|
145
|
+
// the key stays indexed while the element still holds a subscription or a callback here.
|
|
146
|
+
// A field, not a private method: the framework's babel config has no private-method transform
|
|
147
|
+
_classPrivateFieldInitSpec(this, _dropOwnerIfDone, element => {
|
|
148
|
+
if (_classPrivateFieldGet(_subscribers, this).has(element)) return;
|
|
149
|
+
const owned = _classPrivateFieldGet(_notifyOwners, this).get(element);
|
|
150
|
+
if (owned !== undefined && owned.size > 0) return;
|
|
151
|
+
_classPrivateFieldGet(_notifyOwners, this).delete(element);
|
|
152
|
+
const subscriptions = _classPrivateFieldGet(_subscribedElements, this).get(element);
|
|
153
|
+
if (subscriptions !== undefined) {
|
|
154
|
+
subscriptions.delete(_classPrivateFieldGet(_key, this));
|
|
155
|
+
if (subscriptions.size === 0) _classPrivateFieldGet(_subscribedElements, this).delete(element);
|
|
156
|
+
}
|
|
89
157
|
});
|
|
90
158
|
_classPrivateFieldSet(_key, this, key);
|
|
91
159
|
_classPrivateFieldSet(_value2, this, value);
|
package/dist/assert.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../src/assert.ts"],"names":[],"mappings":"AAGA,wBAAgB,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAE1D"}
|
package/dist/assert.js
ADDED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/components/Link.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAG3D,MAAM,MAAM,SAAS,GAAG;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,EAAE,EAAE,IAAI,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,WAAW,CAAA;CACxB,CAAA;AAED,qBAAa,IAAK,SAAQ,uBAAuB,CAAC,SAAS,CAAC;IACxD,
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/components/Link.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAG3D,MAAM,MAAM,SAAS,GAAG;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,EAAE,EAAE,IAAI,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,WAAW,CAAA;CACxB,CAAA;AAED,qBAAa,IAAK,SAAQ,uBAAuB,CAAC,SAAS,CAAC;IACxD,KAAK,GAAI,OAAO,gBAAgB,UAiB/B;IACD,OAAO,uDAUN;CACJ"}
|
package/dist/components/Link.js
CHANGED
|
@@ -6,11 +6,9 @@ import { jsx as _jsx } from "tungsten/jsx-runtime";
|
|
|
6
6
|
export class Link extends TungstenSimpleComponent {
|
|
7
7
|
constructor(...args) {
|
|
8
8
|
super(...args);
|
|
9
|
-
_defineProperty(this, "href", this.__instance.routeKeyToUrl(this.props.to));
|
|
10
9
|
_defineProperty(this, "click", (event /* Event */) => {
|
|
11
|
-
// GUARD
|
|
12
|
-
|
|
13
|
-
if (event.ctrlKey) return;
|
|
10
|
+
// GUARD a modified or non-primary click is the browser's: new tab, new window, download
|
|
11
|
+
if (event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
|
|
14
12
|
// GUARD don't do anything if clientSideNavigation is disabled
|
|
15
13
|
if (!this.__instance.config.clientSideNav) return;
|
|
16
14
|
//if (this.__instance.config.staticSite) return // temporarily disable this on static sites
|
|
@@ -21,12 +19,12 @@ export class Link extends TungstenSimpleComponent {
|
|
|
21
19
|
// ? '/'
|
|
22
20
|
// : `${to}.html`
|
|
23
21
|
//console.log('go to', to)
|
|
24
|
-
this.__instance.goto(to);
|
|
22
|
+
void this.__instance.goto(to);
|
|
25
23
|
});
|
|
26
24
|
_defineProperty(this, "content", () => {
|
|
27
25
|
return _jsx("a", {
|
|
28
26
|
className: this.props.className,
|
|
29
|
-
href: this.
|
|
27
|
+
href: this.__instance.routeKeyToUrl(this.props.to),
|
|
30
28
|
onClick: this.click,
|
|
31
29
|
children: this.props.children
|
|
32
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydrate.d.ts","sourceRoot":"","sources":["../../src/hydrate/hydrate.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAQnE,OAAO,KAAK,EA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ID,wBAAsB,OAAO,CACzB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,yBAAyB,GAAG,IAAI,EAC/C,cAAc,EAAE,cAAc,iBA4DjC;AAyBD,wBAAsB,oBAAoB,CACtC,aAAa,SAAS,yBAAyB,CAAC,GAAG,EAAE,GAAG,CAAC,EAEzD,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,WAAW,EAIjB,KAAK,GAAE,YAAY,CAAC,aAAa,CAAC,CAAC,OAAO,CAAM,EAChD,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,SAAS,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CA6DtC"}
|
package/dist/hydrate/hydrate.js
CHANGED
|
@@ -69,10 +69,6 @@ export async function hydrate(appRoutes, RootComponent, instanceConfig) {
|
|
|
69
69
|
stores,
|
|
70
70
|
storeSubscriptions
|
|
71
71
|
} = initStores(location, null, globalData, matchedRouteInfo);
|
|
72
|
-
// const internalStore: TrueStore<InternalStoreSchema> = makeStore(new InternalStoreSchema(location))
|
|
73
|
-
// //store: Store
|
|
74
|
-
// const stores: TrueStore<any>[] = createStores(null, matchedRouteInfo, globalData)
|
|
75
|
-
//console.log('hydration instance config', instanceConfig)
|
|
76
72
|
const instance = new Instance(location, instanceConfig, null, appRoutes, routes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo);
|
|
77
73
|
if (isDev) setCurrentInstance(instance);
|
|
78
74
|
//const routes = instance.getRoutes()
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { ConstructPackage, TungstenBaseComponent, TungstenBaseComponentType, TungstenComponentPropsBase } from '../Components.jsx';
|
|
2
2
|
import type { TrueStore } from '../Store/makeStore.js';
|
|
3
|
+
import type { Endpoint, Path } from '../routing/RouteTypes.js';
|
|
4
|
+
import type { ErrorRouteType } from '../routing/ErrorRouteType.js';
|
|
5
|
+
import type { ReqRes } from '../ReqRes.js';
|
|
3
6
|
export type ComponentProps<ComponentType extends TungstenBaseComponentType<any, any>> = InstanceType<ComponentType>['props'];
|
|
4
7
|
export type TestStoreRegistration<Schema extends object> = {
|
|
5
8
|
getStore: (stores: TrueStore<unknown>[]) => TrueStore<Schema>;
|
|
@@ -19,6 +22,14 @@ export type TestAppOptions<Props extends object> = {
|
|
|
19
22
|
routeData?: unknown;
|
|
20
23
|
globalData?: Record<string, unknown>;
|
|
21
24
|
stores?: readonly TestStoreOverride<any>[];
|
|
25
|
+
routes?: TestRoutes | ((reqRes: ReqRes | null) => TestRoutes);
|
|
26
|
+
};
|
|
27
|
+
export type TestRoutes = {
|
|
28
|
+
[key in Path]: Endpoint<any, any>;
|
|
29
|
+
} & {
|
|
30
|
+
'404'?: Endpoint<any, any>;
|
|
31
|
+
'default'?: Endpoint<any, any>;
|
|
32
|
+
'error'?: ErrorRouteType;
|
|
22
33
|
};
|
|
23
34
|
export type TestApp<Component extends TungstenBaseComponent> = {
|
|
24
35
|
readonly document: Document;
|
|
@@ -27,6 +38,7 @@ export type TestApp<Component extends TungstenBaseComponent> = {
|
|
|
27
38
|
resolved(): Promise<void>;
|
|
28
39
|
setProps(props: Component['props']): Promise<void>;
|
|
29
40
|
unmount(): Promise<void>;
|
|
41
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
30
42
|
};
|
|
31
43
|
export type CreateTestAppArgs<Props extends object> = object extends Props ? [options?: TestAppOptions<Props>] : keyof Props extends never ? [options?: TestAppOptions<Props>] : [options: TestAppOptions<Props> & {
|
|
32
44
|
props: Props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTestApp.d.ts","sourceRoot":"","sources":["../../src/testing/createTestApp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC7B,MAAM,mBAAmB,CAAA;AAI1B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,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAExB,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACzC,CAAA;AAED,MAAM,MAAM,iBAAiB,CAAC,KAAK,SAAS,MAAM,IAAI,MAAM,SAAS,KAAK,GACpE,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,GACjC,MAAM,KAAK,SAAS,KAAK,GACrB,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,GACjC,CAAC,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC,CAAA;AAyE7D,wBAAsB,aAAa,CAC/B,KAAK,SAAS,0BAA0B,EACxC,SAAS,SAAS,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,EACjD,SAAS,GAAG,SAAS,EAGrB,aAAa,EAAE,KAAK,GAAG,EAAE,gBAAgB,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,SAAS,EACzE,GAAG,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAClC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAwH7B"}
|
|
@@ -41,6 +41,9 @@ class TestAppImplementation {
|
|
|
41
41
|
_classPrivateFieldGet(_instance, this).queueUpdate(this.component);
|
|
42
42
|
await this.resolved();
|
|
43
43
|
});
|
|
44
|
+
_defineProperty(this, Symbol.asyncDispose, async () => {
|
|
45
|
+
await this.unmount();
|
|
46
|
+
});
|
|
44
47
|
_defineProperty(this, "unmount", async () => {
|
|
45
48
|
if (_classPrivateFieldGet(_unmounted, this)) return;
|
|
46
49
|
_classPrivateFieldSet(_unmounted, this, true);
|
|
@@ -123,13 +126,16 @@ RootComponent, ...args) {
|
|
|
123
126
|
const instanceConfig = {
|
|
124
127
|
prod: false,
|
|
125
128
|
useRootComponent: true,
|
|
126
|
-
clientSideNav:
|
|
129
|
+
clientSideNav: true,
|
|
127
130
|
siteBasePath: '/',
|
|
128
131
|
staticSite: false,
|
|
129
132
|
csr: false
|
|
130
133
|
};
|
|
131
|
-
|
|
132
|
-
|
|
134
|
+
// routing() falls back to the built-in 404 when neither '404' nor 'default' is given
|
|
135
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
136
|
+
const appRoutes = options?.routes ?? {};
|
|
137
|
+
const routes = typeof appRoutes === 'function' ? appRoutes(null) : appRoutes;
|
|
138
|
+
const instance = new Instance(location, instanceConfig, null, appRoutes, routes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo, runtimeContext);
|
|
133
139
|
try {
|
|
134
140
|
for (const override of options?.stores ?? []) {
|
|
135
141
|
const store = override.registration.getStore(instance.stores);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/testing/host.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAA8B,MAAM,iCAAiC,CAAA;AACtG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EACH,qBAAqB,
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/testing/host.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAA8B,MAAM,iC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AAS,SAAS,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,EAEjD,aAAa,EAAE,sBAAsB,CAAC,KAAK,EAAE,SAAS,CAAC,EACvD,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,GAChD,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAA"}
|
package/dist/testing/host.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TungstenBaseComponent, TungstenBaseSimpleStoreComponent, TungstenBaseStatefulStoreComponent, TungstenBaseStoreComponent, TungstenSimpleComponent } from "../Components.js";
|
|
2
|
-
import {
|
|
2
|
+
import { makeStore } from '../Store/makeStore.js';
|
|
3
3
|
import { routing } from "../Servers/routing.js";
|
|
4
|
-
import { missingStoreValue,
|
|
4
|
+
import { missingStoreValue, testingComponentPackage } from './testingComponentPackage.js';
|
|
5
5
|
const isPromise = value => value instanceof Promise || typeof value === 'object' && value !== null && 'then' in value;
|
|
6
6
|
// The same list at runtime. Underscore-prefixed members are excluded by rule
|
|
7
7
|
// (the framework's naming scheme), so only the plain-named ones are listed, and
|
|
@@ -52,7 +52,7 @@ export async function host(ComponentType, props,
|
|
|
52
52
|
options) {
|
|
53
53
|
const stored = options ?? {};
|
|
54
54
|
const storeData = stored.storeData ?? stored.partialStoreData;
|
|
55
|
-
const store = stored.store ?? stored.partialStore ?? (storeData === undefined ? undefined :
|
|
55
|
+
const store = stored.store ?? stored.partialStore ?? (storeData === undefined ? undefined : makeStore(storeData, new Map()));
|
|
56
56
|
const partial = stored.partialStore !== undefined || stored.partialStoreData !== undefined;
|
|
57
57
|
const route = await hostedRouting(stored);
|
|
58
58
|
const pending = [];
|
|
@@ -17,6 +17,7 @@ export type HydrateTestApp<Component extends TungstenBaseComponent> = {
|
|
|
17
17
|
resolved(): Promise<void>;
|
|
18
18
|
setProps(props: Component['props']): Promise<void>;
|
|
19
19
|
unmount(): Promise<void>;
|
|
20
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
20
21
|
};
|
|
21
22
|
/**
|
|
22
23
|
* The hydration round trip createTestApp() deliberately doesn't cover: render a component to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydrateTestApp.d.ts","sourceRoot":"","sources":["../../src/testing/hydrateTestApp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,gBAAgB,EAChB,qBAAqB,EACrB,0BAA0B,EAC7B,MAAM,mBAAmB,CAAA;AAI1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAA;AAK1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAaxD,MAAM,MAAM,qBAAqB,CAAC,KAAK,SAAS,MAAM,IAAI,cAAc,CAAC,KAAK,CAAC,GAAG;IAM9E,WAAW,CAAC,EAAE,KAAK,CAAA;IAEnB,GAAG,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,KAAK,kBAAkB,CAAC,KAAK,SAAS,MAAM,IAAI,MAAM,SAAS,KAAK,GAC9D,CAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC,KAAK,CAAC,CAAC,GACxC,MAAM,KAAK,SAAS,KAAK,GACrB,CAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC,KAAK,CAAC,CAAC,GACxC,CAAC,OAAO,EAAE,qBAAqB,CAAC,KAAK,CAAC,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC,CAAA;AAEpE,MAAM,MAAM,cAAc,CAAC,SAAS,SAAS,qBAAqB,IAAI;IAClE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAA;IAC/B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAG7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAIrB,QAAQ,CAAC,UAAU,EAAE,SAAS,uBAAuB,EAAE,CAA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IAIrB,QAAQ,CAAC,UAAU,EAAE,SAAS,uBAAuB,EAAE,CAAA;IAEvD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAExB,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACzC,CAAA;AAsGD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAChC,KAAK,SAAS,0BAA0B,EACxC,SAAS,SAAS,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,EACjD,SAAS,GAAG,SAAS,EAErB,aAAa,EAAE,KAAK,GAAG,EAAE,gBAAgB,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,SAAS,EACzE,GAAG,IAAI,EAAE,kBAAkB,CAAC,KAAK,CAAC,GACnC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAgIpC"}
|
|
@@ -58,6 +58,9 @@ class HydrateTestAppImplementation {
|
|
|
58
58
|
_classPrivateFieldGet(_instance, this).queueUpdate(this.component);
|
|
59
59
|
await this.resolved();
|
|
60
60
|
});
|
|
61
|
+
_defineProperty(this, Symbol.asyncDispose, async () => {
|
|
62
|
+
await this.unmount();
|
|
63
|
+
});
|
|
61
64
|
_defineProperty(this, "unmount", async () => {
|
|
62
65
|
if (_classPrivateFieldGet(_unmounted, this)) return;
|
|
63
66
|
_classPrivateFieldSet(_unmounted, this, true);
|
|
@@ -146,12 +149,15 @@ export async function hydrateTestApp(RootComponent, ...args) {
|
|
|
146
149
|
const instanceConfig = {
|
|
147
150
|
prod: false,
|
|
148
151
|
useRootComponent: true,
|
|
149
|
-
clientSideNav:
|
|
152
|
+
clientSideNav: true,
|
|
150
153
|
siteBasePath: '/',
|
|
151
154
|
staticSite: false,
|
|
152
155
|
csr: options?.csr ?? false
|
|
153
156
|
};
|
|
154
|
-
|
|
157
|
+
// routing() falls back to the built-in 404 when neither '404' nor 'default' is given
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
159
|
+
const appRoutes = options?.routes ?? {};
|
|
160
|
+
const routes = typeof appRoutes === 'function' ? appRoutes(null) : appRoutes;
|
|
155
161
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- rootToHtml.ts builds a root content node the same way
|
|
156
162
|
const componentNode = {
|
|
157
163
|
[$type]: RootComponent,
|
|
@@ -167,7 +173,7 @@ export async function hydrateTestApp(RootComponent, ...args) {
|
|
|
167
173
|
stores,
|
|
168
174
|
storeSubscriptions
|
|
169
175
|
} = initStores(location, null, globalData, matchedRouteInfo);
|
|
170
|
-
const ssrInstance = new Instance(location, instanceConfig, null,
|
|
176
|
+
const ssrInstance = new Instance(location, instanceConfig, null, appRoutes, routes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo, {
|
|
171
177
|
document,
|
|
172
178
|
window: document.defaultView,
|
|
173
179
|
scheduler: ssrScheduler,
|
|
@@ -211,7 +217,7 @@ export async function hydrateTestApp(RootComponent, ...args) {
|
|
|
211
217
|
scheduler,
|
|
212
218
|
navigation: false
|
|
213
219
|
};
|
|
214
|
-
const instance = new Instance(location, instanceConfig, null,
|
|
220
|
+
const instance = new Instance(location, instanceConfig, null, appRoutes, routes, internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo, runtimeContext);
|
|
215
221
|
try {
|
|
216
222
|
for (const override of options?.stores ?? []) {
|
|
217
223
|
const store = override.registration.getStore(instance.stores);
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { loadEnv } from './loadEnv.js';
|
|
2
2
|
export { testEnvVariableName } from './testEnvIsRequested.js';
|
|
3
3
|
export { hydrateTestApp, type HydrateTestApp, type HydrateTestAppOptions } from './hydrateTestApp.js';
|
|
4
|
-
export { createTestApp, testStore, type ComponentProps, type CreateTestAppArgs, type TestApp, type TestAppOptions, type TestStore, type TestStoreOverride, type TestStoreRegistration, } from './createTestApp.js';
|
|
4
|
+
export { createTestApp, testStore, type ComponentProps, type CreateTestAppArgs, type TestApp, type TestAppOptions, type TestStore, type TestStoreOverride, type TestStoreRegistration, type TestRoutes, } from './createTestApp.js';
|
|
5
5
|
export { host, type HostOptions, type HostStoreOptions, type Hosted } from './host.js';
|
|
6
6
|
export { testingComponentPackage } from './testingComponentPackage.js';
|
|
7
7
|
export { contentHtmlElements } from './helpers/contentHtmlElements.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACrG,OAAO,EACH,aAAa,EACb,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACrG,OAAO,EACH,aAAa,EACb,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,GAClB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ConstructPackage } from '../Components.jsx';
|
|
1
|
+
import type { ConstructPackage, TungstenBaseStoreComponent } from '../Components.jsx';
|
|
2
2
|
import type { Instance } from '../Instance/Instance.js';
|
|
3
3
|
import type { InstanceConfig } from '../Instance/InstanceConfig.js';
|
|
4
4
|
import type { PartialInternalStoreSchema } from '../Store/InternalStoreSchema.js';
|
|
5
5
|
import type { GlobalData } from '../routing/registerGlobalData.js';
|
|
6
|
-
import { $
|
|
6
|
+
import { $trueStoreValue, type TrueStore } from '../Store/makeStore.js';
|
|
7
7
|
export type TestingComponentPackageOptions = {
|
|
8
8
|
store?: Partial<TrueStore<any>>;
|
|
9
9
|
routes?: object;
|
|
@@ -17,21 +17,16 @@ export type TestingComponentPackageOptions = {
|
|
|
17
17
|
goto?: Instance['goto'];
|
|
18
18
|
redirect?: Instance['redirect'];
|
|
19
19
|
};
|
|
20
|
-
export declare const storeValue: <Value>(initialValue: Value) => {
|
|
21
|
-
[$trueStoreCell]: true;
|
|
22
|
-
get: () => Value;
|
|
23
|
-
set: (newValue: Value) => void;
|
|
24
|
-
subscribe: () => undefined;
|
|
25
|
-
unsubscribe: () => undefined;
|
|
26
|
-
sync: () => Value;
|
|
27
|
-
};
|
|
28
20
|
export declare const missingStoreValue: <Value>(key: string) => {
|
|
29
|
-
[$
|
|
21
|
+
[$trueStoreValue]: true;
|
|
30
22
|
get: () => Value;
|
|
31
23
|
set: () => undefined;
|
|
32
24
|
subscribe: () => undefined;
|
|
33
25
|
unsubscribe: () => undefined;
|
|
34
26
|
sync: () => Value;
|
|
27
|
+
notify: <Fn extends ((value: Value) => void)>(fn: Fn, el: TungstenBaseStoreComponent<any, any, any>) => Fn;
|
|
28
|
+
stopNotify: <Fn extends ((value: Value) => void)>(fn: Fn, el: TungstenBaseStoreComponent<any, any, any>) => Fn;
|
|
29
|
+
stopNotifyAll: () => undefined;
|
|
35
30
|
};
|
|
36
31
|
export declare const testingComponentPackage: <Props extends object>(props: Props, options?: TestingComponentPackageOptions) => ConstructPackage<Props, undefined>;
|
|
37
32
|
//# sourceMappingURL=testingComponentPackage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testingComponentPackage.d.ts","sourceRoot":"","sources":["../../src/testing/testingComponentPackage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"testingComponentPackage.d.ts","sourceRoot":"","sources":["../../src/testing/testingComponentPackage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AACrF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAuB,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AACtG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAGlE,OAAO,EACH,eAAe,EAAc,KAAK,SAAS,EAC9C,MAAM,uBAAuB,CAAA;AAI9B,MAAM,MAAM,8BAA8B,GAAG;IAIzC,KAAK,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;IAG/B,MAAM,CAAC,EAAE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