@designcrowd/library.brand-page 5.17.25-undo-10 → 5.17.25-undo-14
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-C2CJCAQ1.js → CreatedOnBrandCrowd-de-de-D0AQ4h1Y.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-Bg5k7y_D.js → CreatedOnBrandCrowd-en-us-Bz9D9FcQ.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-DAaAXvzy.js → CreatedOnBrandCrowd-es-es-B6EKNEDx.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-B7C0ERbi.js → CreatedOnBrandCrowd-fr-ca-DvC5JIAW.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-B7C0ERbi.js → CreatedOnBrandCrowd-fr-fr-DvC5JIAW.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-1pvCqQK1.js → CreatedOnBrandCrowd-pt-br-tckhI2rl.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-1pvCqQK1.js → CreatedOnBrandCrowd-pt-pt-tckhI2rl.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-hbcr-qW0.js → CreatedOnDcom-de-de-BJAmW8nU.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-BToix_74.js → CreatedOnDcom-en-us-0IxL5rtr.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-DOCxN0tr.js → CreatedOnDcom-es-es-j1tEaAuh.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-Q3ZYgCxp.js → CreatedOnDcom-fr-ca-BHD4nfCD.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-C1-dUWKB.js → CreatedOnDcom-fr-fr-D4b447yE.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-KWKgld1I.js → CreatedOnDcom-pt-br-6WIaKLxK.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-CRR3Hfej.js → CreatedOnDcom-pt-pt-DSvzJLxn.js} +1 -1
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +21 -29
- package/lib/src/brand-page-maker/stores/history/history-store.d.ts +6 -0
- package/lib/src/brand-page-maker/stores/history/history-store.js +14 -28
- package/lib/src/brand-page-maker/stores/logo-store/logo-store.d.ts +1 -0
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-Bhf5ZHsd.js → lib-3NPiNYNp.js} +612 -610
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +2 -0
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +2 -0
- package/lib/src/shared/logo-settings/store/editable-logo-store.d.ts +9 -1
- package/lib/src/shared/logo-settings/store/editable-logo-store.js +33 -0
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +2 -0
- package/package.json +1 -1
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.test.ts +0 -74
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +25 -37
- package/src/brand-page-maker/stores/history/history-store.test.ts +11 -74
- package/src/brand-page-maker/stores/history/history-store.ts +20 -31
- package/src/brand-page-maker/stores/logo-store/logo-store.ts +5 -0
- package/src/shared/logo-settings/store/editable-logo-store.ts +45 -1
|
@@ -567,6 +567,9 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
567
567
|
// restored header logo. The preview rehydrates via the page contents,
|
|
568
568
|
// but `uiLogoSettings` holds its own copy that drives the sidebar
|
|
569
569
|
// "current logo" state — same pattern as `initialiseStoresByBrandPageModelAsync`.
|
|
570
|
+
// Also restores the variations grid + template asset for the
|
|
571
|
+
// snapshot's draft token (both are sidecars to `brandPageData` —
|
|
572
|
+
// BYO upload mutates them out of band).
|
|
570
573
|
this._syncLogoSettingsFromSnapshot(snapshot);
|
|
571
574
|
// 9. If the sidebar is editing a content item that no longer exists in
|
|
572
575
|
// the restored page, fall back to the Content tab so the user doesn't
|
|
@@ -585,37 +588,26 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
585
588
|
logoSettingsStore.setState({
|
|
586
589
|
newState: { selectedLogoImage: logoImage },
|
|
587
590
|
});
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
//
|
|
592
|
-
//
|
|
593
|
-
//
|
|
594
|
-
|
|
595
|
-
|
|
591
|
+
const draftToken = logoImage.logoDraftToken;
|
|
592
|
+
if (!draftToken)
|
|
593
|
+
return;
|
|
594
|
+
// Re-derive `enableEditMode` and the active template asset from the
|
|
595
|
+
// logo-store's draft registry. Drafts are append-only for the session,
|
|
596
|
+
// and BYO upload stamps `templateAsset` onto the registered draft when
|
|
597
|
+
// it lands — so the registered draft is enough to fully restore the
|
|
598
|
+
// sidebar's design/upload chooser without storing anything inside
|
|
599
|
+
// each history entry. The variations grid is restored from the
|
|
600
|
+
// editable-logo store's per-token cache (populated by every
|
|
601
|
+
// `updateEditableLogoImageUrlAsync` render).
|
|
602
|
+
const draft = logoStore.getLogoDraftAssetByToken(draftToken);
|
|
603
|
+
if (draft) {
|
|
596
604
|
editableLogoStore.setEnableEditMode(!draft.isByo);
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
// BYO upload renders ~10 MB across the four viewports, which would
|
|
601
|
-
// blow the 5 MB per-entry cap and freeze history). On undo back to
|
|
602
|
-
// a different draft, the page-settings logo fields now have an
|
|
603
|
-
// empty base64, so the canvas would show no logo until something
|
|
604
|
-
// re-renders. Pointing the editable logo store at the restored
|
|
605
|
-
// draft and asking it to re-render fans out fabric-render requests
|
|
606
|
-
// for the four variations and writes fresh base64 onto every page
|
|
607
|
-
// section + logo content block — same path as the original BYO
|
|
608
|
-
// upload. Fire-and-forget: the restore returns immediately and the
|
|
609
|
-
// canvas updates as the renders complete, just like the upload UX.
|
|
610
|
-
const tokenChanged = editableLogoStore.logoDraftToken !== logoImage.logoDraftToken;
|
|
611
|
-
if (tokenChanged && logoImage.logoDraftToken) {
|
|
612
|
-
editableLogoStore.setLogoDraftToken(logoImage.logoDraftToken);
|
|
613
|
-
editableLogoStore
|
|
614
|
-
.updateEditableLogoImageUrlAsync()
|
|
615
|
-
.catch((err) => {
|
|
616
|
-
console.error('history-store: failed to repaint logo on restore', err);
|
|
617
|
-
});
|
|
605
|
+
if (draft.templateAsset) {
|
|
606
|
+
logoStore.setLogoTemplateAsset(draft.templateAsset);
|
|
607
|
+
}
|
|
618
608
|
}
|
|
609
|
+
editableLogoStore.setLogoDraftToken(draftToken);
|
|
610
|
+
editableLogoStore.restoreVariationsForDraftToken(draftToken);
|
|
619
611
|
},
|
|
620
612
|
_fallbackSidebarIfSelectedContentMissing(snapshot) {
|
|
621
613
|
const contentSettingsStore = useUiContentSettingsStore();
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
* with the live store.
|
|
9
9
|
* 2. `sizeBytes === snapshot.length` is automatic and accurate for the V2
|
|
10
10
|
* memory-budget instrumentation.
|
|
11
|
+
*
|
|
12
|
+
* Sidecar state that doesn't live on `brandPageData` (the variations grid in
|
|
13
|
+
* the Logo sidebar, the active `logoTemplateAsset`, the active
|
|
14
|
+
* `logoDraftToken`) is restored on undo by `_syncLogoSettingsFromSnapshot`
|
|
15
|
+
* via per-draft-token caches on the logo / editable-logo stores — keyed off
|
|
16
|
+
* `logoImage.logoDraftToken` which IS in the snapshot.
|
|
11
17
|
*/
|
|
12
18
|
export interface HistoryEntry {
|
|
13
19
|
/** JSON.stringify(BrandPageModel) at the moment of capture. */
|
|
@@ -29,11 +29,17 @@ import { useEventTracker } from '../../composables/useEventTracker';
|
|
|
29
29
|
// so a user holding down a key for 15 s still gets periodic snapshots.
|
|
30
30
|
const CAPTURE_DEBOUNCE_MS = 1700;
|
|
31
31
|
const CAPTURE_MAX_WAIT_MS = 10000;
|
|
32
|
-
// FR-12: 40-entry cap. FR-13: 100 MB memory budget. FR-13c:
|
|
32
|
+
// FR-12: 40-entry cap. FR-13: 100 MB memory budget. FR-13c: per-entry
|
|
33
33
|
// oversize threshold — entries above this are skipped + emit telemetry.
|
|
34
|
+
// 25 MB accommodates a high-res BYO logo upload, which renders ~2.5 MB
|
|
35
|
+
// of base64 PNG into each of four viewport sections (~10 MB) plus per-page
|
|
36
|
+
// logo content blocks. The variations grid (~10 MB) does NOT live in the
|
|
37
|
+
// snapshot — it sits on the editable-logo store keyed by draft token, and
|
|
38
|
+
// is restored on undo from there. The 100 MB total budget still evicts
|
|
39
|
+
// oldest non-baseline entries to keep memory bounded.
|
|
34
40
|
const MAX_ENTRIES = 40;
|
|
35
41
|
const MAX_MEMORY_BYTES = 100 * 1024 * 1024;
|
|
36
|
-
const MAX_ENTRY_BYTES =
|
|
42
|
+
const MAX_ENTRY_BYTES = 25 * 1024 * 1024;
|
|
37
43
|
// Window after baseline-capture during which any auto-captured snapshot
|
|
38
44
|
// REPLACES the baseline rather than pushing a new entry. Covers post-init
|
|
39
45
|
// reactive cascades (template loadPageNo, router afterEach, layout settle)
|
|
@@ -68,34 +74,14 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
68
74
|
* Synchronous — safe to call inside a microtask without racing a follow-up
|
|
69
75
|
* mutation.
|
|
70
76
|
*/
|
|
71
|
-
function
|
|
77
|
+
function serializeCurrentSnapshot() {
|
|
72
78
|
if (!cachedMakerStore)
|
|
73
79
|
return null;
|
|
74
80
|
try {
|
|
75
|
-
|
|
76
|
-
// Drop `logoImageBase64Url` from the serialized form. A high-res
|
|
77
|
-
// BYO upload renders a ~2.5 MB base64 PNG into each of the four
|
|
78
|
-
// viewport sections (~10 MB raw), which is well past the 5 MB
|
|
79
|
-
// per-entry cap and would otherwise stick every BYO capture — and
|
|
80
|
-
// every follow-up edit while the upload is on the page — into the
|
|
81
|
-
// `oversized` path, freezing history. Stripping the field at
|
|
82
|
-
// serialize time keeps entries small and is safe for restore:
|
|
83
|
-
// - BYO upload IS undoable. The undo-relevant signal is
|
|
84
|
-
// `logoImage.logoDraftToken`, which is preserved.
|
|
85
|
-
// - On undo `LogoRender` watches `viewModel` and falls back to
|
|
86
|
-
// fetching the SVG by `logoDraftToken` when `logoImageBase64Url`
|
|
87
|
-
// is undefined (LogoRender.vue:97-102, 139-161), so the canvas
|
|
88
|
-
// repaints the previous logo without the cached PNG.
|
|
89
|
-
// - Per-property logo edits (text, color, font) author via
|
|
90
|
-
// `editableLogoStore.logoEdits` — not `brandPageData` — so
|
|
91
|
-
// they're already out of V1 undo scope. Same key is also
|
|
92
|
-
// stripped in the dedup normalizer; that strip is now
|
|
93
|
-
// redundant for the watcher path but kept as belt-and-braces
|
|
94
|
-
// in case a snapshot string lands there from another origin.
|
|
95
|
-
return JSON.stringify(raw, (key, value) => key === 'logoImageBase64Url' ? undefined : value);
|
|
81
|
+
return JSON.stringify(toRaw(cachedMakerStore.brandPageData));
|
|
96
82
|
}
|
|
97
83
|
catch (error) {
|
|
98
|
-
console.error('history-store: failed to serialize
|
|
84
|
+
console.error('history-store: failed to serialize snapshot', error);
|
|
99
85
|
return null;
|
|
100
86
|
}
|
|
101
87
|
}
|
|
@@ -534,7 +520,7 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
534
520
|
return;
|
|
535
521
|
if (!baselineCaptured.value)
|
|
536
522
|
return;
|
|
537
|
-
const snapshot =
|
|
523
|
+
const snapshot = serializeCurrentSnapshot();
|
|
538
524
|
if (!snapshot)
|
|
539
525
|
return;
|
|
540
526
|
// During the post-init settle window, fold any captured mutation back
|
|
@@ -586,7 +572,7 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
586
572
|
if (baselineCaptured.value)
|
|
587
573
|
return;
|
|
588
574
|
installWatcher();
|
|
589
|
-
const snapshot =
|
|
575
|
+
const snapshot = serializeCurrentSnapshot();
|
|
590
576
|
if (!snapshot)
|
|
591
577
|
return;
|
|
592
578
|
// Baseline starts a fresh stack of exactly 1 entry with pointer at 0.
|
|
@@ -616,7 +602,7 @@ export const useHistoryStore = defineStore('history', () => {
|
|
|
616
602
|
return 'skipped';
|
|
617
603
|
if (!baselineCaptured.value)
|
|
618
604
|
return 'skipped';
|
|
619
|
-
const snapshot =
|
|
605
|
+
const snapshot = serializeCurrentSnapshot();
|
|
620
606
|
if (!snapshot)
|
|
621
607
|
return 'skipped';
|
|
622
608
|
return commitEntry({ snapshot, ...args });
|
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-3NPiNYNp.js";
|
|
2
2
|
import { createPinia as wE, setActivePinia as ZE } from "pinia";
|
|
3
3
|
export {
|
|
4
4
|
E as ABOUT_SECTION_SETTINGS_CONFIG,
|