anentrypoint-design 0.0.414 → 0.0.415

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.
Files changed (102) hide show
  1. package/dist/247420.js +62 -12
  2. package/dist/app-shell.css +40 -594
  3. package/dist/colors_and_type.css +607 -47
  4. package/dist/index.html +227 -277
  5. package/dist/preview/buttons.html +39 -28
  6. package/dist/preview/colors-core.html +18 -8
  7. package/dist/preview/colors-lore.html +26 -17
  8. package/dist/preview/colors-semantic.html +24 -18
  9. package/dist/preview/dateline.html +6 -5
  10. package/dist/preview/dropzone.html +4 -3
  11. package/dist/preview/file-grid.html +10 -9
  12. package/dist/preview/file-row.html +14 -13
  13. package/dist/preview/file-toolbar.html +4 -3
  14. package/dist/preview/file-viewer.html +4 -3
  15. package/dist/preview/header.html +26 -24
  16. package/dist/preview/icons-unicode.html +8 -5
  17. package/dist/preview/index-row.html +17 -9
  18. package/dist/preview/inputs.html +4 -3
  19. package/dist/preview/manifesto.html +34 -17
  20. package/dist/preview/motion-default.js +77 -57
  21. package/dist/preview/rules.html +4 -3
  22. package/dist/preview/spacing.html +13 -12
  23. package/dist/preview/stamps-lore.html +5 -4
  24. package/dist/preview/stamps.html +4 -3
  25. package/dist/preview/theme-ink.html +7 -6
  26. package/dist/preview/type-display.html +14 -5
  27. package/dist/preview/type-mono.html +6 -5
  28. package/dist/preview/type-prose.html +12 -10
  29. package/dist/preview/type-scale.html +4 -3
  30. package/dist/preview/wordmarks.html +10 -7
  31. package/dist/site/content/globals/site.yaml +5 -3
  32. package/dist/site/content/pages/freddie.yaml +2 -2
  33. package/dist/site/content/pages/home.yaml +55 -55
  34. package/dist/site/theme.mjs +96 -348
  35. package/dist/slides/index.html +13 -13
  36. package/dist/src/bootstrap.js +10 -1
  37. package/dist/src/components/chat.js +43 -195
  38. package/dist/src/components/community.js +18 -166
  39. package/dist/src/components/content.js +30 -210
  40. package/dist/src/components/files-modals.js +14 -106
  41. package/dist/src/components/files.js +15 -116
  42. package/dist/src/components/freddie/helpers.js +53 -8
  43. package/dist/src/components/freddie.js +35 -25
  44. package/dist/src/components/shell.js +16 -114
  45. package/dist/src/components/theme-toggle.js +69 -25
  46. package/dist/src/components.js +92 -13
  47. package/dist/src/deck-stage.js +6 -4
  48. package/dist/src/highlight.js +51 -7
  49. package/dist/src/index.js +58 -12
  50. package/dist/src/kits/os/about-app.js +2 -3
  51. package/dist/src/kits/os/app-panes.css +46 -70
  52. package/dist/src/kits/os/browser-app.js +28 -1
  53. package/dist/src/kits/os/files-app.js +7 -0
  54. package/dist/src/kits/os/freddie/pages-chat.js +90 -75
  55. package/dist/src/kits/os/freddie/pages-core.js +9 -9
  56. package/dist/src/kits/os/freddie/pages-os.js +8 -8
  57. package/dist/src/kits/os/freddie/pages-tools.js +14 -14
  58. package/dist/src/kits/os/freddie/routes.js +21 -19
  59. package/dist/src/kits/os/freddie-dashboard.css +42 -21
  60. package/dist/src/kits/os/freddie-dashboard.js +6 -6
  61. package/dist/src/kits/os/icons.js +38 -16
  62. package/dist/src/kits/os/index.js +11 -0
  63. package/dist/src/kits/os/launcher.css +26 -10
  64. package/dist/src/kits/os/launcher.js +3 -0
  65. package/dist/src/kits/os/shell.js +72 -108
  66. package/dist/src/kits/os/terminal-app.js +1 -1
  67. package/dist/src/kits/os/theme.css +1330 -150
  68. package/dist/src/kits/os/wm.css +68 -15
  69. package/dist/src/kits/os/wm.js +93 -17
  70. package/dist/src/markdown.js +121 -12
  71. package/dist/src/motion.js +18 -2
  72. package/dist/src/page-html.js +62 -134
  73. package/dist/src/theme.js +106 -13
  74. package/dist/src/web-components/ds-chat.js +80 -9
  75. package/dist/ui_kits/aicat/app.js +54 -6
  76. package/dist/ui_kits/aicat/index.html +2 -0
  77. package/dist/ui_kits/blog/index.html +33 -17
  78. package/dist/ui_kits/chat/app.js +90 -22
  79. package/dist/ui_kits/chat/index.html +2 -0
  80. package/dist/ui_kits/community/app.js +86 -24
  81. package/dist/ui_kits/community/index.html +1 -0
  82. package/dist/ui_kits/dashboard/app.js +123 -34
  83. package/dist/ui_kits/dashboard/index.html +1 -0
  84. package/dist/ui_kits/docs/index.html +43 -33
  85. package/dist/ui_kits/error_404/app.js +78 -23
  86. package/dist/ui_kits/file_browser/README.md +1 -1
  87. package/dist/ui_kits/file_browser/app.js +45 -10
  88. package/dist/ui_kits/file_browser/index.html +1 -0
  89. package/dist/ui_kits/gallery/app.js +130 -51
  90. package/dist/ui_kits/homepage/app.js +156 -138
  91. package/dist/ui_kits/project_page/app.js +142 -125
  92. package/dist/ui_kits/project_page/index.html +2 -1
  93. package/dist/ui_kits/search/app.js +52 -15
  94. package/dist/ui_kits/settings/app.js +166 -39
  95. package/dist/ui_kits/signin/app.js +175 -49
  96. package/dist/ui_kits/signin/index.html +1 -0
  97. package/dist/ui_kits/slide_deck/app.js +83 -49
  98. package/dist/ui_kits/system_primer/app.js +57 -40
  99. package/dist/ui_kits/terminal/app.js +160 -43
  100. package/package.json +1 -1
  101. package/src/page-html/client-script.js +40 -11
  102. package/src/page-html/page-styles.js +22 -1
