@vibelord/lanes 1.7.4 → 1.7.6

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.
@@ -13,13 +13,12 @@ if (typeof module === 'object') module.exports = {laneShellMode};
13
13
  const LANES_ANSI = {dark: ['#8792a0', '#ff7b6e', '#5fdc8a', '#ffc233', '#6fb6ff', '#c58bff', '#3fd9cf', '#a6b1be', '#97a3b1', '#ff9a8e', '#86f0ad', '#ffd866', '#98cbff', '#dcb2ff', '#7deee6', '#f2f5f8'], light: ['#2f3b34', '#c41c1c', '#0d7338', '#a04d00', '#1a56c4', '#8228c4', '#006f73', '#4a5661', '#55625b', '#d0221a', '#0e7a3a', '#a85200', '#1f5fd8', '#9133d0', '#00797c', '#111a14']};
14
14
  // END lanes tokens
15
15
  root.dataset.lanesShell = mode;
16
- const add = (tag, props) => document.head.append(Object.assign(document.createElement(tag), props));
17
- if (mode !== 'phone') {
18
- add('link', {rel: 'stylesheet', href: '/lanes-assets/browser.css'});
19
- add('script', {src: '/lanes-assets/browser.js'});
20
- }
21
- let d; const dir = () => !d && /^#lane(s$|=)/.test(globalThis.location?.hash) && add('script', {src: '/lanes-assets/directory.js'}, d = 1);
16
+ const add = (tag, props) => document.head.append(Object.assign(document.createElement(tag), props)), js = src => add('script', {src});
17
+ if (mode !== 'phone') add('link', {rel: 'stylesheet', href: '/lanes-assets/browser.css'}), js('/lanes-assets/browser.js');
18
+ let d; const dir = () => !d && /^#lane(s$|=)/.test(globalThis.location?.hash) && js('/lanes-assets/directory.js', d = 1);
19
+ let o; const ops = () => !o && /^#(inbox|schedule|results)(=|$)/.test(globalThis.location?.hash) && js('/lanes-assets/inbox.js', o = 1);
22
20
  globalThis.addEventListener?.('hashchange', dir); dir();
21
+ globalThis.addEventListener?.('hashchange', ops); ops();
23
22
  if (mode === 'desktop') return;
24
23
  root.classList.add('lanes-mobile');
25
24
  if (mode === 'tablet') {
@@ -75,10 +74,10 @@ if (typeof module === 'object') module.exports = {laneShellMode};
75
74
  if (stored >= 14 && stored <= 24) fontSize = stored;
76
75
  } catch {}
77
76
  const state = () => api?.getState();
78
- const data = () => state()?.data;
77
+ const data = () => state()?.data, paneAt = pos => data()?.panes.find(p => p.tab_position === pos && !p.is_plugin);
79
78
  const nativeClick = selector => document.querySelector(selector)?.click();
80
79
  const resize = () => window.dispatchEvent(new Event('zellij:rendering-resize'));
