@vkontakte/videoplayer-shared 1.0.6 → 1.0.7
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/Logger/Logger.d.ts +1 -1
- package/Logger/types.d.ts +1 -1
- package/index.cjs.js +2 -2
- package/index.esm.js +2 -2
- package/package.json +1 -1
- package/reactive/Observable.d.ts +1 -1
- package/reactive/Subject.d.ts +1 -1
- package/reactive/Subscription.d.ts +1 -1
- package/reactive/ValueSubject.d.ts +1 -1
- package/reactive/combine.d.ts +1 -1
- package/reactive/fromEvent.d.ts +1 -1
- package/reactive/merge.d.ts +1 -1
- package/reactive/observableFrom.d.ts +1 -1
- package/reactive/operators/debounce.d.ts +2 -2
- package/reactive/operators/filter.d.ts +1 -1
- package/reactive/operators/filterChanged.d.ts +1 -1
- package/reactive/operators/map.d.ts +1 -1
- package/reactive/operators/mapTo.d.ts +1 -1
- package/reactive/operators/once.d.ts +1 -1
- package/reactive/operators/pairwise.d.ts +1 -1
- package/reactive/operators/tap.d.ts +1 -1
- package/reactive/operators/throttle.d.ts +1 -1
- package/reactive/timeout.d.ts +1 -1
- package/utils/now.d.ts +1 -1
package/Logger/Logger.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Subject from '../reactive/Subject';
|
|
2
|
-
import { ILogger, ILogInputEntry, IComponentLogger, ILogEntry } from './types';
|
|
2
|
+
import type { ILogger, ILogInputEntry, IComponentLogger, ILogEntry } from './types';
|
|
3
3
|
export declare class Logger implements ILogger {
|
|
4
4
|
log$: Subject<ILogEntry>;
|
|
5
5
|
private logs;
|
package/Logger/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IObservable } from '../reactive/types';
|
|
1
|
+
import type { IObservable } from '../reactive/types';
|
|
2
2
|
export interface ILogger {
|
|
3
3
|
log: (entry: ILogInputEntry) => void;
|
|
4
4
|
createCustomLog: <TArgs extends unknown[]>(transform: (...args: TArgs) => ILogInputEntry) => (...args: TArgs) => void;
|
package/index.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.7
|
|
3
|
+
* Thu, 24 Feb 2022 12:31:01 GMT
|
|
4
4
|
*/
|
|
5
5
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class t{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>"function"==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},r=()=>{};class s{constructor(t){t&&(this._subscribe=t)}subscribe(s,n){let i;i=n?"function"==typeof n?{next:n,error:r}:{next:t=>n.next(t),error:t=>{var e;return null===(e=n.error)||void 0===e?void 0:e.call(n,t)}}:{next:r,error:r};const o="function"==typeof s?{next:t=>{try{s(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>s.next(t),error:t=>s.error?s.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=r,o.error=r,typeof c){case"function":return void c();case"object":return void c.unsubscribe();case"undefined":return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class n extends s{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>{var r;return null===(r=e.error)||void 0===r?void 0:r.call(e,t)}))}_subscribe(e){const r=this.keyCounter++;return this.subscribers.set(r,e),(new t).add((()=>this.subscribers.delete(r)))}}function i(t){return null!=t}function o(t){return null==t}var c;const u="function"==typeof(null===(c=window.performance)||void 0===c?void 0:c.now)?()=>window.performance.now():()=>Date.now();const a={leading:!1,trailing:!0};class l{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,i(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout((()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0}),this.time)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}const h={leading:!0,trailing:!1};class d{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,o(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout((()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0}),this.time))}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class b{constructor(t,e){this.destination=t,this.predicate=e}next(t){let e;try{e=this.predicate(t)}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}const p={};class x{constructor(t,e){this.destination=t,this.predicate=e,this.lastValue=p}next(t){let e;try{e=this.lastValue===p||!this.predicate(this.lastValue,t),this.lastValue=t}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function w(t){return e=>new s((r=>e.subscribe(new v(r,t))))}class v{constructor(t,e){this.destination=t,this.mapper=e}next(t){let e;try{e=this.mapper(t)}catch(t){throw this.error(t),t}this.destination.next(e)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class f{constructor(t){this.destination=t,this.hasLast=!1}next(t){const e=this.last;this.last=t,this.hasLast?this.destination.next([e,t]):this.hasLast=!0}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}class m{constructor(t,e){this.destination=t,this.effect=e}next(t){try{this.effect(t)}catch(t){throw this.error(t),t}this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}exports.Logger=class{constructor(){this.log$=new n,this.logs=[],this.log=t=>{const e=Object.assign(Object.assign({},t),{timestamp:Date.now()});this.logs.push(e),this.log$.next(e)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...e)=>{let r;try{r=t(...e)}catch(t){r={message:"error in `createCustomLog`",component:"Logger"}}this.log(r)}}createComponentLog(t){return this.createCustomLog((e=>Object.assign({component:t},e)))}},exports.Observable=s,exports.Subject=n,exports.Subscription=t,exports.ValueSubject=class extends n{constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const e=super._subscribe(t);return t.next(this.value),e}},exports.addScript=(t,e,r)=>new Promise(((s,n)=>{e.addEventListener("abort",(()=>{c(),a.remove()}));const i=()=>{c(),n()},o=()=>{c(),s()},c=()=>{u&&clearTimeout(u),a.removeEventListener("load",o),a.removeEventListener("error",i)};let u;r&&(u=window.setTimeout(i,r));const a=document.createElement("script");a.addEventListener("load",o),a.addEventListener("error",i),a.src=t,document.head.appendChild(a)})),exports.assertNever=e,exports.assertNonNullable=function(t,e='Assertion "value is not nullable" failed'){if(null==t)throw new Error(e)},exports.assertNullable=function(t,e='Assertion "value is nullable" failed'){if(null!=t)throw new Error(e)},exports.checkNever=t=>{},exports.combine=function(e){return new s((r=>{const s={};let n=Object.keys(e).length;return Object.entries(e).reduce(((t,[e,i])=>t.add(i.subscribe((t=>e=>{t in s||n--,s[t]=e,0===n&&r.next(s)})(e)))),new t)}))},exports.debounce=function(t,e=a){return r=>new s((s=>r.subscribe(new l(s,t,e))))},exports.filter=function(t){return e=>new s((r=>e.subscribe(new b(r,t))))},exports.filterChanged=function(t=((t,e)=>t===e)){return e=>new s((r=>e.subscribe(new x(r,t))))},exports.fromEvent=(t,e)=>new s((r=>{const s=t=>r.next(t);return t.addEventListener(e,s),()=>t.removeEventListener(e,s)})),exports.isNonNullable=i,exports.isNullable=o,exports.map=w,exports.mapTo=function(t){return w((()=>t))},exports.merge=function(...e){return new s((r=>e.reduce(((t,e)=>t.add(e.subscribe(r))),new t)))},exports.noop=r,exports.now=u,exports.observableFrom=t=>new s((e=>{t.forEach((t=>e.next(t)))})),exports.once=function(){return t=>new s((e=>{let r=!1,s=!1;const n=t.subscribe((t=>{r||(r=!0,e.next(t)),s&&n.unsubscribe()}),(t=>{var i;r=!0,null===(i=e.error)||void 0===i||i.call(e,t),s&&n.unsubscribe()}));return s=!0,r&&n.unsubscribe(),n}))},exports.pairwise=function(){return t=>new s((e=>t.subscribe(new f(e))))},exports.tap=function(t){return e=>new s((r=>e.subscribe(new m(r,t))))},exports.throttle=function(t,e=h){return r=>new s((s=>r.subscribe(new d(s,t,e))))},exports.timeout=t=>new s((e=>{const r=window.setTimeout((()=>e.next()),t);return()=>window.clearTimeout(r)}));
|
package/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vkontakte/videoplayer-shared v1.0.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/videoplayer-shared v1.0.7
|
|
3
|
+
* Thu, 24 Feb 2022 12:31:01 GMT
|
|
4
4
|
*/
|
|
5
5
|
class t{constructor(){this.subscriptions=[]}unsubscribe(){const t=this.subscriptions;this.subscriptions=[],t.forEach((t=>"function"==typeof t?t():t.unsubscribe()))}add(t){return this.subscriptions.push(t),this}}const e=t=>{throw new Error(`${t} is value of unexpected type`)},r=t=>{},s=()=>{};class n{constructor(t){t&&(this._subscribe=t)}subscribe(r,n){let i;i=n?"function"==typeof n?{next:n,error:s}:{next:t=>n.next(t),error:t=>{var e;return null===(e=n.error)||void 0===e?void 0:e.call(n,t)}}:{next:s,error:s};const o="function"==typeof r?{next:t=>{try{r(t)}catch(t){i.next(t)}},error:t=>i.next(t)}:{next:t=>r.next(t),error:t=>r.error?r.error(t):i.next(t)},c=this._subscribe(o);return(new t).add((()=>{switch(o.next=s,o.error=s,typeof c){case"function":return void c();case"object":return void c.unsubscribe();case"undefined":return;default:return e(c)}}))}pipe(...t){return t.reduce(((t,e)=>e(t)),this)}_subscribe(t){}}class i extends n{constructor(){super(),this.keyCounter=0,this.subscribers=new Map}next(t){this.subscribers.forEach((e=>e.next(t)))}error(t){this.subscribers.forEach((e=>{var r;return null===(r=e.error)||void 0===r?void 0:r.call(e,t)}))}_subscribe(e){const r=this.keyCounter++;return this.subscribers.set(r,e),(new t).add((()=>this.subscribers.delete(r)))}}class o{constructor(){this.log$=new i,this.logs=[],this.log=t=>{const e=Object.assign(Object.assign({},t),{timestamp:Date.now()});this.logs.push(e),this.log$.next(e)},this.getAllLogs=()=>this.logs}createCustomLog(t){return(...e)=>{let r;try{r=t(...e)}catch(t){r={message:"error in `createCustomLog`",component:"Logger"}}this.log(r)}}createComponentLog(t){return this.createCustomLog((e=>Object.assign({component:t},e)))}}function c(t,e='Assertion "value is not nullable" failed'){if(null==t)throw new Error(e)}function u(t,e='Assertion "value is nullable" failed'){if(null!=t)throw new Error(e)}function a(t){return null!=t}function l(t){return null==t}const h=(t,e,r)=>new Promise(((s,n)=>{e.addEventListener("abort",(()=>{c(),a.remove()}));const i=()=>{c(),n()},o=()=>{c(),s()},c=()=>{u&&clearTimeout(u),a.removeEventListener("load",o),a.removeEventListener("error",i)};let u;r&&(u=window.setTimeout(i,r));const a=document.createElement("script");a.addEventListener("load",o),a.addEventListener("error",i),a.src=t,document.head.appendChild(a)}));var d;const b="function"==typeof(null===(d=window.performance)||void 0===d?void 0:d.now)?()=>window.performance.now():()=>Date.now();class w extends i{constructor(t){super(),this.value=t}next(t){super.next(this.value=t)}error(t){super.error(this.value=t)}getValue(){return this.value}_subscribe(t){const e=super._subscribe(t);return t.next(this.value),e}}function v(e){return new n((r=>{const s={};let n=Object.keys(e).length;return Object.entries(e).reduce(((t,[e,i])=>t.add(i.subscribe((t=>e=>{t in s||n--,s[t]=e,0===n&&r.next(s)})(e)))),new t)}))}function f(...e){return new n((r=>e.reduce(((t,e)=>t.add(e.subscribe(r))),new t)))}var x=t=>new n((e=>{const r=window.setTimeout((()=>e.next()),t);return()=>window.clearTimeout(r)})),m=t=>new n((e=>{t.forEach((t=>e.next(t)))})),p=(t,e)=>new n((r=>{const s=t=>r.next(t);return t.addEventListener(e,s),()=>t.removeEventListener(e,s)}));const g={leading:!1,trailing:!0};function L(t,e=g){return r=>new n((s=>r.subscribe(new y(s,t,e))))}class y{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,a(this.timeout)?window.clearTimeout(this.timeout):this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout((()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0}),this.time)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}const E={leading:!0,trailing:!1};function V(t,e=E){return r=>new n((s=>r.subscribe(new C(s,t,e))))}class C{constructor(t,e,r){this.destination=t,this.time=e,this.config=r}next(t){this.lastValue=t,l(this.timeout)&&(this.config.leading&&this.destination.next(t),this.timeout=window.setTimeout((()=>{this.config.trailing&&this.destination.next(this.lastValue),this.timeout=void 0}),this.time))}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function T(t){return e=>new n((r=>e.subscribe(new j(r,t))))}class j{constructor(t,e){this.destination=t,this.predicate=e}next(t){let e;try{e=this.predicate(t)}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function _(t=((t,e)=>t===e)){return e=>new n((r=>e.subscribe(new k(r,t))))}const O={};class k{constructor(t,e){this.destination=t,this.predicate=e,this.lastValue=O}next(t){let e;try{e=this.lastValue===O||!this.predicate(this.lastValue,t),this.lastValue=t}catch(t){throw this.error(t),t}e&&this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function A(t){return e=>new n((r=>e.subscribe(new $(r,t))))}class ${constructor(t,e){this.destination=t,this.mapper=e}next(t){let e;try{e=this.mapper(t)}catch(t){throw this.error(t),t}this.destination.next(e)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function D(t){return A((()=>t))}function M(){return t=>new n((e=>{let r=!1,s=!1;const n=t.subscribe((t=>{r||(r=!0,e.next(t)),s&&n.unsubscribe()}),(t=>{var i;r=!0,null===(i=e.error)||void 0===i||i.call(e,t),s&&n.unsubscribe()}));return s=!0,r&&n.unsubscribe(),n}))}function P(){return t=>new n((e=>t.subscribe(new q(e))))}class q{constructor(t){this.destination=t,this.hasLast=!1}next(t){const e=this.last;this.last=t,this.hasLast?this.destination.next([e,t]):this.hasLast=!0}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}function z(t){return e=>new n((r=>e.subscribe(new B(r,t))))}class B{constructor(t,e){this.destination=t,this.effect=e}next(t){try{this.effect(t)}catch(t){throw this.error(t),t}this.destination.next(t)}error(t){var e,r;null===(r=(e=this.destination).error)||void 0===r||r.call(e,t)}}export{o as Logger,n as Observable,i as Subject,t as Subscription,w as ValueSubject,h as addScript,e as assertNever,c as assertNonNullable,u as assertNullable,r as checkNever,v as combine,L as debounce,T as filter,_ as filterChanged,p as fromEvent,a as isNonNullable,l as isNullable,A as map,D as mapTo,f as merge,s as noop,b as now,m as observableFrom,M as once,P as pairwise,z as tap,V as throttle,x as timeout};
|
package/package.json
CHANGED
package/reactive/Observable.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IEmitter, IListener, IObservable, IOperator, ISubscription, IUnsubscriber } from './types';
|
|
1
|
+
import type { IEmitter, IListener, IObservable, IOperator, ISubscription, IUnsubscriber } from './types';
|
|
2
2
|
export default class Observable<T> implements IObservable<T> {
|
|
3
3
|
constructor(subscribe?: (emitter: IEmitter<T>) => IUnsubscriber | ISubscription | void);
|
|
4
4
|
subscribe(listener: IListener<T>, error?: IListener<Error | unknown>): ISubscription;
|
package/reactive/Subject.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IEmitter, ISubject, ISubscription, IUnsubscriber } from './types';
|
|
1
|
+
import type { IEmitter, ISubject, ISubscription, IUnsubscriber } from './types';
|
|
2
2
|
import Observable from './Observable';
|
|
3
3
|
export default class Subject<T> extends Observable<T> implements ISubject<T> {
|
|
4
4
|
private keyCounter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IEmitter, ISubscription, IUnsubscriber, IValueSubject } from './types';
|
|
1
|
+
import type { IEmitter, ISubscription, IUnsubscriber, IValueSubject } from './types';
|
|
2
2
|
import Subject from './Subject';
|
|
3
3
|
export default class ValueSubject<T> extends Subject<T> implements IValueSubject<T> {
|
|
4
4
|
private value;
|
package/reactive/combine.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IObservable, TypeOfObservable } from './types';
|
|
1
|
+
import type { IObservable, TypeOfObservable } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Создаёт Observable, который состоит из объектов, ключами которых являются последние значения исходных Observable.
|
|
4
4
|
* Первое событие возникает тогда, когда каждый исходный Observable выдал хотя бы одно значение.
|
package/reactive/fromEvent.d.ts
CHANGED
package/reactive/merge.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IObservable } from './types';
|
|
1
|
+
import type { IObservable } from './types';
|
|
2
2
|
export default function merge<T1, T2>(v1: IObservable<T1>, v2: IObservable<T2>): IObservable<T1 | T2>;
|
|
3
3
|
export default function merge<T1, T2, T3>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>): IObservable<T1 | T2 | T3>;
|
|
4
4
|
export default function merge<T1, T2, T3, T4>(v1: IObservable<T1>, v2: IObservable<T2>, v3: IObservable<T3>, v4: IObservable<T4>): IObservable<T1 | T2 | T3 | T4>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Milliseconds } from '../../utils/semanticTypes';
|
|
2
|
-
import { IOperator } from '../types';
|
|
1
|
+
import type { Milliseconds } from '../../utils/semanticTypes';
|
|
2
|
+
import type { IOperator } from '../types';
|
|
3
3
|
export default function debounce<T>(time: Milliseconds, config?: {
|
|
4
4
|
leading: boolean;
|
|
5
5
|
trailing: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IOperator } from '../types';
|
|
1
|
+
import type { IOperator } from '../types';
|
|
2
2
|
export default function map<T, S>(mapper: (value: T) => S): IOperator<T, S>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IOperator } from '../types';
|
|
1
|
+
import type { IOperator } from '../types';
|
|
2
2
|
export default function mapTo<T, S>(value: S): IOperator<T, S>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IOperator } from '../types';
|
|
1
|
+
import type { IOperator } from '../types';
|
|
2
2
|
export default function tap<T>(effect: (value: T) => void): IOperator<T>;
|
package/reactive/timeout.d.ts
CHANGED
package/utils/now.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Milliseconds } from './semanticTypes';
|
|
1
|
+
import type { Milliseconds } from './semanticTypes';
|
|
2
2
|
export declare const now: () => Milliseconds;
|