@bagelink/blox 1.15.176 → 1.15.180

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 (67) hide show
  1. package/dist/{PreviewApp-B8EmNfyH.cjs → PreviewApp-APyemzqx.cjs} +1 -1
  2. package/dist/{PreviewApp-DdkAQqw2.js → PreviewApp-BKTydm92.js} +1 -1
  3. package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-CPBuld3j.cjs → PreviewApp.vue_vue_type_style_index_0_lang-C0ZVst7R.cjs} +6 -6
  4. package/dist/{PreviewApp.vue_vue_type_style_index_0_lang-1JKQVLm2.js → PreviewApp.vue_vue_type_style_index_0_lang-DHb-NJ4C.js} +1 -1
  5. package/dist/api/index.d.ts +22 -0
  6. package/dist/api/index.d.ts.map +1 -1
  7. package/dist/components/BloxRouterView.vue.d.ts +26 -15
  8. package/dist/components/BloxRouterView.vue.d.ts.map +1 -1
  9. package/dist/composables/useLocale.d.ts +7 -0
  10. package/dist/composables/useLocale.d.ts.map +1 -1
  11. package/dist/composables/useLocaleNav.d.ts +2 -2
  12. package/dist/composables/useLocaleNav.d.ts.map +1 -1
  13. package/dist/content/{ContentDetailHost.vue.d.ts → ContentDetailView.vue.d.ts} +1 -1
  14. package/dist/content/ContentDetailView.vue.d.ts.map +1 -0
  15. package/dist/content/ContentHost.vue.d.ts +3 -0
  16. package/dist/content/ContentHost.vue.d.ts.map +1 -0
  17. package/dist/content/index.d.ts +9 -0
  18. package/dist/content/index.d.ts.map +1 -0
  19. package/dist/content/registry.d.ts +73 -0
  20. package/dist/content/registry.d.ts.map +1 -0
  21. package/dist/content/routes.d.ts +48 -0
  22. package/dist/content/routes.d.ts.map +1 -0
  23. package/dist/content/useContentItem.d.ts +37 -5
  24. package/dist/content/useContentItem.d.ts.map +1 -1
  25. package/dist/content/useContentSeo.d.ts +20 -7
  26. package/dist/content/useContentSeo.d.ts.map +1 -1
  27. package/dist/core.d.ts +3 -1
  28. package/dist/core.d.ts.map +1 -1
  29. package/dist/createBloxApp.d.ts.map +1 -1
  30. package/dist/data/useData.d.ts +91 -0
  31. package/dist/data/useData.d.ts.map +1 -0
  32. package/dist/index.cjs +185 -138
  33. package/dist/index.d.ts +7 -13
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.mjs +177 -131
  36. package/dist/localeRoutes.d.ts +15 -0
  37. package/dist/localeRoutes.d.ts.map +1 -0
  38. package/dist/localeStrategy.d.ts +13 -0
  39. package/dist/localeStrategy.d.ts.map +1 -1
  40. package/dist/{prerender-NHAqrTm3.js → prerender-DB1R4jiQ.js} +10 -9
  41. package/dist/{prerender-H72-UrK4.cjs → prerender-DXGy7pee.cjs} +10 -9
  42. package/dist/{core-KRHc4Bob.cjs → routes-C97aL4cQ.cjs} +415 -220
  43. package/dist/{core-Bp2bf8e4.js → routes-bhjTTXfU.js} +444 -249
  44. package/dist/ssg/cli.cjs +1 -1
  45. package/dist/ssg/cli.mjs +1 -1
  46. package/dist/ssg/createSSREntry.d.ts.map +1 -1
  47. package/dist/ssg/index.cjs +28 -19
  48. package/dist/ssg/index.mjs +31 -22
  49. package/dist/ssg/render-resolved-page.d.ts +6 -0
  50. package/dist/ssg/render-resolved-page.d.ts.map +1 -1
  51. package/dist/ssg/seo.d.ts +9 -3
  52. package/dist/ssg/seo.d.ts.map +1 -1
  53. package/dist/vite-plugin.cjs +2 -2
  54. package/dist/vite-plugin.d.ts.map +1 -1
  55. package/dist/vite-plugin.mjs +2 -2
  56. package/package.json +1 -1
  57. package/dist/components/LocaleRouterLink.vue.d.ts +0 -28
  58. package/dist/components/LocaleRouterLink.vue.d.ts.map +0 -1
  59. package/dist/composables/useData.d.ts +0 -22
  60. package/dist/composables/useData.d.ts.map +0 -1
  61. package/dist/composables/useSeo.d.ts +0 -20
  62. package/dist/composables/useSeo.d.ts.map +0 -1
  63. package/dist/content/ContentDetailHost.vue.d.ts.map +0 -1
  64. package/dist/content/defineContent.d.ts +0 -22
  65. package/dist/content/defineContent.d.ts.map +0 -1
  66. package/dist/routing/withLocaleRoutes.d.ts +0 -8
  67. package/dist/routing/withLocaleRoutes.d.ts.map +0 -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-CPBuld3j.cjs");
