@bagelink/blox 1.15.168 → 1.15.170

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.
@@ -1 +1 @@
1
- {"version":3,"file":"CmsPageView.vue.d.ts","sourceRoot":"","sources":["../src/CmsPageView.vue"],"names":[],"mappings":";AA0bA,wBAMG"}
1
+ {"version":3,"file":"CmsPageView.vue.d.ts","sourceRoot":"","sources":["../src/CmsPageView.vue"],"names":[],"mappings":";AAodA,wBAMG"}
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-jOqBFtyW.js";
1
+ import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-BVTlfTLk.js";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-E1fz5U0S.cjs");
3
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-B1SNJnOd.cjs");
4
4
  exports.default = PreviewApp_vue_vue_type_style_index_0_lang._sfc_main;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const vue = require("vue");
3
- const core = require("./core-z-MGlvcM.cjs");
3
+ const core = require("./core-jis2RkPA.cjs");
4
4
  function sendToEditor(msg) {
5
5
  window.parent.postMessage(msg, "*");
6
6
  }
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, inject, ref, h, provide, onMounted, onUnmounted, openBlock, createElementBlock, createVNode, unref, nextTick } from "vue";
2
- import { B as BLOX_REGISTRY_KEY, g as globalRefOf, G as GlobalBlockHost, u as useLocale } from "./core-CcRbfY3w.js";
2
+ import { B as BLOX_REGISTRY_KEY, g as globalRefOf, G as GlobalBlockHost, u as useLocale } from "./core-D8O506WZ.js";
3
3
  function sendToEditor(msg) {
4
4
  window.parent.postMessage(msg, "*");
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LocaleRouterLink.vue.d.ts","sourceRoot":"","sources":["../../src/components/LocaleRouterLink.vue"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAKlD,KAAK,WAAW,GAAG;IAClB,EAAE,EAAE,gBAAgB,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;CACpF,CAAC;AAYF,iBAAS,cAAc;WAgCT,OAAO,IAA6B;;yBAVrB,GAAG;;;;EAe/B;AAUD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,kSAOnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAQpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"LocaleRouterLink.vue.d.ts","sourceRoot":"","sources":["../../src/components/LocaleRouterLink.vue"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAMlD,KAAK,WAAW,GAAG;IAClB,EAAE,EAAE,gBAAgB,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;CACpF,CAAC;AAgBF,iBAAS,cAAc;WAgCT,OAAO,IAA6B;;yBAVrB,GAAG;;;;EAe/B;AAUD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,kSAOnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAQpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -2,8 +2,8 @@
2
2
  * Locale-aware navigation composable.
3
3
  *
4
4
  * - `switchLocale(locale)` — navigates to the same page in the target locale,
5
- * using `currentAlternates` for the localized slug. Falls back to home if
6
- * the page is not available in that locale.
5
+ * using `currentAlternates[targetLocale]` when set (e.g. legal pages with
6
+ * per-locale paths). Falls back to the current URL slug, then home.
7
7
  * - `toPath(slug)` — returns the locale-aware path for any slug.
8
8
  */
9
9
  export declare function useLocaleNav(): {
@@ -1 +1 @@
1
- {"version":3,"file":"useLocaleNav.d.ts","sourceRoot":"","sources":["../../src/composables/useLocaleNav.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,wBAAgB,YAAY;iCAKS,MAAM;mBAOpB,MAAM,KAAG,MAAM;;EAKrC"}
1
+ {"version":3,"file":"useLocaleNav.d.ts","sourceRoot":"","sources":["../../src/composables/useLocaleNav.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,wBAAgB,YAAY;iCAKS,MAAM;mBAkBpB,MAAM,KAAG,MAAM;;EAOrC"}
@@ -316,6 +316,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
316
316
  const error = ref(null);
317
317
  const initialLoading = ref(true);
318
318
  const navigating = ref(false);
319
+ function navigableAlternates(alternates, resolvedSlug) {
320
+ const keys = Object.keys(alternates ?? {});
321
+ if (!keys.length) return { [locale2.value]: resolvedSlug };
322
+ return Object.fromEntries(keys.map((l) => [l, resolvedSlug]));
323
+ }
319
324
  function tryHydrateFromState(path) {
320
325
  var _a, _b, _c;
321
326
  const win = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : void 0;
@@ -327,7 +332,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
327
332
  blocks.value = ((_b = (_a = entry.page) == null ? void 0 : _a.content) == null ? void 0 : _b.blocks) ?? [];
328
333
  contexts.value = entry.contexts ?? {};
329
334
  currentPageId.value = ((_c = entry.page) == null ? void 0 : _c.id) ?? null;
330
- setAlternates(entry.alternates ?? {});
335
+ setAlternates(navigableAlternates(entry.alternates, path));
331
336
  return true;
332
337
  }
333
338
  function updateDocumentTitle(resolved) {
@@ -364,12 +369,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
364
369
  blocks.value = ((_a = resolved.page.content) == null ? void 0 : _a.blocks) ?? [];
365
370
  contexts.value = resolved.contexts ?? {};
366
371
  currentPageId.value = resolved.page.id ?? null;
367
- setAlternates(resolved.alternates ?? {});
372
+ setAlternates(navigableAlternates(resolved.alternates, slug));
368
373
  updateDocumentTitle(resolved);
369
374
  } catch (e) {
370
375
  const msg = e instanceof Error ? e.message : String(e);
371
376
  if (msg.includes("404")) {
372
- const home = strategy ? strategy.toPath("/") : "/";
377
+ const home = strategy ? strategy.toPath("/", String(locale2.value).slice(0, 2)) : "/";
373
378
  router.replace(home);
374
379
  } else {
375
380
  error.value = msg;
@@ -407,10 +412,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
407
412
  })
408
413
  ])) : error.value ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(error.value), 1)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [
409
414
  navigating.value ? (openBlock(), createElementBlock("div", _hoisted_4)) : createCommentVNode("", true),
410
- (openBlock(), createBlock(unref(PageRenderer), {
411
- key: unref(route).path,
412
- blocks: blocks.value
413
- }, null, 8, ["blocks"]))
415
+ createVNode(unref(PageRenderer), { blocks: blocks.value }, null, 8, ["blocks"])
414
416
  ], 64)),
