tmux-weblink 3.1.1 → 3.2.1

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.
@@ -152,6 +152,16 @@ import{escapeHtml as c}from"./html.js";import{icon as i,iconPath as r}from"./ico
152
152
  .sidebar-divider { border: none; border-top: 1px solid var(--panel-border); margin: 14px 0; }
153
153
 
154
154
  /* \u2500\u2500 New session modal \u2500\u2500 */
155
+ @media (max-width: 640px) {
156
+ /* Higher specificity than the desktop rules that follow, so the sheet wins. */
157
+ .modal-backdrop.open { align-items: flex-end; padding: 0; }
158
+ .modal-backdrop.open .modal-panel {
159
+ width: 100%; max-width: 100%; max-height: 90vh; overflow-y: auto;
160
+ border-radius: 16px 16px 0 0;
161
+ padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
162
+ border-left: none; border-right: none; border-bottom: none;
163
+ }
164
+ }
155
165
  .modal-backdrop {
156
166
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3);
157
167
  z-index: 500; align-items: center; justify-content: center;
@@ -250,7 +260,7 @@ import{escapeHtml as c}from"./html.js";import{icon as i,iconPath as r}from"./ico
250
260
  <script>${y()}</script>`}function A(e){const{activePage:o,refreshHref:a}=e;function t(l,f,b,x,g=""){return`<a href="${f}" class="${l!==null&&l===o?"sidebar-btn current":"sidebar-btn"}"${g}>
251
261
  <svg viewBox="0 0 24 24" fill="currentColor">${b}</svg>
252
262
  ${x}
253
- </a>`}const s=r("sessions"),p=r("notes"),h=r("history"),u=r("quick-commands"),m=r("file"),k=r("refresh");return`<aside class="action-sidebar">
263
+ </a>`}const s=r("sessions"),p=r("notes"),h=r("history"),m=r("quick-commands"),u=r("file"),k=r("refresh");return`<aside class="action-sidebar">
254
264
  <p class="sidebar-label">Actions</p>
255
265
  <button class="sidebar-btn primary" id="new-session-btn">
256
266
  ${i("add")}
@@ -259,15 +269,25 @@ import{escapeHtml as c}from"./html.js";import{icon as i,iconPath as r}from"./ico
259
269
  <hr class="sidebar-divider">
260
270
  ${t("home","/",s,"Sessions")}
261
271
  ${t("notes","/notes",p,"All Notes")}
262
- ${t("files","/files",m,"Files")}
272
+ ${t("files","/files",u,"Files")}
263
273
  ${t("history","/history",h,"History")}
264
- ${t("quickCommands","/quick-commands",u,"Quick Commands")}
274
+ ${t("quickCommands","/quick-commands",m,"Quick Commands")}
265
275
  <hr class="sidebar-divider">
266
276
  <a href="${a}" class="sidebar-btn">
267
277
  ${i("refresh")}
268
278
  Refresh
269
279
  </a>
270
- </aside>`}function T(){return` /* \u2500\u2500 New session modal \u2500\u2500 */
280
+ </aside>`}function D(){return` /* \u2500\u2500 New session modal \u2500\u2500 */
281
+ @media (max-width: 640px) {
282
+ /* Higher specificity than the desktop rules that follow, so the sheet wins. */
283
+ .modal-backdrop.open { align-items: flex-end; padding: 0; }
284
+ .modal-backdrop.open .modal-panel {
285
+ width: 100%; max-width: 100%; max-height: 90vh; overflow-y: auto;
286
+ border-radius: 16px 16px 0 0;
287
+ padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
288
+ border-left: none; border-right: none; border-bottom: none;
289
+ }
290
+ }
271
291
  .modal-backdrop {
272
292
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3);
273
293
  z-index: 500; align-items: center; justify-content: center;
