@designcrowd/library.brand-page 5.17.25-undo-21 → 5.17.25

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.
Files changed (115) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-Bze5WUip.js → CreatedOnBrandCrowd-de-de-9YvB5ocm.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-Dw5uSnX8.js → CreatedOnBrandCrowd-en-us-B8OpZpMP.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-Cz-oPdjt.js → CreatedOnBrandCrowd-es-es-D_d6SwvE.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-zldLXw3G.js → CreatedOnBrandCrowd-fr-ca-CPqNeevd.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-zldLXw3G.js → CreatedOnBrandCrowd-fr-fr-CPqNeevd.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-64QJpEaD.js → CreatedOnBrandCrowd-pt-br-D0DpxtjY.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-64QJpEaD.js → CreatedOnBrandCrowd-pt-pt-D0DpxtjY.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-8SXOvjEH.js → CreatedOnDcom-de-de-BLKiD1pl.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-ClZBYY_t.js → CreatedOnDcom-en-us-DGNjFV5B.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-xg4ZwvEb.js → CreatedOnDcom-es-es-C2IDMZZe.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-4zo2gxc1.js → CreatedOnDcom-fr-ca-ZRxz3QKj.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-Dw9Fuy7U.js → CreatedOnDcom-fr-fr-5bE7oSdF.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-Dbl0EWcU.js → CreatedOnDcom-pt-br-WCumEx63.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-Bps73oQE.js → CreatedOnDcom-pt-pt-C8Hinnmg.js} +1 -1
  15. package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +2 -7
  16. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +2 -7
  17. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.js +0 -10
  18. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.d.ts +2 -7
  19. package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +0 -1
  20. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +2 -23
  21. package/lib/src/brand-page-maker/components/brandpage-settings/ReplaceImageSettingsForBrandPageSettings.mixin.d.ts +2 -7
  22. package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.d.ts +0 -3
  23. package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.js +0 -11
  24. package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +2 -7
  25. package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +2 -7
  26. package/lib/src/brand-page-maker/components/social-share/SocialShare.mixin.d.ts +2 -7
  27. package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +2 -7
  28. package/lib/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.js +0 -9
  29. package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +1 -17
  30. package/lib/src/brand-page-maker/composables/useEventTracker.d.ts +0 -20
  31. package/lib/src/brand-page-maker/composables/useEventTracker.js +0 -17
  32. package/lib/src/brand-page-maker/stores/ai-thread/ai-website-builder-thread-store.d.ts +1 -1
  33. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.d.ts +2 -41
  34. package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +5 -247
  35. package/lib/src/brand-page-maker/stores/logo-store/logo-store.d.ts +0 -1
  36. package/lib/src/brand-page-maker/stores/user/user-store.js +0 -1
  37. package/lib/src/bundled-translations-Bu_5FO26.js +173 -0
  38. package/lib/src/bundles/bundled-translations.json +1 -3
  39. package/lib/src/constants/ui.d.ts +0 -1
  40. package/lib/src/css/library.brand-page-brandCrowd.min.css +17 -22
  41. package/lib/src/css/library.brand-page-brandPage.min.css +18 -22
  42. package/lib/src/css/library.brand-page-designCom.min.css +17 -22
  43. package/lib/src/css/library.brand-page-preview.min.css +17 -22
  44. package/lib/src/index.mjs +1 -1
  45. package/lib/src/{lib-BgvZxeSl.js → lib-BF9ONIgx.js} +23292 -23913
  46. package/lib/src/shared/content-settings/components/GenericTextInput.mixin.d.ts +1 -1
  47. package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +2 -23
  48. package/lib/src/shared/content-settings/components/content-settings/ContentSettings.stories.js +0 -1
  49. package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +2 -23
  50. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +0 -16
  51. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +2 -7
  52. package/lib/src/shared/content-settings/components/draggable-item-list/DraggableItemList.mixin.d.ts +0 -3
  53. package/lib/src/shared/content-settings/components/draggable-item-list/DraggableItemList.mixin.js +2 -19
  54. package/lib/src/shared/content-settings/components/email-field/EmailField.mixin.d.ts +1 -1
  55. package/lib/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.js +8 -18
  56. package/lib/src/shared/content-settings/components/radio-field/RadioField.mixin.d.ts +1 -1
  57. package/lib/src/shared/content-settings/components/tel-field/TelField.mixin.d.ts +1 -1
  58. package/lib/src/shared/content-settings/components/text-field/TextField.mixin.d.ts +1 -1
  59. package/lib/src/shared/content-settings/components/textarea-field/TextareaField.mixin.d.ts +1 -1
  60. package/lib/src/shared/content-settings/components/url-field/UrlField.mixin.d.ts +1 -1
  61. package/lib/src/shared/content-settings/components/youtube-video-field/YoutubeVideoField.mixin.d.ts +1 -1
  62. package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +0 -18
  63. package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.js +0 -11
  64. package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +2 -9
  65. package/lib/src/shared/logo-settings/store/editable-logo-store.d.ts +1 -9
  66. package/lib/src/shared/logo-settings/store/editable-logo-store.js +0 -33
  67. package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +2 -24
  68. package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +2 -9
  69. package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +2 -23
  70. package/lib/src/shared/side-bar/components/SideBarTabButton.mixin.d.ts +0 -16
  71. package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +2 -23
  72. package/lib/src/shared/template-settings/components/TemplatesSettings.mixin.d.ts +0 -16
  73. package/package.json +1 -1
  74. package/src/brand-page/components/video/Video.vue +0 -2
  75. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.ts +0 -11
  76. package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.vue +3 -2
  77. package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +0 -1
  78. package/src/brand-page-maker/components/cookie-collection/CookieSettings.vue +17 -18
  79. package/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.ts +0 -13
  80. package/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.vue +4 -14
  81. package/src/brand-page-maker/components/quick-link-bar/i18n/quick-link-bar.json +1 -3
  82. package/src/brand-page-maker/components/save-contact/SaveContact.vue +19 -12
  83. package/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.ts +0 -10
  84. package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +1 -20
  85. package/src/brand-page-maker/composables/useEventTracker.ts +0 -29
  86. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.test.ts +0 -166
  87. package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +4 -287
  88. package/src/brand-page-maker/stores/logo-store/logo-store.ts +0 -5
  89. package/src/brand-page-maker/stores/user/user-store.ts +0 -1
  90. package/src/bundles/bundled-translations.json +1 -3
  91. package/src/constants/ui.ts +0 -1
  92. package/src/shared/content-settings/components/content-settings/ContentSettings.stories.ts +0 -1
  93. package/src/shared/content-settings/components/draggable-item-list/DraggableItemList.mixin.ts +2 -19
  94. package/src/shared/content-settings/components/draggable-item-list/DraggableItemList.vue +1 -1
  95. package/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.ts +10 -26
  96. package/src/shared/content-settings/components/logo-selection-field/LogoSelection.vue +48 -63
  97. package/src/shared/content-settings/components/text-field/TextField.vue +0 -1
  98. package/src/shared/content-settings/components/text-image-field/TextImageField.vue +4 -33
  99. package/src/shared/logo-settings/components/EditLogoSettings.mixin.ts +0 -11
  100. package/src/shared/logo-settings/store/editable-logo-store.ts +1 -45
  101. package/lib/src/brand-page-maker/composables/useUndoRedoFlag.d.ts +0 -16
  102. package/lib/src/brand-page-maker/composables/useUndoRedoFlag.js +0 -22
  103. package/lib/src/brand-page-maker/stores/history/history-store.d.ts +0 -104
  104. package/lib/src/brand-page-maker/stores/history/history-store.js +0 -836
  105. package/lib/src/bundled-translations-CWHKs3in.js +0 -173
  106. package/lib/src/metadata-builder/builders/reorder-pages-builder.d.ts +0 -13
  107. package/lib/src/metadata-builder/builders/reorder-pages-builder.js +0 -49
  108. package/src/brand-page-maker/components/quick-link-bar/RedoButton.test.ts +0 -166
  109. package/src/brand-page-maker/components/quick-link-bar/RedoButton.vue +0 -66
  110. package/src/brand-page-maker/components/quick-link-bar/UndoButton.test.ts +0 -166
  111. package/src/brand-page-maker/components/quick-link-bar/UndoButton.vue +0 -66
  112. package/src/brand-page-maker/composables/useUndoRedoFlag.ts +0 -26
  113. package/src/brand-page-maker/stores/history/history-store.test.ts +0 -1246
  114. package/src/brand-page-maker/stores/history/history-store.ts +0 -1041
  115. package/src/metadata-builder/builders/reorder-pages-builder.ts +0 -80
