@almadar/ui 4.29.1 → 4.31.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/avl/index.cjs
CHANGED
|
@@ -49005,7 +49005,7 @@ init_logger();
|
|
|
49005
49005
|
|
|
49006
49006
|
// runtime/createClientEffectHandlers.ts
|
|
49007
49007
|
function createClientEffectHandlers(options) {
|
|
49008
|
-
const { eventBus, slotSetter, navigate, notify } = options;
|
|
49008
|
+
const { eventBus, slotSetter, navigate, notify, callService } = options;
|
|
49009
49009
|
return {
|
|
49010
49010
|
emit: (event, payload) => {
|
|
49011
49011
|
const prefixedEvent = event.startsWith("UI:") ? event : `UI:${event}`;
|
|
@@ -49017,9 +49017,24 @@ function createClientEffectHandlers(options) {
|
|
|
49017
49017
|
set: () => {
|
|
49018
49018
|
console.warn("[ClientEffectHandlers] set is server-side only, ignored on client");
|
|
49019
49019
|
},
|
|
49020
|
-
callService: async () => {
|
|
49021
|
-
|
|
49022
|
-
|
|
49020
|
+
callService: async (service, action, params) => {
|
|
49021
|
+
if (callService) return callService(service, action, params);
|
|
49022
|
+
const mockId = `mock_${service}_${action}_${Math.random().toString(36).slice(2, 10)}`;
|
|
49023
|
+
const paramsEcho = {};
|
|
49024
|
+
if (params) {
|
|
49025
|
+
for (const [k, v] of Object.entries(params)) {
|
|
49026
|
+
if (v !== void 0 && (typeof v === "string" || typeof v === "number" || typeof v === "boolean" || v === null || v instanceof Date)) {
|
|
49027
|
+
paramsEcho[k] = v;
|
|
49028
|
+
}
|
|
49029
|
+
}
|
|
49030
|
+
}
|
|
49031
|
+
return {
|
|
49032
|
+
id: mockId,
|
|
49033
|
+
clientSecret: `secret_${mockId}`,
|
|
49034
|
+
success: true,
|
|
49035
|
+
status: "succeeded",
|
|
49036
|
+
...paramsEcho
|
|
49037
|
+
};
|
|
49023
49038
|
},
|
|
49024
49039
|
renderUI: (slot, pattern, props) => {
|
|
49025
49040
|
if (pattern === null) {
|
|
@@ -49325,7 +49340,18 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
49325
49340
|
orbitalsByTrait: JSON.stringify(orbitalsByTrait ?? null)
|
|
49326
49341
|
});
|
|
49327
49342
|
const bindingMap = new Map(bindings.map((b) => [b.trait.name, b]));
|
|
49328
|
-
const
|
|
49343
|
+
const entityByTrait = {};
|
|
49344
|
+
for (const [name, fields] of traitFieldStatesRef.current) {
|
|
49345
|
+
if (fields && Object.keys(fields).length > 0) {
|
|
49346
|
+
entityByTrait[name] = fields;
|
|
49347
|
+
}
|
|
49348
|
+
}
|
|
49349
|
+
const results = currentManager.sendEvent(
|
|
49350
|
+
normalizedEvent,
|
|
49351
|
+
payload,
|
|
49352
|
+
void 0,
|
|
49353
|
+
entityByTrait
|
|
49354
|
+
);
|
|
49329
49355
|
crossTraitLog.debug("processEvent:results", {
|
|
49330
49356
|
event: normalizedEvent,
|
|
49331
49357
|
executedCount: results.length,
|
|
@@ -49391,7 +49417,8 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
49391
49417
|
}
|
|
49392
49418
|
},
|
|
49393
49419
|
navigate: optionsRef.current?.navigate,
|
|
49394
|
-
notify: optionsRef.current?.notify
|
|
49420
|
+
notify: optionsRef.current?.notify,
|
|
49421
|
+
callService: optionsRef.current?.callService
|
|
49395
49422
|
});
|
|
49396
49423
|
const persistence = optionsRef.current?.persistence;
|
|
49397
49424
|
let handlers = clientHandlers;
|
package/dist/avl/index.js
CHANGED
|
@@ -48959,7 +48959,7 @@ init_logger();
|
|
|
48959
48959
|
|
|
48960
48960
|
// runtime/createClientEffectHandlers.ts
|
|
48961
48961
|
function createClientEffectHandlers(options) {
|
|
48962
|
-
const { eventBus, slotSetter, navigate, notify } = options;
|
|
48962
|
+
const { eventBus, slotSetter, navigate, notify, callService } = options;
|
|
48963
48963
|
return {
|
|
48964
48964
|
emit: (event, payload) => {
|
|
48965
48965
|
const prefixedEvent = event.startsWith("UI:") ? event : `UI:${event}`;
|
|
@@ -48971,9 +48971,24 @@ function createClientEffectHandlers(options) {
|
|
|
48971
48971
|
set: () => {
|
|
48972
48972
|
console.warn("[ClientEffectHandlers] set is server-side only, ignored on client");
|
|
48973
48973
|
},
|
|
48974
|
-
callService: async () => {
|
|
48975
|
-
|
|
48976
|
-
|
|
48974
|
+
callService: async (service, action, params) => {
|
|
48975
|
+
if (callService) return callService(service, action, params);
|
|
48976
|
+
const mockId = `mock_${service}_${action}_${Math.random().toString(36).slice(2, 10)}`;
|
|
48977
|
+
const paramsEcho = {};
|
|
48978
|
+
if (params) {
|
|
48979
|
+
for (const [k, v] of Object.entries(params)) {
|
|
48980
|
+
if (v !== void 0 && (typeof v === "string" || typeof v === "number" || typeof v === "boolean" || v === null || v instanceof Date)) {
|
|
48981
|
+
paramsEcho[k] = v;
|
|
48982
|
+
}
|
|
48983
|
+
}
|
|
48984
|
+
}
|
|
48985
|
+
return {
|
|
48986
|
+
id: mockId,
|
|
48987
|
+
clientSecret: `secret_${mockId}`,
|
|
48988
|
+
success: true,
|
|
48989
|
+
status: "succeeded",
|
|
48990
|
+
...paramsEcho
|
|
48991
|
+
};
|
|
48977
48992
|
},
|
|
48978
48993
|
renderUI: (slot, pattern, props) => {
|
|
48979
48994
|
if (pattern === null) {
|
|
@@ -49279,7 +49294,18 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
49279
49294
|
orbitalsByTrait: JSON.stringify(orbitalsByTrait ?? null)
|
|
49280
49295
|
});
|
|
49281
49296
|
const bindingMap = new Map(bindings.map((b) => [b.trait.name, b]));
|
|
49282
|
-
const
|
|
49297
|
+
const entityByTrait = {};
|
|
49298
|
+
for (const [name, fields] of traitFieldStatesRef.current) {
|
|
49299
|
+
if (fields && Object.keys(fields).length > 0) {
|
|
49300
|
+
entityByTrait[name] = fields;
|
|
49301
|
+
}
|
|
49302
|
+
}
|
|
49303
|
+
const results = currentManager.sendEvent(
|
|
49304
|
+
normalizedEvent,
|
|
49305
|
+
payload,
|
|
49306
|
+
void 0,
|
|
49307
|
+
entityByTrait
|
|
49308
|
+
);
|
|
49283
49309
|
crossTraitLog.debug("processEvent:results", {
|
|
49284
49310
|
event: normalizedEvent,
|
|
49285
49311
|
executedCount: results.length,
|
|
@@ -49345,7 +49371,8 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
49345
49371
|
}
|
|
49346
49372
|
},
|
|
49347
49373
|
navigate: optionsRef.current?.navigate,
|
|
49348
|
-
notify: optionsRef.current?.notify
|
|
49374
|
+
notify: optionsRef.current?.notify,
|
|
49375
|
+
callService: optionsRef.current?.callService
|
|
49349
49376
|
});
|
|
49350
49377
|
const persistence = optionsRef.current?.persistence;
|
|
49351
49378
|
let handlers = clientHandlers;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
|
-
import type { EventPayload } from '@almadar/core';
|
|
8
|
+
import type { EventPayload, ServiceParams } from '@almadar/core';
|
|
9
9
|
import type { EffectHandlers } from '@almadar/runtime';
|
|
10
10
|
export interface ClientEventBus {
|
|
11
11
|
emit: (type: string, payload?: EventPayload) => void;
|
|
@@ -19,5 +19,13 @@ export interface CreateClientEffectHandlersOptions {
|
|
|
19
19
|
slotSetter: SlotSetter;
|
|
20
20
|
navigate?: (path: string, params?: Record<string, unknown>) => void;
|
|
21
21
|
notify?: (message: string, type: 'success' | 'error' | 'warning' | 'info') => void;
|
|
22
|
+
/**
|
|
23
|
+
* Optional consumer-supplied call-service handler. When set, it runs
|
|
24
|
+
* instead of the default mock fallback — use to wire the playground
|
|
25
|
+
* to real backends. When omitted, `callService` returns a synthetic
|
|
26
|
+
* mock result so service-atom chains advance end-to-end in offline /
|
|
27
|
+
* standalone-preview mode (see OrbitalServerRuntime's mock parallel).
|
|
28
|
+
*/
|
|
29
|
+
callService?: (service: string, action: string, params?: ServiceParams) => Promise<unknown>;
|
|
22
30
|
}
|
|
23
31
|
export declare function createClientEffectHandlers(options: CreateClientEffectHandlersOptions): EffectHandlers;
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -35397,7 +35397,7 @@ init_logger();
|
|
|
35397
35397
|
|
|
35398
35398
|
// runtime/createClientEffectHandlers.ts
|
|
35399
35399
|
function createClientEffectHandlers(options) {
|
|
35400
|
-
const { eventBus, slotSetter, navigate, notify } = options;
|
|
35400
|
+
const { eventBus, slotSetter, navigate, notify, callService } = options;
|
|
35401
35401
|
return {
|
|
35402
35402
|
emit: (event, payload) => {
|
|
35403
35403
|
const prefixedEvent = event.startsWith("UI:") ? event : `UI:${event}`;
|
|
@@ -35409,9 +35409,24 @@ function createClientEffectHandlers(options) {
|
|
|
35409
35409
|
set: () => {
|
|
35410
35410
|
console.warn("[ClientEffectHandlers] set is server-side only, ignored on client");
|
|
35411
35411
|
},
|
|
35412
|
-
callService: async () => {
|
|
35413
|
-
|
|
35414
|
-
|
|
35412
|
+
callService: async (service, action, params) => {
|
|
35413
|
+
if (callService) return callService(service, action, params);
|
|
35414
|
+
const mockId = `mock_${service}_${action}_${Math.random().toString(36).slice(2, 10)}`;
|
|
35415
|
+
const paramsEcho = {};
|
|
35416
|
+
if (params) {
|
|
35417
|
+
for (const [k, v] of Object.entries(params)) {
|
|
35418
|
+
if (v !== void 0 && (typeof v === "string" || typeof v === "number" || typeof v === "boolean" || v === null || v instanceof Date)) {
|
|
35419
|
+
paramsEcho[k] = v;
|
|
35420
|
+
}
|
|
35421
|
+
}
|
|
35422
|
+
}
|
|
35423
|
+
return {
|
|
35424
|
+
id: mockId,
|
|
35425
|
+
clientSecret: `secret_${mockId}`,
|
|
35426
|
+
success: true,
|
|
35427
|
+
status: "succeeded",
|
|
35428
|
+
...paramsEcho
|
|
35429
|
+
};
|
|
35415
35430
|
},
|
|
35416
35431
|
renderUI: (slot, pattern, props) => {
|
|
35417
35432
|
if (pattern === null) {
|
|
@@ -35828,7 +35843,18 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
35828
35843
|
orbitalsByTrait: JSON.stringify(orbitalsByTrait ?? null)
|
|
35829
35844
|
});
|
|
35830
35845
|
const bindingMap = new Map(bindings.map((b) => [b.trait.name, b]));
|
|
35831
|
-
const
|
|
35846
|
+
const entityByTrait = {};
|
|
35847
|
+
for (const [name, fields] of traitFieldStatesRef.current) {
|
|
35848
|
+
if (fields && Object.keys(fields).length > 0) {
|
|
35849
|
+
entityByTrait[name] = fields;
|
|
35850
|
+
}
|
|
35851
|
+
}
|
|
35852
|
+
const results = currentManager.sendEvent(
|
|
35853
|
+
normalizedEvent,
|
|
35854
|
+
payload,
|
|
35855
|
+
void 0,
|
|
35856
|
+
entityByTrait
|
|
35857
|
+
);
|
|
35832
35858
|
crossTraitLog.debug("processEvent:results", {
|
|
35833
35859
|
event: normalizedEvent,
|
|
35834
35860
|
executedCount: results.length,
|
|
@@ -35894,7 +35920,8 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
35894
35920
|
}
|
|
35895
35921
|
},
|
|
35896
35922
|
navigate: optionsRef.current?.navigate,
|
|
35897
|
-
notify: optionsRef.current?.notify
|
|
35923
|
+
notify: optionsRef.current?.notify,
|
|
35924
|
+
callService: optionsRef.current?.callService
|
|
35898
35925
|
});
|
|
35899
35926
|
const persistence = optionsRef.current?.persistence;
|
|
35900
35927
|
let handlers = clientHandlers;
|
package/dist/runtime/index.js
CHANGED
|
@@ -35352,7 +35352,7 @@ init_logger();
|
|
|
35352
35352
|
|
|
35353
35353
|
// runtime/createClientEffectHandlers.ts
|
|
35354
35354
|
function createClientEffectHandlers(options) {
|
|
35355
|
-
const { eventBus, slotSetter, navigate, notify } = options;
|
|
35355
|
+
const { eventBus, slotSetter, navigate, notify, callService } = options;
|
|
35356
35356
|
return {
|
|
35357
35357
|
emit: (event, payload) => {
|
|
35358
35358
|
const prefixedEvent = event.startsWith("UI:") ? event : `UI:${event}`;
|
|
@@ -35364,9 +35364,24 @@ function createClientEffectHandlers(options) {
|
|
|
35364
35364
|
set: () => {
|
|
35365
35365
|
console.warn("[ClientEffectHandlers] set is server-side only, ignored on client");
|
|
35366
35366
|
},
|
|
35367
|
-
callService: async () => {
|
|
35368
|
-
|
|
35369
|
-
|
|
35367
|
+
callService: async (service, action, params) => {
|
|
35368
|
+
if (callService) return callService(service, action, params);
|
|
35369
|
+
const mockId = `mock_${service}_${action}_${Math.random().toString(36).slice(2, 10)}`;
|
|
35370
|
+
const paramsEcho = {};
|
|
35371
|
+
if (params) {
|
|
35372
|
+
for (const [k, v] of Object.entries(params)) {
|
|
35373
|
+
if (v !== void 0 && (typeof v === "string" || typeof v === "number" || typeof v === "boolean" || v === null || v instanceof Date)) {
|
|
35374
|
+
paramsEcho[k] = v;
|
|
35375
|
+
}
|
|
35376
|
+
}
|
|
35377
|
+
}
|
|
35378
|
+
return {
|
|
35379
|
+
id: mockId,
|
|
35380
|
+
clientSecret: `secret_${mockId}`,
|
|
35381
|
+
success: true,
|
|
35382
|
+
status: "succeeded",
|
|
35383
|
+
...paramsEcho
|
|
35384
|
+
};
|
|
35370
35385
|
},
|
|
35371
35386
|
renderUI: (slot, pattern, props) => {
|
|
35372
35387
|
if (pattern === null) {
|
|
@@ -35783,7 +35798,18 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
35783
35798
|
orbitalsByTrait: JSON.stringify(orbitalsByTrait ?? null)
|
|
35784
35799
|
});
|
|
35785
35800
|
const bindingMap = new Map(bindings.map((b) => [b.trait.name, b]));
|
|
35786
|
-
const
|
|
35801
|
+
const entityByTrait = {};
|
|
35802
|
+
for (const [name, fields] of traitFieldStatesRef.current) {
|
|
35803
|
+
if (fields && Object.keys(fields).length > 0) {
|
|
35804
|
+
entityByTrait[name] = fields;
|
|
35805
|
+
}
|
|
35806
|
+
}
|
|
35807
|
+
const results = currentManager.sendEvent(
|
|
35808
|
+
normalizedEvent,
|
|
35809
|
+
payload,
|
|
35810
|
+
void 0,
|
|
35811
|
+
entityByTrait
|
|
35812
|
+
);
|
|
35787
35813
|
crossTraitLog.debug("processEvent:results", {
|
|
35788
35814
|
event: normalizedEvent,
|
|
35789
35815
|
executedCount: results.length,
|
|
@@ -35849,7 +35875,8 @@ function useTraitStateMachine(traitBindings, uiSlots, options) {
|
|
|
35849
35875
|
}
|
|
35850
35876
|
},
|
|
35851
35877
|
navigate: optionsRef.current?.navigate,
|
|
35852
|
-
notify: optionsRef.current?.notify
|
|
35878
|
+
notify: optionsRef.current?.notify,
|
|
35879
|
+
callService: optionsRef.current?.callService
|
|
35853
35880
|
});
|
|
35854
35881
|
const persistence = optionsRef.current?.persistence;
|
|
35855
35882
|
let handlers = clientHandlers;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.31.0",
|
|
4
4
|
"description": "React UI components, hooks, and providers for Almadar",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"@almadar/core": ">=7.12.0",
|
|
126
126
|
"@almadar/evaluator": ">=2.9.2",
|
|
127
127
|
"@almadar/patterns": "^2.21.0",
|
|
128
|
-
"@almadar/runtime": "^6.
|
|
128
|
+
"@almadar/runtime": "^6.2.0",
|
|
129
129
|
"@almadar/std": ">=6.4.1",
|
|
130
130
|
"@almadar/syntax": ">=1.3.1",
|
|
131
131
|
"@xyflow/react": "12.10.1",
|