quilt-vanilla 0.1.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/LICENSE +21 -0
- package/README.md +58 -0
- package/dist/action-icons.d.ts +18 -0
- package/dist/action-icons.d.ts.map +1 -0
- package/dist/action-icons.js +36 -0
- package/dist/action-icons.js.map +1 -0
- package/dist/chrome-icons.d.ts +3 -0
- package/dist/chrome-icons.d.ts.map +1 -0
- package/dist/chrome-icons.js +32 -0
- package/dist/chrome-icons.js.map +1 -0
- package/dist/corners.d.ts +8 -0
- package/dist/corners.d.ts.map +1 -0
- package/dist/corners.js +205 -0
- package/dist/corners.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/lifetime.d.ts +10 -0
- package/dist/lifetime.d.ts.map +1 -0
- package/dist/lifetime.js +44 -0
- package/dist/lifetime.js.map +1 -0
- package/dist/menu.d.ts +10 -0
- package/dist/menu.d.ts.map +1 -0
- package/dist/menu.js +356 -0
- package/dist/menu.js.map +1 -0
- package/dist/panes.d.ts +13 -0
- package/dist/panes.d.ts.map +1 -0
- package/dist/panes.js +58 -0
- package/dist/panes.js.map +1 -0
- package/dist/picker.d.ts +6 -0
- package/dist/picker.d.ts.map +1 -0
- package/dist/picker.js +112 -0
- package/dist/picker.js.map +1 -0
- package/dist/registry.d.ts +25 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +39 -0
- package/dist/registry.js.map +1 -0
- package/dist/renderer.d.ts +3 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +570 -0
- package/dist/renderer.js.map +1 -0
- package/dist/resize.d.ts +7 -0
- package/dist/resize.d.ts.map +1 -0
- package/dist/resize.js +56 -0
- package/dist/resize.js.map +1 -0
- package/dist/shortcuts.d.ts +6 -0
- package/dist/shortcuts.d.ts.map +1 -0
- package/dist/shortcuts.js +64 -0
- package/dist/shortcuts.js.map +1 -0
- package/dist/styles.css +842 -0
- package/dist/tab-bar.d.ts +6 -0
- package/dist/tab-bar.d.ts.map +1 -0
- package/dist/tab-bar.js +336 -0
- package/dist/tab-bar.js.map +1 -0
- package/dist/tab-tooltip.d.ts +4 -0
- package/dist/tab-tooltip.d.ts.map +1 -0
- package/dist/tab-tooltip.js +95 -0
- package/dist/tab-tooltip.js.map +1 -0
- package/dist/tabs.d.ts +15 -0
- package/dist/tabs.d.ts.map +1 -0
- package/dist/tabs.js +126 -0
- package/dist/tabs.js.map +1 -0
- package/dist/theme.d.ts +206 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +166 -0
- package/dist/theme.js.map +1 -0
- package/dist/types.d.ts +66 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/windows.d.ts +23 -0
- package/dist/windows.d.ts.map +1 -0
- package/dist/windows.js +247 -0
- package/dist/windows.js.map +1 -0
- package/package.json +50 -0
- package/src/action-icons.ts +40 -0
- package/src/chrome-icons.ts +30 -0
- package/src/corners.ts +259 -0
- package/src/index.ts +27 -0
- package/src/lifetime.ts +46 -0
- package/src/menu.ts +432 -0
- package/src/panes.ts +76 -0
- package/src/picker.ts +114 -0
- package/src/registry.ts +46 -0
- package/src/renderer.ts +654 -0
- package/src/resize.ts +65 -0
- package/src/shortcuts.ts +90 -0
- package/src/styles.css +842 -0
- package/src/tab-bar.ts +382 -0
- package/src/tab-tooltip.ts +96 -0
- package/src/tabs.ts +129 -0
- package/src/theme.ts +211 -0
- package/src/types.ts +67 -0
- package/src/windows.ts +244 -0
package/dist/tabs.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { chromeIcon } from './chrome-icons.js';
|
|
2
|
+
import { el } from './lifetime.js';
|
|
3
|
+
import { shortcutEnabled } from './shortcuts.js';
|
|
4
|
+
/** Header nodes are disposable; pane views are owned separately by the renderer. */
|
|
5
|
+
export function fillTabs(tabs, group, panes, deps) {
|
|
6
|
+
const { options, prefix, act } = deps;
|
|
7
|
+
const doc = tabs.ownerDocument;
|
|
8
|
+
panes.forEach((pane, i) => {
|
|
9
|
+
const active = pane.id === group.active;
|
|
10
|
+
const item = el(doc, 'div', 'layouts-tab-item');
|
|
11
|
+
item.dataset.active = String(active);
|
|
12
|
+
const tab = el(doc, 'button', 'layouts-tab');
|
|
13
|
+
tab.type = 'button';
|
|
14
|
+
tab.setAttribute('aria-label', pane.title);
|
|
15
|
+
tab.setAttribute('role', 'tab');
|
|
16
|
+
tab.setAttribute('aria-selected', String(active));
|
|
17
|
+
tab.tabIndex = active ? 0 : -1;
|
|
18
|
+
tab.dataset.focusId = `tab-${pane.id}`;
|
|
19
|
+
tab.id = `${prefix}-tab-${pane.id}`;
|
|
20
|
+
tab.setAttribute('aria-controls', `${prefix}-panel-${pane.id}`);
|
|
21
|
+
const icon = el(doc, 'span', 'layouts-tab-icon');
|
|
22
|
+
icon.setAttribute('aria-hidden', 'true');
|
|
23
|
+
let resolved;
|
|
24
|
+
act(() => {
|
|
25
|
+
resolved = pane.icon ? options.renderIcon?.(pane.icon, doc) : undefined;
|
|
26
|
+
});
|
|
27
|
+
if (resolved)
|
|
28
|
+
icon.append(resolved);
|
|
29
|
+
else
|
|
30
|
+
icon.textContent = Array.from(pane.title.trim())[0] || '•';
|
|
31
|
+
tab.append(icon, el(doc, 'span', 'layouts-tab-label', pane.title));
|
|
32
|
+
tab.onclick = () => act(() => options.store.activate(group.id, pane.id));
|
|
33
|
+
tab.draggable = options.store.can(pane.id, 'move');
|
|
34
|
+
tab.ondragstart = (e) => {
|
|
35
|
+
deps.setDrag(pane.id);
|
|
36
|
+
e.dataTransfer?.setData('text/plain', pane.id);
|
|
37
|
+
if (e.dataTransfer)
|
|
38
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
39
|
+
};
|
|
40
|
+
tab.ondragend = () => {
|
|
41
|
+
deps.setDrag(undefined);
|
|
42
|
+
deps.clearDrop();
|
|
43
|
+
};
|
|
44
|
+
const vertical = () => tabs.getAttribute('aria-orientation') === 'vertical';
|
|
45
|
+
const after = (e) => {
|
|
46
|
+
const rect = item.getBoundingClientRect();
|
|
47
|
+
return vertical()
|
|
48
|
+
? e.clientY > rect.top + rect.height / 2
|
|
49
|
+
: e.clientX > rect.left + rect.width / 2;
|
|
50
|
+
};
|
|
51
|
+
item.ondragover = (e) => {
|
|
52
|
+
const id = deps.getDrag();
|
|
53
|
+
if (!id ||
|
|
54
|
+
!options.store.can(id, 'move') ||
|
|
55
|
+
!group.panes.every((p) => options.store.can(p, 'move')))
|
|
56
|
+
return;
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
deps.clearDrop();
|
|
60
|
+
item.dataset.tabDrop = after(e) ? 'after' : 'before';
|
|
61
|
+
};
|
|
62
|
+
item.ondragleave = () => {
|
|
63
|
+
delete item.dataset.tabDrop;
|
|
64
|
+
};
|
|
65
|
+
item.ondrop = (e) => {
|
|
66
|
+
const id = deps.getDrag();
|
|
67
|
+
if (!id)
|
|
68
|
+
return;
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
e.stopPropagation();
|
|
71
|
+
let index = i + (after(e) ? 1 : 0);
|
|
72
|
+
const source = group.panes.indexOf(id);
|
|
73
|
+
// The controller accepts an insertion index after removing the source tab.
|
|
74
|
+
if (source >= 0 && source < index)
|
|
75
|
+
index--;
|
|
76
|
+
deps.setDrag(undefined);
|
|
77
|
+
deps.clearDrop();
|
|
78
|
+
act(() => options.store.move(id, group.id, 'tab', index, { source: 'user' }));
|
|
79
|
+
};
|
|
80
|
+
tab.onkeydown = (e) => {
|
|
81
|
+
let index = i;
|
|
82
|
+
if (e.key === (vertical() ? 'ArrowDown' : 'ArrowRight'))
|
|
83
|
+
index = (i + 1) % panes.length;
|
|
84
|
+
else if (e.key === (vertical() ? 'ArrowUp' : 'ArrowLeft'))
|
|
85
|
+
index = (i + panes.length - 1) % panes.length;
|
|
86
|
+
else if (e.key === 'Home')
|
|
87
|
+
index = 0;
|
|
88
|
+
else if (e.key === 'End')
|
|
89
|
+
index = panes.length - 1;
|
|
90
|
+
else
|
|
91
|
+
return;
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
act(() => options.store.activate(group.id, panes[index].id));
|
|
94
|
+
deps.focusActive();
|
|
95
|
+
};
|
|
96
|
+
const close = () => act(() => {
|
|
97
|
+
options.store.close(pane.id, { source: 'user' });
|
|
98
|
+
deps.focusActive();
|
|
99
|
+
});
|
|
100
|
+
item.append(tab);
|
|
101
|
+
if (options.store.can(pane.id, 'close')) {
|
|
102
|
+
const x = el(doc, 'button', 'layouts-button layouts-tab-close');
|
|
103
|
+
x.append(chromeIcon(doc, 'close'));
|
|
104
|
+
x.type = 'button';
|
|
105
|
+
x.title = `Close ${pane.title}`;
|
|
106
|
+
x.setAttribute('aria-label', x.title);
|
|
107
|
+
x.dataset.focusId = `close-${pane.id}`;
|
|
108
|
+
x.onclick = close;
|
|
109
|
+
item.append(x);
|
|
110
|
+
if (shortcutEnabled(options, 'middleClickClose')) {
|
|
111
|
+
item.onmousedown = (e) => {
|
|
112
|
+
if (e.button === 1)
|
|
113
|
+
e.preventDefault();
|
|
114
|
+
};
|
|
115
|
+
item.onauxclick = (e) => {
|
|
116
|
+
if (e.button === 1) {
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
close();
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
tabs.append(item);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=tabs.js.map
|
package/dist/tabs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.js","sourceRoot":"","sources":["../src/tabs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EA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K,GAAG,SAAS,IAAI,CAAC,KAAK,EAAE,CAAC;YAChC,CAAC,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;YACtC,CAAC,CAAC,OAAO,CAAC,OAAO,GAAG,SAAS,IAAI,CAAC,EAAE,EAAE,CAAC;YACvC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC;YAClB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACf,IAAI,eAAe,CAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE,CAAC;gBACjD,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,EAAE,EAAE;oBACvB,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;wBAAE,CAAC,CAAC,cAAc,EAAE,CAAC;gBACzC,CAAC,CAAC;gBACF,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE,EAAE;oBACtB,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;wBACnB,CAAC,CAAC,cAAc,EAAE,CAAC;wBACnB,KAAK,EAAE,CAAC;oBACV,CAAC;gBACH,CAAC,CAAC;YACJ,CAAC;QACH,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { chromeIcon } from './chrome-icons.js';\nimport type { Group, Pane } from 'quilt-core';\nimport type { LayoutOptions } from './types.js';\nimport { el } from './lifetime.js';\nimport { shortcutEnabled } from './shortcuts.js';\ninterface TabDependencies {\n options: LayoutOptions;\n prefix: string;\n act: (fn: () => void) => void;\n getDrag: () => string | undefined;\n setDrag: (id: string | undefined) => void;\n clearDrop: () => void;\n focusActive: () => void;\n}\n/** Header nodes are disposable; pane views are owned separately by the renderer. */\nexport function fillTabs(tabs: HTMLElement, group: Group, panes: Pane[], deps: TabDependencies) {\n const { options, prefix, act } = deps;\n const doc = tabs.ownerDocument;\n panes.forEach((pane, i) => {\n const active = pane.id === group.active;\n const item = el(doc, 'div', 'layouts-tab-item');\n item.dataset.active = String(active);\n const tab = el(doc, 'button', 'layouts-tab');\n tab.type = 'button';\n tab.setAttribute('aria-label', pane.title);\n tab.setAttribute('role', 'tab');\n tab.setAttribute('aria-selected', String(active));\n tab.tabIndex = active ? 0 : -1;\n tab.dataset.focusId = `tab-${pane.id}`;\n tab.id = `${prefix}-tab-${pane.id}`;\n tab.setAttribute('aria-controls', `${prefix}-panel-${pane.id}`);\n const icon = el(doc, 'span', 'layouts-tab-icon');\n icon.setAttribute('aria-hidden', 'true');\n let resolved: Element | undefined;\n act(() => {\n resolved = pane.icon ? options.renderIcon?.(pane.icon, doc) : undefined;\n });\n if (resolved) icon.append(resolved);\n else icon.textContent = Array.from(pane.title.trim())[0] || '•';\n tab.append(icon, el(doc, 'span', 'layouts-tab-label', pane.title));\n tab.onclick = () => act(() => options.store.activate(group.id, pane.id));\n tab.draggable = options.store.can(pane.id, 'move');\n tab.ondragstart = (e) => {\n deps.setDrag(pane.id);\n e.dataTransfer?.setData('text/plain', pane.id);\n if (e.dataTransfer) e.dataTransfer.effectAllowed = 'move';\n };\n tab.ondragend = () => {\n deps.setDrag(undefined);\n deps.clearDrop();\n };\n const vertical = () => tabs.getAttribute('aria-orientation') === 'vertical';\n const after = (e: DragEvent) => {\n const rect = item.getBoundingClientRect();\n return vertical()\n ? e.clientY > rect.top + rect.height / 2\n : e.clientX > rect.left + rect.width / 2;\n };\n item.ondragover = (e) => {\n const id = deps.getDrag();\n if (\n !id ||\n !options.store.can(id, 'move') ||\n !group.panes.every((p) => options.store.can(p, 'move'))\n )\n return;\n e.preventDefault();\n e.stopPropagation();\n deps.clearDrop();\n item.dataset.tabDrop = after(e) ? 'after' : 'before';\n };\n item.ondragleave = () => {\n delete item.dataset.tabDrop;\n };\n item.ondrop = (e) => {\n const id = deps.getDrag();\n if (!id) return;\n e.preventDefault();\n e.stopPropagation();\n let index = i + (after(e) ? 1 : 0);\n const source = group.panes.indexOf(id);\n // The controller accepts an insertion index after removing the source tab.\n if (source >= 0 && source < index) index--;\n deps.setDrag(undefined);\n deps.clearDrop();\n act(() => options.store.move(id, group.id, 'tab', index, { source: 'user' }));\n };\n tab.onkeydown = (e) => {\n let index = i;\n if (e.key === (vertical() ? 'ArrowDown' : 'ArrowRight')) index = (i + 1) % panes.length;\n else if (e.key === (vertical() ? 'ArrowUp' : 'ArrowLeft'))\n index = (i + panes.length - 1) % panes.length;\n else if (e.key === 'Home') index = 0;\n else if (e.key === 'End') index = panes.length - 1;\n else return;\n e.preventDefault();\n act(() => options.store.activate(group.id, panes[index]!.id));\n deps.focusActive();\n };\n const close = () =>\n act(() => {\n options.store.close(pane.id, { source: 'user' });\n deps.focusActive();\n });\n item.append(tab);\n if (options.store.can(pane.id, 'close')) {\n const x = el(doc, 'button', 'layouts-button layouts-tab-close');\n x.append(chromeIcon(doc, 'close'));\n x.type = 'button';\n x.title = `Close ${pane.title}`;\n x.setAttribute('aria-label', x.title);\n x.dataset.focusId = `close-${pane.id}`;\n x.onclick = close;\n item.append(x);\n if (shortcutEnabled(options, 'middleClickClose')) {\n item.onmousedown = (e) => {\n if (e.button === 1) e.preventDefault();\n };\n item.onauxclick = (e) => {\n if (e.button === 1) {\n e.preventDefault();\n close();\n }\n };\n }\n }\n tabs.append(item);\n });\n}\n"]}
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/** All values are CSS values. Theme state is separate from serialized layout structure. */
|
|
2
|
+
export interface LayoutTheme {
|
|
3
|
+
bg?: string;
|
|
4
|
+
panel?: string;
|
|
5
|
+
header?: string;
|
|
6
|
+
text?: string;
|
|
7
|
+
muted?: string;
|
|
8
|
+
line?: string;
|
|
9
|
+
accent?: string;
|
|
10
|
+
focus?: string;
|
|
11
|
+
radius?: string;
|
|
12
|
+
fontFamily?: string;
|
|
13
|
+
fontSize?: string;
|
|
14
|
+
/** Tab and menu icon size (default 16px). */
|
|
15
|
+
iconSize?: string;
|
|
16
|
+
/** Shared floating-tab inset and application content padding in CSS pixels (default 8px). */
|
|
17
|
+
panelPadding?: string;
|
|
18
|
+
headerHeight?: string;
|
|
19
|
+
/** Width of the vertical tab rail (default 32px). */
|
|
20
|
+
headerWidth?: string;
|
|
21
|
+
/** Resize gap in CSS pixels (default 4px). Explicit split gaps take precedence. */
|
|
22
|
+
resizeHandleWidth?: string;
|
|
23
|
+
/** Gap for disabled dividers in CSS pixels (default 0px). */
|
|
24
|
+
disabledResizeHandleWidth?: string;
|
|
25
|
+
/** Border color at disabled, gapless boundaries; defaults to line. Use transparent to hide. */
|
|
26
|
+
frozenPaneBorder?: string;
|
|
27
|
+
/** 8px target size. */
|
|
28
|
+
cornerHandleSize?: string;
|
|
29
|
+
/** 0px offset from pane edges. */
|
|
30
|
+
cornerHandleInset?: string;
|
|
31
|
+
/** muted color. */
|
|
32
|
+
cornerHandleColor?: string;
|
|
33
|
+
/** 0.35 idle opacity. */
|
|
34
|
+
cornerHandleOpacity?: string;
|
|
35
|
+
/** block; none disables corner targets. */
|
|
36
|
+
cornerHandleDisplay?: string;
|
|
37
|
+
/** 2px 0 0 2px bracket stroke. */
|
|
38
|
+
cornerHandleBorderWidth?: string;
|
|
39
|
+
/** 0px. */
|
|
40
|
+
cornerHandleRadius?: string;
|
|
41
|
+
/** transparent. */
|
|
42
|
+
cornerHandleFill?: string;
|
|
43
|
+
scrollbarThumb?: string;
|
|
44
|
+
scrollbarTrack?: string;
|
|
45
|
+
scrollbarSize?: string;
|
|
46
|
+
controlHeight?: string;
|
|
47
|
+
spacing?: string;
|
|
48
|
+
}
|
|
49
|
+
export declare const themeProperties: {
|
|
50
|
+
readonly bg: "--layouts-bg";
|
|
51
|
+
readonly panel: "--layouts-panel";
|
|
52
|
+
readonly header: "--layouts-header";
|
|
53
|
+
readonly text: "--layouts-text";
|
|
54
|
+
readonly muted: "--layouts-muted";
|
|
55
|
+
readonly line: "--layouts-line";
|
|
56
|
+
readonly accent: "--layouts-accent";
|
|
57
|
+
readonly focus: "--layouts-focus";
|
|
58
|
+
readonly radius: "--layouts-radius";
|
|
59
|
+
readonly fontFamily: "--layouts-font-family";
|
|
60
|
+
readonly fontSize: "--layouts-font-size";
|
|
61
|
+
readonly iconSize: "--layouts-icon-size";
|
|
62
|
+
readonly panelPadding: "--layouts-panel-padding";
|
|
63
|
+
readonly headerHeight: "--layouts-header-height";
|
|
64
|
+
readonly headerWidth: "--layouts-header-width";
|
|
65
|
+
readonly resizeHandleWidth: "--layouts-resize-handle-width";
|
|
66
|
+
readonly disabledResizeHandleWidth: "--layouts-disabled-resize-handle-width";
|
|
67
|
+
readonly frozenPaneBorder: "--layouts-frozen-pane-border";
|
|
68
|
+
readonly cornerHandleSize: "--layouts-corner-handle-size";
|
|
69
|
+
readonly cornerHandleInset: "--layouts-corner-handle-inset";
|
|
70
|
+
readonly cornerHandleColor: "--layouts-corner-handle-color";
|
|
71
|
+
readonly cornerHandleOpacity: "--layouts-corner-handle-opacity";
|
|
72
|
+
readonly cornerHandleDisplay: "--layouts-corner-handle-display";
|
|
73
|
+
readonly cornerHandleBorderWidth: "--layouts-corner-handle-border-width";
|
|
74
|
+
readonly cornerHandleRadius: "--layouts-corner-handle-radius";
|
|
75
|
+
readonly cornerHandleFill: "--layouts-corner-handle-fill";
|
|
76
|
+
readonly scrollbarThumb: "--layouts-scrollbar-thumb";
|
|
77
|
+
readonly scrollbarTrack: "--layouts-scrollbar-track";
|
|
78
|
+
readonly scrollbarSize: "--layouts-scrollbar-size";
|
|
79
|
+
readonly controlHeight: "--layouts-control-height";
|
|
80
|
+
readonly spacing: "--layouts-spacing";
|
|
81
|
+
};
|
|
82
|
+
/** Optional application presets: no framework, persistence, or global theme state. */
|
|
83
|
+
export declare const themeFamilies: {
|
|
84
|
+
readonly neutral: {
|
|
85
|
+
readonly dark: {
|
|
86
|
+
readonly bg: "#0a0a0a";
|
|
87
|
+
readonly panel: "#171717";
|
|
88
|
+
readonly header: "#262626";
|
|
89
|
+
readonly text: "#fafafa";
|
|
90
|
+
readonly muted: "#a3a3a3";
|
|
91
|
+
readonly line: "#525252";
|
|
92
|
+
readonly accent: "#e5e5e5";
|
|
93
|
+
readonly focus: "#e5e5e5";
|
|
94
|
+
};
|
|
95
|
+
readonly light: {
|
|
96
|
+
readonly bg: "#fafafa";
|
|
97
|
+
readonly panel: "#ffffff";
|
|
98
|
+
readonly header: "#f5f5f5";
|
|
99
|
+
readonly text: "#171717";
|
|
100
|
+
readonly muted: "#525252";
|
|
101
|
+
readonly line: "#d4d4d4";
|
|
102
|
+
readonly accent: "#262626";
|
|
103
|
+
readonly focus: "#262626";
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
readonly zinc: {
|
|
107
|
+
readonly dark: {
|
|
108
|
+
readonly bg: "#09090b";
|
|
109
|
+
readonly panel: "#18181b";
|
|
110
|
+
readonly header: "#27272a";
|
|
111
|
+
readonly text: "#fafafa";
|
|
112
|
+
readonly muted: "#a1a1aa";
|
|
113
|
+
readonly line: "#52525b";
|
|
114
|
+
readonly accent: "#d4d4d8";
|
|
115
|
+
readonly focus: "#d4d4d8";
|
|
116
|
+
};
|
|
117
|
+
readonly light: {
|
|
118
|
+
readonly bg: "#fafafa";
|
|
119
|
+
readonly panel: "#ffffff";
|
|
120
|
+
readonly header: "#f4f4f5";
|
|
121
|
+
readonly text: "#18181b";
|
|
122
|
+
readonly muted: "#52525b";
|
|
123
|
+
readonly line: "#d4d4d8";
|
|
124
|
+
readonly accent: "#3f3f46";
|
|
125
|
+
readonly focus: "#3f3f46";
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
readonly stone: {
|
|
129
|
+
readonly dark: {
|
|
130
|
+
readonly bg: "#0c0a09";
|
|
131
|
+
readonly panel: "#1c1917";
|
|
132
|
+
readonly header: "#292524";
|
|
133
|
+
readonly text: "#fafaf9";
|
|
134
|
+
readonly muted: "#a8a29e";
|
|
135
|
+
readonly line: "#57534e";
|
|
136
|
+
readonly accent: "#d6d3d1";
|
|
137
|
+
readonly focus: "#d6d3d1";
|
|
138
|
+
};
|
|
139
|
+
readonly light: {
|
|
140
|
+
readonly bg: "#fafaf9";
|
|
141
|
+
readonly panel: "#ffffff";
|
|
142
|
+
readonly header: "#f5f5f4";
|
|
143
|
+
readonly text: "#1c1917";
|
|
144
|
+
readonly muted: "#57534e";
|
|
145
|
+
readonly line: "#d6d3d1";
|
|
146
|
+
readonly accent: "#57534e";
|
|
147
|
+
readonly focus: "#57534e";
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
readonly mist: {
|
|
151
|
+
readonly dark: {
|
|
152
|
+
readonly bg: "#0b1114";
|
|
153
|
+
readonly panel: "#141e23";
|
|
154
|
+
readonly header: "#1e2c32";
|
|
155
|
+
readonly text: "#edf4f7";
|
|
156
|
+
readonly muted: "#9eb5bf";
|
|
157
|
+
readonly line: "#425d69";
|
|
158
|
+
readonly accent: "#8bc5d8";
|
|
159
|
+
readonly focus: "#8bc5d8";
|
|
160
|
+
};
|
|
161
|
+
readonly light: {
|
|
162
|
+
readonly bg: "#f4f8fa";
|
|
163
|
+
readonly panel: "#ffffff";
|
|
164
|
+
readonly header: "#eaf1f4";
|
|
165
|
+
readonly text: "#192c35";
|
|
166
|
+
readonly muted: "#465f6b";
|
|
167
|
+
readonly line: "#b8ccd5";
|
|
168
|
+
readonly accent: "#28647b";
|
|
169
|
+
readonly focus: "#28647b";
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
export declare const themes: {
|
|
174
|
+
readonly dark: {
|
|
175
|
+
readonly bg: "#161a20";
|
|
176
|
+
readonly panel: "#1d222a";
|
|
177
|
+
readonly header: "#242a34";
|
|
178
|
+
readonly text: "#e5e9f0";
|
|
179
|
+
readonly muted: "#a2acba";
|
|
180
|
+
readonly line: "#39414e";
|
|
181
|
+
readonly accent: "#8bbaaa";
|
|
182
|
+
readonly focus: "#b3decf";
|
|
183
|
+
};
|
|
184
|
+
readonly light: {
|
|
185
|
+
readonly bg: "#dce1e8";
|
|
186
|
+
readonly panel: "#ffffff";
|
|
187
|
+
readonly header: "#f0f3f7";
|
|
188
|
+
readonly text: "#202936";
|
|
189
|
+
readonly muted: "#586579";
|
|
190
|
+
readonly line: "#c9d1dc";
|
|
191
|
+
readonly accent: "#357a69";
|
|
192
|
+
readonly focus: "#195fc1";
|
|
193
|
+
};
|
|
194
|
+
readonly sage: {
|
|
195
|
+
readonly bg: "#cbd3c7";
|
|
196
|
+
readonly panel: "#f1f3ed";
|
|
197
|
+
readonly header: "#e9ede4";
|
|
198
|
+
readonly text: "#2d4133";
|
|
199
|
+
readonly muted: "#72816e";
|
|
200
|
+
readonly line: "#d0d8c9";
|
|
201
|
+
readonly accent: "#6a957a";
|
|
202
|
+
readonly focus: "#316c4b";
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
export declare function applyTheme(root: HTMLElement, theme: LayoutTheme): void;
|
|
206
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,WAAW,WAAW;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6FAA6F;IAC7F,YAAY,CAAC,EAAE,MAAM,CA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,EAAE,WAAW,QAM/D"}
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
export const themeProperties = {
|
|
2
|
+
bg: '--layouts-bg',
|
|
3
|
+
panel: '--layouts-panel',
|
|
4
|
+
header: '--layouts-header',
|
|
5
|
+
text: '--layouts-text',
|
|
6
|
+
muted: '--layouts-muted',
|
|
7
|
+
line: '--layouts-line',
|
|
8
|
+
accent: '--layouts-accent',
|
|
9
|
+
focus: '--layouts-focus',
|
|
10
|
+
radius: '--layouts-radius',
|
|
11
|
+
fontFamily: '--layouts-font-family',
|
|
12
|
+
fontSize: '--layouts-font-size',
|
|
13
|
+
iconSize: '--layouts-icon-size',
|
|
14
|
+
panelPadding: '--layouts-panel-padding',
|
|
15
|
+
headerHeight: '--layouts-header-height',
|
|
16
|
+
headerWidth: '--layouts-header-width',
|
|
17
|
+
resizeHandleWidth: '--layouts-resize-handle-width',
|
|
18
|
+
disabledResizeHandleWidth: '--layouts-disabled-resize-handle-width',
|
|
19
|
+
frozenPaneBorder: '--layouts-frozen-pane-border',
|
|
20
|
+
cornerHandleSize: '--layouts-corner-handle-size',
|
|
21
|
+
cornerHandleInset: '--layouts-corner-handle-inset',
|
|
22
|
+
cornerHandleColor: '--layouts-corner-handle-color',
|
|
23
|
+
cornerHandleOpacity: '--layouts-corner-handle-opacity',
|
|
24
|
+
cornerHandleDisplay: '--layouts-corner-handle-display',
|
|
25
|
+
cornerHandleBorderWidth: '--layouts-corner-handle-border-width',
|
|
26
|
+
cornerHandleRadius: '--layouts-corner-handle-radius',
|
|
27
|
+
cornerHandleFill: '--layouts-corner-handle-fill',
|
|
28
|
+
scrollbarThumb: '--layouts-scrollbar-thumb',
|
|
29
|
+
scrollbarTrack: '--layouts-scrollbar-track',
|
|
30
|
+
scrollbarSize: '--layouts-scrollbar-size',
|
|
31
|
+
controlHeight: '--layouts-control-height',
|
|
32
|
+
spacing: '--layouts-spacing',
|
|
33
|
+
};
|
|
34
|
+
/** Optional application presets: no framework, persistence, or global theme state. */
|
|
35
|
+
export const themeFamilies = {
|
|
36
|
+
neutral: {
|
|
37
|
+
dark: {
|
|
38
|
+
bg: '#0a0a0a',
|
|
39
|
+
panel: '#171717',
|
|
40
|
+
header: '#262626',
|
|
41
|
+
text: '#fafafa',
|
|
42
|
+
muted: '#a3a3a3',
|
|
43
|
+
line: '#525252',
|
|
44
|
+
accent: '#e5e5e5',
|
|
45
|
+
focus: '#e5e5e5',
|
|
46
|
+
},
|
|
47
|
+
light: {
|
|
48
|
+
bg: '#fafafa',
|
|
49
|
+
panel: '#ffffff',
|
|
50
|
+
header: '#f5f5f5',
|
|
51
|
+
text: '#171717',
|
|
52
|
+
muted: '#525252',
|
|
53
|
+
line: '#d4d4d4',
|
|
54
|
+
accent: '#262626',
|
|
55
|
+
focus: '#262626',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
zinc: {
|
|
59
|
+
dark: {
|
|
60
|
+
bg: '#09090b',
|
|
61
|
+
panel: '#18181b',
|
|
62
|
+
header: '#27272a',
|
|
63
|
+
text: '#fafafa',
|
|
64
|
+
muted: '#a1a1aa',
|
|
65
|
+
line: '#52525b',
|
|
66
|
+
accent: '#d4d4d8',
|
|
67
|
+
focus: '#d4d4d8',
|
|
68
|
+
},
|
|
69
|
+
light: {
|
|
70
|
+
bg: '#fafafa',
|
|
71
|
+
panel: '#ffffff',
|
|
72
|
+
header: '#f4f4f5',
|
|
73
|
+
text: '#18181b',
|
|
74
|
+
muted: '#52525b',
|
|
75
|
+
line: '#d4d4d8',
|
|
76
|
+
accent: '#3f3f46',
|
|
77
|
+
focus: '#3f3f46',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
stone: {
|
|
81
|
+
dark: {
|
|
82
|
+
bg: '#0c0a09',
|
|
83
|
+
panel: '#1c1917',
|
|
84
|
+
header: '#292524',
|
|
85
|
+
text: '#fafaf9',
|
|
86
|
+
muted: '#a8a29e',
|
|
87
|
+
line: '#57534e',
|
|
88
|
+
accent: '#d6d3d1',
|
|
89
|
+
focus: '#d6d3d1',
|
|
90
|
+
},
|
|
91
|
+
light: {
|
|
92
|
+
bg: '#fafaf9',
|
|
93
|
+
panel: '#ffffff',
|
|
94
|
+
header: '#f5f5f4',
|
|
95
|
+
text: '#1c1917',
|
|
96
|
+
muted: '#57534e',
|
|
97
|
+
line: '#d6d3d1',
|
|
98
|
+
accent: '#57534e',
|
|
99
|
+
focus: '#57534e',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
mist: {
|
|
103
|
+
dark: {
|
|
104
|
+
bg: '#0b1114',
|
|
105
|
+
panel: '#141e23',
|
|
106
|
+
header: '#1e2c32',
|
|
107
|
+
text: '#edf4f7',
|
|
108
|
+
muted: '#9eb5bf',
|
|
109
|
+
line: '#425d69',
|
|
110
|
+
accent: '#8bc5d8',
|
|
111
|
+
focus: '#8bc5d8',
|
|
112
|
+
},
|
|
113
|
+
light: {
|
|
114
|
+
bg: '#f4f8fa',
|
|
115
|
+
panel: '#ffffff',
|
|
116
|
+
header: '#eaf1f4',
|
|
117
|
+
text: '#192c35',
|
|
118
|
+
muted: '#465f6b',
|
|
119
|
+
line: '#b8ccd5',
|
|
120
|
+
accent: '#28647b',
|
|
121
|
+
focus: '#28647b',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
export const themes = {
|
|
126
|
+
dark: {
|
|
127
|
+
bg: '#161a20',
|
|
128
|
+
panel: '#1d222a',
|
|
129
|
+
header: '#242a34',
|
|
130
|
+
text: '#e5e9f0',
|
|
131
|
+
muted: '#a2acba',
|
|
132
|
+
line: '#39414e',
|
|
133
|
+
accent: '#8bbaaa',
|
|
134
|
+
focus: '#b3decf',
|
|
135
|
+
},
|
|
136
|
+
light: {
|
|
137
|
+
bg: '#dce1e8',
|
|
138
|
+
panel: '#ffffff',
|
|
139
|
+
header: '#f0f3f7',
|
|
140
|
+
text: '#202936',
|
|
141
|
+
muted: '#586579',
|
|
142
|
+
line: '#c9d1dc',
|
|
143
|
+
accent: '#357a69',
|
|
144
|
+
focus: '#195fc1',
|
|
145
|
+
},
|
|
146
|
+
sage: {
|
|
147
|
+
bg: '#cbd3c7',
|
|
148
|
+
panel: '#f1f3ed',
|
|
149
|
+
header: '#e9ede4',
|
|
150
|
+
text: '#2d4133',
|
|
151
|
+
muted: '#72816e',
|
|
152
|
+
line: '#d0d8c9',
|
|
153
|
+
accent: '#6a957a',
|
|
154
|
+
focus: '#316c4b',
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
export function applyTheme(root, theme) {
|
|
158
|
+
for (const key of Object.keys(themeProperties)) {
|
|
159
|
+
const value = theme[key];
|
|
160
|
+
if (value === undefined)
|
|
161
|
+
root.style.removeProperty(themeProperties[key]);
|
|
162
|
+
else
|
|
163
|
+
root.style.setProperty(themeProperties[key], value);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAgDA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,EAAE,EAAE,cAAc;IAClB,KAAK,EAAE,iBAAiB;IACxB,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,iBAAiB;IACxB,IAAI,EAAE,gBAAgB;IACtB,MAAM,EAAE,kBAAkB;IAC1B,KAAK,EAAE,iBAAiB;IACxB,MAAM,EAAE,kBAAkB;IAC1B,UAAU,EAAE,uBAAuB;IACnC,QAAQ,EAAE,qBAAqB;IAC/B,QAAQ,EAAE,qBAAqB;IAC/B,YAAY,EAAE,yBAAyB;IACvC,YAAY,EAAE,yBAAyB;IACvC,WAAW,EAAE,wBAAwB;IACrC,iBAAiB,EAAE,+BAA+B;IAClD,yBAAyB,EAAE,wCAAwC;IACnE,gBAAgB,EAAE,8BAA8B;IAChD,gBAAgB,E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AK,EAAE;QACL,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,SAAS;KACjB;IACD,IAAI,EAAE;QACJ,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,SAAS;KACjB;CAC6C,CAAC;AACjD,MAAM,UAAU,UAAU,CAAC,IAAiB,EAAE,KAAkB;IAC9D,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAA0B,EAAE,CAAC;QACxE,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;;YACpE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC","sourcesContent":["/** All values are CSS values. Theme state is separate from serialized layout structure. */\nexport interface LayoutTheme {\n bg?: string;\n panel?: string;\n header?: string;\n text?: string;\n muted?: string;\n line?: string;\n accent?: string;\n focus?: string;\n radius?: string;\n fontFamily?: string;\n fontSize?: string;\n /** Tab and menu icon size (default 16px). */\n iconSize?: string;\n /** Shared floating-tab inset and application content padding in CSS pixels (default 8px). */\n panelPadding?: string;\n headerHeight?: string;\n /** Width of the vertical tab rail (default 32px). */\n headerWidth?: string;\n /** Resize gap in CSS pixels (default 4px). Explicit split gaps take precedence. */\n resizeHandleWidth?: string;\n /** Gap for disabled dividers in CSS pixels (default 0px). */\n disabledResizeHandleWidth?: string;\n /** Border color at disabled, gapless boundaries; defaults to line. Use transparent to hide. */\n frozenPaneBorder?: string;\n /** 8px target size. */\n cornerHandleSize?: string;\n /** 0px offset from pane edges. */\n cornerHandleInset?: string;\n /** muted color. */\n cornerHandleColor?: string;\n /** 0.35 idle opacity. */\n cornerHandleOpacity?: string;\n /** block; none disables corner targets. */\n cornerHandleDisplay?: string;\n /** 2px 0 0 2px bracket stroke. */\n cornerHandleBorderWidth?: string;\n /** 0px. */\n cornerHandleRadius?: string;\n /** transparent. */\n cornerHandleFill?: string;\n scrollbarThumb?: string;\n scrollbarTrack?: string;\n scrollbarSize?: string;\n controlHeight?: string;\n spacing?: string;\n}\nexport const themeProperties = {\n bg: '--layouts-bg',\n panel: '--layouts-panel',\n header: '--layouts-header',\n text: '--layouts-text',\n muted: '--layouts-muted',\n line: '--layouts-line',\n accent: '--layouts-accent',\n focus: '--layouts-focus',\n radius: '--layouts-radius',\n fontFamily: '--layouts-font-family',\n fontSize: '--layouts-font-size',\n iconSize: '--layouts-icon-size',\n panelPadding: '--layouts-panel-padding',\n headerHeight: '--layouts-header-height',\n headerWidth: '--layouts-header-width',\n resizeHandleWidth: '--layouts-resize-handle-width',\n disabledResizeHandleWidth: '--layouts-disabled-resize-handle-width',\n frozenPaneBorder: '--layouts-frozen-pane-border',\n cornerHandleSize: '--layouts-corner-handle-size',\n cornerHandleInset: '--layouts-corner-handle-inset',\n cornerHandleColor: '--layouts-corner-handle-color',\n cornerHandleOpacity: '--layouts-corner-handle-opacity',\n cornerHandleDisplay: '--layouts-corner-handle-display',\n cornerHandleBorderWidth: '--layouts-corner-handle-border-width',\n cornerHandleRadius: '--layouts-corner-handle-radius',\n cornerHandleFill: '--layouts-corner-handle-fill',\n scrollbarThumb: '--layouts-scrollbar-thumb',\n scrollbarTrack: '--layouts-scrollbar-track',\n scrollbarSize: '--layouts-scrollbar-size',\n controlHeight: '--layouts-control-height',\n spacing: '--layouts-spacing',\n} as const;\n/** Optional application presets: no framework, persistence, or global theme state. */\nexport const themeFamilies = {\n neutral: {\n dark: {\n bg: '#0a0a0a',\n panel: '#171717',\n header: '#262626',\n text: '#fafafa',\n muted: '#a3a3a3',\n line: '#525252',\n accent: '#e5e5e5',\n focus: '#e5e5e5',\n },\n light: {\n bg: '#fafafa',\n panel: '#ffffff',\n header: '#f5f5f5',\n text: '#171717',\n muted: '#525252',\n line: '#d4d4d4',\n accent: '#262626',\n focus: '#262626',\n },\n },\n zinc: {\n dark: {\n bg: '#09090b',\n panel: '#18181b',\n header: '#27272a',\n text: '#fafafa',\n muted: '#a1a1aa',\n line: '#52525b',\n accent: '#d4d4d8',\n focus: '#d4d4d8',\n },\n light: {\n bg: '#fafafa',\n panel: '#ffffff',\n header: '#f4f4f5',\n text: '#18181b',\n muted: '#52525b',\n line: '#d4d4d8',\n accent: '#3f3f46',\n focus: '#3f3f46',\n },\n },\n stone: {\n dark: {\n bg: '#0c0a09',\n panel: '#1c1917',\n header: '#292524',\n text: '#fafaf9',\n muted: '#a8a29e',\n line: '#57534e',\n accent: '#d6d3d1',\n focus: '#d6d3d1',\n },\n light: {\n bg: '#fafaf9',\n panel: '#ffffff',\n header: '#f5f5f4',\n text: '#1c1917',\n muted: '#57534e',\n line: '#d6d3d1',\n accent: '#57534e',\n focus: '#57534e',\n },\n },\n mist: {\n dark: {\n bg: '#0b1114',\n panel: '#141e23',\n header: '#1e2c32',\n text: '#edf4f7',\n muted: '#9eb5bf',\n line: '#425d69',\n accent: '#8bc5d8',\n focus: '#8bc5d8',\n },\n light: {\n bg: '#f4f8fa',\n panel: '#ffffff',\n header: '#eaf1f4',\n text: '#192c35',\n muted: '#465f6b',\n line: '#b8ccd5',\n accent: '#28647b',\n focus: '#28647b',\n },\n },\n} as const satisfies Record<string, { dark: LayoutTheme; light: LayoutTheme }>;\nexport const themes = {\n dark: {\n bg: '#161a20',\n panel: '#1d222a',\n header: '#242a34',\n text: '#e5e9f0',\n muted: '#a2acba',\n line: '#39414e',\n accent: '#8bbaaa',\n focus: '#b3decf',\n },\n light: {\n bg: '#dce1e8',\n panel: '#ffffff',\n header: '#f0f3f7',\n text: '#202936',\n muted: '#586579',\n line: '#c9d1dc',\n accent: '#357a69',\n focus: '#195fc1',\n },\n sage: {\n bg: '#cbd3c7',\n panel: '#f1f3ed',\n header: '#e9ede4',\n text: '#2d4133',\n muted: '#72816e',\n line: '#d0d8c9',\n accent: '#6a957a',\n focus: '#316c4b',\n },\n} as const satisfies Record<string, LayoutTheme>;\nexport function applyTheme(root: HTMLElement, theme: LayoutTheme) {\n for (const key of Object.keys(themeProperties) as (keyof LayoutTheme)[]) {\n const value = theme[key];\n if (value === undefined) root.style.removeProperty(themeProperties[key]);\n else root.style.setProperty(themeProperties[key], value);\n }\n}\n"]}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { TabRegistry } from './registry.js';
|
|
2
|
+
import type { LayoutTheme } from './theme.js';
|
|
3
|
+
import type { LayoutStore, Pane, WindowPlacement } from 'quilt-core';
|
|
4
|
+
export interface PaneContext {
|
|
5
|
+
element: HTMLElement;
|
|
6
|
+
document: Document;
|
|
7
|
+
window: Window;
|
|
8
|
+
pane: Pane;
|
|
9
|
+
/** Stable application-owned reference. The library does not serialize this value. */
|
|
10
|
+
state: unknown;
|
|
11
|
+
location: 'main' | 'popout';
|
|
12
|
+
}
|
|
13
|
+
export interface PaneView {
|
|
14
|
+
dispose(): void;
|
|
15
|
+
resize?(width: number, height: number): void;
|
|
16
|
+
update?(pane: Pane): void;
|
|
17
|
+
}
|
|
18
|
+
export type PaneRenderer = (context: PaneContext) => PaneView;
|
|
19
|
+
export interface TabBarStyle {
|
|
20
|
+
/** Left placement uses an icon-only rail; mode and shape apply in either placement. */
|
|
21
|
+
placement?: 'top' | 'left';
|
|
22
|
+
/** Automatic shows labels as width permits; compact always uses icons only. */
|
|
23
|
+
display?: 'automatic' | 'compact';
|
|
24
|
+
mode?: 'full' | 'tapered';
|
|
25
|
+
shape?: 'angle' | 'round' | 'scoop' | 'vertical' | 'rounded';
|
|
26
|
+
/** Anchored by default; floating bars overlay content with an 8px inset. */
|
|
27
|
+
attachment?: 'anchored' | 'floating';
|
|
28
|
+
fit?: 'full' | 'fit';
|
|
29
|
+
corners?: 'fitted' | 'rounded' | 'capsule';
|
|
30
|
+
/** Positive finite CSS pixels. Omit to match header height. */
|
|
31
|
+
taperWidth?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface TabBarOptions extends TabBarStyle {
|
|
34
|
+
/** Partial overrides keyed by stable group ID; not serialized in Layout JSON. */
|
|
35
|
+
regions?: Record<string, TabBarStyle>;
|
|
36
|
+
}
|
|
37
|
+
export interface LayoutOptions {
|
|
38
|
+
tabBar?: TabBarOptions;
|
|
39
|
+
store: LayoutStore;
|
|
40
|
+
tabs?: TabRegistry;
|
|
41
|
+
theme?: LayoutTheme;
|
|
42
|
+
renderers: Record<string, PaneRenderer>;
|
|
43
|
+
/** Return a fresh decorative icon element. Unknown keys use a title initial. */
|
|
44
|
+
renderIcon?: (key: string, document: Document) => Element | undefined;
|
|
45
|
+
/** Opt-in conveniences; omitted and false disable all. */
|
|
46
|
+
shortcuts?: boolean | {
|
|
47
|
+
maximize?: boolean;
|
|
48
|
+
middleClickClose?: boolean;
|
|
49
|
+
addTab?: boolean;
|
|
50
|
+
restoreClosedTab?: boolean;
|
|
51
|
+
};
|
|
52
|
+
getPaneState?: (paneId: string) => unknown;
|
|
53
|
+
onError?: (error: unknown) => void;
|
|
54
|
+
/** Copy additional app styles/assets into a same-origin companion document. */
|
|
55
|
+
prepareWindow?: (window: Window, pane: Pane) => void;
|
|
56
|
+
/** Override window creation for applications with a managed same-origin host. Must return synchronously. */
|
|
57
|
+
openWindow?: (pane: Pane, placement: WindowPlacement) => Window | null;
|
|
58
|
+
}
|
|
59
|
+
export interface MountedLayout {
|
|
60
|
+
setTabBar(options: TabBarOptions): void;
|
|
61
|
+
setTheme(theme: LayoutTheme): void;
|
|
62
|
+
popout(paneId: string, placement?: WindowPlacement): boolean;
|
|
63
|
+
returnPane(paneId: string): void;
|
|
64
|
+
dispose(): void;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACrE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;IACX,qFAAqF;IACrF,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC7B;AACD,MAAM,WAAW,QAAQ;IACvB,OAAO,IAAI,IAAI,CAAC;IAChB,MAAM,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;CAC3B;AACD,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,QAAQ,CAAC;AAC9D,MAAM,WAAW,WAAW;IAC1B,uFAAuF;IACvF,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC3B,+EAA+E;IAC/E,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,S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AS,EAAE,eAAe,KAAK,MAAM,GAAG,IAAI,CAAC;CACxE;AACD,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IACnC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC;IAC7D,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,OAAO,IAAI,IAAI,CAAC;CACjB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TabRegistry } from './registry.js';\nimport type { LayoutTheme } from './theme.js';\nimport type { LayoutStore, Pane, WindowPlacement } from 'quilt-core';\nexport interface PaneContext {\n element: HTMLElement;\n document: Document;\n window: Window;\n pane: Pane;\n /** Stable application-owned reference. The library does not serialize this value. */\n state: unknown;\n location: 'main' | 'popout';\n}\nexport interface PaneView {\n dispose(): void;\n resize?(width: number, height: number): void;\n update?(pane: Pane): void;\n}\nexport type PaneRenderer = (context: PaneContext) => PaneView;\nexport interface TabBarStyle {\n /** Left placement uses an icon-only rail; mode and shape apply in either placement. */\n placement?: 'top' | 'left';\n /** Automatic shows labels as width permits; compact always uses icons only. */\n display?: 'automatic' | 'compact';\n mode?: 'full' | 'tapered';\n shape?: 'angle' | 'round' | 'scoop' | 'vertical' | 'rounded';\n /** Anchored by default; floating bars overlay content with an 8px inset. */\n attachment?: 'anchored' | 'floating';\n fit?: 'full' | 'fit';\n corners?: 'fitted' | 'rounded' | 'capsule';\n /** Positive finite CSS pixels. Omit to match header height. */\n taperWidth?: number;\n}\nexport interface TabBarOptions extends TabBarStyle {\n /** Partial overrides keyed by stable group ID; not serialized in Layout JSON. */\n regions?: Record<string, TabBarStyle>;\n}\nexport interface LayoutOptions {\n tabBar?: TabBarOptions;\n store: LayoutStore;\n tabs?: TabRegistry;\n theme?: LayoutTheme;\n renderers: Record<string, PaneRenderer>;\n /** Return a fresh decorative icon element. Unknown keys use a title initial. */\n renderIcon?: (key: string, document: Document) => Element | undefined;\n /** Opt-in conveniences; omitted and false disable all. */\n shortcuts?:\n | boolean\n | {\n maximize?: boolean;\n middleClickClose?: boolean;\n addTab?: boolean;\n restoreClosedTab?: boolean;\n };\n getPaneState?: (paneId: string) => unknown;\n onError?: (error: unknown) => void;\n /** Copy additional app styles/assets into a same-origin companion document. */\n prepareWindow?: (window: Window, pane: Pane) => void;\n /** Override window creation for applications with a managed same-origin host. Must return synchronously. */\n openWindow?: (pane: Pane, placement: WindowPlacement) => Window | null;\n}\nexport interface MountedLayout {\n setTabBar(options: TabBarOptions): void;\n setTheme(theme: LayoutTheme): void;\n popout(paneId: string, placement?: WindowPlacement): boolean;\n returnPane(paneId: string): void;\n dispose(): void;\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { WindowPlacement } from 'quilt-core';
|
|
2
|
+
import type { LayoutOptions } from './types.js';
|
|
3
|
+
/** The opener owns all state; child documents never load an independent app bundle. */
|
|
4
|
+
export declare class Windows {
|
|
5
|
+
private doc;
|
|
6
|
+
private options;
|
|
7
|
+
private error;
|
|
8
|
+
private themeRoot;
|
|
9
|
+
private companions;
|
|
10
|
+
private scope;
|
|
11
|
+
private stopped;
|
|
12
|
+
readonly pending: Map<string, WindowPlacement>;
|
|
13
|
+
constructor(doc: Document, options: LayoutOptions, error: (e: unknown) => void, themeRoot: HTMLElement);
|
|
14
|
+
private restoreMissing;
|
|
15
|
+
private reconcile;
|
|
16
|
+
private styles;
|
|
17
|
+
open(id: string, placement?: WindowPlacement): boolean;
|
|
18
|
+
returnPane(id: string): void;
|
|
19
|
+
private closeCompanion;
|
|
20
|
+
private check;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=windows.d.ts.map
|