@juo/blocks 1.9.0 → 1.10.1

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/preact.js CHANGED
@@ -6,7 +6,7 @@ import { useState, useRef, useEffect, useContext as useContext$1, useMemo } from
6
6
  import { g as getSignalValue, s as setSignalValue, w as wrapContext, c as createSlotChildren } from "./block-VhmfGB3N.js";
7
7
  import { t } from "./block-VhmfGB3N.js";
8
8
  import { createContext, h, render } from "preact";
9
- import { a as createEditorBridge } from "./bridge-BOcO9toS.js";
9
+ import { a as createEditorBridge } from "./bridge-w5KQ-czl.js";
10
10
  function toState(signal) {
11
11
  const [value, setValue] = useState(() => getSignalValue(signal));
12
12
  const disposeRef = useRef(null);
package/dist/react.js CHANGED
@@ -6,7 +6,7 @@ import React, { useSyncExternalStore, createContext, useState, useContext as use
6
6
  import { g as getSignalValue, s as setSignalValue, w as wrapContext, c as createSlotChildren } from "./block-VhmfGB3N.js";
7
7
  import { t } from "./block-VhmfGB3N.js";
8
8
  import { createRoot } from "react-dom/client";
9
- import { a as createEditorBridge } from "./bridge-BOcO9toS.js";
9
+ import { a as createEditorBridge } from "./bridge-w5KQ-czl.js";
10
10
  function toState(signal) {
11
11
  const subscribe = (callback) => {
12
12
  const dispose = effect(() => {
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Detects whether a block is rendering inside an **editor preview** (the
3
+ * blocks visual editor or the Shopify theme editor) rather than the live
4
+ * storefront.
5
+ *
6
+ * Both editors load the customer portal in an iframe whose URL carries
7
+ * `?editor=true` (blocks editor: `blocks/editor/src/pages/Editor.vue`; theme
8
+ * editor: same param), and the param is persisted across client-side
9
+ * navigation and SSR redirects (`BlocksInitializer.vue`,
10
+ * `customer-portal/server.ts`).
11
+ *
12
+ * Prefer this over an iframe-topology check (`window.parent !== window`):
13
+ * that also fires for any non-editor embedding (app embeds, third-party
14
+ * wrappers), which would wrongly suppress storefront behavior. The explicit
15
+ * `?editor=true` signal only appears when an editor intends a preview.
16
+ */
17
+ export declare function isEditorPreview(): boolean;
18
+ //# sourceMappingURL=editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../src/utils/editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAGzC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=editor.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.test.d.ts","sourceRoot":"","sources":["../../src/utils/editor.test.ts"],"names":[],"mappings":""}
@@ -29,4 +29,5 @@ export type PriceWithCurrency = {
29
29
  amount: string;
30
30
  currencyCode: string;
31
31
  };
32
+ export * from './editor';
32
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,OAAO,IAAI;IACjC,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,IAAI,IAAI;IAC9B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEpE,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,KAAK,EAAE,CAAC,EAAE,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AK,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,cAAc,UAAU,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { App, Component } from 'vue';
2
- import { BlockInstance } from '../main.ts';
3
- export { hasRenderedContent } from '../block';
2
+ import { BlockInstance, hasRenderedContent } from '../main.ts';
3
+ export { hasRenderedContent };
4
4
  export declare function createVueRenderer(component: Component, options?: {
5
5
  hostApp?: App;
6
6
  }): (block: BlockInstance) => HTMLElement;
@@ -1 +1 @@
1
- {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/vue/block.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EAGR,SAAS,EAUV,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;AAK9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AA2B9C,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,GAAG,CAAA;CAAE,WAuCZ,aAAa,iBA6D7B;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,SAAS,EACpB,EAAE,UAAiB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,yCAoCrD"}
1
+ {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/vue/block.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EAGR,SAAS,EAUV,MAAM,KAAK,CAAC;AACb,OAAO,EAEL,aAAa,EAEb,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,kBAAkB,EAAE,CAAC;AA2B9B,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,GAAG,CAAA;CAAE,WAuCZ,aAAa,iBA6D7B;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,SAAS,EACpB,EAAE,UAAiB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,yCAoCrD"}
package/dist/vue.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { customRef, toValue, watchEffect, defineComponent, ref, getCurrentInstance, onMounted, provide, h, renderSlot, inject, computed, useHost, defineCustomElement, triggerRef, render, shallowRef } from "vue";
2
- import { effect, signal, injectContext, provideContext, createCeRenderer } from "@juo/blocks";
3
- import { b as attachEmptyTracking } from "./block-C8lPBCF8.js";
4
- import { n } from "./block-C8lPBCF8.js";
5
- import { c as createRegisterBlockTranslationKeysMessage, a as createEditorBridge } from "./bridge-BOcO9toS.js";
2
+ import { effect, signal, injectContext, provideContext, createCeRenderer, attachEmptyTracking } from "@juo/blocks";
3
+ import { hasRenderedContent } from "@juo/blocks";
4
+ import { c as createRegisterBlockTranslationKeysMessage, a as createEditorBridge } from "./bridge-w5KQ-czl.js";
6
5
  const signalsMap = /* @__PURE__ */ new WeakMap();
7
6
  function toSignal(ref2) {
8
7
  if (!signalsMap.has(ref2)) {
@@ -291,7 +290,7 @@ export {
291
290
  ContextProvider,
292
291
  createVueCeRenderer,
293
292
  createVueRenderer,
294
- n as hasRenderedContent,
293
+ hasRenderedContent,
295
294
  toRef,
296
295
  toSignal,
297
296
  useBlockId,
@@ -1 +1 @@
1
- {"version":3,"file":"InlineText.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/InlineText.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IACjD,OAAO,CAAC,YAAY,CAAsD;IAC1E,OAAO,CAAC,kBAAkB,CAAmC;IAC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;IAE7B,MAAM,KAAK,kBAAkB,aAE5B;;IAMD,iBAAiB;IA0CjB,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,oBAAoB;IAiD5B,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,MAAM,CAAC,aAAa,CAAwC;IAEpE,OAAO,CAAC,YAAY;IA8BpB,OAAO,CAAC,UAAU;IA+BlB,wBAAwB,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOzB,oBAAoB;CASrB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,UAAU,CAAC;KACxB;CACF"}
@@ -1,10 +1,9 @@
1
1
  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
- import { o as injectContext, E, z as ContextRoot } from "./block-C8lPBCF8.js";
5
- import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-BmfKKpcU.js";
6
- import { a as createEditorBridge, b as createFocusInlineTextMessage, d as createUpdateBlockTranslationMessage } from "./bridge-BOcO9toS.js";
7
- import { T as TranslationContext } from "./juo-workflow-B3OHYsp-.js";
4
+ import { z as injectContext, E, b as TranslationContext, M as ContextRoot } from "./juo-workflow-CkyZRq60.js";
5
+ import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-9XfhG8YM.js";
6
+ import { a as createEditorBridge, b as createFocusInlineTextMessage, d as createUpdateBlockTranslationMessage } from "./bridge-w5KQ-czl.js";
8
7
  const _InlineText = class _InlineText extends HTMLElement {
9
8
  constructor() {
10
9
  super();
@@ -110,6 +109,7 @@ const _InlineText = class _InlineText extends HTMLElement {
110
109
  }
111
110
  handleClick(event) {
112
111
  if (this.isReadonly) return;
112
+ event.preventDefault();
113
113
  event.stopPropagation();
114
114
  }
115
115
  handleBlur() {
@@ -1,9 +1,8 @@
1
1
  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
- import { o as injectContext, E, z as ContextRoot } from "./block-C8lPBCF8.js";
5
- import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-BmfKKpcU.js";
6
- import { T as TranslationContext } from "./juo-workflow-B3OHYsp-.js";
4
+ import { z as injectContext, b as TranslationContext, E, M as ContextRoot } from "./juo-workflow-CkyZRq60.js";
5
+ import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-9XfhG8YM.js";
7
6
  class InlineText extends HTMLElement {
8
7
  constructor() {
9
8
  super(...arguments);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@juo/blocks",
3
3
  "private": false,
4
- "version": "1.9.0",
4
+ "version": "1.10.1",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"