@mistriwork/mistri 1.0.0-rc.12 → 1.0.0-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/client/assets/LayoutBuilder-MPzkVU2e.js.map +1 -1
- package/dist/client/assets/index-D2dHI6hR.js.map +1 -1
- package/dist/client/assets/shell-TreN_uLs.js.map +1 -1
- package/dist/docs/access-model.md +1 -1
- package/dist/docs/build-and-deploy.md +0 -1
- package/dist/docs/cli.md +1 -1
- package/dist/docs/glossary.md +3 -3
- package/dist/docs/query.md +9 -21
- package/dist/docs/status.md +3 -3
- package/dist/embed/react/chunks/LayoutBuilder-Cbxa_wve.js.map +1 -1
- package/dist/embed/react/chunks/app-0UZ1Re1k.js.map +1 -1
- package/dist/embed/react/chunks/page-Bx4o1kpQ.js.map +1 -1
- package/dist/embed/react/chunks/palette-Bb7Lf6eo.js.map +1 -1
- package/dist/embed/react/chunks/shell-DZRACiB9.js.map +1 -1
- package/dist/embed/react/chunks/write-BQO4CFc9.js.map +1 -1
- package/dist/embed/react/index.js +1 -1
- package/dist/server/build/dockerfile.js +1 -1
- package/dist/server/cli/usage.js +2 -2
- package/dist/ui/index.js +2 -2
- package/dist/ui/page.js +2 -2
- package/dist/ui/{shared-N4Ej8yRD.js → shared-1PD7TOTJ.js} +5 -5
- package/dist/ui/{shared-N4Ej8yRD.js.map → shared-1PD7TOTJ.js.map} +1 -1
- package/dist/ui/{shared-D5m86-4o.js → shared-1gMnOu9J.js} +6 -6
- package/dist/ui/{shared-D5m86-4o.js.map → shared-1gMnOu9J.js.map} +1 -1
- package/dist/ui/{shared-Ctaj8mR2.js → shared-5RQMi4BR.js} +3 -3
- package/dist/ui/{shared-Ctaj8mR2.js.map → shared-5RQMi4BR.js.map} +1 -1
- package/dist/ui/{shared-DpLeIATZ.js → shared-B-BUF9fx.js} +2 -2
- package/dist/ui/{shared-DpLeIATZ.js.map → shared-B-BUF9fx.js.map} +1 -1
- package/dist/ui/{shared-DWYnjItP.js → shared-B-MhiPIN.js} +9 -9
- package/dist/ui/{shared-DWYnjItP.js.map → shared-B-MhiPIN.js.map} +1 -1
- package/dist/ui/{shared-0fNuhSbG.js → shared-B07qIMlE.js} +5 -5
- package/dist/ui/{shared-0fNuhSbG.js.map → shared-B07qIMlE.js.map} +1 -1
- package/dist/ui/{shared-lYtMadRU.js → shared-B1SAS_J-.js} +3 -3
- package/dist/ui/{shared-lYtMadRU.js.map → shared-B1SAS_J-.js.map} +1 -1
- package/dist/ui/{shared-CpI0Y8M5.js → shared-B4jgU8h9.js} +6 -6
- package/dist/ui/{shared-CpI0Y8M5.js.map → shared-B4jgU8h9.js.map} +1 -1
- package/dist/ui/{shared-Cxu1c35l.js → shared-B5aBCUi7.js} +30 -30
- package/dist/ui/{shared-Cxu1c35l.js.map → shared-B5aBCUi7.js.map} +1 -1
- package/dist/ui/{shared-CAe-US1q.js → shared-B9H7_Pji.js} +5 -5
- package/dist/ui/{shared-CAe-US1q.js.map → shared-B9H7_Pji.js.map} +1 -1
- package/dist/ui/{shared-Q2bgBaYo.js → shared-BAXr20S-.js} +4 -4
- package/dist/ui/{shared-Q2bgBaYo.js.map → shared-BAXr20S-.js.map} +1 -1
- package/dist/ui/{shared-CyEefFFb.js → shared-BDDUzH-f.js} +19 -19
- package/dist/ui/{shared-CyEefFFb.js.map → shared-BDDUzH-f.js.map} +1 -1
- package/dist/ui/{shared-BdhPI6dq.js → shared-BGmkeDeW.js} +3 -3
- package/dist/ui/{shared-BdhPI6dq.js.map → shared-BGmkeDeW.js.map} +1 -1
- package/dist/ui/{shared-DONIpq2q.js → shared-BHCQ60yN.js} +2 -2
- package/dist/ui/{shared-DONIpq2q.js.map → shared-BHCQ60yN.js.map} +1 -1
- package/dist/ui/{shared-CNmaAv64.js → shared-BHsjawAG.js} +8 -8
- package/dist/ui/{shared-CNmaAv64.js.map → shared-BHsjawAG.js.map} +1 -1
- package/dist/ui/{shared-DgjU9kOy.js → shared-BIQuK_nq.js} +4 -4
- package/dist/ui/{shared-DgjU9kOy.js.map → shared-BIQuK_nq.js.map} +1 -1
- package/dist/ui/{shared-icSQAj21.js → shared-BOe4W2FI.js} +3 -3
- package/dist/ui/{shared-icSQAj21.js.map → shared-BOe4W2FI.js.map} +1 -1
- package/dist/ui/{shared-BlxoOJSk.js → shared-BPpC08ip.js} +3 -3
- package/dist/ui/{shared-BlxoOJSk.js.map → shared-BPpC08ip.js.map} +1 -1
- package/dist/ui/{shared-BtiFL37J.js → shared-BdA3LPCB.js} +2 -2
- package/dist/ui/{shared-BtiFL37J.js.map → shared-BdA3LPCB.js.map} +1 -1
- package/dist/ui/{shared-CvR94vn4.js → shared-Be3nbWsd.js} +11 -11
- package/dist/ui/{shared-CvR94vn4.js.map → shared-Be3nbWsd.js.map} +1 -1
- package/dist/ui/{shared-Bl_nF_IH.js → shared-Bf30ZLoS.js} +8 -4
- package/dist/ui/shared-Bf30ZLoS.js.map +1 -0
- package/dist/ui/{shared-DijrJ_V-.js → shared-BguP_BaR.js} +7 -7
- package/dist/ui/{shared-DijrJ_V-.js.map → shared-BguP_BaR.js.map} +1 -1
- package/dist/ui/{shared-DPAVoWY0.js → shared-BoLbc2WD.js} +17 -2
- package/dist/ui/{shared-DPAVoWY0.js.map → shared-BoLbc2WD.js.map} +1 -1
- package/dist/ui/{shared-BkdBTYwx.js → shared-BttyOW4W.js} +3 -3
- package/dist/ui/{shared-BkdBTYwx.js.map → shared-BttyOW4W.js.map} +1 -1
- package/dist/ui/{shared-CQWLz8uT.js → shared-BumxsBlA.js} +10 -10
- package/dist/ui/{shared-CQWLz8uT.js.map → shared-BumxsBlA.js.map} +1 -1
- package/dist/ui/{shared-Dzu7tFiC.js → shared-Bw73ktBk.js} +3 -3
- package/dist/ui/{shared-Dzu7tFiC.js.map → shared-Bw73ktBk.js.map} +1 -1
- package/dist/ui/{shared-BhAYErSx.js → shared-C1B0GH0e.js} +4 -4
- package/dist/ui/{shared-BhAYErSx.js.map → shared-C1B0GH0e.js.map} +1 -1
- package/dist/ui/{shared-BQJQcGgj.js → shared-C2FsyYr7.js} +4 -4
- package/dist/ui/{shared-BQJQcGgj.js.map → shared-C2FsyYr7.js.map} +1 -1
- package/dist/ui/{shared-B9lw2Ryh.js → shared-C2RU1qjv.js} +4 -4
- package/dist/ui/{shared-B9lw2Ryh.js.map → shared-C2RU1qjv.js.map} +1 -1
- package/dist/ui/{shared-DQYNI9wO.js → shared-C42f07hJ.js} +5 -5
- package/dist/ui/{shared-DQYNI9wO.js.map → shared-C42f07hJ.js.map} +1 -1
- package/dist/ui/{shared-CqCZ8wMY.js → shared-C4LkPCU4.js} +3 -3
- package/dist/ui/{shared-CqCZ8wMY.js.map → shared-C4LkPCU4.js.map} +1 -1
- package/dist/ui/{shared-BhtpgOpa.js → shared-C4wSfz6k.js} +9 -9
- package/dist/ui/{shared-BhtpgOpa.js.map → shared-C4wSfz6k.js.map} +1 -1
- package/dist/ui/{shared-BHc2Izkj.js → shared-C9DZtSFH.js} +2 -2
- package/dist/ui/{shared-BHc2Izkj.js.map → shared-C9DZtSFH.js.map} +1 -1
- package/dist/ui/{shared-DW1YuiNS.js → shared-CA52ClGo.js} +2 -2
- package/dist/ui/{shared-DW1YuiNS.js.map → shared-CA52ClGo.js.map} +1 -1
- package/dist/ui/{shared-BbSbilkh.js → shared-CBciTwm6.js} +9 -9
- package/dist/ui/{shared-BbSbilkh.js.map → shared-CBciTwm6.js.map} +1 -1
- package/dist/ui/{shared-C-J32eBn.js → shared-CL3RLKDA.js} +16 -16
- package/dist/ui/{shared-C-J32eBn.js.map → shared-CL3RLKDA.js.map} +1 -1
- package/dist/ui/{shared-Ck8S4OxW.js → shared-CLq3-_hW.js} +3 -3
- package/dist/ui/{shared-Ck8S4OxW.js.map → shared-CLq3-_hW.js.map} +1 -1
- package/dist/ui/{shared-Q5WefT7G.js → shared-CMjK-Ucd.js} +3 -3
- package/dist/ui/{shared-Q5WefT7G.js.map → shared-CMjK-Ucd.js.map} +1 -1
- package/dist/ui/{shared-D3MAuEA3.js → shared-CPjpSFGh.js} +2 -2
- package/dist/ui/{shared-D3MAuEA3.js.map → shared-CPjpSFGh.js.map} +1 -1
- package/dist/ui/{shared-VshXGwXP.js → shared-CSPhENq3.js} +2 -2
- package/dist/ui/{shared-VshXGwXP.js.map → shared-CSPhENq3.js.map} +1 -1
- package/dist/ui/{shared-DJrJaE73.js → shared-CZJE4Bmp.js} +3 -3
- package/dist/ui/{shared-DJrJaE73.js.map → shared-CZJE4Bmp.js.map} +1 -1
- package/dist/ui/{shared-D7ONOwI7.js → shared-C_BhUL2I.js} +7 -7
- package/dist/ui/{shared-D7ONOwI7.js.map → shared-C_BhUL2I.js.map} +1 -1
- package/dist/ui/{shared-j-2peBIB.js → shared-CbeujwdU.js} +4 -4
- package/dist/ui/{shared-j-2peBIB.js.map → shared-CbeujwdU.js.map} +1 -1
- package/dist/ui/{shared-D5GrOEa2.js → shared-Cbf-o4Dt.js} +4 -4
- package/dist/ui/{shared-D5GrOEa2.js.map → shared-Cbf-o4Dt.js.map} +1 -1
- package/dist/ui/{shared-HwiPIajr.js → shared-CdNmeNHh.js} +3 -3
- package/dist/ui/{shared-HwiPIajr.js.map → shared-CdNmeNHh.js.map} +1 -1
- package/dist/ui/{shared-ZCFt-CPb.js → shared-CdQOMD8J.js} +3 -3
- package/dist/ui/{shared-ZCFt-CPb.js.map → shared-CdQOMD8J.js.map} +1 -1
- package/dist/ui/{shared-ClhXSGGK.js → shared-CdiPYlTh.js} +2 -2
- package/dist/ui/{shared-ClhXSGGK.js.map → shared-CdiPYlTh.js.map} +1 -1
- package/dist/ui/{shared-DA8_pVRZ.js → shared-CepLAhwm.js} +2 -2
- package/dist/ui/{shared-DA8_pVRZ.js.map → shared-CepLAhwm.js.map} +1 -1
- package/dist/ui/{shared-BrYKjrnM.js → shared-Ch82h_Fu.js} +6 -6
- package/dist/ui/{shared-BrYKjrnM.js.map → shared-Ch82h_Fu.js.map} +1 -1
- package/dist/ui/{shared-C4UrE8Fb.js → shared-Chp88all.js} +3 -3
- package/dist/ui/{shared-C4UrE8Fb.js.map → shared-Chp88all.js.map} +1 -1
- package/dist/ui/{shared-CWa80DTO.js → shared-Ci16s2rN.js} +9 -9
- package/dist/ui/{shared-CWa80DTO.js.map → shared-Ci16s2rN.js.map} +1 -1
- package/dist/ui/{shared-tksTLD6Q.js → shared-CiqNkoE1.js} +5 -5
- package/dist/ui/{shared-tksTLD6Q.js.map → shared-CiqNkoE1.js.map} +1 -1
- package/dist/ui/{shared-yt7DjSrq.js → shared-CpMhOq8F.js} +2 -2
- package/dist/ui/{shared-yt7DjSrq.js.map → shared-CpMhOq8F.js.map} +1 -1
- package/dist/ui/{shared-Dm0z5WUl.js → shared-CrWv5JKH.js} +6 -6
- package/dist/ui/{shared-Dm0z5WUl.js.map → shared-CrWv5JKH.js.map} +1 -1
- package/dist/ui/{shared-CQL3FGHc.js → shared-Csfi3Pti.js} +2 -2
- package/dist/ui/{shared-CQL3FGHc.js.map → shared-Csfi3Pti.js.map} +1 -1
- package/dist/ui/{shared-BKNRbm-V.js → shared-CuZt26rm.js} +2 -2
- package/dist/ui/{shared-BKNRbm-V.js.map → shared-CuZt26rm.js.map} +1 -1
- package/dist/ui/{shared-Guq3upiR.js → shared-Cws_z-TS.js} +2 -2
- package/dist/ui/{shared-Guq3upiR.js.map → shared-Cws_z-TS.js.map} +1 -1
- package/dist/ui/{shared-Bw_qZeIj.js → shared-D1KWuCg6.js} +2 -2
- package/dist/ui/{shared-Bw_qZeIj.js.map → shared-D1KWuCg6.js.map} +1 -1
- package/dist/ui/{shared-CuCZKwXW.js → shared-D66ju_Cb.js} +23 -23
- package/dist/ui/{shared-CuCZKwXW.js.map → shared-D66ju_Cb.js.map} +1 -1
- package/dist/ui/{shared-DYfX7NSM.js → shared-DGaQZXnw.js} +2 -2
- package/dist/ui/{shared-DYfX7NSM.js.map → shared-DGaQZXnw.js.map} +1 -1
- package/dist/ui/{shared-B3Hp8tOv.js → shared-DHy41sET.js} +6 -6
- package/dist/ui/{shared-B3Hp8tOv.js.map → shared-DHy41sET.js.map} +1 -1
- package/dist/ui/{shared-CXyd7IKi.js → shared-DKEOMQ6l.js} +2 -2
- package/dist/ui/{shared-CXyd7IKi.js.map → shared-DKEOMQ6l.js.map} +1 -1
- package/dist/ui/{shared-Ccmc8YO0.js → shared-DSUICuaJ.js} +33 -33
- package/dist/ui/{shared-Ccmc8YO0.js.map → shared-DSUICuaJ.js.map} +1 -1
- package/dist/ui/{shared-CL2iw_js.js → shared-DUPMRoO0.js} +13 -13
- package/dist/ui/{shared-CL2iw_js.js.map → shared-DUPMRoO0.js.map} +1 -1
- package/dist/ui/{shared-Dtp4eRul.js → shared-DVfdm6ah.js} +2 -2
- package/dist/ui/{shared-Dtp4eRul.js.map → shared-DVfdm6ah.js.map} +1 -1
- package/dist/ui/{shared-BJ5Ex32G.js → shared-DXM7d7lJ.js} +3 -3
- package/dist/ui/{shared-BJ5Ex32G.js.map → shared-DXM7d7lJ.js.map} +1 -1
- package/dist/ui/{shared-BFr6ld0e.js → shared-DXbMlcev.js} +2 -2
- package/dist/ui/{shared-BFr6ld0e.js.map → shared-DXbMlcev.js.map} +1 -1
- package/dist/ui/{shared-BUp3jv-N.js → shared-D_SkPtJ9.js} +6 -6
- package/dist/ui/{shared-BUp3jv-N.js.map → shared-D_SkPtJ9.js.map} +1 -1
- package/dist/ui/{shared-CdNomVzH.js → shared-Dd21k2ic.js} +4 -4
- package/dist/ui/{shared-CdNomVzH.js.map → shared-Dd21k2ic.js.map} +1 -1
- package/dist/ui/{shared-gRMbxmpu.js → shared-Dh0nHtLZ.js} +8 -8
- package/dist/ui/{shared-gRMbxmpu.js.map → shared-Dh0nHtLZ.js.map} +1 -1
- package/dist/ui/{shared-BKGJgjog.js → shared-DkOdSpSK.js} +3 -3
- package/dist/ui/{shared-BKGJgjog.js.map → shared-DkOdSpSK.js.map} +1 -1
- package/dist/ui/{shared-BMsh72Uq.js → shared-Dkph5ckT.js} +2 -2
- package/dist/ui/{shared-BMsh72Uq.js.map → shared-Dkph5ckT.js.map} +1 -1
- package/dist/ui/{shared-Be1HpDOB.js → shared-Dl1_Nx--.js} +3 -3
- package/dist/ui/{shared-Be1HpDOB.js.map → shared-Dl1_Nx--.js.map} +1 -1
- package/dist/ui/{shared-BQIZWOoJ.js → shared-Dm0IGbAf.js} +2 -2
- package/dist/ui/{shared-BQIZWOoJ.js.map → shared-Dm0IGbAf.js.map} +1 -1
- package/dist/ui/{shared-DSUtcU5S.js → shared-DnIkTpPr.js} +5 -5
- package/dist/ui/{shared-DSUtcU5S.js.map → shared-DnIkTpPr.js.map} +1 -1
- package/dist/ui/{shared-DsxGbYlV.js → shared-Docl_0tq.js} +3 -3
- package/dist/ui/{shared-DsxGbYlV.js.map → shared-Docl_0tq.js.map} +1 -1
- package/dist/ui/{shared-DZskrV26.js → shared-DprrHC72.js} +2 -2
- package/dist/ui/{shared-DZskrV26.js.map → shared-DprrHC72.js.map} +1 -1
- package/dist/ui/{shared-Bmw43Hwf.js → shared-DyKsJTZs.js} +2 -2
- package/dist/ui/{shared-Bmw43Hwf.js.map → shared-DyKsJTZs.js.map} +1 -1
- package/dist/ui/{shared-BLG88Pya.js → shared-FO7vfI3F.js} +4 -4
- package/dist/ui/{shared-BLG88Pya.js.map → shared-FO7vfI3F.js.map} +1 -1
- package/dist/ui/{shared-DLSd80D1.js → shared-HalAVHjv.js} +3 -3
- package/dist/ui/{shared-DLSd80D1.js.map → shared-HalAVHjv.js.map} +1 -1
- package/dist/ui/{shared-D1mMBLdj.js → shared-JvcI-LWp.js} +15 -15
- package/dist/ui/{shared-D1mMBLdj.js.map → shared-JvcI-LWp.js.map} +1 -1
- package/dist/ui/{shared-C6Hv_4O0.js → shared-K7Ym27yg.js} +2 -2
- package/dist/ui/{shared-C6Hv_4O0.js.map → shared-K7Ym27yg.js.map} +1 -1
- package/dist/ui/{shared-B39ln7oi.js → shared-SzlnwfJO.js} +3 -3
- package/dist/ui/{shared-B39ln7oi.js.map → shared-SzlnwfJO.js.map} +1 -1
- package/dist/ui/{shared-DgPn_Jll.js → shared-TrGbd1FY.js} +3 -3
- package/dist/ui/{shared-DgPn_Jll.js.map → shared-TrGbd1FY.js.map} +1 -1
- package/dist/ui/{shared-DrFb-XtA.js → shared-WhbuObEW.js} +2 -2
- package/dist/ui/{shared-DrFb-XtA.js.map → shared-WhbuObEW.js.map} +1 -1
- package/dist/ui/{shared-DiFQljcq.js → shared-XcSKDp6N.js} +11 -11
- package/dist/ui/{shared-DiFQljcq.js.map → shared-XcSKDp6N.js.map} +1 -1
- package/dist/ui/{shared-CMAg58rY.js → shared-Z4uBJU6I.js} +7 -6
- package/dist/ui/shared-Z4uBJU6I.js.map +1 -0
- package/dist/ui/{shared-BnUptuUp.js → shared-bAgeiRa5.js} +2 -2
- package/dist/ui/{shared-BnUptuUp.js.map → shared-bAgeiRa5.js.map} +1 -1
- package/dist/ui/{shared-BxMvSjey.js → shared-cgXG7OgZ.js} +5 -5
- package/dist/ui/{shared-BxMvSjey.js.map → shared-cgXG7OgZ.js.map} +1 -1
- package/dist/ui/{shared-u4CG2kQJ.js → shared-eZ0SB_zm.js} +2 -2
- package/dist/ui/{shared-u4CG2kQJ.js.map → shared-eZ0SB_zm.js.map} +1 -1
- package/dist/ui/{shared-L90bWW8e.js → shared-frKFb79C.js} +2 -2
- package/dist/ui/{shared-L90bWW8e.js.map → shared-frKFb79C.js.map} +1 -1
- package/dist/ui/{shared-Dd34nhkw.js → shared-hAayNSRA.js} +3 -3
- package/dist/ui/{shared-Dd34nhkw.js.map → shared-hAayNSRA.js.map} +1 -1
- package/dist/ui/{shared-DzC64cpp.js → shared-j_J16p2B.js} +2 -2
- package/dist/ui/{shared-DzC64cpp.js.map → shared-j_J16p2B.js.map} +1 -1
- package/dist/ui/{shared-DX7HRIV-.js → shared-tqpl5N3g.js} +6 -6
- package/dist/ui/{shared-DX7HRIV-.js.map → shared-tqpl5N3g.js.map} +1 -1
- package/dist/ui/{shared-BS5dBMpA.js → shared-y-6_ZDts.js} +2 -2
- package/dist/ui/{shared-BS5dBMpA.js.map → shared-y-6_ZDts.js.map} +1 -1
- package/dist/ui/{shared-Cv5v_MP1.js → shared-zG6e1Rhz.js} +13 -13
- package/dist/ui/{shared-Cv5v_MP1.js.map → shared-zG6e1Rhz.js.map} +1 -1
- package/dist/ui/testing.js +1 -1
- package/package.json +4 -4
- package/dist/docs/cli-browser.md +0 -232
- package/dist/docs/database-browser.md +0 -115
- package/dist/docs/keyboard.md +0 -63
- package/dist/docs/mcp.md +0 -86
- package/dist/ui/shared-Bl_nF_IH.js.map +0 -1
- package/dist/ui/shared-CMAg58rY.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-BQO4CFc9.js","names":["say","ownedBy","subscribeSessionIdentity","el","defineMessages","saveJson","addHostListener","state","setRecordMutationPendingProbe","render","isJsonType","toast","sessionIdentity","portalRoot","captureSessionIdentity","api","connectionGeneration","loadJson","captureNavigation","currentEntry","prefersPages","shell","shellBody","columnLabel","updateOwnerKey","validateRecordEdits","canEditRow","updateAttempts","confirmFor","captureRecordWriteRefresh","draftSchemaKey","createRecordDrafts","say","recordAutosavePending","WRITE_KEY","APP_WRITE_KEY","connectionKey","writableConnection","c","rememberedWrite","rememberWrite","storageKey","all","on","initWriteMode","prepareEditingExit","applyingStaged","connection","schema","entry","mode","captured","staged","pendingCount","discardStaged","syncWriteMode","setWriteMode","remember","drafts","emptyDraft","cancelRecordAutosave","tell","activateDraft","next","table","suspendDraft","retained","draft","feedback","dirtyDraft","takeTheirs","column","value","draftNeedsReview","sameRow","key","draftSchemaChanged","retainedValues","stagedOriginal","resumeDraft","event","editErrors","clearServerErrors","discards","listeners","serverErrors","mergedErrors","fieldFocus","noEditErrors","version","fn","subscribeStaged","unsubscribe","stagedVersion","stagedAttempt","stagedFeedback","stagedDiscardVersion","stagedEditErrors","tableId","draftErrors","client","server","cached","errors","takeFieldFocus","clearServerError","of","field","name","rest","fieldOnScreen","root","markRefusal","marks","unplaced","result","candidate","message","marked","first","focus","dismissSaveFeedback","readEditControls","controls","registered","unresolvedReference","invalidInput","errorControl","selector","publishEditValidation","previous","names","changed","inaccessible","priorFeedback","refreshEditValidation","revision","currentTable","stagedValue","pendingColumns","stage","known","original","folded","folds","fields","values","objects","sent","guarded","originals","object","toValue","registerInput","registration","input","comparable","json","applying","autosaveCancellation","autosaveIdentity","autosaveOwner","captureRecordAutosaveGuard","identity","capturedKey","cancellation","navigation","current","stillEditing","applyStaged","trigger","options","blur","guard","app","staging","generation","dispatchCurrent","confirmUpdate","acknowledged","summary","n","inputs","foldedSaved","fold","confirmSaved","onDone","err","applied","q","id","sets","where","sql","params","rows","to","from","type","dialog","k","v","resolve","whyNotEditable"],"sources":["../../../../../kit/src/client/copy/record/components/WriteConfirm.ts","../../../../../kit/src/client/copy/record/write.ts","../../../../../kit/src/client/write.js"],"sourcesContent":["/** What WriteConfirm says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n enableWriteMode: 'Enable write mode?',\n enableEditingOfExisting: 'Enable editing of existing records in',\n fieldChangesStayPending: 'Field changes stay pending until you review and apply them together.',\n theReviewNamesTheRecord: 'The review names the record, changed values, and SQL statement.',\n anUpdateThatWould: 'An update that would touch more than one row is refused.',\n writeModeStaysOnForThisDatabase: 'Write mode stays on for this database until you turn it off, including after a reload.',\n itAppliesToThisDatabase: 'It applies to this database only — switching connections does not carry it over.',\n keepViewing: 'Keep viewing',\n enableWriteModeButton: 'Enable write mode',\n});\n","/** What write says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../messages.js';\n\nexport const say = defineMessages({\n resolveThePendingOrUnconfirmed: 'Resolve the pending or unconfirmed change before leaving this view.',\n waitForThePending: 'Wait for the pending record update before changing modes.',\n discardPendingRecordChanges: 'Discard pending record changes?',\n theseFieldChangesHaveNotBeen: 'These field changes have not been applied.',\n discardChanges: 'Discard changes',\n thisConnectionIsRead: 'This connection is read-only.',\n unsavedChangesWereRetained: 'Unsaved changes were retained in this tab. Review them when you return.',\n theRecordConnectionOrTable: 'The record, connection or table definition changed. Review the current record before applying changes.',\n theRecordChangedBefore: 'The record changed before saving. Review it and save again.',\n updatedColumnsOnTheOriginal: {\n one: 'Updated {count} column on the original record in {connection}.',\n other: 'Updated {count} columns on the original record in {connection}.',\n },\n changesSaved: 'Changes saved',\n updatedColumns: { one: 'Updated {count} column on {name}.', other: 'Updated {count} columns on {name}.' },\n applyThisChange: 'Apply this change?',\n applyChanges: { one: 'Apply {count} change?', other: 'Apply {count} changes?' },\n unknownTable: 'Unknown table.',\n thisIsAView: 'This is a view. Views are read-only.',\n thisTableHasNoPrimary: 'This table has no primary key, so there is no way to identify one row safely.',\n parameters: 'parameters {params}',\n theOriginalConnection: 'the original connection',\n});\n","/**\n * Write mode.\n *\n * Workbench defaults to read-only; apps enable editing on writable connections.\n * The connection the browsing path uses remains read-only, so looking\n * around cannot write, even after editing is enabled. Editing goes through a\n * separate connection that the server opens lazily, the first time it is\n * actually asked to write.\n *\n * Editing preferences are remembered separately per connection and workspace.\n * Workbench enabling still requires explicit confirmation.\n * It never grants server permission or carries from one database to another.\n *\n * The real guard is on the server, not here. This file makes the state\n * obvious and asks for confirmation; the server independently refuses any\n * update whose WHERE clause does not match exactly one row.\n */\nimport { ownedBy } from './requestIdentity.js';\nimport {\n api,\n captureNavigation,\n columnLabel,\n currentEntry,\n el,\n loadJson,\n prefersPages,\n render,\n saveJson,\n setRecordMutationPendingProbe,\n state,\n toast,\n} from './core.js';\nimport { ask, confirmFor } from './prompt.js';\nimport { WriteConfirmDialog } from './components/WriteConfirm.js';\nimport { booleanChoices, canEditRow } from './rowEditing.js';\nimport { captureSessionIdentity, sessionIdentity, subscribeSessionIdentity } from './sessionIdentity.js';\nimport { updateAttempts, updateOwnerKey } from './updateAttempts.js';\nimport { createRecordDrafts, draftSchemaKey } from './recordDrafts.js';\nimport { shell } from './shellMode.js';\nimport { validateRecordEdits } from './recordEditValidation.js';\nimport { captureRecordWriteRefresh } from './recordWriteRefresh.js';\nimport { connectionGeneration } from './connectionTransition.js';\nimport { plural } from './locale.js';\nimport { say } from './copy/record/write.js';\nimport { isJsonType } from '@mistriwork/engine/shared/schema.js';\nimport { addHostListener, portalRoot, shellBody } from './shellHost.js';\n\nsetRecordMutationPendingProbe(recordAutosavePending);\n\n/* Write mode is remembered per connection.\n Per connection, not globally: switching from the demo to production must\n not silently inherit permission to edit it. Each database is opted into\n separately, and the choice sticks until it is turned off. */\nconst WRITE_KEY = 'mistri.write.v1';\nconst APP_WRITE_KEY = 'mistri.app-editing.v1';\n\nconst connectionKey = () => state.activeConnection ?? 'default';\nconst writableConnection = () => Boolean(state.connections?.find((c) => c.id === state.activeConnection)?.writable);\n\nfunction rememberedWrite() {\n if (prefersPages()) return writableConnection() && loadJson(APP_WRITE_KEY, {})[connectionKey()] !== false;\n return loadJson(WRITE_KEY, {})[connectionKey()] === true;\n}\n\nfunction rememberWrite(on) {\n const storageKey = prefersPages() ? APP_WRITE_KEY : WRITE_KEY;\n const all = loadJson(storageKey, {});\n all[connectionKey()] = on;\n saveJson(storageKey, all);\n}\n\nexport function initWriteMode() {\n // Restored without asking again: the confirmation was given for this\n // database and has not been withdrawn.\n setWriteMode(rememberedWrite(), { remember: false });\n}\n\n/** Mode changes must not hide pending work or interrupt an acknowledged save. */\nexport async function prepareEditingExit() {\n if (shell().mutations.hasUnresolved()) {\n toast(say('resolveThePendingOrUnconfirmed'), 'error');\n return false;\n }\n if (applyingStaged()) {\n toast(say('waitForThePending'), 'error');\n return false;\n }\n const connection = state.activeConnection;\n const schema = state.schema;\n const entry = currentEntry();\n const mode = prefersPages();\n const captured = staged;\n if (\n pendingCount() &&\n !(await confirmFor({\n title: say('discardPendingRecordChanges'),\n body: say('theseFieldChangesHaveNotBeen'),\n confirmLabel: say('discardChanges'),\n }))\n )\n return false;\n if (\n connection !== state.activeConnection ||\n schema !== state.schema ||\n entry !== currentEntry() ||\n mode !== prefersPages() ||\n captured !== staged ||\n applyingStaged() ||\n shell().mutations.hasUnresolved()\n )\n return false;\n discardStaged();\n return true;\n}\n\nexport async function toggleWriteMode() {\n if (state.canWrite) {\n if (await prepareEditingExit()) setWriteMode(false);\n return;\n }\n const connection = state.activeConnection;\n const schema = state.schema;\n const app = prefersPages();\n if (app && !writableConnection()) {\n toast(say('thisConnectionIsRead'), 'error');\n return;\n }\n if ((app || (await confirmWrite())) && connection === state.activeConnection && schema === state.schema && app === prefersPages())\n setWriteMode(true);\n}\n\n/** Re-evaluate on connection switch, since the setting is per database. */\nexport function syncWriteMode() {\n setWriteMode(rememberedWrite(), { remember: false });\n}\n\nfunction setWriteMode(on, { remember = true } = {}) {\n state.canWrite = on;\n if (remember) rememberWrite(on);\n /* The indicator is on <body> rather than the button, so it can colour the\n window frame. Being in write mode should be visible from across the room,\n not something you have to go looking for. */\n shellBody().classList.toggle('write-mode', on && !prefersPages());\n // Explicit mode exits discard above; automatic connection changes retain drafts.\n if (!on && remember) discardStaged();\n render();\n}\n\n/**\n * A real confirmation, naming the database — `components/WriteConfirm.tsx`.\n * \"Are you sure?\" teaches nothing; the name of the thing you are about to\n * be able to change does.\n */\nfunction confirmWrite() {\n return ask(WriteConfirmDialog, { label: state.schema.label });\n}\n\n/* ---------- staged edits ----------\n\n Every submission captures the whole draft as one update. An opted-in App\n can submit on an owned blur; Workbench keeps explicit review and apply.\n\n Staging is keyed by table and row, so walking away and back does not\n silently carry pending edits onto a different row. */\n\nconst drafts = createRecordDrafts();\nconst emptyDraft = () => ({\n connection: null,\n table: '',\n key: {},\n schemaKey: '',\n needsReview: false,\n manualSaveRequired: false,\n values: {},\n originals: {},\n inputs: {},\n});\nlet staged = emptyDraft();\nsubscribeSessionIdentity(() => {\n cancelRecordAutosave();\n drafts.clear();\n staged = emptyDraft();\n tell();\n});\n\nexport function activateDraft(table, key) {\n const next = drafts.acquire({ connection: state.activeConnection ?? null, table: table.id, key }, draftSchemaKey(table));\n if (next === staged) return staged;\n staged = next;\n tell();\n return staged;\n}\n\nexport function suspendDraft(draft) {\n const retained = draft === staged && prefersPages() && Object.keys(draft.values).length > 0 && !updateAttempts.get(draft);\n if (draft === staged) cancelRecordAutosave();\n drafts.suspend(draft);\n feedback.delete(draft);\n if (draft === staged) staged = emptyDraft();\n if (retained) toast(say('unsavedChangesWereRetained'), 'info');\n}\n\n/**\n * The record the reader has an unsaved draft of, for live sync (liveInvalidate.ts): a change another person made to\n * it does not reach the form, it is said beside it (components/LiveNotice.tsx).\n * @returns {{ table: string, key: Record<string, unknown>, originals: Record<string, unknown>, values: Record<string, unknown> } | undefined}\n */\nexport const dirtyDraft = () =>\n staged.connection === (state.activeConnection ?? null) && Object.keys(staged.values).length ? staged : undefined;\n\n/**\n * Take another person's value for one field of the draft: the form shows it, and Save checks against it.\n * @param {string} column\n * @param {unknown} value\n */\nexport function takeTheirs(column, value) {\n if (!Object.keys(staged.values).length) return;\n staged.values[column] = value;\n staged.originals[column] = value;\n tell();\n}\n\nexport const draftNeedsReview = (table, key) => sameRow(table, key) && staged.needsReview;\nexport const draftRequiresManualSave = (table, key) => sameRow(table, key) && staged.manualSaveRequired;\nexport const draftSchemaChanged = (table) => staged.schemaKey !== draftSchemaKey(table);\nexport const retainedValues = () => ({ ...staged.values });\nexport const stagedOriginal = (column) => (staged.needsReview ? undefined : staged.originals[column]);\n\nexport function resumeDraft(table, key) {\n if (!sameRow(table.id, key) || draftSchemaChanged(table) || !canEditRow(table, key) || stagedAttempt(table.id, key)) return;\n staged.needsReview = false;\n tell();\n}\n\naddHostListener(window, 'beforeunload', (event) => {\n if (!drafts.hasPending()) return;\n event.preventDefault();\n event.returnValue = '';\n});\n\nexport function pendingCount() {\n return staged.connection === (state.activeConnection ?? null) ? Object.keys(staged.values).length : 0;\n}\n\n/**\n * Whether what is staged belongs to the row on screen.\n *\n * The connection is part of the answer. Keyed by table and key alone, an edit\n * staged against staging's `customer:4` showed as pending on production's\n * `customer:4` — the same table name and the same id, a different database,\n * and one click from being written to the wrong one.\n */\nfunction sameRow(table, key) {\n return updateOwnerKey(staged) === updateOwnerKey({ connection: state.activeConnection ?? null, table, key });\n}\n\nexport function discardStaged() {\n cancelRecordAutosave();\n editErrors.delete(staged);\n clearServerErrors(staged);\n discards.set(staged, (discards.get(staged) ?? 0) + 1);\n if (staged.connection === (state.activeConnection ?? null)) {\n staged.values = {};\n staged.originals = {};\n staged.needsReview = false;\n staged.manualSaveRequired = false;\n feedback.delete(staged);\n } else staged = emptyDraft();\n tell();\n}\n\n/* A flag's two stored values and whether a row may be edited live in\n rowEditing.js, where a grid's cell asks them too; re-exported for the\n record editors that have always asked here. */\nexport { booleanChoices, canEditRow };\n\n/* The editor and the pending bar are components (components/Editable.tsx); they\n read this store and tick with it. */\nconst listeners = new Set();\nconst feedback = new WeakMap();\nconst discards = new WeakMap();\n/** @type {WeakMap<import('./recordDrafts.js').RecordDraft, Readonly<Record<string, string>>>} */\nconst editErrors = new WeakMap();\n/* The fields a refused save named, marked on the record until each is edited.\n Kept apart from the preflight's errors, which are recomputed from the draft\n on every edit and would otherwise wipe a mark the reader has not touched. */\n/** @type {WeakMap<import('./recordDrafts.js').RecordDraft, Readonly<Record<string, string>>>} */\nconst serverErrors = new WeakMap();\n/** @type {WeakMap<Readonly<Record<string, string>>, { client: Readonly<Record<string, string>>, errors: Readonly<Record<string, string>> }>} */\nconst mergedErrors = new WeakMap();\n/* The first field a refused explicit Save marked. Its editor may not be drawn\n yet — an unopened field opens because it is marked — so the editor takes\n the focus when it is, once. */\n/** @type {{ draft: import('./recordDrafts.js').RecordDraft, field: string } | null} */\nlet fieldFocus = null;\nconst noEditErrors = Object.freeze({});\nlet version = 0;\nfunction tell() {\n version += 1;\n for (const fn of listeners) fn();\n}\nexport function subscribeStaged(fn) {\n listeners.add(fn);\n const unsubscribe = updateAttempts.subscribe(fn);\n return () => {\n listeners.delete(fn);\n unsubscribe();\n };\n}\nexport const stagedVersion = () => version + updateAttempts.version();\n/** @returns {import('./updateAttempts.js').UpdateAttempt | undefined} */\nexport const stagedAttempt = (table, key) => updateAttempts.get({ connection: state.activeConnection ?? null, table, key });\nexport const stagedFeedback = (table, key) => (sameRow(table, key) ? feedback.get(staged) : undefined);\nexport const stagedDiscardVersion = (table, key) => (sameRow(table, key) ? (discards.get(staged) ?? 0) : 0);\n/** @returns {Readonly<Record<string, string>>} */\nexport const stagedEditErrors = (tableId, key) => (sameRow(tableId, key) ? draftErrors(staged) : noEditErrors);\n\n/* The preflight's word wins over a refusal's for the same field: it is about\n the value on screen now, the refusal about the one that was sent. */\nfunction draftErrors(draft) {\n const client = editErrors.get(draft) ?? noEditErrors;\n const server = serverErrors.get(draft);\n if (!server) return client;\n const cached = mergedErrors.get(server);\n if (cached?.client === client) return cached.errors;\n const errors = Object.freeze({ ...server, ...client });\n mergedErrors.set(server, { client, errors });\n return errors;\n}\n\n/** Whether this field's editor should take the focus a refused Save left for it. Consumed. */\nexport function takeFieldFocus(tableId, key, column) {\n if (!fieldFocus || fieldFocus.draft !== staged || fieldFocus.field !== column || !sameRow(tableId, key)) return false;\n fieldFocus = null;\n return true;\n}\n\n/* A column's own mark, and its row-defined fields' (`specs.capacity`): the\n whole object is what was staged again. */\nfunction clearServerError(draft, name) {\n const server = serverErrors.get(draft);\n const of = (field) => field === name || field.startsWith(`${name}.`);\n if (fieldFocus?.draft === draft && of(fieldFocus.field)) fieldFocus = null;\n if (!server || !Object.keys(server).some(of)) return;\n const rest = Object.fromEntries(Object.entries(server).filter(([field]) => !of(field)));\n if (Object.keys(rest).length) serverErrors.set(draft, Object.freeze(rest));\n else serverErrors.delete(draft);\n}\n\nfunction clearServerErrors(draft) {\n serverErrors.delete(draft);\n if (fieldFocus?.draft === draft) fieldFocus = null;\n}\n\n/* A field is on screen when its editor — open or not — is registered and\n drawn. Presence, not focusability: a pending save disables the launchers. */\nfunction fieldOnScreen(draft, name) {\n const root = draft.inputs[name]?.element;\n return Boolean(root?.isConnected && !root.closest('[hidden], [inert], [aria-hidden=\"true\"]'));\n}\n\n/**\n * Mark the fields a refused save named — the New form's contract, through the\n * same shape check — on the record they are drawn on, and say in the summary\n * only what cannot be marked: fields this record does not show, or none named\n * at all. An explicit Save leaves the focus on the first marked field in\n * catalog order; a blur save leaves it where the reader moved it.\n * @returns {string} The summary, empty when every named field is marked.\n */\nfunction markRefusal(draft, table, result, focus) {\n const marks = Object.create(null);\n const unplaced = [];\n for (const { field, message } of result.fields ?? []) {\n // A row-defined field is `column.key` (definedFields.ts), marked where its own editor is registered under that name.\n const column = table.columns?.find((candidate) => candidate.name === field.split('.')[0]);\n if (column && fieldOnScreen(draft, field)) marks[field] = message;\n else unplaced.push(column ? `${columnLabel(table.id, field) ?? field}: ${message}` : '');\n }\n const marked = Object.keys(marks);\n if (marked.length) serverErrors.set(draft, Object.freeze(marks));\n else clearServerErrors(draft);\n const first =\n table.columns?.find((column) => Object.hasOwn(marks, column.name))?.name ??\n marked.find((field) => table.columns?.some((column) => field.startsWith(`${column.name}.`)));\n fieldFocus = focus && first ? { draft, field: first } : fieldFocus?.draft === draft ? null : fieldFocus;\n if (marked.length && !unplaced.length) return '';\n return [result.message, ...unplaced.filter(Boolean)].join(' ');\n}\nexport function dismissSaveFeedback() {\n feedback.delete(staged);\n tell();\n}\n\nfunction readEditControls(draft) {\n /** @type {Record<string, import('./recordEditValidation.js').RecordEditControlState>} */\n const controls = Object.create(null);\n for (const [name, registered] of Object.entries(draft.inputs)) {\n if (!registered.element.isConnected || !registered.readState) continue;\n try {\n const value = registered.readState();\n if (!value || typeof value !== 'object' || Array.isArray(value) || 'then' in value) throw new Error();\n const { unresolvedReference, invalidInput } = value;\n if (\n (unresolvedReference !== undefined && typeof unresolvedReference !== 'boolean') ||\n (invalidInput !== undefined && typeof invalidInput !== 'boolean')\n )\n throw new Error();\n controls[name] = { unresolvedReference, invalidInput };\n } catch {\n // Control faults never expose callback diagnostics or permit a partial save.\n controls[name] = { invalidInput: true };\n }\n }\n return controls;\n}\n\nfunction errorControl(draft, name) {\n const root = draft.inputs[name]?.element;\n if (!root?.isConnected || root.closest('[hidden], [inert], [aria-hidden=\"true\"]')) return;\n const selector =\n 'input:not(:disabled):not([type=\"hidden\"]), textarea:not(:disabled), select:not(:disabled), button:not(:disabled), [tabindex]:not([tabindex=\"-1\"])';\n return root.matches(selector) ? root : root.querySelector(selector);\n}\n\nfunction publishEditValidation(draft, errors) {\n const previous = editErrors.get(draft) ?? noEditErrors;\n const names = Object.keys(errors);\n let changed = names.length !== Object.keys(previous).length || names.some((name) => errors[name] !== previous[name]);\n editErrors.set(draft, changed ? errors : previous);\n const inaccessible = names.filter((name) => !errorControl(draft, name));\n const priorFeedback = feedback.get(draft);\n if (inaccessible.length) {\n const message = inaccessible.map((name) => `${name}: ${errors[name]}`).join(' ');\n if (priorFeedback?.source !== 'validation' || priorFeedback.message !== message) {\n feedback.set(draft, { phase: 'error', source: 'validation', message });\n changed = true;\n }\n } else if (priorFeedback?.source === 'validation') {\n feedback.delete(draft);\n changed = true;\n }\n return changed;\n}\n\n/** Corrections may clear attempted validation, but mounting stays quiet. */\nexport function refreshEditValidation(table, key) {\n if (!prefersPages() || !sameRow(table.id, key) || !editErrors.has(staged)) return;\n const captured = staged,\n revision = stagedVersion();\n const currentTable = state.schema?.tables?.find((candidate) => candidate.id === table.id) ?? table;\n const errors = validateRecordEdits(currentTable, captured.values, readEditControls(captured));\n if (captured !== staged || revision !== stagedVersion() || !sameRow(table.id, key)) return;\n if (publishEditValidation(captured, errors)) tell();\n}\n\n/** What is staged for a column of the row on screen, or undefined. */\nexport const stagedValue = (column) => (staged.needsReview ? undefined : staged.values[column]);\nexport const pendingColumns = () => Object.keys(staged.values);\n\n/**\n * Stage one change. Typing a value and then typing the original back is not\n * a change. Exported for the editor component.\n */\nexport function stage(table, key, column, value, original) {\n const known = table.columns?.find((c) => c.name === column.name);\n // A declared transition moves only through the record's actions.\n if (column.writable === false || column.changesBy === 'actions' || known?.writable === false || known?.changesBy === 'actions') return;\n // Freeze before an autosave publishes pending state. Other staged operations\n // (notably Undo reconciliation) still preserve edits begun while they settle.\n if (stagedAttempt(table.id, key) || (recordAutosavePending() && sameRow(table.id, key))) return;\n activateDraft(table, key);\n if (staged.needsReview) return;\n feedback.delete(staged);\n // An edited field is the reader's answer to its mark; the others keep theirs.\n clearServerError(staged, column.name);\n if (Object.hasOwn(staged.originals, column.name)) original = staged.originals[column.name];\n // Text inputs stringify numbers and booleans, but NULL is not the text \"null\".\n const unchanged = value === null || original === null ? value === original : String(value) === String(original);\n if (unchanged) {\n delete staged.values[column.name];\n delete staged.originals[column.name];\n } else {\n staged.values[column.name] = value;\n staged.originals[column.name] = original;\n /* A row-defined field (DefinedFields.tsx) is staged under `column.key`\n and saved as its column's whole object: the object it was read in and\n how its box's text becomes a value ride with the draft. */\n if (column.defined) (staged.folds ??= {})[column.name] = column.defined;\n }\n refreshEditValidation(table, key);\n tell();\n}\n\n/* What is sent: each row-defined field folded into its column's object, as\n JSON text (the server writes and judges the whole object). */\nfunction folded(draft, values, originals) {\n const folds = draft.folds ?? {};\n const fields = Object.keys(values).filter((name) => Object.hasOwn(folds, name));\n if (!fields.length) return { values, originals };\n const objects = {};\n const sent = { ...values },\n guarded = { ...originals };\n for (const name of fields) {\n const { column, object, toValue } = folds[name];\n const next = (objects[column] ??= { ...object });\n const value = toValue(values[name]);\n if (value === undefined) delete next[name.slice(column.length + 1)];\n else next[name.slice(column.length + 1)] = value;\n delete sent[name];\n delete guarded[name];\n }\n for (const [column, object] of Object.entries(objects)) sent[column] = JSON.stringify(object);\n return { values: sent, originals: guarded };\n}\n\n/** The editor's element, kept so a successful write can confirm in place.\n * @param {() => import('./recordEditValidation.js').RecordEditControlState} [readState]\n */\nexport function registerInput(table, key, column, input, onCommitted, readState) {\n activateDraft(table, key);\n const captured = staged,\n registration = { element: input, onCommitted, readState };\n Object.defineProperty(captured.inputs, column, { value: registration, configurable: true, writable: true, enumerable: true });\n return () => {\n if (captured.inputs[column] === registration) delete captured.inputs[column];\n };\n}\n\nexport { sameRow };\n\n/* An update's guard names each changed column at the value it was read with —\n but a JSON column's, which no engine compares: it is written whole. */\nfunction comparable(table, originals) {\n const json = new Set((table.columns ?? []).filter((column) => isJsonType(column.type)).map((column) => column.name));\n return json.size ? Object.fromEntries(Object.entries(originals).filter(([column]) => !json.has(column))) : originals;\n}\n\nlet applying = false;\nexport const applyingStaged = () => applying;\nlet autosaveCancellation = 0;\n/** @type {ReturnType<typeof captureSessionIdentity> | undefined} */\nlet autosaveIdentity;\n/** @type {import('./updateAttempts.js').UpdateOwner | undefined} */\nlet autosaveOwner;\n/** Deferred intent only: an already dispatched write still settles normally. */\nexport function cancelRecordAutosave() {\n autosaveCancellation++;\n}\nexport function recordAutosavePending() {\n // Ordinary uncertainty keeps the record locked, not every route. Tenant\n // uncertainty still has its independent stronger navigation gate in core.\n return (\n autosaveIdentity !== undefined &&\n autosaveIdentity === sessionIdentity() &&\n autosaveOwner !== undefined &&\n updateAttempts.get(autosaveOwner)?.phase !== 'uncertain'\n );\n}\n\n/** Capture only for a fresh user edit leaving its complete interaction surface.\n * This predicate does not schedule or send anything. The interaction owner must\n * also prove its mount, picker state and current App save policy at dispatch. */\nexport function captureRecordAutosaveGuard(table, key, stillEditing) {\n const captured = staged,\n identity = captureSessionIdentity(),\n schema = state.schema;\n const capturedKey = { ...key },\n revision = stagedVersion();\n const cancellation = autosaveCancellation;\n const navigation = captureNavigation();\n const current = () => {\n try {\n return (\n typeof stillEditing === 'function' &&\n stillEditing() === true &&\n cancellation === autosaveCancellation &&\n prefersPages() &&\n navigation() &&\n captured === staged &&\n identity === sessionIdentity() &&\n schema === state.schema &&\n revision === stagedVersion() &&\n sameRow(table.id, capturedKey) &&\n pendingCount() > 0 &&\n !staged.needsReview &&\n !staged.manualSaveRequired &&\n !applying &&\n !stagedAttempt(table.id, capturedKey) &&\n !draftSchemaChanged(table) &&\n canEditRow(table, capturedKey)\n );\n } catch {\n return false;\n }\n };\n // An initially ineligible draft cannot be armed later by Resume, policy\n // changes, another acknowledgement or programmatic focus restoration.\n return current() ? current : () => false;\n}\n\n/**\n * @param {(opts?: { inPlace?: boolean }) => void} [onDone]\n * @param {{ trigger?: 'explicit'|'blur', guard?: () => boolean }} [options]\n */\nexport async function applyStaged(table, key, onDone = undefined, options = {}) {\n const trigger = options.trigger ?? 'explicit';\n if (trigger !== 'explicit' && trigger !== 'blur') return;\n const blur = trigger === 'blur';\n // Do not cancel the supplied blur capture before checking it.\n if (!blur) cancelRecordAutosave();\n const guard = () => {\n try {\n return typeof options.guard === 'function' && options.guard() === true;\n } catch {\n return false;\n }\n };\n if (blur && (!prefersPages() || staged.manualSaveRequired || !guard())) return;\n if (applying || staged.needsReview || stagedAttempt(table.id, key) || !sameRow(table.id, key)) return;\n if (!pendingCount()) {\n if (!blur && staged.manualSaveRequired) {\n staged.manualSaveRequired = false;\n editErrors.delete(staged);\n clearServerErrors(staged);\n feedback.delete(staged);\n tell();\n }\n return;\n }\n const currentTable = state.schema?.tables ? state.schema.tables.find((candidate) => candidate.id === table.id) : table;\n if (\n !currentTable ||\n draftSchemaChanged(currentTable) ||\n draftSchemaChanged(table) ||\n Object.keys(staged.values).some((name) => {\n const column = currentTable.columns?.find((c) => c.name === name);\n return column?.writable === false || column?.changesBy === 'actions';\n })\n )\n return;\n const app = prefersPages();\n if (app && !canEditRow(currentTable, key)) return;\n const captured = staged;\n const connection = captured.connection;\n const staging = { ...staged.values };\n const { values, originals } = folded(captured, staging, { ...staged.originals });\n key = { ...key };\n const schema = state.schema;\n const identity = captureSessionIdentity();\n const generation = connectionGeneration();\n const navigation = blur ? captureNavigation() : () => true;\n const cancellation = autosaveCancellation,\n revision = stagedVersion();\n if (app) {\n const errors = validateRecordEdits(currentTable, values, readEditControls(captured));\n if (\n captured !== staged ||\n revision !== stagedVersion() ||\n schema !== state.schema ||\n identity !== sessionIdentity() ||\n cancellation !== autosaveCancellation ||\n !sameRow(table.id, key) ||\n !canEditRow(currentTable, key) ||\n (blur && !guard())\n )\n return;\n const changed = publishEditValidation(captured, errors);\n if (Object.keys(errors).length) {\n if (changed) tell();\n if (!blur && captured === staged && identity === sessionIdentity() && sameRow(table.id, key)) {\n const first = Object.keys(errors)\n .map((name) => errorControl(captured, name))\n .find(Boolean);\n first?.focus();\n }\n return;\n }\n }\n feedback.delete(captured);\n const current = () => identity === sessionIdentity() && captured === staged && sameRow(table.id, key) && state.canWrite;\n const dispatchCurrent = () =>\n current() &&\n schema === state.schema &&\n generation === connectionGeneration() &&\n !draftSchemaChanged(table) &&\n (!app || (prefersPages() && canEditRow(currentTable, key))) &&\n (!blur || (navigation() && cancellation === autosaveCancellation && !captured.manualSaveRequired && !captured.needsReview));\n applying = true;\n if (blur) {\n autosaveIdentity = identity;\n autosaveOwner = { connection: connection ?? null, table: table.id, key: { ...key } };\n }\n try {\n tell();\n const ok = app || (await confirmUpdate(table, key, values, originals));\n if (!ok) return;\n if (!dispatchCurrent()) {\n if (!blur) toast(say('theRecordConnectionOrTable'), 'error');\n return;\n }\n /** @type {(() => void) | undefined} */\n let acknowledged;\n const result = await updateAttempts.run({ connection: connection ?? null, table: table.id, key }, values, () => {\n if (!dispatchCurrent()) throw Object.assign(new Error(say('theRecordChangedBefore')), { outcome: 'not_applied' });\n if (app) acknowledged = captureRecordWriteRefresh(table.id, key);\n return api('/api/update', { ...ownedBy(connection), table: table.id, key, values, expected: comparable(table, originals) });\n });\n if (result.kind !== 'applied') {\n if (result.kind === 'rejected') captured.manualSaveRequired = true;\n if (app && current() && result.kind === 'rejected') {\n /* The draft stays as it was; the fields the server named are marked\n on it, and nothing is retried — a blur save included. */\n const summary = markRefusal(captured, currentTable, result, !blur);\n if (summary) feedback.set(captured, { phase: 'error', message: summary });\n else feedback.delete(captured);\n tell();\n } else if (identity === sessionIdentity() && (result.kind !== 'uncertain' || !current())) toast(result.message, 'error');\n return;\n }\n const n = Object.keys(result.applied).length;\n const inputs = captured.inputs;\n // Settle the original draft even after navigation selected another record.\n for (const [column, value] of Object.entries(result.applied)) {\n if (Object.is(captured.values[column], values[column])) {\n delete captured.values[column];\n delete captured.originals[column];\n } else if (column in captured.values) captured.originals[column] = value;\n }\n // A row-defined field folded into a column that was written, unless it was edited again meanwhile.\n const foldedSaved = {};\n for (const name of Object.keys(staging)) {\n const fold = captured.folds?.[name];\n if (!fold || !Object.hasOwn(result.applied, fold.column)) continue;\n // Its editor is told what it now holds: the box's own text, which the object was written from.\n foldedSaved[name] = staging[name];\n if (!Object.is(captured.values[name], staging[name])) continue;\n delete captured.values[name];\n delete captured.originals[name];\n delete captured.folds[name];\n }\n if (!Object.keys(captured.values).length) {\n captured.needsReview = false;\n captured.manualSaveRequired = false;\n editErrors.delete(captured);\n }\n // What a refusal said was about the values it saw; these were written.\n clearServerErrors(captured);\n acknowledged?.();\n // History follows the original owner even if another record is now open.\n if (\n identity === sessionIdentity() &&\n connection === state.activeConnection &&\n schema === state.schema &&\n generation === connectionGeneration()\n )\n void shell().undo.refresh();\n tell();\n if (!current()) {\n if (identity === sessionIdentity())\n toast(say('updatedColumnsOnTheOriginal', { count: n, connection: connection ?? say('theOriginalConnection') }), 'ok');\n return;\n }\n\n // An App has no Undo: the dock says what was saved.\n if (app) feedback.set(captured, { phase: 'saved', message: say('changesSaved'), identity, columns: Object.keys(values) });\n else\n toast(\n say('updatedColumns', { count: n, name: table.name }),\n 'ok',\n !identity.tenantRequired && result.undoId\n ? {\n /* Beside the confirmation, because this is the moment someone realises\n it was the wrong row — and sending them to a menu to find Undo wastes\n the seconds in which they still remember what they changed. */\n label: say('common.undo'),\n run: () => {\n if (identity === sessionIdentity() && connection === state.activeConnection) void shell().undo.last(result.undoId);\n },\n }\n : undefined,\n );\n\n /* Confirmed in place rather than by re-rendering. A re-render would throw\n away the row you are looking at and rebuild it, which reads as a flicker\n and loses the caret; worse, it left the fields showing their unsaved\n styling because the DOM they styled was gone before the class was.\n Showing the saved value, in green, on the field you just edited is both\n calmer and more specific — it says *which* fields landed. */\n tell();\n confirmSaved(inputs, { ...result.applied, ...foldedSaved });\n // Only the pending bar is refreshed, so the green fields survive.\n onDone?.({ inPlace: true });\n } catch (err) {\n // Attempt failures are classified above; presentation failures must not resend.\n toast(err.message, 'error');\n } finally {\n if (blur) {\n autosaveIdentity = undefined;\n autosaveOwner = undefined;\n }\n applying = false;\n tell();\n }\n}\n\nfunction confirmSaved(inputs, applied) {\n for (const [column, value] of Object.entries(applied)) {\n const registered = inputs[column];\n const input = registered?.element;\n if (!input || !input.isConnected) continue;\n // The value the database actually stored, which may differ from what was\n // typed — \"17901\" comes back as the number 17901.\n registered.onCommitted?.(value);\n }\n}\n\n/** Show the statement before it runs. This is the last stop before a write. */\nfunction confirmUpdate(table, key, values, originals) {\n return new Promise((resolve) => {\n const q = (id) => `\"${id}\"`;\n const sets = Object.keys(values)\n .map((c) => `${q(c)} = ?`)\n .join(',\\n ');\n const where = [\n ...Object.keys(key).map((c) => `${q(c)} = ?`),\n ...Object.keys(originals).map((c) => `${q(c)} ${originals[c] === null ? 'IS NULL' : '= ?'}`),\n ].join(' AND ');\n const sql = `UPDATE ${q(table.id)}\\n SET ${sets}\\n WHERE ${where};`;\n\n /* The parameters shown are the raw staged values. The server coerces them\n against the declared column types and returns what it applied, so a\n number typed as text is corrected there rather than guessed at here. */\n const params = JSON.stringify([\n ...Object.values(values),\n ...Object.values(key),\n ...Object.values(originals).filter((value) => value !== null),\n ]);\n\n const rows = Object.entries(values).map(([column, to]) => {\n const from = originals[column];\n const type = table.columns.find((c) => c.name === column)?.type ?? '';\n return el('tr', {}, [\n el('td', {}, [el('span', { class: 'diff-col', text: column }), el('span', { class: 'diff-type', text: type.toLowerCase() })]),\n el('td', { class: `diff-from${from === null ? ' null' : ''}`, text: from === null ? 'null' : String(from) }),\n el('td', { class: 'diff-arrow', text: '→' }),\n el('td', { class: `diff-to${to === null ? ' null' : ''}`, text: to === null ? 'null' : String(to) }),\n ]);\n });\n\n const dialog = el('dialog', { class: 'confirm confirm-wide' }, [\n el('h2', { text: rows.length === 1 ? say('applyThisChange') : say('applyChanges', { count: rows.length }) }),\n el('p', {}, [\n document.createTextNode('One row in '),\n el('strong', { text: table.id }),\n document.createTextNode(', identified by '),\n el('strong', {\n text: Object.entries(key)\n .map(([k, v]) => `${k} = ${v}`)\n .join(', '),\n }),\n document.createTextNode('. Applied as a single statement only if these fields still match their original values.'),\n ]),\n el('table', { class: 'confirm-diff' }, el('tbody', {}, rows)),\n el('pre', { class: 'ddl', text: sql }),\n el('p', { class: 'confirm-params', text: say('parameters', { params }) }),\n el('div', { class: 'confirm-actions' }, [\n el('button', {\n type: 'button',\n class: 'ghost',\n text: say('common.cancel'),\n onclick: () => {\n dialog.close();\n resolve(false);\n },\n }),\n el('button', {\n type: 'button',\n class: 'primary',\n text: say('common.apply'),\n onclick: () => {\n dialog.close();\n resolve(true);\n },\n }),\n ]),\n ]);\n dialog.addEventListener('close', () => dialog.remove());\n dialog.addEventListener('cancel', () => resolve(false));\n portalRoot().append(dialog);\n dialog.showModal();\n });\n}\n\n/** Why a row is not editable, for the record view to explain rather than hide. */\nexport function whyNotEditable(table) {\n if (!state.canWrite) return null; // not in write mode: say nothing\n if (!table) return say('unknownTable');\n if (table.isView) return say('thisIsAView');\n if (!table.columns.some((c) => c.primaryKey)) {\n return say('thisTableHasNoPrimary');\n }\n return null;\n}\n"],"mappings":";;;;;;;;;AAGAI,EAAA;CACE,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;AACF,CAAA;;ACVA,IAAA4B,IAAA5B,EAAA;CACE,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;EACE,KAAA;EACA,OAAA;CACF;CACA,GAAA;CACA,GAAA;EAAkB,KAAA;EAA0C,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,SAAA,eAAA,yFAAA;GACA,CAAA;GACAtM,EAAA,SAAA,EAAA,OAAA,eAAA,GAAAA,EAAA,SAAA,CAAA,GAAAgM,CAAA,CAAA;GACAhM,EAAA,OAAA;IAAA,OAAA;IAAA,MAAA8L;GAAA,CAAA;GACA9L,EAAA,KAAA;IAAA,OAAA;IAAA,MAAA6B,EAAmD,KAAY,EAAA,UAAA,CAAA;GAAA,CAAA;GAC/D7B,EAAA,OAAA,EAAA,OAAA,kBAAA,GAAA,CACAA,EAAA,UAAA;IACA,MAAA;IACA,OAAA;IACA,MAAA6B,EAAoB,KAAe;IACnC,eAAA;KAEA,AADAuK,EAAA,MAAA,GACAG,EAAA,EAAA;IACA;GACA,CAAA,GACAvM,EAAA,UAAA;IACA,MAAA;IACA,OAAA;IACA,MAAA6B,EAAoB,KAAc;IAClC,eAAA;KAEA,AADAuK,EAAA,MAAA,GACAG,EAAA,EAAA;IACA;GACA,CAAA,CACA,CAAA;EACA,CAAA;EAIA,AAHAH,EAAA,iBAAA,eAAAA,EAAA,OAAA,CAAA,GACAA,EAAA,iBAAA,gBAAAG,EAAA,EAAA,CAAA,GACA7L,EAAA,CAAA,CAAA,OAAA0L,CAAA,GACAA,EAAA,UAAA;CACA,CAAA;AACA;AAGA,SAAAI,GAAA,GAAA;CAOA,OANApM,EAAA,WACAyD,IACAA,EAAA,SAAAhC,EAA+B,GAAa,IAC5CgC,EAAA,QAAA,MAAA,MAAA1B,EAAA,UAAA,IAGA,OAFAN,EAAe,GAAuB,IAHtCA,EAAyB,GAAc,IADvC;AAOA"}
|
|
1
|
+
{"version":3,"file":"write-BQO4CFc9.js","names":["say","ownedBy","subscribeSessionIdentity","el","defineMessages","saveJson","addHostListener","state","setRecordMutationPendingProbe","render","isJsonType","toast","sessionIdentity","portalRoot","captureSessionIdentity","api","connectionGeneration","loadJson","captureNavigation","currentEntry","prefersPages","shell","shellBody","columnLabel","updateOwnerKey","validateRecordEdits","canEditRow","updateAttempts","confirmFor","captureRecordWriteRefresh","draftSchemaKey","createRecordDrafts","say","recordAutosavePending","WRITE_KEY","APP_WRITE_KEY","connectionKey","writableConnection","c","rememberedWrite","rememberWrite","storageKey","all","on","initWriteMode","prepareEditingExit","applyingStaged","connection","schema","entry","mode","captured","staged","pendingCount","discardStaged","syncWriteMode","setWriteMode","remember","drafts","emptyDraft","cancelRecordAutosave","tell","activateDraft","next","table","suspendDraft","retained","draft","feedback","dirtyDraft","takeTheirs","column","value","draftNeedsReview","sameRow","key","draftSchemaChanged","retainedValues","stagedOriginal","resumeDraft","event","editErrors","clearServerErrors","discards","listeners","serverErrors","mergedErrors","fieldFocus","noEditErrors","version","fn","subscribeStaged","unsubscribe","stagedVersion","stagedAttempt","stagedFeedback","stagedDiscardVersion","stagedEditErrors","tableId","draftErrors","client","server","cached","errors","takeFieldFocus","clearServerError","of","field","name","rest","fieldOnScreen","root","markRefusal","marks","unplaced","result","candidate","message","marked","first","focus","dismissSaveFeedback","readEditControls","controls","registered","unresolvedReference","invalidInput","errorControl","selector","publishEditValidation","previous","names","changed","inaccessible","priorFeedback","refreshEditValidation","revision","currentTable","stagedValue","pendingColumns","stage","known","original","folded","folds","fields","values","objects","sent","guarded","originals","object","toValue","registerInput","registration","input","comparable","json","applying","autosaveCancellation","autosaveIdentity","autosaveOwner","captureRecordAutosaveGuard","identity","capturedKey","cancellation","navigation","current","stillEditing","applyStaged","trigger","options","blur","guard","app","staging","generation","dispatchCurrent","confirmUpdate","acknowledged","summary","n","inputs","foldedSaved","fold","confirmSaved","onDone","err","applied","q","id","sets","where","sql","params","rows","to","from","type","dialog","k","v","resolve","whyNotEditable"],"sources":["../../../../../kit/src/client/copy/record/components/WriteConfirm.ts","../../../../../kit/src/client/copy/record/write.ts","../../../../../kit/src/client/write.js"],"sourcesContent":["/** What WriteConfirm says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n enableWriteMode: 'Enable write mode?',\n enableEditingOfExisting: 'Enable editing of existing records in',\n fieldChangesStayPending: 'Field changes stay pending until you review and apply them together.',\n theReviewNamesTheRecord: 'The review names the record, changed values, and SQL statement.',\n anUpdateThatWould: 'An update that would touch more than one row is refused.',\n writeModeStaysOnForThisDatabase: 'Write mode stays on for this database until you turn it off, including after a reload.',\n itAppliesToThisDatabase: 'It applies to this database only — switching connections does not carry it over.',\n keepViewing: 'Keep viewing',\n enableWriteModeButton: 'Enable write mode',\n});\n","/** What write says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../messages.js';\n\nexport const say = defineMessages({\n resolveThePendingOrUnconfirmed: 'Resolve the pending or unconfirmed change before leaving this view.',\n waitForThePending: 'Wait for the pending record update before changing modes.',\n discardPendingRecordChanges: 'Discard pending record changes?',\n theseFieldChangesHaveNotBeen: 'These field changes have not been applied.',\n discardChanges: 'Discard changes',\n thisConnectionIsRead: 'This connection is read-only.',\n unsavedChangesWereRetained: 'Unsaved changes were retained in this tab. Review them when you return.',\n theRecordConnectionOrTable: 'The record, connection or table definition changed. Review the current record before applying changes.',\n theRecordChangedBefore: 'The record changed before saving. Review it and save again.',\n updatedColumnsOnTheOriginal: {\n one: 'Updated {count} column on the original record in {connection}.',\n other: 'Updated {count} columns on the original record in {connection}.',\n },\n changesSaved: 'Changes saved',\n updatedColumns: { one: 'Updated {count} column on {name}.', other: 'Updated {count} columns on {name}.' },\n applyThisChange: 'Apply this change?',\n applyChanges: { one: 'Apply {count} change?', other: 'Apply {count} changes?' },\n unknownTable: 'Unknown table.',\n thisIsAView: 'This is a view. Views are read-only.',\n thisTableHasNoPrimary: 'This table has no primary key, so there is no way to identify one row safely.',\n parameters: 'parameters {params}',\n theOriginalConnection: 'the original connection',\n});\n","/**\n * Write mode.\n *\n * Workbench defaults to read-only; apps enable editing on writable connections.\n * The connection the browsing path uses remains read-only, so looking\n * around cannot write, even after editing is enabled. Editing goes through a\n * separate connection that the server opens lazily, the first time it is\n * actually asked to write.\n *\n * Editing preferences are remembered separately per connection and workspace.\n * Workbench enabling still requires explicit confirmation.\n * It never grants server permission or carries from one database to another.\n *\n * The real guard is on the server, not here. This file makes the state\n * obvious and asks for confirmation; the server independently refuses any\n * update whose WHERE clause does not match exactly one row.\n */\nimport { ownedBy } from './requestIdentity.js';\nimport {\n api,\n captureNavigation,\n columnLabel,\n currentEntry,\n el,\n loadJson,\n prefersPages,\n render,\n saveJson,\n setRecordMutationPendingProbe,\n state,\n toast,\n} from './core.js';\nimport { ask, confirmFor } from './prompt.js';\nimport { WriteConfirmDialog } from './components/WriteConfirm.js';\nimport { booleanChoices, canEditRow } from './rowEditing.js';\nimport { captureSessionIdentity, sessionIdentity, subscribeSessionIdentity } from './sessionIdentity.js';\nimport { updateAttempts, updateOwnerKey } from './updateAttempts.js';\nimport { createRecordDrafts, draftSchemaKey } from './recordDrafts.js';\nimport { shell } from './shellMode.js';\nimport { validateRecordEdits } from './recordEditValidation.js';\nimport { captureRecordWriteRefresh } from './recordWriteRefresh.js';\nimport { connectionGeneration } from './connectionTransition.js';\nimport { plural } from './locale.js';\nimport { say } from './copy/record/write.js';\nimport { isJsonType } from '@mistriwork/engine/shared/schema.js';\nimport { addHostListener, portalRoot, shellBody } from './shellHost.js';\n\nsetRecordMutationPendingProbe(recordAutosavePending);\n\n/* Write mode is remembered per connection.\n Per connection, not globally: switching from the demo to production must\n not silently inherit permission to edit it. Each database is opted into\n separately, and the choice sticks until it is turned off. */\nconst WRITE_KEY = 'mistri.write.v1';\nconst APP_WRITE_KEY = 'mistri.app-editing.v1';\n\nconst connectionKey = () => state.activeConnection ?? 'default';\nconst writableConnection = () => Boolean(state.connections?.find((c) => c.id === state.activeConnection)?.writable);\n\nfunction rememberedWrite() {\n if (prefersPages()) return writableConnection() && loadJson(APP_WRITE_KEY, {})[connectionKey()] !== false;\n return loadJson(WRITE_KEY, {})[connectionKey()] === true;\n}\n\nfunction rememberWrite(on) {\n const storageKey = prefersPages() ? APP_WRITE_KEY : WRITE_KEY;\n const all = loadJson(storageKey, {});\n all[connectionKey()] = on;\n saveJson(storageKey, all);\n}\n\nexport function initWriteMode() {\n // Restored without asking again: the confirmation was given for this\n // database and has not been withdrawn.\n setWriteMode(rememberedWrite(), { remember: false });\n}\n\n/** Mode changes must not hide pending work or interrupt an acknowledged save. */\nexport async function prepareEditingExit() {\n if (shell().mutations.hasUnresolved()) {\n toast(say('resolveThePendingOrUnconfirmed'), 'error');\n return false;\n }\n if (applyingStaged()) {\n toast(say('waitForThePending'), 'error');\n return false;\n }\n const connection = state.activeConnection;\n const schema = state.schema;\n const entry = currentEntry();\n const mode = prefersPages();\n const captured = staged;\n if (\n pendingCount() &&\n !(await confirmFor({\n title: say('discardPendingRecordChanges'),\n body: say('theseFieldChangesHaveNotBeen'),\n confirmLabel: say('discardChanges'),\n }))\n )\n return false;\n if (\n connection !== state.activeConnection ||\n schema !== state.schema ||\n entry !== currentEntry() ||\n mode !== prefersPages() ||\n captured !== staged ||\n applyingStaged() ||\n shell().mutations.hasUnresolved()\n )\n return false;\n discardStaged();\n return true;\n}\n\n/** @public the database browser's (scripts/boundary/entries.json, \"host\") */\nexport async function toggleWriteMode() {\n if (state.canWrite) {\n if (await prepareEditingExit()) setWriteMode(false);\n return;\n }\n const connection = state.activeConnection;\n const schema = state.schema;\n const app = prefersPages();\n if (app && !writableConnection()) {\n toast(say('thisConnectionIsRead'), 'error');\n return;\n }\n if ((app || (await confirmWrite())) && connection === state.activeConnection && schema === state.schema && app === prefersPages())\n setWriteMode(true);\n}\n\n/** Re-evaluate on connection switch, since the setting is per database. */\nexport function syncWriteMode() {\n setWriteMode(rememberedWrite(), { remember: false });\n}\n\nfunction setWriteMode(on, { remember = true } = {}) {\n state.canWrite = on;\n if (remember) rememberWrite(on);\n /* The indicator is on <body> rather than the button, so it can colour the\n window frame. Being in write mode should be visible from across the room,\n not something you have to go looking for. */\n shellBody().classList.toggle('write-mode', on && !prefersPages());\n // Explicit mode exits discard above; automatic connection changes retain drafts.\n if (!on && remember) discardStaged();\n render();\n}\n\n/**\n * A real confirmation, naming the database — `components/WriteConfirm.tsx`.\n * \"Are you sure?\" teaches nothing; the name of the thing you are about to\n * be able to change does.\n */\nfunction confirmWrite() {\n return ask(WriteConfirmDialog, { label: state.schema.label });\n}\n\n/* ---------- staged edits ----------\n\n Every submission captures the whole draft as one update. An opted-in App\n can submit on an owned blur; Workbench keeps explicit review and apply.\n\n Staging is keyed by table and row, so walking away and back does not\n silently carry pending edits onto a different row. */\n\nconst drafts = createRecordDrafts();\nconst emptyDraft = () => ({\n connection: null,\n table: '',\n key: {},\n schemaKey: '',\n needsReview: false,\n manualSaveRequired: false,\n values: {},\n originals: {},\n inputs: {},\n});\nlet staged = emptyDraft();\nsubscribeSessionIdentity(() => {\n cancelRecordAutosave();\n drafts.clear();\n staged = emptyDraft();\n tell();\n});\n\nexport function activateDraft(table, key) {\n const next = drafts.acquire({ connection: state.activeConnection ?? null, table: table.id, key }, draftSchemaKey(table));\n if (next === staged) return staged;\n staged = next;\n tell();\n return staged;\n}\n\nexport function suspendDraft(draft) {\n const retained = draft === staged && prefersPages() && Object.keys(draft.values).length > 0 && !updateAttempts.get(draft);\n if (draft === staged) cancelRecordAutosave();\n drafts.suspend(draft);\n feedback.delete(draft);\n if (draft === staged) staged = emptyDraft();\n if (retained) toast(say('unsavedChangesWereRetained'), 'info');\n}\n\n/**\n * The record the reader has an unsaved draft of, for live sync (liveInvalidate.ts): a change another person made to\n * it does not reach the form, it is said beside it (components/LiveNotice.tsx).\n * @returns {{ table: string, key: Record<string, unknown>, originals: Record<string, unknown>, values: Record<string, unknown> } | undefined}\n */\nexport const dirtyDraft = () =>\n staged.connection === (state.activeConnection ?? null) && Object.keys(staged.values).length ? staged : undefined;\n\n/**\n * Take another person's value for one field of the draft: the form shows it, and Save checks against it.\n * @param {string} column\n * @param {unknown} value\n */\nexport function takeTheirs(column, value) {\n if (!Object.keys(staged.values).length) return;\n staged.values[column] = value;\n staged.originals[column] = value;\n tell();\n}\n\nexport const draftNeedsReview = (table, key) => sameRow(table, key) && staged.needsReview;\n/** @public the database browser's (scripts/boundary/entries.json, \"host\") */\nexport const draftRequiresManualSave = (table, key) => sameRow(table, key) && staged.manualSaveRequired;\nexport const draftSchemaChanged = (table) => staged.schemaKey !== draftSchemaKey(table);\nexport const retainedValues = () => ({ ...staged.values });\nexport const stagedOriginal = (column) => (staged.needsReview ? undefined : staged.originals[column]);\n\nexport function resumeDraft(table, key) {\n if (!sameRow(table.id, key) || draftSchemaChanged(table) || !canEditRow(table, key) || stagedAttempt(table.id, key)) return;\n staged.needsReview = false;\n tell();\n}\n\naddHostListener(window, 'beforeunload', (event) => {\n if (!drafts.hasPending()) return;\n event.preventDefault();\n event.returnValue = '';\n});\n\nexport function pendingCount() {\n return staged.connection === (state.activeConnection ?? null) ? Object.keys(staged.values).length : 0;\n}\n\n/**\n * Whether what is staged belongs to the row on screen.\n *\n * The connection is part of the answer. Keyed by table and key alone, an edit\n * staged against staging's `customer:4` showed as pending on production's\n * `customer:4` — the same table name and the same id, a different database,\n * and one click from being written to the wrong one.\n */\nfunction sameRow(table, key) {\n return updateOwnerKey(staged) === updateOwnerKey({ connection: state.activeConnection ?? null, table, key });\n}\n\nexport function discardStaged() {\n cancelRecordAutosave();\n editErrors.delete(staged);\n clearServerErrors(staged);\n discards.set(staged, (discards.get(staged) ?? 0) + 1);\n if (staged.connection === (state.activeConnection ?? null)) {\n staged.values = {};\n staged.originals = {};\n staged.needsReview = false;\n staged.manualSaveRequired = false;\n feedback.delete(staged);\n } else staged = emptyDraft();\n tell();\n}\n\n/* A flag's two stored values and whether a row may be edited live in\n rowEditing.js, where a grid's cell asks them too; re-exported for the\n record editors that have always asked here. */\nexport { booleanChoices, canEditRow };\n\n/* The editor and the pending bar are components (components/Editable.tsx); they\n read this store and tick with it. */\nconst listeners = new Set();\nconst feedback = new WeakMap();\nconst discards = new WeakMap();\n/** @type {WeakMap<import('./recordDrafts.js').RecordDraft, Readonly<Record<string, string>>>} */\nconst editErrors = new WeakMap();\n/* The fields a refused save named, marked on the record until each is edited.\n Kept apart from the preflight's errors, which are recomputed from the draft\n on every edit and would otherwise wipe a mark the reader has not touched. */\n/** @type {WeakMap<import('./recordDrafts.js').RecordDraft, Readonly<Record<string, string>>>} */\nconst serverErrors = new WeakMap();\n/** @type {WeakMap<Readonly<Record<string, string>>, { client: Readonly<Record<string, string>>, errors: Readonly<Record<string, string>> }>} */\nconst mergedErrors = new WeakMap();\n/* The first field a refused explicit Save marked. Its editor may not be drawn\n yet — an unopened field opens because it is marked — so the editor takes\n the focus when it is, once. */\n/** @type {{ draft: import('./recordDrafts.js').RecordDraft, field: string } | null} */\nlet fieldFocus = null;\nconst noEditErrors = Object.freeze({});\nlet version = 0;\nfunction tell() {\n version += 1;\n for (const fn of listeners) fn();\n}\nexport function subscribeStaged(fn) {\n listeners.add(fn);\n const unsubscribe = updateAttempts.subscribe(fn);\n return () => {\n listeners.delete(fn);\n unsubscribe();\n };\n}\nexport const stagedVersion = () => version + updateAttempts.version();\n/** @returns {import('./updateAttempts.js').UpdateAttempt | undefined} */\nexport const stagedAttempt = (table, key) => updateAttempts.get({ connection: state.activeConnection ?? null, table, key });\nexport const stagedFeedback = (table, key) => (sameRow(table, key) ? feedback.get(staged) : undefined);\nexport const stagedDiscardVersion = (table, key) => (sameRow(table, key) ? (discards.get(staged) ?? 0) : 0);\n/** @returns {Readonly<Record<string, string>>} */\nexport const stagedEditErrors = (tableId, key) => (sameRow(tableId, key) ? draftErrors(staged) : noEditErrors);\n\n/* The preflight's word wins over a refusal's for the same field: it is about\n the value on screen now, the refusal about the one that was sent. */\nfunction draftErrors(draft) {\n const client = editErrors.get(draft) ?? noEditErrors;\n const server = serverErrors.get(draft);\n if (!server) return client;\n const cached = mergedErrors.get(server);\n if (cached?.client === client) return cached.errors;\n const errors = Object.freeze({ ...server, ...client });\n mergedErrors.set(server, { client, errors });\n return errors;\n}\n\n/** Whether this field's editor should take the focus a refused Save left for it. Consumed. */\nexport function takeFieldFocus(tableId, key, column) {\n if (!fieldFocus || fieldFocus.draft !== staged || fieldFocus.field !== column || !sameRow(tableId, key)) return false;\n fieldFocus = null;\n return true;\n}\n\n/* A column's own mark, and its row-defined fields' (`specs.capacity`): the\n whole object is what was staged again. */\nfunction clearServerError(draft, name) {\n const server = serverErrors.get(draft);\n const of = (field) => field === name || field.startsWith(`${name}.`);\n if (fieldFocus?.draft === draft && of(fieldFocus.field)) fieldFocus = null;\n if (!server || !Object.keys(server).some(of)) return;\n const rest = Object.fromEntries(Object.entries(server).filter(([field]) => !of(field)));\n if (Object.keys(rest).length) serverErrors.set(draft, Object.freeze(rest));\n else serverErrors.delete(draft);\n}\n\nfunction clearServerErrors(draft) {\n serverErrors.delete(draft);\n if (fieldFocus?.draft === draft) fieldFocus = null;\n}\n\n/* A field is on screen when its editor — open or not — is registered and\n drawn. Presence, not focusability: a pending save disables the launchers. */\nfunction fieldOnScreen(draft, name) {\n const root = draft.inputs[name]?.element;\n return Boolean(root?.isConnected && !root.closest('[hidden], [inert], [aria-hidden=\"true\"]'));\n}\n\n/**\n * Mark the fields a refused save named — the New form's contract, through the\n * same shape check — on the record they are drawn on, and say in the summary\n * only what cannot be marked: fields this record does not show, or none named\n * at all. An explicit Save leaves the focus on the first marked field in\n * catalog order; a blur save leaves it where the reader moved it.\n * @returns {string} The summary, empty when every named field is marked.\n */\nfunction markRefusal(draft, table, result, focus) {\n const marks = Object.create(null);\n const unplaced = [];\n for (const { field, message } of result.fields ?? []) {\n // A row-defined field is `column.key` (definedFields.ts), marked where its own editor is registered under that name.\n const column = table.columns?.find((candidate) => candidate.name === field.split('.')[0]);\n if (column && fieldOnScreen(draft, field)) marks[field] = message;\n else unplaced.push(column ? `${columnLabel(table.id, field) ?? field}: ${message}` : '');\n }\n const marked = Object.keys(marks);\n if (marked.length) serverErrors.set(draft, Object.freeze(marks));\n else clearServerErrors(draft);\n const first =\n table.columns?.find((column) => Object.hasOwn(marks, column.name))?.name ??\n marked.find((field) => table.columns?.some((column) => field.startsWith(`${column.name}.`)));\n fieldFocus = focus && first ? { draft, field: first } : fieldFocus?.draft === draft ? null : fieldFocus;\n if (marked.length && !unplaced.length) return '';\n return [result.message, ...unplaced.filter(Boolean)].join(' ');\n}\nexport function dismissSaveFeedback() {\n feedback.delete(staged);\n tell();\n}\n\nfunction readEditControls(draft) {\n /** @type {Record<string, import('./recordEditValidation.js').RecordEditControlState>} */\n const controls = Object.create(null);\n for (const [name, registered] of Object.entries(draft.inputs)) {\n if (!registered.element.isConnected || !registered.readState) continue;\n try {\n const value = registered.readState();\n if (!value || typeof value !== 'object' || Array.isArray(value) || 'then' in value) throw new Error();\n const { unresolvedReference, invalidInput } = value;\n if (\n (unresolvedReference !== undefined && typeof unresolvedReference !== 'boolean') ||\n (invalidInput !== undefined && typeof invalidInput !== 'boolean')\n )\n throw new Error();\n controls[name] = { unresolvedReference, invalidInput };\n } catch {\n // Control faults never expose callback diagnostics or permit a partial save.\n controls[name] = { invalidInput: true };\n }\n }\n return controls;\n}\n\nfunction errorControl(draft, name) {\n const root = draft.inputs[name]?.element;\n if (!root?.isConnected || root.closest('[hidden], [inert], [aria-hidden=\"true\"]')) return;\n const selector =\n 'input:not(:disabled):not([type=\"hidden\"]), textarea:not(:disabled), select:not(:disabled), button:not(:disabled), [tabindex]:not([tabindex=\"-1\"])';\n return root.matches(selector) ? root : root.querySelector(selector);\n}\n\nfunction publishEditValidation(draft, errors) {\n const previous = editErrors.get(draft) ?? noEditErrors;\n const names = Object.keys(errors);\n let changed = names.length !== Object.keys(previous).length || names.some((name) => errors[name] !== previous[name]);\n editErrors.set(draft, changed ? errors : previous);\n const inaccessible = names.filter((name) => !errorControl(draft, name));\n const priorFeedback = feedback.get(draft);\n if (inaccessible.length) {\n const message = inaccessible.map((name) => `${name}: ${errors[name]}`).join(' ');\n if (priorFeedback?.source !== 'validation' || priorFeedback.message !== message) {\n feedback.set(draft, { phase: 'error', source: 'validation', message });\n changed = true;\n }\n } else if (priorFeedback?.source === 'validation') {\n feedback.delete(draft);\n changed = true;\n }\n return changed;\n}\n\n/** Corrections may clear attempted validation, but mounting stays quiet. */\nexport function refreshEditValidation(table, key) {\n if (!prefersPages() || !sameRow(table.id, key) || !editErrors.has(staged)) return;\n const captured = staged,\n revision = stagedVersion();\n const currentTable = state.schema?.tables?.find((candidate) => candidate.id === table.id) ?? table;\n const errors = validateRecordEdits(currentTable, captured.values, readEditControls(captured));\n if (captured !== staged || revision !== stagedVersion() || !sameRow(table.id, key)) return;\n if (publishEditValidation(captured, errors)) tell();\n}\n\n/** What is staged for a column of the row on screen, or undefined. */\nexport const stagedValue = (column) => (staged.needsReview ? undefined : staged.values[column]);\nexport const pendingColumns = () => Object.keys(staged.values);\n\n/**\n * Stage one change. Typing a value and then typing the original back is not\n * a change. Exported for the editor component.\n */\nexport function stage(table, key, column, value, original) {\n const known = table.columns?.find((c) => c.name === column.name);\n // A declared transition moves only through the record's actions.\n if (column.writable === false || column.changesBy === 'actions' || known?.writable === false || known?.changesBy === 'actions') return;\n // Freeze before an autosave publishes pending state. Other staged operations\n // (notably Undo reconciliation) still preserve edits begun while they settle.\n if (stagedAttempt(table.id, key) || (recordAutosavePending() && sameRow(table.id, key))) return;\n activateDraft(table, key);\n if (staged.needsReview) return;\n feedback.delete(staged);\n // An edited field is the reader's answer to its mark; the others keep theirs.\n clearServerError(staged, column.name);\n if (Object.hasOwn(staged.originals, column.name)) original = staged.originals[column.name];\n // Text inputs stringify numbers and booleans, but NULL is not the text \"null\".\n const unchanged = value === null || original === null ? value === original : String(value) === String(original);\n if (unchanged) {\n delete staged.values[column.name];\n delete staged.originals[column.name];\n } else {\n staged.values[column.name] = value;\n staged.originals[column.name] = original;\n /* A row-defined field (DefinedFields.tsx) is staged under `column.key`\n and saved as its column's whole object: the object it was read in and\n how its box's text becomes a value ride with the draft. */\n if (column.defined) (staged.folds ??= {})[column.name] = column.defined;\n }\n refreshEditValidation(table, key);\n tell();\n}\n\n/* What is sent: each row-defined field folded into its column's object, as\n JSON text (the server writes and judges the whole object). */\nfunction folded(draft, values, originals) {\n const folds = draft.folds ?? {};\n const fields = Object.keys(values).filter((name) => Object.hasOwn(folds, name));\n if (!fields.length) return { values, originals };\n const objects = {};\n const sent = { ...values },\n guarded = { ...originals };\n for (const name of fields) {\n const { column, object, toValue } = folds[name];\n const next = (objects[column] ??= { ...object });\n const value = toValue(values[name]);\n if (value === undefined) delete next[name.slice(column.length + 1)];\n else next[name.slice(column.length + 1)] = value;\n delete sent[name];\n delete guarded[name];\n }\n for (const [column, object] of Object.entries(objects)) sent[column] = JSON.stringify(object);\n return { values: sent, originals: guarded };\n}\n\n/** The editor's element, kept so a successful write can confirm in place.\n * @param {() => import('./recordEditValidation.js').RecordEditControlState} [readState]\n */\nexport function registerInput(table, key, column, input, onCommitted, readState) {\n activateDraft(table, key);\n const captured = staged,\n registration = { element: input, onCommitted, readState };\n Object.defineProperty(captured.inputs, column, { value: registration, configurable: true, writable: true, enumerable: true });\n return () => {\n if (captured.inputs[column] === registration) delete captured.inputs[column];\n };\n}\n\nexport { sameRow };\n\n/* An update's guard names each changed column at the value it was read with —\n but a JSON column's, which no engine compares: it is written whole. */\nfunction comparable(table, originals) {\n const json = new Set((table.columns ?? []).filter((column) => isJsonType(column.type)).map((column) => column.name));\n return json.size ? Object.fromEntries(Object.entries(originals).filter(([column]) => !json.has(column))) : originals;\n}\n\nlet applying = false;\nexport const applyingStaged = () => applying;\nlet autosaveCancellation = 0;\n/** @type {ReturnType<typeof captureSessionIdentity> | undefined} */\nlet autosaveIdentity;\n/** @type {import('./updateAttempts.js').UpdateOwner | undefined} */\nlet autosaveOwner;\n/** Deferred intent only: an already dispatched write still settles normally. */\nexport function cancelRecordAutosave() {\n autosaveCancellation++;\n}\n/** @public the database browser's (scripts/boundary/entries.json, \"host\") */\nexport function recordAutosavePending() {\n // Ordinary uncertainty keeps the record locked, not every route. Tenant\n // uncertainty still has its independent stronger navigation gate in core.\n return (\n autosaveIdentity !== undefined &&\n autosaveIdentity === sessionIdentity() &&\n autosaveOwner !== undefined &&\n updateAttempts.get(autosaveOwner)?.phase !== 'uncertain'\n );\n}\n\n/** Capture only for a fresh user edit leaving its complete interaction surface.\n * This predicate does not schedule or send anything. The interaction owner must\n * also prove its mount, picker state and current App save policy at dispatch. */\nexport function captureRecordAutosaveGuard(table, key, stillEditing) {\n const captured = staged,\n identity = captureSessionIdentity(),\n schema = state.schema;\n const capturedKey = { ...key },\n revision = stagedVersion();\n const cancellation = autosaveCancellation;\n const navigation = captureNavigation();\n const current = () => {\n try {\n return (\n typeof stillEditing === 'function' &&\n stillEditing() === true &&\n cancellation === autosaveCancellation &&\n prefersPages() &&\n navigation() &&\n captured === staged &&\n identity === sessionIdentity() &&\n schema === state.schema &&\n revision === stagedVersion() &&\n sameRow(table.id, capturedKey) &&\n pendingCount() > 0 &&\n !staged.needsReview &&\n !staged.manualSaveRequired &&\n !applying &&\n !stagedAttempt(table.id, capturedKey) &&\n !draftSchemaChanged(table) &&\n canEditRow(table, capturedKey)\n );\n } catch {\n return false;\n }\n };\n // An initially ineligible draft cannot be armed later by Resume, policy\n // changes, another acknowledgement or programmatic focus restoration.\n return current() ? current : () => false;\n}\n\n/**\n * @param {(opts?: { inPlace?: boolean }) => void} [onDone]\n * @param {{ trigger?: 'explicit'|'blur', guard?: () => boolean }} [options]\n */\nexport async function applyStaged(table, key, onDone = undefined, options = {}) {\n const trigger = options.trigger ?? 'explicit';\n if (trigger !== 'explicit' && trigger !== 'blur') return;\n const blur = trigger === 'blur';\n // Do not cancel the supplied blur capture before checking it.\n if (!blur) cancelRecordAutosave();\n const guard = () => {\n try {\n return typeof options.guard === 'function' && options.guard() === true;\n } catch {\n return false;\n }\n };\n if (blur && (!prefersPages() || staged.manualSaveRequired || !guard())) return;\n if (applying || staged.needsReview || stagedAttempt(table.id, key) || !sameRow(table.id, key)) return;\n if (!pendingCount()) {\n if (!blur && staged.manualSaveRequired) {\n staged.manualSaveRequired = false;\n editErrors.delete(staged);\n clearServerErrors(staged);\n feedback.delete(staged);\n tell();\n }\n return;\n }\n const currentTable = state.schema?.tables ? state.schema.tables.find((candidate) => candidate.id === table.id) : table;\n if (\n !currentTable ||\n draftSchemaChanged(currentTable) ||\n draftSchemaChanged(table) ||\n Object.keys(staged.values).some((name) => {\n const column = currentTable.columns?.find((c) => c.name === name);\n return column?.writable === false || column?.changesBy === 'actions';\n })\n )\n return;\n const app = prefersPages();\n if (app && !canEditRow(currentTable, key)) return;\n const captured = staged;\n const connection = captured.connection;\n const staging = { ...staged.values };\n const { values, originals } = folded(captured, staging, { ...staged.originals });\n key = { ...key };\n const schema = state.schema;\n const identity = captureSessionIdentity();\n const generation = connectionGeneration();\n const navigation = blur ? captureNavigation() : () => true;\n const cancellation = autosaveCancellation,\n revision = stagedVersion();\n if (app) {\n const errors = validateRecordEdits(currentTable, values, readEditControls(captured));\n if (\n captured !== staged ||\n revision !== stagedVersion() ||\n schema !== state.schema ||\n identity !== sessionIdentity() ||\n cancellation !== autosaveCancellation ||\n !sameRow(table.id, key) ||\n !canEditRow(currentTable, key) ||\n (blur && !guard())\n )\n return;\n const changed = publishEditValidation(captured, errors);\n if (Object.keys(errors).length) {\n if (changed) tell();\n if (!blur && captured === staged && identity === sessionIdentity() && sameRow(table.id, key)) {\n const first = Object.keys(errors)\n .map((name) => errorControl(captured, name))\n .find(Boolean);\n first?.focus();\n }\n return;\n }\n }\n feedback.delete(captured);\n const current = () => identity === sessionIdentity() && captured === staged && sameRow(table.id, key) && state.canWrite;\n const dispatchCurrent = () =>\n current() &&\n schema === state.schema &&\n generation === connectionGeneration() &&\n !draftSchemaChanged(table) &&\n (!app || (prefersPages() && canEditRow(currentTable, key))) &&\n (!blur || (navigation() && cancellation === autosaveCancellation && !captured.manualSaveRequired && !captured.needsReview));\n applying = true;\n if (blur) {\n autosaveIdentity = identity;\n autosaveOwner = { connection: connection ?? null, table: table.id, key: { ...key } };\n }\n try {\n tell();\n const ok = app || (await confirmUpdate(table, key, values, originals));\n if (!ok) return;\n if (!dispatchCurrent()) {\n if (!blur) toast(say('theRecordConnectionOrTable'), 'error');\n return;\n }\n /** @type {(() => void) | undefined} */\n let acknowledged;\n const result = await updateAttempts.run({ connection: connection ?? null, table: table.id, key }, values, () => {\n if (!dispatchCurrent()) throw Object.assign(new Error(say('theRecordChangedBefore')), { outcome: 'not_applied' });\n if (app) acknowledged = captureRecordWriteRefresh(table.id, key);\n return api('/api/update', { ...ownedBy(connection), table: table.id, key, values, expected: comparable(table, originals) });\n });\n if (result.kind !== 'applied') {\n if (result.kind === 'rejected') captured.manualSaveRequired = true;\n if (app && current() && result.kind === 'rejected') {\n /* The draft stays as it was; the fields the server named are marked\n on it, and nothing is retried — a blur save included. */\n const summary = markRefusal(captured, currentTable, result, !blur);\n if (summary) feedback.set(captured, { phase: 'error', message: summary });\n else feedback.delete(captured);\n tell();\n } else if (identity === sessionIdentity() && (result.kind !== 'uncertain' || !current())) toast(result.message, 'error');\n return;\n }\n const n = Object.keys(result.applied).length;\n const inputs = captured.inputs;\n // Settle the original draft even after navigation selected another record.\n for (const [column, value] of Object.entries(result.applied)) {\n if (Object.is(captured.values[column], values[column])) {\n delete captured.values[column];\n delete captured.originals[column];\n } else if (column in captured.values) captured.originals[column] = value;\n }\n // A row-defined field folded into a column that was written, unless it was edited again meanwhile.\n const foldedSaved = {};\n for (const name of Object.keys(staging)) {\n const fold = captured.folds?.[name];\n if (!fold || !Object.hasOwn(result.applied, fold.column)) continue;\n // Its editor is told what it now holds: the box's own text, which the object was written from.\n foldedSaved[name] = staging[name];\n if (!Object.is(captured.values[name], staging[name])) continue;\n delete captured.values[name];\n delete captured.originals[name];\n delete captured.folds[name];\n }\n if (!Object.keys(captured.values).length) {\n captured.needsReview = false;\n captured.manualSaveRequired = false;\n editErrors.delete(captured);\n }\n // What a refusal said was about the values it saw; these were written.\n clearServerErrors(captured);\n acknowledged?.();\n // History follows the original owner even if another record is now open.\n if (\n identity === sessionIdentity() &&\n connection === state.activeConnection &&\n schema === state.schema &&\n generation === connectionGeneration()\n )\n void shell().undo.refresh();\n tell();\n if (!current()) {\n if (identity === sessionIdentity())\n toast(say('updatedColumnsOnTheOriginal', { count: n, connection: connection ?? say('theOriginalConnection') }), 'ok');\n return;\n }\n\n // An App has no Undo: the dock says what was saved.\n if (app) feedback.set(captured, { phase: 'saved', message: say('changesSaved'), identity, columns: Object.keys(values) });\n else\n toast(\n say('updatedColumns', { count: n, name: table.name }),\n 'ok',\n !identity.tenantRequired && result.undoId\n ? {\n /* Beside the confirmation, because this is the moment someone realises\n it was the wrong row — and sending them to a menu to find Undo wastes\n the seconds in which they still remember what they changed. */\n label: say('common.undo'),\n run: () => {\n if (identity === sessionIdentity() && connection === state.activeConnection) void shell().undo.last(result.undoId);\n },\n }\n : undefined,\n );\n\n /* Confirmed in place rather than by re-rendering. A re-render would throw\n away the row you are looking at and rebuild it, which reads as a flicker\n and loses the caret; worse, it left the fields showing their unsaved\n styling because the DOM they styled was gone before the class was.\n Showing the saved value, in green, on the field you just edited is both\n calmer and more specific — it says *which* fields landed. */\n tell();\n confirmSaved(inputs, { ...result.applied, ...foldedSaved });\n // Only the pending bar is refreshed, so the green fields survive.\n onDone?.({ inPlace: true });\n } catch (err) {\n // Attempt failures are classified above; presentation failures must not resend.\n toast(err.message, 'error');\n } finally {\n if (blur) {\n autosaveIdentity = undefined;\n autosaveOwner = undefined;\n }\n applying = false;\n tell();\n }\n}\n\nfunction confirmSaved(inputs, applied) {\n for (const [column, value] of Object.entries(applied)) {\n const registered = inputs[column];\n const input = registered?.element;\n if (!input || !input.isConnected) continue;\n // The value the database actually stored, which may differ from what was\n // typed — \"17901\" comes back as the number 17901.\n registered.onCommitted?.(value);\n }\n}\n\n/** Show the statement before it runs. This is the last stop before a write. */\nfunction confirmUpdate(table, key, values, originals) {\n return new Promise((resolve) => {\n const q = (id) => `\"${id}\"`;\n const sets = Object.keys(values)\n .map((c) => `${q(c)} = ?`)\n .join(',\\n ');\n const where = [\n ...Object.keys(key).map((c) => `${q(c)} = ?`),\n ...Object.keys(originals).map((c) => `${q(c)} ${originals[c] === null ? 'IS NULL' : '= ?'}`),\n ].join(' AND ');\n const sql = `UPDATE ${q(table.id)}\\n SET ${sets}\\n WHERE ${where};`;\n\n /* The parameters shown are the raw staged values. The server coerces them\n against the declared column types and returns what it applied, so a\n number typed as text is corrected there rather than guessed at here. */\n const params = JSON.stringify([\n ...Object.values(values),\n ...Object.values(key),\n ...Object.values(originals).filter((value) => value !== null),\n ]);\n\n const rows = Object.entries(values).map(([column, to]) => {\n const from = originals[column];\n const type = table.columns.find((c) => c.name === column)?.type ?? '';\n return el('tr', {}, [\n el('td', {}, [el('span', { class: 'diff-col', text: column }), el('span', { class: 'diff-type', text: type.toLowerCase() })]),\n el('td', { class: `diff-from${from === null ? ' null' : ''}`, text: from === null ? 'null' : String(from) }),\n el('td', { class: 'diff-arrow', text: '→' }),\n el('td', { class: `diff-to${to === null ? ' null' : ''}`, text: to === null ? 'null' : String(to) }),\n ]);\n });\n\n const dialog = el('dialog', { class: 'confirm confirm-wide' }, [\n el('h2', { text: rows.length === 1 ? say('applyThisChange') : say('applyChanges', { count: rows.length }) }),\n el('p', {}, [\n document.createTextNode('One row in '),\n el('strong', { text: table.id }),\n document.createTextNode(', identified by '),\n el('strong', {\n text: Object.entries(key)\n .map(([k, v]) => `${k} = ${v}`)\n .join(', '),\n }),\n document.createTextNode('. Applied as a single statement only if these fields still match their original values.'),\n ]),\n el('table', { class: 'confirm-diff' }, el('tbody', {}, rows)),\n el('pre', { class: 'ddl', text: sql }),\n el('p', { class: 'confirm-params', text: say('parameters', { params }) }),\n el('div', { class: 'confirm-actions' }, [\n el('button', {\n type: 'button',\n class: 'ghost',\n text: say('common.cancel'),\n onclick: () => {\n dialog.close();\n resolve(false);\n },\n }),\n el('button', {\n type: 'button',\n class: 'primary',\n text: say('common.apply'),\n onclick: () => {\n dialog.close();\n resolve(true);\n },\n }),\n ]),\n ]);\n dialog.addEventListener('close', () => dialog.remove());\n dialog.addEventListener('cancel', () => resolve(false));\n portalRoot().append(dialog);\n dialog.showModal();\n });\n}\n\n/** Why a row is not editable, for the record view to explain rather than hide. */\nexport function whyNotEditable(table) {\n if (!state.canWrite) return null; // not in write mode: say nothing\n if (!table) return say('unknownTable');\n if (table.isView) return say('thisIsAView');\n if (!table.columns.some((c) => c.primaryKey)) {\n return say('thisTableHasNoPrimary');\n }\n return null;\n}\n"],"mappings":";;;;;;;;;AAGAI,EAAA;CACE,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;AACF,CAAA;;ACVA,IAAA4B,IAAA5B,EAAA;CACE,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;EACE,KAAA;EACA,OAAA;CACF;CACA,GAAA;CACA,GAAA;EAAkB,KAAA;EAA0C,OAAA;CAA4C;CACxG,GAAA;CACA,GAAA;EAAgB,KAAA;EAA8B,OAAA;CAAgC;CAC9E,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;CACA,GAAA;AACF,CAAA;;ACqBAI,EAAAyB,EAAA;AAMA,IAAAC,IAAA,mBACAC,IAAA,yBAEAC,UAAA7B,EAAA,oBAAA,WACA8B,UAAA,EAAA9B,EAAA,aAAA,MAAA,MAAA+B,EAAA,OAAA/B,EAAA,gBAAA,CAAA,EAAA;AAEA,SAAAgC,IAAA;CAEA,OADAnB,EAAA,IAAAiB,EAAA,KAAApB,EAAAkB,GAAA,CAAA,CAAA,CAAA,CAAAC,EAAA,OAAA,KACAnB,EAAAiB,GAAA,CAAA,CAAA,CAAA,CAAAE,EAAA,OAAA;AACA;AAEA,SAAAI,GAAA,GAAA;CACA,IAAAC,IAAArB,EAAA,IAAAe,IAAAD,GACAQ,IAAAzB,EAAAwB,GAAA,CAAA,CAAA;CAEA,AADA,EAA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A,AAHAH,EAAA,iBAAA,eAAAA,EAAA,OAAA,CAAA,GACAA,EAAA,iBAAA,gBAAAG,EAAA,EAAA,CAAA,GACA7L,EAAA,CAAA,CAAA,OAAA0L,CAAA,GACAA,EAAA,UAAA;CACA,CAAA;AACA;AAGA,SAAAI,GAAA,GAAA;CAOA,OANApM,EAAA,WACAyD,IACAA,EAAA,SAAAhC,EAA+B,GAAa,IAC5CgC,EAAA,QAAA,MAAA,MAAA1B,EAAA,UAAA,IAGA,OAFAN,EAAe,GAAuB,IAHtCA,EAAyB,GAAc,IADvC;AAOA"}
|
|
@@ -4,7 +4,7 @@ import { n as s, r as c, t as l } from "./chunks/router-CAJxIEw4.js";
|
|
|
4
4
|
import { createContext as u, useContext as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
5
5
|
import { jsx as g } from "react/jsx-runtime";
|
|
6
6
|
// packages/mistri/src/embed/index.tsx
|
|
7
|
-
var _ = "1.0.0-rc.
|
|
7
|
+
var _ = "1.0.0-rc.13", v = u(null), y;
|
|
8
8
|
async function b(n, i, a) {
|
|
9
9
|
let o = i?.authorization(), s = a ? `?${new URLSearchParams({
|
|
10
10
|
app: a.app,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { basename, isAbsolute, posix, relative, resolve, sep } from 'node:path';
|
|
19
19
|
import { BUILD_ENTRY_KINDS } from '../app/appBuild.js';
|
|
20
|
-
/* Kept in step with
|
|
20
|
+
/* Kept in step with examples/docker/Dockerfile's NODE_IMAGE: an exact patch, so a rebuild is the image that was tested. */
|
|
21
21
|
const NODE_IMAGE = 'node:24.22.1-alpine3.24';
|
|
22
22
|
/** A path inside the build context, in the form a Dockerfile COPY reads; refused when it climbs out of the current directory. */
|
|
23
23
|
function contextPath(flag, value, root = false) {
|
package/dist/server/cli/usage.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `mistri` command line in words: `USAGE`, every command and flag of the App framework, and `SHORT_USAGE`, the
|
|
3
|
-
* first screen of it. The database browser's are `tablewalk`'s own
|
|
3
|
+
* first screen of it. The database browser's are `tablewalk`'s own, in its own repository.
|
|
4
4
|
* test/prose.test.ts holds this USAGE and the package's README (packages/mistri/README.md) to each other, and
|
|
5
|
-
* scripts/cli-reference.mjs writes the site's CLI page from
|
|
5
|
+
* scripts/cli-reference.mjs writes the site's CLI page from it.
|
|
6
6
|
*/
|
|
7
7
|
import { commandWordsOf, flagWordsOf } from '@mistriwork/engine/server/cli/usage.js';
|
|
8
8
|
export const USAGE = `
|
package/dist/ui/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as useContext, c as useMemo, d as useState, f as UI_TOKENS, i as useCallback, l as useReducer, n as React, o as useEffect, s as useId, t as Fragment, u as useRef } from "./shared-
|
|
1
|
+
import { a as useContext, c as useMemo, d as useState, f as UI_TOKENS, i as useCallback, l as useReducer, n as React, o as useEffect, s as useId, t as Fragment, u as useRef } from "./shared-CdiPYlTh.js";
|
|
2
2
|
import { nt as Button } from "./shared-poc11xxo.js";
|
|
3
|
-
import { A as Tone, C as Loaded, D as Stack, E as Segmented, M as SplitListDetail, O as Stat, S as Icon, T as Row, _ as useVisitor, a as useComposer, b as Empty, c as useFormat, d as useNavigate, f as useRecord, g as useViewer, h as useToken, i as useCommand, j as Value, k as Table, l as useLook, m as useSectionSize, n as useAnalytics, o as useFile, p as useRows, r as useBreakdown, s as useFlags, u as useMessage, v as Card, w as Meter, x as Heading, y as Columns } from "./shared-
|
|
3
|
+
import { A as Tone, C as Loaded, D as Stack, E as Segmented, M as SplitListDetail, O as Stat, S as Icon, T as Row, _ as useVisitor, a as useComposer, b as Empty, c as useFormat, d as useNavigate, f as useRecord, g as useViewer, h as useToken, i as useCommand, j as Value, k as Table, l as useLook, m as useSectionSize, n as useAnalytics, o as useFile, p as useRows, r as useBreakdown, s as useFlags, u as useMessage, v as Card, w as Meter, x as Heading, y as Columns } from "./shared-TrGbd1FY.js";
|
|
4
4
|
import { t as Dropdown } from "./shared-gtzTT5Z7.js";
|
|
5
5
|
export { Button, Card, Columns, Dropdown, Empty, Fragment, Heading, Icon, Loaded, Meter, React, Row, Segmented, SplitListDetail, Stack, Stat, Table, Tone, Value, UI_TOKENS as tokens, useAnalytics, useBreakdown, useCallback, useCommand, useComposer, useContext, useEffect, useFile, useFlags, useFormat, useId, useLook, useMemo, useMessage, useNavigate, useRecord, useReducer, useRef, useRows, useSectionSize, useState, useToken, useViewer, useVisitor };
|
package/dist/ui/page.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { nt as Button } from "./shared-poc11xxo.js";
|
|
2
|
-
import { C as Loaded, D as Stack, O as Stat, T as Row, b as Empty, j as Value, t as useAddressState, v as Card, x as Heading, y as Columns } from "./shared-
|
|
3
|
-
import { a as Gantt, c as Panel, d as Tabs, f as Timeline, i as CommandForm, l as RecordCard, m as definePage, n as Breakdown, o as Grid, p as Tree, r as Chart, s as Metric, t as Assistant, u as Rows } from "./shared-
|
|
2
|
+
import { C as Loaded, D as Stack, O as Stat, T as Row, b as Empty, j as Value, t as useAddressState, v as Card, x as Heading, y as Columns } from "./shared-TrGbd1FY.js";
|
|
3
|
+
import { a as Gantt, c as Panel, d as Tabs, f as Timeline, i as CommandForm, l as RecordCard, m as definePage, n as Breakdown, o as Grid, p as Tree, r as Chart, s as Metric, t as Assistant, u as Rows } from "./shared-hAayNSRA.js";
|
|
4
4
|
export { Assistant, Breakdown, Button, Card, Chart, Columns, CommandForm, Empty, Gantt, Grid, Heading, Loaded, Metric, Panel, RecordCard, Row, Rows, Stack, Stat, Tabs, Timeline, Tree, Value, definePage, useAddressState };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { E as sessionIdentity } from "./shared-poc11xxo.js";
|
|
2
2
|
import { F as primaryKey, M as labelColumn, O as expectedValues, Pn as useQueryClient, gt as defineMessages, rn as shell } from "./shared-DJZjSi3J.js";
|
|
3
|
-
import { I as DropGroup, L as DropItem, R as DropMenu } from "./shared-
|
|
4
|
-
import { B as toast, L as state, U as writeAllowed, d as findTable, p as keyOf } from "./shared-
|
|
5
|
-
import { _t as wholeColumn, dt as rowKeyString, ft as PLACES, gt as savePlaces, ht as positionOf, mt as placements, pt as placeIndex, st as RowDecoration } from "./shared-
|
|
6
|
-
import { r as bulkKey, t as applyBulk } from "./shared-
|
|
3
|
+
import { I as DropGroup, L as DropItem, R as DropMenu } from "./shared-BHsjawAG.js";
|
|
4
|
+
import { B as toast, L as state, U as writeAllowed, d as findTable, p as keyOf } from "./shared-BoLbc2WD.js";
|
|
5
|
+
import { _t as wholeColumn, dt as rowKeyString, ft as PLACES, gt as savePlaces, ht as positionOf, mt as placements, pt as placeIndex, st as RowDecoration } from "./shared-XcSKDp6N.js";
|
|
6
|
+
import { r as bulkKey, t as applyBulk } from "./shared-Chp88all.js";
|
|
7
7
|
import { n as landingBefore, t as usePointerDrag } from "./shared-Ba8y5h2K.js";
|
|
8
8
|
import { t as useOptimisticMoves } from "./shared-mCoqJD_k.js";
|
|
9
9
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -331,4 +331,4 @@ function GridOrder({ table, rows, order, interactive, children }) {
|
|
|
331
331
|
}
|
|
332
332
|
export { useListOrder as n, GridOrder as t };
|
|
333
333
|
|
|
334
|
-
//# sourceMappingURL=shared-
|
|
334
|
+
//# sourceMappingURL=shared-1PD7TOTJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-N4Ej8yRD.js","names":[],"sources":["../../../kit/src/client/copy/lists/components/useListOrder.ts","../../../kit/src/client/components/useListOrder.tsx"],"sourcesContent":["/** What useListOrder says, in the lists and grid room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n thereIsNoRoom: 'There is no room left between those two on this page. Show “{title}” with the whole list on one page to put it there.',\n movedToPlace: 'Moved “{title}” to place {index} of {entriesCount}',\n reorder: 'Reorder {title}',\n dragTheRowPress: 'Drag the row, press Alt and ↑ or ↓, or choose a place',\n order: 'Order',\n});\n","/**\n * A list's rows in the order an editor gives them by hand: a view's `order`\n * column, read ascending, and changed three ways, none pointer-only — a row\n * dragged into place, Alt and ↑/↓ on a focused row, and the row's grip menu\n * (up, down, top, bottom). Each is the board's move (placeOrder.ts): the one\n * row, numbered halfway between its new neighbors, and the run renumbered a\n * step apart only when there is no number left between them — ordinary\n * updates, each checked, recorded and undoable.\n *\n * Offered only where the rows are read in that order now: a reader who sorts\n * by a header, a tab with a sort of its own, or a Sort menu choice reads the\n * rows another way, and the handles go until the order is back. And only to a\n * reader who may edit the column, on the same gates as the update route.\n *\n * A move is drawn at once (optimisticMoves.ts): the row stands in its new\n * place from the moment it is let go, and goes back, with the server's\n * sentence, only if a write is refused. Moves made while one saves wait their\n * turn. Rows one under another open a gap where the row will land, the\n * board's (usePointerDrag's `gap`); cards side by side keep the mark at their\n * side, since a gap in a wrapping grid would move every card after it.\n *\n * On a page of a longer list a row can take a number between two neighbors\n * on the page but the run is never renumbered, which would collide with the\n * pages it cannot see; the move says so instead.\n */\nimport { useEffect, useMemo, useRef, useState, type KeyboardEvent, type PointerEvent as ReactPointerEvent, type ReactNode } from 'react';\nimport { useQueryClient } from '@tanstack/react-query';\nimport { findTable, keyOf, state, toast, writeAllowed } from '../core.js';\nimport { applyBulk, bulkKey } from '../bulkActions.js';\nimport { shell } from '../shellMode.js';\nimport { sessionIdentity } from '../sessionIdentity.js';\nimport { expectedValues, labelColumn, primaryKey, type TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { PLACES, placeIndex, placements, positionOf, savePlaces, wholeColumn, type Place } from './placeOrder.js';\nimport { landingBefore } from './pointerDrag.js';\nimport { useOptimisticMoves } from './optimisticMoves.js';\nimport { usePointerDrag, type DropPoint } from './usePointerDrag.js';\nimport { DropGroup, DropItem, DropMenu } from '@mistriwork/ui/DropMenu.js';\nimport { RowDecoration, rowKeyString } from './RowHost.js';\nimport { say } from '../copy/lists/components/useListOrder.js';\n\n/** A view's order, as the list room hands it on. */\nexport interface ListOrder {\n /** The numeric column holding each row's place. */\n column: string;\n /** The rows are read in that order now, and nothing else. */\n active: boolean;\n /** The rows are a page of a longer list. */\n partial: boolean;\n}\n\ninterface ListOrderOptions {\n table: TableMeta;\n rows: Array<Record<string, unknown>>;\n order?: ListOrder;\n interactive: boolean;\n title: (row: Record<string, unknown>) => string;\n /** How a row is named on its element; bulkKey's spelling in `data-drop-item` unless the rows already carry one. */\n id?: (row: Record<string, unknown>, key: Record<string, unknown>) => string | null;\n /** The attribute a row's element carries its id in. */\n attribute?: string;\n /** Where the focus goes back to after a move, from the row's element. */\n focusOf?: (item: HTMLElement) => HTMLElement | null;\n /** Rows that stand beside each other, as cards in columns: a row's halves are left and right. */\n across?: (zone: HTMLElement) => boolean;\n}\n\ninterface Entry {\n id: string;\n key: Record<string, unknown>;\n title: string;\n position?: number;\n}\n\nconst ownFocus = (item: HTMLElement) => item.querySelector<HTMLElement>('[data-order-focus]');\n\nexport function useListOrder({\n table,\n rows,\n order,\n interactive,\n title,\n id: idOf,\n attribute = 'data-drop-item',\n focusOf = ownFocus,\n across,\n}: ListOrderOptions) {\n const client = useQueryClient();\n const [said, setSaid] = useState('');\n const zone = useRef<HTMLElement | null>(null);\n const refocus = useRef<string | null>(null);\n const chosen = useRef<string | null>(null);\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const nameOf = (row: Record<string, unknown>) => {\n const key = keyOf(table, row) as Record<string, unknown> | null;\n return key ? (idOf ? idOf(row, key) : bulkKey(table, key)) : null;\n };\n const connection = state.activeConnection ?? null;\n /* A move is drawn before it is saved: its rows carry their new numbers, and stand in that order. */\n const optimistic = useOptimisticMoves(rows, nameOf, () => client.invalidateQueries({ queryKey: ['run', connection] }));\n const drawnRows = useMemo(() => {\n if (!order || optimistic.rows === rows) return rows;\n const place = (row: Record<string, unknown>) => positionOf(row[order.column]) ?? Number.POSITIVE_INFINITY;\n return [...optimistic.rows].sort((a, b) => place(a) - place(b));\n }, [optimistic.rows, rows, order]);\n /* Rows are named only in a list that keeps an order: every other list pays nothing. */\n const named = !order\n ? []\n : drawnRows.flatMap((row) => {\n const key = keyOf(table, row) as Record<string, unknown> | null;\n const id = key ? (idOf ? idOf(row, key) : bulkKey(table, key)) : null;\n if (!key || id === null) return [];\n const position = positionOf(row[order.column]);\n return [{ row, entry: { id, key, title: title(row), ...(position === undefined ? {} : { position }) } as Entry }];\n });\n const entries = named.map((each) => each.entry);\n const rowIds = new Map(named.map((each) => [each.row, each.entry.id]));\n const ids = entries.map((entry) => entry.id);\n const byId = new Map(entries.map((entry) => [entry.id, entry]));\n /* Every gate the ordinary update route applies, asked only of a list that keeps an order. */\n const column = order ? ((findTable(table.id) as TableMeta | undefined) ?? table).columns.find((c) => c.name === order.column) : undefined;\n const orderable = Boolean(\n order?.active &&\n interactive &&\n column &&\n entries.length > 1 &&\n writeAllowed(table.id) &&\n state.connections?.some((c: { id: string; writable?: boolean }) => c.id === connection && c.writable) &&\n !table.isView &&\n !column.primaryKey &&\n column.writable !== false &&\n column.changesBy !== 'actions',\n );\n const whole = wholeColumn(column?.type);\n\n const itemOf = (id: string) =>\n [...(zone.current?.querySelectorAll<HTMLElement>(`[${attribute}]`) ?? [])].find((item) => item.getAttribute(attribute) === id) ?? null;\n /* A moved row is drawn anew in its place; the focus follows it once it is there. */\n useEffect(() => {\n const item = refocus.current ? itemOf(refocus.current) : null;\n const target = item && focusOf(item);\n if (target) {\n target.focus();\n refocus.current = null;\n }\n });\n\n const write = async (entry: Entry, value: number, isCurrent: () => boolean) => {\n const values = { [order!.column]: value };\n const expected = expectedValues(table, values, named.find((each) => each.entry.id === entry.id)?.row);\n const result = await applyBulk(\n { connection, table: table.id },\n values,\n [{ key: entry.key, label: entry.title, ...(expected ? { expected } : {}) }],\n isCurrent,\n );\n const outcome = result.outcomes[0];\n return outcome.kind === 'applied'\n ? null\n : { message: outcome.message, refused: outcome.kind === 'rejected' || outcome.kind === 'blocked' };\n };\n const move = (entry: Entry, index: number) => {\n if (!orderable) return;\n const writes = placements(\n entry,\n entries.filter((each) => each.id !== entry.id),\n index,\n whole,\n );\n if (!writes.length) return;\n if (order!.partial && writes.length > 1) {\n toast(say('thereIsNoRoom', { title: entry.title }), 'error');\n return;\n }\n const epoch = sessionIdentity().epoch;\n const isCurrent = () => mounted.current && epoch === sessionIdentity().epoch && connection === (state.activeConnection ?? null);\n const token = optimistic.begin(writes.map(([each, value]) => [each.id, { [order!.column]: value }] as const));\n refocus.current = entry.id;\n setSaid(say('movedToPlace', { title: entry.title, index: index + 1, entriesCount: entries.length }));\n optimistic.enqueue(async () => {\n try {\n const saved = await savePlaces(writes, (each, value) => write(each, value, isCurrent), isCurrent);\n if (saved.stale) return optimistic.undo(token);\n if (!saved.applied || saved.failed) {\n // A renumbered run part-written goes back to what the server says, read again when the queue is done.\n optimistic.undo(token);\n if (saved.failed?.refused) toast(saved.failed.message, 'error');\n if (!saved.applied) return;\n } else optimistic.saved(token);\n void shell().undo.refresh();\n void client.invalidateQueries({ queryKey: ['count', connection] });\n } catch (error) {\n optimistic.undo(token);\n throw error;\n }\n });\n };\n const place = (id: string, where: Place) => {\n const entry = byId.get(id);\n const index = placeIndex(ids, id, where);\n if (entry && index !== undefined) move(entry, index);\n };\n\n /* Where a drop lands: before the row in whose first half it is let go,\n before the next in its second, last past the last — and nowhere when\n that is where the row already stands. */\n const landing = (id: string, at: DropPoint | null): { index: number; before?: string; beside: boolean } | undefined => {\n if (!at || at.zone !== zone.current) return undefined;\n const over = at.item?.getAttribute(attribute) ?? undefined;\n const beside = Boolean(across?.(at.zone));\n const before = landingBefore(ids, id, over, beside ? at.left : at.upper);\n const others = ids.filter((each) => each !== id);\n const index = before === undefined ? others.length : others.indexOf(before);\n return index < 0 || index === ids.indexOf(id) ? undefined : { index, before, beside };\n };\n /* The mark is an attribute on the row's element, set here rather than drawn: a grid's rows are the grid's to render. */\n const clear = () => {\n for (const marked of zone.current?.querySelectorAll('[data-drop]') ?? []) marked.removeAttribute('data-drop');\n };\n const drag = usePointerDrag<string>({\n items: `[${attribute}]`,\n gap: !across,\n locate: (id) => itemOf(id),\n over: (id, at) => {\n clear();\n const landed = landing(id, at);\n if (!landed) return null;\n // Rows one under another: the gap opens where the row will land, and is the mark.\n if (!landed.beside) return { zone: zone.current!, before: landed.before === undefined ? null : itemOf(landed.before) };\n const last = ids.filter((each) => each !== id).at(-1);\n const marked = itemOf(landed.before ?? last ?? '');\n // Rows one under another take a rule above or below; cards side by side, at their side.\n const edge = landed.before === undefined ? (landed.beside ? 'end' : 'after') : landed.beside ? 'start' : 'before';\n marked?.setAttribute('data-drop', edge);\n return null;\n },\n drop: (id, at) => {\n clear();\n const landed = landing(id, at);\n const entry = byId.get(id);\n if (landed && entry) move(entry, landed.index);\n },\n end: clear,\n });\n\n const keyDown = (event: KeyboardEvent, id: string) => {\n if (!orderable || !event.altKey || event.metaKey || event.ctrlKey || event.shiftKey) return;\n if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return;\n event.preventDefault();\n event.stopPropagation();\n place(id, event.key === 'ArrowUp' ? 'up' : 'down');\n };\n\n /* A row's grip: the place menu, quiet until the row is hovered or focused\n (always there on touch), and a sign that the row itself can be dragged.\n Pressing it opens the menu rather than starting a drag. */\n const menu = (id: string): ReactNode => {\n const entry = byId.get(id);\n if (!orderable || !entry) return null;\n const places = PLACES.filter(([where]) => placeIndex(ids, id, where) !== undefined);\n return (\n <span className=\"order-grip\" data-drag-ignore=\"\">\n <DropMenu\n className=\"order-menu\"\n triggerClassName=\"order-grip-button\"\n triggerLabel={say('reorder', { title: entry.title })}\n triggerTitle={say('dragTheRowPress')}\n label={<span aria-hidden=\"true\">⠿</span>}\n popupClassName=\"more-list order-menu-list\"\n onOpenChange={(open) => {\n if (open) chosen.current = null;\n }}\n finalFocus={() => {\n const item = chosen.current === id ? itemOf(id) : null;\n return (item && focusOf(item)) ?? true;\n }}\n >\n <DropGroup label={say('order')} labelClassName=\"more-group-label\">\n {places.map(([where, label]) => (\n <DropItem\n key={where}\n className=\"more-item\"\n onClick={() => {\n chosen.current = id;\n place(id, where);\n }}\n >\n <span className=\"more-tick\" aria-hidden=\"true\" />\n <span className=\"more-label\">{label}</span>\n </DropItem>\n ))}\n </DropGroup>\n </DropMenu>\n </span>\n );\n };\n\n return {\n orderable,\n /** The rows as they are to be drawn: in their places, a move made and not yet read back included. */\n rows: drawnRows,\n /** Whether a row's move is still being saved. */\n pending: (id: string) => Boolean(optimistic.pending(id)),\n /** The list's element: where its rows land, and where their marks and the focus are looked for. */\n zone: {\n ref: (element: HTMLElement | null) => {\n zone.current = element;\n },\n ...(orderable ? { 'data-drop-zone': '' } : {}),\n },\n /** A row's name here, in a list that keeps an order; null in any other. */\n id: (row: Record<string, unknown>) => rowIds.get(row) ?? null,\n /** A row's element, by id: its name for the drop, and a drag source while the rows may move. */\n item: (id: string) => (orderable && byId.has(id) ? { [attribute]: id, ...drag.source(id, true) } : {}),\n start: (event: ReactPointerEvent, id: string, element: HTMLElement) => {\n if (orderable && byId.has(id)) drag.start(event, id, element);\n },\n keyDown,\n menu,\n shortcuts: orderable ? 'Alt+ArrowUp Alt+ArrowDown' : undefined,\n /** Said to assistive technology after a move. */\n live: order ? (\n <div className=\"visually-hidden\" aria-live=\"polite\">\n {said}\n </div>\n ) : null,\n };\n}\n\n/**\n * The grid's rows put in order: the grid draws its own rows, so a press on\n * one is taken here, by delegation, and each row's grip is portalled into\n * its leading cell (RowHost.tsx). Under a RowHosts scope, beside any other\n * decoration of the same rows.\n */\nexport function GridOrder({\n table,\n rows,\n order,\n interactive,\n children,\n}: {\n table: TableMeta;\n rows: Array<Record<string, unknown>>;\n order: ListOrder;\n interactive: boolean;\n /** The grid, drawn from the rows in their places (a move not yet read back included). */\n children: (rows: Array<Record<string, unknown>>) => ReactNode;\n}) {\n const naming = labelColumn(table) ?? primaryKey(table)[0];\n const ordering = useListOrder({\n table,\n rows,\n order,\n interactive,\n title: (row) => String(row[naming] ?? say('common.untitled')),\n id: (row) => rowKeyString(table, row),\n attribute: 'data-row-key',\n focusOf: (item) => item.querySelector<HTMLElement>('.order-grip-button'),\n });\n const rowOf = (target: EventTarget | null) => (target as Element | null)?.closest?.<HTMLElement>('tr[data-row-key]') ?? null;\n return (\n <div\n className=\"grid-order\"\n {...ordering.zone}\n onPointerDown={(event) => {\n const row = rowOf(event.target);\n if (row) ordering.start(event, row.dataset.rowKey!, row);\n }}\n onKeyDown={(event) => {\n const row = rowOf(event.target);\n if (row) ordering.keyDown(event, row.dataset.rowKey!);\n }}\n >\n {children(ordering.rows)}\n {ordering.orderable &&\n ordering.rows.map((row) => {\n const key = rowKeyString(table, row);\n return key === null ? null : (\n <RowDecoration key={key} rowKey={key}>\n {ordering.menu(key)}\n </RowDecoration>\n );\n })}\n {ordering.live}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAGA,IAAa,MAAM,eAAe;CAChC,eAAe;CACf,cAAc;CACd,SAAS;CACT,iBAAiB;CACjB,OAAO;AACT,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;ACgED,IAAM,YAAY,SAAsB,KAAK,cAA2B,oBAAoB;AAE5F,SAAgB,aAAa,EAC3B,OACA,MACA,OACA,aACA,OACA,IAAI,MACJ,YAAY,kBACZ,UAAU,UACV,UACmB;CACnB,MAAM,SAAS,eAAe;CAC9B,MAAM,CAAC,MAAM,WAAW,SAAS,EAAE;CACnC,MAAM,OAAO,OAA2B,IAAI;CAC5C,MAAM,UAAU,OAAsB,IAAI;CAC1C,MAAM,SAAS,OAAsB,IAAI;CACzC,MAAM,UAAU,OAAO,IAAI;CAC3B,gBAAgB;EACd,QAAQ,UAAU;EAClB,aAAa;GACX,QAAQ,UAAU;EACpB;CACF,GAAG,CAAC,CAAC;CAEL,MAAM,UAAU,QAAiC;EAC/C,MAAM,MAAM,MAAM,OAAO,GAAG;EAC5B,O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K;CACxH,OACE,qBAAC,OAAD;EACE,WAAU;EACV,GAAI,SAAS;EACb,gBAAgB,UAAU;GACxB,MAAM,MAAM,MAAM,MAAM,MAAM;GAC9B,IAAI,KAAK,SAAS,MAAM,OAAO,IAAI,QAAQ,QAAS,GAAG;EACzD;EACA,YAAY,UAAU;GACpB,MAAM,MAAM,MAAM,MAAM,MAAM;GAC9B,IAAI,KAAK,SAAS,QAAQ,OAAO,IAAI,QAAQ,MAAO;EACtD;EAVF,UAAA;GAYG,SAAS,SAAS,IAAI;GACtB,SAAS,aACR,SAAS,KAAK,KAAK,QAAQ;IACzB,MAAM,MAAM,aAAa,OAAO,GAAG;IACnC,OAAO,QAAQ,OAAO,OACpB,oBAAC,eAAD;KAAyB,QAAQ;KAC9B,UAAA,SAAS,KAAK,GAAG;IACL,GAFK,GAEL;GAEnB,CAAC;GACF,SAAS;EACP;;AAET"}
|
|
1
|
+
{"version":3,"file":"shared-1PD7TOTJ.js","names":[],"sources":["../../../kit/src/client/copy/lists/components/useListOrder.ts","../../../kit/src/client/components/useListOrder.tsx"],"sourcesContent":["/** What useListOrder says, in the lists and grid room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n thereIsNoRoom: 'There is no room left between those two on this page. Show “{title}” with the whole list on one page to put it there.',\n movedToPlace: 'Moved “{title}” to place {index} of {entriesCount}',\n reorder: 'Reorder {title}',\n dragTheRowPress: 'Drag the row, press Alt and ↑ or ↓, or choose a place',\n order: 'Order',\n});\n","/**\n * A list's rows in the order an editor gives them by hand: a view's `order`\n * column, read ascending, and changed three ways, none pointer-only — a row\n * dragged into place, Alt and ↑/↓ on a focused row, and the row's grip menu\n * (up, down, top, bottom). Each is the board's move (placeOrder.ts): the one\n * row, numbered halfway between its new neighbors, and the run renumbered a\n * step apart only when there is no number left between them — ordinary\n * updates, each checked, recorded and undoable.\n *\n * Offered only where the rows are read in that order now: a reader who sorts\n * by a header, a tab with a sort of its own, or a Sort menu choice reads the\n * rows another way, and the handles go until the order is back. And only to a\n * reader who may edit the column, on the same gates as the update route.\n *\n * A move is drawn at once (optimisticMoves.ts): the row stands in its new\n * place from the moment it is let go, and goes back, with the server's\n * sentence, only if a write is refused. Moves made while one saves wait their\n * turn. Rows one under another open a gap where the row will land, the\n * board's (usePointerDrag's `gap`); cards side by side keep the mark at their\n * side, since a gap in a wrapping grid would move every card after it.\n *\n * On a page of a longer list a row can take a number between two neighbors\n * on the page but the run is never renumbered, which would collide with the\n * pages it cannot see; the move says so instead.\n */\nimport { useEffect, useMemo, useRef, useState, type KeyboardEvent, type PointerEvent as ReactPointerEvent, type ReactNode } from 'react';\nimport { useQueryClient } from '@tanstack/react-query';\nimport { findTable, keyOf, state, toast, writeAllowed } from '../core.js';\nimport { applyBulk, bulkKey } from '../bulkActions.js';\nimport { shell } from '../shellMode.js';\nimport { sessionIdentity } from '../sessionIdentity.js';\nimport { expectedValues, labelColumn, primaryKey, type TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { PLACES, placeIndex, placements, positionOf, savePlaces, wholeColumn, type Place } from './placeOrder.js';\nimport { landingBefore } from './pointerDrag.js';\nimport { useOptimisticMoves } from './optimisticMoves.js';\nimport { usePointerDrag, type DropPoint } from './usePointerDrag.js';\nimport { DropGroup, DropItem, DropMenu } from '@mistriwork/ui/DropMenu.js';\nimport { RowDecoration, rowKeyString } from './RowHost.js';\nimport { say } from '../copy/lists/components/useListOrder.js';\n\n/** A view's order, as the list room hands it on. */\nexport interface ListOrder {\n /** The numeric column holding each row's place. */\n column: string;\n /** The rows are read in that order now, and nothing else. */\n active: boolean;\n /** The rows are a page of a longer list. */\n partial: boolean;\n}\n\ninterface ListOrderOptions {\n table: TableMeta;\n rows: Array<Record<string, unknown>>;\n order?: ListOrder;\n interactive: boolean;\n title: (row: Record<string, unknown>) => string;\n /** How a row is named on its element; bulkKey's spelling in `data-drop-item` unless the rows already carry one. */\n id?: (row: Record<string, unknown>, key: Record<string, unknown>) => string | null;\n /** The attribute a row's element carries its id in. */\n attribute?: string;\n /** Where the focus goes back to after a move, from the row's element. */\n focusOf?: (item: HTMLElement) => HTMLElement | null;\n /** Rows that stand beside each other, as cards in columns: a row's halves are left and right. */\n across?: (zone: HTMLElement) => boolean;\n}\n\ninterface Entry {\n id: string;\n key: Record<string, unknown>;\n title: string;\n position?: number;\n}\n\nconst ownFocus = (item: HTMLElement) => item.querySelector<HTMLElement>('[data-order-focus]');\n\nexport function useListOrder({\n table,\n rows,\n order,\n interactive,\n title,\n id: idOf,\n attribute = 'data-drop-item',\n focusOf = ownFocus,\n across,\n}: ListOrderOptions) {\n const client = useQueryClient();\n const [said, setSaid] = useState('');\n const zone = useRef<HTMLElement | null>(null);\n const refocus = useRef<string | null>(null);\n const chosen = useRef<string | null>(null);\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const nameOf = (row: Record<string, unknown>) => {\n const key = keyOf(table, row) as Record<string, unknown> | null;\n return key ? (idOf ? idOf(row, key) : bulkKey(table, key)) : null;\n };\n const connection = state.activeConnection ?? null;\n /* A move is drawn before it is saved: its rows carry their new numbers, and stand in that order. */\n const optimistic = useOptimisticMoves(rows, nameOf, () => client.invalidateQueries({ queryKey: ['run', connection] }));\n const drawnRows = useMemo(() => {\n if (!order || optimistic.rows === rows) return rows;\n const place = (row: Record<string, unknown>) => positionOf(row[order.column]) ?? Number.POSITIVE_INFINITY;\n return [...optimistic.rows].sort((a, b) => place(a) - place(b));\n }, [optimistic.rows, rows, order]);\n /* Rows are named only in a list that keeps an order: every other list pays nothing. */\n const named = !order\n ? []\n : drawnRows.flatMap((row) => {\n const key = keyOf(table, row) as Record<string, unknown> | null;\n const id = key ? (idOf ? idOf(row, key) : bulkKey(table, key)) : null;\n if (!key || id === null) return [];\n const position = positionOf(row[order.column]);\n return [{ row, entry: { id, key, title: title(row), ...(position === undefined ? {} : { position }) } as Entry }];\n });\n const entries = named.map((each) => each.entry);\n const rowIds = new Map(named.map((each) => [each.row, each.entry.id]));\n const ids = entries.map((entry) => entry.id);\n const byId = new Map(entries.map((entry) => [entry.id, entry]));\n /* Every gate the ordinary update route applies, asked only of a list that keeps an order. */\n const column = order ? ((findTable(table.id) as TableMeta | undefined) ?? table).columns.find((c) => c.name === order.column) : undefined;\n const orderable = Boolean(\n order?.active &&\n interactive &&\n column &&\n entries.length > 1 &&\n writeAllowed(table.id) &&\n state.connections?.some((c: { id: string; writable?: boolean }) => c.id === connection && c.writable) &&\n !table.isView &&\n !column.primaryKey &&\n column.writable !== false &&\n column.changesBy !== 'actions',\n );\n const whole = wholeColumn(column?.type);\n\n const itemOf = (id: string) =>\n [...(zone.current?.querySelectorAll<HTMLElement>(`[${attribute}]`) ?? [])].find((item) => item.getAttribute(attribute) === id) ?? null;\n /* A moved row is drawn anew in its place; the focus follows it once it is there. */\n useEffect(() => {\n const item = refocus.current ? itemOf(refocus.current) : null;\n const target = item && focusOf(item);\n if (target) {\n target.focus();\n refocus.current = null;\n }\n });\n\n const write = async (entry: Entry, value: number, isCurrent: () => boolean) => {\n const values = { [order!.column]: value };\n const expected = expectedValues(table, values, named.find((each) => each.entry.id === entry.id)?.row);\n const result = await applyBulk(\n { connection, table: table.id },\n values,\n [{ key: entry.key, label: entry.title, ...(expected ? { expected } : {}) }],\n isCurrent,\n );\n const outcome = result.outcomes[0];\n return outcome.kind === 'applied'\n ? null\n : { message: outcome.message, refused: outcome.kind === 'rejected' || outcome.kind === 'blocked' };\n };\n const move = (entry: Entry, index: number) => {\n if (!orderable) return;\n const writes = placements(\n entry,\n entries.filter((each) => each.id !== entry.id),\n index,\n whole,\n );\n if (!writes.length) return;\n if (order!.partial && writes.length > 1) {\n toast(say('thereIsNoRoom', { title: entry.title }), 'error');\n return;\n }\n const epoch = sessionIdentity().epoch;\n const isCurrent = () => mounted.current && epoch === sessionIdentity().epoch && connection === (state.activeConnection ?? null);\n const token = optimistic.begin(writes.map(([each, value]) => [each.id, { [order!.column]: value }] as const));\n refocus.current = entry.id;\n setSaid(say('movedToPlace', { title: entry.title, index: index + 1, entriesCount: entries.length }));\n optimistic.enqueue(async () => {\n try {\n const saved = await savePlaces(writes, (each, value) => write(each, value, isCurrent), isCurrent);\n if (saved.stale) return optimistic.undo(token);\n if (!saved.applied || saved.failed) {\n // A renumbered run part-written goes back to what the server says, read again when the queue is done.\n optimistic.undo(token);\n if (saved.failed?.refused) toast(saved.failed.message, 'error');\n if (!saved.applied) return;\n } else optimistic.saved(token);\n void shell().undo.refresh();\n void client.invalidateQueries({ queryKey: ['count', connection] });\n } catch (error) {\n optimistic.undo(token);\n throw error;\n }\n });\n };\n const place = (id: string, where: Place) => {\n const entry = byId.get(id);\n const index = placeIndex(ids, id, where);\n if (entry && index !== undefined) move(entry, index);\n };\n\n /* Where a drop lands: before the row in whose first half it is let go,\n before the next in its second, last past the last — and nowhere when\n that is where the row already stands. */\n const landing = (id: string, at: DropPoint | null): { index: number; before?: string; beside: boolean } | undefined => {\n if (!at || at.zone !== zone.current) return undefined;\n const over = at.item?.getAttribute(attribute) ?? undefined;\n const beside = Boolean(across?.(at.zone));\n const before = landingBefore(ids, id, over, beside ? at.left : at.upper);\n const others = ids.filter((each) => each !== id);\n const index = before === undefined ? others.length : others.indexOf(before);\n return index < 0 || index === ids.indexOf(id) ? undefined : { index, before, beside };\n };\n /* The mark is an attribute on the row's element, set here rather than drawn: a grid's rows are the grid's to render. */\n const clear = () => {\n for (const marked of zone.current?.querySelectorAll('[data-drop]') ?? []) marked.removeAttribute('data-drop');\n };\n const drag = usePointerDrag<string>({\n items: `[${attribute}]`,\n gap: !across,\n locate: (id) => itemOf(id),\n over: (id, at) => {\n clear();\n const landed = landing(id, at);\n if (!landed) return null;\n // Rows one under another: the gap opens where the row will land, and is the mark.\n if (!landed.beside) return { zone: zone.current!, before: landed.before === undefined ? null : itemOf(landed.before) };\n const last = ids.filter((each) => each !== id).at(-1);\n const marked = itemOf(landed.before ?? last ?? '');\n // Rows one under another take a rule above or below; cards side by side, at their side.\n const edge = landed.before === undefined ? (landed.beside ? 'end' : 'after') : landed.beside ? 'start' : 'before';\n marked?.setAttribute('data-drop', edge);\n return null;\n },\n drop: (id, at) => {\n clear();\n const landed = landing(id, at);\n const entry = byId.get(id);\n if (landed && entry) move(entry, landed.index);\n },\n end: clear,\n });\n\n const keyDown = (event: KeyboardEvent, id: string) => {\n if (!orderable || !event.altKey || event.metaKey || event.ctrlKey || event.shiftKey) return;\n if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return;\n event.preventDefault();\n event.stopPropagation();\n place(id, event.key === 'ArrowUp' ? 'up' : 'down');\n };\n\n /* A row's grip: the place menu, quiet until the row is hovered or focused\n (always there on touch), and a sign that the row itself can be dragged.\n Pressing it opens the menu rather than starting a drag. */\n const menu = (id: string): ReactNode => {\n const entry = byId.get(id);\n if (!orderable || !entry) return null;\n const places = PLACES.filter(([where]) => placeIndex(ids, id, where) !== undefined);\n return (\n <span className=\"order-grip\" data-drag-ignore=\"\">\n <DropMenu\n className=\"order-menu\"\n triggerClassName=\"order-grip-button\"\n triggerLabel={say('reorder', { title: entry.title })}\n triggerTitle={say('dragTheRowPress')}\n label={<span aria-hidden=\"true\">⠿</span>}\n popupClassName=\"more-list order-menu-list\"\n onOpenChange={(open) => {\n if (open) chosen.current = null;\n }}\n finalFocus={() => {\n const item = chosen.current === id ? itemOf(id) : null;\n return (item && focusOf(item)) ?? true;\n }}\n >\n <DropGroup label={say('order')} labelClassName=\"more-group-label\">\n {places.map(([where, label]) => (\n <DropItem\n key={where}\n className=\"more-item\"\n onClick={() => {\n chosen.current = id;\n place(id, where);\n }}\n >\n <span className=\"more-tick\" aria-hidden=\"true\" />\n <span className=\"more-label\">{label}</span>\n </DropItem>\n ))}\n </DropGroup>\n </DropMenu>\n </span>\n );\n };\n\n return {\n orderable,\n /** The rows as they are to be drawn: in their places, a move made and not yet read back included. */\n rows: drawnRows,\n /** Whether a row's move is still being saved. */\n pending: (id: string) => Boolean(optimistic.pending(id)),\n /** The list's element: where its rows land, and where their marks and the focus are looked for. */\n zone: {\n ref: (element: HTMLElement | null) => {\n zone.current = element;\n },\n ...(orderable ? { 'data-drop-zone': '' } : {}),\n },\n /** A row's name here, in a list that keeps an order; null in any other. */\n id: (row: Record<string, unknown>) => rowIds.get(row) ?? null,\n /** A row's element, by id: its name for the drop, and a drag source while the rows may move. */\n item: (id: string) => (orderable && byId.has(id) ? { [attribute]: id, ...drag.source(id, true) } : {}),\n start: (event: ReactPointerEvent, id: string, element: HTMLElement) => {\n if (orderable && byId.has(id)) drag.start(event, id, element);\n },\n keyDown,\n menu,\n shortcuts: orderable ? 'Alt+ArrowUp Alt+ArrowDown' : undefined,\n /** Said to assistive technology after a move. */\n live: order ? (\n <div className=\"visually-hidden\" aria-live=\"polite\">\n {said}\n </div>\n ) : null,\n };\n}\n\n/**\n * The grid's rows put in order: the grid draws its own rows, so a press on\n * one is taken here, by delegation, and each row's grip is portalled into\n * its leading cell (RowHost.tsx). Under a RowHosts scope, beside any other\n * decoration of the same rows.\n */\nexport function GridOrder({\n table,\n rows,\n order,\n interactive,\n children,\n}: {\n table: TableMeta;\n rows: Array<Record<string, unknown>>;\n order: ListOrder;\n interactive: boolean;\n /** The grid, drawn from the rows in their places (a move not yet read back included). */\n children: (rows: Array<Record<string, unknown>>) => ReactNode;\n}) {\n const naming = labelColumn(table) ?? primaryKey(table)[0];\n const ordering = useListOrder({\n table,\n rows,\n order,\n interactive,\n title: (row) => String(row[naming] ?? say('common.untitled')),\n id: (row) => rowKeyString(table, row),\n attribute: 'data-row-key',\n focusOf: (item) => item.querySelector<HTMLElement>('.order-grip-button'),\n });\n const rowOf = (target: EventTarget | null) => (target as Element | null)?.closest?.<HTMLElement>('tr[data-row-key]') ?? null;\n return (\n <div\n className=\"grid-order\"\n {...ordering.zone}\n onPointerDown={(event) => {\n const row = rowOf(event.target);\n if (row) ordering.start(event, row.dataset.rowKey!, row);\n }}\n onKeyDown={(event) => {\n const row = rowOf(event.target);\n if (row) ordering.keyDown(event, row.dataset.rowKey!);\n }}\n >\n {children(ordering.rows)}\n {ordering.orderable &&\n ordering.rows.map((row) => {\n const key = rowKeyString(table, row);\n return key === null ? null : (\n <RowDecoration key={key} rowKey={key}>\n {ordering.menu(key)}\n </RowDecoration>\n );\n })}\n {ordering.live}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAGA,IAAa,MAAM,eAAe;CAChC,eAAe;CACf,cAAc;CACd,SAAS;CACT,iBAAiB;CACjB,OAAO;AACT,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;ACgED,IAAM,YAAY,SAAsB,KAAK,cAA2B,oBAAoB;AAE5F,SAAgB,aAAa,EAC3B,OACA,MACA,OACA,aACA,OACA,IAAI,MACJ,YAAY,kBACZ,UAAU,UACV,UACmB;CACnB,MAAM,SAAS,eAAe;CAC9B,MAAM,CAAC,MAAM,WAAW,SAAS,EAAE;CACnC,MAAM,OAAO,OAA2B,IAAI;CAC5C,MAAM,UAAU,OAAsB,IAAI;CAC1C,MAAM,SAAS,OAAsB,IAAI;CACzC,MAAM,UAAU,OAAO,IAAI;CAC3B,gBAAgB;EACd,QAAQ,UAAU;EAClB,aAAa;GACX,QAAQ,UAAU;EACpB;CACF,GAAG,CAAC,CAAC;CAEL,MAAM,UAAU,QAAiC;EAC/C,MAAM,MAAM,MAAM,OAAO,GAAG;EAC5B,OAAO,MAAO,OAAO,KAAK,KAAK,GAAG,IAAI,QAAQ,OAAO,GAAG,IAAK;CAC/D;CACA,MAAM,aAAa,MAAM,oBAAoB;CAE7C,MAAM,aAAa,mBAAmB,MAAM,cAAc,OAAO,kBAAkB,EAAE,UAAU,CAAC,OAAO,UAAU,EAAE,CAAC,CAAC;CACrH,MAAM,YAAY,cAAc;EAC9B,IAAI,CAAC,SAAS,WAAW,SAAS,MAAM,OAAO;EAC/C,MAAM,SAAS,QAAiC,WAAW,IAAI,MAAM,OAAO,KAAK,OAAO;EACxF,OAAO,CA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K,KAAK,QAAQ;IACzB,MAAM,MAAM,aAAa,OAAO,GAAG;IACnC,OAAO,QAAQ,OAAO,OACpB,oBAAC,eAAD;KAAyB,QAAQ;KAC9B,UAAA,SAAS,KAAK,GAAG;IACL,GAFK,GAEL;GAEnB,CAAC;GACF,SAAS;EACP;;AAET"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { n as __exportAll } from "./shared-C-UrYobY.js";
|
|
2
2
|
import { E as sessionIdentity } from "./shared-poc11xxo.js";
|
|
3
3
|
import { D as columnKind, J as rowCurrency, Kt as formatLocale, Pn as useQueryClient, Qt as formatTimezone, Rt as defaultCurrency, c as booleanWords, ft as vocabularyWord, gt as defineMessages, rn as shell, ut as humanName } from "./shared-DJZjSi3J.js";
|
|
4
|
-
import { B as toast, L as state, c as columnLabel, d as findTable, i as api, s as columnDisplay, st as ownedBy } from "./shared-
|
|
4
|
+
import { B as toast, L as state, c as columnLabel, d as findTable, i as api, s as columnDisplay, st as ownedBy } from "./shared-BoLbc2WD.js";
|
|
5
5
|
import { t as Dropdown } from "./shared-gtzTT5Z7.js";
|
|
6
6
|
import { t as DateField } from "./shared-D0FwuLNI.js";
|
|
7
|
-
import { c as updateAttempts } from "./shared-
|
|
7
|
+
import { c as updateAttempts } from "./shared-Chp88all.js";
|
|
8
8
|
import { r as recordKey } from "./shared-_IMKuuvy.js";
|
|
9
|
-
import { n as singleReference } from "./shared-
|
|
10
|
-
import { n as canEditRow, t as booleanChoices } from "./shared-
|
|
9
|
+
import { n as singleReference } from "./shared-y-6_ZDts.js";
|
|
10
|
+
import { n as canEditRow, t as booleanChoices } from "./shared-BHCQ60yN.js";
|
|
11
11
|
import { t as validateRecordEdits } from "./shared-BqjEZ3bN.js";
|
|
12
|
-
import { n as columnInput, r as RecordPicker, t as InputSlot } from "./shared-
|
|
12
|
+
import { n as columnInput, r as RecordPicker, t as InputSlot } from "./shared-C2RU1qjv.js";
|
|
13
13
|
import { t as MinorMoneyInput } from "./shared-BfvaTcUD.js";
|
|
14
14
|
import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
15
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -388,4 +388,4 @@ function GridCellEdit({ table, row, column, recordKey: recordKey$1, draw, byName
|
|
|
388
388
|
}
|
|
389
389
|
export { ValueControl as n, GridCellEditor_exports as t };
|
|
390
390
|
|
|
391
|
-
//# sourceMappingURL=shared-
|
|
391
|
+
//# sourceMappingURL=shared-1gMnOu9J.js.map
|