@bquery/bquery 1.4.0 → 1.6.0
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 +586 -527
- package/dist/component/component.d.ts +13 -5
- package/dist/component/component.d.ts.map +1 -1
- package/dist/component/html.d.ts +40 -3
- package/dist/component/html.d.ts.map +1 -1
- package/dist/component/index.d.ts +4 -2
- package/dist/component/index.d.ts.map +1 -1
- package/dist/component/library.d.ts +34 -0
- package/dist/component/library.d.ts.map +1 -0
- package/dist/component/types.d.ts +132 -13
- package/dist/component/types.d.ts.map +1 -1
- package/dist/component-BEQgt5hl.js +600 -0
- package/dist/component-BEQgt5hl.js.map +1 -0
- package/dist/component.es.mjs +7 -184
- package/dist/config-DRmZZno3.js +40 -0
- package/dist/config-DRmZZno3.js.map +1 -0
- package/dist/core-BGQJVw0-.js +35 -0
- package/dist/core-BGQJVw0-.js.map +1 -0
- package/dist/core-CCEabVHl.js +648 -0
- package/dist/core-CCEabVHl.js.map +1 -0
- package/dist/core.es.mjs +45 -1261
- package/dist/effect-AFRW_Plg.js +84 -0
- package/dist/effect-AFRW_Plg.js.map +1 -0
- package/dist/full.d.ts +8 -8
- package/dist/full.d.ts.map +1 -1
- package/dist/full.es.mjs +101 -91
- package/dist/full.iife.js +173 -3
- package/dist/full.iife.js.map +1 -1
- package/dist/full.umd.js +173 -3
- package/dist/full.umd.js.map +1 -1
- package/dist/index.es.mjs +147 -139
- package/dist/motion/transition.d.ts +1 -1
- package/dist/motion/transition.d.ts.map +1 -1
- package/dist/motion/types.d.ts +11 -1
- package/dist/motion/types.d.ts.map +1 -1
- package/dist/motion-D9TcHxOF.js +415 -0
- package/dist/motion-D9TcHxOF.js.map +1 -0
- package/dist/motion.es.mjs +25 -361
- package/dist/object-qGpWr6-J.js +38 -0
- package/dist/object-qGpWr6-J.js.map +1 -0
- package/dist/platform/announcer.d.ts +59 -0
- package/dist/platform/announcer.d.ts.map +1 -0
- package/dist/platform/config.d.ts +92 -0
- package/dist/platform/config.d.ts.map +1 -0
- package/dist/platform/cookies.d.ts +45 -0
- package/dist/platform/cookies.d.ts.map +1 -0
- package/dist/platform/index.d.ts +8 -0
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/meta.d.ts +62 -0
- package/dist/platform/meta.d.ts.map +1 -0
- package/dist/platform-Dr9b6fsq.js +362 -0
- package/dist/platform-Dr9b6fsq.js.map +1 -0
- package/dist/platform.es.mjs +11 -248
- package/dist/reactive/async-data.d.ts +114 -0
- package/dist/reactive/async-data.d.ts.map +1 -0
- package/dist/reactive/index.d.ts +2 -2
- package/dist/reactive/index.d.ts.map +1 -1
- package/dist/reactive/signal.d.ts +2 -0
- package/dist/reactive/signal.d.ts.map +1 -1
- package/dist/reactive-DSkct0dO.js +254 -0
- package/dist/reactive-DSkct0dO.js.map +1 -0
- package/dist/reactive.es.mjs +18 -32
- package/dist/router-CbDhl8rS.js +188 -0
- package/dist/router-CbDhl8rS.js.map +1 -0
- package/dist/router.es.mjs +11 -200
- package/dist/sanitize-Bs2dkMby.js +313 -0
- package/dist/sanitize-Bs2dkMby.js.map +1 -0
- package/dist/security/constants.d.ts.map +1 -1
- package/dist/security/index.d.ts +4 -2
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/sanitize.d.ts +4 -1
- package/dist/security/sanitize.d.ts.map +1 -1
- package/dist/security/trusted-html.d.ts +53 -0
- package/dist/security/trusted-html.d.ts.map +1 -0
- package/dist/security.es.mjs +11 -56
- package/dist/store/define-store.d.ts +1 -1
- package/dist/store/define-store.d.ts.map +1 -1
- package/dist/store/mapping.d.ts +1 -1
- package/dist/store/mapping.d.ts.map +1 -1
- package/dist/store/persisted.d.ts +1 -1
- package/dist/store/persisted.d.ts.map +1 -1
- package/dist/store/types.d.ts +2 -2
- package/dist/store/types.d.ts.map +1 -1
- package/dist/store/watch.d.ts +1 -1
- package/dist/store/watch.d.ts.map +1 -1
- package/dist/store-BwDvI45q.js +263 -0
- package/dist/store-BwDvI45q.js.map +1 -0
- package/dist/store.es.mjs +12 -25
- package/dist/storybook/index.d.ts +37 -0
- package/dist/storybook/index.d.ts.map +1 -0
- package/dist/storybook.es.mjs +151 -0
- package/dist/storybook.es.mjs.map +1 -0
- package/dist/untrack-B0rVscTc.js +7 -0
- package/dist/untrack-B0rVscTc.js.map +1 -0
- package/dist/view-C70lA3vf.js +397 -0
- package/dist/view-C70lA3vf.js.map +1 -0
- package/dist/view.es.mjs +11 -430
- package/package.json +141 -132
- package/src/component/component.ts +524 -289
- package/src/component/html.ts +153 -53
- package/src/component/index.ts +50 -40
- package/src/component/library.ts +518 -0
- package/src/component/types.ts +256 -85
- package/src/core/collection.ts +628 -628
- package/src/core/element.ts +774 -774
- package/src/core/index.ts +48 -48
- package/src/core/utils/function.ts +151 -151
- package/src/full.ts +229 -187
- package/src/motion/animate.ts +113 -113
- package/src/motion/flip.ts +176 -176
- package/src/motion/scroll.ts +57 -57
- package/src/motion/spring.ts +150 -150
- package/src/motion/timeline.ts +246 -246
- package/src/motion/transition.ts +97 -51
- package/src/motion/types.ts +11 -1
- package/src/platform/announcer.ts +208 -0
- package/src/platform/config.ts +163 -0
- package/src/platform/cookies.ts +165 -0
- package/src/platform/index.ts +21 -0
- package/src/platform/meta.ts +168 -0
- package/src/platform/storage.ts +215 -215
- package/src/reactive/async-data.ts +486 -0
- package/src/reactive/core.ts +114 -114
- package/src/reactive/effect.ts +54 -54
- package/src/reactive/index.ts +15 -1
- package/src/reactive/internals.ts +122 -122
- package/src/reactive/signal.ts +9 -0
- package/src/security/constants.ts +3 -1
- package/src/security/index.ts +17 -10
- package/src/security/sanitize-core.ts +364 -364
- package/src/security/sanitize.ts +70 -66
- package/src/security/trusted-html.ts +71 -0
- package/src/store/define-store.ts +49 -48
- package/src/store/mapping.ts +74 -73
- package/src/store/persisted.ts +62 -61
- package/src/store/types.ts +92 -94
- package/src/store/watch.ts +53 -52
- package/src/storybook/index.ts +479 -0
- package/src/view/evaluate.ts +290 -290
- package/dist/batch-x7b2eZST.js +0 -13
- package/dist/batch-x7b2eZST.js.map +0 -1
- package/dist/component.es.mjs.map +0 -1
- package/dist/core-BhpuvPhy.js +0 -170
- package/dist/core-BhpuvPhy.js.map +0 -1
- package/dist/core.es.mjs.map +0 -1
- package/dist/full.es.mjs.map +0 -1
- package/dist/index.es.mjs.map +0 -1
- package/dist/motion.es.mjs.map +0 -1
- package/dist/persisted-DHoi3uEs.js +0 -278
- package/dist/persisted-DHoi3uEs.js.map +0 -1
- package/dist/platform.es.mjs.map +0 -1
- package/dist/reactive.es.mjs.map +0 -1
- package/dist/router.es.mjs.map +0 -1
- package/dist/sanitize-Cxvxa-DX.js +0 -283
- package/dist/sanitize-Cxvxa-DX.js.map +0 -1
- package/dist/security.es.mjs.map +0 -1
- package/dist/store.es.mjs.map +0 -1
- package/dist/type-guards-BdKlYYlS.js +0 -32
- package/dist/type-guards-BdKlYYlS.js.map +0 -1
- package/dist/untrack-DNnnqdlR.js +0 -6
- package/dist/untrack-DNnnqdlR.js.map +0 -1
- package/dist/view.es.mjs.map +0 -1
- package/dist/watch-DXXv3iAI.js +0 -58
- package/dist/watch-DXXv3iAI.js.map +0 -1
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
import { f as A, l as q, n as z, t as _, u as M } from "./sanitize-Bs2dkMby.js";
|
|
2
|
+
import { t as O } from "./effect-AFRW_Plg.js";
|
|
3
|
+
import { n as B } from "./config-DRmZZno3.js";
|
|
4
|
+
import { t as E } from "./untrack-B0rVscTc.js";
|
|
5
|
+
var H = (r, t) => {
|
|
6
|
+
const { type: a } = t;
|
|
7
|
+
if (a === String) return r;
|
|
8
|
+
if (a === Number) return Number(r);
|
|
9
|
+
if (a === Boolean) {
|
|
10
|
+
const e = r.trim().toLowerCase();
|
|
11
|
+
return e === "" || e === "true" || e === "1" ? !0 : e === "false" || e === "0" ? !1 : !!r;
|
|
12
|
+
}
|
|
13
|
+
if (a === Object || a === Array) try {
|
|
14
|
+
return JSON.parse(r);
|
|
15
|
+
} catch {
|
|
16
|
+
return r;
|
|
17
|
+
}
|
|
18
|
+
if (typeof a == "function") {
|
|
19
|
+
const e = a, n = a;
|
|
20
|
+
if (t.construct === !0) return Reflect.construct(n, [r]);
|
|
21
|
+
if (t.construct === !1) return e(r);
|
|
22
|
+
const l = a.prototype !== void 0 && a.prototype !== null, x = (l ? Object.getOwnPropertyNames(a.prototype) : []).length > 1, s = l && a.prototype.constructor !== a, i = /^class\s/.test(Function.prototype.toString.call(a));
|
|
23
|
+
if (x || s || i) try {
|
|
24
|
+
return Reflect.construct(n, [r]);
|
|
25
|
+
} catch {
|
|
26
|
+
return e(r);
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const o = e(r);
|
|
30
|
+
if (o === void 0 && l) try {
|
|
31
|
+
return Reflect.construct(n, [r]);
|
|
32
|
+
} catch {
|
|
33
|
+
return o;
|
|
34
|
+
}
|
|
35
|
+
return o;
|
|
36
|
+
} catch (o) {
|
|
37
|
+
if (o instanceof TypeError && /cannot be invoked without 'new'|is not a function/i.test(o.message)) return Reflect.construct(n, [r]);
|
|
38
|
+
throw o;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return r;
|
|
42
|
+
}, L = ["slot"], I = [
|
|
43
|
+
"part",
|
|
44
|
+
"disabled",
|
|
45
|
+
"checked",
|
|
46
|
+
"placeholder",
|
|
47
|
+
"value",
|
|
48
|
+
"rows",
|
|
49
|
+
"cols",
|
|
50
|
+
"readonly",
|
|
51
|
+
"required",
|
|
52
|
+
"maxlength",
|
|
53
|
+
"minlength",
|
|
54
|
+
"max",
|
|
55
|
+
"min",
|
|
56
|
+
"step",
|
|
57
|
+
"pattern",
|
|
58
|
+
"autocomplete",
|
|
59
|
+
"autofocus",
|
|
60
|
+
"for",
|
|
61
|
+
"multiple",
|
|
62
|
+
"selected",
|
|
63
|
+
"wrap"
|
|
64
|
+
], S = (r, t) => {
|
|
65
|
+
const a = [...L, ...t.sanitize?.allowTags ?? []], e = [...I, ...t.sanitize?.allowAttributes ?? []], n = Object.values(t.signals ?? {});
|
|
66
|
+
class l extends HTMLElement {
|
|
67
|
+
constructor() {
|
|
68
|
+
super(), this.state = { ...t.state ?? {} }, this.props = {}, this.missingRequiredProps = /* @__PURE__ */ new Set(), this.hasMounted = !1, this.attachShadow({ mode: "open" }), this.syncProps();
|
|
69
|
+
}
|
|
70
|
+
static get observedAttributes() {
|
|
71
|
+
return Object.keys(t.props ?? {});
|
|
72
|
+
}
|
|
73
|
+
connectedCallback() {
|
|
74
|
+
try {
|
|
75
|
+
if (!this.hasMounted && this.missingRequiredProps.size > 0) return;
|
|
76
|
+
if (this.hasMounted) {
|
|
77
|
+
try {
|
|
78
|
+
t.connected?.call(this);
|
|
79
|
+
} catch (s) {
|
|
80
|
+
this.handleError(s);
|
|
81
|
+
}
|
|
82
|
+
this.setupSignalSubscriptions(!0);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this.mount();
|
|
86
|
+
} catch (s) {
|
|
87
|
+
this.handleError(s);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
mount() {
|
|
91
|
+
this.hasMounted || (t.beforeMount?.call(this), t.connected?.call(this), this.render(), this.setupSignalSubscriptions(), this.hasMounted = !0);
|
|
92
|
+
}
|
|
93
|
+
disconnectedCallback() {
|
|
94
|
+
try {
|
|
95
|
+
this.signalEffectCleanup?.(), this.signalEffectCleanup = void 0, t.disconnected?.call(this);
|
|
96
|
+
} catch (s) {
|
|
97
|
+
this.handleError(s);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
attributeChangedCallback(s, i, o) {
|
|
101
|
+
try {
|
|
102
|
+
const u = this.cloneProps();
|
|
103
|
+
this.syncProps(), this.hasMounted ? this.render(!0, u, {
|
|
104
|
+
name: s,
|
|
105
|
+
oldValue: i,
|
|
106
|
+
newValue: o
|
|
107
|
+
}) : this.isConnected && this.missingRequiredProps.size === 0 && this.mount();
|
|
108
|
+
} catch (u) {
|
|
109
|
+
this.handleError(u);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
handleError(s) {
|
|
113
|
+
t.onError ? t.onError.call(this, s) : console.error(`bQuery component error in <${r}>:`, s);
|
|
114
|
+
}
|
|
115
|
+
setState(s, i) {
|
|
116
|
+
this.state[s] = i, this.render(!0, this.cloneProps(), void 0, !1);
|
|
117
|
+
}
|
|
118
|
+
getState(s) {
|
|
119
|
+
return this.state[s];
|
|
120
|
+
}
|
|
121
|
+
setupSignalSubscriptions(s = !1) {
|
|
122
|
+
if (this.signalEffectCleanup || n.length === 0) return;
|
|
123
|
+
let i = !0;
|
|
124
|
+
this.signalEffectCleanup = O(() => {
|
|
125
|
+
try {
|
|
126
|
+
for (const u of n) u.value;
|
|
127
|
+
if (i) {
|
|
128
|
+
if (i = !1, s && this.hasMounted && this.isConnected) {
|
|
129
|
+
const u = this.cloneProps();
|
|
130
|
+
E(() => {
|
|
131
|
+
this.render(!0, u, void 0, !1);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (!this.hasMounted || !this.isConnected) return;
|
|
137
|
+
const o = this.cloneProps();
|
|
138
|
+
E(() => {
|
|
139
|
+
this.render(!0, o, void 0, !1);
|
|
140
|
+
});
|
|
141
|
+
} catch (o) {
|
|
142
|
+
this.handleError(o);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
syncProps() {
|
|
147
|
+
const s = t.props ?? {};
|
|
148
|
+
for (const [i, o] of Object.entries(s)) {
|
|
149
|
+
const u = this.getAttribute(i);
|
|
150
|
+
let d;
|
|
151
|
+
if (u == null ? o.required && o.default === void 0 ? (this.missingRequiredProps.add(i), d = void 0) : d = o.default ?? void 0 : (this.missingRequiredProps.has(i) && this.missingRequiredProps.delete(i), d = H(u, o)), o.validator && d !== void 0 && !o.validator(d))
|
|
152
|
+
throw new Error(`bQuery component: validation failed for prop "${i}" with value ${JSON.stringify(d)}`);
|
|
153
|
+
this.props[i] = d;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
cloneProps() {
|
|
157
|
+
return { ...this.props };
|
|
158
|
+
}
|
|
159
|
+
render(s = !1, i, o, u = !0) {
|
|
160
|
+
try {
|
|
161
|
+
if (s && u && t.beforeUpdate) {
|
|
162
|
+
if (!i) throw new Error("bQuery component: previous props are required for update renders");
|
|
163
|
+
if (t.beforeUpdate.call(this, this.props, i) === !1) return;
|
|
164
|
+
}
|
|
165
|
+
const d = (h, T) => {
|
|
166
|
+
this.dispatchEvent(new CustomEvent(h, {
|
|
167
|
+
detail: T,
|
|
168
|
+
bubbles: !0,
|
|
169
|
+
composed: !0
|
|
170
|
+
}));
|
|
171
|
+
};
|
|
172
|
+
if (!this.shadowRoot) return;
|
|
173
|
+
const R = z(t.render({
|
|
174
|
+
props: this.props,
|
|
175
|
+
state: this.state,
|
|
176
|
+
signals: t.signals ?? {},
|
|
177
|
+
emit: d
|
|
178
|
+
}), {
|
|
179
|
+
allowTags: a,
|
|
180
|
+
allowAttributes: e
|
|
181
|
+
});
|
|
182
|
+
let m = null;
|
|
183
|
+
if (t.styles && (m = this.shadowRoot.querySelector("style[data-bquery-component-style]")), this.shadowRoot.innerHTML = R, t.styles) {
|
|
184
|
+
const h = m ?? document.createElement("style");
|
|
185
|
+
m || h.setAttribute("data-bquery-component-style", ""), h.textContent = t.styles, this.shadowRoot.prepend(h);
|
|
186
|
+
}
|
|
187
|
+
s && t.updated?.call(this, o);
|
|
188
|
+
} catch (d) {
|
|
189
|
+
this.handleError(d);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return l;
|
|
194
|
+
};
|
|
195
|
+
function K(r, t) {
|
|
196
|
+
return S(r, t);
|
|
197
|
+
}
|
|
198
|
+
function f(r, t) {
|
|
199
|
+
const a = S(r, t);
|
|
200
|
+
customElements.get(r) || customElements.define(r, a);
|
|
201
|
+
}
|
|
202
|
+
var k = /* @__PURE__ */ Symbol("bquery.booleanAttribute"), N = /^[^\0-\x20"'/>=]+$/, C = (r) => {
|
|
203
|
+
if (typeof r != "object" || r === null) return !1;
|
|
204
|
+
const t = r;
|
|
205
|
+
return t[k] === !0 && typeof t.enabled == "boolean" && typeof t.name == "string";
|
|
206
|
+
}, w = (r) => C(r) ? r.enabled ? r.name : "" : String(r ?? ""), j = {
|
|
207
|
+
"&": "&",
|
|
208
|
+
"<": "<",
|
|
209
|
+
">": ">",
|
|
210
|
+
'"': """,
|
|
211
|
+
"'": "'",
|
|
212
|
+
"`": "`"
|
|
213
|
+
}, P = (r) => C(r) ? r.enabled ? r.name : "" : w(r).replace(/[&<>"'`]/g, (t) => j[t]), Y = (r, t) => {
|
|
214
|
+
if (!N.test(r)) throw new TypeError(`Invalid boolean attribute name: ${r}`);
|
|
215
|
+
const a = {
|
|
216
|
+
[k]: !0,
|
|
217
|
+
enabled: !!t,
|
|
218
|
+
name: r
|
|
219
|
+
};
|
|
220
|
+
return Object.freeze(a);
|
|
221
|
+
}, p = (r, ...t) => r.reduce((a, e, n) => `${a}${e}${w(t[n])}`, ""), X = (r, ...t) => {
|
|
222
|
+
const a = (e) => q(e) ? A(e) : P(e);
|
|
223
|
+
return M(r.reduce((e, n, l) => `${e}${n}${l < t.length ? a(t[l]) : ""}`, ""));
|
|
224
|
+
}, b = `
|
|
225
|
+
:host {
|
|
226
|
+
color: inherit;
|
|
227
|
+
font: inherit;
|
|
228
|
+
}
|
|
229
|
+
`, $ = `
|
|
230
|
+
${b}
|
|
231
|
+
.field {
|
|
232
|
+
display: inline-flex;
|
|
233
|
+
flex-direction: column;
|
|
234
|
+
gap: 0.375rem;
|
|
235
|
+
width: 100%;
|
|
236
|
+
}
|
|
237
|
+
.label {
|
|
238
|
+
color: #334155;
|
|
239
|
+
font-size: 0.875rem;
|
|
240
|
+
font-weight: 600;
|
|
241
|
+
}
|
|
242
|
+
.control {
|
|
243
|
+
border: 1px solid #cbd5e1;
|
|
244
|
+
border-radius: 0.75rem;
|
|
245
|
+
box-sizing: border-box;
|
|
246
|
+
font: inherit;
|
|
247
|
+
min-height: 2.75rem;
|
|
248
|
+
outline: none;
|
|
249
|
+
padding: 0.75rem 0.875rem;
|
|
250
|
+
width: 100%;
|
|
251
|
+
background: #fff;
|
|
252
|
+
color: #0f172a;
|
|
253
|
+
transition: border-color 160ms ease, box-shadow 160ms ease;
|
|
254
|
+
}
|
|
255
|
+
.control:focus {
|
|
256
|
+
border-color: #2563eb;
|
|
257
|
+
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
|
|
258
|
+
}
|
|
259
|
+
.control:disabled {
|
|
260
|
+
background: #f8fafc;
|
|
261
|
+
color: #94a3b8;
|
|
262
|
+
cursor: not-allowed;
|
|
263
|
+
}
|
|
264
|
+
`, c = (r) => _(r), v = /* @__PURE__ */ new WeakMap(), y = (r, t) => v.get(r)?.[t], g = (r, t, a) => {
|
|
265
|
+
const e = v.get(r) ?? {};
|
|
266
|
+
e[t] = a, v.set(r, e);
|
|
267
|
+
}, U = (r, t, a) => {
|
|
268
|
+
if (a.label !== t.label || a.type !== t.type || a.placeholder !== t.placeholder || a.name !== t.name || a.disabled !== t.disabled) return !1;
|
|
269
|
+
const e = r.shadowRoot?.querySelector("input.control");
|
|
270
|
+
return e ? (e.value !== t.value && (e.value = t.value), !0) : !1;
|
|
271
|
+
}, Q = (r, t, a) => {
|
|
272
|
+
if (a.label !== t.label || a.placeholder !== t.placeholder || a.name !== t.name || a.rows !== t.rows || a.disabled !== t.disabled) return !1;
|
|
273
|
+
const e = r.shadowRoot?.querySelector("textarea.control");
|
|
274
|
+
return e ? (e.value !== t.value && (e.value = t.value), !0) : !1;
|
|
275
|
+
}, D = (r) => [
|
|
276
|
+
"<textarea",
|
|
277
|
+
' part="control"',
|
|
278
|
+
' class="control"',
|
|
279
|
+
` placeholder="${c(r.placeholder)}"`,
|
|
280
|
+
` name="${c(r.name)}"`,
|
|
281
|
+
` rows="${r.rows}"`,
|
|
282
|
+
r.disabled ? " disabled" : "",
|
|
283
|
+
`>${c(r.value)}</textarea>`
|
|
284
|
+
].join(""), Z = (r = {}) => {
|
|
285
|
+
const t = r.prefix ?? B().components?.prefix ?? "bq", a = {
|
|
286
|
+
button: `${t}-button`,
|
|
287
|
+
card: `${t}-card`,
|
|
288
|
+
input: `${t}-input`,
|
|
289
|
+
textarea: `${t}-textarea`,
|
|
290
|
+
checkbox: `${t}-checkbox`
|
|
291
|
+
};
|
|
292
|
+
return f(a.button, {
|
|
293
|
+
props: {
|
|
294
|
+
label: {
|
|
295
|
+
type: String,
|
|
296
|
+
default: ""
|
|
297
|
+
},
|
|
298
|
+
variant: {
|
|
299
|
+
type: String,
|
|
300
|
+
default: "primary"
|
|
301
|
+
},
|
|
302
|
+
size: {
|
|
303
|
+
type: String,
|
|
304
|
+
default: "md"
|
|
305
|
+
},
|
|
306
|
+
type: {
|
|
307
|
+
type: String,
|
|
308
|
+
default: "button"
|
|
309
|
+
},
|
|
310
|
+
disabled: {
|
|
311
|
+
type: Boolean,
|
|
312
|
+
default: !1
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
styles: `
|
|
316
|
+
${b}
|
|
317
|
+
button {
|
|
318
|
+
appearance: none;
|
|
319
|
+
border: 0;
|
|
320
|
+
border-radius: 999px;
|
|
321
|
+
cursor: pointer;
|
|
322
|
+
display: inline-flex;
|
|
323
|
+
align-items: center;
|
|
324
|
+
justify-content: center;
|
|
325
|
+
font: inherit;
|
|
326
|
+
font-weight: 600;
|
|
327
|
+
gap: 0.5rem;
|
|
328
|
+
min-height: 2.5rem;
|
|
329
|
+
padding: 0.65rem 1rem;
|
|
330
|
+
transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
|
|
331
|
+
background: #2563eb;
|
|
332
|
+
color: #fff;
|
|
333
|
+
}
|
|
334
|
+
button[data-variant='secondary'] {
|
|
335
|
+
background: #e2e8f0;
|
|
336
|
+
color: #0f172a;
|
|
337
|
+
}
|
|
338
|
+
button[data-size='sm'] {
|
|
339
|
+
min-height: 2.125rem;
|
|
340
|
+
padding: 0.5rem 0.875rem;
|
|
341
|
+
}
|
|
342
|
+
button[data-size='lg'] {
|
|
343
|
+
min-height: 3rem;
|
|
344
|
+
padding: 0.875rem 1.25rem;
|
|
345
|
+
}
|
|
346
|
+
button:hover:not(:disabled) {
|
|
347
|
+
transform: translateY(-1px);
|
|
348
|
+
}
|
|
349
|
+
button:disabled {
|
|
350
|
+
cursor: not-allowed;
|
|
351
|
+
opacity: 0.6;
|
|
352
|
+
}
|
|
353
|
+
`,
|
|
354
|
+
render: ({ props: e }) => p`
|
|
355
|
+
<button
|
|
356
|
+
part="button"
|
|
357
|
+
type="${c(e.type)}"
|
|
358
|
+
data-variant="${c(e.variant)}"
|
|
359
|
+
data-size="${c(e.size)}"
|
|
360
|
+
${e.disabled ? "disabled" : ""}
|
|
361
|
+
>
|
|
362
|
+
<slot>${c(e.label)}</slot>
|
|
363
|
+
</button>
|
|
364
|
+
`
|
|
365
|
+
}), f(a.card, {
|
|
366
|
+
props: {
|
|
367
|
+
title: {
|
|
368
|
+
type: String,
|
|
369
|
+
default: ""
|
|
370
|
+
},
|
|
371
|
+
footer: {
|
|
372
|
+
type: String,
|
|
373
|
+
default: ""
|
|
374
|
+
},
|
|
375
|
+
elevated: {
|
|
376
|
+
type: Boolean,
|
|
377
|
+
default: !0
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
styles: `
|
|
381
|
+
${b}
|
|
382
|
+
article {
|
|
383
|
+
background: #fff;
|
|
384
|
+
border: 1px solid #e2e8f0;
|
|
385
|
+
border-radius: 1rem;
|
|
386
|
+
box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
|
|
387
|
+
color: #0f172a;
|
|
388
|
+
display: block;
|
|
389
|
+
padding: 1rem;
|
|
390
|
+
}
|
|
391
|
+
article[data-elevated='false'] {
|
|
392
|
+
box-shadow: none;
|
|
393
|
+
}
|
|
394
|
+
header, footer {
|
|
395
|
+
color: #475569;
|
|
396
|
+
font-size: 0.95rem;
|
|
397
|
+
font-weight: 600;
|
|
398
|
+
}
|
|
399
|
+
header {
|
|
400
|
+
margin-bottom: 0.75rem;
|
|
401
|
+
}
|
|
402
|
+
footer {
|
|
403
|
+
margin-top: 0.75rem;
|
|
404
|
+
}
|
|
405
|
+
`,
|
|
406
|
+
render: ({ props: e }) => p`
|
|
407
|
+
<article part="card" data-elevated="${String(e.elevated)}">
|
|
408
|
+
${e.title ? `<header part="header">${c(e.title)}</header>` : ""}
|
|
409
|
+
<section part="body"><slot></slot></section>
|
|
410
|
+
${e.footer ? `<footer part="footer">${c(e.footer)}</footer>` : ""}
|
|
411
|
+
</article>
|
|
412
|
+
`
|
|
413
|
+
}), f(a.input, {
|
|
414
|
+
props: {
|
|
415
|
+
label: {
|
|
416
|
+
type: String,
|
|
417
|
+
default: ""
|
|
418
|
+
},
|
|
419
|
+
type: {
|
|
420
|
+
type: String,
|
|
421
|
+
default: "text"
|
|
422
|
+
},
|
|
423
|
+
value: {
|
|
424
|
+
type: String,
|
|
425
|
+
default: ""
|
|
426
|
+
},
|
|
427
|
+
placeholder: {
|
|
428
|
+
type: String,
|
|
429
|
+
default: ""
|
|
430
|
+
},
|
|
431
|
+
name: {
|
|
432
|
+
type: String,
|
|
433
|
+
default: ""
|
|
434
|
+
},
|
|
435
|
+
disabled: {
|
|
436
|
+
type: Boolean,
|
|
437
|
+
default: !1
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
styles: $,
|
|
441
|
+
beforeUpdate(e, n) {
|
|
442
|
+
return !U(this, e, n);
|
|
443
|
+
},
|
|
444
|
+
connected() {
|
|
445
|
+
const e = (n) => {
|
|
446
|
+
const l = n.target;
|
|
447
|
+
l?.matches("input") && (n.stopPropagation(), this.setAttribute("value", l.value), this.dispatchEvent(new CustomEvent("input", {
|
|
448
|
+
detail: { value: l.value },
|
|
449
|
+
bubbles: !0,
|
|
450
|
+
composed: !0
|
|
451
|
+
})));
|
|
452
|
+
};
|
|
453
|
+
g(this, "__bqueryInputHandler", e), this.shadowRoot?.addEventListener("input", e);
|
|
454
|
+
},
|
|
455
|
+
disconnected() {
|
|
456
|
+
const e = y(this, "__bqueryInputHandler");
|
|
457
|
+
e && this.shadowRoot?.removeEventListener("input", e);
|
|
458
|
+
},
|
|
459
|
+
render: ({ props: e }) => p`
|
|
460
|
+
<label part="field" class="field">
|
|
461
|
+
${e.label ? `<span part="label" class="label">${c(e.label)}</span>` : ""}
|
|
462
|
+
<input
|
|
463
|
+
part="control"
|
|
464
|
+
class="control"
|
|
465
|
+
type="${c(e.type)}"
|
|
466
|
+
value="${c(e.value)}"
|
|
467
|
+
placeholder="${c(e.placeholder)}"
|
|
468
|
+
name="${c(e.name)}"
|
|
469
|
+
${e.disabled ? "disabled" : ""}
|
|
470
|
+
/>
|
|
471
|
+
</label>
|
|
472
|
+
`
|
|
473
|
+
}), f(a.textarea, {
|
|
474
|
+
props: {
|
|
475
|
+
label: {
|
|
476
|
+
type: String,
|
|
477
|
+
default: ""
|
|
478
|
+
},
|
|
479
|
+
value: {
|
|
480
|
+
type: String,
|
|
481
|
+
default: ""
|
|
482
|
+
},
|
|
483
|
+
placeholder: {
|
|
484
|
+
type: String,
|
|
485
|
+
default: ""
|
|
486
|
+
},
|
|
487
|
+
name: {
|
|
488
|
+
type: String,
|
|
489
|
+
default: ""
|
|
490
|
+
},
|
|
491
|
+
rows: {
|
|
492
|
+
type: Number,
|
|
493
|
+
default: 4
|
|
494
|
+
},
|
|
495
|
+
disabled: {
|
|
496
|
+
type: Boolean,
|
|
497
|
+
default: !1
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
styles: `${$}
|
|
501
|
+
textarea.control {
|
|
502
|
+
min-height: 6rem;
|
|
503
|
+
resize: vertical;
|
|
504
|
+
}
|
|
505
|
+
`,
|
|
506
|
+
beforeUpdate(e, n) {
|
|
507
|
+
return !Q(this, e, n);
|
|
508
|
+
},
|
|
509
|
+
connected() {
|
|
510
|
+
const e = (n) => {
|
|
511
|
+
const l = n.target;
|
|
512
|
+
l?.matches("textarea") && (n.stopPropagation(), this.setAttribute("value", l.value), this.dispatchEvent(new CustomEvent("input", {
|
|
513
|
+
detail: { value: l.value },
|
|
514
|
+
bubbles: !0,
|
|
515
|
+
composed: !0
|
|
516
|
+
})));
|
|
517
|
+
};
|
|
518
|
+
g(this, "__bqueryTextareaHandler", e), this.shadowRoot?.addEventListener("input", e);
|
|
519
|
+
},
|
|
520
|
+
disconnected() {
|
|
521
|
+
const e = y(this, "__bqueryTextareaHandler");
|
|
522
|
+
e && this.shadowRoot?.removeEventListener("input", e);
|
|
523
|
+
},
|
|
524
|
+
render: ({ props: e }) => p`
|
|
525
|
+
<label part="field" class="field">
|
|
526
|
+
${e.label ? `<span part="label" class="label">${c(e.label)}</span>` : ""}
|
|
527
|
+
${D(e)}
|
|
528
|
+
</label>
|
|
529
|
+
`
|
|
530
|
+
}), f(a.checkbox, {
|
|
531
|
+
props: {
|
|
532
|
+
label: {
|
|
533
|
+
type: String,
|
|
534
|
+
default: ""
|
|
535
|
+
},
|
|
536
|
+
checked: {
|
|
537
|
+
type: Boolean,
|
|
538
|
+
default: !1
|
|
539
|
+
},
|
|
540
|
+
disabled: {
|
|
541
|
+
type: Boolean,
|
|
542
|
+
default: !1
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
styles: `
|
|
546
|
+
${b}
|
|
547
|
+
label {
|
|
548
|
+
align-items: center;
|
|
549
|
+
color: #0f172a;
|
|
550
|
+
cursor: pointer;
|
|
551
|
+
display: inline-flex;
|
|
552
|
+
gap: 0.625rem;
|
|
553
|
+
}
|
|
554
|
+
input {
|
|
555
|
+
accent-color: #2563eb;
|
|
556
|
+
block-size: 1rem;
|
|
557
|
+
inline-size: 1rem;
|
|
558
|
+
}
|
|
559
|
+
input:disabled {
|
|
560
|
+
cursor: not-allowed;
|
|
561
|
+
}
|
|
562
|
+
`,
|
|
563
|
+
connected() {
|
|
564
|
+
const e = (n) => {
|
|
565
|
+
const l = n.target;
|
|
566
|
+
l?.matches('input[type="checkbox"]') && (n.stopPropagation(), l.checked ? this.setAttribute("checked", "true") : this.removeAttribute("checked"), this.dispatchEvent(new CustomEvent("change", {
|
|
567
|
+
detail: { checked: l.checked },
|
|
568
|
+
bubbles: !0,
|
|
569
|
+
composed: !0
|
|
570
|
+
})));
|
|
571
|
+
};
|
|
572
|
+
g(this, "__bqueryCheckboxHandler", e), this.shadowRoot?.addEventListener("change", e);
|
|
573
|
+
},
|
|
574
|
+
disconnected() {
|
|
575
|
+
const e = y(this, "__bqueryCheckboxHandler");
|
|
576
|
+
e && this.shadowRoot?.removeEventListener("change", e);
|
|
577
|
+
},
|
|
578
|
+
render: ({ props: e }) => p`
|
|
579
|
+
<label part="label">
|
|
580
|
+
<input
|
|
581
|
+
part="control"
|
|
582
|
+
type="checkbox"
|
|
583
|
+
${e.checked ? "checked" : ""}
|
|
584
|
+
${e.disabled ? "disabled" : ""}
|
|
585
|
+
/>
|
|
586
|
+
<span part="text"><slot>${c(e.label)}</slot></span>
|
|
587
|
+
</label>
|
|
588
|
+
`
|
|
589
|
+
}), a;
|
|
590
|
+
};
|
|
591
|
+
export {
|
|
592
|
+
f as a,
|
|
593
|
+
X as i,
|
|
594
|
+
Y as n,
|
|
595
|
+
K as o,
|
|
596
|
+
p as r,
|
|
597
|
+
Z as t
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
//# sourceMappingURL=component-BEQgt5hl.js.map
|