Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@spectrum-web-components/base

Package Overview
Dependencies
Maintainers
8
Versions
207
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spectrum-web-components/base - npm Package Compare versions

Comparing version 0.31.1-react.21 to 0.32.0

4

package.json
{
"name": "@spectrum-web-components/base",
"version": "0.31.1-react.21+44f0b1df9",
"version": "0.32.0",
"publishConfig": {

@@ -110,3 +110,3 @@ "access": "public"

],
"gitHead": "44f0b1df9e1ea77d9e931629a63918ceee2744c2"
"gitHead": "c5f67662ac54d0e37debaf7cbd7c2df60e8b294e"
}

@@ -26,2 +26,3 @@ import { nothing, Part } from 'lit';

state: 'off' | 'on';
stream?: number;
render(_configGroup: ListenerConfigGroup): typeof nothing;

@@ -31,6 +32,8 @@ update(part: Part, [{ start, end, streamInside, streamOutside, },]: Parameters<this['render']>): void;

callHandler(value: (event: Event) => void | EventListenerObject, event: Event): void;
handleStream(value: (event: Event) => void | EventListenerObject, event: Event): void;
clearStream(): void;
handleStart: (event: Event) => void;
handleStream: (event: Event) => void;
handleInside: (event: Event) => void;
handleEnd: (event: Event) => void;
handleBetween: (event: Event) => void;
handleOutside: (event: Event) => void;
addListener(type: string | string[], fn: (event: Event) => void): void;

@@ -37,0 +40,0 @@ removeListener(type: string | string[], fn: (event: Event) => void): void;

@@ -19,2 +19,3 @@ "use strict";

