@juo/blocks 1.16.0 → 2.0.0-alpha.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-DRpD5EcC.js} +24 -6
- package/dist/block-BjJztStr.js +993 -0
- package/dist/{block-dVP4Rqgz.js → block-DnhzyZ1H.js} +29 -3
- package/dist/block.d.ts +56 -0
- package/dist/block.d.ts.map +1 -1
- package/dist/{bridge-xiKEzCGR.js → bridge-Mz0CqG6E.js} +39 -30
- package/dist/core.js +336 -222
- package/dist/css-runtime-B7tZrBIp.js +749 -0
- package/dist/devtools/hook.d.ts +0 -5
- package/dist/devtools/hook.d.ts.map +1 -1
- package/dist/devtools/index.d.ts +0 -1
- package/dist/devtools/index.d.ts.map +1 -1
- package/dist/devtools/protocol.d.ts +15 -1
- package/dist/devtools/protocol.d.ts.map +1 -1
- package/dist/devtools.js +42 -9
- package/dist/editor/bridge.d.ts +7 -0
- package/dist/editor/bridge.d.ts.map +1 -1
- package/dist/editor/components.d.ts.map +1 -1
- package/dist/editor/main.d.ts +2 -1
- package/dist/editor/main.d.ts.map +1 -1
- package/dist/editor/messages.d.ts +13 -2
- package/dist/editor/messages.d.ts.map +1 -1
- package/dist/editor/overlays.d.ts +14 -0
- package/dist/editor/overlays.d.ts.map +1 -0
- package/dist/editor/overlays.test.d.ts +2 -0
- package/dist/editor/overlays.test.d.ts.map +1 -0
- package/dist/editor.js +52 -33
- package/dist/{gridstack-adapter-CDWbSpbt.js → gridstack-adapter-BGKGC-eO.js} +2 -2
- package/dist/main.d.ts +3 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/{morph-n4LMxOYo.js → morph-CT5hc5Qp.js} +1 -1
- package/dist/overlay-wrapper.d.ts +69 -0
- package/dist/overlay-wrapper.d.ts.map +1 -0
- package/dist/overlay-wrapper.test.d.ts +2 -0
- package/dist/overlay-wrapper.test.d.ts.map +1 -0
- package/dist/overlays/OverlayService.d.ts +34 -0
- package/dist/overlays/OverlayService.d.ts.map +1 -0
- package/dist/overlays/OverlayService.test.d.ts +2 -0
- package/dist/overlays/OverlayService.test.d.ts.map +1 -0
- package/dist/preact/block.d.ts.map +1 -1
- package/dist/preact/context.d.ts.map +1 -1
- package/dist/preact/context.test.d.ts +2 -0
- package/dist/preact/context.test.d.ts.map +1 -0
- package/dist/preact/signals.d.ts +19 -0
- package/dist/preact/signals.d.ts.map +1 -1
- package/dist/preact/useContextSubscription.test.d.ts +2 -0
- package/dist/preact/useContextSubscription.test.d.ts.map +1 -0
- package/dist/preact.js +33 -7
- package/dist/{project-gridstack-CM783oKI.js → project-gridstack-PxN_DIfP.js} +1 -1
- package/dist/react/block.d.ts.map +1 -1
- package/dist/react/context.d.ts.map +1 -1
- package/dist/react/context.test.d.ts +2 -0
- package/dist/react/context.test.d.ts.map +1 -0
- package/dist/react/signals.d.ts +19 -0
- package/dist/react/signals.d.ts.map +1 -1
- package/dist/react/useContextSubscription.test.d.ts +2 -0
- package/dist/react/useContextSubscription.test.d.ts.map +1 -0
- package/dist/react.js +40 -8
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/order/adapter.d.ts +7 -6
- package/dist/services/order/adapter.d.ts.map +1 -1
- package/dist/services/order/index.d.ts +2 -3
- package/dist/services/order/index.d.ts.map +1 -1
- package/dist/services/order/orderService.d.ts +2 -3
- package/dist/services/order/orderService.d.ts.map +1 -1
- package/dist/services/order/orderService.test.d.ts +2 -0
- package/dist/services/order/orderService.test.d.ts.map +1 -0
- package/dist/services/order/types.d.ts +53 -14
- package/dist/services/order/types.d.ts.map +1 -1
- package/dist/shared/context.d.ts +10 -3
- package/dist/shared/context.d.ts.map +1 -1
- package/dist/shared/touchSignals.d.ts +17 -0
- package/dist/shared/touchSignals.d.ts.map +1 -0
- package/dist/shared/touchSignals.test.d.ts +2 -0
- package/dist/shared/touchSignals.test.d.ts.map +1 -0
- package/dist/theme-state.d.ts +2 -1
- package/dist/theme-state.d.ts.map +1 -1
- package/dist/theme-state.params.test.d.ts +2 -0
- package/dist/theme-state.params.test.d.ts.map +1 -0
- package/dist/theme-state.translations.test.d.ts +2 -0
- package/dist/theme-state.translations.test.d.ts.map +1 -0
- package/dist/vue/block.d.ts.map +1 -1
- package/dist/vue.js +16 -13
- package/dist/web-components/ExtensionRoot.d.ts +1 -0
- package/dist/web-components/ExtensionRoot.d.ts.map +1 -1
- package/dist/web-components-editor.js +6 -5
- package/dist/web-components-runtime.js +3 -2
- package/package.json +1 -1
- package/dist/css-runtime-ClH0MEYr.js +0 -1570
- package/dist/devtools/instrumentation.d.ts +0 -47
- package/dist/devtools/instrumentation.d.ts.map +0 -1
- package/dist/index-JSv6UH_o.js +0 -169
- package/dist/services/orders/adapter.d.ts +0 -10
- package/dist/services/orders/adapter.d.ts.map +0 -1
- package/dist/services/orders/index.d.ts +0 -4
- package/dist/services/orders/index.d.ts.map +0 -1
- package/dist/services/orders/ordersService.d.ts +0 -6
- package/dist/services/orders/ordersService.d.ts.map +0 -1
- package/dist/services/orders/ordersService.test.d.ts +0 -2
- package/dist/services/orders/ordersService.test.d.ts.map +0 -1
- package/dist/services/orders/types.d.ts +0 -60
- package/dist/services/orders/types.d.ts.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReadonlySignal } from '@preact/signals-core';
|
|
2
|
+
import { BlockDefinition } from '../block';
|
|
3
|
+
import { ThemeState } from '../theme-state';
|
|
4
|
+
import { OverlayLayout } from '../overlay-wrapper';
|
|
5
|
+
import { OverlayRegistryEntry } from '../editor/overlays';
|
|
6
|
+
export type { OverlayRegistryEntry };
|
|
7
|
+
export interface OverlayState {
|
|
8
|
+
name: string;
|
|
9
|
+
layout: OverlayLayout;
|
|
10
|
+
canAbort: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface OverlayService {
|
|
13
|
+
/** Editor registry: the flat, global overlay list for the editor dropdown. */
|
|
14
|
+
getEditableOverlays(): Record<string, OverlayRegistryEntry>;
|
|
15
|
+
/** Open an overlay surface (full `overlay:<id>` name), optionally parameterized. */
|
|
16
|
+
open(name: string, params?: Record<string, unknown>): void;
|
|
17
|
+
/** Close the current overlay surface. */
|
|
18
|
+
close(): void;
|
|
19
|
+
/** The overlay currently showing, or null (incl. when a workflow overlay is up). */
|
|
20
|
+
current: ReadonlySignal<OverlayState | null>;
|
|
21
|
+
}
|
|
22
|
+
export declare const OverlayServiceContext: {
|
|
23
|
+
__context__: OverlayService;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Owns non-workflow overlay state over the shared `themeState.overlay` surface.
|
|
27
|
+
* Symmetric to `WorkflowService`; never invoked on the workflow path. `current`
|
|
28
|
+
* filters to `overlay:` roots so workflow roots (which share the surface) read
|
|
29
|
+
* as null.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createOverlayService(themeState: ThemeState, options?: {
|
|
32
|
+
getBlocks?: () => BlockDefinition[];
|
|
33
|
+
}): OverlayService;
|
|
34
|
+
//# sourceMappingURL=OverlayService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayService.d.ts","sourceRoot":"","sources":["../../src/overlays/OverlayService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAIrC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,8EAA8E;IAC9E,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAC5D,oFAAoF;IACpF,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3D,yCAAyC;IACzC,KAAK,IAAI,IAAI,CAAC;IACd,oFAAoF;IACpF,OAAO,EAAE,cAAc,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CAC9C;AAED,eAAO,MAAM,qBAAqB;;CACiB,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,eAAe,EAAE,CAAA;CAAO,GACpD,cAAc,CAiChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayService.test.d.ts","sourceRoot":"","sources":["../../src/overlays/OverlayService.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/preact/block.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/preact/block.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA8BjD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,GAAG,EAC1C,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,GAC1B,CAAC,KAAK,EAAE,aAAa,KAAK,WAAW,CAkDvC;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,GAAG,GAAG,EAC5C,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAC3B,EAAE,UAAiB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,CAAC,KAAK,EAAE,aAAa,KAAK,WAAW,CAoEvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/preact/context.ts"],"names":[],"mappings":"AASA,OAAO,EAAK,KAAK,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EACL,WAAW,EAGX,cAAc,EACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAI3D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,iBAAiB,CAAA;CAAE;;;GAiB5E;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,cAAc,EACxD,OAAO,EAAE,CAAC,EACV,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GACnB,IAAI,CAON;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,cAAc,EACjD,OAAO,EAAE,CAAC,GACT,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/preact/context.ts"],"names":[],"mappings":"AASA,OAAO,EAAK,KAAK,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EACL,WAAW,EAGX,cAAc,EACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAI3D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,iBAAiB,CAAA;CAAE;;;GAiB5E;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,cAAc,EACxD,OAAO,EAAE,CAAC,EACV,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GACnB,IAAI,CAON;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,cAAc,EACjD,OAAO,EAAE,CAAC,GACT,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAUtB;AAED,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAU1C;AAED,YAAY,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.test.d.ts","sourceRoot":"","sources":["../../src/preact/context.test.ts"],"names":[],"mappings":""}
|
package/dist/preact/signals.d.ts
CHANGED
|
@@ -20,4 +20,23 @@ export declare function toState<T extends object>(signal: Signal<T> | (() => T))
|
|
|
20
20
|
* @returns The current value of the signal
|
|
21
21
|
*/
|
|
22
22
|
export declare function useSignal<T>(signal: Signal<T> | (() => T)): T;
|
|
23
|
+
/**
|
|
24
|
+
* Subscribes the component to every signal reachable from `target` (see
|
|
25
|
+
* `touchSignals`) and rerenders it on any change. This is the single,
|
|
26
|
+
* coarse-grained subscription behind `useContext` — it keeps method
|
|
27
|
+
* reads like `settings.get(...)` reactive without any hooks inside the
|
|
28
|
+
* wrapContext proxy. Only signals reachable from the context object are
|
|
29
|
+
* covered — objects returned by service methods (e.g. a SubscriptionList)
|
|
30
|
+
* carry their own signals and are not subscribed.
|
|
31
|
+
*
|
|
32
|
+
* The effect body runs once synchronously when wired inside useEffect. On
|
|
33
|
+
* the first wiring it bumps the version unconditionally — so a signal
|
|
34
|
+
* change that lands between mount render and subscription is never lost
|
|
35
|
+
* (at the cost of one extra post-mount render). Rewires caused by a
|
|
36
|
+
* `target` identity change are silent: the outgoing effect stays live until
|
|
37
|
+
* the synchronous swap, so an unstable target degrades to subscription
|
|
38
|
+
* churn instead of an infinite rerender loop. (A signal reachable only
|
|
39
|
+
* from the new target changing before the swap is not caught.)
|
|
40
|
+
*/
|
|
41
|
+
export declare function useContextSubscription(target: unknown): void;
|
|
23
42
|
//# sourceMappingURL=signals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/preact/signals.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAU,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/preact/signals.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAU,MAAM,EAAE,MAAM,aAAa,CAAC;AAK7C;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EACtC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAC5B,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CAkCzB;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CA8B7D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAiB5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useContextSubscription.test.d.ts","sourceRoot":"","sources":["../../src/preact/useContextSubscription.test.ts"],"names":[],"mappings":""}
|
package/dist/preact.js
CHANGED
|
@@ -3,11 +3,12 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { effect, injectContext, provideContext, createCeRenderer, attachEmptyTracking } from "@juo/blocks";
|
|
5
5
|
import { useState, useRef, useEffect, useContext as useContext$1, useMemo } from "preact/hooks";
|
|
6
|
-
import { g as getSignalValue, s as setSignalValue, w as wrapContext, c as createSlotChildren } from "./block-
|
|
7
|
-
import {
|
|
6
|
+
import { g as getSignalValue, t as touchSignals, s as setSignalValue, w as wrapContext, c as createSlotChildren } from "./block-DnhzyZ1H.js";
|
|
7
|
+
import { a } from "./block-DnhzyZ1H.js";
|
|
8
8
|
import { createContext, h, render } from "preact";
|
|
9
|
-
import {
|
|
10
|
-
import { a as
|
|
9
|
+
import { getHook } from "./devtools.js";
|
|
10
|
+
import { _ as __recordDevtoolsPropSetter, a as applyDevtoolsPropOverride } from "./block-BjJztStr.js";
|
|
11
|
+
import { a as createEditorBridge } from "./bridge-Mz0CqG6E.js";
|
|
11
12
|
function toState(signal) {
|
|
12
13
|
const [value, setValue] = useState(() => getSignalValue(signal));
|
|
13
14
|
const disposeRef = useRef(null);
|
|
@@ -55,6 +56,23 @@ function useSignal(signal) {
|
|
|
55
56
|
}, [signal]);
|
|
56
57
|
return value;
|
|
57
58
|
}
|
|
59
|
+
function useContextSubscription(target) {
|
|
60
|
+
const [, setVersion] = useState(0);
|
|
61
|
+
const everWiredRef = useRef(false);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
const isRewire = everWiredRef.current;
|
|
64
|
+
everWiredRef.current = true;
|
|
65
|
+
let initialRun = true;
|
|
66
|
+
return effect(() => {
|
|
67
|
+
touchSignals(target);
|
|
68
|
+
if (initialRun) {
|
|
69
|
+
initialRun = false;
|
|
70
|
+
if (isRewire) return;
|
|
71
|
+
}
|
|
72
|
+
setVersion((v) => v + 1);
|
|
73
|
+
});
|
|
74
|
+
}, [target]);
|
|
75
|
+
}
|
|
58
76
|
const ContextProviderContext = createContext(null);
|
|
59
77
|
function ContextProvider({ children }) {
|
|
60
78
|
const [rootElement, setRootElement] = useState(null);
|
|
@@ -84,7 +102,9 @@ function useContext(context) {
|
|
|
84
102
|
if (root == null) {
|
|
85
103
|
throw new Error("ContextProvider not available");
|
|
86
104
|
}
|
|
87
|
-
|
|
105
|
+
const ctx = injectContext(root, context);
|
|
106
|
+
useContextSubscription(ctx);
|
|
107
|
+
return wrapContext(ctx);
|
|
88
108
|
}
|
|
89
109
|
function useBlockId() {
|
|
90
110
|
const root = useContext$1(ContextProviderContext);
|
|
@@ -134,7 +154,12 @@ function createPreactRenderer(component) {
|
|
|
134
154
|
wrapper
|
|
135
155
|
);
|
|
136
156
|
};
|
|
137
|
-
|
|
157
|
+
if (getHook()) {
|
|
158
|
+
__recordDevtoolsPropSetter(block.id, () => {
|
|
159
|
+
renderTree(applyDevtoolsPropOverride(block.id, block.props));
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
renderTree(applyDevtoolsPropOverride(block.id, block.props));
|
|
138
163
|
attachEmptyTracking(wrapper);
|
|
139
164
|
return wrapper;
|
|
140
165
|
};
|
|
@@ -226,11 +251,12 @@ export {
|
|
|
226
251
|
ContextProvider,
|
|
227
252
|
createPreactCeRenderer,
|
|
228
253
|
createPreactRenderer,
|
|
229
|
-
|
|
254
|
+
a as toSignal,
|
|
230
255
|
toState,
|
|
231
256
|
useBlockId,
|
|
232
257
|
useBridge,
|
|
233
258
|
useContext,
|
|
259
|
+
useContextSubscription,
|
|
234
260
|
useProvideContext,
|
|
235
261
|
useSignal
|
|
236
262
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/react/block.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/react/block.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA4BjD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,GAAG,EACzC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,GAChC,CAAC,KAAK,EAAE,aAAa,KAAK,WAAW,CAkDvC;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,GAAG,GAAG,EAC3C,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACjC,EAAE,UAAiB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,CAAC,KAAK,EAAE,aAAa,KAAK,WAAW,CAyEvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/react/context.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EACL,WAAW,EAGX,cAAc,EACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAI3D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2EAsBpE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,cAAc,EACxD,OAAO,EAAE,CAAC,EACV,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GACnB,IAAI,CAON;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,cAAc,EACjD,OAAO,EAAE,CAAC,GACT,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/react/context.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EACL,WAAW,EAGX,cAAc,EACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAI3D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2EAsBpE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,cAAc,EACxD,OAAO,EAAE,CAAC,EACV,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GACnB,IAAI,CAON;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,cAAc,EACjD,OAAO,EAAE,CAAC,GACT,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAUtB;AAED,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAU1C;AAED,YAAY,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.test.d.ts","sourceRoot":"","sources":["../../src/react/context.test.ts"],"names":[],"mappings":""}
|
package/dist/react/signals.d.ts
CHANGED
|
@@ -20,4 +20,23 @@ export declare function toState<T extends object>(signal: Signal<T> | (() => T))
|
|
|
20
20
|
* @returns The current value of the signal
|
|
21
21
|
*/
|
|
22
22
|
export declare function useSignal<T>(signal: Signal<T> | (() => T)): T;
|
|
23
|
+
/**
|
|
24
|
+
* Subscribes the component to every signal reachable from `target` (see
|
|
25
|
+
* `touchSignals`) and rerenders it on any change. This is the single,
|
|
26
|
+
* coarse-grained subscription behind `useContext` — it keeps method
|
|
27
|
+
* reads like `settings.get(...)` reactive without any hooks inside the
|
|
28
|
+
* wrapContext proxy. Only signals reachable from the context object are
|
|
29
|
+
* covered — objects returned by service methods (e.g. a SubscriptionList)
|
|
30
|
+
* carry their own signals and are not subscribed.
|
|
31
|
+
*
|
|
32
|
+
* The effect body runs once synchronously when the store subscription is
|
|
33
|
+
* wired. On the first wiring it bumps the version unconditionally — so a
|
|
34
|
+
* signal change that lands between mount render and subscription is never
|
|
35
|
+
* lost (at the cost of one extra post-mount render). Rewires caused by a
|
|
36
|
+
* `target` identity change are silent: the outgoing effect stays live until
|
|
37
|
+
* the synchronous swap, so an unstable target degrades to subscription
|
|
38
|
+
* churn instead of an infinite rerender loop. (A signal reachable only
|
|
39
|
+
* from the new target changing before the swap is not caught.)
|
|
40
|
+
*/
|
|
41
|
+
export declare function useContextSubscription(target: unknown): void;
|
|
23
42
|
//# sourceMappingURL=signals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/react/signals.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAU,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/react/signals.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAU,MAAM,EAAE,MAAM,aAAa,CAAC;AAK7C;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EACtC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAC5B,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CAkBzB;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAY7D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAyB5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useContextSubscription.test.d.ts","sourceRoot":"","sources":["../../src/react/useContextSubscription.test.ts"],"names":[],"mappings":""}
|
package/dist/react.js
CHANGED
|
@@ -2,12 +2,13 @@ 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 { effect, injectContext, provideContext, createCeRenderer, attachEmptyTracking } from "@juo/blocks";
|
|
5
|
-
import React, { useSyncExternalStore, createContext, useState, useContext as useContext$1, useMemo,
|
|
6
|
-
import { g as getSignalValue, s as setSignalValue, w as wrapContext, c as createSlotChildren } from "./block-
|
|
7
|
-
import {
|
|
5
|
+
import React, { useSyncExternalStore, useRef, useCallback, createContext, useState, useContext as useContext$1, useMemo, useEffect } from "react";
|
|
6
|
+
import { t as touchSignals, g as getSignalValue, s as setSignalValue, w as wrapContext, c as createSlotChildren } from "./block-DnhzyZ1H.js";
|
|
7
|
+
import { a } from "./block-DnhzyZ1H.js";
|
|
8
8
|
import { createRoot } from "react-dom/client";
|
|
9
|
-
import {
|
|
10
|
-
import { a as
|
|
9
|
+
import { getHook } from "./devtools.js";
|
|
10
|
+
import { _ as __recordDevtoolsPropSetter, a as applyDevtoolsPropOverride } from "./block-BjJztStr.js";
|
|
11
|
+
import { a as createEditorBridge } from "./bridge-Mz0CqG6E.js";
|
|
11
12
|
function toState(signal) {
|
|
12
13
|
const subscribe = (callback) => {
|
|
13
14
|
const dispose = effect(() => {
|
|
@@ -34,6 +35,29 @@ function useSignal(signal) {
|
|
|
34
35
|
const getSnapshot = () => getSignalValue(signal);
|
|
35
36
|
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
36
37
|
}
|
|
38
|
+
function useContextSubscription(target) {
|
|
39
|
+
const versionRef = useRef(0);
|
|
40
|
+
const everWiredRef = useRef(false);
|
|
41
|
+
const subscribe = useCallback(
|
|
42
|
+
(notify) => {
|
|
43
|
+
const isRewire = everWiredRef.current;
|
|
44
|
+
everWiredRef.current = true;
|
|
45
|
+
let initialRun = true;
|
|
46
|
+
return effect(() => {
|
|
47
|
+
touchSignals(target);
|
|
48
|
+
if (initialRun) {
|
|
49
|
+
initialRun = false;
|
|
50
|
+
if (isRewire) return;
|
|
51
|
+
}
|
|
52
|
+
versionRef.current++;
|
|
53
|
+
notify();
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
[target]
|
|
57
|
+
);
|
|
58
|
+
const getVersion = () => versionRef.current;
|
|
59
|
+
useSyncExternalStore(subscribe, getVersion, getVersion);
|
|
60
|
+
}
|
|
37
61
|
const ContextProviderContext = createContext(null);
|
|
38
62
|
function ContextProvider({ children }) {
|
|
39
63
|
const [rootElement, setRootElement] = useState(null);
|
|
@@ -68,7 +92,9 @@ function useContext(context) {
|
|
|
68
92
|
if (root == null) {
|
|
69
93
|
throw new Error("ContextProvider not available");
|
|
70
94
|
}
|
|
71
|
-
|
|
95
|
+
const ctx = injectContext(root, context);
|
|
96
|
+
useContextSubscription(ctx);
|
|
97
|
+
return wrapContext(ctx);
|
|
72
98
|
}
|
|
73
99
|
function useBlockId() {
|
|
74
100
|
const root = useContext$1(ContextProviderContext);
|
|
@@ -116,7 +142,12 @@ function createReactRenderer(component) {
|
|
|
116
142
|
})
|
|
117
143
|
);
|
|
118
144
|
};
|
|
119
|
-
|
|
145
|
+
if (getHook()) {
|
|
146
|
+
__recordDevtoolsPropSetter(block.id, () => {
|
|
147
|
+
renderTree(applyDevtoolsPropOverride(block.id, block.props));
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
renderTree(applyDevtoolsPropOverride(block.id, block.props));
|
|
120
151
|
attachEmptyTracking(wrapper);
|
|
121
152
|
return wrapper;
|
|
122
153
|
};
|
|
@@ -201,11 +232,12 @@ export {
|
|
|
201
232
|
ContextProvider,
|
|
202
233
|
createReactCeRenderer,
|
|
203
234
|
createReactRenderer,
|
|
204
|
-
|
|
235
|
+
a as toSignal,
|
|
205
236
|
toState,
|
|
206
237
|
useBlockId,
|
|
207
238
|
useBridge,
|
|
208
239
|
useContext,
|
|
240
|
+
useContextSubscription,
|
|
209
241
|
useProvideContext,
|
|
210
242
|
useSignal
|
|
211
243
|
};
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ApiFetcher } from '../../utils';
|
|
2
|
+
import { OrderAdapter } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Returns a mock `OrderAdapter` with sample orders including customAttributes.
|
|
5
|
+
* Hosts can override the methods to seed real fixtures.
|
|
6
|
+
* Used as a starting point by storybook helpers (`createMockOrderService`) and theme preview.
|
|
7
|
+
*/
|
|
7
8
|
export declare function createMockOrderAdapter(): OrderAdapter;
|
|
8
9
|
export declare function createApiOrderAdapter(fetcher: ApiFetcher): OrderAdapter;
|
|
9
10
|
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/order/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/order/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAoB,YAAY,EAAmB,MAAM,SAAS,CAAC;AAE/E;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,YAAY,CA6DrD;AAwDD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,UAAU,GAAG,YAAY,CA2BvE"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export type { OrderAdapter } from './
|
|
1
|
+
export type { GetOrdersParams, Order, OrderLine, OrderAdapter, OrderService, } from './types';
|
|
2
2
|
export { createMockOrderAdapter, createApiOrderAdapter } from './adapter';
|
|
3
|
-
export { createOrderService, OrderServiceContext } from './orderService';
|
|
4
|
-
export * from './types';
|
|
3
|
+
export { createOrderService, OrderServiceContext, } from './orderService';
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/order/index.ts"],"names":[],"mappings":"AAAA,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/order/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,KAAK,EACL,SAAS,EACT,YAAY,EACZ,YAAY,GACb,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAE1E,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { OrderAdapter } from './
|
|
2
|
-
|
|
1
|
+
import { OrderAdapter, OrderService } from './types';
|
|
2
|
+
export declare function createOrderService(adapter: OrderAdapter): OrderService;
|
|
3
3
|
export declare const OrderServiceContext: {
|
|
4
4
|
__context__: OrderService;
|
|
5
5
|
};
|
|
6
|
-
export declare function createOrderService(adapter: OrderAdapter): OrderService;
|
|
7
6
|
//# sourceMappingURL=orderService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orderService.d.ts","sourceRoot":"","sources":["../../../src/services/order/orderService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"orderService.d.ts","sourceRoot":"","sources":["../../../src/services/order/orderService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,CAWtE;AAED,eAAO,MAAM,mBAAmB;;CACe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orderService.test.d.ts","sourceRoot":"","sources":["../../../src/services/order/orderService.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,21 +1,60 @@
|
|
|
1
|
-
import { Result } from '../../utils';
|
|
2
|
-
export interface
|
|
1
|
+
import { Image, PaginatedList, Result } from '../../utils';
|
|
2
|
+
export interface OrderLine {
|
|
3
3
|
id: string;
|
|
4
|
-
|
|
5
|
-
variantId: string;
|
|
4
|
+
title: string;
|
|
6
5
|
quantity: number;
|
|
7
|
-
|
|
6
|
+
variantImage: Image | null;
|
|
7
|
+
customAttributes?: Array<{
|
|
8
|
+
key: string;
|
|
9
|
+
value: string;
|
|
10
|
+
}>;
|
|
8
11
|
}
|
|
9
12
|
export interface Order {
|
|
13
|
+
/** Numeric Shopify order id (the trailing segment of the order GID). The block prepends `#` for display. */
|
|
10
14
|
id: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
createdAt: string;
|
|
16
|
+
placedAt: string | null;
|
|
17
|
+
currencyCode: string;
|
|
18
|
+
totalPrice: number | null;
|
|
19
|
+
/** Raw Shopify financial-status token (e.g. `PAID`, `PARTIALLY_REFUNDED`); the block humanizes it for display. `null` = unknown. */
|
|
20
|
+
financialStatus: string | null;
|
|
21
|
+
/** Raw Shopify fulfillment-status token (e.g. `FULFILLED`, `PARTIALLY_FULFILLED`); the block humanizes it for display. `null` = unknown. */
|
|
22
|
+
fulfillmentStatus: string | null;
|
|
23
|
+
lines: OrderLine[];
|
|
24
|
+
customAttributes?: Array<{
|
|
25
|
+
key: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
export interface GetOrdersParams {
|
|
30
|
+
limit?: number;
|
|
31
|
+
after?: string;
|
|
32
|
+
before?: string;
|
|
33
|
+
/**
|
|
34
|
+
* DEPRECATED: previously used for free-text / per-subscriptionId server-side
|
|
35
|
+
* search. The backend proxy implementation ignores this parameter; accepted
|
|
36
|
+
* for SDK backward compatibility only. Use `includeOneTime` to control
|
|
37
|
+
* which order types are returned.
|
|
38
|
+
*
|
|
39
|
+
* @deprecated
|
|
40
|
+
*/
|
|
41
|
+
query?: string;
|
|
42
|
+
/**
|
|
43
|
+
* When `false` (default), only subscription-driven orders are returned.
|
|
44
|
+
* When `true`, one-time orders are included alongside subscription orders.
|
|
45
|
+
*/
|
|
46
|
+
includeOneTime?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Sort order. When set to `"placedAt"`, orders are sorted by placement
|
|
49
|
+
* date (newest first). When omitted, the endpoint's default sort is used.
|
|
50
|
+
*/
|
|
51
|
+
sort?: "placedAt";
|
|
52
|
+
}
|
|
53
|
+
/** Adapter consumed by `createOrderService`. Hosts (customer portal, theme, storybook) implement this. */
|
|
54
|
+
export interface OrderAdapter {
|
|
55
|
+
getOrders(params?: GetOrdersParams): Promise<PaginatedList<Order>>;
|
|
56
|
+
}
|
|
57
|
+
export interface OrderService {
|
|
58
|
+
getOrders(params?: GetOrdersParams): Promise<Result<PaginatedList<Order>>>;
|
|
16
59
|
}
|
|
17
|
-
export type OrderService = {
|
|
18
|
-
getHistory(): Promise<Result<Order[]>>;
|
|
19
|
-
getById(id: string): Promise<Result<Order | null>>;
|
|
20
|
-
};
|
|
21
60
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/order/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/order/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,KAAK,GAAG,IAAI,CAAC;IAC3B,gBAAgB,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1D;AAED,MAAM,WAAW,KAAK;IACpB,4GAA4G;IAC5G,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oIAAoI;IACpI,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,4IAA4I;IAC5I,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,gBAAgB,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1D;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,0GAA0G;AAC1G,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;CACpE;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,CACP,MAAM,CAAC,EAAE,eAAe,GACvB,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;CAC1C"}
|
package/dist/shared/context.d.ts
CHANGED
|
@@ -6,11 +6,18 @@ export type Wrap<T> = T extends Signal<infer V> ? [V, (value: V) => void] : T ex
|
|
|
6
6
|
[K in keyof T]: Wrap<T[K]>;
|
|
7
7
|
} : T;
|
|
8
8
|
/**
|
|
9
|
-
* Wraps a context value, converting
|
|
9
|
+
* Wraps a context value, converting signal props to plain `[value, setter]`
|
|
10
|
+
* state tuples.
|
|
11
|
+
*
|
|
12
|
+
* The proxy is fully synchronous and hook-free. Reactivity is provided
|
|
13
|
+
* separately: `useContext` (react/preact) installs one coarse-grained
|
|
14
|
+
* subscription per context via `useContextSubscription`, which rerenders the
|
|
15
|
+
* component when any signal in the context changes — covering both tuple
|
|
16
|
+
* reads and method-internal signal reads. Keeping hooks out of the proxy
|
|
17
|
+
* makes double reads, conditional reads, and event-handler reads all legal.
|
|
10
18
|
*
|
|
11
19
|
* @param obj - The context value to wrap
|
|
12
|
-
* @param toState - Function to convert a signal to framework state tuple
|
|
13
20
|
* @returns The wrapped context value
|
|
14
21
|
*/
|
|
15
|
-
export declare function wrapContext<T>(obj: T
|
|
22
|
+
export declare function wrapContext<T>(obj: T): Wrap<T>;
|
|
16
23
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/shared/context.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAC3C,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,GACvB,CAAC,SAAS,QAAQ,GAClB,CAAC,GACD,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAC1B;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3B,GACD,CAAC,CAAC;AAEN
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/shared/context.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAC3C,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,GACvB,CAAC,SAAS,QAAQ,GAClB,CAAC,GACD,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAC1B;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3B,GACD,CAAC,CAAC;AAEN;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CA4C9C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared signal-graph walker for framework integrations
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Reads `.value` of every signal reachable from `obj` — own enumerable
|
|
6
|
+
* props, recursing into plain nested objects. Calling this inside a
|
|
7
|
+
* signals `effect()` subscribes that effect to every signal in the
|
|
8
|
+
* context object graph; this is the coarse-grained subscription behind
|
|
9
|
+
* the react/preact `useContextSubscription` hooks.
|
|
10
|
+
*
|
|
11
|
+
* Skips functions and arrays (parity with the reach of the Vue `wrap()`
|
|
12
|
+
* recursion) and does not recurse into a signal's current value —
|
|
13
|
+
* services replace signal values immutably, so the signal itself is the
|
|
14
|
+
* unit of change. A WeakSet guards against cycles.
|
|
15
|
+
*/
|
|
16
|
+
export declare function touchSignals(obj: unknown): void;
|
|
17
|
+
//# sourceMappingURL=touchSignals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"touchSignals.d.ts","sourceRoot":"","sources":["../../src/shared/touchSignals.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAE/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"touchSignals.test.d.ts","sourceRoot":"","sources":["../../src/shared/touchSignals.test.ts"],"names":[],"mappings":""}
|
package/dist/theme-state.d.ts
CHANGED
|
@@ -78,7 +78,8 @@ export type ThemeState = {
|
|
|
78
78
|
locales: ThemeLocaleState;
|
|
79
79
|
globalStyles: ReadonlySignal<GlobalStyles>;
|
|
80
80
|
setGlobalStyles: (styles: GlobalStyles) => void;
|
|
81
|
-
|
|
81
|
+
setInstanceTranslationOverride: (blockId: string, key: string, value: string) => void;
|
|
82
|
+
resolve: (surface: ThemeSurface, path: string, params?: Record<string, unknown>) => Promise<{
|
|
82
83
|
blocks: Block[];
|
|
83
84
|
}>;
|
|
84
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-state.d.ts","sourceRoot":"","sources":["../src/theme-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,MAAM,EACZ,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAIL,KAAK,KAAK,EAEV,KAAK,aAAa,EAGnB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/D,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,CAAC;AAE9C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG,QAAQ,CAA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,MAAM,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;CAC9E,GAAG,UAAU,CAsQb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-state.params.test.d.ts","sourceRoot":"","sources":["../src/theme-state.params.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-state.translations.test.d.ts","sourceRoot":"","sources":["../src/theme-state.translations.test.ts"],"names":[],"mappings":""}
|