@juo/blocks 2.0.0-alpha.1 → 2.0.0-alpha.10
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-DRpD5EcC.js → ExtensionRoot-CG9dH98z.js} +1 -1
- package/dist/{bridge-Mz0CqG6E.js → bridge-Bss7Xq3D.js} +7 -0
- package/dist/core.js +1289 -54
- package/dist/{css-runtime-B7tZrBIp.js → css-runtime-CjZl0K48.js} +23 -17
- package/dist/editor/bridge.d.ts.map +1 -1
- package/dist/editor/components.d.ts +11 -0
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/handler.d.ts.map +1 -1
- package/dist/editor.js +37 -10
- package/dist/{gridstack-adapter-BGKGC-eO.js → gridstack-adapter-C1Q8gbsH.js} +2 -2
- package/dist/languages.d.ts +51 -0
- package/dist/languages.d.ts.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/{morph-CT5hc5Qp.js → morph-LwttdRML.js} +1 -1
- package/dist/preact.js +1 -1
- package/dist/{project-gridstack-PxN_DIfP.js → project-gridstack-CRZ_7HoT.js} +1 -1
- package/dist/react.js +1 -1
- package/dist/services/customer/adapter.d.ts +14 -1
- package/dist/services/customer/adapter.d.ts.map +1 -1
- package/dist/services/customer/adapter.test.d.ts +2 -0
- package/dist/services/customer/adapter.test.d.ts.map +1 -0
- package/dist/services/customer/customerService.d.ts.map +1 -1
- package/dist/services/customer/customerService.test.d.ts +2 -0
- package/dist/services/customer/customerService.test.d.ts.map +1 -0
- package/dist/services/customer/index.d.ts +2 -2
- package/dist/services/customer/index.d.ts.map +1 -1
- package/dist/services/customer/types.d.ts +29 -0
- package/dist/services/customer/types.d.ts.map +1 -1
- package/dist/services/login/adapter.d.ts.map +1 -1
- package/dist/services/login/index.d.ts +1 -0
- package/dist/services/login/index.d.ts.map +1 -1
- package/dist/services/login/loginService.d.ts +1 -0
- package/dist/services/login/loginService.d.ts.map +1 -1
- package/dist/services/login/loginService.test.d.ts +2 -0
- package/dist/services/login/loginService.test.d.ts.map +1 -0
- package/dist/services/login/refreshLock.d.ts +28 -0
- package/dist/services/login/refreshLock.d.ts.map +1 -0
- package/dist/services/login/refreshLock.test.d.ts +2 -0
- package/dist/services/login/refreshLock.test.d.ts.map +1 -0
- package/dist/services/order/adapter.d.ts +11 -1
- package/dist/services/order/adapter.d.ts.map +1 -1
- package/dist/services/order/adapter.test.d.ts +2 -0
- package/dist/services/order/adapter.test.d.ts.map +1 -0
- package/dist/services/order/index.d.ts +2 -2
- package/dist/services/order/index.d.ts.map +1 -1
- package/dist/services/order/types.d.ts +56 -6
- package/dist/services/order/types.d.ts.map +1 -1
- package/dist/services/product/adapter.d.ts +42 -0
- package/dist/services/product/adapter.d.ts.map +1 -1
- package/dist/services/product/index.d.ts +1 -1
- package/dist/services/product/index.d.ts.map +1 -1
- package/dist/services/settings/types.d.ts +15 -0
- package/dist/services/settings/types.d.ts.map +1 -1
- package/dist/services/subscription/adapter.d.ts +56 -1
- package/dist/services/subscription/adapter.d.ts.map +1 -1
- package/dist/services/subscription/index.d.ts +4 -1
- package/dist/services/subscription/index.d.ts.map +1 -1
- package/dist/services/subscription/instantOrderErrors.d.ts +91 -0
- package/dist/services/subscription/instantOrderErrors.d.ts.map +1 -0
- package/dist/services/subscription/lineRemoval.d.ts +56 -0
- package/dist/services/subscription/lineRemoval.d.ts.map +1 -0
- package/dist/services/subscription/lineRemoval.test.d.ts +2 -0
- package/dist/services/subscription/lineRemoval.test.d.ts.map +1 -0
- package/dist/services/subscription/paymentInstrument.d.ts +119 -0
- package/dist/services/subscription/paymentInstrument.d.ts.map +1 -0
- package/dist/services/subscription/paymentInstrument.test.d.ts +2 -0
- package/dist/services/subscription/paymentInstrument.test.d.ts.map +1 -0
- package/dist/services/subscription/store.d.ts.map +1 -1
- package/dist/services/subscription/subscriptionService.d.ts.map +1 -1
- package/dist/services/subscription/types.d.ts +351 -11
- package/dist/services/subscription/types.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 +7 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/vue/context.d.ts +25 -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 +37 -3
- 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 +15 -7
- package/dist/web-components-runtime.js +2 -2
- package/package.json +1 -1
package/dist/vue.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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 { getHook } from "./devtools.js";
|
|
3
3
|
import { a as applyDevtoolsPropOverride, _ as __recordDevtoolsPropSetter } from "./block-BjJztStr.js";
|
|
4
|
-
import { effect, signal, injectContext, provideContext, createCeRenderer, attachEmptyTracking } from "@juo/blocks";
|
|
4
|
+
import { effect, signal, injectContext, provideContext, TranslationContext, createCeRenderer, attachEmptyTracking } from "@juo/blocks";
|
|
5
5
|
import { hasRenderedContent } from "@juo/blocks";
|
|
6
|
-
import { w as createRegisterBlockTranslationKeysMessage, a as createEditorBridge } from "./bridge-
|
|
6
|
+
import { w as createRegisterBlockTranslationKeysMessage, a as createEditorBridge } from "./bridge-Bss7Xq3D.js";
|
|
7
7
|
const signalsMap = /* @__PURE__ */ new WeakMap();
|
|
8
8
|
function toSignal(ref2) {
|
|
9
9
|
if (!signalsMap.has(ref2)) {
|
|
@@ -105,6 +105,39 @@ function useRegisterTranslationKeys() {
|
|
|
105
105
|
);
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
+
function useTranslatedProp(key2, fallback) {
|
|
109
|
+
const blockId = useBlockId();
|
|
110
|
+
const blockType = useBlockType();
|
|
111
|
+
const service = useContext(TranslationContext).$;
|
|
112
|
+
const out = ref("");
|
|
113
|
+
let dispose;
|
|
114
|
+
watch(
|
|
115
|
+
[
|
|
116
|
+
blockId,
|
|
117
|
+
blockType,
|
|
118
|
+
() => toValue(key2),
|
|
119
|
+
() => toValue(fallback) ?? ""
|
|
120
|
+
],
|
|
121
|
+
([id, type, currentKey, currentFallback]) => {
|
|
122
|
+
dispose == null ? void 0 : dispose();
|
|
123
|
+
dispose = void 0;
|
|
124
|
+
if (!id || !type || !currentKey) {
|
|
125
|
+
out.value = currentFallback;
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
dispose = effect(() => {
|
|
129
|
+
const resolved = service.resolve(type, id, currentKey);
|
|
130
|
+
out.value = resolved === currentKey ? currentFallback : resolved;
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
{ immediate: true }
|
|
134
|
+
);
|
|
135
|
+
onScopeDispose(() => {
|
|
136
|
+
dispose == null ? void 0 : dispose();
|
|
137
|
+
dispose = void 0;
|
|
138
|
+
});
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
108
141
|
function useContext(context) {
|
|
109
142
|
const root = inject(key);
|
|
110
143
|
if ((root == null ? void 0 : root.value) == null) {
|
|
@@ -331,5 +364,6 @@ export {
|
|
|
331
364
|
useProvideContextProvider,
|
|
332
365
|
useRegisterTranslationKeys,
|
|
333
366
|
useTarget,
|
|
367
|
+
useTranslatedProp,
|
|
334
368
|
wrap
|
|
335
369
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineText.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/InlineText.ts"],"names":[],"mappings":"AASA,MAAM,CAAC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,EAAE,MAAM,GAAG,IAAI;IAOzB,oBAAoB;CASrB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,UAAU,CAAC;KACxB;CACF"}
|
|
@@ -2,12 +2,12 @@ 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 { i as injectContext, C as ContextRoot } from "./block-BjJztStr.js";
|
|
5
|
-
import { V as ViewLayoutController, E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
5
|
+
import { V as ViewLayoutController, E as ExtensionRoot, B as Block } from "./ExtensionRoot-CG9dH98z.js";
|
|
6
6
|
import { canvasMode, getActiveSurfaceContext, emitLayoutSetRects, effect } from "@juo/blocks";
|
|
7
7
|
import { getLayoutModeAdapter } from "./layout-mode-adapter-BBd4JRQd.js";
|
|
8
|
-
import { a as createEditorBridge, n as createFocusInlineTextMessage, K as createUpdateBlockTranslationMessage } from "./bridge-
|
|
9
|
-
import { T as TranslationContext } from "./css-runtime-
|
|
10
|
-
import { i as initMorphController } from "./morph-
|
|
8
|
+
import { a as createEditorBridge, n as createFocusInlineTextMessage, K as createUpdateBlockTranslationMessage } from "./bridge-Bss7Xq3D.js";
|
|
9
|
+
import { T as TranslationContext } from "./css-runtime-CjZl0K48.js";
|
|
10
|
+
import { i as initMorphController } from "./morph-LwttdRML.js";
|
|
11
11
|
class EditorLayoutController {
|
|
12
12
|
constructor() {
|
|
13
13
|
__publicField(this, "currentAdapter", null);
|
|
@@ -111,6 +111,9 @@ const _InlineText = class _InlineText extends HTMLElement {
|
|
|
111
111
|
__publicField(this, "boundHandlePointerDown", this.handlePointerDown.bind(this));
|
|
112
112
|
__publicField(this, "boundHandleClick", this.handleClick.bind(this));
|
|
113
113
|
__publicField(this, "lastValue", null);
|
|
114
|
+
// The text the block itself rendered (its prop value), used when the catalog
|
|
115
|
+
// has no translation for this key. Survives DOM moves — see initializeEditorMode.
|
|
116
|
+
__publicField(this, "fallbackText", null);
|
|
114
117
|
__publicField(this, "dispose");
|
|
115
118
|
// One-time DOM/style setup guard — see initializeEditorMode. Persists across
|
|
116
119
|
// DOM moves so reconnecting (e.g. exiting layout mode) skips redundant,
|
|
@@ -178,17 +181,22 @@ const _InlineText = class _InlineText extends HTMLElement {
|
|
|
178
181
|
this.addEventListener("blur", this.boundHandleBlur);
|
|
179
182
|
this.addEventListener("pointerdown", this.boundHandlePointerDown);
|
|
180
183
|
this.addEventListener("click", this.boundHandleClick);
|
|
181
|
-
|
|
184
|
+
const rendered = this.textContent ?? "";
|
|
185
|
+
if (this.fallbackText == null || rendered !== this.lastValue) {
|
|
186
|
+
this.fallbackText = rendered;
|
|
187
|
+
}
|
|
188
|
+
this.lastValue = rendered;
|
|
182
189
|
if (this.translationService && this.propName && this.blockType && this.blockId) {
|
|
183
190
|
const key = this.propName;
|
|
184
|
-
const fallbackText = this.textContent ?? "";
|
|
185
191
|
this.dispose = effect(() => {
|
|
186
192
|
const service = this.translationService;
|
|
187
193
|
if (!service) return;
|
|
188
194
|
void service.locale.value;
|
|
189
195
|
const resolved = service.resolve(this.blockType, this.blockId, key);
|
|
190
196
|
const isMissing = resolved === key || this.hasAttribute("fallback-on-empty") && resolved.trim() === "";
|
|
197
|
+
const fallbackText = this.fallbackText ?? "";
|
|
191
198
|
const value = isMissing && fallbackText.trim().length > 0 ? fallbackText : resolved;
|
|
199
|
+
if (this.contentEditable === "plaintext-only") return;
|
|
192
200
|
this.textContent = value;
|
|
193
201
|
this.lastValue = value;
|
|
194
202
|
});
|
|
@@ -299,7 +307,7 @@ initMorphController();
|
|
|
299
307
|
void (async () => {
|
|
300
308
|
try {
|
|
301
309
|
const [{ createGridStackAdapter }, { registerLayoutModeAdapter }] = await Promise.all([
|
|
302
|
-
import("./gridstack-adapter-
|
|
310
|
+
import("./gridstack-adapter-C1Q8gbsH.js"),
|
|
303
311
|
import("./layout-mode-adapter-BBd4JRQd.js")
|
|
304
312
|
]);
|
|
305
313
|
registerLayoutModeAdapter(createGridStackAdapter());
|
|
@@ -2,9 +2,9 @@ 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 { i as injectContext, C as ContextRoot } from "./block-BjJztStr.js";
|
|
5
|
-
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
5
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-CG9dH98z.js";
|
|
6
6
|
import { effect } from "@juo/blocks";
|
|
7
|
-
import { T as TranslationContext } from "./css-runtime-
|
|
7
|
+
import { T as TranslationContext } from "./css-runtime-CjZl0K48.js";
|
|
8
8
|
class InlineText extends HTMLElement {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|