New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cycle/dom

Package Overview
Dependencies
Maintainers
3
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cycle/dom - npm Package Compare versions

Comparing version 22.0.0 to 22.1.0-rc.0

4

lib/cjs/BodyDOMSource.d.ts
import { Stream, MemoryStream } from 'xstream';
import { EventsFnOptions, DOMSource } from './DOMSource';
export declare class BodyDOMSource implements DOMSource {
import { EventsFnOptions } from './DOMSource';
export declare class BodyDOMSource {
private _name;

@@ -5,0 +5,0 @@ constructor(_name: string);

import { Stream, MemoryStream } from 'xstream';
import { EventsFnOptions, DOMSource } from './DOMSource';
export declare class DocumentDOMSource implements DOMSource {
import { EventsFnOptions } from './DOMSource';
export declare class DocumentDOMSource {
private _name;

@@ -5,0 +5,0 @@ constructor(_name: string);

@@ -1,3 +0,5 @@

import { MemoryStream, Stream } from 'xstream';
import { PreventDefaultOpt } from './fromEvent';
import { MainDOMSource } from './MainDOMSource';
import { DocumentDOMSource } from './DocumentDOMSource';
import { BodyDOMSource } from './BodyDOMSource';
export interface EventsFnOptions {

@@ -9,8 +11,2 @@ useCapture?: boolean;

}
export interface DOMSource {
select(selector: string): DOMSource;
elements(): MemoryStream<Array<Document> | Array<HTMLBodyElement> | Array<Element> | string>;
element(): MemoryStream<Document | HTMLBodyElement | Element | string>;
events<K extends keyof HTMLElementEventMap>(eventType: K, options?: EventsFnOptions, bubbles?: boolean): Stream<HTMLElementEventMap[K]>;
events(eventType: string, options?: EventsFnOptions): Stream<Event>;
}
export declare type DOMSource = MainDOMSource | DocumentDOMSource | BodyDOMSource;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*export interface DOMSource {
select(selector: string): DOMSource;
elements(): MemoryStream<
Array<Document> | Array<HTMLBodyElement> | Array<Element> | string
>;
element(): MemoryStream<Document | HTMLBodyElement | Element | string>;
events<K extends keyof HTMLElementEventMap>(
eventType: K,
options?: EventsFnOptions,
bubbles?: boolean
): Stream<HTMLElementEventMap[K]>;
events(eventType: string, options?: EventsFnOptions): Stream<Event>;
}*/
//# sourceMappingURL=DOMSource.js.map

@@ -7,5 +7,4 @@ import { Stream } from 'xstream';

}
export declare type Sink = Stream<VNode>;
export declare type IsolateSink = (s: Sink, scope: string) => Sink;
export declare function makeIsolateSink(namespace: Array<Scope>): (sink: Sink, scope: string) => Sink;
export declare type IsolateSink<T extends VNode> = (s: Stream<T>, scope: string) => Stream<T>;
export declare function makeIsolateSink<T extends VNode>(namespace: Array<Scope>): IsolateSink<T>;
export declare function getScopeObj(scope: string): Scope;
import { Stream, MemoryStream } from 'xstream';
import { DOMSource, EventsFnOptions } from './DOMSource';
import { EventsFnOptions } from './DOMSource';
import { DocumentDOMSource } from './DocumentDOMSource';

@@ -12,3 +12,3 @@ import { BodyDOMSource } from './BodyDOMSource';

}
export declare class MainDOMSource implements DOMSource {
export declare class MainDOMSource {
private _rootElement$;

@@ -30,3 +30,3 @@ private _sanitation$;

isolateSource: (source: MainDOMSource, scope: string) => MainDOMSource;
isolateSink: IsolateSink;
isolateSink: IsolateSink<any>;
}
import { FantasyObservable } from '@cycle/run';
import { DOMSource, EventsFnOptions } from './DOMSource';
import { EventsFnOptions } from './DOMSource';
export declare type MockConfig = {
[name: string]: FantasyObservable | MockConfig;
[name: string]: FantasyObservable<any> | MockConfig;
};
export declare class MockedDOMSource implements DOMSource {
export declare class MockedDOMSource {
private _mockConfig;

@@ -8,0 +8,0 @@ private _elements;

import { Stream, MemoryStream } from 'xstream';
import { EventsFnOptions, DOMSource } from './DOMSource';
export declare class BodyDOMSource implements DOMSource {
import { EventsFnOptions } from './DOMSource';
export declare class BodyDOMSource {
private _name;

@@ -5,0 +5,0 @@ constructor(_name: string);

import { Stream, MemoryStream } from 'xstream';
import { EventsFnOptions, DOMSource } from './DOMSource';
export declare class DocumentDOMSource implements DOMSource {
import { EventsFnOptions } from './DOMSource';
export declare class DocumentDOMSource {
private _name;

@@ -5,0 +5,0 @@ constructor(_name: string);

@@ -1,3 +0,5 @@

import { MemoryStream, Stream } from 'xstream';
import { PreventDefaultOpt } from './fromEvent';
import { MainDOMSource } from './MainDOMSource';
import { DocumentDOMSource } from './DocumentDOMSource';
import { BodyDOMSource } from './BodyDOMSource';
export interface EventsFnOptions {

@@ -9,8 +11,2 @@ useCapture?: boolean;

}
export interface DOMSource {
select(selector: string): DOMSource;
elements(): MemoryStream<Array<Document> | Array<HTMLBodyElement> | Array<Element> | string>;
element(): MemoryStream<Document | HTMLBodyElement | Element | string>;
events<K extends keyof HTMLElementEventMap>(eventType: K, options?: EventsFnOptions, bubbles?: boolean): Stream<HTMLElementEventMap[K]>;
events(eventType: string, options?: EventsFnOptions): Stream<Event>;
}
export declare type DOMSource = MainDOMSource | DocumentDOMSource | BodyDOMSource;

@@ -0,1 +1,14 @@

/*export interface DOMSource {
select(selector: string): DOMSource;
elements(): MemoryStream<
Array<Document> | Array<HTMLBodyElement> | Array<Element> | string
>;
element(): MemoryStream<Document | HTMLBodyElement | Element | string>;
events<K extends keyof HTMLElementEventMap>(
eventType: K,
options?: EventsFnOptions,
bubbles?: boolean
): Stream<HTMLElementEventMap[K]>;
events(eventType: string, options?: EventsFnOptions): Stream<Event>;
}*/
//# sourceMappingURL=DOMSource.js.map

@@ -7,5 +7,4 @@ import { Stream } from 'xstream';

}
export declare type Sink = Stream<VNode>;
export declare type IsolateSink = (s: Sink, scope: string) => Sink;
export declare function makeIsolateSink(namespace: Array<Scope>): (sink: Sink, scope: string) => Sink;
export declare type IsolateSink<T extends VNode> = (s: Stream<T>, scope: string) => Stream<T>;
export declare function makeIsolateSink<T extends VNode>(namespace: Array<Scope>): IsolateSink<T>;
export declare function getScopeObj(scope: string): Scope;
import { Stream, MemoryStream } from 'xstream';
import { DOMSource, EventsFnOptions } from './DOMSource';
import { EventsFnOptions } from './DOMSource';
import { DocumentDOMSource } from './DocumentDOMSource';

@@ -12,3 +12,3 @@ import { BodyDOMSource } from './BodyDOMSource';

}
export declare class MainDOMSource implements DOMSource {
export declare class MainDOMSource {
private _rootElement$;

@@ -30,3 +30,3 @@ private _sanitation$;

isolateSource: (source: MainDOMSource, scope: string) => MainDOMSource;
isolateSink: IsolateSink;
isolateSink: IsolateSink<any>;
}
import { FantasyObservable } from '@cycle/run';
import { DOMSource, EventsFnOptions } from './DOMSource';
import { EventsFnOptions } from './DOMSource';
export declare type MockConfig = {
[name: string]: FantasyObservable | MockConfig;
[name: string]: FantasyObservable<any> | MockConfig;
};
export declare class MockedDOMSource implements DOMSource {
export declare class MockedDOMSource {
private _mockConfig;

@@ -8,0 +8,0 @@ private _elements;

{
"name": "@cycle/dom",
"version": "22.0.0",
"version": "22.1.0-rc.0",
"description": "The standard DOM Driver for Cycle.js, based on Snabbdom",

@@ -52,6 +52,5 @@ "license": "MIT",

"dependencies": {
"@cycle/run": "^5.1.0",
"rxjs": "^6.3.3",
"@cycle/run": "^5.2.0-rc.4",
"snabbdom": "^0.7.2",
"snabbdom-selector": "^4.0.0",
"snabbdom-selector": "^4.1.0",
"xstream": "*"

@@ -61,10 +60,10 @@ },

"@cycle/isolate": "^4.1.0",
"@cycle/rxjs-run": "^10.0.0",
"@cycle/rxjs-run": "^10.2.0-rc.6",
"@types/mocha": "^5.2.5",
"@types/node": "^10.11.7",
"@types/sinon": "^5.0.5",
"@types/node": "^10.12.11",
"@types/sinon": "^5.0.7",
"deepmerge": "^2.2.1",
"es6-map": "^0.1.5",
"es6-set": "^0.1.5",
"karma": "^3.0.0",
"karma": "^3.1.3",
"karma-browserstack-launcher": "^1.3.0",

@@ -78,9 +77,10 @@ "karma-chrome-launcher": "^2.2.0",

"mutation-observer": "1.0.3",
"rxjs": "^6.3.3",
"simulant": "^0.2.2",
"sinon": "^6.3.5",
"snabbdom-pragma": "^2.7.0",
"sinon": "^7.1.1",
"snabbdom-pragma": "^2.8.0",
"symbol-observable": "^1.2.0",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
"typescript": "3.1.x",
"typescript": "^3.1.6",
"xstream": "11.x"

@@ -87,0 +87,0 @@ },

@@ -7,3 +7,3 @@ import xs, {Stream, MemoryStream} from 'xstream';

export class BodyDOMSource implements DOMSource {
export class BodyDOMSource {
constructor(private _name: string) {}

@@ -10,0 +10,0 @@

@@ -7,3 +7,3 @@ import xs, {Stream, MemoryStream} from 'xstream';

export class DocumentDOMSource implements DOMSource {
export class DocumentDOMSource {
constructor(private _name: string) {}

@@ -10,0 +10,0 @@

import {MemoryStream, Stream} from 'xstream';
import {PreventDefaultOpt} from './fromEvent';
import {MainDOMSource} from './MainDOMSource';
import {DocumentDOMSource} from './DocumentDOMSource';
import {BodyDOMSource} from './BodyDOMSource';

@@ -11,3 +14,5 @@ export interface EventsFnOptions {

export interface DOMSource {
export type DOMSource = MainDOMSource | DocumentDOMSource | BodyDOMSource; // | MockedDOMSource;
/*export interface DOMSource {
select(selector: string): DOMSource;

@@ -24,2 +29,2 @@ elements(): MemoryStream<

events(eventType: string, options?: EventsFnOptions): Stream<Event>;
}
}*/

@@ -13,3 +13,3 @@ import {ScopeChecker} from './ScopeChecker';

public namespace: Array<Scope>,
public isolateModule: IsolateModule,
public isolateModule: IsolateModule
) {}

@@ -23,3 +23,3 @@

const topNode = this.isolateModule.getElement(
namespace.filter(n => n.type !== 'selector'),
namespace.filter(n => n.type !== 'selector')
);

@@ -26,0 +26,0 @@

@@ -11,8 +11,10 @@ import {Stream} from 'xstream';

export type Sink = Stream<VNode>;
export type IsolateSink = (s: Sink, scope: string) => Sink;
export type IsolateSink<T extends VNode> = (
s: Stream<T>,
scope: string
) => Stream<T>;
export function makeIsolateSink(
export function makeIsolateSink<T extends VNode>(
namespace: Array<Scope>
): (sink: Sink, scope: string) => Sink {
): IsolateSink<T> {
return (sink, scope) => {

@@ -29,3 +31,3 @@ if (scope === ':root') {

const newNode = {
...node,
...(node as any),
data: {

@@ -45,3 +47,3 @@ ...node.data,

: JSON.stringify(newNode.data.isolate),
} as VNode;
} as T;
});

@@ -48,0 +50,0 @@ };

@@ -19,3 +19,3 @@ import xs from 'xstream';

export class MainDOMSource implements DOMSource {
export class MainDOMSource {
constructor(

@@ -38,3 +38,3 @@ private _rootElement$: Stream<Element>,

);
this.isolateSink = makeIsolateSink(this._namespace);
this.isolateSink = makeIsolateSink(this._namespace) as any;
}

@@ -149,3 +149,3 @@

public isolateSource: (source: MainDOMSource, scope: string) => MainDOMSource;
public isolateSink: IsolateSink;
public isolateSink: IsolateSink<any>;
}

@@ -20,3 +20,3 @@ import {Driver, FantasyObservable} from '@cycle/run';

throw new Error(
`Optional modules option must be an array for snabbdom modules`,
`Optional modules option must be an array for snabbdom modules`
);

@@ -170,3 +170,3 @@ }

delegator,
name,
name
);

@@ -173,0 +173,0 @@ }

@@ -8,3 +8,3 @@ import xs, {Stream, MemoryStream} from 'xstream';

export type MockConfig = {
[name: string]: FantasyObservable | MockConfig;
[name: string]: FantasyObservable<any> | MockConfig;
};

@@ -14,8 +14,8 @@

export class MockedDOMSource implements DOMSource {
private _elements: FantasyObservable;
export class MockedDOMSource {
private _elements: FantasyObservable<any>;
constructor(private _mockConfig: MockConfig) {
if (_mockConfig.elements) {
this._elements = _mockConfig.elements as FantasyObservable;
this._elements = _mockConfig.elements as FantasyObservable<any>;
} else {

@@ -27,3 +27,3 @@ this._elements = adapt(xs.empty());

public elements(): any {
const out: Partial<DevToolEnabledSource> & FantasyObservable = this
const out: Partial<DevToolEnabledSource> & FantasyObservable<any> = this
._elements;

@@ -50,3 +50,3 @@ out._isCycleSource = 'MockedDOM';

const streamForEventType = this._mockConfig[eventType] as any;
const out: DevToolEnabledSource & FantasyObservable = adapt(
const out: DevToolEnabledSource & FantasyObservable<any> = adapt(
streamForEventType || xs.empty()

@@ -53,0 +53,0 @@ );

@@ -30,3 +30,3 @@ type Node<Payload> = [Payload | undefined, InternalTree<Payload>];

mkDefaultElement: () => Payload,
max?: number,
max?: number
): Payload {

@@ -43,3 +43,3 @@ return this.get(path, mkDefaultElement, max) as Payload;

mkDefaultElement?: () => Payload,
max?: number,
max?: number
): Payload | undefined {

@@ -46,0 +46,0 @@ let curr = this.tree;

@@ -62,3 +62,3 @@ import {Scope} from './isolate';

a: Array<Scope> | undefined,
b: Array<Scope> | undefined,
b: Array<Scope> | undefined
): boolean {

@@ -77,7 +77,7 @@ if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) {

export function makeInsert(
map: Map<string, Map<Element, any>>,
map: Map<string, Map<Element, any>>
): (type: string, elm: Element, value: any) => void {
return (type, elm, value) => {
if (map.has(type)) {
const innerMap = map.get(type) as Map<Element, any>;
const innerMap = map.get(type)!;
innerMap.set(elm, value);

@@ -84,0 +84,0 @@ } else {

@@ -47,3 +47,3 @@ import {VNode, vnode as vnodeFn} from 'snabbdom/vnode';

{},
children,
children
);

@@ -50,0 +50,0 @@ vnode.data = vnode.data || {};

@@ -441,6 +441,7 @@ import * as assert from 'assert';

const {sinks, sources, run} = setup(app, {
const drivers = {
DOM: makeDOMDriver(createRenderTarget()),
island: sink => {},
});
island(sink: Stream<Array<Element>>) {},
};
const {sinks, sources, run} = setup(app, drivers);

@@ -673,6 +674,7 @@ sinks.island

const {sinks, sources, run} = setup(IsolatedApp, {
const drivers = {
DOM: makeDOMDriver(createRenderTarget()),
triangleElement: sink => {},
});
triangleElement: (sink: any) => {},
};
const {sinks, sources, run} = setup(IsolatedApp, drivers);

@@ -1536,2 +1538,3 @@ // Make assertions

done('This case must not happen.');
return div();
}

@@ -1538,0 +1541,0 @@ });

// tslint:disable-next-line
import 'symbol-observable';
import {Stream} from 'xstream';
import * as assert from 'assert';
import {Observable, of, from, combineLatest} from 'rxjs';
import {take, skip} from 'rxjs/operators';
import {take, skip, map} from 'rxjs/operators';
import {setup} from '@cycle/rxjs-run';

@@ -16,2 +17,3 @@ import {setAdapt} from '@cycle/run/lib/adapt';

MockedDOMSource,
VNode,
} from '../../src/index';

@@ -232,3 +234,3 @@

const {sinks, sources, run} = setup(app, {
DOM: () =>
DOM: (_: Stream<VNode>) =>
mockDOMSource({

@@ -272,3 +274,3 @@ '.___foo': {

const {sinks, sources, run} = setup(app, {
DOM: () => mockDOMSource({}),
DOM: (_: Stream<VNode>) => mockDOMSource({}),
});

@@ -285,13 +287,11 @@ const dispose = run();

it('should prevent parent from DOM.selecting() inside the isolation', function(done) {
function app(_sources: {DOM: MockedDOMSource}): any {
function app(_sources: {DOM: MockedDOMSource}) {
const child$ = _sources.DOM.isolateSink(
of(div('.foo', [h4('.bar', 'Wrong')])),
'ISOLATION'
);
return {
DOM: of(
h3('.top-most', [
_sources.DOM.isolateSink(
of(div('.foo', [h4('.bar', 'Wrong')])),
'ISOLATION'
),
h2('.bar', 'Correct'),
])
),
DOM: map((child: any) =>
h3('.top-most', [child, h2('.bar', 'Correct')])
)(child$),
};

@@ -301,3 +301,3 @@ }

const {sinks, sources, run} = setup(app, {
DOM: () =>
DOM: (_: Stream<VNode>) =>
mockDOMSource({

@@ -304,0 +304,0 @@ '.___ISOLATION': {

@@ -6,4 +6,2 @@ {

"jsxFactory": "Snabbdom.createElement",
"strict": true,
"strictFunctionTypes": false,
"lib": [

@@ -10,0 +8,0 @@ "dom",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc