@bagelink/blox 1.15.633 → 1.15.637
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-BtQBgxxJ.cjs → PreviewApp-CWexehXS.cjs} +1 -1
- package/dist/{PreviewApp-D7nTn843.js → PreviewApp-RzR7F5HX.js} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-DDqfNEdN.js → PreviewApp.vue_vue_type_style_index_0_lang-BMOOTRxd.js} +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-BGQBi7kZ.cjs → PreviewApp.vue_vue_type_style_index_0_lang-hkuLedAX.cjs} +1 -1
- package/dist/{appRuntime-Zt_fH0wN.cjs → appRuntime-BEqnYYLz.cjs} +24 -21
- package/dist/{appRuntime-MDr0X5u0.js → appRuntime-DX9LWE5R.js} +14 -11
- package/dist/{pageTitle-Dh_UoICu.cjs → index-DUjEj7ts.cjs} +2 -54
- package/dist/{pageTitle-BUVrac-4.js → index-I81QTzv-.js} +15 -68
- package/dist/index.cjs +19 -19
- package/dist/index.mjs +19 -19
- package/dist/pageTitle-BOTMH-D8.js +56 -0
- package/dist/pageTitle-nIl1cDfD.cjs +55 -0
- package/dist/{shard-runner-JbXPS_Dl.cjs → shard-runner-BSoIApcl.cjs} +2 -2
- package/dist/{shard-runner-Cv5Cjm1f.js → shard-runner-C962Vua3.js} +2 -2
- package/dist/ssg/cli.cjs +4 -4
- package/dist/ssg/cli.mjs +3 -3
- package/dist/ssg/index.cjs +7 -7
- package/dist/ssg/index.mjs +4 -4
- package/dist/{validate-output-ClPMepYU.js → validate-output-9_ibeTgY.js} +1 -1
- package/dist/{validate-output-CgOarPEF.cjs → validate-output-Dmc7_eXo.cjs} +1 -1
- 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":";AA6hBA,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-hkuLedAX.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-DX9LWE5R.js";
|
|
3
3
|
function sendToEditor(msg) {
|
|
4
4
|
window.parent.postMessage(cloneForPostMessage(msg), "*");
|
|
5
5
|
}
|
|
@@ -4,9 +4,10 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
const pinia = require("pinia");
|
|
6
6
|
const vue = require("vue");
|
|
7
|
-
const
|
|
7
|
+
const index = require("./index-DUjEj7ts.cjs");
|
|
8
8
|
const vueRouter = require("vue-router");
|
|
9
9
|
const vue$1 = require("@bagelink/vue");
|
|
10
|
+
const pageTitle = require("./pageTitle-nIl1cDfD.cjs");
|
|
10
11
|
const ssg_client = require("./client-AoDTJJXJ.cjs");
|
|
11
12
|
const BLOX_REGISTRY_KEY = Symbol("blox:registry");
|
|
12
13
|
const BLOX_CONFIG_KEY = Symbol("blox:config");
|
|
@@ -287,19 +288,20 @@ const _hoisted_4$1 = {
|
|
|
287
288
|
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
288
289
|
__name: "CmsPageView",
|
|
289
290
|
setup(__props) {
|
|
291
|
+
var _a;
|
|
290
292
|
const route = vueRouter.useRoute();
|
|
291
293
|
const router = vueRouter.useRouter();
|
|
292
294
|
const { locale: locale2, setLocale, setAlternates } = useLocale();
|
|
293
295
|
const strategy = vue.inject(BLOX_LOCALE_STRATEGY_KEY, null);
|
|
294
296
|
const config = vue.inject(BLOX_CONFIG_KEY, null);
|
|
295
297
|
const ssrRouteState = vue.inject(BLOX_SSR_ROUTE_STATE_KEY, null);
|
|
296
|
-
const api =
|
|
298
|
+
const api = index.useBloxApi();
|
|
297
299
|
const blocks = vue.ref([]);
|
|
298
300
|
const contexts = vue.ref({});
|
|
299
301
|
vue.provide("contexts", contexts);
|
|
300
302
|
const adminConfig = vue.inject(BLOX_ADMIN_CONFIG_KEY, null);
|
|
301
303
|
const currentPageId = vue.ref(null);
|
|
302
|
-
const websiteId = vue.ref((api == null ? void 0 : api.getWebsiteIdSync()) ??
|
|
304
|
+
const websiteId = vue.ref((api == null ? void 0 : api.getWebsiteIdSync()) ?? index.getWebsiteIdSync());
|
|
303
305
|
const notFound = vue.ref(false);
|
|
304
306
|
const error = vue.ref(null);
|
|
305
307
|
const initialLoading = vue.ref(true);
|
|
@@ -315,20 +317,20 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
315
317
|
return typeof (route == null ? void 0 : route.fullPath) === "string" && route.fullPath ? route.fullPath : currentRoutePath() || fallback;
|
|
316
318
|
}
|
|
317
319
|
function tryHydrateFromState(path) {
|
|
318
|
-
var
|
|
320
|
+
var _a2;
|
|
319
321
|
if ((ssrRouteState == null ? void 0 : ssrRouteState.path) === path && ssrRouteState.resolved) {
|
|
320
322
|
applyResolvedState(ssrRouteState.resolved);
|
|
321
323
|
return true;
|
|
322
324
|
}
|
|
323
|
-
const routeState = (
|
|
325
|
+
const routeState = (_a2 = ssg_client.readBloxHydration()) == null ? void 0 : _a2.route;
|
|
324
326
|
const entry = (routeState == null ? void 0 : routeState.path) === path ? routeState.resolved : void 0;
|
|
325
327
|
if (!entry) return false;
|
|
326
328
|
applyResolvedState(entry);
|
|
327
329
|
return true;
|
|
328
330
|
}
|
|
329
331
|
function applyResolvedState(entry, path) {
|
|
330
|
-
var
|
|
331
|
-
blocks.value = ((_b = (
|
|
332
|
+
var _a2, _b, _c;
|
|
333
|
+
blocks.value = ((_b = (_a2 = entry.page) == null ? void 0 : _a2.content) == null ? void 0 : _b.blocks) ?? [];
|
|
332
334
|
contexts.value = entry.contexts ?? {};
|
|
333
335
|
currentPageId.value = ((_c = entry.page) == null ? void 0 : _c.id) ?? null;
|
|
334
336
|
setAlternates(entry.alternates && Object.keys(entry.alternates).length ? entry.alternates : {});
|
|
@@ -342,17 +344,18 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
342
344
|
if (title) document.title = title;
|
|
343
345
|
}
|
|
344
346
|
const initialSlug = (() => {
|
|
345
|
-
var
|
|
347
|
+
var _a2;
|
|
346
348
|
if (strategy) {
|
|
347
|
-
const hostname = typeof window !== "undefined" ? ((
|
|
349
|
+
const hostname = typeof window !== "undefined" ? ((_a2 = window.location) == null ? void 0 : _a2.hostname) ?? "" : "";
|
|
348
350
|
return strategy.detect(hostname, currentRoutePath()).slug;
|
|
349
351
|
}
|
|
350
352
|
return currentRoutePath();
|
|
351
353
|
})();
|
|
352
354
|
const ssrHydrated = tryHydrateFromState(initialSlug);
|
|
355
|
+
const hasPrerenderedRouteState = ((_a = ssg_client.readBloxHydration()) == null ? void 0 : _a.route) != null;
|
|
353
356
|
if (ssrHydrated) initialLoading.value = false;
|
|
354
357
|
async function load() {
|
|
355
|
-
var
|
|
358
|
+
var _a2;
|
|
356
359
|
notFound.value = false;
|
|
357
360
|
error.value = null;
|
|
358
361
|
const { locale: urlLocale, slug } = strategy ? strategy.detect(typeof window !== "undefined" ? window.location.hostname : "", currentRoutePath()) : { locale: locale2.value, slug: currentRoutePath() };
|
|
@@ -361,14 +364,14 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
361
364
|
initialLoading.value = false;
|
|
362
365
|
return;
|
|
363
366
|
}
|
|
364
|
-
if ((config == null ? void 0 : config.navigation) === "document" && typeof window !== "undefined") {
|
|
367
|
+
if ((config == null ? void 0 : config.navigation) === "document" && hasPrerenderedRouteState && typeof window !== "undefined") {
|
|
365
368
|
window.location.assign(currentRouteTarget(slug));
|
|
366
369
|
return;
|
|
367
370
|
}
|
|
368
371
|
navigating.value = true;
|
|
369
372
|
try {
|
|
370
|
-
const resolved = await ((api == null ? void 0 : api.resolvePath(slug, urlLocale)) ??
|
|
371
|
-
blocks.value = ((
|
|
373
|
+
const resolved = await ((api == null ? void 0 : api.resolvePath(slug, urlLocale)) ?? index.resolvePath(slug, urlLocale));
|
|
374
|
+
blocks.value = ((_a2 = resolved.page.content) == null ? void 0 : _a2.blocks) ?? [];
|
|
372
375
|
contexts.value = resolved.contexts ?? {};
|
|
373
376
|
currentPageId.value = resolved.page.id ?? null;
|
|
374
377
|
setAlternates(resolved.alternates ?? {});
|
|
@@ -392,7 +395,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
392
395
|
vue.watch(currentRoutePath, load);
|
|
393
396
|
vue.onMounted(() => {
|
|
394
397
|
if (adminConfig && !websiteId.value) {
|
|
395
|
-
((api == null ? void 0 : api.getWebsiteId()) ??
|
|
398
|
+
((api == null ? void 0 : api.getWebsiteId()) ?? index.getWebsiteId()).then((id) => {
|
|
396
399
|
websiteId.value = id;
|
|
397
400
|
}).catch(() => {
|
|
398
401
|
});
|
|
@@ -866,7 +869,7 @@ class BloxInstance {
|
|
|
866
869
|
router.addRoute({
|
|
867
870
|
path: "/_blox_preview",
|
|
868
871
|
name: BLOX_PREVIEW_ROUTE_NAME,
|
|
869
|
-
component: () => Promise.resolve().then(() => require("./PreviewApp-
|
|
872
|
+
component: () => Promise.resolve().then(() => require("./PreviewApp-CWexehXS.cjs")),
|
|
870
873
|
beforeEnter: () => typeof window === "undefined" || window.parent !== window ? true : "/"
|
|
871
874
|
});
|
|
872
875
|
}
|
|
@@ -899,7 +902,7 @@ class BloxInstance {
|
|
|
899
902
|
if (options == null ? void 0 : options.router) this.registerRoutes(options.router);
|
|
900
903
|
if (options == null ? void 0 : options.adminEdit) this._adminEdit = options.adminEdit;
|
|
901
904
|
if ((options == null ? void 0 : options.websiteName) || (options == null ? void 0 : options.store)) {
|
|
902
|
-
|
|
905
|
+
index.configureApi(options.websiteName ?? "", options.store ?? "");
|
|
903
906
|
}
|
|
904
907
|
if (options == null ? void 0 : options.defaultLocale) {
|
|
905
908
|
const { setLocale } = useLocale();
|
|
@@ -917,7 +920,7 @@ function isBlockDefinition(value) {
|
|
|
917
920
|
function createBlox(options) {
|
|
918
921
|
const instance = new BloxInstance(options);
|
|
919
922
|
if ((options == null ? void 0 : options.websiteName) || (options == null ? void 0 : options.store)) {
|
|
920
|
-
|
|
923
|
+
index.configureApi(options.websiteName ?? "", options.store ?? "");
|
|
921
924
|
}
|
|
922
925
|
if (options == null ? void 0 : options.modules) instance.registerModules(options.modules);
|
|
923
926
|
if (options == null ? void 0 : options.components) instance.registerComponents(options.components);
|
|
@@ -979,7 +982,7 @@ function useContentItem(collectionArg, slugArg) {
|
|
|
979
982
|
const c = coll();
|
|
980
983
|
const s = slg();
|
|
981
984
|
if (!c || !s) return null;
|
|
982
|
-
const res = await
|
|
985
|
+
const res = await index.listItemsFromActiveApi(c, { locale: loc(), limit: 1e3 });
|
|
983
986
|
const items = Array.isArray(res) ? res : (res == null ? void 0 : res.items) ?? [];
|
|
984
987
|
return items.find((it) => String((it == null ? void 0 : it.slug) ?? "") === s) ?? null;
|
|
985
988
|
},
|
|
@@ -1145,7 +1148,7 @@ function installContentFallback(router, supportedLocales, defaultLocale, api) {
|
|
|
1145
1148
|
registration.collection,
|
|
1146
1149
|
slug,
|
|
1147
1150
|
urlLocale
|
|
1148
|
-
)) ??
|
|
1151
|
+
)) ?? index.getItemBySlug(
|
|
1149
1152
|
registration.collection,
|
|
1150
1153
|
slug,
|
|
1151
1154
|
urlLocale
|
|
@@ -1162,7 +1165,7 @@ function installContentFallback(router, supportedLocales, defaultLocale, api) {
|
|
|
1162
1165
|
registration.collection,
|
|
1163
1166
|
slug,
|
|
1164
1167
|
sourceLocale
|
|
1165
|
-
)) ??
|
|
1168
|
+
)) ?? index.getItemBySlug(
|
|
1166
1169
|
registration.collection,
|
|
1167
1170
|
slug,
|
|
1168
1171
|
sourceLocale
|
|
@@ -1178,7 +1181,7 @@ function installContentFallback(router, supportedLocales, defaultLocale, api) {
|
|
|
1178
1181
|
registration.collection,
|
|
1179
1182
|
id,
|
|
1180
1183
|
urlLocale
|
|
1181
|
-
)) ??
|
|
1184
|
+
)) ?? index.getItemById(
|
|
1182
1185
|
registration.collection,
|
|
1183
1186
|
id,
|
|
1184
1187
|
urlLocale
|
|
@@ -3,9 +3,10 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { createPinia } from "pinia";
|
|
5
5
|
import { inject, computed, ref, defineComponent, onMounted, unref, openBlock, createElementBlock, createElementVNode, createCommentVNode, getCurrentInstance, h, provide, watch, resolveComponent, toDisplayString, createVNode, withCtx, createTextVNode, Fragment, createBlock, shallowRef, onServerPrefetch, toValue, markRaw, resolveDynamicComponent } from "vue";
|
|
6
|
-
import {
|
|
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, s as siteNameFromContexts, a as preserveCurrentSiteSuffix } from "./pageTitle-BOTMH-D8.js";
|
|
9
10
|
import { r as readBloxHydration } from "./client-Ce9fRCGH.js";
|
|
10
11
|
const BLOX_REGISTRY_KEY = Symbol("blox:registry");
|
|
11
12
|
const BLOX_CONFIG_KEY = Symbol("blox:config");
|
|
@@ -286,6 +287,7 @@ const _hoisted_4$1 = {
|
|
|
286
287
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
287
288
|
__name: "CmsPageView",
|
|
288
289
|
setup(__props) {
|
|
290
|
+
var _a;
|
|
289
291
|
const route = useRoute();
|
|
290
292
|
const router = useRouter();
|
|
291
293
|
const { locale: locale2, setLocale, setAlternates } = useLocale();
|
|
@@ -314,20 +316,20 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
314
316
|
return typeof (route == null ? void 0 : route.fullPath) === "string" && route.fullPath ? route.fullPath : currentRoutePath() || fallback;
|
|
315
317
|
}
|
|
316
318
|
function tryHydrateFromState(path) {
|
|
317
|
-
var
|
|
319
|
+
var _a2;
|
|
318
320
|
if ((ssrRouteState == null ? void 0 : ssrRouteState.path) === path && ssrRouteState.resolved) {
|
|
319
321
|
applyResolvedState(ssrRouteState.resolved);
|
|
320
322
|
return true;
|
|
321
323
|
}
|
|
322
|
-
const routeState = (
|
|
324
|
+
const routeState = (_a2 = readBloxHydration()) == null ? void 0 : _a2.route;
|
|
323
325
|
const entry = (routeState == null ? void 0 : routeState.path) === path ? routeState.resolved : void 0;
|
|
324
326
|
if (!entry) return false;
|
|
325
327
|
applyResolvedState(entry);
|
|
326
328
|
return true;
|
|
327
329
|
}
|
|
328
330
|
function applyResolvedState(entry, path) {
|
|
329
|
-
var
|
|
330
|
-
blocks.value = ((_b = (
|
|
331
|
+
var _a2, _b, _c;
|
|
332
|
+
blocks.value = ((_b = (_a2 = entry.page) == null ? void 0 : _a2.content) == null ? void 0 : _b.blocks) ?? [];
|
|
331
333
|
contexts.value = entry.contexts ?? {};
|
|
332
334
|
currentPageId.value = ((_c = entry.page) == null ? void 0 : _c.id) ?? null;
|
|
333
335
|
setAlternates(entry.alternates && Object.keys(entry.alternates).length ? entry.alternates : {});
|
|
@@ -341,17 +343,18 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
341
343
|
if (title) document.title = title;
|
|
342
344
|
}
|
|
343
345
|
const initialSlug = (() => {
|
|
344
|
-
var
|
|
346
|
+
var _a2;
|
|
345
347
|
if (strategy) {
|
|
346
|
-
const hostname = typeof window !== "undefined" ? ((
|
|
348
|
+
const hostname = typeof window !== "undefined" ? ((_a2 = window.location) == null ? void 0 : _a2.hostname) ?? "" : "";
|
|
347
349
|
return strategy.detect(hostname, currentRoutePath()).slug;
|
|
348
350
|
}
|
|
349
351
|
return currentRoutePath();
|
|
350
352
|
})();
|
|
351
353
|
const ssrHydrated = tryHydrateFromState(initialSlug);
|
|
354
|
+
const hasPrerenderedRouteState = ((_a = readBloxHydration()) == null ? void 0 : _a.route) != null;
|
|
352
355
|
if (ssrHydrated) initialLoading.value = false;
|
|
353
356
|
async function load() {
|
|
354
|
-
var
|
|
357
|
+
var _a2;
|
|
355
358
|
notFound.value = false;
|
|
356
359
|
error.value = null;
|
|
357
360
|
const { locale: urlLocale, slug } = strategy ? strategy.detect(typeof window !== "undefined" ? window.location.hostname : "", currentRoutePath()) : { locale: locale2.value, slug: currentRoutePath() };
|
|
@@ -360,14 +363,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
360
363
|
initialLoading.value = false;
|
|
361
364
|
return;
|
|
362
365
|
}
|
|
363
|
-
if ((config == null ? void 0 : config.navigation) === "document" && typeof window !== "undefined") {
|
|
366
|
+
if ((config == null ? void 0 : config.navigation) === "document" && hasPrerenderedRouteState && typeof window !== "undefined") {
|
|
364
367
|
window.location.assign(currentRouteTarget(slug));
|
|
365
368
|
return;
|
|
366
369
|
}
|
|
367
370
|
navigating.value = true;
|
|
368
371
|
try {
|
|
369
372
|
const resolved = await ((api == null ? void 0 : api.resolvePath(slug, urlLocale)) ?? resolvePath(slug, urlLocale));
|
|
370
|
-
blocks.value = ((
|
|
373
|
+
blocks.value = ((_a2 = resolved.page.content) == null ? void 0 : _a2.blocks) ?? [];
|
|
371
374
|
contexts.value = resolved.contexts ?? {};
|
|
372
375
|
currentPageId.value = resolved.page.id ?? null;
|
|
373
376
|
setAlternates(resolved.alternates ?? {});
|
|
@@ -865,7 +868,7 @@ class BloxInstance {
|
|
|
865
868
|
router.addRoute({
|
|
866
869
|
path: "/_blox_preview",
|
|
867
870
|
name: BLOX_PREVIEW_ROUTE_NAME,
|
|
868
|
-
component: () => import("./PreviewApp-
|
|
871
|
+
component: () => import("./PreviewApp-RzR7F5HX.js"),
|
|
869
872
|
beforeEnter: () => typeof window === "undefined" || window.parent !== window ? true : "/"
|
|
870
873
|
});
|
|
871
874
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
3
|
const vue = require("vue");
|
|
3
4
|
const ssg_client = require("./client-AoDTJJXJ.cjs");
|
|
4
5
|
let BASE = "/api";
|
|
@@ -201,57 +202,8 @@ function listItemsFromActiveApi(collection, options = {}) {
|
|
|
201
202
|
var _a;
|
|
202
203
|
return ((_a = useBloxApi()) == null ? void 0 : _a.listItems(collection, options)) ?? listItems(collection, options);
|
|
203
204
|
}
|
|
204
|
-
|
|
205
|
-
const TITLE_FIELDS = ["meta_title", "metaTitle", "title", "name", "productName", "displayName"];
|
|
206
|
-
function primaryPageContext(contexts) {
|
|
207
|
-
if (!contexts) return null;
|
|
208
|
-
const keys = [
|
|
209
|
-
...PREFERRED_CONTEXT_KEYS.filter((key) => key in contexts),
|
|
210
|
-
...Object.keys(contexts).filter((key) => key !== "$website" && !PREFERRED_CONTEXT_KEYS.includes(key)).sort()
|
|
211
|
-
];
|
|
212
|
-
for (const key of keys) {
|
|
213
|
-
const ctx = contexts[key];
|
|
214
|
-
if (ctx != null && typeof ctx === "object") return { key, ctx };
|
|
215
|
-
}
|
|
216
|
-
return null;
|
|
217
|
-
}
|
|
218
|
-
function contextPageTitle(context) {
|
|
219
|
-
if (!context) return null;
|
|
220
|
-
for (const field of TITLE_FIELDS) {
|
|
221
|
-
const value = context[field];
|
|
222
|
-
if (typeof value === "string" && value.trim()) return value.trim();
|
|
223
|
-
}
|
|
224
|
-
return null;
|
|
225
|
-
}
|
|
226
|
-
function siteNameFromContexts(contexts) {
|
|
227
|
-
const website = contexts == null ? void 0 : contexts.$website;
|
|
228
|
-
const seo = website == null ? void 0 : website.seo;
|
|
229
|
-
const siteName = seo && typeof seo === "object" ? seo.site_name : website == null ? void 0 : website.site_name;
|
|
230
|
-
return typeof siteName === "string" && siteName.trim() ? siteName.trim() : null;
|
|
231
|
-
}
|
|
232
|
-
function withSiteName(title, siteName) {
|
|
233
|
-
if (!siteName || title.includes(siteName)) return title;
|
|
234
|
-
return `${title} · ${siteName}`;
|
|
235
|
-
}
|
|
236
|
-
function resolvePageTitle(resolved, options = {}) {
|
|
237
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
238
|
-
const hasBinding = !!((_a = resolved.page) == null ? void 0 : _a.data_bindings) && Object.keys(resolved.page.data_bindings).length > 0;
|
|
239
|
-
const contextTitle = hasBinding ? contextPageTitle((_b = primaryPageContext(resolved.contexts)) == null ? void 0 : _b.ctx) : null;
|
|
240
|
-
const dynamicTitle = ((_c = options.override) == null ? void 0 : _c.trim()) || contextTitle;
|
|
241
|
-
if (dynamicTitle) return withSiteName(dynamicTitle, options.siteName);
|
|
242
|
-
if ((_e = (_d = resolved.page) == null ? void 0 : _d.meta_title) == null ? void 0 : _e.trim()) return resolved.page.meta_title.trim();
|
|
243
|
-
if ((_g = (_f = resolved.page) == null ? void 0 : _f.title) == null ? void 0 : _g.trim()) return withSiteName(resolved.page.title.trim(), options.siteName);
|
|
244
|
-
return null;
|
|
245
|
-
}
|
|
246
|
-
function preserveCurrentSiteSuffix(title, currentTitle) {
|
|
247
|
-
const separator = " · ";
|
|
248
|
-
const suffixIndex = currentTitle.lastIndexOf(separator);
|
|
249
|
-
if (suffixIndex < 0) return title;
|
|
250
|
-
const siteName = currentTitle.slice(suffixIndex + separator.length).trim();
|
|
251
|
-
return withSiteName(title, siteName);
|
|
252
|
-
}
|
|
205
|
+
exports.BLOX_API_KEY = BLOX_API_KEY;
|
|
253
206
|
exports.configureApi = configureApi;
|
|
254
|
-
exports.contextPageTitle = contextPageTitle;
|
|
255
207
|
exports.createBloxApi = createBloxApi;
|
|
256
208
|
exports.getCollectionResolver = getCollectionResolver;
|
|
257
209
|
exports.getItemById = getItemById;
|
|
@@ -260,12 +212,8 @@ exports.getWebsiteId = getWebsiteId;
|
|
|
260
212
|
exports.getWebsiteIdSync = getWebsiteIdSync;
|
|
261
213
|
exports.listItems = listItems;
|
|
262
214
|
exports.listItemsFromActiveApi = listItemsFromActiveApi;
|
|
263
|
-
exports.preserveCurrentSiteSuffix = preserveCurrentSiteSuffix;
|
|
264
|
-
exports.primaryPageContext = primaryPageContext;
|
|
265
215
|
exports.provideBloxApi = provideBloxApi;
|
|
266
|
-
exports.resolvePageTitle = resolvePageTitle;
|
|
267
216
|
exports.resolvePath = resolvePath;
|
|
268
217
|
exports.setApiOrigin = setApiOrigin;
|
|
269
218
|
exports.setCollectionResolver = setCollectionResolver;
|
|
270
|
-
exports.siteNameFromContexts = siteNameFromContexts;
|
|
271
219
|
exports.useBloxApi = useBloxApi;
|
|
@@ -200,73 +200,20 @@ function listItemsFromActiveApi(collection, options = {}) {
|
|
|
200
200
|
var _a;
|
|
201
201
|
return ((_a = useBloxApi()) == null ? void 0 : _a.listItems(collection, options)) ?? listItems(collection, options);
|
|
202
202
|
}
|
|
203
|
-
const PREFERRED_CONTEXT_KEYS = ["$page", "$post", "$item", "$article", "$product", "$event", "$author"];
|
|
204
|
-
const TITLE_FIELDS = ["meta_title", "metaTitle", "title", "name", "productName", "displayName"];
|
|
205
|
-
function primaryPageContext(contexts) {
|
|
206
|
-
if (!contexts) return null;
|
|
207
|
-
const keys = [
|
|
208
|
-
...PREFERRED_CONTEXT_KEYS.filter((key) => key in contexts),
|
|
209
|
-
...Object.keys(contexts).filter((key) => key !== "$website" && !PREFERRED_CONTEXT_KEYS.includes(key)).sort()
|
|
210
|
-
];
|
|
211
|
-
for (const key of keys) {
|
|
212
|
-
const ctx = contexts[key];
|
|
213
|
-
if (ctx != null && typeof ctx === "object") return { key, ctx };
|
|
214
|
-
}
|
|
215
|
-
return null;
|
|
216
|
-
}
|
|
217
|
-
function contextPageTitle(context) {
|
|
218
|
-
if (!context) return null;
|
|
219
|
-
for (const field of TITLE_FIELDS) {
|
|
220
|
-
const value = context[field];
|
|
221
|
-
if (typeof value === "string" && value.trim()) return value.trim();
|
|
222
|
-
}
|
|
223
|
-
return null;
|
|
224
|
-
}
|
|
225
|
-
function siteNameFromContexts(contexts) {
|
|
226
|
-
const website = contexts == null ? void 0 : contexts.$website;
|
|
227
|
-
const seo = website == null ? void 0 : website.seo;
|
|
228
|
-
const siteName = seo && typeof seo === "object" ? seo.site_name : website == null ? void 0 : website.site_name;
|
|
229
|
-
return typeof siteName === "string" && siteName.trim() ? siteName.trim() : null;
|
|
230
|
-
}
|
|
231
|
-
function withSiteName(title, siteName) {
|
|
232
|
-
if (!siteName || title.includes(siteName)) return title;
|
|
233
|
-
return `${title} · ${siteName}`;
|
|
234
|
-
}
|
|
235
|
-
function resolvePageTitle(resolved, options = {}) {
|
|
236
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
237
|
-
const hasBinding = !!((_a = resolved.page) == null ? void 0 : _a.data_bindings) && Object.keys(resolved.page.data_bindings).length > 0;
|
|
238
|
-
const contextTitle = hasBinding ? contextPageTitle((_b = primaryPageContext(resolved.contexts)) == null ? void 0 : _b.ctx) : null;
|
|
239
|
-
const dynamicTitle = ((_c = options.override) == null ? void 0 : _c.trim()) || contextTitle;
|
|
240
|
-
if (dynamicTitle) return withSiteName(dynamicTitle, options.siteName);
|
|
241
|
-
if ((_e = (_d = resolved.page) == null ? void 0 : _d.meta_title) == null ? void 0 : _e.trim()) return resolved.page.meta_title.trim();
|
|
242
|
-
if ((_g = (_f = resolved.page) == null ? void 0 : _f.title) == null ? void 0 : _g.trim()) return withSiteName(resolved.page.title.trim(), options.siteName);
|
|
243
|
-
return null;
|
|
244
|
-
}
|
|
245
|
-
function preserveCurrentSiteSuffix(title, currentTitle) {
|
|
246
|
-
const separator = " · ";
|
|
247
|
-
const suffixIndex = currentTitle.lastIndexOf(separator);
|
|
248
|
-
if (suffixIndex < 0) return title;
|
|
249
|
-
const siteName = currentTitle.slice(suffixIndex + separator.length).trim();
|
|
250
|
-
return withSiteName(title, siteName);
|
|
251
|
-
}
|
|
252
203
|
export {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
provideBloxApi as p,
|
|
269
|
-
resolvePageTitle as r,
|
|
270
|
-
setCollectionResolver as s,
|
|
271
|
-
useBloxApi as u
|
|
204
|
+
BLOX_API_KEY,
|
|
205
|
+
configureApi,
|
|
206
|
+
createBloxApi,
|
|
207
|
+
getCollectionResolver,
|
|
208
|
+
getItemById,
|
|
209
|
+
getItemBySlug,
|
|
210
|
+
getWebsiteId,
|
|
211
|
+
getWebsiteIdSync,
|
|
212
|
+
listItems,
|
|
213
|
+
listItemsFromActiveApi,
|
|
214
|
+
provideBloxApi,
|
|
215
|
+
resolvePath,
|
|
216
|
+
setApiOrigin,
|
|
217
|
+
setCollectionResolver,
|
|
218
|
+
useBloxApi
|
|
272
219
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-
|
|
5
|
-
const appRuntime = require("./appRuntime-
|
|
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-hkuLedAX.cjs");
|
|
5
|
+
const appRuntime = require("./appRuntime-BEqnYYLz.cjs");
|
|
6
6
|
const vue = require("vue");
|
|
7
7
|
const ssg_client = require("./client-AoDTJJXJ.cjs");
|
|
8
8
|
const vueRouter = require("vue-router");
|
|
@@ -186,7 +186,7 @@ function useBloxRuntime() {
|
|
|
186
186
|
function useContentSeo(item, head) {
|
|
187
187
|
const route = safeRoute();
|
|
188
188
|
const { locale } = appRuntime.useLocale();
|
|
189
|
-
const api =
|
|
189
|
+
const api = index.useBloxApi();
|
|
190
190
|
const strategy = vue.inject(appRuntime.BLOX_LOCALE_STRATEGY_KEY, null);
|
|
191
191
|
const registration = () => {
|
|
192
192
|
var _a;
|
|
@@ -208,7 +208,7 @@ function useContentSeo(item, head) {
|
|
|
208
208
|
const slug = String(((_a = route == null ? void 0 : route.params) == null ? void 0 : _a.slug) ?? ((_b = vue.toValue(item)) == null ? void 0 : _b.slug) ?? "");
|
|
209
209
|
const activeLoc = String(locale.value || "en").slice(0, 2).toLowerCase();
|
|
210
210
|
const activeItem = vue.toValue(item);
|
|
211
|
-
const entity = activeItem ?? (slug ? await ((api == null ? void 0 : api.getItemBySlug(reg.collection, slug, activeLoc)) ??
|
|
211
|
+
const entity = activeItem ?? (slug ? await ((api == null ? void 0 : api.getItemBySlug(reg.collection, slug, activeLoc)) ?? index.getItemBySlug(reg.collection, slug, activeLoc)).catch(() => null) : null);
|
|
212
212
|
if (!entity) return;
|
|
213
213
|
const id = String(entity.id ?? entity._id ?? "");
|
|
214
214
|
const supported = (strategy == null ? void 0 : strategy.locales) ?? [locale.value];
|
|
@@ -217,7 +217,7 @@ function useContentSeo(item, head) {
|
|
|
217
217
|
const built = {};
|
|
218
218
|
await Promise.all(locales.map(async (loc) => {
|
|
219
219
|
var _a2;
|
|
220
|
-
const locSlug = loc === activeLoc ? String(entity.slug ?? "") : String(((_a2 = await ((api == null ? void 0 : api.getItemById(reg.collection, id, loc)) ??
|
|
220
|
+
const locSlug = loc === activeLoc ? String(entity.slug ?? "") : String(((_a2 = await ((api == null ? void 0 : api.getItemById(reg.collection, id, loc)) ?? index.getItemById(reg.collection, id, loc)).catch(() => null)) == null ? void 0 : _a2.slug) ?? "");
|
|
221
221
|
if (locSlug) built[loc] = reg.route.replace(/:slug(?=\/|$)/, locSlug);
|
|
222
222
|
}));
|
|
223
223
|
if (Object.keys(built).length > 1) alternates = built;
|
|
@@ -287,7 +287,7 @@ function createBloxApp(options) {
|
|
|
287
287
|
render: () => vue.h(vue.Suspense, null, { default: () => vue.h(rootComponent) })
|
|
288
288
|
});
|
|
289
289
|
const dataRegistry = appRuntime.provideBloxData(app);
|
|
290
|
-
const api =
|
|
290
|
+
const api = index.provideBloxApi(app, { websiteName, store });
|
|
291
291
|
const localeState = appRuntime.provideBloxLocale(app, locale);
|
|
292
292
|
const blox = appRuntime.installBloxRuntime({
|
|
293
293
|
app,
|
|
@@ -413,18 +413,18 @@ function serializeRegistry(registry) {
|
|
|
413
413
|
function buildBloxManifest(blox) {
|
|
414
414
|
return serializeRegistry(blox.getRegistry());
|
|
415
415
|
}
|
|
416
|
-
exports.configureApi =
|
|
417
|
-
exports.createBloxApi =
|
|
418
|
-
exports.getCollectionResolver =
|
|
419
|
-
exports.getItemById =
|
|
420
|
-
exports.getItemBySlug =
|
|
421
|
-
exports.getWebsiteId =
|
|
422
|
-
exports.getWebsiteIdSync =
|
|
423
|
-
exports.listItems =
|
|
424
|
-
exports.resolvePath =
|
|
425
|
-
exports.setApiOrigin =
|
|
426
|
-
exports.setCollectionResolver =
|
|
427
|
-
exports.useBloxApi =
|
|
416
|
+
exports.configureApi = index.configureApi;
|
|
417
|
+
exports.createBloxApi = index.createBloxApi;
|
|
418
|
+
exports.getCollectionResolver = index.getCollectionResolver;
|
|
419
|
+
exports.getItemById = index.getItemById;
|
|
420
|
+
exports.getItemBySlug = index.getItemBySlug;
|
|
421
|
+
exports.getWebsiteId = index.getWebsiteId;
|
|
422
|
+
exports.getWebsiteIdSync = index.getWebsiteIdSync;
|
|
423
|
+
exports.listItems = index.listItems;
|
|
424
|
+
exports.resolvePath = index.resolvePath;
|
|
425
|
+
exports.setApiOrigin = index.setApiOrigin;
|
|
426
|
+
exports.setCollectionResolver = index.setCollectionResolver;
|
|
427
|
+
exports.useBloxApi = index.useBloxApi;
|
|
428
428
|
exports.PreviewApp = PreviewApp_vue_vue_type_style_index_0_lang._sfc_main;
|
|
429
429
|
exports.PreviewRenderer = PreviewApp_vue_vue_type_style_index_0_lang.PreviewRenderer;
|
|
430
430
|
exports.sendToEditor = PreviewApp_vue_vue_type_style_index_0_lang.sendToEditor;
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { _, P, s
|
|
4
|
-
import { f as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, e as BLOX_RUNTIME_KEY, g as useSeo, h as getRegistryData, j as getContentRoute, p as provideBloxData, b as provideBloxLocale, i as installBloxRuntime, s as setActiveLocale, k as installSmartLinks, l as consumePendingLocaleSwitch } from "./appRuntime-
|
|
5
|
-
import { _ as _2, m, o, q, t, v, w, x, y, P as P2, z, A, c, a as a2, C, D, E, F, G, H, I, J, K, L, M, r, N, O, Q, R } from "./appRuntime-
|
|
6
|
-
import { defineComponent, resolveComponent, openBlock, createBlock, withCtx, Transition, resolveDynamicComponent, inject, ref, watch, onMounted, onUnmounted, computed, onServerPrefetch, toValue, h
|
|
1
|
+
import { useBloxApi, getItemBySlug, getItemById, provideBloxApi } from "./index-I81QTzv-.js";
|
|
2
|
+
import { configureApi, createBloxApi, getCollectionResolver, getWebsiteId, getWebsiteIdSync, listItems, resolvePath, setApiOrigin, setCollectionResolver } from "./index-I81QTzv-.js";
|
|
3
|
+
import { _, P, s, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-BMOOTRxd.js";
|
|
4
|
+
import { f as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, n as normalizeLink, e as BLOX_RUNTIME_KEY, g as useSeo, h as getRegistryData, j as getContentRoute, p as provideBloxData, b as provideBloxLocale, i as installBloxRuntime, s as setActiveLocale, k as installSmartLinks, l as consumePendingLocaleSwitch } from "./appRuntime-DX9LWE5R.js";
|
|
5
|
+
import { _ as _2, m, o, q, t, v, w, x, y, P as P2, z, A, c, a as a2, C, D, E, F, G, H, I, J, K, L, M, r, N, O, Q, R } from "./appRuntime-DX9LWE5R.js";
|
|
6
|
+
import { defineComponent, resolveComponent, openBlock, createBlock, withCtx, Transition, resolveDynamicComponent, inject, ref, watch, onMounted, onUnmounted, computed, onServerPrefetch, toValue, h, Suspense, createSSRApp, createApp } from "vue";
|
|
7
7
|
import { r as readBloxHydration } from "./client-Ce9fRCGH.js";
|
|
8
8
|
import { useRouter, useRoute } from "vue-router";
|
|
9
9
|
const FORM_CONTROL_SELECTOR = "button, input, select, textarea, label, option";
|
|
@@ -212,7 +212,7 @@ function useContentSeo(item, head) {
|
|
|
212
212
|
if (!entity) return;
|
|
213
213
|
const id = String(entity.id ?? entity._id ?? "");
|
|
214
214
|
const supported = (strategy == null ? void 0 : strategy.locales) ?? [locale.value];
|
|
215
|
-
const locales = (Array.isArray(entity.available_locales) ? entity.available_locales : []).filter((
|
|
215
|
+
const locales = (Array.isArray(entity.available_locales) ? entity.available_locales : []).filter((l) => supported.includes(l));
|
|
216
216
|
if (!id || !locales.length) return;
|
|
217
217
|
const built = {};
|
|
218
218
|
await Promise.all(locales.map(async (loc) => {
|
|
@@ -284,7 +284,7 @@ function createBloxApp(options) {
|
|
|
284
284
|
const createVueApp = hasSsgState ? createSSRApp : createApp;
|
|
285
285
|
const app = createVueApp({
|
|
286
286
|
name: "BloxRoot",
|
|
287
|
-
render: () =>
|
|
287
|
+
render: () => h(Suspense, null, { default: () => h(rootComponent) })
|
|
288
288
|
});
|
|
289
289
|
const dataRegistry = provideBloxData(app);
|
|
290
290
|
const api = provideBloxApi(app, { websiteName, store });
|
|
@@ -370,7 +370,7 @@ function defineBlock(meta) {
|
|
|
370
370
|
}
|
|
371
371
|
function withLocaleRoutes(path, component, supportedLocales, defaultLocale = "en") {
|
|
372
372
|
const normalized = path.startsWith("/") ? path : `/${path}`;
|
|
373
|
-
const prefixed = supportedLocales.filter((
|
|
373
|
+
const prefixed = supportedLocales.filter((l) => l !== defaultLocale);
|
|
374
374
|
const make = (p) => ({ path: p, component });
|
|
375
375
|
const routes = [make(normalized)];
|
|
376
376
|
if (prefixed.length) {
|
|
@@ -434,22 +434,22 @@ export {
|
|
|
434
434
|
A as classifyLink,
|
|
435
435
|
c as collectBloxData,
|
|
436
436
|
a2 as collectBloxSeo,
|
|
437
|
-
|
|
437
|
+
configureApi,
|
|
438
438
|
C as contentRoutes,
|
|
439
439
|
D as createBlox,
|
|
440
|
-
|
|
440
|
+
createBloxApi,
|
|
441
441
|
createBloxApp,
|
|
442
442
|
defineBlock,
|
|
443
443
|
defineBloxSite,
|
|
444
444
|
E as defineContent,
|
|
445
445
|
F as generateContentRoutes,
|
|
446
|
-
|
|
446
|
+
getCollectionResolver,
|
|
447
447
|
getContentRoute,
|
|
448
448
|
G as getContentRouteByCollection,
|
|
449
449
|
getItemById,
|
|
450
450
|
getItemBySlug,
|
|
451
|
-
|
|
452
|
-
|
|
451
|
+
getWebsiteId,
|
|
452
|
+
getWebsiteIdSync,
|
|
453
453
|
injectPlausible,
|
|
454
454
|
H as installContentFallback,
|
|
455
455
|
installDocumentNavigation,
|
|
@@ -457,19 +457,19 @@ export {
|
|
|
457
457
|
I as isAbsoluteExternal,
|
|
458
458
|
J as isSoloContentPage,
|
|
459
459
|
K as isSpecialScheme,
|
|
460
|
-
|
|
460
|
+
listItems,
|
|
461
461
|
normalizeLink,
|
|
462
462
|
L as normalizeTo,
|
|
463
463
|
provideBloxData,
|
|
464
464
|
M as provideContentItem,
|
|
465
465
|
readBloxHydration,
|
|
466
466
|
r as resolveBlockProps,
|
|
467
|
-
|
|
468
|
-
|
|
467
|
+
resolvePath,
|
|
468
|
+
s as sendToEditor,
|
|
469
469
|
a as sendToPreview,
|
|
470
470
|
serializeRegistry,
|
|
471
|
-
|
|
472
|
-
|
|
471
|
+
setApiOrigin,
|
|
472
|
+
setCollectionResolver,
|
|
473
473
|
N as toInternalPath,
|
|
474
474
|
useBloxApi,
|
|
475
475
|
O as useBloxEdit,
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const PREFERRED_CONTEXT_KEYS = ["$page", "$post", "$item", "$article", "$product", "$event", "$author"];
|
|
2
|
+
const TITLE_FIELDS = ["meta_title", "metaTitle", "title", "name", "productName", "displayName"];
|
|
3
|
+
function primaryPageContext(contexts) {
|
|
4
|
+
if (!contexts) return null;
|
|
5
|
+
const keys = [
|
|
6
|
+
...PREFERRED_CONTEXT_KEYS.filter((key) => key in contexts),
|
|
7
|
+
...Object.keys(contexts).filter((key) => key !== "$website" && !PREFERRED_CONTEXT_KEYS.includes(key)).sort()
|
|
8
|
+
];
|
|
9
|
+
for (const key of keys) {
|
|
10
|
+
const ctx = contexts[key];
|
|
11
|
+
if (ctx != null && typeof ctx === "object") return { key, ctx };
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
function contextPageTitle(context) {
|
|
16
|
+
if (!context) return null;
|
|
17
|
+
for (const field of TITLE_FIELDS) {
|
|
18
|
+
const value = context[field];
|
|
19
|
+
if (typeof value === "string" && value.trim()) return value.trim();
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
function siteNameFromContexts(contexts) {
|
|
24
|
+
const website = contexts == null ? void 0 : contexts.$website;
|
|
25
|
+
const seo = website == null ? void 0 : website.seo;
|
|
26
|
+
const siteName = seo && typeof seo === "object" ? seo.site_name : website == null ? void 0 : website.site_name;
|
|
27
|
+
return typeof siteName === "string" && siteName.trim() ? siteName.trim() : null;
|
|
28
|
+
}
|
|
29
|
+
function withSiteName(title, siteName) {
|
|
30
|
+
if (!siteName || title.includes(siteName)) return title;
|
|
31
|
+
return `${title} · ${siteName}`;
|
|
32
|
+
}
|
|
33
|
+
function resolvePageTitle(resolved, options = {}) {
|
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
35
|
+
const hasBinding = !!((_a = resolved.page) == null ? void 0 : _a.data_bindings) && Object.keys(resolved.page.data_bindings).length > 0;
|
|
36
|
+
const contextTitle = hasBinding ? contextPageTitle((_b = primaryPageContext(resolved.contexts)) == null ? void 0 : _b.ctx) : null;
|
|
37
|
+
const dynamicTitle = ((_c = options.override) == null ? void 0 : _c.trim()) || contextTitle;
|
|
38
|
+
if (dynamicTitle) return withSiteName(dynamicTitle, options.siteName);
|
|
39
|
+
if ((_e = (_d = resolved.page) == null ? void 0 : _d.meta_title) == null ? void 0 : _e.trim()) return resolved.page.meta_title.trim();
|
|
40
|
+
if ((_g = (_f = resolved.page) == null ? void 0 : _f.title) == null ? void 0 : _g.trim()) return withSiteName(resolved.page.title.trim(), options.siteName);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
function preserveCurrentSiteSuffix(title, currentTitle) {
|
|
44
|
+
const separator = " · ";
|
|
45
|
+
const suffixIndex = currentTitle.lastIndexOf(separator);
|
|
46
|
+
if (suffixIndex < 0) return title;
|
|
47
|
+
const siteName = currentTitle.slice(suffixIndex + separator.length).trim();
|
|
48
|
+
return withSiteName(title, siteName);
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
preserveCurrentSiteSuffix as a,
|
|
52
|
+
contextPageTitle as c,
|
|
53
|
+
primaryPageContext as p,
|
|
54
|
+
resolvePageTitle as r,
|
|
55
|
+
siteNameFromContexts as s
|
|
56
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const PREFERRED_CONTEXT_KEYS = ["$page", "$post", "$item", "$article", "$product", "$event", "$author"];
|
|
3
|
+
const TITLE_FIELDS = ["meta_title", "metaTitle", "title", "name", "productName", "displayName"];
|
|
4
|
+
function primaryPageContext(contexts) {
|
|
5
|
+
if (!contexts) return null;
|
|
6
|
+
const keys = [
|
|
7
|
+
...PREFERRED_CONTEXT_KEYS.filter((key) => key in contexts),
|
|
8
|
+
...Object.keys(contexts).filter((key) => key !== "$website" && !PREFERRED_CONTEXT_KEYS.includes(key)).sort()
|
|
9
|
+
];
|
|
10
|
+
for (const key of keys) {
|
|
11
|
+
const ctx = contexts[key];
|
|
12
|
+
if (ctx != null && typeof ctx === "object") return { key, ctx };
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
function contextPageTitle(context) {
|
|
17
|
+
if (!context) return null;
|
|
18
|
+
for (const field of TITLE_FIELDS) {
|
|
19
|
+
const value = context[field];
|
|
20
|
+
if (typeof value === "string" && value.trim()) return value.trim();
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function siteNameFromContexts(contexts) {
|
|
25
|
+
const website = contexts == null ? void 0 : contexts.$website;
|
|
26
|
+
const seo = website == null ? void 0 : website.seo;
|
|
27
|
+
const siteName = seo && typeof seo === "object" ? seo.site_name : website == null ? void 0 : website.site_name;
|
|
28
|
+
return typeof siteName === "string" && siteName.trim() ? siteName.trim() : null;
|
|
29
|
+
}
|
|
30
|
+
function withSiteName(title, siteName) {
|
|
31
|
+
if (!siteName || title.includes(siteName)) return title;
|
|
32
|
+
return `${title} · ${siteName}`;
|
|
33
|
+
}
|
|
34
|
+
function resolvePageTitle(resolved, options = {}) {
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
36
|
+
const hasBinding = !!((_a = resolved.page) == null ? void 0 : _a.data_bindings) && Object.keys(resolved.page.data_bindings).length > 0;
|
|
37
|
+
const contextTitle = hasBinding ? contextPageTitle((_b = primaryPageContext(resolved.contexts)) == null ? void 0 : _b.ctx) : null;
|
|
38
|
+
const dynamicTitle = ((_c = options.override) == null ? void 0 : _c.trim()) || contextTitle;
|
|
39
|
+
if (dynamicTitle) return withSiteName(dynamicTitle, options.siteName);
|
|
40
|
+
if ((_e = (_d = resolved.page) == null ? void 0 : _d.meta_title) == null ? void 0 : _e.trim()) return resolved.page.meta_title.trim();
|
|
41
|
+
if ((_g = (_f = resolved.page) == null ? void 0 : _f.title) == null ? void 0 : _g.trim()) return withSiteName(resolved.page.title.trim(), options.siteName);
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
function preserveCurrentSiteSuffix(title, currentTitle) {
|
|
45
|
+
const separator = " · ";
|
|
46
|
+
const suffixIndex = currentTitle.lastIndexOf(separator);
|
|
47
|
+
if (suffixIndex < 0) return title;
|
|
48
|
+
const siteName = currentTitle.slice(suffixIndex + separator.length).trim();
|
|
49
|
+
return withSiteName(title, siteName);
|
|
50
|
+
}
|
|
51
|
+
exports.contextPageTitle = contextPageTitle;
|
|
52
|
+
exports.preserveCurrentSiteSuffix = preserveCurrentSiteSuffix;
|
|
53
|
+
exports.primaryPageContext = primaryPageContext;
|
|
54
|
+
exports.resolvePageTitle = resolvePageTitle;
|
|
55
|
+
exports.siteNameFromContexts = siteNameFromContexts;
|
|
@@ -26,7 +26,7 @@ const node_child_process = require("node:child_process");
|
|
|
26
26
|
const os = require("node:os");
|
|
27
27
|
const path = require("node:path");
|
|
28
28
|
const process = require("node:process");
|
|
29
|
-
const llmArtifacts = require("./validate-output-
|
|
29
|
+
const llmArtifacts = require("./validate-output-Dmc7_eXo.cjs");
|
|
30
30
|
const AUTO_SHARD_CAP = Number(process.env.BLOX_SSG_SHARD_CAP) || 6;
|
|
31
31
|
const PREFETCH_BUDGET = Number(process.env.BLOX_SSG_PREFETCH_BUDGET) || 24;
|
|
32
32
|
const SEQUENTIAL_SHARDS = process.env.BLOX_SSG_SEQUENTIAL === "1";
|
|
@@ -166,7 +166,7 @@ async function runSharded(opts) {
|
|
|
166
166
|
}
|
|
167
167
|
if (process.env.BLOX_SSG_LLM !== "0") {
|
|
168
168
|
try {
|
|
169
|
-
const { mergeLlmParts } = await Promise.resolve().then(() => require("./validate-output-
|
|
169
|
+
const { mergeLlmParts } = await Promise.resolve().then(() => require("./validate-output-Dmc7_eXo.cjs")).then((n) => n.llmArtifacts);
|
|
170
170
|
const mergeWebsite = website;
|
|
171
171
|
const partFiles = Array.from({ length: total }, (_, i) => path.join(llmPartsDir, `part.${i}.json`));
|
|
172
172
|
const { pages } = await mergeLlmParts({
|
|
@@ -2,7 +2,7 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
5
|
-
import { f as fetchCmsSiteData, g as generateSitemapArtifacts } from "./validate-output-
|
|
5
|
+
import { f as fetchCmsSiteData, g as generateSitemapArtifacts } from "./validate-output-9_ibeTgY.js";
|
|
6
6
|
const AUTO_SHARD_CAP = Number(process.env.BLOX_SSG_SHARD_CAP) || 6;
|
|
7
7
|
const PREFETCH_BUDGET = Number(process.env.BLOX_SSG_PREFETCH_BUDGET) || 24;
|
|
8
8
|
const SEQUENTIAL_SHARDS = process.env.BLOX_SSG_SEQUENTIAL === "1";
|
|
@@ -142,7 +142,7 @@ async function runSharded(opts) {
|
|
|
142
142
|
}
|
|
143
143
|
if (process.env.BLOX_SSG_LLM !== "0") {
|
|
144
144
|
try {
|
|
145
|
-
const { mergeLlmParts } = await import("./validate-output-
|
|
145
|
+
const { mergeLlmParts } = await import("./validate-output-9_ibeTgY.js").then((n) => n.A);
|
|
146
146
|
const mergeWebsite = website;
|
|
147
147
|
const partFiles = Array.from({ length: total }, (_, i) => path.join(llmPartsDir, `part.${i}.json`));
|
|
148
148
|
const { pages } = await mergeLlmParts({
|
package/dist/ssg/cli.cjs
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
const process = require("node:process");
|
|
4
4
|
const fs = require("node:fs/promises");
|
|
5
5
|
const ssg_buildGrant = require("./build-grant.cjs");
|
|
6
|
-
const llmArtifacts = require("../validate-output-
|
|
7
|
-
const pageTitle = require("../pageTitle-Dh_UoICu.cjs");
|
|
6
|
+
const llmArtifacts = require("../validate-output-Dmc7_eXo.cjs");
|
|
8
7
|
function installFetchTimeout() {
|
|
9
8
|
const ms = Number(process.env.BLOX_SSG_FETCH_TIMEOUT_MS) || 2e4;
|
|
10
9
|
const original = globalThis.fetch;
|
|
@@ -142,7 +141,7 @@ Environment:
|
|
|
142
141
|
if (shardsOpt !== null || routesCmd) {
|
|
143
142
|
const { apiBase: apiBase2, websiteName: configWebsiteName2 } = await resolveApiBase(mode);
|
|
144
143
|
const websiteName2 = process.env.WEBSITE_NAME ?? configWebsiteName2 ?? "default";
|
|
145
|
-
const { runSharded } = await Promise.resolve().then(() => require("../shard-runner-
|
|
144
|
+
const { runSharded } = await Promise.resolve().then(() => require("../shard-runner-BSoIApcl.cjs"));
|
|
146
145
|
const code = await runSharded({
|
|
147
146
|
shards: shardsOpt ?? "auto",
|
|
148
147
|
mode,
|
|
@@ -168,6 +167,7 @@ Environment:
|
|
|
168
167
|
}
|
|
169
168
|
const { apiBase, websiteName: configWebsiteName } = await resolveApiBase(mode);
|
|
170
169
|
await llmArtifacts.polyfillBloxSsgGlobals({ pageUrl: apiBase });
|
|
170
|
+
const { setCollectionResolver } = await Promise.resolve().then(() => require("../index-DUjEj7ts.cjs"));
|
|
171
171
|
const websiteName = process.env.WEBSITE_NAME ?? configWebsiteName ?? "default";
|
|
172
172
|
console.log(siteDataFile ? `Loading cached site routes (mode: ${mode}, site: ${websiteName})…` : `Fetching routes from ${apiBase} (mode: ${mode}, site: ${websiteName})…`);
|
|
173
173
|
let paths = [];
|
|
@@ -197,7 +197,7 @@ Environment:
|
|
|
197
197
|
paths = ["/"];
|
|
198
198
|
}
|
|
199
199
|
if (collectionItems && Object.keys(collectionItems).length > 0) {
|
|
200
|
-
|
|
200
|
+
setCollectionResolver(llmArtifacts.buildCollectionResolver(collectionItems));
|
|
201
201
|
}
|
|
202
202
|
for (const p of extraPaths) {
|
|
203
203
|
if (!paths.includes(p)) paths.push(p);
|
package/dist/ssg/cli.mjs
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import { resolveBloxBuildGrant } from "./build-grant.mjs";
|
|
5
|
-
import { v as validateSsgOutput, u as uploadBloxManifest, p as polyfillBloxSsgGlobals, f as fetchCmsSiteData,
|
|
6
|
-
import { s as setCollectionResolver } from "../pageTitle-BUVrac-4.js";
|
|
5
|
+
import { v as validateSsgOutput, u as uploadBloxManifest, p as polyfillBloxSsgGlobals, f as fetchCmsSiteData, b as buildCollectionResolver, a as prerender } from "../validate-output-9_ibeTgY.js";
|
|
7
6
|
function installFetchTimeout() {
|
|
8
7
|
const ms = Number(process.env.BLOX_SSG_FETCH_TIMEOUT_MS) || 2e4;
|
|
9
8
|
const original = globalThis.fetch;
|
|
@@ -141,7 +140,7 @@ Environment:
|
|
|
141
140
|
if (shardsOpt !== null || routesCmd) {
|
|
142
141
|
const { apiBase: apiBase2, websiteName: configWebsiteName2 } = await resolveApiBase(mode);
|
|
143
142
|
const websiteName2 = process.env.WEBSITE_NAME ?? configWebsiteName2 ?? "default";
|
|
144
|
-
const { runSharded } = await import("../shard-runner-
|
|
143
|
+
const { runSharded } = await import("../shard-runner-C962Vua3.js");
|
|
145
144
|
const code = await runSharded({
|
|
146
145
|
shards: shardsOpt ?? "auto",
|
|
147
146
|
mode,
|
|
@@ -167,6 +166,7 @@ Environment:
|
|
|
167
166
|
}
|
|
168
167
|
const { apiBase, websiteName: configWebsiteName } = await resolveApiBase(mode);
|
|
169
168
|
await polyfillBloxSsgGlobals({ pageUrl: apiBase });
|
|
169
|
+
const { setCollectionResolver } = await import("../index-I81QTzv-.js");
|
|
170
170
|
const websiteName = process.env.WEBSITE_NAME ?? configWebsiteName ?? "default";
|
|
171
171
|
console.log(siteDataFile ? `Loading cached site routes (mode: ${mode}, site: ${websiteName})…` : `Fetching routes from ${apiBase} (mode: ${mode}, site: ${websiteName})…`);
|
|
172
172
|
let paths = [];
|
package/dist/ssg/index.cjs
CHANGED
|
@@ -22,12 +22,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
24
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
25
|
-
const llmArtifacts = require("../validate-output-
|
|
25
|
+
const llmArtifacts = require("../validate-output-Dmc7_eXo.cjs");
|
|
26
26
|
const ssg_buildGrant = require("./build-grant.cjs");
|
|
27
27
|
const ssg_client = require("../client-AoDTJJXJ.cjs");
|
|
28
28
|
const vue = require("vue");
|
|
29
|
-
const appRuntime = require("../appRuntime-
|
|
30
|
-
const
|
|
29
|
+
const appRuntime = require("../appRuntime-BEqnYYLz.cjs");
|
|
30
|
+
const index = require("../index-DUjEj7ts.cjs");
|
|
31
31
|
async function renderBloxSsgPage(options) {
|
|
32
32
|
var _a, _b, _c, _d;
|
|
33
33
|
const {
|
|
@@ -134,7 +134,7 @@ function templateParams(template, slug) {
|
|
|
134
134
|
});
|
|
135
135
|
const match = slug.match(new RegExp(`^${pattern}$`));
|
|
136
136
|
if (!match) return null;
|
|
137
|
-
return Object.fromEntries(names.map((name,
|
|
137
|
+
return Object.fromEntries(names.map((name, index2) => [name, match[index2 + 1]]));
|
|
138
138
|
}
|
|
139
139
|
function bindingParam(params, bindBy) {
|
|
140
140
|
if (params[bindBy]) return { name: bindBy, value: params[bindBy] };
|
|
@@ -254,7 +254,7 @@ function createBloxSSREntry(options) {
|
|
|
254
254
|
publishedBundleCache.set(cacheKey, pending);
|
|
255
255
|
}
|
|
256
256
|
const bundle = await pending;
|
|
257
|
-
const activeResolver = options.collectionResolver ??
|
|
257
|
+
const activeResolver = options.collectionResolver ?? index.getCollectionResolver() ?? void 0;
|
|
258
258
|
const resolved = await resolvePublishedPage(
|
|
259
259
|
bundle.pages,
|
|
260
260
|
slug,
|
|
@@ -282,11 +282,11 @@ function createBloxSSREntry(options) {
|
|
|
282
282
|
render: () => vue.h(vue.Suspense, null, { default: () => vue.h(rootComponent) })
|
|
283
283
|
});
|
|
284
284
|
const dataRegistry = appRuntime.provideBloxData(app, { server: true });
|
|
285
|
-
const api =
|
|
285
|
+
const api = index.provideBloxApi(app, {
|
|
286
286
|
websiteName,
|
|
287
287
|
store,
|
|
288
288
|
origin: apiBase,
|
|
289
|
-
collectionResolver: options.collectionResolver ??
|
|
289
|
+
collectionResolver: options.collectionResolver ?? index.getCollectionResolver()
|
|
290
290
|
});
|
|
291
291
|
const localeState = appRuntime.provideBloxLocale(app, pageLocale);
|
|
292
292
|
app.provide(appRuntime.BLOX_SSR_ROUTE_STATE_KEY, {
|
package/dist/ssg/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as buildPageHead, d as primaryContextEntry, e as buildJsonLd, h as extractPageText, B as BloxBuildResponseError, i as bloxBuildJson } from "../validate-output-
|
|
2
|
-
import { j, k, f, l, m, n, o, g, q, r, s, t, w, x, p, a, y, z, u, v } from "../validate-output-
|
|
1
|
+
import { c as buildPageHead, d as primaryContextEntry, e as buildJsonLd, h as extractPageText, B as BloxBuildResponseError, i as bloxBuildJson } from "../validate-output-9_ibeTgY.js";
|
|
2
|
+
import { j, k, f, l, m, n, o, g, q, r, s, t, w, x, p, a, y, z, u, v } from "../validate-output-9_ibeTgY.js";
|
|
3
3
|
import { parseBloxBuildGrantBody, resolveBloxBuildGrant } from "./build-grant.mjs";
|
|
4
4
|
import { a as BLOX_HYDRATION_WINDOW_KEY } from "../client-Ce9fRCGH.js";
|
|
5
5
|
import { createSSRApp, h, Suspense } from "vue";
|
|
6
|
-
import { c as collectBloxData, a as collectBloxSeo, p as provideBloxData, b as provideBloxLocale, B as BLOX_SSR_ROUTE_STATE_KEY, i as installBloxRuntime, s as setActiveLocale } from "../appRuntime-
|
|
7
|
-
import {
|
|
6
|
+
import { c as collectBloxData, a as collectBloxSeo, p as provideBloxData, b as provideBloxLocale, B as BLOX_SSR_ROUTE_STATE_KEY, i as installBloxRuntime, s as setActiveLocale } from "../appRuntime-DX9LWE5R.js";
|
|
7
|
+
import { provideBloxApi, getCollectionResolver } from "../index-I81QTzv-.js";
|
|
8
8
|
async function renderBloxSsgPage(options) {
|
|
9
9
|
var _a, _b, _c, _d;
|
|
10
10
|
const {
|
|
@@ -3,7 +3,7 @@ import fs, { readFile } from "node:fs/promises";
|
|
|
3
3
|
import path, { resolve } from "node:path";
|
|
4
4
|
import process$1 from "node:process";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
|
-
import { r as resolvePageTitle,
|
|
6
|
+
import { r as resolvePageTitle, p as primaryPageContext, c as contextPageTitle } from "./pageTitle-BOTMH-D8.js";
|
|
7
7
|
class BloxBuildResponseError extends Error {
|
|
8
8
|
constructor(status, url, statusText) {
|
|
9
9
|
super(`Build API ${status} ${statusText}: ${url}`);
|
|
@@ -26,7 +26,7 @@ const fs = require("node:fs/promises");
|
|
|
26
26
|
const path = require("node:path");
|
|
27
27
|
const process$1 = require("node:process");
|
|
28
28
|
const node_url = require("node:url");
|
|
29
|
-
const pageTitle = require("./pageTitle-
|
|
29
|
+
const pageTitle = require("./pageTitle-nIl1cDfD.cjs");
|
|
30
30
|
class BloxBuildResponseError extends Error {
|
|
31
31
|
constructor(status, url, statusText) {
|
|
32
32
|
super(`Build API ${status} ${statusText}: ${url}`);
|
package/package.json
CHANGED