@bagelink/blox 1.15.55 → 1.15.57

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.
@@ -0,0 +1,75 @@
1
+ import { Component, PropType } from 'vue';
2
+ /**
3
+ * Wrapper that renders a *dynamic* global block — one created via the page
4
+ * designer's "Duplicate as global" action, identified by `props._globalRef`.
5
+ *
6
+ * Unlike static global blocks (which read a fixed datastore singleton from
7
+ * inside their own component, e.g. `FooterBlox` reading `site-footer`), a
8
+ * reference block carries no inline content. This host resolves the shared
9
+ * content by `_globalRef` through the injected {@link GlobalBlockResolver} and
10
+ * merges it over the block's defaults before rendering the real component.
11
+ *
12
+ * It also listens for the editor's `BLOX_REFRESH_GLOBAL` message so saving the
13
+ * block in the designer updates the live preview without a reload.
14
+ */
15
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
16
+ /** The resolved block component to render. */
17
+ component: {
18
+ type: PropType<Component>;
19
+ required: true;
20
+ };
21
+ /** Block-level defaults (from the block's schema). */
22
+ defaults: {
23
+ type: PropType<Record<string, unknown>>;
24
+ default: () => Record<string, unknown>;
25
+ };
26
+ /** The reference block's props (includes `_globalRef`, no real content). */
27
+ blockProps: {
28
+ type: PropType<Record<string, unknown>>;
29
+ default: () => Record<string, unknown>;
30
+ };
31
+ /** The dynamic global reference id. */
32
+ globalRef: {
33
+ type: StringConstructor;
34
+ required: true;
35
+ };
36
+ /** The block type, used to match targeted refresh messages. */
37
+ blockType: {
38
+ type: StringConstructor;
39
+ default: string;
40
+ };
41
+ }>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
42
+ [key: string]: any;
43
+ }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
44
+ /** The resolved block component to render. */
45
+ component: {
46
+ type: PropType<Component>;
47
+ required: true;
48
+ };
49
+ /** Block-level defaults (from the block's schema). */
50
+ defaults: {
51
+ type: PropType<Record<string, unknown>>;
52
+ default: () => Record<string, unknown>;
53
+ };
54
+ /** The reference block's props (includes `_globalRef`, no real content). */
55
+ blockProps: {
56
+ type: PropType<Record<string, unknown>>;
57
+ default: () => Record<string, unknown>;
58
+ };
59
+ /** The dynamic global reference id. */
60
+ globalRef: {
61
+ type: StringConstructor;
62
+ required: true;
63
+ };
64
+ /** The block type, used to match targeted refresh messages. */
65
+ blockType: {
66
+ type: StringConstructor;
67
+ default: string;
68
+ };
69
+ }>> & Readonly<{}>, {
70
+ defaults: Record<string, unknown>;
71
+ blockProps: Record<string, unknown>;
72
+ blockType: string;
73
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
74
+ export default _default;
75
+ //# sourceMappingURL=GlobalBlockHost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlobalBlockHost.d.ts","sourceRoot":"","sources":["../src/GlobalBlockHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAK9C;;;;;;;;;;;;GAYG;;IAID,8CAA8C;;cAEjB,QAAQ,CAAC,SAAS,CAAC;;;IAGhD,sDAAsD;;cAErC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;uBACpC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;IAErC,4EAA4E;;cAE3D,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;uBACpC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;IAErC,uCAAuC;;;;;IAKvC,+DAA+D;;;;;;;;IApB/D,8CAA8C;;cAEjB,QAAQ,CAAC,SAAS,CAAC;;;IAGhD,sDAAsD;;cAErC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;uBACpC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;IAErC,4EAA4E;;cAE3D,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;uBACpC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;IAErC,uCAAuC;;;;;IAKvC,+DAA+D;;;;;;;;;;AAvBjE,wBAyEE"}
@@ -1 +1 @@
1
- {"version":3,"file":"PageRenderer.d.ts","sourceRoot":"","sources":["../src/PageRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;;;cAQtB,QAAQ,CAAC,KAAK,EAAE,CAAC;uBACnB,KAAK,EAAE;;;;;;cADL,QAAQ,CAAC,KAAK,EAAE,CAAC;uBACnB,KAAK,EAAE;;;;;AALvB,wBAqBE"}
1
+ {"version":3,"file":"PageRenderer.d.ts","sourceRoot":"","sources":["../src/PageRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;;;cAUtB,QAAQ,CAAC,KAAK,EAAE,CAAC;uBACnB,KAAK,EAAE;;;;;;cADL,QAAQ,CAAC,KAAK,EAAE,CAAC;uBACnB,KAAK,EAAE;;;;;AALvB,wBAgCE"}
@@ -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-y8aUlctU.cjs");
3
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-bIPmNO4K.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-weDpp7Uy.js";
1
+ import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-CbtS5GCv.js";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
@@ -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, u as useLocale } from "./core-CIFcs9Cn.js";
2
+ import { B as BLOX_REGISTRY_KEY, g as globalRefOf, G as GlobalBlockHost, u as useLocale } from "./core-Cz6zN6jB.js";
3
3
  function sendToEditor(msg) {
4
4
  window.parent.postMessage(msg, "*");
5
5
  }
@@ -91,7 +91,8 @@ const PreviewRenderer = defineComponent({
91
91
  const isSelected = props.selectedIndex === i;
92
92
  const isHovered = (props.hoveredIndex === i || localHovered.value === i) && !isSelected;
93
93
  const { label } = definition.schema;
94
- const isGlobal = props.globalBlockTypes.includes(block.type);
94
+ const globalRef = globalRefOf(block);
95
+ const isGlobal = props.globalBlockTypes.includes(block.type) || !!globalRef;
95
96
  const palette = isGlobal ? GLOBAL : REGULAR;
96
97
  const overlayStyle = { ...overlayBaseFor(palette.rgb) };
97
98
  if (isSelected) {
@@ -122,7 +123,13 @@ const PreviewRenderer = defineComponent({
122
123
  "onMouseleave": onBlockLeave
123
124
  },
124
125
  [
125
- h(definition.component, { ...definition.schema.defaults, ...block.props }),
126
+ globalRef ? h(GlobalBlockHost, {
127
+ component: definition.component,
128
+ defaults: definition.schema.defaults,
129
+ blockProps: block.props,
130
+ globalRef,
131
+ blockType: block.type
132
+ }) : h(definition.component, { ...definition.schema.defaults, ...block.props }),
126
133
  h("div", { style: overlayStyle }),
127
134
  (isSelected || isHovered) && h("div", { style: labelStyle }, label)
128
135
  ]
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const vue = require("vue");
3
- const core = require("./core-ZJ2VPvQb.cjs");
3
+ const core = require("./core-inrQh-VF.cjs");
4
4
  function sendToEditor(msg) {
5
5
  window.parent.postMessage(msg, "*");
6
6
  }
@@ -92,7 +92,8 @@ 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 isGlobal = props.globalBlockTypes.includes(block.type);
95
+ const globalRef = core.globalRefOf(block);
96
+ const isGlobal = props.globalBlockTypes.includes(block.type) || !!globalRef;
96
97
  const palette = isGlobal ? GLOBAL : REGULAR;
97
98
  const overlayStyle = { ...overlayBaseFor(palette.rgb) };
98
99
  if (isSelected) {
@@ -123,7 +124,13 @@ const PreviewRenderer = vue.defineComponent({
123
124
  "onMouseleave": onBlockLeave
124
125
  },
125
126
  [
126
- vue.h(definition.component, { ...definition.schema.defaults, ...block.props }),
127
+ globalRef ? vue.h(core.GlobalBlockHost, {
128
+ component: definition.component,
129
+ defaults: definition.schema.defaults,
130
+ blockProps: block.props,
131
+ globalRef,
132
+ blockType: block.type
133
+ }) : vue.h(definition.component, { ...definition.schema.defaults, ...block.props }),
127
134
  vue.h("div", { style: overlayStyle }),
128
135
  (isSelected || isHovered) && vue.h("div", { style: labelStyle }, label)
129
136
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"PreviewRenderer.d.ts","sourceRoot":"","sources":["../src/PreviewRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;;;cAatB,QAAQ,CAAC,KAAK,EAAE,CAAC;uBACnB,KAAK,EAAE;;;cAGJ,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;;cAIvB,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;IAGxC,oFAAoF;;cAEpE,QAAQ,CAAC,MAAM,EAAE,CAAC;uBACpB,MAAM,EAAE;;;;;;cAdN,QAAQ,CAAC,KAAK,EAAE,CAAC;uBACnB,KAAK,EAAE;;;cAGJ,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;;cAIvB,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;IAGxC,oFAAoF;;cAEpE,QAAQ,CAAC,MAAM,EAAE,CAAC;uBACpB,MAAM,EAAE;;;;;;;;AAlBxB,wBA8HE"}
1
+ {"version":3,"file":"PreviewRenderer.d.ts","sourceRoot":"","sources":["../src/PreviewRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;;;cAetB,QAAQ,CAAC,KAAK,EAAE,CAAC;uBACnB,KAAK,EAAE;;;cAGJ,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;;cAIvB,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;IAGxC,oFAAoF;;cAEpE,QAAQ,CAAC,MAAM,EAAE,CAAC;uBACpB,MAAM,EAAE;;;;;;cAdN,QAAQ,CAAC,KAAK,EAAE,CAAC;uBACnB,KAAK,EAAE;;;cAGJ,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;;cAIvB,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;IAGxC,oFAAoF;;cAEpE,QAAQ,CAAC,MAAM,EAAE,CAAC;uBACpB,MAAM,EAAE;;;;;;;;AAlBxB,wBAuIE"}
@@ -2,7 +2,7 @@ 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 { BLOX_WEBSITE_ID_WINDOW_KEY, BLOX_STATE_WINDOW_KEY } from "./ssg/client.mjs";
5
- import { computed, ref, defineComponent, inject, h, provide, watch, resolveComponent, openBlock, createElementBlock, createVNode, unref, createElementVNode, toDisplayString, withCtx, createTextVNode, Fragment, createCommentVNode, createBlock, normalizeProps, guardReactiveProps, renderSlot } from "vue";
5
+ import { computed, ref, defineComponent, inject, onMounted, onUnmounted, watch, h, provide, resolveComponent, openBlock, createElementBlock, createVNode, unref, createElementVNode, toDisplayString, withCtx, createTextVNode, Fragment, createCommentVNode, createBlock, normalizeProps, guardReactiveProps, renderSlot } from "vue";
6
6
  import { useRoute, useRouter, RouterLink } from "vue-router";
7
7
  import { getI18n, Loading } from "@bagelink/vue";
8
8
  const BASE = "/api";
@@ -76,6 +76,79 @@ function useLocale() {
76
76
  const BLOX_REGISTRY_KEY = Symbol("blox:registry");
77
77
  const BLOX_CONFIG_KEY = Symbol("blox:config");
78
78
  const BLOX_LOCALE_STRATEGY_KEY = Symbol("blox:locale-strategy");
79
+ const BLOX_GLOBAL_RESOLVER_KEY = Symbol("blox:global-resolver");
80
+ const GlobalBlockHost = defineComponent({
81
+ name: "GlobalBlockHost",
82
+ props: {
83
+ /** The resolved block component to render. */
84
+ component: {
85
+ type: [Object, Function],
86
+ required: true
87
+ },
88
+ /** Block-level defaults (from the block's schema). */
89
+ defaults: {
90
+ type: Object,
91
+ default: () => ({})
92
+ },
93
+ /** The reference block's props (includes `_globalRef`, no real content). */
94
+ blockProps: {
95
+ type: Object,
96
+ default: () => ({})
97
+ },
98
+ /** The dynamic global reference id. */
99
+ globalRef: {
100
+ type: String,
101
+ required: true
102
+ },
103
+ /** The block type, used to match targeted refresh messages. */
104
+ blockType: {
105
+ type: String,
106
+ default: ""
107
+ }
108
+ },
109
+ setup(props) {
110
+ const resolver = inject(BLOX_GLOBAL_RESOLVER_KEY, null);
111
+ const remote = ref(null);
112
+ async function load() {
113
+ if (!resolver) return;
114
+ try {
115
+ remote.value = await resolver(props.globalRef);
116
+ } catch (e) {
117
+ console.warn(`[GlobalBlockHost] failed to resolve "${props.globalRef}"`, e);
118
+ }
119
+ }
120
+ function onEditorMessage(event) {
121
+ const msg = event.data;
122
+ if ((msg == null ? void 0 : msg.type) !== "BLOX_REFRESH_GLOBAL") return;
123
+ if (!msg.block || msg.block === props.blockType) void load();
124
+ }
125
+ onMounted(() => {
126
+ void load();
127
+ if (typeof window !== "undefined") {
128
+ window.addEventListener("message", onEditorMessage);
129
+ }
130
+ });
131
+ onUnmounted(() => {
132
+ if (typeof window !== "undefined") {
133
+ window.removeEventListener("message", onEditorMessage);
134
+ }
135
+ });
136
+ watch(() => props.globalRef, () => {
137
+ void load();
138
+ });
139
+ return () => {
140
+ const { _globalRef, ...inlineProps } = props.blockProps;
141
+ const merged = { ...props.defaults, ...inlineProps, ...remote.value ?? {} };
142
+ return h(props.component, merged);
143
+ };
144
+ }
145
+ });
146
+ const GLOBAL_REF_KEY = "_globalRef";
147
+ function globalRefOf(block) {
148
+ var _a;
149
+ const ref2 = (_a = block == null ? void 0 : block.props) == null ? void 0 : _a[GLOBAL_REF_KEY];
150
+ return typeof ref2 === "string" && ref2 ? ref2 : null;
151
+ }
79
152
  const PageRenderer = defineComponent({
80
153
  name: "PageRenderer",
81
154
  props: {
@@ -91,8 +164,19 @@ const PageRenderer = defineComponent({
91
164
  props.blocks.flatMap((block, i) => {
92
165
  const definition = registry[block.type];
93
166
  if (!definition) return [];
94
- const props2 = { ...definition.schema.defaults, ...block.props };
95
- return [h(definition.component, { key: i, ...props2 })];
167
+ const ref2 = globalRefOf(block);
168
+ if (ref2) {
169
+ return [h(GlobalBlockHost, {
170
+ key: i,
171
+ component: definition.component,
172
+ defaults: definition.schema.defaults,
173
+ blockProps: block.props,
174
+ globalRef: ref2,
175
+ blockType: block.type
176
+ })];
177
+ }
178
+ const merged = { ...definition.schema.defaults, ...block.props };
179
+ return [h(definition.component, { key: i, ...merged })];
96
180
  })
97
181
  );
98
182
  }
@@ -403,7 +487,7 @@ class BloxInstance {
403
487
  }
404
488
  router.addRoute({
405
489
  path: "/_blox_preview",
406
- component: () => import("./PreviewApp-BrpFk5Ud.js"),
490
+ component: () => import("./PreviewApp-eIzHiJ-a.js"),
407
491
  beforeEnter: () => window.parent !== window ? true : "/"
408
492
  });
409
493
  router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$1 });
@@ -453,13 +537,17 @@ function createBlox(options) {
453
537
  }
454
538
  export {
455
539
  BLOX_REGISTRY_KEY as B,
540
+ GlobalBlockHost as G,
456
541
  PageRenderer as P,
457
542
  _sfc_main$1 as _,
458
543
  BLOX_LOCALE_STRATEGY_KEY as a,
459
544
  BLOX_CONFIG_KEY as b,
460
545
  createBlox as c,
461
- BloxInstance as d,
462
- configureApi as e,
546
+ BLOX_GLOBAL_RESOLVER_KEY as d,
547
+ BloxInstance as e,
548
+ GLOBAL_REF_KEY as f,
549
+ globalRefOf as g,
550
+ configureApi as h,
463
551
  listItems as l,
464
552
  resolvePath as r,
465
553
  useLocale as u
@@ -77,6 +77,79 @@ function useLocale() {
77
77
  const BLOX_REGISTRY_KEY = Symbol("blox:registry");
78
78
  const BLOX_CONFIG_KEY = Symbol("blox:config");
79
79
  const BLOX_LOCALE_STRATEGY_KEY = Symbol("blox:locale-strategy");
80
+ const BLOX_GLOBAL_RESOLVER_KEY = Symbol("blox:global-resolver");
81
+ const GlobalBlockHost = vue.defineComponent({
82
+ name: "GlobalBlockHost",
83
+ props: {
84
+ /** The resolved block component to render. */
85
+ component: {
86
+ type: [Object, Function],
87
+ required: true
88
+ },
89
+ /** Block-level defaults (from the block's schema). */
90
+ defaults: {
91
+ type: Object,
92
+ default: () => ({})
93
+ },
94
+ /** The reference block's props (includes `_globalRef`, no real content). */
95
+ blockProps: {
96
+ type: Object,
97
+ default: () => ({})
98
+ },
99
+ /** The dynamic global reference id. */
100
+ globalRef: {
101
+ type: String,
102
+ required: true
103
+ },
104
+ /** The block type, used to match targeted refresh messages. */
105
+ blockType: {
106
+ type: String,
107
+ default: ""
108
+ }
109
+ },
110
+ setup(props) {
111
+ const resolver = vue.inject(BLOX_GLOBAL_RESOLVER_KEY, null);
112
+ const remote = vue.ref(null);
113
+ async function load() {
114
+ if (!resolver) return;
115
+ try {
116
+ remote.value = await resolver(props.globalRef);
117
+ } catch (e) {
118
+ console.warn(`[GlobalBlockHost] failed to resolve "${props.globalRef}"`, e);
119
+ }
120
+ }
121
+ function onEditorMessage(event) {
122
+ const msg = event.data;
123
+ if ((msg == null ? void 0 : msg.type) !== "BLOX_REFRESH_GLOBAL") return;
124
+ if (!msg.block || msg.block === props.blockType) void load();
125
+ }
126
+ vue.onMounted(() => {
127
+ void load();
128
+ if (typeof window !== "undefined") {
129
+ window.addEventListener("message", onEditorMessage);
130
+ }
131
+ });
132
+ vue.onUnmounted(() => {
133
+ if (typeof window !== "undefined") {
134
+ window.removeEventListener("message", onEditorMessage);
135
+ }
136
+ });
137
+ vue.watch(() => props.globalRef, () => {
138
+ void load();
139
+ });
140
+ return () => {
141
+ const { _globalRef, ...inlineProps } = props.blockProps;
142
+ const merged = { ...props.defaults, ...inlineProps, ...remote.value ?? {} };
143
+ return vue.h(props.component, merged);
144
+ };
145
+ }
146
+ });
147
+ const GLOBAL_REF_KEY = "_globalRef";
148
+ function globalRefOf(block) {
149
+ var _a;
150
+ const ref = (_a = block == null ? void 0 : block.props) == null ? void 0 : _a[GLOBAL_REF_KEY];
151
+ return typeof ref === "string" && ref ? ref : null;
152
+ }
80
153
  const PageRenderer = vue.defineComponent({
81
154
  name: "PageRenderer",
82
155
  props: {
@@ -92,8 +165,19 @@ const PageRenderer = vue.defineComponent({
92
165
  props.blocks.flatMap((block, i) => {
93
166
  const definition = registry[block.type];
94
167
  if (!definition) return [];
95
- const props2 = { ...definition.schema.defaults, ...block.props };
96
- return [vue.h(definition.component, { key: i, ...props2 })];
168
+ const ref = globalRefOf(block);
169
+ if (ref) {
170
+ return [vue.h(GlobalBlockHost, {
171
+ key: i,
172
+ component: definition.component,
173
+ defaults: definition.schema.defaults,
174
+ blockProps: block.props,
175
+ globalRef: ref,
176
+ blockType: block.type
177
+ })];
178
+ }
179
+ const merged = { ...definition.schema.defaults, ...block.props };
180
+ return [vue.h(definition.component, { key: i, ...merged })];
97
181
  })
98
182
  );
99
183
  }
@@ -404,7 +488,7 @@ class BloxInstance {
404
488
  }
405
489
  router.addRoute({
406
490
  path: "/_blox_preview",
407
- component: () => Promise.resolve().then(() => require("./PreviewApp-C6NyDvt7.cjs")),
491
+ component: () => Promise.resolve().then(() => require("./PreviewApp-B-0N8xJy.cjs")),
408
492
  beforeEnter: () => window.parent !== window ? true : "/"
409
493
  });
410
494
  router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$1 });
@@ -453,13 +537,17 @@ function createBlox(options) {
453
537
  return instance;
454
538
  }
455
539
  exports.BLOX_CONFIG_KEY = BLOX_CONFIG_KEY;
540
+ exports.BLOX_GLOBAL_RESOLVER_KEY = BLOX_GLOBAL_RESOLVER_KEY;
456
541
  exports.BLOX_LOCALE_STRATEGY_KEY = BLOX_LOCALE_STRATEGY_KEY;
457
542
  exports.BLOX_REGISTRY_KEY = BLOX_REGISTRY_KEY;
458
543
  exports.BloxInstance = BloxInstance;
544
+ exports.GLOBAL_REF_KEY = GLOBAL_REF_KEY;
545
+ exports.GlobalBlockHost = GlobalBlockHost;
459
546
  exports.PageRenderer = PageRenderer;
460
547
  exports._sfc_main = _sfc_main$1;
461
548
  exports.configureApi = configureApi;
462
549
  exports.createBlox = createBlox;
550
+ exports.globalRefOf = globalRefOf;
463
551
  exports.listItems = listItems;
464
552
  exports.resolvePath = resolvePath;
465
553
  exports.useLocale = useLocale;
@@ -0,0 +1,9 @@
1
+ import { Block } from './api/types';
2
+ /** Prop key used to mark a block as a reference to a dynamic global block. */
3
+ export declare const GLOBAL_REF_KEY = "_globalRef";
4
+ /**
5
+ * Read the dynamic global-block reference id off a block, if present.
6
+ * Returns `null` for regular blocks (no `_globalRef` prop).
7
+ */
8
+ export declare function globalRefOf(block: Block | null | undefined): string | null;
9
+ //# sourceMappingURL=globalRef.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globalRef.d.ts","sourceRoot":"","sources":["../src/globalRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC,8EAA8E;AAC9E,eAAO,MAAM,cAAc,eAAe,CAAA;AAE1C;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAG1E"}
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const core = require("./core-ZJ2VPvQb.cjs");
4
- const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-y8aUlctU.cjs");
3
+ const core = require("./core-inrQh-VF.cjs");
4
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-bIPmNO4K.cjs");
5
5
  const vue = require("vue");
6
6
  const vueRouter = require("vue-router");
7
7
  const pinia = require("pinia");
@@ -134,12 +134,16 @@ function defineBlock(meta) {
134
134
  return meta;
135
135
  }
136
136
  exports.BLOX_CONFIG_KEY = core.BLOX_CONFIG_KEY;
137
+ exports.BLOX_GLOBAL_RESOLVER_KEY = core.BLOX_GLOBAL_RESOLVER_KEY;
137
138
  exports.BLOX_LOCALE_STRATEGY_KEY = core.BLOX_LOCALE_STRATEGY_KEY;
138
139
  exports.BloxInstance = core.BloxInstance;
139
140
  exports.CmsPageView = core._sfc_main;
141
+ exports.GLOBAL_REF_KEY = core.GLOBAL_REF_KEY;
142
+ exports.GlobalBlockHost = core.GlobalBlockHost;
140
143
  exports.PageRenderer = core.PageRenderer;
141
144
  exports.configureApi = core.configureApi;
142
145
  exports.createBlox = core.createBlox;
146
+ exports.globalRefOf = core.globalRefOf;
143
147
  exports.listItems = core.listItems;
144
148
  exports.resolvePath = core.resolvePath;
145
149
  exports.useLocale = core.useLocale;
package/dist/index.d.ts CHANGED
@@ -21,6 +21,8 @@ export { default as PageRenderer } from './PageRenderer';
21
21
  export { default as PreviewApp } from './PreviewApp.vue';
22
22
  export { default as PreviewRenderer } from './PreviewRenderer';
23
23
  export type { BlockComponent, BlockDefinition, BlockSchema } from './schema';
24
- export { BLOX_CONFIG_KEY, BLOX_LOCALE_STRATEGY_KEY } from './symbols';
25
- export type { BloxConfig } from './symbols';
24
+ export { BLOX_CONFIG_KEY, BLOX_GLOBAL_RESOLVER_KEY, BLOX_LOCALE_STRATEGY_KEY } from './symbols';
25
+ export type { BloxConfig, GlobalBlockResolver } from './symbols';
26
+ export { GLOBAL_REF_KEY, globalRefOf } from './globalRef';
27
+ export { default as GlobalBlockHost } from './GlobalBlockHost';
26
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAClE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAKnD,YAAY,EACX,cAAc,EACd,KAAK,EAEL,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,cAAc,EACd,QAAQ,EACR,eAAe,EACf,cAAc,EACd,WAAW,GACX,MAAM,aAAa,CAAA;AAIpB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACtD,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAK1D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AAC3F,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,YAAY,EAAE,MAAM,EAAE,MAAM,yBAAyB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,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAE/F,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAEhE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { a as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, c as createBlox } from "./core-CIFcs9Cn.js";
2
- import { b, d, _, P, e, l, r } from "./core-CIFcs9Cn.js";
3
- import { _ as _2, P as P2, s, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-weDpp7Uy.js";
1
+ import { a as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, c as createBlox } from "./core-Cz6zN6jB.js";
2
+ import { b, d, e, _, f, G, P, h, g, l, r } from "./core-Cz6zN6jB.js";
3
+ import { _ as _2, P as P2, s, a } from "./PreviewApp.vue_vue_type_style_index_0_lang-CbtS5GCv.js";
4
4
  import { ref, onMounted, onUnmounted, inject, computed, createApp, markRaw } from "vue";
5
5
  import { useRouter } from "vue-router";
6
6
  import { createPinia } from "pinia";
@@ -134,16 +134,20 @@ function defineBlock(meta) {
134
134
  }
135
135
  export {
136
136
  b as BLOX_CONFIG_KEY,
137
+ d as BLOX_GLOBAL_RESOLVER_KEY,
137
138
  BLOX_LOCALE_STRATEGY_KEY,
138
- d as BloxInstance,
139
+ e as BloxInstance,
139
140
  _ as CmsPageView,
141
+ f as GLOBAL_REF_KEY,
142
+ G as GlobalBlockHost,
140
143
  P as PageRenderer,
141
144
  _2 as PreviewApp,
142
145
  P2 as PreviewRenderer,
143
- e as configureApi,
146
+ h as configureApi,
144
147
  createBlox,
145
148
  createBloxApp,
146
149
  defineBlock,
150
+ g as globalRefOf,
147
151
  l as listItems,
148
152
  r as resolvePath,
149
153
  s as sendToEditor,
@@ -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-ZJ2VPvQb.cjs");
29
+ const core = require("../core-inrQh-VF.cjs");
30
30
  async function renderBloxSsgPage(options) {
31
31
  const {
32
32
  url,
@@ -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-CIFcs9Cn.js";
7
+ import { c as createBlox } from "../core-Cz6zN6jB.js";
8
8
  async function renderBloxSsgPage(options) {
9
9
  const {
10
10
  url,
package/dist/symbols.d.ts CHANGED
@@ -8,4 +8,15 @@ export interface BloxConfig {
8
8
  }
9
9
  export declare const BLOX_CONFIG_KEY: InjectionKey<BloxConfig>;
10
10
  export declare const BLOX_LOCALE_STRATEGY_KEY: InjectionKey<LocaleStrategy>;
11
+ /**
12
+ * Resolves the shared content of a *dynamic* global block by its reference id
13
+ * (the `props._globalRef` written by the page designer's "Duplicate as global").
14
+ *
15
+ * Returns the saved props object, or `null` when nothing is stored. Typically
16
+ * backed by the project's datastore-based global-block registry. Injected by the
17
+ * host app so `@bagelink/blox` stays storage-agnostic; when not provided,
18
+ * reference blocks fall back to their inline `props`.
19
+ */
20
+ export type GlobalBlockResolver = (ref: string) => Promise<Record<string, unknown> | null>;
21
+ export declare const BLOX_GLOBAL_RESOLVER_KEY: InjectionKey<GlobalBlockResolver>;
11
22
  //# sourceMappingURL=symbols.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../src/symbols.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;A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,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/blox",
3
3
  "type": "module",
4
- "version": "1.15.55",
4
+ "version": "1.15.57",
5
5
  "description": "Blox page builder library for drag-and-drop page building and static data management",
6
6
  "author": {
7
7
  "name": "Bagel Studio",