@@ -377,7 +397,7 @@ import{escapeHtml as c}from"./html.js";import{icon as i,iconPath as r}from"./ico
377
397
  <button class="modal-btn confirm" id="ns-submit">Create</button>
378
398
  </div>
379
399
  </div>
380
- </div>`}function z(e){return`(function() {
400
+ </div>`}function T(e){return`(function() {
381
401
  const modal = document.getElementById('new-session-modal');
382
402
  const openBtn = document.getElementById('new-session-btn');
383
403
  const cancelBtn = document.getElementById('ns-cancel');
@@ -402,14 +422,26 @@ import{escapeHtml as c}from"./html.js";import{icon as i,iconPath as r}from"./ico
402
422
  return id ? '/a/' + encodeURIComponent(id) : '';
403
423
  }
404
424
 
405
- function openModal() {
425
+ // presetDir creates the session in a known folder (the + on a sidebar group):
426
+ // the directory is filled in, the tree opens there and the name is suggested from
427
+ // the folder so a tap on Create is enough.
428
+ function openModal(presetDir) {
406
429
  modal.classList.add('open');
407
430
  nameInput.value = '';
408
- dirInput.value = '';
431
+ dirInput.value = typeof presetDir === 'string' ? presetDir : '';
432
+ nameInput.value = presetDir ? suggestedName(presetDir) : '';
409
433
  errorEl.style.display = 'none';
410
434
  errorEl.textContent = '';
411
435
  closeDropdown();
412
- openTreeForSession().then(() => setTimeout(() => nameInput.focus(), 50));
436
+ openTreeForSession(presetDir).then(() => setTimeout(() => {
437
+ nameInput.focus();
438
+ if (nameInput.value) nameInput.select();
439
+ }, 50));
440
+ }
441
+
442
+ function suggestedName(dir) {
443
+ const base = String(dir).split('/').filter(Boolean).pop();
444
+ return base || '';
413
445
  }
414
446
 
415
447
  function closeModal() { modal.classList.remove('open'); closeDropdown(); closeTree(); }
@@ -664,11 +696,12 @@ import{escapeHtml as c}from"./html.js";import{icon as i,iconPath as r}from"./ico
664
696
  // On modal open, expand the tree directly to the currently selected
665
697
  // session's working directory (window.__tmuxWebCurrentSession is set by
666
698
  // the shell client; falls back to the home directory otherwise).
667
- async function openTreeForSession() {
699
+ async function openTreeForSession(presetDir) {
668
700
  treeRoot = '/';
669
701
  treePanel.classList.add('open');
670
702
  treeOpen = true;
671
- const target = await treeOpenTarget();
703
+ const preset = typeof presetDir === 'string' && presetDir.startsWith('/') ? presetDir : '';
704
+ const target = preset || await treeOpenTarget();
672
705
  await treeExpandTo(target);
673
706
  }
674
707
 
@@ -745,4 +778,4 @@ import{escapeHtml as c}from"./html.js";import{icon as i,iconPath as r}from"./ico
745
778
  if (e.key === 'Enter') submit();
746
779
  });
747
780
  window.__openNewSessionModal = openModal;
748
- })();`}export{T as newSessionModalCSS,B as newSessionModalHTML,z as newSessionModalScript,w as reducedMotion,R as sharedHeader,L as sharedLayoutCSS,A as sharedSidebar,v as themeSwitcherButtonHTML,y as themeSwitcherScript};
781
+ })();`}export{D as newSessionModalCSS,B as newSessionModalHTML,T as newSessionModalScript,w as reducedMotion,R as sharedHeader,L as sharedLayoutCSS,A as sharedSidebar,v as themeSwitcherButtonHTML,y as themeSwitcherScript};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tmux-weblink",
3
- "version": "3.1.1",
3
+ "version": "3.2.1",
4
4
  "description": "Access your tmux sessions from the browser. A continuation of tmux-web and persalink.",
5
5
  "type": "module",
6
6
  "bin": {