sygnal 2.6.2 → 2.6.4
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/README.md +16 -0
- package/dist/index.cjs.js +73 -87
- package/dist/index.esm.js +62 -66
- package/dist/jsx.cjs.js +2 -15
- package/dist/jsx.esm.js +0 -7
- package/dist/sygnal.min.js +1 -1
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import isolate from '@cycle/isolate';
|
|
2
2
|
import { makeCollection, StateSource, withState } from '@cycle/state';
|
|
3
|
-
import
|
|
3
|
+
import xs$1, { Stream as Stream$1 } from 'xstream';
|
|
4
4
|
export { default as xs } from 'xstream';
|
|
5
5
|
import { run as run$1 } from '@cycle/run';
|
|
6
6
|
import { makeDOMDriver } from '@cycle/dom';
|
|
@@ -72,9 +72,7 @@ var dropRepeats$1 = {};
|
|
|
72
72
|
|
|
73
73
|
var xstream = {};
|
|
74
74
|
|
|
75
|
-
var ponyfill$1 = {
|
|
76
|
-
|
|
77
|
-
var ponyfill = {};
|
|
75
|
+
var ponyfill$1 = {};
|
|
78
76
|
|
|
79
77
|
(function (exports) {
|
|
80
78
|
|
|
@@ -108,11 +106,9 @@ var ponyfill = {};
|
|
|
108
106
|
}
|
|
109
107
|
|
|
110
108
|
return result;
|
|
111
|
-
}} (ponyfill));
|
|
109
|
+
}} (ponyfill$1));
|
|
112
110
|
|
|
113
|
-
|
|
114
|
-
module.exports = ponyfill;
|
|
115
|
-
} (ponyfill$1));
|
|
111
|
+
var ponyfill = ponyfill$1;
|
|
116
112
|
|
|
117
113
|
var toStr$2 = Object.prototype.toString;
|
|
118
114
|
|
|
@@ -912,7 +908,7 @@ var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
|
912
908
|
})();
|
|
913
909
|
Object.defineProperty(xstream, "__esModule", { value: true });
|
|
914
910
|
xstream.NO_IL = xstream.NO = xstream.MemoryStream = xstream.Stream = void 0;
|
|
915
|
-
var ponyfill_1 = ponyfill
|
|
911
|
+
var ponyfill_1 = ponyfill;
|
|
916
912
|
var globalthis_1 = globalthis;
|
|
917
913
|
var $$observable = ponyfill_1.default(globalthis_1.getPolyfill());
|
|
918
914
|
var NO$1 = {};
|
|
@@ -2816,7 +2812,7 @@ function _switchable (factories, sources, name$, switched=['DOM'], stateSourceNa
|
|
|
2816
2812
|
.map(([name, factory]) => {
|
|
2817
2813
|
if (sources[stateSourceName]) {
|
|
2818
2814
|
const state$ = sources[stateSourceName].stream;
|
|
2819
|
-
const switched =
|
|
2815
|
+
const switched = xs$1.combine(name$, state$)
|
|
2820
2816
|
.filter(([newComponentName, _]) => newComponentName == name)
|
|
2821
2817
|
.map(([_, state]) => state)
|
|
2822
2818
|
.remember();
|
|
@@ -2833,7 +2829,7 @@ function _switchable (factories, sources, name$, switched=['DOM'], stateSourceNa
|
|
|
2833
2829
|
obj[sinkName] = name$
|
|
2834
2830
|
.map( newComponentName => {
|
|
2835
2831
|
const sink = sinks.find(([componentName, _]) => componentName === newComponentName);
|
|
2836
|
-
return (sink && sink[1][sinkName]) ||
|
|
2832
|
+
return (sink && sink[1][sinkName]) || xs$1.never()
|
|
2837
2833
|
})
|
|
2838
2834
|
.flatten()
|
|
2839
2835
|
.remember()
|
|
@@ -2841,7 +2837,7 @@ function _switchable (factories, sources, name$, switched=['DOM'], stateSourceNa
|
|
|
2841
2837
|
} else {
|
|
2842
2838
|
const definedSinks = sinks.filter(([_,sink]) => sink[sinkName] !== undefined)
|
|
2843
2839
|
.map(([_,sink]) => sink[sinkName]);
|
|
2844
|
-
obj[sinkName] =
|
|
2840
|
+
obj[sinkName] = xs$1.merge(...definedSinks);
|
|
2845
2841
|
}
|
|
2846
2842
|
return obj
|
|
2847
2843
|
}, {});
|
|
@@ -3145,17 +3141,6 @@ function debounce(period) {
|
|
|
3145
3141
|
}
|
|
3146
3142
|
var _default$2 = debounce$1.default = debounce;
|
|
3147
3143
|
|
|
3148
|
-
// import syntax has bugs for xstream in Node context
|
|
3149
|
-
// this attempts to normalize to work in both Node and browser
|
|
3150
|
-
// if (!xs.never && xs.default && xs.default.never) {
|
|
3151
|
-
// xs.never = xs.default.never
|
|
3152
|
-
// xs.merge = xs.default.merge
|
|
3153
|
-
// xs.of = xs.default.of
|
|
3154
|
-
// }
|
|
3155
|
-
// const concat = (Concat && Concat.default) ? Concat.default : Concat
|
|
3156
|
-
// const delay = (Delay && Delay.default) ? Delay.default : Delay
|
|
3157
|
-
// const dropRepeats = (DropRepeats && DropRepeats.default) ? DropRepeats.default : DropRepeats
|
|
3158
|
-
|
|
3159
3144
|
const ENVIRONMENT = ((typeof window != 'undefined' && window) || (process && process.env)) || {};
|
|
3160
3145
|
|
|
3161
3146
|
|
|
@@ -3215,6 +3200,7 @@ class Component {
|
|
|
3215
3200
|
// response
|
|
3216
3201
|
// view
|
|
3217
3202
|
// children
|
|
3203
|
+
// components
|
|
3218
3204
|
// initialState
|
|
3219
3205
|
// calculated
|
|
3220
3206
|
// storeCalculatedInState
|
|
@@ -3271,9 +3257,11 @@ class Component {
|
|
|
3271
3257
|
}));
|
|
3272
3258
|
}
|
|
3273
3259
|
|
|
3260
|
+
// TODO: this is a hack to allow the root component to be created without an intent or model
|
|
3261
|
+
// refactor to avoid using a global variable
|
|
3274
3262
|
if (IS_ROOT_COMPONENT && typeof this.intent === 'undefined' && typeof this.model === 'undefined') {
|
|
3275
3263
|
this.initialState = initialState || true;
|
|
3276
|
-
this.intent = _ => ({__NOOP_ACTION__:
|
|
3264
|
+
this.intent = _ => ({__NOOP_ACTION__:xs$1.never()});
|
|
3277
3265
|
this.model = {
|
|
3278
3266
|
__NOOP_ACTION__: state => state
|
|
3279
3267
|
};
|
|
@@ -3314,7 +3302,7 @@ class Component {
|
|
|
3314
3302
|
const requestSource = (this.sources && this.sources[this.requestSourceName]) || null;
|
|
3315
3303
|
|
|
3316
3304
|
if (!this.intent$) {
|
|
3317
|
-
this.action$ =
|
|
3305
|
+
this.action$ = xs$1.never();
|
|
3318
3306
|
return
|
|
3319
3307
|
}
|
|
3320
3308
|
|
|
@@ -3324,11 +3312,11 @@ class Component {
|
|
|
3324
3312
|
} else {
|
|
3325
3313
|
const mapped = Object.entries(this.intent$)
|
|
3326
3314
|
.map(([type, data$]) => data$.map(data => ({type, data})));
|
|
3327
|
-
runner =
|
|
3315
|
+
runner = xs$1.merge(xs$1.never(), ...mapped);
|
|
3328
3316
|
}
|
|
3329
3317
|
|
|
3330
|
-
const action$ = ((runner instanceof Stream$1) ? runner : (runner.apply && runner(this.sources) ||
|
|
3331
|
-
const wrapped$ = _default$3(
|
|
3318
|
+
const action$ = ((runner instanceof Stream$1) ? runner : (runner.apply && runner(this.sources) || xs$1.never()));
|
|
3319
|
+
const wrapped$ = _default$3(xs$1.of({ type: BOOTSTRAP_ACTION }), action$)
|
|
3332
3320
|
.compose(_default$4(10));
|
|
3333
3321
|
|
|
3334
3322
|
let initialApiData;
|
|
@@ -3336,12 +3324,12 @@ class Component {
|
|
|
3336
3324
|
initialApiData = requestSource.select('initial')
|
|
3337
3325
|
.flatten();
|
|
3338
3326
|
} else {
|
|
3339
|
-
initialApiData =
|
|
3327
|
+
initialApiData = xs$1.never();
|
|
3340
3328
|
}
|
|
3341
3329
|
|
|
3342
3330
|
const hydrate$ = initialApiData.map(data => ({ type: HYDRATE_ACTION, data }));
|
|
3343
3331
|
|
|
3344
|
-
this.action$ =
|
|
3332
|
+
this.action$ = xs$1.merge(wrapped$, hydrate$)
|
|
3345
3333
|
.compose(this.log(({ type }) => `Action triggered: <${ type }>`));
|
|
3346
3334
|
}
|
|
3347
3335
|
|
|
@@ -3398,7 +3386,7 @@ class Component {
|
|
|
3398
3386
|
if (actionType === 'function') {
|
|
3399
3387
|
const enhancedState = this.addCalculated(this.currentState);
|
|
3400
3388
|
const result = action(enhancedState, req);
|
|
3401
|
-
return
|
|
3389
|
+
return xs$1.of({ ...obj, data: result })
|
|
3402
3390
|
} else {
|
|
3403
3391
|
this.action$.shamefullySendNext(obj);
|
|
3404
3392
|
|
|
@@ -3408,7 +3396,7 @@ class Component {
|
|
|
3408
3396
|
const selected$ = source[REQUEST_SELECTOR_METHOD](_reqId);
|
|
3409
3397
|
return [ ...acc, selected$ ]
|
|
3410
3398
|
}, []);
|
|
3411
|
-
return
|
|
3399
|
+
return xs$1.merge(...responses)
|
|
3412
3400
|
}
|
|
3413
3401
|
} catch(err) {
|
|
3414
3402
|
console.error(err);
|
|
@@ -3416,11 +3404,11 @@ class Component {
|
|
|
3416
3404
|
}).flatten();
|
|
3417
3405
|
return [ ...acc, route$ ]
|
|
3418
3406
|
}, []);
|
|
3419
|
-
const mapped$ =
|
|
3407
|
+
const mapped$ = xs$1.merge(...mapped);
|
|
3420
3408
|
return [ ...acc, mapped$ ]
|
|
3421
3409
|
}, []);
|
|
3422
3410
|
|
|
3423
|
-
this.response$ =
|
|
3411
|
+
this.response$ = xs$1.merge(...wrapped)
|
|
3424
3412
|
.compose(this.log(res => {
|
|
3425
3413
|
if (res._action) return `[${ this.requestSourceName }] response data received for Action: <${ res._action }>`
|
|
3426
3414
|
return `[${ this.requestSourceName }] response data received from FUNCTION`
|
|
@@ -3451,14 +3439,14 @@ class Component {
|
|
|
3451
3439
|
initModel$() {
|
|
3452
3440
|
if (typeof this.model == 'undefined') {
|
|
3453
3441
|
this.model$ = this.sourceNames.reduce((a,s) => {
|
|
3454
|
-
a[s] =
|
|
3442
|
+
a[s] = xs$1.never();
|
|
3455
3443
|
return a
|
|
3456
3444
|
}, {});
|
|
3457
3445
|
return
|
|
3458
3446
|
}
|
|
3459
3447
|
|
|
3460
3448
|
const initial = { type: INITIALIZE_ACTION, data: this.initialState };
|
|
3461
|
-
const shimmed$ = this.initialState ? _default$3(
|
|
3449
|
+
const shimmed$ = this.initialState ? _default$3(xs$1.of(initial), this.action$).compose(_default$4(0)) : this.action$;
|
|
3462
3450
|
const onState = this.makeOnAction(shimmed$, true, this.action$);
|
|
3463
3451
|
const onNormal = this.makeOnAction(this.action$, false, this.action$);
|
|
3464
3452
|
|
|
@@ -3507,7 +3495,7 @@ class Component {
|
|
|
3507
3495
|
|
|
3508
3496
|
const model$ = Object.entries(reducers).reduce((acc, entry) => {
|
|
3509
3497
|
const [sink, streams] = entry;
|
|
3510
|
-
acc[sink] =
|
|
3498
|
+
acc[sink] = xs$1.merge(xs$1.never(), ...streams);
|
|
3511
3499
|
return acc
|
|
3512
3500
|
}, {});
|
|
3513
3501
|
|
|
@@ -3526,7 +3514,7 @@ class Component {
|
|
|
3526
3514
|
next: this.log(({ _reqId, _action }) => `Unhandled response for request: ${ _action } ${ _reqId }`)
|
|
3527
3515
|
});
|
|
3528
3516
|
}
|
|
3529
|
-
this.sendResponse$ =
|
|
3517
|
+
this.sendResponse$ = xs$1.never();
|
|
3530
3518
|
return
|
|
3531
3519
|
}
|
|
3532
3520
|
|
|
@@ -3554,7 +3542,7 @@ class Component {
|
|
|
3554
3542
|
return [ ...acc, mapped$ ]
|
|
3555
3543
|
}, []);
|
|
3556
3544
|
|
|
3557
|
-
this.sendResponse$ =
|
|
3545
|
+
this.sendResponse$ = xs$1.merge(...out$)
|
|
3558
3546
|
.compose(this.log(({ _reqId, _action }) => `[${ this.requestSourceName }] response sent for: <${ _action }>`));
|
|
3559
3547
|
}
|
|
3560
3548
|
|
|
@@ -3582,7 +3570,7 @@ class Component {
|
|
|
3582
3570
|
}
|
|
3583
3571
|
|
|
3584
3572
|
initSubComponentSink$() {
|
|
3585
|
-
const subComponentSink$ =
|
|
3573
|
+
const subComponentSink$ = xs$1.create({
|
|
3586
3574
|
start: listener => {
|
|
3587
3575
|
this.newSubComponentSinks = listener.next.bind(listener);
|
|
3588
3576
|
},
|
|
@@ -3595,7 +3583,7 @@ class Component {
|
|
|
3595
3583
|
}
|
|
3596
3584
|
|
|
3597
3585
|
initSubComponentsRendered$() {
|
|
3598
|
-
const stream =
|
|
3586
|
+
const stream = xs$1.create({
|
|
3599
3587
|
start: (listener) => {
|
|
3600
3588
|
this.subComponentsRendered = listener.next.bind(listener);
|
|
3601
3589
|
},
|
|
@@ -3608,7 +3596,7 @@ class Component {
|
|
|
3608
3596
|
|
|
3609
3597
|
initVdom$() {
|
|
3610
3598
|
if (typeof this.view != 'function') {
|
|
3611
|
-
this.vdom$ =
|
|
3599
|
+
this.vdom$ = xs$1.of(null);
|
|
3612
3600
|
return
|
|
3613
3601
|
}
|
|
3614
3602
|
|
|
@@ -3626,17 +3614,17 @@ class Component {
|
|
|
3626
3614
|
initSinks() {
|
|
3627
3615
|
this.sinks = this.sourceNames.reduce((acc, name) => {
|
|
3628
3616
|
if (name == this.DOMSourceName) return acc
|
|
3629
|
-
const subComponentSink$ = this.subComponentSink$ ? this.subComponentSink$.map(sinks => sinks[name]).filter(sink => !!sink).flatten() :
|
|
3617
|
+
const subComponentSink$ = this.subComponentSink$ ? this.subComponentSink$.map(sinks => sinks[name]).filter(sink => !!sink).flatten() : xs$1.never();
|
|
3630
3618
|
if (name === this.stateSourceName) {
|
|
3631
|
-
acc[name] =
|
|
3619
|
+
acc[name] = xs$1.merge((this.model$[name] || xs$1.never()), subComponentSink$, this.sources[this.stateSourceName].stream.filter(_ => false), ...this.children$[name]);
|
|
3632
3620
|
} else {
|
|
3633
|
-
acc[name] =
|
|
3621
|
+
acc[name] = xs$1.merge((this.model$[name] || xs$1.never()), subComponentSink$, ...this.children$[name]);
|
|
3634
3622
|
}
|
|
3635
3623
|
return acc
|
|
3636
3624
|
}, {});
|
|
3637
3625
|
|
|
3638
3626
|
this.sinks[this.DOMSourceName] = this.vdom$;
|
|
3639
|
-
this.sinks[this.requestSourceName] =
|
|
3627
|
+
this.sinks[this.requestSourceName] = xs$1.merge(this.sendResponse$ ,this.sinks[this.requestSourceName]);
|
|
3640
3628
|
}
|
|
3641
3629
|
|
|
3642
3630
|
makeOnAction(action$, isStateSink=true, rootAction$) {
|
|
@@ -3730,7 +3718,7 @@ class Component {
|
|
|
3730
3718
|
const renderParams = { ...this.children$[this.DOMSourceName] };
|
|
3731
3719
|
|
|
3732
3720
|
const enhancedState = state && state.isolateSource(state, { get: state => this.addCalculated(state) });
|
|
3733
|
-
const stateStream = (enhancedState && enhancedState.stream) ||
|
|
3721
|
+
const stateStream = (enhancedState && enhancedState.stream) || xs$1.never();
|
|
3734
3722
|
|
|
3735
3723
|
renderParams.state = stateStream;
|
|
3736
3724
|
renderParams[this.stateSourceName] = stateStream;
|
|
@@ -3751,7 +3739,7 @@ class Component {
|
|
|
3751
3739
|
streams.push(stream);
|
|
3752
3740
|
});
|
|
3753
3741
|
|
|
3754
|
-
const combined =
|
|
3742
|
+
const combined = xs$1.combine(...streams)
|
|
3755
3743
|
// map the streams from an array back to an object with the render parameter names as the keys
|
|
3756
3744
|
.map(arr => {
|
|
3757
3745
|
return names.reduce((acc, name, index) => {
|
|
@@ -3793,8 +3781,8 @@ class Component {
|
|
|
3793
3781
|
return acc
|
|
3794
3782
|
}
|
|
3795
3783
|
|
|
3796
|
-
const props$ =
|
|
3797
|
-
const children$ =
|
|
3784
|
+
const props$ = xs$1.create().startWith(props);
|
|
3785
|
+
const children$ = xs$1.create().startWith(children);
|
|
3798
3786
|
|
|
3799
3787
|
let instantiator;
|
|
3800
3788
|
|
|
@@ -3808,7 +3796,7 @@ class Component {
|
|
|
3808
3796
|
|
|
3809
3797
|
const sink$ = instantiator(el, props$, children$);
|
|
3810
3798
|
|
|
3811
|
-
sink$[this.DOMSourceName] = sink$[this.DOMSourceName] ? this.makeCoordinatedSubComponentDomSink(sink$[this.DOMSourceName]) :
|
|
3799
|
+
sink$[this.DOMSourceName] = sink$[this.DOMSourceName] ? this.makeCoordinatedSubComponentDomSink(sink$[this.DOMSourceName]) : xs$1.never();
|
|
3812
3800
|
|
|
3813
3801
|
acc[id] = { sink$, props$, children$ };
|
|
3814
3802
|
|
|
@@ -3822,7 +3810,7 @@ class Component {
|
|
|
3822
3810
|
|
|
3823
3811
|
const mergedSinksByType = Object.entries(sinkArrsByType).reduce((acc, [name, streamArr]) => {
|
|
3824
3812
|
if (streamArr.length === 0) return acc
|
|
3825
|
-
acc[name] = streamArr.length === 1 ? streamArr[0] :
|
|
3813
|
+
acc[name] = streamArr.length === 1 ? streamArr[0] : xs$1.merge(...streamArr);
|
|
3826
3814
|
return acc
|
|
3827
3815
|
}, {});
|
|
3828
3816
|
|
|
@@ -3852,7 +3840,7 @@ class Component {
|
|
|
3852
3840
|
const props = data.props || {};
|
|
3853
3841
|
el.children || [];
|
|
3854
3842
|
|
|
3855
|
-
const combined$ =
|
|
3843
|
+
const combined$ = xs$1.combine(this.sources[this.stateSourceName].stream.startWith(this.currentState), props$, children$)
|
|
3856
3844
|
.map(([state, __props, __children]) => {
|
|
3857
3845
|
return typeof state === 'object' ? { ...this.addCalculated(state), __props, __children } : { value: state, __props, __children }
|
|
3858
3846
|
});
|
|
@@ -3896,7 +3884,6 @@ class Component {
|
|
|
3896
3884
|
return state
|
|
3897
3885
|
},
|
|
3898
3886
|
set: (oldState, newState) => {
|
|
3899
|
-
console.log('COLL SET', newState);
|
|
3900
3887
|
return newState
|
|
3901
3888
|
}
|
|
3902
3889
|
};
|
|
@@ -3924,7 +3911,17 @@ class Component {
|
|
|
3924
3911
|
console.error(`Collection component in ${ this.name } has an invalid 'from' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting child state from the current state. Attempting to use parent component state.`);
|
|
3925
3912
|
lense = undefined;
|
|
3926
3913
|
} else {
|
|
3927
|
-
lense = {
|
|
3914
|
+
lense = {
|
|
3915
|
+
get: (state) => {
|
|
3916
|
+
const newState = stateField.get(state);
|
|
3917
|
+
if (!Array.isArray(newState)) {
|
|
3918
|
+
console.warn(`State getter function in collection component of ${ this.name } did not return an array: No components will be instantiated in the collection. Returned value:`, newState);
|
|
3919
|
+
return []
|
|
3920
|
+
}
|
|
3921
|
+
return newState
|
|
3922
|
+
},
|
|
3923
|
+
set: stateField.set
|
|
3924
|
+
};
|
|
3928
3925
|
}
|
|
3929
3926
|
} else {
|
|
3930
3927
|
console.error(`Collection component in ${ this.name } has an invalid 'from' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting child state from the current state. Attempting to use parent component state.`);
|
|
@@ -3944,7 +3941,7 @@ class Component {
|
|
|
3944
3941
|
const props = data.props || {};
|
|
3945
3942
|
el.children || [];
|
|
3946
3943
|
|
|
3947
|
-
const combined$ =
|
|
3944
|
+
const combined$ = xs$1.combine(this.sources[this.stateSourceName].stream.startWith(this.currentState), props$, children$)
|
|
3948
3945
|
.map(([state, __props, __children]) => {
|
|
3949
3946
|
return typeof state === 'object' ? { ...this.addCalculated(state), __props, __children } : { value: state, __props, __children }
|
|
3950
3947
|
});
|
|
@@ -3963,7 +3960,6 @@ class Component {
|
|
|
3963
3960
|
console.warn(`Switchable sub-component of ${ this.name } attempted to update state on a calculated field '${ stateField }': Update ignored`);
|
|
3964
3961
|
return oldState
|
|
3965
3962
|
}
|
|
3966
|
-
console.log('SWITCH SET', newState);
|
|
3967
3963
|
if (typeof newState !== 'object' || newState instanceof Array) return { ...oldState, [stateField]: newState }
|
|
3968
3964
|
const { __props, __children, ...sanitized } = newState;
|
|
3969
3965
|
return { ...oldState, [stateField]: sanitized }
|
|
@@ -4013,7 +4009,7 @@ class Component {
|
|
|
4013
4009
|
const props = data.props || {};
|
|
4014
4010
|
el.children || [];
|
|
4015
4011
|
|
|
4016
|
-
const combined$ =
|
|
4012
|
+
const combined$ = xs$1.combine(this.sources[this.stateSourceName].stream.startWith(this.currentState), props$, children$)
|
|
4017
4013
|
.map(([state, __props, __children]) => {
|
|
4018
4014
|
return typeof state === 'object' ? { ...this.addCalculated(state), __props, __children } : { value: state, __props, __children }
|
|
4019
4015
|
});
|
|
@@ -4080,7 +4076,7 @@ class Component {
|
|
|
4080
4076
|
}
|
|
4081
4077
|
|
|
4082
4078
|
renderVdom(componentInstances$) {
|
|
4083
|
-
return
|
|
4079
|
+
return xs$1.combine(this.subComponentsRendered$, componentInstances$)
|
|
4084
4080
|
.compose(_default$2(5))
|
|
4085
4081
|
.map(([_, components]) => {
|
|
4086
4082
|
const componentNames = Object.keys(this.components);
|
|
@@ -4089,7 +4085,7 @@ class Component {
|
|
|
4089
4085
|
const entries = Object.entries(components).filter(([id]) => id !== '::ROOT::');
|
|
4090
4086
|
|
|
4091
4087
|
if (entries.length === 0) {
|
|
4092
|
-
return
|
|
4088
|
+
return xs$1.of(root)
|
|
4093
4089
|
}
|
|
4094
4090
|
|
|
4095
4091
|
const ids = [];
|
|
@@ -4099,9 +4095,9 @@ class Component {
|
|
|
4099
4095
|
return val.sink$[this.DOMSourceName].startWith(undefined)
|
|
4100
4096
|
});
|
|
4101
4097
|
|
|
4102
|
-
if (vdom$.length === 0) return
|
|
4098
|
+
if (vdom$.length === 0) return xs$1.of(root)
|
|
4103
4099
|
|
|
4104
|
-
return
|
|
4100
|
+
return xs$1.combine(...vdom$)
|
|
4105
4101
|
.compose(_default$2(10))
|
|
4106
4102
|
.map(vdoms => {
|
|
4107
4103
|
const withIds = vdoms.reduce((acc, vdom, index) => {
|
|
@@ -4176,12 +4172,12 @@ function getComponents(currentElement, componentNames, depth=0, index=0) {
|
|
|
4176
4172
|
if (!props.of) throw new Error(`Collection element missing required 'component' property`)
|
|
4177
4173
|
if (typeof props.of !== 'string' && typeof props.of !== 'function') throw new Error(`Invalid 'component' property of collection element: found ${ typeof props.of } requires string or component factory function`)
|
|
4178
4174
|
if (typeof props.of !== 'function' && !componentNames.includes(props.of)) throw new Error(`Specified component for collection not found: ${ props.of }`)
|
|
4179
|
-
if (typeof props.from !== 'undefined' && !(typeof props.from === 'string' || Array.isArray(props.from))) console.warn(`No valid array found
|
|
4175
|
+
if (typeof props.from !== 'undefined' && !(typeof props.from === 'string' || Array.isArray(props.from) || typeof props.from.get === 'function')) console.warn(`No valid array found for collection ${ typeof props.of === 'string' ? props.of : 'function component' }: no collection components will be created`, props.from);
|
|
4180
4176
|
currentElement.data.isCollection = true;
|
|
4181
4177
|
currentElement.data.props ||= {};
|
|
4182
4178
|
} else if (isSwitchable) {
|
|
4183
4179
|
if (!props.of) throw new Error(`Switchable element missing required 'of' property`)
|
|
4184
|
-
if (typeof props.of !== 'object') throw new Error(`Invalid '
|
|
4180
|
+
if (typeof props.of !== 'object') throw new Error(`Invalid 'of' property of switchable element: found ${ typeof props.of } requires object mapping names to component factories`)
|
|
4185
4181
|
const switchableComponents = Object.values(props.of);
|
|
4186
4182
|
if (!switchableComponents.every(comp => typeof comp === 'function')) throw new Error(`One or more components provided to switchable element is not a valid component factory`)
|
|
4187
4183
|
if (!props.current || (typeof props.current !== 'string' && typeof props.current !== 'function')) throw new Error(`Missing or invalid 'current' property for switchable element: found '${ typeof props.current }' requires string or function`)
|
|
@@ -4265,7 +4261,7 @@ function processForm(form, options={}) {
|
|
|
4265
4261
|
|
|
4266
4262
|
const eventStream$ = events.map(event => form.events(event));
|
|
4267
4263
|
|
|
4268
|
-
const merged$ =
|
|
4264
|
+
const merged$ = xs$1.merge(...eventStream$);
|
|
4269
4265
|
|
|
4270
4266
|
return merged$.map((e) => {
|
|
4271
4267
|
if (preventDefault) e.preventDefault();
|
|
@@ -4326,7 +4322,7 @@ function eventBusDriver(out$) {
|
|
|
4326
4322
|
const all = !type;
|
|
4327
4323
|
const _type = (Array.isArray(type)) ? type : [type];
|
|
4328
4324
|
let cb;
|
|
4329
|
-
const in$ =
|
|
4325
|
+
const in$ = xs$1.create({
|
|
4330
4326
|
start: (listener) => {
|
|
4331
4327
|
cb = ({detail: event}) => {
|
|
4332
4328
|
const data = (event && event.data) || null;
|
package/dist/jsx.cjs.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var _extend = require('extend');
|
|
6
4
|
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var _extend__default = /*#__PURE__*/_interopDefaultLegacy(_extend);
|
|
10
|
-
|
|
11
5
|
const undefinedv = (v) => v === undefined;
|
|
12
6
|
|
|
13
7
|
const number = (v) => typeof v === 'number';
|
|
@@ -31,9 +25,9 @@ const svg = (v) => v.sel in svgPropsMap;
|
|
|
31
25
|
|
|
32
26
|
// TODO: stop using extend here
|
|
33
27
|
|
|
34
|
-
const extend = (...objs) =>
|
|
28
|
+
const extend = (...objs) => _extend(true, ...objs);
|
|
35
29
|
|
|
36
|
-
const assign = (...objs) =>
|
|
30
|
+
const assign = (...objs) => _extend(false, ...objs);
|
|
37
31
|
|
|
38
32
|
const reduceDeep = (arr, fn, initial) => {
|
|
39
33
|
let result = initial;
|
|
@@ -184,13 +178,6 @@ function vnode(sel, data, children, text, elm) {
|
|
|
184
178
|
return { sel, data, children, text, elm, key };
|
|
185
179
|
}
|
|
186
180
|
|
|
187
|
-
vnode("", {}, [], undefined, undefined);
|
|
188
|
-
|
|
189
|
-
// Bindig `requestAnimationFrame` like this fixes a bug in IE/Edge. See #360 and #409.
|
|
190
|
-
(typeof window !== "undefined" &&
|
|
191
|
-
window.requestAnimationFrame.bind(window)) ||
|
|
192
|
-
setTimeout;
|
|
193
|
-
|
|
194
181
|
/* eslint-disable @typescript-eslint/no-namespace, import/export */
|
|
195
182
|
function Fragment(data, ...children) {
|
|
196
183
|
const flatChildren = flattenAndFilter(children, []);
|
package/dist/jsx.esm.js
CHANGED
|
@@ -176,13 +176,6 @@ function vnode(sel, data, children, text, elm) {
|
|
|
176
176
|
return { sel, data, children, text, elm, key };
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
vnode("", {}, [], undefined, undefined);
|
|
180
|
-
|
|
181
|
-
// Bindig `requestAnimationFrame` like this fixes a bug in IE/Edge. See #360 and #409.
|
|
182
|
-
(typeof window !== "undefined" &&
|
|
183
|
-
window.requestAnimationFrame.bind(window)) ||
|
|
184
|
-
setTimeout;
|
|
185
|
-
|
|
186
179
|
/* eslint-disable @typescript-eslint/no-namespace, import/export */
|
|
187
180
|
function Fragment(data, ...children) {
|
|
188
181
|
const flatChildren = flattenAndFilter(children, []);
|