studio-engine 0.52.2 → 0.52.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b252a824ebae2c1a14b0efb4a89a056207f11550c6f21585d290b5469960134
4
- data.tar.gz: d45781ea692d918b89770e19675af88f68fb717f8906dc525ead01aefff02836
3
+ metadata.gz: b1964a19e1e50b6a7ed315212d926a3c02dc63559927a7976a454215b655dc11
4
+ data.tar.gz: a6fba155e470f8b15ef0b9125920397a51f07a98d34b3f3f4ad5b238a1308d92
5
5
  SHA512:
6
- metadata.gz: 12b68644186bbfd48b52d4ca073f305b04367538acea66b480e1313cfead58053c0abe3d2f2d49318728d0a99470df3d74f36e784fba5f09cdc926f0c68dd3cf
7
- data.tar.gz: 06a8baea9fa0164bf7cff3b823148d4c90f349b89949cedc0d3a8c6d165bf3c95314dd4eb0fe1929638c9434426618d076bc9e983d80cbff4778b988a1caf6ae
6
+ metadata.gz: 46f6bbc8dbe8350a4b6697a2af4fd25dc13e22d9f886e8912f07f27adbf605adb708a70e9ac56778819efad2fff619485dbdc5b1f9fa1905226a3c2c47e29b2d
7
+ data.tar.gz: d4d7d64b08d2f60871d3828ad5f261aa9cba51d1e79e12024677bd84c22b2f3de2dee4195a17501082db8c68f65bdd0c0bc39d3db88dbab7b585b62dcbe74f94
data/CHANGELOG.md CHANGED
@@ -4,6 +4,29 @@ The format is [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This pro
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ### Fixed
8
+
9
+ - **The birthday calendar measures itself instead of guessing, so a flipped
10
+ popover stays attached to its field.** `place()` used a hardcoded
11
+ `estimatedHeight = 340` for both the flip DECISION and the flipped COORDINATE.
12
+ The real popover is about 245px, so whenever the field sat near the bottom of
13
+ the viewport the calendar opened roughly 95px above where it belonged — visibly
14
+ detached, and jumping on every scroll, because scroll re-runs the same
15
+ arithmetic.
16
+
17
+ It now reads the popover's own `offsetHeight` through an `x-ref`, with the
18
+ constant surviving only as the fallback for the first call before the element
19
+ is shown. `toggle()` places twice: once so it never appears at 0,0 for a frame,
20
+ then again in `$nextTick` — the call that can actually measure, since
21
+ `offsetHeight` is 0 while `x-show` still has it hidden.
22
+
23
+ **No earlier spec had ever run the flip branch.** The lab's field sits near the
24
+ top with room below, so every placement assertion exercised the below-branch
25
+ only, and "it fits on screen" cannot catch this — a popover 95px too high still
26
+ fits. The new spec forces the flip, asserts the flip actually happened, and then
27
+ asserts the popover's bottom edge sits against the trigger's top edge.
28
+
29
+
7
30
  ### Changed
8
31
 
9
32
  - **The edit page's avatar is now the control; its corner badge is gone.**
@@ -66,6 +66,7 @@
66
66
  </button>
67
67
 
68
68
  <div x-show="open" x-cloak
69
+ x-ref="popover"
69
70
  @click.outside="open = false"
70
71
  @keydown.escape.window="open = false"
71
72
  @scroll.window="place()" @resize.window="place()"
@@ -117,27 +117,50 @@
117
117
 
118
118
  toggle() {
119
119
  this.open = !this.open;
120
- if (this.open) {
121
- this.syncViewFromValue();
122
- this.place();
123
- }
120
+ if (!this.open) return;
121
+
122
+ this.syncViewFromValue();
123
+
124
+ // Placed twice, deliberately. The first call stops the popover appearing
125
+ // at 0,0 for a frame; the second is the one that can MEASURE, because
126
+ // offsetHeight is 0 while x-show still has the element hidden.
127
+ this.place();
128
+ this.$nextTick(function () { this.place(); }.bind(this));
124
129
  },
125
130
 
126
131
  // Placed from the trigger's rect because the popover is fixed. Flips above
127
132
  // the trigger when there is not room below, so it never opens off-screen on
128
133
  // a short viewport.
134
+ //
135
+ // THE HEIGHT IS MEASURED, NOT GUESSED, and that distinction is the bug the
136
+ // operator reported. This used a hardcoded `estimatedHeight = 340` for both
137
+ // the decision AND the flipped coordinate. The real popover is about 245px,
138
+ // so a flip landed ~95px too high and the calendar floated visibly detached
139
+ // from its field — and since scroll re-runs this, it kept jumping. The
140
+ // arithmetic was legible in the screenshot: trigger at 640, popover at 300,
141
+ // and 640 - 340 - 4 = 316.
142
+ //
143
+ // The element is rendered under x-show (display is toggled, it stays in the
144
+ // DOM), so offsetHeight is readable as soon as it is shown. The constant
145
+ // survives only as the fallback for the first call, before the ref exists.
129
146
  place() {
130
147
  var el = this.$refs.trigger;
131
148
  if (!el) return;
149
+
132
150
  var r = el.getBoundingClientRect();
133
- var estimatedHeight = 340;
151
+ var popover = this.$refs.popover;
152
+ var height = (popover && popover.offsetHeight) || 340;
153
+ var GAP = 4;
134
154
  var below = window.innerHeight - r.bottom;
135
155
 
136
156
  this.left = r.left;
137
157
  this.width = r.width;
138
- this.top = below < estimatedHeight && r.top > estimatedHeight
139
- ? r.top - estimatedHeight - 4
140
- : r.bottom + 4;
158
+
159
+ // Flip only when there is room ABOVE to flip into. Falling back to
160
+ // below-placement when neither fits keeps the popover attached to its
161
+ // field rather than pinned to the top of the viewport.
162
+ var flip = below < height + GAP && r.top > height + GAP;
163
+ this.top = flip ? r.top - height - GAP : r.bottom + GAP;
141
164
  }
142
165
  };
143
166
  };
@@ -1,3 +1,3 @@
1
1
  module Studio
2
- VERSION = "0.52.2"
2
+ VERSION = "0.52.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: studio-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.52.2
4
+ version: 0.52.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex McRitchie