jaxs 0.9.8 → 0.10.1
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 +66 -29
- package/dist/jaxs.js +65 -53
- package/dist/jaxs.umd.cjs +32 -26
- 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
|
|
@@ -164,6 +174,8 @@ declare type CompileChildren = (
|
|
|
164
174
|
parent: JaxsElement,
|
|
165
175
|
) => ChangeInstructions
|
|
166
176
|
|
|
177
|
+
declare type ComponentProps = Record<string, unknown>
|
|
178
|
+
|
|
167
179
|
export declare const createApp: (
|
|
168
180
|
domEnvironment?: CreateAppBuilderArguments,
|
|
169
181
|
) => App
|
|
@@ -353,10 +365,12 @@ export declare namespace JaxsTypes {
|
|
|
353
365
|
TypedTemplate,
|
|
354
366
|
Template,
|
|
355
367
|
RenderableCollection,
|
|
356
|
-
StoreMap,
|
|
357
368
|
ViewModel,
|
|
358
|
-
|
|
359
|
-
|
|
369
|
+
ViewModelResult,
|
|
370
|
+
ComponentProps,
|
|
371
|
+
BindArguments,
|
|
372
|
+
SimpleViewModel,
|
|
373
|
+
WithViewModelArguments,
|
|
360
374
|
ChangeInstructionTypes,
|
|
361
375
|
RemoveInstructionData,
|
|
362
376
|
AttributeInstructionData,
|
|
@@ -621,12 +635,12 @@ declare class Root {
|
|
|
621
635
|
declare const routeChangeEvent = 'navigation:route-change'
|
|
622
636
|
|
|
623
637
|
export declare const routedView: (routes: RenderedRoute[]) => (
|
|
624
|
-
attributes:
|
|
625
|
-
|
|
638
|
+
attributes: Props<
|
|
639
|
+
Partial<{
|
|
626
640
|
route: RouteState
|
|
627
641
|
}>
|
|
628
642
|
>,
|
|
629
|
-
) => Bound<
|
|
643
|
+
) => Bound<ComponentProps, ComponentProps, Partial<ComponentProps>>
|
|
630
644
|
|
|
631
645
|
export declare type RouteMatcher = (routeState: RouteState) => boolean
|
|
632
646
|
|
|
@@ -640,6 +654,10 @@ export declare namespace routing {
|
|
|
640
654
|
export { exactPathMatch, catchAll, buildRouter }
|
|
641
655
|
}
|
|
642
656
|
|
|
657
|
+
declare type SimpleViewModel<ViewModelProps, TemplateProps> = (
|
|
658
|
+
props: ViewModelProps,
|
|
659
|
+
) => Partial<TemplateProps>
|
|
660
|
+
|
|
643
661
|
declare interface SourceMap {
|
|
644
662
|
__source?: ReactSourceObject
|
|
645
663
|
}
|
|
@@ -707,10 +725,6 @@ declare type StoreInitializationOptions<T> = {
|
|
|
707
725
|
|
|
708
726
|
declare type StoreListSorterFunction<T> = (left: T, right: T) => number
|
|
709
727
|
|
|
710
|
-
declare type StoreMap = {
|
|
711
|
-
[key: string]: any
|
|
712
|
-
}
|
|
713
|
-
|
|
714
728
|
declare type StoresCollection = Record<string, Store_2<any>>
|
|
715
729
|
|
|
716
730
|
declare type StoreUpdater<T> =
|
|
@@ -805,13 +819,36 @@ declare type UpdateEventInstructionData = {
|
|
|
805
819
|
|
|
806
820
|
declare type UpdaterValue<T> = boolean | T | T[]
|
|
807
821
|
|
|
808
|
-
declare type ViewModel<
|
|
809
|
-
|
|
810
|
-
|
|
822
|
+
declare type ViewModel<TemplateProps, BoundProps, StateMap> = (
|
|
823
|
+
StateMap: StateMap,
|
|
824
|
+
props?: Props<BoundProps>,
|
|
825
|
+
) => Partial<TemplateProps>
|
|
826
|
+
|
|
827
|
+
declare type ViewModelResult<TemplateProps, BoundProps, StateMap> =
|
|
828
|
+
| Partial<TemplateProps>
|
|
829
|
+
| (StateMap & Props<BoundProps>)
|
|
811
830
|
|
|
812
831
|
declare type WithTimeoutOptions<T> = {
|
|
813
832
|
timeout: number
|
|
814
833
|
payload?: T
|
|
815
834
|
}
|
|
816
835
|
|
|
836
|
+
export declare const withViewModel: <
|
|
837
|
+
TemplateProps extends ComponentProps,
|
|
838
|
+
ViewModelProps extends ComponentProps,
|
|
839
|
+
>({
|
|
840
|
+
Template,
|
|
841
|
+
viewModel,
|
|
842
|
+
}: WithViewModelArguments<TemplateProps, ViewModelProps>) => (
|
|
843
|
+
viewModelProps: ViewModelProps & Partial<TemplateProps>,
|
|
844
|
+
) => Renderable
|
|
845
|
+
|
|
846
|
+
declare type WithViewModelArguments<
|
|
847
|
+
TemplateProps extends ComponentProps,
|
|
848
|
+
ViewModelProps extends ComponentProps,
|
|
849
|
+
> = {
|
|
850
|
+
Template: Template<TemplateProps>
|
|
851
|
+
viewModel: SimpleViewModel<ViewModelProps, TemplateProps>
|
|
852
|
+
}
|
|
853
|
+
|
|
817
854
|
export {}
|
package/dist/jaxs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const O = (e, t) => {
|
|
2
2
|
for (let s = e.length - 1; s >= 0; s--) e[s] === t && e.splice(s, 1)
|
|
3
3
|
return e
|
|
4
4
|
},
|
|
@@ -8,8 +8,8 @@ const M = (e, t) => {
|
|
|
8
8
|
},
|
|
9
9
|
$ = (e, t, s) => (e.splice(t, 0, s), e),
|
|
10
10
|
D = (e, t) => (e.includes(t) || e.push(t), e),
|
|
11
|
-
|
|
12
|
-
remove:
|
|
11
|
+
Le = {
|
|
12
|
+
remove: O,
|
|
13
13
|
removeBy: k,
|
|
14
14
|
insertAt: $,
|
|
15
15
|
appendIfUnique: D,
|
|
@@ -57,7 +57,7 @@ class ht {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
const f = (e) => new ht(e),
|
|
60
|
-
|
|
60
|
+
ze = {
|
|
61
61
|
toggle: (e) => f(e).toggle(),
|
|
62
62
|
setTrue: (e) => f(e).setTrue(),
|
|
63
63
|
setFalse: (e) => f(e).setFalse(),
|
|
@@ -70,7 +70,7 @@ const f = (e) => new ht(e),
|
|
|
70
70
|
P = (e) => typeof e == 'string',
|
|
71
71
|
v = (e) => Array.isArray(e),
|
|
72
72
|
E = (e) => e !== null && !v(e) && typeof e == 'object',
|
|
73
|
-
|
|
73
|
+
Ke = {
|
|
74
74
|
boolean: dt,
|
|
75
75
|
number: pt,
|
|
76
76
|
string: P,
|
|
@@ -95,7 +95,7 @@ const f = (e) => new ht(e),
|
|
|
95
95
|
return g(s, n)
|
|
96
96
|
}),
|
|
97
97
|
g = (e, t) => (E(e) ? B(e, t) : v(e) ? F(e, t) : mt(e, t)),
|
|
98
|
-
|
|
98
|
+
Re = {
|
|
99
99
|
objects: B,
|
|
100
100
|
arrays: F,
|
|
101
101
|
equal: g,
|
|
@@ -140,7 +140,7 @@ class bt {
|
|
|
140
140
|
$(r, t, s), this.update(r)
|
|
141
141
|
}
|
|
142
142
|
remove(t) {
|
|
143
|
-
const s =
|
|
143
|
+
const s = O(this.value, t)
|
|
144
144
|
this.update(s)
|
|
145
145
|
}
|
|
146
146
|
removeBy(t) {
|
|
@@ -164,7 +164,7 @@ class bt {
|
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
const m = (e) => new bt(e),
|
|
167
|
-
|
|
167
|
+
Ue = {
|
|
168
168
|
push: (e, t) => m(e).push(t),
|
|
169
169
|
pop: (e) => m(e).pop(),
|
|
170
170
|
unshift: (e, t) => m(e).unshift(t),
|
|
@@ -219,7 +219,7 @@ class vt {
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
const b = (e) => new vt(e),
|
|
222
|
-
|
|
222
|
+
Ie = {
|
|
223
223
|
reset: (e) => b(e).reset(),
|
|
224
224
|
resetAttribute: (e, t) => b(e).resetAttribute(t),
|
|
225
225
|
updateAttribute: (e, t, s) => b(e).updateAttribute(t, s),
|
|
@@ -342,9 +342,9 @@ class Tt {
|
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
const jt = (e) => typeof e == 'string' || typeof e == 'number',
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
V = (e) => kt(e).map(
|
|
345
|
+
Mt = (e) => new Tt(e),
|
|
346
|
+
Ot = (e) => (jt(e) ? Mt(e) : e),
|
|
347
|
+
V = (e) => kt(e).map(Ot).flat(),
|
|
348
348
|
kt = (e) => (Array.isArray(e) ? e.flat() : e ? [e] : []),
|
|
349
349
|
L = (e, t = {}) => V(e || t.children || []),
|
|
350
350
|
$t = (e, t = '') => {
|
|
@@ -601,7 +601,7 @@ class Z {
|
|
|
601
601
|
Y(this)
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
|
-
const
|
|
604
|
+
const qe = /* @__PURE__ */ Object.freeze(
|
|
605
605
|
/* @__PURE__ */ Object.defineProperty(
|
|
606
606
|
{
|
|
607
607
|
__proto__: null,
|
|
@@ -783,7 +783,7 @@ const rt = (e) => {
|
|
|
783
783
|
subscribe: s,
|
|
784
784
|
}
|
|
785
785
|
},
|
|
786
|
-
|
|
786
|
+
Je = /* @__PURE__ */ Object.freeze(
|
|
787
787
|
/* @__PURE__ */ Object.defineProperty(
|
|
788
788
|
{
|
|
789
789
|
__proto__: null,
|
|
@@ -887,7 +887,7 @@ class it {
|
|
|
887
887
|
}
|
|
888
888
|
}
|
|
889
889
|
const ot = (e) => new it(e),
|
|
890
|
-
|
|
890
|
+
He = /* @__PURE__ */ Object.freeze(
|
|
891
891
|
/* @__PURE__ */ Object.defineProperty(
|
|
892
892
|
{
|
|
893
893
|
__proto__: null,
|
|
@@ -952,7 +952,7 @@ class Ht {
|
|
|
952
952
|
}
|
|
953
953
|
}
|
|
954
954
|
}
|
|
955
|
-
const
|
|
955
|
+
const Ge = (e = {}) => {
|
|
956
956
|
const s = new Ht(e).setup()
|
|
957
957
|
return s.startNavigation(), s
|
|
958
958
|
}
|
|
@@ -970,7 +970,7 @@ var c = /* @__PURE__ */ ((e) => (
|
|
|
970
970
|
(e[(e.changeText = 10)] = 'changeText'),
|
|
971
971
|
e
|
|
972
972
|
))(c || {})
|
|
973
|
-
const
|
|
973
|
+
const We = /* @__PURE__ */ Object.freeze(
|
|
974
974
|
/* @__PURE__ */ Object.defineProperty(
|
|
975
975
|
{
|
|
976
976
|
__proto__: null,
|
|
@@ -1083,7 +1083,7 @@ class re {
|
|
|
1083
1083
|
return Object.values(this.map).flat()
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
|
-
const
|
|
1086
|
+
const M = (e) => {
|
|
1087
1087
|
const t = new re()
|
|
1088
1088
|
return t.populate(e), t
|
|
1089
1089
|
},
|
|
@@ -1216,8 +1216,8 @@ const O = (e) => {
|
|
|
1216
1216
|
at = (e, t, s) => {
|
|
1217
1217
|
const r = [],
|
|
1218
1218
|
n = de(e, t),
|
|
1219
|
-
i =
|
|
1220
|
-
o =
|
|
1219
|
+
i = M(e),
|
|
1220
|
+
o = M(t),
|
|
1221
1221
|
a = []
|
|
1222
1222
|
let u = 0
|
|
1223
1223
|
for (; u < n; u++) {
|
|
@@ -1353,12 +1353,12 @@ const O = (e) => {
|
|
|
1353
1353
|
const r = $e[e.type]
|
|
1354
1354
|
r && r(e, t, s)
|
|
1355
1355
|
},
|
|
1356
|
-
|
|
1356
|
+
Me = (e, t) => {
|
|
1357
1357
|
const { source: s } = e,
|
|
1358
1358
|
r = t.indexOf(s)
|
|
1359
1359
|
r >= 0 && t.splice(r, 1)
|
|
1360
1360
|
},
|
|
1361
|
-
|
|
1361
|
+
Oe = (e, t, s) => {
|
|
1362
1362
|
const { target: r } = e,
|
|
1363
1363
|
n = e.data,
|
|
1364
1364
|
{ index: i, parent: o } = n
|
|
@@ -1370,8 +1370,8 @@ const O = (e) => {
|
|
|
1370
1370
|
n >= 0 && (t[n] = s)
|
|
1371
1371
|
},
|
|
1372
1372
|
$e = {
|
|
1373
|
-
[c.removeNode]:
|
|
1374
|
-
[c.insertNode]:
|
|
1373
|
+
[c.removeNode]: Me,
|
|
1374
|
+
[c.insertNode]: Oe,
|
|
1375
1375
|
[c.replaceNode]: ke,
|
|
1376
1376
|
}
|
|
1377
1377
|
class De {
|
|
@@ -1393,12 +1393,16 @@ class De {
|
|
|
1393
1393
|
)
|
|
1394
1394
|
}
|
|
1395
1395
|
generateDom(t) {
|
|
1396
|
-
const s =
|
|
1396
|
+
const s = this.viewModel(
|
|
1397
|
+
t.state.getAll(this.subscriptions),
|
|
1398
|
+
this.attributes,
|
|
1399
|
+
),
|
|
1400
|
+
r = {
|
|
1397
1401
|
...this.attributes,
|
|
1398
|
-
...
|
|
1402
|
+
...s,
|
|
1399
1403
|
},
|
|
1400
|
-
|
|
1401
|
-
return
|
|
1404
|
+
n = this.Template(r)
|
|
1405
|
+
return n ? n.render(t) : []
|
|
1402
1406
|
}
|
|
1403
1407
|
rerender() {
|
|
1404
1408
|
if (!this.parentElement && this.dom[0]) {
|
|
@@ -1419,18 +1423,24 @@ class De {
|
|
|
1419
1423
|
return `${S}:${t}`
|
|
1420
1424
|
}
|
|
1421
1425
|
}
|
|
1422
|
-
const Pe =
|
|
1423
|
-
|
|
1424
|
-
(s = s || []),
|
|
1425
|
-
(t = t || Pe),
|
|
1426
|
+
const Pe =
|
|
1427
|
+
({ Template: e, subscriptions: t, viewModel: s }) =>
|
|
1426
1428
|
(r) =>
|
|
1427
|
-
new De({ Template: e, viewModel:
|
|
1428
|
-
|
|
1429
|
-
|
|
1429
|
+
new De({ Template: e, viewModel: s, subscriptions: t, attributes: r }),
|
|
1430
|
+
Ce =
|
|
1431
|
+
({ Template: e, viewModel: t }) =>
|
|
1432
|
+
(s) => {
|
|
1433
|
+
const r = {
|
|
1434
|
+
...s,
|
|
1435
|
+
...t(s),
|
|
1436
|
+
}
|
|
1437
|
+
return e(r)
|
|
1438
|
+
},
|
|
1439
|
+
Be =
|
|
1430
1440
|
(e) =>
|
|
1431
1441
|
({ path: t }) =>
|
|
1432
1442
|
t === e,
|
|
1433
|
-
|
|
1443
|
+
Fe = () => !0,
|
|
1434
1444
|
lt =
|
|
1435
1445
|
(e) =>
|
|
1436
1446
|
({ route: t }) => {
|
|
@@ -1442,20 +1452,21 @@ const Pe = (e) => e,
|
|
|
1442
1452
|
{
|
|
1443
1453
|
__proto__: null,
|
|
1444
1454
|
buildRouter: lt,
|
|
1445
|
-
catchAll:
|
|
1446
|
-
exactPathMatch:
|
|
1455
|
+
catchAll: Fe,
|
|
1456
|
+
exactPathMatch: Be,
|
|
1447
1457
|
},
|
|
1448
1458
|
Symbol.toStringTag,
|
|
1449
1459
|
{ value: 'Module' },
|
|
1450
1460
|
),
|
|
1451
1461
|
),
|
|
1452
|
-
|
|
1462
|
+
Ve = () => ({
|
|
1453
1463
|
render: (e, t) => [],
|
|
1454
1464
|
}),
|
|
1455
1465
|
Xe = (e) => {
|
|
1456
1466
|
const t = lt(e)
|
|
1457
|
-
return
|
|
1458
|
-
Template: ({ route: r }) => (t({ route: r }) ||
|
|
1467
|
+
return Pe({
|
|
1468
|
+
Template: ({ route: r }) => (t({ route: r }) || Ve)(),
|
|
1469
|
+
viewModel: ({ route: r }) => ({ route: r }),
|
|
1459
1470
|
subscriptions: ['route'],
|
|
1460
1471
|
})
|
|
1461
1472
|
},
|
|
@@ -1477,20 +1488,21 @@ const Pe = (e) => e,
|
|
|
1477
1488
|
),
|
|
1478
1489
|
)
|
|
1479
1490
|
export {
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1491
|
+
Le as ArrayModifiers,
|
|
1492
|
+
ze as BooleanStore,
|
|
1493
|
+
Re as Equality,
|
|
1494
|
+
Ke as Is,
|
|
1495
|
+
We as JaxsTypes,
|
|
1496
|
+
Ue as ListStore,
|
|
1497
|
+
Ie as RecordStore,
|
|
1498
|
+
qe as appBuilding,
|
|
1499
|
+
Pe as bind,
|
|
1500
|
+
Ge as createApp,
|
|
1490
1501
|
Lt as jsx,
|
|
1491
|
-
|
|
1502
|
+
Je as messageBus,
|
|
1492
1503
|
Ye as navigation,
|
|
1493
1504
|
Xe as routedView,
|
|
1494
1505
|
Qe as routing,
|
|
1495
|
-
|
|
1506
|
+
He as state,
|
|
1507
|
+
Ce as withViewModel,
|
|
1496
1508
|
}
|
package/dist/jaxs.umd.cjs
CHANGED
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
for (let s = e.length - 1; s >= 0; s--) e[s] === t && e.splice(s, 1)
|
|
12
12
|
return e
|
|
13
13
|
},
|
|
14
|
-
|
|
14
|
+
M = (e, t) => {
|
|
15
15
|
for (let s = e.length - 1; s >= 0; s--) t(e[s]) && e.splice(s, 1)
|
|
16
16
|
return e
|
|
17
17
|
},
|
|
18
|
-
|
|
18
|
+
O = (e, t, s) => (e.splice(t, 0, s), e),
|
|
19
19
|
k = (e, t) => (e.includes(t) || e.push(t), e),
|
|
20
20
|
ft = {
|
|
21
21
|
remove: b,
|
|
22
|
-
removeBy:
|
|
23
|
-
insertAt:
|
|
22
|
+
removeBy: M,
|
|
23
|
+
insertAt: O,
|
|
24
24
|
appendIfUnique: k,
|
|
25
25
|
push: (e, t) => e.push(t),
|
|
26
26
|
pop: (e) => e.pop(),
|
|
@@ -130,14 +130,14 @@
|
|
|
130
130
|
}
|
|
131
131
|
insertAt(t, s) {
|
|
132
132
|
const r = this.value
|
|
133
|
-
|
|
133
|
+
O(r, t, s), this.update(r)
|
|
134
134
|
}
|
|
135
135
|
remove(t) {
|
|
136
136
|
const s = b(this.value, t)
|
|
137
137
|
this.update(s)
|
|
138
138
|
}
|
|
139
139
|
removeBy(t) {
|
|
140
|
-
const s =
|
|
140
|
+
const s = M(this.value, t)
|
|
141
141
|
this.update(s)
|
|
142
142
|
}
|
|
143
143
|
includes(t) {
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
$(r) && r.trim() === '' ? e.removeAttribute(s) : e.setAttribute(s, r)
|
|
232
232
|
}
|
|
233
233
|
},
|
|
234
|
-
|
|
234
|
+
Mt = (e, t, s) => {
|
|
235
235
|
const r = {}
|
|
236
236
|
for (const n in t) {
|
|
237
237
|
const i = t[n],
|
|
@@ -241,9 +241,9 @@
|
|
|
241
241
|
}
|
|
242
242
|
e.eventMaps = r
|
|
243
243
|
},
|
|
244
|
-
|
|
244
|
+
Ot = (e, t, s, r) => {
|
|
245
245
|
const n = Tt(e, r.document)
|
|
246
|
-
return jt(n, t),
|
|
246
|
+
return jt(n, t), Mt(n, s, r.publish), n
|
|
247
247
|
},
|
|
248
248
|
N = 'http://www.w3.org/2000/svg',
|
|
249
249
|
kt = {
|
|
@@ -427,7 +427,7 @@
|
|
|
427
427
|
return this.isSvg ? this.generateSvgDom(t) : this.generateHtmlDom(t)
|
|
428
428
|
}
|
|
429
429
|
generateHtmlDom(t) {
|
|
430
|
-
const s =
|
|
430
|
+
const s = Ot(this.type, this.attributes, this.events, t)
|
|
431
431
|
return (s.__jsx = this.jsxKey()), s
|
|
432
432
|
}
|
|
433
433
|
generateSvgDom(t) {
|
|
@@ -1118,11 +1118,11 @@
|
|
|
1118
1118
|
;(ze[e.type] || je)(e)
|
|
1119
1119
|
},
|
|
1120
1120
|
je = (e) => {},
|
|
1121
|
-
|
|
1121
|
+
Me = (e) => {
|
|
1122
1122
|
const { source: t, target: s } = e
|
|
1123
1123
|
t.nodeValue = s.textContent
|
|
1124
1124
|
},
|
|
1125
|
-
|
|
1125
|
+
Oe = (e) => {
|
|
1126
1126
|
const { source: t } = e
|
|
1127
1127
|
t.remove()
|
|
1128
1128
|
},
|
|
@@ -1174,8 +1174,8 @@
|
|
|
1174
1174
|
s.value = r
|
|
1175
1175
|
},
|
|
1176
1176
|
ze = {
|
|
1177
|
-
[a.changeText]:
|
|
1178
|
-
[a.removeNode]:
|
|
1177
|
+
[a.changeText]: Me,
|
|
1178
|
+
[a.removeNode]: Oe,
|
|
1179
1179
|
[a.insertNode]: ke,
|
|
1180
1180
|
[a.replaceNode]: $e,
|
|
1181
1181
|
[a.removeAttribute]: De,
|
|
@@ -1240,12 +1240,13 @@
|
|
|
1240
1240
|
)
|
|
1241
1241
|
}
|
|
1242
1242
|
generateDom(t) {
|
|
1243
|
-
const s =
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
r = this.
|
|
1248
|
-
|
|
1243
|
+
const s = this.viewModel(
|
|
1244
|
+
t.state.getAll(this.subscriptions),
|
|
1245
|
+
this.attributes,
|
|
1246
|
+
),
|
|
1247
|
+
r = { ...this.attributes, ...s },
|
|
1248
|
+
n = this.Template(r)
|
|
1249
|
+
return n ? n.render(t) : []
|
|
1249
1250
|
}
|
|
1250
1251
|
rerender() {
|
|
1251
1252
|
if (!this.parentElement && this.dom[0]) {
|
|
@@ -1266,13 +1267,16 @@
|
|
|
1266
1267
|
return `${T}:${t}`
|
|
1267
1268
|
}
|
|
1268
1269
|
}
|
|
1269
|
-
const
|
|
1270
|
-
|
|
1271
|
-
(s = s || []),
|
|
1272
|
-
(t = t || Ge),
|
|
1270
|
+
const dt =
|
|
1271
|
+
({ Template: e, subscriptions: t, viewModel: s }) =>
|
|
1273
1272
|
(r) =>
|
|
1274
|
-
new He({ Template: e, viewModel:
|
|
1275
|
-
|
|
1273
|
+
new He({ Template: e, viewModel: s, subscriptions: t, attributes: r }),
|
|
1274
|
+
Ge =
|
|
1275
|
+
({ Template: e, viewModel: t }) =>
|
|
1276
|
+
(s) => {
|
|
1277
|
+
const r = { ...s, ...t(s) }
|
|
1278
|
+
return e(r)
|
|
1279
|
+
},
|
|
1276
1280
|
We =
|
|
1277
1281
|
(e) =>
|
|
1278
1282
|
({ path: t }) =>
|
|
@@ -1296,6 +1300,7 @@
|
|
|
1296
1300
|
const t = pt(e)
|
|
1297
1301
|
return dt({
|
|
1298
1302
|
Template: ({ route: r }) => (t({ route: r }) || Xe)(),
|
|
1303
|
+
viewModel: ({ route: r }) => ({ route: r }),
|
|
1299
1304
|
subscriptions: ['route'],
|
|
1300
1305
|
})
|
|
1301
1306
|
},
|
|
@@ -1332,5 +1337,6 @@
|
|
|
1332
1337
|
(l.routedView = Ye),
|
|
1333
1338
|
(l.routing = Qe),
|
|
1334
1339
|
(l.state = se),
|
|
1340
|
+
(l.withViewModel = Ge),
|
|
1335
1341
|
Object.defineProperty(l, Symbol.toStringTag, { value: 'Module' })
|
|
1336
1342
|
})
|