@designcrowd/library.brand-page 5.18.1-undo-33 → 5.18.1-undo-34
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/src/{CreatedOnBrandCrowd-de-de-986OpXvU.js → CreatedOnBrandCrowd-de-de-D-2WhY-F.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-CTZuZ366.js → CreatedOnBrandCrowd-en-us-B7ldKpJK.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-CHrTgX9-.js → CreatedOnBrandCrowd-es-es-BatQY8Tt.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-xJAvxQ-x.js → CreatedOnBrandCrowd-fr-ca-CFivOJkN.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-xJAvxQ-x.js → CreatedOnBrandCrowd-fr-fr-CFivOJkN.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-lpRIGIcs.js → CreatedOnBrandCrowd-pt-br-wHkXfYLP.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-lpRIGIcs.js → CreatedOnBrandCrowd-pt-pt-wHkXfYLP.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-CZuim3ee.js → CreatedOnDcom-de-de--HwniV-Y.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-DG4I5f4s.js → CreatedOnDcom-en-us-Bqm5NnRX.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-Hpieh1wX.js → CreatedOnDcom-es-es-COGQIuEn.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-DWr5P-df.js → CreatedOnDcom-fr-ca-eVDHO7MX.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-CHfOyS6V.js → CreatedOnDcom-fr-fr-BhGKbdoG.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-bQwCCDDI.js → CreatedOnDcom-pt-br-5kDZKPZc.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-bo-i_h0N.js → CreatedOnDcom-pt-pt-CnTcVxct.js} +1 -1
- package/lib/src/brand-page-maker/stores/history/history-store.js +47 -18
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-DNHBgZyy.js → lib-B5jbN-ro.js} +3878 -3875
- package/package.json +1 -1
- package/src/brand-page-maker/stores/history/history-store.test.ts +32 -0
- package/src/brand-page-maker/stores/history/history-store.ts +48 -18
|
@@ -99,13 +99,19 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
99
99
|
return undefined;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
|
|
102
|
+
// Two-phase merge flag. Hydration write sites call `mergeNextMutation()`
|
|
103
|
+
// immediately before their imperative write, which sets `mergeArmed`.
|
|
104
|
+
// When the watcher's `scheduleAutoCapture` arms a new idle timer, it
|
|
105
|
+
// transfers `mergeArmed` into `pendingTimerIsMerge`. The flush then
|
|
106
|
+
// consumes `pendingTimerIsMerge` and merges into the current head
|
|
107
|
+
// instead of pushing.
|
|
108
|
+
//
|
|
109
|
+
// The microtask cleanup on `mergeArmed` prevents stale flags surviving
|
|
110
|
+
// when the user navigates away (e.g. sidebar tab switch) before the
|
|
111
|
+
// flagged write actually happens — a previously-set arm is dropped
|
|
112
|
+
// synchronously after the current tick if no watcher fired.
|
|
113
|
+
const mergeArmed = ref(false);
|
|
114
|
+
let pendingTimerIsMerge = false;
|
|
109
115
|
// Returns 'noop' when no-change vs current head, 'oversized' when over
|
|
110
116
|
// MAX_ENTRY_BYTES, else 'committed'. Truncates the redo tail, caps at
|
|
111
117
|
// MAX_ENTRIES, evicts oldest non-baseline to stay under MAX_MEMORY_BYTES.
|
|
@@ -200,10 +206,11 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
200
206
|
// anything.
|
|
201
207
|
const inSettleWindow = currentIndex.value === 0 &&
|
|
202
208
|
Date.now() - baselineCapturedAt < BASELINE_SETTLE_MS;
|
|
203
|
-
// Merge:
|
|
204
|
-
// current head in place instead of
|
|
205
|
-
|
|
206
|
-
|
|
209
|
+
// Merge: the timer that fired this flush was armed during a
|
|
210
|
+
// hydration burst — replace the current head in place instead of
|
|
211
|
+
// pushing. Consumed once.
|
|
212
|
+
const shouldMerge = pendingTimerIsMerge;
|
|
213
|
+
pendingTimerIsMerge = false;
|
|
207
214
|
if (inSettleWindow) {
|
|
208
215
|
entries.value = [
|
|
209
216
|
{
|
|
@@ -240,12 +247,19 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
240
247
|
};
|
|
241
248
|
// Monotonic — first mutation arms; subsequent ones inside the window
|
|
242
249
|
// don't reset. Gated on isApplyingSnapshot so undo/redo don't leave
|
|
243
|
-
// a stale timer ticking.
|
|
250
|
+
// a stale timer ticking. If a hydration site armed `mergeArmed`
|
|
251
|
+
// immediately before the mutation that triggered this run, transfer
|
|
252
|
+
// the intent into `pendingTimerIsMerge` so the resulting flush
|
|
253
|
+
// merges instead of commits.
|
|
244
254
|
const scheduleAutoCapture = () => {
|
|
245
255
|
if (isApplyingSnapshot.value)
|
|
246
256
|
return;
|
|
247
257
|
if (idleTimerId !== null)
|
|
248
258
|
return;
|
|
259
|
+
if (mergeArmed.value) {
|
|
260
|
+
pendingTimerIsMerge = true;
|
|
261
|
+
mergeArmed.value = false;
|
|
262
|
+
}
|
|
249
263
|
idleTimerId = setTimeout(flush, CAPTURE_DEBOUNCE_MS);
|
|
250
264
|
maxWaitTimerId = setTimeout(flush, CAPTURE_MAX_WAIT_MS);
|
|
251
265
|
};
|
|
@@ -361,9 +375,10 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
361
375
|
}
|
|
362
376
|
const targetEntry = entries.value[targetIndex];
|
|
363
377
|
isApplyingSnapshot.value = true;
|
|
364
|
-
// Clear any unconsumed merge
|
|
378
|
+
// Clear any unconsumed merge intent — a stale flag would fold the
|
|
365
379
|
// post-apply tick into the restored entry and erase the redo.
|
|
366
|
-
|
|
380
|
+
mergeArmed.value = false;
|
|
381
|
+
pendingTimerIsMerge = false;
|
|
367
382
|
cancelPendingAutoCapture();
|
|
368
383
|
try {
|
|
369
384
|
await brandPageMakerStore.applyHistorySnapshot(snapshot, resolvedActivePageId, targetEntry?.logoEdits);
|
|
@@ -415,7 +430,8 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
415
430
|
if (!baselineCaptured.value)
|
|
416
431
|
return;
|
|
417
432
|
cancelPendingAutoCapture();
|
|
418
|
-
|
|
433
|
+
mergeArmed.value = false;
|
|
434
|
+
pendingTimerIsMerge = false;
|
|
419
435
|
entries.value = [];
|
|
420
436
|
currentIndex.value = -1;
|
|
421
437
|
baselineCaptured.value = false;
|
|
@@ -423,10 +439,23 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
423
439
|
captureBaseline();
|
|
424
440
|
}
|
|
425
441
|
// Hydration write sites call this immediately before their imperative
|
|
426
|
-
// mutation
|
|
427
|
-
//
|
|
442
|
+
// mutation. The arm is auto-cleared on the next Vue tick — `nextTick`
|
|
443
|
+
// runs AFTER all queued reactive effects (including the watcher), so
|
|
444
|
+
// if the hydration write triggered `scheduleAutoCapture`, the arm has
|
|
445
|
+
// already been transferred into `pendingTimerIsMerge` before this
|
|
446
|
+
// cleanup fires. If no mutation followed (e.g. the user navigated
|
|
447
|
+
// away before the flagged write), the cleanup drops the stale arm so
|
|
448
|
+
// it can't be consumed by an unrelated future mutation.
|
|
428
449
|
function mergeNextMutation() {
|
|
429
|
-
|
|
450
|
+
mergeArmed.value = true;
|
|
451
|
+
// setTimeout(0) is a macrotask — runs AFTER the synchronous write
|
|
452
|
+
// and AFTER Vue's microtask flush of the watcher's reactive effect.
|
|
453
|
+
// If `scheduleAutoCapture` fired in between (the imperative write
|
|
454
|
+
// triggered the watcher), the arm has already been transferred into
|
|
455
|
+
// `pendingTimerIsMerge` before this cleanup runs.
|
|
456
|
+
setTimeout(() => {
|
|
457
|
+
mergeArmed.value = false;
|
|
458
|
+
}, 0);
|
|
430
459
|
}
|
|
431
460
|
// --- Instrumentation (NFR-04a) ---
|
|
432
461
|
function getCurrentSizeBytes() {
|
package/lib/src/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as E, a as T, b as s, c as I, d as S, e as N, f as e, B as A, g as O, h as C, i as G, j as D, k as P, l as t, m as R, n as L, o as M, p as o, q as r, r as b, s as n, t as F, u as i, v as l, w as g, x as B, y as c, z as Y, C as U, D as d, E as u, F as H, G as p, H as y, I as K, J as k, K as m, L as V, M as X, N as h, O as v, P as W, Q as f, R as x, S as z, T as w, U as Z, V as j, W as Q, X as q, Y as J, Z as $, $ as aa, a0 as _a, a1 as Ea, a2 as Ta, a3 as sa, a4 as Ia, a5 as Sa, a6 as Na, a7 as ea, a8 as Aa, a9 as Oa, aa as Ca, ab as Ga, ac as Da, ad as Pa, ae as ta, af as Ra, ag as La, ah as Ma, ai as oa, aj as ra, ak as ba, al as na, am as Fa, an as ia, ao as la, ap as ga, aq as Ba, ar as ca, as as Ya, at as Ua, au as da, av as ua, aw as Ha, ax as pa, ay as ya, az as Ka, aA as ka, aB as ma, aC as Va, aD as Xa, aE as ha, aF as va, aG as Wa, aH as fa, aI as xa, aJ as za, aK as wa, aL as Za, aM as ja, aN as Qa, aO as qa, aP as Ja, aQ as $a, aR as a_, aS as __, aT as E_, aU as T_, aV as s_, aW as I_, aX as S_, aY as N_, aZ as e_, a_ as A_, a$ as O_, b0 as C_, b1 as G_, b2 as D_, b3 as P_, b4 as t_, b5 as R_, b6 as L_, b7 as M_, b8 as o_, b9 as r_, ba as b_, bb as n_, bc as F_, bd as i_, be as l_, bf as g_, bg as B_, bh as c_, bi as Y_, bj as U_, bk as d_, bl as u_, bm as H_, bn as p_, bo as y_, bp as K_, bq as k_, br as m_, bs as V_, bt as X_, bu as h_, bv as v_, bw as W_, bx as f_, by as x_, bz as z_, bA as w_, bB as Z_, bC as j_, bD as Q_, bE as q_, bF as J_, bG as $_, bH as aE, bI as _E, bJ as EE, bK as TE, bL as sE, bM as IE, bN as SE, bO as NE, bP as eE, bQ as AE, bR as OE, bS as CE, bT as GE, bU as DE, bV as PE, bW as tE, bX as RE, bY as LE, bZ as ME, b_ as oE, b$ as rE, c0 as bE, c1 as nE, c2 as FE, c3 as iE, c4 as lE, c5 as gE, c6 as BE, c7 as cE, c8 as YE, c9 as UE, ca as dE, cb as uE, cc as HE, cd as pE, ce as yE, cf as KE, cg as kE, ch as mE, ci as VE, cj as XE, ck as hE, cl as vE, cm as WE, cn as fE, co as xE } from "./lib-
|
|
1
|
+
import { A as E, a as T, b as s, c as I, d as S, e as N, f as e, B as A, g as O, h as C, i as G, j as D, k as P, l as t, m as R, n as L, o as M, p as o, q as r, r as b, s as n, t as F, u as i, v as l, w as g, x as B, y as c, z as Y, C as U, D as d, E as u, F as H, G as p, H as y, I as K, J as k, K as m, L as V, M as X, N as h, O as v, P as W, Q as f, R as x, S as z, T as w, U as Z, V as j, W as Q, X as q, Y as J, Z as $, $ as aa, a0 as _a, a1 as Ea, a2 as Ta, a3 as sa, a4 as Ia, a5 as Sa, a6 as Na, a7 as ea, a8 as Aa, a9 as Oa, aa as Ca, ab as Ga, ac as Da, ad as Pa, ae as ta, af as Ra, ag as La, ah as Ma, ai as oa, aj as ra, ak as ba, al as na, am as Fa, an as ia, ao as la, ap as ga, aq as Ba, ar as ca, as as Ya, at as Ua, au as da, av as ua, aw as Ha, ax as pa, ay as ya, az as Ka, aA as ka, aB as ma, aC as Va, aD as Xa, aE as ha, aF as va, aG as Wa, aH as fa, aI as xa, aJ as za, aK as wa, aL as Za, aM as ja, aN as Qa, aO as qa, aP as Ja, aQ as $a, aR as a_, aS as __, aT as E_, aU as T_, aV as s_, aW as I_, aX as S_, aY as N_, aZ as e_, a_ as A_, a$ as O_, b0 as C_, b1 as G_, b2 as D_, b3 as P_, b4 as t_, b5 as R_, b6 as L_, b7 as M_, b8 as o_, b9 as r_, ba as b_, bb as n_, bc as F_, bd as i_, be as l_, bf as g_, bg as B_, bh as c_, bi as Y_, bj as U_, bk as d_, bl as u_, bm as H_, bn as p_, bo as y_, bp as K_, bq as k_, br as m_, bs as V_, bt as X_, bu as h_, bv as v_, bw as W_, bx as f_, by as x_, bz as z_, bA as w_, bB as Z_, bC as j_, bD as Q_, bE as q_, bF as J_, bG as $_, bH as aE, bI as _E, bJ as EE, bK as TE, bL as sE, bM as IE, bN as SE, bO as NE, bP as eE, bQ as AE, bR as OE, bS as CE, bT as GE, bU as DE, bV as PE, bW as tE, bX as RE, bY as LE, bZ as ME, b_ as oE, b$ as rE, c0 as bE, c1 as nE, c2 as FE, c3 as iE, c4 as lE, c5 as gE, c6 as BE, c7 as cE, c8 as YE, c9 as UE, ca as dE, cb as uE, cc as HE, cd as pE, ce as yE, cf as KE, cg as kE, ch as mE, ci as VE, cj as XE, ck as hE, cl as vE, cm as WE, cn as fE, co as xE } from "./lib-B5jbN-ro.js";
|
|
2
2
|
import { createPinia as wE, setActivePinia as ZE } from "pinia";
|
|
3
3
|
export {
|
|
4
4
|
E as ABOUT_SECTION_SETTINGS_CONFIG,
|