@juo/blocks 1.15.0 → 1.16.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/{ExtensionRoot-C3lVJEBl.js → ExtensionRoot-DfpvN94s.js} +1 -1
- package/dist/{block-VhmfGB3N.js → block-dVP4Rqgz.js} +9 -0
- package/dist/core.js +2297 -381
- package/dist/{css-runtime-ClH0MEYr.js → css-runtime-DTiXcYSs.js} +23 -17
- package/dist/editor/handler.d.ts.map +1 -1
- package/dist/editor.js +4 -1
- package/dist/{gridstack-adapter-CDWbSpbt.js → gridstack-adapter-BZWybRw1.js} +2 -2
- package/dist/preact.js +2 -2
- package/dist/{project-gridstack-CM783oKI.js → project-gridstack-C2cSYRMx.js} +1 -1
- package/dist/react.js +2 -2
- package/dist/services/customer/adapter.d.ts +8 -0
- package/dist/services/customer/adapter.d.ts.map +1 -0
- package/dist/services/customer/customerService.d.ts +3 -2
- package/dist/services/customer/customerService.d.ts.map +1 -1
- package/dist/services/customer/index.d.ts +1 -0
- package/dist/services/customer/index.d.ts.map +1 -1
- package/dist/services/customer/types.d.ts +4 -1
- package/dist/services/customer/types.d.ts.map +1 -1
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/login/adapter.d.ts +33 -0
- package/dist/services/login/adapter.d.ts.map +1 -0
- package/dist/services/login/index.d.ts +3 -1
- package/dist/services/login/index.d.ts.map +1 -1
- package/dist/services/login/loginService.d.ts +6 -2
- package/dist/services/login/loginService.d.ts.map +1 -1
- package/dist/services/order/adapter.d.ts +9 -0
- package/dist/services/order/adapter.d.ts.map +1 -0
- package/dist/services/order/index.d.ts +5 -0
- package/dist/services/order/index.d.ts.map +1 -0
- package/dist/services/order/orderService.d.ts +7 -0
- package/dist/services/order/orderService.d.ts.map +1 -0
- package/dist/services/order/types.d.ts +21 -0
- package/dist/services/order/types.d.ts.map +1 -0
- package/dist/services/orders/adapter.d.ts +2 -0
- package/dist/services/orders/adapter.d.ts.map +1 -1
- package/dist/services/orders/index.d.ts +1 -1
- package/dist/services/orders/index.d.ts.map +1 -1
- package/dist/services/product/adapter.d.ts +27 -2
- package/dist/services/product/adapter.d.ts.map +1 -1
- package/dist/services/product/adapter.test.d.ts +2 -0
- package/dist/services/product/adapter.test.d.ts.map +1 -0
- package/dist/services/product/index.d.ts +1 -1
- package/dist/services/product/index.d.ts.map +1 -1
- package/dist/services/product/productService.d.ts.map +1 -1
- package/dist/services/product/types.d.ts +68 -0
- package/dist/services/product/types.d.ts.map +1 -1
- package/dist/services/schedules/adapter.d.ts +94 -0
- package/dist/services/schedules/adapter.d.ts.map +1 -0
- package/dist/services/schedules/adapter.test.d.ts +2 -0
- package/dist/services/schedules/adapter.test.d.ts.map +1 -0
- package/dist/services/schedules/apiSchedulesAdapter.test.d.ts +2 -0
- package/dist/services/schedules/apiSchedulesAdapter.test.d.ts.map +1 -0
- package/dist/services/schedules/index.d.ts +5 -0
- package/dist/services/schedules/index.d.ts.map +1 -0
- package/dist/services/schedules/schedulesService.d.ts +11 -0
- package/dist/services/schedules/schedulesService.d.ts.map +1 -0
- package/dist/services/schedules/schedulesService.test.d.ts +2 -0
- package/dist/services/schedules/schedulesService.test.d.ts.map +1 -0
- package/dist/services/schedules/types.d.ts +290 -0
- package/dist/services/schedules/types.d.ts.map +1 -0
- package/dist/services/settings/index.d.ts +3 -0
- package/dist/services/settings/index.d.ts.map +1 -0
- package/dist/services/settings/settingsService.d.ts +7 -0
- package/dist/services/settings/settingsService.d.ts.map +1 -0
- package/dist/services/settings/settingsService.test.d.ts +2 -0
- package/dist/services/settings/settingsService.test.d.ts.map +1 -0
- package/dist/services/settings/types.d.ts +35 -0
- package/dist/services/settings/types.d.ts.map +1 -0
- package/dist/services/shop/index.d.ts +3 -0
- package/dist/services/shop/index.d.ts.map +1 -0
- package/dist/services/shop/shopService.d.ts +12 -0
- package/dist/services/shop/shopService.d.ts.map +1 -0
- package/dist/services/shop/shopService.test.d.ts +2 -0
- package/dist/services/shop/shopService.test.d.ts.map +1 -0
- package/dist/services/shop/types.d.ts +7 -0
- package/dist/services/shop/types.d.ts.map +1 -0
- package/dist/services/subscription/adapter.d.ts +77 -2
- package/dist/services/subscription/adapter.d.ts.map +1 -1
- package/dist/services/subscription/adapter.test.d.ts +2 -0
- package/dist/services/subscription/adapter.test.d.ts.map +1 -0
- package/dist/services/subscription/index.d.ts +1 -1
- package/dist/services/subscription/index.d.ts.map +1 -1
- package/dist/services/subscription/subscriptionService.d.ts +1 -6
- package/dist/services/subscription/subscriptionService.d.ts.map +1 -1
- package/dist/services/subscription/types.d.ts +220 -9
- package/dist/services/subscription/types.d.ts.map +1 -1
- package/dist/services/subscription/types.test.d.ts +2 -0
- package/dist/services/subscription/types.test.d.ts.map +1 -0
- package/dist/shared/context.d.ts.map +1 -1
- package/dist/theme-state.d.ts +10 -1
- package/dist/theme-state.d.ts.map +1 -1
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/vue/context.d.ts +26 -1
- package/dist/vue/context.d.ts.map +1 -1
- package/dist/vue/useTranslatedProp.test.d.ts +2 -0
- package/dist/vue/useTranslatedProp.test.d.ts.map +1 -0
- package/dist/vue.js +48 -4
- package/dist/web-components/editor/InlineText.d.ts +1 -0
- package/dist/web-components/editor/InlineText.d.ts.map +1 -1
- package/dist/web-components-editor.js +13 -5
- package/dist/web-components-runtime.js +2 -2
- package/package.json +1 -1
package/dist/vue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { customRef, toValue, watchEffect, defineComponent, ref, getCurrentInstance, onMounted, provide, h, renderSlot, inject, computed, useHost, defineCustomElement, triggerRef, render, shallowRef } from "vue";
|
|
1
|
+
import { customRef, toValue, watchEffect, defineComponent, ref, getCurrentInstance, onMounted, provide, h, renderSlot, inject, computed, watch, onScopeDispose, useHost, defineCustomElement, triggerRef, render, shallowRef } from "vue";
|
|
2
2
|
import { g as getInstrumentation } from "./index-JSv6UH_o.js";
|
|
3
|
-
import { effect, signal, injectContext, provideContext, createCeRenderer, attachEmptyTracking } from "@juo/blocks";
|
|
3
|
+
import { effect, signal, injectContext, provideContext, TranslationContext, createCeRenderer, attachEmptyTracking } from "@juo/blocks";
|
|
4
4
|
import { hasRenderedContent } from "@juo/blocks";
|
|
5
5
|
import { v as createRegisterBlockTranslationKeysMessage, a as createEditorBridge } from "./bridge-xiKEzCGR.js";
|
|
6
6
|
const signalsMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -104,6 +104,39 @@ function useRegisterTranslationKeys() {
|
|
|
104
104
|
);
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
+
function useTranslatedProp(key2, fallback) {
|
|
108
|
+
const blockId = useBlockId();
|
|
109
|
+
const blockType = useBlockType();
|
|
110
|
+
const service = useContext(TranslationContext).$;
|
|
111
|
+
const out = ref("");
|
|
112
|
+
let dispose;
|
|
113
|
+
watch(
|
|
114
|
+
[
|
|
115
|
+
blockId,
|
|
116
|
+
blockType,
|
|
117
|
+
() => toValue(key2),
|
|
118
|
+
() => toValue(fallback) ?? ""
|
|
119
|
+
],
|
|
120
|
+
([id, type, currentKey, currentFallback]) => {
|
|
121
|
+
dispose == null ? void 0 : dispose();
|
|
122
|
+
dispose = void 0;
|
|
123
|
+
if (!id || !type || !currentKey) {
|
|
124
|
+
out.value = currentFallback;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
dispose = effect(() => {
|
|
128
|
+
const resolved = service.resolve(type, id, currentKey);
|
|
129
|
+
out.value = resolved === currentKey ? currentFallback : resolved;
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
{ immediate: true }
|
|
133
|
+
);
|
|
134
|
+
onScopeDispose(() => {
|
|
135
|
+
dispose == null ? void 0 : dispose();
|
|
136
|
+
dispose = void 0;
|
|
137
|
+
});
|
|
138
|
+
return out;
|
|
139
|
+
}
|
|
107
140
|
function useContext(context) {
|
|
108
141
|
const root = inject(key);
|
|
109
142
|
if ((root == null ? void 0 : root.value) == null) {
|
|
@@ -122,8 +155,9 @@ function wrap(obj) {
|
|
|
122
155
|
if (typeof obj !== "object" || obj == null) {
|
|
123
156
|
return obj;
|
|
124
157
|
}
|
|
158
|
+
const boundCache = /* @__PURE__ */ new WeakMap();
|
|
125
159
|
return new Proxy(obj, {
|
|
126
|
-
get(target, key2) {
|
|
160
|
+
get(target, key2, receiver) {
|
|
127
161
|
const val = target[key2];
|
|
128
162
|
if (key2 === "$") {
|
|
129
163
|
return target;
|
|
@@ -134,6 +168,14 @@ function wrap(obj) {
|
|
|
134
168
|
if (typeof val === "object" && val != null && !Array.isArray(val) && typeof val !== "function") {
|
|
135
169
|
return wrap(val);
|
|
136
170
|
}
|
|
171
|
+
if (typeof val === "function") {
|
|
172
|
+
let bound = boundCache.get(val);
|
|
173
|
+
if (!bound) {
|
|
174
|
+
bound = val.bind(receiver);
|
|
175
|
+
boundCache.set(val, bound);
|
|
176
|
+
}
|
|
177
|
+
return bound;
|
|
178
|
+
}
|
|
137
179
|
return val;
|
|
138
180
|
}
|
|
139
181
|
});
|
|
@@ -318,5 +360,7 @@ export {
|
|
|
318
360
|
useProvideContext,
|
|
319
361
|
useProvideContextProvider,
|
|
320
362
|
useRegisterTranslationKeys,
|
|
321
|
-
useTarget
|
|
363
|
+
useTarget,
|
|
364
|
+
useTranslatedProp,
|
|
365
|
+
wrap
|
|
322
366
|
};
|
|
@@ -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;IAC7D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,sBAAsB,CAAqC;IACnE,OAAO,CAAC,gBAAgB,CAA+B;IACvD,OAAO,CAAC,SAAS,CAAuB;
|
|
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;IAC7D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,sBAAsB,CAAqC;IACnE,OAAO,CAAC,gBAAgB,CAA+B;IACvD,OAAO,CAAC,SAAS,CAAuB;IAGxC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,OAAO,CAAC,CAAa;IAI7B,OAAO,CAAC,cAAc,CAAS;IAE/B,MAAM,KAAK,kBAAkB,aAE5B;;IAMD,iBAAiB;IA0CjB,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,oBAAoB;IA6E5B,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,8 +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 { i as injectContext, T as TranslationContext, C as ContextRoot } from "./css-runtime-
|
|
5
|
-
import { V as ViewLayoutController, E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
4
|
+
import { i as injectContext, T as TranslationContext, C as ContextRoot } from "./css-runtime-DTiXcYSs.js";
|
|
5
|
+
import { V as ViewLayoutController, E as ExtensionRoot, B as Block } from "./ExtensionRoot-DfpvN94s.js";
|
|
6
6
|
import { canvasMode, getActiveSurfaceContext, emitLayoutSetRects, effect } from "@juo/blocks";
|
|
7
7
|
import { getLayoutModeAdapter } from "./layout-mode-adapter-BBd4JRQd.js";
|
|
8
8
|
import { a as createEditorBridge, m as createFocusInlineTextMessage, J as createUpdateBlockTranslationMessage } from "./bridge-xiKEzCGR.js";
|
|
@@ -110,6 +110,9 @@ const _InlineText = class _InlineText extends HTMLElement {
|
|
|
110
110
|
__publicField(this, "boundHandlePointerDown", this.handlePointerDown.bind(this));
|
|
111
111
|
__publicField(this, "boundHandleClick", this.handleClick.bind(this));
|
|
112
112
|
__publicField(this, "lastValue", null);
|
|
113
|
+
// The text the block itself rendered (its prop value), used when the catalog
|
|
114
|
+
// has no translation for this key. Survives DOM moves — see initializeEditorMode.
|
|
115
|
+
__publicField(this, "fallbackText", null);
|
|
113
116
|
__publicField(this, "dispose");
|
|
114
117
|
// One-time DOM/style setup guard — see initializeEditorMode. Persists across
|
|
115
118
|
// DOM moves so reconnecting (e.g. exiting layout mode) skips redundant,
|
|
@@ -177,17 +180,22 @@ const _InlineText = class _InlineText extends HTMLElement {
|
|
|
177
180
|
this.addEventListener("blur", this.boundHandleBlur);
|
|
178
181
|
this.addEventListener("pointerdown", this.boundHandlePointerDown);
|
|
179
182
|
this.addEventListener("click", this.boundHandleClick);
|
|
180
|
-
|
|
183
|
+
const rendered = this.textContent ?? "";
|
|
184
|
+
if (this.fallbackText == null || rendered !== this.lastValue) {
|
|
185
|
+
this.fallbackText = rendered;
|
|
186
|
+
}
|
|
187
|
+
this.lastValue = rendered;
|
|
181
188
|
if (this.translationService && this.propName && this.blockType && this.blockId) {
|
|
182
189
|
const key = this.propName;
|
|
183
|
-
const fallbackText = this.textContent ?? "";
|
|
184
190
|
this.dispose = effect(() => {
|
|
185
191
|
const service = this.translationService;
|
|
186
192
|
if (!service) return;
|
|
187
193
|
void service.locale.value;
|
|
188
194
|
const resolved = service.resolve(this.blockType, this.blockId, key);
|
|
189
195
|
const isMissing = resolved === key || this.hasAttribute("fallback-on-empty") && resolved.trim() === "";
|
|
196
|
+
const fallbackText = this.fallbackText ?? "";
|
|
190
197
|
const value = isMissing && fallbackText.trim().length > 0 ? fallbackText : resolved;
|
|
198
|
+
if (this.contentEditable === "plaintext-only") return;
|
|
191
199
|
this.textContent = value;
|
|
192
200
|
this.lastValue = value;
|
|
193
201
|
});
|
|
@@ -298,7 +306,7 @@ initMorphController();
|
|
|
298
306
|
void (async () => {
|
|
299
307
|
try {
|
|
300
308
|
const [{ createGridStackAdapter }, { registerLayoutModeAdapter }] = await Promise.all([
|
|
301
|
-
import("./gridstack-adapter-
|
|
309
|
+
import("./gridstack-adapter-BZWybRw1.js"),
|
|
302
310
|
import("./layout-mode-adapter-BBd4JRQd.js")
|
|
303
311
|
]);
|
|
304
312
|
registerLayoutModeAdapter(createGridStackAdapter());
|
|
@@ -1,8 +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 { i as injectContext, T as TranslationContext, C as ContextRoot } from "./css-runtime-
|
|
5
|
-
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
4
|
+
import { i as injectContext, T as TranslationContext, C as ContextRoot } from "./css-runtime-DTiXcYSs.js";
|
|
5
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-DfpvN94s.js";
|
|
6
6
|
import { effect } from "@juo/blocks";
|
|
7
7
|
class InlineText extends HTMLElement {
|
|
8
8
|
constructor() {
|