chirkle 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -4
- package/package.json +2 -1
- package/pb_hooks/main.pb.js +1 -1
- package/pb_hooks/telegram/api.js +3 -2
- package/pb_hooks/telegram/inbound.js +6 -1
- package/pb_hooks/telegram/outbound.js +35 -6
- package/pb_hooks/telegram/reactions.js +137 -0
- package/pb_hooks/telegram/worker.js +1 -0
- package/pb_migrations/1760000043_telegram_reactions.js +21 -0
- package/pb_public/assets/app-A3SXD3FF.css +2 -0
- package/pb_public/assets/app-A3SXD3FF.css.map +7 -0
- package/pb_public/assets/app-NDSIQW4L.js +3 -0
- package/pb_public/assets/{app-SILEBEXB.js.map → app-NDSIQW4L.js.map} +3 -3
- package/pb_public/assets/collections-DHJEOLHW.css +2 -0
- package/pb_public/assets/collections-DHJEOLHW.css.map +7 -0
- package/pb_public/assets/{lazy-SCCVSUZO.js → lazy-4CXRBHHM.js} +2 -2
- package/pb_public/assets/lazy-4CXRBHHM.js.map +7 -0
- package/pb_public/assets/{media-L3EYTHKT.css → media-7TCBG7WM.css} +2 -2
- package/pb_public/assets/{media-L3EYTHKT.css.map → media-7TCBG7WM.css.map} +2 -2
- package/pb_public/assets/media-FPRU2QH5.js +2 -0
- package/pb_public/assets/media-FPRU2QH5.js.map +7 -0
- package/pb_public/index.html +3 -3
- package/pb_public/assets/app-ECR34OBK.css +0 -2
- package/pb_public/assets/app-ECR34OBK.css.map +0 -7
- package/pb_public/assets/app-SILEBEXB.js +0 -3
- package/pb_public/assets/collections-VEOIOCAW.css +0 -2
- package/pb_public/assets/collections-VEOIOCAW.css.map +0 -7
- package/pb_public/assets/lazy-SCCVSUZO.js.map +0 -7
- package/pb_public/assets/media-DH7ECZSF.js +0 -2
- package/pb_public/assets/media-DH7ECZSF.js.map +0 -7
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.collection{padding-bottom:2rem;container-type:inline-size}.coll-head{position:relative;display:grid;grid-template-columns:48px minmax(0,1fr) auto;column-gap:16px;row-gap:4px;align-items:center;padding:20px 28px 18px;border-bottom:1px solid var(--line)}.coll-head:before{content:"";grid-area:1 / 1 / 3;height:48px;border-radius:12px;background:color-mix(in srgb,var(--hue) 16%,transparent)}.coll-head h1{display:flex;grid-area:1 / 2;gap:.4rem;align-items:center;align-self:end;margin:0;font-size:1.25rem;line-height:1.25;overflow-wrap:anywhere}.coll-head h1 .ci{position:absolute;top:33px;left:41px;width:22px;height:22px;color:color-mix(in srgb,var(--hue) 70%,var(--fg))}.coll-head .coll-meta{grid-area:2 / 2;align-self:start;margin:0}.coll-actions{grid-area:1 / 3 / 3}.coll-head .coll-notice{grid-column:1 / -1;margin-top:8px}.coll-notice:empty{display:none}@container (width < 40rem){.coll-actions{grid-area:3 / 1 / 4 / -1;margin-top:8px}}@media(max-width:720px){.coll-head{display:block;padding:12px 16px 14px}.coll-head:before{content:none}.coll-head h1 .ci{position:static}.coll-head .back{margin-bottom:.25rem}.coll-actions{margin-top:10px}.collection .media-grid.coll-grid{padding-inline:16px}.collection .coll-head .coll-actions>button:not(:last-child){padding:0 12px}.coll-actions>.danger:last-child{position:absolute;top:12px;right:16px}}.coll-meta,.coll-notice,.coll-status,.coll-count{margin:0 0 .5rem;color:var(--muted);font-size:.8125rem}.coll-actions,.coll-rename,.coll-new-form{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.coll-actions button{display:inline-flex;align-items:center;justify-content:center;height:38px;padding:0 14px;border-color:transparent;background:var(--hover)}.coll-actions>button:first-child:not([aria-pressed]),.coll-actions [aria-pressed=false]{gap:8px;padding:0 16px;background:var(--fill);color:var(--on-fill)}.coll-actions [aria-pressed=true]{border-color:var(--border);background:none}.coll-actions>button:first-child:not([aria-pressed]):before,.coll-actions>.danger:last-child:before{content:"";width:16px;height:16px;background:currentcolor;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12'/%3E%3C/svg%3E") center / contain no-repeat}.coll-actions .danger{border-color:color-mix(in srgb,var(--danger) 45%,transparent);background:none;color:var(--danger)}.coll-actions>.danger:last-child{width:38px;padding:0;font-size:0}.coll-actions>.danger:last-child:before{mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3C/svg%3E")}.coll-new{margin:18px 28px 0;font-weight:700;color:var(--accent)}.media-grid.coll-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:6px;padding:6px 28px 0}.coll-grid h2{grid-column:1 / -1;margin:14px 0 4px;font-size:.8125rem;font-weight:600;color:var(--muted)}.collection>.media-status{margin:18px 28px}.coll-grid .media-tile{position:relative;display:grid;place-items:center;width:100%;aspect-ratio:1;padding:0;border:0;border-radius:10px;overflow:hidden;background:var(--surface);color:var(--muted);cursor:pointer}.coll-grid .media-tile img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.coll-cell{position:relative}.coll-cell.new .media-tile{outline:3px solid var(--accent);outline-offset:-3px}.coll-cell.new:after{content:"";position:absolute;top:6px;left:6px;width:.7rem;height:.7rem;border:2px solid #fff;border-radius:50%;background:var(--grad);pointer-events:none}.coll-remove{position:absolute;bottom:4px;right:4px;width:1.9rem;height:1.9rem;padding:0;border:0;border-radius:50%;background:#0d0b14a6;color:#fff;opacity:0}@media(hover:none){.coll-remove{opacity:.85}}.coll-cell:hover .att-save,.coll-cell:focus-within .att-save,.coll-cell:hover .coll-remove,.coll-cell:focus-within .coll-remove{opacity:1}dialog.coll-dialog{width:min(28rem,100%);max-height:min(40rem,100%);padding:0;border:1px solid var(--border);border-radius:16px;background:var(--raised);color:var(--fg);box-shadow:var(--shadow)}dialog.coll-pick{width:min(48rem,100%);height:min(40rem,100%)}dialog.coll-dialog[open]{display:flex;flex-direction:column}dialog.coll-dialog::backdrop{background:#08060ea8}.coll-dialog .media-bar{display:flex;gap:10px;align-items:center;padding:12px 10px 10px 16px;border-bottom:1px solid var(--line)}.coll-dialog .media-bar h2{display:flex;flex:1;gap:.4rem;align-items:center;margin:0;font-size:1rem}.coll-chips{display:flex;flex:none;gap:8px;overflow-x:auto;padding:12px 16px 4px}.coll-chip{flex:none;border-radius:var(--pill);white-space:nowrap}.coll-chip[aria-pressed=true]{background:var(--tint);color:var(--accent)}.coll-body{flex:1;overflow-y:auto;padding:.75rem 1rem}.coll-choices{margin:0 0 .75rem;padding:0;list-style:none}.coll-choices label{display:flex;gap:.4rem;align-items:center;padding:.35rem 0}.coll-choices .coll-meta{margin:0}.coll-spin{flex:none;width:.9rem;height:.9rem;border:2px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:coll-spin .8s linear infinite}@keyframes coll-spin{to{transform:rotate(360deg)}}.coll-dialog input[type=checkbox]:not(.switch){flex:none;width:auto;accent-color:var(--accent)}.coll-public{display:flex;gap:10px;align-items:center}.coll-new-form input{flex:1;width:auto;min-width:0}.coll-pick .media-tile[aria-pressed=true]{outline:3px solid var(--accent);outline-offset:-3px}.coll-pick .media-tile[aria-pressed=true]:after{content:"\2713";position:absolute;top:4px;right:4px;display:grid;place-items:center;width:1.5rem;height:1.5rem;border-radius:50%;background:var(--accent);color:var(--on-fill);font-weight:800}.coll-foot{display:flex;gap:.75rem;align-items:center;justify-content:flex-end;padding:.5rem 1rem;border-top:1px solid var(--border)}.coll-foot .coll-count{margin:0 auto 0 0}@media(max-width:40rem){dialog.coll-dialog{width:100%;height:100%;max-height:none;border-radius:0}}
|
|
2
|
+
/*# sourceMappingURL=collections-DHJEOLHW.css.map */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../web/styles/collections.css"],
|
|
4
|
+
"sourcesContent": ["/* Media collections (DESIGN.md \u00A731): the collection page, the save menu, the picker. Not part of app.css: the chunk\n links this file when it first shows one. Uses app.css's custom properties, and the media grid's tiles (.media-grid,\n .media-tile) are styled here too, since media.css may not be loaded. */\n\n.collection {\n padding-bottom: 2rem;\n container-type: inline-size;\n}\n\n/* The header: the icon on a tile, the name over whose it is, the buttons on the right; a line under it. */\n.coll-head {\n position: relative;\n display: grid;\n grid-template-columns: 48px minmax(0, 1fr) auto;\n column-gap: 16px;\n row-gap: 4px;\n align-items: center;\n padding: 20px 28px 18px;\n border-bottom: 1px solid var(--line);\n}\n\n.coll-head::before {\n content: \"\";\n grid-area: 1 / 1 / 3;\n height: 48px;\n border-radius: 12px;\n background: color-mix(in srgb, var(--hue) 16%, transparent);\n}\n\n.coll-head h1 {\n display: flex;\n grid-area: 1 / 2;\n gap: 0.4rem;\n align-items: center;\n align-self: end;\n margin: 0;\n font-size: 1.25rem;\n line-height: 1.25;\n overflow-wrap: anywhere;\n}\n\n/* The icon, moved onto the tile. */\n.coll-head h1 .ci {\n position: absolute;\n top: 33px;\n left: 41px;\n width: 22px;\n height: 22px;\n color: color-mix(in srgb, var(--hue) 70%, var(--fg));\n}\n\n.coll-head .coll-meta {\n grid-area: 2 / 2;\n align-self: start;\n margin: 0;\n}\n\n.coll-actions {\n grid-area: 1 / 3 / 3;\n}\n\n.coll-head .coll-notice {\n grid-column: 1 / -1;\n margin-top: 8px;\n}\n\n.coll-notice:empty {\n display: none;\n}\n\n/* A narrow pane (a small window, or zoomed in): the buttons go under the name rather than squeezing it to a word a line. */\n@container (width < 40rem) {\n .coll-actions {\n grid-area: 3 / 1 / 4 / -1;\n margin-top: 8px;\n }\n}\n\n/* The back arrow (as a room's, \u00A77.8): narrow screens only (app.css hides .back on wide ones), where the header is a column. */\n@media (max-width: 720px) {\n .coll-head {\n display: block;\n padding: 12px 16px 14px;\n }\n\n .coll-head::before {\n content: none;\n }\n\n .coll-head h1 .ci {\n position: static;\n }\n\n .coll-head .back {\n margin-bottom: 0.25rem;\n }\n\n .coll-actions {\n margin-top: 10px;\n }\n\n /* In line with the header's. */\n .collection .media-grid.coll-grid {\n padding-inline: 16px;\n }\n\n .collection .coll-head .coll-actions > button:not(:last-child) {\n padding: 0 12px;\n }\n\n /* Delete (only its icon) by the back arrow: on a phone it wrapped to a line of its own (QA BUG-246). */\n .coll-actions > .danger:last-child {\n position: absolute;\n top: 12px;\n right: 16px;\n }\n}\n\n.coll-meta,\n.coll-notice,\n.coll-status,\n.coll-count {\n margin: 0 0 0.5rem;\n color: var(--muted);\n font-size: 0.8125rem;\n}\n\n.coll-actions,\n.coll-rename,\n.coll-new-form {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n align-items: center;\n}\n\n/* Upload (yours) and Subscribe stand out; Rename and Make public are quieter; Delete is only its icon. */\n.coll-actions button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: 38px;\n padding: 0 14px;\n border-color: transparent;\n background: var(--hover);\n}\n\n.coll-actions > button:first-child:not([aria-pressed]),\n.coll-actions [aria-pressed=\"false\"] {\n gap: 8px;\n padding: 0 16px;\n background: var(--fill);\n color: var(--on-fill);\n}\n\n.coll-actions [aria-pressed=\"true\"] {\n border-color: var(--border);\n background: none;\n}\n\n.coll-actions > button:first-child:not([aria-pressed])::before,\n.coll-actions > .danger:last-child::before {\n content: \"\";\n width: 16px;\n height: 16px;\n background: currentcolor;\n mask:\n url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12'/%3E%3C/svg%3E\")\n center / contain no-repeat;\n}\n\n.coll-actions .danger {\n border-color: color-mix(in srgb, var(--danger) 45%, transparent);\n background: none;\n color: var(--danger);\n}\n\n.coll-actions > .danger:last-child {\n width: 38px;\n padding: 0;\n font-size: 0;\n}\n\n.coll-actions > .danger:last-child::before {\n mask-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6'/%3E%3C/svg%3E\");\n}\n\n.coll-new {\n margin: 18px 28px 0;\n font-weight: 700;\n color: var(--accent);\n}\n\n.media-grid.coll-grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));\n gap: 6px;\n padding: 6px 28px 0;\n}\n\n.coll-grid h2 {\n grid-column: 1 / -1;\n margin: 14px 0 4px;\n font-size: 0.8125rem;\n font-weight: 600;\n color: var(--muted);\n}\n\n.collection > .media-status {\n margin: 18px 28px;\n}\n\n.coll-grid .media-tile {\n position: relative;\n display: grid;\n place-items: center;\n width: 100%;\n aspect-ratio: 1;\n padding: 0;\n border: 0;\n border-radius: 10px;\n overflow: hidden;\n background: var(--surface);\n color: var(--muted);\n cursor: pointer;\n}\n\n.coll-grid .media-tile img {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.coll-cell {\n position: relative;\n}\n\n/* New since your last visit: a ring and a dot. */\n.coll-cell.new .media-tile {\n outline: 3px solid var(--accent);\n outline-offset: -3px;\n}\n\n.coll-cell.new::after {\n content: \"\";\n position: absolute;\n top: 6px;\n left: 6px;\n width: 0.7rem;\n height: 0.7rem;\n border: 2px solid #fff;\n border-radius: 50%;\n background: var(--grad);\n pointer-events: none;\n}\n\n.coll-remove {\n position: absolute;\n bottom: 4px;\n right: 4px;\n width: 1.9rem;\n height: 1.9rem;\n padding: 0;\n border: 0;\n border-radius: 50%;\n background: rgb(13 11 20 / 65%);\n color: #fff;\n opacity: 0;\n}\n\n@media (hover: none) {\n .coll-remove {\n opacity: 0.85;\n }\n}\n\n.coll-cell:hover .att-save,\n.coll-cell:focus-within .att-save,\n.coll-cell:hover .coll-remove,\n.coll-cell:focus-within .coll-remove {\n opacity: 1;\n}\n\n/* The save menu and the picker. */\ndialog.coll-dialog {\n width: min(28rem, 100%);\n max-height: min(40rem, 100%);\n padding: 0;\n border: 1px solid var(--border);\n border-radius: 16px;\n background: var(--raised);\n color: var(--fg);\n box-shadow: var(--shadow);\n}\n\ndialog.coll-pick {\n width: min(48rem, 100%);\n height: min(40rem, 100%);\n}\n\ndialog.coll-dialog[open] {\n display: flex;\n flex-direction: column;\n}\n\ndialog.coll-dialog::backdrop {\n background: rgb(8 6 14 / 66%);\n}\n\n.coll-dialog .media-bar {\n display: flex;\n gap: 10px;\n align-items: center;\n padding: 12px 10px 10px 16px;\n border-bottom: 1px solid var(--line);\n}\n\n.coll-dialog .media-bar h2 {\n display: flex;\n flex: 1;\n gap: 0.4rem;\n align-items: center;\n margin: 0;\n font-size: 1rem;\n}\n\n/* The picker's collections: a row of chips that scrolls sideways, as the app's. */\n.coll-chips {\n display: flex;\n flex: none;\n gap: 8px;\n overflow-x: auto;\n padding: 12px 16px 4px;\n}\n\n.coll-chip {\n flex: none;\n border-radius: var(--pill);\n white-space: nowrap;\n}\n\n.coll-chip[aria-pressed=\"true\"] {\n background: var(--tint);\n color: var(--accent);\n}\n\n.coll-body {\n flex: 1;\n overflow-y: auto;\n padding: 0.75rem 1rem;\n}\n\n.coll-choices {\n margin: 0 0 0.75rem;\n padding: 0;\n list-style: none;\n}\n\n.coll-choices label {\n display: flex;\n gap: 0.4rem;\n align-items: center;\n padding: 0.35rem 0;\n}\n\n.coll-choices .coll-meta {\n margin: 0;\n}\n\n/* A save or removal in progress (the copy can take seconds). */\n.coll-spin {\n flex: none;\n width: 0.9rem;\n height: 0.9rem;\n border: 2px solid var(--border);\n border-top-color: var(--accent);\n border-radius: 50%;\n animation: coll-spin 0.8s linear infinite;\n}\n\n@keyframes coll-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n/* Not app.css's full-width inputs: a box before its label, a name field next to its button. */\n.coll-dialog input[type=\"checkbox\"]:not(.switch) {\n flex: none;\n width: auto;\n accent-color: var(--accent);\n}\n\n.coll-public {\n display: flex;\n gap: 10px;\n align-items: center;\n}\n\n.coll-new-form input {\n flex: 1;\n width: auto;\n min-width: 0;\n}\n\n.coll-pick .media-tile[aria-pressed=\"true\"] {\n outline: 3px solid var(--accent);\n outline-offset: -3px;\n}\n\n.coll-pick .media-tile[aria-pressed=\"true\"]::after {\n content: \"\u2713\";\n position: absolute;\n top: 4px;\n right: 4px;\n display: grid;\n place-items: center;\n width: 1.5rem;\n height: 1.5rem;\n border-radius: 50%;\n background: var(--accent);\n color: var(--on-fill);\n font-weight: 800;\n}\n\n.coll-foot {\n display: flex;\n gap: 0.75rem;\n align-items: center;\n justify-content: flex-end;\n padding: 0.5rem 1rem;\n border-top: 1px solid var(--border);\n}\n\n.coll-foot .coll-count {\n margin: 0 auto 0 0;\n}\n\n@media (max-width: 40rem) {\n dialog.coll-dialog {\n width: 100%;\n height: 100%;\n max-height: none;\n border-radius: 0;\n }\n}\n"],
|
|
5
|
+
"mappings": "AAIA,CAAC,WACC,eAAgB,KAChB,eAAgB,WAClB,CAGA,CAAC,UACC,SAAU,SACV,QAAS,KACT,sBAAuB,KAAK,OAAO,CAAC,CAAE,KAAK,KAC3C,WAAY,KACZ,QAAS,IACT,YAAa,OAhBf,QAiBW,KAAK,KAAK,KACnB,cAAe,IAAI,MAAM,IAAI,OAC/B,CAEA,CAXC,SAWS,QACR,QAAS,GACT,UAAW,EAAE,EAAE,EAAE,EAAE,EACnB,OAAQ,KAxBV,cAyBiB,KACf,WAAY,UAAU,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gRc,MACb,KAAM,EACN,MAAO,KACP,UAAW,CACb,CAEA,CA9GO,UA8GI,CAnMC,UAmMU,CAAC,mBACrB,QAAS,IAAI,MAAM,IAAI,UACvB,eAAgB,IAClB,CAEA,CAnHO,UAmHI,CAxMC,UAwMU,CAAC,kBAAoB,OACzC,QAAS,QACT,SAAU,SACV,IAAK,IACL,MAAO,IACP,QAAS,KACT,YAAa,OACb,MAAO,OACP,OAAQ,OApaV,cAqaiB,IACf,WAAY,IAAI,UAChB,MAAO,IAAI,WACX,YAAa,GACf,CAEA,CAAC,UACC,QAAS,KACT,IAAK,OACL,YAAa,OACb,gBAAiB,SA/anB,QAgbW,MAAO,KAChB,WAAY,IAAI,MAAM,IAAI,SAC5B,CAEA,CATC,UASU,CA3TV,WAzHD,OAqbU,EAAE,KAAK,EAAE,CACnB,CAEA,OAAO,UAAY,OACjB,MAAM,CA3JD,YA4JH,MAAO,KACP,OAAQ,KACR,WAAY,KA5bhB,cA6bmB,CACjB,CACF",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var oe="/api/collections/collections/records",D=o=>JSON.stringify(o),Ae="id,collection,file,name,video,poster,created";function _(o){return{get:(e,n)=>o.request(`${oe}/${e}`,{query:{expand:"owner",fields:"id,name,public,owner,items,expand.owner.name"},signal:n}),create:(e,n,a)=>o.request(oe,{method:"POST",body:{owner:e,name:n,public:a},query:{fields:"id"}}),update:(e,n)=>o.request(`${oe}/${e}`,{method:"PATCH",body:n,query:{fields:"name,public"}}),remove:e=>o.request(`${oe}/${e}`,{method:"DELETE"}),async items(e,n,a,i=!1){let d=i?">":"<",m=n?` && (created ${d} ${D(n.created)} || (created = ${D(n.created)} && id ${d} ${D(n.id)}))`:"",g={filter:`collection = ${D(e)}${m}`,sort:"-created,-id",perPage:61,skipTotal:!0,fields:Ae},{items:b}=await o.request("/api/collections/collection_items/records",{query:g,signal:a});return{items:b.slice(0,60),more:b.length>60}},async idsSince(e,n,a){let i=new Set,d=`collection = ${D(e)} && (created > ${D(n.created)} || (created = ${D(n.created)} && id >= ${D(n.id)}))`;for(let m=1;;m++){let g={filter:d,sort:"-created,-id",page:m,perPage:1e3,skipTotal:!0,fields:"id"},{items:b}=await o.request("/api/collections/collection_items/records",{query:g,signal:a});for(let p of b)i.add(p.id);if(b.length<1e3)return i}},save:(e,n)=>o.request("/api/chat/items",{method:"POST",body:{collection:e,...n}}),upload:(e,n,a)=>o.request("/api/chat/items",{method:"POST",body:{collection:e,file:n},onUpload:a}),unsave:e=>o.request(`/api/chat/items/${e}`,{method:"DELETE"}),savedIn:(e,n)=>o.request("/api/chat/saved",{query:e,signal:n}),follow:(e,n)=>o.request("/api/chat/subs",{method:"POST",body:{collection:e,on:n}})}}var le=null;function N(o){return le??=new Promise(e=>{let a=o("link",{rel:"stylesheet",href:"/assets/collections-VEOIOCAW.css",on:{load:()=>e(),error:()=>{a.remove(),le=null,e()}}});document.head.append(a)}),le}var ye=/\.(jpe?g|png|gif|webp|avif|mp4|m4v|webm|mov|ogv)$/i,Ce=".jpg,.jpeg,.png,.gif,.webp,.avif,.mp4,.m4v,.webm,.mov,.ogv",we=20*1024*1024,O=o=>o.list()??{mine:[],subs:[]};function ce(o,e){return new Promise(n=>{let a=()=>{i(),clearTimeout(d),n()},i=o.watch(a),d=setTimeout(a,e)})}function B(o){let e=o;return e?.status===0?"Can't reach the server. Check your connection.":Object.values(e?.fields??{})[0]||e?.message||"Something went wrong."}var q=o=>o("span",{class:"ci","aria-hidden":"true"}),xe=new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}),Se=o=>new Date(o.replace(" ","T"));function de(o){let{id:e,created:n,file:a,name:i}=o;return{id:e,room:"",author:"",text:"",created:n,updated:n,edited_at:"",deleted:!1,files:[a],file_names:{[a]:i}}}function ie(o,e,n){if(e.video&&!e.poster)return null;let a=o.h("img",{src:e.video?o.api.itemPosterUrl(e):o.api.itemUrl(e,"240x240"),alt:"",loading:"lazy",decoding:"async"});return e.video&&a.addEventListener("error",()=>a.remove(),{signal:n}),a}function Y(o,e,n){let a=[],i=!1,d=null;return{items:a,get done(){return i},next(){return i?Promise.resolve([]):(d??=_(o.api).items(e,a.at(-1),n).then(m=>(d=null,i=!m.more,a.push(...m.items),m.items),m=>{throw d=null,m}),d)}}}async function Oe(o){let{h:e}=o,n=new AbortController,{signal:a}=n;o.signal.addEventListener("abort",()=>y(),{signal:a});let i=e("h2",{id:"coll-create-title"},[q(e)," New collection"]),d=e("input",{required:!0,autocomplete:"off","aria-label":"Name",placeholder:"Name"}),m=e("input",{type:"checkbox",role:"switch",class:"switch"}),g=e("p",{class:"coll-status",role:"alert"}),b=e("button",{type:"submit",class:"primary"},"Create"),p=e("form",{class:"coll-body",on:{submit:async w=>{if(w.preventDefault(),!b.disabled){b.disabled=!0,g.textContent="";try{let{id:M}=await _(o.api).create(o.me()?.id??"",d.value,m.checked);o.service.refresh(),y(!1),o.onCreated(M)}catch(M){g.textContent=B(M)}finally{b.disabled=!1}}}},signal:a},[e("p",{class:"coll-new-form"},[d,b]),e("label",{class:"coll-public"},[m,"Public: anyone can see it and subscribe"]),g]),x=e("dialog",{class:"coll-dialog coll-create","aria-labelledby":i.id},[e("header",{class:"media-bar"},[i,e("button",{type:"button",class:"icon-button ic i-x","aria-label":"Close",on:{click:()=>y()},signal:a})]),p]);function y(w=!0){a.aborted||(n.abort(),x.open&&x.close(),x.remove(),w&&o.opener.focus())}x.addEventListener("close",()=>y(),{signal:a}),await N(e),!a.aborted&&(document.body.append(x),x.showModal(),d.focus())}var ue=null;async function se(o){ue?.();let{h:e}=o,n=_(o.api),a=new AbortController,{signal:i}=a;o.signal.addEventListener("abort",()=>A(),{signal:i});let d=e("h2",{id:"coll-save-title"},[q(e)," Save to collection"]),m=e("ul",{class:"coll-choices"}),g=e("p",{class:"coll-status",role:"status"},"Loading\u2026"),b=e("input",{placeholder:"New collection","aria-label":"New collection name",autocomplete:"off"}),p=e("form",{class:"coll-new-form",on:{submit:async v=>{if(v.preventDefault(),!!b.value.trim())try{let r=(await n.create(o.me()?.id??"",b.value,!1)).id;b.value="",await M(r,!0)}catch(r){g.textContent=B(r)}}},signal:i},[b,e("button",{type:"submit"},"Create")]),x=e("dialog",{class:"coll-dialog coll-save","aria-labelledby":d.id},[e("header",{class:"media-bar"},[d,e("button",{type:"button",class:"icon-button ic i-x","aria-label":"Close",on:{click:()=>A()},signal:i})]),e("div",{class:"coll-body"},[m,g,p])]),y={},w=new Map;async function M(v,r){w.set(v,r),g.textContent=r?"Saving\u2026":"Removing\u2026",h();try{r?y[v]=(await n.save(v,o.from)).id:y[v]&&(await n.unsave(y[v]),delete y[v]),g.textContent=r?"Saved.":"Removed.",o.service.refresh()}catch(S){S.status===409?y=await n.savedIn(o.from,i).catch(()=>y):g.textContent=B(S)}w.delete(v),h()}function h(){let v=O(o).mine;m.replaceChildren(...v.map(r=>{let S=e("input",{type:"checkbox",checked:w.get(r.id)??!!y[r.id],disabled:w.has(r.id)});return S.addEventListener("change",()=>{M(r.id,S.checked)},{signal:i}),e("li",{"aria-busy":w.has(r.id)?"true":"false"},e("label",{},[S," ",r.name,e("span",{class:"coll-meta"},r.public?" \xB7 Public: anyone can see it":" \xB7 Private"),w.has(r.id)?e("span",{class:"coll-spin","aria-hidden":"true"}):null]))})),!v.length&&g.textContent===""&&(g.textContent="You have no collections yet. Make one:")}function A(){i.aborted||(a.abort(),ue=null,x.open&&x.close(),x.remove(),o.opener.setAttribute("aria-expanded","false"),o.opener.focus())}if(ue=A,x.addEventListener("close",()=>A(),{signal:i}),i.addEventListener("abort",o.watch(h),{once:!0}),await N(e),!i.aborted){document.body.append(x),x.showModal(),o.opener.setAttribute("aria-expanded","true");try{y=await n.savedIn(o.from,i),g.textContent=""}catch(v){if(i.aborted)return;g.textContent=B(v)}h(),(m.querySelector("input")??b).focus()}}async function qe(o,e){let{h:n,api:a,signal:i,id:d}=e,m=_(a),[,g]=await Promise.all([N(n),m.get(d,i).catch(()=>null),(async()=>{e.me()&&!e.list()&&await ce(e,2e3)})()]);if(i.aborted)return;function b(){o.replaceChildren(n("section",{class:"collection not-found"},[n("h1",{},[q(n)," This collection doesn't exist."]),n("p",{},["It may be private, or deleted. ",n("a",{href:"/"},"Back to rooms")])]))}if(!g)return b();let p=g,x=e.me(),y=!!x&&p.owner===x.id,w=g.expand?.owner?.name??"",M=O(e).subs.find(t=>t.id===d)?.seen_at??"",h=Y(e,d,i),A=n("h1",{id:"coll-title"}),v=n("p",{class:"coll-meta"}),r=n("div",{class:"coll-actions"}),S=n("p",{class:"coll-notice",role:"status"}),z=n("p",{class:"coll-new",hidden:!0}),P=n("div",{class:"media-grid coll-grid"}),$=n("p",{class:"media-status",role:"status"});o.replaceChildren(n("section",{class:"collection","aria-labelledby":"coll-title"},[n("header",{class:`coll-head t${d.charCodeAt(0)%4}`},[n("a",{href:"/",class:"back ic i-back","aria-label":"Back to rooms"}),A,v,r,S]),z,P,$]));let R=(t,s)=>{S.textContent=`Couldn't ${t}. ${B(s)}`},I=(t,s,l="")=>n("button",{type:"button",class:l,on:{click:()=>{s()}},signal:i},t),F=t=>`${t} ${t===1?"item":"items"}`,J=()=>y?"Nothing here yet. Upload images and videos, or save them from the chat.":"Nothing here yet.",L=[],c=0,E=!1,H=[],W=n("input",{type:"file",multiple:!0,accept:Ce,hidden:!0,on:{change:()=>{ae([...W.files??[]]),W.value=""}},signal:i});function ae(t){for(let s of t)ye.test(s.name)?s.size>we?H.push(`${s.name}: larger than 20 MB`):L.push(s):H.push(`${s.name}: not an image or video`);if(!E){if(!L.length)return me();E=!0,(async()=>{for(;L.length&&!i.aborted;){let s=L[0],l=`Uploading ${c+1} of ${c+L.length}\u2026`;S.textContent=l;try{await m.upload(d,s,f=>S.textContent=`${l} ${Math.round(f*100)}%`)}catch(f){if(f.status===429){S.textContent="Waiting for the server\u2026",await new Promise(u=>setTimeout(u,1e4));continue}H.push(`${s.name}: ${B(f)}`)}L.shift(),c++,e.service.refresh()}c=0,E=!1,me()})()}}function me(){S.textContent=H.length?`Couldn't upload ${H.join("; ")}`:"",H=[]}let K=!1,G="",Q="";function Z(){K=!1,Q="",j()}async function pe(t){try{return p={...p,...await m.update(d,t)},S.textContent="",e.service.refresh(),Z(),!0}catch(s){return R("save",s),!1}}function Ee(){K=!0,G="Rename";let t=n("input",{value:p.name,"aria-label":"Collection name",autocomplete:"off"}),s=n("form",{class:"coll-rename",on:{submit:l=>{l.preventDefault(),pe({name:t.value})},keydown:l=>l.key==="Escape"&&Z()},signal:i},[t,n("button",{type:"submit"},"Save"),I("Cancel",Z,"link")]);r.replaceChildren(s),t.focus(),t.select()}function ke(){K=!0,G="Delete",r.replaceChildren(n("span",{},`Delete \u201C${p.name}\u201D${p.items?` and its ${F(p.items)}`:""}? This can't be undone.`),I("Delete collection",async()=>{try{await m.remove(d),e.service.refresh(),e.navigate("/")}catch(t){R("delete it",t)}},"danger"),I("Cancel",Z,"link")),r.querySelector("button")?.focus()}function j(){if(i.aborted)return;A.replaceChildren(q(n)," ",p.name),v.textContent=[y?"Yours":w&&`By ${w}`,p.public?"Public":"Private",F(p.items)].filter(Boolean).join(" \xB7 ");let t=O(e).subs.some(u=>u.id===d),s=[p.public,t].join();if(K||s===Q)return;Q=s;let l=[...r.children].findIndex(u=>u.contains(document.activeElement));if(y)r.replaceChildren(I("Upload",()=>W.click()),I("Rename",Ee),I(p.public?"Make private":"Make public",()=>pe({public:!p.public})),I("Delete",ke,"danger"));else if(x&&(p.public||t)){let u=I(t?"Unsubscribe":"Subscribe",async()=>{u.disabled=!0;try{await m.follow(d,!t),e.service.refresh(),await ce(e,1e3)}catch(k){R(t?"unsubscribe":"subscribe",k)}Q="",j()});u.setAttribute("aria-pressed",String(t)),r.replaceChildren(u)}else r.replaceChildren();let f=[...r.children];l>=0&&(f.find(u=>G&&u.textContent===G)??f[l])?.focus(),G=""}if(j(),y){o.firstElementChild.append(W);let t=s=>s.dataTransfer?.types.includes("Files");o.addEventListener("dragover",s=>t(s)&&s.preventDefault(),{signal:i}),o.addEventListener("drop",s=>{t(s)&&(s.preventDefault(),ae([...s.dataTransfer?.files??[]]))},{signal:i}),document.addEventListener("paste",s=>{let l=[...s.clipboardData?.files??[]];!l.length||document.querySelector("dialog[open]")||(s.preventDefault(),ae(l))},{signal:i})}let V="";function re(){if(!V||document.visibilityState!=="visible"||!O(e).subs.some(s=>s.id===d))return;let t=V;V="",queueMicrotask(()=>i.aborted||e.service.seen(d,t))}document.addEventListener("visibilitychange",re,{signal:i});let fe=()=>[...O(e).mine,...O(e).subs].find(t=>t.id===d),U=fe();function $e(){let t=fe();t?(p={...p,name:t.name,public:t.public,items:t.items},U&&t.last_added!==U.last_added&&Ie(),U&&t.items<U.items+(t.last_added!==U.last_added?1:0)&&Pe(),t.new&&(V=t.last_added,re())):U&&m.get(d,i).then(s=>{p={...p,...s},j()},s=>s.status===404&&b()),U=t,j()}i.addEventListener("abort",e.watch($e),{once:!0});let X="",ee=0;function be(t,s=!1){let l=xe.format(Se(t.created)),f=s||!!M&&t.created>M;f&&!s&&ee++;let u=`${t.name}${t.video?", video":""}${f?", new":""}`,k=n("button",{type:"button",class:"media-tile","aria-label":u,title:t.name,on:{click:()=>{Le(t,k)}},signal:i},[ie(e,t,i),t.video&&n("span",{"aria-hidden":"true"},"\u25B6")]),C=n("div",{class:`coll-cell${f?" new":""}`,dataset:{item:t.id}},[k]);if(x){let T=n("button",{type:"button",class:"att-save","aria-label":`Save ${t.name} to collection`,title:"Save to collection",on:{click:()=>se({...e,from:{item:t.id},opener:T})},signal:i},q(n));C.append(T)}y&&C.append(n("button",{type:"button",class:"coll-remove","aria-label":`Remove ${t.name} from the collection`,title:"Remove from collection",on:{click:()=>{Me(t,C)}},signal:i},"\xD7")),s?P.firstElementChild?.textContent===l?P.firstElementChild.after(C):(P.prepend(n("h2",{},l),C),X||=l):(l!==X&&P.append(n("h2",{},l)),X=l,P.append(C))}async function Me(t,s){try{await m.unsave(t.id)}catch(k){return R("remove it",k)}let l=[...P.querySelectorAll(".coll-cell")],f=l.indexOf(s),u=l[f+1]??l[f-1];ge(t),p={...p,items:Math.max(0,p.items-1)},j(),(u?.querySelector(".coll-remove")??r.querySelector("button"))?.focus(),e.service.refresh()}function ge(t){let s=h.items.indexOf(t);if(s<0)return;h.items.splice(s,1);let l=[...P.querySelectorAll(".coll-cell")].find(f=>f.dataset.item===t.id);if(l){let[f,u]=[l.previousElementSibling,l.nextElementSibling];l.contains(document.activeElement)&&(u?.querySelector("button")??r.querySelector("button"))?.focus(),l.remove(),f?.tagName==="H2"&&(!u||u.tagName==="H2")&&(f.remove(),u||(X=""))}h.done&&!h.items.length&&($.textContent=J())}let he=0;async function Pe(){let t=++he,s=[...h.items],l=s.at(-1),f=l&&await m.idsSince(d,l,i).catch(()=>null);if(!(!f||t!==he||i.aborted))for(let u of s.filter(k=>!f.has(k.id)))ge(u)}async function te(){let t=h;if(!t.done){$.textContent="Loading\u2026";try{let s=await t.next();if(i.aborted||t!==h)return;for(let l of s)be(l);$.textContent=t.done&&!t.items.length?J():""}catch{if(i.aborted||t!==h)return;ne.unobserve($),$.replaceChildren("Couldn't load the collection. ",I("Retry",()=>{te()},"link"));return}ne.unobserve($),t.done||ne.observe($)}}function ve(){return h=Y(e,d,i),P.replaceChildren(),X="",te()}async function Ie(){let t=h.items[0];if(!t)return ve();let s=await m.items(d,t,i,!0).catch(()=>null);if(!s||i.aborted)return;if(s.more)return ve();let l=new Set(h.items.map(u=>u.id)),f=s.items.filter(u=>!l.has(u.id));h.items.unshift(...f);for(let u of f.reverse())be(u,!0);f.length&&($.textContent="")}async function Le(t,s){let f=[...h.items].reverse().map(k=>({message:de(k),file:k.file,video:k.video})),u=h;try{let{openViewer:k}=await import("./viewer-DXT7SKOU.js");if(i.aborted)return;await k({images:f,start:f.findIndex(C=>C.message.id===t.id),more:[!u.done,!1],page:async C=>({messages:(C?await u.next():[]).map(de).reverse(),done:!C||u.done}),media:C=>[{message:C,file:C.files[0],video:u.items.find(T=>T.id===C.id)?.video??!1}],h:n,name:(C,T)=>C.file_names?.[T]??T,when:C=>`Added ${e.when(C.created)}`,fileUrl:(C,T)=>a.itemUrl({id:C.id,file:T}),...x?{onSave:(C,T,Te)=>se({...e,from:{item:C.id},opener:Te})}:{},opener:s,follow:()=>{},signal:i})}catch{window.open(a.itemUrl(t),"_blank","noopener")}}let ne=new IntersectionObserver(t=>t.some(s=>s.isIntersecting)&&void te(),{rootMargin:"400px"});i.addEventListener("abort",()=>ne.disconnect(),{once:!0}),await te(),!i.aborted&&(ee&&(z.hidden=!1,z.textContent=`${ee>=60?"60+":ee} new since your last visit`),V=h.items[0]?.created??"",re())}async function He(o){let{h:e}=o,n=new AbortController,{signal:a}=n;o.signal.addEventListener("abort",()=>L(),{signal:a});let{mine:i,subs:d}=O(o),m=[...i,...d],g=e("h2",{id:"coll-pick-title"},[q(e)," Attach from collections"]),b=m[0]?.id??"",p=m.map(c=>e("button",{type:"button",class:"coll-chip","aria-pressed":String(c.id===b),on:{click:E=>I(c.id,E.currentTarget)},signal:a},c.owner?`${c.name} \xB7 ${c.owner.name}`:c.name)),x=e("div",{class:"coll-chips",role:"group","aria-label":"Collection"},p),y=e("div",{class:"media-grid coll-grid"}),w=e("p",{class:"media-status",role:"status"}),M=e("span",{class:"coll-count","aria-live":"polite"}),h=e("button",{type:"button",disabled:!0,on:{click:()=>J()},signal:a},"Attach"),A=e("div",{class:"coll-body"},[y,w]),v=e("dialog",{class:"coll-dialog coll-pick","aria-labelledby":g.id},[e("header",{class:"media-bar"},[g,e("button",{type:"button",class:"icon-button ic i-x","aria-label":"Close",on:{click:()=>L()},signal:a})]),m.length?x:null,A,e("footer",{class:"coll-foot"},[M,h])]),r=new Map,S=Y(o,"",a);function z(){M.textContent=r.size?`${r.size} picked${r.size>=o.max?" (the most a message takes)":""}`:o.max?"":"The message has all the files it can take.",h.disabled=!r.size,h.textContent=r.size?`Attach ${r.size}`:"Attach"}function P(c){let E=e("button",{type:"button",class:"media-tile","aria-label":`${c.name}${c.video?", video":""}`,title:c.name,"aria-pressed":String(r.has(c.id)),on:{click:()=>{r.has(c.id)?r.delete(c.id):r.size<o.max&&r.set(c.id,c),E.setAttribute("aria-pressed",String(r.has(c.id))),z()}},signal:a},[ie(o,c,a),c.video&&e("span",{"aria-hidden":"true"},"\u25B6")]);return E}async function $(){if(S.done||!b)return;let c=S;w.textContent="Loading\u2026";try{let E=await c.next();if(a.aborted||c!==S)return;y.append(...E.map(P)),w.textContent=c.done&&!c.items.length?"Nothing in this collection yet.":""}catch{if(a.aborted||c!==S)return;F.unobserve(w),w.replaceChildren("Couldn't load the collection. ",e("button",{type:"button",class:"link",on:{click:()=>{$()}},signal:a},"Retry"));return}F.unobserve(w),c.done||F.observe(w)}function R(){S=Y(o,b,a),y.replaceChildren(),$()}function I(c,E){if(c!==b){b=c;for(let H of p)H.setAttribute("aria-pressed",String(H===E));E.scrollIntoView({block:"nearest",inline:"nearest"}),R()}}let F=new IntersectionObserver(c=>c.some(E=>E.isIntersecting)&&void $(),{root:A,rootMargin:"400px"});function J(){let c=[...r.values()];L(),c.length&&o.onPick(c)}function L(){a.aborted||(n.abort(),F.disconnect(),v.open&&v.close(),v.remove(),o.opener.focus())}if(v.addEventListener("close",()=>L(),{signal:a}),await N(e),!a.aborted){if(document.body.append(v),v.showModal(),z(),!m.length){w.textContent="You have no collections yet. Save images and videos from the chat to one first.";return}R(),p[0]?.focus()}}export{qe as mountCollection,Oe as openCreate,He as openPicker,se as openSave};
|
|
2
|
-
//# sourceMappingURL=lazy-
|
|
1
|
+
var oe="/api/collections/collections/records",D=o=>JSON.stringify(o),Ae="id,collection,file,name,video,poster,created";function _(o){return{get:(e,n)=>o.request(`${oe}/${e}`,{query:{expand:"owner",fields:"id,name,public,owner,items,expand.owner.name"},signal:n}),create:(e,n,a)=>o.request(oe,{method:"POST",body:{owner:e,name:n,public:a},query:{fields:"id"}}),update:(e,n)=>o.request(`${oe}/${e}`,{method:"PATCH",body:n,query:{fields:"name,public"}}),remove:e=>o.request(`${oe}/${e}`,{method:"DELETE"}),async items(e,n,a,i=!1){let d=i?">":"<",m=n?` && (created ${d} ${D(n.created)} || (created = ${D(n.created)} && id ${d} ${D(n.id)}))`:"",g={filter:`collection = ${D(e)}${m}`,sort:"-created,-id",perPage:61,skipTotal:!0,fields:Ae},{items:b}=await o.request("/api/collections/collection_items/records",{query:g,signal:a});return{items:b.slice(0,60),more:b.length>60}},async idsSince(e,n,a){let i=new Set,d=`collection = ${D(e)} && (created > ${D(n.created)} || (created = ${D(n.created)} && id >= ${D(n.id)}))`;for(let m=1;;m++){let g={filter:d,sort:"-created,-id",page:m,perPage:1e3,skipTotal:!0,fields:"id"},{items:b}=await o.request("/api/collections/collection_items/records",{query:g,signal:a});for(let p of b)i.add(p.id);if(b.length<1e3)return i}},save:(e,n)=>o.request("/api/chat/items",{method:"POST",body:{collection:e,...n}}),upload:(e,n,a)=>o.request("/api/chat/items",{method:"POST",body:{collection:e,file:n},onUpload:a}),unsave:e=>o.request(`/api/chat/items/${e}`,{method:"DELETE"}),savedIn:(e,n)=>o.request("/api/chat/saved",{query:e,signal:n}),follow:(e,n)=>o.request("/api/chat/subs",{method:"POST",body:{collection:e,on:n}})}}var le=null;function N(o){return le??=new Promise(e=>{let a=o("link",{rel:"stylesheet",href:"/assets/collections-DHJEOLHW.css",on:{load:()=>e(),error:()=>{a.remove(),le=null,e()}}});document.head.append(a)}),le}var ye=/\.(jpe?g|png|gif|webp|avif|mp4|m4v|webm|mov|ogv)$/i,Ce=".jpg,.jpeg,.png,.gif,.webp,.avif,.mp4,.m4v,.webm,.mov,.ogv",we=20*1024*1024,O=o=>o.list()??{mine:[],subs:[]};function ce(o,e){return new Promise(n=>{let a=()=>{i(),clearTimeout(d),n()},i=o.watch(a),d=setTimeout(a,e)})}function B(o){let e=o;return e?.status===0?"Can't reach the server. Check your connection.":Object.values(e?.fields??{})[0]||e?.message||"Something went wrong."}var q=o=>o("span",{class:"ci","aria-hidden":"true"}),xe=new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}),Se=o=>new Date(o.replace(" ","T"));function de(o){let{id:e,created:n,file:a,name:i}=o;return{id:e,room:"",author:"",text:"",created:n,updated:n,edited_at:"",deleted:!1,files:[a],file_names:{[a]:i}}}function ie(o,e,n){if(e.video&&!e.poster)return null;let a=o.h("img",{src:e.video?o.api.itemPosterUrl(e):o.api.itemUrl(e,"240x240"),alt:"",loading:"lazy",decoding:"async"});return e.video&&a.addEventListener("error",()=>a.remove(),{signal:n}),a}function Y(o,e,n){let a=[],i=!1,d=null;return{items:a,get done(){return i},next(){return i?Promise.resolve([]):(d??=_(o.api).items(e,a.at(-1),n).then(m=>(d=null,i=!m.more,a.push(...m.items),m.items),m=>{throw d=null,m}),d)}}}async function Oe(o){let{h:e}=o,n=new AbortController,{signal:a}=n;o.signal.addEventListener("abort",()=>y(),{signal:a});let i=e("h2",{id:"coll-create-title"},[q(e)," New collection"]),d=e("input",{required:!0,autocomplete:"off","aria-label":"Name",placeholder:"Name"}),m=e("input",{type:"checkbox",role:"switch",class:"switch"}),g=e("p",{class:"coll-status",role:"alert"}),b=e("button",{type:"submit",class:"primary"},"Create"),p=e("form",{class:"coll-body",on:{submit:async w=>{if(w.preventDefault(),!b.disabled){b.disabled=!0,g.textContent="";try{let{id:M}=await _(o.api).create(o.me()?.id??"",d.value,m.checked);o.service.refresh(),y(!1),o.onCreated(M)}catch(M){g.textContent=B(M)}finally{b.disabled=!1}}}},signal:a},[e("p",{class:"coll-new-form"},[d,b]),e("label",{class:"coll-public"},[m,"Public: anyone can see it and subscribe"]),g]),x=e("dialog",{class:"coll-dialog coll-create","aria-labelledby":i.id},[e("header",{class:"media-bar"},[i,e("button",{type:"button",class:"icon-button ic i-x","aria-label":"Close",on:{click:()=>y()},signal:a})]),p]);function y(w=!0){a.aborted||(n.abort(),x.open&&x.close(),x.remove(),w&&o.opener.focus())}x.addEventListener("close",()=>y(),{signal:a}),await N(e),!a.aborted&&(document.body.append(x),x.showModal(),d.focus())}var ue=null;async function se(o){ue?.();let{h:e}=o,n=_(o.api),a=new AbortController,{signal:i}=a;o.signal.addEventListener("abort",()=>A(),{signal:i});let d=e("h2",{id:"coll-save-title"},[q(e)," Save to collection"]),m=e("ul",{class:"coll-choices"}),g=e("p",{class:"coll-status",role:"status"},"Loading\u2026"),b=e("input",{placeholder:"New collection","aria-label":"New collection name",autocomplete:"off"}),p=e("form",{class:"coll-new-form",on:{submit:async v=>{if(v.preventDefault(),!!b.value.trim())try{let r=(await n.create(o.me()?.id??"",b.value,!1)).id;b.value="",await M(r,!0)}catch(r){g.textContent=B(r)}}},signal:i},[b,e("button",{type:"submit"},"Create")]),x=e("dialog",{class:"coll-dialog coll-save","aria-labelledby":d.id},[e("header",{class:"media-bar"},[d,e("button",{type:"button",class:"icon-button ic i-x","aria-label":"Close",on:{click:()=>A()},signal:i})]),e("div",{class:"coll-body"},[m,g,p])]),y={},w=new Map;async function M(v,r){w.set(v,r),g.textContent=r?"Saving\u2026":"Removing\u2026",h();try{r?y[v]=(await n.save(v,o.from)).id:y[v]&&(await n.unsave(y[v]),delete y[v]),g.textContent=r?"Saved.":"Removed.",o.service.refresh()}catch(S){S.status===409?y=await n.savedIn(o.from,i).catch(()=>y):g.textContent=B(S)}w.delete(v),h()}function h(){let v=O(o).mine;m.replaceChildren(...v.map(r=>{let S=e("input",{type:"checkbox",checked:w.get(r.id)??!!y[r.id],disabled:w.has(r.id)});return S.addEventListener("change",()=>{M(r.id,S.checked)},{signal:i}),e("li",{"aria-busy":w.has(r.id)?"true":"false"},e("label",{},[S," ",r.name,e("span",{class:"coll-meta"},r.public?" \xB7 Public: anyone can see it":" \xB7 Private"),w.has(r.id)?e("span",{class:"coll-spin","aria-hidden":"true"}):null]))})),!v.length&&g.textContent===""&&(g.textContent="You have no collections yet. Make one:")}function A(){i.aborted||(a.abort(),ue=null,x.open&&x.close(),x.remove(),o.opener.setAttribute("aria-expanded","false"),o.opener.focus())}if(ue=A,x.addEventListener("close",()=>A(),{signal:i}),i.addEventListener("abort",o.watch(h),{once:!0}),await N(e),!i.aborted){document.body.append(x),x.showModal(),o.opener.setAttribute("aria-expanded","true");try{y=await n.savedIn(o.from,i),g.textContent=""}catch(v){if(i.aborted)return;g.textContent=B(v)}h(),(m.querySelector("input")??b).focus()}}async function qe(o,e){let{h:n,api:a,signal:i,id:d}=e,m=_(a),[,g]=await Promise.all([N(n),m.get(d,i).catch(()=>null),(async()=>{e.me()&&!e.list()&&await ce(e,2e3)})()]);if(i.aborted)return;function b(){o.replaceChildren(n("section",{class:"collection not-found"},[n("h1",{},[q(n)," This collection doesn't exist."]),n("p",{},["It may be private, or deleted. ",n("a",{href:"/"},"Back to rooms")])]))}if(!g)return b();let p=g,x=e.me(),y=!!x&&p.owner===x.id,w=g.expand?.owner?.name??"",M=O(e).subs.find(t=>t.id===d)?.seen_at??"",h=Y(e,d,i),A=n("h1",{id:"coll-title"}),v=n("p",{class:"coll-meta"}),r=n("div",{class:"coll-actions"}),S=n("p",{class:"coll-notice",role:"status"}),z=n("p",{class:"coll-new",hidden:!0}),P=n("div",{class:"media-grid coll-grid"}),$=n("p",{class:"media-status",role:"status"});o.replaceChildren(n("section",{class:"collection","aria-labelledby":"coll-title"},[n("header",{class:`coll-head t${d.charCodeAt(0)%4}`},[n("a",{href:"/",class:"back ic i-back","aria-label":"Back to rooms"}),A,v,r,S]),z,P,$]));let R=(t,s)=>{S.textContent=`Couldn't ${t}. ${B(s)}`},I=(t,s,l="")=>n("button",{type:"button",class:l,on:{click:()=>{s()}},signal:i},t),F=t=>`${t} ${t===1?"item":"items"}`,J=()=>y?"Nothing here yet. Upload images and videos, or save them from the chat.":"Nothing here yet.",L=[],c=0,E=!1,H=[],W=n("input",{type:"file",multiple:!0,accept:Ce,hidden:!0,on:{change:()=>{ae([...W.files??[]]),W.value=""}},signal:i});function ae(t){for(let s of t)ye.test(s.name)?s.size>we?H.push(`${s.name}: larger than 20 MB`):L.push(s):H.push(`${s.name}: not an image or video`);if(!E){if(!L.length)return me();E=!0,(async()=>{for(;L.length&&!i.aborted;){let s=L[0],l=`Uploading ${c+1} of ${c+L.length}\u2026`;S.textContent=l;try{await m.upload(d,s,f=>S.textContent=`${l} ${Math.round(f*100)}%`)}catch(f){if(f.status===429){S.textContent="Waiting for the server\u2026",await new Promise(u=>setTimeout(u,1e4));continue}H.push(`${s.name}: ${B(f)}`)}L.shift(),c++,e.service.refresh()}c=0,E=!1,me()})()}}function me(){S.textContent=H.length?`Couldn't upload ${H.join("; ")}`:"",H=[]}let K=!1,G="",Q="";function Z(){K=!1,Q="",j()}async function pe(t){try{return p={...p,...await m.update(d,t)},S.textContent="",e.service.refresh(),Z(),!0}catch(s){return R("save",s),!1}}function Ee(){K=!0,G="Rename";let t=n("input",{value:p.name,"aria-label":"Collection name",autocomplete:"off"}),s=n("form",{class:"coll-rename",on:{submit:l=>{l.preventDefault(),pe({name:t.value})},keydown:l=>l.key==="Escape"&&Z()},signal:i},[t,n("button",{type:"submit"},"Save"),I("Cancel",Z,"link")]);r.replaceChildren(s),t.focus(),t.select()}function ke(){K=!0,G="Delete",r.replaceChildren(n("span",{},`Delete \u201C${p.name}\u201D${p.items?` and its ${F(p.items)}`:""}? This can't be undone.`),I("Delete collection",async()=>{try{await m.remove(d),e.service.refresh(),e.navigate("/")}catch(t){R("delete it",t)}},"danger"),I("Cancel",Z,"link")),r.querySelector("button")?.focus()}function j(){if(i.aborted)return;A.replaceChildren(q(n)," ",p.name),v.textContent=[y?"Yours":w&&`By ${w}`,p.public?"Public":"Private",F(p.items)].filter(Boolean).join(" \xB7 ");let t=O(e).subs.some(u=>u.id===d),s=[p.public,t].join();if(K||s===Q)return;Q=s;let l=[...r.children].findIndex(u=>u.contains(document.activeElement));if(y)r.replaceChildren(I("Upload",()=>W.click()),I("Rename",Ee),I(p.public?"Make private":"Make public",()=>pe({public:!p.public})),I("Delete",ke,"danger"));else if(x&&(p.public||t)){let u=I(t?"Unsubscribe":"Subscribe",async()=>{u.disabled=!0;try{await m.follow(d,!t),e.service.refresh(),await ce(e,1e3)}catch(k){R(t?"unsubscribe":"subscribe",k)}Q="",j()});u.setAttribute("aria-pressed",String(t)),r.replaceChildren(u)}else r.replaceChildren();let f=[...r.children];l>=0&&(f.find(u=>G&&u.textContent===G)??f[l])?.focus(),G=""}if(j(),y){o.firstElementChild.append(W);let t=s=>s.dataTransfer?.types.includes("Files");o.addEventListener("dragover",s=>t(s)&&s.preventDefault(),{signal:i}),o.addEventListener("drop",s=>{t(s)&&(s.preventDefault(),ae([...s.dataTransfer?.files??[]]))},{signal:i}),document.addEventListener("paste",s=>{let l=[...s.clipboardData?.files??[]];!l.length||document.querySelector("dialog[open]")||(s.preventDefault(),ae(l))},{signal:i})}let V="";function re(){if(!V||document.visibilityState!=="visible"||!O(e).subs.some(s=>s.id===d))return;let t=V;V="",queueMicrotask(()=>i.aborted||e.service.seen(d,t))}document.addEventListener("visibilitychange",re,{signal:i});let fe=()=>[...O(e).mine,...O(e).subs].find(t=>t.id===d),U=fe();function $e(){let t=fe();t?(p={...p,name:t.name,public:t.public,items:t.items},U&&t.last_added!==U.last_added&&Ie(),U&&t.items<U.items+(t.last_added!==U.last_added?1:0)&&Pe(),t.new&&(V=t.last_added,re())):U&&m.get(d,i).then(s=>{p={...p,...s},j()},s=>s.status===404&&b()),U=t,j()}i.addEventListener("abort",e.watch($e),{once:!0});let X="",ee=0;function be(t,s=!1){let l=xe.format(Se(t.created)),f=s||!!M&&t.created>M;f&&!s&&ee++;let u=`${t.name}${t.video?", video":""}${f?", new":""}`,k=n("button",{type:"button",class:"media-tile","aria-label":u,title:t.name,on:{click:()=>{Le(t,k)}},signal:i},[ie(e,t,i),t.video&&n("span",{class:"att-play","aria-hidden":"true"})]),C=n("div",{class:`coll-cell${f?" new":""}`,dataset:{item:t.id}},[k]);if(x){let T=n("button",{type:"button",class:"att-save","aria-label":`Save ${t.name} to collection`,title:"Save to collection",on:{click:()=>se({...e,from:{item:t.id},opener:T})},signal:i},q(n));C.append(T)}y&&C.append(n("button",{type:"button",class:"coll-remove","aria-label":`Remove ${t.name} from the collection`,title:"Remove from collection",on:{click:()=>{Me(t,C)}},signal:i},"\xD7")),s?P.firstElementChild?.textContent===l?P.firstElementChild.after(C):(P.prepend(n("h2",{},l),C),X||=l):(l!==X&&P.append(n("h2",{},l)),X=l,P.append(C))}async function Me(t,s){try{await m.unsave(t.id)}catch(k){return R("remove it",k)}let l=[...P.querySelectorAll(".coll-cell")],f=l.indexOf(s),u=l[f+1]??l[f-1];ge(t),p={...p,items:Math.max(0,p.items-1)},j(),(u?.querySelector(".coll-remove")??r.querySelector("button"))?.focus(),e.service.refresh()}function ge(t){let s=h.items.indexOf(t);if(s<0)return;h.items.splice(s,1);let l=[...P.querySelectorAll(".coll-cell")].find(f=>f.dataset.item===t.id);if(l){let[f,u]=[l.previousElementSibling,l.nextElementSibling];l.contains(document.activeElement)&&(u?.querySelector("button")??r.querySelector("button"))?.focus(),l.remove(),f?.tagName==="H2"&&(!u||u.tagName==="H2")&&(f.remove(),u||(X=""))}h.done&&!h.items.length&&($.textContent=J())}let he=0;async function Pe(){let t=++he,s=[...h.items],l=s.at(-1),f=l&&await m.idsSince(d,l,i).catch(()=>null);if(!(!f||t!==he||i.aborted))for(let u of s.filter(k=>!f.has(k.id)))ge(u)}async function te(){let t=h;if(!t.done){$.textContent="Loading\u2026";try{let s=await t.next();if(i.aborted||t!==h)return;for(let l of s)be(l);$.textContent=t.done&&!t.items.length?J():""}catch{if(i.aborted||t!==h)return;ne.unobserve($),$.replaceChildren("Couldn't load the collection. ",I("Retry",()=>{te()},"link"));return}ne.unobserve($),t.done||ne.observe($)}}function ve(){return h=Y(e,d,i),P.replaceChildren(),X="",te()}async function Ie(){let t=h.items[0];if(!t)return ve();let s=await m.items(d,t,i,!0).catch(()=>null);if(!s||i.aborted)return;if(s.more)return ve();let l=new Set(h.items.map(u=>u.id)),f=s.items.filter(u=>!l.has(u.id));h.items.unshift(...f);for(let u of f.reverse())be(u,!0);f.length&&($.textContent="")}async function Le(t,s){let f=[...h.items].reverse().map(k=>({message:de(k),file:k.file,video:k.video})),u=h;try{let{openViewer:k}=await import("./viewer-DXT7SKOU.js");if(i.aborted)return;await k({images:f,start:f.findIndex(C=>C.message.id===t.id),more:[!u.done,!1],page:async C=>({messages:(C?await u.next():[]).map(de).reverse(),done:!C||u.done}),media:C=>[{message:C,file:C.files[0],video:u.items.find(T=>T.id===C.id)?.video??!1}],h:n,name:(C,T)=>C.file_names?.[T]??T,when:C=>`Added ${e.when(C.created)}`,fileUrl:(C,T)=>a.itemUrl({id:C.id,file:T}),...x?{onSave:(C,T,Te)=>se({...e,from:{item:C.id},opener:Te})}:{},opener:s,follow:()=>{},signal:i})}catch{window.open(a.itemUrl(t),"_blank","noopener")}}let ne=new IntersectionObserver(t=>t.some(s=>s.isIntersecting)&&void te(),{rootMargin:"400px"});i.addEventListener("abort",()=>ne.disconnect(),{once:!0}),await te(),!i.aborted&&(ee&&(z.hidden=!1,z.textContent=`${ee>=60?"60+":ee} new since your last visit`),V=h.items[0]?.created??"",re())}async function He(o){let{h:e}=o,n=new AbortController,{signal:a}=n;o.signal.addEventListener("abort",()=>L(),{signal:a});let{mine:i,subs:d}=O(o),m=[...i,...d],g=e("h2",{id:"coll-pick-title"},[q(e)," Attach from collections"]),b=m[0]?.id??"",p=m.map(c=>e("button",{type:"button",class:"coll-chip","aria-pressed":String(c.id===b),on:{click:E=>I(c.id,E.currentTarget)},signal:a},c.owner?`${c.name} \xB7 ${c.owner.name}`:c.name)),x=e("div",{class:"coll-chips",role:"group","aria-label":"Collection"},p),y=e("div",{class:"media-grid coll-grid"}),w=e("p",{class:"media-status",role:"status"}),M=e("span",{class:"coll-count","aria-live":"polite"}),h=e("button",{type:"button",disabled:!0,on:{click:()=>J()},signal:a},"Attach"),A=e("div",{class:"coll-body"},[y,w]),v=e("dialog",{class:"coll-dialog coll-pick","aria-labelledby":g.id},[e("header",{class:"media-bar"},[g,e("button",{type:"button",class:"icon-button ic i-x","aria-label":"Close",on:{click:()=>L()},signal:a})]),m.length?x:null,A,e("footer",{class:"coll-foot"},[M,h])]),r=new Map,S=Y(o,"",a);function z(){M.textContent=r.size?`${r.size} picked${r.size>=o.max?" (the most a message takes)":""}`:o.max?"":"The message has all the files it can take.",h.disabled=!r.size,h.textContent=r.size?`Attach ${r.size}`:"Attach"}function P(c){let E=e("button",{type:"button",class:"media-tile","aria-label":`${c.name}${c.video?", video":""}`,title:c.name,"aria-pressed":String(r.has(c.id)),on:{click:()=>{r.has(c.id)?r.delete(c.id):r.size<o.max&&r.set(c.id,c),E.setAttribute("aria-pressed",String(r.has(c.id))),z()}},signal:a},[ie(o,c,a),c.video&&e("span",{class:"att-play","aria-hidden":"true"})]);return E}async function $(){if(S.done||!b)return;let c=S;w.textContent="Loading\u2026";try{let E=await c.next();if(a.aborted||c!==S)return;y.append(...E.map(P)),w.textContent=c.done&&!c.items.length?"Nothing in this collection yet.":""}catch{if(a.aborted||c!==S)return;F.unobserve(w),w.replaceChildren("Couldn't load the collection. ",e("button",{type:"button",class:"link",on:{click:()=>{$()}},signal:a},"Retry"));return}F.unobserve(w),c.done||F.observe(w)}function R(){S=Y(o,b,a),y.replaceChildren(),$()}function I(c,E){if(c!==b){b=c;for(let H of p)H.setAttribute("aria-pressed",String(H===E));E.scrollIntoView({block:"nearest",inline:"nearest"}),R()}}let F=new IntersectionObserver(c=>c.some(E=>E.isIntersecting)&&void $(),{root:A,rootMargin:"400px"});function J(){let c=[...r.values()];L(),c.length&&o.onPick(c)}function L(){a.aborted||(n.abort(),F.disconnect(),v.open&&v.close(),v.remove(),o.opener.focus())}if(v.addEventListener("close",()=>L(),{signal:a}),await N(e),!a.aborted){if(document.body.append(v),v.showModal(),z(),!m.length){w.textContent="You have no collections yet. Save images and videos from the chat to one first.";return}R(),p[0]?.focus()}}export{qe as mountCollection,Oe as openCreate,He as openPicker,se as openSave};
|
|
2
|
+
//# sourceMappingURL=lazy-4CXRBHHM.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../web/src/views/collection/calls.ts", "../../web/src/views/collection/shared.ts", "../../web/src/views/collection/create.ts", "../../web/src/views/collection/save.ts", "../../web/src/views/collection/page.ts", "../../web/src/views/collection/picker.ts"],
|
|
4
|
+
"sourcesContent": ["// The collections' requests (\u00A731), through Api.request: app.js doesn't carry them. ITEM_FIELDS is shared/contract.json's\n// (tests/unit/contract.test.ts).\n\nimport type { Api } from \"../../api.ts\";\nimport type { CollectionItem } from \"../../lib/types.ts\";\n\n/** What a collection's page shows of it. */\nexport interface Meta {\n id: string;\n name: string;\n public: boolean;\n owner: string;\n items: number;\n}\n\n/** A message's file (the one that has it: a forward's original, \u00A721.3), or an item. */\nexport type From = { message: string; file: string } | { item: string };\n\n/** A collection's page of items, as the media grid's (\u00A730.2). */\nexport const PAGE = 60;\n\nexport const RECORDS = \"/api/collections/collections/records\";\n\n/** A value in a records filter (ids and dates here), quoted and escaped. */\nexport const lit = (v: string) => JSON.stringify(v);\n\n/** What a page of items asks for (shared/contract.json). */\nexport const ITEM_FIELDS = \"id,collection,file,name,video,poster,created\";\n\n/** The requests of the page, the menu and the picker. */\nexport function calls(api: Api) {\n return {\n /** The collection, with its owner's name (guests can't look users up). */\n get: (id: string, signal: AbortSignal) =>\n api.request<Meta & { expand?: { owner?: { name: string } } }>(`${RECORDS}/${id}`, {\n query: { expand: \"owner\", fields: \"id,name,public,owner,items,expand.owner.name\" },\n signal,\n }),\n create: (owner: string, name: string, isPublic: boolean) =>\n api.request<{ id: string }>(RECORDS, { method: \"POST\", body: { owner, name, public: isPublic }, query: { fields: \"id\" } }),\n update: (id: string, body: { name?: string; public?: boolean }) =>\n api.request<Pick<Meta, \"name\" | \"public\">>(`${RECORDS}/${id}`, { method: \"PATCH\", body, query: { fields: \"name,public\" } }),\n remove: (id: string) => api.request(`${RECORDS}/${id}`, { method: \"DELETE\" }),\n /**\n * A page of a collection's items, newest first: older than `after` (the oldest shown), or the newest; with\n * `newer`, those added after `after` (the newest shown).\n */\n async items(collection: string, after: CollectionItem | undefined, signal: AbortSignal, newer = false) {\n const op = newer ? \">\" : \"<\";\n const cursor = after\n ? ` && (created ${op} ${lit(after.created)} || (created = ${lit(after.created)} && id ${op} ${lit(after.id)}))`\n : \"\";\n const query = {\n filter: `collection = ${lit(collection)}${cursor}`,\n sort: \"-created,-id\",\n perPage: PAGE + 1,\n skipTotal: true,\n fields: ITEM_FIELDS,\n };\n const { items } = await api.request<{ items: CollectionItem[] }>(\"/api/collections/collection_items/records\", { query, signal });\n return { items: items.slice(0, PAGE), more: items.length > PAGE };\n },\n /** The ids of a collection's items from `oldest` on (it included): which of those shown are still there. */\n async idsSince(collection: string, oldest: CollectionItem, signal: AbortSignal) {\n const ids = new Set<string>();\n const filter = `collection = ${lit(collection)} && (created > ${lit(oldest.created)} || (created = ${lit(oldest.created)} && id >= ${lit(oldest.id)}))`;\n for (let page = 1; ; page++) {\n const query = { filter, sort: \"-created,-id\", page, perPage: 1000, skipTotal: true, fields: \"id\" };\n const { items } = await api.request<{ items: { id: string }[] }>(\"/api/collections/collection_items/records\", { query, signal });\n for (const x of items) ids.add(x.id);\n if (items.length < 1000) return ids;\n }\n },\n /** A copy of a message's file or of an item in a collection of yours. 409: it is in there already. */\n save: (collection: string, from: From) =>\n api.request<CollectionItem>(\"/api/chat/items\", { method: \"POST\", body: { collection, ...from } }),\n /** An image or video of your own, uploaded straight into a collection of yours. */\n upload: (collection: string, file: File, onUpload: (fraction: number) => void) =>\n api.request<CollectionItem>(\"/api/chat/items\", { method: \"POST\", body: { collection, file }, onUpload }),\n unsave: (item: string) => api.request(`/api/chat/items/${item}`, { method: \"DELETE\" }),\n /** Your collections that have the file already: collection id \u2192 item id. */\n savedIn: (from: From, signal: AbortSignal) => api.request<Record<string, string>>(\"/api/chat/saved\", { query: from, signal }),\n follow: (collection: string, on: boolean) => api.request(\"/api/chat/subs\", { method: \"POST\", body: { collection, on } }),\n };\n}\n", "// What the collections' chunk (lazy.ts) shares between its parts: the options every part gets, the stylesheet, and the\n// helpers for tiles, pages of items and errors.\n\nimport type { Api } from \"../../api.ts\";\nimport type { CollectionsService } from \"../../collections.ts\";\nimport type { h as H } from \"../../dom.ts\";\nimport type { CollectionItem, Collections, Message, User } from \"../../lib/types.ts\";\nimport { calls } from \"./calls.ts\";\n\n/** The stylesheet's URL, set by the build (scripts/lib/build-utils.mjs). */\ndeclare const COLLECTIONS_CSS: string;\n\nexport interface Base {\n api: Api;\n h: typeof H;\n service: CollectionsService;\n me: () => User | null;\n /** Yours and those you follow, as the store has them: null until they are loaded. */\n list: () => Collections | null;\n /** Call `fn` when they change; returns the unsubscribe. */\n watch: (fn: () => void) => () => void;\n /** When an item was added, for the viewer. */\n when: (created: string) => string;\n signal: AbortSignal;\n}\n\nlet stylesheet: Promise<void> | null = null;\nexport function loadStylesheet(h: typeof H): Promise<void> {\n stylesheet ??= new Promise((resolve) => {\n const failed = () => {\n link.remove();\n stylesheet = null;\n resolve();\n };\n const link = h(\"link\", { rel: \"stylesheet\", href: COLLECTIONS_CSS, on: { load: () => resolve(), error: failed } });\n document.head.append(link);\n });\n return stylesheet;\n}\n\n/** What can be uploaded into a collection: the images and videos of lib/files.ts (not imported: app.js has it), at most 20 MB. */\nexport const MEDIA = /\\.(jpe?g|png|gif|webp|avif|mp4|m4v|webm|mov|ogv)$/i;\nexport const ACCEPT = \".jpg,.jpeg,.png,.gif,.webp,.avif,.mp4,.m4v,.webm,.mov,.ogv\";\nexport const MAX_BYTES = 20 * 1024 * 1024;\n\n/** Yours and those you follow (none until they are loaded). */\nexport const lists = (o: Base): Collections => o.list() ?? { mine: [], subs: [] };\n\n/** The next change of the collections in the store, or `ms` without one. */\nexport function changed(o: Base, ms: number): Promise<void> {\n return new Promise((resolve) => {\n const done = () => {\n off();\n clearTimeout(timer);\n resolve();\n };\n const off = o.watch(done);\n const timer = setTimeout(done, ms);\n });\n}\n\n/** Why a request failed, in words: the server's reason for a field when it gave one. */\nexport function reason(e: unknown): string {\n const err = e as { fields?: Record<string, string>; message?: string; status?: number };\n if (err?.status === 0) return \"Can't reach the server. Check your connection.\";\n return Object.values(err?.fields ?? {})[0] || err?.message || \"Something went wrong.\";\n}\n\nexport const icon = (h: typeof H) => h(\"span\", { class: \"ci\", \"aria-hidden\": \"true\" });\nexport const monthOf = new Intl.DateTimeFormat(undefined, { month: \"long\", year: \"numeric\" });\nexport const dateOf = (created: string) => new Date(created.replace(\" \", \"T\"));\n\n/** An item as the viewer takes it: a message of its own with one file. */\nexport function asMessage(it: CollectionItem): Message {\n const { id, created, file, name } = it;\n return {\n id,\n room: \"\",\n author: \"\",\n text: \"\",\n created,\n updated: created,\n edited_at: \"\",\n deleted: false,\n files: [file],\n file_names: { [file]: name },\n };\n}\n\n/** A square tile's picture: the grid thumbnail, a video's poster, or nothing (a plain tile with the play badge). */\nexport function picture(b: Base, it: CollectionItem, signal: AbortSignal): HTMLImageElement | null {\n if (it.video && !it.poster) return null;\n const img = b.h(\"img\", {\n src: it.video ? b.api.itemPosterUrl(it) : b.api.itemUrl(it, \"240x240\"),\n alt: \"\",\n loading: \"lazy\",\n decoding: \"async\",\n });\n // A poster that fails leaves the plain tile.\n if (it.video) img.addEventListener(\"error\", () => img.remove(), { signal });\n return img;\n}\n\n/** A collection's items a page at a time, newest first. */\nexport function pager(b: Base, collection: string, signal: AbortSignal) {\n const items: CollectionItem[] = [];\n let done = false;\n let loading: Promise<CollectionItem[]> | null = null;\n return {\n items,\n get done() {\n return done;\n },\n /** The next page (the same one while it loads); rejects when it fails. */\n next(): Promise<CollectionItem[]> {\n if (done) return Promise.resolve([]);\n loading ??= calls(b.api)\n .items(collection, items.at(-1), signal)\n .then(\n (page: { items: CollectionItem[]; more: boolean }) => {\n loading = null;\n done = !page.more;\n items.push(...page.items);\n return page.items;\n },\n (e: unknown) => {\n loading = null;\n throw e;\n },\n );\n return loading!;\n },\n };\n}\n", "// A new collection (\u00A731): the sidebar's \"+\".\n\nimport { calls } from \"./calls.ts\";\nimport { type Base, icon, loadStylesheet, reason } from \"./shared.ts\";\n\nexport interface CreateOptions extends Base {\n opener: HTMLElement;\n /** Made: e.g. go to its page. */\n onCreated: (id: string) => void;\n}\n\n/** The sidebar's \"+\" (\u00A731): a name, and whether anyone may see it. */\nexport async function openCreate(o: CreateOptions): Promise<void> {\n const { h } = o;\n const scope = new AbortController();\n const { signal } = scope;\n o.signal.addEventListener(\"abort\", () => close(), { signal });\n const title = h(\"h2\", { id: \"coll-create-title\" }, [icon(h), \" New collection\"]);\n const input = h(\"input\", { required: true, autocomplete: \"off\", \"aria-label\": \"Name\", placeholder: \"Name\" });\n // A switch, as Settings' choices are.\n const pub = h(\"input\", { type: \"checkbox\", role: \"switch\", class: \"switch\" });\n const err = h(\"p\", { class: \"coll-status\", role: \"alert\" });\n const submit = h(\"button\", { type: \"submit\", class: \"primary\" }, \"Create\");\n const form = h(\n \"form\",\n {\n class: \"coll-body\",\n on: {\n submit: async (e) => {\n e.preventDefault();\n if (submit.disabled) return;\n submit.disabled = true;\n err.textContent = \"\";\n try {\n const { id } = await calls(o.api).create(o.me()?.id ?? \"\", input.value, pub.checked);\n o.service.refresh();\n close(false);\n o.onCreated(id);\n } catch (e) {\n err.textContent = reason(e);\n } finally {\n submit.disabled = false;\n }\n },\n },\n signal,\n },\n [\n h(\"p\", { class: \"coll-new-form\" }, [input, submit]),\n h(\"label\", { class: \"coll-public\" }, [pub, \"Public: anyone can see it and subscribe\"]),\n err,\n ],\n );\n const dialog = h(\"dialog\", { class: \"coll-dialog coll-create\", \"aria-labelledby\": title.id }, [\n h(\"header\", { class: \"media-bar\" }, [\n title,\n h(\"button\", { type: \"button\", class: \"icon-button ic i-x\", \"aria-label\": \"Close\", on: { click: () => close() }, signal }),\n ]),\n form,\n ]);\n function close(refocus = true) {\n if (signal.aborted) return;\n scope.abort();\n if (dialog.open) dialog.close();\n dialog.remove();\n if (refocus) o.opener.focus();\n }\n dialog.addEventListener(\"close\", () => close(), { signal });\n await loadStylesheet(h);\n if (signal.aborted) return;\n document.body.append(dialog);\n dialog.showModal();\n input.focus();\n}\n", "// The save menu (\u00A731): which of your collections have a file; tick to add, untick to take out, or make a new one.\n\nimport type { Collection } from \"../../lib/types.ts\";\nimport type { From } from \"./calls.ts\";\nimport { calls } from \"./calls.ts\";\nimport { type Base, icon, lists, loadStylesheet, reason } from \"./shared.ts\";\n\nexport interface SaveOptions extends Base {\n from: From;\n /** Gets focus back on close. */\n opener: HTMLElement;\n}\n\n/** One save menu at a time. */\nlet saving: (() => void) | null = null;\n\nexport async function openSave(o: SaveOptions): Promise<void> {\n saving?.();\n const { h } = o;\n const call = calls(o.api);\n const scope = new AbortController();\n const { signal } = scope;\n o.signal.addEventListener(\"abort\", () => close(), { signal });\n const title = h(\"h2\", { id: \"coll-save-title\" }, [icon(h), \" Save to collection\"]);\n const list = h(\"ul\", { class: \"coll-choices\" });\n const status = h(\"p\", { class: \"coll-status\", role: \"status\" }, \"Loading\u2026\");\n const input = h(\"input\", { placeholder: \"New collection\", \"aria-label\": \"New collection name\", autocomplete: \"off\" });\n const form = h(\n \"form\",\n {\n class: \"coll-new-form\",\n on: {\n submit: async (e) => {\n e.preventDefault();\n if (!input.value.trim()) return;\n try {\n const id = (await call.create(o.me()?.id ?? \"\", input.value, false)).id;\n input.value = \"\";\n await toggle(id, true);\n } catch (err) {\n status.textContent = reason(err);\n }\n },\n },\n signal,\n },\n [input, h(\"button\", { type: \"submit\" }, \"Create\")],\n );\n const dialog = h(\"dialog\", { class: \"coll-dialog coll-save\", \"aria-labelledby\": title.id }, [\n h(\"header\", { class: \"media-bar\" }, [\n title,\n h(\"button\", { type: \"button\", class: \"icon-button ic i-x\", \"aria-label\": \"Close\", on: { click: () => close() }, signal }),\n ]),\n h(\"div\", { class: \"coll-body\" }, [list, status, form]),\n ]);\n /** Collection id \u2192 the item there (ticked). */\n let saved: Record<string, string> = {};\n /** Collection id \u2192 ticked or unticked, while that is saving. */\n const busy = new Map<string, boolean>();\n\n async function toggle(id: string, on: boolean) {\n busy.set(id, on);\n status.textContent = on ? \"Saving\u2026\" : \"Removing\u2026\";\n render();\n try {\n if (on) saved[id] = (await call.save(id, o.from)).id;\n else if (saved[id]) {\n await call.unsave(saved[id]);\n delete saved[id];\n }\n status.textContent = on ? \"Saved.\" : \"Removed.\";\n o.service.refresh();\n } catch (e) {\n // In there already (another tab): it is ticked.\n if ((e as { status?: number }).status === 409) saved = await call.savedIn(o.from, signal).catch(() => saved);\n else status.textContent = reason(e);\n }\n busy.delete(id);\n render();\n }\n\n function render() {\n const mine = lists(o).mine;\n list.replaceChildren(\n ...mine.map((c: Collection) => {\n const box = h(\"input\", { type: \"checkbox\", checked: busy.get(c.id) ?? !!saved[c.id], disabled: busy.has(c.id) });\n box.addEventListener(\"change\", () => void toggle(c.id, box.checked), { signal });\n // Saving copies the file on the server, which can take a while: a spinner on the row until it is done.\n return h(\n \"li\",\n { \"aria-busy\": busy.has(c.id) ? \"true\" : \"false\" },\n h(\"label\", {}, [\n box,\n \" \",\n c.name,\n h(\"span\", { class: \"coll-meta\" }, c.public ? \" \u00B7 Public: anyone can see it\" : \" \u00B7 Private\"),\n busy.has(c.id) ? h(\"span\", { class: \"coll-spin\", \"aria-hidden\": \"true\" }) : null,\n ]),\n );\n }),\n );\n if (!mine.length && status.textContent === \"\") status.textContent = \"You have no collections yet. Make one:\";\n }\n\n function close() {\n if (signal.aborted) return;\n scope.abort();\n saving = null;\n if (dialog.open) dialog.close();\n dialog.remove();\n o.opener.setAttribute(\"aria-expanded\", \"false\");\n o.opener.focus();\n }\n saving = close;\n dialog.addEventListener(\"close\", () => close(), { signal });\n signal.addEventListener(\"abort\", o.watch(render), { once: true });\n\n await loadStylesheet(h);\n if (signal.aborted) return;\n document.body.append(dialog);\n dialog.showModal();\n o.opener.setAttribute(\"aria-expanded\", \"true\");\n try {\n saved = await call.savedIn(o.from, signal);\n status.textContent = \"\";\n } catch (e) {\n if (signal.aborted) return;\n status.textContent = reason(e);\n }\n render();\n (list.querySelector(\"input\") ?? input).focus();\n}\n", "// A collection's page (/c/:id, \u00A731): its items as a grid like the media grid's, newest first under month headings, what\n// is new since you last looked highlighted.\n\nimport type { CollectionItem, Message } from \"../../lib/types.ts\";\nimport type { ViewerImage } from \"../room/viewer.ts\";\nimport { calls, type Meta } from \"./calls.ts\";\nimport { openSave } from \"./save.ts\";\nimport {\n ACCEPT,\n asMessage,\n type Base,\n changed,\n dateOf,\n icon,\n lists,\n loadStylesheet,\n MAX_BYTES,\n MEDIA,\n monthOf,\n pager,\n picture,\n reason,\n} from \"./shared.ts\";\n\nexport interface PageOptions extends Base {\n id: string;\n navigate: (path: string) => void;\n}\n\nexport async function mountCollection(root: HTMLElement, o: PageOptions): Promise<void> {\n const { h, api, signal, id } = o;\n const call = calls(api);\n const [, meta] = await Promise.all([\n loadStylesheet(h),\n call.get(id, signal).catch(() => null),\n (async () => {\n // Your subscription's `seen_at` decides what is new: wait for the store to have it (just after a reload).\n if (o.me() && !o.list()) {\n await changed(o, 2000);\n }\n })(),\n ]);\n if (signal.aborted) return;\n /** Not there (any more), or not yours to see. */\n function gone() {\n root.replaceChildren(\n h(\"section\", { class: \"collection not-found\" }, [\n h(\"h1\", {}, [icon(h), \" This collection doesn't exist.\"]),\n h(\"p\", {}, [\"It may be private, or deleted. \", h(\"a\", { href: \"/\" }, \"Back to rooms\")]),\n ]),\n );\n }\n if (!meta) return gone();\n let info: Meta = meta;\n const me = o.me();\n const mine = !!me && info.owner === me.id;\n const ownerName = meta.expand?.owner?.name ?? \"\";\n const seenAt = lists(o).subs.find((c) => c.id === id)?.seen_at ?? \"\";\n let pages = pager(o, id, signal);\n\n const heading = h(\"h1\", { id: \"coll-title\" });\n const metaLine = h(\"p\", { class: \"coll-meta\" });\n const actions = h(\"div\", { class: \"coll-actions\" });\n const notice = h(\"p\", { class: \"coll-notice\", role: \"status\" });\n const newLine = h(\"p\", { class: \"coll-new\", hidden: true });\n const grid = h(\"div\", { class: \"media-grid coll-grid\" });\n const status = h(\"p\", { class: \"media-status\", role: \"status\" });\n root.replaceChildren(\n h(\"section\", { class: \"collection\", \"aria-labelledby\": \"coll-title\" }, [\n // The tile's tint is the sidebar row's (t0..t3, views/rooms.ts).\n h(\"header\", { class: `coll-head t${id.charCodeAt(0) % 4}` }, [\n h(\"a\", { href: \"/\", class: \"back ic i-back\", \"aria-label\": \"Back to rooms\" }),\n heading,\n metaLine,\n actions,\n notice,\n ]),\n newLine,\n grid,\n status,\n ]),\n );\n\n const fail = (what: string, e: unknown) => {\n notice.textContent = `Couldn't ${what}. ${reason(e)}`;\n };\n const btn = (label: string, run: () => unknown, cls = \"\") =>\n h(\"button\", { type: \"button\", class: cls, on: { click: () => void run() }, signal }, label);\n const count = (n: number) => `${n} ${n === 1 ? \"item\" : \"items\"}`;\n const empty = () => (mine ? \"Nothing here yet. Upload images and videos, or save them from the chat.\" : \"Nothing here yet.\");\n\n /** Files waiting to be uploaded (the owner's), one at a time; each comes in at the top once the store hears of it. */\n const queue: File[] = [];\n let sent = 0;\n let busy = false;\n let failed: string[] = [];\n const picker = h(\"input\", {\n type: \"file\",\n multiple: true,\n accept: ACCEPT,\n hidden: true,\n on: {\n change: () => {\n upload([...(picker.files ?? [])]);\n picker.value = \"\";\n },\n },\n signal,\n });\n function upload(files: File[]) {\n for (const f of files) {\n if (!MEDIA.test(f.name)) failed.push(`${f.name}: not an image or video`);\n else if (f.size > MAX_BYTES) failed.push(`${f.name}: larger than 20 MB`);\n else queue.push(f);\n }\n if (busy) return;\n if (!queue.length) return report();\n busy = true;\n void (async () => {\n while (queue.length && !signal.aborted) {\n const f = queue[0]!;\n const at = `Uploading ${sent + 1} of ${sent + queue.length}\u2026`;\n notice.textContent = at;\n try {\n await call.upload(id, f, (x) => (notice.textContent = `${at} ${Math.round(x * 100)}%`));\n } catch (e) {\n // Too many at once (the server's rate limit): wait, then the same one again.\n if ((e as { status?: number }).status === 429) {\n notice.textContent = \"Waiting for the server\u2026\";\n await new Promise((r) => setTimeout(r, 10_000));\n continue;\n }\n failed.push(`${f.name}: ${reason(e)}`);\n }\n queue.shift();\n sent++;\n o.service.refresh();\n }\n sent = 0;\n busy = false;\n report();\n })();\n }\n /** After an upload: what didn't go, or nothing. */\n function report() {\n notice.textContent = failed.length ? `Couldn't upload ${failed.join(\"; \")}` : \"\";\n failed = [];\n }\n\n /** Renaming or confirming a delete: the actions stay as they are while the store changes. */\n let editing = false;\n /** The button that was pressed to edit (Rename or Delete): it gets focus back. */\n let back = \"\";\n /** What the actions were drawn for: they are drawn again only when that changes, so focus stays. */\n let drawn = \"\";\n function doneEditing() {\n editing = false;\n drawn = \"\";\n renderHead();\n }\n\n /** Saved: true. Refused: the reason is shown, and whatever was being edited stays. */\n async function change(patch: { name?: string; public?: boolean }): Promise<boolean> {\n try {\n info = { ...info, ...(await call.update(id, patch)) };\n notice.textContent = \"\";\n o.service.refresh();\n doneEditing();\n return true;\n } catch (e) {\n fail(\"save\", e);\n return false;\n }\n }\n\n function renameForm() {\n editing = true;\n back = \"Rename\";\n const input = h(\"input\", { value: info.name, \"aria-label\": \"Collection name\", autocomplete: \"off\" });\n const form = h(\n \"form\",\n {\n class: \"coll-rename\",\n on: {\n submit: (e) => {\n e.preventDefault();\n void change({ name: input.value });\n },\n keydown: (e) => e.key === \"Escape\" && doneEditing(),\n },\n signal,\n },\n [input, h(\"button\", { type: \"submit\" }, \"Save\"), btn(\"Cancel\", doneEditing, \"link\")],\n );\n actions.replaceChildren(form);\n input.focus();\n input.select();\n }\n\n function confirmDelete() {\n editing = true;\n back = \"Delete\";\n actions.replaceChildren(\n h(\"span\", {}, `Delete \u201C${info.name}\u201D${info.items ? ` and its ${count(info.items)}` : \"\"}? This can't be undone.`),\n btn(\n \"Delete collection\",\n async () => {\n try {\n await call.remove(id);\n o.service.refresh();\n o.navigate(\"/\");\n } catch (e) {\n fail(\"delete it\", e);\n }\n },\n \"danger\",\n ),\n btn(\"Cancel\", doneEditing, \"link\"),\n );\n actions.querySelector(\"button\")?.focus();\n }\n\n function renderHead() {\n if (signal.aborted) return;\n heading.replaceChildren(icon(h), \" \", info.name);\n metaLine.textContent = [mine ? \"Yours\" : ownerName && `By ${ownerName}`, info.public ? \"Public\" : \"Private\", count(info.items)]\n .filter(Boolean)\n .join(\" \u00B7 \");\n const following = lists(o).subs.some((c) => c.id === id);\n const key = [info.public, following].join();\n if (editing || key === drawn) return;\n drawn = key;\n const focused = [...actions.children].findIndex((c) => c.contains(document.activeElement));\n if (mine) {\n actions.replaceChildren(\n btn(\"Upload\", () => picker.click()),\n btn(\"Rename\", renameForm),\n btn(info.public ? \"Make private\" : \"Make public\", () => change({ public: !info.public })),\n btn(\"Delete\", confirmDelete, \"danger\"),\n );\n } else if (me && (info.public || following)) {\n const b = btn(following ? \"Unsubscribe\" : \"Subscribe\", async () => {\n b.disabled = true;\n try {\n await call.follow(id, !following);\n o.service.refresh();\n await changed(o, 1000);\n } catch (e) {\n fail(following ? \"unsubscribe\" : \"subscribe\", e);\n }\n drawn = \"\";\n renderHead();\n });\n b.setAttribute(\"aria-pressed\", String(following));\n actions.replaceChildren(b);\n } else actions.replaceChildren();\n const kids = [...actions.children] as HTMLElement[];\n if (focused >= 0) (kids.find((c) => back && c.textContent === back) ?? kids[focused])?.focus();\n back = \"\";\n }\n renderHead();\n if (mine) {\n root.firstElementChild!.append(picker);\n const files = (e: DragEvent) => e.dataTransfer?.types.includes(\"Files\");\n root.addEventListener(\"dragover\", (e) => files(e) && e.preventDefault(), { signal });\n root.addEventListener(\n \"drop\",\n (e) => {\n if (!files(e)) return;\n e.preventDefault();\n upload([...(e.dataTransfer?.files ?? [])]);\n },\n { signal },\n );\n // Pasted (Ctrl+V) anywhere on the page, unless a dialog (the viewer, a menu's) is open over it.\n document.addEventListener(\n \"paste\",\n (e) => {\n const pasted = [...(e.clipboardData?.files ?? [])];\n if (!pasted.length || document.querySelector(\"dialog[open]\")) return;\n e.preventDefault();\n upload(pasted);\n },\n { signal },\n );\n }\n\n /** The newest item's `created` (or the collection's last_added), to send as seen once the tab is visible. */\n let unseen = \"\";\n function markSeen() {\n if (!unseen || document.visibilityState !== \"visible\" || !lists(o).subs.some((c) => c.id === id)) return;\n const at = unseen;\n unseen = \"\";\n // Not while the store is telling its listeners of a change: the badge goes with the next one.\n queueMicrotask(() => signal.aborted || o.service.seen(id, at));\n }\n document.addEventListener(\"visibilitychange\", markSeen, { signal });\n\n /** The collection as the store has it (yours, or followed), last time: what changed since. */\n const listed = () => [...lists(o).mine, ...lists(o).subs].find((c) => c.id === id);\n let last = listed();\n function follow() {\n const c = listed();\n if (c) {\n info = { ...info, name: c.name, public: c.public, items: c.items };\n if (last && c.last_added !== last.last_added) void newer();\n // Some may have been taken out (the save menu, another tab): the gone ones leave the grid.\n if (last && c.items < last.items + (c.last_added !== last.last_added ? 1 : 0)) void prune();\n if (c.new) {\n unseen = c.last_added;\n markSeen();\n }\n } else if (last) {\n // Gone from the list: made private, deleted, or no longer followed.\n void call.get(id, signal).then(\n (m) => {\n info = { ...info, ...m };\n renderHead();\n },\n (e: { status?: number }) => e.status === 404 && gone(),\n );\n }\n last = c;\n renderHead();\n }\n signal.addEventListener(\"abort\", o.watch(follow), { once: true });\n\n let month = \"\";\n let fresh = 0;\n /** An item's cell, at the end (a page of older ones) or at the top (`added`: new while the page is open). */\n function add(it: CollectionItem, added = false) {\n const mo = monthOf.format(dateOf(it.created));\n const isNew = added || (!!seenAt && it.created > seenAt);\n if (isNew && !added) fresh++;\n const label = `${it.name}${it.video ? \", video\" : \"\"}${isNew ? \", new\" : \"\"}`;\n const tile = h(\n \"button\",\n {\n type: \"button\",\n class: \"media-tile\",\n \"aria-label\": label,\n title: it.name,\n on: { click: () => void open(it, tile) },\n signal,\n },\n [picture(o, it, signal), it.video && h(\"span\", { class: \"att-play\", \"aria-hidden\": \"true\" })],\n );\n const cell = h(\"div\", { class: `coll-cell${isNew ? \" new\" : \"\"}`, dataset: { item: it.id } }, [tile]);\n if (me) {\n const save: HTMLButtonElement = h(\n \"button\",\n {\n type: \"button\",\n class: \"att-save\",\n \"aria-label\": `Save ${it.name} to collection`,\n title: \"Save to collection\",\n on: { click: () => openSave({ ...o, from: { item: it.id }, opener: save }) },\n signal,\n },\n icon(h),\n );\n cell.append(save);\n }\n if (mine) {\n cell.append(\n h(\n \"button\",\n {\n type: \"button\",\n class: \"coll-remove\",\n \"aria-label\": `Remove ${it.name} from the collection`,\n title: \"Remove from collection\",\n on: { click: () => void remove(it, cell) },\n signal,\n },\n \"\u00D7\",\n ),\n );\n }\n if (!added) {\n if (mo !== month) grid.append(h(\"h2\", {}, mo));\n month = mo;\n grid.append(cell);\n } else if (grid.firstElementChild?.textContent === mo) grid.firstElementChild.after(cell);\n else {\n grid.prepend(h(\"h2\", {}, mo), cell);\n month ||= mo;\n }\n }\n\n async function remove(it: CollectionItem, cell: HTMLElement) {\n try {\n await call.unsave(it.id);\n } catch (e) {\n return fail(\"remove it\", e);\n }\n const cells = [...grid.querySelectorAll(\".coll-cell\")];\n const at = cells.indexOf(cell);\n const to = cells[at + 1] ?? cells[at - 1];\n drop(it);\n info = { ...info, items: Math.max(0, info.items - 1) };\n renderHead();\n // Focus stays in the grid (the next one's Remove), or goes to the actions once it is empty.\n (to?.querySelector<HTMLElement>(\".coll-remove\") ?? actions.querySelector(\"button\"))?.focus();\n o.service.refresh();\n }\n\n /** An item no longer in the collection: its cell goes, and its month's heading when it was the last of it. */\n function drop(it: CollectionItem) {\n const at = pages.items.indexOf(it);\n if (at < 0) return;\n pages.items.splice(at, 1);\n const cell = [...grid.querySelectorAll<HTMLElement>(\".coll-cell\")].find((c) => c.dataset.item === it.id);\n if (cell) {\n const [before, after] = [cell.previousElementSibling, cell.nextElementSibling];\n if (cell.contains(document.activeElement)) (after?.querySelector<HTMLElement>(\"button\") ?? actions.querySelector(\"button\"))?.focus();\n cell.remove();\n if (before?.tagName === \"H2\" && (!after || after.tagName === \"H2\")) {\n before.remove();\n if (!after) month = \"\";\n }\n }\n if (pages.done && !pages.items.length) status.textContent = empty();\n }\n\n /** Taken out elsewhere (the save menu, another tab): those shown that are gone go from the grid. */\n let pruned = 0;\n async function prune() {\n const seq = ++pruned;\n const shown = [...pages.items];\n const oldest = shown.at(-1);\n const ids = oldest && (await call.idsSince(id, oldest, signal).catch(() => null));\n if (!ids || seq !== pruned || signal.aborted) return;\n for (const it of shown.filter((x) => !ids.has(x.id))) drop(it);\n }\n\n async function more() {\n const p = pages;\n if (p.done) return;\n status.textContent = \"Loading\u2026\";\n try {\n const page = await p.next();\n if (signal.aborted || p !== pages) return;\n for (const it of page) add(it);\n status.textContent = p.done && !p.items.length ? empty() : \"\";\n } catch {\n if (signal.aborted || p !== pages) return;\n seen.unobserve(status);\n status.replaceChildren(\n \"Couldn't load the collection. \",\n btn(\"Retry\", () => void more(), \"link\"),\n );\n return;\n }\n seen.unobserve(status);\n if (!p.done) seen.observe(status);\n }\n\n /** From the start again (the page was empty, or more was added than a page holds). */\n function reset() {\n pages = pager(o, id, signal);\n grid.replaceChildren();\n month = \"\";\n return more();\n }\n\n /** Items added while the page is open: at the top, marked new. */\n async function newer() {\n const top = pages.items[0];\n if (!top) return reset();\n const got = await call.items(id, top, signal, true).catch(() => null);\n if (!got || signal.aborted) return;\n if (got.more) return reset();\n const shown = new Set(pages.items.map((x) => x.id));\n const added = got.items.filter((x) => !shown.has(x.id));\n pages.items.unshift(...added);\n for (const it of added.reverse()) add(it, true);\n if (added.length) status.textContent = \"\";\n }\n\n async function open(it: CollectionItem, opener: HTMLElement) {\n const images = (): ViewerImage[] => [...pages.items].reverse().map((x) => ({ message: asMessage(x), file: x.file, video: x.video }));\n const all = images();\n const p = pages;\n try {\n const { openViewer } = await import(\"../room/viewer.ts\");\n if (signal.aborted) return;\n await openViewer({\n images: all,\n start: all.findIndex((x) => x.message.id === it.id),\n more: [!p.done, false],\n page: async (older) => {\n const got = older ? await p.next() : [];\n return { messages: got.map(asMessage).reverse(), done: !older || p.done };\n },\n media: (m) => [{ message: m, file: m.files![0]!, video: p.items.find((x) => x.id === m.id)?.video ?? false }],\n h,\n name: (m, f) => m.file_names?.[f] ?? f,\n when: (m) => `Added ${o.when(m.created)}`,\n fileUrl: (m, f) => api.itemUrl({ id: m.id, file: f }),\n ...(me ? { onSave: (m: Message, _f: string, b: HTMLElement) => openSave({ ...o, from: { item: m.id }, opener: b }) } : {}),\n opener,\n follow: () => {},\n signal,\n });\n } catch {\n window.open(api.itemUrl(it), \"_blank\", \"noopener\");\n }\n }\n\n const seen = new IntersectionObserver((es) => es.some((e) => e.isIntersecting) && void more(), { rootMargin: \"400px\" });\n signal.addEventListener(\"abort\", () => seen.disconnect(), { once: true });\n await more();\n if (signal.aborted) return;\n if (fresh) {\n newLine.hidden = false;\n newLine.textContent = `${fresh >= 60 ? \"60+\" : fresh} new since your last visit`;\n }\n // Seen once it is on screen in a visible tab: the sidebar's count goes.\n unseen = pages.items[0]?.created ?? \"\";\n markSeen();\n}\n", "// The picker the composer opens (\u00A731): items of your collections and those you follow, to attach.\n\nimport type { CollectionItem } from \"../../lib/types.ts\";\nimport { type Base, icon, lists, loadStylesheet, pager, picture } from \"./shared.ts\";\n\nexport interface PickOptions extends Base {\n /** At most this many may be picked (what the message still has room for). */\n max: number;\n /** Attach these (Attach was pressed). */\n onPick: (items: CollectionItem[]) => void;\n opener: HTMLElement;\n}\n\nexport async function openPicker(o: PickOptions): Promise<void> {\n const { h } = o;\n const scope = new AbortController();\n const { signal } = scope;\n o.signal.addEventListener(\"abort\", () => close(), { signal });\n const { mine, subs } = lists(o);\n const all = [...mine, ...subs];\n const title = h(\"h2\", { id: \"coll-pick-title\" }, [icon(h), \" Attach from collections\"]);\n /** The collection shown: a row of chips, as the app's. */\n let chosen = all[0]?.id ?? \"\";\n const chips = all.map((c) =>\n h(\n \"button\",\n {\n type: \"button\",\n class: \"coll-chip\",\n \"aria-pressed\": String(c.id === chosen),\n on: { click: (e: Event) => choose(c.id, e.currentTarget as HTMLElement) },\n signal,\n },\n c.owner ? `${c.name} \u00B7 ${c.owner.name}` : c.name,\n ),\n );\n const row = h(\"div\", { class: \"coll-chips\", role: \"group\", \"aria-label\": \"Collection\" }, chips);\n const grid = h(\"div\", { class: \"media-grid coll-grid\" });\n const status = h(\"p\", { class: \"media-status\", role: \"status\" });\n const count = h(\"span\", { class: \"coll-count\", \"aria-live\": \"polite\" });\n const attach = h(\"button\", { type: \"button\", disabled: true, on: { click: () => done() }, signal }, \"Attach\");\n const body = h(\"div\", { class: \"coll-body\" }, [grid, status]);\n const dialog = h(\"dialog\", { class: \"coll-dialog coll-pick\", \"aria-labelledby\": title.id }, [\n h(\"header\", { class: \"media-bar\" }, [\n title,\n h(\"button\", { type: \"button\", class: \"icon-button ic i-x\", \"aria-label\": \"Close\", on: { click: () => close() }, signal }),\n ]),\n all.length ? row : null,\n body,\n h(\"footer\", { class: \"coll-foot\" }, [count, attach]),\n ]);\n /** Picked, in the order they were. */\n const picked = new Map<string, CollectionItem>();\n let pages = pager(o, \"\", signal);\n\n function update() {\n count.textContent = picked.size\n ? `${picked.size} picked${picked.size >= o.max ? \" (the most a message takes)\" : \"\"}`\n : o.max\n ? \"\"\n : \"The message has all the files it can take.\";\n attach.disabled = !picked.size;\n attach.textContent = picked.size ? `Attach ${picked.size}` : \"Attach\";\n }\n\n function tile(it: CollectionItem) {\n const b: HTMLButtonElement = h(\n \"button\",\n {\n type: \"button\",\n class: \"media-tile\",\n \"aria-label\": `${it.name}${it.video ? \", video\" : \"\"}`,\n title: it.name,\n \"aria-pressed\": String(picked.has(it.id)),\n on: {\n click: () => {\n if (picked.has(it.id)) picked.delete(it.id);\n else if (picked.size < o.max) picked.set(it.id, it);\n b.setAttribute(\"aria-pressed\", String(picked.has(it.id)));\n update();\n },\n },\n signal,\n },\n [picture(o, it, signal), it.video && h(\"span\", { class: \"att-play\", \"aria-hidden\": \"true\" })],\n );\n return b;\n }\n\n async function more() {\n if (pages.done || !chosen) return;\n const p = pages;\n status.textContent = \"Loading\u2026\";\n try {\n const got = await p.next();\n if (signal.aborted || p !== pages) return;\n grid.append(...got.map(tile));\n status.textContent = p.done && !p.items.length ? \"Nothing in this collection yet.\" : \"\";\n } catch {\n if (signal.aborted || p !== pages) return;\n seen.unobserve(status);\n status.replaceChildren(\n \"Couldn't load the collection. \",\n h(\"button\", { type: \"button\", class: \"link\", on: { click: () => void more() }, signal }, \"Retry\"),\n );\n return;\n }\n seen.unobserve(status);\n if (!p.done) seen.observe(status);\n }\n\n function show() {\n pages = pager(o, chosen, signal);\n grid.replaceChildren();\n void more();\n }\n\n function choose(id: string, chip: HTMLElement) {\n if (id === chosen) return;\n chosen = id;\n for (const c of chips) c.setAttribute(\"aria-pressed\", String(c === chip));\n chip.scrollIntoView({ block: \"nearest\", inline: \"nearest\" });\n show();\n }\n const seen = new IntersectionObserver((es) => es.some((e) => e.isIntersecting) && void more(), { root: body, rootMargin: \"400px\" });\n\n function done() {\n const items = [...picked.values()];\n close();\n if (items.length) o.onPick(items);\n }\n\n function close() {\n if (signal.aborted) return;\n scope.abort();\n seen.disconnect();\n if (dialog.open) dialog.close();\n dialog.remove();\n o.opener.focus();\n }\n dialog.addEventListener(\"close\", () => close(), { signal });\n\n await loadStylesheet(h);\n if (signal.aborted) return;\n document.body.append(dialog);\n dialog.showModal();\n update();\n if (!all.length) {\n status.textContent = \"You have no collections yet. Save images and videos from the chat to one first.\";\n return;\n }\n show();\n chips[0]?.focus();\n}\n"],
|
|
5
|
+
"mappings": "AAqBO,IAAMA,GAAU,uCAGVC,EAAOC,GAAc,KAAK,UAAUA,CAAC,EAGrCC,GAAc,+CAGpB,SAASC,EAAMC,EAAU,CAC9B,MAAO,CAEL,IAAK,CAACC,EAAYC,IAChBF,EAAI,QAA0D,GAAGL,EAAO,IAAIM,CAAE,GAAI,CAChF,MAAO,CAAE,OAAQ,QAAS,OAAQ,8CAA+C,EACjF,OAAAC,CACF,CAAC,EACH,OAAQ,CAACC,EAAeC,EAAcC,IACpC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AAC,EAC3DF,EAAK,EACP,CACA,IAAMD,EAAO,IAAI,qBAAsBK,GAAOA,EAAG,KAAM1B,GAAMA,EAAE,cAAc,GAAK,KAAKkB,EAAK,EAAG,CAAE,KAAMV,EAAM,WAAY,OAAQ,CAAC,EAElI,SAASD,GAAO,CACd,IAAMoB,EAAQ,CAAC,GAAGjB,EAAO,OAAO,CAAC,EACjCnB,EAAM,EACFoC,EAAM,QAAQ,EAAE,OAAOA,CAAK,CAClC,CAEA,SAASpC,GAAQ,CACXD,EAAO,UACXD,EAAM,MAAM,EACZgC,EAAK,WAAW,EACZZ,EAAO,MAAMA,EAAO,MAAM,EAC9BA,EAAO,OAAO,EACd,EAAE,OAAO,MAAM,EACjB,CAIA,GAHAA,EAAO,iBAAiB,QAAS,IAAMlB,EAAM,EAAG,CAAE,OAAAD,CAAO,CAAC,EAE1D,MAAMsC,EAAexC,CAAC,EAClB,CAAAE,EAAO,QAIX,IAHA,SAAS,KAAK,OAAOmB,CAAM,EAC3BA,EAAO,UAAU,EACjBI,EAAO,EACH,CAAClB,EAAI,OAAQ,CACfS,EAAO,YAAc,kFACrB,MACF,CACAkB,EAAK,EACLvB,EAAM,CAAC,GAAG,MAAM,EAClB",
|
|
6
|
+
"names": ["RECORDS", "lit", "v", "ITEM_FIELDS", "calls", "api", "id", "signal", "owner", "name", "isPublic", "body", "collection", "after", "newer", "op", "cursor", "query", "items", "oldest", "ids", "filter", "page", "x", "from", "file", "onUpload", "item", "on", "stylesheet", "loadStylesheet", "h", "resolve", "link", "MEDIA", "ACCEPT", "MAX_BYTES", "lists", "changed", "ms", "done", "off", "timer", "reason", "e", "err", "icon", "monthOf", "dateOf", "created", "asMessage", "it", "id", "file", "name", "picture", "b", "signal", "img", "pager", "collection", "items", "loading", "calls", "page", "openCreate", "h", "scope", "signal", "close", "title", "icon", "input", "pub", "err", "submit", "form", "e", "id", "calls", "reason", "dialog", "refocus", "loadStylesheet", "saving", "openSave", "h", "call", "calls", "scope", "signal", "close", "title", "icon", "list", "status", "input", "form", "e", "id", "toggle", "err", "reason", "dialog", "saved", "busy", "on", "render", "mine", "lists", "c", "box", "loadStylesheet", "mountCollection", "root", "o", "h", "api", "signal", "id", "call", "calls", "meta", "loadStylesheet", "changed", "gone", "icon", "info", "me", "mine", "ownerName", "seenAt", "lists", "c", "pages", "pager", "heading", "metaLine", "actions", "notice", "newLine", "grid", "status", "fail", "what", "e", "reason", "btn", "label", "run", "cls", "count", "n", "empty", "queue", "sent", "busy", "failed", "picker", "ACCEPT", "upload", "files", "f", "MEDIA", "MAX_BYTES", "report", "at", "x", "r", "editing", "back", "drawn", "doneEditing", "renderHead", "change", "patch", "renameForm", "input", "form", "confirmDelete", "following", "key", "focused", "b", "kids", "pasted", "unseen", "markSeen", "listed", "last", "follow", "newer", "prune", "m", "month", "fresh", "add", "it", "added", "mo", "monthOf", "dateOf", "isNew", "tile", "open", "picture", "cell", "save", "openSave", "remove", "cells", "to", "drop", "before", "after", "pruned", "seq", "shown", "oldest", "ids", "more", "p", "page", "seen", "reset", "top", "got", "opener", "all", "asMessage", "openViewer", "older", "_f", "es", "openPicker", "h", "scope", "signal", "close", "mine", "subs", "lists", "all", "title", "icon", "chosen", "chips", "e", "choose", "row", "grid", "status", "count", "attach", "done", "body", "dialog", "picked", "pages", "pager", "update", "tile", "it", "b", "picture", "more", "p", "got", "seen", "show", "id", "chip", "c", "es", "items", "loadStylesheet"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
dialog.media{width:min(55rem,100%);height:min(49.25rem,100%);max-width:none;max-height:none;padding:0;border:1px solid var(--border);border-radius:16px;background:color-mix(in srgb,var(--raised),var(--bg));color:var(--fg);box-shadow:var(--shadow)}dialog.media[open]{display:flex;flex-direction:column}dialog.media::backdrop{background:#08060eb3}.media-bar{display:flex;align-items:center;gap:10px;padding:14px 16px 12px 24px;border-bottom:1px solid var(--border)}.media-bar h2{flex:1;min-width:0;margin:0;font-size:1.0625rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.media-bar .hash{width:auto;margin-right:1px}.media-bar .icon-button{width:36px;height:36px;color:var(--muted)}.media-body{flex:1;overflow-y:auto;padding:0 24px 20px}.media-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(8rem,1fr));gap:6px}.media-grid h3{grid-column:1 / -1;margin:16px 0 4px;font-size:.8125rem;font-weight:600;color:var(--muted)}.media-tile{position:relative;display:block;width:100%;aspect-ratio:1;padding:0;border:0;border-radius:6px;overflow:hidden;background:var(--surface);cursor:pointer}.media-tile img{display:block;width:100%;height:100%;object-fit:cover}.media-tile:hover{opacity:.85}.media-
|
|
2
|
-
/*# sourceMappingURL=media-
|
|
1
|
+
dialog.media{width:min(55rem,100%);height:min(49.25rem,100%);max-width:none;max-height:none;padding:0;border:1px solid var(--border);border-radius:16px;background:color-mix(in srgb,var(--raised),var(--bg));color:var(--fg);box-shadow:var(--shadow)}dialog.media[open]{display:flex;flex-direction:column}dialog.media::backdrop{background:#08060eb3}.media-bar{display:flex;align-items:center;gap:10px;padding:14px 16px 12px 24px;border-bottom:1px solid var(--border)}.media-bar h2{flex:1;min-width:0;margin:0;font-size:1.0625rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.media-bar .hash{width:auto;margin-right:1px}.media-bar .icon-button{width:36px;height:36px;color:var(--muted)}.media-body{flex:1;overflow-y:auto;padding:0 24px 20px}.media-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(8rem,1fr));gap:6px}.media-grid h3{grid-column:1 / -1;margin:16px 0 4px;font-size:.8125rem;font-weight:600;color:var(--muted)}.media-tile{position:relative;display:block;width:100%;aspect-ratio:1;padding:0;border:0;border-radius:6px;overflow:hidden;background:var(--surface);cursor:pointer}.media-tile img{display:block;width:100%;height:100%;object-fit:cover}.media-tile:hover{opacity:.85}.media-status{margin:1rem 0 0;text-align:center;color:var(--muted);font-size:.9rem}@media(max-width:40rem){dialog.media{width:100%;height:100%;border:0;border-radius:0}.media-bar{padding-top:max(.5rem,env(safe-area-inset-top))}}
|
|
2
|
+
/*# sourceMappingURL=media-7TCBG7WM.css.map */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../web/styles/media.css"],
|
|
4
|
-
"sourcesContent": ["/* Media grid (DESIGN.md \u00A730). Not part of app.css: the grid links this file when it first opens.\n Uses app.css's custom properties, so it follows the theme. */\n\ndialog.media {\n width: min(55rem, 100%);\n height: min(49.25rem, 100%);\n max-width: none;\n max-height: none;\n padding: 0;\n border: 1px solid var(--border);\n border-radius: 16px;\n background: color-mix(in srgb, var(--raised), var(--bg));\n color: var(--fg);\n box-shadow: var(--shadow);\n}\n\ndialog.media[open] {\n display: flex;\n flex-direction: column;\n}\n\ndialog.media::backdrop {\n background: rgb(8 6 14 / 70%);\n}\n\n.media-bar {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 14px 16px 12px 24px;\n border-bottom: 1px solid var(--border);\n}\n\n.media-bar h2 {\n flex: 1;\n min-width: 0;\n margin: 0;\n font-size: 1.0625rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.media-bar .hash {\n width: auto;\n margin-right: 1px;\n}\n\n.media-bar .icon-button {\n width: 36px;\n height: 36px;\n color: var(--muted);\n}\n\n.media-body {\n flex: 1;\n overflow-y: auto;\n padding: 0 24px 20px;\n}\n\n.media-grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));\n gap: 6px;\n}\n\n.media-grid h3 {\n grid-column: 1 / -1;\n margin: 16px 0 4px;\n font-size: 0.8125rem;\n font-weight: 600;\n color: var(--muted);\n}\n\n.media-tile {\n position: relative;\n display: block;\n width: 100%;\n aspect-ratio: 1;\n padding: 0;\n border: 0;\n border-radius: 6px;\n overflow: hidden;\n background: var(--surface);\n cursor: pointer;\n}\n\n.media-tile img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.media-tile:hover {\n op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AoBU,OACT,QAAS,GACX,CAEA,
|
|
4
|
+
"sourcesContent": ["/* Media grid (DESIGN.md \u00A730). Not part of app.css: the grid links this file when it first opens.\n Uses app.css's custom properties, so it follows the theme. */\n\ndialog.media {\n width: min(55rem, 100%);\n height: min(49.25rem, 100%);\n max-width: none;\n max-height: none;\n padding: 0;\n border: 1px solid var(--border);\n border-radius: 16px;\n background: color-mix(in srgb, var(--raised), var(--bg));\n color: var(--fg);\n box-shadow: var(--shadow);\n}\n\ndialog.media[open] {\n display: flex;\n flex-direction: column;\n}\n\ndialog.media::backdrop {\n background: rgb(8 6 14 / 70%);\n}\n\n.media-bar {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 14px 16px 12px 24px;\n border-bottom: 1px solid var(--border);\n}\n\n.media-bar h2 {\n flex: 1;\n min-width: 0;\n margin: 0;\n font-size: 1.0625rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.media-bar .hash {\n width: auto;\n margin-right: 1px;\n}\n\n.media-bar .icon-button {\n width: 36px;\n height: 36px;\n color: var(--muted);\n}\n\n.media-body {\n flex: 1;\n overflow-y: auto;\n padding: 0 24px 20px;\n}\n\n.media-grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));\n gap: 6px;\n}\n\n.media-grid h3 {\n grid-column: 1 / -1;\n margin: 16px 0 4px;\n font-size: 0.8125rem;\n font-weight: 600;\n color: var(--muted);\n}\n\n.media-tile {\n position: relative;\n display: block;\n width: 100%;\n aspect-ratio: 1;\n padding: 0;\n border: 0;\n border-radius: 6px;\n overflow: hidden;\n background: var(--surface);\n cursor: pointer;\n}\n\n.media-tile img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.media-tile:hover {\n opacity: 0.85;\n}\n\n.media-status {\n margin: 1rem 0 0;\n text-align: center;\n color: var(--muted);\n font-size: 0.9rem;\n}\n\n@media (max-width: 40rem) {\n dialog.media {\n width: 100%;\n height: 100%;\n border: 0;\n border-radius: 0;\n }\n .media-bar {\n padding-top: max(0.5rem, env(safe-area-inset-top));\n }\n}\n"],
|
|
5
|
+
"mappings": "AAGA,MAAM,CAAC,MACL,MAAO,IAAI,KAAK,CAAE,MAClB,OAAQ,IAAI,QAAQ,CAAE,MACtB,UAAW,KACX,WAAY,KAPd,QAQW,EACT,OAAQ,IAAI,MAAM,IAAI,UATxB,cAUiB,KACf,WAAY,UAAU,GAAG,IAAI,CAAE,IAAI,SAAS,CAAE,IAAI,OAClD,MAAO,IAAI,MACX,WAAY,IAAI,SAClB,CAEA,MAAM,CAbC,KAaK,CAAC,MACX,QAAS,KACT,eAAgB,MAClB,CAEA,MAAM,CAlBC,KAkBK,WACV,WAAY,SACd,CAEA,CAAC,UACC,QAAS,KACT,YAAa,OACb,IAAK,KA5BP,QA6BW,KAAK,KAAK,KAAK,KACxB,cAAe,IAAI,MAAM,IAAI,SAC/B,CAEA,CARC,UAQU,GACT,KAAM,EACN,UAAW,EAnCb,OAoCU,EACR,UAAW,UACX,SAAU,OACV,cAAe,SACf,YAAa,MACf,CAEA,CAlBC,UAkBU,CAAC,KACV,MAAO,KACP,aAAc,GAChB,CAEA,CAvBC,UAuBU,CAAC,YACV,MAAO,KACP,OAAQ,KACR,MAAO,IAAI,QACb,CAEA,CAAC,WACC,KAAM,EACN,WAAY,KAxDd,QAyDW,EAAE,KAAK,IAClB,CAEA,CAAC,WACC,QAAS,KACT,sBAAuB,OAAO,SAAS,CAAE,OAAO,IAAI,CAAE,MACtD,IAAK,GACP,CAEA,CANC,WAMW,GACV,YAAa,EAAE,EAAE,GAnEnB,OAoEU,KAAK,EAAE,IACf,UAAW,SACX,YAAa,IACb,MAAO,IAAI,QACb,CAEA,CAAC,WACC,SAAU,SACV,QAAS,MACT,MAAO,KACP,aAAc,EA9EhB,QA+EW,EACT,OAAQ,EAhFV,cAiFiB,IACf,SAAU,OACV,WAAY,IAAI,WAChB,OAAQ,OACV,CAEA,CAbC,WAaW,IACV,QAAS,MACT,MAAO,KACP,OAAQ,KACR,WAAY,KACd,CAEA,CApBC,UAoBU,OACT,QAAS,GACX,CAEA,CAAC,aAlGD,OAmGU,KAAK,EAAE,EACf,WAAY,OACZ,MAAO,IAAI,SACX,UAAW,KACb,CAEA,OAAO,UAAY,OACjB,MAAM,CAvGD,MAwGH,MAAO,KACP,OAAQ,KACR,OAAQ,EA7GZ,cA8GmB,CACjB,CACA,CAvFD,UAwFG,YAAa,IAAI,KAAM,CAAE,IAAI,qBAC/B,CACF",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var x=null;function q(a){return x??=new Promise(n=>{let b=a("link",{rel:"stylesheet",href:"/assets/media-7TCBG7WM.css",on:{load:()=>n(),error:()=>{b.remove(),x=null,n()}}});document.head.append(b)}),x}var $=`media-${Date.now()}-${Math.random()}`,w=()=>history.state?.media===$,H=null,k=!1;function B(a){if(k)return;k=!0;let{h:n,api:v}=a,b=document.activeElement,I=new AbortController,{signal:r}=I;a.signal.addEventListener("abort",()=>g(!1),{signal:r});let S=n("h2",{id:"media-title"},a.label?["Media in ",n("span",{class:"hash"},"#"),a.label]:"Media"),M=n("div",{class:"media-grid"}),l=n("p",{class:"media-status",role:"status"}),L=n("div",{class:"media-body"},[M,l]),d=n("dialog",{class:"media","aria-labelledby":S.id},[n("header",{class:"media-bar"},[S,n("button",{type:"button",class:"icon-button ic i-x","aria-label":"Close",autofocus:!0,on:{click:()=>g(!0)},signal:r})]),L]),c=[],f,C=new Map,u=!1,E=!1,O="",m=!1,N=new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"});async function P(){if(!(E||u||m)){E=!0,l.textContent="Loading\u2026";try{let e=await v.media(a.room,f&&{sent:f.sent,message:f.message,pos:f.pos},r);if(m)return;u=!e.more,f=e.items.at(-1)??f;for(let t of e.items)R(t);l.textContent=u?c.length?"":"No photos or videos here yet.":""}catch{if(m)return;p.unobserve(l),l.replaceChildren("Couldn't load media. ",n("button",{type:"button",class:"link",on:{click:()=>{P()}},signal:r},"Retry"));return}finally{E=!1}p.unobserve(l),!u&&!m&&p.observe(l)}}function V(e){let t=C.get(e.message);if(!t){let{message:i,sent:o,author:s}=e;t={id:i,room:a.room,author:s?.id??"",text:"",created:o,updated:o,edited_at:"",deleted:!1},t.files=[],t.file_names={},e.source!==i&&(t.forward_of=e.source),s&&(t.expand={author:s}),C.set(i,t)}return t.files.unshift(e.file),e.name&&(t.file_names[e.file]=e.name),t}function R(e){let{file:t,video:i}=e,o=V(e),s=new Date(o.created.replace(" ","T")),h=N.format(s);h!==O&&(O=h,M.append(n("h3",{},h)));let Y=a.name(o,t),j=()=>i?v.posterUrl(o,t):v.fileUrl(o,t,"240x240"),y=(!i||e.poster)&&n("img",{src:j(),alt:"",loading:"lazy",decoding:"async"});y&&i&&y.addEventListener("error",()=>y.remove(),{signal:r});let _=`${Y}${i?", video":""}, ${o.expand?.author?.name??"Unknown"}, ${s.toLocaleDateString()}`,A=n("button",{type:"button",class:"media-tile","aria-label":_,title:_,on:{click:()=>z(D)},signal:r},[y,i&&n("span",{class:"att-play","aria-hidden":"true"})]),D={message:o,file:t,video:i,tile:A};c.push(D),M.append(A)}function z({message:e,file:t,tile:i}){let o=c.map(({tile:s,...h})=>h).reverse();a.open(e,t,i,o,[!u,!1],()=>g(!0,!1))}a.follow((e,t)=>{let i=new Set(t||e.deleted?[]:e.files??[]);for(let o of c.filter(s=>s.message.id===e.id&&!i.has(s.file))){c.splice(c.indexOf(o),1);let s=o.tile.previousElementSibling;o.tile.remove(),s?.tagName==="H3"&&(!s.nextElementSibling||s.nextElementSibling.tagName==="H3")&&s.remove()}u&&!c.length&&(l.textContent="No photos or videos here yet.")});let p=new IntersectionObserver(e=>e.some(t=>t.isIntersecting)&&void P(),{root:L,rootMargin:"400px"});function g(e,t=!0){m||(m=!0,k=!1,I.abort(),p.disconnect(),a.follow(void 0),d.open&&d.close(),e?H=F().finally(()=>d.remove()):d.remove(),t&&b?.focus())}let T=()=>new Promise(e=>window.addEventListener("popstate",e,{once:!0})),U=()=>!!history.state?.viewer;async function F(){if(!w()&&U()&&await T(),!w())return;let e=T();history.back(),await e}d.addEventListener("close",()=>g(!0),{signal:r}),(async()=>(await Promise.all([q(n),H]),!m&&(w()||history.pushState({media:$},""),window.addEventListener("popstate",()=>!w()&&!U()&&g(!1),{signal:r}),document.body.append(d),d.showModal(),p.observe(l))))()}export{B as openMedia};
|
|
2
|
+
//# sourceMappingURL=media-FPRU2QH5.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../web/src/views/room/media.ts"],
|
|
4
|
+
"sourcesContent": ["// Media grid (\u00A730): every image and video of a room (or DM), newest first, as square tiles under month headings, in a\n// modal <dialog>, so one sent long ago is quick to find. Scrolling down fetches older ones. A tile opens the viewer\n// (\u00A717.7) over the grid, stepping through the same images; closing the viewer comes back to the grid, and \"Show in\n// chat\" closes both. Like the viewer it adds a history entry (same URL), so Back closes it rather than leaving the room.\n//\n// Its pages come from GET /api/chat/media/{room} (\u00A730.1): only the room's images and videos, from an index, not its\n// messages. A video's tile is its poster frame, made by the server, or a plain tile with a play badge until there is one: never\n// the video itself, which every browser would start fetching.\n//\n// A lazy chunk, like search (\u00A729): the room view import()s it when the grid is first opened, and it links its own\n// stylesheet (styles/media.css), so neither app.js nor app.css grows. It imports types only: what it needs from app.js\n// comes in its options.\n\nimport type { Api } from \"../../api.ts\";\nimport type { h } from \"../../dom.ts\";\nimport type { MediaItem, Message, User } from \"../../lib/types.ts\";\nimport type { ViewerImage } from \"./viewer.ts\";\n\nexport interface MediaOptions {\n room: string;\n /** The room's name, in the title (\"Media in #design\"); none for a DM. */\n label?: string | undefined;\n api: Pick<Api, \"media\" | \"fileUrl\" | \"posterUrl\">;\n h: typeof h;\n /** What to call a file (`attachmentName`). */\n name: (m: Message, file: string) => string;\n /**\n * Show `m`'s `file` in the viewer (the room view's `viewImage`), stepping through `images` (oldest first); `more`:\n * the room has more before them (and none after). `leave` closes the grid (\"Show in chat\").\n */\n open: (m: Message, file: string, opener: HTMLElement, images: ViewerImage[], more: [boolean, boolean], leave: () => void) => unknown;\n /** Sets what is told of the room's messages that change or go, while it is open (the viewer's `follow`). */\n follow: (fn: ((m: Message, gone: boolean) => void) | undefined) => void;\n /** Ends it (the room view unmounts). */\n signal: AbortSignal;\n}\n\n/** The stylesheet's URL, set by the build (scripts/lib/build-utils.mjs). */\ndeclare const MEDIA_CSS: string;\n\nlet stylesheet: Promise<void> | null = null;\n/** Loaded once, like the viewer's: a failed load is tried again next time, and the grid opens anyway. */\nfunction loadStylesheet(h: MediaOptions[\"h\"]): Promise<void> {\n stylesheet ??= new Promise((resolve) => {\n const failed = () => {\n link.remove();\n stylesheet = null;\n resolve();\n };\n const link = h(\"link\", { rel: \"stylesheet\", href: MEDIA_CSS, on: { load: () => resolve(), error: failed } });\n document.head.append(link);\n });\n return stylesheet;\n}\n\n/** Marks its history entry; new on every page load, like the viewer's. */\nconst ENTRY = `media-${Date.now()}-${Math.random()}`;\nconst onEntry = () => (history.state as { media?: unknown } | null)?.media === ENTRY;\n/** A grid closed from itself went Back off its entry and the browser hasn't got there yet: a new one waits for it. */\nlet leaving: Promise<unknown> | null = null;\n/** One grid at a time: the button again does nothing while one is open. */\nlet current = false;\n\nexport function openMedia(o: MediaOptions): void {\n if (current) return;\n current = true;\n const { h, api } = o;\n /** Gets focus back on close (the Media button). */\n const opener = document.activeElement as HTMLElement | null;\n const scope = new AbortController();\n const { signal } = scope;\n o.signal.addEventListener(\"abort\", () => close(false), { signal });\n\n const title = h(\"h2\", { id: \"media-title\" }, o.label ? [\"Media in \", h(\"span\", { class: \"hash\" }, \"#\"), o.label] : \"Media\");\n const grid = h(\"div\", { class: \"media-grid\" });\n const status = h(\"p\", { class: \"media-status\", role: \"status\" });\n const body = h(\"div\", { class: \"media-body\" }, [grid, status]);\n const dialog = h(\"dialog\", { class: \"media\", \"aria-labelledby\": title.id }, [\n h(\"header\", { class: \"media-bar\" }, [\n title,\n h(\"button\", {\n type: \"button\",\n class: \"icon-button ic i-x\",\n \"aria-label\": \"Close\",\n autofocus: true,\n on: { click: () => close(true) },\n signal,\n }),\n ]),\n body,\n ]);\n\n /** What is shown, newest first, and the last one fetched (where older ones begin). */\n const items: (ViewerImage & { tile: HTMLElement })[] = [];\n let last: MediaItem | undefined;\n /** The messages they come from, as the viewer takes them, by id. */\n const messages = new Map<string, Message>();\n let done = false;\n let loading = false;\n let month = \"\";\n let closed = false;\n const monthOf = new Intl.DateTimeFormat(undefined, { month: \"long\", year: \"numeric\" });\n\n /** The next page of older messages; scrolling near the end asks again until there are tiles below the fold. */\n async function more() {\n if (loading || done || closed) return;\n loading = true;\n status.textContent = \"Loading\u2026\";\n try {\n const page = await api.media(o.room, last && { sent: last.sent, message: last.message, pos: last.pos }, signal);\n if (closed) return;\n done = !page.more;\n last = page.items.at(-1) ?? last;\n // Newest first, so a message's files last to first: reversed for the viewer, they are in their own order.\n for (const it of page.items) add(it);\n status.textContent = done ? (items.length ? \"\" : \"No photos or videos here yet.\") : \"\";\n } catch {\n if (closed) return;\n // Until Retry: observed again, the end (still in view) would ask again at once, over and over (QA BUG-116).\n seen.unobserve(status);\n status.replaceChildren(\n \"Couldn't load media. \",\n h(\"button\", { type: \"button\", class: \"link\", on: { click: () => void more() }, signal }, \"Retry\"),\n );\n return;\n } finally {\n loading = false;\n }\n // Still at the end (a page with few or no media): the observer won't fire again by itself.\n seen.unobserve(status);\n if (!done && !closed) seen.observe(status);\n }\n\n /** The message an item comes from: what the viewer, \"Show in chat\" and the file's URL need of it. */\n function messageOf(it: MediaItem): Message {\n let m = messages.get(it.message);\n if (!m) {\n const { message: id, sent, author } = it;\n m = { id, room: o.room, author: author?.id ?? \"\", text: \"\", created: sent, updated: sent, edited_at: \"\", deleted: false };\n m.files = [];\n m.file_names = {};\n if (it.source !== id) m.forward_of = it.source; // its files are the original's (\u00A721.3)\n if (author) m.expand = { author: author as User };\n messages.set(id, m);\n }\n m.files!.unshift(it.file);\n if (it.name) m.file_names![it.file] = it.name;\n return m;\n }\n\n function add(row: MediaItem) {\n const { file, video } = row;\n const m = messageOf(row);\n const d = new Date(m.created.replace(\" \", \"T\"));\n const mo = monthOf.format(d);\n if (mo !== month) {\n month = mo;\n grid.append(h(\"h3\", {}, mo));\n }\n const name = o.name(m, file);\n const src = () => (video ? api.posterUrl(m, file) : api.fileUrl(m, file, \"240x240\"));\n // A video without a poster (not made yet, or no ffmpeg on the server) is a plain tile with the play badge.\n const pic = (!video || row.poster) && h(\"img\", { src: src(), alt: \"\", loading: \"lazy\", decoding: \"async\" });\n // A poster that fails leaves the plain tile.\n if (pic && video) pic.addEventListener(\"error\", () => pic.remove(), { signal });\n const label = `${name}${video ? \", video\" : \"\"}, ${m.expand?.author?.name ?? \"Unknown\"}, ${d.toLocaleDateString()}`;\n const tile: HTMLElement = h(\n \"button\",\n { type: \"button\", class: \"media-tile\", \"aria-label\": label, title: label, on: { click: () => open(item) }, signal },\n [pic, video && h(\"span\", { class: \"att-play\", \"aria-hidden\": \"true\" })],\n );\n const item = { message: m, file, video, tile };\n items.push(item);\n grid.append(tile);\n }\n\n function open({ message, file, tile }: (typeof items)[number]) {\n const images = items.map(({ tile: _, ...i }) => i).reverse();\n o.open(message, file, tile, images, [!done, false], () => close(true, false));\n }\n\n /**\n * A message deleted meanwhile (or a forward whose original was): its tiles go, and a month left empty its heading.\n * Opened, they said \"Couldn't load image\" (QA BUG-244).\n */\n o.follow((m, gone) => {\n const has = new Set(gone || m.deleted ? [] : (m.files ?? []));\n for (const it of items.filter((i) => i.message.id === m.id && !has.has(i.file))) {\n items.splice(items.indexOf(it), 1);\n const heading = it.tile.previousElementSibling;\n it.tile.remove();\n if (heading?.tagName === \"H3\" && (!heading.nextElementSibling || heading.nextElementSibling.tagName === \"H3\")) heading.remove();\n }\n if (done && !items.length) status.textContent = \"No photos or videos here yet.\";\n });\n\n const seen = new IntersectionObserver((es) => es.some((e) => e.isIntersecting) && void more(), {\n root: body,\n rootMargin: \"400px\",\n });\n\n /**\n * `back`: closed from the grid itself (\u00D7, Escape) or from the viewer's \"Show in chat\": leave its history entry too.\n * Not when Back closed it, nor when leaving the room (that would undo the navigation). `refocus`: put focus back on\n * the button (not when going to a message: the viewer focuses its tile). The closed dialog stays in the page until\n * then: the router passes over a grid entry with no grid (QA BUG-118), and would go Back a second time.\n */\n function close(back: boolean, refocus = true) {\n if (closed) return;\n closed = true;\n current = false;\n scope.abort();\n seen.disconnect();\n o.follow(undefined);\n if (dialog.open) dialog.close();\n if (back) leaving = leave().finally(() => dialog.remove());\n else dialog.remove();\n if (refocus) opener?.focus();\n }\n\n const popped = () => new Promise((r) => window.addEventListener(\"popstate\", r, { once: true }));\n const onViewer = () => !!(history.state as { viewer?: unknown } | null)?.viewer;\n\n /** Go Back off its entry; when the viewer is still on its way Back to it (\"Show in chat\"), once it has got there. */\n async function leave() {\n if (!onEntry() && onViewer()) await popped();\n if (!onEntry()) return;\n const gone = popped();\n history.back();\n await gone;\n }\n\n dialog.addEventListener(\"close\", () => close(true), { signal });\n\n void (async () => {\n await Promise.all([loadStylesheet(h), leaving]);\n if (closed) return;\n if (!onEntry()) history.pushState({ media: ENTRY }, \"\");\n // Back left its entry (and not for the viewer's, which is pushed on top of it).\n window.addEventListener(\"popstate\", () => !onEntry() && !onViewer() && close(false), { signal });\n document.body.append(dialog);\n dialog.showModal();\n seen.observe(status);\n })();\n}\n"],
|
|
5
|
+
"mappings": "AAwCA,IAAIA,EAAmC,KAEvC,SAASC,EAAeC,EAAqC,CAC3D,OAAAF,IAAe,IAAI,QAASG,GAAY,CAMtC,IAAMC,EAAOF,EAAE,OAAQ,CAAE,IAAK,aAAc,KAAM,6BAAW,GAAI,CAAE,KAAM,IAAMC,EAAQ,EAAG,MAL3E,IAAM,CACnBC,EAAK,OAAO,EACZJ,EAAa,KACbG,EAAQ,CACV,CACwG,CAAE,CAAC,EAC3G,SA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,MAAM,EAC1BwC,EAAMrD,EAAUuD,EAAM,EAAE,QAAQ,IAAM1C,EAAO,OAAO,CAAC,EACpDA,EAAO,OAAO,EACfyC,GAASjD,GAAQ,MAAM,EAC7B,CAEA,IAAMmD,EAAS,IAAM,IAAI,QAASC,GAAM,OAAO,iBAAiB,WAAYA,EAAG,CAAE,KAAM,EAAK,CAAC,CAAC,EACxFC,EAAW,IAAM,CAAC,CAAE,QAAQ,OAAuC,OAGzE,eAAeH,GAAQ,CAErB,GADI,CAACxD,EAAQ,GAAK2D,EAAS,GAAG,MAAMF,EAAO,EACvC,CAACzD,EAAQ,EAAG,OAChB,IAAMiD,EAAOQ,EAAO,EACpB,QAAQ,KAAK,EACb,MAAMR,CACR,CAEAnC,EAAO,iBAAiB,QAAS,IAAML,EAAM,EAAI,EAAG,CAAE,OAAAD,CAAO,CAAC,GAExD,UACJ,MAAM,QAAQ,IAAI,CAACb,EAAeC,CAAC,EAAGK,CAAO,CAAC,EAC1C,CAAAoB,IACCrB,EAAQ,GAAG,QAAQ,UAAU,CAAE,MAAOD,CAAM,EAAG,EAAE,EAEtD,OAAO,iBAAiB,WAAY,IAAM,CAACC,EAAQ,GAAK,CAAC2D,EAAS,GAAKlD,EAAM,EAAK,EAAG,CAAE,OAAAD,CAAO,CAAC,EAC/F,SAAS,KAAK,OAAOM,CAAM,EAC3BA,EAAO,UAAU,EACjBa,EAAK,QAAQf,CAAM,MAEvB",
|
|
6
|
+
"names": ["stylesheet", "loadStylesheet", "h", "resolve", "link", "ENTRY", "onEntry", "leaving", "current", "openMedia", "o", "api", "opener", "scope", "signal", "close", "title", "grid", "status", "body", "dialog", "items", "last", "messages", "done", "loading", "month", "closed", "monthOf", "more", "page", "it", "add", "seen", "messageOf", "m", "id", "sent", "author", "row", "file", "video", "d", "mo", "name", "src", "pic", "label", "tile", "open", "item", "message", "images", "_", "i", "gone", "has", "heading", "es", "e", "back", "refocus", "leave", "popped", "r", "onViewer"]
|
|
7
|
+
}
|
package/pb_public/index.html
CHANGED
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content">
|
|
6
6
|
<meta name="color-scheme" content="light dark">
|
|
7
7
|
<meta name="theme-color" content="#f1eefc" media="(prefers-color-scheme: light)">
|
|
8
|
-
<meta name="theme-color" content="#
|
|
8
|
+
<meta name="theme-color" content="#111214" media="(prefers-color-scheme: dark)">
|
|
9
9
|
<title>Chirkle</title>
|
|
10
10
|
<script>try{const t=localStorage.getItem("chat.theme");if(t==="light"||t==="dark")document.documentElement.dataset.theme=t}catch{}</script>
|
|
11
11
|
<link rel="manifest" href="/manifest.webmanifest">
|
|
12
12
|
<link rel="apple-touch-icon" href="/icons/apple-touch-icon.png">
|
|
13
13
|
<link rel="icon" type="image/svg+xml" href="/icons/icon.svg">
|
|
14
14
|
<link rel="preload" href="/assets/inter-latin-NRMW37G5.woff2" as="font" type="font/woff2" crossorigin>
|
|
15
|
-
<link rel="stylesheet" href="/assets/app-
|
|
15
|
+
<link rel="stylesheet" href="/assets/app-A3SXD3FF.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
18
18
|
<div id="app"><header class="app-bar"><span class="brand">Chirkle</span></header><main class="app-main"></main></div>
|
|
19
|
-
<script type="module" src="/assets/app-
|
|
19
|
+
<script type="module" src="/assets/app-NDSIQW4L.js"></script>
|
|
20
20
|
</body>
|
|
21
21
|
</html>
|