Archived
Template
1
Fork 0
This repository has been archived on 2024-09-04. You can view files and clone it, but cannot push or open issues or pull requests.
Contour/public/@shoelace-style/shoelace/cdn/chunks/chunk.RQ7JZ4R7.js

28 lines
987 B
JavaScript
Raw Permalink Normal View History

2024-01-30 10:59:28 -05:00
import {
u
} from "./chunk.CXZZ2LVK.js";
// src/internal/default-value.ts
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 || u;
const fromAttribute = typeof converter === "function" ? converter : (_a = converter == null ? void 0 : converter.fromAttribute) != null ? _a : u.fromAttribute;
const newValue = fromAttribute(value, options.type);
if (this[propertyName] !== newValue) {
this[key] = newValue;
}
}
attributeChangedCallback.call(this, name, old, value);
};
};
export {
defaultValue
};