@@ -1,32 +1,14 @@
1
- import { icons } from './icons.js';
2
-
3
- const THEME_CSS_URL = new URL('./theme.css', import.meta.url).href;
4
-
5
- function ensureCss(href) {
6
- if (document.querySelector('link[data-os-theme]')) return;
7
- const l = document.createElement('link');
8
- l.rel = 'stylesheet';
9
- l.href = href || THEME_CSS_URL;
10
- l.dataset.osTheme = '1';
11
- document.head.appendChild(l);
12
- }
13
-
14
- function ic(svg) {
15
- const s = document.createElement('span');
16
- s.className = 'ic';
17
- s.innerHTML = svg;
18
- return s;
19
- }
20
-
21
- function makeBtn(svg, label, role) {
22
- const b = document.createElement('button');
23
- b.className = 'os-btn';
24
- b.type = 'button';
25
- if (role) b.dataset.role = role;
26
- if (svg) b.append(ic(svg));
27
- if (label) b.append(Object.assign(document.createElement('span'), { textContent: label }));
28
- return b;
29
- }
1
+ // createDesktopShell the desktop OS shell: assembles the menubar / apps
2
+ // menu / side rail / drawer / taskbar chrome (built by ./shell-chrome.js),
3
+ // owns the shared mutable state those surfaces read (active context, active
4
+ // instance, taskbar signature, drawer focus return), and drives window
5
+ // spawning through ./shell-geometry.js.
6
+
7
+ import {
8
+ ensureCss, buildMenubar, buildAppsMenu, buildSideRail, buildDrawer,
9
+ buildTaskbar, buildAppEntries,
10
+ } from './shell-chrome.js';
11
+ import { computeSpawnRect, reflowWindows } from './shell-geometry.js';
30
12
 
