@bagelink/blox 1.12.36 → 1.12.42

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.
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-B0N5QbfS.js";
1
+ import { _ as _sfc_main } from "./PreviewApp.vue_vue_type_style_index_0_lang-BkGWMbsE.js";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
@@ -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-BTuE4GmT.cjs");
3
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-CFS05Itn.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":";AA0QA,wBAMG"}
1
+ {"version":3,"file":"PreviewApp.vue.d.ts","sourceRoot":"","sources":["../src/PreviewApp.vue"],"names":[],"mappings":";AAyNA,wBAMG"}
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, inject, ref, h, provide, onMounted, onUnmounted, createElementBlock, openBlock, createVNode, unref, nextTick } from "vue";
2
- import { e as BLOX_REGISTRY_KEY, u as useLocale } from "./core-C3Iu5qa2.js";
2
+ import { e as BLOX_REGISTRY_KEY, u as useLocale } from "./core-CPXNfJ-Z.js";
3
3
  function sendToEditor(msg) {
4
4
  window.parent.postMessage(msg, "*");
5
5
  }
@@ -37,6 +37,43 @@ const PreviewRenderer = defineComponent({
37
37
  localHovered.value = null;
38
38
  sendToEditor({ type: "BLOX_BLOCK_HOVER", index: null });
39
39
  }
40
+ const wrapperStyle = { position: "relative", cursor: "pointer" };
41
+ const overlayBase = {
42
+ position: "absolute",
43
+ inset: "0",
44
+ zIndex: "10",
45
+ pointerEvents: "auto",
46
+ transition: "box-shadow 0.12s, background 0.12s"
47
+ };
48
+ const overlayHovered = {
49
+ ...overlayBase,
50
+ boxShadow: "inset 0 0 0 2px rgba(99, 102, 241, 0.5)",
51
+ background: "rgba(99, 102, 241, 0.04)"
52
+ };
53
+ const overlaySelected = {
54
+ ...overlayBase,
55
+ boxShadow: "inset 0 0 0 3px #6366f1",
56
+ background: "rgba(99, 102, 241, 0.06)"
57
+ };
58
+ const labelBase = {
59
+ position: "absolute",
60
+ top: "0",
61
+ left: "0",
62
+ zIndex: "20",
63
+ padding: "2px 8px",
64
+ fontSize: "11px",
65
+ fontFamily: "system-ui, sans-serif",
66
+ fontWeight: "600",
67
+ lineHeight: "20px",
68
+ letterSpacing: "0.02em",
69
+ textTransform: "uppercase",
70
+ pointerEvents: "none",
71
+ whiteSpace: "nowrap",
72
+ color: "#6366f1",
73
+ background: "rgba(99, 102, 241, 0.1)",
74
+ borderBottomRightRadius: "4px"
75
+ };
76
+ const labelSelected = { ...labelBase, color: "#fff", background: "#6366f1" };
40
77
  return () => h(
41
78
  "div",
42
79
  { class: "blox-preview-canvas" },
@@ -46,17 +83,14 @@ const PreviewRenderer = defineComponent({
46
83
  const isSelected = props.selectedIndex === i;
47
84
  const isHovered = (props.hoveredIndex === i || localHovered.value === i) && !isSelected;
48
85
  const { label } = definition.schema;
86
+ const overlayStyle = isSelected ? overlaySelected : isHovered ? overlayHovered : overlayBase;
49
87
  return [
50
88
  h(
51
89
  "div",
52
90
  {
53
91
  "key": i,
54
92
  "data-blox-index": i,
55
- "class": [
56
- "blox-block-wrapper",
57
- isSelected && "blox-block--selected",
58
- isHovered && "blox-block--hovered"
59
- ],
93
+ "style": wrapperStyle,
60
94
  "onClick": () => {
61
95
  onBlockClick(i);
62
96
  },
@@ -67,14 +101,8 @@ const PreviewRenderer = defineComponent({
67
101
  },
68
102
  [
69
103
  h(definition.component, { ...definition.schema.defaults, ...block.props }),
70
- h("div", { class: "blox-block-overlay" }),
71
- (isSelected || isHovered) && h(
72
- "div",
73
- {
74
- class: ["blox-block-label", isSelected && "blox-block-label--selected"]
75
- },
76
- label
77
- )
104
+ h("div", { style: overlayStyle }),
105
+ (isSelected || isHovered) && h("div", { style: isSelected ? labelSelected : labelBase }, label)
78
106
  ]
79
107
  )
80
108
  ];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const vue = require("vue");
3
- const core = require("./core-_fnHoEZN.cjs");
3
+ const core = require("./core-D1FiZJtz.cjs");
4
4
  function sendToEditor(msg) {
5
5
  window.parent.postMessage(msg, "*");
6
6
  }
@@ -38,6 +38,43 @@ const PreviewRenderer = vue.defineComponent({
38
38
  localHovered.value = null;
39
39
  sendToEditor({ type: "BLOX_BLOCK_HOVER", index: null });
40
40
  }
41
+ const wrapperStyle = { position: "relative", cursor: "pointer" };
42
+ const overlayBase = {
43
+ position: "absolute",
44
+ inset: "0",
45
+ zIndex: "10",
46
+ pointerEvents: "auto",
47
+ transition: "box-shadow 0.12s, background 0.12s"
48
+ };
49
+ const overlayHovered = {
50
+ ...overlayBase,
51
+ boxShadow: "inset 0 0 0 2px rgba(99, 102, 241, 0.5)",
52
+ background: "rgba(99, 102, 241, 0.04)"
53
+ };
54
+ const overlaySelected = {
55
+ ...overlayBase,
56
+ boxShadow: "inset 0 0 0 3px #6366f1",
57
+ background: "rgba(99, 102, 241, 0.06)"
58
+ };
59
+ const labelBase = {
60
+ position: "absolute",
61
+ top: "0",
62
+ left: "0",
63
+ zIndex: "20",
64
+ padding: "2px 8px",
65
+ fontSize: "11px",
66
+ fontFamily: "system-ui, sans-serif",
67
+ fontWeight: "600",
68
+ lineHeight: "20px",
69
+ letterSpacing: "0.02em",
70
+ textTransform: "uppercase",
71
+ pointerEvents: "none",
72
+ whiteSpace: "nowrap",
73
+ color: "#6366f1",
74
+ background: "rgba(99, 102, 241, 0.1)",
75
+ borderBottomRightRadius: "4px"
76
+ };
77
+ const labelSelected = { ...labelBase, color: "#fff", background: "#6366f1" };
41
78
  return () => vue.h(
42
79
  "div",
43
80
  { class: "blox-preview-canvas" },
@@ -47,17 +84,14 @@ const PreviewRenderer = vue.defineComponent({
47
84
  const isSelected = props.selectedIndex === i;
48
85
  const isHovered = (props.hoveredIndex === i || localHovered.value === i) && !isSelected;
49
86
  const { label } = definition.schema;
87
+ const overlayStyle = isSelected ? overlaySelected : isHovered ? overlayHovered : overlayBase;
50
88
  return [
51
89
  vue.h(
52
90
  "div",
53
91
  {
54
92
  "key": i,
55
93
  "data-blox-index": i,
56
- "class": [
57
- "blox-block-wrapper",
58
- isSelected && "blox-block--selected",
59
- isHovered && "blox-block--hovered"
60
- ],
94
+ "style": wrapperStyle,
61
95
  "onClick": () => {
62
96
  onBlockClick(i);
63
97
  },
@@ -68,14 +102,8 @@ const PreviewRenderer = vue.defineComponent({
68
102
  },
69
103
  [
70
104
  vue.h(definition.component, { ...definition.schema.defaults, ...block.props }),
71
- vue.h("div", { class: "blox-block-overlay" }),
72
- (isSelected || isHovered) && vue.h(
73
- "div",
74
- {
75
- class: ["blox-block-label", isSelected && "blox-block-label--selected"]
76
- },
77
- label
78
- )
105
+ vue.h("div", { style: overlayStyle }),
106
+ (isSelected || isHovered) && vue.h("div", { style: isSelected ? labelSelected : labelBase }, label)
79
107
  ]
80
108
  )
81
109
  ];
@@ -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;;;;;;;cARxB,QAAQ,CAAC,KAAK,EAAE,CAAC;uBACnB,KAAK,EAAE;;;cAGJ,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;;cAIvB,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;;;;;;AAZ1C,wBA6EE"}
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;;;;;;;cARxB,QAAQ,CAAC,KAAK,EAAE,CAAC;uBACnB,KAAK,EAAE;;;cAGJ,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;;cAIvB,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;;;;;;;;AAZ1C,wBA8FE"}
@@ -397,7 +397,7 @@ class BloxInstance {
397
397
  }
398
398
  router.addRoute({
399
399
  path: "/_blox_preview",
400
- component: () => import("./PreviewApp-CmThrLvv.js"),
400
+ component: () => import("./PreviewApp-BrthGx2F.js"),
401
401
  beforeEnter: () => window.parent !== window ? true : "/"
402
402
  });
403
403
  router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$1 });
@@ -398,7 +398,7 @@ class BloxInstance {
398
398
  }
399
399
  router.addRoute({
400
400
  path: "/_blox_preview",
401
- component: () => Promise.resolve().then(() => require("./PreviewApp-C2T03Jm9.cjs")),
401
+ component: () => Promise.resolve().then(() => require("./PreviewApp-CV_Uh9-d.cjs")),
402
402
  beforeEnter: () => window.parent !== window ? true : "/"
403
403
  });
404
404
  router.addRoute({ path: "/:pathMatch(.*)*", component: _sfc_main$1 });
@@ -1,4 +1,16 @@
1
- import { SchemaDefinition } from '@bagelink/vue';
1
+ /**
2
+ * Loose structural type for a FormFlow schema.
3
+ * Avoids importing `SchemaDefinition` from `@bagelink/vue` directly, which
4
+ * would drag in Vue's `Component` type and cause duplicate-Vue-copy errors
5
+ * in monorepo setups where the consumer resolves a different `vue` package.
6
+ */
7
+ export type BloxSchema = {
8
+ _fields?: Record<string, {
9
+ _config?: {
10
+ default?: unknown;
11
+ };
12
+ }>;
13
+ } & Record<string, any>;
2
14
  export interface BlockMeta {
3
15
  /** Block type key — must be unique across the app. Used as the export name by the Vite plugin. */
4
16
  name: string;
@@ -7,7 +19,7 @@ export interface BlockMeta {
7
19
  /** Material icon name. */
8
20
  icon?: string;
9
21
  /** FormFlow schema for editable props. Omit for blocks with no configurable props. */
10
- schema?: SchemaDefinition;
22
+ schema?: BloxSchema;
11
23
  /** Default prop values. Merged with block props at render time so blocks show content before editing. */
12
24
  defaults?: Record<string, unknown>;
13
25
  description?: string;
@@ -29,11 +41,12 @@ export interface BlockModule {
29
41
  * import { defineBlock } from '@bagelink/blox'
30
42
  * import { defineSchema, $ } from '@bagelink/vue'
31
43
  *
32
- * const schema = defineSchema({ title: $.text('Title') })
44
+ * const schema = defineSchema({ title: $.text('Title', { default: 'Hello' }) })
33
45
  *
34
46
  * defineBlock({ name: 'myBlock', label: 'My Block', icon: 'star', schema })
35
47
  *
36
- * defineProps<{ title: string }>()
48
+ * // Props are optional — defaults are extracted from schema automatically
49
+ * defineProps<{ title?: string }>()
37
50
  * </script>
38
51
  * ```
39
52
  *
@@ -1 +1 @@
1
- {"version":3,"file":"defineBlock.d.ts","sourceRoot":"","sources":["../src/defineBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,MAAM,WAAW,SAAS;IACzB,kGAAkG;IAClG,IAAI,EAAE,MAAM,CAAA;IACZ,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAA;IACb,0BAA0B;IAC1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,WAAW;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAatD"}
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-_fnHoEZN.cjs");
4
- const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-BTuE4GmT.cjs");
3
+ const core = require("./core-D1FiZJtz.cjs");
4
+ const PreviewApp_vue_vue_type_style_index_0_lang = require("./PreviewApp.vue_vue_type_style_index_0_lang-CFS05Itn.cjs");
5
5
  const vue = require("vue");
6
6
  const vueRouter = require("vue-router");
7
7
  const pinia = require("pinia");
@@ -88,6 +88,17 @@ function createBloxApp(options) {
88
88
  return { app, router, blox };
89
89
  }
90
90
  function defineBlock(meta) {
91
+ var _a;
92
+ if (meta.schema && !meta.defaults) {
93
+ const extracted = {};
94
+ for (const [key, field] of Object.entries(meta.schema._fields ?? {})) {
95
+ const val = (_a = field == null ? void 0 : field._config) == null ? void 0 : _a.default;
96
+ if (val !== void 0) extracted[key] = val;
97
+ }
98
+ if (Object.keys(extracted).length > 0) {
99
+ meta.defaults = extracted;
100
+ }
101
+ }
91
102
  return meta;
92
103
  }
93
104
  exports.BLOX_CONFIG_KEY = core.BLOX_CONFIG_KEY;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { B as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, c as createBlox } from "./core-C3Iu5qa2.js";
2
- import { d, b, _, P, a, l, r } from "./core-C3Iu5qa2.js";
3
- import { _ as _2, P as P2, s, a as a2 } from "./PreviewApp.vue_vue_type_style_index_0_lang-B0N5QbfS.js";
1
+ import { B as BLOX_LOCALE_STRATEGY_KEY, u as useLocale, c as createBlox } from "./core-CPXNfJ-Z.js";
2
+ import { d, b, _, P, a, l, r } from "./core-CPXNfJ-Z.js";
3
+ import { _ as _2, P as P2, s, a as a2 } from "./PreviewApp.vue_vue_type_style_index_0_lang-BkGWMbsE.js";
4
4
  import { inject, computed, createApp, markRaw } from "vue";
5
5
  import { useRouter } from "vue-router";
6
6
  import { createPinia } from "pinia";
@@ -87,6 +87,17 @@ function createBloxApp(options) {
87
87
  return { app, router, blox };
88
88
  }
89
89
  function defineBlock(meta) {
90
+ var _a;
91
+ if (meta.schema && !meta.defaults) {
92
+ const extracted = {};
93
+ for (const [key, field] of Object.entries(meta.schema._fields ?? {})) {
94
+ const val = (_a = field == null ? void 0 : field._config) == null ? void 0 : _a.default;
95
+ if (val !== void 0) extracted[key] = val;
96
+ }
97
+ if (Object.keys(extracted).length > 0) {
98
+ meta.defaults = extracted;
99
+ }
100
+ }
90
101
  return meta;
91
102
  }
92
103
  export {
@@ -26,7 +26,7 @@ const prerender = require("../prerender-Bi7YtzSp.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-_fnHoEZN.cjs");
29
+ const core = require("../core-D1FiZJtz.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-C3Iu5qa2.js";
7
+ import { c as createBlox } from "../core-CPXNfJ-Z.js";
8
8
  async function renderBloxSsgPage(options) {
9
9
  const {
10
10
  url,
package/dist/style.css CHANGED
@@ -24,49 +24,5 @@
24
24
  body {
25
25
  margin: 0;
26
26
  }
27
- .blox-block-wrapper {
28
- position: relative;
29
- cursor: pointer;
30
- display: contents;
31
- }
32
- .blox-block-overlay {
33
- position: absolute;
34
- inset: 0;
35
- z-index: 10;
36
- pointer-events: auto;
37
- transition:
38
- box-shadow 0.12s,
39
- background 0.12s;
40
- }
41
- .blox-block--hovered .blox-block-overlay {
42
- box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.5);
43
- background: rgba(99, 102, 241, 0.04);
44
- }
45
- .blox-block--selected .blox-block-overlay {
46
- box-shadow: inset 0 0 0 3px #6366f1;
47
- background: rgba(99, 102, 241, 0.06);
48
- }
49
27
 
50
- /* Label badge */
51
- .blox-block-label {
52
- position: absolute;
53
- top: 0;
54
- left: 0;
55
- z-index: 20;
56
- padding: 2px 8px;
57
- font-size: 11px;
58
- font-family: system-ui, sans-serif;
59
- font-weight: 600;
60
- line-height: 20px;
61
- letter-spacing: 0.02em;
62
- text-transform: uppercase;
63
- color: #6366f1;
64
- background: rgba(99, 102, 241, 0.1);
65
- border-bottom-right-radius: 4px;
66
- pointer-events: none;
67
- white-space: nowrap;
68
- }
69
- .blox-block-label--selected {
70
- color: #fff;
71
- background: #6366f1;
72
- }
28
+ /* Block selection styles are applied via inline styles in PreviewRenderer */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/blox",
3
3
  "type": "module",
4
- "version": "1.12.36",
4
+ "version": "1.12.42",
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",