UNPKG

ranui

Version:

A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.

45 lines (44 loc) 1.45 kB
import { a, n as o, o as i, r as n, t as h } from "./utils-D1iZnChu.js"; import { _ as l, p as m } from "./factory-ZNhcQ4tf.js"; import { a as u, n as f } from "./ssr-DSGwPtEd.js"; var c = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}", d = class extends f { _form; _shadowDom; static get observedAttributes() { return ["sheet"]; } constructor() { super(), this._shadowDom = o(this, c), this._form = h(this._shadowDom, ".r-form", () => l("form").class("r-form").children(m().attr("name", "r-form_content")).build()); } get value() { return this.getAttribute("value"); } set value(t) { t != null && this.setAttribute("value", t); } get sheet() { return n(this, "sheet"); } set sheet(t) { a(this, "sheet", t); } handlerExternalCss = () => { i(this, this._shadowDom, "sheet", null, this.sheet); }; connectedCallback() { this.handlerExternalCss(); const t = {}, e = new FormData(this._form); e.forEach((r, s) => { t[s] || (t[s] = e.getAll(s).length > 1 ? e.getAll(s) : e.get(s)); }), this._form.addEventListener("submit", () => { this.value = JSON.stringify(t); }); } attributeChangedCallback(t, e, r) { e !== r && t === "sheet" && this.handlerExternalCss(); } }; u("r-form", d); export { d as t };