tempest.games 0.2.69 → 0.2.71

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/app/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>TEMPEST</title>
8
- <script type="module" crossorigin src="/assets/index-CCuiNaIa.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BQfBw87O.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-DZ_4vJcE.css">
10
10
  </head>
11
11
  <body>
@@ -50206,7 +50206,9 @@ var markDone = (store, key) => {
50206
50206
  }
50207
50207
  store.operation.done.add(key);
50208
50208
  };
50209
- function dispatchOrDeferStateUpdate(target, state, { oldValue, newValue }, stateIsNewlyCreated, family) {
50209
+ function dispatchOrDeferStateUpdate(target, state, proto, stateIsNewlyCreated, family) {
50210
+ const { oldValue, newValue } = proto;
50211
+ const hasOldValue = `oldValue` in proto;
50210
50212
  const token = deposit(state);
50211
50213
  if (stateIsNewlyCreated && family) {
50212
50214
  state.subject.next({ newValue });
@@ -50239,10 +50241,14 @@ function dispatchOrDeferStateUpdate(target, state, { oldValue, newValue }, state
50239
50241
  return;
50240
50242
  }
50241
50243
  const { key, subject, type } = state;
50242
- const update = {
50243
- oldValue: isTransceiver(oldValue) ? oldValue.READONLY_VIEW : oldValue,
50244
- newValue: isTransceiver(newValue) ? newValue.READONLY_VIEW : newValue
50245
- };
50244
+ let update;
50245
+ if (hasOldValue)
50246
+ update = {
50247
+ oldValue: isTransceiver(oldValue) ? oldValue.READONLY_VIEW : oldValue,
50248
+ newValue: isTransceiver(newValue) ? newValue.READONLY_VIEW : newValue
50249
+ };
50250
+ else
50251
+ update = { newValue: isTransceiver(newValue) ? newValue.READONLY_VIEW : newValue };
50246
50252
  if (isRootStore(target)) {
50247
50253
  switch (type) {
50248
50254
  case `mutable_atom`:
@@ -50278,13 +50284,29 @@ function dispatchOrDeferStateUpdate(target, state, { oldValue, newValue }, state
50278
50284
  }
50279
50285
  }
50280
50286
  }
50287
+ var UNSET = Symbol(`UNSET`);
50281
50288
  var setAtom = (target, atom, next) => {
50282
- const oldValue = readOrComputeValue(target, atom, `mut`);
50283
- let newValue = become(next, oldValue);
50289
+ let oldValue;
50290
+ let newValue;
50291
+ if (isFn(next)) {
50292
+ const prev = readOrComputeValue(target, atom, `mut`);
50293
+ oldValue = prev;
50294
+ newValue = next(prev);
50295
+ } else {
50296
+ if (target.valueMap.has(atom.key))
50297
+ oldValue = readFromCache(target, atom, `mut`);
50298
+ else if (atom.type === `atom` && !isFn(atom.default))
50299
+ oldValue = atom.default;
50300
+ else
50301
+ oldValue = UNSET;
50302
+ newValue = next;
50303
+ }
50284
50304
  target.logger.info(`\u2B50`, `atom`, atom.key, `setting value`, newValue);
50285
50305
  newValue = writeToCache(target, atom, newValue);
50286
50306
  markDone(target, atom.key);
50287
50307
  evictDownstreamFromAtom(target, atom);
50308
+ if (oldValue === UNSET)
50309
+ return { newValue };
50288
50310
  return {
50289
50311
  oldValue,
50290
50312
  newValue
@@ -2056,7 +2056,9 @@ var markDone = (store, key) => {
2056
2056
  }
2057
2057
  store.operation.done.add(key);
2058
2058
  };
2059
- function dispatchOrDeferStateUpdate(target, state, { oldValue, newValue }, stateIsNewlyCreated, family) {
2059
+ function dispatchOrDeferStateUpdate(target, state, proto, stateIsNewlyCreated, family) {
2060
+ const { oldValue, newValue } = proto;
2061
+ const hasOldValue = `oldValue` in proto;
2060
2062
  const token = deposit(state);
2061
2063
  if (stateIsNewlyCreated && family) {
2062
2064
  state.subject.next({ newValue });
@@ -2089,10 +2091,14 @@ function dispatchOrDeferStateUpdate(target, state, { oldValue, newValue }, state
2089
2091
  return;
2090
2092
  }
2091
2093
  const { key, subject, type } = state;
2092
- const update = {
2093
- oldValue: isTransceiver(oldValue) ? oldValue.READONLY_VIEW : oldValue,
2094
- newValue: isTransceiver(newValue) ? newValue.READONLY_VIEW : newValue
2095
- };
2094
+ let update;
2095
+ if (hasOldValue)
2096
+ update = {
2097
+ oldValue: isTransceiver(oldValue) ? oldValue.READONLY_VIEW : oldValue,
2098
+ newValue: isTransceiver(newValue) ? newValue.READONLY_VIEW : newValue
2099
+ };
2100
+ else
2101
+ update = { newValue: isTransceiver(newValue) ? newValue.READONLY_VIEW : newValue };
2096
2102
  if (isRootStore(target)) {
2097
2103
  switch (type) {
2098
2104
  case `mutable_atom`:
@@ -2128,13 +2134,29 @@ function dispatchOrDeferStateUpdate(target, state, { oldValue, newValue }, state
2128
2134
  }
2129
2135
  }
2130
2136
  }
2137
+ var UNSET = Symbol(`UNSET`);
2131
2138
  var setAtom = (target, atom, next) => {
2132
- const oldValue = readOrComputeValue(target, atom, `mut`);
2133
- let newValue = become(next, oldValue);
2139
+ let oldValue;
2140
+ let newValue;
2141
+ if (isFn(next)) {
2142
+ const prev = readOrComputeValue(target, atom, `mut`);
2143
+ oldValue = prev;
2144
+ newValue = next(prev);
2145
+ } else {
2146
+ if (target.valueMap.has(atom.key))
2147
+ oldValue = readFromCache(target, atom, `mut`);
2148
+ else if (atom.type === `atom` && !isFn(atom.default))
2149
+ oldValue = atom.default;
2150
+ else
2151
+ oldValue = UNSET;
2152
+ newValue = next;
2153
+ }
2134
2154
  target.logger.info(`\u2B50`, `atom`, atom.key, `setting value`, newValue);
2135
2155
  newValue = writeToCache(target, atom, newValue);
2136
2156
  markDone(target, atom.key);
2137
2157
  evictDownstreamFromAtom(target, atom);
2158
+ if (oldValue === UNSET)
2159
+ return { newValue };
2138
2160
  return {
2139
2161
  oldValue,
2140
2162
  newValue