@bagelink/blox 1.18.3 → 1.18.7
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/{PreviewApp-BKrLRDBC.js → PreviewApp-9H9-jLVN.js} +1 -1
- package/dist/{PreviewApp-Kb3uTwtH.cjs → PreviewApp-D8ZBTG0j.cjs} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-AC3W0NSJ.cjs → PreviewApp.vue_vue_type_style_index_0_lang-BYCayJs0.cjs} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-BMGv1eSR.js → PreviewApp.vue_vue_type_style_index_0_lang-BwiLyRBw.js} +1 -1
- package/dist/{appRuntime-CWlPH_5r.js → appRuntime-DZSCSsnS.js} +39 -156
- package/dist/{appRuntime-BU2Ls-Y7.cjs → appRuntime-Z0AxTPxf.cjs} +17 -134
- package/dist/composables/useLocale.d.ts +3 -0
- package/dist/composables/useLocale.d.ts.map +1 -1
- package/dist/composables/useLocaleNav.d.ts.map +1 -1
- package/dist/createBloxApp.d.ts.map +1 -1
- package/dist/hydration.d.ts +2 -0
- package/dist/hydration.d.ts.map +1 -1
- package/dist/index.cjs +16 -9
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +44 -36
- package/dist/localeStrategy-OwRIn35C.cjs +207 -0
- package/dist/localeStrategy-hXlNof1E.js +208 -0
- package/dist/localeStrategy.d.ts +21 -0
- package/dist/localeStrategy.d.ts.map +1 -1
- package/dist/{shard-runner-zmTY7v3n.cjs → shard-runner-Bz46UqN8.cjs} +16 -7
- package/dist/{shard-runner-yZNy6pQy.js → shard-runner-CoFcUVGe.js} +17 -8
- package/dist/ssg/cli.cjs +10 -2
- package/dist/ssg/cli.mjs +10 -2
- package/dist/ssg/cms-routes.d.ts +7 -0
- package/dist/ssg/cms-routes.d.ts.map +1 -1
- package/dist/ssg/index.cjs +4 -2
- package/dist/ssg/index.mjs +19 -17
- package/dist/ssg/prerender.d.ts +5 -1
- package/dist/ssg/prerender.d.ts.map +1 -1
- package/dist/ssg/render-resolved-page.d.ts +2 -0
- package/dist/ssg/render-resolved-page.d.ts.map +1 -1
- package/dist/ssg/shard-runner.d.ts +3 -0
- package/dist/ssg/shard-runner.d.ts.map +1 -1
- package/dist/ssg/validate-output.d.ts +9 -0
- package/dist/ssg/validate-output.d.ts.map +1 -1
- package/dist/{validate-output-3fNPagvj.js → validate-output-B8pmE7hf.js} +115 -28
- package/dist/{validate-output-CrhXrC1l.cjs → validate-output-CbIQrCwa.cjs} +99 -12
- package/package.json +125 -124
- package/LICENSE +0 -21
- package/dist/pageTitle-B1mtDJKn.js +0 -59
- package/dist/pageTitle-wobGhtiZ.cjs +0 -58
|
@@ -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-BYCayJs0.cjs");
|
|
4
4
|
exports.default = PreviewApp_vue_vue_type_style_index_0_lang._sfc_main;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, inject, ref, h, provide, onMounted, onUnmounted, openBlock, createElementBlock, createVNode, unref, nextTick } from "vue";
|
|
2
|
-
import { d as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, e as BLOX_RUNTIME_KEY } from "./appRuntime-
|
|
2
|
+
import { d as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, e as BLOX_RUNTIME_KEY } from "./appRuntime-DZSCSsnS.js";
|
|
3
3
|
function sendToEditor(msg) {
|
|
4
4
|
window.parent.postMessage(cloneForPostMessage(msg), "*");
|
|
5
5
|
}
|
|
@@ -6,7 +6,7 @@ import { inject, computed, ref, defineComponent, onMounted, unref, openBlock, cr
|
|
|
6
6
|
import { useBloxApi, getWebsiteIdSync, getWebsiteId, resolvePath, configureApi, listItemsFromActiveApi, getItemBySlug, getItemById } from "./index-I81QTzv-.js";
|
|
7
7
|
import { useRoute, useRouter } from "vue-router";
|
|
8
8
|
import { getI18n } from "@bagelink/vue";
|
|
9
|
-
import { r as resolvePageTitle,
|
|
9
|
+
import { r as resolvePageTitle, b as siteNameFromContexts, d as preserveCurrentSiteSuffix, e as createLocaleStrategy } from "./localeStrategy-hXlNof1E.js";
|
|
10
10
|
import { r as readBloxHydration } from "./client-Ce9fRCGH.js";
|
|
11
11
|
const BLOX_REGISTRY_KEY = Symbol("blox:registry");
|
|
12
12
|
const BLOX_CONFIG_KEY = Symbol("blox:config");
|
|
@@ -110,11 +110,13 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
110
110
|
const _hasStorage = typeof localStorage !== "undefined";
|
|
111
111
|
const locale = ref((_hasStorage ? localStorage.getItem("blox:locale") : null) || "en");
|
|
112
112
|
const currentAlternates = ref({});
|
|
113
|
+
const currentLocaleFallbacks = ref({});
|
|
113
114
|
const BLOX_LOCALE_KEY = Symbol("blox:locale");
|
|
114
115
|
function provideBloxLocale(app, initialLocale) {
|
|
115
116
|
const state = {
|
|
116
117
|
locale: ref(initialLocale),
|
|
117
|
-
currentAlternates: ref({})
|
|
118
|
+
currentAlternates: ref({}),
|
|
119
|
+
currentLocaleFallbacks: ref({})
|
|
118
120
|
};
|
|
119
121
|
app.provide(BLOX_LOCALE_KEY, state);
|
|
120
122
|
return state;
|
|
@@ -124,7 +126,7 @@ function localeState() {
|
|
|
124
126
|
const state = inject(BLOX_LOCALE_KEY, null);
|
|
125
127
|
if (state) return state;
|
|
126
128
|
}
|
|
127
|
-
return { locale, currentAlternates };
|
|
129
|
+
return { locale, currentAlternates, currentLocaleFallbacks };
|
|
128
130
|
}
|
|
129
131
|
function setActiveLocale(l, state = localeState()) {
|
|
130
132
|
state.locale.value = l;
|
|
@@ -153,12 +155,17 @@ function useLocale() {
|
|
|
153
155
|
function setAlternates(alternates) {
|
|
154
156
|
state.currentAlternates.value = alternates;
|
|
155
157
|
}
|
|
158
|
+
function setLocaleFallbacks(fallbacks) {
|
|
159
|
+
state.currentLocaleFallbacks.value = fallbacks;
|
|
160
|
+
}
|
|
156
161
|
return {
|
|
157
162
|
locale: state.locale,
|
|
158
163
|
dir,
|
|
159
164
|
setLocale,
|
|
160
165
|
currentAlternates: state.currentAlternates,
|
|
161
|
-
setAlternates
|
|
166
|
+
setAlternates,
|
|
167
|
+
currentLocaleFallbacks: state.currentLocaleFallbacks,
|
|
168
|
+
setLocaleFallbacks
|
|
162
169
|
};
|
|
163
170
|
}
|
|
164
171
|
function pathExcluded(path, patterns) {
|
|
@@ -683,129 +690,6 @@ function installSmartLinks(router) {
|
|
|
683
690
|
document.addEventListener("click", onClick);
|
|
684
691
|
return () => document.removeEventListener("click", onClick);
|
|
685
692
|
}
|
|
686
|
-
let _pendingLocaleSwitch = null;
|
|
687
|
-
function consumePendingLocaleSwitch() {
|
|
688
|
-
const next = _pendingLocaleSwitch;
|
|
689
|
-
_pendingLocaleSwitch = null;
|
|
690
|
-
return next;
|
|
691
|
-
}
|
|
692
|
-
function markLocaleSwitch(locale2) {
|
|
693
|
-
_pendingLocaleSwitch = locale2;
|
|
694
|
-
}
|
|
695
|
-
function createPathStrategy(options) {
|
|
696
|
-
const { defaultLocale, supportedLocales } = options;
|
|
697
|
-
let _currentLocale = defaultLocale;
|
|
698
|
-
return {
|
|
699
|
-
get locales() {
|
|
700
|
-
return supportedLocales;
|
|
701
|
-
},
|
|
702
|
-
get defaultLocale() {
|
|
703
|
-
return defaultLocale;
|
|
704
|
-
},
|
|
705
|
-
get currentLocale() {
|
|
706
|
-
return _currentLocale;
|
|
707
|
-
},
|
|
708
|
-
detect(_hostname, path) {
|
|
709
|
-
const segments = path.replace(/^\//, "").split("/");
|
|
710
|
-
const first = segments[0];
|
|
711
|
-
if (supportedLocales.includes(first)) {
|
|
712
|
-
_currentLocale = first;
|
|
713
|
-
const rest = segments.slice(1).join("/");
|
|
714
|
-
return {
|
|
715
|
-
locale: first,
|
|
716
|
-
slug: rest ? `/${rest}` : "/"
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
_currentLocale = defaultLocale;
|
|
720
|
-
return { locale: defaultLocale, slug: path || "/" };
|
|
721
|
-
},
|
|
722
|
-
toPath(slug, locale2) {
|
|
723
|
-
const loc = locale2 || _currentLocale;
|
|
724
|
-
let s = slug ? slug.startsWith("/") ? slug : `/${slug}` : "/";
|
|
725
|
-
const segments = s.replace(/^\//, "").split("/").filter(Boolean);
|
|
726
|
-
if (segments[0] && supportedLocales.includes(segments[0])) {
|
|
727
|
-
const rest = segments.slice(1).join("/");
|
|
728
|
-
s = rest ? `/${rest}` : "/";
|
|
729
|
-
}
|
|
730
|
-
if (loc === defaultLocale) return s;
|
|
731
|
-
return s === "/" ? `/${loc}` : `/${loc}${s}`;
|
|
732
|
-
},
|
|
733
|
-
switchTo(locale2, slug, router) {
|
|
734
|
-
_currentLocale = locale2;
|
|
735
|
-
const s = slug || "/";
|
|
736
|
-
const bare = (() => {
|
|
737
|
-
const segments = s.replace(/^\//, "").split("/").filter(Boolean);
|
|
738
|
-
if (segments[0] && supportedLocales.includes(segments[0])) {
|
|
739
|
-
const rest = segments.slice(1).join("/");
|
|
740
|
-
return rest ? `/${rest}` : "/";
|
|
741
|
-
}
|
|
742
|
-
return s;
|
|
743
|
-
})();
|
|
744
|
-
const target = locale2 === defaultLocale ? bare : bare === "/" ? `/${locale2}` : `/${locale2}${bare}`;
|
|
745
|
-
markLocaleSwitch(locale2);
|
|
746
|
-
router.push(target);
|
|
747
|
-
},
|
|
748
|
-
normalize(path, intendedLocale) {
|
|
749
|
-
const p = path || "/";
|
|
750
|
-
const [pathname, ...restQ] = p.split(/(?=[?#])/);
|
|
751
|
-
const suffix = restQ.join("");
|
|
752
|
-
const segments = (pathname || "/").replace(/^\//, "").split("/").filter(Boolean);
|
|
753
|
-
const first = segments[0];
|
|
754
|
-
if (first && supportedLocales.includes(first)) return null;
|
|
755
|
-
if (intendedLocale === defaultLocale) return null;
|
|
756
|
-
const bare = segments.length ? `/${segments.join("/")}` : "/";
|
|
757
|
-
const rebuilt = bare === "/" ? `/${intendedLocale}` : `/${intendedLocale}${bare}`;
|
|
758
|
-
return `${rebuilt}${suffix}`;
|
|
759
|
-
}
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
function createDomainStrategy(options) {
|
|
763
|
-
const { localeDomains } = options;
|
|
764
|
-
const locales = Object.keys(localeDomains);
|
|
765
|
-
const _defaultLocale = locales[0] ?? "en";
|
|
766
|
-
const _currentLocale = locales.find((l) => localeDomains[l] === window.location.hostname) ?? _defaultLocale;
|
|
767
|
-
return {
|
|
768
|
-
get locales() {
|
|
769
|
-
return locales;
|
|
770
|
-
},
|
|
771
|
-
get defaultLocale() {
|
|
772
|
-
return _defaultLocale;
|
|
773
|
-
},
|
|
774
|
-
get currentLocale() {
|
|
775
|
-
return _currentLocale;
|
|
776
|
-
},
|
|
777
|
-
detect(_hostname, path) {
|
|
778
|
-
return { locale: _currentLocale, slug: path || "/" };
|
|
779
|
-
},
|
|
780
|
-
toPath(slug) {
|
|
781
|
-
return slug || "/";
|
|
782
|
-
},
|
|
783
|
-
switchTo(locale2, slug, _router) {
|
|
784
|
-
const domain = localeDomains[locale2];
|
|
785
|
-
if (!domain) return;
|
|
786
|
-
if (locale2 === _currentLocale) {
|
|
787
|
-
markLocaleSwitch(locale2);
|
|
788
|
-
_router.push(slug || "/");
|
|
789
|
-
return;
|
|
790
|
-
}
|
|
791
|
-
const { protocol } = window.location;
|
|
792
|
-
const s = slug || "/";
|
|
793
|
-
window.location.href = `${protocol}//${domain}${s}`;
|
|
794
|
-
},
|
|
795
|
-
normalize() {
|
|
796
|
-
return null;
|
|
797
|
-
}
|
|
798
|
-
};
|
|
799
|
-
}
|
|
800
|
-
function createLocaleStrategy(options) {
|
|
801
|
-
if (options.localeStrategy === "domain" && options.localeDomains) {
|
|
802
|
-
return createDomainStrategy({ localeDomains: options.localeDomains });
|
|
803
|
-
}
|
|
804
|
-
return createPathStrategy({
|
|
805
|
-
defaultLocale: options.defaultLocale ?? "en",
|
|
806
|
-
supportedLocales: options.supportedLocales ?? []
|
|
807
|
-
});
|
|
808
|
-
}
|
|
809
693
|
const BLOX_PREVIEW_ROUTE_NAME = "blox:preview";
|
|
810
694
|
const BLOX_CMS_ROUTE_NAME = "blox:cms";
|
|
811
695
|
function applyDefaultsToFields(schema, defaults) {
|
|
@@ -917,7 +801,7 @@ class BloxInstance {
|
|
|
917
801
|
router.addRoute({
|
|
918
802
|
path: "/_blox_preview",
|
|
919
803
|
name: BLOX_PREVIEW_ROUTE_NAME,
|
|
920
|
-
component: () => import("./PreviewApp-
|
|
804
|
+
component: () => import("./PreviewApp-9H9-jLVN.js"),
|
|
921
805
|
beforeEnter: () => typeof window === "undefined" || window.parent !== window ? true : "/"
|
|
922
806
|
});
|
|
923
807
|
}
|
|
@@ -1307,27 +1191,26 @@ function installBloxRuntime(options) {
|
|
|
1307
1191
|
return blox;
|
|
1308
1192
|
}
|
|
1309
1193
|
export {
|
|
1310
|
-
_sfc_main
|
|
1194
|
+
_sfc_main as A,
|
|
1311
1195
|
BLOX_SSR_ROUTE_STATE_KEY as B,
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1196
|
+
applyLayoutChrome as C,
|
|
1197
|
+
classifyLink as D,
|
|
1198
|
+
contentRoutes as E,
|
|
1199
|
+
createBlox as F,
|
|
1200
|
+
defineContent as G,
|
|
1201
|
+
generateContentRoutes as H,
|
|
1202
|
+
getContentRouteByCollection as I,
|
|
1203
|
+
installContentFallback as J,
|
|
1204
|
+
isAbsoluteExternal as K,
|
|
1205
|
+
isSoloContentPage as L,
|
|
1206
|
+
isSpecialScheme as M,
|
|
1207
|
+
normalizeTo as N,
|
|
1208
|
+
provideContentItem as O,
|
|
1325
1209
|
PageRenderer as P,
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
useData as U,
|
|
1210
|
+
toInternalPath as Q,
|
|
1211
|
+
useBloxEdit as R,
|
|
1212
|
+
useContentItem as S,
|
|
1213
|
+
useData as T,
|
|
1331
1214
|
_sfc_main$3 as _,
|
|
1332
1215
|
collectBloxSeo as a,
|
|
1333
1216
|
provideBloxLocale as b,
|
|
@@ -1341,18 +1224,18 @@ export {
|
|
|
1341
1224
|
getContentRoute as j,
|
|
1342
1225
|
isMissingPageDocument as k,
|
|
1343
1226
|
installSmartLinks as l,
|
|
1344
|
-
|
|
1227
|
+
BLOX_CMS_ROUTE_NAME as m,
|
|
1345
1228
|
normalizeLink as n,
|
|
1346
|
-
|
|
1229
|
+
BLOX_PREVIEW_ROUTE_NAME as o,
|
|
1347
1230
|
provideBloxData as p,
|
|
1348
|
-
|
|
1231
|
+
BLOX_ADMIN_CONFIG_KEY as q,
|
|
1349
1232
|
resolveBlockProps as r,
|
|
1350
1233
|
setActiveLocale as s,
|
|
1351
|
-
|
|
1234
|
+
BLOX_CONFIG_KEY as t,
|
|
1352
1235
|
useLocale as u,
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
_sfc_main$
|
|
1236
|
+
BLOX_DATA_KEY as v,
|
|
1237
|
+
BLOX_LAYOUT_KEY as w,
|
|
1238
|
+
BloxInstance as x,
|
|
1239
|
+
_sfc_main$2 as y,
|
|
1240
|
+
_sfc_main$1 as z
|
|
1358
1241
|
};
|
|
@@ -7,7 +7,7 @@ const vue = require("vue");
|
|
|
7
7
|
const index = require("./index-DUjEj7ts.cjs");
|
|
8
8
|
const vueRouter = require("vue-router");
|
|
9
9
|
const vue$1 = require("@bagelink/vue");
|
|
10
|
-
const
|
|
10
|
+
const localeStrategy = require("./localeStrategy-OwRIn35C.cjs");
|
|
11
11
|
const ssg_client = require("./client-AoDTJJXJ.cjs");
|
|
12
12
|
const BLOX_REGISTRY_KEY = Symbol("blox:registry");
|
|
13
13
|
const BLOX_CONFIG_KEY = Symbol("blox:config");
|
|
@@ -111,11 +111,13 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
111
111
|
const _hasStorage = typeof localStorage !== "undefined";
|
|
112
112
|
const locale = vue.ref((_hasStorage ? localStorage.getItem("blox:locale") : null) || "en");
|
|
113
113
|
const currentAlternates = vue.ref({});
|
|
114
|
+
const currentLocaleFallbacks = vue.ref({});
|
|
114
115
|
const BLOX_LOCALE_KEY = Symbol("blox:locale");
|
|
115
116
|
function provideBloxLocale(app, initialLocale) {
|
|
116
117
|
const state = {
|
|
117
118
|
locale: vue.ref(initialLocale),
|
|
118
|
-
currentAlternates: vue.ref({})
|
|
119
|
+
currentAlternates: vue.ref({}),
|
|
120
|
+
currentLocaleFallbacks: vue.ref({})
|
|
119
121
|
};
|
|
120
122
|
app.provide(BLOX_LOCALE_KEY, state);
|
|
121
123
|
return state;
|
|
@@ -125,7 +127,7 @@ function localeState() {
|
|
|
125
127
|
const state = vue.inject(BLOX_LOCALE_KEY, null);
|
|
126
128
|
if (state) return state;
|
|
127
129
|
}
|
|
128
|
-
return { locale, currentAlternates };
|
|
130
|
+
return { locale, currentAlternates, currentLocaleFallbacks };
|
|
129
131
|
}
|
|
130
132
|
function setActiveLocale(l, state = localeState()) {
|
|
131
133
|
state.locale.value = l;
|
|
@@ -154,12 +156,17 @@ function useLocale() {
|
|
|
154
156
|
function setAlternates(alternates) {
|
|
155
157
|
state.currentAlternates.value = alternates;
|
|
156
158
|
}
|
|
159
|
+
function setLocaleFallbacks(fallbacks) {
|
|
160
|
+
state.currentLocaleFallbacks.value = fallbacks;
|
|
161
|
+
}
|
|
157
162
|
return {
|
|
158
163
|
locale: state.locale,
|
|
159
164
|
dir,
|
|
160
165
|
setLocale,
|
|
161
166
|
currentAlternates: state.currentAlternates,
|
|
162
|
-
setAlternates
|
|
167
|
+
setAlternates,
|
|
168
|
+
currentLocaleFallbacks: state.currentLocaleFallbacks,
|
|
169
|
+
setLocaleFallbacks
|
|
163
170
|
};
|
|
164
171
|
}
|
|
165
172
|
function pathExcluded(path, patterns) {
|
|
@@ -379,8 +386,8 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
379
386
|
}
|
|
380
387
|
function updateDocumentTitle(resolved) {
|
|
381
388
|
if (typeof document === "undefined") return;
|
|
382
|
-
const title =
|
|
383
|
-
siteName:
|
|
389
|
+
const title = localeStrategy.resolvePageTitle(resolved, {
|
|
390
|
+
siteName: localeStrategy.siteNameFromContexts(resolved.contexts)
|
|
384
391
|
});
|
|
385
392
|
if (title) document.title = title;
|
|
386
393
|
}
|
|
@@ -516,7 +523,7 @@ function useSeo(source) {
|
|
|
516
523
|
if (vue.getCurrentInstance()) {
|
|
517
524
|
vue.watch(source, (v) => {
|
|
518
525
|
if ((v == null ? void 0 : v.title) && typeof document !== "undefined") {
|
|
519
|
-
document.title =
|
|
526
|
+
document.title = localeStrategy.preserveCurrentSiteSuffix(v.title, document.title);
|
|
520
527
|
}
|
|
521
528
|
}, { immediate: true });
|
|
522
529
|
}
|
|
@@ -684,129 +691,6 @@ function installSmartLinks(router) {
|
|
|
684
691
|
document.addEventListener("click", onClick);
|
|
685
692
|
return () => document.removeEventListener("click", onClick);
|
|
686
693
|
}
|
|
687
|
-
let _pendingLocaleSwitch = null;
|
|
688
|
-
function consumePendingLocaleSwitch() {
|
|
689
|
-
const next = _pendingLocaleSwitch;
|
|
690
|
-
_pendingLocaleSwitch = null;
|
|
691
|
-
return next;
|
|
692
|
-
}
|
|
693
|
-
function markLocaleSwitch(locale2) {
|
|
694
|
-
_pendingLocaleSwitch = locale2;
|
|
695
|
-
}
|
|
696
|
-
function createPathStrategy(options) {
|
|
697
|
-
const { defaultLocale, supportedLocales } = options;
|
|
698
|
-
let _currentLocale = defaultLocale;
|
|
699
|
-
return {
|
|
700
|
-
get locales() {
|
|
701
|
-
return supportedLocales;
|
|
702
|
-
},
|
|
703
|
-
get defaultLocale() {
|
|
704
|
-
return defaultLocale;
|
|
705
|
-
},
|
|
706
|
-
get currentLocale() {
|
|
707
|
-
return _currentLocale;
|
|
708
|
-
},
|
|
709
|
-
detect(_hostname, path) {
|
|
710
|
-
const segments = path.replace(/^\//, "").split("/");
|
|
711
|
-
const first = segments[0];
|
|
712
|
-
if (supportedLocales.includes(first)) {
|
|
713
|
-
_currentLocale = first;
|
|
714
|
-
const rest = segments.slice(1).join("/");
|
|
715
|
-
return {
|
|
716
|
-
locale: first,
|
|
717
|
-
slug: rest ? `/${rest}` : "/"
|
|
718
|
-
};
|
|
719
|
-
}
|
|
720
|
-
_currentLocale = defaultLocale;
|
|
721
|
-
return { locale: defaultLocale, slug: path || "/" };
|
|
722
|
-
},
|
|
723
|
-
toPath(slug, locale2) {
|
|
724
|
-
const loc = locale2 || _currentLocale;
|
|
725
|
-
let s = slug ? slug.startsWith("/") ? slug : `/${slug}` : "/";
|
|
726
|
-
const segments = s.replace(/^\//, "").split("/").filter(Boolean);
|
|
727
|
-
if (segments[0] && supportedLocales.includes(segments[0])) {
|
|
728
|
-
const rest = segments.slice(1).join("/");
|
|
729
|
-
s = rest ? `/${rest}` : "/";
|
|
730
|
-
}
|
|
731
|
-
if (loc === defaultLocale) return s;
|
|
732
|
-
return s === "/" ? `/${loc}` : `/${loc}${s}`;
|
|
733
|
-
},
|
|
734
|
-
switchTo(locale2, slug, router) {
|
|
735
|
-
_currentLocale = locale2;
|
|
736
|
-
const s = slug || "/";
|
|
737
|
-
const bare = (() => {
|
|
738
|
-
const segments = s.replace(/^\//, "").split("/").filter(Boolean);
|
|
739
|
-
if (segments[0] && supportedLocales.includes(segments[0])) {
|
|
740
|
-
const rest = segments.slice(1).join("/");
|
|
741
|
-
return rest ? `/${rest}` : "/";
|
|
742
|
-
}
|
|
743
|
-
return s;
|
|
744
|
-
})();
|
|
745
|
-
const target = locale2 === defaultLocale ? bare : bare === "/" ? `/${locale2}` : `/${locale2}${bare}`;
|
|
746
|
-
markLocaleSwitch(locale2);
|
|
747
|
-
router.push(target);
|
|
748
|
-
},
|
|
749
|
-
normalize(path, intendedLocale) {
|
|
750
|
-
const p = path || "/";
|
|
751
|
-
const [pathname, ...restQ] = p.split(/(?=[?#])/);
|
|
752
|
-
const suffix = restQ.join("");
|
|
753
|
-
const segments = (pathname || "/").replace(/^\//, "").split("/").filter(Boolean);
|
|
754
|
-
const first = segments[0];
|
|
755
|
-
if (first && supportedLocales.includes(first)) return null;
|
|
756
|
-
if (intendedLocale === defaultLocale) return null;
|
|
757
|
-
const bare = segments.length ? `/${segments.join("/")}` : "/";
|
|
758
|
-
const rebuilt = bare === "/" ? `/${intendedLocale}` : `/${intendedLocale}${bare}`;
|
|
759
|
-
return `${rebuilt}${suffix}`;
|
|
760
|
-
}
|
|
761
|
-
};
|
|
762
|
-
}
|
|
763
|
-
function createDomainStrategy(options) {
|
|
764
|
-
const { localeDomains } = options;
|
|
765
|
-
const locales = Object.keys(localeDomains);
|
|
766
|
-
const _defaultLocale = locales[0] ?? "en";
|
|
767
|
-
const _currentLocale = locales.find((l) => localeDomains[l] === window.location.hostname) ?? _defaultLocale;
|
|
768
|
-
return {
|
|
769
|
-
get locales() {
|
|
770
|
-
return locales;
|
|
771
|
-
},
|
|
772
|
-
get defaultLocale() {
|
|
773
|
-
return _defaultLocale;
|
|
774
|
-
},
|
|
775
|
-
get currentLocale() {
|
|
776
|
-
return _currentLocale;
|
|
777
|
-
},
|
|
778
|
-
detect(_hostname, path) {
|
|
779
|
-
return { locale: _currentLocale, slug: path || "/" };
|
|
780
|
-
},
|
|
781
|
-
toPath(slug) {
|
|
782
|
-
return slug || "/";
|
|
783
|
-
},
|
|
784
|
-
switchTo(locale2, slug, _router) {
|
|
785
|
-
const domain = localeDomains[locale2];
|
|
786
|
-
if (!domain) return;
|
|
787
|
-
if (locale2 === _currentLocale) {
|
|
788
|
-
markLocaleSwitch(locale2);
|
|
789
|
-
_router.push(slug || "/");
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
const { protocol } = window.location;
|
|
793
|
-
const s = slug || "/";
|
|
794
|
-
window.location.href = `${protocol}//${domain}${s}`;
|
|
795
|
-
},
|
|
796
|
-
normalize() {
|
|
797
|
-
return null;
|
|
798
|
-
}
|
|
799
|
-
};
|
|
800
|
-
}
|
|
801
|
-
function createLocaleStrategy(options) {
|
|
802
|
-
if (options.localeStrategy === "domain" && options.localeDomains) {
|
|
803
|
-
return createDomainStrategy({ localeDomains: options.localeDomains });
|
|
804
|
-
}
|
|
805
|
-
return createPathStrategy({
|
|
806
|
-
defaultLocale: options.defaultLocale ?? "en",
|
|
807
|
-
supportedLocales: options.supportedLocales ?? []
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
694
|
const BLOX_PREVIEW_ROUTE_NAME = "blox:preview";
|
|
811
695
|
const BLOX_CMS_ROUTE_NAME = "blox:cms";
|
|
812
696
|
function applyDefaultsToFields(schema, defaults) {
|
|
@@ -831,7 +715,7 @@ class BloxInstance {
|
|
|
831
715
|
supportedLocales: (options == null ? void 0 : options.supportedLocales) ?? [],
|
|
832
716
|
navigation: (options == null ? void 0 : options.navigation) ?? "spa"
|
|
833
717
|
};
|
|
834
|
-
this._strategy = createLocaleStrategy(options ?? {});
|
|
718
|
+
this._strategy = localeStrategy.createLocaleStrategy(options ?? {});
|
|
835
719
|
this._adminEdit = options == null ? void 0 : options.adminEdit;
|
|
836
720
|
}
|
|
837
721
|
/** The active locale strategy (path/domain). Used by the nav guard. */
|
|
@@ -918,7 +802,7 @@ class BloxInstance {
|
|
|
918
802
|
router.addRoute({
|
|
919
803
|
path: "/_blox_preview",
|
|
920
804
|
name: BLOX_PREVIEW_ROUTE_NAME,
|
|
921
|
-
component: () => Promise.resolve().then(() => require("./PreviewApp-
|
|
805
|
+
component: () => Promise.resolve().then(() => require("./PreviewApp-D8ZBTG0j.cjs")),
|
|
922
806
|
beforeEnter: () => typeof window === "undefined" || window.parent !== window ? true : "/"
|
|
923
807
|
});
|
|
924
808
|
}
|
|
@@ -940,7 +824,7 @@ class BloxInstance {
|
|
|
940
824
|
supportedLocales: options.supportedLocales ?? this._config.supportedLocales,
|
|
941
825
|
navigation: options.navigation ?? this._config.navigation
|
|
942
826
|
};
|
|
943
|
-
this._strategy = createLocaleStrategy({
|
|
827
|
+
this._strategy = localeStrategy.createLocaleStrategy({
|
|
944
828
|
...options,
|
|
945
829
|
defaultLocale: this._config.defaultLocale,
|
|
946
830
|
supportedLocales: this._config.supportedLocales
|
|
@@ -1327,7 +1211,6 @@ exports.applyLayoutChrome = applyLayoutChrome;
|
|
|
1327
1211
|
exports.classifyLink = classifyLink;
|
|
1328
1212
|
exports.collectBloxData = collectBloxData;
|
|
1329
1213
|
exports.collectBloxSeo = collectBloxSeo;
|
|
1330
|
-
exports.consumePendingLocaleSwitch = consumePendingLocaleSwitch;
|
|
1331
1214
|
exports.contentRoutes = contentRoutes;
|
|
1332
1215
|
exports.createBlox = createBlox;
|
|
1333
1216
|
exports.defineContent = defineContent;
|
|
@@ -3,6 +3,7 @@ export type Locale = string;
|
|
|
3
3
|
export interface BloxLocaleState {
|
|
4
4
|
locale: Ref<Locale>;
|
|
5
5
|
currentAlternates: Ref<Record<string, string>>;
|
|
6
|
+
currentLocaleFallbacks: Ref<Record<string, string[]>>;
|
|
6
7
|
}
|
|
7
8
|
export declare const BLOX_LOCALE_KEY: InjectionKey<BloxLocaleState>;
|
|
8
9
|
export declare function provideBloxLocale(app: App, initialLocale: Locale): BloxLocaleState;
|
|
@@ -19,5 +20,7 @@ export declare function useLocale(): {
|
|
|
19
20
|
setLocale: (l: Locale) => void;
|
|
20
21
|
currentAlternates: Ref<Record<string, string>, Record<string, string>>;
|
|
21
22
|
setAlternates: (alternates: Record<string, string>) => void;
|
|
23
|
+
currentLocaleFallbacks: Ref<Record<string, string[]>, Record<string, string[]>>;
|
|
24
|
+
setLocaleFallbacks: (fallbacks: Record<string, string[]>) => void;
|
|
22
25
|
};
|
|
23
26
|
//# sourceMappingURL=useLocale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../src/composables/useLocale.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAGjD,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../src/composables/useLocale.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAGjD,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAa3B,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACnB,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC9C,sBAAsB,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;CACrD;AAED,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,eAAe,CAAyB,CAAA;AAEnF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,GAAG,eAAe,CAQlF;AAUD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,GAAE,eAA+B,GAAG,IAAI,CAQvF;AAED,wBAAgB,SAAS;;;mBAIF,MAAM;;gCAgBO,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;oCAIlB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;EAa/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleNav.d.ts","sourceRoot":"","sources":["../../src/composables/useLocaleNav.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY;iCAYS,MAAM;kCAeL,MAAM,KAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"useLocaleNav.d.ts","sourceRoot":"","sources":["../../src/composables/useLocaleNav.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY;iCAYS,MAAM;kCAeL,MAAM,KAAG,MAAM;mBAM9B,MAAM,KAAG,MAAM;+BAOH,MAAM,oBAAe,MAAM;mBAYvC,MAAM,KAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;;;EAa/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBloxApp.d.ts","sourceRoot":"","sources":["../src/createBloxApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"createBloxApp.d.ts","sourceRoot":"","sources":["../src/createBloxApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAahD,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE7D,MAAM,WAAW,oBAAoB;IACpC,oCAAoC;IACpC,aAAa,EAAE,SAAS,CAAA;IACxB,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd;;;;;OAKG;IACH,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IACpD,4EAA4E;IAC5E,WAAW,EAAE,MAAM,CAAA;IACnB,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACxB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAA;IAClD;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,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;IACrC;;;;;;;;;;;;;;OAcG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;IACzB;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,UAAU,GAAG,KAAK,CAAA;IAC/B,0DAA0D;IAC1D,SAAS,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;IACpC,iFAAiF;IACjF,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC3B;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;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAUtE;AAWD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAoCvE;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,CAiL1E"}
|
package/dist/hydration.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export interface BloxHydrationPayload {
|
|
|
6
6
|
resolved: PageResolveRead;
|
|
7
7
|
};
|
|
8
8
|
websiteId?: string;
|
|
9
|
+
/** Canonical localized page paths (`{ "/about-us": { es: "/quienes-somos" } }`). */
|
|
10
|
+
pageSlugMap?: Record<string, Record<string, string>>;
|
|
9
11
|
data: Record<string, unknown>;
|
|
10
12
|
}
|
|
11
13
|
/** Read the current V2 payload, with V1 globals isolated as temporary compatibility. */
|
package/dist/hydration.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydration.d.ts","sourceRoot":"","sources":["../src/hydration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAQlD,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,CAAC,CAAA;IACV,KAAK,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,CAAA;QACZ,QAAQ,EAAE,eAAe,CAAA;KACzB,CAAA;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC7B;AAQD,wFAAwF;AACxF,wBAAgB,iBAAiB,IAAI,oBAAoB,GAAG,IAAI,CAyB/D"}
|
|
1
|
+
{"version":3,"file":"hydration.d.ts","sourceRoot":"","sources":["../src/hydration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAQlD,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,CAAC,CAAA;IACV,KAAK,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,CAAA;QACZ,QAAQ,EAAE,eAAe,CAAA;KACzB,CAAA;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oFAAoF;IACpF,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACpD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC7B;AAQD,wFAAwF;AACxF,wBAAgB,iBAAiB,IAAI,oBAAoB,GAAG,IAAI,CAyB/D"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const index = require("./index-DUjEj7ts.cjs");
|
|
4
|
-
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-
|
|
5
|
-
const appRuntime = require("./appRuntime-
|
|
4
|
+
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-BYCayJs0.cjs");
|
|
5
|
+
const appRuntime = require("./appRuntime-Z0AxTPxf.cjs");
|
|
6
6
|
const vue = require("vue");
|
|
7
7
|
const ssg_client = require("./client-AoDTJJXJ.cjs");
|
|
8
8
|
const vueRouter = require("vue-router");
|
|
9
|
+
const localeStrategy = require("./localeStrategy-OwRIn35C.cjs");
|
|
9
10
|
const FORM_CONTROL_SELECTOR = "button, input, select, textarea, label, option";
|
|
10
11
|
function isEditorPreview$1() {
|
|
11
12
|
try {
|
|
@@ -129,7 +130,7 @@ function useGlobalBlock(blockType) {
|
|
|
129
130
|
function useLocaleNav() {
|
|
130
131
|
const strategy = vue.inject(appRuntime.BLOX_LOCALE_STRATEGY_KEY, null);
|
|
131
132
|
const router = vueRouter.useRouter();
|
|
132
|
-
const { locale, currentAlternates } = appRuntime.useLocale();
|
|
133
|
+
const { locale, currentAlternates, currentLocaleFallbacks } = appRuntime.useLocale();
|
|
133
134
|
const availableLocales = vue.computed(() => {
|
|
134
135
|
var _a;
|
|
135
136
|
const alts = Object.keys(currentAlternates.value ?? {});
|
|
@@ -141,8 +142,10 @@ function useLocaleNav() {
|
|
|
141
142
|
strategy.switchTo(targetLocale, alternatePath(targetLocale), router);
|
|
142
143
|
}
|
|
143
144
|
function alternatePath(targetLocale) {
|
|
144
|
-
var _a;
|
|
145
|
-
|
|
145
|
+
var _a, _b, _c;
|
|
146
|
+
const exact = (_a = currentAlternates.value) == null ? void 0 : _a[targetLocale];
|
|
147
|
+
if (exact) return exact;
|
|
148
|
+
return ((_c = (_b = currentLocaleFallbacks.value) == null ? void 0 : _b[targetLocale]) == null ? void 0 : _c.find(Boolean)) ?? "/";
|
|
146
149
|
}
|
|
147
150
|
function toPath(slug) {
|
|
148
151
|
const normalized = appRuntime.normalizeLink(slug) ?? slug;
|
|
@@ -323,7 +326,7 @@ function injectPlausible(config) {
|
|
|
323
326
|
document.head.appendChild(el);
|
|
324
327
|
}
|
|
325
328
|
function createBloxApp(options) {
|
|
326
|
-
var _a, _b, _c;
|
|
329
|
+
var _a, _b, _c, _d;
|
|
327
330
|
const {
|
|
328
331
|
rootComponent,
|
|
329
332
|
router,
|
|
@@ -349,6 +352,7 @@ function createBloxApp(options) {
|
|
|
349
352
|
options.createApi({ baseURL: apiBaseURL });
|
|
350
353
|
}
|
|
351
354
|
const hasSsgState = ssg_client.readBloxHydration() != null;
|
|
355
|
+
localeStrategy.setPageSlugMap((_a = ssg_client.readBloxHydration()) == null ? void 0 : _a.pageSlugMap);
|
|
352
356
|
const createVueApp = hasSsgState ? vue.createSSRApp : vue.createApp;
|
|
353
357
|
const app = createVueApp({
|
|
354
358
|
name: "BloxRoot",
|
|
@@ -390,7 +394,7 @@ function createBloxApp(options) {
|
|
|
390
394
|
const toPath = typeof (to == null ? void 0 : to.path) === "string" ? to.path : browserPath;
|
|
391
395
|
const toFullPath = typeof (to == null ? void 0 : to.fullPath) === "string" ? to.fullPath : toPath;
|
|
392
396
|
const fromPath = typeof (from == null ? void 0 : from.path) === "string" ? from.path : "";
|
|
393
|
-
const switched =
|
|
397
|
+
const switched = localeStrategy.consumePendingLocaleSwitch();
|
|
394
398
|
if (switched != null) {
|
|
395
399
|
appRuntime.setActiveLocale(switched, localeState);
|
|
396
400
|
return true;
|
|
@@ -404,12 +408,12 @@ function createBloxApp(options) {
|
|
|
404
408
|
appRuntime.setActiveLocale(localeOf(toPath), localeState);
|
|
405
409
|
return true;
|
|
406
410
|
});
|
|
407
|
-
const initialPath = typeof window !== "undefined" && ((
|
|
411
|
+
const initialPath = typeof window !== "undefined" && ((_b = window.location) == null ? void 0 : _b.pathname) ? window.location.pathname : router.currentRoute.value.path;
|
|
408
412
|
appRuntime.setActiveLocale(localeOf(initialPath), localeState);
|
|
409
413
|
appRuntime.setActiveLocale(localeOf(initialPath), localeState);
|
|
410
414
|
if (hasSsgState && strategy && typeof window !== "undefined" && !isEditorPreview()) {
|
|
411
415
|
const hostname = window.location.hostname;
|
|
412
|
-
const hydratedPath = (
|
|
416
|
+
const hydratedPath = (_d = (_c = ssg_client.readBloxHydration()) == null ? void 0 : _c.route) == null ? void 0 : _d.path;
|
|
413
417
|
const requestedSlug = strategy.detect(hostname, initialPath).slug;
|
|
414
418
|
if (appRuntime.isMissingPageDocument({
|
|
415
419
|
hydratedSlug: hydratedPath ? strategy.detect(hostname, hydratedPath).slug : "",
|
|
@@ -548,6 +552,9 @@ exports.useData = appRuntime.useData;
|
|
|
548
552
|
exports.useLocale = appRuntime.useLocale;
|
|
549
553
|
exports.useSeo = appRuntime.useSeo;
|
|
550
554
|
exports.readBloxHydration = ssg_client.readBloxHydration;
|
|
555
|
+
exports.getPageSlugMap = localeStrategy.getPageSlugMap;
|
|
556
|
+
exports.localizePageSlug = localeStrategy.localizePageSlug;
|
|
557
|
+
exports.setPageSlugMap = localeStrategy.setPageSlugMap;
|
|
551
558
|
exports.BloxRouterView = _sfc_main;
|
|
552
559
|
exports.buildBloxManifest = buildBloxManifest;
|
|
553
560
|
exports.createBloxApp = createBloxApp;
|