this.handleStart = (event) => {
this.clearStream();
this.callHandler(this.start[1], event);

@@ -27,6 +28,7 @@ if (event.defaultPrevented) {

};
this.handleStream = (event) => {
this.callHandler(this.streamInside[1], event);
this.handleInside = (event) => {
this.handleStream(this.streamInside[1], event);
};
this.handleEnd = (event) => {
this.clearStream();
this.callHandler(this.end[1], event);

@@ -36,4 +38,4 @@ this.removeListeners();

};
this.handleBetween = (event) => {
this.callHandler(this.streamOutside[1], event);
this.handleOutside = (event) => {
this.handleStream(this.streamOutside[1], event);
};

@@ -69,6 +71,6 @@ }

if (this.state === "off") {
this.addListener(this.streamOutside[0], this.handleBetween);
this.addListener(this.streamOutside[0], this.handleOutside);
this.addListener(this.start[0], this.handleStart);
} else if (this.state === "on") {
this.addListener(this.streamInside[0], this.handleStream);
this.addListener(this.streamInside[0], this.handleInside);
this.addListener(this.end[0], this.handleEnd);

@@ -84,2 +86,17 @@ }

}
handleStream(value, event) {
if (this.stream) {
return;
}
this.callHandler(value, event);
this.stream = requestAnimationFrame(() => {
this.stream = void 0;
});
}
clearStream() {
if (this.stream != null) {
cancelAnimationFrame(this.stream);
this.stream = void 0;
}
}
addListener(type, fn) {

@@ -105,5 +122,5 @@ if (Array.isArray(type)) {

this.removeListener(this.start[0], this.handleStart);
this.removeListener(this.streamInside[0], this.handleStream);
this.removeListener(this.streamInside[0], this.handleInside);
this.removeListener(this.end[0], this.handleEnd);
this.removeListener(this.streamOutside[0], this.handleBetween);
this.removeListener(this.streamOutside[0], this.handleOutside);
}

@@ -110,0 +127,0 @@ disconnected() {

@@ -1,2 +0,2 @@

"use strict";import{nothing as o}from"lit";import{AsyncDirective as a,directive as h}from"lit/async-directive.js";const i=["",()=>{}];class v extends a{constructor(){super(...arguments);this.start=i;this.streamInside=i;this.end=i;this.streamOutside=i;this.state="off";this.handleStart=e=>{this.callHandler(this.start[1],e),!e.defaultPrevented&&(this.removeListeners(),this.addListeners("on"))};this.handleStream=e=>{this.callHandler(this.streamInside[1],e)};this.handleEnd=e=>{this.callHandler(this.end[1],e),this.removeListeners(),this.addListeners("off")};this.handleBetween=e=>{this.callHandler(this.streamOutside[1],e)}}render(e){return o}update(e,[{start:t,end:s,streamInside:r=i,streamOutside:d=i}]){var n;this.element!==e.element&&(this.element=e.element,this.removeListeners()),this.host=((n=e.options)==null?void 0:n.host)||this.element,this.start=t,this.end=s,this.streamInside=r,this.streamOutside=d,this.addListeners()}addListeners(e){this.state=e||this.state,this.state==="off"?(this.addListener(this.streamOutside[0],this.handleBetween),this.addListener(this.start[0],this.handleStart)):this.state==="on"&&(this.addListener(this.streamInside[0],this.handleStream),this.addListener(this.end[0],this.handleEnd))}callHandler(e,t){typeof e=="function"?e.call(this.host,t):e.handleEvent(t)}addListener(e,t){Array.isArray(e)?e.map(s=>{this.element.addEventListener(s,t)}):this.element.addEventListener(e,t)}removeListener(e,t){Array.isArray(e)?e.map(s=>{this.element.removeEventListener(s,t)}):this.element.removeEventListener(e,t)}removeListeners(){this.removeListener(this.start[0],this.handleStart),this.removeListener(this.streamInside[0],this.handleStream),this.removeListener(this.end[0],this.handleEnd),this.removeListener(this.streamOutside[0],this.handleBetween)}disconnected(){this.removeListeners()}reconnected(){this.addListeners()}}export const streamingListener=h(v);
"use strict";import{nothing as a}from"lit";import{AsyncDirective as o,directive as h}from"lit/async-directive.js";const i=["",()=>{}];class m extends o{constructor(){super(...arguments);this.start=i;this.streamInside=i;this.end=i;this.streamOutside=i;this.state="off";this.handleStart=e=>{this.clearStream(),this.callHandler(this.start[1],e),!e.defaultPrevented&&(this.removeListeners(),this.addListeners("on"))};this.handleInside=e=>{this.handleStream(this.streamInside[1],e)};this.handleEnd=e=>{this.clearStream(),this.callHandler(this.end[1],e),this.removeListeners(),this.addListeners("off")};this.handleOutside=e=>{this.handleStream(this.streamOutside[1],e)}}render(e){return a}update(e,[{start:t,end:s,streamInside:r=i,streamOutside:d=i}]){var n;this.element!==e.element&&(this.element=e.element,this.removeListeners()),this.host=((n=e.options)==null?void 0:n.host)||this.element,this.start=t,this.end=s,this.streamInside=r,this.streamOutside=d,this.addListeners()}addListeners(e){this.state=e||this.state,this.state==="off"?(this.addListener(this.streamOutside[0],this.handleOutside),this.addListener(this.start[0],this.handleStart)):this.state==="on"&&(this.addListener(this.streamInside[0],this.handleInside),this.addListener(this.end[0],this.handleEnd))}callHandler(e,t){typeof e=="function"?e.call(this.host,t):e.handleEvent(t)}handleStream(e,t){this.stream||(this.callHandler(e,t),this.stream=requestAnimationFrame(()=>{this.stream=void 0}))}clearStream(){this.stream!=null&&(cancelAnimationFrame(this.stream),this.stream=void 0)}addListener(e,t){Array.isArray(e)?e.map(s=>{this.element.addEventListener(s,t)}):this.element.addEventListener(e,t)}removeListener(e,t){Array.isArray(e)?e.map(s=>{this.element.removeEventListener(s,t)}):this.element.removeEventListener(e,t)}removeListeners(){this.removeListener(this.start[0],this.handleStart),this.removeListener(this.streamInside[0],this.handleInside),this.removeListener(this.end[0],this.handleEnd),this.removeListener(this.streamOutside[0],this.handleOutside)}disconnected(){this.removeListeners()}reconnected(){this.addListeners()}}export const streamingListener=h(m);
//# sourceMappingURL=streaming-listener.js.map

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