@verbb/formie-web-components 1.0.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/CHANGELOG.md +5 -0
- package/LICENSE.md +40 -0
- package/README.md +49 -0
- package/dist/field-utils.d.ts +4 -0
- package/dist/field-utils.d.ts.map +1 -0
- package/dist/form-element.d.ts +53 -0
- package/dist/form-element.d.ts.map +1 -0
- package/dist/formie-core-form.d.ts +33 -0
- package/dist/formie-core-form.d.ts.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1596 -0
- package/dist/index.js.map +1 -0
- package/dist/registry.d.ts +30 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/render-view.d.ts +18 -0
- package/dist/render-view.d.ts.map +1 -0
- package/dist/signature-element.d.ts +23 -0
- package/dist/signature-element.d.ts.map +1 -0
- package/dist/signature_pad-69C-Dgt3.js +391 -0
- package/dist/signature_pad-69C-Dgt3.js.map +1 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +51 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1596 @@
|
|
|
1
|
+
import { FRONTEND_CLIENT_EVENT_NAMES as e, compositePartDefinitions as t, createFrontendFormInstance as n, createGraphqlFrontendTransport as r, createRepeaterRowValue as i, createRestFrontendTransport as a, isCompositeField as o, isFileField as s, isKnownFrontendFieldType as c, isRepeatableField as l, loadFrontendEnvelope as u, loadGraphqlFrontendEnvelope as d, repeaterRowDefinitions as f } from "@verbb/formie-core";
|
|
2
|
+
import { FORMIE_HTML_EVENT_NAMES as p, createFormieClient as ee, createFormieClient as te } from "@verbb/formie-browser";
|
|
3
|
+
//#region ../../node_modules/@lit/reactive-element/css-tag.js
|
|
4
|
+
var m = globalThis, h = m.ShadowRoot && (m.ShadyCSS === void 0 || m.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, g = Symbol(), ne = /* @__PURE__ */ new WeakMap(), re = class {
|
|
5
|
+
constructor(e, t, n) {
|
|
6
|
+
if (this._$cssResult$ = !0, n !== g) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
7
|
+
this.cssText = e, this.t = t;
|
|
8
|
+
}
|
|
9
|
+
get styleSheet() {
|
|
10
|
+
let e = this.o, t = this.t;
|
|
11
|
+
if (h && e === void 0) {
|
|
12
|
+
let n = t !== void 0 && t.length === 1;
|
|
13
|
+
n && (e = ne.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), n && ne.set(t, e));
|
|
14
|
+
}
|
|
15
|
+
return e;
|
|
16
|
+
}
|
|
17
|
+
toString() {
|
|
18
|
+
return this.cssText;
|
|
19
|
+
}
|
|
20
|
+
}, ie = (e) => new re(typeof e == "string" ? e : e + "", void 0, g), ae = (e, ...t) => new re(e.length === 1 ? e[0] : t.reduce((t, n, r) => t + ((e) => {
|
|
21
|
+
if (!0 === e._$cssResult$) return e.cssText;
|
|
22
|
+
if (typeof e == "number") return e;
|
|
23
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + e + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
24
|
+
})(n) + e[r + 1], e[0]), e, g), oe = (e, t) => {
|
|
25
|
+
if (h) e.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
26
|
+
else for (let n of t) {
|
|
27
|
+
let t = document.createElement("style"), r = m.litNonce;
|
|
28
|
+
r !== void 0 && t.setAttribute("nonce", r), t.textContent = n.cssText, e.appendChild(t);
|
|
29
|
+
}
|
|
30
|
+
}, se = h ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((e) => {
|
|
31
|
+
let t = "";
|
|
32
|
+
for (let n of e.cssRules) t += n.cssText;
|
|
33
|
+
return ie(t);
|
|
34
|
+
})(e) : e, { is: ce, defineProperty: le, getOwnPropertyDescriptor: ue, getOwnPropertyNames: de, getOwnPropertySymbols: fe, getPrototypeOf: pe } = Object, _ = globalThis, me = _.trustedTypes, he = me ? me.emptyScript : "", ge = _.reactiveElementPolyfillSupport, v = (e, t) => e, y = {
|
|
35
|
+
toAttribute(e, t) {
|
|
36
|
+
switch (t) {
|
|
37
|
+
case Boolean:
|
|
38
|
+
e = e ? he : null;
|
|
39
|
+
break;
|
|
40
|
+
case Object:
|
|
41
|
+
case Array: e = e == null ? e : JSON.stringify(e);
|
|
42
|
+
}
|
|
43
|
+
return e;
|
|
44
|
+
},
|
|
45
|
+
fromAttribute(e, t) {
|
|
46
|
+
let n = e;
|
|
47
|
+
switch (t) {
|
|
48
|
+
case Boolean:
|
|
49
|
+
n = e !== null;
|
|
50
|
+
break;
|
|
51
|
+
case Number:
|
|
52
|
+
n = e === null ? null : Number(e);
|
|
53
|
+
break;
|
|
54
|
+
case Object:
|
|
55
|
+
case Array: try {
|
|
56
|
+
n = JSON.parse(e);
|
|
57
|
+
} catch {
|
|
58
|
+
n = null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return n;
|
|
62
|
+
}
|
|
63
|
+
}, b = (e, t) => !ce(e, t), _e = {
|
|
64
|
+
attribute: !0,
|
|
65
|
+
type: String,
|
|
66
|
+
converter: y,
|
|
67
|
+
reflect: !1,
|
|
68
|
+
useDefault: !1,
|
|
69
|
+
hasChanged: b
|
|
70
|
+
};
|
|
71
|
+
Symbol.metadata ??= Symbol("metadata"), _.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
72
|
+
var x = class extends HTMLElement {
|
|
73
|
+
static addInitializer(e) {
|
|
74
|
+
this._$Ei(), (this.l ??= []).push(e);
|
|
75
|
+
}
|
|
76
|
+
static get observedAttributes() {
|
|
77
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
78
|
+
}
|
|
79
|
+
static createProperty(e, t = _e) {
|
|
80
|
+
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
81
|
+
let n = Symbol(), r = this.getPropertyDescriptor(e, n, t);
|
|
82
|
+
r !== void 0 && le(this.prototype, e, r);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
static getPropertyDescriptor(e, t, n) {
|
|
86
|
+
let { get: r, set: i } = ue(this.prototype, e) ?? {
|
|
87
|
+
get() {
|
|
88
|
+
return this[t];
|
|
89
|
+
},
|
|
90
|
+
set(e) {
|
|
91
|
+
this[t] = e;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
return {
|
|
95
|
+
get: r,
|
|
96
|
+
set(t) {
|
|
97
|
+
let a = r?.call(this);
|
|
98
|
+
i?.call(this, t), this.requestUpdate(e, a, n);
|
|
99
|
+
},
|
|
100
|
+
configurable: !0,
|
|
101
|
+
enumerable: !0
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
static getPropertyOptions(e) {
|
|
105
|
+
return this.elementProperties.get(e) ?? _e;
|
|
106
|
+
}
|
|
107
|
+
static _$Ei() {
|
|
108
|
+
if (this.hasOwnProperty(v("elementProperties"))) return;
|
|
109
|
+
let e = pe(this);
|
|
110
|
+
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
111
|
+
}
|
|
112
|
+
static finalize() {
|
|
113
|
+
if (this.hasOwnProperty(v("finalized"))) return;
|
|
114
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(v("properties"))) {
|
|
115
|
+
let e = this.properties, t = [...de(e), ...fe(e)];
|
|
116
|
+
for (let n of t) this.createProperty(n, e[n]);
|
|
117
|
+
}
|
|
118
|
+
let e = this[Symbol.metadata];
|
|
119
|
+
if (e !== null) {
|
|
120
|
+
let t = litPropertyMetadata.get(e);
|
|
121
|
+
if (t !== void 0) for (let [e, n] of t) this.elementProperties.set(e, n);
|
|
122
|
+
}
|
|
123
|
+
this._$Eh = /* @__PURE__ */ new Map();
|
|
124
|
+
for (let [e, t] of this.elementProperties) {
|
|
125
|
+
let n = this._$Eu(e, t);
|
|
126
|
+
n !== void 0 && this._$Eh.set(n, e);
|
|
127
|
+
}
|
|
128
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
129
|
+
}
|
|
130
|
+
static finalizeStyles(e) {
|
|
131
|
+
let t = [];
|
|
132
|
+
if (Array.isArray(e)) {
|
|
133
|
+
let n = new Set(e.flat(Infinity).reverse());
|
|
134
|
+
for (let e of n) t.unshift(se(e));
|
|
135
|
+
} else e !== void 0 && t.push(se(e));
|
|
136
|
+
return t;
|
|
137
|
+
}
|
|
138
|
+
static _$Eu(e, t) {
|
|
139
|
+
let n = t.attribute;
|
|
140
|
+
return !1 === n ? void 0 : typeof n == "string" ? n : typeof e == "string" ? e.toLowerCase() : void 0;
|
|
141
|
+
}
|
|
142
|
+
constructor() {
|
|
143
|
+
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
144
|
+
}
|
|
145
|
+
_$Ev() {
|
|
146
|
+
this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((e) => e(this));
|
|
147
|
+
}
|
|
148
|
+
addController(e) {
|
|
149
|
+
(this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
|
|
150
|
+
}
|
|
151
|
+
removeController(e) {
|
|
152
|
+
this._$EO?.delete(e);
|
|
153
|
+
}
|
|
154
|
+
_$E_() {
|
|
155
|
+
let e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
|
|
156
|
+
for (let n of t.keys()) this.hasOwnProperty(n) && (e.set(n, this[n]), delete this[n]);
|
|
157
|
+
e.size > 0 && (this._$Ep = e);
|
|
158
|
+
}
|
|
159
|
+
createRenderRoot() {
|
|
160
|
+
let e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
161
|
+
return oe(e, this.constructor.elementStyles), e;
|
|
162
|
+
}
|
|
163
|
+
connectedCallback() {
|
|
164
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.());
|
|
165
|
+
}
|
|
166
|
+
enableUpdating(e) {}
|
|
167
|
+
disconnectedCallback() {
|
|
168
|
+
this._$EO?.forEach((e) => e.hostDisconnected?.());
|
|
169
|
+
}
|
|
170
|
+
attributeChangedCallback(e, t, n) {
|
|
171
|
+
this._$AK(e, n);
|
|
172
|
+
}
|
|
173
|
+
_$ET(e, t) {
|
|
174
|
+
let n = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, n);
|
|
175
|
+
if (r !== void 0 && !0 === n.reflect) {
|
|
176
|
+
let i = (n.converter?.toAttribute === void 0 ? y : n.converter).toAttribute(t, n.type);
|
|
177
|
+
this._$Em = e, i == null ? this.removeAttribute(r) : this.setAttribute(r, i), this._$Em = null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
_$AK(e, t) {
|
|
181
|
+
let n = this.constructor, r = n._$Eh.get(e);
|
|
182
|
+
if (r !== void 0 && this._$Em !== r) {
|
|
183
|
+
let e = n.getPropertyOptions(r), i = typeof e.converter == "function" ? { fromAttribute: e.converter } : e.converter?.fromAttribute === void 0 ? y : e.converter;
|
|
184
|
+
this._$Em = r;
|
|
185
|
+
let a = i.fromAttribute(t, e.type);
|
|
186
|
+
this[r] = a ?? this._$Ej?.get(r) ?? a, this._$Em = null;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
requestUpdate(e, t, n, r = !1, i) {
|
|
190
|
+
if (e !== void 0) {
|
|
191
|
+
let a = this.constructor;
|
|
192
|
+
if (!1 === r && (i = this[e]), n ??= a.getPropertyOptions(e), !((n.hasChanged ?? b)(i, t) || n.useDefault && n.reflect && i === this._$Ej?.get(e) && !this.hasAttribute(a._$Eu(e, n)))) return;
|
|
193
|
+
this.C(e, t, n);
|
|
194
|
+
}
|
|
195
|
+
!1 === this.isUpdatePending && (this._$ES = this._$EP());
|
|
196
|
+
}
|
|
197
|
+
C(e, t, { useDefault: n, reflect: r, wrapped: i }, a) {
|
|
198
|
+
n && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, a ?? t ?? this[e]), !0 !== i || a !== void 0) || (this._$AL.has(e) || (this.hasUpdated || n || (t = void 0), this._$AL.set(e, t)), !0 === r && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
|
|
199
|
+
}
|
|
200
|
+
async _$EP() {
|
|
201
|
+
this.isUpdatePending = !0;
|
|
202
|
+
try {
|
|
203
|
+
await this._$ES;
|
|
204
|
+
} catch (e) {
|
|
205
|
+
Promise.reject(e);
|
|
206
|
+
}
|
|
207
|
+
let e = this.scheduleUpdate();
|
|
208
|
+
return e != null && await e, !this.isUpdatePending;
|
|
209
|
+
}
|
|
210
|
+
scheduleUpdate() {
|
|
211
|
+
return this.performUpdate();
|
|
212
|
+
}
|
|
213
|
+
performUpdate() {
|
|
214
|
+
if (!this.isUpdatePending) return;
|
|
215
|
+
if (!this.hasUpdated) {
|
|
216
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
217
|
+
for (let [e, t] of this._$Ep) this[e] = t;
|
|
218
|
+
this._$Ep = void 0;
|
|
219
|
+
}
|
|
220
|
+
let e = this.constructor.elementProperties;
|
|
221
|
+
if (e.size > 0) for (let [t, n] of e) {
|
|
222
|
+
let { wrapped: e } = n, r = this[t];
|
|
223
|
+
!0 !== e || this._$AL.has(t) || r === void 0 || this.C(t, void 0, n, r);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
let e = !1, t = this._$AL;
|
|
227
|
+
try {
|
|
228
|
+
e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach((e) => e.hostUpdate?.()), this.update(t)) : this._$EM();
|
|
229
|
+
} catch (t) {
|
|
230
|
+
throw e = !1, this._$EM(), t;
|
|
231
|
+
}
|
|
232
|
+
e && this._$AE(t);
|
|
233
|
+
}
|
|
234
|
+
willUpdate(e) {}
|
|
235
|
+
_$AE(e) {
|
|
236
|
+
this._$EO?.forEach((e) => e.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
237
|
+
}
|
|
238
|
+
_$EM() {
|
|
239
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
240
|
+
}
|
|
241
|
+
get updateComplete() {
|
|
242
|
+
return this.getUpdateComplete();
|
|
243
|
+
}
|
|
244
|
+
getUpdateComplete() {
|
|
245
|
+
return this._$ES;
|
|
246
|
+
}
|
|
247
|
+
shouldUpdate(e) {
|
|
248
|
+
return !0;
|
|
249
|
+
}
|
|
250
|
+
update(e) {
|
|
251
|
+
this._$Eq &&= this._$Eq.forEach((e) => this._$ET(e, this[e])), this._$EM();
|
|
252
|
+
}
|
|
253
|
+
updated(e) {}
|
|
254
|
+
firstUpdated(e) {}
|
|
255
|
+
};
|
|
256
|
+
x.elementStyles = [], x.shadowRootOptions = { mode: "open" }, x[v("elementProperties")] = /* @__PURE__ */ new Map(), x[v("finalized")] = /* @__PURE__ */ new Map(), ge?.({ ReactiveElement: x }), (_.reactiveElementVersions ??= []).push("2.1.2");
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region ../../node_modules/lit-html/lit-html.js
|
|
259
|
+
var ve = globalThis, ye = (e) => e, S = ve.trustedTypes, be = S ? S.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, xe = "$lit$", C = `lit$${Math.random().toFixed(9).slice(2)}$`, Se = "?" + C, Ce = `<${Se}>`, w = document, T = () => w.createComment(""), E = (e) => e === null || typeof e != "object" && typeof e != "function", D = Array.isArray, we = (e) => D(e) || typeof e?.[Symbol.iterator] == "function", O = "[ \n\f\r]", k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Te = /-->/g, Ee = />/g, A = RegExp(`>|${O}(?:([^\\s"'>=/]+)(${O}*=${O}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), De = /'/g, Oe = /"/g, ke = /^(?:script|style|textarea|title)$/i, j = ((e) => (t, ...n) => ({
|
|
260
|
+
_$litType$: e,
|
|
261
|
+
strings: t,
|
|
262
|
+
values: n
|
|
263
|
+
}))(1), M = Symbol.for("lit-noChange"), N = Symbol.for("lit-nothing"), Ae = /* @__PURE__ */ new WeakMap(), P = w.createTreeWalker(w, 129);
|
|
264
|
+
function je(e, t) {
|
|
265
|
+
if (!D(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
266
|
+
return be === void 0 ? t : be.createHTML(t);
|
|
267
|
+
}
|
|
268
|
+
var Me = (e, t) => {
|
|
269
|
+
let n = e.length - 1, r = [], i, a = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = k;
|
|
270
|
+
for (let t = 0; t < n; t++) {
|
|
271
|
+
let n = e[t], s, c, l = -1, u = 0;
|
|
272
|
+
for (; u < n.length && (o.lastIndex = u, c = o.exec(n), c !== null);) u = o.lastIndex, o === k ? c[1] === "!--" ? o = Te : c[1] === void 0 ? c[2] === void 0 ? c[3] !== void 0 && (o = A) : (ke.test(c[2]) && (i = RegExp("</" + c[2], "g")), o = A) : o = Ee : o === A ? c[0] === ">" ? (o = i ?? k, l = -1) : c[1] === void 0 ? l = -2 : (l = o.lastIndex - c[2].length, s = c[1], o = c[3] === void 0 ? A : c[3] === "\"" ? Oe : De) : o === Oe || o === De ? o = A : o === Te || o === Ee ? o = k : (o = A, i = void 0);
|
|
273
|
+
let d = o === A && e[t + 1].startsWith("/>") ? " " : "";
|
|
274
|
+
a += o === k ? n + Ce : l >= 0 ? (r.push(s), n.slice(0, l) + xe + n.slice(l) + C + d) : n + C + (l === -2 ? t : d);
|
|
275
|
+
}
|
|
276
|
+
return [je(e, a + (e[n] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
|
|
277
|
+
}, F = class e {
|
|
278
|
+
constructor({ strings: t, _$litType$: n }, r) {
|
|
279
|
+
let i;
|
|
280
|
+
this.parts = [];
|
|
281
|
+
let a = 0, o = 0, s = t.length - 1, c = this.parts, [l, u] = Me(t, n);
|
|
282
|
+
if (this.el = e.createElement(l, r), P.currentNode = this.el.content, n === 2 || n === 3) {
|
|
283
|
+
let e = this.el.content.firstChild;
|
|
284
|
+
e.replaceWith(...e.childNodes);
|
|
285
|
+
}
|
|
286
|
+
for (; (i = P.nextNode()) !== null && c.length < s;) {
|
|
287
|
+
if (i.nodeType === 1) {
|
|
288
|
+
if (i.hasAttributes()) for (let e of i.getAttributeNames()) if (e.endsWith(xe)) {
|
|
289
|
+
let t = u[o++], n = i.getAttribute(e).split(C), r = /([.?@])?(.*)/.exec(t);
|
|
290
|
+
c.push({
|
|
291
|
+
type: 1,
|
|
292
|
+
index: a,
|
|
293
|
+
name: r[2],
|
|
294
|
+
strings: n,
|
|
295
|
+
ctor: r[1] === "." ? Pe : r[1] === "?" ? Fe : r[1] === "@" ? Ie : R
|
|
296
|
+
}), i.removeAttribute(e);
|
|
297
|
+
} else e.startsWith(C) && (c.push({
|
|
298
|
+
type: 6,
|
|
299
|
+
index: a
|
|
300
|
+
}), i.removeAttribute(e));
|
|
301
|
+
if (ke.test(i.tagName)) {
|
|
302
|
+
let e = i.textContent.split(C), t = e.length - 1;
|
|
303
|
+
if (t > 0) {
|
|
304
|
+
i.textContent = S ? S.emptyScript : "";
|
|
305
|
+
for (let n = 0; n < t; n++) i.append(e[n], T()), P.nextNode(), c.push({
|
|
306
|
+
type: 2,
|
|
307
|
+
index: ++a
|
|
308
|
+
});
|
|
309
|
+
i.append(e[t], T());
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
} else if (i.nodeType === 8) if (i.data === Se) c.push({
|
|
313
|
+
type: 2,
|
|
314
|
+
index: a
|
|
315
|
+
});
|
|
316
|
+
else {
|
|
317
|
+
let e = -1;
|
|
318
|
+
for (; (e = i.data.indexOf(C, e + 1)) !== -1;) c.push({
|
|
319
|
+
type: 7,
|
|
320
|
+
index: a
|
|
321
|
+
}), e += C.length - 1;
|
|
322
|
+
}
|
|
323
|
+
a++;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
static createElement(e, t) {
|
|
327
|
+
let n = w.createElement("template");
|
|
328
|
+
return n.innerHTML = e, n;
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
function I(e, t, n = e, r) {
|
|
332
|
+
if (t === M) return t;
|
|
333
|
+
let i = r === void 0 ? n._$Cl : n._$Co?.[r], a = E(t) ? void 0 : t._$litDirective$;
|
|
334
|
+
return i?.constructor !== a && (i?._$AO?.(!1), a === void 0 ? i = void 0 : (i = new a(e), i._$AT(e, n, r)), r === void 0 ? n._$Cl = i : (n._$Co ??= [])[r] = i), i !== void 0 && (t = I(e, i._$AS(e, t.values), i, r)), t;
|
|
335
|
+
}
|
|
336
|
+
var Ne = class {
|
|
337
|
+
constructor(e, t) {
|
|
338
|
+
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
|
|
339
|
+
}
|
|
340
|
+
get parentNode() {
|
|
341
|
+
return this._$AM.parentNode;
|
|
342
|
+
}
|
|
343
|
+
get _$AU() {
|
|
344
|
+
return this._$AM._$AU;
|
|
345
|
+
}
|
|
346
|
+
u(e) {
|
|
347
|
+
let { el: { content: t }, parts: n } = this._$AD, r = (e?.creationScope ?? w).importNode(t, !0);
|
|
348
|
+
P.currentNode = r;
|
|
349
|
+
let i = P.nextNode(), a = 0, o = 0, s = n[0];
|
|
350
|
+
for (; s !== void 0;) {
|
|
351
|
+
if (a === s.index) {
|
|
352
|
+
let t;
|
|
353
|
+
s.type === 2 ? t = new L(i, i.nextSibling, this, e) : s.type === 1 ? t = new s.ctor(i, s.name, s.strings, this, e) : s.type === 6 && (t = new Le(i, this, e)), this._$AV.push(t), s = n[++o];
|
|
354
|
+
}
|
|
355
|
+
a !== s?.index && (i = P.nextNode(), a++);
|
|
356
|
+
}
|
|
357
|
+
return P.currentNode = w, r;
|
|
358
|
+
}
|
|
359
|
+
p(e) {
|
|
360
|
+
let t = 0;
|
|
361
|
+
for (let n of this._$AV) n !== void 0 && (n.strings === void 0 ? n._$AI(e[t]) : (n._$AI(e, n, t), t += n.strings.length - 2)), t++;
|
|
362
|
+
}
|
|
363
|
+
}, L = class e {
|
|
364
|
+
get _$AU() {
|
|
365
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
366
|
+
}
|
|
367
|
+
constructor(e, t, n, r) {
|
|
368
|
+
this.type = 2, this._$AH = N, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = n, this.options = r, this._$Cv = r?.isConnected ?? !0;
|
|
369
|
+
}
|
|
370
|
+
get parentNode() {
|
|
371
|
+
let e = this._$AA.parentNode, t = this._$AM;
|
|
372
|
+
return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
|
|
373
|
+
}
|
|
374
|
+
get startNode() {
|
|
375
|
+
return this._$AA;
|
|
376
|
+
}
|
|
377
|
+
get endNode() {
|
|
378
|
+
return this._$AB;
|
|
379
|
+
}
|
|
380
|
+
_$AI(e, t = this) {
|
|
381
|
+
e = I(this, e, t), E(e) ? e === N || e == null || e === "" ? (this._$AH !== N && this._$AR(), this._$AH = N) : e !== this._$AH && e !== M && this._(e) : e._$litType$ === void 0 ? e.nodeType === void 0 ? we(e) ? this.k(e) : this._(e) : this.T(e) : this.$(e);
|
|
382
|
+
}
|
|
383
|
+
O(e) {
|
|
384
|
+
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
385
|
+
}
|
|
386
|
+
T(e) {
|
|
387
|
+
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
388
|
+
}
|
|
389
|
+
_(e) {
|
|
390
|
+
this._$AH !== N && E(this._$AH) ? this._$AA.nextSibling.data = e : this.T(w.createTextNode(e)), this._$AH = e;
|
|
391
|
+
}
|
|
392
|
+
$(e) {
|
|
393
|
+
let { values: t, _$litType$: n } = e, r = typeof n == "number" ? this._$AC(e) : (n.el === void 0 && (n.el = F.createElement(je(n.h, n.h[0]), this.options)), n);
|
|
394
|
+
if (this._$AH?._$AD === r) this._$AH.p(t);
|
|
395
|
+
else {
|
|
396
|
+
let e = new Ne(r, this), n = e.u(this.options);
|
|
397
|
+
e.p(t), this.T(n), this._$AH = e;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
_$AC(e) {
|
|
401
|
+
let t = Ae.get(e.strings);
|
|
402
|
+
return t === void 0 && Ae.set(e.strings, t = new F(e)), t;
|
|
403
|
+
}
|
|
404
|
+
k(t) {
|
|
405
|
+
D(this._$AH) || (this._$AH = [], this._$AR());
|
|
406
|
+
let n = this._$AH, r, i = 0;
|
|
407
|
+
for (let a of t) i === n.length ? n.push(r = new e(this.O(T()), this.O(T()), this, this.options)) : r = n[i], r._$AI(a), i++;
|
|
408
|
+
i < n.length && (this._$AR(r && r._$AB.nextSibling, i), n.length = i);
|
|
409
|
+
}
|
|
410
|
+
_$AR(e = this._$AA.nextSibling, t) {
|
|
411
|
+
for (this._$AP?.(!1, !0, t); e !== this._$AB;) {
|
|
412
|
+
let t = ye(e).nextSibling;
|
|
413
|
+
ye(e).remove(), e = t;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
setConnected(e) {
|
|
417
|
+
this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
|
|
418
|
+
}
|
|
419
|
+
}, R = class {
|
|
420
|
+
get tagName() {
|
|
421
|
+
return this.element.tagName;
|
|
422
|
+
}
|
|
423
|
+
get _$AU() {
|
|
424
|
+
return this._$AM._$AU;
|
|
425
|
+
}
|
|
426
|
+
constructor(e, t, n, r, i) {
|
|
427
|
+
this.type = 1, this._$AH = N, this._$AN = void 0, this.element = e, this.name = t, this._$AM = r, this.options = i, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(/* @__PURE__ */ new String()), this.strings = n) : this._$AH = N;
|
|
428
|
+
}
|
|
429
|
+
_$AI(e, t = this, n, r) {
|
|
430
|
+
let i = this.strings, a = !1;
|
|
431
|
+
if (i === void 0) e = I(this, e, t, 0), a = !E(e) || e !== this._$AH && e !== M, a && (this._$AH = e);
|
|
432
|
+
else {
|
|
433
|
+
let r = e, o, s;
|
|
434
|
+
for (e = i[0], o = 0; o < i.length - 1; o++) s = I(this, r[n + o], t, o), s === M && (s = this._$AH[o]), a ||= !E(s) || s !== this._$AH[o], s === N ? e = N : e !== N && (e += (s ?? "") + i[o + 1]), this._$AH[o] = s;
|
|
435
|
+
}
|
|
436
|
+
a && !r && this.j(e);
|
|
437
|
+
}
|
|
438
|
+
j(e) {
|
|
439
|
+
e === N ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
440
|
+
}
|
|
441
|
+
}, Pe = class extends R {
|
|
442
|
+
constructor() {
|
|
443
|
+
super(...arguments), this.type = 3;
|
|
444
|
+
}
|
|
445
|
+
j(e) {
|
|
446
|
+
this.element[this.name] = e === N ? void 0 : e;
|
|
447
|
+
}
|
|
448
|
+
}, Fe = class extends R {
|
|
449
|
+
constructor() {
|
|
450
|
+
super(...arguments), this.type = 4;
|
|
451
|
+
}
|
|
452
|
+
j(e) {
|
|
453
|
+
this.element.toggleAttribute(this.name, !!e && e !== N);
|
|
454
|
+
}
|
|
455
|
+
}, Ie = class extends R {
|
|
456
|
+
constructor(e, t, n, r, i) {
|
|
457
|
+
super(e, t, n, r, i), this.type = 5;
|
|
458
|
+
}
|
|
459
|
+
_$AI(e, t = this) {
|
|
460
|
+
if ((e = I(this, e, t, 0) ?? N) === M) return;
|
|
461
|
+
let n = this._$AH, r = e === N && n !== N || e.capture !== n.capture || e.once !== n.once || e.passive !== n.passive, i = e !== N && (n === N || r);
|
|
462
|
+
r && this.element.removeEventListener(this.name, this, n), i && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
463
|
+
}
|
|
464
|
+
handleEvent(e) {
|
|
465
|
+
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
|
|
466
|
+
}
|
|
467
|
+
}, Le = class {
|
|
468
|
+
constructor(e, t, n) {
|
|
469
|
+
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = n;
|
|
470
|
+
}
|
|
471
|
+
get _$AU() {
|
|
472
|
+
return this._$AM._$AU;
|
|
473
|
+
}
|
|
474
|
+
_$AI(e) {
|
|
475
|
+
I(this, e);
|
|
476
|
+
}
|
|
477
|
+
}, Re = {
|
|
478
|
+
M: xe,
|
|
479
|
+
P: C,
|
|
480
|
+
A: Se,
|
|
481
|
+
C: 1,
|
|
482
|
+
L: Me,
|
|
483
|
+
R: Ne,
|
|
484
|
+
D: we,
|
|
485
|
+
V: I,
|
|
486
|
+
I: L,
|
|
487
|
+
H: R,
|
|
488
|
+
N: Fe,
|
|
489
|
+
U: Ie,
|
|
490
|
+
B: Pe,
|
|
491
|
+
F: Le
|
|
492
|
+
}, ze = ve.litHtmlPolyfillSupport;
|
|
493
|
+
ze?.(F, L), (ve.litHtmlVersions ??= []).push("3.3.2");
|
|
494
|
+
var Be = (e, t, n) => {
|
|
495
|
+
let r = n?.renderBefore ?? t, i = r._$litPart$;
|
|
496
|
+
if (i === void 0) {
|
|
497
|
+
let e = n?.renderBefore ?? null;
|
|
498
|
+
r._$litPart$ = i = new L(t.insertBefore(T(), e), e, void 0, n ?? {});
|
|
499
|
+
}
|
|
500
|
+
return i._$AI(e), i;
|
|
501
|
+
}, z = globalThis, B = class extends x {
|
|
502
|
+
constructor() {
|
|
503
|
+
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
504
|
+
}
|
|
505
|
+
createRenderRoot() {
|
|
506
|
+
let e = super.createRenderRoot();
|
|
507
|
+
return this.renderOptions.renderBefore ??= e.firstChild, e;
|
|
508
|
+
}
|
|
509
|
+
update(e) {
|
|
510
|
+
let t = this.render();
|
|
511
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = Be(t, this.renderRoot, this.renderOptions);
|
|
512
|
+
}
|
|
513
|
+
connectedCallback() {
|
|
514
|
+
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
515
|
+
}
|
|
516
|
+
disconnectedCallback() {
|
|
517
|
+
super.disconnectedCallback(), this._$Do?.setConnected(!1);
|
|
518
|
+
}
|
|
519
|
+
render() {
|
|
520
|
+
return M;
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
B._$litElement$ = !0, B.finalized = !0, z.litElementHydrateSupport?.({ LitElement: B });
|
|
524
|
+
var Ve = z.litElementPolyfillSupport;
|
|
525
|
+
Ve?.({ LitElement: B }), (z.litElementVersions ??= []).push("4.2.2");
|
|
526
|
+
//#endregion
|
|
527
|
+
//#region ../../node_modules/lit-html/static.js
|
|
528
|
+
var He = Symbol.for(""), Ue = (e) => {
|
|
529
|
+
if (e?.r === He) return e?._$litStatic$;
|
|
530
|
+
}, We = (e) => ({
|
|
531
|
+
_$litStatic$: e,
|
|
532
|
+
r: He
|
|
533
|
+
}), Ge = /* @__PURE__ */ new Map(), V = ((e) => (t, ...n) => {
|
|
534
|
+
let r = n.length, i, a, o = [], s = [], c, l = 0, u = !1;
|
|
535
|
+
for (; l < r;) {
|
|
536
|
+
for (c = t[l]; l < r && (a = n[l], i = Ue(a)) !== void 0;) c += i + t[++l], u = !0;
|
|
537
|
+
l !== r && s.push(a), o.push(c), l++;
|
|
538
|
+
}
|
|
539
|
+
if (l === r && o.push(t[r]), u) {
|
|
540
|
+
let e = o.join("$$lit$$");
|
|
541
|
+
(t = Ge.get(e)) === void 0 && (o.raw = o, Ge.set(e, t = o)), n = s;
|
|
542
|
+
}
|
|
543
|
+
return e(t, ...n);
|
|
544
|
+
})(j), Ke = {
|
|
545
|
+
attribute: !0,
|
|
546
|
+
type: String,
|
|
547
|
+
converter: y,
|
|
548
|
+
reflect: !1,
|
|
549
|
+
hasChanged: b
|
|
550
|
+
}, qe = (e = Ke, t, n) => {
|
|
551
|
+
let { kind: r, metadata: i } = n, a = globalThis.litPropertyMetadata.get(i);
|
|
552
|
+
if (a === void 0 && globalThis.litPropertyMetadata.set(i, a = /* @__PURE__ */ new Map()), r === "setter" && ((e = Object.create(e)).wrapped = !0), a.set(n.name, e), r === "accessor") {
|
|
553
|
+
let { name: r } = n;
|
|
554
|
+
return {
|
|
555
|
+
set(n) {
|
|
556
|
+
let i = t.get.call(this);
|
|
557
|
+
t.set.call(this, n), this.requestUpdate(r, i, e, !0, n);
|
|
558
|
+
},
|
|
559
|
+
init(t) {
|
|
560
|
+
return t !== void 0 && this.C(r, void 0, e, t), t;
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
if (r === "setter") {
|
|
565
|
+
let { name: r } = n;
|
|
566
|
+
return function(n) {
|
|
567
|
+
let i = this[r];
|
|
568
|
+
t.call(this, n), this.requestUpdate(r, i, e, !0, n);
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
throw Error("Unsupported decorator location: " + r);
|
|
572
|
+
};
|
|
573
|
+
function H(e) {
|
|
574
|
+
return (t, n) => typeof n == "object" ? qe(e, t, n) : ((e, t, n) => {
|
|
575
|
+
let r = t.hasOwnProperty(n);
|
|
576
|
+
return t.constructor.createProperty(n, e), r ? Object.getOwnPropertyDescriptor(t, n) : void 0;
|
|
577
|
+
})(e, t, n);
|
|
578
|
+
}
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region ../../node_modules/@lit/reactive-element/decorators/state.js
|
|
581
|
+
function U(e) {
|
|
582
|
+
return H({
|
|
583
|
+
...e,
|
|
584
|
+
state: !0,
|
|
585
|
+
attribute: !1
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
//#endregion
|
|
589
|
+
//#region src/registry.ts
|
|
590
|
+
var Je = /^[a-z][a-z0-9]*(-[a-z0-9]+)+$/;
|
|
591
|
+
function W(e) {
|
|
592
|
+
if (!Je.test(e)) throw Error(`[Formie WC] Invalid custom element tag "${e}". Use lowercase hyphenated names (e.g. my-text-field).`);
|
|
593
|
+
}
|
|
594
|
+
var G = class e {
|
|
595
|
+
constructor() {
|
|
596
|
+
this.fieldControls = {}, this.fieldTag = null, this.regions = {};
|
|
597
|
+
}
|
|
598
|
+
registerFieldControl(e, t) {
|
|
599
|
+
return W(t), this.fieldControls[e] = t, this;
|
|
600
|
+
}
|
|
601
|
+
registerField(e) {
|
|
602
|
+
return W(e), this.fieldTag = e, this;
|
|
603
|
+
}
|
|
604
|
+
registerRegion(e, t) {
|
|
605
|
+
return W(t), this.regions[e] = t, this;
|
|
606
|
+
}
|
|
607
|
+
clone() {
|
|
608
|
+
let t = new e();
|
|
609
|
+
return t.fieldControls = { ...this.fieldControls }, t.fieldTag = this.fieldTag, t.regions = { ...this.regions }, t;
|
|
610
|
+
}
|
|
611
|
+
}, Ye = new G();
|
|
612
|
+
function Xe() {
|
|
613
|
+
return Ye;
|
|
614
|
+
}
|
|
615
|
+
function Ze() {
|
|
616
|
+
return new G();
|
|
617
|
+
}
|
|
618
|
+
//#endregion
|
|
619
|
+
//#region ../../node_modules/lit-html/directive-helpers.js
|
|
620
|
+
var { I: Qe } = Re, $e = (e) => e.strings === void 0, et = {
|
|
621
|
+
ATTRIBUTE: 1,
|
|
622
|
+
CHILD: 2,
|
|
623
|
+
PROPERTY: 3,
|
|
624
|
+
BOOLEAN_ATTRIBUTE: 4,
|
|
625
|
+
EVENT: 5,
|
|
626
|
+
ELEMENT: 6
|
|
627
|
+
}, tt = (e) => (...t) => ({
|
|
628
|
+
_$litDirective$: e,
|
|
629
|
+
values: t
|
|
630
|
+
}), nt = class {
|
|
631
|
+
constructor(e) {}
|
|
632
|
+
get _$AU() {
|
|
633
|
+
return this._$AM._$AU;
|
|
634
|
+
}
|
|
635
|
+
_$AT(e, t, n) {
|
|
636
|
+
this._$Ct = e, this._$AM = t, this._$Ci = n;
|
|
637
|
+
}
|
|
638
|
+
_$AS(e, t) {
|
|
639
|
+
return this.update(e, t);
|
|
640
|
+
}
|
|
641
|
+
update(e, t) {
|
|
642
|
+
return this.render(...t);
|
|
643
|
+
}
|
|
644
|
+
}, K = (e, t) => {
|
|
645
|
+
let n = e._$AN;
|
|
646
|
+
if (n === void 0) return !1;
|
|
647
|
+
for (let e of n) e._$AO?.(t, !1), K(e, t);
|
|
648
|
+
return !0;
|
|
649
|
+
}, q = (e) => {
|
|
650
|
+
let t, n;
|
|
651
|
+
do {
|
|
652
|
+
if ((t = e._$AM) === void 0) break;
|
|
653
|
+
n = t._$AN, n.delete(e), e = t;
|
|
654
|
+
} while (n?.size === 0);
|
|
655
|
+
}, rt = (e) => {
|
|
656
|
+
for (let t; t = e._$AM; e = t) {
|
|
657
|
+
let n = t._$AN;
|
|
658
|
+
if (n === void 0) t._$AN = n = /* @__PURE__ */ new Set();
|
|
659
|
+
else if (n.has(e)) break;
|
|
660
|
+
n.add(e), ot(t);
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
function it(e) {
|
|
664
|
+
this._$AN === void 0 ? this._$AM = e : (q(this), this._$AM = e, rt(this));
|
|
665
|
+
}
|
|
666
|
+
function at(e, t = !1, n = 0) {
|
|
667
|
+
let r = this._$AH, i = this._$AN;
|
|
668
|
+
if (i !== void 0 && i.size !== 0) if (t) if (Array.isArray(r)) for (let e = n; e < r.length; e++) K(r[e], !1), q(r[e]);
|
|
669
|
+
else r != null && (K(r, !1), q(r));
|
|
670
|
+
else K(this, e);
|
|
671
|
+
}
|
|
672
|
+
var ot = (e) => {
|
|
673
|
+
e.type == et.CHILD && (e._$AP ??= at, e._$AQ ??= it);
|
|
674
|
+
}, st = class extends nt {
|
|
675
|
+
constructor() {
|
|
676
|
+
super(...arguments), this._$AN = void 0;
|
|
677
|
+
}
|
|
678
|
+
_$AT(e, t, n) {
|
|
679
|
+
super._$AT(e, t, n), rt(this), this.isConnected = e._$AU;
|
|
680
|
+
}
|
|
681
|
+
_$AO(e, t = !0) {
|
|
682
|
+
e !== this.isConnected && (this.isConnected = e, e ? this.reconnected?.() : this.disconnected?.()), t && (K(this, e), q(this));
|
|
683
|
+
}
|
|
684
|
+
setValue(e) {
|
|
685
|
+
if ($e(this._$Ct)) this._$Ct._$AI(e, this);
|
|
686
|
+
else {
|
|
687
|
+
let t = [...this._$Ct._$AH];
|
|
688
|
+
t[this._$Ci] = e, this._$Ct._$AI(t, this, 0);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
disconnected() {}
|
|
692
|
+
reconnected() {}
|
|
693
|
+
}, ct = /* @__PURE__ */ new WeakMap(), lt = tt(class extends st {
|
|
694
|
+
render(e) {
|
|
695
|
+
return N;
|
|
696
|
+
}
|
|
697
|
+
update(e, [t]) {
|
|
698
|
+
let n = t !== this.G;
|
|
699
|
+
return n && this.G !== void 0 && this.rt(void 0), (n || this.lt !== this.ct) && (this.G = t, this.ht = e.options?.host, this.rt(this.ct = e.element)), N;
|
|
700
|
+
}
|
|
701
|
+
rt(e) {
|
|
702
|
+
if (this.isConnected || (e = void 0), typeof this.G == "function") {
|
|
703
|
+
let t = this.ht ?? globalThis, n = ct.get(t);
|
|
704
|
+
n === void 0 && (n = /* @__PURE__ */ new WeakMap(), ct.set(t, n)), n.get(this.G) !== void 0 && this.G.call(this.ht, void 0), n.set(this.G, e), e !== void 0 && this.G.call(this.ht, e);
|
|
705
|
+
} else this.G.value = e;
|
|
706
|
+
}
|
|
707
|
+
get lt() {
|
|
708
|
+
return typeof this.G == "function" ? ct.get(this.ht ?? globalThis)?.get(this.G) : this.G?.value;
|
|
709
|
+
}
|
|
710
|
+
disconnected() {
|
|
711
|
+
this.lt === this.ct && this.rt(void 0);
|
|
712
|
+
}
|
|
713
|
+
reconnected() {
|
|
714
|
+
this.rt(this.ct);
|
|
715
|
+
}
|
|
716
|
+
}), ut = class extends nt {
|
|
717
|
+
constructor(e) {
|
|
718
|
+
if (super(e), this.it = N, e.type !== et.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
719
|
+
}
|
|
720
|
+
render(e) {
|
|
721
|
+
if (e === N || e == null) return this._t = void 0, this.it = e;
|
|
722
|
+
if (e === M) return e;
|
|
723
|
+
if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
724
|
+
if (e === this.it) return this._t;
|
|
725
|
+
this.it = e;
|
|
726
|
+
let t = [e];
|
|
727
|
+
return t.raw = t, this._t = {
|
|
728
|
+
_$litType$: this.constructor.resultType,
|
|
729
|
+
strings: t,
|
|
730
|
+
values: []
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
ut.directiveName = "unsafeHTML", ut.resultType = 1;
|
|
735
|
+
var dt = tt(ut);
|
|
736
|
+
//#endregion
|
|
737
|
+
//#region src/field-utils.ts
|
|
738
|
+
function ft(e) {
|
|
739
|
+
return !!e && typeof e == "object" && "id" in e && "handle" in e && "type" in e;
|
|
740
|
+
}
|
|
741
|
+
function pt(e) {
|
|
742
|
+
if (c(e.type)) return e.type;
|
|
743
|
+
let t = e.input && typeof e.input == "object" ? e.input : {}, n = typeof t.fieldKind == "string" ? t.fieldKind : null;
|
|
744
|
+
return n === "text" ? "single-line-text" : n === "textarea" ? "multi-line-text" : n === "boolean" ? "agree" : n === "file" ? "file" : e.type;
|
|
745
|
+
}
|
|
746
|
+
//#endregion
|
|
747
|
+
//#region src/types.ts
|
|
748
|
+
var J = "formie-control-value-change";
|
|
749
|
+
//#endregion
|
|
750
|
+
//#region src/render-view.ts
|
|
751
|
+
function mt(e) {
|
|
752
|
+
return W(e), We(e);
|
|
753
|
+
}
|
|
754
|
+
function ht(e, t, n, r, i, a, o, s) {
|
|
755
|
+
if (!e || !(e instanceof HTMLElement)) return;
|
|
756
|
+
let c = t.toLowerCase(), l = e.firstElementChild;
|
|
757
|
+
(!l || l.tagName.toLowerCase() !== c) && (e.replaceChildren(), l = document.createElement(t), l.addEventListener(J, (e) => {
|
|
758
|
+
s(e.detail);
|
|
759
|
+
}), e.append(l)), l.field = n, l.value = r, l.errorKey = i, l.disabled = a, l.hidden = o;
|
|
760
|
+
}
|
|
761
|
+
function gt(e, t, n, r, i, a, o, s) {
|
|
762
|
+
return j`<div
|
|
763
|
+
class="starter-core-registry-host min-w-0"
|
|
764
|
+
${lt((e) => {
|
|
765
|
+
ht(e, t, n, r, i, a, o, s);
|
|
766
|
+
})}
|
|
767
|
+
></div>`;
|
|
768
|
+
}
|
|
769
|
+
function _t(e, t, n, r, i = "default") {
|
|
770
|
+
if (i === "compositePart") return vt(t, n, r);
|
|
771
|
+
let a = e.registry.fieldTag;
|
|
772
|
+
if (!a) return yt(t, n, r);
|
|
773
|
+
let o = mt(a);
|
|
774
|
+
return V`<${o} .field=${t} .errors=${n}>${r}</${o}>`;
|
|
775
|
+
}
|
|
776
|
+
function vt(e, t, n) {
|
|
777
|
+
return j`
|
|
778
|
+
<div class="starter-component-subfield" data-formie-field-type=${e.type}>
|
|
779
|
+
${e.label ? j`<label class="starter-component-subfield-label">${e.label}</label>` : N}
|
|
780
|
+
<div class="starter-component-injected-control grid gap-2 text-slate-900">${n}</div>
|
|
781
|
+
${t.length > 0 ? j`<ul class="grid gap-1 text-sm text-red-600">
|
|
782
|
+
${t.map((e) => j`<li>${e}</li>`)}
|
|
783
|
+
</ul>` : N}
|
|
784
|
+
</div>
|
|
785
|
+
`;
|
|
786
|
+
}
|
|
787
|
+
function yt(e, t, n) {
|
|
788
|
+
return j`
|
|
789
|
+
<div class="starter-component-card" data-formie-field-type=${e.type}>
|
|
790
|
+
${e.label ? j`<label class="starter-component-label">${e.label}</label>` : N}
|
|
791
|
+
${e.instructions ? j`<p class="starter-component-help">${e.instructions}</p>` : N}
|
|
792
|
+
<div class="starter-component-injected-control grid gap-2 text-slate-900">${n}</div>
|
|
793
|
+
${t.length > 0 ? j`<ul class="grid gap-1 text-sm text-red-600">
|
|
794
|
+
${t.map((e) => j`<li>${e}</li>`)}
|
|
795
|
+
</ul>` : N}
|
|
796
|
+
</div>
|
|
797
|
+
`;
|
|
798
|
+
}
|
|
799
|
+
function bt(e, t, n, r) {
|
|
800
|
+
let i = e.input;
|
|
801
|
+
if (e.type === "multi-line-text") return j`
|
|
802
|
+
<textarea
|
|
803
|
+
class="starter-component-control"
|
|
804
|
+
.value=${typeof t == "string" ? t : ""}
|
|
805
|
+
?disabled=${n}
|
|
806
|
+
placeholder=${typeof i.placeholder == "string" ? i.placeholder : ""}
|
|
807
|
+
@input=${(e) => {
|
|
808
|
+
r(e.target.value);
|
|
809
|
+
}}
|
|
810
|
+
></textarea>
|
|
811
|
+
`;
|
|
812
|
+
if (e.type === "dropdown") {
|
|
813
|
+
let e = Array.isArray(i.options) ? i.options : [], a = i.multiple === !0;
|
|
814
|
+
return j`
|
|
815
|
+
<select
|
|
816
|
+
class="starter-component-control"
|
|
817
|
+
?disabled=${n}
|
|
818
|
+
multiple=${a}
|
|
819
|
+
.value=${a ? void 0 : typeof t == "string" ? t : ""}
|
|
820
|
+
@change=${(e) => {
|
|
821
|
+
let t = e.target;
|
|
822
|
+
r(a ? Array.from(t.selectedOptions).map((e) => e.value) : t.value);
|
|
823
|
+
}}
|
|
824
|
+
>
|
|
825
|
+
${e.map((e) => j`
|
|
826
|
+
<option
|
|
827
|
+
value=${String(e.value ?? "")}
|
|
828
|
+
?disabled=${e.disabled === !0}
|
|
829
|
+
>
|
|
830
|
+
${String(e.label ?? e.value ?? "")}
|
|
831
|
+
</option>
|
|
832
|
+
`)}
|
|
833
|
+
</select>
|
|
834
|
+
`;
|
|
835
|
+
}
|
|
836
|
+
return j`
|
|
837
|
+
<input
|
|
838
|
+
class="starter-component-control"
|
|
839
|
+
type=${typeof i.inputType == "string" ? i.inputType : e.type === "email" ? "email" : e.type === "phone" ? "tel" : e.type === "number" ? "number" : "text"}
|
|
840
|
+
.value=${typeof t == "string" ? t : ""}
|
|
841
|
+
?disabled=${n}
|
|
842
|
+
placeholder=${typeof i.placeholder == "string" ? i.placeholder : ""}
|
|
843
|
+
@input=${(e) => {
|
|
844
|
+
r(e.target.value);
|
|
845
|
+
}}
|
|
846
|
+
/>
|
|
847
|
+
`;
|
|
848
|
+
}
|
|
849
|
+
function xt(e, t) {
|
|
850
|
+
let { field: n, value: r, errorKey: i, disabled: a, setValue: u } = t, d = n.input, f = pt(n);
|
|
851
|
+
if (o(n)) return Ct(e, t);
|
|
852
|
+
if (l(n)) return wt(e, t);
|
|
853
|
+
if (s(n)) return St(n, r, a, u);
|
|
854
|
+
if (f === "signature") return j`<formie-internal-signature
|
|
855
|
+
.field=${n}
|
|
856
|
+
.modules=${e.state.definition.modules}
|
|
857
|
+
.value=${typeof r == "string" ? r : ""}
|
|
858
|
+
?disabled=${a}
|
|
859
|
+
@formie-control-value-change=${(e) => {
|
|
860
|
+
u(e.detail);
|
|
861
|
+
}}
|
|
862
|
+
></formie-internal-signature>`;
|
|
863
|
+
if (f === "multi-line-text" || f === "dropdown") return bt(n, r, a, u);
|
|
864
|
+
if (f === "radio") return j`
|
|
865
|
+
<div class="flex flex-col gap-2">
|
|
866
|
+
${(Array.isArray(d.options) ? d.options : []).map((e) => {
|
|
867
|
+
let t = String(e.value ?? "");
|
|
868
|
+
return j`
|
|
869
|
+
<label class="flex items-center gap-2 text-sm text-slate-800">
|
|
870
|
+
<input
|
|
871
|
+
type="radio"
|
|
872
|
+
name=${`${n.id}-radio`}
|
|
873
|
+
.checked=${r === t}
|
|
874
|
+
?disabled=${a}
|
|
875
|
+
@change=${() => {
|
|
876
|
+
u(t);
|
|
877
|
+
}}
|
|
878
|
+
/>
|
|
879
|
+
<span>${String(e.label ?? t)}</span>
|
|
880
|
+
</label>
|
|
881
|
+
`;
|
|
882
|
+
})}
|
|
883
|
+
</div>
|
|
884
|
+
`;
|
|
885
|
+
if (f === "checkboxes") {
|
|
886
|
+
let e = Array.isArray(d.options) ? d.options : [], t = Array.isArray(r) ? r.map((e) => String(e)) : [];
|
|
887
|
+
return j`
|
|
888
|
+
<div class="flex flex-col gap-2">
|
|
889
|
+
${e.map((e) => {
|
|
890
|
+
let n = String(e.value ?? ""), r = t.includes(n);
|
|
891
|
+
return j`
|
|
892
|
+
<label class="flex items-center gap-2 text-sm text-slate-800">
|
|
893
|
+
<input
|
|
894
|
+
type="checkbox"
|
|
895
|
+
.checked=${r}
|
|
896
|
+
?disabled=${a}
|
|
897
|
+
@change=${() => {
|
|
898
|
+
u(r ? t.filter((e) => e !== n) : [...t, n]);
|
|
899
|
+
}}
|
|
900
|
+
/>
|
|
901
|
+
<span>${String(e.label ?? n)}</span>
|
|
902
|
+
</label>
|
|
903
|
+
`;
|
|
904
|
+
})}
|
|
905
|
+
</div>
|
|
906
|
+
`;
|
|
907
|
+
}
|
|
908
|
+
if (f === "agree") {
|
|
909
|
+
let e = typeof d.descriptionHtml == "string" ? d.descriptionHtml : null;
|
|
910
|
+
return j`
|
|
911
|
+
<label class="flex items-start gap-2 text-sm text-slate-800">
|
|
912
|
+
<input
|
|
913
|
+
type="checkbox"
|
|
914
|
+
.checked=${r === !0}
|
|
915
|
+
?disabled=${a}
|
|
916
|
+
@change=${(e) => {
|
|
917
|
+
u(e.target.checked);
|
|
918
|
+
}}
|
|
919
|
+
/>
|
|
920
|
+
<span>${e ? dt(e) : n.label ?? ""}</span>
|
|
921
|
+
</label>
|
|
922
|
+
`;
|
|
923
|
+
}
|
|
924
|
+
return c(f) ? bt(n, r, a, u) : j`<div class="rounded-xl border border-amber-200 bg-amber-50 p-3 text-sm text-amber-900">
|
|
925
|
+
Unknown field type:
|
|
926
|
+
${String(n.meta?.fieldType ?? n.type)}
|
|
927
|
+
</div>`;
|
|
928
|
+
}
|
|
929
|
+
function St(e, t, n, r) {
|
|
930
|
+
let i = e.input, a = Array.isArray(t) ? t : [], o = i.multiple === !0, s = a.map((e, t) => e && typeof e == "object" && "name" in e && typeof e.name == "string" ? e.name : e && typeof e == "object" && "filename" in e && typeof e.filename == "string" ? e.filename : e && typeof e == "object" && "assetId" in e && typeof e.assetId == "number" ? `Asset #${e.assetId}` : `File ${t + 1}`);
|
|
931
|
+
return j`
|
|
932
|
+
<div class="grid gap-2">
|
|
933
|
+
<input
|
|
934
|
+
type="file"
|
|
935
|
+
class="starter-component-control"
|
|
936
|
+
?disabled=${n}
|
|
937
|
+
multiple=${o}
|
|
938
|
+
@change=${(e) => {
|
|
939
|
+
let t = e.target;
|
|
940
|
+
r(Array.from(t.files || []));
|
|
941
|
+
}}
|
|
942
|
+
/>
|
|
943
|
+
${s.length > 0 ? j`<ul class="grid gap-1 text-sm text-slate-600">
|
|
944
|
+
${s.map((e) => j`<li>${e}</li>`)}
|
|
945
|
+
</ul>` : N}
|
|
946
|
+
</div>
|
|
947
|
+
`;
|
|
948
|
+
}
|
|
949
|
+
function Ct(e, n) {
|
|
950
|
+
let { field: r, value: i, errorKey: a, disabled: o, setValue: s } = n, c = t(r), l = i && typeof i == "object" ? i : {};
|
|
951
|
+
return c.length === 0 ? j`<div class="text-sm text-amber-800">Composite field has no parts.</div>` : j`
|
|
952
|
+
<div class="starter-component-name-grid">
|
|
953
|
+
${c.filter((e) => e.meta?.hidden !== !0).map((t) => {
|
|
954
|
+
let n = `${a}.${t.handle}`;
|
|
955
|
+
return Tt(e, {
|
|
956
|
+
field: t,
|
|
957
|
+
value: l[t.handle],
|
|
958
|
+
errors: e.state.errors.fields[n] || [],
|
|
959
|
+
errorKey: n,
|
|
960
|
+
disabled: o || t.meta?.disabled === !0,
|
|
961
|
+
setValue(e) {
|
|
962
|
+
s({
|
|
963
|
+
...l,
|
|
964
|
+
[t.handle]: e
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
}, "compositePart");
|
|
968
|
+
})}
|
|
969
|
+
</div>
|
|
970
|
+
`;
|
|
971
|
+
}
|
|
972
|
+
function wt(e, t) {
|
|
973
|
+
let { field: n, value: r, errorKey: a, disabled: o, setValue: s } = t, c = f(n), l = Array.isArray(r) ? r : [], u = n.input, d = Number(u.minRows ?? 0) || 0, p = Number(u.maxRows ?? 0) || 0, ee = !o && (p <= 0 || l.length < p);
|
|
974
|
+
return c.length === 0 ? j`<div class="text-sm text-amber-800">Repeater has no row layout.</div>` : j`
|
|
975
|
+
<div class="grid gap-4" data-formie-repeater-container>
|
|
976
|
+
${l.map((t, n) => j`
|
|
977
|
+
<div class="rounded-xl border border-slate-200 p-4" data-formie-repeater-item>
|
|
978
|
+
${c.map((r, i) => Et(e, r, t, `${a}.${n}`, o, (e, t) => {
|
|
979
|
+
s(l.map((r, i) => i === n ? {
|
|
980
|
+
...r,
|
|
981
|
+
[e.handle]: t
|
|
982
|
+
} : r));
|
|
983
|
+
}))}
|
|
984
|
+
<button
|
|
985
|
+
type="button"
|
|
986
|
+
class="mt-2 rounded-lg border border-slate-200 px-3 py-1.5 text-sm font-medium text-slate-700"
|
|
987
|
+
?disabled=${o || d > 0 && l.length <= d}
|
|
988
|
+
@click=${() => {
|
|
989
|
+
s(l.filter((e, t) => t !== n));
|
|
990
|
+
}}
|
|
991
|
+
>
|
|
992
|
+
Remove
|
|
993
|
+
</button>
|
|
994
|
+
</div>
|
|
995
|
+
`)}
|
|
996
|
+
<button
|
|
997
|
+
type="button"
|
|
998
|
+
class="rounded-xl border border-slate-200 bg-white px-4 py-2 text-sm font-semibold text-slate-700 shadow-sm"
|
|
999
|
+
?disabled=${!ee}
|
|
1000
|
+
@click=${() => {
|
|
1001
|
+
s([...l, i(n)]);
|
|
1002
|
+
}}
|
|
1003
|
+
>
|
|
1004
|
+
${String(u.addLabel ?? "Add another row")}
|
|
1005
|
+
</button>
|
|
1006
|
+
</div>
|
|
1007
|
+
`;
|
|
1008
|
+
}
|
|
1009
|
+
function Tt(e, t, n = "default") {
|
|
1010
|
+
let { field: r, value: i, errors: a, errorKey: o, disabled: s, setValue: c } = t, l = e.state.fieldStates[r.id]?.hidden === !0;
|
|
1011
|
+
if (l) return j``;
|
|
1012
|
+
let u = pt(r), d = e.registry.fieldControls[r.type] || e.registry.fieldControls[u] || null, f = (t) => {
|
|
1013
|
+
c(t), e.host.requestUpdate();
|
|
1014
|
+
};
|
|
1015
|
+
return _t(e, r, a, d ? gt(e, d, r, i, o, s, l, f) : xt(e, {
|
|
1016
|
+
...t,
|
|
1017
|
+
setValue: f
|
|
1018
|
+
}), n);
|
|
1019
|
+
}
|
|
1020
|
+
function Et(e, t, n, r, i, a) {
|
|
1021
|
+
return j`
|
|
1022
|
+
<div class="starter-core-row grid gap-4">
|
|
1023
|
+
${t.fields.map((t) => {
|
|
1024
|
+
let o = `${r}.${t.handle}`;
|
|
1025
|
+
return Tt(e, {
|
|
1026
|
+
field: t,
|
|
1027
|
+
value: n[t.handle],
|
|
1028
|
+
errors: e.state.errors.fields[o] || [],
|
|
1029
|
+
errorKey: o,
|
|
1030
|
+
disabled: i === !0 || e.state.fieldStates[t.id]?.disabled === !0,
|
|
1031
|
+
setValue(e) {
|
|
1032
|
+
a(t, e);
|
|
1033
|
+
}
|
|
1034
|
+
});
|
|
1035
|
+
})}
|
|
1036
|
+
</div>
|
|
1037
|
+
`;
|
|
1038
|
+
}
|
|
1039
|
+
function Dt(e, t) {
|
|
1040
|
+
return j`
|
|
1041
|
+
<div class="starter-core-row grid gap-4">
|
|
1042
|
+
${t.fields.map((t) => Tt(e, {
|
|
1043
|
+
field: t,
|
|
1044
|
+
value: e.state.values[t.id],
|
|
1045
|
+
errors: e.state.errors.fields[t.id] || [],
|
|
1046
|
+
errorKey: t.id,
|
|
1047
|
+
disabled: e.state.fieldStates[t.id]?.disabled === !0,
|
|
1048
|
+
setValue(n) {
|
|
1049
|
+
e.instance.setValue(t.id, n);
|
|
1050
|
+
}
|
|
1051
|
+
}))}
|
|
1052
|
+
</div>
|
|
1053
|
+
`;
|
|
1054
|
+
}
|
|
1055
|
+
function Ot(e) {
|
|
1056
|
+
let t = e.state.definition.pages.find((t) => t.id === e.state.currentPageId);
|
|
1057
|
+
if (!t) return j``;
|
|
1058
|
+
let n = e.registry.regions.pageActions;
|
|
1059
|
+
if (n) {
|
|
1060
|
+
let r = mt(n);
|
|
1061
|
+
return V`<${r}
|
|
1062
|
+
.page=${t}
|
|
1063
|
+
.state=${e.state}
|
|
1064
|
+
.instance=${e.instance}
|
|
1065
|
+
></${r}>`;
|
|
1066
|
+
}
|
|
1067
|
+
return j`
|
|
1068
|
+
<div class="formie-page-actions">
|
|
1069
|
+
${t.actions.secondary.map((t) => j`
|
|
1070
|
+
<button
|
|
1071
|
+
type="button"
|
|
1072
|
+
@click=${() => {
|
|
1073
|
+
e.instance.submit(t.type);
|
|
1074
|
+
}}
|
|
1075
|
+
>
|
|
1076
|
+
${t.label}
|
|
1077
|
+
</button>
|
|
1078
|
+
`)}
|
|
1079
|
+
<button type="submit">${t.actions.primary.label}</button>
|
|
1080
|
+
</div>
|
|
1081
|
+
`;
|
|
1082
|
+
}
|
|
1083
|
+
function kt(e) {
|
|
1084
|
+
let t = e.state.definition.pages.find((t) => t.id === e.state.currentPageId && e.state.pageStates[t.id]?.hidden !== !0) || e.state.definition.pages.find((t) => e.state.pageStates[t.id]?.hidden !== !0) || e.state.definition.pages[0];
|
|
1085
|
+
if (!t) return j``;
|
|
1086
|
+
let n = e.state.errors.form, r = e.state.lastSubmitResult?.messages.error, i = !!r && !n.includes(r), a = j`
|
|
1087
|
+
${n.length > 0 ? j`<div class="starter-core-msg starter-core-msg-error mb-4 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800">
|
|
1088
|
+
<ul class="list-inside list-disc">
|
|
1089
|
+
${n.map((e) => j`<li>${e}</li>`)}
|
|
1090
|
+
</ul>
|
|
1091
|
+
</div>` : N}
|
|
1092
|
+
${e.state.lastSubmitResult?.messages.notice ? j`<div class="mb-4 rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-800">
|
|
1093
|
+
${e.state.lastSubmitResult.messages.notice}
|
|
1094
|
+
</div>` : N}
|
|
1095
|
+
${i ? j`<div class="mb-4 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800">${r}</div>` : N}
|
|
1096
|
+
${At(e, t)}
|
|
1097
|
+
`, o = e.state.session.tokens.render ?? "";
|
|
1098
|
+
return j`
|
|
1099
|
+
<form
|
|
1100
|
+
class=${e.formClass || "starter-component-form starter-core-preview text-slate-900"}
|
|
1101
|
+
data-formie-definition=${e.state.definition.handle}
|
|
1102
|
+
data-formie-render-id=${o}
|
|
1103
|
+
@submit=${(t) => {
|
|
1104
|
+
t.preventDefault(), e.instance.submit();
|
|
1105
|
+
}}
|
|
1106
|
+
>
|
|
1107
|
+
${a}
|
|
1108
|
+
</form>
|
|
1109
|
+
`;
|
|
1110
|
+
}
|
|
1111
|
+
function At(e, t) {
|
|
1112
|
+
let n = e.registry.regions.page, r = j`
|
|
1113
|
+
<div class="starter-core-fields grid gap-4">
|
|
1114
|
+
${t.rows.map((t) => Dt(e, t))}
|
|
1115
|
+
</div>
|
|
1116
|
+
${Ot(e)}
|
|
1117
|
+
`;
|
|
1118
|
+
if (n) {
|
|
1119
|
+
let i = mt(n);
|
|
1120
|
+
return V`<${i} .page=${t} .state=${e.state}>${r}</${i}>`;
|
|
1121
|
+
}
|
|
1122
|
+
return j`
|
|
1123
|
+
<section data-page-id=${t.id} class="starter-core-page space-y-4">
|
|
1124
|
+
${r}
|
|
1125
|
+
</section>
|
|
1126
|
+
`;
|
|
1127
|
+
}
|
|
1128
|
+
function jt(e = "Loading form…") {
|
|
1129
|
+
return j`<div class="mt-3 text-sm text-slate-500">${e}</div>`;
|
|
1130
|
+
}
|
|
1131
|
+
function Mt(e) {
|
|
1132
|
+
return j`<div class="mb-4 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800">${e}</div>`;
|
|
1133
|
+
}
|
|
1134
|
+
//#endregion
|
|
1135
|
+
//#region \0@oxc-project+runtime@0.127.0/helpers/decorate.js
|
|
1136
|
+
function Y(e, t, n, r) {
|
|
1137
|
+
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
1138
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
1139
|
+
else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
|
|
1140
|
+
return i > 3 && a && Object.defineProperty(t, n, a), a;
|
|
1141
|
+
}
|
|
1142
|
+
//#endregion
|
|
1143
|
+
//#region src/formie-core-form.ts
|
|
1144
|
+
function Nt(e) {
|
|
1145
|
+
return W(e), We(e);
|
|
1146
|
+
}
|
|
1147
|
+
var X = class extends B {
|
|
1148
|
+
constructor(...e) {
|
|
1149
|
+
super(...e), this.endpoint = "", this.formHandle = "", this.transport = "rest", this.fetchCredentials = "same-origin", this.formClass = "", this.loadingMessage = "Loading form…", this.loadError = null, this.booting = !1, this.snapshot = null, this.instance = null, this.unsubscribers = [], this.loadGeneration = 0;
|
|
1150
|
+
}
|
|
1151
|
+
createRenderRoot() {
|
|
1152
|
+
return this;
|
|
1153
|
+
}
|
|
1154
|
+
disconnectedCallback() {
|
|
1155
|
+
super.disconnectedCallback(), this.teardown();
|
|
1156
|
+
}
|
|
1157
|
+
connectedCallback() {
|
|
1158
|
+
super.connectedCallback(), this.bootstrap(!1);
|
|
1159
|
+
}
|
|
1160
|
+
willUpdate(e) {
|
|
1161
|
+
super.willUpdate(e), this.hasUpdated && [
|
|
1162
|
+
"endpoint",
|
|
1163
|
+
"formHandle",
|
|
1164
|
+
"siteId",
|
|
1165
|
+
"transport",
|
|
1166
|
+
"fetchCredentials"
|
|
1167
|
+
].some((t) => e.has(t)) && this.bootstrap(!0);
|
|
1168
|
+
}
|
|
1169
|
+
getFormieInstance() {
|
|
1170
|
+
return this.instance;
|
|
1171
|
+
}
|
|
1172
|
+
async reload() {
|
|
1173
|
+
await this.bootstrap(!0);
|
|
1174
|
+
}
|
|
1175
|
+
get resolvedRegistry() {
|
|
1176
|
+
return this.registry ?? Xe();
|
|
1177
|
+
}
|
|
1178
|
+
teardown() {
|
|
1179
|
+
for (let e of this.unsubscribers) e();
|
|
1180
|
+
this.unsubscribers = [], this.instance?.destroy(), this.instance = null, this.snapshot = null;
|
|
1181
|
+
}
|
|
1182
|
+
async bootstrap(t) {
|
|
1183
|
+
let i = ++this.loadGeneration, o = this.formHandle.trim(), s = this.endpoint.trim();
|
|
1184
|
+
if (!o) {
|
|
1185
|
+
this.teardown(), this.booting = !1, this.loadError = "Set `form-handle` on <formie-core-form>.";
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
if (t) this.teardown();
|
|
1189
|
+
else if (this.instance) return;
|
|
1190
|
+
this.booting = !0, this.loadError = null;
|
|
1191
|
+
let c = this.fetchCredentials, l = this.siteId;
|
|
1192
|
+
try {
|
|
1193
|
+
let t = {
|
|
1194
|
+
endpoint: s,
|
|
1195
|
+
formHandle: o,
|
|
1196
|
+
...l === void 0 ? {} : { siteId: l },
|
|
1197
|
+
credentials: c
|
|
1198
|
+
}, f = this.transport === "graphql" ? await d(t) : await u(t);
|
|
1199
|
+
if (i !== this.loadGeneration) return;
|
|
1200
|
+
let p = n({
|
|
1201
|
+
envelope: f,
|
|
1202
|
+
transport: this.transport === "graphql" ? r(t) : a(t)
|
|
1203
|
+
});
|
|
1204
|
+
this.instance = p;
|
|
1205
|
+
for (let t of e) {
|
|
1206
|
+
let e = p.on(t, (e) => {
|
|
1207
|
+
this.dispatchEvent(new CustomEvent(t, {
|
|
1208
|
+
detail: e,
|
|
1209
|
+
bubbles: !0,
|
|
1210
|
+
composed: !0
|
|
1211
|
+
}));
|
|
1212
|
+
});
|
|
1213
|
+
this.unsubscribers.push(e);
|
|
1214
|
+
}
|
|
1215
|
+
this.unsubscribers.push(p.subscribe((e) => {
|
|
1216
|
+
this.snapshot = e, this.requestUpdate();
|
|
1217
|
+
})), this.booting = !1;
|
|
1218
|
+
} catch (e) {
|
|
1219
|
+
if (i !== this.loadGeneration) return;
|
|
1220
|
+
this.teardown(), this.booting = !1, this.loadError = e instanceof Error ? e.message : "Unable to load the form.";
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
render() {
|
|
1224
|
+
let e = this.resolvedRegistry;
|
|
1225
|
+
if (this.loadError) {
|
|
1226
|
+
let t = e.regions.errorSummary;
|
|
1227
|
+
if (t) {
|
|
1228
|
+
let e = Nt(t);
|
|
1229
|
+
return V`<${e} .errors=${[this.loadError]} .kind=${"load"}></${e}>`;
|
|
1230
|
+
}
|
|
1231
|
+
return Mt(this.loadError);
|
|
1232
|
+
}
|
|
1233
|
+
if (this.booting || !this.snapshot || !this.instance) {
|
|
1234
|
+
let t = e.regions.loading;
|
|
1235
|
+
if (t) {
|
|
1236
|
+
let e = Nt(t);
|
|
1237
|
+
return V`<${e} .message=${this.loadingMessage}></${e}>`;
|
|
1238
|
+
}
|
|
1239
|
+
return jt(this.loadingMessage);
|
|
1240
|
+
}
|
|
1241
|
+
return kt({
|
|
1242
|
+
registry: e,
|
|
1243
|
+
state: this.snapshot,
|
|
1244
|
+
instance: this.instance,
|
|
1245
|
+
host: this,
|
|
1246
|
+
formClass: this.formClass || ""
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
};
|
|
1250
|
+
Y([H({ type: String })], X.prototype, "endpoint", void 0), Y([H({
|
|
1251
|
+
type: String,
|
|
1252
|
+
attribute: "form-handle"
|
|
1253
|
+
})], X.prototype, "formHandle", void 0), Y([H({
|
|
1254
|
+
type: Number,
|
|
1255
|
+
attribute: "site-id",
|
|
1256
|
+
converter: { fromAttribute(e) {
|
|
1257
|
+
if (e == null || e === "") return;
|
|
1258
|
+
let t = Number(e);
|
|
1259
|
+
return Number.isFinite(t) ? t : void 0;
|
|
1260
|
+
} }
|
|
1261
|
+
})], X.prototype, "siteId", void 0), Y([H({
|
|
1262
|
+
attribute: "transport",
|
|
1263
|
+
converter: { fromAttribute(e) {
|
|
1264
|
+
return (e ?? "rest").toLowerCase() === "graphql" ? "graphql" : "rest";
|
|
1265
|
+
} }
|
|
1266
|
+
})], X.prototype, "transport", void 0), Y([H({
|
|
1267
|
+
attribute: "fetch-credentials",
|
|
1268
|
+
converter: { fromAttribute(e) {
|
|
1269
|
+
return e === "omit" || e === "same-origin" || e === "include" ? e : "same-origin";
|
|
1270
|
+
} }
|
|
1271
|
+
})], X.prototype, "fetchCredentials", void 0), Y([H({
|
|
1272
|
+
type: String,
|
|
1273
|
+
attribute: "form-class"
|
|
1274
|
+
})], X.prototype, "formClass", void 0), Y([H({
|
|
1275
|
+
type: String,
|
|
1276
|
+
attribute: "loading-message"
|
|
1277
|
+
})], X.prototype, "loadingMessage", void 0), Y([H({ attribute: !1 })], X.prototype, "registry", void 0), Y([U()], X.prototype, "loadError", void 0), Y([U()], X.prototype, "booting", void 0), Y([U()], X.prototype, "snapshot", void 0);
|
|
1278
|
+
//#endregion
|
|
1279
|
+
//#region src/form-element.ts
|
|
1280
|
+
function Pt(e) {
|
|
1281
|
+
if (e == null || e === "") return !1;
|
|
1282
|
+
let t = e.toLowerCase();
|
|
1283
|
+
return t === "true" || t === "1";
|
|
1284
|
+
}
|
|
1285
|
+
function Z(e, t, n) {
|
|
1286
|
+
typeof n == "string" && n.length > 0 ? e.setAttribute(t, n) : e.removeAttribute(t);
|
|
1287
|
+
}
|
|
1288
|
+
function Q(e, t, n) {
|
|
1289
|
+
n === !0 ? e.setAttribute(t, "true") : e.removeAttribute(t);
|
|
1290
|
+
}
|
|
1291
|
+
function Ft(e, t) {
|
|
1292
|
+
if (t) return t.startsWith("http") ? t : `${e}${t}`;
|
|
1293
|
+
}
|
|
1294
|
+
var It = class extends HTMLElement {
|
|
1295
|
+
static get observedAttributes() {
|
|
1296
|
+
return [
|
|
1297
|
+
"mode",
|
|
1298
|
+
"transport",
|
|
1299
|
+
"theme",
|
|
1300
|
+
"form-handle",
|
|
1301
|
+
"endpoint",
|
|
1302
|
+
"refresh-tokens",
|
|
1303
|
+
"static-cache",
|
|
1304
|
+
"locale",
|
|
1305
|
+
"site-id",
|
|
1306
|
+
"auto-visible",
|
|
1307
|
+
"base-url"
|
|
1308
|
+
];
|
|
1309
|
+
}
|
|
1310
|
+
constructor() {
|
|
1311
|
+
super(), this.mountedInstance = null, this.optionState = {}, this.mountScheduled = null, this.eventUnsubs = [];
|
|
1312
|
+
}
|
|
1313
|
+
ensureInitialized() {
|
|
1314
|
+
this.mountRoot ||= (this.client = te(), document.createElement("div"));
|
|
1315
|
+
}
|
|
1316
|
+
connectedCallback() {
|
|
1317
|
+
this.ensureInitialized(), this.style.display = "block", this.contains(this.mountRoot) || this.append(this.mountRoot), this.scheduleMount();
|
|
1318
|
+
}
|
|
1319
|
+
disconnectedCallback() {
|
|
1320
|
+
this.unmount();
|
|
1321
|
+
}
|
|
1322
|
+
attributeChangedCallback(e, t, n) {
|
|
1323
|
+
t === n || !this.isConnected || e === "refresh-tokens" && this.optionState.refreshTokens !== void 0 || e === "static-cache" && this.optionState.staticCache !== void 0 || this.scheduleMount();
|
|
1324
|
+
}
|
|
1325
|
+
get baseUrl() {
|
|
1326
|
+
let e = this.getAttribute("base-url");
|
|
1327
|
+
return this.optionState.baseUrl ?? e ?? void 0;
|
|
1328
|
+
}
|
|
1329
|
+
set baseUrl(e) {
|
|
1330
|
+
this.optionState.baseUrl = e, Z(this, "base-url", e), this.scheduleMount();
|
|
1331
|
+
}
|
|
1332
|
+
get transport() {
|
|
1333
|
+
let e = this.getAttribute("transport");
|
|
1334
|
+
return this.optionState.transport ?? e ?? void 0;
|
|
1335
|
+
}
|
|
1336
|
+
set transport(e) {
|
|
1337
|
+
this.optionState.transport = e, Z(this, "transport", e), this.scheduleMount();
|
|
1338
|
+
}
|
|
1339
|
+
get theme() {
|
|
1340
|
+
let e = this.getAttribute("theme");
|
|
1341
|
+
return this.optionState.theme ?? e ?? void 0;
|
|
1342
|
+
}
|
|
1343
|
+
set theme(e) {
|
|
1344
|
+
this.optionState.theme = e, Z(this, "theme", e), this.scheduleMount();
|
|
1345
|
+
}
|
|
1346
|
+
get themeConfig() {
|
|
1347
|
+
return this.optionState.themeConfig;
|
|
1348
|
+
}
|
|
1349
|
+
set themeConfig(e) {
|
|
1350
|
+
this.optionState.themeConfig = e, this.scheduleMount();
|
|
1351
|
+
}
|
|
1352
|
+
get payload() {
|
|
1353
|
+
return this.optionState.payload;
|
|
1354
|
+
}
|
|
1355
|
+
set payload(e) {
|
|
1356
|
+
this.optionState.payload = e, this.scheduleMount();
|
|
1357
|
+
}
|
|
1358
|
+
get formHandle() {
|
|
1359
|
+
let e = this.getAttribute("form-handle");
|
|
1360
|
+
return this.optionState.formHandle ?? e ?? void 0;
|
|
1361
|
+
}
|
|
1362
|
+
set formHandle(e) {
|
|
1363
|
+
this.optionState.formHandle = e, Z(this, "form-handle", e), this.scheduleMount();
|
|
1364
|
+
}
|
|
1365
|
+
get endpoint() {
|
|
1366
|
+
let e = this.getAttribute("endpoint");
|
|
1367
|
+
return this.optionState.endpoint ?? e ?? void 0;
|
|
1368
|
+
}
|
|
1369
|
+
set endpoint(e) {
|
|
1370
|
+
this.optionState.endpoint = e, Z(this, "endpoint", e), this.scheduleMount();
|
|
1371
|
+
}
|
|
1372
|
+
get staticCache() {
|
|
1373
|
+
return this.optionState.staticCache ?? (this.hasAttribute("static-cache") ? Pt(this.getAttribute("static-cache")) : void 0);
|
|
1374
|
+
}
|
|
1375
|
+
set staticCache(e) {
|
|
1376
|
+
this.optionState.staticCache = e, Q(this, "static-cache", e), this.scheduleMount();
|
|
1377
|
+
}
|
|
1378
|
+
get refreshTokens() {
|
|
1379
|
+
return this.optionState.refreshTokens ?? (this.hasAttribute("refresh-tokens") ? Pt(this.getAttribute("refresh-tokens")) : void 0);
|
|
1380
|
+
}
|
|
1381
|
+
set refreshTokens(e) {
|
|
1382
|
+
this.optionState.refreshTokens = e, Q(this, "refresh-tokens", e), this.scheduleMount();
|
|
1383
|
+
}
|
|
1384
|
+
get locale() {
|
|
1385
|
+
let e = this.getAttribute("locale");
|
|
1386
|
+
return this.optionState.locale ?? e ?? void 0;
|
|
1387
|
+
}
|
|
1388
|
+
set locale(e) {
|
|
1389
|
+
this.optionState.locale = e, Z(this, "locale", e), this.scheduleMount();
|
|
1390
|
+
}
|
|
1391
|
+
get siteId() {
|
|
1392
|
+
return this.optionState.siteId ?? (this.getAttribute("site-id") ? Number(this.getAttribute("site-id")) : void 0);
|
|
1393
|
+
}
|
|
1394
|
+
set siteId(e) {
|
|
1395
|
+
this.optionState.siteId = e, Z(this, "site-id", typeof e == "number" ? String(e) : void 0), this.scheduleMount();
|
|
1396
|
+
}
|
|
1397
|
+
get autoVisible() {
|
|
1398
|
+
return this.optionState.autoVisible ?? (this.hasAttribute("auto-visible") ? Pt(this.getAttribute("auto-visible")) : void 0);
|
|
1399
|
+
}
|
|
1400
|
+
set autoVisible(e) {
|
|
1401
|
+
this.optionState.autoVisible = e, Q(this, "auto-visible", e), this.scheduleMount();
|
|
1402
|
+
}
|
|
1403
|
+
get mode() {
|
|
1404
|
+
let e = this.getAttribute("mode");
|
|
1405
|
+
return this.optionState.mode ?? e ?? "server-rendered";
|
|
1406
|
+
}
|
|
1407
|
+
set mode(e) {
|
|
1408
|
+
this.optionState.mode = e, Z(this, "mode", e), this.scheduleMount();
|
|
1409
|
+
}
|
|
1410
|
+
getInstance() {
|
|
1411
|
+
return this.ensureInitialized(), this.mountedInstance;
|
|
1412
|
+
}
|
|
1413
|
+
async submit(e = "submit") {
|
|
1414
|
+
return this.ensureInitialized(), this.mountedInstance ? this.mountedInstance.submit(e) : null;
|
|
1415
|
+
}
|
|
1416
|
+
buildOptions() {
|
|
1417
|
+
let e = this.baseUrl || "", t = this.transport, n = t === "graphql" ? "/api" : "/actions/formie/server/forms/render", r = Ft(e, this.endpoint || n), i = this.staticCache, a = this.refreshTokens;
|
|
1418
|
+
return {
|
|
1419
|
+
mode: this.mode,
|
|
1420
|
+
transport: t,
|
|
1421
|
+
theme: this.theme,
|
|
1422
|
+
themeConfig: this.themeConfig,
|
|
1423
|
+
formHandle: this.formHandle,
|
|
1424
|
+
endpoint: r,
|
|
1425
|
+
payload: this.payload,
|
|
1426
|
+
staticCache: i,
|
|
1427
|
+
refreshTokens: a,
|
|
1428
|
+
locale: this.locale,
|
|
1429
|
+
siteId: this.siteId,
|
|
1430
|
+
autoVisible: this.autoVisible ?? !1
|
|
1431
|
+
};
|
|
1432
|
+
}
|
|
1433
|
+
bindInstanceEvents(e) {
|
|
1434
|
+
this.eventUnsubs.forEach((e) => e()), this.eventUnsubs = p.map((t) => e.on(t, (e) => {
|
|
1435
|
+
this.dispatchEvent(new CustomEvent(t, {
|
|
1436
|
+
detail: e,
|
|
1437
|
+
bubbles: !0,
|
|
1438
|
+
composed: !0
|
|
1439
|
+
}));
|
|
1440
|
+
}));
|
|
1441
|
+
}
|
|
1442
|
+
async scheduleMount() {
|
|
1443
|
+
return this.ensureInitialized(), this.mountScheduled ||= Promise.resolve().then(async () => {
|
|
1444
|
+
this.mountScheduled = null, this.isConnected && await this.mount();
|
|
1445
|
+
}), this.mountScheduled;
|
|
1446
|
+
}
|
|
1447
|
+
async mount() {
|
|
1448
|
+
await this.unmount();
|
|
1449
|
+
let e = await this.client.mount(this.mountRoot, this.buildOptions());
|
|
1450
|
+
this.mountedInstance = e, this.bindInstanceEvents(e), this.dispatchEvent(new CustomEvent("formie-mounted", {
|
|
1451
|
+
detail: {
|
|
1452
|
+
id: e.id,
|
|
1453
|
+
instance: e
|
|
1454
|
+
},
|
|
1455
|
+
bubbles: !0,
|
|
1456
|
+
composed: !0
|
|
1457
|
+
}));
|
|
1458
|
+
}
|
|
1459
|
+
async unmount() {
|
|
1460
|
+
if (this.eventUnsubs.forEach((e) => e()), this.eventUnsubs = [], !this.mountRoot || !this.mountedInstance) return;
|
|
1461
|
+
let e = this.mountedInstance;
|
|
1462
|
+
await this.client.unmount(this.mountRoot), this.mountedInstance = null, this.dispatchEvent(new CustomEvent("formie-unmounted", {
|
|
1463
|
+
detail: { id: e.id },
|
|
1464
|
+
bubbles: !0,
|
|
1465
|
+
composed: !0
|
|
1466
|
+
}));
|
|
1467
|
+
}
|
|
1468
|
+
}, $ = class extends B {
|
|
1469
|
+
constructor(...e) {
|
|
1470
|
+
super(...e), this.modules = [], this.value = "", this.disabled = !1, this.loadError = null, this.pad = null, this.strokeListener = () => {
|
|
1471
|
+
this.emitValue();
|
|
1472
|
+
}, this.onWinResize = () => {
|
|
1473
|
+
let e = this.shadowRoot?.querySelector("canvas");
|
|
1474
|
+
e instanceof HTMLCanvasElement && this.resizeCanvas(e);
|
|
1475
|
+
};
|
|
1476
|
+
}
|
|
1477
|
+
static {
|
|
1478
|
+
this.styles = ae`
|
|
1479
|
+
:host {
|
|
1480
|
+
display: block;
|
|
1481
|
+
}
|
|
1482
|
+
.wrap {
|
|
1483
|
+
display: grid;
|
|
1484
|
+
gap: 0.5rem;
|
|
1485
|
+
}
|
|
1486
|
+
canvas {
|
|
1487
|
+
width: 100%;
|
|
1488
|
+
height: 12rem;
|
|
1489
|
+
border-radius: 0.75rem;
|
|
1490
|
+
border: 1px dashed #fda4af;
|
|
1491
|
+
background: linear-gradient(180deg, #fff1f2 0%, #fff 100%);
|
|
1492
|
+
}
|
|
1493
|
+
button {
|
|
1494
|
+
justify-self: start;
|
|
1495
|
+
border-radius: 0.75rem;
|
|
1496
|
+
border: 1px solid #cbd5e1;
|
|
1497
|
+
background: #fff;
|
|
1498
|
+
padding: 0.45rem 0.85rem;
|
|
1499
|
+
font-size: 0.875rem;
|
|
1500
|
+
font-weight: 600;
|
|
1501
|
+
color: #334155;
|
|
1502
|
+
cursor: pointer;
|
|
1503
|
+
}
|
|
1504
|
+
button:disabled {
|
|
1505
|
+
opacity: 0.5;
|
|
1506
|
+
cursor: not-allowed;
|
|
1507
|
+
}
|
|
1508
|
+
.err {
|
|
1509
|
+
font-size: 0.875rem;
|
|
1510
|
+
color: #b91c1c;
|
|
1511
|
+
}
|
|
1512
|
+
`;
|
|
1513
|
+
}
|
|
1514
|
+
async firstUpdated() {
|
|
1515
|
+
let e = this.shadowRoot?.querySelector("canvas");
|
|
1516
|
+
if (!(!e || !(e instanceof HTMLCanvasElement))) try {
|
|
1517
|
+
let { default: t } = await import("./signature_pad-69C-Dgt3.js"), n = this.resolveDrawModuleConfig(), r = typeof n?.options == "object" && n.options && typeof n.options.backgroundColor == "string" ? String(n.options.backgroundColor) : "#ffffff", i = typeof n?.options == "object" && n.options && typeof n.options.penColor == "string" ? String(n.options.penColor) : "#000000", a = typeof n?.options == "object" && n.options && Number(n.options.penWeight ?? 2) || 2, o = new t(e, {
|
|
1518
|
+
backgroundColor: r,
|
|
1519
|
+
penColor: i,
|
|
1520
|
+
minWidth: a,
|
|
1521
|
+
maxWidth: a
|
|
1522
|
+
});
|
|
1523
|
+
this.pad = o, o.addEventListener?.("endStroke", this.strokeListener), this.resizeCanvas(e), window.addEventListener("resize", this.onWinResize), this.applySerializedValue();
|
|
1524
|
+
} catch (e) {
|
|
1525
|
+
this.loadError = e instanceof Error ? e.message : "Signature pad failed to load.";
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
disconnectedCallback() {
|
|
1529
|
+
super.disconnectedCallback(), window.removeEventListener("resize", this.onWinResize), this.pad?.removeEventListener && this.pad.removeEventListener("endStroke", this.strokeListener), this.pad = null;
|
|
1530
|
+
}
|
|
1531
|
+
resolveDrawModuleConfig() {
|
|
1532
|
+
let e = new Set(this.field.moduleRefs || []), t = this.modules.find((t) => e.has(t.id) && t.capability === "draw-signature");
|
|
1533
|
+
return t && typeof t.config == "object" && t.config ? t.config : null;
|
|
1534
|
+
}
|
|
1535
|
+
resizeCanvas(e) {
|
|
1536
|
+
let t = Math.max(window.devicePixelRatio || 1, 1), n = Math.max(1, Math.floor(e.clientWidth || 480)), r = e.getContext("2d");
|
|
1537
|
+
e.width = n * t, e.height = 192 * t, r?.scale(t, t), e.style.width = `${n}px`, e.style.height = "192px", this.pad?.fromDataURL?.(this.value || "data:,");
|
|
1538
|
+
}
|
|
1539
|
+
updated(e) {
|
|
1540
|
+
if (e.has("value") && this.pad && this.applySerializedValue(), e.has("disabled") && this.pad) {
|
|
1541
|
+
let e = this.shadowRoot?.querySelector("canvas");
|
|
1542
|
+
e instanceof HTMLElement && (e.style.pointerEvents = this.disabled ? "none" : "");
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
applySerializedValue() {
|
|
1546
|
+
if (this.pad) {
|
|
1547
|
+
if (!this.value) {
|
|
1548
|
+
this.pad.isEmpty() || this.pad.clear();
|
|
1549
|
+
return;
|
|
1550
|
+
}
|
|
1551
|
+
try {
|
|
1552
|
+
this.pad.fromDataURL(this.value);
|
|
1553
|
+
} catch {}
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
emitValue() {
|
|
1557
|
+
if (!this.pad || this.pad.isEmpty()) {
|
|
1558
|
+
this.dispatchEvent(new CustomEvent(J, {
|
|
1559
|
+
detail: "",
|
|
1560
|
+
bubbles: !0,
|
|
1561
|
+
composed: !0
|
|
1562
|
+
}));
|
|
1563
|
+
return;
|
|
1564
|
+
}
|
|
1565
|
+
this.dispatchEvent(new CustomEvent(J, {
|
|
1566
|
+
detail: this.pad.toDataURL(),
|
|
1567
|
+
bubbles: !0,
|
|
1568
|
+
composed: !0
|
|
1569
|
+
}));
|
|
1570
|
+
}
|
|
1571
|
+
render() {
|
|
1572
|
+
return this.loadError ? j`<div class="err">${this.loadError}</div>` : j`
|
|
1573
|
+
<div class="wrap">
|
|
1574
|
+
<canvas></canvas>
|
|
1575
|
+
<button type="button" ?disabled=${this.disabled} @click=${() => {
|
|
1576
|
+
this.pad?.clear(), this.dispatchEvent(new CustomEvent(J, {
|
|
1577
|
+
detail: "",
|
|
1578
|
+
bubbles: !0,
|
|
1579
|
+
composed: !0
|
|
1580
|
+
}));
|
|
1581
|
+
}}>Clear</button>
|
|
1582
|
+
</div>
|
|
1583
|
+
`;
|
|
1584
|
+
}
|
|
1585
|
+
};
|
|
1586
|
+
Y([H({ attribute: !1 })], $.prototype, "field", void 0), Y([H({ attribute: !1 })], $.prototype, "modules", void 0), Y([H({ type: String })], $.prototype, "value", void 0), Y([H({ type: Boolean })], $.prototype, "disabled", void 0), Y([U()], $.prototype, "loadError", void 0);
|
|
1587
|
+
//#endregion
|
|
1588
|
+
//#region src/index.ts
|
|
1589
|
+
var Lt = !1;
|
|
1590
|
+
function Rt() {
|
|
1591
|
+
Lt || (Lt = !0, customElements.get("formie-form") || customElements.define("formie-form", It), customElements.get("formie-internal-signature") || customElements.define("formie-internal-signature", $), customElements.get("formie-core-form") || customElements.define("formie-core-form", X));
|
|
1592
|
+
}
|
|
1593
|
+
//#endregion
|
|
1594
|
+
export { J as FORMIE_CONTROL_VALUE_EVENT, X as FormieCoreForm, It as FormieFormElement, $ as FormieInternalSignature, G as FormieRegistry, W as assertValidCustomElementName, ee as createFormieClient, Ze as createFormieRegistry, Xe as getFormieRegistry, ft as isFieldDefinition, Rt as registerFormieWebComponents, Mt as renderErrorView, kt as renderFormView, jt as renderLoadingView, pt as resolveFieldRendererType };
|
|
1595
|
+
|
|
1596
|
+
//# sourceMappingURL=index.js.map
|