@@ -1,836 +0,0 @@
1
- import { defineStore } from 'pinia';
2
- import { computed, nextTick, ref, shallowRef, toRaw, watch } from 'vue';
3
- import { useBrandPageMakerStore } from '../brandpage-maker/brandpage-maker-store';
4
- import { useAiWebsiteBuilderThreadStore } from '../ai-thread/ai-website-builder-thread-store';
5
- import { useEventTracker } from '../../composables/useEventTracker';
6
- import { usePageNavigationStore } from '@shared/page-navigation/store/page-navigation-store';
7
- /**
8
- * Single-stack history model with a pointer instead of two stacks.
9
- *
10
- * entries: [e0, e1, e2, e3, e4]
11
- * ^
12
- * currentIndex
13
- *
14
- * canUndo = currentIndex > 0
15
- * canRedo = currentIndex < entries.length - 1
16
- *
17
- * capture → entries = entries.slice(0, currentIndex + 1); push; currentIndex = end
18
- * undo → currentIndex--; applySnapshot(entries[currentIndex])
19
- * redo → currentIndex++; applySnapshot(entries[currentIndex])
20
- *
21
- * This model:
22
- * - eliminates the two-stack-desync risk class (mutating two refs in sequence)
23
- * - makes FR-11 "clear redo on new change" a single array truncation
24
- * - makes it trivial to build a V2 timeline UI (iterate entries, highlight
25
- * currentIndex)
26
- */
27
- // Collapses multi-step mutations into a single capture. Monotonic: first
28
- // mutation starts the timer, further mutations inside the window do not
29
- // reset it. A max-wait ceiling forces a commit during continuous activity
30
- // so a user holding down a key for 15 s still gets periodic snapshots.
31
- const CAPTURE_DEBOUNCE_MS = 1700;
32
- const CAPTURE_MAX_WAIT_MS = 10000;
33
- // FR-12: 40-entry cap. FR-13: 100 MB memory budget. FR-13c: per-entry
34
- // oversize threshold — entries above this are skipped + emit telemetry.
35
- // 25 MB accommodates a high-res BYO logo upload, which renders ~2.5 MB
36
- // of base64 PNG into each of four viewport sections (~10 MB) plus per-page
37
- // logo content blocks. The variations grid (~10 MB) does NOT live in the
38
- // snapshot — it sits on the editable-logo store keyed by draft token, and
39
- // is restored on undo from there. The 100 MB total budget still evicts
40
- // oldest non-baseline entries to keep memory bounded.
41
- const MAX_ENTRIES = 40;
42
- const MAX_MEMORY_BYTES = 100 * 1024 * 1024;
43
- const MAX_ENTRY_BYTES = 25 * 1024 * 1024;
44
- // Window after baseline-capture during which any auto-captured snapshot
45
- // REPLACES the baseline rather than pushing a new entry. Covers post-init
46
- // reactive cascades (template loadPageNo, router afterEach, layout settle)
47
- // that would otherwise make undo light up before the user has done anything.
48
- const BASELINE_SETTLE_MS = 2000;
49
- export const useHistoryStore = defineStore('history', () => {
50
- const eventTracker = useEventTracker();
51
- // --- State ---
52
- /**
53
- * `shallowRef` keeps the array ref reactive (so dependent computeds recompute
54
- * when we swap the array) but prevents Pinia / Vue from proxying every entry
55
- * object inside. Combined with string snapshots, entries are fully opaque to
56
- * reactivity traversal — which is what we want for a history log.
57
- */
58
- const entries = shallowRef([]);
59
- const currentIndex = ref(-1); // -1 means "no baseline yet"
60
- const isApplyingSnapshot = ref(false);
61
- const baselineCaptured = ref(false);
62
- const watcherInstalled = ref(false);
63
- let baselineCapturedAt = 0;
64
- // --- Getters ---
65
- const canUndo = computed(() => currentIndex.value > 0);
66
- const canRedo = computed(() => currentIndex.value >= 0 && currentIndex.value < entries.value.length - 1);
67
- // --- Internals ---
68
- /**
69
- * Cached reference to the maker store. Set once when the watcher installs so
70
- * the capture hot path is synchronous.
71
- */
72
- let cachedMakerStore = null;
73
- /**
74
- * Serialize the current `brandPageData` into a detached JSON string.
75
- * Synchronous — safe to call inside a microtask without racing a follow-up
76
- * mutation.
77
- */
78
- function serializeCurrentSnapshot() {
79
- if (!cachedMakerStore)
80
- return null;
81
- try {
82
- return JSON.stringify(toRaw(cachedMakerStore.brandPageData));
83
- }
84
- catch (error) {
85
- console.error('history-store: failed to serialize snapshot', error);
86
- return null;
87
- }
88
- }
89
- /**
90
- * Read the currently active pageId from `pageNavigationStore`. Sidecar to
91
- * the snapshot string — see `HistoryEntry.activePageId`. Empty string when
92
- * no page is active yet.
93
- */
94
- function getCurrentActivePageId() {
95
- return usePageNavigationStore().activePageId ?? '';
96
- }
97
- /**
98
- * Normalize a snapshot for the dedup byte-compare. Strips/canonicalizes
99
- * fields that get mutated by sidebar-open reactive cascades but aren't
100
- * user-visible edits — without this, opening a content panel produces an
101
- * undo step that "does nothing" when replayed.
102
- *
103
- * Known phantom sources (BP-5506):
104
- * - TipTap RTE writing back its empty-paragraph default on first mount
105
- * (e.g. `""` → `<p style="text-align: center;"></p>`).
106
- * - TipTap RTE writing back its default-style hydration on first mount
107
- * (e.g. plain `"Hello"` → `<p style="..."><span style="..."><mark ...>Hello</mark></span></p>`).
108
- * - TipTap re-emitting whole-content `<strong>`/`<em>`/`<u>`/`<s>` tags
109
- * to mirror the resolved `textStyle.fontWeight / fontStyle /
110
- * textDecoration` (e.g. plain `"text"` →
111
- * `<p>...<span>...<strong>text</strong></span></p>`).
112
- * - Lazy hydration of `*Style` objects when a content settings panel —
113
- * or section selection on the canvas — resolves `textStyleType` and
114
- * writes the full resolved style (fontFamily, fontSize, color,
115
- * fontWeight, fontStyle, letterSpacing, lineHeight, textDecoration)
116
- * onto the model. The `textStyleType` itself is the authoring
117
- * intent; the resolved keys are just cached values.
118
- * - `isModifiedAfterTemplateApplied` flipping on first edit gesture.
119
- * - `logoImageBase64Url` — the rendered logo PNG. Per-property logo
120
- * edits author through `editableLogoStore.logoEdits` (not in
121
- * `brandPageData`), so an undo would revert the canvas image but
122
- * leave the sidebar fields showing the user's typed value. Logo
123
- * property edits are excluded from V1 undo scope; BYO-upload undo
124
- * still works because that diff lives in `logoImage.logoDraftToken`.
125
- *
126
- * RTE strings are canonicalized by parsing the HTML with DOMParser and
127
- * walking the tree; only attributeless format wrappers (and a tightly
128
- * scoped set of hydration styles on `<p>` / `<span>` / `<mark>`) are
129
- * collapsed. Real authoring intent (links, custom colors, partial-text
130
- * formatting like `Hello <strong>world</strong>`) survives the walk
131
- * because at least one node falls outside the hydration whitelist,
132
- * and the walker bails to "preserve original" the moment that happens.
133
- *
134
- * Used ONLY for dedup comparison. Stored snapshots remain unchanged so
135
- * `applyHistorySnapshot` always sees the real state.
136
- */
137
- // Tags TipTap re-emits purely to mirror the resolved textStyle on first
138
- // hydration. None carry user authoring intent on their own when they are
139
- // the sole element-child wrapping the entire content:
140
- // - <p>: only its `text-align` style is meaningful, and that's already
141
- // captured in `textStyle.textAlign`.
142
- // - <span>: TipTap wraps content in a span with `font-family`, `font-size`,
143
- // `color`, `letter-spacing`, `line-height` resolved from the
144
- // textStyle. The textStyle object on the same content is the
145
- // authoritative source.
146
- // - <mark>: TipTap's highlight extension default — collapses regardless
147
- // of `data-color` / `style` attrs, mirroring the original
148
- // regex's behavior on a hydrated highlight.
149
- // - <strong>/<em>/<u>/<s>: attributeless tags that mirror
150
- // `fontWeight: bold` / `fontStyle: italic` / `textDecoration:
151
- // underline / line-through`. ONLY recognized as hydration when
152
- // they are the sole child of their parent — partial-content
153
- // usage like `Hello <strong>world</strong>` is a real edit.
154
- // Anything else (`<a>`, `<br>`, `<span style="color: red">`, attributes on
155
- // <strong>/<em>, etc.) is preserved as a real diff.
156
- const STRUCTURAL_HYDRATION_TAGS = new Set(['P', 'SPAN', 'MARK']);
157
- const FORMAT_HYDRATION_TAGS = new Set(['STRONG', 'EM', 'U', 'S']);
158
- // Default style properties TipTap emits on a hydration <span> /
159
- // <mark>. The textStyle resolver writes all of these onto the live
160
- // model, so when TipTap re-emits them as inline style on its
161
- // hydration span/mark there is no user-visible delta.
162
- // Anything outside this whitelist (e.g. `text-decoration` mid-content,
163
- // `text-shadow`, `text-transform`) is treated as a real edit.
164
- const HYDRATION_INLINE_STYLE_PROPS = new Set([
165
- 'font-family',
166
- 'font-size',
167
- 'letter-spacing',
168
- 'line-height',
169
- 'color',
170
- 'background-color',
171
- ]);
172
- // Empty paragraph forms TipTap emits when an editor mounts on an empty
173
- // string. Treated as equivalent to `""` for dedup.
174
- function isEmptyRteHtml(value) {
175
- if (typeof value !== 'string')
176
- return false;
177
- return /^<p(\s[^>]*)?>(<br\s*\/?>)?<\/p>$/.test(value);
178
- }
179
- function isHydrationOnlyAttributes(el) {
180
- // Format tags (<strong>/<em>/<u>/<s>) must be attributeless. Anything
181
- // with class/style/data-*/etc. is a real edit.
182
- if (FORMAT_HYDRATION_TAGS.has(el.tagName))
183
- return el.attributes.length === 0;
184
- for (const attr of Array.from(el.attributes)) {
185
- // <mark> may carry a `data-color` attr (TipTap highlight extension's
186
- // default-and-resolved value). The accompanying `style` is checked
187
- // against the same hydration-prop whitelist as <span>.
188
- if (el.tagName === 'MARK' &&
189
- (attr.name === 'data-color' || attr.name === 'style')) {
190
- if (attr.name === 'data-color')
191
- continue;
192
- }
193
- else if (attr.name !== 'style') {
194
- return false;
195
- }
196
- const decls = attr.value
197
- .split(';')
198
- .map((d) => d.trim())
199
- .filter(Boolean);
200
- if (el.tagName === 'P') {
201
- for (const decl of decls) {
202
- const [prop] = decl.split(':').map((s) => s.trim());
203
- if (prop !== 'text-align')
204
- return false;
205
- }
206
- }
207
- else if (el.tagName === 'SPAN' || el.tagName === 'MARK') {
208
- for (const decl of decls) {
209
- const [prop, value] = decl.split(':').map((s) => s.trim());
210
- // Allow `color: inherit` on <mark> (TipTap stamps it on the
211
- // default highlight to inherit the span's color). Otherwise
212
- // require the prop to be in the hydration whitelist.
213
- if (el.tagName === 'MARK' &&
214
- prop === 'color' &&
215
- value === 'inherit') {
216
- continue;
217
- }
218
- if (!HYDRATION_INLINE_STYLE_PROPS.has(prop))
219
- return false;
220
- }
221
- }
222
- else {
223
- return false;
224
- }
225
- }
226
- return true;
227
- }
228
- /**
229
- * Walk a parsed HTML node tree. Return the joined text content if every
230
- * descendant is hydration noise; return null if any node carries real
231
- * authoring intent (links, partial formatting, custom styles, etc.).
232
- *
233
- * `isFormatTag` differs in how it's allowed to appear: a structural tag
234
- * (P/SPAN/MARK) can have siblings; a format tag (STRONG/EM/U/S) is only
235
- * allowed when it's the SOLE child of its parent. The caller enforces
236
- * that at the iteration site.
237
- */
238
- function extractCanonicalText(node) {
239
- if (node.nodeType === 3 /* TEXT_NODE */)
240
- return node.textContent ?? '';
241
- if (node.nodeType !== 1 /* ELEMENT_NODE */) {
242
- // Comments, CDATA, etc. — treat as opaque (preserve original).
243
- return null;
244
- }
245
- const el = node;
246
- const isStructural = STRUCTURAL_HYDRATION_TAGS.has(el.tagName);
247
- const isFormat = FORMAT_HYDRATION_TAGS.has(el.tagName);
248
- if (!isStructural && !isFormat)
249
- return null;
250
- if (!isHydrationOnlyAttributes(el))
251
- return null;
252
- const children = Array.from(el.childNodes);
253
- let out = '';
254
- for (const child of children) {
255
- // Format tags only count as hydration when they wrap the ENTIRE
256
- // content of their parent. If a <strong>/<em>/<u>/<s> appears
257
- // alongside any sibling (text or element), it's partial-content
258
- // formatting — a real edit that can't be expressed via textStyle —
259
- // so bail.
260
- if (child.nodeType === 1 &&
261
- FORMAT_HYDRATION_TAGS.has(child.tagName) &&
262
- children.length > 1) {
263
- return null;
264
- }
265
- const part = extractCanonicalText(child);
266
- if (part === null)
267
- return null;
268
- out += part;
269
- }
270
- return out;
271
- }
272
- /**
273
- * If `value` is TipTap's default-hydration wrapper around plain text
274
- * (only hydration-noise elements wrapping bare text), return that bare
275
- * text. Otherwise return the original string unchanged.
276
- *
277
- * This collapses the BP-5506 phantom where opening a content sidebar —
278
- * or selecting a section on the canvas — mounts every RTE editor at
279
- * once and writes back wrapped HTML with no user-visible delta.
280
- */
281
- function canonicalizeRteString(value) {
282
- // Cheap exit: no tags at all.
283
- if (!value.includes('<'))
284
- return value;
285
- if (isEmptyRteHtml(value))
286
- return '';
287
- // DOMParser is unavailable in some non-browser test environments;
288
- // fall back to leaving the value as-is so the caller produces a
289
- // real diff (i.e. fail open — never falsely collapse).
290
- if (typeof DOMParser === 'undefined')
291
- return value;
292
- let doc;
293
- try {
294
- doc = new DOMParser().parseFromString(`<div id="__rte_root__">${value}</div>`, 'text/html');
295
- }
296
- catch {
297
- return value;
298
- }
299
- const root = doc.getElementById('__rte_root__');
300
- if (!root)
301
- return value;
302
- let out = '';
303
- for (const child of Array.from(root.childNodes)) {
304
- const part = extractCanonicalText(child);
305
- if (part === null)
306
- return value;
307
- out += part;
308
- }
309
- return out;
310
- }
311
- function normalizeNode(node) {
312
- if (Array.isArray(node))
313
- return node.map(normalizeNode);
314
- if (node === null || typeof node !== 'object')
315
- return node;
316
- const out = {};
317
- for (const key of Object.keys(node)) {
318
- let v = node[key];
319
- // Strip the template-modified flag — it's meta-state that flips on
320
- // first edit gesture (e.g. clicking into a panel) and does not
321
- // represent a user-visible change.
322
- if (key === 'isModifiedAfterTemplateApplied')
323
- continue;
324
- // Strip the rendered logo PNG. Logo property edits (text, color,
325
- // font, outline, shadow) authored via the Logo sidebar live in
326
- // `editableLogoStore.logoEdits` — which is NOT in `brandPageData`,
327
- // so an undo would revert this base64 image on the canvas without
328
- // touching the sidebar fields. Per V1 scope, logo property edits
329
- // are non-undoable (parallels the PRD's admin-logo exclusion);
330
- // BYO-upload undo still works because that change shows up in
331
- // `logoImage.logoDraftToken`, not here. Stripping the field keeps
332
- // those isolated render-output diffs out of the stack entirely.
333
- if (key === 'logoImageBase64Url')
334
- continue;
335
- // Collapse RTE default-hydration wrappers down to the plain text
336
- // they wrap. Plain "X" and `<p style="..."><span ...><mark ...>X
337
- // </mark></span></p>` share the same canonical "X" so a sidebar
338
- // open that mounts every editor at once doesn't generate phantom
339
- // undo steps.
340
- if (typeof v === 'string') {
341
- v = canonicalizeRteString(v);
342
- }
343
- // Empty TipTap paragraphs collapse to "" — and an empty string is
344
- // equivalent to the key being absent (JSON.stringify drops `undefined`),
345
- // so skip the key entirely. Otherwise the normalizer would emit
346
- // `"description": ""` here while the baseline snapshot — captured when
347
- // `description` was `undefined` — has no `description` key at all,
348
- // and the two normalized strings would differ.
349
- if (isEmptyRteHtml(v) || v === '')
350
- continue;
351
- // textStyle / descriptionStyle / titleStyle / *Style objects.
352
- //
353
- // When `textStyleType` is set, the live store lazily fills in the
354
- // resolved values (fontFamily, fontSize, color, fontWeight,
355
- // fontStyle, letterSpacing, lineHeight, textDecoration, etc.) the
356
- // first time a settings panel — or section-selection on the canvas
357
- // — resolves `textStyleType` against `styles.textStyles.textStyleOptions`.
358
- // None of those lazy fields represent a real user edit; the
359
- // `textStyleType` itself is the authoring intent.
360
- //
361
- // Real user edits via the inline RTE toolbar set `textStyleType: undefined`
362
- // (see useRichTextEditor.ts `fontStyleChanges = { ..., textStyleType: undefined }`),
363
- // so we leave every key intact in that case — those values ARE the
364
- // real authoring intent.
365
- //
366
- // Per-content style edits via the global Style panel land in
367
- // `snapshot.styles.textStyles` (a separate sub-tree), so they still
368
- // produce a real diff outside this branch.
369
- if (v !== null &&
370
- typeof v === 'object' &&
371
- !Array.isArray(v) &&
372
- /Style$/.test(key)) {
373
- const styleObj = v;
374
- const hasTextStyleType = styleObj.textStyleType !== undefined &&
375
- styleObj.textStyleType !== null;
376
- if (hasTextStyleType) {
377
- // Drop everything except `textStyleType` itself + `textAlign`,
378
- // which is the user's per-instance alignment override (preserved
379
- // on hydration via `globalContentStyle = { ...resolved, textAlign: style?.textAlign }`).
380
- out[key] = {
381
- textStyleType: styleObj.textStyleType,
382
- ...(styleObj.textAlign !== undefined
383
- ? { textAlign: styleObj.textAlign }
384
- : {}),
385
- };
386
- continue;
387
- }
388
- // No textStyleType — these are real per-content overrides. Recurse
389
- // normally so nested objects still get the standard treatment.
390
- out[key] = normalizeNode(styleObj);
391
- continue;
392
- }
393
- out[key] = normalizeNode(v);
394
- }
395
- return out;
396
- }
397
- function normalizeSnapshotForDedup(snapshotStr) {
398
- try {
399
- const parsed = JSON.parse(snapshotStr);
400
- return JSON.stringify(normalizeNode(parsed));
401
- }
402
- catch {
403
- return snapshotStr;
404
- }
405
- }
406
- /**
407
- * Commit a new entry into the stack at the current pointer position.
408
- *
409
- * Returns 'committed' when the entry lands in the stack, 'oversized' when
410
- * the entry exceeds `MAX_ENTRY_BYTES` and is skipped (FR-13c), or 'noop'
411
- * when the snapshot is byte-identical to the entry at the current pointer.
412
- * Callers can use the return to emit telemetry — analytics wiring lives
413
- * in U5.
414
- *
415
- * Enforces these invariants in order:
416
- * 1. Drop no-op duplicates — if the new snapshot is identical to the
417
- * entry at the current pointer, skip it. Color/text settle paths,
418
- * template-switch confirms with no real diff, and AI applies that
419
- * land identical state would otherwise create undo/redo steps that
420
- * do nothing visible.
421
- * 2. FR-13c — if the new entry exceeds 5 MB, skip it entirely.
422
- * 3. FR-11 — truncate any redo tail.
423
- * 4. FR-12 — cap at 40 entries; drop oldest non-baseline on overflow.
424
- * 5. FR-13 — keep total memory under 100 MB; drop oldest non-baseline
425
- * repeatedly until we're under budget.
426
- *
427
- * Baseline (entry 0) is never evicted so "undo everything" always returns
428
- * to session start.
429
- */
430
- function commitEntry(args) {
431
- const current = entries.value[currentIndex.value];
432
- if (current) {
433
- if (current.snapshot === args.snapshot)
434
- return 'noop';
435
- // Phantom-edit dedup: normalize both snapshots to ignore
436
- // sidebar-open reactive cascades (RTE empty-paragraph init, lazy
437
- // textStyle hydration, isModifiedAfterTemplateApplied flips). If
438
- // they're equal after normalization, this capture has no
439
- // user-visible diff vs. the entry at the pointer.
440
- if (normalizeSnapshotForDedup(current.snapshot) ===
441
- normalizeSnapshotForDedup(args.snapshot)) {
442
- return 'noop';
443
- }
444
- }
445
- if (args.snapshot.length > MAX_ENTRY_BYTES) {
446
- eventTracker.sendHistoryOversizedEvent({
447
- attempted_bytes: args.snapshot.length,
448
- source: args.source,
449
- });
450
- return 'oversized';
451
- }
452
- const entry = {
453
- snapshot: args.snapshot,
454
- timestamp: new Date().toISOString(),
455
- source: args.source,
456
- actor: args.actor,
457
- label: args.label,
458
- sizeBytes: args.snapshot.length,
459
- activePageId: args.activePageId,
460
- };
461
- // FR-11: truncate redo tail, then append.
462
- const next = entries.value.slice(0, currentIndex.value + 1);
463
- next.push(entry);
464
- // FR-12: 40-entry cap. Drop oldest non-baseline (index 1) if we'd exceed.
465
- let didEvict = false;
466
- while (next.length > MAX_ENTRIES && next.length > 1) {
467
- next.splice(1, 1);
468
- didEvict = true;
469
- }
470
- // FR-13: keep total serialized size under 100 MB. Drop oldest
471
- // non-baseline repeatedly until under budget. Baseline alone can exceed
472
- // the budget on a very large page — in that pathological case we stop
473
- // evicting at length 2 (baseline + newest) rather than dropping the
474
- // baseline.
475
- let totalBytes = next.reduce((sum, e) => sum + e.sizeBytes, 0);
476
- while (totalBytes > MAX_MEMORY_BYTES && next.length > 2) {
477
- totalBytes -= next[1].sizeBytes;
478
- next.splice(1, 1);
479
- didEvict = true;
480
- }
481
- entries.value = next;
482
- currentIndex.value = next.length - 1;
483
- if (didEvict) {
484
- eventTracker.sendHistoryCappedEvent({
485
- entries_count: next.length,
486
- size_bytes: totalBytes,
487
- });
488
- }
489
- return 'committed';
490
- }
491
- /**
492
- * Install a deep watcher on `brandPageData` that auto-captures mutations.
493
- *
494
- * Debounce strategy (FR-16 / ADR-005):
495
- * - Monotonic — the first mutation starts the idle timer; subsequent
496
- * mutations inside the window DO NOT reset it. This is what collapses
497
- * e.g. an RTE italic click's sync style write + ~100 ms-later HTML
498
- * update into a single capture.
499
- * - Idle flush — the idle timer fires CAPTURE_DEBOUNCE_MS after the
500
- * first mutation in a burst (2 s by default).
501
- * - Max-wait ceiling — if mutations keep arriving and the idle timer
502
- * keeps being "one more edit away", a second timer forces a commit at
503
- * CAPTURE_MAX_WAIT_MS after the burst started (10 s by default). This
504
- * is what keeps a user holding down a key from losing undo resolution.
505
- *
506
- * Both timers clear after a commit fires, so the next mutation starts a
507
- * fresh burst.
508
- */
509
- // Hoisted so force-commit paths (template switch, AI apply) can cancel any
510
- // pending auto-capture that would otherwise duplicate their entry.
511
- let idleTimerId = null;
512
- let maxWaitTimerId = null;
513
- function cancelPendingAutoCapture() {
514
- if (idleTimerId !== null) {
515
- clearTimeout(idleTimerId);
516
- idleTimerId = null;
517
- }
518
- if (maxWaitTimerId !== null) {
519
- clearTimeout(maxWaitTimerId);
520
- maxWaitTimerId = null;
521
- }
522
- }
523
- function installWatcher() {
524
- if (watcherInstalled.value)
525
- return;
526
- cachedMakerStore = useBrandPageMakerStore();
527
- const flush = () => {
528
- cancelPendingAutoCapture();
529
- if (isApplyingSnapshot.value)
530
- return;
531
- if (!baselineCaptured.value)
532
- return;
533
- const snapshot = serializeCurrentSnapshot();
534
- if (!snapshot)
535
- return;
536
- const activePageId = getCurrentActivePageId();
537
- // During the post-init settle window, fold any captured mutation back
538
- // into the baseline (entry 0). Async cascades like template
539
- // `loadPageNo`, the router's `afterEach`, and layout settling all
540
- // mutate `brandPageData` after baseline is taken — without this they
541
- // would each look like an undoable user edit on first paint. The
542
- // baseline's `activePageId` is also overwritten so it tracks where
543
- // the user actually settled (the router's `afterEach` runs inside
544
- // this window, so the post-init `activePageId` is more accurate
545
- // than the pre-router value captured in `captureBaseline`).
546
- const inSettleWindow = currentIndex.value === 0 &&
547
- Date.now() - baselineCapturedAt < BASELINE_SETTLE_MS;
548
- if (inSettleWindow) {
549
- entries.value = [
550
- {
551
- ...entries.value[0],
552
- snapshot,
553
- timestamp: new Date().toISOString(),
554
- sizeBytes: snapshot.length,
555
- activePageId,
556
- },
557
- ];
558
- return;
559
- }
560
- commitEntry({
561
- snapshot,
562
- source: 'manual_edit',
563
- actor: 'user',
564
- activePageId,
565
- });
566
- };
567
- // Monotonic burst arming. `isApplyingSnapshot` is gated here so an
568
- // undo/redo doesn't leave a stale timer ticking that later flushes
569
- // mid-keystroke when the user starts editing inside the debounce
570
- // window. `baselineCaptured` is not gated here — `installWatcher` is
571
- // only called from `captureBaseline`, so by the time this fires it is
572
- // always true, and `flush` re-checks it.
573
- const scheduleAutoCapture = () => {
574
- if (isApplyingSnapshot.value)
575
- return;
576
- if (idleTimerId !== null)
577
- return;
578
- idleTimerId = setTimeout(flush, CAPTURE_DEBOUNCE_MS);
579
- maxWaitTimerId = setTimeout(flush, CAPTURE_MAX_WAIT_MS);
580
- };
581
- watch(() => cachedMakerStore.brandPageData, scheduleAutoCapture, {
582
- deep: true,
583
- });
584
- watcherInstalled.value = true;
585
- }
586
- // --- Actions ---
587
- /**
588
- * Captures the baseline entry. Called once per session, typically by
589
- * `BrandPageMaker.mixin.ts` immediately after `setIsBrandPageLoaded(true)`.
590
- * Installs the reactive watcher so subsequent mutations auto-capture.
591
- */
592
- function captureBaseline() {
593
- if (baselineCaptured.value)
594
- return;
595
- installWatcher();
596
- const snapshot = serializeCurrentSnapshot();
597
- if (!snapshot)
598
- return;
599
- // Baseline starts a fresh stack of exactly 1 entry with pointer at 0.
600
- entries.value = [
601
- {
602
- snapshot,
603
- timestamp: new Date().toISOString(),
604
- source: 'manual_edit',
605
- actor: 'user',
606
- label: 'baseline',
607
- sizeBytes: snapshot.length,
608
- activePageId: getCurrentActivePageId(),
609
- },
610
- ];
611
- currentIndex.value = 0;
612
- baselineCaptured.value = true;
613
- baselineCapturedAt = Date.now();
614
- }
615
- /**
616
- * Force-commit capture used by non-watcher call sites (template switch,
617
- * AI apply). The watcher path commits atomically on its own.
618
- *
619
- * Returns the `commitEntry` result so force-commit callers can log
620
- * oversized telemetry — analytics wiring lives in U5.
621
- */
622
- function capture(args) {
623
- if (isApplyingSnapshot.value)
624
- return 'skipped';
625
- if (!baselineCaptured.value)
626
- return 'skipped';
627
- const snapshot = serializeCurrentSnapshot();
628
- if (!snapshot)
629
- return 'skipped';
630
- return commitEntry({
631
- snapshot,
632
- activePageId: getCurrentActivePageId(),
633
- ...args,
634
- });
635
- }
636
- /**
637
- * Force-commit a `template_switch` entry. Cancels any pending auto-capture
638
- * so the template-switch change lands as exactly one entry (not a duplicate
639
- * with the watcher's eventual flush).
640
- */
641
- function captureTemplateSwitch(label) {
642
- cancelPendingAutoCapture();
643
- return capture({ source: 'template_switch', actor: 'user', label });
644
- }
645
- /**
646
- * Force-commit an `ai_changeset` entry. Cancels any pending auto-capture
647
- * so the AI apply lands as exactly one entry per prompt (US-E1).
648
- */
649
- function captureAiChangeset(label) {
650
- cancelPendingAutoCapture();
651
- return capture({ source: 'ai_changeset', actor: 'ai_builder', label });
652
- }
653
- /**
654
- * Parse a stringified snapshot and push it through the maker store's
655
- * dedicated `applyHistorySnapshot` action, which rehydrates every Pinia
656
- * source store + own-store scalar fields that `brandPageData` reads from.
657
- *
658
- * Holds `isApplyingSnapshot` through `nextTick` so Vue's reactive queue
659
- * drains while the watcher guard is still set, preventing the restore from
660
- * being re-captured as a spurious duplicate entry.
661
- *
662
- * Active-page resolution priority:
663
- * 1. Diff against `cameFromIndex` — any page present in the target
664
- * snapshot but absent from the source snapshot is being "restored"
665
- * by this transition. Navigate there. Covers undo-of-delete (lands
666
- * on the deleted page) and redo-of-add (lands on the newly-added
667
- * page) — both of which the user expects to "follow" the change.
668
- * Without this, undo of a page-delete would resolve via walk-back
669
- * to whatever page the user was on at the previous baseline, not
670
- * the page they just un-deleted.
671
- * 2. Walk back from `targetIndex` to find the closest entry whose
672
- * captured `activePageId` still exists in the restored snapshot.
673
- * Covers undo-of-add (falls back to the page the user was on
674
- * before they added the new one) and any non-page-structural
675
- * edits.
676
- */
677
- async function applySnapshotString(snapshotStr, targetIndex, cameFromIndex) {
678
- const brandPageMakerStore = useBrandPageMakerStore();
679
- let snapshot;
680
- try {
681
- snapshot = JSON.parse(snapshotStr);
682
- }
683
- catch (error) {
684
- console.error('history-store: failed to parse snapshot', error);
685
- return;
686
- }
687
- const restoredPageIds = new Set();
688
- snapshot.pages?.forEach((p) => {
689
- if (p?.id)
690
- restoredPageIds.add(p.id);
691
- });
692
- let resolvedActivePageId;
693
- // Step 1: diff against the source-of-transition. The first page in
694
- // the target snapshot whose id is absent from the source is the page
695
- // being restored/added by this apply.
696
- const sourceEntry = entries.value[cameFromIndex];
697
- if (sourceEntry) {
698
- const sourcePageIds = new Set();
699
- try {
700
- const sourceSnap = JSON.parse(sourceEntry.snapshot);
701
- sourceSnap.pages?.forEach((p) => {
702
- if (p?.id)
703
- sourcePageIds.add(p.id);
704
- });
705
- for (const p of snapshot.pages ?? []) {
706
- if (p?.id && !sourcePageIds.has(p.id)) {
707
- resolvedActivePageId = p.id;
708
- break;
709
- }
710
- }
711
- }
712
- catch {
713
- // Source snapshot unparseable — fall through to walk-back.
714
- }
715
- }
716
- // Step 2: walk-back fallback. Used when no page-structural diff
717
- // applies (style/content edits) or when the diff produced nothing
718
- // viable.
719
- if (!resolvedActivePageId) {
720
- for (let i = targetIndex; i >= 0; i--) {
721
- const candidate = entries.value[i]?.activePageId;
722
- if (candidate && restoredPageIds.has(candidate)) {
723
- resolvedActivePageId = candidate;
724
- break;
725
- }
726
- }
727
- }
728
- isApplyingSnapshot.value = true;
729
- try {
730
- await brandPageMakerStore.applyHistorySnapshot(snapshot, resolvedActivePageId);
731
- await nextTick();
732
- }
733
- finally {
734
- isApplyingSnapshot.value = false;
735
- }
736
- }
737
- /** Move the pointer back one step and apply the entry at the new position. */
738
- async function undo() {
739
- if (!canUndo.value)
740
- return;
741
- const aiThreadStore = useAiWebsiteBuilderThreadStore();
742
- if (aiThreadStore.isProcessing)
743
- return;
744
- // Capture the actor of the entry we're leaving — that's the change being undone.
745
- const undoneActor = entries.value[currentIndex.value]?.actor;
746
- const cameFromIndex = currentIndex.value;
747
- currentIndex.value -= 1;
748
- const target = entries.value[currentIndex.value];
749
- if (target) {
750
- await applySnapshotString(target.snapshot, currentIndex.value, cameFromIndex);
751
- }
752
- eventTracker.sendUndoEvent({
753
- entries_count: entries.value.length,
754
- actor: undoneActor,
755
- });
756
- }
757
- /** Move the pointer forward one step and apply the entry at the new position. */
758
- async function redo() {
759
- if (!canRedo.value)
760
- return;
761
- const aiThreadStore = useAiWebsiteBuilderThreadStore();
762
- if (aiThreadStore.isProcessing)
763
- return;
764
- const cameFromIndex = currentIndex.value;
765
- currentIndex.value += 1;
766
- const target = entries.value[currentIndex.value];
767
- if (target) {
768
- await applySnapshotString(target.snapshot, currentIndex.value, cameFromIndex);
769
- }
770
- // Actor of the entry we're moving onto — that's the change being re-applied.
771
- eventTracker.sendRedoEvent({
772
- entries_count: entries.value.length,
773
- actor: target?.actor,
774
- });
775
- }
776
- /**
777
- * Clear the stack and re-baseline against the just-saved state.
778
- *
779
- * PRD §3 Non-Goals: undo history resets on save/publish — the saved state
780
- * becomes the new clean baseline so a user can't accidentally undo back
781
- * past a save. Called by `brand-page-container-store.saveBrandPage` on a
782
- * successful save (covers both Save Progress and Publish, since publish
783
- * routes through `saveBrandPage`).
784
- *
785
- * No-ops when no baseline has ever been captured — the undo/redo feature
786
- * is gated by `userStore.features.canUseUndoRedo` (see
787
- * BrandPageMaker.mixin.ts), and only flagged sessions install the watcher
788
- * + capture a baseline. Without this guard, calling reset() in an
789
- * unflagged session would install the watcher and start eating memory
790
- * for snapshots the user can never see.
791
- *
792
- * Re-runs `captureBaseline` synchronously so the next mutation lands as
793
- * an actual undoable edit rather than disappearing into a fresh settle
794
- * window. The watcher stays installed; `installWatcher` early-returns
795
- * if `watcherInstalled` is already true.
796
- */
797
- function reset() {
798
- if (!baselineCaptured.value)
799
- return;
800
- cancelPendingAutoCapture();
801
- entries.value = [];
802
- currentIndex.value = -1;
803
- baselineCaptured.value = false;
804
- baselineCapturedAt = 0;
805
- captureBaseline();
806
- }
807
- // --- Instrumentation (NFR-04a) ---
808
- /** Sum of all entries' serialized sizes in bytes. */
809
- function getCurrentSizeBytes() {
810
- return entries.value.reduce((sum, e) => sum + e.sizeBytes, 0);
811
- }
812
- /** Total number of entries currently in the stack. */
813
- function getCurrentEntryCount() {
814
- return entries.value.length;
815
- }
816
- return {
817
- // State
818
- entries,
819
- currentIndex,
820
- isApplyingSnapshot,
821
- baselineCaptured,
822
- // Getters
823
- canUndo,
824
- canRedo,
825
- // Actions
826
- captureBaseline,
827
- capture,
828
- captureTemplateSwitch,
829
- captureAiChangeset,
830
- undo,
831
- redo,
832
- reset,
833
- getCurrentSizeBytes,
834
- getCurrentEntryCount,
835
- };
836
- });