@bagelink/blox 1.12.21 → 1.12.22
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/index.cjs +18 -5
- package/dist/index.mjs +18 -5
- 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":";AAgTA,wBAMG"}
|
package/dist/index.cjs
CHANGED
|
@@ -121,10 +121,9 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
121
121
|
const blocks = vue.ref([]);
|
|
122
122
|
const contexts = vue.ref({});
|
|
123
123
|
vue.provide("contexts", contexts);
|
|
124
|
-
const loading = vue.ref(true);
|
|
125
124
|
const notFound = vue.ref(false);
|
|
126
125
|
const error = vue.ref(null);
|
|
127
|
-
function
|
|
126
|
+
function tryHydrateFromState(path) {
|
|
128
127
|
var _a, _b;
|
|
129
128
|
const win = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : void 0;
|
|
130
129
|
if (!win) return false;
|
|
@@ -135,9 +134,18 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
135
134
|
blocks.value = ((_b = (_a = entry.page) == null ? void 0 : _a.content) == null ? void 0 : _b.blocks) ?? [];
|
|
136
135
|
contexts.value = entry.contexts ?? {};
|
|
137
136
|
setAlternates(entry.alternates ?? {});
|
|
138
|
-
loading.value = false;
|
|
139
137
|
return true;
|
|
140
138
|
}
|
|
139
|
+
const initialSlug = (() => {
|
|
140
|
+
var _a;
|
|
141
|
+
if (strategy) {
|
|
142
|
+
const hostname = typeof window !== "undefined" ? ((_a = window.location) == null ? void 0 : _a.hostname) ?? "" : "";
|
|
143
|
+
return strategy.detect(hostname, route.path).slug;
|
|
144
|
+
}
|
|
145
|
+
return route.path || "/";
|
|
146
|
+
})();
|
|
147
|
+
const ssrHydrated = tryHydrateFromState(initialSlug);
|
|
148
|
+
const loading = vue.ref(!ssrHydrated);
|
|
141
149
|
async function load() {
|
|
142
150
|
var _a;
|
|
143
151
|
loading.value = true;
|
|
@@ -146,7 +154,10 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
146
154
|
const { locale: urlLocale, slug } = strategy ? strategy.detect(typeof window !== "undefined" ? window.location.hostname : "", route.path) : { locale: locale2.value, slug: route.path || "/" };
|
|
147
155
|
if (urlLocale !== locale2.value) setLocale(urlLocale);
|
|
148
156
|
setAlternates({});
|
|
149
|
-
if (
|
|
157
|
+
if (tryHydrateFromState(slug)) {
|
|
158
|
+
loading.value = false;
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
150
161
|
try {
|
|
151
162
|
const resolved = await resolvePath(slug, urlLocale);
|
|
152
163
|
blocks.value = ((_a = resolved.page.content) == null ? void 0 : _a.blocks) ?? [];
|
|
@@ -164,7 +175,9 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
164
175
|
loading.value = false;
|
|
165
176
|
}
|
|
166
177
|
}
|
|
167
|
-
|
|
178
|
+
if (!ssrHydrated) {
|
|
179
|
+
load();
|
|
180
|
+
}
|
|
168
181
|
vue.watch(() => route.path, load);
|
|
169
182
|
return (_ctx, _cache) => {
|
|
170
183
|
const _component_RouterLink = vue.resolveComponent("RouterLink");
|
package/dist/index.mjs
CHANGED
|
@@ -119,10 +119,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
119
119
|
const blocks = ref([]);
|
|
120
120
|
const contexts = ref({});
|
|
121
121
|
provide("contexts", contexts);
|
|
122
|
-
const loading = ref(true);
|
|
123
122
|
const notFound = ref(false);
|
|
124
123
|
const error = ref(null);
|
|
125
|
-
function
|
|
124
|
+
function tryHydrateFromState(path) {
|
|
126
125
|
var _a, _b;
|
|
127
126
|
const win = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : void 0;
|
|
128
127
|
if (!win) return false;
|
|
@@ -133,9 +132,18 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
133
132
|
blocks.value = ((_b = (_a = entry.page) == null ? void 0 : _a.content) == null ? void 0 : _b.blocks) ?? [];
|
|
134
133
|
contexts.value = entry.contexts ?? {};
|
|
135
134
|
setAlternates(entry.alternates ?? {});
|
|
136
|
-
loading.value = false;
|
|
137
135
|
return true;
|
|
138
136
|
}
|
|
137
|
+
const initialSlug = (() => {
|
|
138
|
+
var _a;
|
|
139
|
+
if (strategy) {
|
|
140
|
+
const hostname = typeof window !== "undefined" ? ((_a = window.location) == null ? void 0 : _a.hostname) ?? "" : "";
|
|
141
|
+
return strategy.detect(hostname, route.path).slug;
|
|
142
|
+
}
|
|
143
|
+
return route.path || "/";
|
|
144
|
+
})();
|
|
145
|
+
const ssrHydrated = tryHydrateFromState(initialSlug);
|
|
146
|
+
const loading = ref(!ssrHydrated);
|
|
139
147
|
async function load() {
|
|
140
148
|
var _a;
|
|
141
149
|
loading.value = true;
|
|
@@ -144,7 +152,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
144
152
|
const { locale: urlLocale, slug } = strategy ? strategy.detect(typeof window !== "undefined" ? window.location.hostname : "", route.path) : { locale: locale2.value, slug: route.path || "/" };
|
|
145
153
|
if (urlLocale !== locale2.value) setLocale(urlLocale);
|
|
146
154
|
setAlternates({});
|
|
147
|
-
if (
|
|
155
|
+
if (tryHydrateFromState(slug)) {
|
|
156
|
+
loading.value = false;
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
148
159
|
try {
|
|
149
160
|
const resolved = await resolvePath(slug, urlLocale);
|
|
150
161
|
blocks.value = ((_a = resolved.page.content) == null ? void 0 : _a.blocks) ?? [];
|
|
@@ -162,7 +173,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
162
173
|
loading.value = false;
|
|
163
174
|
}
|
|
164
175
|
}
|
|
165
|
-
|
|
176
|
+
if (!ssrHydrated) {
|
|
177
|
+
load();
|
|
178
|
+
}
|
|
166
179
|
watch(() => route.path, load);
|
|
167
180
|
return (_ctx, _cache) => {
|
|
168
181
|
const _component_RouterLink = resolveComponent("RouterLink");
|
package/package.json
CHANGED