anentrypoint-design 0.0.74 → 0.0.75

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anentrypoint-design",
3
- "version": "0.0.74",
3
+ "version": "0.0.75",
4
4
  "description": "247420 design system SDK — webjsx + modified ripple-ui, single-file ESM bundle for reproducible use of the AnEntrypoint design.",
5
5
  "type": "module",
6
6
  "main": "./dist/247420.js",
@@ -19,6 +19,7 @@
19
19
  "./desktop/theme.css": "./src/desktop/theme.css",
20
20
  "./desktop/wm.css": "./src/desktop/wm.css",
21
21
  "./desktop/wm.js": "./src/desktop/wm.js",
22
+ "./desktop/launcher.js": "./src/desktop/launcher.js",
22
23
  "./desktop/launcher.css": "./src/desktop/launcher.css",
23
24
  "./desktop/validate.css": "./src/desktop/validate.css",
24
25
  "./desktop/icons.js": "./src/desktop/icons.js",
@@ -1,3 +1,5 @@
1
1
  export { icons } from './icons.js';
2
2
  export { createDesktopShell } from './shell.js';
3
+ export { renderWindow } from './wm.js';
4
+ export { renderDock } from './launcher.js';
3
5
  export const themeUrl = new URL('./theme.css', import.meta.url).href;
@@ -0,0 +1,87 @@
1
+ // Launcher dock paint surface — pure DOM rendering, no lifecycle.
2
+ // Consumer (thebird) owns instance creation, fs/worker/shell wiring, teardown.
3
+ // renderDock returns a handle whose setInstances/setActive are called from
4
+ // lifecycle code. Visuals are bible-aligned: panel-select bg + accent inset
5
+ // rail for active, tonal hover, lowercase mono labels.
6
+
7
+ export function renderDock(opts = {}) {
8
+ const { root = document.body, callbacks = {} } = opts;
9
+
10
+ const el = document.createElement('div');
11
+ el.className = 'launcher-dock';
12
+
13
+ const addBtn = document.createElement('button');
14
+ addBtn.className = 'launcher-btn launcher-add';
15
+ addBtn.textContent = '+';
16
+ addBtn.title = 'new instance';
17
+ addBtn.addEventListener('click', () => callbacks.onNewInstance && callbacks.onNewInstance());
18
+ el.appendChild(addBtn);
19
+
20
+ const instancesHost = document.createElement('div');
21
+ instancesHost.className = 'launcher-instances';
22
+ instancesHost.style.display = 'flex';
23
+ instancesHost.style.flexDirection = 'column';
24
+ instancesHost.style.gap = '8px';
25
+ instancesHost.style.alignItems = 'center';
26
+ el.appendChild(instancesHost);
27
+
28
+ root.appendChild(el);
29
+
30
+ let activeId = null;
31
+ const buttons = new Map();
32
+
33
+ function clear() {
34
+ while (instancesHost.firstChild) instancesHost.removeChild(instancesHost.firstChild);
35
+ buttons.clear();
36
+ }
37
+
38
+ function setInstances(list) {
39
+ clear();
40
+ for (const inst of list) {
41
+ const row = document.createElement('div');
42
+ row.className = 'launcher-row';
43
+ row.dataset.instanceId = inst.id;
44
+ row.style.display = 'flex';
45
+ row.style.flexDirection = 'column';
46
+ row.style.gap = '2px';
47
+ row.style.alignItems = 'center';
48
+
49
+ const selBtn = document.createElement('button');
50
+ selBtn.className = 'launcher-btn';
51
+ selBtn.textContent = inst.label || inst.id;
52
+ selBtn.title = 'instance ' + inst.id;
53
+ selBtn.dataset.role = 'select';
54
+ selBtn.dataset.instanceId = inst.id;
55
+ if (inst.active || inst.id === activeId) selBtn.classList.add('active');
56
+ selBtn.addEventListener('click', () => callbacks.onSelectInstance && callbacks.onSelectInstance(inst.id));
57
+
58
+ const closeBtn = document.createElement('button');
59
+ closeBtn.className = 'launcher-btn launcher-close';
60
+ closeBtn.textContent = 'x';
61
+ closeBtn.title = 'close ' + inst.id;
62
+ closeBtn.dataset.role = 'close';
63
+ closeBtn.dataset.instanceId = inst.id;
64
+ closeBtn.addEventListener('click', e => {
65
+ e.stopPropagation();
66
+ callbacks.onCloseInstance && callbacks.onCloseInstance(inst.id);
67
+ });
68
+
69
+ row.append(selBtn, closeBtn);
70
+ instancesHost.appendChild(row);
71
+ buttons.set(inst.id, { selBtn, closeBtn, row });
72
+ }
73
+ if (activeId && !buttons.has(activeId)) activeId = null;
74
+ }
75
+
76
+ function setActive(id) {
77
+ activeId = id;
78
+ for (const [iid, b] of buttons) b.selBtn.classList.toggle('active', iid === id);
79
+ }
80
+
81
+ function dispose() {
82
+ el.remove();
83
+ buttons.clear();
84
+ }
85
+
86
+ return { el, setInstances, setActive, dispose };
87
+ }