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
|
@@ -1,43 +1,40 @@
|
|
|
1
|
-
import { $
|
|
1
|
+
import { $trueStoreValue, StoreValue } from '../Store/makeStore.js';
|
|
2
2
|
import { routeKeyToUrl } from '../routing/routeUrl.js';
|
|
3
3
|
const missing = key => {
|
|
4
4
|
throw new Error(`testingComponentPackage: no ${key} supplied. Pass one in the options if the value is part` + ` of the test, or use createTestApp() for a component that needs a real app.`);
|
|
5
5
|
};
|
|
6
|
-
export const storeValue = initialValue => {
|
|
7
|
-
let value = initialValue;
|
|
8
|
-
return {
|
|
9
|
-
[$trueStoreCell]: true,
|
|
10
|
-
get: () => value,
|
|
11
|
-
set: newValue => {
|
|
12
|
-
value = newValue;
|
|
13
|
-
},
|
|
14
|
-
subscribe: () => undefined,
|
|
15
|
-
unsubscribe: () => undefined,
|
|
16
|
-
sync: () => value
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
6
|
// A store key the test did not supply: subscribing and setting work, reading
|
|
20
7
|
// names the key.
|
|
21
8
|
export const missingStoreValue = key => ({
|
|
22
|
-
[$
|
|
9
|
+
[$trueStoreValue]: true,
|
|
23
10
|
get: () => missing(key),
|
|
24
11
|
set: () => undefined,
|
|
25
12
|
subscribe: () => undefined,
|
|
26
13
|
unsubscribe: () => undefined,
|
|
27
|
-
sync: () => missing(key)
|
|
14
|
+
sync: () => missing(key),
|
|
15
|
+
notify: (fn, el) => fn,
|
|
16
|
+
stopNotify: (fn, el) => fn,
|
|
17
|
+
stopNotifyAll: () => undefined
|
|
28
18
|
});
|
|
29
|
-
|
|
19
|
+
// A supplied key gets the real cell, so the mock never has to track StoreValue's methods
|
|
20
|
+
const storeField = (key, value, subscribedElements) => value === undefined ? missingStoreValue(key) : new StoreValue(key, value, subscribedElements);
|
|
30
21
|
// Keyed off the schema, so a new internal store key fails to compile here
|
|
31
22
|
// rather than turning up as `undefined.sync is not a function` in a test.
|
|
32
|
-
const internalStore = supplied =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
const internalStore = supplied => {
|
|
24
|
+
// the cells of one store share an element index, as a real store's do
|
|
25
|
+
const subscribedElements = new Map();
|
|
26
|
+
return {
|
|
27
|
+
location: storeField('internalStore.location', supplied?.location, subscribedElements),
|
|
28
|
+
navigationIndex: storeField('internalStore.navigationIndex', 0, subscribedElements),
|
|
29
|
+
navigating: storeField('internalStore.navigating', false, subscribedElements),
|
|
30
|
+
matchedRouteInfo: storeField('internalStore.matchedRouteInfo', supplied?.matchedRouteInfo, subscribedElements),
|
|
31
|
+
popMessages: storeField('internalStore.popMessages', supplied?.popMessages, subscribedElements)
|
|
32
|
+
};
|
|
33
|
+
};
|
|
37
34
|
const defaultConfig = {
|
|
38
35
|
prod: false,
|
|
39
36
|
useRootComponent: true,
|
|
40
|
-
clientSideNav:
|
|
37
|
+
clientSideNav: true,
|
|
41
38
|
siteBasePath: '',
|
|
42
39
|
staticSite: false,
|
|
43
40
|
csr: false
|