3
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-C0ZVst7R.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-1JKQVLm2.js";
1
+ import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-DHb-NJ4C.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 core = require("./core-KRHc4Bob.cjs");
3
+ const routes = require("./routes-C97aL4cQ.cjs");
4
4
  function sendToEditor(msg) {
5
5
  window.parent.postMessage(msg, "*");
6
6
  }
@@ -30,7 +30,7 @@ const PreviewRenderer = vue.defineComponent({
30
30
  }
31
31
  },
32
32
  setup(props) {
33
- const registry = vue.inject(core.BLOX_REGISTRY_KEY, {});
33
+ const registry = vue.inject(routes.BLOX_REGISTRY_KEY, {});
34
34
  const localHovered = vue.ref(null);
35
35
  function onBlockClick(index) {
36
36
  sendToEditor({ type: "BLOX_BLOCK_CLICK", index });
@@ -92,7 +92,7 @@ const PreviewRenderer = vue.defineComponent({
92
92
  const isSelected = props.selectedIndex === i;
93
93
  const isHovered = (props.hoveredIndex === i || localHovered.value === i) && !isSelected;
94
94
  const { label } = definition.schema;
95
- const globalRef = core.globalRefOf(block);
95
+ const globalRef = routes.globalRefOf(block);
96
96
  const isGlobal = props.globalBlockTypes.includes(block.type) || !!globalRef;
97
97
  const palette = isGlobal ? GLOBAL : REGULAR;
98
98
  const overlayStyle = { ...overlayBaseFor(palette.rgb) };
@@ -124,7 +124,7 @@ const PreviewRenderer = vue.defineComponent({
124
124
  "onMouseleave": onBlockLeave
125
125
  },
126
126
  [
127
- globalRef ? vue.h(core.GlobalBlockHost, {
127
+ globalRef ? vue.h(routes.GlobalBlockHost, {
128
128
  component: definition.component,
129
129
  defaults: definition.schema.defaults,
130
130
  blockProps: block.props,
@@ -144,8 +144,8 @@ const _hoisted_1 = { class: "blox-preview-root" };
144
144
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
145
145
  __name: "PreviewApp",
146
146
  setup(__props) {
147
- const registry = vue.inject(core.BLOX_REGISTRY_KEY, {});
148
- const { setLocale } = core.useLocale();
147
+ const registry = vue.inject(routes.BLOX_REGISTRY_KEY, {});
148
+ const { setLocale } = routes.useLocale();
149
149
  const blocks = vue.ref([]);
150
150
  const contexts = vue.ref({});
151
151
  const selectedIndex = vue.ref(null);
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, inject, ref, h, provide, onMounted, onUnmounted, openBlock, createElementBlock, createVNode, unref, nextTick } from "vue";
2
- import { B as BLOX_REGISTRY_KEY, g as globalRefOf, G as GlobalBlockHost, u as useLocale } from "./core-Bp2bf8e4.js";
2
+ import { e as BLOX_REGISTRY_KEY, f as globalRefOf, G as GlobalBlockHost, u as useLocale } from "./routes-bhjTTXfU.js";
3
3
  function sendToEditor(msg) {
4
4
  window.parent.postMessage(msg, "*");
5
5
  }
@@ -1,5 +1,11 @@
1
1
  import { CollectionItemsPage, PageResolveRead } from './types';
2
2
  export declare function configureApi(websiteName: string, store: string): void;
3
+ /**
4
+ * Point blox's datastore client at an absolute API base (SSG/Node, where
5
+ * `window.location.origin` + a `/api` proxy don't exist). `base` may include a
6
+ * path prefix (e.g. `https://host` or `https://host/api`).
7
+ */
8
+ export declare function setApiOrigin(base: string): void;
3
9
  /** Synchronously read the resolved website id if already known (SSG-embedded or cached). */
4
10
  export declare function getWebsiteIdSync(): string | null;
5
11
  export declare function getWebsiteId(): Promise<string>;
@@ -13,4 +19,20 @@ export interface ListItemsOptions {
13
19
  export declare function listItems<T = Record<string, unknown>>(collection: string, { locale, q, offset, limit }?: ListItemsOptions): Promise<CollectionItemsPage & {
14
20
  items: T[];
15
21
  }>;
22
+ /**
23
+ * Fetch a single item from a collection by its `slug`, in the given locale.
24
+ *
25
+ * The datastore returns the row already translated for `?locale=`, so `item.*`
26
+ * fields (incl. `slug`) are the active-locale values. Returns null if no item
27
+ * matches. `available_locales` (when present) is used by the content router's
28
+ * cross-locale fallback.
29
+ */
30
+ export declare function getItemBySlug<T = Record<string, unknown>>(collection: string, slug: string, locale?: string): Promise<T | null>;
31
+ /**
32
+ * Fetch a single item by its `id`, translated for `locale`. Used to resolve an
33
+ * entity's slug in OTHER locales (hreflang alternates) — the id is
34
+ * locale-independent, the returned `slug`/fields are the requested locale's.
35
+ * Returns null if the item isn't available in that locale (datastore 406/404).
36
+ */
37
+ export declare function getItemById<T = Record<string, unknown>>(collection: string, id: string, locale?: string): Promise<T | null>;
16
38
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAe,MAAM,SAAS,CAAA;AAUhF,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAIrE;AAsBD,4FAA4F;AAC5F,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAOhD;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAiBpD;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAMxF;AAED,MAAM,WAAW,gBAAgB;IAChC,MAAM,CAAC,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,MAAU,EAAE,KAAW,EAAE,GAAE,gBAAqB,GAC3D,OAAO,CAAC,mBAAmB,GAAG;IAAE,KAAK,EAAE,CAAC,EAAE,CAAA;CAAE,CAAC,CAK/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,CAInB"}
@@ -1,18 +1,29 @@
1
- declare function __VLS_template(): {
2
- attrs: Partial<{}>;
3
- slots: {
4
- fallback?(_: {}): any;
5
- };
6
- refs: {};
7
- rootEl: any;
1
+ /**
2
+ * Router outlet for Blox apps — renders the matched route component directly
3
+ * under the app-root `<Suspense>`.
4
+ *
5
+ * WHY NOT a plain `<RouterView>` wrapped in `<transition>` (the common pattern)?
6
+ * A `<transition>` around the routed view prevents Vue's server renderer from
7
+ * awaiting that view's `onServerPrefetch`. Data-driven detail pages
8
+ * (blog/event/product) fetch via `useData()`/`useContentItem()` in
9
+ * `onServerPrefetch`; behind a transition their data never resolves during SSG,
10
+ * so they prerender EMPTY. Keeping the routed view directly under the root
11
+ * `<Suspense>` lets the prefetch resolve and the content land in static HTML.
12
+ *
13
+ * `transition` is therefore OFF by default. Opt in only for client-only apps
14
+ * (no SSG) where page-transition animation matters more than prerendered
15
+ * content — passing `transition` re-introduces the empty-SSG behavior for
16
+ * data-driven routes, by design.
17
+ *
18
+ * `:key` is the matched leaf record's path, so a real page change remounts while
19
+ * param-only navigation (same route, new `:slug`) does not.
20
+ */
21
+ type __VLS_Props = {
22
+ /** CSS transition name. When set, wraps the view in `<transition>` (client-only apps). */
23
+ transition?: string;
8
24
  };
9
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
- declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
11
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
25
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
26
+ transition: string;
27
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
12
28
  export default _default;
13
- type __VLS_WithTemplateSlots<T, S> = T & {
14
- new (): {
15
- $slots: S;
16
- };
17
- };
18
29
  //# sourceMappingURL=BloxRouterView.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BloxRouterView.vue.d.ts","sourceRoot":"","sources":["../../src/components/BloxRouterView.vue"],"names":[],"mappings":"AA4BA,iBAAS,cAAc;WAqDT,OAAO,IAA6B;;0BAVnB,GAAG;;;;EAejC;AAOD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,+QAMnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAEpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"BloxRouterView.vue.d.ts","sourceRoot":"","sources":["../../src/components/BloxRouterView.vue"],"names":[],"mappings":"AA4CA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,KAAK,WAAW,GAAG;IAClB,0FAA0F;IAC1F,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC;;gBADY,MAAM;;AA4FpB,wBAQG"}
@@ -1,4 +1,11 @@
1
1
  export type Locale = string;
2
+ /**
3
+ * Set the active locale ref directly, without touching `localStorage`/`document`.
4
+ * Used by the SSG entry to align `useLocale()` with the URL-detected render
5
+ * locale for app-router pages (which don't pass through `CmsPageView`). Keeps
6
+ * `@bagelink/vue` i18n in sync when present.
7
+ */
8
+ export declare function setActiveLocale(l: Locale): void;
2
9
  export declare function useLocale(): {
3
10
  locale: import('vue').Ref<string, string>;
4
11
  dir: import('vue').ComputedRef<"ltr" | "rtl">;
@@ -1 +1 @@
1
- {"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../src/composables/useLocale.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAO3B,wBAAgB,SAAS;;;mBAGF,MAAM;;gCAcO,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;EAKzD"}
1
+ {"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../src/composables/useLocale.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAW3B;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAQ/C;AAED,wBAAgB,SAAS;;;mBAGF,MAAM;;gCAgBO,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;EAKzD"}
@@ -12,11 +12,11 @@
12
12
  export declare function useLocaleNav(): {
13
13
  switchLocale: (targetLocale: string) => void;
14
14
  toPath: (slug: string) => string;
15
- locale: import('vue').Ref<string, string>;
16
- availableLocales: import('vue').ComputedRef<string[]>;
17
15
  detect: (path: string) => {
18
16
  locale: string;
19
17
  slug: string;
20
18
  };
19
+ availableLocales: import('vue').ComputedRef<string[]>;
20
+ locale: import('vue').Ref<string, string>;
21
21
  };
22
22
  //# sourceMappingURL=useLocaleNav.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLocaleNav.d.ts","sourceRoot":"","sources":["../../src/composables/useLocaleNav.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY;iCAYS,MAAM;mBAkBpB,MAAM,KAAG,MAAM;;;mBAOf,MAAM;;;;EAO5B"}
1
+ {"version":3,"file":"useLocaleNav.d.ts","sourceRoot":"","sources":["../../src/composables/useLocaleNav.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY;iCAYS,MAAM;mBAkBpB,MAAM,KAAG,MAAM;mBAaf,MAAM,KAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;;;EAa/D"}
@@ -1,3 +1,3 @@
1
1
  declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
2
  export default _default;
3
- //# sourceMappingURL=ContentDetailHost.vue.d.ts.map
3
+ //# sourceMappingURL=ContentDetailView.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentDetailView.vue.d.ts","sourceRoot":"","sources":["../../src/content/ContentDetailView.vue"],"names":[],"mappings":";AAgKA,wBAKG"}
@@ -0,0 +1,3 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
3
+ //# sourceMappingURL=ContentHost.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentHost.vue.d.ts","sourceRoot":"","sources":["../../src/content/ContentHost.vue"],"names":[],"mappings":";AAyGA,wBAMG"}
@@ -0,0 +1,9 @@
1
+ export { defineContent, contentRoutes, getContentRoute, getContentRouteByCollection, __clearContentRegistry, } from './registry';
2
+ export type { ContentItem, ContentRoute, ContentRouteInput, ContentViewSchema } from './registry';
3
+ export { generateContentRoutes, installContentFallback, installLocaleAwareResolve } from './routes';
4
+ export { provideContentItem, useContentItem } from './useContentItem';
5
+ export { useContentSeo } from './useContentSeo';
6
+ export { getItemBySlug, getItemById } from '../api';
7
+ export { default as ContentHost } from './ContentHost.vue';
8
+ export { default as ContentDetailView } from './ContentDetailView.vue';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/content/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EACb,aAAa,EACb,eAAe,EACf,2BAA2B,EAC3B,sBAAsB,GACtB,MAAM,YAAY,CAAA;AACnB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEjG,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAA;AACnG,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAEnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA"}
@@ -0,0 +1,73 @@
1
+ import { Component } from 'vue';
2
+ /**
3
+ * Content registry — the SINGLE source of truth binding a datastore collection
4
+ * to its detail route. Everything locale/routing/prerender-related is a
5
+ * projection of this one declaration:
6
+ * - router → named, locale-prefixed routes (meta.content)
7
+ * - links → vanilla `<RouterLink :to="{ name, params:{ slug } }">`
8
+ * (blox adds the locale prefix under the hood)
9
+ * - detail data → route loader fetches the item (active locale) + provides it
10
+ * - prerender/sitemap → enumerate collections × available locales → URLs
11
+ *
12
+ * The datastore returns items already translated for `?locale=`, so `item.slug`
13
+ * is ALWAYS the active-locale slug — no slug-field/translation logic lives here.
14
+ * Registration is pure routing data, so a new data-powered route can be added at
15
+ * runtime with a single `defineContent` call (no per-route component code when
16
+ * using the generic detail view).
17
+ */
18
+ export type ContentItem = Record<string, any>;
19
+ export interface ContentRouteInput {
20
+ /** Stable route name used by links: `{ name, params: { slug } }`. */
21
+ name: string;
22
+ /** Datastore collection this content lives in. */
23
+ collection: string;
24
+ /**
25
+ * Bare (default-locale) route pattern with a `:slug` param, e.g.
26
+ * `/event/:slug` or `/blog/:category/:slug`. Locale prefixing is added by the
27
+ * router generator.
28
+ */
29
+ route: string;
30
+ /**
31
+ * Detail component. Optional — defaults to the generic schema-driven
32
+ * `ContentDetailView`, so a data-only collection needs no bespoke component.
33
+ */
34
+ component?: Component;
35
+ /**
36
+ * Optional render schema for the generic detail view (field → display).
37
+ * Ignored when a custom `component` is supplied.
38
+ */
39
+ view?: ContentViewSchema;
40
+ }
41
+ export interface ContentViewSchema {
42
+ /** Field used as the <h1> / page title + SEO title. */
43
+ title?: string;
44
+ /** Field used as the hero image (expects `{ imageURL }` or a URL string). */
45
+ image?: string;
46
+ /** Rich-text/HTML body field. */
47
+ body?: string;
48
+ /** Short description field for SEO (stripped to text). */
49
+ description?: string;
50
+ }
51
+ export interface ContentRoute {
52
+ readonly name: string;
53
+ readonly collection: string;
54
+ readonly route: string;
55
+ readonly component?: Component;
56
+ readonly view?: ContentViewSchema;
57
+ /** Param names in `route`, in order (e.g. ['category','slug']). */
58
+ readonly params: string[];
59
+ }
60
+ /**
61
+ * Register content routes. Idempotent per `name` (last write wins) so it's safe
62
+ * to call from both the client and the SSR entry.
63
+ */
64
+ export declare function defineContent(inputs: ContentRouteInput[]): void;
65
+ /** All registered content routes (router generation + prerender). */
66
+ export declare function contentRoutes(): ContentRoute[];
67
+ /** Look up a registered content route by name. */
68
+ export declare function getContentRoute(name: string): ContentRoute | undefined;
69
+ /** Look up a registered content route by collection. */
70
+ export declare function getContentRouteByCollection(collection: string): ContentRoute | undefined;
71
+ /** Reset — test/hot-reload only. */
72
+ export declare function __clearContentRegistry(): void;
73
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/content/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAEpC;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAE7C,MAAM,WAAW,iBAAiB;IACjC,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAA;IACZ,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAA;CACxB;AAED,MAAM,WAAW,iBAAiB;IACjC,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAAA;IACjC,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CACzB;AAQD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAe/D;AAED,qEAAqE;AACrE,wBAAgB,aAAa,IAAI,YAAY,EAAE,CAE9C;AAED,kDAAkD;AAClD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEtE;AAED,wDAAwD;AACxD,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAGxF;AAED,oCAAoC;AACpC,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
@@ -0,0 +1,48 @@
1
+ import { RouteRecordRaw, Router } from 'vue-router';
2
+ import { LocaleStrategy } from '../localeStrategy';
3
+ /**
4
+ * Generate vue-router route records for every registered content route.
5
+ *
6
+ * Each registration yields a NAMED default-locale route + one NAMED route per
7
+ * non-default locale (`event`, `event:it`, `event:fr`, …), all rendered by
8
+ * `ContentHost` (which fetches + provides the entity). `meta.content` carries the
9
+ * registration name so the host, the fallback guard, and prerender can find it.
10
+ *
11
+ * Links stay pure-vanilla: `<RouterLink :to="{ name, params: { slug } }">`; the
12
+ * locale prefix is added by the locale strategy, and `item.slug` is already the
13
+ * active-locale slug (per-locale fetch), so no slug translation is needed.
14
+ */
15
+ export declare function generateContentRoutes(supportedLocales: string[], defaultLocale: string): RouteRecordRaw[];
16
+ /**
17
+ * Make `router.resolve` locale-aware so that **plain vue-router usage is enough**
18
+ * — no `LocaleRouterLink`, no per-block/per-project locale code.
19
+ *
20
+ * `<RouterLink>` computes its href via `router.resolve(to)` (see vue-router
21
+ * `useLink`), and `router.push`/`replace` route through it too. Wrapping it once
22
+ * makes BOTH rendered links and programmatic navigation locale-correct, on the
23
+ * client AND during SSG (where `setActiveLocale()` sets the per-page active
24
+ * locale before each render, so static hrefs come out prefixed).
25
+ *
26
+ * Two cases, both keeping call sites 100% vanilla:
27
+ * • STRING `to` (`"/blog"`, `"/get-the-best-offer"`): prefixed with the active
28
+ * locale via the strategy (`/it/blog`). Idempotent — an already-prefixed or
29
+ * external/special value is left alone.
30
+ * • NAMED content route (`{ name:'event', params:{ slug } }`): the bare name is
31
+ * swapped for the active locale's variant (`event` → `event:it`) so it
32
+ * resolves to `/it/event/<slug>`.
33
+ *
34
+ * Raw `<a href>` in CMS/editor content is handled at click-time by
35
+ * `installSmartLinks` (client) — orthogonal to this.
36
+ */
37
+ export declare function installLocaleAwareResolve(router: Router, strategy: LocaleStrategy): void;
38
+ /**
39
+ * Cross-locale fallback for content detail routes.
40
+ *
41
+ * If a content URL's slug isn't available in the URL's locale but the entity
42
+ * exists in another locale, REDIRECT to that locale's URL (real navigation →
43
+ * correct URL, correct hreflang, no content/URL mismatch). Order: URL locale →
44
+ * default locale → any available locale. Only runs for content routes; anything
45
+ * unresolved falls through untouched (soft not-found handled by the view).
46
+ */
47
+ export declare function installContentFallback(router: Router, supportedLocales: string[], defaultLocale: string): void;
48
+ //# sourceMappingURL=routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/content/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAOvD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACpC,gBAAgB,EAAE,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,GACnB,cAAc,EAAE,CA4BlB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CACxC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,cAAc,GACtB,IAAI,CA4BN;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,EAAE,EAC1B,aAAa,EAAE,MAAM,GACnB,IAAI,CAsCN"}
@@ -1,6 +1,38 @@
1
- import { InjectionKey, Ref } from 'vue';
2
- export type ContentItem = Record<string, any>;
3
- export declare const BLOX_CONTENT_ITEM_KEY: InjectionKey<Ref<ContentItem | null>>;
4
- /** Active content-route entity (provided by `ContentDetailHost`). */
5
- export declare function useContentItem<T extends ContentItem = ContentItem>(): Ref<T | null>;
1
+ import { InjectionKey, Ref, MaybeRefOrGetter } from 'vue';
2
+ import { ContentItem } from './registry';
3
+ /**
4
+ * Optional override: the content route host can provide `{ collection, slug }`
5
+ * so a view calling `useContentItem()` with no args resolves them from context.
6
+ * (Views normally just call `useContentItem()` and let it read route + registry.)
7
+ */
8
+ export interface ContentItemContext {
9
+ collection: MaybeRefOrGetter<string>;
10
+ slug: MaybeRefOrGetter<string>;
11
+ }
12
+ export declare const CONTENT_ITEM_CTX: InjectionKey<ContentItemContext>;
13
+ /**
14
+ * Fetch the current detail entity (active locale) for a content route.
15
+ *
16
+ * Vanilla for views: `const item = useContentItem()` — no args. It resolves the
17
+ * collection + slug from the route (`meta.content` → registry, `params.slug`),
18
+ * fetches in the active locale, and returns a reactive ref. The datastore
19
+ * returns the row already translated, so `item.value.slug`/`.city`/… are the
20
+ * active-locale values (read them directly, no `tdbLocale`).
21
+ *
22
+ * SSR-safe: the fetch runs via `useData` (onServerPrefetch on THIS component),
23
+ * so the value is present in the SSR render and hydrated synchronously on the
24
+ * client. Because the fetch lives on the consuming component, its resolved value
25
+ * participates in the same render pass (no cross-component provide/inject SSR
26
+ * timing gap).
27
+ *
28
+ * Optional args let non-route callers (or custom hosts) pass explicit
29
+ * collection/slug.
30
+ */
31
+ export declare function useContentItem(collectionArg?: MaybeRefOrGetter<string>, slugArg?: MaybeRefOrGetter<string>): Ref<ContentItem | null>;
32
+ /**
33
+ * Legacy provide entry point kept for the host: it now just provides the
34
+ * collection/slug context (no fetch), so the VIEW's `useContentItem()` performs
35
+ * the fetch on its own component (correct SSR timing).
36
+ */
37
+ export declare function provideContentItem(collection: MaybeRefOrGetter<string>, slug: MaybeRefOrGetter<string>): void;
6
38
  //# sourceMappingURL=useContentItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useContentItem.d.ts","sourceRoot":"","sources":["../../src/content/useContentItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAG5C,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAE7C,eAAO,MAAM,qBAAqB,EAAE,YAAY,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAA+B,CAAA;AAEvG,qEAAqE;AACrE,wBAAgB,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAEnF"}
1
+ {"version":3,"file":"useContentItem.d.ts","sourceRoot":"","sources":["../../src/content/useContentItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC5C,OAAO,EAA4B,KAAK,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAKrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAG7C;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAClC,UAAU,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACpC,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CAC9B;AACD,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,kBAAkB,CAAmC,CAAA;AAEjG;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC7B,aAAa,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,EACxC,OAAO,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAChC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAuCzB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CACjC,UAAU,EAAE,gBAAgB,CAAC,MAAM,CAAC,EACpC,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAC5B,IAAI,CAEN"}
@@ -1,10 +1,23 @@
1
- import { Ref } from 'vue';
2
- import { SeoGetter } from '../composables/useSeo';
3
- import { ContentItem } from './useContentItem';
1
+ import { MaybeRefOrGetter } from 'vue';
2
+ import { BloxSeoHead } from '../data/useData';
3
+ import { ContentItem } from './registry';
4
+ type BaseHead = Omit<BloxSeoHead, 'alternates'>;
4
5
  /**
5
- * `useSeo` plus hreflang alternates from the entity's `available_locales`.
6
- * Alternate values are the current bare path (locale prefix stripped); SSG
7
- * head prefixes non-default locales with `/xx`.
6
+ * SEO for a data-driven detail page — same as `useSeo`, plus hreflang alternates
7
+ * that point at each available locale's real URL.
8
+ *
9
+ * CMS pages get hreflang from the backend resolve-path; content detail pages
10
+ * (blog/event/product) are entity URLs the CMS doesn't know, so this fills the
11
+ * gap. It reads the current registration (via `route.meta.content`), the
12
+ * entity's `available_locales`, resolves each locale's `slug` (by id — the id is
13
+ * locale-independent), builds `{ locale → routePath }` from the route pattern,
14
+ * and hands it to `useSeo({ alternates })` which `buildPageHead` emits as
15
+ * `<link rel="alternate" hreflang=…>` during SSG.
16
+ *
17
+ * Call this INSTEAD of `useSeo` in a detail view to get hreflang for free.
18
+ * Alternates resolve during `onServerPrefetch` (SSG only); on the client it's a
19
+ * plain `useSeo` (hreflang is a build-time concern).
8
20
  */
9
- export declare function useContentSeo(item: Ref<ContentItem | null | undefined>, getter: SeoGetter): void;
21
+ export declare function useContentSeo(item: MaybeRefOrGetter<ContentItem | null>, head: () => BaseHead | null | undefined): void;
22
+ export {};
10
23
  //# sourceMappingURL=useContentSeo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useContentSeo.d.ts","sourceRoot":"","sources":["../../src/content/useContentSeo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAG9B,OAAO,EAAU,KAAK,SAAS,EAAiB,MAAM,uBAAuB,CAAA;AAE7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD;;;;GAIG;AACH,wBAAgB,aAAa,CAC5B,IAAI,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC,EACzC,MAAM,EAAE,SAAS,GACf,IAAI,CAqBN"}
1
+ {"version":3,"file":"useContentSeo.d.ts","sourceRoot":"","sources":["../../src/content/useContentSeo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAI3C,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAG7C,KAAK,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;AAE/C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC5B,IAAI,EAAE,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,EAC1C,IAAI,EAAE,MAAM,QAAQ,GAAG,IAAI,GAAG,SAAS,GACrC,IAAI,CAmDN"}
package/dist/core.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { App } from 'vue';
2
2
  import { Router } from 'vue-router';
3
3
  import { BlockModule } from './defineBlock';
4
- import { StrategyOptions } from './localeStrategy';
4
+ import { LocaleStrategy, StrategyOptions } from './localeStrategy';
5
5
  import { BlockComponent, BlockDefinition } from './schema';
6
6
  import { BloxAdminConfig } from './symbols';
7
7
  /** Either a full `{ component, schema }` definition or a self-defining component (used `defineBlock()`). */
@@ -38,6 +38,8 @@ export declare class BloxInstance {
38
38
  private _strategy;
39
39
  private _adminEdit?;
40
40
  constructor(options?: BloxOptions);
41
+ /** The active locale strategy (path/domain). Used by the nav guard. */
42
+ get strategy(): LocaleStrategy;
41
43
  registerModules(modules: BlockModule[] | Record<string, BlockModule>): this;
42
44
  registerComponents(components: Record<string, BloxComponent>): this;
43
45
  /** The resolved block registry (type → definition with component + schema). */
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAa,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,KAAK,EAAkB,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAc,MAAM,WAAW,CAAA;AAoB5D,4GAA4G;AAC5G,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,cAAc,CAAA;AAE5D,MAAM,WAAW,WAAY,SAAQ,eAAe;IACnD,qIAAqI;IACrI,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IAC1C;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IACrD,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gFAAgF;IAChF,SAAS,CAAC,EAAE,eAAe,CAAA;CAC3B;AAED,qBAAa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E,GAAG,KAAK,GAAG,KAAK,IAAI,CAAA;SACvC,CAAA;KACD,CAAA;CACD;AAED,MAAM,WAAW,aAAa;IAC7B,GAAG,EAAE,GAAG,CAAA;IACR,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,YAAY,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CA+I1E"}
@@ -0,0 +1,91 @@
1
+ import { App, MaybeRefOrGetter, Ref } from 'vue';
2
+ export declare const BLOX_DATA_WINDOW_KEY: "__BLOX_DATA__";
3
+ export declare const BLOX_DATA_KEY: unique symbol;
4
+ /** Per-page SEO overrides a block can set during SSR (see `useSeo`). */
5
+ export interface BloxSeoHead {
6
+ title?: string;
7
+ description?: string;
8
+ image?: string;
9
+ /**
10
+ * Per-locale alternate URLs for hreflang. Map of `locale → absolute-or-root
11
+ * path` (e.g. `{ en: '/event/rome', it: '/it/event/roma' }`). Detail pages
12
+ * (blog/event/product) contribute this so hreflang points at each locale's
13
+ * real prerendered URL — CMS pages get theirs from the backend resolve-path
14
+ * instead. Emitted by `buildPageHead` when present.
15
+ */
16
+ alternates?: Record<string, string>;
17
+ }
18
+ export interface BloxDataRegistry {
19
+ /** Resolved values collected during SSR, serialized into the payload. */
20
+ readonly ssr: Map<string, unknown>;
21
+ /** Hydration payload read from `window.__BLOX_DATA__` on the client. */
22
+ readonly payload: Record<string, unknown> | null;
23
+ /** True while rendering on the server (collect phase). */
24
+ readonly isServer: boolean;
25
+ /** SEO head override collected during SSR (last writer wins). */
26
+ seo: BloxSeoHead;
27
+ /** SEO source getters registered by `useSeo`, evaluated *after* render. */
28
+ readonly seoSources: Array<() => BloxSeoHead | null | undefined>;
29
+ }
30
+ export interface UseDataResult<T> {
31
+ /** Reactive data — populated synchronously on server/hydration, async on SPA nav. */
32
+ data: Ref<T>;
33
+ /** True only while a client-side (SPA) fetch is in flight. */
34
+ pending: Ref<boolean>;
35
+ /** Last error thrown by the fetcher, if any. */
36
+ error: Ref<unknown>;
37
+ /** Imperatively re-run the fetcher (always hits the network). */
38
+ refresh: () => Promise<void>;
39
+ }
40
+ export interface UseDataOptions<T> {
41
+ /** Value used before the first resolution (SPA nav) and as SSR fallback on error. */
42
+ default: T;
43
+ /**
44
+ * When false, skip SSR prefetch for this key (client-only data, e.g. it depends
45
+ * on `window`/user state). Defaults to true.
46
+ */
47
+ server?: boolean;
48
+ }
49
+ /**
50
+ * Create the per-app data registry and provide it. Call once per app instance.
51
+ *
52
+ * @param opts.server Explicit "this is a server/SSG render" flag. Required
53
+ * because the SSG runtime polyfills `window` (happy-dom), so `typeof window`
54
+ * cannot distinguish server from client. The SSR entry passes `true`; the
55
+ * client `createBloxApp` passes `false` (default).
56
+ */
57
+ export declare function provideBloxData(app: App, opts?: {
58
+ server?: boolean;
59
+ }): BloxDataRegistry;
60
+ /** Public accessor for the per-request data registry (SSR detection, SEO). */
61
+ export declare function getRegistryData(): BloxDataRegistry | null;
62
+ /**
63
+ * Serialize everything collected during an SSR render into a payload object.
64
+ * Call after `renderToString` resolves. Returns `{}` if nothing was collected.
65
+ */
66
+ export declare function collectBloxData(registry: BloxDataRegistry): Record<string, unknown>;
67
+ /**
68
+ * Set per-page SEO head (title/description/image) from block data.
69
+ *
70
+ * - SSR: collected into the registry (after data prefetch) and merged into the
71
+ * prerendered `<head>` — so detail pages get real titles/OG tags.
72
+ * - Client: updates `document.title` on change (SPA navigation).
73
+ *
74
+ * @param source Getter returning the head values (may read reactive data).
75
+ */
76
+ export declare function useSeo(source: () => BloxSeoHead | null | undefined): void;
77
+ /**
78
+ * Evaluate all `useSeo` sources and return the merged head. Call AFTER
79
+ * `renderToString` resolves so the sources read fully-resolved data.
80
+ */
81
+ export declare function collectBloxSeo(registry: BloxDataRegistry): BloxSeoHead;
82
+ /**
83
+ * Declare a keyed data dependency.
84
+ *
85
+ * @param key Stable, unique cache key — a string, ref, or getter. Include
86
+ * locale + params (e.g. `blog:it`, `product:<slug>:it`). When the
87
+ * key changes on the client (SPA navigation), the data re-fetches.
88
+ * @param fetcher Async function that returns the data for the current key.
89
+ */
90
+ export declare function useData<T>(key: MaybeRefOrGetter<string>, fetcher: () => Promise<T>, options: UseDataOptions<T>): UseDataResult<T>;
91
+ //# sourceMappingURL=useData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useData.d.ts","sourceRoot":"","sources":["../../src/data/useData.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAGrD,eAAO,MAAM,oBAAoB,EAAG,eAAwB,CAAA;AAC5D,eAAO,MAAM,aAAa,eAAsB,CAAA;AAEhD,wEAAwE;AACxE,MAAM,WAAW,WAAW;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACnC;AAED,MAAM,WAAW,gBAAgB;IAChC,yEAAyE;IACzE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAChD,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,iEAAiE;IACjE,GAAG,EAAE,WAAW,CAAA;IAChB,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;CAChE;AAED,MAAM,WAAW,aAAa,CAAC,CAAC;IAC/B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