mnfst 0.5.195 → 0.5.197
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/lib/manifest.chat.js +15 -2
- package/lib/manifest.colorpicker.css +7 -2
- package/lib/manifest.colorpicker.js +8 -1
- package/lib/manifest.css +537 -189
- package/lib/manifest.d.ts +80 -1
- package/lib/manifest.datepicker.css +7 -2
- package/lib/manifest.datepicker.js +11 -2
- package/lib/manifest.dialog.css +12 -4
- package/lib/manifest.dropdown.css +7 -2
- package/lib/manifest.dropdowns.js +9 -1
- package/lib/manifest.edit.css +335 -0
- package/lib/manifest.edit.js +1373 -0
- package/lib/manifest.form.css +6 -4
- package/lib/manifest.integrity.json +7 -5
- package/lib/manifest.js +6 -1
- package/lib/manifest.min.css +1 -1
- package/lib/manifest.resize.css +81 -120
- package/lib/manifest.sidebar.css +7 -2
- package/lib/manifest.text.edit.css +204 -0
- package/lib/manifest.text.edit.js +2020 -0
- package/package.json +2 -1
package/lib/manifest.chat.js
CHANGED
|
@@ -106,11 +106,24 @@
|
|
|
106
106
|
for (const k of Object.keys(incoming)) if (k !== 'body' && k !== '_seq') target[k] = incoming[k];
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
// own echo beating the ack: claim the pending row by meta.clientId
|
|
110
|
+
function claimPending(incoming) {
|
|
111
|
+
const cid = incoming.meta && incoming.meta.clientId;
|
|
112
|
+
if (cid == null || !state.me || !incoming.author || incoming.author.id !== state.me.id) return null;
|
|
113
|
+
return _msgs.find(m => m._optimistic && m._clientId === cid) || null;
|
|
114
|
+
}
|
|
115
|
+
|
|
109
116
|
function upsert(raw) {
|
|
110
117
|
const incoming = normalize(raw, ++seq);
|
|
111
118
|
const prev = incoming.id != null ? _byId.get(incoming.id) : null;
|
|
119
|
+
const pending = prev ? null : claimPending(incoming);
|
|
112
120
|
if (prev) {
|
|
113
121
|
merge(prev, incoming);
|
|
122
|
+
} else if (pending) {
|
|
123
|
+
_byId.delete(pending.id);
|
|
124
|
+
merge(pending, incoming);
|
|
125
|
+
pending._optimistic = false;
|
|
126
|
+
if (pending.id != null) _byId.set(pending.id, pending);
|
|
114
127
|
} else {
|
|
115
128
|
_msgs.push(incoming);
|
|
116
129
|
if (incoming.id != null) _byId.set(incoming.id, incoming);
|
|
@@ -176,11 +189,11 @@
|
|
|
176
189
|
async function send(draft) {
|
|
177
190
|
const tmp = 'tmp_' + (++seq);
|
|
178
191
|
const body = draft && draft.body ? draft.body : { text: draft && draft.text != null ? draft.text : '' };
|
|
179
|
-
const local = normalize({ id: tmp, conversationId, author: state.me, body, replyTo: draft && draft.replyTo, status: 'pending', ts: null, _optimistic: true }, ++seq);
|
|
192
|
+
const local = normalize({ id: tmp, conversationId, author: state.me, body, replyTo: draft && draft.replyTo, status: 'pending', ts: null, _optimistic: true, _clientId: tmp }, ++seq);
|
|
180
193
|
_msgs.push(local); _byId.set(tmp, local); commit();
|
|
181
194
|
if (!adapter.send) { local.status = 'failed'; local.statusReason = 'unsupported'; commit(); return; }
|
|
182
195
|
try {
|
|
183
|
-
const ack = await adapter.send(conversationId, Object.assign({}, draft, { body }));
|
|
196
|
+
const ack = await adapter.send(conversationId, Object.assign({}, draft, { body, clientId: tmp }));
|
|
184
197
|
_byId.delete(tmp);
|
|
185
198
|
// A bus that echoes our own send can beat the ack; that echo lands
|
|
186
199
|
// while this row is still tmp-keyed, so it appended as its own entry.
|
|
@@ -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
|
-
|
|
20
|
+
scale: .9
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
to {
|
|
19
|
-
|
|
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
|
-
|
|
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
|
}
|