@jay-framework/runtime 0.11.0 → 0.12.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/index.d.ts +11 -9
- package/dist/index.js +3 -3
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -69,20 +69,22 @@ type JayEventHandlerWrapper<EventType, ViewState, Returns> = (orig: JayEventHand
|
|
|
69
69
|
interface ContextMarker<ContextType> {
|
|
70
70
|
}
|
|
71
71
|
declare const _jayContractBrand: unique symbol;
|
|
72
|
-
type JayContract<ViewState extends object, Refs extends object, SlowViewState extends object = never, FastViewState extends object = never, InteractiveViewState extends object = never> = {
|
|
72
|
+
type JayContract<ViewState extends object, Refs extends object, SlowViewState extends object = never, FastViewState extends object = never, InteractiveViewState extends object = never, Props extends object = {}> = {
|
|
73
73
|
readonly [_jayContractBrand]: {
|
|
74
74
|
viewState: ViewState;
|
|
75
75
|
refs: Refs;
|
|
76
76
|
slowViewState: SlowViewState;
|
|
77
77
|
fastViewState: FastViewState;
|
|
78
78
|
interactiveViewState: InteractiveViewState;
|
|
79
|
+
props: Props;
|
|
79
80
|
};
|
|
80
81
|
};
|
|
81
|
-
type ExtractViewState<A> = A extends JayContract<infer ViewState, any, any, any, any> ? ViewState : never;
|
|
82
|
-
type ExtractRefs<A> = A extends JayContract<any, infer Refs, any, any, any> ? Refs : never;
|
|
83
|
-
type ExtractSlowViewState<A> = A extends JayContract<any, any, infer SlowViewState, any, any> ? SlowViewState : never;
|
|
84
|
-
type ExtractFastViewState<A> = A extends JayContract<any, any, any, infer FastViewState, any> ? FastViewState : never;
|
|
85
|
-
type ExtractInteractiveViewState<A> = A extends JayContract<any, any, any, any, infer InteractiveViewState> ? InteractiveViewState : never;
|
|
82
|
+
type ExtractViewState<A> = A extends JayContract<infer ViewState, any, any, any, any, any> ? ViewState : never;
|
|
83
|
+
type ExtractRefs<A> = A extends JayContract<any, infer Refs, any, any, any, any> ? Refs : never;
|
|
84
|
+
type ExtractSlowViewState<A> = A extends JayContract<any, any, infer SlowViewState, any, any, any> ? SlowViewState : never;
|
|
85
|
+
type ExtractFastViewState<A> = A extends JayContract<any, any, any, infer FastViewState, any, any> ? FastViewState : never;
|
|
86
|
+
type ExtractInteractiveViewState<A> = A extends JayContract<any, any, any, any, infer InteractiveViewState, any> ? InteractiveViewState : never;
|
|
87
|
+
type ExtractProps<A> = A extends JayContract<any, any, any, any, any, infer Props> ? Props : never;
|
|
86
88
|
declare enum LogType {
|
|
87
89
|
ASYNC_ERROR = 0,
|
|
88
90
|
CONTEXT_NOT_FOUND = 1
|
|
@@ -484,12 +486,12 @@ declare function forEach<T, Item>(getItems: (T: any) => Array<Item>, elemCreator
|
|
|
484
486
|
* specific array item, so child bindings like {price} work correctly
|
|
485
487
|
* (they resolve to item.price, not viewState.price).
|
|
486
488
|
*
|
|
487
|
-
* @param
|
|
489
|
+
* @param getItems - Function to get the array from the parent ViewState (handles nested paths)
|
|
488
490
|
* @param index - The jayIndex value (position in the pre-rendered array)
|
|
489
491
|
* @param trackByValue - The jayTrackBy value (identity for reconciliation)
|
|
490
492
|
* @param elementCreator - Function that creates the pre-rendered element (called within item context)
|
|
491
493
|
*/
|
|
492
|
-
declare function slowForEachItem<ParentVS, ItemVS>(
|
|
494
|
+
declare function slowForEachItem<ParentVS, ItemVS>(getItems: (parentData: ParentVS) => ItemVS[], index: number, trackByValue: string, elementCreator: () => BaseJayElement<ItemVS>): BaseJayElement<ParentVS>;
|
|
493
495
|
interface ForEach<ViewState, Item> {
|
|
494
496
|
getItems: (T: any) => Array<Item>;
|
|
495
497
|
elemCreator: (Item: any, String: any) => BaseJayElement<Item>;
|
|
@@ -573,4 +575,4 @@ declare class ConstructContext<ViewState> {
|
|
|
573
575
|
static withRootContext<ViewState, Refs>(viewState: ViewState, refManager: ReferencesManager, elementConstructor: () => BaseJayElement<ViewState>): JayElement<ViewState, Refs>;
|
|
574
576
|
}
|
|
575
577
|
|
|
576
|
-
export { type Attribute, type Attributes, type BaseJayElement, BaseReferencesManager, type ComponentCollectionProxy, ComponentCollectionRefImpl, type ComponentProxy, ComponentRefImpl, ComponentRefsImpl, type Conditional, ConstructContext, type ContextMarker, type Coordinate, type DynamicAttributeOrProperty, EVENT_TRAP, type ElementFrom, type EventEmitter, type EventTypeFrom, type ExtractFastViewState, type ExtractInteractiveViewState, type ExtractRefs, type ExtractSlowViewState, type ExtractViewState, type ForEach, GetTrapProxy, type GlobalJayEvents, type HTMLElementCollectionProxy, type HTMLElementCollectionProxyTarget, type HTMLElementProxy, type HTMLElementProxyTarget, type HTMLNativeExec, type HeadLink, type JayComponent, type JayComponentConstructor, type JayContract, type JayElement, type JayEvent, type JayEventHandler, type JayEventHandlerWrapper, type JayLog, type JayNativeEventBuilder, type JayNativeFunction, LogType, type ManagedRefConstructor, ManagedRefType, type ManagedRefs, type MapEventEmitterViewState, type MountFunc, type OnlyEventEmitters, type PreRenderElement, type PrivateRef, type PrivateRefConstructor, PrivateRefs, type PropsFrom, ReferencesManager, type RenderElement, type RenderElementOptions, type TextElement, VIEW_STATE_CHANGE_EVENT, type ViewStateFrom, type When, WhenRole, type WithData, booleanAttribute, childComp, clearGlobalContextRegistry, conditional, createJayContext, currentConstructionContext, defaultEventWrapper, dynamicAttribute, dynamicElement, dynamicElementNS, dynamicProperty, dynamicText, element, findContext, forEach, injectHeadLinks, isCondition, isForEach, isWhen, isWithData, jayLog, mathMLDynamicElement, mathMLElement, mkUpdateCollection, noop, noopMount, noopUpdate, normalizeMount, normalizeUpdates, pending, registerGlobalContext, rejected, resolved, restoreContext, saveContext, slowForEachItem, svgDynamicElement, svgElement, type updateFunc, useContext, useGlobalContext, withContext, withData };
|
|
578
|
+
export { type Attribute, type Attributes, type BaseJayElement, BaseReferencesManager, type ComponentCollectionProxy, ComponentCollectionRefImpl, type ComponentProxy, ComponentRefImpl, ComponentRefsImpl, type Conditional, ConstructContext, type ContextMarker, type Coordinate, type DynamicAttributeOrProperty, EVENT_TRAP, type ElementFrom, type EventEmitter, type EventTypeFrom, type ExtractFastViewState, type ExtractInteractiveViewState, type ExtractProps, type ExtractRefs, type ExtractSlowViewState, type ExtractViewState, type ForEach, GetTrapProxy, type GlobalJayEvents, type HTMLElementCollectionProxy, type HTMLElementCollectionProxyTarget, type HTMLElementProxy, type HTMLElementProxyTarget, type HTMLNativeExec, type HeadLink, type JayComponent, type JayComponentConstructor, type JayContract, type JayElement, type JayEvent, type JayEventHandler, type JayEventHandlerWrapper, type JayLog, type JayNativeEventBuilder, type JayNativeFunction, LogType, type ManagedRefConstructor, ManagedRefType, type ManagedRefs, type MapEventEmitterViewState, type MountFunc, type OnlyEventEmitters, type PreRenderElement, type PrivateRef, type PrivateRefConstructor, PrivateRefs, type PropsFrom, ReferencesManager, type RenderElement, type RenderElementOptions, type TextElement, VIEW_STATE_CHANGE_EVENT, type ViewStateFrom, type When, WhenRole, type WithData, booleanAttribute, childComp, clearGlobalContextRegistry, conditional, createJayContext, currentConstructionContext, defaultEventWrapper, dynamicAttribute, dynamicElement, dynamicElementNS, dynamicProperty, dynamicText, element, findContext, forEach, injectHeadLinks, isCondition, isForEach, isWhen, isWithData, jayLog, mathMLDynamicElement, mathMLElement, mkUpdateCollection, noop, noopMount, noopUpdate, normalizeMount, normalizeUpdates, pending, registerGlobalContext, rejected, resolved, restoreContext, saveContext, slowForEachItem, svgDynamicElement, svgElement, type updateFunc, useContext, useGlobalContext, withContext, withData };
|
package/dist/index.js
CHANGED
|
@@ -368,17 +368,17 @@ function mkWhenPendingCondition(when2, group) {
|
|
|
368
368
|
function forEach(getItems, elemCreator, matchBy) {
|
|
369
369
|
return { getItems, elemCreator, trackBy: matchBy };
|
|
370
370
|
}
|
|
371
|
-
function slowForEachItem(
|
|
371
|
+
function slowForEachItem(getItems, index, trackByValue, elementCreator) {
|
|
372
372
|
const parentContext = currentConstructionContext();
|
|
373
373
|
const savedContext = saveContext();
|
|
374
374
|
const parentData = parentContext.currData;
|
|
375
|
-
const array = parentData
|
|
375
|
+
const array = getItems(parentData);
|
|
376
376
|
const initialItem = array?.[index];
|
|
377
377
|
const childContext = parentContext.forItem(initialItem, trackByValue);
|
|
378
378
|
const element2 = withContext(CONSTRUCTION_CONTEXT_MARKER, childContext, elementCreator);
|
|
379
379
|
const originalUpdate = element2.update;
|
|
380
380
|
const update = (newParentData) => {
|
|
381
|
-
const newArray = newParentData
|
|
381
|
+
const newArray = getItems(newParentData);
|
|
382
382
|
const newItem = newArray?.[index];
|
|
383
383
|
const updateChildContext = parentContext.forItem(newItem, trackByValue);
|
|
384
384
|
restoreContext(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"test:watch": "vitest"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@jay-framework/list-compare": "^0.
|
|
27
|
-
"@jay-framework/reactive": "^0.
|
|
26
|
+
"@jay-framework/list-compare": "^0.12.0",
|
|
27
|
+
"@jay-framework/reactive": "^0.12.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@jay-framework/dev-environment": "^0.
|
|
30
|
+
"@jay-framework/dev-environment": "^0.12.0",
|
|
31
31
|
"@testing-library/jest-dom": "^6.2.0",
|
|
32
32
|
"@types/jsdom": "^21.1.6",
|
|
33
33
|
"@types/node": "^20.11.5",
|