@peektravel/app-utilities 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -14
- package/dist/index.cjs +102 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +76 -5
- package/dist/index.d.ts +76 -5
- package/dist/index.js +101 -40
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +35 -1
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +35 -1
- package/dist/ui/index.js.map +1 -1
- package/docs/ui.md +26 -2
- package/docs/webhooks.md +80 -9
- package/llms.txt +28 -9
- package/package.json +1 -1
package/dist/ui/index.cjs
CHANGED
|
@@ -162,9 +162,43 @@ function classes(...parts) {
|
|
|
162
162
|
function reflectControlValue(control, value) {
|
|
163
163
|
if (control && control.value !== value) control.value = value;
|
|
164
164
|
}
|
|
165
|
+
function attrNameFor(propName) {
|
|
166
|
+
return propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
167
|
+
}
|
|
168
|
+
function reflectToAttribute(el, attr, value) {
|
|
169
|
+
if (value === null || value === void 0 || value === false) {
|
|
170
|
+
el.removeAttribute(attr);
|
|
171
|
+
} else if (value === true) {
|
|
172
|
+
el.setAttribute(attr, "");
|
|
173
|
+
} else if (typeof value === "object") {
|
|
174
|
+
el.setAttribute(attr, JSON.stringify(value));
|
|
175
|
+
} else {
|
|
176
|
+
el.setAttribute(attr, String(value));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function addReactSafeSetters(ctor) {
|
|
180
|
+
const observed = new Set(
|
|
181
|
+
ctor.observedAttributes ?? []
|
|
182
|
+
);
|
|
183
|
+
let proto = ctor.prototype;
|
|
184
|
+
while (proto && proto !== OdyElement.prototype && proto !== HTMLElement.prototype && proto !== Object.prototype) {
|
|
185
|
+
for (const [name, desc] of Object.entries(Object.getOwnPropertyDescriptors(proto))) {
|
|
186
|
+
if (typeof desc.get !== "function" || desc.set) continue;
|
|
187
|
+
const attr = attrNameFor(name);
|
|
188
|
+
const set = observed.has(attr) ? function reflectingSetter(value) {
|
|
189
|
+
reflectToAttribute(this, attr, value);
|
|
190
|
+
} : function ignoringSetter() {
|
|
191
|
+
};
|
|
192
|
+
Object.defineProperty(proto, name, { ...desc, set });
|
|
193
|
+
}
|
|
194
|
+
proto = Object.getPrototypeOf(proto);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
165
197
|
function define(tag, ctor) {
|
|
166
198
|
if (typeof customElements === "undefined") return;
|
|
167
|
-
if (
|
|
199
|
+
if (customElements.get(tag)) return;
|
|
200
|
+
addReactSafeSetters(ctor);
|
|
201
|
+
customElements.define(tag, ctor);
|
|
168
202
|
}
|
|
169
203
|
|
|
170
204
|
// src/ui/icons-data.ts
|