@bagelink/blox 1.15.45 → 1.15.49
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-CCxTa86_.js → PreviewApp-0gXN2w30.js} +1 -1
- package/dist/{PreviewApp-C5hzLdHt.cjs → PreviewApp-wx1ot38P.cjs} +1 -1
- package/dist/PreviewApp.vue.d.ts.map +1 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-Da4Pi_Lc.cjs → PreviewApp.vue_vue_type_style_index_0_lang-CS0XgXZ9.cjs} +20 -1
- package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-Bv4eRrVz.js → PreviewApp.vue_vue_type_style_index_0_lang-DrFY0fJ1.js} +20 -1
- package/dist/bridge.d.ts +10 -0
- package/dist/bridge.d.ts.map +1 -1
- package/dist/composables/useGlobalBlock.d.ts +31 -0
- package/dist/composables/useGlobalBlock.d.ts.map +1 -0
- package/dist/{core-Do0ELzJT.js → core-D99Qcs4W.js} +6 -6
- package/dist/{core-CR2evIjK.cjs → core-D_aG0Ax6.cjs} +1 -1
- package/dist/index.cjs +35 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +41 -8
- package/dist/ssg/index.cjs +1 -1
- package/dist/ssg/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -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-CS0XgXZ9.cjs");
|
|
4
4
|
exports.default = PreviewApp_vue_vue_type_style_index_0_lang._sfc_main;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewApp.vue.d.ts","sourceRoot":"","sources":["../src/PreviewApp.vue"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"PreviewApp.vue.d.ts","sourceRoot":"","sources":["../src/PreviewApp.vue"],"names":[],"mappings":";AAiRA,wBAMG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const vue = require("vue");
|
|
3
|
-
const core = require("./core-
|
|
3
|
+
const core = require("./core-D_aG0Ax6.cjs");
|
|
4
4
|
function sendToEditor(msg) {
|
|
5
5
|
window.parent.postMessage(msg, "*");
|
|
6
6
|
}
|
|
@@ -155,8 +155,24 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
155
155
|
break;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
+
function blockNavigation(event) {
|
|
159
|
+
const target = event.target;
|
|
160
|
+
const anchor = target == null ? void 0 : target.closest("a");
|
|
161
|
+
if (anchor && (anchor.getAttribute("href") || anchor.hasAttribute("target"))) {
|
|
162
|
+
event.preventDefault();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function blockSubmit(event) {
|
|
166
|
+
event.preventDefault();
|
|
167
|
+
}
|
|
168
|
+
function blockUnload(event) {
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
}
|
|
158
171
|
vue.onMounted(() => {
|
|
159
172
|
window.addEventListener("message", onMessage);
|
|
173
|
+
document.addEventListener("click", blockNavigation, true);
|
|
174
|
+
document.addEventListener("submit", blockSubmit, true);
|
|
175
|
+
window.addEventListener("beforeunload", blockUnload);
|
|
160
176
|
heightObserver = new ResizeObserver(() => {
|
|
161
177
|
sendToEditor({ type: "BLOX_HEIGHT", height: document.body.scrollHeight });
|
|
162
178
|
});
|
|
@@ -168,6 +184,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
168
184
|
});
|
|
169
185
|
vue.onUnmounted(() => {
|
|
170
186
|
window.removeEventListener("message", onMessage);
|
|
187
|
+
document.removeEventListener("click", blockNavigation, true);
|
|
188
|
+
document.removeEventListener("submit", blockSubmit, true);
|
|
189
|
+
window.removeEventListener("beforeunload", blockUnload);
|
|
171
190
|
heightObserver == null ? void 0 : heightObserver.disconnect();
|
|
172
191
|
});
|
|
173
192
|
return (_ctx, _cache) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, inject, ref, h, provide, onMounted, onUnmounted, openBlock, createElementBlock, createVNode, unref, nextTick } from "vue";
|
|
2
|
-
import {
|
|
2
|
+
import { B as BLOX_REGISTRY_KEY, u as useLocale } from "./core-D99Qcs4W.js";
|
|
3
3
|
function sendToEditor(msg) {
|
|
4
4
|
window.parent.postMessage(msg, "*");
|
|
5
5
|
}
|
|
@@ -154,8 +154,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
154
154
|
break;
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
+
function blockNavigation(event) {
|
|
158
|
+
const target = event.target;
|
|
159
|
+
const anchor = target == null ? void 0 : target.closest("a");
|
|
160
|
+
if (anchor && (anchor.getAttribute("href") || anchor.hasAttribute("target"))) {
|
|
161
|
+
event.preventDefault();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function blockSubmit(event) {
|
|
165
|
+
event.preventDefault();
|
|
166
|
+
}
|
|
167
|
+
function blockUnload(event) {
|
|
168
|
+
event.preventDefault();
|
|
169
|
+
}
|
|
157
170
|
onMounted(() => {
|
|
158
171
|
window.addEventListener("message", onMessage);
|
|
172
|
+
document.addEventListener("click", blockNavigation, true);
|
|
173
|
+
document.addEventListener("submit", blockSubmit, true);
|
|
174
|
+
window.addEventListener("beforeunload", blockUnload);
|
|
159
175
|
heightObserver = new ResizeObserver(() => {
|
|
160
176
|
sendToEditor({ type: "BLOX_HEIGHT", height: document.body.scrollHeight });
|
|
161
177
|
});
|
|
@@ -167,6 +183,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
167
183
|
});
|
|
168
184
|
onUnmounted(() => {
|
|
169
185
|
window.removeEventListener("message", onMessage);
|
|
186
|
+
document.removeEventListener("click", blockNavigation, true);
|
|
187
|
+
document.removeEventListener("submit", blockSubmit, true);
|
|
188
|
+
window.removeEventListener("beforeunload", blockUnload);
|
|
170
189
|
heightObserver == null ? void 0 : heightObserver.disconnect();
|
|
171
190
|
});
|
|
172
191
|
return (_ctx, _cache) => {
|
package/dist/bridge.d.ts
CHANGED
|
@@ -28,6 +28,16 @@ export type EditorMessage = {
|
|
|
28
28
|
index: number | null;
|
|
29
29
|
} | {
|
|
30
30
|
type: 'BLOX_SCROLL_TOP';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Tells the preview that a global/shared block's content changed (e.g. the
|
|
34
|
+
* editor saved the nav or footer singleton). Global block components should
|
|
35
|
+
* re-fetch their shared content. `block` optionally narrows the refresh to a
|
|
36
|
+
* single block type; when omitted, all global blocks should refresh.
|
|
37
|
+
*/
|
|
38
|
+
| {
|
|
39
|
+
type: 'BLOX_REFRESH_GLOBAL';
|
|
40
|
+
block?: string;
|
|
31
41
|
};
|
|
32
42
|
export type PreviewMessage = {
|
|
33
43
|
type: 'BLOX_READY';
|
package/dist/bridge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEzD,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,gBAAgB,CAAA;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC,UAAU,CAAC,EAAE,OAAO,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
*
|
|
5
|
+
* Receives nothing and returns the saved props object (or `null` when nothing
|
|
6
|
+
* is saved yet). Usually backed by a datastore singleton.
|
|
7
|
+
*/
|
|
8
|
+
export type GlobalBlockLoader<T> = () => Promise<T | null>;
|
|
9
|
+
export interface UseGlobalBlockResult<T> {
|
|
10
|
+
/** The loaded shared content, or `null` until the first successful load. */
|
|
11
|
+
data: Ref<T | null>;
|
|
12
|
+
/** True while a (re)load is in flight. */
|
|
13
|
+
loading: Ref<boolean>;
|
|
14
|
+
/** Manually trigger a reload. */
|
|
15
|
+
refresh: () => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Load and reactively track a global/shared block's content (e.g. site nav or
|
|
19
|
+
* footer, stored as a datastore singleton and shared across every page).
|
|
20
|
+
*
|
|
21
|
+
* The content is loaded once on mount. Additionally, when rendered inside the
|
|
22
|
+
* page-designer preview iframe, it listens for the `BLOX_REFRESH_GLOBAL` editor
|
|
23
|
+
* message and re-fetches — so saving the block in the editor updates the live
|
|
24
|
+
* preview instantly, without a page reload.
|
|
25
|
+
*
|
|
26
|
+
* @param blockType The block's type (e.g. `'TopnavBlox'`). Used to match
|
|
27
|
+
* targeted refresh messages.
|
|
28
|
+
* @param loader Async function that fetches the saved shared content.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useGlobalBlock<T extends Record<string, unknown>>(blockType: string, loader: GlobalBlockLoader<T>): UseGlobalBlockResult<T>;
|
|
31
|
+
//# sourceMappingURL=useGlobalBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGlobalBlock.d.ts","sourceRoot":"","sources":["../../src/composables/useGlobalBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAI9B;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,MAAM,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;AAE1D,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACtC,4EAA4E;IAC5E,IAAI,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;IACnB,0CAA0C;IAC1C,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACrB,iCAAiC;IACjC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAC1B,oBAAoB,CAAC,CAAC,CAAC,CAqCzB"}
|
|
@@ -403,7 +403,7 @@ class BloxInstance {
|
|
|
403
403
|
}
|
|
404
404
|
router.addRoute({
|
|
405
405
|
path: "/_blox_preview",
|
|
406
|
-
component: () => import("./PreviewApp-
|
|
406
|
+
component: () => import("./PreviewApp-0gXN2w30.js"),
|
|
407
407
|
beforeEnter: () => window.parent !== window ? true : "/"
|
|
408
408
|
});
|
|
409
409
|
router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$1 });
|
|
@@ -452,14 +452,14 @@ function createBlox(options) {
|
|
|
452
452
|
return instance;
|
|
453
453
|
}
|
|
454
454
|
export {
|
|
455
|
-
|
|
455
|
+
BLOX_REGISTRY_KEY as B,
|
|
456
456
|
PageRenderer as P,
|
|
457
457
|
_sfc_main$1 as _,
|
|
458
|
-
|
|
459
|
-
|
|
458
|
+
BLOX_LOCALE_STRATEGY_KEY as a,
|
|
459
|
+
BLOX_CONFIG_KEY as b,
|
|
460
460
|
createBlox as c,
|
|
461
|
-
|
|
462
|
-
|
|
461
|
+
BloxInstance as d,
|
|
462
|
+
configureApi as e,
|
|
463
463
|
listItems as l,
|
|
464
464
|
resolvePath as r,
|
|
465
465
|
useLocale as u
|
|
@@ -404,7 +404,7 @@ class BloxInstance {
|
|
|
404
404
|
}
|
|
405
405
|
router.addRoute({
|
|
406
406
|
path: "/_blox_preview",
|
|
407
|
-
component: () => Promise.resolve().then(() => require("./PreviewApp-
|
|
407
|
+
component: () => Promise.resolve().then(() => require("./PreviewApp-wx1ot38P.cjs")),
|
|
408
408
|
beforeEnter: () => window.parent !== window ? true : "/"
|
|
409
409
|
});
|
|
410
410
|
router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$1 });
|
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const core = require("./core-
|
|
4
|
-
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-
|
|
3
|
+
const core = require("./core-D_aG0Ax6.cjs");
|
|
4
|
+
const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-CS0XgXZ9.cjs");
|
|
5
5
|
const vue = require("vue");
|
|
6
6
|
const vueRouter = require("vue-router");
|
|
7
7
|
const pinia = require("pinia");
|
|
8
8
|
const ssg_client = require("./ssg/client.cjs");
|
|
9
|
+
function useGlobalBlock(blockType, loader) {
|
|
10
|
+
const data = vue.ref(null);
|
|
11
|
+
const loading = vue.ref(false);
|
|
12
|
+
async function refresh() {
|
|
13
|
+
loading.value = true;
|
|
14
|
+
try {
|
|
15
|
+
const loaded = await loader();
|
|
16
|
+
if (loaded) data.value = loaded;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
console.warn(`[useGlobalBlock] failed to load "${blockType}", using defaults`, e);
|
|
19
|
+
} finally {
|
|
20
|
+
loading.value = false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function onEditorMessage(event) {
|
|
24
|
+
const msg = event.data;
|
|
25
|
+
if ((msg == null ? void 0 : msg.type) !== "BLOX_REFRESH_GLOBAL") return;
|
|
26
|
+
if (!msg.block || msg.block === blockType) void refresh();
|
|
27
|
+
}
|
|
28
|
+
vue.onMounted(() => {
|
|
29
|
+
void refresh();
|
|
30
|
+
if (typeof window !== "undefined") {
|
|
31
|
+
window.addEventListener("message", onEditorMessage);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
vue.onUnmounted(() => {
|
|
35
|
+
if (typeof window !== "undefined") {
|
|
36
|
+
window.removeEventListener("message", onEditorMessage);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return { data, loading, refresh };
|
|
40
|
+
}
|
|
9
41
|
function useLocaleNav() {
|
|
10
42
|
const strategy = vue.inject(core.BLOX_LOCALE_STRATEGY_KEY, null);
|
|
11
43
|
const router = vueRouter.useRouter();
|
|
@@ -117,5 +149,6 @@ exports.sendToEditor = PreviewApp_vue_vue_type_style_index_0_lang.sendToEditor;
|
|
|
117
149
|
exports.sendToPreview = PreviewApp_vue_vue_type_style_index_0_lang.sendToPreview;
|
|
118
150
|
exports.createBloxApp = createBloxApp;
|
|
119
151
|
exports.defineBlock = defineBlock;
|
|
152
|
+
exports.useGlobalBlock = useGlobalBlock;
|
|
120
153
|
exports.useLocaleNav = useLocaleNav;
|
|
121
154
|
exports.usePageContext = usePageContext;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export type { BindingWarning, Block, BloxPageApiAdapter, CollectionItem, Collect
|
|
|
4
4
|
export { sendToEditor, sendToPreview } from './bridge';
|
|
5
5
|
export type { BlockSchemaInfo, EditorMessage, PreviewMessage } from './bridge';
|
|
6
6
|
export { default as CmsPageView } from './CmsPageView.vue';
|
|
7
|
+
export { useGlobalBlock } from './composables/useGlobalBlock';
|
|
8
|
+
export type { GlobalBlockLoader, UseGlobalBlockResult } from './composables/useGlobalBlock';
|
|
7
9
|
export { useLocale } from './composables/useLocale';
|
|
8
10
|
export type { Locale } from './composables/useLocale';
|
|
9
11
|
export { useLocaleNav } from './composables/useLocaleNav';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1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AAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACjD,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAKxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAK1E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3D,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAK9D,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAI5E,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAErE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { _ as _2, P as P2, s, a
|
|
4
|
-
import { inject, computed, createApp, markRaw } from "vue";
|
|
1
|
+
import { a as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, c as createBlox } from "./core-D99Qcs4W.js";
|
|
2
|
+
import { b, d, _, P, e, l, r } from "./core-D99Qcs4W.js";
|
|
3
|
+
import { _ as _2, P as P2, s, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-DrFY0fJ1.js";
|
|
4
|
+
import { ref, onMounted, onUnmounted, inject, computed, createApp, markRaw } from "vue";
|
|
5
5
|
import { useRouter } from "vue-router";
|
|
6
6
|
import { createPinia } from "pinia";
|
|
7
7
|
import { installBloxStateCache, installCollectionCache } from "./ssg/client.mjs";
|
|
8
|
+
function useGlobalBlock(blockType, loader) {
|
|
9
|
+
const data = ref(null);
|
|
10
|
+
const loading = ref(false);
|
|
11
|
+
async function refresh() {
|
|
12
|
+
loading.value = true;
|
|
13
|
+
try {
|
|
14
|
+
const loaded = await loader();
|
|
15
|
+
if (loaded) data.value = loaded;
|
|
16
|
+
} catch (e2) {
|
|
17
|
+
console.warn(`[useGlobalBlock] failed to load "${blockType}", using defaults`, e2);
|
|
18
|
+
} finally {
|
|
19
|
+
loading.value = false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function onEditorMessage(event) {
|
|
23
|
+
const msg = event.data;
|
|
24
|
+
if ((msg == null ? void 0 : msg.type) !== "BLOX_REFRESH_GLOBAL") return;
|
|
25
|
+
if (!msg.block || msg.block === blockType) void refresh();
|
|
26
|
+
}
|
|
27
|
+
onMounted(() => {
|
|
28
|
+
void refresh();
|
|
29
|
+
if (typeof window !== "undefined") {
|
|
30
|
+
window.addEventListener("message", onEditorMessage);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
onUnmounted(() => {
|
|
34
|
+
if (typeof window !== "undefined") {
|
|
35
|
+
window.removeEventListener("message", onEditorMessage);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return { data, loading, refresh };
|
|
39
|
+
}
|
|
8
40
|
function useLocaleNav() {
|
|
9
41
|
const strategy = inject(BLOX_LOCALE_STRATEGY_KEY, null);
|
|
10
42
|
const router = useRouter();
|
|
@@ -101,21 +133,22 @@ function defineBlock(meta) {
|
|
|
101
133
|
return meta;
|
|
102
134
|
}
|
|
103
135
|
export {
|
|
104
|
-
|
|
136
|
+
b as BLOX_CONFIG_KEY,
|
|
105
137
|
BLOX_LOCALE_STRATEGY_KEY,
|
|
106
|
-
|
|
138
|
+
d as BloxInstance,
|
|
107
139
|
_ as CmsPageView,
|
|
108
140
|
P as PageRenderer,
|
|
109
141
|
_2 as PreviewApp,
|
|
110
142
|
P2 as PreviewRenderer,
|
|
111
|
-
|
|
143
|
+
e as configureApi,
|
|
112
144
|
createBlox,
|
|
113
145
|
createBloxApp,
|
|
114
146
|
defineBlock,
|
|
115
147
|
l as listItems,
|
|
116
148
|
r as resolvePath,
|
|
117
149
|
s as sendToEditor,
|
|
118
|
-
|
|
150
|
+
a as sendToPreview,
|
|
151
|
+
useGlobalBlock,
|
|
119
152
|
useLocale,
|
|
120
153
|
useLocaleNav,
|
|
121
154
|
usePageContext
|
package/dist/ssg/index.cjs
CHANGED
|
@@ -26,7 +26,7 @@ const prerender = require("../prerender-DH6Arhpk.cjs");
|
|
|
26
26
|
const ssg_client = require("./client.cjs");
|
|
27
27
|
const pinia = require("pinia");
|
|
28
28
|
const vue = require("vue");
|
|
29
|
-
const core = require("../core-
|
|
29
|
+
const core = require("../core-D_aG0Ax6.cjs");
|
|
30
30
|
async function renderBloxSsgPage(options) {
|
|
31
31
|
const {
|
|
32
32
|
url,
|
package/dist/ssg/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { BLOX_STATE_WINDOW_KEY, BLOX_COLLECTIONS_WINDOW_KEY, BLOX_WEBSITE_ID_WIN
|
|
|
4
4
|
import { getCollectionCache, getEmbeddedWebsiteId, installBloxStateCache, installCollectionCache } from "./client.mjs";
|
|
5
5
|
import { createPinia } from "pinia";
|
|
6
6
|
import { createSSRApp, markRaw } from "vue";
|
|
7
|
-
import { c as createBlox } from "../core-
|
|
7
|
+
import { c as createBlox } from "../core-D99Qcs4W.js";
|
|
8
8
|
async function renderBloxSsgPage(options) {
|
|
9
9
|
const {
|
|
10
10
|
url,
|
package/package.json
CHANGED