@runopencode/rx-stencil 0.4.1 → 0.4.3

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.
Files changed (114) hide show
  1. package/README.md +12 -11
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  3. package/dist/cjs/index-CbERigo8.js +1211 -0
  4. package/dist/cjs/index.cjs.js +166 -447
  5. package/dist/cjs/loader.cjs.js +4 -6
  6. package/dist/cjs/rx-async.cjs.entry.js +29 -63
  7. package/dist/cjs/rx-stencil.cjs.js +14 -14
  8. package/dist/cjs/set-property-BZHuI0P5.js +9525 -0
  9. package/dist/collection/collection-manifest.json +2 -2
  10. package/dist/collection/components/async/async.css +3 -0
  11. package/dist/collection/components/async/async.js +62 -61
  12. package/dist/collection/index.js +0 -1
  13. package/dist/collection/rx/decorator/index.js +0 -1
  14. package/dist/collection/rx/decorator/query-selector-all.js +26 -27
  15. package/dist/collection/rx/decorator/query-selector.js +32 -33
  16. package/dist/collection/rx/index.js +0 -1
  17. package/dist/collection/rx/observable/index.js +1 -1
  18. package/dist/collection/rx/observable/mutation-observable.js +8 -9
  19. package/dist/collection/rx/observable/properties-observable.js +13 -0
  20. package/dist/collection/rx/observable/property-observable.js +20 -21
  21. package/dist/collection/rx/observable/render-observable.js +15 -16
  22. package/dist/collection/rx/operator/index.js +0 -1
  23. package/dist/collection/rx/operator/schedule-render.js +9 -10
  24. package/dist/collection/rx/operator/to-property.js +8 -9
  25. package/dist/collection/rx/operator/until-disconnected.js +56 -57
  26. package/dist/collection/rx/subscriber/index.js +0 -1
  27. package/dist/collection/rx/subscriber/set-property.js +12 -13
  28. package/dist/collection/utils/get-property-descriptor.js +10 -11
  29. package/dist/collection/utils/index.js +0 -1
  30. package/dist/components/index.d.ts +2 -0
  31. package/dist/components/index.js +1 -562
  32. package/dist/components/rx-async.d.ts +2 -2
  33. package/dist/components/rx-async.js +1 -86
  34. package/dist/components/set-property.js +1 -1150
  35. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  36. package/dist/esm/index-BIBww8qU.js +1202 -0
  37. package/dist/esm/index.js +167 -447
  38. package/dist/esm/loader.js +5 -5
  39. package/dist/esm/rx-async.entry.js +29 -61
  40. package/dist/esm/rx-stencil.js +14 -13
  41. package/dist/esm/set-property-CpZKE-Xu.js +9520 -0
  42. package/dist/rx-stencil/index.esm.js +1 -2
  43. package/dist/rx-stencil/p-77100dee.entry.js +1 -0
  44. package/dist/rx-stencil/p-BIBww8qU.js +2 -0
  45. package/dist/rx-stencil/p-DQuL1Twl.js +1 -0
  46. package/dist/rx-stencil/p-IbpJ_cRo.js +1 -0
  47. package/dist/rx-stencil/rx-stencil.esm.js +1 -2
  48. package/dist/types/components/async/async.d.ts +5 -5
  49. package/dist/types/components.d.ts +7 -1
  50. package/dist/types/rx/decorator/query-selector-all.d.ts +9 -9
  51. package/dist/types/rx/decorator/query-selector.d.ts +9 -9
  52. package/dist/types/rx/observable/index.d.ts +1 -0
  53. package/dist/types/rx/observable/properties-observable.d.ts +6 -0
  54. package/dist/types/rx/subscriber/set-property.d.ts +12 -12
  55. package/dist/types/stencil-public-runtime.d.ts +225 -17
  56. package/docs/creation-operators.md +62 -3
  57. package/loader/cdn.js +1 -3
  58. package/loader/index.cjs.js +1 -3
  59. package/loader/index.d.ts +3 -0
  60. package/loader/index.es2017.js +1 -3
  61. package/loader/index.js +1 -3
  62. package/package.json +11 -10
  63. package/dist/cjs/index-5f6f12ab.js +0 -1265
  64. package/dist/cjs/index-5f6f12ab.js.map +0 -1
  65. package/dist/cjs/index.cjs.js.map +0 -1
  66. package/dist/cjs/loader.cjs.js.map +0 -1
  67. package/dist/cjs/rx-async.cjs.entry.js.map +0 -1
  68. package/dist/cjs/rx-stencil.cjs.js.map +0 -1
  69. package/dist/cjs/set-property-88176225.js +0 -1167
  70. package/dist/cjs/set-property-88176225.js.map +0 -1
  71. package/dist/collection/components/async/async.js.map +0 -1
  72. package/dist/collection/components/async/async.scss +0 -3
  73. package/dist/collection/index.js.map +0 -1
  74. package/dist/collection/rx/decorator/index.js.map +0 -1
  75. package/dist/collection/rx/decorator/query-selector-all.js.map +0 -1
  76. package/dist/collection/rx/decorator/query-selector.js.map +0 -1
  77. package/dist/collection/rx/index.js.map +0 -1
  78. package/dist/collection/rx/observable/index.js.map +0 -1
  79. package/dist/collection/rx/observable/mutation-observable.js.map +0 -1
  80. package/dist/collection/rx/observable/property-observable.js.map +0 -1
  81. package/dist/collection/rx/observable/render-observable.js.map +0 -1
  82. package/dist/collection/rx/operator/index.js.map +0 -1
  83. package/dist/collection/rx/operator/schedule-render.js.map +0 -1
  84. package/dist/collection/rx/operator/to-property.js.map +0 -1
  85. package/dist/collection/rx/operator/until-disconnected.js.map +0 -1
  86. package/dist/collection/rx/subscriber/index.js.map +0 -1
  87. package/dist/collection/rx/subscriber/set-property.js.map +0 -1
  88. package/dist/collection/utils/get-property-descriptor.js.map +0 -1
  89. package/dist/collection/utils/index.js.map +0 -1
  90. package/dist/components/index.js.map +0 -1
  91. package/dist/components/rx-async.js.map +0 -1
  92. package/dist/components/set-property.js.map +0 -1
  93. package/dist/esm/index-9102de09.js +0 -1236
  94. package/dist/esm/index-9102de09.js.map +0 -1
  95. package/dist/esm/index.js.map +0 -1
  96. package/dist/esm/loader.js.map +0 -1
  97. package/dist/esm/polyfills/core-js.js +0 -11
  98. package/dist/esm/polyfills/dom.js +0 -79
  99. package/dist/esm/polyfills/es5-html-element.js +0 -1
  100. package/dist/esm/polyfills/index.js +0 -34
  101. package/dist/esm/polyfills/system.js +0 -6
  102. package/dist/esm/rx-async.entry.js.map +0 -1
  103. package/dist/esm/rx-stencil.js.map +0 -1
  104. package/dist/esm/set-property-7fa82bef.js +0 -1150
  105. package/dist/esm/set-property-7fa82bef.js.map +0 -1
  106. package/dist/rx-stencil/index.esm.js.map +0 -1
  107. package/dist/rx-stencil/p-01af4414.entry.js +0 -2
  108. package/dist/rx-stencil/p-01af4414.entry.js.map +0 -1
  109. package/dist/rx-stencil/p-0cd0b2da.js +0 -2
  110. package/dist/rx-stencil/p-0cd0b2da.js.map +0 -1
  111. package/dist/rx-stencil/p-8411601b.js +0 -3
  112. package/dist/rx-stencil/p-8411601b.js.map +0 -1
  113. package/dist/rx-stencil/rx-stencil.esm.js.map +0 -1
  114. package/loader/package.json +0 -11
