@almadar/ui 3.5.5 → 3.7.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 +25 -0
- package/dist/avl/index.js +25 -0
- package/dist/components/index.cjs +3 -0
- package/dist/components/index.js +3 -0
- package/dist/hooks/index.cjs +3 -0
- package/dist/hooks/index.js +3 -0
- package/dist/runtime/index.cjs +25 -0
- package/dist/runtime/index.js +25 -0
- package/dist/runtime/types.d.ts +28 -1
- package/package.json +2 -2
package/dist/avl/index.cjs
CHANGED
|
@@ -51497,6 +51497,16 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
51497
51497
|
});
|
|
51498
51498
|
}
|
|
51499
51499
|
}
|
|
51500
|
+
const LIFECYCLE_EVENTS = /* @__PURE__ */ new Set(["INIT", "LOAD", "$MOUNT", "$UNMOUNT", "$FRAME"]);
|
|
51501
|
+
if (!LIFECYCLE_EVENTS.has(normalizedEvent)) {
|
|
51502
|
+
for (const { traitName, result } of results) {
|
|
51503
|
+
if (!result.executed) continue;
|
|
51504
|
+
eventBus.emit(normalizedEvent, payload, {
|
|
51505
|
+
trait: traitName,
|
|
51506
|
+
fromBridge: true
|
|
51507
|
+
});
|
|
51508
|
+
}
|
|
51509
|
+
}
|
|
51500
51510
|
if (results.length > 0) {
|
|
51501
51511
|
setTraitStates(currentManager.getAllStates());
|
|
51502
51512
|
}
|
|
@@ -51556,6 +51566,21 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
51556
51566
|
});
|
|
51557
51567
|
unsubscribes.push(unsub);
|
|
51558
51568
|
}
|
|
51569
|
+
for (const binding of traitBindings) {
|
|
51570
|
+
const listens = binding.trait.listens ?? [];
|
|
51571
|
+
for (const listen of listens) {
|
|
51572
|
+
const expectedTrait = listen.source?.trait;
|
|
51573
|
+
const unsub = eventBus.on(listen.event, (event) => {
|
|
51574
|
+
if (expectedTrait) {
|
|
51575
|
+
const emitTrait = event.source?.trait;
|
|
51576
|
+
if (emitTrait !== expectedTrait) return;
|
|
51577
|
+
}
|
|
51578
|
+
console.log("[TraitStateMachine] listens", binding.trait.name, listen.event, "\u2192", listen.triggers, "from", event.source?.trait);
|
|
51579
|
+
enqueueAndDrain(listen.triggers, event.payload);
|
|
51580
|
+
});
|
|
51581
|
+
unsubscribes.push(unsub);
|
|
51582
|
+
}
|
|
51583
|
+
}
|
|
51559
51584
|
return () => {
|
|
51560
51585
|
for (const unsub of unsubscribes) {
|
|
51561
51586
|
unsub();
|
package/dist/avl/index.js
CHANGED
|
@@ -51451,6 +51451,16 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
51451
51451
|
});
|
|
51452
51452
|
}
|
|
51453
51453
|
}
|
|
51454
|
+
const LIFECYCLE_EVENTS = /* @__PURE__ */ new Set(["INIT", "LOAD", "$MOUNT", "$UNMOUNT", "$FRAME"]);
|
|
51455
|
+
if (!LIFECYCLE_EVENTS.has(normalizedEvent)) {
|
|
51456
|
+
for (const { traitName, result } of results) {
|
|
51457
|
+
if (!result.executed) continue;
|
|
51458
|
+
eventBus.emit(normalizedEvent, payload, {
|
|
51459
|
+
trait: traitName,
|
|
51460
|
+
fromBridge: true
|
|
51461
|
+
});
|
|
51462
|
+
}
|
|
51463
|
+
}
|
|
51454
51464
|
if (results.length > 0) {
|
|
51455
51465
|
setTraitStates(currentManager.getAllStates());
|
|
51456
51466
|
}
|
|
@@ -51510,6 +51520,21 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
51510
51520
|
});
|
|
51511
51521
|
unsubscribes.push(unsub);
|
|
51512
51522
|
}
|
|
51523
|
+
for (const binding of traitBindings) {
|
|
51524
|
+
const listens = binding.trait.listens ?? [];
|
|
51525
|
+
for (const listen of listens) {
|
|
51526
|
+
const expectedTrait = listen.source?.trait;
|
|
51527
|
+
const unsub = eventBus.on(listen.event, (event) => {
|
|
51528
|
+
if (expectedTrait) {
|
|
51529
|
+
const emitTrait = event.source?.trait;
|
|
51530
|
+
if (emitTrait !== expectedTrait) return;
|
|
51531
|
+
}
|
|
51532
|
+
console.log("[TraitStateMachine] listens", binding.trait.name, listen.event, "\u2192", listen.triggers, "from", event.source?.trait);
|
|
51533
|
+
enqueueAndDrain(listen.triggers, event.payload);
|
|
51534
|
+
});
|
|
51535
|
+
unsubscribes.push(unsub);
|
|
51536
|
+
}
|
|
51537
|
+
}
|
|
51513
51538
|
return () => {
|
|
51514
51539
|
for (const unsub of unsubscribes) {
|
|
51515
51540
|
unsub();
|
|
@@ -40894,6 +40894,9 @@ function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
|
40894
40894
|
};
|
|
40895
40895
|
unsubscribes.push(eventBus.on(`${UI_PREFIX}${smEvent}`, prefixedHandler));
|
|
40896
40896
|
const directHandler = (event) => {
|
|
40897
|
+
if (event.source && event.source.fromBridge) {
|
|
40898
|
+
return;
|
|
40899
|
+
}
|
|
40897
40900
|
dispatch(smEvent, event.payload);
|
|
40898
40901
|
};
|
|
40899
40902
|
unsubscribes.push(eventBus.on(smEvent, directHandler));
|
package/dist/components/index.js
CHANGED
|
@@ -40849,6 +40849,9 @@ function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
|
40849
40849
|
};
|
|
40850
40850
|
unsubscribes.push(eventBus.on(`${UI_PREFIX}${smEvent}`, prefixedHandler));
|
|
40851
40851
|
const directHandler = (event) => {
|
|
40852
|
+
if (event.source && event.source.fromBridge) {
|
|
40853
|
+
return;
|
|
40854
|
+
}
|
|
40852
40855
|
dispatch(smEvent, event.payload);
|
|
40853
40856
|
};
|
|
40854
40857
|
unsubscribes.push(eventBus.on(smEvent, directHandler));
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -1254,6 +1254,9 @@ function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
|
1254
1254
|
};
|
|
1255
1255
|
unsubscribes.push(eventBus.on(`${UI_PREFIX}${smEvent}`, prefixedHandler));
|
|
1256
1256
|
const directHandler = (event) => {
|
|
1257
|
+
if (event.source && event.source.fromBridge) {
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1257
1260
|
dispatch(smEvent, event.payload);
|
|
1258
1261
|
};
|
|
1259
1262
|
unsubscribes.push(eventBus.on(smEvent, directHandler));
|
package/dist/hooks/index.js
CHANGED
|
@@ -1248,6 +1248,9 @@ function useUIEvents(dispatch, validEvents, eventBusInstance) {
|
|
|
1248
1248
|
};
|
|
1249
1249
|
unsubscribes.push(eventBus.on(`${UI_PREFIX}${smEvent}`, prefixedHandler));
|
|
1250
1250
|
const directHandler = (event) => {
|
|
1251
|
+
if (event.source && event.source.fromBridge) {
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1251
1254
|
dispatch(smEvent, event.payload);
|
|
1252
1255
|
};
|
|
1253
1256
|
unsubscribes.push(eventBus.on(smEvent, directHandler));
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -38293,6 +38293,16 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
38293
38293
|
});
|
|
38294
38294
|
}
|
|
38295
38295
|
}
|
|
38296
|
+
const LIFECYCLE_EVENTS = /* @__PURE__ */ new Set(["INIT", "LOAD", "$MOUNT", "$UNMOUNT", "$FRAME"]);
|
|
38297
|
+
if (!LIFECYCLE_EVENTS.has(normalizedEvent)) {
|
|
38298
|
+
for (const { traitName, result } of results) {
|
|
38299
|
+
if (!result.executed) continue;
|
|
38300
|
+
eventBus.emit(normalizedEvent, payload, {
|
|
38301
|
+
trait: traitName,
|
|
38302
|
+
fromBridge: true
|
|
38303
|
+
});
|
|
38304
|
+
}
|
|
38305
|
+
}
|
|
38296
38306
|
if (results.length > 0) {
|
|
38297
38307
|
setTraitStates(currentManager.getAllStates());
|
|
38298
38308
|
}
|
|
@@ -38352,6 +38362,21 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
38352
38362
|
});
|
|
38353
38363
|
unsubscribes.push(unsub);
|
|
38354
38364
|
}
|
|
38365
|
+
for (const binding of traitBindings) {
|
|
38366
|
+
const listens = binding.trait.listens ?? [];
|
|
38367
|
+
for (const listen of listens) {
|
|
38368
|
+
const expectedTrait = listen.source?.trait;
|
|
38369
|
+
const unsub = eventBus.on(listen.event, (event) => {
|
|
38370
|
+
if (expectedTrait) {
|
|
38371
|
+
const emitTrait = event.source?.trait;
|
|
38372
|
+
if (emitTrait !== expectedTrait) return;
|
|
38373
|
+
}
|
|
38374
|
+
console.log("[TraitStateMachine] listens", binding.trait.name, listen.event, "\u2192", listen.triggers, "from", event.source?.trait);
|
|
38375
|
+
enqueueAndDrain(listen.triggers, event.payload);
|
|
38376
|
+
});
|
|
38377
|
+
unsubscribes.push(unsub);
|
|
38378
|
+
}
|
|
38379
|
+
}
|
|
38355
38380
|
return () => {
|
|
38356
38381
|
for (const unsub of unsubscribes) {
|
|
38357
38382
|
unsub();
|
package/dist/runtime/index.js
CHANGED
|
@@ -38248,6 +38248,16 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
38248
38248
|
});
|
|
38249
38249
|
}
|
|
38250
38250
|
}
|
|
38251
|
+
const LIFECYCLE_EVENTS = /* @__PURE__ */ new Set(["INIT", "LOAD", "$MOUNT", "$UNMOUNT", "$FRAME"]);
|
|
38252
|
+
if (!LIFECYCLE_EVENTS.has(normalizedEvent)) {
|
|
38253
|
+
for (const { traitName, result } of results) {
|
|
38254
|
+
if (!result.executed) continue;
|
|
38255
|
+
eventBus.emit(normalizedEvent, payload, {
|
|
38256
|
+
trait: traitName,
|
|
38257
|
+
fromBridge: true
|
|
38258
|
+
});
|
|
38259
|
+
}
|
|
38260
|
+
}
|
|
38251
38261
|
if (results.length > 0) {
|
|
38252
38262
|
setTraitStates(currentManager.getAllStates());
|
|
38253
38263
|
}
|
|
@@ -38307,6 +38317,21 @@ function useTraitStateMachine(traitBindings, slotsActions, options) {
|
|
|
38307
38317
|
});
|
|
38308
38318
|
unsubscribes.push(unsub);
|
|
38309
38319
|
}
|
|
38320
|
+
for (const binding of traitBindings) {
|
|
38321
|
+
const listens = binding.trait.listens ?? [];
|
|
38322
|
+
for (const listen of listens) {
|
|
38323
|
+
const expectedTrait = listen.source?.trait;
|
|
38324
|
+
const unsub = eventBus.on(listen.event, (event) => {
|
|
38325
|
+
if (expectedTrait) {
|
|
38326
|
+
const emitTrait = event.source?.trait;
|
|
38327
|
+
if (emitTrait !== expectedTrait) return;
|
|
38328
|
+
}
|
|
38329
|
+
console.log("[TraitStateMachine] listens", binding.trait.name, listen.event, "\u2192", listen.triggers, "from", event.source?.trait);
|
|
38330
|
+
enqueueAndDrain(listen.triggers, event.payload);
|
|
38331
|
+
});
|
|
38332
|
+
unsubscribes.push(unsub);
|
|
38333
|
+
}
|
|
38334
|
+
}
|
|
38310
38335
|
return () => {
|
|
38311
38336
|
for (const unsub of unsubscribes) {
|
|
38312
38337
|
unsub();
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -6,5 +6,32 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
9
|
-
export type { TransitionFrom, ResolvedField, ResolvedEntity, ResolvedEntityBinding, ResolvedTraitState, ResolvedTraitEvent, ResolvedTraitTransition, ResolvedTraitGuard, ResolvedTraitTick,
|
|
9
|
+
export type { TransitionFrom, ResolvedField, ResolvedEntity, ResolvedEntityBinding, ResolvedTraitState, ResolvedTraitEvent, ResolvedTraitTransition, ResolvedTraitGuard, ResolvedTraitTick, ResolvedTraitDataEntity, ResolvedTraitUIBinding, ResolvedTrait, ResolvedTraitBinding, ResolvedPattern, ResolvedSectionEvent, ResolvedSection, ResolvedNavigation, ResolvedPage, ResolvedIR, } from '@almadar/core';
|
|
10
|
+
import type { ResolvedTraitListener as CoreResolvedTraitListener } from '@almadar/core';
|
|
11
|
+
/**
|
|
12
|
+
* Listen scope descriptor carried by the resolved orb at runtime.
|
|
13
|
+
*
|
|
14
|
+
* Emitted by the compiler in the `listens[i].source` field of each
|
|
15
|
+
* `ResolvedTraitListener`. Core's type doesn't declare this field yet
|
|
16
|
+
* (@almadar/core 5.7.0) even though the Rust compiler and .lolo parser
|
|
17
|
+
* both populate it. We declare it here in @almadar/ui (the consumer)
|
|
18
|
+
* rather than modify core.
|
|
19
|
+
*
|
|
20
|
+
* - `any`: accept emits from any trait
|
|
21
|
+
* - `trait`: only accept emits whose `BusEvent.source.trait` matches
|
|
22
|
+
* - `orbital`: only accept emits whose `source.orbital[.trait?]` matches
|
|
23
|
+
*/
|
|
24
|
+
export interface ListenSource {
|
|
25
|
+
kind?: 'any' | 'trait' | 'orbital';
|
|
26
|
+
trait?: string;
|
|
27
|
+
orbital?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Extended `ResolvedTraitListener` carrying the runtime-only `source`
|
|
31
|
+
* scope descriptor that `@almadar/core`'s type hasn't picked up yet.
|
|
32
|
+
* Intended as a local shim until core publishes a version with `source`.
|
|
33
|
+
*/
|
|
34
|
+
export type ResolvedTraitListener = CoreResolvedTraitListener & {
|
|
35
|
+
source?: ListenSource;
|
|
36
|
+
};
|
|
10
37
|
export { createEmptyResolvedTrait, createEmptyResolvedPage, createResolvedField, inferTsType, isResolvedIR, } from '@almadar/core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "React UI components, hooks, and providers for Almadar",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/components/index.js",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"access": "public"
|
|
119
119
|
},
|
|
120
120
|
"dependencies": {
|
|
121
|
-
"@almadar/core": ">=5.
|
|
121
|
+
"@almadar/core": ">=5.7.0",
|
|
122
122
|
"@almadar/evaluator": ">=2.9.2",
|
|
123
123
|
"@almadar/patterns": ">=2.17.1",
|
|
124
124
|
"@almadar/runtime": ">=4.3.0",
|