@wix/himalaya-cli 0.1271.0 → 0.1273.0
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/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/hhp/src/index.d.ts +19 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/hhp.mjs +30 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/package.json +4 -0
- package/dist/cli.mjs +6682 -4816
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/hhp-resources.json +35 -0
- package/guides/hhp.md +184 -0
- package/guides/importable-sdks.md +1 -0
- package/guides/index.json +6 -0
- package/guides/sdk-reference.json +37 -0
- package/package.json +4 -2
package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/hhp/src/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Compile-time controller authoring. This module does not install a device runtime. */
|
|
2
|
+
export type ControllerEvent<T = unknown> = {
|
|
3
|
+
/** Native action properties retain their declared payload fields. Narrow these
|
|
4
|
+
* values in the handler, or use a typed value payload for ordinary inputs. */
|
|
5
|
+
[field: string]: unknown;
|
|
6
|
+
value?: T;
|
|
7
|
+
key?: string;
|
|
8
|
+
args?: Record<string, unknown>;
|
|
9
|
+
};
|
|
10
|
+
export interface Controller<S> {
|
|
11
|
+
initialState: S;
|
|
12
|
+
handlers: Record<string, (state: S, event: ControllerEvent) => S | undefined | Promise<S | undefined>>;
|
|
13
|
+
}
|
|
14
|
+
/** HHP lowers this declaration to defineService at build time. */
|
|
15
|
+
export declare function defineController<S>(controller: Controller<S>): Controller<S>;
|
|
16
|
+
/** Normalize the existing worker event payload without discarding native event fields. */
|
|
17
|
+
export declare function normalizeControllerEvent(event: unknown): ControllerEvent;
|
|
18
|
+
/** Used by generated reducers; immutable, own-property-only nested updates. */
|
|
19
|
+
export declare function updateBoundValue<S>(state: S, path: string, value: unknown): S;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// ../../core/sdk/hhp/src/index.ts
|
|
2
|
+
function defineController(controller) {
|
|
3
|
+
return controller;
|
|
4
|
+
}
|
|
5
|
+
function normalizeControllerEvent(event) {
|
|
6
|
+
if (event === void 0 || event === null) return {};
|
|
7
|
+
if (typeof event === "object" && !Array.isArray(event)) {
|
|
8
|
+
const record = event;
|
|
9
|
+
return { ...record, ...Object.hasOwn(record, "value") ? {} : Object.hasOwn(record, "selectedId") ? { value: record.selectedId } : Object.hasOwn(record, "selectedIds") ? { value: record.selectedIds } : {} };
|
|
10
|
+
}
|
|
11
|
+
return { value: event };
|
|
12
|
+
}
|
|
13
|
+
function updateBoundValue(state, path, value) {
|
|
14
|
+
const parts = path.split(".");
|
|
15
|
+
if (parts.some((p) => !p || ["__proto__", "prototype", "constructor"].includes(p)))
|
|
16
|
+
throw new Error("Invalid controller binding path");
|
|
17
|
+
const update = (current, index) => {
|
|
18
|
+
if (!current || typeof current !== "object" || Array.isArray(current) || !Object.hasOwn(current, parts[index]))
|
|
19
|
+
throw new Error(`Unknown controller binding: ${path}`);
|
|
20
|
+
const record = current;
|
|
21
|
+
return { ...record, [parts[index]]: index === parts.length - 1 ? value : update(record[parts[index]], index + 1) };
|
|
22
|
+
};
|
|
23
|
+
return update(state, 0);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
defineController,
|
|
27
|
+
normalizeControllerEvent,
|
|
28
|
+
updateBoundValue
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=hhp.mjs.map
|
|
@@ -118,6 +118,10 @@
|
|
|
118
118
|
"types": "./dist/_types/core/sdk/health/src/index.d.ts",
|
|
119
119
|
"import": "./dist/health.mjs"
|
|
120
120
|
},
|
|
121
|
+
"./hhp": {
|
|
122
|
+
"types": "./dist/_types/core/sdk/hhp/src/index.d.ts",
|
|
123
|
+
"import": "./dist/hhp.mjs"
|
|
124
|
+
},
|
|
121
125
|
"./himi-apps": {
|
|
122
126
|
"types": "./dist/_types/core/sdk/himi-apps/src/index.d.ts",
|
|
123
127
|
"import": "./dist/himi-apps.mjs"
|