solid-ui 5.0.2-3 → 5.0.2-4
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/dist/chunks/{DialogProvider-dagk2fHm.js → DialogProvider-CdesAsw-.js} +5 -6
- package/dist/chunks/{DialogProvider-dagk2fHm.js.map → DialogProvider-CdesAsw-.js.map} +1 -1
- package/dist/chunks/{ResourceActionsMenu-o-8kWx8z.js → ResourceActionsMenu-Bllpr4M5.js} +15 -16
- package/dist/chunks/{ResourceActionsMenu-o-8kWx8z.js.map → ResourceActionsMenu-Bllpr4M5.js.map} +1 -1
- package/dist/chunks/{access-control-modal-CWH98HX3.js → access-control-modal-CwmY_Dod.js} +74 -75
- package/dist/chunks/{access-control-modal-CWH98HX3.js.map → access-control-modal-CwmY_Dod.js.map} +1 -1
- package/dist/chunks/{account-Cocvv0H3.js → account-CoHPKKDu.js} +20 -21
- package/dist/chunks/{account-Cocvv0H3.js.map → account-CoHPKKDu.js.map} +1 -1
- package/dist/chunks/{auth-Df5uYksz.js → auth-CocCqS1p.js} +18 -19
- package/dist/chunks/{auth-Df5uYksz.js.map → auth-CocCqS1p.js.map} +1 -1
- package/dist/chunks/{avatar-DeotTinS.js → avatar-sNdKdWVO.js} +10 -11
- package/dist/chunks/{avatar-DeotTinS.js.map → avatar-sNdKdWVO.js.map} +1 -1
- package/dist/chunks/{button-Dy1aFjqG.js → button-D6qO2idW.js} +10 -11
- package/dist/chunks/{button-Dy1aFjqG.js.map → button-D6qO2idW.js.map} +1 -1
- package/dist/chunks/{chunk.UEBQI7VV-9M5gO7Ew.js → chunk.UEBQI7VV-lcP-fpUk.js} +12 -9
- package/dist/chunks/chunk.UEBQI7VV-lcP-fpUk.js.map +1 -0
- package/dist/chunks/{combobox-BL0-8wef.js → combobox-fSTp9qoT.js} +17 -18
- package/dist/chunks/{combobox-BL0-8wef.js.map → combobox-fSTp9qoT.js.map} +1 -1
- package/dist/chunks/{combobox-option-DjlmXt1O.js → combobox-option-DOtGuKel.js} +7 -8
- package/dist/chunks/{combobox-option-DjlmXt1O.js.map → combobox-option-DOtGuKel.js.map} +1 -1
- package/dist/chunks/{components-LxiwG5ae.js → components-C8c2Ucm5.js} +201 -190
- package/dist/chunks/components-C8c2Ucm5.js.map +1 -0
- package/dist/chunks/{context-By_u12WA.js → context-BDrfQ9bN.js} +2 -2
- package/dist/chunks/{context-By_u12WA.js.map → context-BDrfQ9bN.js.map} +1 -1
- package/dist/chunks/{dialog-CrmftB9c.js → dialog-CgYK767T.js} +15 -16
- package/dist/chunks/{dialog-CrmftB9c.js.map → dialog-CgYK767T.js.map} +1 -1
- package/dist/chunks/{dialog-content-Cw3xqJ45.js → dialog-content-DjwRH1ci.js} +5 -6
- package/dist/chunks/{dialog-content-Cw3xqJ45.js.map → dialog-content-DjwRH1ci.js.map} +1 -1
- package/dist/chunks/{dialog-footer-sFQf-2zD.js → dialog-footer-GQWi8lfB.js} +5 -6
- package/dist/chunks/{dialog-footer-sFQf-2zD.js.map → dialog-footer-GQWi8lfB.js.map} +1 -1
- package/dist/chunks/{dialog-header-xIWIqfZK.js → dialog-header-c3qOMQfb.js} +5 -6
- package/dist/chunks/{dialog-header-xIWIqfZK.js.map → dialog-header-c3qOMQfb.js.map} +1 -1
- package/dist/chunks/{dialogs-B3tHtjMf.js → dialogs-BmtLjMzg.js} +2 -2
- package/dist/chunks/{dialogs-B3tHtjMf.js.map → dialogs-BmtLjMzg.js.map} +1 -1
- package/dist/chunks/{dialogs-root-Lh2u-3Cs.js → dialogs-root-BNF3_SA8.js} +8 -9
- package/dist/chunks/{dialogs-root-Lh2u-3Cs.js.map → dialogs-root-BNF3_SA8.js.map} +1 -1
- package/dist/chunks/{error-state-DnsXVj1z.js → error-state-BD4_Wrkz.js} +10 -11
- package/dist/chunks/{error-state-DnsXVj1z.js.map → error-state-BD4_Wrkz.js.map} +1 -1
- package/dist/chunks/{file-explorer-header-B6-Q0i6V.js → file-explorer-header-D0TebSYR.js} +33 -34
- package/dist/chunks/file-explorer-header-D0TebSYR.js.map +1 -0
- package/dist/chunks/{file-explorer-provider-B3gUBkHg.js → file-explorer-provider-DpjC7uds.js} +8 -9
- package/dist/chunks/{file-explorer-provider-B3gUBkHg.js.map → file-explorer-provider-DpjC7uds.js.map} +1 -1
- package/dist/chunks/{guard-C39y81In.js → guard-BOicu9dt.js} +10 -11
- package/dist/chunks/{guard-C39y81In.js.map → guard-BOicu9dt.js.map} +1 -1
- package/dist/chunks/{input-Bi6ZBZQw.js → input-Bz3l514j.js} +11 -12
- package/dist/chunks/{input-Bi6ZBZQw.js.map → input-Bz3l514j.js.map} +1 -1
- package/dist/chunks/{login-button-fo0P8vym.js → login-button-clTw_9tX.js} +9 -10
- package/dist/chunks/{login-button-fo0P8vym.js.map → login-button-clTw_9tX.js.map} +1 -1
- package/dist/chunks/{logout-button-CF2YFgID.js → logout-button-CP-Pz70O.js} +9 -10
- package/dist/chunks/{logout-button-CF2YFgID.js.map → logout-button-CP-Pz70O.js.map} +1 -1
- package/dist/chunks/{menu-RumUciM-.js → menu-D0k2fkiE.js} +47 -49
- package/dist/chunks/{menu-RumUciM-.js.map → menu-D0k2fkiE.js.map} +1 -1
- package/dist/chunks/{menu-item-CVAZyipz.js → menu-item-nfPpH4dN.js} +10 -11
- package/dist/chunks/{menu-item-CVAZyipz.js.map → menu-item-nfPpH4dN.js.map} +1 -1
- package/dist/chunks/{photo-capture-CAfo7y6-.js → photo-capture-hJaJm4TM.js} +20 -21
- package/dist/chunks/photo-capture-hJaJm4TM.js.map +1 -0
- package/dist/chunks/{photo-capture-modal-DWmDE_Ws.js → photo-capture-modal-BsHv6wmh.js} +28 -29
- package/dist/chunks/{photo-capture-modal-DWmDE_Ws.js.map → photo-capture-modal-BsHv6wmh.js.map} +1 -1
- package/dist/chunks/{provide-B5NeVMM_.js → provide-z9U64q4m.js} +2 -2
- package/dist/chunks/{provide-B5NeVMM_.js.map → provide-z9U64q4m.js.map} +1 -1
- package/dist/chunks/{provider-BbT2duMy.js → provider-Cuv3Kp6G.js} +10 -11
- package/dist/chunks/{provider-BbT2duMy.js.map → provider-Cuv3Kp6G.js.map} +1 -1
- package/dist/chunks/{rdf-form-CH9bDx98.js → rdf-form-DVmTw3RG.js} +23 -24
- package/dist/chunks/{rdf-form-CH9bDx98.js.map → rdf-form-DVmTw3RG.js.map} +1 -1
- package/dist/chunks/{rdf-input-C_V0pIS5.js → rdf-input-CRYLK-27.js} +15 -16
- package/dist/chunks/{rdf-input-C_V0pIS5.js.map → rdf-input-CRYLK-27.js.map} +1 -1
- package/dist/chunks/{select-y1Z6fwmh.js → select-ClPkDkGl.js} +9 -10
- package/dist/chunks/{select-y1Z6fwmh.js.map → select-ClPkDkGl.js.map} +1 -1
- package/dist/chunks/{select-option-U4ALXL20.js → select-option-DQan7rcB.js} +7 -8
- package/dist/chunks/{select-option-U4ALXL20.js.map → select-option-DQan7rcB.js.map} +1 -1
- package/dist/chunks/{signup-button-DicFpAjD.js → signup-button-CexdMWj6.js} +9 -10
- package/dist/chunks/{signup-button-DicFpAjD.js.map → signup-button-CexdMWj6.js.map} +1 -1
- package/dist/chunks/{solid-emblem-CeCXTpve.js → solid-emblem-DwLdkGuO.js} +7 -8
- package/dist/chunks/{solid-emblem-CeCXTpve.js.map → solid-emblem-DwLdkGuO.js.map} +1 -1
- package/dist/chunks/{src-Bhtor0ZC.js → src-DQgHAH3d.js} +2934 -2926
- package/dist/chunks/src-DQgHAH3d.js.map +1 -0
- package/dist/components/access-control-modal/AccessControlAddAccess.esm.js.map +1 -1
- package/dist/components/access-control-modal/AccessControlErrors.esm.js.map +1 -1
- package/dist/components/access-control-modal/AccessControlGeneralAccess.esm.js.map +1 -1
- package/dist/components/access-control-modal/AccessControlModal.esm.js.map +1 -1
- package/dist/components/access-control-modal/AccessControlSharedAccess.esm.js.map +1 -1
- package/dist/components/access-control-modal.js +1 -1
- package/dist/components/account/Account.esm.js.map +1 -1
- package/dist/components/account.js +1 -1
- package/dist/components/avatar.js +1 -1
- package/dist/components/button/Button.esm.js.map +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/combobox/Combobox.esm.js.map +1 -1
- package/dist/components/combobox-option/ComboboxOption.esm.js.map +1 -1
- package/dist/components/combobox-option.js +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/dialog/Dialog.esm.js.map +1 -1
- package/dist/components/dialog-content.js +1 -1
- package/dist/components/dialog-footer.js +1 -1
- package/dist/components/dialog-header.js +1 -1
- package/dist/components/dialog-provider/DialogProvider.esm.js.map +1 -1
- package/dist/components/dialog-provider.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/dialogs-root/DialogsRoot.esm.js.map +1 -1
- package/dist/components/dialogs-root.js +1 -1
- package/dist/components/error-state/ErrorState.esm.js.map +1 -1
- package/dist/components/error-state.js +1 -1
- package/dist/components/file-explorer-header/FileExplorerHeader.cjs.js +2 -2
- package/dist/components/file-explorer-header/FileExplorerHeader.cjs.js.map +1 -1
- package/dist/components/file-explorer-header/FileExplorerHeader.d.ts.map +1 -1
- package/dist/components/file-explorer-header/FileExplorerHeader.esm.js +20 -19
- package/dist/components/file-explorer-header/FileExplorerHeader.esm.js.map +1 -1
- package/dist/components/file-explorer-header/FileExplorerHeaderControls.cjs.js +6 -6
- package/dist/components/file-explorer-header/FileExplorerHeaderControls.cjs.js.map +1 -1
- package/dist/components/file-explorer-header/FileExplorerHeaderControls.d.ts.map +1 -1
- package/dist/components/file-explorer-header/FileExplorerHeaderControls.esm.js +24 -23
- package/dist/components/file-explorer-header/FileExplorerHeaderControls.esm.js.map +1 -1
- package/dist/components/file-explorer-header/FileExplorerHeaderSummary.cjs.js +7 -7
- package/dist/components/file-explorer-header/FileExplorerHeaderSummary.cjs.js.map +1 -1
- package/dist/components/file-explorer-header/FileExplorerHeaderSummary.d.ts.map +1 -1
- package/dist/components/file-explorer-header/FileExplorerHeaderSummary.esm.js +25 -24
- package/dist/components/file-explorer-header/FileExplorerHeaderSummary.esm.js.map +1 -1
- package/dist/components/file-explorer-header.js +1 -1
- package/dist/components/file-explorer-provider/FileExplorerProvider.cjs.js +1 -1
- package/dist/components/file-explorer-provider/FileExplorerProvider.cjs.js.map +1 -1
- package/dist/components/file-explorer-provider/FileExplorerProvider.d.ts +1 -1
- package/dist/components/file-explorer-provider/FileExplorerProvider.d.ts.map +1 -1
- package/dist/components/file-explorer-provider/FileExplorerProvider.esm.js +8 -7
- package/dist/components/file-explorer-provider/FileExplorerProvider.esm.js.map +1 -1
- package/dist/components/file-explorer-provider.js +1 -1
- package/dist/components/guard.js +1 -1
- package/dist/components/input/Input.esm.js.map +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/login-button.js +1 -1
- package/dist/components/login-modal/LoginModal.esm.js.map +1 -1
- package/dist/components/login-modal.js +1 -1
- package/dist/components/logout-button.js +1 -1
- package/dist/components/menu/Menu.esm.js.map +1 -1
- package/dist/components/menu-item/MenuItem.esm.js.map +1 -1
- package/dist/components/menu-item.js +1 -1
- package/dist/components/menu.js +1 -1
- package/dist/components/photo-capture/PhotoCapture.esm.js.map +1 -1
- package/dist/components/photo-capture-modal/PhotoCaptureModal.esm.js.map +1 -1
- package/dist/components/photo-capture-modal.js +1 -1
- package/dist/components/photo-capture.js +1 -1
- package/dist/components/provider/Provider.esm.js.map +1 -1
- package/dist/components/provider.js +1 -1
- package/dist/components/rdf-form/RDFForm.esm.js.map +1 -1
- package/dist/components/rdf-form.js +1 -1
- package/dist/components/rdf-input/RDFInput.esm.js.map +1 -1
- package/dist/components/rdf-input.js +1 -1
- package/dist/components/resource-actions-menu/ResourceActionsMenu.cjs.js +8 -8
- package/dist/components/resource-actions-menu/ResourceActionsMenu.cjs.js.map +1 -1
- package/dist/components/resource-actions-menu/ResourceActionsMenu.d.ts.map +1 -1
- package/dist/components/resource-actions-menu/ResourceActionsMenu.esm.js +18 -17
- package/dist/components/resource-actions-menu/ResourceActionsMenu.esm.js.map +1 -1
- package/dist/components/resource-actions-menu.js +1 -1
- package/dist/components/select/Select.esm.js.map +1 -1
- package/dist/components/select-option/SelectOption.esm.js.map +1 -1
- package/dist/components/select-option.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/signup-button.js +1 -1
- package/dist/components/solid-emblem.js +1 -1
- package/dist/components.js +30 -30
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +5 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +8 -9
- package/dist/lib/file-explorer/index.cjs.js +1 -1
- package/dist/lib/file-explorer/index.esm.js +3 -3
- package/dist/lib/file-explorer/relevant-panes.cjs.js +1 -1
- package/dist/lib/file-explorer/relevant-panes.cjs.js.map +1 -1
- package/dist/lib/file-explorer/relevant-panes.d.ts +7 -0
- package/dist/lib/file-explorer/relevant-panes.d.ts.map +1 -1
- package/dist/lib/file-explorer/relevant-panes.esm.js +14 -5
- package/dist/lib/file-explorer/relevant-panes.esm.js.map +1 -1
- package/dist/loader.js +8 -9
- package/dist/solid-ui.js +28 -28
- package/dist/solid-ui.min.js +28 -28
- package/dist/solid-ui.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk.UEBQI7VV-9M5gO7Ew.js.map +0 -1
- package/dist/chunks/components-LxiwG5ae.js.map +0 -1
- package/dist/chunks/custom-element-BW8Ua4c7.js +0 -9
- package/dist/chunks/custom-element-BW8Ua4c7.js.map +0 -1
- package/dist/chunks/decorators-V-B013l9.js +0 -12
- package/dist/chunks/decorators-V-B013l9.js.map +0 -1
- package/dist/chunks/file-explorer-header-B6-Q0i6V.js.map +0 -1
- package/dist/chunks/photo-capture-CAfo7y6-.js.map +0 -1
- package/dist/chunks/src-Bhtor0ZC.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { E as e, y as t } from "./solidLogicSingleton.esm-BXyHD7mn.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as c, i as l, o as u, r as d, s as f } from "./rdf-input-C_V0pIS5.js";
|
|
2
|
+
import { b as n, g as r, i, o as a, r as o, u as s } from "./components-C8c2Ucm5.js";
|
|
3
|
+
import { a as c, i as l, o as u, r as d, s as f } from "./rdf-input-CRYLK-27.js";
|
|
5
4
|
// src/components/rdf-form/RDFForm.ts
|
|
6
5
|
var p, m, h, g, _, v, y, b, x, S, C, w, T, E, D, O, k, A, j;
|
|
7
6
|
function M(e, t, n) {
|
|
@@ -177,12 +176,12 @@ var H = {
|
|
|
177
176
|
return e || null;
|
|
178
177
|
}
|
|
179
178
|
}, U = (e) => e?.href ?? "";
|
|
180
|
-
g = [
|
|
179
|
+
g = [r("solid-ui-rdf-form")];
|
|
181
180
|
var W, G = /*#__PURE__*/ new WeakMap(), K = /*#__PURE__*/ new WeakMap(), q = /*#__PURE__*/ new WeakMap(), J = /*#__PURE__*/ new WeakMap(), Y = /*#__PURE__*/ new WeakMap(), X = /*#__PURE__*/ new WeakMap(), Z = /*#__PURE__*/ new WeakMap();
|
|
182
|
-
j = (_ =
|
|
181
|
+
j = (_ = n({
|
|
183
182
|
context: l,
|
|
184
183
|
subscribe: !0
|
|
185
|
-
}), y =
|
|
184
|
+
}), y = i({ attribute: !1 }), x = o(), C = o(), T = o(), D = i({ converter: H }), k = i({ converter: H }), "storeContext"), p = class extends a {
|
|
186
185
|
constructor(...e) {
|
|
187
186
|
super(...e), M(this, G, (m(this), v(this, d))), M(this, K, b(this, null)), M(this, q, S(this, !0)), M(this, J, w(this, 0)), M(this, Y, E(this, !1)), M(this, X, O(this, null)), M(this, Z, A(this, null));
|
|
188
187
|
}
|
|
@@ -232,19 +231,19 @@ j = (_ = o({
|
|
|
232
231
|
P(Z, this, e);
|
|
233
232
|
}
|
|
234
233
|
render() {
|
|
235
|
-
if (!this._documentsLoaded) return
|
|
234
|
+
if (!this._documentsLoaded) return s``;
|
|
236
235
|
let n = this.currentStore, r = U(this.subjectUrl);
|
|
237
236
|
r && n.updater?.editable(r) !== void 0 && n.updater?.editable(r) !== !1 && (this.entireDataIsReadonly = !1);
|
|
238
237
|
let i = u(this.currentStore, U(this.formUrl));
|
|
239
238
|
if (!i) throw Error("No ui:Form found in " + U(this.formUrl));
|
|
240
|
-
let
|
|
241
|
-
let r = n.each(e, t.rdf("type"), null,
|
|
239
|
+
let a = e(U(this.formUrl)), o = n.each(i, t.ui("parts"), null, a), c = (f(n, o) || []).flatMap((e) => e && typeof e == "object" && "elements" in e && Array.isArray(e.elements) ? e.elements : [e]).map((e) => {
|
|
240
|
+
let r = n.each(e, t.rdf("type"), null, a)[0], i = r ? r.value || String(r) : e.value || String(e), o = i.lastIndexOf("#");
|
|
242
241
|
return {
|
|
243
242
|
value: e,
|
|
244
|
-
fieldValue:
|
|
243
|
+
fieldValue: o >= 0 ? i.slice(o + 1) : i
|
|
245
244
|
};
|
|
246
245
|
});
|
|
247
|
-
return
|
|
246
|
+
return s`
|
|
248
247
|
<form>
|
|
249
248
|
${c.map((t) => {
|
|
250
249
|
switch (t.fieldValue) {
|
|
@@ -260,24 +259,24 @@ j = (_ = o({
|
|
|
260
259
|
case "FloatField":
|
|
261
260
|
case "TextField":
|
|
262
261
|
case "SingleLineTextField":
|
|
263
|
-
case "NamedNodeURIField": return
|
|
262
|
+
case "NamedNodeURIField": return s` <solid-ui-rdf-input
|
|
264
263
|
.formSubject=${e(t.value)}
|
|
265
264
|
.dataSubject=${e(r)}
|
|
266
265
|
.storeVersion=${this._loadVersion}
|
|
267
266
|
.readonly=${this.entireDataIsReadonly}
|
|
268
267
|
></solid-ui-rdf-input>
|
|
269
268
|
<br>`;
|
|
270
|
-
case "MultiLineTextField": return
|
|
271
|
-
case "BooleanField": return
|
|
272
|
-
case "TristateField": return
|
|
273
|
-
case "Classifier": return
|
|
274
|
-
case "Choice": return
|
|
275
|
-
case "Multiple": return
|
|
276
|
-
case "Options": return
|
|
277
|
-
case "AutocompleteField": return
|
|
269
|
+
case "MultiLineTextField": return s`<input .rdf=${t}></input>`;
|
|
270
|
+
case "BooleanField": return s`<input .rdf=${t}></input>`;
|
|
271
|
+
case "TristateField": return s`<input .rdf=${t}></input>`;
|
|
272
|
+
case "Classifier": return s`<input .rdf=${t}></input>`;
|
|
273
|
+
case "Choice": return s`<input .rdf=${t}></input>`;
|
|
274
|
+
case "Multiple": return s`<input .rdf=${t}></input>`;
|
|
275
|
+
case "Options": return s`<input .rdf=${t}></input>`;
|
|
276
|
+
case "AutocompleteField": return s`<input .rdf=${t}></input>`;
|
|
278
277
|
case "Comment":
|
|
279
|
-
case "Heading": return
|
|
280
|
-
default: return
|
|
278
|
+
case "Heading": return s`<input .rdf=${t}></input>`;
|
|
279
|
+
default: return s`<div>Unknown part type: ${t}</div>`;
|
|
281
280
|
}
|
|
282
281
|
})}
|
|
283
282
|
</form>
|
|
@@ -330,9 +329,9 @@ j = (_ = o({
|
|
|
330
329
|
1,
|
|
331
330
|
"subjectUrl"
|
|
332
331
|
]
|
|
333
|
-
], g, 0, void 0,
|
|
332
|
+
], g, 0, void 0, a), h();
|
|
334
333
|
// src/components/rdf-form/index.ts
|
|
335
334
|
var Q = W;
|
|
336
335
|
export { W as n, Q as t };
|
|
337
336
|
|
|
338
|
-
//# sourceMappingURL=rdf-form-
|
|
337
|
+
//# sourceMappingURL=rdf-form-DVmTw3RG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rdf-form-CH9bDx98.js","names":["property","state","html","consume","customElement","WebComponent","ns","fetchData","findForm","sortBySequence","sym","DEFAULT_STORE","storeContext","urlConverter","fromAttribute","value","URL","toAttribute","hrefFromUrlValue","href","_classDecs","_RDFForm","_A","WeakMap","_B","_C","_D","_E","_F","_G","_ref","_storeContextDecs","context","subscribe","_passedInStoreDecs","attribute","_entireDataIsReadonlyDecs","_loadVersionDecs","_documentsLoadedDecs","_formUrlDecs","converter","_subjectUrlDecs","RDFForm","constructor","args","_classPrivateFieldInitSpec","_initProto","_init_storeContext","_init_passedInStore","_init_entireDataIsReadonly","_init__loadVersion","_init__documentsLoaded","_init_formUrl","_init_subjectUrl","_classPrivateFieldGet","v","_classPrivateFieldSet","passedInStore","currentStore","store","entireDataIsReadonly","_loadVersion","_documentsLoaded","formUrl","subjectUrl","render","updater","editable","undefined","formRoot","Error","formDocument","parts","each","ui","partsBySequence","partItems","flatMap","item","Array","isArray","elements","uiFields","map","types","rdf","typeNode","String","hashIndex","lastIndexOf","fieldValue","slice","part","willUpdate","changedProperties","has","loadDocumentsIfNeeded","error","console","_RDFForm2","e","c","_initClass","_applyDecs","default","consume","property","state","sym","ns","RDFForm","RDFForm","namedNode","ns_default","WebComponent","b","c","customElement","fetchData","storeContext","findForm","DEFAULT_STORE","sortBySequence","_RDFForm2","_initProto","_initClass","_classDecs","_storeContextDecs","_init_storeContext","_passedInStoreDecs","_init_passedInStore","_entireDataIsReadonlyDecs","_init_entireDataIsReadonly","_loadVersionDecs","_init__loadVersion","_documentsLoadedDecs","_init__documentsLoaded","_formUrlDecs","_init_formUrl","_subjectUrlDecs","_init_subjectUrl","_ref","_classPrivateFieldInitSpec","a","_checkPrivateRedeclaration","_classPrivateFieldSet","s","_assertClassBrand","r","_classPrivateFieldGet","_applyDecs","i","n","o","applyDec","m","h","y","v","g","u","w","S","A","d","p","_setFunctionName","P","j","D","I","F","l","f","N","_checkInRHS","_toPropertyKey","_toPrimitive","t","e","urlConverter","value","hrefFromUrlValue","_RDFForm","_A","_B","_C","_D","_E","_F","_G","args","store","subjectUrl","formRoot","formDocument","parts","uiFields","item","typeNode","hashIndex","part","changedProperties","formUrl","error","rdf_form_default"],"sources":["../../src/components/rdf-form/RDFForm.ts","../../src/components/rdf-form/index.ts"],"sourcesContent":["import { property, state } from 'lit/decorators.js'\nimport { html } from 'lit/html.js'\nimport type { PropertyValues } from 'lit'\nimport { consume } from '@lit/context'\nimport { customElement, WebComponent } from '@/lib/components'\nimport ns from '../../lib/ns'\nimport { fetchData, findForm, sortBySequence } from '../../lib/forms/rdfFormsHelper'\nimport { sym, LiveStore } from 'rdflib'\nimport '@/components/rdf-input'\nimport { DEFAULT_STORE, storeContext, StoreContext } from '@/lib/forms/store/StoreContext'\n\nconst urlConverter = {\n fromAttribute (value: string | null): URL | null {\n if (!value) return null\n\n try {\n return new URL(value)\n } catch {\n return null\n }\n },\n toAttribute (value: URL | null) {\n if (!value) return null\n return value\n }\n}\n\nconst hrefFromUrlValue = (value: URL | null): string =>\n value?.href ?? ''\n\n@customElement('solid-ui-rdf-form')\nexport default class RDFForm extends WebComponent {\n @consume({ context: storeContext, subscribe: true })\n private accessor storeContext: StoreContext = DEFAULT_STORE\n\n @property({ attribute: false })\n accessor passedInStore: LiveStore | null = null\n\n private get currentStore (): LiveStore {\n return this.passedInStore ?? this.storeContext.store\n }\n\n @state()\n private accessor entireDataIsReadonly: boolean = true // to protect data, we default to not editable\n\n @state()\n private accessor _loadVersion = 0\n\n @state()\n private accessor _documentsLoaded = false\n\n @property({ converter: urlConverter })\n accessor formUrl: URL | null = null\n\n @property({ converter: urlConverter })\n accessor subjectUrl: URL | null = null\n\n render () {\n if (!this._documentsLoaded) {\n return html``\n }\n\n const store = this.currentStore\n\n const subjectUrl = hrefFromUrlValue(this.subjectUrl)\n if (subjectUrl && store.updater?.editable(subjectUrl) !== undefined && store.updater?.editable(subjectUrl) !== false) {\n this.entireDataIsReadonly = false\n }\n\n const formRoot = findForm(this.currentStore, hrefFromUrlValue(this.formUrl)) // If there are more 'a ui:Form' elements in a form file\n if (!formRoot) throw new Error('No ui:Form found in ' + hrefFromUrlValue(this.formUrl))\n\n const formDocument = sym(hrefFromUrlValue(this.formUrl)) // rdflib NamedNode for the document\n const parts = store.each(formRoot, ns.ui('parts'), null, formDocument)\n const partsBySequence = sortBySequence(store, parts)\n const partItems = (partsBySequence || []).flatMap(item => {\n if (item && typeof item === 'object' && 'elements' in item && Array.isArray((item as any).elements)) {\n return (item as any).elements\n }\n return [item]\n })\n const uiFields = partItems.map(item => {\n const types = store.each(item as any, ns.rdf('type'), null, formDocument)\n const typeNode = types[0]\n const value = typeNode ? ((typeNode as any).value || String(typeNode)) : ((item as any).value || String(item))\n const hashIndex = value.lastIndexOf('#')\n return {\n value: item,\n fieldValue: hashIndex >= 0 ? value.slice(hashIndex + 1) : value\n }\n })\n\n return html`\n <form>\n ${uiFields.map(part => {\n switch (part.fieldValue) {\n case 'PhoneField':\n case 'EmailField':\n case 'ColorField':\n case 'DateField':\n case 'DateTimeField':\n case 'TimeField':\n case 'NumericField':\n case 'IntegerField':\n case 'DecimalField':\n case 'FloatField':\n case 'TextField':\n case 'SingleLineTextField':\n case 'NamedNodeURIField': {\n return html` <solid-ui-rdf-input \n .formSubject=${sym(part.value)} \n .dataSubject=${sym(subjectUrl)}\n .storeVersion=${this._loadVersion}\n .readonly=${this.entireDataIsReadonly}\n ></solid-ui-rdf-input>\n <br>`\n }\n case 'MultiLineTextField':\n return html`<input .rdf=${part}></input>`\n case 'BooleanField':\n return html`<input .rdf=${part}></input>`\n case 'TristateField':\n return html`<input .rdf=${part}></input>`\n case 'Classifier':\n return html`<input .rdf=${part}></input>`\n case 'Choice':\n return html`<input .rdf=${part}></input>`\n case 'Multiple':\n return html`<input .rdf=${part}></input>`\n case 'Options':\n return html`<input .rdf=${part}></input>`\n case 'AutocompleteField':\n return html`<input .rdf=${part}></input>`\n case 'Comment':\n case 'Heading':\n return html`<input .rdf=${part}></input>`\n default:\n return html`<div>Unknown part type: ${part}</div>`\n }\n })}\n </form>\n `\n }\n\n protected override willUpdate (changedProperties: PropertyValues<this>) {\n super.willUpdate(changedProperties)\n if (changedProperties.has('formUrl') ||\n changedProperties.has('subjectUrl') ||\n changedProperties.has('passedInStore')\n ) {\n this.loadDocumentsIfNeeded()\n }\n }\n\n private async loadDocumentsIfNeeded () {\n const store = this.currentStore\n const formUrl = hrefFromUrlValue(this.formUrl)\n const subjectUrl = hrefFromUrlValue(this.subjectUrl)\n\n if (!formUrl || !subjectUrl) return\n\n try {\n await fetchData(store, formUrl)\n await fetchData(store, subjectUrl)\n this._loadVersion += 1\n this._documentsLoaded = true\n } catch (error) {\n console.error('Failed to load RDF docum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BAAgB,GACrB,KAAKC,mBAAmB;EAC1B,SAASmC,GAAO;GACdC,QAAQD,MAAM,gCAAgCA,CAAK;EACrD;CACF;AACJ,GAAC,CAAAG,GAAA,CAAArD,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAP,IAAAuD,GAAA,CAAAhF,GAAAiF,MAAAC,EAAAJ,GAAA;CAAA;EAAApE;EAAA;EAAA;CAAA;CAAA;EAAAG;EAAA;EAAA;CAAA;CAAA;EAAAE;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;CAAA;EAAAE;EAAA;EAAA;CAAA;AAAA,GAAArB,GAAA,GAAA,KAAA,GA3IoCf,CAAY,GAAAiG,EAAA;;AC5BjD,IAAAuG,IAAe/F"}
|
|
1
|
+
{"version":3,"file":"rdf-form-DVmTw3RG.js","names":["property","state","html","consume","customElement","WebComponent","ns","fetchData","findForm","sortBySequence","sym","DEFAULT_STORE","storeContext","urlConverter","fromAttribute","value","URL","toAttribute","hrefFromUrlValue","href","_classDecs","_RDFForm","_A","WeakMap","_B","_C","_D","_E","_F","_G","_ref","_storeContextDecs","context","subscribe","_passedInStoreDecs","attribute","_entireDataIsReadonlyDecs","_loadVersionDecs","_documentsLoadedDecs","_formUrlDecs","converter","_subjectUrlDecs","RDFForm","constructor","args","_classPrivateFieldInitSpec","_initProto","_init_storeContext","_init_passedInStore","_init_entireDataIsReadonly","_init__loadVersion","_init__documentsLoaded","_init_formUrl","_init_subjectUrl","_classPrivateFieldGet","v","_classPrivateFieldSet","passedInStore","currentStore","store","entireDataIsReadonly","_loadVersion","_documentsLoaded","formUrl","subjectUrl","render","updater","editable","undefined","formRoot","Error","formDocument","parts","each","ui","partsBySequence","partItems","flatMap","item","Array","isArray","elements","uiFields","map","types","rdf","typeNode","String","hashIndex","lastIndexOf","fieldValue","slice","part","willUpdate","changedProperties","has","loadDocumentsIfNeeded","error","console","_RDFForm2","e","c","_initClass","_applyDecs","default","consume","property","state","sym","ns","RDFForm","RDFForm","namedNode","ns_default","c","customElement","WebComponent","b","fetchData","storeContext","findForm","DEFAULT_STORE","sortBySequence","_RDFForm2","_initProto","_initClass","_classDecs","_storeContextDecs","_init_storeContext","_passedInStoreDecs","_init_passedInStore","_entireDataIsReadonlyDecs","_init_entireDataIsReadonly","_loadVersionDecs","_init__loadVersion","_documentsLoadedDecs","_init__documentsLoaded","_formUrlDecs","_init_formUrl","_subjectUrlDecs","_init_subjectUrl","_ref","_classPrivateFieldInitSpec","a","_checkPrivateRedeclaration","_classPrivateFieldSet","s","_assertClassBrand","r","_classPrivateFieldGet","_applyDecs","i","n","o","applyDec","m","h","y","v","g","u","w","S","A","d","p","_setFunctionName","P","j","D","I","F","l","f","N","_checkInRHS","_toPropertyKey","_toPrimitive","t","e","urlConverter","value","hrefFromUrlValue","_RDFForm","_A","_B","_C","_D","_E","_F","_G","args","store","subjectUrl","formRoot","formDocument","parts","uiFields","item","typeNode","hashIndex","part","changedProperties","formUrl","error","rdf_form_default"],"sources":["../../src/components/rdf-form/RDFForm.ts","../../src/components/rdf-form/index.ts"],"sourcesContent":["import { property, state } from 'lit/decorators.js'\nimport { html } from 'lit/html.js'\nimport type { PropertyValues } from 'lit'\nimport { consume } from '@lit/context'\nimport { customElement, WebComponent } from '@/lib/components'\nimport ns from '../../lib/ns'\nimport { fetchData, findForm, sortBySequence } from '../../lib/forms/rdfFormsHelper'\nimport { sym, LiveStore } from 'rdflib'\nimport '@/components/rdf-input'\nimport { DEFAULT_STORE, storeContext, StoreContext } from '@/lib/forms/store/StoreContext'\n\nconst urlConverter = {\n fromAttribute (value: string | null): URL | null {\n if (!value) return null\n\n try {\n return new URL(value)\n } catch {\n return null\n }\n },\n toAttribute (value: URL | null) {\n if (!value) return null\n return value\n }\n}\n\nconst hrefFromUrlValue = (value: URL | null): string =>\n value?.href ?? ''\n\n@customElement('solid-ui-rdf-form')\nexport default class RDFForm extends WebComponent {\n @consume({ context: storeContext, subscribe: true })\n private accessor storeContext: StoreContext = DEFAULT_STORE\n\n @property({ attribute: false })\n accessor passedInStore: LiveStore | null = null\n\n private get currentStore (): LiveStore {\n return this.passedInStore ?? this.storeContext.store\n }\n\n @state()\n private accessor entireDataIsReadonly: boolean = true // to protect data, we default to not editable\n\n @state()\n private accessor _loadVersion = 0\n\n @state()\n private accessor _documentsLoaded = false\n\n @property({ converter: urlConverter })\n accessor formUrl: URL | null = null\n\n @property({ converter: urlConverter })\n accessor subjectUrl: URL | null = null\n\n render () {\n if (!this._documentsLoaded) {\n return html``\n }\n\n const store = this.currentStore\n\n const subjectUrl = hrefFromUrlValue(this.subjectUrl)\n if (subjectUrl && store.updater?.editable(subjectUrl) !== undefined && store.updater?.editable(subjectUrl) !== false) {\n this.entireDataIsReadonly = false\n }\n\n const formRoot = findForm(this.currentStore, hrefFromUrlValue(this.formUrl)) // If there are more 'a ui:Form' elements in a form file\n if (!formRoot) throw new Error('No ui:Form found in ' + hrefFromUrlValue(this.formUrl))\n\n const formDocument = sym(hrefFromUrlValue(this.formUrl)) // rdflib NamedNode for the document\n const parts = store.each(formRoot, ns.ui('parts'), null, formDocument)\n const partsBySequence = sortBySequence(store, parts)\n const partItems = (partsBySequence || []).flatMap(item => {\n if (item && typeof item === 'object' && 'elements' in item && Array.isArray((item as any).elements)) {\n return (item as any).elements\n }\n return [item]\n })\n const uiFields = partItems.map(item => {\n const types = store.each(item as any, ns.rdf('type'), null, formDocument)\n const typeNode = types[0]\n const value = typeNode ? ((typeNode as any).value || String(typeNode)) : ((item as any).value || String(item))\n const hashIndex = value.lastIndexOf('#')\n return {\n value: item,\n fieldValue: hashIndex >= 0 ? value.slice(hashIndex + 1) : value\n }\n })\n\n return html`\n <form>\n ${uiFields.map(part => {\n switch (part.fieldValue) {\n case 'PhoneField':\n case 'EmailField':\n case 'ColorField':\n case 'DateField':\n case 'DateTimeField':\n case 'TimeField':\n case 'NumericField':\n case 'IntegerField':\n case 'DecimalField':\n case 'FloatField':\n case 'TextField':\n case 'SingleLineTextField':\n case 'NamedNodeURIField': {\n return html` <solid-ui-rdf-input \n .formSubject=${sym(part.value)} \n .dataSubject=${sym(subjectUrl)}\n .storeVersion=${this._loadVersion}\n .readonly=${this.entireDataIsReadonly}\n ></solid-ui-rdf-input>\n <br>`\n }\n case 'MultiLineTextField':\n return html`<input .rdf=${part}></input>`\n case 'BooleanField':\n return html`<input .rdf=${part}></input>`\n case 'TristateField':\n return html`<input .rdf=${part}></input>`\n case 'Classifier':\n return html`<input .rdf=${part}></input>`\n case 'Choice':\n return html`<input .rdf=${part}></input>`\n case 'Multiple':\n return html`<input .rdf=${part}></input>`\n case 'Options':\n return html`<input .rdf=${part}></input>`\n case 'AutocompleteField':\n return html`<input .rdf=${part}></input>`\n case 'Comment':\n case 'Heading':\n return html`<input .rdf=${part}></input>`\n default:\n return html`<div>Unknown part type: ${part}</div>`\n }\n })}\n </form>\n `\n }\n\n protected override willUpdate (changedProperties: PropertyValues<this>) {\n super.willUpdate(changedProperties)\n if (changedProperties.has('formUrl') ||\n changedProperties.has('subjectUrl') ||\n changedProperties.has('passedInStore')\n ) {\n this.loadDocumentsIfNeeded()\n }\n }\n\n private async loadDocumentsIfNeeded () {\n const store = this.currentStore\n const formUrl = hrefFromUrlValue(this.formUrl)\n const subjectUrl = hrefFromUrlValue(this.subjectUrl)\n\n if (!formUrl || !subjectUrl) return\n\n try {\n await fetchData(store, formUrl)\n await fetchData(store, subjectUrl)\n this._loadVersion += 1\n this._documentsLoaded = true\n } catch (error) {\n console.error('Failed to load RDF documents', error)\n }\n }\n}\n","import RDFForm from './RDFForm'\n\nexport { RDFForm }\nexport default RDFForm\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAA;EAAApE;EAAA;EAAA;CAAA;CAAA;EAAAG;EAAA;EAAA;CAAA;CAAA;EAAAE;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;CAAA;EAAAE;EAAA;EAAA;CAAA;AAAA,GAAArB,GAAA,GAAA,KAAA,GA3IoCf,CAAY,GAAAiG,EAAA;;AC5BjD,IAAAuG,IAAe/F"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { D as e, E as t, V as n, y as r } from "./solidLogicSingleton.esm-BXyHD7mn.js";
|
|
2
2
|
import { t as i, u as a } from "./style-CXaw5EYi.js";
|
|
3
|
-
import { b as o,
|
|
4
|
-
import
|
|
5
|
-
import "./input-Bi6ZBZQw.js";
|
|
3
|
+
import { b as o, g as s, i as c, o as l, r as u, u as d, x as f, y as p } from "./components-C8c2Ucm5.js";
|
|
4
|
+
import "./input-Bz3l514j.js";
|
|
6
5
|
// src/lib/forms/rdfFormsHelper.ts
|
|
7
6
|
async function m(e, n) {
|
|
8
7
|
let r = t(n);
|
|
@@ -102,7 +101,7 @@ var v = {
|
|
|
102
101
|
get store() {
|
|
103
102
|
throw Error("Cannot use RDF forms without a store");
|
|
104
103
|
}
|
|
105
|
-
}(), b =
|
|
104
|
+
}(), b = f(Symbol("storeContext")), x, S, C, w, T, E, D, O, k, A, j, M, N, P, F, I, L;
|
|
106
105
|
function R(e, t, n) {
|
|
107
106
|
return (t = G(t)) in e ? Object.defineProperty(e, t, {
|
|
108
107
|
value: n,
|
|
@@ -271,21 +270,21 @@ function te(e) {
|
|
|
271
270
|
if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (e === null ? "null" : typeof e));
|
|
272
271
|
return e;
|
|
273
272
|
}
|
|
274
|
-
w = [
|
|
273
|
+
w = [s("solid-ui-rdf-input")];
|
|
275
274
|
var q, J = /*#__PURE__*/ new WeakMap(), Y = /*#__PURE__*/ new WeakMap(), X = /*#__PURE__*/ new WeakMap(), Z = /*#__PURE__*/ new WeakMap(), Q = /*#__PURE__*/ new WeakMap(), $ = /*#__PURE__*/ new WeakMap();
|
|
276
|
-
L = (T =
|
|
275
|
+
L = (T = o({
|
|
277
276
|
context: b,
|
|
278
277
|
subscribe: !0
|
|
279
|
-
}), D =
|
|
278
|
+
}), D = c({
|
|
280
279
|
attribute: !1,
|
|
281
280
|
type: Object
|
|
282
|
-
}), k =
|
|
281
|
+
}), k = c({
|
|
283
282
|
attribute: !1,
|
|
284
283
|
type: Object
|
|
285
|
-
}), j =
|
|
284
|
+
}), j = c({ type: Number }), N = u(), F = c({
|
|
286
285
|
type: Boolean,
|
|
287
286
|
reflect: !0
|
|
288
|
-
}), "storeContext"), x = class extends
|
|
287
|
+
}), "storeContext"), x = class extends l {
|
|
289
288
|
get [L]() {
|
|
290
289
|
return H(J, this);
|
|
291
290
|
}
|
|
@@ -323,15 +322,15 @@ L = (T = f({
|
|
|
323
322
|
V($, this, e);
|
|
324
323
|
}
|
|
325
324
|
constructor() {
|
|
326
|
-
super(), z(this, J, (S(this), E(this, y))), z(this, Y, O(this, null)), z(this, X, A(this, null)), z(this, Z, M(this, 0)), z(this, Q, P(this, null)), R(this, "_updateInFlight", !1), R(this, "_pendingUpdateValue", null), z(this, $, I(this, !0)), this.id =
|
|
325
|
+
super(), z(this, J, (S(this), E(this, y))), z(this, Y, O(this, null)), z(this, X, A(this, null)), z(this, Z, M(this, 0)), z(this, Q, P(this, null)), R(this, "_updateInFlight", !1), R(this, "_pendingUpdateValue", null), z(this, $, I(this, !0)), this.id = p();
|
|
327
326
|
}
|
|
328
327
|
render() {
|
|
329
|
-
let e = this.getDocument(this.formSubject), t = this.getFormProperty(this.formSubject, r.ui("property"), e), n = this.getInputLabel(this.formSubject, t, e), i = this.getReadOnly(this.readonly, this.formSubject, e), a = this.formSubject ? g(this.storeContext.store, this.formSubject) : void 0, o = a ? v[a] ?? {} : {}, s = o.type ?? "text", c = this.getSelectedTerm(this.dataSubject, t, this.formSubject, o), l = i ? "" : this.defaultInputValue(o),
|
|
330
|
-
return
|
|
328
|
+
let e = this.getDocument(this.formSubject), t = this.getFormProperty(this.formSubject, r.ui("property"), e), n = this.getInputLabel(this.formSubject, t, e), i = this.getReadOnly(this.readonly, this.formSubject, e), a = this.formSubject ? g(this.storeContext.store, this.formSubject) : void 0, o = a ? v[a] ?? {} : {}, s = o.type ?? "text", c = this.getSelectedTerm(this.dataSubject, t, this.formSubject, o), l = i ? "" : this.defaultInputValue(o), u = this._updateInFlight || this._pendingUpdateValue !== null ? this.localInputValue ?? "" : this.termToInputValue(c);
|
|
329
|
+
return d`
|
|
331
330
|
<solid-ui-input
|
|
332
331
|
label="${n}"
|
|
333
332
|
name="name-${this.id}"
|
|
334
|
-
.value=${
|
|
333
|
+
.value=${u}
|
|
335
334
|
.placeholder=${l}
|
|
336
335
|
type="${s}"
|
|
337
336
|
?readonly=${i}
|
|
@@ -430,9 +429,9 @@ L = (T = f({
|
|
|
430
429
|
1,
|
|
431
430
|
"readonly"
|
|
432
431
|
]
|
|
433
|
-
], w, 0, void 0,
|
|
432
|
+
], w, 0, void 0, l), C();
|
|
434
433
|
// src/components/rdf-input/index.ts
|
|
435
434
|
var ne = q;
|
|
436
435
|
export { m as a, b as i, q as n, _ as o, y as r, h as s, ne as t };
|
|
437
436
|
|
|
438
|
-
//# sourceMappingURL=rdf-input-
|
|
437
|
+
//# sourceMappingURL=rdf-input-CRYLK-27.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rdf-input-C_V0pIS5.js","names":["sym","parse","ns","baseUri","loadDocument","store","documentSource","documentName","documentURI","preferRemote","finalDocumentUri","document","holds","undefined","removeStatements","statementsMatching","parseSource","Promise","resolve","reject","err","console","error","fetcher","load","force","clearPreviousData","then","catch","trim","length","Error","fetchData","sortBySequence","list","subfields","map","p","k","any","ui","seq","Number","value","isNaN","sort","a","b","pair","mostSpecificClassURI","subject","typeUri","findTypeURIs","specificTypes","bottomTypeURIs","finalTypes","t","push","findForm","sourceUri","docUrl","split","fragment","includes","candidate","rdf","forms","each","found","find","term","termType","sym","ns","ns","style","fieldParams","ui","uri","size","type","dt","pattern","namedNode","defaultInputValue","formGroupStyle","element","commentStyle","formHeadingStyle","ns","NoopStore","store","Error","createContext","NoopStore","DEFAULT_STORE","storeContext","Symbol","createContext","property","state","html","ns","customElement","generateId","WebComponent","Literal","st","label","mostSpecificClassURI","fieldParams","fieldTypeParams","DEFAULT_STORE","storeContext","consume","_classDecs","_RDFInput","_A","WeakMap","_B","_C","_D","_E","_F","_ref","_storeContextDecs","context","subscribe","_formSubjectDecs","attribute","type","Object","_dataSubjectDecs","_storeVersionDecs","Number","_localInputValueDecs","_readonlyDecs","Boolean","reflect","RDFInput","_classPrivateFieldGet","v","_classPrivateFieldSet","formSubject","dataSubject","storeVersion","localInputValue","readonly","constructor","_classPrivateFieldInitSpec","_initProto","_init_storeContext","_init_formSubject","_init_dataSubject","_init_storeVersion","_init_localInputValue","_defineProperty","_init_readonly","id","render","formDocument","getDocument","uiPropertyTerm","getFormProperty","ui","inputLabel","getInputLabel","getReadOnly","fieldType","store","undefined","params","inputType","selectedTerm","getSelectedTerm","placeholder","defaultInputValue","inputValue","_updateInFlight","_pendingUpdateValue","termToInputValue","updateData","subject","doc","graph","any","formFieldSubject","uiLabel","propertyLabel","value","anyJS","defaultTerm","inputTerm","term","decodeURIComponent","String","stripped","replace","e","newValue","target","runPendingUpdate","dataDocument","updater","editable","toDeleteSt","statementsMatching","toInsertSt","objectFromNewValue","namedNode","sym","encodeURIComponent","dt","trim","xsd","map","statement","predicate","why","length","updateMany","err","console","error","_RDFInput2","c","_initClass","_applyDecs","default","consume","property","state","ns","fieldTypeParams","RDFInput","RDFInput","st","namedNode","Literal","ns_default","style","label","n","n$1","WebComponent","generateId","c","customElement","fetchData","document","documentURI","store","sortBySequence","subfields","list","k","p","seq","a","b","pair","mostSpecificClassURI","typeUri","subject","specificTypes","finalTypes","t","findForm","docUrl","sourceUri","fragment","candidate","term","fieldParams","DEFAULT_STORE","storeContext","_RDFInput2","_initProto","_initClass","_classDecs","_storeContextDecs","_init_storeContext","_formSubjectDecs","_init_formSubject","_dataSubjectDecs","_init_dataSubject","_storeVersionDecs","_init_storeVersion","_localInputValueDecs","_init_localInputValue","_readonlyDecs","_init_readonly","_ref","_defineProperty","_toPropertyKey","r","_classPrivateFieldInitSpec","_checkPrivateRedeclaration","_classPrivateFieldSet","s","_assertClassBrand","_classPrivateFieldGet","_applyDecs","i","o","applyDec","m","h","y","v","g","u","w","S","A","d","_setFunctionName","P","j","D","I","F","l","f","N","_checkInRHS","_toPrimitive","e","_RDFInput","_A","_B","_C","_D","_E","_F","formDocument","uiPropertyTerm","inputLabel","readonly","fieldType","params","inputType","selectedTerm","placeholder","inputValue","property","graph","formFieldSubject","uiLabel","propertyLabel","defaultTerm","dataSubject","newValue","dataDocument","toDeleteSt","toInsertSt","objectFromNewValue","statement","err","rdf_input_default"],"sources":["../../src/lib/forms/rdfFormsHelper.ts","../../src/lib/forms/fieldParams.ts","../../src/lib/forms/store/NoopStore.ts","../../src/lib/forms/store/StoreContext.ts","../../src/components/rdf-input/RDFInput.ts","../../src/components/rdf-input/index.ts"],"sourcesContent":["import { sym, LiveStore, parse } from 'rdflib'\nimport type { Term } from 'rdflib/lib/tf-types'\n// eslint-disable-next-line camelcase\nimport type { Quad_Subject, NamedNode } from 'rdflib/lib/tf-types'\nimport ns from '../../lib/ns'\n\nconst baseUri = 'https://solidos.github.io/solid-ui/src/ontology/'\n\nexport function loadDocument (\n store: LiveStore,\n documentSource: string,\n documentName: string,\n documentURI?: string,\n preferRemote = false\n) {\n const finalDocumentUri = documentURI || baseUri + documentName // Full URI to the file\n const document = sym(finalDocumentUri) // rdflib NamedNode for the document\n\n if (store.holds(undefined, undefined, undefined, document)) {\n store.removeStatements(store.statementsMatching(undefined, undefined, undefined, document))\n }\n\n const parseSource = () => {\n return new Promise<void>((resolve, reject) => {\n parse(documentSource, store, finalDocumentUri, 'text/turtle', (err) => {\n if (err) {\n console.error('Parse document error for ', finalDocumentUri, err)\n reject(err)\n } else {\n resolve()\n }\n })\n })\n }\n\n if (preferRemote && documentURI) {\n return store.fetcher.load(documentURI, {\n force: true,\n clearPreviousData: true,\n }).then(() => {}).catch((err) => {\n if (documentSource && documentSource.trim().length > 0) {\n return parseSource()\n }\n throw err\n })\n }\n\n if (documentSource && documentSource.trim().length > 0) {\n return parseSource()\n }\n\n if (documentURI) {\n return store.fetcher.load(documentURI, {\n force: true,\n clearPreviousData: true,\n }).then(() => {})\n }\n\n return Promise.reject(new Error(`No document source or URI for ${documentName}`))\n}\n\nexport async function fetchData (\n store: LiveStore,\n documentURI: string\n) {\n const document = sym(documentURI) // rdflib NamedNode for the document\n\n if (store.holds(undefined, undefined, undefined, document)) {\n store.removeStatements(store.statementsMatching(undefined, undefined, undefined, document))\n }\n\n return await store.fetcher.load(documentURI, {\n force: true,\n clearPreviousData: true,\n })\n}\n\nexport function sortBySequence (\n store: LiveStore,\n list: Term[]\n) {\n const subfields = list.map((p) => {\n const k = store.any(p as any, ns.ui('sequence'))\n const seq = k ? Number((k as { value: string }).value) : 9999\n return [Number.isNaN(seq) ? 9999 : seq, p] as const\n })\n\n subfields.sort((a, b) => a[0] - b[0])\n\n return subfields.map(pair => pair[1])\n}\n\n/**\n * Which class of field is this? Relies on http://www.w3.org/2000/01/rdf-schema#subClassOf and\n * https://linkeddata.github.io/rdflib.js/doc/classes/formula.html#bottomtypeuris\n * to find the most specific RDF type if there are multiple.\n *\n * @param subject a form field, e.g. `namedNode('https://timbl.com/timbl/Public/Test/Forms/individualForm.ttl#fullNameField')`\n * @returns the URI of the most specific known class, e.g. `http://www.w3.org/ns/ui#SingleLineTextField`\n */\n// eslint-disable-next-line camelcase\nexport function mostSpecificClassURI (store: LiveStore, subject: Quad_Subject): string {\n const typeUri = store.findTypeURIs(subject)\n const specificTypes = store.bottomTypeURIs(typeUri) // most specific\n const finalTypes: any[] = []\n for (const t in specificTypes) finalTypes.push(t)\n // if (finalTypes.length > 1) throw \"Didn't expect \"+subject+\" to have multiple bottom types: \"+finalTypes\n return finalTypes[0]\n}\n\n// Find the first ui:Form node in a store, optionally matching a fragment.\n// code based on Jeff Zucker's sol-components: https://github.com/jeff-zucker/sol-components (core/form-utils.js)\nexport function findForm (store: LiveStore, sourceUri: string): NamedNode | null {\n const docUrl = sourceUri.split('#')[0]\n const fragment = sourceUri.includes('#') ? sourceUri.split('#')[1] : null\n if (fragment) {\n const candidate = sym(docUrl + '#' + fragment)\n if (store.holds(candidate, ns.rdf('type'), ns.ui('Form'))) return candidate\n }\n const forms = store.each(null, ns.rdf('type'), ns.ui('Form'))\n const found = forms.find((term) => term.termType === 'NamedNode')\n return found ? (found as NamedNode) : null\n}\n","import ns from '../../lib/ns'\nimport { style } from '../../lib/style'\n\nexport type InputType =\n | 'hidden'\n | 'text'\n | 'search'\n | 'tel'\n | 'url'\n | 'email'\n | 'password'\n | 'datetime'\n | 'date'\n | 'month'\n | 'week'\n | 'time'\n | 'datetime-local'\n | 'number'\n | 'range'\n | 'color'\n | 'checkbox'\n | 'radio'\n | 'file'\n | 'submit'\n | 'image'\n | 'reset'\n | 'button'\n\nexport type FieldParamsObject = {\n size?: number, // input element size attribute\n type?: InputType, // input element type attribute. Default: 'text' (not for Comment and Heading)\n element?: string, // element type to use (Comment and Heading only)\n style?: string, // style to use\n dt?: string, // xsd data type for the RDF Literal corresponding to the field value. Default: xsd:string\n defaultInputValue?: string, // e.g. 'mailto:'. Default value in input field, will be removed when displaying actual value to user.\n namedNode?: boolean, // if true, field value corresponds to the URI of an RDF NamedNode. Overrides dt and defaultInputValue.\n pattern?: RegExp // for client-side input validation; field will go red if violated, green if ok\n}\n\n/**\n * The fieldParams object defines various constants\n * for use in various form fields. Depending on the\n * field in questions, different values may be read\n * from here.\n */\nexport const fieldParams: { [ fieldUri: string ]: FieldParamsObject } = {\n /**\n * Text field\n *\n * For possible date popups see e.g. http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm\n * or use HTML5: http://www.w3.org/TR/2011/WD-html-markup-20110113/input.date.html\n */\n [ns.ui('ColorField').uri]: {\n size: 9,\n type: 'color',\n style: 'height: 3em;', // around 1.5em is padding\n dt: 'color',\n pattern: /^\\s*#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]([0-9a-f][0-9a-f])?\\s*$/\n }, // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/color\n\n [ns.ui('DateField').uri]: {\n size: 20,\n type: 'date',\n dt: 'date',\n pattern: /^\\s*[0-9][0-9][0-9][0-9](-[0-1]?[0-9]-[0-3]?[0-9])?Z?\\s*$/\n },\n\n [ns.ui('DateTimeField').uri]: {\n size: 20,\n type: 'datetime-local', // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime\n dt: 'dateTime',\n pattern: /^\\s*[0-9][0-9][0-9][0-9](-[0-1]?[0-9]-[0-3]?[0-9])?(T[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)?Z?\\s*$/\n },\n\n [ns.ui('TimeField').uri]: {\n size: 10,\n type: 'time',\n dt: 'time',\n pattern: /^\\s*([0-2]?[0-9]:[0-5][0-9](:[0-5][0-9])?)\\s*$/\n },\n\n [ns.ui('IntegerField').uri]: {\n size: 12,\n style: 'text-align: right;',\n dt: 'integer',\n pattern: /^\\s*-?[0-9]+\\s*$/\n },\n\n [ns.ui('DecimalField').uri]: {\n size: 12,\n style: 'text-align: right;',\n dt: 'decimal',\n pattern: /^\\s*-?[0-9]*(\\.[0-9]*)?\\s*$/\n },\n\n [ns.ui('FloatField').uri]: {\n size: 12,\n style: 'text-align: right;',\n dt: 'float',\n pattern: /^\\s*-?[0-9]*(\\.[0-9]*)?((e|E)-?[0-9]*)?\\s*$/\n },\n\n [ns.ui('SingleLineTextField').uri]: {\n\n },\n [ns.ui('NamedNodeURIField').uri]: {\n namedNode: true\n },\n [ns.ui('TextField').uri]: {\n\n },\n\n [ns.ui('PhoneField').uri]: {\n size: 20,\n defaultInputValue: 'tel:',\n pattern: /^\\+?[\\d-]+[\\d]*$/\n },\n\n [ns.ui('EmailField').uri]: {\n size: 30,\n defaultInputValue: 'mailto:',\n pattern: /^\\s*.*@.*\\..*\\s*$/ // @@ Get the right regexp here\n },\n\n [ns.ui('Group').uri]: {\n style: style.formGroupStyle\n },\n\n /**\n * Non-interactive fields\n */\n [ns.ui('Comment').uri]: {\n element: 'p',\n style: style.commentStyle\n },\n [ns.ui('Heading').uri]: {\n element: 'h3',\n style: style.formHeadingStyle\n }\n}\n","import { LiveStore } from 'rdflib'\nimport { StoreContext } from './StoreContext'\n\nexport default class NoopStore implements StoreContext {\n get store (): LiveStore {\n throw new Error('Cannot use RDF forms without a store')\n }\n}\n","import { createContext } from '@lit/context'\nimport { LiveStore } from 'rdflib'\nimport NoopStore from './NoopStore'\n\nexport interface StoreContext {\n store: LiveStore\n}\n\nexport const DEFAULT_STORE = new NoopStore()\nexport const storeContext = createContext<StoreContext>(Symbol('storeContext'))\n","import { property, state } from 'lit/decorators.js'\nimport { html } from 'lit/html.js'\nimport ns from '../../lib/ns'\nimport { customElement, generateId, WebComponent } from '@/lib/components'\nimport { Literal, NamedNode, st } from 'rdflib'\nimport { label } from '../../utils'\nimport { mostSpecificClassURI } from '../../lib/forms/rdfFormsHelper'\nimport { FieldParamsObject, fieldParams as fieldTypeParams, InputType } from '../../lib/forms/fieldParams'\nimport { DEFAULT_STORE, storeContext, StoreContext } from '@/lib/forms/store/StoreContext'\nimport { consume } from '@lit/context'\nimport '@/components/input'\n\n@customElement('solid-ui-rdf-input')\nexport default class RDFInput extends WebComponent {\n // example RDF Turtle format source:\n // :nameField a ui:SingleLineTextField ;\n // ui:property vcard:fn;\n // ui:label \"name\" .\n\n // formSubject describes the field metadata\n // dataSubject points to the data resource containing the value\n\n @consume({ context: storeContext, subscribe: true })\n private accessor storeContext: StoreContext = DEFAULT_STORE\n\n @property({ attribute: false, type: Object })\n accessor formSubject: NamedNode | null = null\n\n @property({ attribute: false, type: Object })\n accessor dataSubject: NamedNode | null = null\n\n @property({ type: Number })\n accessor storeVersion = 0\n\n @state()\n private accessor localInputValue: string | null = null\n\n private _updateInFlight = false\n private _pendingUpdateValue: string | null = null\n\n @property({ type: Boolean, reflect: true })\n accessor readonly: boolean = true // to protect data, we default to not editable\n\n constructor () {\n super()\n\n this.id = generateId()\n }\n\n render () {\n const formDocument = this.getDocument(this.formSubject)\n\n // for building the HTML input element\n const uiPropertyTerm = this.getFormProperty(this.formSubject, ns.ui('property'), formDocument)\n const inputLabel = this.getInputLabel(this.formSubject, uiPropertyTerm, formDocument)\n const readonly = this.getReadOnly(this.readonly, this.formSubject, formDocument)\n\n const fieldType = this.formSubject ? mostSpecificClassURI(this.storeContext.store, this.formSubject) : undefined\n const params = fieldType ? fieldTypeParams[fieldType] ?? {} : {}\n const inputType: InputType = params.type ?? 'text'\n\n // for populating the HTML input element\n const selectedTerm = this.getSelectedTerm(this.dataSubject, uiPropertyTerm, this.formSubject, params)\n const placeholder = readonly ? '' : this.defaultInputValue(params)\n const inputValue = this._updateInFlight || this._pendingUpdateValue !== null\n ? this.localInputValue ?? ''\n : this.termToInputValue(selectedTerm)\n\n return html`\n <solid-ui-input\n label=\"${inputLabel}\"\n name=\"name-${this.id}\"\n .value=${inputValue}\n .placeholder=${placeholder}\n type=\"${inputType}\"\n ?readonly=${readonly}\n @input=${this.updateData}\n ></solid-ui-input>`\n }\n\n private getDocument (subject: NamedNode | null | undefined) {\n return subject?.doc ? subject.doc() : undefined\n }\n\n private getFormProperty (subject: NamedNode | null | undefined, property: NamedNode, graph?: any): NamedNode | undefined {\n if (!subject) return undefined\n return this.storeContext.store.any(subject, property, null, graph) as NamedNode | undefined\n }\n\n private getInputLabel (formFieldSubject: NamedNode | null | undefined, uiPropertyTerm?: NamedNode, graph?: any): string {\n if (!formFieldSubject) return ''\n const uiLabel = this.storeContext.store.any(formFieldSubject, ns.ui('label'), null, graph)\n const propertyLabel = uiPropertyTerm ? label(uiPropertyTerm, true) : ''\n return uiLabel ? uiLabel.value : propertyLabel\n }\n\n private getReadOnly (readonly: boolean, formFieldSubject?: NamedNode | null, graph?: any): boolean {\n if (formFieldSubject && readonly === false) { // if readonly is false, we can ovverride it if the field is marked as uneditable in the form\n return !!this.storeContext.store.anyJS(formFieldSubject, ns.ui('suppressEmptyUneditable'), null, graph)\n }\n return readonly\n }\n\n private getSelectedTerm (\n dataSubject?: NamedNode | null,\n uiPropertyTerm?: NamedNode,\n formFieldSubject?: NamedNode | null,\n params?: { defaultInputValue?: string }\n ) {\n const defaultTerm = formFieldSubject\n ? this.storeContext.store.any(formFieldSubject, ns.ui('default'))\n : undefined\n\n if (!uiPropertyTerm || !dataSubject) {\n return defaultTerm\n }\n\n const inputTerm = this.storeContext.store.any(dataSubject, uiPropertyTerm)\n return inputTerm || defaultTerm\n }\n\n private termToInputValue (term: any) {\n if (!term || !('value' in term) || !term.value) return ''\n\n try {\n return decodeURIComponent(term.value)\n } catch {\n return String(term.value)\n }\n }\n\n private defaultInputValue (params: { defaultInputValue?: string } = {}) {\n const stripped = params.defaultInputValue ?? ''\n return stripped.replace(/ /g, '')\n }\n\n private async updateData (e: CustomEvent) {\n const newValue = (e.target as HTMLInputElement).value\n this.localInputValue = newValue\n this._pendingUpdateValue = newValue\n\n if (this._updateInFlight) {\n return\n }\n\n await this.runPendingUpdate()\n }\n\n private async runPendingUpdate () {\n if (this._pendingUpdateValue === null) {\n return\n }\n\n const newValue = this._pendingUpdateValue\n this._pendingUpdateValue = null\n this._updateInFlight = true\n\n const uiPropertyTerm = this.getFormProperty(this.formSubject, ns.ui('property'), this.getDocument(this.formSubject))\n if (!uiPropertyTerm || !this.dataSubject) {\n this._updateInFlight = false\n this.localInputValue = ''\n return\n }\n\n const dataDocument = this.getDocument(this.dataSubject)\n if (dataDocument && this.storeContext.store.updater?.editable(dataDocument) === false) {\n this._updateInFlight = false\n return\n }\n\n const toDeleteSt = this.storeContext.store.statementsMatching(this.dataSubject, uiPropertyTerm)\n let toInsertSt: Array<ReturnType<typeof st>> = []\n\n if (newValue) {\n let objectFromNewValue\n const fieldType = this.formSubject ? mostSpecificClassURI(this.storeContext.store, this.formSubject) : undefined\n const params: FieldParamsObject = fieldType ? fieldTypeParams[fieldType] ?? {} : {}\n if (params.namedNode) {\n objectFromNewValue = this.storeContext.store.sym(newValue)\n } else if (params.defaultInputValue) {\n objectFromNewValue = encodeURIComponent(newValue.replace(/ /g, ''))\n objectFromNewValue = this.storeContext.store.sym(params.defaultInputValue + objectFromNewValue)\n } else {\n if (params.dt) {\n objectFromNewValue = new Literal(\n newValue.trim(),\n undefined,\n ns.xsd(params.dt)\n )\n } else {\n objectFromNewValue = new Literal(newValue)\n }\n }\n toInsertSt = toDeleteSt.map((statement) => st(statement.subject, statement.predicate, objectFromNewValue, statement.why))\n if (toInsertSt.length === 0) {\n toInsertSt = [st(this.dataSubject, uiPropertyTerm, objectFromNewValue, this.getDocument(this.dataSubject))]\n }\n }\n\n try {\n await this.storeContext.store.updater.updateMany(toDeleteSt, toInsertSt as any)\n this.storeVersion += 1\n } catch (err) {\n console.error('RDFInput update failed', err)\n } finally {\n this._updateInFlight = false\n }\n\n if (this._pendingUpdateValue !== null) {\n await this.runPendingUpdate()\n }\n }\n}\n","import RDFInput from './RDFInput'\n\nexport { RDFInput }\nexport default RDFInput\n"],"mappings":";;;;;;AA6DA,eAAsBgC,EACpB3B,GACAG,GACA;CACA,IAAMG,IAAWX,EAAIQ,CAAW;CAMhC,OAJIH,EAAMO,MAAMC,KAAAA,GAAWA,KAAAA,GAAWA,KAAAA,GAAWF,CAAQ,KACvDN,EAAMS,iBAAiBT,EAAMU,mBAAmBF,KAAAA,GAAWA,KAAAA,GAAWA,KAAAA,GAAWF,CAAQ,CAAC,GAGrF,MAAMN,EAAMkB,QAAQC,KAAKhB,GAAa;EAC3CiB,OAAO;EACPC,mBAAmB;CACrB,CA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AAC,GAAAC,GAAAE,GAAAP,IAAA2E,GAAA,CAAA7G,GAAA8G,MAAAC,EAAAH,GAAA;CAAA;EAAAnG;EAAA;EAAA;CAAA;CAAA;EAAAG;EAAA;EAAA;CAAA;CAAA;EAAAI;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;CAAA;EAAAE;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;AAAA,GAAArB,GAAA,GAAA,KAAA,GAvMqCV,CAAY,GAAAyH,EAAA;;ACVlD,IAAAqI,KAAe7H"}
|
|
1
|
+
{"version":3,"file":"rdf-input-CRYLK-27.js","names":["sym","parse","ns","baseUri","loadDocument","store","documentSource","documentName","documentURI","preferRemote","finalDocumentUri","document","holds","undefined","removeStatements","statementsMatching","parseSource","Promise","resolve","reject","err","console","error","fetcher","load","force","clearPreviousData","then","catch","trim","length","Error","fetchData","sortBySequence","list","subfields","map","p","k","any","ui","seq","Number","value","isNaN","sort","a","b","pair","mostSpecificClassURI","subject","typeUri","findTypeURIs","specificTypes","bottomTypeURIs","finalTypes","t","push","findForm","sourceUri","docUrl","split","fragment","includes","candidate","rdf","forms","each","found","find","term","termType","sym","ns","ns","style","fieldParams","ui","uri","size","type","dt","pattern","namedNode","defaultInputValue","formGroupStyle","element","commentStyle","formHeadingStyle","ns","NoopStore","store","Error","createContext","NoopStore","DEFAULT_STORE","storeContext","Symbol","createContext","property","state","html","ns","customElement","generateId","WebComponent","Literal","st","label","mostSpecificClassURI","fieldParams","fieldTypeParams","DEFAULT_STORE","storeContext","consume","_classDecs","_RDFInput","_A","WeakMap","_B","_C","_D","_E","_F","_ref","_storeContextDecs","context","subscribe","_formSubjectDecs","attribute","type","Object","_dataSubjectDecs","_storeVersionDecs","Number","_localInputValueDecs","_readonlyDecs","Boolean","reflect","RDFInput","_classPrivateFieldGet","v","_classPrivateFieldSet","formSubject","dataSubject","storeVersion","localInputValue","readonly","constructor","_classPrivateFieldInitSpec","_initProto","_init_storeContext","_init_formSubject","_init_dataSubject","_init_storeVersion","_init_localInputValue","_defineProperty","_init_readonly","id","render","formDocument","getDocument","uiPropertyTerm","getFormProperty","ui","inputLabel","getInputLabel","getReadOnly","fieldType","store","undefined","params","inputType","selectedTerm","getSelectedTerm","placeholder","defaultInputValue","inputValue","_updateInFlight","_pendingUpdateValue","termToInputValue","updateData","subject","doc","graph","any","formFieldSubject","uiLabel","propertyLabel","value","anyJS","defaultTerm","inputTerm","term","decodeURIComponent","String","stripped","replace","e","newValue","target","runPendingUpdate","dataDocument","updater","editable","toDeleteSt","statementsMatching","toInsertSt","objectFromNewValue","namedNode","sym","encodeURIComponent","dt","trim","xsd","map","statement","predicate","why","length","updateMany","err","console","error","_RDFInput2","c","_initClass","_applyDecs","default","consume","property","state","ns","fieldTypeParams","RDFInput","RDFInput","st","namedNode","Literal","ns_default","style","label","c","customElement","n$1","WebComponent","b","n","generateId","fetchData","document","documentURI","store","sortBySequence","subfields","list","k","p","seq","a","pair","mostSpecificClassURI","typeUri","subject","specificTypes","finalTypes","t","findForm","docUrl","sourceUri","fragment","candidate","term","fieldParams","DEFAULT_STORE","storeContext","_RDFInput2","_initProto","_initClass","_classDecs","_storeContextDecs","_init_storeContext","_formSubjectDecs","_init_formSubject","_dataSubjectDecs","_init_dataSubject","_storeVersionDecs","_init_storeVersion","_localInputValueDecs","_init_localInputValue","_readonlyDecs","_init_readonly","_ref","_defineProperty","_toPropertyKey","r","_classPrivateFieldInitSpec","_checkPrivateRedeclaration","_classPrivateFieldSet","s","_assertClassBrand","_classPrivateFieldGet","_applyDecs","i","o","applyDec","m","h","y","v","g","u","w","S","A","d","_setFunctionName","P","j","D","I","F","l","f","N","_checkInRHS","_toPrimitive","e","_RDFInput","_A","_B","_C","_D","_E","_F","formDocument","uiPropertyTerm","inputLabel","readonly","fieldType","params","inputType","selectedTerm","placeholder","inputValue","property","graph","formFieldSubject","uiLabel","propertyLabel","defaultTerm","dataSubject","newValue","dataDocument","toDeleteSt","toInsertSt","objectFromNewValue","statement","err","rdf_input_default"],"sources":["../../src/lib/forms/rdfFormsHelper.ts","../../src/lib/forms/fieldParams.ts","../../src/lib/forms/store/NoopStore.ts","../../src/lib/forms/store/StoreContext.ts","../../src/components/rdf-input/RDFInput.ts","../../src/components/rdf-input/index.ts"],"sourcesContent":["import { sym, LiveStore, parse } from 'rdflib'\nimport type { Term } from 'rdflib/lib/tf-types'\n// eslint-disable-next-line camelcase\nimport type { Quad_Subject, NamedNode } from 'rdflib/lib/tf-types'\nimport ns from '../../lib/ns'\n\nconst baseUri = 'https://solidos.github.io/solid-ui/src/ontology/'\n\nexport function loadDocument (\n store: LiveStore,\n documentSource: string,\n documentName: string,\n documentURI?: string,\n preferRemote = false\n) {\n const finalDocumentUri = documentURI || baseUri + documentName // Full URI to the file\n const document = sym(finalDocumentUri) // rdflib NamedNode for the document\n\n if (store.holds(undefined, undefined, undefined, document)) {\n store.removeStatements(store.statementsMatching(undefined, undefined, undefined, document))\n }\n\n const parseSource = () => {\n return new Promise<void>((resolve, reject) => {\n parse(documentSource, store, finalDocumentUri, 'text/turtle', (err) => {\n if (err) {\n console.error('Parse document error for ', finalDocumentUri, err)\n reject(err)\n } else {\n resolve()\n }\n })\n })\n }\n\n if (preferRemote && documentURI) {\n return store.fetcher.load(documentURI, {\n force: true,\n clearPreviousData: true,\n }).then(() => {}).catch((err) => {\n if (documentSource && documentSource.trim().length > 0) {\n return parseSource()\n }\n throw err\n })\n }\n\n if (documentSource && documentSource.trim().length > 0) {\n return parseSource()\n }\n\n if (documentURI) {\n return store.fetcher.load(documentURI, {\n force: true,\n clearPreviousData: true,\n }).then(() => {})\n }\n\n return Promise.reject(new Error(`No document source or URI for ${documentName}`))\n}\n\nexport async function fetchData (\n store: LiveStore,\n documentURI: string\n) {\n const document = sym(documentURI) // rdflib NamedNode for the document\n\n if (store.holds(undefined, undefined, undefined, document)) {\n store.removeStatements(store.statementsMatching(undefined, undefined, undefined, document))\n }\n\n return await store.fetcher.load(documentURI, {\n force: true,\n clearPreviousData: true,\n })\n}\n\nexport function sortBySequence (\n store: LiveStore,\n list: Term[]\n) {\n const subfields = list.map((p) => {\n const k = store.any(p as any, ns.ui('sequence'))\n const seq = k ? Number((k as { value: string }).value) : 9999\n return [Number.isNaN(seq) ? 9999 : seq, p] as const\n })\n\n subfields.sort((a, b) => a[0] - b[0])\n\n return subfields.map(pair => pair[1])\n}\n\n/**\n * Which class of field is this? Relies on http://www.w3.org/2000/01/rdf-schema#subClassOf and\n * https://linkeddata.github.io/rdflib.js/doc/classes/formula.html#bottomtypeuris\n * to find the most specific RDF type if there are multiple.\n *\n * @param subject a form field, e.g. `namedNode('https://timbl.com/timbl/Public/Test/Forms/individualForm.ttl#fullNameField')`\n * @returns the URI of the most specific known class, e.g. `http://www.w3.org/ns/ui#SingleLineTextField`\n */\n// eslint-disable-next-line camelcase\nexport function mostSpecificClassURI (store: LiveStore, subject: Quad_Subject): string {\n const typeUri = store.findTypeURIs(subject)\n const specificTypes = store.bottomTypeURIs(typeUri) // most specific\n const finalTypes: any[] = []\n for (const t in specificTypes) finalTypes.push(t)\n // if (finalTypes.length > 1) throw \"Didn't expect \"+subject+\" to have multiple bottom types: \"+finalTypes\n return finalTypes[0]\n}\n\n// Find the first ui:Form node in a store, optionally matching a fragment.\n// code based on Jeff Zucker's sol-components: https://github.com/jeff-zucker/sol-components (core/form-utils.js)\nexport function findForm (store: LiveStore, sourceUri: string): NamedNode | null {\n const docUrl = sourceUri.split('#')[0]\n const fragment = sourceUri.includes('#') ? sourceUri.split('#')[1] : null\n if (fragment) {\n const candidate = sym(docUrl + '#' + fragment)\n if (store.holds(candidate, ns.rdf('type'), ns.ui('Form'))) return candidate\n }\n const forms = store.each(null, ns.rdf('type'), ns.ui('Form'))\n const found = forms.find((term) => term.termType === 'NamedNode')\n return found ? (found as NamedNode) : null\n}\n","import ns from '../../lib/ns'\nimport { style } from '../../lib/style'\n\nexport type InputType =\n | 'hidden'\n | 'text'\n | 'search'\n | 'tel'\n | 'url'\n | 'email'\n | 'password'\n | 'datetime'\n | 'date'\n | 'month'\n | 'week'\n | 'time'\n | 'datetime-local'\n | 'number'\n | 'range'\n | 'color'\n | 'checkbox'\n | 'radio'\n | 'file'\n | 'submit'\n | 'image'\n | 'reset'\n | 'button'\n\nexport type FieldParamsObject = {\n size?: number, // input element size attribute\n type?: InputType, // input element type attribute. Default: 'text' (not for Comment and Heading)\n element?: string, // element type to use (Comment and Heading only)\n style?: string, // style to use\n dt?: string, // xsd data type for the RDF Literal corresponding to the field value. Default: xsd:string\n defaultInputValue?: string, // e.g. 'mailto:'. Default value in input field, will be removed when displaying actual value to user.\n namedNode?: boolean, // if true, field value corresponds to the URI of an RDF NamedNode. Overrides dt and defaultInputValue.\n pattern?: RegExp // for client-side input validation; field will go red if violated, green if ok\n}\n\n/**\n * The fieldParams object defines various constants\n * for use in various form fields. Depending on the\n * field in questions, different values may be read\n * from here.\n */\nexport const fieldParams: { [ fieldUri: string ]: FieldParamsObject } = {\n /**\n * Text field\n *\n * For possible date popups see e.g. http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm\n * or use HTML5: http://www.w3.org/TR/2011/WD-html-markup-20110113/input.date.html\n */\n [ns.ui('ColorField').uri]: {\n size: 9,\n type: 'color',\n style: 'height: 3em;', // around 1.5em is padding\n dt: 'color',\n pattern: /^\\s*#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]([0-9a-f][0-9a-f])?\\s*$/\n }, // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/color\n\n [ns.ui('DateField').uri]: {\n size: 20,\n type: 'date',\n dt: 'date',\n pattern: /^\\s*[0-9][0-9][0-9][0-9](-[0-1]?[0-9]-[0-3]?[0-9])?Z?\\s*$/\n },\n\n [ns.ui('DateTimeField').uri]: {\n size: 20,\n type: 'datetime-local', // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime\n dt: 'dateTime',\n pattern: /^\\s*[0-9][0-9][0-9][0-9](-[0-1]?[0-9]-[0-3]?[0-9])?(T[0-2][0-9]:[0-5][0-9](:[0-5][0-9])?)?Z?\\s*$/\n },\n\n [ns.ui('TimeField').uri]: {\n size: 10,\n type: 'time',\n dt: 'time',\n pattern: /^\\s*([0-2]?[0-9]:[0-5][0-9](:[0-5][0-9])?)\\s*$/\n },\n\n [ns.ui('IntegerField').uri]: {\n size: 12,\n style: 'text-align: right;',\n dt: 'integer',\n pattern: /^\\s*-?[0-9]+\\s*$/\n },\n\n [ns.ui('DecimalField').uri]: {\n size: 12,\n style: 'text-align: right;',\n dt: 'decimal',\n pattern: /^\\s*-?[0-9]*(\\.[0-9]*)?\\s*$/\n },\n\n [ns.ui('FloatField').uri]: {\n size: 12,\n style: 'text-align: right;',\n dt: 'float',\n pattern: /^\\s*-?[0-9]*(\\.[0-9]*)?((e|E)-?[0-9]*)?\\s*$/\n },\n\n [ns.ui('SingleLineTextField').uri]: {\n\n },\n [ns.ui('NamedNodeURIField').uri]: {\n namedNode: true\n },\n [ns.ui('TextField').uri]: {\n\n },\n\n [ns.ui('PhoneField').uri]: {\n size: 20,\n defaultInputValue: 'tel:',\n pattern: /^\\+?[\\d-]+[\\d]*$/\n },\n\n [ns.ui('EmailField').uri]: {\n size: 30,\n defaultInputValue: 'mailto:',\n pattern: /^\\s*.*@.*\\..*\\s*$/ // @@ Get the right regexp here\n },\n\n [ns.ui('Group').uri]: {\n style: style.formGroupStyle\n },\n\n /**\n * Non-interactive fields\n */\n [ns.ui('Comment').uri]: {\n element: 'p',\n style: style.commentStyle\n },\n [ns.ui('Heading').uri]: {\n element: 'h3',\n style: style.formHeadingStyle\n }\n}\n","import { LiveStore } from 'rdflib'\nimport { StoreContext } from './StoreContext'\n\nexport default class NoopStore implements StoreContext {\n get store (): LiveStore {\n throw new Error('Cannot use RDF forms without a store')\n }\n}\n","import { createContext } from '@lit/context'\nimport { LiveStore } from 'rdflib'\nimport NoopStore from './NoopStore'\n\nexport interface StoreContext {\n store: LiveStore\n}\n\nexport const DEFAULT_STORE = new NoopStore()\nexport const storeContext = createContext<StoreContext>(Symbol('storeContext'))\n","import { property, state } from 'lit/decorators.js'\nimport { html } from 'lit/html.js'\nimport ns from '../../lib/ns'\nimport { customElement, generateId, WebComponent } from '@/lib/components'\nimport { Literal, NamedNode, st } from 'rdflib'\nimport { label } from '../../utils'\nimport { mostSpecificClassURI } from '../../lib/forms/rdfFormsHelper'\nimport { FieldParamsObject, fieldParams as fieldTypeParams, InputType } from '../../lib/forms/fieldParams'\nimport { DEFAULT_STORE, storeContext, StoreContext } from '@/lib/forms/store/StoreContext'\nimport { consume } from '@lit/context'\nimport '@/components/input'\n\n@customElement('solid-ui-rdf-input')\nexport default class RDFInput extends WebComponent {\n // example RDF Turtle format source:\n // :nameField a ui:SingleLineTextField ;\n // ui:property vcard:fn;\n // ui:label \"name\" .\n\n // formSubject describes the field metadata\n // dataSubject points to the data resource containing the value\n\n @consume({ context: storeContext, subscribe: true })\n private accessor storeContext: StoreContext = DEFAULT_STORE\n\n @property({ attribute: false, type: Object })\n accessor formSubject: NamedNode | null = null\n\n @property({ attribute: false, type: Object })\n accessor dataSubject: NamedNode | null = null\n\n @property({ type: Number })\n accessor storeVersion = 0\n\n @state()\n private accessor localInputValue: string | null = null\n\n private _updateInFlight = false\n private _pendingUpdateValue: string | null = null\n\n @property({ type: Boolean, reflect: true })\n accessor readonly: boolean = true // to protect data, we default to not editable\n\n constructor () {\n super()\n\n this.id = generateId()\n }\n\n render () {\n const formDocument = this.getDocument(this.formSubject)\n\n // for building the HTML input element\n const uiPropertyTerm = this.getFormProperty(this.formSubject, ns.ui('property'), formDocument)\n const inputLabel = this.getInputLabel(this.formSubject, uiPropertyTerm, formDocument)\n const readonly = this.getReadOnly(this.readonly, this.formSubject, formDocument)\n\n const fieldType = this.formSubject ? mostSpecificClassURI(this.storeContext.store, this.formSubject) : undefined\n const params = fieldType ? fieldTypeParams[fieldType] ?? {} : {}\n const inputType: InputType = params.type ?? 'text'\n\n // for populating the HTML input element\n const selectedTerm = this.getSelectedTerm(this.dataSubject, uiPropertyTerm, this.formSubject, params)\n const placeholder = readonly ? '' : this.defaultInputValue(params)\n const inputValue = this._updateInFlight || this._pendingUpdateValue !== null\n ? this.localInputValue ?? ''\n : this.termToInputValue(selectedTerm)\n\n return html`\n <solid-ui-input\n label=\"${inputLabel}\"\n name=\"name-${this.id}\"\n .value=${inputValue}\n .placeholder=${placeholder}\n type=\"${inputType}\"\n ?readonly=${readonly}\n @input=${this.updateData}\n ></solid-ui-input>`\n }\n\n private getDocument (subject: NamedNode | null | undefined) {\n return subject?.doc ? subject.doc() : undefined\n }\n\n private getFormProperty (subject: NamedNode | null | undefined, property: NamedNode, graph?: any): NamedNode | undefined {\n if (!subject) return undefined\n return this.storeContext.store.any(subject, property, null, graph) as NamedNode | undefined\n }\n\n private getInputLabel (formFieldSubject: NamedNode | null | undefined, uiPropertyTerm?: NamedNode, graph?: any): string {\n if (!formFieldSubject) return ''\n const uiLabel = this.storeContext.store.any(formFieldSubject, ns.ui('label'), null, graph)\n const propertyLabel = uiPropertyTerm ? label(uiPropertyTerm, true) : ''\n return uiLabel ? uiLabel.value : propertyLabel\n }\n\n private getReadOnly (readonly: boolean, formFieldSubject?: NamedNode | null, graph?: any): boolean {\n if (formFieldSubject && readonly === false) { // if readonly is false, we can ovverride it if the field is marked as uneditable in the form\n return !!this.storeContext.store.anyJS(formFieldSubject, ns.ui('suppressEmptyUneditable'), null, graph)\n }\n return readonly\n }\n\n private getSelectedTerm (\n dataSubject?: NamedNode | null,\n uiPropertyTerm?: NamedNode,\n formFieldSubject?: NamedNode | null,\n params?: { defaultInputValue?: string }\n ) {\n const defaultTerm = formFieldSubject\n ? this.storeContext.store.any(formFieldSubject, ns.ui('default'))\n : undefined\n\n if (!uiPropertyTerm || !dataSubject) {\n return defaultTerm\n }\n\n const inputTerm = this.storeContext.store.any(dataSubject, uiPropertyTerm)\n return inputTerm || defaultTerm\n }\n\n private termToInputValue (term: any) {\n if (!term || !('value' in term) || !term.value) return ''\n\n try {\n return decodeURIComponent(term.value)\n } catch {\n return String(term.value)\n }\n }\n\n private defaultInputValue (params: { defaultInputValue?: string } = {}) {\n const stripped = params.defaultInputValue ?? ''\n return stripped.replace(/ /g, '')\n }\n\n private async updateData (e: CustomEvent) {\n const newValue = (e.target as HTMLInputElement).value\n this.localInputValue = newValue\n this._pendingUpdateValue = newValue\n\n if (this._updateInFlight) {\n return\n }\n\n await this.runPendingUpdate()\n }\n\n private async runPendingUpdate () {\n if (this._pendingUpdateValue === null) {\n return\n }\n\n const newValue = this._pendingUpdateValue\n this._pendingUpdateValue = null\n this._updateInFlight = true\n\n const uiPropertyTerm = this.getFormProperty(this.formSubject, ns.ui('property'), this.getDocument(this.formSubject))\n if (!uiPropertyTerm || !this.dataSubject) {\n this._updateInFlight = false\n this.localInputValue = ''\n return\n }\n\n const dataDocument = this.getDocument(this.dataSubject)\n if (dataDocument && this.storeContext.store.updater?.editable(dataDocument) === false) {\n this._updateInFlight = false\n return\n }\n\n const toDeleteSt = this.storeContext.store.statementsMatching(this.dataSubject, uiPropertyTerm)\n let toInsertSt: Array<ReturnType<typeof st>> = []\n\n if (newValue) {\n let objectFromNewValue\n const fieldType = this.formSubject ? mostSpecificClassURI(this.storeContext.store, this.formSubject) : undefined\n const params: FieldParamsObject = fieldType ? fieldTypeParams[fieldType] ?? {} : {}\n if (params.namedNode) {\n objectFromNewValue = this.storeContext.store.sym(newValue)\n } else if (params.defaultInputValue) {\n objectFromNewValue = encodeURIComponent(newValue.replace(/ /g, ''))\n objectFromNewValue = this.storeContext.store.sym(params.defaultInputValue + objectFromNewValue)\n } else {\n if (params.dt) {\n objectFromNewValue = new Literal(\n newValue.trim(),\n undefined,\n ns.xsd(params.dt)\n )\n } else {\n objectFromNewValue = new Literal(newValue)\n }\n }\n toInsertSt = toDeleteSt.map((statement) => st(statement.subject, statement.predicate, objectFromNewValue, statement.why))\n if (toInsertSt.length === 0) {\n toInsertSt = [st(this.dataSubject, uiPropertyTerm, objectFromNewValue, this.getDocument(this.dataSubject))]\n }\n }\n\n try {\n await this.storeContext.store.updater.updateMany(toDeleteSt, toInsertSt as any)\n this.storeVersion += 1\n } catch (err) {\n console.error('RDFInput update failed', err)\n } finally {\n this._updateInFlight = false\n }\n\n if (this._pendingUpdateValue !== null) {\n await this.runPendingUpdate()\n }\n }\n}\n","import RDFInput from './RDFInput'\n\nexport { RDFInput }\nexport default RDFInput\n"],"mappings":";;;;;AA6DA,eAAsBgC,EACpB3B,GACAG,GACA;CACA,IAAMG,IAAWX,EAAIQ,CAAW;CAMhC,OAJIH,EAAMO,MAAMC,KAAAA,GAAWA,KAAAA,GAAWA,KAAAA,GAAWF,CAAQ,KACvDN,EAAMS,iBAAiBT,EAAMU,mBAAmBF,KAAAA,GAAWA,KAAAA,GAAWA,KAAAA,GAAWF,CAAQ,CAAC,GAGrF,MAAMN,EAAMkB,QAAQC,KAAKhB,GAAa;EAC3CiB,OAAO;EACPC,mBAAmB;CACrB,CAAC;AACH;AAEA,SAAgBO,EACd5B,GACA6B,GACA;CACA,IAAMC,IAAYD,EAAKE,KAAKC,MAAM;EAChC,IAAMC,IAAIjC,EAAMkC,IAAIF,GAAUnC,EAAGsC,GAAG,UAAU,CAAC,GACzCC,IAAMH,IAAII,OAAQJ,EAAwBK,KAAK,IAAI;EACzD,OAAO,CAACD,OAAOE,MAAMH,CAAG,IAAI,OAAOA,GAAKJ,CAAC;CAC3C,CAAC;CAID,OAFAF,EAAUU,MAAMC,GAAGC,MAAMD,EAAE,KAAKC,EAAE,EAAE,GAE7BZ,EAAUC,KAAIY,MAAQA,EAAK,EAAE;AACtC;AAWA,SAAgBC,EAAsB5C,GAAkB6C,GAA+B;CACrF,IAAMC,IAAU9C,EAAM+C,aAAaF,CAAO,GACpCG,IAAgBhD,EAAMiD,eAAeH,CAAO,GAC5CI,IAAoB,CAAA;CAC1B,KAAK,IAAMC,KAAKH,GAAeE,EAAWE,KAAKD,CAAC;CAEhD,O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E,EAAGgH,IAAI3C,EAAOyC,EAAE,CAClB,IAEqB,IAAI1G,EAAQ6F,CAAQ,GAG7CQ,IAAaF,EAAWU,KAAKC,MAAc7G,EAAG6G,EAAUlC,SAASkC,EAAUC,WAAWT,GAAoBQ,EAAUE,GAAG,CAAC,GACpHX,EAAWY,WAAW,MACxBZ,IAAa,CAACpG,EAAG,KAAKqC,aAAakB,GAAgB8C,GAAoB,KAAK/C,YAAY,KAAKjB,WAAW,CAAC,CAAC;EAE9G;EAEA,IAAI;GAEF,AADA,MAAM,KAAK/B,aAAawD,MAAMkC,QAAQiB,WAAWf,GAAYE,CAAiB,GAC9E,KAAK9D,gBAAgB;EACvB,SAAS4E,GAAK;GACZC,QAAQC,MAAM,0BAA0BF,CAAG;EAC7C,UAAU;GACR,KAAK3C,kBAAkB;EACzB;EAEA,AAAI,KAAKC,wBAAwB,QAC/B,MAAM,KAAKsB,iBAAiB;CAEhC;AACF,GAAC,CAAAH,GAAA,CAAA/C,GAAAC,GAAAC,GAAAC,GAAAC,GAAAE,GAAAP,IAAA2E,GAAA,CAAA7G,GAAA8G,MAAAC,EAAAH,GAAA;CAAA;EAAAnG;EAAA;EAAA;CAAA;CAAA;EAAAG;EAAA;EAAA;CAAA;CAAA;EAAAI;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;CAAA;EAAAE;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;AAAA,GAAArB,GAAA,GAAA,KAAA,GAvMqCV,CAAY,GAAAyH,EAAA;;ACVlD,IAAAqI,KAAe7H"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { c as e,
|
|
2
|
-
import { t as o } from "./decorators-V-B013l9.js";
|
|
1
|
+
import { c as e, g as t, i as n, p as r, r as i, t as a, u as o } from "./components-C8c2Ucm5.js";
|
|
3
2
|
import { t as s } from "./query-DjAOg-tk.js";
|
|
4
3
|
import "./chevron-down-CqUEolao.js";
|
|
5
4
|
// src/lib/values.ts
|
|
@@ -7,7 +6,7 @@ function c(e) {
|
|
|
7
6
|
return e == null || e === "";
|
|
8
7
|
}
|
|
9
8
|
// src/components/select/Select.styles.css
|
|
10
|
-
var l =
|
|
9
|
+
var l = r`:host{flex-direction:column;align-items:flex-start;gap:5px;display:inline-flex;& label{color:var(--solid-ui-color-gray-600);font-size:var(--solid-ui-font-size-sm);font-weight:400}& .input-wrapper{width:100%;position:relative;& select{appearance:none;border:1px solid var(--solid-ui-color-gray-400);width:100%;color:var(--solid-ui-color-gray-700);font-size:inherit;cursor:pointer;background:#fff;border-radius:5px;padding:10px 40px 10px 10px}& icon-lucide-chevron-down{color:var(--solid-ui-color-gray-500);width:var(--solid-ui-font-size-lg);height:var(--solid-ui-font-size-lg);pointer-events:none;position:absolute;top:50%;right:15px;transform:translateY(-50%)}}}`, u, d, f, p, m, h, g, _, v, y, b, x, S, C;
|
|
11
10
|
function w(e, t, n) {
|
|
12
11
|
T(e, t), t.set(e, n);
|
|
13
12
|
}
|
|
@@ -179,9 +178,9 @@ function P(e) {
|
|
|
179
178
|
function F(e) {
|
|
180
179
|
return e;
|
|
181
180
|
}
|
|
182
|
-
g = [
|
|
181
|
+
g = [t("solid-ui-select")];
|
|
183
182
|
var I;
|
|
184
|
-
new (S = (f = /*#__PURE__*/ new WeakMap(), p = /*#__PURE__*/ new WeakMap(), C = (_ =
|
|
183
|
+
new (S = (f = /*#__PURE__*/ new WeakMap(), p = /*#__PURE__*/ new WeakMap(), C = (_ = n({ type: Array }), v = s("select"), b = i(), "options"), d = class extends a {
|
|
185
184
|
constructor(...e) {
|
|
186
185
|
super(...e), w(this, f, (m(this), y(this, null))), w(this, p, x(this, null));
|
|
187
186
|
}
|
|
@@ -209,8 +208,8 @@ new (S = (f = /*#__PURE__*/ new WeakMap(), p = /*#__PURE__*/ new WeakMap(), C =
|
|
|
209
208
|
E(p, this, e);
|
|
210
209
|
}
|
|
211
210
|
render() {
|
|
212
|
-
let t = this.options.some((e) => c(e.value)) ? e :
|
|
213
|
-
return
|
|
211
|
+
let t = this.options.some((e) => c(e.value)) ? e : o`<option disabled value="" ?selected=${!this.value}>Select an option</option>`;
|
|
212
|
+
return o`
|
|
214
213
|
${this.controlTrait.renderLabel()}
|
|
215
214
|
|
|
216
215
|
<div class="input-wrapper">
|
|
@@ -221,7 +220,7 @@ new (S = (f = /*#__PURE__*/ new WeakMap(), p = /*#__PURE__*/ new WeakMap(), C =
|
|
|
221
220
|
@change=${this.onChange}
|
|
222
221
|
>
|
|
223
222
|
${t}
|
|
224
|
-
${this.options.map((e) =>
|
|
223
|
+
${this.options.map((e) => o`<option
|
|
225
224
|
.value=${e.value}
|
|
226
225
|
?selected=${e.value === this.value}
|
|
227
226
|
>
|
|
@@ -256,7 +255,7 @@ new (S = (f = /*#__PURE__*/ new WeakMap(), p = /*#__PURE__*/ new WeakMap(), C =
|
|
|
256
255
|
1,
|
|
257
256
|
"_options"
|
|
258
257
|
]
|
|
259
|
-
], g, 0, void 0,
|
|
258
|
+
], g, 0, void 0, a), d), u = class extends F {
|
|
260
259
|
constructor() {
|
|
261
260
|
super(I), k(this, "styles", l), h();
|
|
262
261
|
}
|
|
@@ -265,4 +264,4 @@ new (S = (f = /*#__PURE__*/ new WeakMap(), p = /*#__PURE__*/ new WeakMap(), C =
|
|
|
265
264
|
var L = I;
|
|
266
265
|
export { I as n, L as t };
|
|
267
266
|
|
|
268
|
-
//# sourceMappingURL=select-
|
|
267
|
+
//# sourceMappingURL=select-ClPkDkGl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-
|
|
1
|
+
{"version":3,"file":"select-ClPkDkGl.js","names":["isEmptyValue","value","undefined","customElement","FormControlComponent","html","nothing","property","query","state","isEmptyValue","styles","_classDecs","_Select","_Select2","_A","WeakMap","_B","_ref","_optionsDecs","type","Array","_controlElementDecs","_optionsDecs2","_Select3","Select","constructor","args","_classPrivateFieldInitSpec","_initProto","_init_controlElement","_init__options","value","_options","options","querySelectorAll","from","map","option","label","textContent","controlElement","_classPrivateFieldGet","v","_classPrivateFieldSet","render","defaultOption","some","controlTrait","renderLabel","controlId","name","required","onChange","find","setValue","dispatchEvent","CustomEvent","bubbles","composed","detail","e","c","_initClass","_applyDecs","_Class","_identity","_defineProperty","default","property","query","state","nothing","styles","Select","Select","A","customElement","i","FormControlComponent","b","e","isEmptyValue","value","Select_styles_default","_Class","_Select3","_A","_B","_initProto","_initClass","_classDecs","_optionsDecs","_controlElementDecs","_init_controlElement","_optionsDecs2","_init__options","_Select2","_ref","_classPrivateFieldInitSpec","a","_checkPrivateRedeclaration","_classPrivateFieldSet","s","_assertClassBrand","r","_classPrivateFieldGet","_defineProperty","_toPropertyKey","t","_applyDecs","n","o","c","applyDec","m","h","y","v","g","u","w","S","d","p","_setFunctionName","P","j","D","I","F","l","f","N","_checkInRHS","_toPrimitive","_identity","_Select","args","options","option","defaultOption","select_default"],"sources":["../../src/lib/values.ts","../../src/components/select/Select.styles.css","../../src/components/select/Select.ts","../../src/components/select/index.ts"],"sourcesContent":["export function isEmptyValue (value: unknown): boolean {\n return value === null || value === undefined || value === ''\n}\n",":host {\n display: inline-flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 5px;\n\n label {\n color: var(--solid-ui-color-gray-600);\n font-size: var(--solid-ui-font-size-sm);\n font-weight: 400;\n }\n\n .input-wrapper {\n position: relative;\n width: 100%;\n\n select {\n appearance: none;\n border: 1px solid var(--solid-ui-color-gray-400);\n border-radius: 5px;\n padding: 10px;\n padding-right: 40px;\n width: 100%;\n background: white;\n color: var(--solid-ui-color-gray-700);\n font-size: inherit;\n cursor: pointer;\n }\n\n icon-lucide-chevron-down {\n position: absolute;\n right: 15px;\n top: 50%;\n transform: translateY(-50%);\n color: var(--solid-ui-color-gray-500);\n width: var(--solid-ui-font-size-lg);\n height: var(--solid-ui-font-size-lg);\n pointer-events: none;\n }\n }\n}\n","import { customElement, FormControlComponent } from '@/lib/components'\nimport { html, nothing } from 'lit'\nimport { property, query, state } from 'lit/decorators.js'\nimport { isEmptyValue } from '@/lib/values'\nimport type SelectOption from '@/components/select-option/SelectOption'\n\nimport '~icons/lucide/chevron-down'\n\nimport styles from './Select.styles.css'\n\nexport type SelectOptionData = {\n value: unknown;\n label: string;\n}\n\nexport type SelectChangeEvent = CustomEvent<{ option: SelectOptionData }>\n\n@customElement('solid-ui-select')\nexport default class Select extends FormControlComponent {\n static styles = styles\n\n @property({ type: Array })\n set options (value: SelectOptionData[] | null) {\n this._options = value\n }\n\n get options (): SelectOptionData[] {\n if (this._options) {\n return this._options\n }\n\n const options = this.querySelectorAll<SelectOption>(\n 'solid-ui-select-option'\n )\n\n return Array.from(options).map((option) => ({\n value: option.value,\n label: option.textContent,\n }))\n }\n\n @query('select')\n protected accessor controlElement: HTMLSelectElement | null = null;\n\n @state()\n private accessor _options: SelectOptionData[] | null = null\n\n protected render () {\n const defaultOption = this.options.some(option => isEmptyValue(option.value))\n ? nothing\n : html`<option disabled value=\"\" ?selected=${!this.value}>Select an option</option>`\n\n return html`\n ${this.controlTrait.renderLabel()}\n\n <div class=\"input-wrapper\">\n <select\n id=\"${this.controlTrait.controlId}\"\n name=${this.name}\n ?required=${this.required}\n @change=${this.onChange}\n >\n ${defaultOption}\n ${this.options.map(\n (option) =>\n html`<option\n .value=${option.value}\n ?selected=${option.value === this.value}\n >\n ${option.label}\n </option>`\n )}\n </select>\n <icon-lucide-chevron-down></icon-lucide-chevron-down>\n </div>\n `\n }\n\n private onChange () {\n const value = this.controlElement?.value ?? null\n const option = this.options.find((option) => option.value === value)\n\n this.controlTrait.setValue(value)\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: { option } }))\n }\n}\n","import Select from './Select'\n\nexport * from './Select'\nexport { Select }\nexport default Select\n"],"mappings":";;;;AAAA,SAAgBA,EAAcC,GAAyB;CACrD,OAAOA,KAAU,QAA+BA,MAAU;AAC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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m5.js";
|
|
3
2
|
// src/components/select-option/SelectOption.ts
|
|
4
3
|
var a, o, s, c, l, u, d;
|
|
5
4
|
function f(e, t, n) {
|
|
@@ -162,12 +161,12 @@ function x(e) {
|
|
|
162
161
|
if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (e === null ? "null" : typeof e));
|
|
163
162
|
return e;
|
|
164
163
|
}
|
|
165
|
-
c = [
|
|
164
|
+
c = [t("solid-ui-select-option")];
|
|
166
165
|
var S, C = /*#__PURE__*/ new WeakMap();
|
|
167
|
-
d = (l =
|
|
166
|
+
d = (l = n({
|
|
168
167
|
type: String,
|
|
169
168
|
reflect: !0
|
|
170
|
-
}), "value"), a = class extends
|
|
169
|
+
}), "value"), a = class extends r {
|
|
171
170
|
constructor(...e) {
|
|
172
171
|
super(...e), f(this, C, (o(this), u(this, "")));
|
|
173
172
|
}
|
|
@@ -178,15 +177,15 @@ d = (l = t({
|
|
|
178
177
|
m(C, this, e);
|
|
179
178
|
}
|
|
180
179
|
render() {
|
|
181
|
-
return
|
|
180
|
+
return i`${e}`;
|
|
182
181
|
}
|
|
183
182
|
}, {e: [u, o], c: [S, s]} = _(a, [[
|
|
184
183
|
l,
|
|
185
184
|
1,
|
|
186
185
|
"value"
|
|
187
|
-
]], c, 0, void 0,
|
|
186
|
+
]], c, 0, void 0, r), s();
|
|
188
187
|
// src/components/select-option/index.ts
|
|
189
188
|
var w = S;
|
|
190
189
|
export { S as n, w as t };
|
|
191
190
|
|
|
192
|
-
//# sourceMappingURL=select-option-
|
|
191
|
+
//# sourceMappingURL=select-option-DQan7rcB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-option-
|
|
1
|
+
{"version":3,"file":"select-option-DQan7rcB.js","names":["customElement","WebComponent","html","nothing","property","_classDecs","_SelectOption","_A","WeakMap","_ref","_valueDecs","type","String","reflect","SelectOption","constructor","args","_classPrivateFieldInitSpec","_initProto","_init_value","_classPrivateFieldGet","value","v","_classPrivateFieldSet","render","_SelectOption2","e","c","_initClass","_applyDecs","default","property","nothing","SelectOption","SelectOption","A","customElement","WebComponent","b","_SelectOption2","_initProto","_initClass","_classDecs","_valueDecs","_init_value","_ref","_classPrivateFieldInitSpec","a","_checkPrivateRedeclaration","_classPrivateFieldSet","s","_assertClassBrand","r","_classPrivateFieldGet","_applyDecs","i","n","o","c","applyDec","m","h","y","v","g","u","w","d","p","_setFunctionName","P","j","D","E","I","O","k","F","l","f","N","_checkInRHS","_toPropertyKey","_toPrimitive","t","e","_SelectOption","_A","args","select_option_default"],"sources":["../../src/components/select-option/SelectOption.ts","../../src/components/select-option/index.ts"],"sourcesContent":["import { customElement, WebComponent } from '@/lib/components'\nimport { html, nothing } from 'lit'\nimport { property } from 'lit/decorators.js'\n\n@customElement('solid-ui-select-option')\nexport default class SelectOption extends WebComponent {\n @property({ type: String, reflect: true })\n accessor value = ''\n\n protected render () {\n return html`${nothing}`\n }\n}\n","import SelectOption from './SelectOption'\n\nexport { SelectOption }\nexport default SelectOption\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE4CK,IAAA,CAE3CL,EAAc,wBAAwB,CAAC;AAAA,IAAAM,GAAAC,kBAAA,IAAAC,QAAA;AAAAC,KAAAC,IAErCN,EAAS;CAAEO,MAAMC;CAAQC,SAAS;AAAK,CAAC,GAAC,UAM3CY,IAAAX,cAPyCb,EAAa;CAAAc,YAAA,GAAAC,GAAA;EAAAC,AAAA,MAAA,GAAAD,CAAA,GAAAC,EAAA,MAAAV,IAAAW,EAAA,IAAA,GAAAC,EAAA,MAEpC,EAAE,EAAA;CAAA;CAAA,KAAAV,KAAA;EAAA,OAAAW,EAAAb,GAAA,IAAA;CAAA;CAAA,IAAVc,MAAKC,GAAA;EAAAC,EAAAhB,GAAA,MAAAe,CAAA;CAAA;CAEJE,SAAU;EAClB,OAAOtB,CAAI,GAAGC;CAChB;AACF,GAAC,CAAAuB,GAAA,CAAAP,GAAAD,IAAAS,GAAA,CAAArB,GAAAsB,MAAAC,EAAAJ,GAAA,CAAA;CAAAf;CAAA;CAAA;AAAA,CAAA,GAAAL,GAAA,GAAA,KAAA,GAPyCJ,CAAY,GAAA2B,EAAA;;ACFtD,IAAA6D,IAAexD"}
|