@bagelink/blox 1.15.629 → 1.15.633

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.
Files changed (31) hide show
  1. package/dist/{PreviewApp-5XGQVrnd.cjs → PreviewApp-BtQBgxxJ.cjs} +1 -1
  2. package/dist/{PreviewApp-DcD_Cjzn.js → PreviewApp-D7nTn843.js} +1 -1
  3. package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-OZtgkMXq.cjs → PreviewApp.vue_vue_type_style_index_0_lang-BGQBi7kZ.cjs} +1 -1
  4. package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-m2TIr6Wk.js → PreviewApp.vue_vue_type_style_index_0_lang-DDqfNEdN.js} +1 -1
  5. package/dist/api/index.d.ts +3 -1
  6. package/dist/api/index.d.ts.map +1 -1
  7. package/dist/{appRuntime-FphnGcV2.js → appRuntime-MDr0X5u0.js} +38 -235
  8. package/dist/{appRuntime-BqvP0NaP.cjs → appRuntime-Zt_fH0wN.cjs} +13 -210
  9. package/dist/{client-XQnL-B6N.js → client-Ce9fRCGH.js} +2 -2
  10. package/dist/index.cjs +23 -19
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.mjs +52 -47
  14. package/dist/pageTitle-BUVrac-4.js +272 -0
  15. package/dist/pageTitle-Dh_UoICu.cjs +271 -0
  16. package/dist/{shard-runner-C7_xAkA1.js → shard-runner-Cv5Cjm1f.js} +2 -2
  17. package/dist/{shard-runner-CinJMC5z.cjs → shard-runner-JbXPS_Dl.cjs} +2 -2
  18. package/dist/ssg/cli.cjs +8 -2
  19. package/dist/ssg/cli.mjs +8 -2
  20. package/dist/ssg/client.mjs +2 -2
  21. package/dist/ssg/cms-routes.d.ts +23 -0
  22. package/dist/ssg/cms-routes.d.ts.map +1 -1
  23. package/dist/ssg/createSSREntry.d.ts +1 -1
  24. package/dist/ssg/createSSREntry.d.ts.map +1 -1
  25. package/dist/ssg/index.cjs +9 -7
  26. package/dist/ssg/index.mjs +24 -22
  27. package/dist/{validate-output-DQTw64Rc.cjs → validate-output-CgOarPEF.cjs} +25 -4
  28. package/dist/{validate-output-e0E998g_.js → validate-output-ClPMepYU.js} +45 -24
  29. package/package.json +1 -1
  30. package/dist/pageTitle-BOTMH-D8.js +0 -56
  31. package/dist/pageTitle-nIl1cDfD.cjs +0 -55
