hyperscript-rxjs 1.3.19 → 1.3.20
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/hyperscript-rxjs.js +31 -31
- package/package.json +1 -1
package/dist/hyperscript-rxjs.js
CHANGED
@@ -6,23 +6,23 @@
|
|
6
6
|
else if(typeof exports === 'object')
|
7
7
|
exports["hyperscriptRxjs"] = factory(require("rxjs"), require("rxjs/operators"));
|
8
8
|
else
|
9
|
-
root["hyperscriptRxjs"] = factory(root[
|
10
|
-
})(self, (
|
9
|
+
root["hyperscriptRxjs"] = factory(root["rxjs"], root["rxjs"]);
|
10
|
+
})(self, (__WEBPACK_EXTERNAL_MODULE__968__, __WEBPACK_EXTERNAL_MODULE__506__) => {
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
12
12
|
/******/ "use strict";
|
13
13
|
/******/ var __webpack_modules__ = ({
|
14
14
|
|
15
|
-
/***/
|
15
|
+
/***/ 506:
|
16
16
|
/***/ ((module) => {
|
17
17
|
|
18
|
-
module.exports =
|
18
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__506__;
|
19
19
|
|
20
20
|
/***/ }),
|
21
21
|
|
22
|
-
/***/
|
22
|
+
/***/ 968:
|
23
23
|
/***/ ((module) => {
|
24
24
|
|
25
|
-
module.exports =
|
25
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__968__;
|
26
26
|
|
27
27
|
/***/ })
|
28
28
|
|
@@ -1042,8 +1042,8 @@ const types = ["undefined",
|
|
1042
1042
|
|
1043
1043
|
|
1044
1044
|
|
1045
|
-
// EXTERNAL MODULE: external {"commonjs":"rxjs","commonjs2":"rxjs","amd":"rxjs"}
|
1046
|
-
var
|
1045
|
+
// EXTERNAL MODULE: external {"commonjs":"rxjs","commonjs2":"rxjs","amd":"rxjs","root":"rxjs"}
|
1046
|
+
var external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_ = __webpack_require__(968);
|
1047
1047
|
// EXTERNAL MODULE: external {"commonjs":"rxjs/operators","commonjs2":"rxjs/operators","amd":"rxjs/operators","root":"rxjs"}
|
1048
1048
|
var operators_root_rxjs_ = __webpack_require__(506);
|
1049
1049
|
;// ./src/object/pluckProperty.js
|
@@ -1439,7 +1439,7 @@ class Deep {
|
|
1439
1439
|
*/
|
1440
1440
|
combineLatest() {
|
1441
1441
|
let values = this.getValues();
|
1442
|
-
return (0,
|
1442
|
+
return (0,external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.combineLatest)(values).pipe((0,operators_root_rxjs_.map)(values => this.replaceValue(values)));
|
1443
1443
|
}
|
1444
1444
|
|
1445
1445
|
/**
|
@@ -1449,7 +1449,7 @@ class Deep {
|
|
1449
1449
|
* @returns {Observable<[(string|number)[], U]>}
|
1450
1450
|
*/
|
1451
1451
|
merge() {
|
1452
|
-
return (0,
|
1452
|
+
return (0,external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.from)(this.entries).pipe((0,operators_root_rxjs_.mergeMap)(([keyPath, value$]) => value$.pipe((0,operators_root_rxjs_.map)(
|
1453
1453
|
/**
|
1454
1454
|
* @returns {[(string|number)[], U]}
|
1455
1455
|
*/
|
@@ -1476,7 +1476,7 @@ class Deep {
|
|
1476
1476
|
* @returns {Deep<BehaviorSubject<T>>}
|
1477
1477
|
*/
|
1478
1478
|
static fromBehaviorSubject(obj) {
|
1479
|
-
return Deep.fromObject(obj, v => (0,
|
1479
|
+
return Deep.fromObject(obj, v => (0,external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.isObservable)(v) || v instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.Subscription).filter(([k, v]) => v instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.BehaviorSubject);
|
1480
1480
|
}
|
1481
1481
|
|
1482
1482
|
/**
|
@@ -1485,7 +1485,7 @@ class Deep {
|
|
1485
1485
|
* @returns
|
1486
1486
|
*/
|
1487
1487
|
static fromObservable(obj) {
|
1488
|
-
return Deep.fromObject(obj, v => (0,
|
1488
|
+
return Deep.fromObject(obj, v => (0,external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.isObservable)(v) || v instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.Subscription).filter(([k, v]) => (0,external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.isObservable)(v));
|
1489
1489
|
}
|
1490
1490
|
}
|
1491
1491
|
;// ./src/deep/0.js
|
@@ -1503,7 +1503,7 @@ class Deep {
|
|
1503
1503
|
*
|
1504
1504
|
*/
|
1505
1505
|
function isRxType(obj) {
|
1506
|
-
return typeof obj === 'object' && obj && ((0,
|
1506
|
+
return typeof obj === 'object' && obj && ((0,external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.isObservable)(obj) || obj instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.Subscription);
|
1507
1507
|
}
|
1508
1508
|
;// ./src/deep-rxjs/ObservableArray.js
|
1509
1509
|
|
@@ -1531,7 +1531,7 @@ class ObservableArray extends Array {
|
|
1531
1531
|
* 变化通知的 Subject。
|
1532
1532
|
* @type {Subject<any[]>}
|
1533
1533
|
*/
|
1534
|
-
this.action$ = new
|
1534
|
+
this.action$ = new external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.Subject();
|
1535
1535
|
|
1536
1536
|
/**
|
1537
1537
|
* 插入元素事件流,发出 [item, index]。
|
@@ -1694,7 +1694,7 @@ const attachSubscriptionToNode = (elem, subscription) => {
|
|
1694
1694
|
if (!(elem instanceof Node)) {
|
1695
1695
|
throw new Error('Valid DOM node required');
|
1696
1696
|
}
|
1697
|
-
if (!(subscription instanceof
|
1697
|
+
if (!(subscription instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.Subscription)) {
|
1698
1698
|
throw new Error('Valid RxJS subscription required');
|
1699
1699
|
}
|
1700
1700
|
|
@@ -1737,7 +1737,7 @@ function pipeEvent(elem) {
|
|
1737
1737
|
if (typeof subscriber !== 'function') {
|
1738
1738
|
throw new Error('参数 "subscriber" 必须是一个函数。');
|
1739
1739
|
}
|
1740
|
-
let event$ = (0,
|
1740
|
+
let event$ = (0,external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.fromEvent)(elem, event); // 创建事件流 Observable
|
1741
1741
|
|
1742
1742
|
try {
|
1743
1743
|
let subscription = subscriber(event$); // 订阅事件流并处理
|
@@ -1790,7 +1790,7 @@ function subscribeEvent(elem) {
|
|
1790
1790
|
}
|
1791
1791
|
|
1792
1792
|
// 创建事件流 Observable
|
1793
|
-
let event$ = (0,
|
1793
|
+
let event$ = (0,external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.fromEvent)(elem, event);
|
1794
1794
|
|
1795
1795
|
// 订阅事件流
|
1796
1796
|
let subscription;
|
@@ -1919,7 +1919,7 @@ function splitObjectByObservable(obj) {
|
|
1919
1919
|
let value = obj[key];
|
1920
1920
|
|
1921
1921
|
// 根据值的类型分类
|
1922
|
-
if ((0,
|
1922
|
+
if ((0,external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.isObservable)(value)) {
|
1923
1923
|
observables[key] = value; // 如果是 Observable,存入 observables
|
1924
1924
|
} else {
|
1925
1925
|
scalars[key] = value; // 否则存入 scalars
|
@@ -2064,7 +2064,7 @@ function subscribeProp(element, key, value$) {
|
|
2064
2064
|
if (typeof key !== 'string') {
|
2065
2065
|
throw new Error('参数 "key" 必须是一个字符串。');
|
2066
2066
|
}
|
2067
|
-
if (!(0,
|
2067
|
+
if (!(0,external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.isObservable)(value$)) {
|
2068
2068
|
throw new Error('参数 "value$" 必须是一个有效的 Observable。');
|
2069
2069
|
}
|
2070
2070
|
|
@@ -2191,7 +2191,7 @@ function hyperscript(elemName, ...args) {
|
|
2191
2191
|
return subscribeEvent(element)(event, observer);
|
2192
2192
|
},
|
2193
2193
|
unsubscribe() {
|
2194
|
-
if ('subscription' in element && element.subscription instanceof
|
2194
|
+
if ('subscription' in element && element.subscription instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.Subscription) {
|
2195
2195
|
element.subscription.unsubscribe(); // 取消订阅
|
2196
2196
|
delete element.subscription; // 删除属性
|
2197
2197
|
}
|
@@ -3140,7 +3140,7 @@ function checkbox_checkbox(props) {
|
|
3140
3140
|
});
|
3141
3141
|
|
3142
3142
|
// 如果传入了 checked 属性
|
3143
|
-
if (props.checked && props.checked instanceof
|
3143
|
+
if (props.checked && props.checked instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.BehaviorSubject) {
|
3144
3144
|
// 监听复选框的 input 事件,并将选中状态推送到 Observable/Subject
|
3145
3145
|
let subscriber =
|
3146
3146
|
/**
|
@@ -3332,7 +3332,7 @@ function numberbox(props) {
|
|
3332
3332
|
...rest,
|
3333
3333
|
type: 'text'
|
3334
3334
|
});
|
3335
|
-
if (number && number instanceof
|
3335
|
+
if (number && number instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.BehaviorSubject) {
|
3336
3336
|
let value = number.pipe((0,operators_root_rxjs_.map)(n => String(n)));
|
3337
3337
|
subscribeProp(elem, 'value', value);
|
3338
3338
|
let subscriber =
|
@@ -3392,7 +3392,7 @@ function radio_radio(props) {
|
|
3392
3392
|
...props,
|
3393
3393
|
type: 'radio'
|
3394
3394
|
});
|
3395
|
-
if (props.checked && props.checked instanceof
|
3395
|
+
if (props.checked && props.checked instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.BehaviorSubject) {
|
3396
3396
|
const subscriber =
|
3397
3397
|
/**
|
3398
3398
|
*
|
@@ -3450,10 +3450,10 @@ function select_select(props, ...options) {
|
|
3450
3450
|
} = props;
|
3451
3451
|
|
3452
3452
|
// 确保至少有一个是 BehaviorSubject
|
3453
|
-
if (elem.options.length > 0 && !(selectedIndex instanceof
|
3453
|
+
if (elem.options.length > 0 && !(selectedIndex instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.BehaviorSubject) && !(value instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.BehaviorSubject)) {
|
3454
3454
|
throw new Error('`select` requires at least one of `selectedIndex` or `value` to be a BehaviorSubject.');
|
3455
3455
|
}
|
3456
|
-
if (selectedIndex && selectedIndex instanceof
|
3456
|
+
if (selectedIndex && selectedIndex instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.BehaviorSubject) {
|
3457
3457
|
selectedIndex.subscribe(i => {
|
3458
3458
|
/** @type {HTMLOptionElement} */
|
3459
3459
|
elem[i].selected = true;
|
@@ -3469,7 +3469,7 @@ function select_select(props, ...options) {
|
|
3469
3469
|
// let subscription = subscriber(event$);
|
3470
3470
|
// attachSubscriptionToNode(elem, subscription);
|
3471
3471
|
}
|
3472
|
-
if (value && value instanceof
|
3472
|
+
if (value && value instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.BehaviorSubject) {
|
3473
3473
|
value.subscribe(value => {
|
3474
3474
|
Array.from(elem.getElementsByTagName('option')).filter(opt => opt.value === value).forEach(opt => {
|
3475
3475
|
opt.selected = true;
|
@@ -3513,7 +3513,7 @@ function textarea_textarea(props) {
|
|
3513
3513
|
const {
|
3514
3514
|
value
|
3515
3515
|
} = props;
|
3516
|
-
if (!(value instanceof
|
3516
|
+
if (!(value instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.BehaviorSubject)) {
|
3517
3517
|
throw new Error('`value` must be an instance of BehaviorSubject.');
|
3518
3518
|
}
|
3519
3519
|
|
@@ -3555,7 +3555,7 @@ function textbox(props) {
|
|
3555
3555
|
const {
|
3556
3556
|
value
|
3557
3557
|
} = props;
|
3558
|
-
if (!(value instanceof
|
3558
|
+
if (!(value instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.BehaviorSubject)) {
|
3559
3559
|
throw new Error('`value` must be an instance of BehaviorSubject.');
|
3560
3560
|
}
|
3561
3561
|
|
@@ -3597,7 +3597,7 @@ function textbox(props) {
|
|
3597
3597
|
*/
|
3598
3598
|
function textNode(text) {
|
3599
3599
|
// 如果传入的是 Observable
|
3600
|
-
if ((0,
|
3600
|
+
if ((0,external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.isObservable)(text)) {
|
3601
3601
|
const node = document.createTextNode("");
|
3602
3602
|
|
3603
3603
|
// 创建订阅并更新文本节点
|
@@ -3758,7 +3758,7 @@ function pickBehaviorSubject(model) {
|
|
3758
3758
|
* @throws {Error} 当遇到不符合要求的数据结构时抛出错误
|
3759
3759
|
*/
|
3760
3760
|
function loop(value, key, parent) {
|
3761
|
-
if ((0,
|
3761
|
+
if ((0,external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.isObservable)(value) && value instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.BehaviorSubject) {
|
3762
3762
|
return [[key, value.value]]; //保存葉節點
|
3763
3763
|
} else if (value === null || typeof value !== 'object' || isRxType(value)) {
|
3764
3764
|
return [];
|
@@ -3826,7 +3826,7 @@ function restore(model, src) {
|
|
3826
3826
|
* @param {any} src - Corresponding source value
|
3827
3827
|
*/
|
3828
3828
|
function restore_loop(o, src) {
|
3829
|
-
if (o instanceof
|
3829
|
+
if (o instanceof external_commonjs_rxjs_commonjs2_rxjs_amd_rxjs_root_rxjs_.BehaviorSubject) {
|
3830
3830
|
// Input value
|
3831
3831
|
o.next(src);
|
3832
3832
|
} else if (o === null || typeof o !== 'object' || isRxType(o)) {
|
package/package.json
CHANGED