81
- const kbd = () => window.__zjSoftKbdCapture, aria = (el, label) => el.setAttribute('aria-label', label);
80
+ const kbd = () => window.__zjSoftKbdCapture, aria = (el, label) => el.setAttribute('aria-label', label), keep = ev => ev.preventDefault();
82
81
  const finder = (placeholder, label) => {
83
82
  const el = Object.assign(make('input'), {type: 'search', placeholder, autocomplete: 'off', spellcheck: false});
84
83
  aria(el, label);
@@ -117,8 +116,7 @@ if (typeof module === 'object') module.exports = {laneShellMode};
117
116
  aria(capture, 'Type in terminal');
118
117
  for (const a of ['type text', 'autocomplete off', 'autocapitalize none']) capture.setAttribute(...a.split(' '));
119
118
  capture.tabIndex = 0;
120
- capture.style.cssText = fill + 'box-sizing:border-box;font-size:16px;border:0;border-radius:12px;padding:0;margin:0;' +
121
- 'background:transparent;color:transparent;caret-color:transparent;outline:none;user-select:text;-webkit-user-select:text;';
119
+ capture.style.cssText = fill + 'box-sizing:border-box;font-size:16px;border:0;border-radius:12px;padding:0;margin:0;background:transparent;color:transparent;caret-color:transparent;outline:none;user-select:text;-webkit-user-select:text;';
122
120
  field.append(label, host);
123
121
  capture.addEventListener('beforeinput', ev => {
124
122
  const t = ev.data ?? ev.dataTransfer?.getData('text'), r = ev.getTargetRanges?.()[0];
@@ -131,14 +129,12 @@ if (typeof module === 'object') module.exports = {laneShellMode};
131
129
  return field;
132
130
  }
133
131
  function focusTab(tab) {
134
- const pane = data()?.panes.find(p => p.tab_position === tab?.position && !p.is_plugin);
132
+ const pane = paneAt(tab?.position);
135
133
  if (!pane) return;
136
134
  window.__zjSendControl?.({type: 'FocusPane', pane_id: pane.pane_id, is_plugin: false});
137
135
  closeSheet();
138
136
  }
139
- function currentTab() {
140
- return data()?.tabs.find(t => t.position === data()?.active_pane?.tab_position);
141
- }
137
+ const currentTab = () => data()?.tabs.find(t => t.position === data()?.active_pane?.tab_position);
142
138
  const GLYPHS = '◆◇▸✓', TONES = ['urgent', 'attention', 'working', 'done'];
143
139
  function parseCounts(title) {
144
140
  const c = {approval: 0, input: 0, working: 0, done: 0}, keys = Object.keys(c);
@@ -151,7 +147,7 @@ if (typeof module === 'object') module.exports = {laneShellMode};
151
147
  const pickerTab = name => data()?.tabs.find(t => t.name === `${name} ☰`);
152
148
  function pickerTitle(name) {
153
149
  const picker = pickerTab(name);
154
- return picker ? data()?.panes.find(p => p.tab_position === picker.position && !p.is_plugin)?.title || '' : '';
150
+ return picker ? paneAt(picker.position)?.title || '' : '';
155
151
  }
156
152
  function workspaces() {
157
153
  const tabs = data()?.tabs || [];
@@ -229,7 +225,7 @@ if (typeof module === 'object') module.exports = {laneShellMode};
229
225
  const copyKey = button('Copy screen', 'copy', () => clip(c => c.writeText(screen()), () => hint('Copied')));
230
226
  pasteKey = button('Paste', 'paste', () => clip(c => c.readText(), t => paste(t) && hint('Pasted')));
231
227
  for (const b of [copyKey, pasteKey, more]) b.classList.add('lanes-more');
232
- for (const b of [copyKey, pasteKey]) b.addEventListener('mousedown', ev => ev.preventDefault());
228
+ for (const b of [copyKey, pasteKey]) b.addEventListener('mousedown', keep);
233
229
  header.append(brand, context, copyKey, pasteKey, more);
234
230
  dock = make('nav', 'lanes-dock'); aria(dock, 'Workspace controls');
235
231
  const spaces = button('Workspaces', 'workspaces', openSheet);
@@ -273,7 +269,7 @@ if (typeof module === 'object') module.exports = {laneShellMode};
273
269
  root.classList.add('lanes-ready');
274
270
  for (const key of document.querySelectorAll('.zj-mobile-modbar button')) {
275
271
  key.addEventListener('pointerdown', ev => ev.stopImmediatePropagation(), true);
276
- key.addEventListener('mousedown', ev => ev.preventDefault());
272
+ key.addEventListener('mousedown', keep);
277
273
  }
278
274
  installFontControls();
279
275
  resize();
@@ -320,7 +316,7 @@ if (typeof module === 'object') module.exports = {laneShellMode};
320
316
  const b = make('button', hold ? 'is-destructive' : '', label);
321
317
  let down = -1;
322
318
  if (name) aria(b, name);
323
- b.addEventListener('mousedown', ev => ev.preventDefault());
319
+ b.addEventListener('mousedown', keep);
324
320
  b.addEventListener('pointerdown', ev => down = ev.timeStamp);
325
321
  for (const t of ['pointercancel', 'pointerleave']) b.addEventListener(t, () => down = -1);
326
322
  b.addEventListener('pointerup', ev => {
@@ -385,13 +381,10 @@ if (typeof module === 'object') module.exports = {laneShellMode};
385
381
  }
386
382
  function installFontControls() {
387
383
  const row = menuRow('Text size');
388
- const smaller = make('button', '', 'A−'), larger = make('button', '', 'A+');
389
- aria(smaller, 'Smaller terminal text');
390
- aria(larger, 'Larger terminal text');
384
+ const step = (t, name, by) => { const b = make('button', '', t); aria(b, name + ' terminal text');
385
+ b.addEventListener('click', () => {fontSize = Math.min(24, Math.max(14, fontSize + by)); applyFont();}); return b; };
391
386
  const value = make('output', '', `${fontSize} px`); value.id = 'lanes-font-value';
392
- smaller.addEventListener('click', () => {fontSize = Math.max(14, fontSize - 1); applyFont();});
393
- larger.addEventListener('click', () => {fontSize = Math.min(24, fontSize + 1); applyFont();});
394
- row.append(smaller, value, larger);
387
+ row.append(step('A−', 'Smaller', -1), value, step('A+', 'Larger', 1));
395
388
  Object.assign(menuRow('Docs', 'a', ' lanes-session-link'), {href: '/lanes-docs/', target: '_blank'});
396
389
  fetch('/enrol/site', {credentials: 'same-origin'}).then(r => r.json())
397
390
  .then(({version: v}) => /^\d[\w.+-]{0,31}$/.test(v) && menuRow(`Lanes v${v}`)).catch(() => {});
@@ -445,8 +438,9 @@ if (typeof module === 'object') module.exports = {laneShellMode};
445
438
  if (!token || token.dataset.lanes) return;
446
439
  token.dataset.lanes = 'true';
447
440
  token.autocomplete = 'current-password'; aria(token, 'Login token');
448
- token.closest('.security-modal-content').querySelector('h3').textContent = 'Connect to Lanes';
449
- token.closest('.security-modal-content').querySelector('.submit-btn').textContent = 'Connect';
441
+ const box = token.closest('.security-modal-content');
442
+ box.querySelector('h3').textContent = 'Connect to Lanes';
443
+ box.querySelector('.submit-btn').textContent = 'Connect';
450
444
  }
451
445
  viewport();
452
446
  window.addEventListener('resize', viewport);
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@vibelord/lanes",
3
- "version": "1.7.4",
4
- "commit": "780a5871e019c91660568ebe4a9e46eea763d31f",
5
- "digest": "sha256:029b0db521711cd0e911aca516c7b913a64d73cec05441c53ae798bbb6bc39b2",
3
+ "version": "1.7.6",
4
+ "commit": "fa84431eb78fc3f8fb627ca3902d1ea3886fff10",
5
+ "digest": "sha256:7c5d5bd4779c9bcdb35a5b0b37e9dc63cb5efcfd1076872c55e89d6dd90e7dc3",
6
6
  "executables": [
7
7
  "bin/lanes",
8
8
  "bin/lanes-site-serve",