mnfst 0.5.194 → 0.5.196

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.
@@ -100,13 +100,17 @@
100
100
  function commitParticipants() { state.participants = [..._participants.values()]; rev().n++; }
101
101
  function commitTyping() { state.typing = [..._typing.values()]; rev().n++; }
102
102
 
103
+ // server echo reconciles body/media/status onto the local copy
104
+ function merge(target, incoming) {
105
+ Object.assign(target.body, incoming.body);
106
+ for (const k of Object.keys(incoming)) if (k !== 'body' && k !== '_seq') target[k] = incoming[k];
107
+ }
108
+
103
109
  function upsert(raw) {
104
110
  const incoming = normalize(raw, ++seq);
105
111
  const prev = incoming.id != null ? _byId.get(incoming.id) : null;
106
112
  if (prev) {
107
- // merge — server echo reconciles body/media/status onto the local copy
108
- Object.assign(prev.body, incoming.body);
109
- for (const k of Object.keys(incoming)) if (k !== 'body' && k !== '_seq') prev[k] = incoming[k];
113
+ merge(prev, incoming);
110
114
  } else {
111
115
  _msgs.push(incoming);
112
116
  if (incoming.id != null) _byId.set(incoming.id, incoming);
@@ -178,7 +182,16 @@
178
182
  try {
179
183
  const ack = await adapter.send(conversationId, Object.assign({}, draft, { body }));
180
184
  _byId.delete(tmp);
181
- local.id = ack.id; local.ts = ack.ts; local.status = 'sent'; local._optimistic = false;
185
+ // A bus that echoes our own send can beat the ack; that echo lands
186
+ // while this row is still tmp-keyed, so it appended as its own entry.
187
+ const echo = ack.id != null ? _byId.get(ack.id) : null;
188
+ if (echo && echo !== local) {
189
+ merge(local, echo);
190
+ const at = _msgs.indexOf(echo); if (at > -1) _msgs.splice(at, 1);
191
+ }
192
+ local.id = ack.id; local._optimistic = false;
193
+ if (ack.ts != null) local.ts = ack.ts;
194
+ if (local.status === 'pending') local.status = 'sent';
182
195
  if (ack.conversationId && ack.conversationId !== local.conversationId) {
183
196
  const from = local.conversationId; local.conversationId = ack.conversationId;
184
197
  if (!isAggregate) state.lastRehome = { from, to: ack.conversationId }; // single-chat: cockpit must retarget
@@ -10,13 +10,18 @@
10
10
 
11
11
  @layer base {
12
12
 
13
+ /* Animates `scale`, not `transform`. With fill mode `both` a transform
14
+ animation keeps its final value forever, which silently overrides any
15
+ transform an author put on a popover — so a menu positioned with
16
+ translate(-50%) simply would not move. The standalone property leaves
17
+ transform free. */
13
18
  @keyframes mnfst-popover-in {
14
19
  from {
15
- transform: scale(.9)
20
+ scale: .9
16
21
  }
17
22
 
18
23
  to {
19
- transform: none
24
+ scale: 1
20
25
  }
21
26
  }
22
27
 
@@ -2547,6 +2547,11 @@ function initializeColorpickerPlugin() {
2547
2547
 
2548
2548
  const isDialog = target.tagName === 'DIALOG';
2549
2549
 
2550
+ // A generated panel is appended to <body>, so manifest.dialog.css can't
2551
+ // tell from DOM position that it belongs to a swatch inside a dialog
2552
+ // rather than to the page behind it, and fades it out. Say so here.
2553
+ if (el.closest('[popover]')) target.setAttribute('data-popover-nested', '');
2554
+
2550
2555
  // Non-dialog popover targets route through x-dropdown (anchored like
2551
2556
  // a dropdown). <dialog> targets open imperatively on click instead
2552
2557
  // (modal/centered, not trigger-anchored).
@@ -2568,7 +2573,9 @@ function initializeColorpickerPlugin() {
2568
2573
  e.preventDefault();
2569
2574
  try {
2570
2575
  if (target.hasAttribute('popover')) {
2571
- if (!target.matches(':popover-open')) target.showPopover();
2576
+ // `source` names the swatch as the invoker, so opening the
2577
+ // panel can't light-dismiss a dialog or menu it sits inside.
2578
+ if (!target.matches(':popover-open')) target.showPopover({ source: el });
2572
2579
  } else {
2573
2580
  if (!target.open) target.showModal();
2574
2581
  }