@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CmsPageView.vue.d.ts","sourceRoot":"","sources":["../src/CmsPageView.vue"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"CmsPageView.vue.d.ts","sourceRoot":"","sources":["../src/CmsPageView.vue"],"names":[],"mappings":";AAodA,wBAMG"}
|
|
@@ -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-
|
|
3
|
+
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-BNKK7Vhs.cjs");
|
|
4
4
|
exports.default = PreviewApp_vue_vue_type_style_index_0_lang._sfc_main;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewApp.vue.d.ts","sourceRoot":"","sources":["../src/PreviewApp.vue"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"PreviewApp.vue.d.ts","sourceRoot":"","sources":["../src/PreviewApp.vue"],"names":[],"mappings":";AAqSA,wBAMG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const vue = require("vue");
|
|
3
|
-
const core = require("./core-
|
|
3
|
+
const core = require("./core-fPjj9xyJ.cjs");
|
|
4
4
|
function sendToEditor(msg) {
|
|
5
5
|
window.parent.postMessage(msg, "*");
|
|
6
6
|
}
|
|
@@ -173,7 +173,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
173
173
|
if (msg.index !== null) {
|
|
174
174
|
vue.nextTick(() => {
|
|
175
175
|
const el = document.querySelector(`[data-blox-index="${msg.index}"]`);
|
|
176
|
-
|
|
176
|
+
if (!el) return;
|
|
177
|
+
const OFFSET = 72;
|
|
178
|
+
const top = el.getBoundingClientRect().top + window.scrollY - OFFSET;
|
|
179
|
+
window.scrollTo({ top: Math.max(0, top), behavior: "smooth" });
|
|
177
180
|
});
|
|
178
181
|
}
|
|
179
182
|
break;
|
|
@@ -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-
|
|
2
|
+
import { B as BLOX_REGISTRY_KEY, g as globalRefOf, G as GlobalBlockHost, u as useLocale } from "./core-CbOrSpOU.js";
|
|
3
3
|
function sendToEditor(msg) {
|
|
4
4
|
window.parent.postMessage(msg, "*");
|
|
5
5
|
}
|
|
@@ -172,7 +172,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
172
172
|
if (msg.index !== null) {
|
|
173
173
|
nextTick(() => {
|
|
174
174
|
const el = document.querySelector(`[data-blox-index="${msg.index}"]`);
|
|
175
|
-
|
|
175
|
+
if (!el) return;
|
|
176
|
+
const OFFSET = 72;
|
|
177
|
+
const top = el.getBoundingClientRect().top + window.scrollY - OFFSET;
|
|
178
|
+
window.scrollTo({ top: Math.max(0, top), behavior: "smooth" });
|
|
176
179
|
});
|
|
177
180
|
}
|
|
178
181
|
break;
|
package/dist/bridge.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { SchemaDefinition } from '@bagelink/vue';
|
|
2
2
|
import { Block, PageResolveRead } from './api/types';
|
|
3
|
+
import { BlockDataSourceConfig } from './defineBlock';
|
|
3
4
|
export interface BlockSchemaInfo {
|
|
4
5
|
label: string;
|
|
5
6
|
description?: string;
|
|
6
7
|
icon?: string;
|
|
7
8
|
fields?: SchemaDefinition;
|
|
8
9
|
defaults?: Record<string, unknown>;
|
|
9
|
-
dataSource?:
|
|
10
|
+
dataSource?: BlockDataSourceConfig;
|
|
11
|
+
/** Group key for the editor block picker. See {@link BlockMeta.category}. */
|
|
12
|
+
category?: string;
|
|
10
13
|
thumbnail?: string;
|
|
11
14
|
order?: number;
|
|
12
15
|
}
|
package/dist/bridge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAE1D,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,gBAAgB,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC,UAAU,CAAC,EAAE,qBAAqB,CAAA;IAClC,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAMD,MAAM,MAAM,aAAa,GACpB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,MAAM,EAAE,KAAK,EAAE,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE;AAC7B;;;;GAIG;GACD;IAAE,IAAI,EAAE,wBAAwB,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE;AACrD;;;;;GAKG;GACD;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAMnD,MAAM,MAAM,cAAc,GACrB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CAAE,GAClE;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE;AACpD;;;;;GAKG;GACD;IAAE,IAAI,EAAE,wBAAwB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GACvE;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAM3C,wBAAgB,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,CAEtD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,iBAAiB,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAEjF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocaleRouterLink.vue.d.ts","sourceRoot":"","sources":["../../src/components/LocaleRouterLink.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LocaleRouterLink.vue.d.ts","sourceRoot":"","sources":["../../src/components/LocaleRouterLink.vue"],"names":[],"mappings":"AAuEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AASlD,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;AA+BF,iBAAS,cAAc;WAqDT,OAAO,IAA6B;;yBAZrB,GAAG;yBACH,GAAG;yBACH,GAAG;;;;EAe/B;AAWD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,kSAMnB,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`
|
|
6
|
-
*
|
|
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":"
|
|
1
|
+
{"version":3,"file":"useLocaleNav.d.ts","sourceRoot":"","sources":["../../src/composables/useLocaleNav.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,wBAAgB,YAAY;iCAKS,MAAM;mBAkBpB,MAAM,KAAG,MAAM;;EAQrC"}
|
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { BLOX_WEBSITE_ID_WINDOW_KEY, BLOX_STATE_WINDOW_KEY } from "./ssg/client.mjs";
|
|
5
|
-
import { inject, computed, ref, defineComponent, onMounted, unref, openBlock, createBlock, Teleport, createElementBlock, createElementVNode, createCommentVNode, onUnmounted, watch, h, provide, resolveComponent, createVNode, toDisplayString, withCtx, createTextVNode, Fragment,
|
|
5
|
+
import { inject, computed, ref, defineComponent, onMounted, unref, openBlock, createBlock, Teleport, createElementBlock, createElementVNode, createCommentVNode, onUnmounted, watch, h, provide, resolveComponent, createVNode, toDisplayString, withCtx, createTextVNode, Fragment, useAttrs, mergeProps, renderSlot, normalizeProps } from "vue";
|
|
6
6
|
import { useRoute, useRouter, RouterLink } from "vue-router";
|
|
7
7
|
import { getI18n, Loading } from "@bagelink/vue";
|
|
8
8
|
const BASE = "/api";
|
|
@@ -115,7 +115,7 @@ function useBloxEdit(configOverride) {
|
|
|
115
115
|
}
|
|
116
116
|
return { config, enabled, showEdit, studioBaseUrl, editUrl, enable, dismiss, init };
|
|
117
117
|
}
|
|
118
|
-
const _hoisted_1$
|
|
118
|
+
const _hoisted_1$2 = {
|
|
119
119
|
key: 0,
|
|
120
120
|
class: "blox-admin-bar"
|
|
121
121
|
};
|
|
@@ -138,7 +138,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
138
138
|
key: 0,
|
|
139
139
|
to: "body"
|
|
140
140
|
}, [
|
|
141
|
-
unref(showEdit) && __props.websiteId && __props.pageId ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
141
|
+
unref(showEdit) && __props.websiteId && __props.pageId ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
142
142
|
createElementVNode("button", {
|
|
143
143
|
type: "button",
|
|
144
144
|
class: "blox-admin-btn",
|
|
@@ -283,11 +283,11 @@ const PageRenderer = defineComponent({
|
|
|
283
283
|
);
|
|
284
284
|
}
|
|
285
285
|
});
|
|
286
|
-
const _hoisted_1 = {
|
|
286
|
+
const _hoisted_1$1 = {
|
|
287
287
|
key: 0,
|
|
288
288
|
class: "blox-loading flex column h-100vh justify-content-center"
|
|
289
289
|
};
|
|
290
|
-
const _hoisted_2 = {
|
|
290
|
+
const _hoisted_2$1 = {
|
|
291
291
|
key: 1,
|
|
292
292
|
class: "blox-not-found"
|
|
293
293
|
};
|
|
@@ -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;
|
|
@@ -394,9 +399,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
394
399
|
return (_ctx, _cache) => {
|
|
395
400
|
const _component_RouterLink = resolveComponent("RouterLink");
|
|
396
401
|
return openBlock(), createElementBlock("div", null, [
|
|
397
|
-
initialLoading.value && blocks.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
402
|
+
initialLoading.value && blocks.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
398
403
|
createVNode(unref(Loading))
|
|
399
|
-
])) : notFound.value ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
404
|
+
])) : notFound.value ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
|
|
400
405
|
_cache[0] || (_cache[0] = createElementVNode("h2", null, "404", -1)),
|
|
401
406
|
createElementVNode("p", null, toDisplayString(unref(locale2) === "he" ? "הדף לא נמצא" : "Page not found"), 1),
|
|
402
407
|
createVNode(_component_RouterLink, { to: "/" }, {
|
|
@@ -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
|
-
(
|
|
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,
|
|
@@ -421,7 +423,96 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
421
423
|
};
|
|
422
424
|
}
|
|
423
425
|
});
|
|
426
|
+
function normalizeLink(href) {
|
|
427
|
+
const v = href == null ? void 0 : href.trim();
|
|
428
|
+
if (!v) return void 0;
|
|
429
|
+
if (/^(https?:|mailto:|tel:|sms:|whatsapp:|geo:|#|\/\/|\/|\.)/i.test(v)) return v;
|
|
430
|
+
return `/${v}`;
|
|
431
|
+
}
|
|
432
|
+
const normalizeTo = normalizeLink;
|
|
433
|
+
function isAbsoluteExternal(href) {
|
|
434
|
+
return /^(https?:)?\/\//i.test(href);
|
|
435
|
+
}
|
|
436
|
+
function isSpecialScheme(href) {
|
|
437
|
+
return /^(mailto:|tel:|sms:|whatsapp:|geo:|#)/i.test(href);
|
|
438
|
+
}
|
|
439
|
+
function classifyLink(href, origin = typeof window !== "undefined" ? window.location.origin : "") {
|
|
440
|
+
if (isSpecialScheme(href)) return "special";
|
|
441
|
+
if (isAbsoluteExternal(href)) {
|
|
442
|
+
if (origin) {
|
|
443
|
+
try {
|
|
444
|
+
if (new URL(href, origin).origin === origin) return "internal";
|
|
445
|
+
} catch {
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return "external";
|
|
449
|
+
}
|
|
450
|
+
return "internal";
|
|
451
|
+
}
|
|
452
|
+
function toInternalPath(href) {
|
|
453
|
+
const normalized = normalizeLink(href) ?? href.trim();
|
|
454
|
+
if (isAbsoluteExternal(normalized)) {
|
|
455
|
+
try {
|
|
456
|
+
const base = typeof window !== "undefined" ? window.location.href : "http://localhost";
|
|
457
|
+
const url = new URL(normalized, base);
|
|
458
|
+
return `${url.pathname}${url.search}${url.hash}` || "/";
|
|
459
|
+
} catch {
|
|
460
|
+
return normalized;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return normalized || "/";
|
|
464
|
+
}
|
|
465
|
+
function shouldIgnore(e, anchor) {
|
|
466
|
+
if (e.defaultPrevented) return true;
|
|
467
|
+
if (e.button !== 0) return true;
|
|
468
|
+
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return true;
|
|
469
|
+
if (anchor.hasAttribute("download")) return true;
|
|
470
|
+
const target = anchor.getAttribute("target");
|
|
471
|
+
if (target && target !== "_self") return true;
|
|
472
|
+
return false;
|
|
473
|
+
}
|
|
474
|
+
function installSmartLinks(router) {
|
|
475
|
+
if (typeof document === "undefined") return () => {
|
|
476
|
+
};
|
|
477
|
+
function onClick(e) {
|
|
478
|
+
var _a, _b, _c;
|
|
479
|
+
const path = ((_a = e.composedPath) == null ? void 0 : _a.call(e)) ?? [];
|
|
480
|
+
const anchor = path.find((el) => el instanceof HTMLAnchorElement) ?? ((_c = (_b = e.target) == null ? void 0 : _b.closest) == null ? void 0 : _c.call(_b, "a"));
|
|
481
|
+
if (!anchor) return;
|
|
482
|
+
const rawHref = anchor.getAttribute("href");
|
|
483
|
+
if (!rawHref) return;
|
|
484
|
+
const href = normalizeLink(rawHref) ?? rawHref.trim();
|
|
485
|
+
if (!href) return;
|
|
486
|
+
if (isSpecialScheme(href)) return;
|
|
487
|
+
if (isAbsoluteExternal(href)) {
|
|
488
|
+
let sameOrigin = false;
|
|
489
|
+
try {
|
|
490
|
+
sameOrigin = new URL(href, window.location.href).origin === window.location.origin;
|
|
491
|
+
} catch {
|
|
492
|
+
sameOrigin = false;
|
|
493
|
+
}
|
|
494
|
+
if (!sameOrigin) {
|
|
495
|
+
if (anchor.getAttribute("target")) return;
|
|
496
|
+
e.preventDefault();
|
|
497
|
+
window.open(href, "_blank", "noopener,noreferrer");
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
if (shouldIgnore(e, anchor)) return;
|
|
501
|
+
e.preventDefault();
|
|
502
|
+
void router.push(toInternalPath(href));
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
if (shouldIgnore(e, anchor)) return;
|
|
506
|
+
e.preventDefault();
|
|
507
|
+
void router.push(href.startsWith("/") ? href : `/${href}`);
|
|
508
|
+
}
|
|
509
|
+
document.addEventListener("click", onClick);
|
|
510
|
+
return () => document.removeEventListener("click", onClick);
|
|
511
|
+
}
|
|
512
|
+
const _hoisted_1 = ["href"];
|
|
513
|
+
const _hoisted_2 = ["href"];
|
|
424
514
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
515
|
+
...{ inheritAttrs: false },
|
|
425
516
|
__name: "LocaleRouterLink",
|
|
426
517
|
props: {
|
|
427
518
|
to: {},
|
|
@@ -432,18 +523,39 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
432
523
|
},
|
|
433
524
|
setup(__props) {
|
|
434
525
|
const props = __props;
|
|
526
|
+
const attrs = useAttrs();
|
|
435
527
|
const strategy = inject(BLOX_LOCALE_STRATEGY_KEY, null);
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
|
|
528
|
+
const { locale: locale2 } = useLocale();
|
|
529
|
+
const resolved = computed(() => {
|
|
530
|
+
if (typeof props.to !== "string") {
|
|
531
|
+
return { kind: "route", to: props.to };
|
|
532
|
+
}
|
|
533
|
+
const href = normalizeLink(props.to) ?? props.to.trim();
|
|
534
|
+
const kind = classifyLink(href);
|
|
535
|
+
if (kind === "external") return { kind: "external", href };
|
|
536
|
+
if (kind === "special") return { kind: "special", href };
|
|
537
|
+
const path = toInternalPath(href);
|
|
538
|
+
const loc = String(locale2.value || "").slice(0, 2).toLowerCase();
|
|
539
|
+
const to = strategy ? strategy.toPath(path, loc || void 0) : path;
|
|
540
|
+
return { kind: "route", to };
|
|
439
541
|
});
|
|
440
542
|
return (_ctx, _cache) => {
|
|
441
|
-
return openBlock(),
|
|
543
|
+
return resolved.value.kind === "external" ? (openBlock(), createElementBlock("a", mergeProps({ key: 0 }, unref(attrs), {
|
|
544
|
+
href: resolved.value.href,
|
|
545
|
+
target: "_blank",
|
|
546
|
+
rel: "noopener noreferrer"
|
|
547
|
+
}), [
|
|
548
|
+
renderSlot(_ctx.$slots, "default")
|
|
549
|
+
], 16, _hoisted_1)) : resolved.value.kind === "special" ? (openBlock(), createElementBlock("a", mergeProps({ key: 1 }, unref(attrs), {
|
|
550
|
+
href: resolved.value.href
|
|
551
|
+
}), [
|
|
552
|
+
renderSlot(_ctx.$slots, "default")
|
|
553
|
+
], 16, _hoisted_2)) : (openBlock(), createBlock(unref(RouterLink), normalizeProps(mergeProps({ key: 2 }, { ...props, ...unref(attrs), to: resolved.value.to })), {
|
|
442
554
|
default: withCtx(() => [
|
|
443
555
|
renderSlot(_ctx.$slots, "default")
|
|
444
556
|
]),
|
|
445
557
|
_: 3
|
|
446
|
-
}, 16);
|
|
558
|
+
}, 16));
|
|
447
559
|
};
|
|
448
560
|
}
|
|
449
561
|
});
|
|
@@ -454,6 +566,9 @@ function createPathStrategy(options) {
|
|
|
454
566
|
get locales() {
|
|
455
567
|
return supportedLocales;
|
|
456
568
|
},
|
|
569
|
+
get defaultLocale() {
|
|
570
|
+
return defaultLocale;
|
|
571
|
+
},
|
|
457
572
|
get currentLocale() {
|
|
458
573
|
return _currentLocale;
|
|
459
574
|
},
|
|
@@ -462,22 +577,41 @@ function createPathStrategy(options) {
|
|
|
462
577
|
const first = segments[0];
|
|
463
578
|
if (supportedLocales.includes(first)) {
|
|
464
579
|
_currentLocale = first;
|
|
580
|
+
const rest = segments.slice(1).join("/");
|
|
465
581
|
return {
|
|
466
582
|
locale: first,
|
|
467
|
-
slug: `/${
|
|
583
|
+
slug: rest ? `/${rest}` : "/"
|
|
468
584
|
};
|
|
469
585
|
}
|
|
470
586
|
_currentLocale = defaultLocale;
|
|
471
587
|
return { locale: defaultLocale, slug: path || "/" };
|
|
472
588
|
},
|
|
473
|
-
toPath(slug) {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
589
|
+
toPath(slug, locale2) {
|
|
590
|
+
const loc = locale2 || _currentLocale;
|
|
591
|
+
let s = slug || "/";
|
|
592
|
+
if (s && !s.startsWith("/") && !/^(https?:|mailto:|tel:|sms:|whatsapp:|geo:|#|\/\/)/i.test(s)) {
|
|
593
|
+
s = `/${s}`;
|
|
594
|
+
}
|
|
595
|
+
const segments = s.replace(/^\//, "").split("/").filter(Boolean);
|
|
596
|
+
if (segments[0] && supportedLocales.includes(segments[0])) {
|
|
597
|
+
const rest = segments.slice(1).join("/");
|
|
598
|
+
s = rest ? `/${rest}` : "/";
|
|
599
|
+
}
|
|
600
|
+
if (loc === defaultLocale) return s;
|
|
601
|
+
return s === "/" ? `/${loc}` : `/${loc}${s}`;
|
|
477
602
|
},
|
|
478
603
|
switchTo(locale2, slug, router) {
|
|
604
|
+
_currentLocale = locale2;
|
|
479
605
|
const s = slug || "/";
|
|
480
|
-
const
|
|
606
|
+
const bare = (() => {
|
|
607
|
+
const segments = s.replace(/^\//, "").split("/").filter(Boolean);
|
|
608
|
+
if (segments[0] && supportedLocales.includes(segments[0])) {
|
|
609
|
+
const rest = segments.slice(1).join("/");
|
|
610
|
+
return rest ? `/${rest}` : "/";
|
|
611
|
+
}
|
|
612
|
+
return s;
|
|
613
|
+
})();
|
|
614
|
+
const target = locale2 === defaultLocale ? bare : bare === "/" ? `/${locale2}` : `/${locale2}${bare}`;
|
|
481
615
|
router.push(target);
|
|
482
616
|
}
|
|
483
617
|
};
|
|
@@ -485,11 +619,15 @@ function createPathStrategy(options) {
|
|
|
485
619
|
function createDomainStrategy(options) {
|
|
486
620
|
const { localeDomains } = options;
|
|
487
621
|
const locales = Object.keys(localeDomains);
|
|
488
|
-
const
|
|
622
|
+
const _defaultLocale = locales[0] ?? "en";
|
|
623
|
+
const _currentLocale = locales.find((l) => localeDomains[l] === window.location.hostname) ?? _defaultLocale;
|
|
489
624
|
return {
|
|
490
625
|
get locales() {
|
|
491
626
|
return locales;
|
|
492
627
|
},
|
|
628
|
+
get defaultLocale() {
|
|
629
|
+
return _defaultLocale;
|
|
630
|
+
},
|
|
493
631
|
get currentLocale() {
|
|
494
632
|
return _currentLocale;
|
|
495
633
|
},
|
|
@@ -563,6 +701,7 @@ class BloxInstance {
|
|
|
563
701
|
fields: meta.schema,
|
|
564
702
|
defaults: meta.defaults,
|
|
565
703
|
dataSource: meta.dataSource,
|
|
704
|
+
category: meta.category,
|
|
566
705
|
thumbnail: meta.thumbnail,
|
|
567
706
|
order: meta.order
|
|
568
707
|
}
|
|
@@ -590,6 +729,7 @@ class BloxInstance {
|
|
|
590
729
|
fields: meta.schema,
|
|
591
730
|
defaults: meta.defaults,
|
|
592
731
|
dataSource: meta.dataSource,
|
|
732
|
+
category: meta.category,
|
|
593
733
|
thumbnail: meta.thumbnail,
|
|
594
734
|
order: meta.order
|
|
595
735
|
}
|
|
@@ -616,7 +756,7 @@ class BloxInstance {
|
|
|
616
756
|
}
|
|
617
757
|
router.addRoute({
|
|
618
758
|
path: "/_blox_preview",
|
|
619
|
-
component: () => import("./PreviewApp-
|
|
759
|
+
component: () => import("./PreviewApp-CsC6qej1.js"),
|
|
620
760
|
beforeEnter: () => window.parent !== window ? true : "/"
|
|
621
761
|
});
|
|
622
762
|
router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$1 });
|
|
@@ -650,7 +790,7 @@ class BloxInstance {
|
|
|
650
790
|
app.provide(BLOX_CONFIG_KEY, this._config);
|
|
651
791
|
app.provide(BLOX_LOCALE_STRATEGY_KEY, this._strategy);
|
|
652
792
|
if (this._adminEdit) app.provide(BLOX_ADMIN_CONFIG_KEY, this._adminEdit);
|
|
653
|
-
app.
|
|
793
|
+
app._context.components.RouterLink = _sfc_main;
|
|
654
794
|
}
|
|
655
795
|
}
|
|
656
796
|
function isBlockDefinition(value) {
|
|
@@ -679,12 +819,19 @@ export {
|
|
|
679
819
|
BloxInstance as f,
|
|
680
820
|
globalRefOf as g,
|
|
681
821
|
_sfc_main$1 as h,
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
822
|
+
installSmartLinks as i,
|
|
823
|
+
GLOBAL_REF_KEY as j,
|
|
824
|
+
classifyLink as k,
|
|
825
|
+
configureApi as l,
|
|
826
|
+
getWebsiteId as m,
|
|
827
|
+
normalizeLink as n,
|
|
828
|
+
getWebsiteIdSync as o,
|
|
829
|
+
isAbsoluteExternal as p,
|
|
830
|
+
isSpecialScheme as q,
|
|
831
|
+
listItems as r,
|
|
832
|
+
normalizeTo as s,
|
|
833
|
+
resolvePath as t,
|
|
834
|
+
useLocale as u,
|
|
835
|
+
toInternalPath as v,
|
|
836
|
+
useBloxEdit as w
|
|
690
837
|
};
|