@@ -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-OZtgkMXq.cjs");
3
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-BGQBi7kZ.cjs");
4
4
  exports.default = PreviewApp_vue_vue_type_style_index_0_lang._sfc_main;
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-m2TIr6Wk.js";
1
+ import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-DDqfNEdN.js";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const vue = require("vue");
3
- const appRuntime = require("./appRuntime-BqvP0NaP.cjs");
3
+ const appRuntime = require("./appRuntime-Zt_fH0wN.cjs");
4
4
  function sendToEditor(msg) {
5
5
  window.parent.postMessage(cloneForPostMessage(msg), "*");
6
6
  }
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, inject, ref, h, provide, onMounted, onUnmounted, openBlock, createElementBlock, createVNode, unref, nextTick } from "vue";
2
- import { e as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, f as BLOX_RUNTIME_KEY } from "./appRuntime-FphnGcV2.js";
2
+ import { d as BLOX_REGISTRY_KEY, r as resolveBlockProps, u as useLocale, e as BLOX_RUNTIME_KEY } from "./appRuntime-MDr0X5u0.js";
3
3
  function sendToEditor(msg) {
4
4
  window.parent.postMessage(cloneForPostMessage(msg), "*");
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import { CollectionItemsPage, PageResolveRead } from './types';
2
2
  import { App, InjectionKey } from 'vue';
3
- type CollectionResolver = (collection: string, options: ListItemsOptions) => Promise<Array<Record<string, unknown>>>;
3
+ type CollectionResolver = (collection: string, options: ListItemsOptions) => Promise<Array<Record<string, unknown>> | null>;
4
4
  export interface BloxApiOptions {
5
5
  websiteName: string;
6
6
  store: string;
@@ -27,6 +27,8 @@ export declare function configureApi(websiteName: string, store: string): void;
27
27
  export declare function setApiOrigin(base: string): void;
28
28
  /** Use an immutable build-time collection source instead of HTTP during SSR. */
29
29
  export declare function setCollectionResolver(resolver: CollectionResolver | null): void;
30
+ /** Read the active build-time collection resolver (SSG bulk-loaded data). */
31
+ export declare function getCollectionResolver(): CollectionResolver | null;
30
32
  export declare function createBloxApi(options: BloxApiOptions): BloxApiClient;
31
33
  export declare function provideBloxApi(app: App, options: BloxApiOptions): BloxApiClient;
32
34
  export declare function useBloxApi(): BloxApiClient | null;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAoB,MAAM,SAAS,CAAA;AACrF,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAc5C,KAAK,kBAAkB,GAAG,CACzB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,gBAAgB,KACrB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;AAG5C,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kBAAkB,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAA;CAC9C;AAED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MAAM,WAAW,gBAAgB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED,wBAAsB,SAAS,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1D,UAAU,EAAE,MAAM,EAClB,EAAE,MAAM,EAAE,CAAC,EAAE,MAAU,EAAE,KAAW,EAAE,GAAE,gBAAqB,GAC3D,OAAO,CAAC,mBAAmB,GAAG;IAAE,KAAK,EAAE,CAAC,EAAE,CAAA;CAAE,CAAC,CAQ/C;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9D,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAMnB;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5D,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAOnB;AAED,wBAAgB,sBAAsB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjE,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,gBAAqB,GAC5B,OAAO,CAAC,mBAAmB,GAAG;IAAE,KAAK,EAAE,CAAC,EAAE,CAAA;CAAE,CAAC,CAE/C"}
@@ -2,197 +2,11 @@ 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 { createPinia } from "pinia";
5
- import { getCurrentInstance, inject, computed, ref, defineComponent, onMounted, unref, openBlock, createElementBlock, createElementVNode, createCommentVNode, h, provide, watch, resolveComponent, toDisplayString, createVNode, withCtx, createTextVNode, Fragment, createBlock, shallowRef, onServerPrefetch, toValue, markRaw, resolveDynamicComponent } from "vue";
6
- import { a as BLOX_WEBSITE_ID_WINDOW_KEY, r as readBloxHydration } from "./client-XQnL-B6N.js";
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 { u as useBloxApi, i as getWebsiteIdSync, h as getWebsiteId, r as resolvePageTitle, m as siteNameFromContexts, j as resolvePath, n as preserveCurrentSiteSuffix, e as configureApi, o as listItemsFromActiveApi, b as getItemBySlug, d as getItemById } from "./pageTitle-BUVrac-4.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";
10
- let BASE = "/api";
11
- let _websiteName = "";
12
- let _store = "";
13
- let _websiteId = null;
14
- let _origin = "";
15
- const BLOX_API_KEY = Symbol("blox:api");
16
- function configureApi(websiteName, store) {
17
- _websiteName = websiteName;
18
- _store = store;
19
- _websiteId = null;
20
- }
21
- function setApiOrigin(base) {
22
- if (!base) return;
23
- try {
24
- const u = new URL(base);
25
- _origin = u.origin;
26
- BASE = u.pathname && u.pathname !== "/" ? u.pathname.replace(/\/$/, "") : "";
27
- } catch {
28
- }
29
- }
30
- function apiBase(base = "/api", origin = "") {
31
- if (!origin) return { base, origin };
32
- try {
33
- const url = new URL(origin);
34
- return {
35
- origin: url.origin,
36
- base: url.pathname && url.pathname !== "/" ? url.pathname.replace(/\/$/, "") : ""
37
- };
38
- } catch {
39
- return { base, origin: "" };
40
- }
41
- }
42
- function createBloxApi(options) {
43
- const configured = apiBase("/api", options.origin);
44
- let websiteId = null;
45
- async function scopedRequest(path, { locale: locale2, params, ...opts } = {}) {
46
- const origin = configured.origin || (typeof window !== "undefined" ? window.location.origin : "");
47
- const url = new URL(`${configured.base}${path}`, origin || void 0);
48
- if (locale2) url.searchParams.set("locale", locale2);
49
- if (params) {
50
- for (const [key, value] of Object.entries(params)) url.searchParams.set(key, String(value));
51
- }
52
- const response = await fetch(url.toString(), opts);
53
- if (!response.ok) throw new Error(`API ${response.status}: ${path}`);
54
- if (response.status === 204) return null;
55
- return response.json();
56
- }
57
- function getWebsiteIdSync2() {
58
- var _a;
59
- if (websiteId) return websiteId;
60
- return ((_a = readBloxHydration()) == null ? void 0 : _a.websiteId) ?? null;
61
- }
62
- async function getWebsiteId2() {
63
- const existing = getWebsiteIdSync2();
64
- if (existing) {
65
- websiteId = existing;
66
- return existing;
67
- }
68
- try {
69
- const website = await scopedRequest(
70
- `/blox/sites/${encodeURIComponent(options.websiteName)}`
71
- );
72
- websiteId = website.id;
73
- return website.id;
74
- } catch {
75
- throw new Error(`Website "${options.websiteName}" not found. Run: npm run seed`);
76
- }
77
- }
78
- async function listItems2(collection, { locale: locale2, q, offset = 0, limit = 100 } = {}) {
79
- if (options.collectionResolver) {
80
- return await options.collectionResolver(collection, {
81
- locale: locale2,
82
- q,
83
- offset,
84
- limit
85
- });
86
- }
87
- return scopedRequest(`/datastore/${options.store}/collections/${collection}`, {
88
- locale: locale2,
89
- params: { ...q ? { q } : {}, offset, limit }
90
- });
91
- }
92
- return {
93
- getWebsiteIdSync: getWebsiteIdSync2,
94
- getWebsiteId: getWebsiteId2,
95
- resolvePath: async (path, locale2) => {
96
- const id = await getWebsiteId2();
97
- return scopedRequest(`/blox/websites/${id}/resolve-path`, {
98
- locale: locale2,
99
- params: { path }
100
- });
101
- },
102
- listItems: listItems2,
103
- getItemBySlug: async (collection, slug, locale2) => {
104
- const result = await listItems2(collection, { locale: locale2, limit: 1e3 });
105
- const items = Array.isArray(result) ? result : (result == null ? void 0 : result.items) ?? [];
106
- return items.find((item) => String((item == null ? void 0 : item.slug) ?? "") === slug) ?? null;
107
- },
108
- getItemById: async (collection, id, locale2) => {
109
- const result = await listItems2(collection, { locale: locale2, limit: 1e3 });
110
- const items = Array.isArray(result) ? result : (result == null ? void 0 : result.items) ?? [];
111
- return items.find((item) => {
112
- const record = item;
113
- return String((record == null ? void 0 : record.id) ?? (record == null ? void 0 : record._id) ?? "") === id;
114
- }) ?? null;
115
- }
116
- };
117
- }
118
- function provideBloxApi(app, options) {
119
- const client = createBloxApi(options);
120
- app.provide(BLOX_API_KEY, client);
121
- return client;
122
- }
123
- function useBloxApi() {
124
- return getCurrentInstance() ? inject(BLOX_API_KEY, null) : null;
125
- }
126
- async function request(path, { locale: locale2, params, ...opts } = {}) {
127
- const origin = _origin || (typeof window !== "undefined" ? window.location.origin : "");
128
- const url = new URL(`${BASE}${path}`, origin || void 0);
129
- if (locale2) url.searchParams.set("locale", locale2);
130
- if (params) {
131
- for (const [k, v] of Object.entries(params)) url.searchParams.set(k, String(v));
132
- }
133
- const res = await fetch(url.toString(), opts);
134
- if (!res.ok) throw new Error(`API ${res.status}: ${path}`);
135
- if (res.status === 204) return null;
136
- return res.json();
137
- }
138
- function getWebsiteIdSync() {
139
- if (_websiteId) return _websiteId;
140
- if (typeof window !== "undefined") {
141
- const embedded = window[BLOX_WEBSITE_ID_WINDOW_KEY];
142
- if (typeof embedded === "string" && embedded !== "") return embedded;
143
- }
144
- return null;
145
- }
146
- async function getWebsiteId() {
147
- if (_websiteId) return _websiteId;
148
- if (typeof window !== "undefined") {
149
- const embedded = window[BLOX_WEBSITE_ID_WINDOW_KEY];
150
- if (typeof embedded === "string" && embedded !== "") {
151
- _websiteId = embedded;
152
- return _websiteId;
153
- }
154
- }
155
- let website;
156
- try {
157
- website = await request(
158
- `/blox/sites/${encodeURIComponent(_websiteName)}`
159
- );
160
- } catch {
161
- throw new Error(`Website "${_websiteName}" not found. Run: npm run seed`);
162
- }
163
- _websiteId = website.id;
164
- return website.id;
165
- }
166
- async function resolvePath(path, locale2) {
167
- const websiteId = await getWebsiteId();
168
- return request(`/blox/websites/${websiteId}/resolve-path`, {
169
- locale: locale2,
170
- params: { path }
171
- });
172
- }
173
- async function listItems(collection, { locale: locale2, q, offset = 0, limit = 100 } = {}) {
174
- return request(`/datastore/${_store}/collections/${collection}`, {
175
- locale: locale2,
176
- params: { ...q ? { q } : {}, offset, limit }
177
- });
178
- }
179
- async function getItemBySlug(collection, slug, locale2) {
180
- const res = await listItemsFromActiveApi(collection, { locale: locale2, limit: 1e3 });
181
- const items = Array.isArray(res) ? res : (res == null ? void 0 : res.items) ?? [];
182
- return items.find((item) => String((item == null ? void 0 : item.slug) ?? "") === slug) ?? null;
183
- }
184
- async function getItemById(collection, id, locale2) {
185
- const res = await listItemsFromActiveApi(collection, { locale: locale2, limit: 1e3 });
186
- const items = Array.isArray(res) ? res : (res == null ? void 0 : res.items) ?? [];
187
- return items.find((item) => {
188
- const record = item;
189
- return String((record == null ? void 0 : record.id) ?? (record == null ? void 0 : record._id) ?? "") === id;
190
- }) ?? null;
191
- }
192
- function listItemsFromActiveApi(collection, options = {}) {
193
- var _a;
194
- return ((_a = useBloxApi()) == null ? void 0 : _a.listItems(collection, options)) ?? listItems(collection, options);
195
- }
9
+ import { r as readBloxHydration } from "./client-Ce9fRCGH.js";
196
10
  const BLOX_REGISTRY_KEY = Symbol("blox:registry");
197
11
  const BLOX_CONFIG_KEY = Symbol("blox:config");
198
12
  const BLOX_LOCALE_STRATEGY_KEY = Symbol("blox:locale-strategy");
@@ -1051,7 +865,7 @@ class BloxInstance {
1051
865
  router.addRoute({
1052
866
  path: "/_blox_preview",
1053
867
  name: BLOX_PREVIEW_ROUTE_NAME,
1054
- component: () => import("./PreviewApp-DcD_Cjzn.js"),
868
+ component: () => import("./PreviewApp-D7nTn843.js"),
1055
869
  beforeEnter: () => typeof window === "undefined" || window.parent !== window ? true : "/"
1056
870
  });
1057
871
  }
@@ -1441,60 +1255,49 @@ function installBloxRuntime(options) {
1441
1255
  return blox;
1442
1256
  }
1443
1257
  export {
1444
- useBloxEdit as $,
1445
- _sfc_main$2 as A,
1258
+ classifyLink as A,
1446
1259
  BLOX_SSR_ROUTE_STATE_KEY as B,
1447
- _sfc_main$1 as C,
1448
- _sfc_main as D,
1449
- applyLayoutChrome as E,
1450
- classifyLink as F,
1451
- configureApi as G,
1452
- contentRoutes as H,
1453
- createBlox as I,
1454
- createBloxApi as J,
1455
- defineContent as K,
1456
- generateContentRoutes as L,
1457
- getContentRouteByCollection as M,
1458
- getWebsiteId as N,
1459
- getWebsiteIdSync as O,
1260
+ contentRoutes as C,
1261
+ createBlox as D,
1262
+ defineContent as E,
1263
+ generateContentRoutes as F,
1264
+ getContentRouteByCollection as G,
1265
+ installContentFallback as H,
1266
+ isAbsoluteExternal as I,
1267
+ isSoloContentPage as J,
1268
+ isSpecialScheme as K,
1269
+ normalizeTo as L,
1270
+ provideContentItem as M,
1271
+ toInternalPath as N,
1272
+ useBloxEdit as O,
1460
1273
  PageRenderer as P,
1461
- installContentFallback as Q,
1462
- isAbsoluteExternal as R,
1463
- isSoloContentPage as S,
1464
- isSpecialScheme as T,
1465
- listItems as U,
1466
- normalizeTo as V,
1467
- provideContentItem as W,
1468
- resolvePath as X,
1469
- setApiOrigin as Y,
1470
- toInternalPath as Z,
1274
+ useContentItem as Q,
1275
+ useData as R,
1471
1276
  _sfc_main$3 as _,
1472
1277
  collectBloxSeo as a,
1473
- useContentItem as a0,
1474
- useData as a1,
1475
- provideBloxApi as b,
1278
+ provideBloxLocale as b,
1476
1279
  collectBloxData as c,
1477
- provideBloxLocale as d,
1478
- BLOX_REGISTRY_KEY as e,
1479
- BLOX_RUNTIME_KEY as f,
1480
- BLOX_LOCALE_STRATEGY_KEY as g,
1481
- useBloxApi as h,
1280
+ BLOX_REGISTRY_KEY as d,
1281
+ BLOX_RUNTIME_KEY as e,
1282
+ BLOX_LOCALE_STRATEGY_KEY as f,
1283
+ useSeo as g,
1284
+ getRegistryData as h,
1482
1285
  installBloxRuntime as i,
1483
- useSeo as j,
1484
- getRegistryData as k,
1485
- getItemBySlug as l,
1486
- getItemById as m,
1286
+ getContentRoute as j,
1287
+ installSmartLinks as k,
1288
+ consumePendingLocaleSwitch as l,
1289
+ BLOX_ADMIN_CONFIG_KEY as m,
1487
1290
  normalizeLink as n,
1488
- getContentRoute as o,
1291
+ BLOX_CONFIG_KEY as o,
1489
1292
  provideBloxData as p,
1490
- installSmartLinks as q,
1293
+ BLOX_DATA_KEY as q,
1491
1294
  resolveBlockProps as r,
1492
1295
  setActiveLocale as s,
1493
- consumePendingLocaleSwitch as t,
1296
+ BLOX_LAYOUT_KEY as t,
1494
1297
  useLocale as u,
1495
- BLOX_ADMIN_CONFIG_KEY as v,
1496
- BLOX_CONFIG_KEY as w,
1497
- BLOX_DATA_KEY as x,
1498
- BLOX_LAYOUT_KEY as y,
1499
- BloxInstance as z
1298
+ BloxInstance as v,
1299
+ _sfc_main$2 as w,
1300
+ _sfc_main$1 as x,
1301
+ _sfc_main as y,
1302
+ applyLayoutChrome as z
1500
1303
  };