415
417
  unref(adminConfig) ? (openBlock(), createBlock(_sfc_main$2, {
416
418
  key: 4,
@@ -433,9 +435,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
433
435
  setup(__props) {
434
436
  const props = __props;
435
437
  const strategy = inject(BLOX_LOCALE_STRATEGY_KEY, null);
438
+ const { locale: locale2 } = useLocale();
436
439
  const localizedTo = computed(() => {
437
440
  if (!strategy || typeof props.to !== "string") return props.to;
438
- return strategy.toPath(props.to);
441
+ const loc = String(locale2.value || "").slice(0, 2).toLowerCase();
442
+ return strategy.toPath(props.to, loc || void 0);
439
443
  });
440
444
  return (_ctx, _cache) => {
441
445
  return openBlock(), createBlock(unref(RouterLink), normalizeProps(guardReactiveProps({ ...props, to: localizedTo.value })), {
@@ -454,6 +458,9 @@ function createPathStrategy(options) {
454
458
  get locales() {
455
459
  return supportedLocales;
456
460
  },
461
+ get defaultLocale() {
462
+ return defaultLocale;
463
+ },
457
464
  get currentLocale() {
458
465
  return _currentLocale;
459
466
  },
@@ -462,22 +469,38 @@ function createPathStrategy(options) {
462
469
  const first = segments[0];
463
470
  if (supportedLocales.includes(first)) {
464
471
  _currentLocale = first;
472
+ const rest = segments.slice(1).join("/");
465
473
  return {
466
474
  locale: first,
467
- slug: `/${segments.slice(1).join("/")}` || "/"
475
+ slug: rest ? `/${rest}` : "/"
468
476
  };
469
477
  }
470
478
  _currentLocale = defaultLocale;
471
479
  return { locale: defaultLocale, slug: path || "/" };
472
480
  },
473
- toPath(slug) {
474
- if (_currentLocale === defaultLocale) return slug || "/";
475
- const s = slug || "/";
476
- return s === "/" ? `/${_currentLocale}` : `/${_currentLocale}${s}`;
481
+ toPath(slug, locale2) {
482
+ const loc = locale2 || _currentLocale;
483
+ let s = slug || "/";
484
+ const segments = s.replace(/^\//, "").split("/").filter(Boolean);
485
+ if (segments[0] && supportedLocales.includes(segments[0])) {
486
+ const rest = segments.slice(1).join("/");
487
+ s = rest ? `/${rest}` : "/";
488
+ }
489
+ if (loc === defaultLocale) return s;
490
+ return s === "/" ? `/${loc}` : `/${loc}${s}`;
477
491
  },
478
492
  switchTo(locale2, slug, router) {
493
+ _currentLocale = locale2;
479
494
  const s = slug || "/";
480
- const target = locale2 === defaultLocale ? s : s === "/" ? `/${locale2}` : `/${locale2}${s}`;
495
+ const bare = (() => {
496
+ const segments = s.replace(/^\//, "").split("/").filter(Boolean);
497
+ if (segments[0] && supportedLocales.includes(segments[0])) {
498
+ const rest = segments.slice(1).join("/");
499
+ return rest ? `/${rest}` : "/";
500
+ }
501
+ return s;
502
+ })();
503
+ const target = locale2 === defaultLocale ? bare : bare === "/" ? `/${locale2}` : `/${locale2}${bare}`;
481
504
  router.push(target);
482
505
  }
483
506
  };
@@ -485,11 +508,15 @@ function createPathStrategy(options) {
485
508
  function createDomainStrategy(options) {
486
509
  const { localeDomains } = options;
487
510
  const locales = Object.keys(localeDomains);
488
- const _currentLocale = locales.find((l) => localeDomains[l] === window.location.hostname) ?? locales[0] ?? "en";
511
+ const _defaultLocale = locales[0] ?? "en";
512
+ const _currentLocale = locales.find((l) => localeDomains[l] === window.location.hostname) ?? _defaultLocale;
489
513
  return {
490
514
  get locales() {
491
515
  return locales;
492
516
  },
517
+ get defaultLocale() {
518
+ return _defaultLocale;
519
+ },
493
520
  get currentLocale() {
494
521
  return _currentLocale;
495
522
  },
@@ -616,7 +643,7 @@ class BloxInstance {
616
643
  }
617
644
  router.addRoute({
618
645
  path: "/_blox_preview",
619
- component: () => import("./PreviewApp-D4KSHYFg.js"),
646
+ component: () => import("./PreviewApp-CwB2kJi3.js"),
620
647
  beforeEnter: () => window.parent !== window ? true : "/"
621
648
  });
622
649
  router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$1 });
@@ -650,7 +677,7 @@ class BloxInstance {
650
677
  app.provide(BLOX_CONFIG_KEY, this._config);
651
678
  app.provide(BLOX_LOCALE_STRATEGY_KEY, this._strategy);
652
679
  if (this._adminEdit) app.provide(BLOX_ADMIN_CONFIG_KEY, this._adminEdit);
653
- app.component("RouterLink", _sfc_main);
680
+ app._context.components.RouterLink = _sfc_main;
654
681
  }
655
682
  }
656
683
  function isBlockDefinition(value) {
@@ -317,6 +317,11 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
317
317
  const error = vue.ref(null);
318
318
  const initialLoading = vue.ref(true);
319
319
  const navigating = vue.ref(false);
320
+ function navigableAlternates(alternates, resolvedSlug) {
321
+ const keys = Object.keys(alternates ?? {});
322
+ if (!keys.length) return { [locale2.value]: resolvedSlug };
323
+ return Object.fromEntries(keys.map((l) => [l, resolvedSlug]));
324
+ }
320
325
  function tryHydrateFromState(path) {
321
326
  var _a, _b, _c;
322
327
  const win = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : void 0;
@@ -328,7 +333,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
328
333
  blocks.value = ((_b = (_a = entry.page) == null ? void 0 : _a.content) == null ? void 0 : _b.blocks) ?? [];
329
334
  contexts.value = entry.contexts ?? {};
330
335
  currentPageId.value = ((_c = entry.page) == null ? void 0 : _c.id) ?? null;
331
- setAlternates(entry.alternates ?? {});
336
+ setAlternates(navigableAlternates(entry.alternates, path));
332
337
  return true;
333
338
  }
334
339
  function updateDocumentTitle(resolved) {
@@ -365,12 +370,12 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
365
370
  blocks.value = ((_a = resolved.page.content) == null ? void 0 : _a.blocks) ?? [];
366
371
  contexts.value = resolved.contexts ?? {};
367
372
  currentPageId.value = resolved.page.id ?? null;
368
- setAlternates(resolved.alternates ?? {});
373
+ setAlternates(navigableAlternates(resolved.alternates, slug));
369
374
  updateDocumentTitle(resolved);
370
375
  } catch (e) {
371
376
  const msg = e instanceof Error ? e.message : String(e);
372
377
  if (msg.includes("404")) {
373
- const home = strategy ? strategy.toPath("/") : "/";
378
+ const home = strategy ? strategy.toPath("/", String(locale2.value).slice(0, 2)) : "/";
374
379
  router.replace(home);
375
380
  } else {
376
381
  error.value = msg;
@@ -408,10 +413,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
408
413
  })
409
414
  ])) : error.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, vue.toDisplayString(error.value), 1)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
410
415
  navigating.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4)) : vue.createCommentVNode("", true),
411
- (vue.openBlock(), vue.createBlock(vue.unref(PageRenderer), {
412
- key: vue.unref(route).path,
413
- blocks: blocks.value
414
- }, null, 8, ["blocks"]))
416
+ vue.createVNode(vue.unref(PageRenderer), { blocks: blocks.value }, null, 8, ["blocks"])
415
417
  ], 64)),
416
418
  vue.unref(adminConfig) ? (vue.openBlock(), vue.createBlock(_sfc_main$2, {
417
419
  key: 4,
@@ -434,9 +436,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
434
436
  setup(__props) {
435
437
  const props = __props;
436
438
  const strategy = vue.inject(BLOX_LOCALE_STRATEGY_KEY, null);
439
+ const { locale: locale2 } = useLocale();
437
440
  const localizedTo = vue.computed(() => {
438
441
  if (!strategy || typeof props.to !== "string") return props.to;
439
- return strategy.toPath(props.to);
442
+ const loc = String(locale2.value || "").slice(0, 2).toLowerCase();
443
+ return strategy.toPath(props.to, loc || void 0);
440
444
  });
441
445
  return (_ctx, _cache) => {
442
446
  return vue.openBlock(), vue.createBlock(vue.unref(vueRouter.RouterLink), vue.normalizeProps(vue.guardReactiveProps({ ...props, to: localizedTo.value })), {
@@ -455,6 +459,9 @@ function createPathStrategy(options) {
455
459
  get locales() {
456
460
  return supportedLocales;
457
461
  },
462
+ get defaultLocale() {
463
+ return defaultLocale;
464
+ },
458
465
  get currentLocale() {
459
466
  return _currentLocale;
460
467
  },
@@ -463,22 +470,38 @@ function createPathStrategy(options) {
463
470
  const first = segments[0];
464
471
  if (supportedLocales.includes(first)) {
465
472
  _currentLocale = first;
473
+ const rest = segments.slice(1).join("/");
466
474
  return {
467
475
  locale: first,
468
- slug: `/${segments.slice(1).join("/")}` || "/"
476
+ slug: rest ? `/${rest}` : "/"
469
477
  };
470
478
  }
471
479
  _currentLocale = defaultLocale;
472
480
  return { locale: defaultLocale, slug: path || "/" };
473
481
  },
474
- toPath(slug) {
475
- if (_currentLocale === defaultLocale) return slug || "/";
476
- const s = slug || "/";
477
- return s === "/" ? `/${_currentLocale}` : `/${_currentLocale}${s}`;
482
+ toPath(slug, locale2) {
483
+ const loc = locale2 || _currentLocale;
484
+ let s = slug || "/";
485
+ const segments = s.replace(/^\//, "").split("/").filter(Boolean);
486
+ if (segments[0] && supportedLocales.includes(segments[0])) {
487
+ const rest = segments.slice(1).join("/");
488
+ s = rest ? `/${rest}` : "/";
489
+ }
490
+ if (loc === defaultLocale) return s;
491
+ return s === "/" ? `/${loc}` : `/${loc}${s}`;
478
492
  },
479
493
  switchTo(locale2, slug, router) {
494
+ _currentLocale = locale2;
480
495
  const s = slug || "/";
481
- const target = locale2 === defaultLocale ? s : s === "/" ? `/${locale2}` : `/${locale2}${s}`;
496
+ const bare = (() => {
497
+ const segments = s.replace(/^\//, "").split("/").filter(Boolean);
498
+ if (segments[0] && supportedLocales.includes(segments[0])) {
499
+ const rest = segments.slice(1).join("/");
500
+ return rest ? `/${rest}` : "/";
501
+ }
502
+ return s;
503
+ })();
504
+ const target = locale2 === defaultLocale ? bare : bare === "/" ? `/${locale2}` : `/${locale2}${bare}`;
482
505
  router.push(target);
483
506
  }
484
507
  };
@@ -486,11 +509,15 @@ function createPathStrategy(options) {
486
509
  function createDomainStrategy(options) {
487
510
  const { localeDomains } = options;
488
511
  const locales = Object.keys(localeDomains);
489
- const _currentLocale = locales.find((l) => localeDomains[l] === window.location.hostname) ?? locales[0] ?? "en";
512
+ const _defaultLocale = locales[0] ?? "en";
513
+ const _currentLocale = locales.find((l) => localeDomains[l] === window.location.hostname) ?? _defaultLocale;
490
514
  return {
491
515
  get locales() {
492
516
  return locales;
493
517
  },
518
+ get defaultLocale() {
519
+ return _defaultLocale;
520
+ },
494
521
  get currentLocale() {
495
522
  return _currentLocale;
496
523
  },
@@ -617,7 +644,7 @@ class BloxInstance {
617
644
  }
618
645
  router.addRoute({
619
646
  path: "/_blox_preview",
620
- component: () => Promise.resolve().then(() => require("./PreviewApp-BzkbTbJn.cjs")),
647
+ component: () => Promise.resolve().then(() => require("./PreviewApp-DqRHk5sz.cjs")),
621
648
  beforeEnter: () => window.parent !== window ? true : "/"
622
649
  });
623
650
  router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$1 });
@@ -651,7 +678,7 @@ class BloxInstance {
651
678
  app.provide(BLOX_CONFIG_KEY, this._config);
652
679
  app.provide(BLOX_LOCALE_STRATEGY_KEY, this._strategy);
653
680
  if (this._adminEdit) app.provide(BLOX_ADMIN_CONFIG_KEY, this._adminEdit);
654
- app.component("RouterLink", _sfc_main);
681
+ app._context.components.RouterLink = _sfc_main;
655
682
  }
656
683
  }
657
684
  function isBlockDefinition(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAa,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,KAAK,EAAkB,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAc,MAAM,WAAW,CAAA;AAmB5D,4GAA4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Root":"","sources":["../src/defineBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,MAAM,WAAW,SAAS;IACzB,kGAAkG;IAClG,IAAI,EAAE,MAAM,CAAA;IACZ,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAA;IACb,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sFAAsF;IACtF,MAAM,CAAC,EAAE,gBAAgB,CAAA;IACzB,yGAAyG;IACzG,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2KAA2K;IAC3K,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,0FAA0F;IAC1F,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED,kGAAkG;AAClG,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAmBtD"}
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const core = require("./core-z-MGlvcM.cjs");
4
- const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-E1fz5U0S.cjs");
3
+ const core = require("./core-jis2RkPA.cjs");
4
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-B1SNJnOd.cjs");
5
5
  const vue = require("vue");
6
6
  const vueRouter = require("vue-router");
7
7
  const pinia = require("pinia");
@@ -44,11 +44,16 @@ function useLocaleNav() {
44
44
  const { locale, currentAlternates } = core.useLocale();
45
45
  function switchLocale(targetLocale) {
46
46
  if (!strategy) return;
47
- const alternateSlug = currentAlternates.value[targetLocale];
48
- strategy.switchTo(targetLocale, alternateSlug ?? "/", router);
47
+ const alts = currentAlternates.value;
48
+ const hostname = typeof window !== "undefined" ? window.location.hostname : "";
49
+ const { slug: currentSlug } = strategy.detect(hostname, router.currentRoute.value.path);
50
+ const alternateSlug = alts[targetLocale] ?? alts[strategy.defaultLocale] ?? currentSlug ?? "/";
51
+ strategy.switchTo(targetLocale, alternateSlug, router);
49
52
  }
50
53
  function toPath(slug) {
51
- return strategy ? strategy.toPath(slug) : slug;
54
+ if (!strategy) return slug;
55
+ const loc = String(locale.value || "").slice(0, 2).toLowerCase();
56
+ return strategy.toPath(slug, loc || void 0);
52
57
  }
53
58
  return { switchLocale, toPath, locale };
54
59
  }
@@ -146,7 +151,11 @@ function defineBlock(meta) {
146
151
  if (val !== void 0) extracted[key] = val;
147
152
  }
148
153
  if (Object.keys(extracted).length > 0) {
149
- meta.defaults = extracted;
154
+ try {
155
+ meta.defaults = structuredClone(extracted);
156
+ } catch {
157
+ meta.defaults = JSON.parse(JSON.stringify(extracted));
158
+ }
150
159
  }
151
160
  }
152
161
  return meta;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { a as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, c as createBlox } from "./core-CcRbfY3w.js";
2
- import { _, b, d, e, f, h, i, G, P, j, k, l, g, m, r, n } from "./core-CcRbfY3w.js";
3
- import { _ as _2, P as P2, s, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-jOqBFtyW.js";
1
+ import { a as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, c as createBlox } from "./core-D8O506WZ.js";
2
+ import { _, b, d, e, f, h, i, G, P, j, k, l, g, m, r, n } from "./core-D8O506WZ.js";
3
+ import { _ as _2, P as P2, s, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-BVTlfTLk.js";
4
4
  import { ref, onMounted, onUnmounted, inject, computed, createApp, markRaw } from "vue";
5
5
  import { useRouter } from "vue-router";
6
6
  import { createPinia } from "pinia";
@@ -43,11 +43,16 @@ function useLocaleNav() {
43
43
  const { locale, currentAlternates } = useLocale();
44
44
  function switchLocale(targetLocale) {
45
45
  if (!strategy) return;
46
- const alternateSlug = currentAlternates.value[targetLocale];
47
- strategy.switchTo(targetLocale, alternateSlug ?? "/", router);
46
+ const alts = currentAlternates.value;
47
+ const hostname = typeof window !== "undefined" ? window.location.hostname : "";
48
+ const { slug: currentSlug } = strategy.detect(hostname, router.currentRoute.value.path);
49
+ const alternateSlug = alts[targetLocale] ?? alts[strategy.defaultLocale] ?? currentSlug ?? "/";
50
+ strategy.switchTo(targetLocale, alternateSlug, router);
48
51
  }
49
52
  function toPath(slug) {
50
- return strategy ? strategy.toPath(slug) : slug;
53
+ if (!strategy) return slug;
54
+ const loc = String(locale.value || "").slice(0, 2).toLowerCase();
55
+ return strategy.toPath(slug, loc || void 0);
51
56
  }
52
57
  return { switchLocale, toPath, locale };
53
58
  }
@@ -145,7 +150,11 @@ function defineBlock(meta) {
145
150
  if (val !== void 0) extracted[key] = val;
146
151
  }
147
152
  if (Object.keys(extracted).length > 0) {
148
- meta.defaults = extracted;
153
+ try {
154
+ meta.defaults = structuredClone(extracted);
155
+ } catch {
156
+ meta.defaults = JSON.parse(JSON.stringify(extracted));
157
+ }
149
158
  }
150
159
  }
151
160
  return meta;
@@ -6,11 +6,12 @@ export interface LocaleStrategy {
6
6
  slug: string;
7
7
  };
8
8
  /**
9
- * Return a navigable path for the given slug in the current locale context.
9
+ * Return a navigable path for the given slug in the given (or current) locale.
10
10
  * For `path` strategy: prepends locale prefix (omitted for default locale).
11
+ * Idempotent if `slug` is already locale-prefixed.
11
12
  * For `domain` strategy: returns slug as-is (the domain carries the locale).
12
13
  */
13
- toPath: (slug: string) => string;
14
+ toPath: (slug: string, locale?: string) => string;
14
15
  /**
15
16
  * Navigate to a different locale, using the provided localized slug.
16
17
  * Falls back to '/' if no slug given.
@@ -18,6 +19,8 @@ export interface LocaleStrategy {
18
19
  switchTo: (locale: string, slug: string, router: Router) => void;
19
20
  /** All known locales. */
20
21
  readonly locales: string[];
22
+ /** Default / canonical locale (pages resolve by this locale's slug). */
23
+ readonly defaultLocale: string;
21
24
  /** The locale active on this deployment/URL. */
22
25
  readonly currentLocale: string;
23
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"localeStrategy.d.ts","sourceRoot":"","sources":["../src/localeStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC,MAAM,WAAW,cAAc;IAC9B,gEAAgE;IAChE,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5E;;;;OAIG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IAChC;;;OAGG;IACH,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAChE,yBAAyB;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAA;IAC1B,gDAAgD;IAChD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC9B;AAMD,MAAM,WAAW,mBAAmB;IACnC,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,MAAM,EAAE,CAAA;CAC1B;AA2CD,MAAM,WAAW,qBAAqB;IACrC,+EAA+E;IAC/E,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC;AA4CD,MAAM,WAAW,eAAe;IAC/B,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;IAClC,aAAa,C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AClC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACtC;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CAQ7E"}
@@ -26,7 +26,7 @@ const prerender = require("../prerender-BLECK5o5.cjs");
26
26
  const ssg_client = require("./client.cjs");
27
27
  const pinia = require("pinia");
28
28
  const vue = require("vue");
29
- const core = require("../core-z-MGlvcM.cjs");
29
+ const core = require("../core-jis2RkPA.cjs");
30
30
  async function renderBloxSsgPage(options) {
31
31
  const {
32
32
  url,
@@ -4,7 +4,7 @@ import { BLOX_STATE_WINDOW_KEY, BLOX_COLLECTIONS_WINDOW_KEY, BLOX_WEBSITE_ID_WIN
4
4
  import { getCollectionCache, getEmbeddedWebsiteId, installBloxStateCache, installCollectionCache } from "./client.mjs";
5
5
  import { createPinia } from "pinia";
6
6
  import { createSSRApp, markRaw } from "vue";
7
- import { c as createBlox } from "../core-CcRbfY3w.js";
7
+ import { c as createBlox } from "../core-D8O506WZ.js";
8
8
  async function renderBloxSsgPage(options) {
9
9
  const {
10
10
  url,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/blox",
3
3
  "type": "module",
4
- "version": "1.15.168",
4
+ "version": "1.15.170",
5
5
  "description": "Blox page builder library for drag-and-drop page building and static data management",
6
6
  "author": {
7
7
  "name": "Bagel Studio",