31
13
  export function createDesktopShell({ root = document.body, wm, registry, brand = 'desktop', themeUrl, onNewInstance, autoBoot = false } = {}) {
32
14
  if (!wm) throw new Error('createDesktopShell: wm is required');
@@ -37,94 +19,51 @@ export function createDesktopShell({ root = document.body, wm, registry, brand =
37
19
  osRoot.className = 'os-root';
38
20
  root.appendChild(osRoot);
39
21
 
40
- const menubar = document.createElement('div');
41
- menubar.className = 'os-menubar';
42
-
43
- const homeBtn = makeBtn(icons.home, '', 'home');
44
- homeBtn.title = 'apps';
45
-
46
- const brandEl = document.createElement('span');
47
- brandEl.className = 'os-brand';
48
- brandEl.textContent = brand;
49
-
50
- const appsBtn = makeBtn(icons.apps, 'apps', 'apps');
51
- const newInstBtn = onNewInstance ? makeBtn(icons.plus, 'instance', 'add') : null;
52
-
53
- const instSwitch = document.createElement('div');
54
- instSwitch.className = 'os-instances';
55
-
56
- const spacer = document.createElement('div');
57
- spacer.className = 'os-spacer';
58
-
59
- const tray = document.createElement('div');
60
- tray.className = 'os-tray';
61
- const clock = document.createElement('span');
62
- clock.className = 'os-clock';
63
- tray.appendChild(clock);
64
-
65
- menubar.append(homeBtn, brandEl, appsBtn);
66
- if (newInstBtn) menubar.append(newInstBtn);
67
- menubar.append(instSwitch, spacer, tray);
68
-
69
- const appsMenu = document.createElement('div');
70
- appsMenu.className = 'os-menu';
71
-
72
- const sideRail = document.createElement('div');
73
- sideRail.className = 'os-side-rail';
74
-
75
- const drawer = document.createElement('div');
76
- drawer.className = 'os-drawer';
77
- drawer.setAttribute('aria-hidden', 'true');
78
- const drawerHeader = document.createElement('div');
79
- drawerHeader.className = 'os-drawer-head';
80
- const drawerTitle = document.createElement('span');
81
- drawerTitle.className = 'os-drawer-title';
82
- drawerTitle.textContent = 'apps';
83
- const drawerClose = document.createElement('button');
84
- drawerClose.className = 'os-drawer-close';
85
- drawerClose.type = 'button';
86
- drawerClose.append(ic(icons.close));
87
- drawerHeader.append(drawerTitle, drawerClose);
88
- const drawerGrid = document.createElement('div');
89
- drawerGrid.className = 'os-drawer-grid';
90
- drawer.append(drawerHeader, drawerGrid);
22
+ const { menubar, homeBtn, appsBtn, newInstBtn, instSwitch, clock } =
23
+ buildMenubar({ brand, withNewInstance: !!onNewInstance });
24
+ const appsMenu = buildAppsMenu();
25
+ const sideRail = buildSideRail();
26
+ const { drawer, drawerClose, drawerGrid } = buildDrawer();
27
+ const taskbar = buildTaskbar();
91
28
 
92
29
  const apps = typeof registry.list === 'function' ? registry.list() : [...registry.values()];
93
30
 
94
31
  for (const app of apps) {
95
- const iconSvg = app.icon || icons[app.id] || '';
96
- const menuBtn = makeBtn(iconSvg, app.name);
97
- menuBtn.addEventListener('click', () => { closeMenu(); openApp(app.id); });
32
+ const { menuBtn, railBtn, tile } = buildAppEntries(app, {
33
+ onMenuClick: () => { closeMenu(); openApp(app.id); },
34
+ onRailClick: () => openApp(app.id),
35
+ onTileClick: () => { closeDrawer(); openApp(app.id); },
36
+ });
98
37
  appsMenu.appendChild(menuBtn);
99
-
100
- const railBtn = document.createElement('button');
101
- railBtn.className = 'os-rail-btn';
102
- railBtn.type = 'button';
103
- railBtn.title = app.name;
104
- railBtn.append(ic(iconSvg));
105
- railBtn.addEventListener('click', () => openApp(app.id));
106
38
  sideRail.appendChild(railBtn);
107
-
108
- const tile = document.createElement('button');
109
- tile.className = 'os-drawer-tile';
110
- tile.type = 'button';
111
- tile.append(ic(iconSvg), Object.assign(document.createElement('span'), { className: 'lbl', textContent: app.name }));
112
- tile.addEventListener('click', () => { closeDrawer(); openApp(app.id); });
113
39
  drawerGrid.appendChild(tile);
114
40
  }
115
41
 
116
- const taskbar = document.createElement('div');
117
- taskbar.className = 'os-taskbar';
118
-
119
42
  osRoot.append(menubar, appsMenu, taskbar);
120
43
  document.body.append(sideRail, drawer);
121
44
 
122
- function openMenu() { appsMenu.classList.add('open'); }
123
- function closeMenu() { appsMenu.classList.remove('open'); }
124
- function openDrawer() { drawer.classList.add('open'); drawer.setAttribute('aria-hidden', 'false'); }
125
- function closeDrawer() { drawer.classList.remove('open'); drawer.setAttribute('aria-hidden', 'true'); }
45
+ function openMenu() { appsMenu.classList.add('open'); appsBtn.setAttribute('aria-expanded', 'true'); }
46
+ function closeMenu() { appsMenu.classList.remove('open'); appsBtn.setAttribute('aria-expanded', 'false'); }
47
+ // Focus management: opening the drawer moves keyboard focus onto its
48
+ // close button (the first reachable control inside the now-visible
49
+ // dialog) so Tab starts inside it, not lost on a now-hidden ancestor;
50
+ // closing restores focus to whichever element opened it (homeBtn is the
51
+ // only trigger today) so the user's keyboard position isn't lost.
52
+ let drawerReturnFocus = null;
53
+ function openDrawer() {
54
+ drawerReturnFocus = document.activeElement;
55
+ drawer.classList.add('open');
56
+ drawer.setAttribute('aria-hidden', 'false');
57
+ drawerClose.focus();
58
+ }
59
+ function closeDrawer() {
60
+ drawer.classList.remove('open');
61
+ drawer.setAttribute('aria-hidden', 'true');
62
+ if (drawerReturnFocus && typeof drawerReturnFocus.focus === 'function') drawerReturnFocus.focus();
63
+ drawerReturnFocus = null;
64
+ }
126
65
 
127
- appsBtn.addEventListener('click', e => { e.stopPropagation(); appsMenu.classList.toggle('open'); });
66
+ appsBtn.addEventListener('click', e => { e.stopPropagation(); appsMenu.classList.contains('open') ? closeMenu() : openMenu(); });
128
67
  homeBtn.addEventListener('click', e => { e.stopPropagation(); drawer.classList.contains('open') ? closeDrawer() : openDrawer(); });
129
68
  drawerClose.addEventListener('click', closeDrawer);
130
69
  drawer.addEventListener('click', e => { if (e.target === drawer) closeDrawer(); });
@@ -147,24 +86,45 @@ export function createDesktopShell({ root = document.body, wm, registry, brand =
147
86
  if (!activeInstanceId) return;
148
87
  for (const wEl of document.querySelectorAll('.wm-win[data-instance-id]')) {
149
88
  const wInst = wEl.dataset.instanceId;
150
- wEl.style.display = (wInst === activeInstanceId) ? '' : 'none';
89
+ wEl.classList.toggle('wm-inst-hidden', wInst !== activeInstanceId);
151
90
  }
152
91
  }
153
92
 
93
+ let taskbarSig = null;
154
94
  function refreshTaskbar() {
155
- taskbar.innerHTML = '';
95
+ const items = [];
156
96
  for (const w of wm.list()) {
157
97
  const wEl = document.querySelector('.wm-win[data-id="' + w.id + '"]');
158
98
  const wInst = wEl && wEl.dataset.instanceId;
159
99
  if (activeInstanceId && wInst && wInst !== activeInstanceId) continue;
100
+ items.push(w);
101
+ }
102
+ // Diff-aware rebuild: the 500ms poll must not reset the taskbar's
103
+ // horizontal scroll (mobile scroll-snap) or button focus every tick.
104
+ const sig = items.map(w => w.id + ' ' + w.title + ' ' + (w.focused ? 1 : 0)).join('');
105
+ if (sig === taskbarSig) return;
106
+ taskbarSig = sig;
107
+ const sl = taskbar.scrollLeft;
108
+ taskbar.innerHTML = '';
109
+ if (!items.length) {
110
+ const empty = document.createElement('span');
111
+ empty.className = 'os-task-empty';
112
+ empty.textContent = 'no windows';
113
+ taskbar.appendChild(empty);
114
+ }
115
+ for (const w of items) {
160
116
  const t = document.createElement('button');
161
117
  t.className = 'os-task' + (w.focused ? ' focused' : '');
162
118
  t.type = 'button';
163
119
  t.textContent = w.title;
164
120
  t.dataset.winId = w.id;
121
+ // aria-current announces which window is the active one; a
122
+ // sighted user reads this from the .focused visual state alone.
123
+ if (w.focused) t.setAttribute('aria-current', 'true');
165
124
  t.addEventListener('click', () => wm.focus(w.id));
166
125
  taskbar.appendChild(t);
167
126
  }
127
+ taskbar.scrollLeft = sl;
168
128
  }
169
129
 
170
130
  function setActiveInstance(id) {
@@ -183,8 +143,9 @@ export function createDesktopShell({ root = document.body, wm, registry, brand =
183
143
  const result = app.factory(ctx);
184
144
  const finish = (r) => {
185
145
  const sz = app.defaultSize || { w: 520, h: 360 };
146
+ const { w, h, x, y, maximized } = computeSpawnRect(sz, wm.count);
186
147
  const titlePrefix = (activeContext && activeContext.titlePrefix) ? activeContext.titlePrefix + ' · ' : '';
187
- const win = wm.open({ title: titlePrefix + app.name, body: r.node, kind: appId, width: sz.w, height: sz.h, x: 100 + (wm.count * 28) % 240, y: 80 + (wm.count * 22) % 180 });
148
+ const win = wm.open({ title: titlePrefix + app.name, body: r.node, kind: appId, width: w, height: h, x, y, maximized });
188
149
  win._app = { id: appId, dispose: r.dispose };
189
150
  if (activeInstanceId && win.el) {
190
151
  win.el.dataset.instanceId = activeInstanceId;
@@ -201,12 +162,15 @@ export function createDesktopShell({ root = document.body, wm, registry, brand =
201
162
 
202
163
  const taskTimer = setInterval(refreshTaskbar, 500);
203
164
 
165
+ const onViewportResize = () => reflowWindows(wm);
166
+ window.addEventListener('resize', onViewportResize);
167
+
204
168
  const api = {
205
169
  wm, registry, openApp, setContext, refreshTaskbar, setActiveInstance,
206
170
  openDrawer, closeDrawer, openMenu, closeMenu,
207
171
  get activeInstanceId() { return activeInstanceId; },
208
172
  elements: { osRoot, menubar, taskbar, appsMenu, sideRail, drawer, instSwitch, homeBtn, appsBtn },
209
- dispose() { clearInterval(clockTimer); clearInterval(taskTimer); osRoot.remove(); sideRail.remove(); drawer.remove(); },
173
+ dispose() { clearInterval(clockTimer); clearInterval(taskTimer); window.removeEventListener('resize', onViewportResize); osRoot.remove(); sideRail.remove(); drawer.remove(); },
210
174
  };
211
175
 
212
176
  if (autoBoot && typeof autoBoot === 'string') openApp(autoBoot);
@@ -30,7 +30,7 @@ export function renderTerminal(opts = {}) {
30
30
  term.open(slot);
31
31
  if (term._addonManager) {
32
32
  const addons = term._addonManager._addons || [];
33
- for (const a of addons) { try { a.instance && a.instance.fit && a.instance.fit(); } catch (_) {} }
33
+ for (const a of addons) { try { a.instance && a.instance.fit && a.instance.fit(); } catch (_) { /* swallow: an addon's fit() failing must not block mounting the terminal */ } }
34
34
  }
35
35
  }
36
36