UNPKG

@synergy-design-system/components

Version:

This package provides the base of the Synergy Design System as native web components. It uses [lit](https://www.lit.dev) and parts of [shoelace](https://shoelace.style/). Synergy officially supports the latest two versions of all major browsers (as define

97 lines (94 loc) 3.09 kB
import { __decorateClass, __privateAdd, __privateGet, __privateSet, __spreadValues } from "./chunk.Z4XV3SMG.js"; // src/internal/synergy-element.ts import { LitElement } from "lit"; import { property } from "lit/decorators.js"; var _hasRecordedInitialProperties; var SynergyElement = class extends LitElement { constructor() { super(); __privateAdd(this, _hasRecordedInitialProperties, false); // Store the constructor value of all `static properties = {}` this.initialReflectedProperties = /* @__PURE__ */ new Map(); Object.entries(this.constructor.dependencies).forEach(([name, component]) => { this.constructor.define(name, component); }); } emit(name, options) { const event = new CustomEvent(name, __spreadValues({ bubbles: true, cancelable: false, composed: true, detail: {} }, options)); this.dispatchEvent(event); return event; } static define(name, elementConstructor = this, options = {}) { const currentlyRegisteredConstructor = customElements.get(name); if (!currentlyRegisteredConstructor) { try { customElements.define(name, elementConstructor, options); } catch (_err) { customElements.define(name, class extends elementConstructor { }, options); } return; } let newVersion = " (unknown version)"; let existingVersion = newVersion; if ("version" in elementConstructor && elementConstructor.version) { newVersion = " v" + elementConstructor.version; } if ("version" in currentlyRegisteredConstructor && currentlyRegisteredConstructor.version) { existingVersion = " v" + currentlyRegisteredConstructor.version; } if (newVersion && existingVersion && newVersion === existingVersion) { return; } console.warn( `Attempted to register <${name}>${newVersion}, but <${name}>${existingVersion} has already been registered.` ); } attributeChangedCallback(name, oldValue, newValue) { if (!__privateGet(this, _hasRecordedInitialProperties)) { this.constructor.elementProperties.forEach( (obj, prop) => { if (obj.reflect && this[prop] != null) { this.initialReflectedProperties.set(prop, this[prop]); } } ); __privateSet(this, _hasRecordedInitialProperties, true); } super.attributeChangedCallback(name, oldValue, newValue); } willUpdate(changedProperties) { super.willUpdate(changedProperties); this.initialReflectedProperties.forEach((value, prop) => { if (changedProperties.has(prop) && this[prop] == null) { this[prop] = value; } }); } }; _hasRecordedInitialProperties = new WeakMap(); /* eslint-disable */ // @ts-expect-error This is auto-injected at build time. SynergyElement.version = "2.77.0"; SynergyElement.dependencies = {}; __decorateClass([ property() ], SynergyElement.prototype, "dir", 2); __decorateClass([ property() ], SynergyElement.prototype, "lang", 2); export { SynergyElement }; //# sourceMappingURL=chunk.3THJTCRO.js.map