@bagelink/blox 1.15.168 → 1.15.172
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/dist/CmsPageView.vue.d.ts.map +1 -1
- package/dist/{PreviewApp-D4KSHYFg.js → PreviewApp-CsC6qej1.js} +1 -1
- package/dist/{PreviewApp-BzkbTbJn.cjs → PreviewApp-Dz003khp.cjs} +1 -1
- package/dist/PreviewApp.vue.d.ts.map +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-E1fz5U0S.cjs → PreviewApp.vue_vue_type_style_index_0_lang-BNKK7Vhs.cjs} +5 -2
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-jOqBFtyW.js → PreviewApp.vue_vue_type_style_index_0_lang-C1SwhjdY.js} +5 -2
- package/dist/bridge.d.ts +4 -1
- package/dist/bridge.d.ts.map +1 -1
- package/dist/components/LocaleRouterLink.vue.d.ts +2 -0
- package/dist/components/LocaleRouterLink.vue.d.ts.map +1 -1
- package/dist/composables/useLocaleNav.d.ts +2 -2
- package/dist/composables/useLocaleNav.d.ts.map +1 -1
- package/dist/{core-CcRbfY3w.js → core-CbOrSpOU.js} +183 -36
- package/dist/{core-z-MGlvcM.cjs → core-fPjj9xyJ.cjs} +174 -27
- package/dist/core.d.ts.map +1 -1
- package/dist/createBloxApp.d.ts.map +1 -1
- package/dist/defineBlock.d.ts +25 -2
- package/dist/defineBlock.d.ts.map +1 -1
- package/dist/index.cjs +26 -7
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +39 -20
- package/dist/localeStrategy.d.ts +5 -2
- package/dist/localeStrategy.d.ts.map +1 -1
- package/dist/manifest.d.ts +2 -0
- package/dist/manifest.d.ts.map +1 -1
- package/dist/schema.d.ts +5 -3
- package/dist/schema.d.ts.map +1 -1
- package/dist/smartLinks.d.ts +31 -0
- package/dist/smartLinks.d.ts.map +1 -0
- package/dist/ssg/index.cjs +1 -1
- package/dist/ssg/index.mjs +1 -1
- package/dist/vite-plugin.cjs +12 -2
- package/dist/vite-plugin.d.ts.map +1 -1
- package/dist/vite-plugin.mjs +12 -2
- package/package.json +1 -1
|
@@ -116,7 +116,7 @@ function useBloxEdit(configOverride) {
|
|
|
116
116
|
}
|
|
117
117
|
return { config, enabled, showEdit, studioBaseUrl, editUrl, enable, dismiss, init };
|
|
118
118
|
}
|
|
119
|
-
const _hoisted_1$
|
|
119
|
+
const _hoisted_1$2 = {
|
|
120
120
|
key: 0,
|
|
121
121
|
class: "blox-admin-bar"
|
|
122
122
|
};
|
|
@@ -139,7 +139,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
139
139
|
key: 0,
|
|
140
140
|
to: "body"
|
|
141
141
|
}, [
|
|
142
|
-
vue.unref(showEdit) && __props.websiteId && __props.pageId ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
142
|
+
vue.unref(showEdit) && __props.websiteId && __props.pageId ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
|
|
143
143
|
vue.createElementVNode("button", {
|
|
144
144
|
type: "button",
|
|
145
145
|
class: "blox-admin-btn",
|
|
@@ -284,11 +284,11 @@ const PageRenderer = vue.defineComponent({
|
|
|
284
284
|
);
|
|
285
285
|
}
|
|
286
286
|
});
|
|
287
|
-
const _hoisted_1 = {
|
|
287
|
+
const _hoisted_1$1 = {
|
|
288
288
|
key: 0,
|
|
289
289
|
class: "blox-loading flex column h-100vh justify-content-center"
|
|
290
290
|
};
|
|
291
|
-
const _hoisted_2 = {
|
|
291
|
+
const _hoisted_2$1 = {
|
|
292
292
|
key: 1,
|
|
293
293
|
class: "blox-not-found"
|
|
294
294
|
};
|
|
@@ -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;
|
|
@@ -395,9 +400,9 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
395
400
|
return (_ctx, _cache) => {
|
|
396
401
|
const _component_RouterLink = vue.resolveComponent("RouterLink");
|
|
397
402
|
return vue.openBlock(), vue.createElementBlock("div", null, [
|
|
398
|
-
initialLoading.value && blocks.value.length === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
403
|
+
initialLoading.value && blocks.value.length === 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
|
|
399
404
|
vue.createVNode(vue.unref(vue$1.Loading))
|
|
400
|
-
])) : notFound.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
|
|
405
|
+
])) : notFound.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1, [
|
|
401
406
|
_cache[0] || (_cache[0] = vue.createElementVNode("h2", null, "404", -1)),
|
|
402
407
|
vue.createElementVNode("p", null, vue.toDisplayString(vue.unref(locale2) === "he" ? "הדף לא נמצא" : "Page not found"), 1),
|
|
403
408
|
vue.createVNode(_component_RouterLink, { to: "/" }, {
|
|
@@ -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
|
-
|
|
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,
|
|
@@ -422,7 +424,96 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
422
424
|
};
|
|
423
425
|
}
|
|
424
426
|
});
|
|
427
|
+
function normalizeLink(href) {
|
|
428
|
+
const v = href == null ? void 0 : href.trim();
|
|
429
|
+
if (!v) return void 0;
|
|
430
|
+
if (/^(https?:|mailto:|tel:|sms:|whatsapp:|geo:|#|\/\/|\/|\.)/i.test(v)) return v;
|
|
431
|
+
return `/${v}`;
|
|
432
|
+
}
|
|
433
|
+
const normalizeTo = normalizeLink;
|
|
434
|
+
function isAbsoluteExternal(href) {
|
|
435
|
+
return /^(https?:)?\/\//i.test(href);
|
|
436
|
+
}
|
|
437
|
+
function isSpecialScheme(href) {
|
|
438
|
+
return /^(mailto:|tel:|sms:|whatsapp:|geo:|#)/i.test(href);
|
|
439
|
+
}
|
|
440
|
+
function classifyLink(href, origin = typeof window !== "undefined" ? window.location.origin : "") {
|
|
441
|
+
if (isSpecialScheme(href)) return "special";
|
|
442
|
+
if (isAbsoluteExternal(href)) {
|
|
443
|
+
if (origin) {
|
|
444
|
+
try {
|
|
445
|
+
if (new URL(href, origin).origin === origin) return "internal";
|
|
446
|
+
} catch {
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return "external";
|
|
450
|
+
}
|
|
451
|
+
return "internal";
|
|
452
|
+
}
|
|
453
|
+
function toInternalPath(href) {
|
|
454
|
+
const normalized = normalizeLink(href) ?? href.trim();
|
|
455
|
+
if (isAbsoluteExternal(normalized)) {
|
|
456
|
+
try {
|
|
457
|
+
const base = typeof window !== "undefined" ? window.location.href : "http://localhost";
|
|
458
|
+
const url = new URL(normalized, base);
|
|
459
|
+
return `${url.pathname}${url.search}${url.hash}` || "/";
|
|
460
|
+
} catch {
|
|
461
|
+
return normalized;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return normalized || "/";
|
|
465
|
+
}
|
|
466
|
+
function shouldIgnore(e, anchor) {
|
|
467
|
+
if (e.defaultPrevented) return true;
|
|
468
|
+
if (e.button !== 0) return true;
|
|
469
|
+
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return true;
|
|
470
|
+
if (anchor.hasAttribute("download")) return true;
|
|
471
|
+
const target = anchor.getAttribute("target");
|
|
472
|
+
if (target && target !== "_self") return true;
|
|
473
|
+
return false;
|
|
474
|
+
}
|
|
475
|
+
function installSmartLinks(router) {
|
|
476
|
+
if (typeof document === "undefined") return () => {
|
|
477
|
+
};
|
|
478
|
+
function onClick(e) {
|
|
479
|
+
var _a, _b, _c;
|
|
480
|
+
const path = ((_a = e.composedPath) == null ? void 0 : _a.call(e)) ?? [];
|
|
481
|
+
const anchor = path.find((el) => el instanceof HTMLAnchorElement) ?? ((_c = (_b = e.target) == null ? void 0 : _b.closest) == null ? void 0 : _c.call(_b, "a"));
|
|
482
|
+
if (!anchor) return;
|
|
483
|
+
const rawHref = anchor.getAttribute("href");
|
|
484
|
+
if (!rawHref) return;
|
|
485
|
+
const href = normalizeLink(rawHref) ?? rawHref.trim();
|
|
486
|
+
if (!href) return;
|
|
487
|
+
if (isSpecialScheme(href)) return;
|
|
488
|
+
if (isAbsoluteExternal(href)) {
|
|
489
|
+
let sameOrigin = false;
|
|
490
|
+
try {
|
|
491
|
+
sameOrigin = new URL(href, window.location.href).origin === window.location.origin;
|
|
492
|
+
} catch {
|
|
493
|
+
sameOrigin = false;
|
|
494
|
+
}
|
|
495
|
+
if (!sameOrigin) {
|
|
496
|
+
if (anchor.getAttribute("target")) return;
|
|
497
|
+
e.preventDefault();
|
|
498
|
+
window.open(href, "_blank", "noopener,noreferrer");
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
if (shouldIgnore(e, anchor)) return;
|
|
502
|
+
e.preventDefault();
|
|
503
|
+
void router.push(toInternalPath(href));
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
if (shouldIgnore(e, anchor)) return;
|
|
507
|
+
e.preventDefault();
|
|
508
|
+
void router.push(href.startsWith("/") ? href : `/${href}`);
|
|
509
|
+
}
|
|
510
|
+
document.addEventListener("click", onClick);
|
|
511
|
+
return () => document.removeEventListener("click", onClick);
|
|
512
|
+
}
|
|
513
|
+
const _hoisted_1 = ["href"];
|
|
514
|
+
const _hoisted_2 = ["href"];
|
|
425
515
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
516
|
+
...{ inheritAttrs: false },
|
|
426
517
|
__name: "LocaleRouterLink",
|
|
427
518
|
props: {
|
|
428
519
|
to: {},
|
|
@@ -433,18 +524,39 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
433
524
|
},
|
|
434
525
|
setup(__props) {
|
|
435
526
|
const props = __props;
|
|
527
|
+
const attrs = vue.useAttrs();
|
|
436
528
|
const strategy = vue.inject(BLOX_LOCALE_STRATEGY_KEY, null);
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
|
|
529
|
+
const { locale: locale2 } = useLocale();
|
|
530
|
+
const resolved = vue.computed(() => {
|
|
531
|
+
if (typeof props.to !== "string") {
|
|
532
|
+
return { kind: "route", to: props.to };
|
|
533
|
+
}
|
|
534
|
+
const href = normalizeLink(props.to) ?? props.to.trim();
|
|
535
|
+
const kind = classifyLink(href);
|
|
536
|
+
if (kind === "external") return { kind: "external", href };
|
|
537
|
+
if (kind === "special") return { kind: "special", href };
|
|
538
|
+
const path = toInternalPath(href);
|
|
539
|
+
const loc = String(locale2.value || "").slice(0, 2).toLowerCase();
|
|
540
|
+
const to = strategy ? strategy.toPath(path, loc || void 0) : path;
|
|
541
|
+
return { kind: "route", to };
|
|
440
542
|
});
|
|
441
543
|
return (_ctx, _cache) => {
|
|
442
|
-
return vue.openBlock(), vue.
|
|
544
|
+
return resolved.value.kind === "external" ? (vue.openBlock(), vue.createElementBlock("a", vue.mergeProps({ key: 0 }, vue.unref(attrs), {
|
|
545
|
+
href: resolved.value.href,
|
|
546
|
+
target: "_blank",
|
|
547
|
+
rel: "noopener noreferrer"
|
|
548
|
+
}), [
|
|
549
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
550
|
+
], 16, _hoisted_1)) : resolved.value.kind === "special" ? (vue.openBlock(), vue.createElementBlock("a", vue.mergeProps({ key: 1 }, vue.unref(attrs), {
|
|
551
|
+
href: resolved.value.href
|
|
552
|
+
}), [
|
|
553
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
554
|
+
], 16, _hoisted_2)) : (vue.openBlock(), vue.createBlock(vue.unref(vueRouter.RouterLink), vue.normalizeProps(vue.mergeProps({ key: 2 }, { ...props, ...vue.unref(attrs), to: resolved.value.to })), {
|
|
443
555
|
default: vue.withCtx(() => [
|
|
444
556
|
vue.renderSlot(_ctx.$slots, "default")
|
|
445
557
|
]),
|
|
446
558
|
_: 3
|
|
447
|
-
}, 16);
|
|
559
|
+
}, 16));
|
|
448
560
|
};
|
|
449
561
|
}
|
|
450
562
|
});
|
|
@@ -455,6 +567,9 @@ function createPathStrategy(options) {
|
|
|
455
567
|
get locales() {
|
|
456
568
|
return supportedLocales;
|
|
457
569
|
},
|
|
570
|
+
get defaultLocale() {
|
|
571
|
+
return defaultLocale;
|
|
572
|
+
},
|
|
458
573
|
get currentLocale() {
|
|
459
574
|
return _currentLocale;
|
|
460
575
|
},
|
|
@@ -463,22 +578,41 @@ function createPathStrategy(options) {
|
|
|
463
578
|
const first = segments[0];
|
|
464
579
|
if (supportedLocales.includes(first)) {
|
|
465
580
|
_currentLocale = first;
|
|
581
|
+
const rest = segments.slice(1).join("/");
|
|
466
582
|
return {
|
|
467
583
|
locale: first,
|
|
468
|
-
slug: `/${
|
|
584
|
+
slug: rest ? `/${rest}` : "/"
|
|
469
585
|
};
|
|
470
586
|
}
|
|
471
587
|
_currentLocale = defaultLocale;
|
|
472
588
|
return { locale: defaultLocale, slug: path || "/" };
|
|
473
589
|
},
|
|
474
|
-
toPath(slug) {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
590
|
+
toPath(slug, locale2) {
|
|
591
|
+
const loc = locale2 || _currentLocale;
|
|
592
|
+
let s = slug || "/";
|
|
593
|
+
if (s && !s.startsWith("/") && !/^(https?:|mailto:|tel:|sms:|whatsapp:|geo:|#|\/\/)/i.test(s)) {
|
|
594
|
+
s = `/${s}`;
|
|
595
|
+
}
|
|
596
|
+
const segments = s.replace(/^\//, "").split("/").filter(Boolean);
|
|
597
|
+
if (segments[0] && supportedLocales.includes(segments[0])) {
|
|
598
|
+
const rest = segments.slice(1).join("/");
|
|
599
|
+
s = rest ? `/${rest}` : "/";
|
|
600
|
+
}
|
|
601
|
+
if (loc === defaultLocale) return s;
|
|
602
|
+
return s === "/" ? `/${loc}` : `/${loc}${s}`;
|
|
478
603
|
},
|
|
479
604
|
switchTo(locale2, slug, router) {
|
|
605
|
+
_currentLocale = locale2;
|
|
480
606
|
const s = slug || "/";
|
|
481
|
-
const
|
|
607
|
+
const bare = (() => {
|
|
608
|
+
const segments = s.replace(/^\//, "").split("/").filter(Boolean);
|
|
609
|
+
if (segments[0] && supportedLocales.includes(segments[0])) {
|
|
610
|
+
const rest = segments.slice(1).join("/");
|
|
611
|
+
return rest ? `/${rest}` : "/";
|
|
612
|
+
}
|
|
613
|
+
return s;
|
|
614
|
+
})();
|
|
615
|
+
const target = locale2 === defaultLocale ? bare : bare === "/" ? `/${locale2}` : `/${locale2}${bare}`;
|
|
482
616
|
router.push(target);
|
|
483
617
|
}
|
|
484
618
|
};
|
|
@@ -486,11 +620,15 @@ function createPathStrategy(options) {
|
|
|
486
620
|
function createDomainStrategy(options) {
|
|
487
621
|
const { localeDomains } = options;
|
|
488
622
|
const locales = Object.keys(localeDomains);
|
|
489
|
-
const
|
|
623
|
+
const _defaultLocale = locales[0] ?? "en";
|
|
624
|
+
const _currentLocale = locales.find((l) => localeDomains[l] === window.location.hostname) ?? _defaultLocale;
|
|
490
625
|
return {
|
|
491
626
|
get locales() {
|
|
492
627
|
return locales;
|
|
493
628
|
},
|
|
629
|
+
get defaultLocale() {
|
|
630
|
+
return _defaultLocale;
|
|
631
|
+
},
|
|
494
632
|
get currentLocale() {
|
|
495
633
|
return _currentLocale;
|
|
496
634
|
},
|
|
@@ -564,6 +702,7 @@ class BloxInstance {
|
|
|
564
702
|
fields: meta.schema,
|
|
565
703
|
defaults: meta.defaults,
|
|
566
704
|
dataSource: meta.dataSource,
|
|
705
|
+
category: meta.category,
|
|
567
706
|
thumbnail: meta.thumbnail,
|
|
568
707
|
order: meta.order
|
|
569
708
|
}
|
|
@@ -591,6 +730,7 @@ class BloxInstance {
|
|
|
591
730
|
fields: meta.schema,
|
|
592
731
|
defaults: meta.defaults,
|
|
593
732
|
dataSource: meta.dataSource,
|
|
733
|
+
category: meta.category,
|
|
594
734
|
thumbnail: meta.thumbnail,
|
|
595
735
|
order: meta.order
|
|
596
736
|
}
|
|
@@ -617,7 +757,7 @@ class BloxInstance {
|
|
|
617
757
|
}
|
|
618
758
|
router.addRoute({
|
|
619
759
|
path: "/_blox_preview",
|
|
620
|
-
component: () => Promise.resolve().then(() => require("./PreviewApp-
|
|
760
|
+
component: () => Promise.resolve().then(() => require("./PreviewApp-Dz003khp.cjs")),
|
|
621
761
|
beforeEnter: () => window.parent !== window ? true : "/"
|
|
622
762
|
});
|
|
623
763
|
router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$1 });
|
|
@@ -651,7 +791,7 @@ class BloxInstance {
|
|
|
651
791
|
app.provide(BLOX_CONFIG_KEY, this._config);
|
|
652
792
|
app.provide(BLOX_LOCALE_STRATEGY_KEY, this._strategy);
|
|
653
793
|
if (this._adminEdit) app.provide(BLOX_ADMIN_CONFIG_KEY, this._adminEdit);
|
|
654
|
-
app.
|
|
794
|
+
app._context.components.RouterLink = _sfc_main;
|
|
655
795
|
}
|
|
656
796
|
}
|
|
657
797
|
function isBlockDefinition(value) {
|
|
@@ -678,12 +818,19 @@ exports.GlobalBlockHost = GlobalBlockHost;
|
|
|
678
818
|
exports.PageRenderer = PageRenderer;
|
|
679
819
|
exports._sfc_main = _sfc_main$2;
|
|
680
820
|
exports._sfc_main$1 = _sfc_main$1;
|
|
821
|
+
exports.classifyLink = classifyLink;
|
|
681
822
|
exports.configureApi = configureApi;
|
|
682
823
|
exports.createBlox = createBlox;
|
|
683
824
|
exports.getWebsiteId = getWebsiteId;
|
|
684
825
|
exports.getWebsiteIdSync = getWebsiteIdSync;
|
|
685
826
|
exports.globalRefOf = globalRefOf;
|
|
827
|
+
exports.installSmartLinks = installSmartLinks;
|
|
828
|
+
exports.isAbsoluteExternal = isAbsoluteExternal;
|
|
829
|
+
exports.isSpecialScheme = isSpecialScheme;
|
|
686
830
|
exports.listItems = listItems;
|
|
831
|
+
exports.normalizeLink = normalizeLink;
|
|
832
|
+
exports.normalizeTo = normalizeTo;
|
|
687
833
|
exports.resolvePath = resolvePath;
|
|
834
|
+
exports.toInternalPath = toInternalPath;
|
|
688
835
|
exports.useBloxEdit = useBloxEdit;
|
|
689
836
|
exports.useLocale = useLocale;
|
package/dist/core.d.ts.map
CHANGED
|
@@ -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,4GAA4G;AAC5G,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,cAAc,CAAA;AAE5D,MAAM,WAAW,WAAY,SAAQ,eAAe;IACnD,qIAAqI;IACrI,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IAC1C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C,CAAC,CAAA;IAChD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAC5C;;;OAGG;IACH,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAA;IAC1B;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAA;CACrC;AAED,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB;IAChC,gGAAgG;IAChG,MAAM,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB;AAID;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAoBvE;AAED,wDAAwD;AACxD,UAAU,SAAS;IAClB,YAAY,EAAE;QACb,OAAO,EAAE;YAER,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,KAAK,IAAI,CAAA;SACvC,CAAA;KACD,CAAA;CACD;AAED,MAAM,WAAW,aAAa;IAC7B,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,YAAY,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAmF1E"}
|
package/dist/defineBlock.d.ts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { SchemaDefinition } from '@bagelink/vue';
|
|
2
|
+
/** Datastore collection this block reads from (shown as a deep-link in the designer). */
|
|
3
|
+
export interface BlockDataSource {
|
|
4
|
+
/** Datastore collection name (e.g. `'why-sell'`). */
|
|
5
|
+
collection: string;
|
|
6
|
+
/** Datastore store id. When omitted, the admin default store is used. */
|
|
7
|
+
store?: string;
|
|
8
|
+
/** Label in the designer (defaults to `collection`). */
|
|
9
|
+
label?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* `true` — show a "data" badge with no deep-link.
|
|
13
|
+
* One ref / list of refs — badge + clickable link(s) to the collection editor.
|
|
14
|
+
*/
|
|
15
|
+
export type BlockDataSourceConfig = boolean | BlockDataSource | BlockDataSource[];
|
|
2
16
|
export interface BlockMeta {
|
|
3
17
|
/** Block type key — must be unique across the app. Used as the export name by the Vite plugin. */
|
|
4
18
|
name: string;
|
|
@@ -11,8 +25,17 @@ export interface BlockMeta {
|
|
|
11
25
|
/** Default prop values. Merged with block props at render time so blocks show content before editing. */
|
|
12
26
|
defaults?: Record<string, unknown>;
|
|
13
27
|
description?: string;
|
|
14
|
-
/**
|
|
15
|
-
|
|
28
|
+
/**
|
|
29
|
+
* When set, the page designer shows that this block also pulls content from
|
|
30
|
+
* a datastore collection — and links to that collection when refs are provided.
|
|
31
|
+
*/
|
|
32
|
+
dataSource?: BlockDataSourceConfig;
|
|
33
|
+
/**
|
|
34
|
+
* Group key for the editor block picker (e.g. `'hero'`, `'content'`, `'layout'`).
|
|
35
|
+
* The admin UI translates known keys via `pageDesigner.blockCategories.<key>`;
|
|
36
|
+
* unknown keys are shown as-is. Blocks without a category land in `"other"`.
|
|
37
|
+
*/
|
|
38
|
+
category?: string;
|
|
16
39
|
/** Static thumbnail image URL for the editor block picker. Overrides the default icon. */
|
|
17
40
|
thumbnail?: string;
|
|
18
41
|
/** Sort order in the editor block picker. Lower values appear first. Defaults to 100. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineBlock.d.ts","sourceRoot":"","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,K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M,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-
|
|
4
|
-
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-
|
|
3
|
+
const core = require("./core-fPjj9xyJ.cjs");
|
|
4
|
+
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-BNKK7Vhs.cjs");
|
|
5
5
|
const vue = require("vue");
|
|
6
6
|
const vueRouter = require("vue-router");
|
|
7
7
|
const pinia = require("pinia");
|
|
@@ -44,11 +44,17 @@ function useLocaleNav() {
|
|
|
44
44
|
const { locale, currentAlternates } = core.useLocale();
|
|
45
45
|
function switchLocale(targetLocale) {
|
|
46
46
|
if (!strategy) return;
|
|
47
|
-
const
|
|
48
|
-
|
|
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
|
-
|
|
54
|
+
const normalized = core.normalizeLink(slug) ?? slug;
|
|
55
|
+
if (!strategy) return normalized;
|
|
56
|
+
const loc = String(locale.value || "").slice(0, 2).toLowerCase();
|
|
57
|
+
return strategy.toPath(normalized, loc || void 0);
|
|
52
58
|
}
|
|
53
59
|
return { switchLocale, toPath, locale };
|
|
54
60
|
}
|
|
@@ -133,6 +139,7 @@ function createBloxApp(options) {
|
|
|
133
139
|
}
|
|
134
140
|
if (userSetup) userSetup(app);
|
|
135
141
|
router.isReady().then(() => {
|
|
142
|
+
core.installSmartLinks(router);
|
|
136
143
|
app.mount(mountTarget);
|
|
137
144
|
});
|
|
138
145
|
return { app, router, blox };
|
|
@@ -146,7 +153,11 @@ function defineBlock(meta) {
|
|
|
146
153
|
if (val !== void 0) extracted[key] = val;
|
|
147
154
|
}
|
|
148
155
|
if (Object.keys(extracted).length > 0) {
|
|
149
|
-
|
|
156
|
+
try {
|
|
157
|
+
meta.defaults = structuredClone(extracted);
|
|
158
|
+
} catch {
|
|
159
|
+
meta.defaults = JSON.parse(JSON.stringify(extracted));
|
|
160
|
+
}
|
|
150
161
|
}
|
|
151
162
|
}
|
|
152
163
|
return meta;
|
|
@@ -171,7 +182,8 @@ function definitionToEntry(type, def) {
|
|
|
171
182
|
label: schema.label,
|
|
172
183
|
icon: schema.icon,
|
|
173
184
|
description: schema.description,
|
|
174
|
-
dataSource: schema.dataSource,
|
|
185
|
+
dataSource: !!schema.dataSource,
|
|
186
|
+
category: schema.category,
|
|
175
187
|
order: schema.order,
|
|
176
188
|
propsSchema,
|
|
177
189
|
defaults: schema.defaults
|
|
@@ -194,13 +206,20 @@ exports.CmsPageView = core._sfc_main$1;
|
|
|
194
206
|
exports.GLOBAL_REF_KEY = core.GLOBAL_REF_KEY;
|
|
195
207
|
exports.GlobalBlockHost = core.GlobalBlockHost;
|
|
196
208
|
exports.PageRenderer = core.PageRenderer;
|
|
209
|
+
exports.classifyLink = core.classifyLink;
|
|
197
210
|
exports.configureApi = core.configureApi;
|
|
198
211
|
exports.createBlox = core.createBlox;
|
|
199
212
|
exports.getWebsiteId = core.getWebsiteId;
|
|
200
213
|
exports.getWebsiteIdSync = core.getWebsiteIdSync;
|
|
201
214
|
exports.globalRefOf = core.globalRefOf;
|
|
215
|
+
exports.installSmartLinks = core.installSmartLinks;
|
|
216
|
+
exports.isAbsoluteExternal = core.isAbsoluteExternal;
|
|
217
|
+
exports.isSpecialScheme = core.isSpecialScheme;
|
|
202
218
|
exports.listItems = core.listItems;
|
|
219
|
+
exports.normalizeLink = core.normalizeLink;
|
|
220
|
+
exports.normalizeTo = core.normalizeTo;
|
|
203
221
|
exports.resolvePath = core.resolvePath;
|
|
222
|
+
exports.toInternalPath = core.toInternalPath;
|
|
204
223
|
exports.useBloxEdit = core.useBloxEdit;
|
|
205
224
|
exports.useLocale = core.useLocale;
|
|
206
225
|
exports.PreviewApp = PreviewApp_vue_vue_type_style_index_0_lang._sfc_main;
|
package/dist/index.d.ts
CHANGED
|
@@ -12,12 +12,14 @@ export { useLocale } from './composables/useLocale';
|
|
|
12
12
|
export type { Locale } from './composables/useLocale';
|
|
13
13
|
export { useLocaleNav } from './composables/useLocaleNav';
|
|
14
14
|
export { usePageContext } from './composables/usePageContext';
|
|
15
|
+
export { classifyLink, installSmartLinks, isAbsoluteExternal, isSpecialScheme, normalizeLink, normalizeTo, toInternalPath, } from './smartLinks';
|
|
16
|
+
export type { LinkKind } from './smartLinks';
|
|
15
17
|
export { BloxInstance, createBlox } from './core';
|
|
16
18
|
export type { BloxComponent, BloxOptions } from './core';
|
|
17
19
|
export { createBloxApp, injectPlausible } from './createBloxApp';
|
|
18
20
|
export type { BloxAppResult, CreateBloxAppOptions, PlausibleOptions } from './createBloxApp';
|
|
19
21
|
export { defineBlock } from './defineBlock';
|
|
20
|
-
export type { BlockMeta, BlockModule } from './defineBlock';
|
|
22
|
+
export type { BlockMeta, BlockModule, BlockDataSource, BlockDataSourceConfig } from './defineBlock';
|
|
21
23
|
export type { LocaleStrategy } from './localeStrategy';
|
|
22
24
|
export { default as PageRenderer } from './PageRenderer';
|
|
23
25
|
export { default as PreviewApp } from './PreviewApp.vue';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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A;AACzD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
|
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-
|
|
2
|
-
import { _, b, d, e, f, h,
|
|
3
|
-
import { _ as _2, P as P2, s, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-
|
|
1
|
+
import { a as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, c as createBlox, i as installSmartLinks } from "./core-CbOrSpOU.js";
|
|
2
|
+
import { _, b, d, e, f, h, j, G, P, k, l, m, o, g, p, q, r, s, t, v, w } from "./core-CbOrSpOU.js";
|
|
3
|
+
import { _ as _2, P as P2, s as s2, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-C1SwhjdY.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,17 @@ function useLocaleNav() {
|
|
|
43
43
|
const { locale, currentAlternates } = useLocale();
|
|
44
44
|
function switchLocale(targetLocale) {
|
|
45
45
|
if (!strategy) return;
|
|
46
|
-
const
|
|
47
|
-
|
|
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
|
-
|
|
53
|
+
const normalized = normalizeLink(slug) ?? slug;
|
|
54
|
+
if (!strategy) return normalized;
|
|
55
|
+
const loc = String(locale.value || "").slice(0, 2).toLowerCase();
|
|
56
|
+
return strategy.toPath(normalized, loc || void 0);
|
|
51
57
|
}
|
|
52
58
|
return { switchLocale, toPath, locale };
|
|
53
59
|
}
|
|
@@ -113,16 +119,16 @@ function createBloxApp(options) {
|
|
|
113
119
|
};
|
|
114
120
|
const blox = createBlox(bloxOpts);
|
|
115
121
|
const pinia = createPinia();
|
|
116
|
-
pinia.use(({ store:
|
|
117
|
-
|
|
122
|
+
pinia.use(({ store: s3 }) => {
|
|
123
|
+
s3.router = markRaw(router);
|
|
118
124
|
});
|
|
119
125
|
blox.install(app, {});
|
|
120
126
|
app.use(pinia);
|
|
121
127
|
app.use(router);
|
|
122
128
|
for (const plugin of plugins) {
|
|
123
129
|
if (Array.isArray(plugin)) {
|
|
124
|
-
const [
|
|
125
|
-
app.use(
|
|
130
|
+
const [p2, ...args] = plugin;
|
|
131
|
+
app.use(p2, ...args);
|
|
126
132
|
} else {
|
|
127
133
|
app.use(plugin);
|
|
128
134
|
}
|
|
@@ -132,6 +138,7 @@ function createBloxApp(options) {
|
|
|
132
138
|
}
|
|
133
139
|
if (userSetup) userSetup(app);
|
|
134
140
|
router.isReady().then(() => {
|
|
141
|
+
installSmartLinks(router);
|
|
135
142
|
app.mount(mountTarget);
|
|
136
143
|
});
|
|
137
144
|
return { app, router, blox };
|
|
@@ -145,7 +152,11 @@ function defineBlock(meta) {
|
|
|
145
152
|
if (val !== void 0) extracted[key] = val;
|
|
146
153
|
}
|
|
147
154
|
if (Object.keys(extracted).length > 0) {
|
|
148
|
-
|
|
155
|
+
try {
|
|
156
|
+
meta.defaults = structuredClone(extracted);
|
|
157
|
+
} catch {
|
|
158
|
+
meta.defaults = JSON.parse(JSON.stringify(extracted));
|
|
159
|
+
}
|
|
149
160
|
}
|
|
150
161
|
}
|
|
151
162
|
return meta;
|
|
@@ -170,7 +181,8 @@ function definitionToEntry(type, def) {
|
|
|
170
181
|
label: schema.label,
|
|
171
182
|
icon: schema.icon,
|
|
172
183
|
description: schema.description,
|
|
173
|
-
dataSource: schema.dataSource,
|
|
184
|
+
dataSource: !!schema.dataSource,
|
|
185
|
+
category: schema.category,
|
|
174
186
|
order: schema.order,
|
|
175
187
|
propsSchema,
|
|
176
188
|
defaults: schema.defaults
|
|
@@ -191,26 +203,33 @@ export {
|
|
|
191
203
|
BLOX_LOCALE_STRATEGY_KEY,
|
|
192
204
|
f as BloxInstance,
|
|
193
205
|
h as CmsPageView,
|
|
194
|
-
|
|
206
|
+
j as GLOBAL_REF_KEY,
|
|
195
207
|
G as GlobalBlockHost,
|
|
196
208
|
P as PageRenderer,
|
|
197
209
|
_2 as PreviewApp,
|
|
198
210
|
P2 as PreviewRenderer,
|
|
199
211
|
buildBloxManifest,
|
|
200
|
-
|
|
212
|
+
k as classifyLink,
|
|
213
|
+
l as configureApi,
|
|
201
214
|
createBlox,
|
|
202
215
|
createBloxApp,
|
|
203
216
|
defineBlock,
|
|
204
|
-
|
|
205
|
-
|
|
217
|
+
m as getWebsiteId,
|
|
218
|
+
o as getWebsiteIdSync,
|
|
206
219
|
g as globalRefOf,
|
|
207
220
|
injectPlausible,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
221
|
+
installSmartLinks,
|
|
222
|
+
p as isAbsoluteExternal,
|
|
223
|
+
q as isSpecialScheme,
|
|
224
|
+
r as listItems,
|
|
225
|
+
normalizeLink,
|
|
226
|
+
s as normalizeTo,
|
|
227
|
+
t as resolvePath,
|
|
228
|
+
s2 as sendToEditor,
|
|
211
229
|
a as sendToPreview,
|
|
212
230
|
serializeRegistry,
|
|
213
|
-
|
|
231
|
+
v as toInternalPath,
|
|
232
|
+
w as useBloxEdit,
|
|
214
233
|
useGlobalBlock,
|
|
215
234
|
useLocale,
|
|
216
235
|
useLocaleNav,
|