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
7
Versions
236
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.5.8 to 0.5.9-devmode.24

src/Base.dev.js

76

package.json
{
"name": "@spectrum-web-components/base",
"version": "0.5.8",
"version": "0.5.9-devmode.24+07474d44f",
"publishConfig": {

@@ -23,15 +23,59 @@ "access": "public"

"exports": {
".": "./src/index.js",
"./src/*": "./src/*",
"./condition-attribute-with-id": "./src/condition-attribute-with-id.js",
"./condition-attribute-with-id.js": "./src/condition-attribute-with-id.js",
"./decorators": "./src/decorators.js",
"./decorators.js": "./src/decorators.js",
"./directives": "./src/directives.js",
"./directives.js": "./src/directives.js",
"./html": "./src/html.js",
"./html.js": "./src/html.js",
"./streaming-listener": "./src/streaming-listener.js",
"./streaming-listener.js": "./src/streaming-listener.js",
"./package.json": "./package.json"
".": {
"development": "./src/index.dev.js",
"default": "./src/index.js"
},
"./package.json": "./package.json",
"./src/Base.js": {
"development": "./src/Base.dev.js",
"default": "./src/Base.js"
},
"./src/condition-attribute-with-id.js": {
"development": "./src/condition-attribute-with-id.dev.js",
"default": "./src/condition-attribute-with-id.js"
},
"./src/decorators.js": {
"development": "./src/decorators.dev.js",
"default": "./src/decorators.js"
},
"./src/directives.js": {
"development": "./src/directives.dev.js",
"default": "./src/directives.js"
},
"./src/html.js": {
"development": "./src/html.dev.js",
"default": "./src/html.js"
},
"./src/index.js": {
"development": "./src/index.dev.js",
"default": "./src/index.js"
},
"./src/sizedMixin.js": {
"development": "./src/sizedMixin.dev.js",
"default": "./src/sizedMixin.js"
},
"./src/streaming-listener.js": {
"development": "./src/streaming-listener.dev.js",
"default": "./src/streaming-listener.js"
},
"./condition-attribute-with-id.js": {
"development": "./condition-attribute-with-id.dev.js",
"default": "./condition-attribute-with-id.js"
},
"./decorators.js": {
"development": "./decorators.dev.js",
"default": "./decorators.js"
},
"./directives.js": {
"development": "./directives.dev.js",
"default": "./directives.js"
},
"./html.js": {
"development": "./html.dev.js",
"default": "./html.js"
},
"./streaming-listener.js": {
"development": "./streaming-listener.dev.js",
"default": "./streaming-listener.js"
}
},

@@ -56,3 +100,3 @@ "scripts": {

"dependencies": {
"lit": "^2.1.2",
"lit": "^2.2.0",
"tslib": "^2.0.0"

@@ -63,3 +107,3 @@ },

"sideEffects": false,
"gitHead": "e5cd4a0db2201b8126eb9133ac3c24172d086359"
"gitHead": "07474d44f6cee1db241b9ccf3dc812514ffbe7fa"
}

@@ -1,120 +0,120 @@

/*
Copyright 2020 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
import { __decorate } from "tslib";
import { LitElement } from 'lit';
import { property } from 'lit/decorators.js';
const observedForElements = new Set();
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
if (decorator = decorators[i])
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
if (kind && result)
__defProp(target, key, result);
return result;
};
import { LitElement } from "lit";
import { property } from "lit/decorators.js";
const observedForElements = /* @__PURE__ */ new Set();
const updateRTL = () => {
const dir = document.documentElement.dir === 'rtl'
? document.documentElement.dir
: 'ltr';
observedForElements.forEach((el) => {
el.setAttribute('dir', dir);
});
const dir = document.documentElement.dir === "rtl" ? document.documentElement.dir : "ltr";
observedForElements.forEach((el) => {
el.setAttribute("dir", dir);
});
};
const rtlObserver = new MutationObserver(updateRTL);
rtlObserver.observe(document.documentElement, {
attributes: true,
attributeFilter: ['dir'],
attributes: true,
attributeFilter: ["dir"]
});
const canManageContentDirection = (el) => typeof el.startManagingContentDirection !== 'undefined' ||
el.tagName === 'SP-THEME';
const canManageContentDirection = (el) => typeof el.startManagingContentDirection !== "undefined" || el.tagName === "SP-THEME";
export function SpectrumMixin(constructor) {
class SlotTextObservingElement extends constructor {
constructor() {
super(...arguments);
/**
* @private
*/
this.dir = 'ltr';
class SlotTextObservingElement extends constructor {
constructor() {
super(...arguments);
this.dir = "ltr";
}
get isLTR() {
return this.dir === "ltr";
}
hasVisibleFocusInTree() {
const activeElement = this.getRootNode().activeElement;
if (!activeElement) {
return false;
}
try {
return activeElement.matches(":focus-visible") || activeElement.matches(".focus-visible");
} catch (error) {
return activeElement.matches(".focus-visible");
}
}
connectedCallback() {
if (!this.hasAttribute("dir")) {
let dirParent = this.assignedSlot || this.parentNode;
while (dirParent !== document.documentElement && !canManageContentDirection(dirParent)) {
dirParent = dirParent.assignedSlot || dirParent.parentNode || dirParent.host;
}
/**
* @private
*/
get isLTR() {
return this.dir === 'ltr';
const oldDir = this.dir;
this.dir = dirParent.dir === "rtl" ? dirParent.dir : this.dir || "ltr";
if (oldDir === this.dir) {
this.setAttribute("dir", this.dir);
}
hasVisibleFocusInTree() {
const activeElement = this.getRootNode()
.activeElement;
if (!activeElement) {
return false;
}
// Browsers without support for the `:focus-visible`
// selector will throw on the following test (Safari, older things).
// Some won't throw, but will be focusing item rather than the menu and
// will rely on the polyfill to know whether focus is "visible" or not.
try {
return (activeElement.matches(':focus-visible') ||
activeElement.matches('.focus-visible'));
}
catch (error) {
return activeElement.matches('.focus-visible');
}
if (dirParent === document.documentElement) {
observedForElements.add(this);
} else {
const { localName } = dirParent;
if (localName.search("-") > -1 && !customElements.get(localName)) {
customElements.whenDefined(localName).then(() => {
dirParent.startManagingContentDirection(this);
});
} else {
dirParent.startManagingContentDirection(this);
}
}
connectedCallback() {
if (!this.hasAttribute('dir')) {
let dirParent = (this.assignedSlot ||
this.parentNode);
while (dirParent !== document.documentElement &&
!canManageContentDirection(dirParent)) {
dirParent = (dirParent.assignedSlot || // step into the shadow DOM of the parent of a slotted node
dirParent.parentNode || // DOM Element detected
dirParent
.host);
}
const oldDir = this.dir;
this.dir =
dirParent.dir === 'rtl' ? dirParent.dir : this.dir || 'ltr';
if (oldDir === this.dir) {
this.setAttribute('dir', this.dir);
}
if (dirParent === document.documentElement) {
observedForElements.add(this);
}
else {
const { localName } = dirParent;
if (localName.search('-') > -1 &&
!customElements.get(localName)) {
customElements.whenDefined(localName).then(() => {
dirParent.startManagingContentDirection(this);
});
}
else {
dirParent.startManagingContentDirection(this);
}
}
this._dirParent = dirParent;
}
super.connectedCallback();
this._dirParent = dirParent;
}
super.connectedCallback();
}
disconnectedCallback() {
super.disconnectedCallback();
if (this._dirParent) {
if (this._dirParent === document.documentElement) {
observedForElements.delete(this);
} else {
this._dirParent.stopManagingContentDirection(this);
}
disconnectedCallback() {
super.disconnectedCallback();
if (this._dirParent) {
if (this._dirParent === document.documentElement) {
observedForElements.delete(this);
}
else {
this._dirParent.stopManagingContentDirection(this);
}
this.removeAttribute('dir');
}
}
this.removeAttribute("dir");
}
}
__decorate([
property({ reflect: true })
], SlotTextObservingElement.prototype, "dir", void 0);
return SlotTextObservingElement;
}
__decorateClass([
property({ reflect: true })
], SlotTextObservingElement.prototype, "dir", 2);
return SlotTextObservingElement;
}
export class SpectrumElement extends SpectrumMixin(LitElement) {
}
//# sourceMappingURL=Base.js.map
if (false) {
window.__swc = {
...window.__swc,
issuedWarnings: /* @__PURE__ */ new Set(),
issueWarning: (id, warning, url, issues) => {
var _a, _b, _c, _d, _e, _f;
if (window.__swc.issuedWarnings.has(id))
return;
window.__swc.issuedWarnings.add(id);
const [tagName, type, level] = id.split(":");
if ((_b = (_a = window.__swc) == null ? void 0 : _a.ignoreWarningLocalNames) == null ? void 0 : _b[tagName])
return;
if ((_d = (_c = window.__swc) == null ? void 0 : _c.ignoreWarningTypes) == null ? void 0 : _d[type])
return;
if ((_f = (_e = window.__swc) == null ? void 0 : _e.ignoreWarningLevels) == null ? void 0 : _f[level])
return;
let listedIssues = "";
if (issues && issues.length) {
issues.unshift("");
listedIssues = issues.join("\n -") + "\n";
}
const intro = level === "deprecation" ? "DEPRECATION NOTICE: " : "";
console.warn(intro + warning + "\n" + listedIssues + "\n" + url);
}
};
window.__swc.issueWarning("base:default:default", "Spectrum Web Components is in dev mode. Not recommended for production!", "https://opensource.adobe.com/spectrum-web-components/dev-mode/");
}
//# sourceMappingURL=Base.js.map

@@ -1,36 +0,24 @@

/*
Copyright 2020 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
export function conditionAttributeWithoutId(el, attribute, ids) {
const ariaDescribedby = el.getAttribute(attribute);
let descriptors = ariaDescribedby ? ariaDescribedby.split(/\s+/) : [];
descriptors = descriptors.filter((descriptor) => !ids.find((id) => descriptor === id));
if (descriptors.length) {
el.setAttribute(attribute, descriptors.join(' '));
}
else {
el.removeAttribute(attribute);
}
const ariaDescribedby = el.getAttribute(attribute);
let descriptors = ariaDescribedby ? ariaDescribedby.split(/\s+/) : [];
descriptors = descriptors.filter((descriptor) => !ids.find((id) => descriptor === id));
if (descriptors.length) {
el.setAttribute(attribute, descriptors.join(" "));
} else {
el.removeAttribute(attribute);
}
}
export function conditionAttributeWithId(el, attribute, id) {
const ids = Array.isArray(id) ? id : [id];
const ariaDescribedby = el.getAttribute(attribute);
const descriptors = ariaDescribedby ? ariaDescribedby.split(/\s+/) : [];
const hadIds = ids.every((id) => descriptors.indexOf(id) > -1);
if (hadIds)
return () => {
return;
};
descriptors.push(...ids);
el.setAttribute(attribute, descriptors.join(' '));
return () => conditionAttributeWithoutId(el, attribute, ids);
const ids = Array.isArray(id) ? id : [id];
const ariaDescribedby = el.getAttribute(attribute);
const descriptors = ariaDescribedby ? ariaDescribedby.split(/\s+/) : [];
const hadIds = ids.every((id2) => descriptors.indexOf(id2) > -1);
if (hadIds)
return () => {
return;
};
descriptors.push(...ids);
el.setAttribute(attribute, descriptors.join(" "));
return () => conditionAttributeWithoutId(el, attribute, ids);
}
//# sourceMappingURL=condition-attribute-with-id.js.map
//# sourceMappingURL=condition-attribute-with-id.js.map

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

/*
Copyright 2020 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
export * from 'lit/decorators.js';
//# sourceMappingURL=decorators.js.map
export * from "lit/decorators.js";
//# sourceMappingURL=decorators.js.map

@@ -1,19 +0,8 @@

/*
Copyright 2020 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
export { ifDefined } from 'lit/directives/if-defined.js';
export { repeat } from 'lit/directives/repeat.js';
export { classMap } from 'lit/directives/class-map.js';
export { styleMap } from 'lit/directives/style-map.js';
export { until } from 'lit/directives/until.js';
export { live } from 'lit/directives/live.js';
export { when } from 'lit/directives/when.js';
//# sourceMappingURL=directives.js.map
export { ifDefined } from "lit/directives/if-defined.js";
export { repeat } from "lit/directives/repeat.js";
export { classMap } from "lit/directives/class-map.js";
export { styleMap } from "lit/directives/style-map.js";
export { until } from "lit/directives/until.js";
export { live } from "lit/directives/live.js";
export { when } from "lit/directives/when.js";
//# sourceMappingURL=directives.js.map

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

/*
Copyright 2020 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
export { nothing, render } from 'lit/html.js';
//# sourceMappingURL=html.js.map
export { nothing, render } from "lit/html.js";
//# sourceMappingURL=html.js.map

@@ -1,15 +0,4 @@

/*
Copyright 2020 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
export * from './Base.js';
export * from './sizedMixin.js';
export * from 'lit';
//# sourceMappingURL=index.js.map
export * from "./Base.js";
export * from "./sizedMixin.js";
export * from "lit";
//# sourceMappingURL=index.js.map

@@ -1,47 +0,61 @@

import { __decorate } from "tslib";
import { property } from 'lit/decorators.js';
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
if (decorator = decorators[i])
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
if (kind && result)
__defProp(target, key, result);
return result;
};
import { property } from "lit/decorators.js";
export const ElementSizes = {
xxs: 'xxs',
xs: 'xs',
s: 's',
m: 'm',
l: 'l',
xl: 'xl',
xxl: 'xxl',
xxs: "xxs",
xs: "xs",
s: "s",
m: "m",
l: "l",
xl: "xl",
xxl: "xxl"
};
export function SizedMixin(constructor, { validSizes = ['s', 'm', 'l', 'xl'], noDefaultSize, defaultSize = 'm', } = {}) {
class SizedElement extends constructor {
constructor() {
super(...arguments);
this._size = defaultSize;
}
get size() {
return this._size || defaultSize;
}
set size(value) {
const fallbackSize = noDefaultSize ? null : defaultSize;
const size = (value ? value.toLocaleLowerCase() : value);
const validSize = (validSizes.includes(size) ? size : fallbackSize);
if (validSize) {
this.setAttribute('size', validSize);
}
if (this._size === validSize) {
return;
}
const oldSize = this._size;
this._size = validSize;
this.requestUpdate('size', oldSize);
}
update(changes) {
if (!this.hasAttribute('size') && !noDefaultSize) {
this.setAttribute('size', this.size);
}
super.update(changes);
}
export function SizedMixin(constructor, {
validSizes = ["s", "m", "l", "xl"],
noDefaultSize,
defaultSize = "m"
} = {}) {
class SizedElement extends constructor {
constructor() {
super(...arguments);
this._size = defaultSize;
}
__decorate([
property({ type: String, reflect: true })
], SizedElement.prototype, "size", null);
return SizedElement;
get size() {
return this._size || defaultSize;
}
set size(value) {
const fallbackSize = noDefaultSize ? null : defaultSize;
const size = value ? value.toLocaleLowerCase() : value;
const validSize = validSizes.includes(size) ? size : fallbackSize;
if (validSize) {
this.setAttribute("size", validSize);
}
if (this._size === validSize) {
return;
}
const oldSize = this._size;
this._size = validSize;
this.requestUpdate("size", oldSize);
}
update(changes) {
if (!this.hasAttribute("size") && !noDefaultSize) {
this.setAttribute("size", this.size);
}
super.update(changes);
}
}
__decorateClass([
property({ type: String, reflect: true })
], SizedElement.prototype, "size", 1);
return SizedElement;
}
//# sourceMappingURL=sizedMixin.js.map
//# sourceMappingURL=sizedMixin.js.map

@@ -1,129 +0,109 @@

/* eslint-disable @typescript-eslint/no-explicit-any */
/*
Copyright 2020 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
import { nothing } from 'lit';
import { AsyncDirective, directive } from 'lit/async-directive.js';
/* c8 ignore next 6 */
import { nothing } from "lit";
import { AsyncDirective, directive } from "lit/async-directive.js";
const defaultListener = [
'',
() => {
return;
},
"",
() => {
return;
}
];
/**
* Performantly manage listening to event in a series, like:
* - `input[type="range"]`: input, input, etc. => change
* - `sp-color-area`: pointerdown => pointermove, pointermove, etc. => pointerup
* Lazily bind events to the specific part of the series while
* throttling streamed events to 1/frame.
*/
class StreamingListenerDirective extends AsyncDirective {
constructor() {
super(...arguments);
this.start = defaultListener;
this.streamInside = defaultListener;
this.end = defaultListener;
this.streamOutside = defaultListener;
this.state = 'off';
this.handleStart = (event) => {
this.callHandler(this.start[1], event);
if (event.defaultPrevented) {
return;
}
this.removeListeners();
this.addListeners('on');
};
this.handleStream = (event) => {
this.callHandler(this.streamInside[1], event);
};
this.handleEnd = (event) => {
this.callHandler(this.end[1], event);
this.removeListeners();
this.addListeners('off');
};
this.handleBetween = (event) => {
this.callHandler(this.streamOutside[1], event);
};
constructor() {
super(...arguments);
this.start = defaultListener;
this.streamInside = defaultListener;
this.end = defaultListener;
this.streamOutside = defaultListener;
this.state = "off";
this.handleStart = (event) => {
this.callHandler(this.start[1], event);
if (event.defaultPrevented) {
return;
}
this.removeListeners();
this.addListeners("on");
};
this.handleStream = (event) => {
this.callHandler(this.streamInside[1], event);
};
this.handleEnd = (event) => {
this.callHandler(this.end[1], event);
this.removeListeners();
this.addListeners("off");
};
this.handleBetween = (event) => {
this.callHandler(this.streamOutside[1], event);
};
}
render(_configGroup) {
return nothing;
}
update(part, [
{
start,
end,
streamInside = defaultListener,
streamOutside = defaultListener
}
/* c8 ignore next 4 */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
render(_configGroup) {
return nothing;
]) {
var _a;
if (this.element !== part.element) {
this.element = part.element;
this.removeListeners();
}
update(part, [{ start, end, streamInside = defaultListener, streamOutside = defaultListener, },]) {
var _a;
if (this.element !== part.element) {
this.element = part.element;
this.removeListeners();
}
this.host =
((_a = part.options) === null || _a === void 0 ? void 0 : _a.host) || this.element;
this.start = start;
this.end = end;
this.streamInside = streamInside;
this.streamOutside = streamOutside;
this.addListeners();
this.host = ((_a = part.options) == null ? void 0 : _a.host) || this.element;
this.start = start;
this.end = end;
this.streamInside = streamInside;
this.streamOutside = streamOutside;
this.addListeners();
}
addListeners(state) {
this.state = state || this.state;
if (this.state === "off") {
this.addListener(this.streamOutside[0], this.handleBetween);
this.addListener(this.start[0], this.handleStart);
} else if (this.state === "on") {
this.addListener(this.streamInside[0], this.handleStream);
this.addListener(this.end[0], this.handleEnd);
}
addListeners(state) {
this.state = state || this.state;
if (this.state === 'off') {
this.addListener(this.streamOutside[0], this.handleBetween);
this.addListener(this.start[0], this.handleStart);
}
else if (this.state === 'on') {
this.addListener(this.streamInside[0], this.handleStream);
this.addListener(this.end[0], this.handleEnd);
}
}
callHandler(value, event) {
if (typeof value === "function") {
value.call(this.host, event);
} else {
value.handleEvent(event);
}
callHandler(value, event) {
if (typeof value === 'function') {
value.call(this.host, event);
}
else {
value.handleEvent(event);
}
}
addListener(type, fn) {
if (Array.isArray(type)) {
type.map((eventName) => {
this.element.addEventListener(eventName, fn);
});
} else {
this.element.addEventListener(type, fn);
}
addListener(type, fn) {
if (Array.isArray(type)) {
type.map((eventName) => {
this.element.addEventListener(eventName, fn);
});
}
else {
this.element.addEventListener(type, fn);
}
}
removeListener(type, fn) {
if (Array.isArray(type)) {
type.map((eventName) => {
this.element.removeEventListener(eventName, fn);
});
} else {
this.element.removeEventListener(type, fn);
}
removeListener(type, fn) {
if (Array.isArray(type)) {
type.map((eventName) => {
this.element.removeEventListener(eventName, fn);
});
}
else {
this.element.removeEventListener(type, fn);
}
}
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();
}
}
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 = directive(StreamingListenerDirective);
//# sourceMappingURL=streaming-listener.js.map
//# sourceMappingURL=streaming-listener.js.map

@@ -1,30 +0,20 @@

/*
Copyright 2020 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
import { SpectrumElement } from '../';
import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
import { SpectrumElement } from "@spectrum-web-components/base";
import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
class DirElement extends SpectrumElement {
}
customElements.define('dir-element', DirElement);
describe('Base', () => {
after(() => {
document.dir = '';
});
it('sets `dir` from `document`', async () => {
document.dir = 'rtl';
const el = await fixture(html `
customElements.define("dir-element", DirElement);
describe("Base", () => {
after(() => {
document.dir = "";
});
it("sets `dir` from `document`", async () => {
document.dir = "rtl";
const el = await fixture(html`
<dir-element></dir-element>
`);
await elementUpdated(el);
expect(el.dir).to.equal('rtl');
expect(el.isLTR).to.be.false;
});
await elementUpdated(el);
expect(el.dir).to.equal("rtl");
expect(el.isLTR).to.be.false;
});
});
//# sourceMappingURL=base.test.js.map
//# sourceMappingURL=base.test.js.map

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