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.
Files changed (43) hide show
  1. package/dist/.build-complete +1 -1
  2. package/dist/Components.d.ts +22 -15
  3. package/dist/Components.d.ts.map +1 -1
  4. package/dist/Components.js +17 -3
  5. package/dist/Instance/Instance.d.ts +9 -5
  6. package/dist/Instance/Instance.d.ts.map +1 -1
  7. package/dist/Instance/Instance.js +101 -60
  8. package/dist/Servers/DevServer.d.ts.map +1 -1
  9. package/dist/Servers/DevServer.js +4 -0
  10. package/dist/Servers/ProdServer.d.ts.map +1 -1
  11. package/dist/Servers/ProdServer.js +4 -0
  12. package/dist/Store/InternalStoreSchema.d.ts +12 -1
  13. package/dist/Store/InternalStoreSchema.d.ts.map +1 -1
  14. package/dist/Store/InternalStoreSchema.js +2 -0
  15. package/dist/Store/StoreSubscriptions.types.d.ts +2 -2
  16. package/dist/Store/StoreSubscriptions.types.d.ts.map +1 -1
  17. package/dist/Store/getInternalStore.d.ts +3 -3
  18. package/dist/Store/getInternalStore.d.ts.map +1 -1
  19. package/dist/Store/makeStore.d.ts +30 -15
  20. package/dist/Store/makeStore.d.ts.map +1 -1
  21. package/dist/Store/makeStore.js +79 -11
  22. package/dist/assert.d.ts +2 -0
  23. package/dist/assert.d.ts.map +1 -0
  24. package/dist/assert.js +4 -0
  25. package/dist/components/Link.d.ts +0 -1
  26. package/dist/components/Link.d.ts.map +1 -1
  27. package/dist/components/Link.js +4 -6
  28. package/dist/hydrate/hydrate.d.ts.map +1 -1
  29. package/dist/hydrate/hydrate.js +0 -4
  30. package/dist/testing/createTestApp.d.ts +12 -0
  31. package/dist/testing/createTestApp.d.ts.map +1 -1
  32. package/dist/testing/createTestApp.js +9 -3
  33. package/dist/testing/host.d.ts.map +1 -1
  34. package/dist/testing/host.js +3 -3
  35. package/dist/testing/hydrateTestApp.d.ts +1 -0
  36. package/dist/testing/hydrateTestApp.d.ts.map +1 -1
  37. package/dist/testing/hydrateTestApp.js +10 -4
  38. package/dist/testing/index.d.ts +1 -1
  39. package/dist/testing/index.d.ts.map +1 -1
  40. package/dist/testing/testingComponentPackage.d.ts +6 -11
  41. package/dist/testing/testingComponentPackage.d.ts.map +1 -1
  42. package/dist/testing/testingComponentPackage.js +20 -23
  43. package/package.json +1 -1
@@ -1,43 +1,40 @@
1
- import { $trueStoreCell } from '../Store/makeStore.js';
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
- [$trueStoreCell]: true,
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
- const storeField = (key, value) => value === undefined ? missingStoreValue(key) : storeValue(value);
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
- location: storeField('internalStore.location', supplied?.location),
34
- matchedRouteInfo: storeField('internalStore.matchedRouteInfo', supplied?.matchedRouteInfo),
35
- popMessages: storeField('internalStore.popMessages', supplied?.popMessages)
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: false,
37
+ clientSideNav: true,
41
38
  siteBasePath: '',
42
39
  staticSite: false,
43
40
  csr: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tungsten",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "bin": {