querysub 0.702.0 → 0.704.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "querysub",
3
- "version": "0.702.0",
3
+ "version": "0.704.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -760,11 +760,11 @@ class QRenderClass {
760
760
  if (equalJSON) {
761
761
  // ALSO, we need to make sure the change WAS only because of props...
762
762
  let changes = renderWatcher.triggeredByChanges;
763
- let propsPath = isValueProxy2(props)!;
763
+ let propsPath = getProxyPath(() => self.data().props);
764
764
  let onlyPropsChanges = (
765
- Array.from(changes?.newParentsSynced || []).every(p => p.startsWith(propsPath))
765
+ !Array.from(changes?.newParentsSynced || []).some(p => p !== propsPath)
766
766
  && !changes?.extraReasons?.length
767
- && Array.from(changes?.paths || []).every(p => p.startsWith(propsPath))
767
+ && !Array.from(changes?.paths || []).some(p => p !== propsPath)
768
768
  );
769
769
  if (onlyPropsChanges) {
770
770
  proxyWatcher.reuseLastWatches();
@@ -856,7 +856,8 @@ class QRenderClass {
856
856
  for (let [key, value] of Object.entries(vNode.props)) {
857
857
  rawProps[key] = value;
858
858
  }
859
- if (statics.deepProps) {
859
+ let childStatics = vNode.type as QComponentStatic;
860
+ if (childStatics.deepProps) {
860
861
  // NOTE: By removing atomic we can leverage the proxy automatically decomposing
861
862
  // the props to each individual primitive value.
862
863
  doProxyOptions({ atomicWrites: false }, () => {
@@ -864,6 +865,10 @@ class QRenderClass {
864
865
  props = syncedData.props;
865
866
  });
866
867
  } else {
868
+ let atomicProps = childStatics.atomicSetProps || childStatics.jsonComparePropUpdates;
869
+ if (atomicProps) {
870
+ syncedData.props = vNode.props;
871
+ }
867
872
  // Have each prop be a synced field, so conditional props work (accessing a prop not
868
873
  // provided returns undefined). Atomic writes is on, so write objects
869
874
  // aren't destructured (this allows passing functions, exotics, etc).
@@ -873,7 +878,9 @@ class QRenderClass {
873
878
  if (key === "className") {
874
879
  value = String(value);
875
880
  }
876
- syncedData.props[key] = value;
881
+ if (!atomicProps) {
882
+ syncedData.props[key] = value;
883
+ }
877
884
  // We then need to use a getter in the props, so that it causes a synced read
878
885
  // UNLESS that prop is not defined, then it is just undefined
879
886
  Object.defineProperty(props, key, {
@@ -3,8 +3,8 @@ import { css } from "typesafecss";
3
3
  import { formatNumber } from "socket-function/src/formatting/format";
4
4
 
5
5
  const FLASH_CLASS_NAME = "UsageBar-flash";
6
- const SUB_BAR_HEIGHT_PERCENT = 35;
7
- const SUB_BAR_ALPHA = 0.3;
6
+ const SUB_BAR_HUE = 210;
7
+ const SUB_BAR_ALPHA = 0.35;
8
8
 
9
9
  export const MEMORY_WARNING_THRESHOLD = 0.7;
10
10
  export const MEMORY_ERROR_THRESHOLD = 0.85;
@@ -56,11 +56,10 @@ export class UsageBar extends qreact.Component<{
56
56
  + (isError && (" " + FLASH_CLASS_NAME) || "")
57
57
  } />
58
58
  {subValue !== undefined && <div className={
59
- css.absolute.pos(0, `${100 - SUB_BAR_HEIGHT_PERCENT}%`).size(`${Math.min(subFraction, 1) * 100}%`, `${SUB_BAR_HEIGHT_PERCENT}%`).hsla(0, 0, 0, SUB_BAR_ALPHA)
59
+ css.absolute.pos(0, 0).size(`${Math.min(subFraction, 1) * 100}%`, "100%").hsla(SUB_BAR_HUE, 80, 55, SUB_BAR_ALPHA)
60
60
  } />}
61
- <div className={css.relative}>
62
- {label} ({formatNumber(value)}{suffix} / {formatNumber(max)}{suffix})
63
- {subValue !== undefined && <span className={css.opacity(0.75)}>, {subLabel || "sub"} {formatNumber(subValue)}{suffix}</span>}
61
+ <div className={css.relative} title={subValue !== undefined ? `${subLabel || "sub"} / used / total` : "used / total"}>
62
+ {label} ({subValue !== undefined && <span className={css.opacity(0.75)}>{formatNumber(subValue)}{suffix} / </span>}{formatNumber(value)}{suffix} / {formatNumber(max)}{suffix})
64
63
  </div>
65
64
  {isError && <style>{`
66
65
  @keyframes ${FLASH_CLASS_NAME}-anim {