@@ -1,1167 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-5f6f12ab.js');
4
-
5
- function isFunction(value) {
6
- return typeof value === 'function';
7
- }
8
-
9
- function createErrorClass(createImpl) {
10
- const _super = (instance) => {
11
- Error.call(instance);
12
- instance.stack = new Error().stack;
13
- };
14
- const ctorFunc = createImpl(_super);
15
- ctorFunc.prototype = Object.create(Error.prototype);
16
- ctorFunc.prototype.constructor = ctorFunc;
17
- return ctorFunc;
18
- }
19
-
20
- const UnsubscriptionError = createErrorClass((_super) => function UnsubscriptionErrorImpl(errors) {
21
- _super(this);
22
- this.message = errors
23
- ? `${errors.length} errors occurred during unsubscription:
24
- ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}`
25
- : '';
26
- this.name = 'UnsubscriptionError';
27
- this.errors = errors;
28
- });
29
-
30
- function arrRemove(arr, item) {
31
- if (arr) {
32
- const index = arr.indexOf(item);
33
- 0 <= index && arr.splice(index, 1);
34
- }
35
- }
36
-
37
- class Subscription {
38
- constructor(initialTeardown) {
39
- this.initialTeardown = initialTeardown;
40
- this.closed = false;
41
- this._parentage = null;
42
- this._finalizers = null;
43
- }
44
- unsubscribe() {
45
- let errors;
46
- if (!this.closed) {
47
- this.closed = true;
48
- const { _parentage } = this;
49
- if (_parentage) {
50
- this._parentage = null;
51
- if (Array.isArray(_parentage)) {
52
- for (const parent of _parentage) {
53
- parent.remove(this);
54
- }
55
- }
56
- else {
57
- _parentage.remove(this);
58
- }
59
- }
60
- const { initialTeardown: initialFinalizer } = this;
61
- if (isFunction(initialFinalizer)) {
62
- try {
63
- initialFinalizer();
64
- }
65
- catch (e) {
66
- errors = e instanceof UnsubscriptionError ? e.errors : [e];
67
- }
68
- }
69
- const { _finalizers } = this;
70
- if (_finalizers) {
71
- this._finalizers = null;
72
- for (const finalizer of _finalizers) {
73
- try {
74
- execFinalizer(finalizer);
75
- }
76
- catch (err) {
77
- errors = errors !== null && errors !== void 0 ? errors : [];
78
- if (err instanceof UnsubscriptionError) {
79
- errors = [...errors, ...err.errors];
80
- }
81
- else {
82
- errors.push(err);
83
- }
84
- }
85
- }
86
- }
87
- if (errors) {
88
- throw new UnsubscriptionError(errors);
89
- }
90
- }
91
- }
92
- add(teardown) {
93
- var _a;
94
- if (teardown && teardown !== this) {
95
- if (this.closed) {
96
- execFinalizer(teardown);
97
- }
98
- else {
99
- if (teardown instanceof Subscription) {
100
- if (teardown.closed || teardown._hasParent(this)) {
101
- return;
102
- }
103
- teardown._addParent(this);
104
- }
105
- (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
106
- }
107
- }
108
- }
109
- _hasParent(parent) {
110
- const { _parentage } = this;
111
- return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
112
- }
113
- _addParent(parent) {
114
- const { _parentage } = this;
115
- this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
116
- }
117
- _removeParent(parent) {
118
- const { _parentage } = this;
119
- if (_parentage === parent) {
120
- this._parentage = null;
121
- }
122
- else if (Array.isArray(_parentage)) {
123
- arrRemove(_parentage, parent);
124
- }
125
- }
126
- remove(teardown) {
127
- const { _finalizers } = this;
128
- _finalizers && arrRemove(_finalizers, teardown);
129
- if (teardown instanceof Subscription) {
130
- teardown._removeParent(this);
131
- }
132
- }
133
- }
134
- Subscription.EMPTY = (() => {
135
- const empty = new Subscription();
136
- empty.closed = true;
137
- return empty;
138
- })();
139
- const EMPTY_SUBSCRIPTION = Subscription.EMPTY;
140
- function isSubscription(value) {
141
- return (value instanceof Subscription ||
142
- (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
143
- }
144
- function execFinalizer(finalizer) {
145
- if (isFunction(finalizer)) {
146
- finalizer();
147
- }
148
- else {
149
- finalizer.unsubscribe();
150
- }
151
- }
152
-
153
- const config = {
154
- onUnhandledError: null,
155
- onStoppedNotification: null,
156
- Promise: undefined,
157
- useDeprecatedSynchronousErrorHandling: false,
158
- useDeprecatedNextContext: false,
159
- };
160
-
161
- const timeoutProvider = {
162
- setTimeout(handler, timeout, ...args) {
163
- const { delegate } = timeoutProvider;
164
- if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
165
- return delegate.setTimeout(handler, timeout, ...args);
166
- }
167
- return setTimeout(handler, timeout, ...args);
168
- },
169
- clearTimeout(handle) {
170
- const { delegate } = timeoutProvider;
171
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
172
- },
173
- delegate: undefined,
174
- };
175
-
176
- function reportUnhandledError(err) {
177
- timeoutProvider.setTimeout(() => {
178
- const { onUnhandledError } = config;
179
- if (onUnhandledError) {
180
- onUnhandledError(err);
181
- }
182
- else {
183
- throw err;
184
- }
185
- });
186
- }
187
-
188
- function noop() { }
189
-
190
- const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined))();
191
- function errorNotification(error) {
192
- return createNotification('E', undefined, error);
193
- }
194
- function nextNotification(value) {
195
- return createNotification('N', value, undefined);
196
- }
197
- function createNotification(kind, value, error) {
198
- return {
199
- kind,
200
- value,
201
- error,
202
- };
203
- }
204
-
205
- function errorContext(cb) {
206
- {
207
- cb();
208
- }
209
- }
210
-
211
- class Subscriber extends Subscription {
212
- constructor(destination) {
213
- super();
214
- this.isStopped = false;
215
- if (destination) {
216
- this.destination = destination;
217
- if (isSubscription(destination)) {
218
- destination.add(this);
219
- }
220
- }
221
- else {
222
- this.destination = EMPTY_OBSERVER;
223
- }
224
- }
225
- static create(next, error, complete) {
226
- return new SafeSubscriber(next, error, complete);
227
- }
228
- next(value) {
229
- if (this.isStopped) {
230
- handleStoppedNotification(nextNotification(value), this);
231
- }
232
- else {
233
- this._next(value);
234
- }
235
- }
236
- error(err) {
237
- if (this.isStopped) {
238
- handleStoppedNotification(errorNotification(err), this);
239
- }
240
- else {
241
- this.isStopped = true;
242
- this._error(err);
243
- }
244
- }
245
- complete() {
246
- if (this.isStopped) {
247
- handleStoppedNotification(COMPLETE_NOTIFICATION, this);
248
- }
249
- else {
250
- this.isStopped = true;
251
- this._complete();
252
- }
253
- }
254
- unsubscribe() {
255
- if (!this.closed) {
256
- this.isStopped = true;
257
- super.unsubscribe();
258
- this.destination = null;
259
- }
260
- }
261
- _next(value) {
262
- this.destination.next(value);
263
- }
264
- _error(err) {
265
- try {
266
- this.destination.error(err);
267
- }
268
- finally {
269
- this.unsubscribe();
270
- }
271
- }
272
- _complete() {
273
- try {
274
- this.destination.complete();
275
- }
276
- finally {
277
- this.unsubscribe();
278
- }
279
- }
280
- }
281
- const _bind = Function.prototype.bind;
282
- function bind(fn, thisArg) {
283
- return _bind.call(fn, thisArg);
284
- }
285
- class ConsumerObserver {
286
- constructor(partialObserver) {
287
- this.partialObserver = partialObserver;
288
- }
289
- next(value) {
290
- const { partialObserver } = this;
291
- if (partialObserver.next) {
292
- try {
293
- partialObserver.next(value);
294
- }
295
- catch (error) {
296
- handleUnhandledError(error);
297
- }
298
- }
299
- }
300
- error(err) {
301
- const { partialObserver } = this;
302
- if (partialObserver.error) {
303
- try {
304
- partialObserver.error(err);
305
- }
306
- catch (error) {
307
- handleUnhandledError(error);
308
- }
309
- }
310
- else {
311
- handleUnhandledError(err);
312
- }
313
- }
314
- complete() {
315
- const { partialObserver } = this;
316
- if (partialObserver.complete) {
317
- try {
318
- partialObserver.complete();
319
- }
320
- catch (error) {
321
- handleUnhandledError(error);
322
- }
323
- }
324
- }
325
- }
326
- class SafeSubscriber extends Subscriber {
327
- constructor(observerOrNext, error, complete) {
328
- super();
329
- let partialObserver;
330
- if (isFunction(observerOrNext) || !observerOrNext) {
331
- partialObserver = {
332
- next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
333
- error: error !== null && error !== void 0 ? error : undefined,
334
- complete: complete !== null && complete !== void 0 ? complete : undefined,
335
- };
336
- }
337
- else {
338
- let context;
339
- if (this && config.useDeprecatedNextContext) {
340
- context = Object.create(observerOrNext);
341
- context.unsubscribe = () => this.unsubscribe();
342
- partialObserver = {
343
- next: observerOrNext.next && bind(observerOrNext.next, context),
344
- error: observerOrNext.error && bind(observerOrNext.error, context),
345
- complete: observerOrNext.complete && bind(observerOrNext.complete, context),
346
- };
347
- }
348
- else {
349
- partialObserver = observerOrNext;
350
- }
351
- }
352
- this.destination = new ConsumerObserver(partialObserver);
353
- }
354
- }
355
- function handleUnhandledError(error) {
356
- {
357
- reportUnhandledError(error);
358
- }
359
- }
360
- function defaultErrorHandler(err) {
361
- throw err;
362
- }
363
- function handleStoppedNotification(notification, subscriber) {
364
- const { onStoppedNotification } = config;
365
- onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));
366
- }
367
- const EMPTY_OBSERVER = {
368
- closed: true,
369
- next: noop,
370
- error: defaultErrorHandler,
371
- complete: noop,
372
- };
373
-
374
- const observable = (() => (typeof Symbol === 'function' && Symbol.observable) || '@@observable')();
375
-
376
- function identity(x) {
377
- return x;
378
- }
379
-
380
- function pipeFromArray(fns) {
381
- if (fns.length === 0) {
382
- return identity;
383
- }
384
- if (fns.length === 1) {
385
- return fns[0];
386
- }
387
- return function piped(input) {
388
- return fns.reduce((prev, fn) => fn(prev), input);
389
- };
390
- }
391
-
392
- class Observable {
393
- constructor(subscribe) {
394
- if (subscribe) {
395
- this._subscribe = subscribe;
396
- }
397
- }
398
- lift(operator) {
399
- const observable = new Observable();
400
- observable.source = this;
401
- observable.operator = operator;
402
- return observable;
403
- }
404
- subscribe(observerOrNext, error, complete) {
405
- const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
406
- errorContext(() => {
407
- const { operator, source } = this;
408
- subscriber.add(operator
409
- ?
410
- operator.call(subscriber, source)
411
- : source
412
- ?
413
- this._subscribe(subscriber)
414
- :
415
- this._trySubscribe(subscriber));
416
- });
417
- return subscriber;
418
- }
419
- _trySubscribe(sink) {
420
- try {
421
- return this._subscribe(sink);
422
- }
423
- catch (err) {
424
- sink.error(err);
425
- }
426
- }
427
- forEach(next, promiseCtor) {
428
- promiseCtor = getPromiseCtor(promiseCtor);
429
- return new promiseCtor((resolve, reject) => {
430
- const subscriber = new SafeSubscriber({
431
- next: (value) => {
432
- try {
433
- next(value);
434
- }
435
- catch (err) {
436
- reject(err);
437
- subscriber.unsubscribe();
438
- }
439
- },
440
- error: reject,
441
- complete: resolve,
442
- });
443
- this.subscribe(subscriber);
444
- });
445
- }
446
- _subscribe(subscriber) {
447
- var _a;
448
- return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
449
- }
450
- [observable]() {
451
- return this;
452
- }
453
- pipe(...operations) {
454
- return pipeFromArray(operations)(this);
455
- }
456
- toPromise(promiseCtor) {
457
- promiseCtor = getPromiseCtor(promiseCtor);
458
- return new promiseCtor((resolve, reject) => {
459
- let value;
460
- this.subscribe((x) => (value = x), (err) => reject(err), () => resolve(value));
461
- });
462
- }
463
- }
464
- Observable.create = (subscribe) => {
465
- return new Observable(subscribe);
466
- };
467
- function getPromiseCtor(promiseCtor) {
468
- var _a;
469
- return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
470
- }
471
- function isObserver(value) {
472
- return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
473
- }
474
- function isSubscriber(value) {
475
- return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
476
- }
477
-
478
- function hasLift(source) {
479
- return isFunction(source === null || source === void 0 ? void 0 : source.lift);
480
- }
481
- function operate(init) {
482
- return (source) => {
483
- if (hasLift(source)) {
484
- return source.lift(function (liftedSource) {
485
- try {
486
- return init(liftedSource, this);
487
- }
488
- catch (err) {
489
- this.error(err);
490
- }
491
- });
492
- }
493
- throw new TypeError('Unable to lift unknown Observable type');
494
- };
495
- }
496
-
497
- function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
498
- return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
499
- }
500
- class OperatorSubscriber extends Subscriber {
501
- constructor(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
502
- super(destination);
503
- this.onFinalize = onFinalize;
504
- this.shouldUnsubscribe = shouldUnsubscribe;
505
- this._next = onNext
506
- ? function (value) {
507
- try {
508
- onNext(value);
509
- }
510
- catch (err) {
511
- destination.error(err);
512
- }
513
- }
514
- : super._next;
515
- this._error = onError
516
- ? function (err) {
517
- try {
518
- onError(err);
519
- }
520
- catch (err) {
521
- destination.error(err);
522
- }
523
- finally {
524
- this.unsubscribe();
525
- }
526
- }
527
- : super._error;
528
- this._complete = onComplete
529
- ? function () {
530
- try {
531
- onComplete();
532
- }
533
- catch (err) {
534
- destination.error(err);
535
- }
536
- finally {
537
- this.unsubscribe();
538
- }
539
- }
540
- : super._complete;
541
- }
542
- unsubscribe() {
543
- var _a;
544
- if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
545
- const { closed } = this;
546
- super.unsubscribe();
547
- !closed && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
548
- }
549
- }
550
- }
551
-
552
- const ObjectUnsubscribedError = createErrorClass((_super) => function ObjectUnsubscribedErrorImpl() {
553
- _super(this);
554
- this.name = 'ObjectUnsubscribedError';
555
- this.message = 'object unsubscribed';
556
- });
557
-
558
- class Subject extends Observable {
559
- constructor() {
560
- super();
561
- this.closed = false;
562
- this.currentObservers = null;
563
- this.observers = [];
564
- this.isStopped = false;
565
- this.hasError = false;
566
- this.thrownError = null;
567
- }
568
- lift(operator) {
569
- const subject = new AnonymousSubject(this, this);
570
- subject.operator = operator;
571
- return subject;
572
- }
573
- _throwIfClosed() {
574
- if (this.closed) {
575
- throw new ObjectUnsubscribedError();
576
- }
577
- }
578
- next(value) {
579
- errorContext(() => {
580
- this._throwIfClosed();
581
- if (!this.isStopped) {
582
- if (!this.currentObservers) {
583
- this.currentObservers = Array.from(this.observers);
584
- }
585
- for (const observer of this.currentObservers) {
586
- observer.next(value);
587
- }
588
- }
589
- });
590
- }
591
- error(err) {
592
- errorContext(() => {
593
- this._throwIfClosed();
594
- if (!this.isStopped) {
595
- this.hasError = this.isStopped = true;
596
- this.thrownError = err;
597
- const { observers } = this;
598
- while (observers.length) {
599
- observers.shift().error(err);
600
- }
601
- }
602
- });
603
- }
604
- complete() {
605
- errorContext(() => {
606
- this._throwIfClosed();
607
- if (!this.isStopped) {
608
- this.isStopped = true;
609
- const { observers } = this;
610
- while (observers.length) {
611
- observers.shift().complete();
612
- }
613
- }
614
- });
615
- }
616
- unsubscribe() {
617
- this.isStopped = this.closed = true;
618
- this.observers = this.currentObservers = null;
619
- }
620
- get observed() {
621
- var _a;
622
- return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
623
- }
624
- _trySubscribe(subscriber) {
625
- this._throwIfClosed();
626
- return super._trySubscribe(subscriber);
627
- }
628
- _subscribe(subscriber) {
629
- this._throwIfClosed();
630
- this._checkFinalizedStatuses(subscriber);
631
- return this._innerSubscribe(subscriber);
632
- }
633
- _innerSubscribe(subscriber) {
634
- const { hasError, isStopped, observers } = this;
635
- if (hasError || isStopped) {
636
- return EMPTY_SUBSCRIPTION;
637
- }
638
- this.currentObservers = null;
639
- observers.push(subscriber);
640
- return new Subscription(() => {
641
- this.currentObservers = null;
642
- arrRemove(observers, subscriber);
643
- });
644
- }
645
- _checkFinalizedStatuses(subscriber) {
646
- const { hasError, thrownError, isStopped } = this;
647
- if (hasError) {
648
- subscriber.error(thrownError);
649
- }
650
- else if (isStopped) {
651
- subscriber.complete();
652
- }
653
- }
654
- asObservable() {
655
- const observable = new Observable();
656
- observable.source = this;
657
- return observable;
658
- }
659
- }
660
- Subject.create = (destination, source) => {
661
- return new AnonymousSubject(destination, source);
662
- };
663
- class AnonymousSubject extends Subject {
664
- constructor(destination, source) {
665
- super();
666
- this.destination = destination;
667
- this.source = source;
668
- }
669
- next(value) {
670
- var _a, _b;
671
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
672
- }
673
- error(err) {
674
- var _a, _b;
675
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
676
- }
677
- complete() {
678
- var _a, _b;
679
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
680
- }
681
- _subscribe(subscriber) {
682
- var _a, _b;
683
- return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
684
- }
685
- }
686
-
687
- class BehaviorSubject extends Subject {
688
- constructor(_value) {
689
- super();
690
- this._value = _value;
691
- }
692
- get value() {
693
- return this.getValue();
694
- }
695
- _subscribe(subscriber) {
696
- const subscription = super._subscribe(subscriber);
697
- !subscription.closed && subscriber.next(this._value);
698
- return subscription;
699
- }
700
- getValue() {
701
- const { hasError, thrownError, _value } = this;
702
- if (hasError) {
703
- throw thrownError;
704
- }
705
- this._throwIfClosed();
706
- return _value;
707
- }
708
- next(value) {
709
- super.next((this._value = value));
710
- }
711
- }
712
-
713
- function isScheduler(value) {
714
- return value && isFunction(value.schedule);
715
- }
716
-
717
- function last(arr) {
718
- return arr[arr.length - 1];
719
- }
720
- function popScheduler(args) {
721
- return isScheduler(last(args)) ? args.pop() : undefined;
722
- }
723
-
724
- /******************************************************************************
725
- Copyright (c) Microsoft Corporation.
726
-
727
- Permission to use, copy, modify, and/or distribute this software for any
728
- purpose with or without fee is hereby granted.
729
-
730
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
731
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
732
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
733
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
734
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
735
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
736
- PERFORMANCE OF THIS SOFTWARE.
737
- ***************************************************************************** */
738
-
739
- function __awaiter(thisArg, _arguments, P, generator) {
740
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
741
- return new (P || (P = Promise))(function (resolve, reject) {
742
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
743
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
744
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
745
- step((generator = generator.apply(thisArg, _arguments || [])).next());
746
- });
747
- }
748
-
749
- function __values(o) {
750
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
751
- if (m) return m.call(o);
752
- if (o && typeof o.length === "number") return {
753
- next: function () {
754
- if (o && i >= o.length) o = void 0;
755
- return { value: o && o[i++], done: !o };
756
- }
757
- };
758
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
759
- }
760
-
761
- function __await(v) {
762
- return this instanceof __await ? (this.v = v, this) : new __await(v);
763
- }
764
-
765
- function __asyncGenerator(thisArg, _arguments, generator) {
766
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
767
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
768
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
769
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
770
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
771
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
772
- function fulfill(value) { resume("next", value); }
773
- function reject(value) { resume("throw", value); }
774
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
775
- }
776
-
777
- function __asyncValues(o) {
778
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
779
- var m = o[Symbol.asyncIterator], i;
780
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
781
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
782
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
783
- }
784
-
785
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
786
- var e = new Error(message);
787
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
788
- };
789
-
790
- const isArrayLike = ((x) => x && typeof x.length === 'number' && typeof x !== 'function');
791
-
792
- function isPromise(value) {
793
- return isFunction(value === null || value === void 0 ? void 0 : value.then);
794
- }
795
-
796
- function isInteropObservable(input) {
797
- return isFunction(input[observable]);
798
- }
799
-
800
- function isAsyncIterable(obj) {
801
- return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
802
- }
803
-
804
- function createInvalidObservableTypeError(input) {
805
- return new TypeError(`You provided ${input !== null && typeof input === 'object' ? 'an invalid object' : `'${input}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`);
806
- }
807
-
808
- function getSymbolIterator() {
809
- if (typeof Symbol !== 'function' || !Symbol.iterator) {
810
- return '@@iterator';
811
- }
812
- return Symbol.iterator;
813
- }
814
- const iterator = getSymbolIterator();
815
-
816
- function isIterable(input) {
817
- return isFunction(input === null || input === void 0 ? void 0 : input[iterator]);
818
- }
819
-
820
- function readableStreamLikeToAsyncGenerator(readableStream) {
821
- return __asyncGenerator(this, arguments, function* readableStreamLikeToAsyncGenerator_1() {
822
- const reader = readableStream.getReader();
823
- try {
824
- while (true) {
825
- const { value, done } = yield __await(reader.read());
826
- if (done) {
827
- return yield __await(void 0);
828
- }
829
- yield yield __await(value);
830
- }
831
- }
832
- finally {
833
- reader.releaseLock();
834
- }
835
- });
836
- }
837
- function isReadableStreamLike(obj) {
838
- return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);
839
- }
840
-
841
- function innerFrom(input) {
842
- if (input instanceof Observable) {
843
- return input;
844
- }
845
- if (input != null) {
846
- if (isInteropObservable(input)) {
847
- return fromInteropObservable(input);
848
- }
849
- if (isArrayLike(input)) {
850
- return fromArrayLike(input);
851
- }
852
- if (isPromise(input)) {
853
- return fromPromise(input);
854
- }
855
- if (isAsyncIterable(input)) {
856
- return fromAsyncIterable(input);
857
- }
858
- if (isIterable(input)) {
859
- return fromIterable(input);
860
- }
861
- if (isReadableStreamLike(input)) {
862
- return fromReadableStreamLike(input);
863
- }
864
- }
865
- throw createInvalidObservableTypeError(input);
866
- }
867
- function fromInteropObservable(obj) {
868
- return new Observable((subscriber) => {
869
- const obs = obj[observable]();
870
- if (isFunction(obs.subscribe)) {
871
- return obs.subscribe(subscriber);
872
- }
873
- throw new TypeError('Provided object does not correctly implement Symbol.observable');
874
- });
875
- }
876
- function fromArrayLike(array) {
877
- return new Observable((subscriber) => {
878
- for (let i = 0; i < array.length && !subscriber.closed; i++) {
879
- subscriber.next(array[i]);
880
- }
881
- subscriber.complete();
882
- });
883
- }
884
- function fromPromise(promise) {
885
- return new Observable((subscriber) => {
886
- promise
887
- .then((value) => {
888
- if (!subscriber.closed) {
889
- subscriber.next(value);
890
- subscriber.complete();
891
- }
892
- }, (err) => subscriber.error(err))
893
- .then(null, reportUnhandledError);
894
- });
895
- }
896
- function fromIterable(iterable) {
897
- return new Observable((subscriber) => {
898
- for (const value of iterable) {
899
- subscriber.next(value);
900
- if (subscriber.closed) {
901
- return;
902
- }
903
- }
904
- subscriber.complete();
905
- });
906
- }
907
- function fromAsyncIterable(asyncIterable) {
908
- return new Observable((subscriber) => {
909
- process(asyncIterable, subscriber).catch((err) => subscriber.error(err));
910
- });
911
- }
912
- function fromReadableStreamLike(readableStream) {
913
- return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
914
- }
915
- function process(asyncIterable, subscriber) {
916
- var asyncIterable_1, asyncIterable_1_1;
917
- var e_1, _a;
918
- return __awaiter(this, void 0, void 0, function* () {
919
- try {
920
- for (asyncIterable_1 = __asyncValues(asyncIterable); asyncIterable_1_1 = yield asyncIterable_1.next(), !asyncIterable_1_1.done;) {
921
- const value = asyncIterable_1_1.value;
922
- subscriber.next(value);
923
- if (subscriber.closed) {
924
- return;
925
- }
926
- }
927
- }
928
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
929
- finally {
930
- try {
931
- if (asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return)) yield _a.call(asyncIterable_1);
932
- }
933
- finally { if (e_1) throw e_1.error; }
934
- }
935
- subscriber.complete();
936
- });
937
- }
938
-
939
- function executeSchedule(parentSubscription, scheduler, work, delay = 0, repeat = false) {
940
- const scheduleSubscription = scheduler.schedule(function () {
941
- work();
942
- if (repeat) {
943
- parentSubscription.add(this.schedule(null, delay));
944
- }
945
- else {
946
- this.unsubscribe();
947
- }
948
- }, delay);
949
- parentSubscription.add(scheduleSubscription);
950
- if (!repeat) {
951
- return scheduleSubscription;
952
- }
953
- }
954
-
955
- function observeOn(scheduler, delay = 0) {
956
- return operate((source, subscriber) => {
957
- source.subscribe(createOperatorSubscriber(subscriber, (value) => executeSchedule(subscriber, scheduler, () => subscriber.next(value), delay), () => executeSchedule(subscriber, scheduler, () => subscriber.complete(), delay), (err) => executeSchedule(subscriber, scheduler, () => subscriber.error(err), delay)));
958
- });
959
- }
960
-
961
- function subscribeOn(scheduler, delay = 0) {
962
- return operate((source, subscriber) => {
963
- subscriber.add(scheduler.schedule(() => source.subscribe(subscriber), delay));
964
- });
965
- }
966
-
967
- function scheduleObservable(input, scheduler) {
968
- return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
969
- }
970
-
971
- function schedulePromise(input, scheduler) {
972
- return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
973
- }
974
-
975
- function scheduleArray(input, scheduler) {
976
- return new Observable((subscriber) => {
977
- let i = 0;
978
- return scheduler.schedule(function () {
979
- if (i === input.length) {
980
- subscriber.complete();
981
- }
982
- else {
983
- subscriber.next(input[i++]);
984
- if (!subscriber.closed) {
985
- this.schedule();
986
- }
987
- }
988
- });
989
- });
990
- }
991
-
992
- function scheduleIterable(input, scheduler) {
993
- return new Observable((subscriber) => {
994
- let iterator$1;
995
- executeSchedule(subscriber, scheduler, () => {
996
- iterator$1 = input[iterator]();
997
- executeSchedule(subscriber, scheduler, () => {
998
- let value;
999
- let done;
1000
- try {
1001
- ({ value, done } = iterator$1.next());
1002
- }
1003
- catch (err) {
1004
- subscriber.error(err);
1005
- return;
1006
- }
1007
- if (done) {
1008
- subscriber.complete();
1009
- }
1010
- else {
1011
- subscriber.next(value);
1012
- }
1013
- }, 0, true);
1014
- });
1015
- return () => isFunction(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return();
1016
- });
1017
- }
1018
-
1019
- function scheduleAsyncIterable(input, scheduler) {
1020
- if (!input) {
1021
- throw new Error('Iterable cannot be null');
1022
- }
1023
- return new Observable((subscriber) => {
1024
- executeSchedule(subscriber, scheduler, () => {
1025
- const iterator = input[Symbol.asyncIterator]();
1026
- executeSchedule(subscriber, scheduler, () => {
1027
- iterator.next().then((result) => {
1028
- if (result.done) {
1029
- subscriber.complete();
1030
- }
1031
- else {
1032
- subscriber.next(result.value);
1033
- }
1034
- });
1035
- }, 0, true);
1036
- });
1037
- });
1038
- }
1039
-
1040
- function scheduleReadableStreamLike(input, scheduler) {
1041
- return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
1042
- }
1043
-
1044
- function scheduled(input, scheduler) {
1045
- if (input != null) {
1046
- if (isInteropObservable(input)) {
1047
- return scheduleObservable(input, scheduler);
1048
- }
1049
- if (isArrayLike(input)) {
1050
- return scheduleArray(input, scheduler);
1051
- }
1052
- if (isPromise(input)) {
1053
- return schedulePromise(input, scheduler);
1054
- }
1055
- if (isAsyncIterable(input)) {
1056
- return scheduleAsyncIterable(input, scheduler);
1057
- }
1058
- if (isIterable(input)) {
1059
- return scheduleIterable(input, scheduler);
1060
- }
1061
- if (isReadableStreamLike(input)) {
1062
- return scheduleReadableStreamLike(input, scheduler);
1063
- }
1064
- }
1065
- throw createInvalidObservableTypeError(input);
1066
- }
1067
-
1068
- function from(input, scheduler) {
1069
- return scheduler ? scheduled(input, scheduler) : innerFrom(input);
1070
- }
1071
-
1072
- function distinctUntilChanged(comparator, keySelector = identity) {
1073
- comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
1074
- return operate((source, subscriber) => {
1075
- let previousKey;
1076
- let first = true;
1077
- source.subscribe(createOperatorSubscriber(subscriber, (value) => {
1078
- const currentKey = keySelector(value);
1079
- if (first || !comparator(previousKey, currentKey)) {
1080
- first = false;
1081
- previousKey = currentKey;
1082
- subscriber.next(value);
1083
- }
1084
- }));
1085
- });
1086
- }
1087
- function defaultCompare(a, b) {
1088
- return a === b;
1089
- }
1090
-
1091
- /**
1092
- * Returns property descriptor for the given property of the component.
1093
- *
1094
- * {@internal}
1095
- */
1096
- function getPropertyDescriptor(cmp, property, configurableRequired = true) {
1097
- // descriptors are defined on prototype, so we have to go one level up.
1098
- let prototype = Object.getPrototypeOf(cmp);
1099
- let descriptor = Object.getOwnPropertyDescriptor(prototype, property);
1100
- if (!descriptor) {
1101
- throw new Error(`Property "${property}" is not defined on component "${cmp.constructor.name}".`);
1102
- }
1103
- if (configurableRequired && !descriptor.configurable) {
1104
- throw new Error(`Property "${property}" is not configurable on component "${cmp.constructor.name}".`);
1105
- }
1106
- return descriptor;
1107
- }
1108
-
1109
- /**
1110
- * Returns an observable that emits property value when the component property value changes.
1111
- */
1112
- function propertyObservable(cmp, property) {
1113
- let subjectProperty = `__rx__subject_for_property__${property}__`;
1114
- if (!cmp[subjectProperty]) {
1115
- let descriptor = getPropertyDescriptor(cmp, property);
1116
- let previousSetter = descriptor.set;
1117
- let previousGetter = descriptor.get;
1118
- // we have to invoke previous getter on component instance to get the current value
1119
- let currentValue = undefined !== previousGetter ? previousGetter.call(cmp) : descriptor.value;
1120
- let subject = new BehaviorSubject(currentValue);
1121
- descriptor.set = function (value) {
1122
- if (previousSetter) {
1123
- previousSetter.call(this, value);
1124
- }
1125
- subject.next(value);
1126
- };
1127
- Object.defineProperty(cmp, property, descriptor);
1128
- cmp[subjectProperty] = subject;
1129
- }
1130
- return cmp[subjectProperty]
1131
- .asObservable()
1132
- .pipe(distinctUntilChanged());
1133
- }
1134
-
1135
- function setProperty(cmp, property, options = {}) {
1136
- let resolvedOptions = Object.assign({ scheduleRender: false, nextTick: true }, options);
1137
- return (value) => {
1138
- cmp[property] = value;
1139
- if (!resolvedOptions.scheduleRender) {
1140
- return;
1141
- }
1142
- if (!resolvedOptions.nextTick) {
1143
- index.forceUpdate(cmp);
1144
- return;
1145
- }
1146
- Promise.resolve().then(() => index.forceUpdate(cmp));
1147
- };
1148
- }
1149
-
1150
- exports.Observable = Observable;
1151
- exports.SafeSubscriber = SafeSubscriber;
1152
- exports.Subject = Subject;
1153
- exports.createOperatorSubscriber = createOperatorSubscriber;
1154
- exports.distinctUntilChanged = distinctUntilChanged;
1155
- exports.executeSchedule = executeSchedule;
1156
- exports.from = from;
1157
- exports.getPropertyDescriptor = getPropertyDescriptor;
1158
- exports.identity = identity;
1159
- exports.innerFrom = innerFrom;
1160
- exports.isFunction = isFunction;
1161
- exports.noop = noop;
1162
- exports.operate = operate;
1163
- exports.popScheduler = popScheduler;
1164
- exports.propertyObservable = propertyObservable;
1165
- exports.setProperty = setProperty;
1166
-
1167
- //# sourceMappingURL=set-property-88176225.js.map