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

26 lines (24 loc) 1.06 kB
// src/internal/default-value.ts import { defaultConverter } from "lit"; var defaultValue = (propertyName = "value") => (proto, key) => { const ctor = proto.constructor; const attributeChangedCallback = ctor.prototype.attributeChangedCallback; ctor.prototype.attributeChangedCallback = function(name, old, value) { var _a; const options = ctor.getPropertyOptions(propertyName); const attributeName = typeof options.attribute === "string" ? options.attribute : propertyName; if (name === attributeName) { const converter = options.converter || defaultConverter; const fromAttribute = typeof converter === "function" ? converter : (_a = converter == null ? void 0 : converter.fromAttribute) != null ? _a : defaultConverter.fromAttribute; const newValue = fromAttribute(value, options.type); if (this[propertyName] !== newValue) { this[key] = newValue; } } attributeChangedCallback.call(this, name, old, value); }; }; export { defaultValue }; //# sourceMappingURL=chunk.3NXKLKWH.js.map