veo-sdk 0.5.21 → 0.5.23

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.
@@ -0,0 +1,5 @@
1
+ export { VEO_BLOCK_MIME, attachBlockDropTarget, attachDesignManipulator, createBuilderSession, initBuilderMode, startElementPicker, stopElementPicker } from './chunk-SKGLEQJF.mjs';
2
+ import './chunk-4IOKJ4RO.mjs';
3
+ import './chunk-PTG3BTJE.mjs';
4
+ //# sourceMappingURL=builder-55UEMBDO.mjs.map
5
+ //# sourceMappingURL=builder-55UEMBDO.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"builder-TBIRGQDI.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"builder-55UEMBDO.mjs"}
package/dist/builder.cjs CHANGED
@@ -2294,6 +2294,8 @@ var CompositeRenderer = class extends BaseRenderer {
2294
2294
  };
2295
2295
  const readers = [];
2296
2296
  this.buildContent(card, step.blocks ?? [], doc, context, idx, readers);
2297
+ const lastBlock = card.lastElementChild;
2298
+ if (lastBlock && !lastBlock.style.marginBottom) lastBlock.style.marginBottom = "0";
2297
2299
  if (design.closeButton !== false) {
2298
2300
  const closeBtn = createCloseButton(doc, () => {
2299
2301
  dismiss("dismissed");
@@ -3301,6 +3303,26 @@ function safeDestroy(renderer) {
3301
3303
  }
3302
3304
  }
3303
3305
 
3306
+ // src/plugins/guides/url-match.ts
3307
+ function matchesUrl(matcher, pageUrl) {
3308
+ switch (matcher.type) {
3309
+ case "exact":
3310
+ return matcher.pattern === pageUrl;
3311
+ case "prefix":
3312
+ return pageUrl.startsWith(matcher.pattern);
3313
+ case "regex":
3314
+ try {
3315
+ return new RegExp(matcher.pattern).test(pageUrl);
3316
+ } catch {
3317
+ return false;
3318
+ }
3319
+ }
3320
+ }
3321
+ function stepMatchesPage(loc, pageUrl) {
3322
+ if (!loc || loc.scope === "sitewide" || !loc.pattern) return true;
3323
+ return matchesUrl({ type: loc.matchType ?? "prefix", pattern: loc.pattern }, pageUrl);
3324
+ }
3325
+
3304
3326
  // src/plugins/builder/bridge-protocol.ts
3305
3327
  var VEO_BUILDER_SOURCE = "veo-builder";
3306
3328
 
@@ -4018,10 +4040,28 @@ function initBuilderMode() {
4018
4040
  let dragGhost = null;
4019
4041
  let previewStepIndex = 0;
4020
4042
  let pendingPreview = null;
4043
+ let lastPreview = null;
4021
4044
  const getTarget = () => panel ? panel.target() : staticTarget;
4022
4045
  const post = (event) => {
4023
4046
  getTarget()?.postMessage({ source: VEO_BUILDER_SOURCE, token, ...event }, dashboardOrigin);
4024
4047
  };
4048
+ const previewMatchesPage = (cmd) => {
4049
+ const steps = cmd.guide.guideSteps;
4050
+ const step = steps?.[cmd.guide.startStepIndex ?? 0];
4051
+ return stepMatchesPage(step?.pageLocation, window.location.href);
4052
+ };
4053
+ const applyPreviewGated = (cmd) => {
4054
+ lastPreview = cmd;
4055
+ if (previewMatchesPage(cmd)) {
4056
+ applyPreview(cmd);
4057
+ } else {
4058
+ manipulator?.detach();
4059
+ manipulator = null;
4060
+ dropTarget?.detach();
4061
+ dropTarget = null;
4062
+ closeGuidePreview();
4063
+ }
4064
+ };
4025
4065
  const applyPreview = (cmd) => {
4026
4066
  manipulator?.detach();
4027
4067
  manipulator = null;
@@ -4043,7 +4083,7 @@ function initBuilderMode() {
4043
4083
  if (!pendingPreview) return;
4044
4084
  const queued = pendingPreview;
4045
4085
  pendingPreview = null;
4046
- applyPreview(queued);
4086
+ applyPreviewGated(queued);
4047
4087
  }
4048
4088
  });
4049
4089
  dropTarget = attachBlockDropTarget({
@@ -4121,7 +4161,7 @@ function initBuilderMode() {
4121
4161
  case "preview":
4122
4162
  if (!cmd.guide) break;
4123
4163
  if (manipulator?.isDragging()) pendingPreview = cmd;
4124
- else applyPreview(cmd);
4164
+ else applyPreviewGated(cmd);
4125
4165
  break;
4126
4166
  case "block-drag":
4127
4167
  handleBlockDrag(cmd);
@@ -4133,6 +4173,7 @@ function initBuilderMode() {
4133
4173
  dropTarget = null;
4134
4174
  hideDragGhost();
4135
4175
  pendingPreview = null;
4176
+ lastPreview = null;
4136
4177
  closeGuidePreview();
4137
4178
  break;
4138
4179
  case "teardown":
@@ -4147,9 +4188,35 @@ function initBuilderMode() {
4147
4188
  handleCommand(data);
4148
4189
  };
4149
4190
  const onPageHide = () => post({ type: "closed" });
4191
+ const onNav = () => {
4192
+ if (lastPreview && !manipulator?.isDragging()) applyPreviewGated(lastPreview);
4193
+ };
4194
+ const origPush = window.history.pushState;
4195
+ const origReplace = window.history.replaceState;
4196
+ const installNavWatcher = () => {
4197
+ window.history.pushState = function pushState(...args) {
4198
+ const r = origPush.apply(this, args);
4199
+ onNav();
4200
+ return r;
4201
+ };
4202
+ window.history.replaceState = function replaceState(...args) {
4203
+ const r = origReplace.apply(this, args);
4204
+ onNav();
4205
+ return r;
4206
+ };
4207
+ window.addEventListener("popstate", onNav);
4208
+ window.addEventListener("hashchange", onNav);
4209
+ };
4210
+ const removeNavWatcher = () => {
4211
+ window.history.pushState = origPush;
4212
+ window.history.replaceState = origReplace;
4213
+ window.removeEventListener("popstate", onNav);
4214
+ window.removeEventListener("hashchange", onNav);
4215
+ };
4150
4216
  const teardown = () => {
4151
4217
  window.removeEventListener("message", onMessage);
4152
4218
  window.removeEventListener("pagehide", onPageHide);
4219
+ removeNavWatcher();
4153
4220
  picker?.stop();
4154
4221
  picker = null;
4155
4222
  manipulator?.detach();
@@ -4180,6 +4247,7 @@ function initBuilderMode() {
4180
4247
  const activate = () => {
4181
4248
  window.addEventListener("message", onMessage);
4182
4249
  window.addEventListener("pagehide", onPageHide);
4250
+ installNavWatcher();
4183
4251
  if (!ctx.panel) post({ type: "ready" });
4184
4252
  };
4185
4253
  const cfg = window.__veoBuilder;