jaxs 0.9.7 → 0.10.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/jaxs.d.ts +54 -31
- package/dist/jaxs.js +195 -188
- package/dist/jaxs.umd.cjs +192 -191
- package/package.json +1 -1
package/dist/jaxs.d.ts
CHANGED
|
@@ -65,22 +65,28 @@ declare type AttributeInstructionData = {
|
|
|
65
65
|
isSvg?: boolean
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
export declare const bind: <
|
|
68
|
+
export declare const bind: <
|
|
69
|
+
TemplateProps extends ComponentProps,
|
|
70
|
+
StateMap extends ComponentProps,
|
|
71
|
+
BoundProps extends ComponentProps = Partial<TemplateProps>,
|
|
72
|
+
>({
|
|
69
73
|
Template,
|
|
70
|
-
viewModel,
|
|
71
74
|
subscriptions,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
viewModel,
|
|
76
|
+
}: BindArguments<TemplateProps, StateMap, BoundProps>) => (
|
|
77
|
+
attributes: Props<BoundProps>,
|
|
78
|
+
) => Bound<ComponentProps, ComponentProps, Partial<ComponentProps>>
|
|
75
79
|
|
|
76
|
-
declare type
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
declare type BindArguments<
|
|
81
|
+
TemplateProps extends ComponentProps,
|
|
82
|
+
StateMap extends ComponentProps,
|
|
83
|
+
BoundProps extends ComponentProps = Partial<TemplateProps>,
|
|
84
|
+
> = {
|
|
85
|
+
Template: Template<TemplateProps>
|
|
86
|
+
viewModel?: ViewModel<TemplateProps, BoundProps, StateMap>
|
|
87
|
+
subscriptions?: string[]
|
|
80
88
|
}
|
|
81
89
|
|
|
82
|
-
declare type BindSubscriptionList = string[]
|
|
83
|
-
|
|
84
90
|
export declare const BooleanStore: {
|
|
85
91
|
toggle: (store: Store<boolean>) => void
|
|
86
92
|
setTrue: (store: Store<boolean>) => void
|
|
@@ -90,11 +96,15 @@ export declare const BooleanStore: {
|
|
|
90
96
|
isFalse: (store: Store<boolean>) => boolean
|
|
91
97
|
}
|
|
92
98
|
|
|
93
|
-
declare class Bound<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
declare class Bound<
|
|
100
|
+
TemplateProps extends ComponentProps,
|
|
101
|
+
StateMap extends ComponentProps,
|
|
102
|
+
BoundProps extends ComponentProps = Partial<TemplateProps>,
|
|
103
|
+
> {
|
|
104
|
+
Template: Template<TemplateProps & BoundProps>
|
|
105
|
+
viewModel: ViewModel<TemplateProps, BoundProps, StateMap>
|
|
106
|
+
attributes: Props<BoundProps>
|
|
107
|
+
subscriptions: string[]
|
|
98
108
|
dom: JaxsNode[]
|
|
99
109
|
parentElement: JaxsElement | null
|
|
100
110
|
renderKit?: RenderKit
|
|
@@ -116,6 +126,11 @@ declare class Bound<ATTRIBUTES, STATE_MAP> {
|
|
|
116
126
|
eventName(storeName: string): string
|
|
117
127
|
}
|
|
118
128
|
|
|
129
|
+
declare type BoundViewModel<TemplateProps, BoundProps, StateMap> = (
|
|
130
|
+
StateMap: StateMap,
|
|
131
|
+
props?: Props<BoundProps>,
|
|
132
|
+
) => Partial<TemplateProps>
|
|
133
|
+
|
|
119
134
|
declare const buildRouter: (
|
|
120
135
|
pages: RenderedRoute[],
|
|
121
136
|
) => ({ route }: { route: any }) => StaticTemplate
|
|
@@ -164,6 +179,8 @@ declare type CompileChildren = (
|
|
|
164
179
|
parent: JaxsElement,
|
|
165
180
|
) => ChangeInstructions
|
|
166
181
|
|
|
182
|
+
declare type ComponentProps = Record<string, unknown>
|
|
183
|
+
|
|
167
184
|
export declare const createApp: (
|
|
168
185
|
domEnvironment?: CreateAppBuilderArguments,
|
|
169
186
|
) => App
|
|
@@ -193,6 +210,11 @@ declare type CustomPeriodicOptions = {
|
|
|
193
210
|
declare type CustomPeriodicPublisherOptions<T> =
|
|
194
211
|
RequiredPeriodicPublisherOptions<T> & CustomPeriodicOptions
|
|
195
212
|
|
|
213
|
+
declare type DefaultViewModel<BoundProps, StateMap> = (
|
|
214
|
+
StateMap: StateMap,
|
|
215
|
+
props: Props<BoundProps>,
|
|
216
|
+
) => StateMap & Props<BoundProps>
|
|
217
|
+
|
|
196
218
|
declare type DiffPair = {
|
|
197
219
|
source: JaxsNode
|
|
198
220
|
target: JaxsNode
|
|
@@ -353,10 +375,11 @@ export declare namespace JaxsTypes {
|
|
|
353
375
|
TypedTemplate,
|
|
354
376
|
Template,
|
|
355
377
|
RenderableCollection,
|
|
356
|
-
|
|
378
|
+
BoundViewModel,
|
|
357
379
|
ViewModel,
|
|
358
|
-
|
|
359
|
-
|
|
380
|
+
ViewModelResult,
|
|
381
|
+
ComponentProps,
|
|
382
|
+
BindArguments,
|
|
360
383
|
ChangeInstructionTypes,
|
|
361
384
|
RemoveInstructionData,
|
|
362
385
|
AttributeInstructionData,
|
|
@@ -453,7 +476,7 @@ export declare const ListStore: {
|
|
|
453
476
|
reset: <T>(store: Store<T[]>) => void
|
|
454
477
|
includes: <T>(store: Store<T[]>, value: T) => boolean
|
|
455
478
|
appendIfUnique: <T>(store: Store<T[]>, item: T) => void
|
|
456
|
-
|
|
479
|
+
find: <T>(store: Store<T[]>, matcherFunction: (value: T) => boolean) => T
|
|
457
480
|
replace: <T>(store: Store<T[]>, original: T, replacement: T) => void
|
|
458
481
|
}
|
|
459
482
|
|
|
@@ -621,12 +644,12 @@ declare class Root {
|
|
|
621
644
|
declare const routeChangeEvent = 'navigation:route-change'
|
|
622
645
|
|
|
623
646
|
export declare const routedView: (routes: RenderedRoute[]) => (
|
|
624
|
-
attributes:
|
|
625
|
-
|
|
647
|
+
attributes: Props<
|
|
648
|
+
Partial<{
|
|
626
649
|
route: RouteState
|
|
627
650
|
}>
|
|
628
651
|
>,
|
|
629
|
-
) => Bound<
|
|
652
|
+
) => Bound<ComponentProps, ComponentProps, Partial<ComponentProps>>
|
|
630
653
|
|
|
631
654
|
export declare type RouteMatcher = (routeState: RouteState) => boolean
|
|
632
655
|
|
|
@@ -707,10 +730,6 @@ declare type StoreInitializationOptions<T> = {
|
|
|
707
730
|
|
|
708
731
|
declare type StoreListSorterFunction<T> = (left: T, right: T) => number
|
|
709
732
|
|
|
710
|
-
declare type StoreMap = {
|
|
711
|
-
[key: string]: any
|
|
712
|
-
}
|
|
713
|
-
|
|
714
733
|
declare type StoresCollection = Record<string, Store_2<any>>
|
|
715
734
|
|
|
716
735
|
declare type StoreUpdater<T> =
|
|
@@ -747,7 +766,7 @@ declare class StoreUpdaterList<T> {
|
|
|
747
766
|
removeBy(matcherFunction: (value: T) => boolean): void
|
|
748
767
|
includes(value: T): boolean
|
|
749
768
|
appendIfUnique(item: T): void
|
|
750
|
-
|
|
769
|
+
find(matcherFunction: (value: T) => boolean): T
|
|
751
770
|
replace(original: T, replacement: T): void
|
|
752
771
|
}
|
|
753
772
|
|
|
@@ -805,9 +824,13 @@ declare type UpdateEventInstructionData = {
|
|
|
805
824
|
|
|
806
825
|
declare type UpdaterValue<T> = boolean | T | T[]
|
|
807
826
|
|
|
808
|
-
declare type ViewModel<
|
|
809
|
-
|
|
810
|
-
|
|
827
|
+
declare type ViewModel<TemplateProps, BoundProps, StateMap> =
|
|
828
|
+
| BoundViewModel<TemplateProps, BoundProps, StateMap>
|
|
829
|
+
| DefaultViewModel<BoundProps, StateMap>
|
|
830
|
+
|
|
831
|
+
declare type ViewModelResult<TemplateProps, BoundProps, StateMap> =
|
|
832
|
+
| Partial<TemplateProps>
|
|
833
|
+
| (StateMap & Props<BoundProps>)
|
|
811
834
|
|
|
812
835
|
declare type WithTimeoutOptions<T> = {
|
|
813
836
|
timeout: number
|