@gramlot/gramlot 0.3.0 → 0.3.2
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/dist/gramlot.js +158 -70
- package/dist/gramlot.min.js +42 -24
- package/package.json +1 -1
- package/src/builder/source.js +1 -0
- package/src/components/border-container.js +399 -0
- package/src/components/choice-editor.js +3 -1
- package/src/components/container.js +25 -0
- package/src/components/layout.js +6 -23
- package/src/components/popup.js +3 -3
- package/src/components/registry.js +5 -3
- package/src/components/selected-container.js +289 -0
- package/src/index-page-runtime.d.ts +2 -1
- package/src/index-page-runtime.js +94 -50
- package/src/index-page-styles.js +1 -1
- package/src/renderer/attributes.js +4 -1
- package/src/renderer/gramlot-renderer.js +6 -3
- package/src/server/gramlot-server.js +1 -0
- package/src/view/html.js +30 -6
- package/themes/gramlot-base/theme.css +3 -2
- package/themes/joanna/theme.css +9 -0
- package/themes/mimi/theme.css +9 -0
- package/tools/gramlot-tools-inspector.js +561 -38
- package/tools/inspector-agent.js +259 -5
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/** Shared selection keeps panel Source and light DOM mounted until explicit closing. */
|
|
2
|
+
import {defineComponent} from './registry.js';
|
|
3
|
+
import {Container} from './container.js';
|
|
4
|
+
|
|
5
|
+
const selectionPanels = new WeakMap();
|
|
6
|
+
let panelSequence = 0;
|
|
7
|
+
|
|
8
|
+
function projectSelectionChild(element, attrs, actions) {
|
|
9
|
+
const {pageName = null, title = '', icon = '', badge = null, badge_color = '', closable = false, onClose, hidden = false, disabled = false, ...rest} = attrs;
|
|
10
|
+
if (pageName !== null && typeof pageName !== 'string') throw new TypeError('pageName must be a string');
|
|
11
|
+
if (typeof closable !== 'boolean') throw new TypeError('closable must be a boolean');
|
|
12
|
+
const slot = selectionPanels.get(element)?.slot ?? `panel-${++panelSequence}`;
|
|
13
|
+
selectionPanels.set(element, {pageName, title, icon, badge, badge_color, closable, hidden, disabled, slot,
|
|
14
|
+
remove: actions.remove, allowClose: () => onClose == null ? true : actions.invoke('onClose', onClose, {})});
|
|
15
|
+
rest.slot = slot;
|
|
16
|
+
if (element.parentElement) element.parentElement.scheduleSelection();
|
|
17
|
+
return rest;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function SelectedContainer(HTMLElement) {
|
|
21
|
+
return class extends Container(HTMLElement) {
|
|
22
|
+
static projectChild(element, attrs, actions) { return projectSelectionChild(element, attrs, actions); }
|
|
23
|
+
#panels = new Map();
|
|
24
|
+
#selected = null;
|
|
25
|
+
#initialized = false;
|
|
26
|
+
#scheduled = false;
|
|
27
|
+
#requested = {selectedPage: null, selected: null};
|
|
28
|
+
#observer;
|
|
29
|
+
#context;
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
this.control.replaceChildren();
|
|
33
|
+
this.control.className = 'control-box selection';
|
|
34
|
+
const style = this.ownerDocument.createElement('style');
|
|
35
|
+
style.textContent = `:host{min-height:0;overflow:hidden}.selection{height:100%;min-height:0;display:flex;flex-direction:column}
|
|
36
|
+
.panels{flex:1;min-height:0;min-width:0;position:relative}.panel{height:100%;min-height:0;overflow:auto}
|
|
37
|
+
.panel[hidden]{display:none}::slotted(*){height:100%;min-height:0}`;
|
|
38
|
+
this.panelArea = this.ownerDocument.createElement('div'); this.panelArea.className = 'panels';
|
|
39
|
+
this.control.append(this.panelArea); this.shadowRoot.append(style);
|
|
40
|
+
this.#observer = new this.ownerDocument.defaultView.MutationObserver(() => this.scheduleSelection());
|
|
41
|
+
}
|
|
42
|
+
setSourceContext(context) { this.#context = context; }
|
|
43
|
+
connectedCallback() { this.#observer.observe(this, {childList:true}); this.scheduleSelection(); }
|
|
44
|
+
disconnectedCallback() { this.#observer.disconnect(); }
|
|
45
|
+
scheduleSelection() {
|
|
46
|
+
if (this.#scheduled) return;
|
|
47
|
+
this.#scheduled = true;
|
|
48
|
+
queueMicrotask(() => {
|
|
49
|
+
this.#scheduled = false;
|
|
50
|
+
if (this.isConnected) this.#sync();
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
projectAttributes(attrs, adapt) {
|
|
54
|
+
const rest = super.projectAttributes(attrs, adapt);
|
|
55
|
+
const {selected, selectedPage} = this.parameters;
|
|
56
|
+
if (selected != null && (!Number.isInteger(selected) || selected < 0)) throw new TypeError('selected must be a nonnegative index or null');
|
|
57
|
+
if (selectedPage != null && typeof selectedPage !== 'string') throw new TypeError('selectedPage must be a string or null');
|
|
58
|
+
this.scheduleSelection();
|
|
59
|
+
return rest;
|
|
60
|
+
}
|
|
61
|
+
#sync() {
|
|
62
|
+
const records = [], names = new Set();
|
|
63
|
+
for (const child of this.children) {
|
|
64
|
+
const config = selectionPanels.get(child);
|
|
65
|
+
if (!config) continue;
|
|
66
|
+
if (config.pageName != null && names.has(config.pageName)) throw new Error(`Duplicate pageName: ${config.pageName}`);
|
|
67
|
+
names.add(config.pageName);
|
|
68
|
+
let record = this.#panels.get(child);
|
|
69
|
+
if (!record) {
|
|
70
|
+
const viewport = this.ownerDocument.createElement('div'); viewport.className = 'panel'; viewport.hidden = true;
|
|
71
|
+
viewport.id = config.slot; viewport.setAttribute('role', 'group');
|
|
72
|
+
const slot = this.ownerDocument.createElement('slot'); slot.name = config.slot; viewport.append(slot);
|
|
73
|
+
this.panelArea.append(viewport);
|
|
74
|
+
record = {child, viewport, config, index:records.length}; this.#panels.set(child, record);
|
|
75
|
+
}
|
|
76
|
+
record.config = config;
|
|
77
|
+
records.push(record);
|
|
78
|
+
}
|
|
79
|
+
const previousIndex = this.#selected?.index ?? 0;
|
|
80
|
+
for (const [child, record] of this.#panels) {
|
|
81
|
+
if (!records.includes(record)) { record.viewport.remove(); this.#panels.delete(child); }
|
|
82
|
+
}
|
|
83
|
+
records.forEach((record, index) => { record.index = index; });
|
|
84
|
+
this.#panels = new Map(records.map(record => [record.child, record]));
|
|
85
|
+
const {selectedPage, selected} = this.parameters;
|
|
86
|
+
const nameChanged = !Object.is(selectedPage, this.#requested.selectedPage);
|
|
87
|
+
const indexChanged = !Object.is(selected, this.#requested.selected);
|
|
88
|
+
this.#requested = {selectedPage, selected};
|
|
89
|
+
const available = record => record && !record.config.hidden && !record.config.disabled;
|
|
90
|
+
let target = this.#selected;
|
|
91
|
+
if (!this.#initialized || nameChanged || indexChanged) {
|
|
92
|
+
const requested = (nameChanged || !this.#initialized && selectedPage != null)
|
|
93
|
+
? records.find(record => record.config.pageName === selectedPage) : records[selected];
|
|
94
|
+
if (available(requested)) target = requested;
|
|
95
|
+
}
|
|
96
|
+
if (!records.includes(target) || !available(target)) {
|
|
97
|
+
target = records.slice(previousIndex).find(available) ?? records.slice(0, previousIndex).reverse().find(available) ?? null;
|
|
98
|
+
}
|
|
99
|
+
this.renderTabs(records, target);
|
|
100
|
+
if (records.length || this.#initialized) this.#select(target);
|
|
101
|
+
}
|
|
102
|
+
renderTabs() {}
|
|
103
|
+
selectPanel(record) {
|
|
104
|
+
if (record.config.hidden || record.config.disabled) return;
|
|
105
|
+
this.#select(record);
|
|
106
|
+
}
|
|
107
|
+
#payload(record, selected) {
|
|
108
|
+
const page = record.config.pageName ?? record.index;
|
|
109
|
+
return {page, index:record.index, selected, change:`${page}_${selected ? 'show' : 'hide'}`};
|
|
110
|
+
}
|
|
111
|
+
#writeSelection(target) {
|
|
112
|
+
this.#context.writeParameter('selectedPage', target?.config.pageName ?? null);
|
|
113
|
+
this.#context.writeParameter('selected', target?.index ?? null);
|
|
114
|
+
}
|
|
115
|
+
#select(target) {
|
|
116
|
+
const previous = this.#selected, initial = !this.#initialized;
|
|
117
|
+
if (!initial && target === previous) {
|
|
118
|
+
this.#writeSelection(target);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (!initial) {
|
|
122
|
+
if (previous) this.#context.publish('hiding', {pageName:previous.config.pageName, index:previous.index});
|
|
123
|
+
if (target) this.#context.publish('showing', {pageName:target.config.pageName, index:target.index});
|
|
124
|
+
}
|
|
125
|
+
this.#selected = target; this.#initialized = true;
|
|
126
|
+
for (const record of this.#panels.values()) record.viewport.hidden = record !== target;
|
|
127
|
+
this.renderTabs([...this.#panels.values()], target);
|
|
128
|
+
this.#writeSelection(target);
|
|
129
|
+
if (!initial && previous) this.#context.publish('selected', this.#payload(previous, false));
|
|
130
|
+
if (target) this.#context.publish('selected', this.#payload(target, true));
|
|
131
|
+
}
|
|
132
|
+
closePanel(record) {
|
|
133
|
+
if (!record.config.closable) return;
|
|
134
|
+
const allowed = record.config.allowClose();
|
|
135
|
+
if (typeof allowed !== 'boolean') throw new TypeError('onClose must return a synchronous boolean');
|
|
136
|
+
if (!allowed) return;
|
|
137
|
+
const payload = {pageName:record.config.pageName, index:record.index, wasSelected:record === this.#selected};
|
|
138
|
+
this.#context.publish('closing', payload);
|
|
139
|
+
record.config.remove();
|
|
140
|
+
this.#sync();
|
|
141
|
+
this.#context.publish('closed', payload);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
SelectedContainer.parameters = {
|
|
146
|
+
selectedPage: {dtype:'T', default:null, nullable:true, binding:'twoWay'},
|
|
147
|
+
selected: {dtype:'L', default:null, nullable:true, binding:'twoWay'},
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const selectionChildParameters = {onClose: {inline: []}};
|
|
151
|
+
|
|
152
|
+
export const StackContainer = defineComponent({
|
|
153
|
+
name:'stackContainer', tag:'gramlot-stack-container', base:SelectedContainer, subTags:'*',
|
|
154
|
+
sourceContext: true, childParameters: selectionChildParameters,
|
|
155
|
+
implementation: Base => class extends Base {},
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
export const TabContainer = defineComponent({
|
|
159
|
+
name:'tabContainer', tag:'gramlot-tab-container', base:SelectedContainer, subTags:'*',
|
|
160
|
+
sourceContext: true, childParameters: selectionChildParameters,
|
|
161
|
+
parameters: {
|
|
162
|
+
tabMode: {dtype:'T', default:'tabs', binding:'read', enum:['tabs','underline']},
|
|
163
|
+
tabPosition: {dtype:'T', default:'top', binding:'read', enum:['top','bottom','left','right']},
|
|
164
|
+
tabAlign: {dtype:'T', default:'start', binding:'read', enum:['start','center','end']},
|
|
165
|
+
},
|
|
166
|
+
implementation: Base => class extends Base {
|
|
167
|
+
#tabs = new Map();
|
|
168
|
+
constructor() {
|
|
169
|
+
super();
|
|
170
|
+
const doc = this.ownerDocument;
|
|
171
|
+
this.tabStrip = doc.createElement('div'); this.tabStrip.className = 'tabs'; this.tabStrip.setAttribute('role', 'tablist');
|
|
172
|
+
this.control.prepend(this.tabStrip);
|
|
173
|
+
const style = doc.createElement('style');
|
|
174
|
+
style.textContent = `
|
|
175
|
+
.selection{min-width:0;--tab-border:var(--gramlot-tab-border,var(--gramlot-border,#aaa));
|
|
176
|
+
--tab-radius:var(--gramlot-tab-radius,4px);--tab-indicator:var(--gramlot-tab-indicator-color,var(--gramlot-action,#3766b5))}
|
|
177
|
+
.panels{background:var(--gramlot-tab-selected-background,var(--gramlot-surface,white))}
|
|
178
|
+
.tabs{display:var(--gramlot-tab-strip-display,flex);flex:none;align-items:stretch;gap:var(--gramlot-tab-gap,3px);min-width:0;min-height:0;
|
|
179
|
+
padding:var(--gramlot-tab-strip-padding,4px);overflow:auto;overscroll-behavior:contain;
|
|
180
|
+
border-bottom:1px solid var(--tab-border);background:var(--gramlot-tab-background,var(--gramlot-surface-subtle,#eef1f5))}
|
|
181
|
+
[data-align=center] .tabs{justify-content:safe center}
|
|
182
|
+
[data-align=end] .tabs{justify-content:safe flex-end}
|
|
183
|
+
.tab-entry{position:relative;display:flex;flex:none;align-items:stretch;border:1px solid transparent;border-bottom:0;
|
|
184
|
+
border-radius:var(--tab-radius) var(--tab-radius) 0 0;color:var(--gramlot-tab-color,var(--gramlot-text-secondary,#555))}
|
|
185
|
+
.tab-entry:has([aria-selected=true]){border-color:var(--tab-border);color:var(--gramlot-tab-selected-color,var(--gramlot-ink,#222));
|
|
186
|
+
background:var(--gramlot-tab-selected-background,var(--gramlot-surface,white))}
|
|
187
|
+
button{box-sizing:border-box;display:flex;align-items:center;justify-content:center;gap:var(--gramlot-tab-content-gap,.4em);
|
|
188
|
+
font:inherit;line-height:1.2;color:inherit;border:0;background:transparent;cursor:pointer;white-space:nowrap;min-width:0;
|
|
189
|
+
padding:var(--gramlot-tab-padding,4px 10px);min-height:max(var(--gramlot-touch-target,0px),var(--gramlot-tab-height,28px));border-radius:inherit}
|
|
190
|
+
button[aria-selected=true]{font-weight:600}
|
|
191
|
+
.icon,.badge{flex:none}.icon:empty{display:none}.caption{overflow:hidden;text-overflow:ellipsis}
|
|
192
|
+
.badge{font-size:var(--gramlot-tab-badge-size,.8em);font-weight:600;line-height:1.3;border-radius:999px;
|
|
193
|
+
min-width:1.3em;padding:var(--gramlot-tab-badge-padding,0 .35em);text-align:center;
|
|
194
|
+
background:var(--gramlot-tab-badge-background,var(--gramlot-brand-blue,#3766b5));color:var(--gramlot-tab-badge-color,white)}
|
|
195
|
+
@media(hover:hover){button:not(:disabled):hover{background:var(--gramlot-tab-hover-background,var(--gramlot-selected,#e8f1fc))}}
|
|
196
|
+
button:disabled{opacity:.5;cursor:default}
|
|
197
|
+
button:focus-visible{outline:2px solid var(--gramlot-focus-ring,Highlight);outline-offset:-3px}
|
|
198
|
+
.close{align-self:center;flex:none;min-height:var(--gramlot-touch-target,20px);min-width:var(--gramlot-touch-target,20px);
|
|
199
|
+
padding:0;margin-inline-end:3px;border-radius:var(--tab-radius);font-size:1.15em}
|
|
200
|
+
[hidden]{display:none!important}
|
|
201
|
+
[data-position=top] .tabs{padding-bottom:0}
|
|
202
|
+
[data-position=bottom]{flex-direction:column-reverse}
|
|
203
|
+
[data-position=bottom] .tabs{border-bottom:0;border-top:1px solid var(--tab-border);padding-top:0}
|
|
204
|
+
[data-position=bottom] .tab-entry{border-bottom:1px solid transparent;border-top:0;border-radius:0 0 var(--tab-radius) var(--tab-radius)}
|
|
205
|
+
[data-position=left]{flex-direction:row}[data-position=right]{flex-direction:row-reverse}
|
|
206
|
+
:is([data-position=left],[data-position=right]) .tabs{flex-direction:column;max-width:min(40%,var(--gramlot-tab-side-width,12rem));border-bottom:0}
|
|
207
|
+
:is([data-position=left],[data-position=right]) button[role=tab]{flex:1;justify-content:flex-start}
|
|
208
|
+
[data-position=left] .tabs{border-right:1px solid var(--tab-border);padding-right:0}
|
|
209
|
+
[data-position=right] .tabs{border-left:1px solid var(--tab-border);padding-left:0}
|
|
210
|
+
[data-position=left] .tab-entry{border-bottom:1px solid transparent;border-right:0;border-radius:var(--tab-radius) 0 0 var(--tab-radius)}
|
|
211
|
+
[data-position=right] .tab-entry{border-bottom:1px solid transparent;border-left:0;border-radius:0 var(--tab-radius) var(--tab-radius) 0}
|
|
212
|
+
.tab-entry:has([aria-selected=true]){border-color:var(--tab-border)}
|
|
213
|
+
[data-mode=underline] .tabs{background:transparent}
|
|
214
|
+
[data-mode=underline] .tab-entry{border:0;border-radius:0;background:transparent}
|
|
215
|
+
[data-mode=underline] .tab-entry:has([aria-selected=true])::after{content:'';position:absolute;pointer-events:none;
|
|
216
|
+
background:var(--tab-indicator);height:var(--gramlot-tab-indicator-size,2px);bottom:0;left:0;right:0}
|
|
217
|
+
[data-mode=underline][data-position=bottom] .tab-entry::after{top:0;bottom:auto}
|
|
218
|
+
[data-mode=underline]:is([data-position=left],[data-position=right]) .tab-entry::after{height:auto;width:var(--gramlot-tab-indicator-size,2px);top:0;bottom:0}
|
|
219
|
+
[data-mode=underline][data-position=left] .tab-entry::after{left:auto;right:0}
|
|
220
|
+
[data-mode=underline][data-position=right] .tab-entry::after{left:0;right:auto}`;
|
|
221
|
+
this.shadowRoot.append(style);
|
|
222
|
+
}
|
|
223
|
+
projectAttributes(attrs, adapt) {
|
|
224
|
+
const rest = super.projectAttributes(attrs, adapt);
|
|
225
|
+
const {tabMode, tabPosition, tabAlign} = this.parameters;
|
|
226
|
+
if (!['tabs','underline'].includes(tabMode)) throw new TypeError('Invalid tabMode');
|
|
227
|
+
if (!['top','bottom','left','right'].includes(tabPosition)) throw new TypeError('Invalid tabPosition');
|
|
228
|
+
if (!['start','center','end'].includes(tabAlign)) throw new TypeError('Invalid tabAlign');
|
|
229
|
+
this.control.dataset.mode = tabMode; this.control.dataset.position = tabPosition;
|
|
230
|
+
this.control.dataset.align = tabAlign;
|
|
231
|
+
this.tabStrip.setAttribute('aria-orientation', ['left','right'].includes(tabPosition) ? 'vertical' : 'horizontal');
|
|
232
|
+
return rest;
|
|
233
|
+
}
|
|
234
|
+
renderTabs(records, selected) {
|
|
235
|
+
for (const [record, entry] of this.#tabs) {
|
|
236
|
+
if (!records.includes(record)) { entry.root.remove(); this.#tabs.delete(record); }
|
|
237
|
+
}
|
|
238
|
+
for (const [index, record] of records.entries()) {
|
|
239
|
+
let entry = this.#tabs.get(record);
|
|
240
|
+
if (!entry) {
|
|
241
|
+
const doc = this.ownerDocument, root = doc.createElement('div'), button = doc.createElement('button'), close = doc.createElement('button');
|
|
242
|
+
root.className = 'tab-entry'; button.type = close.type = 'button'; button.setAttribute('role', 'tab');
|
|
243
|
+
button.id = `tab-${record.config.slot}`; button.setAttribute('aria-controls', record.viewport.id);
|
|
244
|
+
record.viewport.setAttribute('role', 'tabpanel');
|
|
245
|
+
record.viewport.setAttribute('aria-labelledby', button.id);
|
|
246
|
+
const icon = doc.createElement('span'), caption = doc.createElement('span'), badge = doc.createElement('span');
|
|
247
|
+
icon.className = 'icon'; icon.setAttribute('aria-hidden', 'true'); caption.className = 'caption'; badge.className = 'badge';
|
|
248
|
+
button.append(icon, caption, badge);
|
|
249
|
+
close.className = 'close'; close.textContent = '×';
|
|
250
|
+
button.addEventListener('click', () => this.selectPanel(record));
|
|
251
|
+
close.addEventListener('click', () => {
|
|
252
|
+
this.closePanel(record);
|
|
253
|
+
if (!close.isConnected) this.tabStrip.querySelector('[aria-selected=true]')?.focus();
|
|
254
|
+
});
|
|
255
|
+
button.addEventListener('keydown', event => {
|
|
256
|
+
if (event.key === 'Delete') { event.preventDefault(); this.closePanel(record); this.tabStrip.querySelector('[aria-selected=true]')?.focus(); return; }
|
|
257
|
+
const vertical = ['left','right'].includes(this.parameters.tabPosition);
|
|
258
|
+
const previous = vertical ? 'ArrowUp' : 'ArrowLeft', nextKey = vertical ? 'ArrowDown' : 'ArrowRight';
|
|
259
|
+
if (![previous,nextKey,'Home','End'].includes(event.key)) return;
|
|
260
|
+
event.preventDefault();
|
|
261
|
+
const available = [...this.#tabs].filter(([r]) => !r.config.hidden && !r.config.disabled)
|
|
262
|
+
.sort(([a], [b]) => a.index - b.index);
|
|
263
|
+
let index = available.findIndex(([r]) => r === record);
|
|
264
|
+
index = event.key === 'Home' ? 0 : event.key === 'End' ? available.length - 1
|
|
265
|
+
: (index + (event.key === nextKey ? 1 : -1) + available.length) % available.length;
|
|
266
|
+
const [next, tab] = available[index]; this.selectPanel(next); tab.button.focus();
|
|
267
|
+
tab.button.scrollIntoView({block:'nearest',inline:'nearest'});
|
|
268
|
+
});
|
|
269
|
+
root.append(button, close); this.tabStrip.append(root); entry = {root,button,close,icon,caption,badge}; this.#tabs.set(record, entry);
|
|
270
|
+
}
|
|
271
|
+
if (this.tabStrip.children[index] !== entry.root) this.tabStrip.insertBefore(entry.root, this.tabStrip.children[index] ?? null);
|
|
272
|
+
entry.root.hidden = !!record.config.hidden;
|
|
273
|
+
const caption = record.config.title || record.config.pageName || String(record.index + 1);
|
|
274
|
+
entry.caption.textContent = caption; entry.button.title = caption;
|
|
275
|
+
entry.icon.textContent = record.config.icon;
|
|
276
|
+
entry.badge.textContent = record.config.badge ?? '';
|
|
277
|
+
entry.badge.hidden = record.config.badge == null || record.config.badge === '';
|
|
278
|
+
entry.badge.style.backgroundColor = record.config.badge_color;
|
|
279
|
+
entry.button.setAttribute('aria-label', entry.badge.hidden ? caption : `${caption} ${record.config.badge}`);
|
|
280
|
+
entry.button.disabled = !!record.config.disabled;
|
|
281
|
+
entry.button.setAttribute('aria-selected', String(record === selected));
|
|
282
|
+
entry.button.tabIndex = record === selected ? 0 : -1;
|
|
283
|
+
entry.close.hidden = !record.config.closable;
|
|
284
|
+
entry.close.disabled = !!record.config.disabled;
|
|
285
|
+
entry.close.setAttribute('aria-label', `Close ${caption}`);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export function mountIndexPage(renderer: any, root: any,
|
|
2
2
|
onSelection?: (entries: Map<string, any>, active: string) => void,
|
|
3
|
-
prepareEntry?: (entry: any, context: any) => void
|
|
3
|
+
prepareEntry?: (entry: any, context: any) => void,
|
|
4
|
+
options?: {containerLayout?: boolean; state?: any}): {dispose(): void};
|
|
4
5
|
/** Re-export as Logic, or delegate indexMount from an application's Logic. */
|
|
5
6
|
export class IndexLogic {
|
|
6
7
|
indexMount(node: any, args: {shell_id: string}): void;
|
|
@@ -3,7 +3,7 @@ import {appearanceStyles} from './index-page-styles.js';
|
|
|
3
3
|
import {THEME_READY, THEME_SET, THEMES, APPEARANCES} from './index-theme.js';
|
|
4
4
|
|
|
5
5
|
/** Index-page behavior; writes UI state through the existing Source records. */
|
|
6
|
-
export function mountIndexPage(renderer, root, onSelection = () => {}, prepareEntry = () => {}) {
|
|
6
|
+
export function mountIndexPage(renderer, root, onSelection = () => {}, prepareEntry = () => {}, {containerLayout = false, state: suppliedState = null} = {}) {
|
|
7
7
|
const shell = renderer.records.get(root).element;
|
|
8
8
|
const document = shell.ownerDocument;
|
|
9
9
|
const window = document.defaultView;
|
|
@@ -37,7 +37,7 @@ export function mountIndexPage(renderer, root, onSelection = () => {}, prepareEn
|
|
|
37
37
|
restoreChoice(appearance, preferences.appearance, APPEARANCES);
|
|
38
38
|
const families = [...shell.querySelectorAll('.index-sidebar details')];
|
|
39
39
|
const Bag = root.builder.data.constructor;
|
|
40
|
-
const state = new Bag();
|
|
40
|
+
const state = suppliedState ?? new Bag();
|
|
41
41
|
const opened = new Bag();
|
|
42
42
|
state.setItem('opened', opened);
|
|
43
43
|
state.setItem('keyboard', (keyboard?.checked ?? false));
|
|
@@ -99,38 +99,45 @@ export function mountIndexPage(renderer, root, onSelection = () => {}, prepareEn
|
|
|
99
99
|
const updatePanels = () => {
|
|
100
100
|
if (navigationToggle) {
|
|
101
101
|
const visible = state.getItem('navigationVisible');
|
|
102
|
-
set(sidebar, {hidden: !visible});
|
|
103
|
-
set(sidebarHandle, {hidden: !visible});
|
|
102
|
+
set(sidebar, containerLayout ? {drawer: visible ? true : 'close'} : {hidden: !visible});
|
|
103
|
+
if (!containerLayout) set(sidebarHandle, {hidden: !visible});
|
|
104
104
|
set(navigationToggle, {aria_expanded: String(visible)});
|
|
105
105
|
set(shell, {data_navigation_hidden: String(!visible)});
|
|
106
106
|
}
|
|
107
107
|
if (codeSidebar) {
|
|
108
108
|
const available = Boolean(entries.get(state.getItem('active'))?.code);
|
|
109
109
|
const visible = available && state.getItem('codeVisible');
|
|
110
|
-
set(codeSidebar, {hidden: !visible});
|
|
111
|
-
set(codeHandle, {hidden: !visible});
|
|
110
|
+
set(codeSidebar, containerLayout ? {hidden: !available, drawer: visible ? true : 'close'} : {hidden: !visible});
|
|
111
|
+
if (!containerLayout) set(codeHandle, {hidden: !visible});
|
|
112
112
|
set(codeToggle, {disabled: !available, aria_expanded: String(visible)});
|
|
113
113
|
set(shell, {data_code_visible: String(visible)});
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
|
+
let selecting = false;
|
|
116
117
|
function select(key) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
set(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
118
|
+
if (selecting) return;
|
|
119
|
+
selecting = true;
|
|
120
|
+
try {
|
|
121
|
+
const entry = entries.get(key);
|
|
122
|
+
if (!opened.getItem(key)) {
|
|
123
|
+
opened.setItem(key, true);
|
|
124
|
+
set(containerLayout ? entry.panel : entry.tab, {hidden: false});
|
|
125
|
+
if (entry.frame) set(entry.frame, {src: entry.open.getAttribute('href')});
|
|
126
|
+
}
|
|
127
|
+
if (entry.family) set(entry.family, {open: true});
|
|
128
|
+
for (const [current, item] of entries) {
|
|
129
|
+
const active = current === key;
|
|
130
|
+
if (!containerLayout) {
|
|
131
|
+
set(item.tab, {aria_selected: String(active), tabindex: active && state.getItem('keyboard') ? 0 : -1});
|
|
132
|
+
set(item.panel, {hidden: !active});
|
|
133
|
+
}
|
|
134
|
+
if (item.code) set(item.code, {hidden: !active});
|
|
135
|
+
if (item.open) set(item.open, {aria_current: active ? 'page' : null});
|
|
136
|
+
}
|
|
137
|
+
if (state.getItem('active') !== key) state.setItem('active', key);
|
|
138
|
+
updatePanels();
|
|
139
|
+
updateInspector();
|
|
140
|
+
} finally { selecting = false; }
|
|
134
141
|
}
|
|
135
142
|
const sidebarMaximum = () => Math.max(120, Math.min(460, Math.floor(window.innerWidth * .6)));
|
|
136
143
|
const applyWidths = () => set(shell, {style: `--sidebar-width: ${state.getItem('sidebarWidth')}px; --code-width: ${state.getItem('codeWidth') ?? 420}px`});
|
|
@@ -197,11 +204,38 @@ export function mountIndexPage(renderer, root, onSelection = () => {}, prepareEn
|
|
|
197
204
|
}
|
|
198
205
|
set(shell, {data_resizing: null});
|
|
199
206
|
// Retain the preferred width when a narrow viewport temporarily limits the visible sidebar.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
207
|
+
if (!containerLayout) {
|
|
208
|
+
const savedWidth = preferences.sidebarWidth;
|
|
209
|
+
const width = typeof savedWidth === 'number' && Number.isFinite(savedWidth) && savedWidth >= 120 && savedWidth <= 460
|
|
210
|
+
? savedWidth : sidebar.getBoundingClientRect().width || Number(sidebarHandle.getAttribute('aria-valuenow'));
|
|
211
|
+
state.setItem('preferredSidebarWidth', width);
|
|
212
|
+
setSidebarWidth(width);
|
|
213
|
+
} else {
|
|
214
|
+
const gramlot = renderer.binding.gramlot;
|
|
215
|
+
for (const [pane, property, widthProperty] of [[sidebar, 'navigationVisible', 'sidebarWidth'], [codeSidebar, 'codeVisible', 'codeWidth']]) {
|
|
216
|
+
const source = node(pane);
|
|
217
|
+
const savedWidth = preferences[widthProperty];
|
|
218
|
+
if (typeof savedWidth === 'number' && Number.isFinite(savedWidth) && savedWidth > 0) set(pane, {width: `${savedWidth}px`});
|
|
219
|
+
const handle = gramlot.subscribe(`${source.getAttr('node_id')}_closable_change`, ({open}) => {
|
|
220
|
+
if (source.getAttr('hidden') === true || source.getAttr('drawer') === false) return;
|
|
221
|
+
state.setItem(property, open);
|
|
222
|
+
set(pane, {drawer: open ? true : 'close'});
|
|
223
|
+
set(property === 'navigationVisible' ? navigationToggle : codeToggle, {aria_expanded: String(open)});
|
|
224
|
+
set(shell, {[property === 'navigationVisible' ? 'data_navigation_hidden' : 'data_code_visible']: String(property === 'navigationVisible' ? !open : open)});
|
|
225
|
+
savePreferences();
|
|
226
|
+
});
|
|
227
|
+
releases.push(() => gramlot.unsubscribe(handle));
|
|
228
|
+
}
|
|
229
|
+
const border = shell.querySelector('[data-index-regions]');
|
|
230
|
+
const handle = gramlot.subscribe(`${node(border).getAttr('node_id')}_splitter_resize`, ({region, size}) => {
|
|
231
|
+
set(region === 'left' ? sidebar : codeSidebar, {width: size});
|
|
232
|
+
state.setItem(region === 'left' ? 'preferredSidebarWidth' : 'preferredCodeWidth', Number.parseFloat(size));
|
|
233
|
+
savePreferences();
|
|
234
|
+
});
|
|
235
|
+
releases.push(() => gramlot.unsubscribe(handle));
|
|
236
|
+
state.setItem('preferredSidebarWidth', preferences.sidebarWidth);
|
|
237
|
+
state.setItem('preferredCodeWidth', preferences.codeWidth);
|
|
238
|
+
}
|
|
205
239
|
listen(navigationToggle, 'click', () => {
|
|
206
240
|
state.setItem('navigationVisible', !state.getItem('navigationVisible'));
|
|
207
241
|
updatePanels();
|
|
@@ -212,7 +246,7 @@ export function mountIndexPage(renderer, root, onSelection = () => {}, prepareEn
|
|
|
212
246
|
updatePanels();
|
|
213
247
|
savePreferences();
|
|
214
248
|
});
|
|
215
|
-
if (codeHandle) {
|
|
249
|
+
if (!containerLayout && codeHandle) {
|
|
216
250
|
const saved = preferences.codeWidth;
|
|
217
251
|
const width = typeof saved === 'number' && Number.isFinite(saved) && saved >= 200 ? saved : 420;
|
|
218
252
|
state.setItem('preferredCodeWidth', width);
|
|
@@ -232,31 +266,34 @@ export function mountIndexPage(renderer, root, onSelection = () => {}, prepareEn
|
|
|
232
266
|
});
|
|
233
267
|
listen(window, 'resize', () => setCodeWidth(state.getItem('preferredCodeWidth')));
|
|
234
268
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
269
|
+
if (!containerLayout) {
|
|
270
|
+
listen(sidebarHandle, 'keydown', event => {
|
|
271
|
+
const current = state.getItem('sidebarWidth');
|
|
272
|
+
const value = event.key === 'ArrowLeft' ? current - 10 : event.key === 'ArrowRight' ? current + 10
|
|
273
|
+
: event.key === 'Home' ? 120 : event.key === 'End' ? sidebarMaximum() : null;
|
|
274
|
+
if (value == null) return;
|
|
275
|
+
event.preventDefault();
|
|
276
|
+
setSidebarWidth(value, true);
|
|
277
|
+
});
|
|
278
|
+
listen(sidebarHandle, 'pointerdown', event => beginDrag(sidebarHandle, event,
|
|
279
|
+
x => setSidebarWidth(Math.round(x - shell.getBoundingClientRect().left), true)));
|
|
280
|
+
listen(sidebarHandle, 'lostpointercapture', () => {
|
|
281
|
+
if (drag?.handle === sidebarHandle) stopDrag();
|
|
282
|
+
});
|
|
283
|
+
listen(window, 'resize', () => setSidebarWidth(state.getItem('preferredSidebarWidth')));
|
|
284
|
+
}
|
|
285
|
+
const choices = containerLayout ? byId('index-pages').children : shell.querySelectorAll('.index-tabs button');
|
|
286
|
+
for (const tab of choices) {
|
|
287
|
+
const key = tab.id.slice(containerLayout ? 'panel-'.length : 'tab-'.length);
|
|
251
288
|
const entry = {key, tab, panel: byId(`panel-${key}`),
|
|
252
289
|
code: byId(`codepane-${key}`),
|
|
253
290
|
open: key === 'intro' ? null : byId(`open-${key}`)};
|
|
254
291
|
entries.set(key, entry);
|
|
255
|
-
if (!tab.hidden) opened.setItem(key, true);
|
|
256
|
-
if (tab.getAttribute('aria-selected') === 'true') state.setItem('active', key);
|
|
257
|
-
listen(tab, 'click', () => select(key));
|
|
292
|
+
if (containerLayout ? node(tab).getAttr('hidden') !== true : !tab.hidden) opened.setItem(key, true);
|
|
293
|
+
if (!containerLayout && tab.getAttribute('aria-selected') === 'true') state.setItem('active', key);
|
|
294
|
+
if (!containerLayout) listen(tab, 'click', () => select(key));
|
|
258
295
|
if (entry.open) listen(entry.open, 'click', event => { event.preventDefault(); select(key); });
|
|
259
|
-
listen(tab, 'keydown', event => {
|
|
296
|
+
if (!containerLayout) listen(tab, 'keydown', event => {
|
|
260
297
|
if (!state.getItem('keyboard') || !['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) return;
|
|
261
298
|
const keys = [...entries.keys()].filter(key => opened.getItem(key));
|
|
262
299
|
const index = keys.indexOf(key);
|
|
@@ -273,6 +310,13 @@ export function mountIndexPage(renderer, root, onSelection = () => {}, prepareEn
|
|
|
273
310
|
entry.frame = byId(`frame-${key}`);
|
|
274
311
|
listen(entry.frame, 'load', () => send(entry.frame));
|
|
275
312
|
}
|
|
313
|
+
if (containerLayout) {
|
|
314
|
+
const subscription = `${shell.id}-selection`;
|
|
315
|
+
state.subscribe(subscription, {any: event => {
|
|
316
|
+
if (event.node === state.getNode('active')) select(state.getItem('active'));
|
|
317
|
+
}});
|
|
318
|
+
releases.push(() => state.unsubscribe(subscription, {any: true}));
|
|
319
|
+
}
|
|
276
320
|
listen(document, 'pointermove', event => {
|
|
277
321
|
if (!drag || event.pointerId !== drag.pointerId) return;
|
|
278
322
|
drag.move(event.clientX);
|
|
@@ -286,7 +330,7 @@ export function mountIndexPage(renderer, root, onSelection = () => {}, prepareEn
|
|
|
286
330
|
set(keyboard, {checked: (keyboard?.checked ?? false)});
|
|
287
331
|
for (const [key, entry] of entries) {
|
|
288
332
|
if (entry.open) set(entry.open, {tabindex: (keyboard?.checked ?? false) ? 0 : -1});
|
|
289
|
-
set(entry.tab, {tabindex: (keyboard?.checked ?? false) && key === state.getItem('active') ? 0 : -1});
|
|
333
|
+
if (!containerLayout) set(entry.tab, {tabindex: (keyboard?.checked ?? false) && key === state.getItem('active') ? 0 : -1});
|
|
290
334
|
}
|
|
291
335
|
});
|
|
292
336
|
listen(appearance, 'change', () => {
|
package/src/index-page-styles.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated from canonical themes; edit themes/, not this file.
|
|
2
|
-
export const appearanceStyles = {"base":"","compact":"/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */\n@layer gramlot.tokens {\n :root {\n --gramlot-field-height: 28px;\n --gramlot-field-line-height: 1.35;\n --gramlot-field-padding: .25rem .5rem;\n --gramlot-field-font-size: 1rem;\n --gramlot-space-1: .2rem;\n --gramlot-space-2: .4rem;\n --gramlot-space-3: .5rem;\n --gramlot-space-4: .6rem;\n --gramlot-space-6: .9rem;\n --gramlot-space-8: 1.2rem;\n --gramlot-space-12: 1.8rem;\n --gramlot-radius-sm: .25rem;\n --gramlot-radius: .35rem;\n --gramlot-radius-lg: .4rem;\n }\n}\n\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.35; }\n :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, pre, figure) { margin-block: 0 .5rem; }\n h1 { font-size: 1.35rem; }\n h2 { font-size: 1.15rem; }\n h3 { font-size: 1.05rem; }\n pre { padding: .5rem; }\n blockquote { padding-inline-start: .6rem; }\n hr { margin-block: 1rem; }\n}\n\n@layer gramlot.components {\n :where(button, input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"], .button) {\n min-block-size: 28px;\n padding: .25rem .5rem;\n font-size: 1rem;\n line-height: 1.35;\n }\n :where(label) { font-size: .95rem; }\n :where(input:not([type=\"button\"]):not([type=\"submit\"]):not([type=\"reset\"]):not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"range\"]):not([type=\"color\"]):not([type=\"file\"]):not([type=\"hidden\"]), select, textarea) {\n min-block-size: var(--gramlot-field-height);\n padding: var(--gramlot-field-padding);\n font-size: var(--gramlot-field-font-size);\n line-height: var(--gramlot-field-line-height);\n }\n :where(textarea) { min-block-size: 5rem; }\n :where(input[type=\"color\"]) { min-block-size: 28px; }\n :where(input[type=\"file\"])::file-selector-button { margin-inline-end: .5rem; padding: .25rem .5rem; }\n :where(fieldset) { margin-block-end: .6rem; padding: .5rem; }\n :where(table) { font-size: 1rem; }\n :where(th, td) { padding: .4rem .5rem; }\n :where(details) { padding: .4rem .5rem; }\n :where(details[open] > summary) { margin-block-end: .5rem; }\n :where(dialog) { padding: .75rem; }\n}\n\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 1.2rem, var(--gramlot-page-width)); padding-block: .6rem; }\n .card { padding: .6rem; box-shadow: none; }\n}\n","mimi":"/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */\n@layer gramlot.tokens {\n :root {\n --gramlot-field-height: 28px;\n --gramlot-field-line-height: 1.35;\n --gramlot-field-padding: .25rem .5rem;\n --gramlot-field-font-size: 1rem;\n --gramlot-space-1: .2rem;\n --gramlot-space-2: .4rem;\n --gramlot-space-3: .5rem;\n --gramlot-space-4: .6rem;\n --gramlot-space-6: .9rem;\n --gramlot-space-8: 1.2rem;\n --gramlot-space-12: 1.8rem;\n --gramlot-radius-sm: .25rem;\n --gramlot-radius: .35rem;\n --gramlot-radius-lg: .4rem;\n }\n}\n\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.35; }\n :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, pre, figure) { margin-block: 0 .5rem; }\n h1 { font-size: 1.35rem; }\n h2 { font-size: 1.15rem; }\n h3 { font-size: 1.05rem; }\n pre { padding: .5rem; }\n blockquote { padding-inline-start: .6rem; }\n hr { margin-block: 1rem; }\n}\n\n@layer gramlot.components {\n :where(button, input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"], .button) {\n min-block-size: 28px;\n padding: .25rem .5rem;\n font-size: 1rem;\n line-height: 1.35;\n }\n :where(label) { font-size: .95rem; }\n :where(input:not([type=\"button\"]):not([type=\"submit\"]):not([type=\"reset\"]):not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"range\"]):not([type=\"color\"]):not([type=\"file\"]):not([type=\"hidden\"]), select, textarea) {\n min-block-size: var(--gramlot-field-height);\n padding: var(--gramlot-field-padding);\n font-size: var(--gramlot-field-font-size);\n line-height: var(--gramlot-field-line-height);\n }\n :where(textarea) { min-block-size: 5rem; }\n :where(input[type=\"color\"]) { min-block-size: 28px; }\n :where(input[type=\"file\"])::file-selector-button { margin-inline-end: .5rem; padding: .25rem .5rem; }\n :where(fieldset) { margin-block-end: .6rem; padding: .5rem; }\n :where(table) { font-size: 1rem; }\n :where(th, td) { padding: .4rem .5rem; }\n :where(details) { padding: .4rem .5rem; }\n :where(details[open] > summary) { margin-block-end: .5rem; }\n :where(dialog) { padding: .75rem; }\n}\n\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 1.2rem, var(--gramlot-page-width)); padding-block: .6rem; }\n .card { padding: .6rem; box-shadow: none; }\n}\n\n/* Gramlot adaptation of legacy mimi; load after Base and Compact. */\n@layer gramlot.tokens {\n :root {\n --gramlot-background: #EDEEF0;\n --gramlot-surface: #F5F5F6;\n --gramlot-surface-subtle: #E0E1E3;\n --gramlot-ink: #3C3D40;\n --gramlot-text-secondary: #6B6E72;\n --gramlot-border: #BDBFC2;\n --gramlot-border-control: #9EA0A3;\n --gramlot-navigation: #48494C;\n --gramlot-navigation-text: #FFFFFF;\n --gramlot-action: #0071E3;\n --gramlot-action-hover: #005BBB;\n --gramlot-brand-blue: #0071E3;\n --gramlot-brand-yellow: #9EA0A3;\n --gramlot-selected: #E8F1FC;\n --gramlot-focus-ring: #0071E3;\n --gramlot-field-background: #FFFFFF;\n --gramlot-field-readonly-background: #E0E1E3;\n --gramlot-error: #B3261E;\n --gramlot-error-background: #FFF1F0;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 6%);\n --gramlot-radius-sm: 4px;\n --gramlot-radius: 3px;\n --gramlot-radius-lg: 3px;\n --gramlot-field-height: 18px;\n --gramlot-field-padding: 1px 3px;\n --gramlot-field-line-height: 1.15;\n --gramlot-field-font-size: 1rem;\n --gramlot-label-size: .9em;\n --gramlot-label-gap: 2px;\n --gramlot-label-color: var(--gramlot-text-secondary);\n --gramlot-space-4: 6px;\n --gramlot-font-ui: -apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Arial, sans-serif;\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n --gramlot-background: #242527;\n --gramlot-surface: #303134;\n --gramlot-surface-subtle: #3C3D40;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #6B6E72;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3C3D40;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n }\n :root[data-theme=\"dark\"] {\n --gramlot-background: #242527;\n --gramlot-surface: #303134;\n --gramlot-surface-subtle: #3C3D40;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #6B6E72;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3C3D40;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n}\n@layer gramlot.base {\n html { font-size: 12px; }\n}\n@layer gramlot.components {\n :where(label) { font-size: var(--gramlot-label-size); font-weight: normal; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(button, input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"], .button) { min-block-size: 24px; padding: 2px 8px; font-weight: 500; }\n}\n@layer gramlot.utilities {\n .card { box-shadow: var(--gramlot-shadow); }\n}\n","joanna":"/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */\n@layer gramlot.tokens {\n :root {\n --gramlot-field-height: 28px;\n --gramlot-field-line-height: 1.35;\n --gramlot-field-padding: .25rem .5rem;\n --gramlot-field-font-size: 1rem;\n --gramlot-space-1: .2rem;\n --gramlot-space-2: .4rem;\n --gramlot-space-3: .5rem;\n --gramlot-space-4: .6rem;\n --gramlot-space-6: .9rem;\n --gramlot-space-8: 1.2rem;\n --gramlot-space-12: 1.8rem;\n --gramlot-radius-sm: .25rem;\n --gramlot-radius: .35rem;\n --gramlot-radius-lg: .4rem;\n }\n}\n\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.35; }\n :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, pre, figure) { margin-block: 0 .5rem; }\n h1 { font-size: 1.35rem; }\n h2 { font-size: 1.15rem; }\n h3 { font-size: 1.05rem; }\n pre { padding: .5rem; }\n blockquote { padding-inline-start: .6rem; }\n hr { margin-block: 1rem; }\n}\n\n@layer gramlot.components {\n :where(button, input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"], .button) {\n min-block-size: 28px;\n padding: .25rem .5rem;\n font-size: 1rem;\n line-height: 1.35;\n }\n :where(label) { font-size: .95rem; }\n :where(input:not([type=\"button\"]):not([type=\"submit\"]):not([type=\"reset\"]):not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"range\"]):not([type=\"color\"]):not([type=\"file\"]):not([type=\"hidden\"]), select, textarea) {\n min-block-size: var(--gramlot-field-height);\n padding: var(--gramlot-field-padding);\n font-size: var(--gramlot-field-font-size);\n line-height: var(--gramlot-field-line-height);\n }\n :where(textarea) { min-block-size: 5rem; }\n :where(input[type=\"color\"]) { min-block-size: 28px; }\n :where(input[type=\"file\"])::file-selector-button { margin-inline-end: .5rem; padding: .25rem .5rem; }\n :where(fieldset) { margin-block-end: .6rem; padding: .5rem; }\n :where(table) { font-size: 1rem; }\n :where(th, td) { padding: .4rem .5rem; }\n :where(details) { padding: .4rem .5rem; }\n :where(details[open] > summary) { margin-block-end: .5rem; }\n :where(dialog) { padding: .75rem; }\n}\n\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 1.2rem, var(--gramlot-page-width)); padding-block: .6rem; }\n .card { padding: .6rem; box-shadow: none; }\n}\n\n/* Gramlot adaptation of legacy joanna; load after Base and Compact. */\n@layer gramlot.tokens {\n :root {\n --gramlot-background: #F2F2F7;\n --gramlot-surface: #FFFFFF;\n --gramlot-surface-subtle: #F2F2F7;\n --gramlot-ink: #3A3A3C;\n --gramlot-text-secondary: #636366;\n --gramlot-border: #D1D1D6;\n --gramlot-border-control: #AEAEB2;\n --gramlot-navigation: #3A3A3C;\n --gramlot-navigation-text: #FFFFFF;\n --gramlot-action: #007AFF;\n --gramlot-action-hover: #0061CC;\n --gramlot-brand-blue: #007AFF;\n --gramlot-brand-yellow: #AEAEB2;\n --gramlot-selected: #E0EFFF;\n --gramlot-focus-ring: #007AFF;\n --gramlot-field-background: #FFFFFF;\n --gramlot-field-readonly-background: #F2F2F7;\n --gramlot-error: #B3261E;\n --gramlot-error-background: #FFF1F0;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 6%);\n --gramlot-radius-sm: 6px;\n --gramlot-radius: 6px;\n --gramlot-radius-lg: 6px;\n --gramlot-field-height: 20px;\n --gramlot-field-padding: 1px 3px;\n --gramlot-field-line-height: 1.15;\n --gramlot-field-font-size: 1rem;\n --gramlot-label-size: .8em;\n --gramlot-label-gap: 2px;\n --gramlot-label-color: var(--gramlot-text-secondary);\n --gramlot-space-4: 6px;\n --gramlot-font-ui: -apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Arial, sans-serif;\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n --gramlot-background: #1C1C1E;\n --gramlot-surface: #2C2C2E;\n --gramlot-surface-subtle: #3A3A3C;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #636366;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3A3A3C;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n }\n :root[data-theme=\"dark\"] {\n --gramlot-background: #1C1C1E;\n --gramlot-surface: #2C2C2E;\n --gramlot-surface-subtle: #3A3A3C;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #636366;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3A3A3C;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n}\n@layer gramlot.base {\n html { font-size: 13px; }\n}\n@layer gramlot.components {\n :where(label) { font-size: var(--gramlot-label-size); font-weight: normal; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(button, input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"], .button) { min-block-size: 26px; padding: 2px 8px; font-weight: 500; }\n}\n@layer gramlot.utilities {\n .card { box-shadow: var(--gramlot-shadow); }\n}\n"};
|
|
2
|
+
export const appearanceStyles = {"base":"","compact":"/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */\n@layer gramlot.tokens {\n :root {\n --gramlot-field-height: 28px;\n --gramlot-field-line-height: 1.35;\n --gramlot-field-padding: .25rem .5rem;\n --gramlot-field-font-size: 1rem;\n --gramlot-space-1: .2rem;\n --gramlot-space-2: .4rem;\n --gramlot-space-3: .5rem;\n --gramlot-space-4: .6rem;\n --gramlot-space-6: .9rem;\n --gramlot-space-8: 1.2rem;\n --gramlot-space-12: 1.8rem;\n --gramlot-radius-sm: .25rem;\n --gramlot-radius: .35rem;\n --gramlot-radius-lg: .4rem;\n }\n}\n\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.35; }\n :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, pre, figure) { margin-block: 0 .5rem; }\n h1 { font-size: 1.35rem; }\n h2 { font-size: 1.15rem; }\n h3 { font-size: 1.05rem; }\n pre { padding: .5rem; }\n blockquote { padding-inline-start: .6rem; }\n hr { margin-block: 1rem; }\n}\n\n@layer gramlot.components {\n :where(button, input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"], .button) {\n min-block-size: 28px;\n padding: .25rem .5rem;\n font-size: 1rem;\n line-height: 1.35;\n }\n :where(label) { font-size: .95rem; }\n :where(input:not([type=\"button\"]):not([type=\"submit\"]):not([type=\"reset\"]):not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"range\"]):not([type=\"color\"]):not([type=\"file\"]):not([type=\"hidden\"]), select, textarea) {\n min-block-size: var(--gramlot-field-height);\n padding: var(--gramlot-field-padding);\n font-size: var(--gramlot-field-font-size);\n line-height: var(--gramlot-field-line-height);\n }\n :where(textarea) { min-block-size: 5rem; }\n :where(input[type=\"color\"]) { min-block-size: 28px; }\n :where(input[type=\"file\"])::file-selector-button { margin-inline-end: .5rem; padding: .25rem .5rem; }\n :where(fieldset) { margin-block-end: .6rem; padding: .5rem; }\n :where(table) { font-size: 1rem; }\n :where(th, td) { padding: .4rem .5rem; }\n :where(details) { padding: .4rem .5rem; }\n :where(details[open] > summary) { margin-block-end: .5rem; }\n :where(dialog) { padding: .75rem; }\n}\n\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 1.2rem, var(--gramlot-page-width)); padding-block: .6rem; }\n .card { padding: .6rem; box-shadow: none; }\n}\n","mimi":"/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */\n@layer gramlot.tokens {\n :root {\n --gramlot-field-height: 28px;\n --gramlot-field-line-height: 1.35;\n --gramlot-field-padding: .25rem .5rem;\n --gramlot-field-font-size: 1rem;\n --gramlot-space-1: .2rem;\n --gramlot-space-2: .4rem;\n --gramlot-space-3: .5rem;\n --gramlot-space-4: .6rem;\n --gramlot-space-6: .9rem;\n --gramlot-space-8: 1.2rem;\n --gramlot-space-12: 1.8rem;\n --gramlot-radius-sm: .25rem;\n --gramlot-radius: .35rem;\n --gramlot-radius-lg: .4rem;\n }\n}\n\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.35; }\n :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, pre, figure) { margin-block: 0 .5rem; }\n h1 { font-size: 1.35rem; }\n h2 { font-size: 1.15rem; }\n h3 { font-size: 1.05rem; }\n pre { padding: .5rem; }\n blockquote { padding-inline-start: .6rem; }\n hr { margin-block: 1rem; }\n}\n\n@layer gramlot.components {\n :where(button, input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"], .button) {\n min-block-size: 28px;\n padding: .25rem .5rem;\n font-size: 1rem;\n line-height: 1.35;\n }\n :where(label) { font-size: .95rem; }\n :where(input:not([type=\"button\"]):not([type=\"submit\"]):not([type=\"reset\"]):not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"range\"]):not([type=\"color\"]):not([type=\"file\"]):not([type=\"hidden\"]), select, textarea) {\n min-block-size: var(--gramlot-field-height);\n padding: var(--gramlot-field-padding);\n font-size: var(--gramlot-field-font-size);\n line-height: var(--gramlot-field-line-height);\n }\n :where(textarea) { min-block-size: 5rem; }\n :where(input[type=\"color\"]) { min-block-size: 28px; }\n :where(input[type=\"file\"])::file-selector-button { margin-inline-end: .5rem; padding: .25rem .5rem; }\n :where(fieldset) { margin-block-end: .6rem; padding: .5rem; }\n :where(table) { font-size: 1rem; }\n :where(th, td) { padding: .4rem .5rem; }\n :where(details) { padding: .4rem .5rem; }\n :where(details[open] > summary) { margin-block-end: .5rem; }\n :where(dialog) { padding: .75rem; }\n}\n\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 1.2rem, var(--gramlot-page-width)); padding-block: .6rem; }\n .card { padding: .6rem; box-shadow: none; }\n}\n\n/* Gramlot adaptation of legacy mimi; load after Base and Compact. */\n@layer gramlot.tokens {\n :root {\n --gramlot-tab-height: 24px;\n --gramlot-tab-padding: 3px 10px;\n --gramlot-tab-radius: 3px;\n --gramlot-tab-gap: 2px;\n --gramlot-tab-strip-padding: 3px;\n --gramlot-tab-background: var(--gramlot-background);\n --gramlot-tab-selected-background: var(--gramlot-surface);\n --gramlot-tab-selected-color: var(--gramlot-ink);\n --gramlot-tab-border: var(--gramlot-border);\n --gramlot-background: #EDEEF0;\n --gramlot-surface: #F5F5F6;\n --gramlot-surface-subtle: #E0E1E3;\n --gramlot-ink: #3C3D40;\n --gramlot-text-secondary: #6B6E72;\n --gramlot-border: #BDBFC2;\n --gramlot-border-control: #9EA0A3;\n --gramlot-navigation: #48494C;\n --gramlot-navigation-text: #FFFFFF;\n --gramlot-action: #0071E3;\n --gramlot-action-hover: #005BBB;\n --gramlot-brand-blue: #0071E3;\n --gramlot-brand-yellow: #9EA0A3;\n --gramlot-selected: #E8F1FC;\n --gramlot-focus-ring: #0071E3;\n --gramlot-field-background: #FFFFFF;\n --gramlot-field-readonly-background: #E0E1E3;\n --gramlot-error: #B3261E;\n --gramlot-error-background: #FFF1F0;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 6%);\n --gramlot-radius-sm: 4px;\n --gramlot-radius: 3px;\n --gramlot-radius-lg: 3px;\n --gramlot-field-height: 18px;\n --gramlot-field-padding: 1px 3px;\n --gramlot-field-line-height: 1.15;\n --gramlot-field-font-size: 1rem;\n --gramlot-label-size: .9em;\n --gramlot-label-gap: 2px;\n --gramlot-label-color: var(--gramlot-text-secondary);\n --gramlot-space-4: 6px;\n --gramlot-font-ui: -apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Arial, sans-serif;\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n --gramlot-background: #242527;\n --gramlot-surface: #303134;\n --gramlot-surface-subtle: #3C3D40;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #6B6E72;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3C3D40;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n }\n :root[data-theme=\"dark\"] {\n --gramlot-background: #242527;\n --gramlot-surface: #303134;\n --gramlot-surface-subtle: #3C3D40;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #6B6E72;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3C3D40;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n}\n@layer gramlot.base {\n html { font-size: 12px; }\n}\n@layer gramlot.components {\n :where(label) { font-size: var(--gramlot-label-size); font-weight: normal; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(button, input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"], .button) { min-block-size: 24px; padding: 2px 8px; font-weight: 500; }\n}\n@layer gramlot.utilities {\n .card { box-shadow: var(--gramlot-shadow); }\n}\n","joanna":"/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */\n@layer gramlot.tokens {\n :root {\n --gramlot-field-height: 28px;\n --gramlot-field-line-height: 1.35;\n --gramlot-field-padding: .25rem .5rem;\n --gramlot-field-font-size: 1rem;\n --gramlot-space-1: .2rem;\n --gramlot-space-2: .4rem;\n --gramlot-space-3: .5rem;\n --gramlot-space-4: .6rem;\n --gramlot-space-6: .9rem;\n --gramlot-space-8: 1.2rem;\n --gramlot-space-12: 1.8rem;\n --gramlot-radius-sm: .25rem;\n --gramlot-radius: .35rem;\n --gramlot-radius-lg: .4rem;\n }\n}\n\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.35; }\n :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, pre, figure) { margin-block: 0 .5rem; }\n h1 { font-size: 1.35rem; }\n h2 { font-size: 1.15rem; }\n h3 { font-size: 1.05rem; }\n pre { padding: .5rem; }\n blockquote { padding-inline-start: .6rem; }\n hr { margin-block: 1rem; }\n}\n\n@layer gramlot.components {\n :where(button, input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"], .button) {\n min-block-size: 28px;\n padding: .25rem .5rem;\n font-size: 1rem;\n line-height: 1.35;\n }\n :where(label) { font-size: .95rem; }\n :where(input:not([type=\"button\"]):not([type=\"submit\"]):not([type=\"reset\"]):not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"range\"]):not([type=\"color\"]):not([type=\"file\"]):not([type=\"hidden\"]), select, textarea) {\n min-block-size: var(--gramlot-field-height);\n padding: var(--gramlot-field-padding);\n font-size: var(--gramlot-field-font-size);\n line-height: var(--gramlot-field-line-height);\n }\n :where(textarea) { min-block-size: 5rem; }\n :where(input[type=\"color\"]) { min-block-size: 28px; }\n :where(input[type=\"file\"])::file-selector-button { margin-inline-end: .5rem; padding: .25rem .5rem; }\n :where(fieldset) { margin-block-end: .6rem; padding: .5rem; }\n :where(table) { font-size: 1rem; }\n :where(th, td) { padding: .4rem .5rem; }\n :where(details) { padding: .4rem .5rem; }\n :where(details[open] > summary) { margin-block-end: .5rem; }\n :where(dialog) { padding: .75rem; }\n}\n\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 1.2rem, var(--gramlot-page-width)); padding-block: .6rem; }\n .card { padding: .6rem; box-shadow: none; }\n}\n\n/* Gramlot adaptation of legacy joanna; load after Base and Compact. */\n@layer gramlot.tokens {\n :root {\n --gramlot-tab-height: 26px;\n --gramlot-tab-padding: 3px 10px;\n --gramlot-tab-radius: 6px;\n --gramlot-tab-gap: 2px;\n --gramlot-tab-strip-padding: 3px;\n --gramlot-tab-background: var(--gramlot-background);\n --gramlot-tab-selected-background: var(--gramlot-surface);\n --gramlot-tab-selected-color: var(--gramlot-ink);\n --gramlot-tab-border: var(--gramlot-border);\n --gramlot-background: #F2F2F7;\n --gramlot-surface: #FFFFFF;\n --gramlot-surface-subtle: #F2F2F7;\n --gramlot-ink: #3A3A3C;\n --gramlot-text-secondary: #636366;\n --gramlot-border: #D1D1D6;\n --gramlot-border-control: #AEAEB2;\n --gramlot-navigation: #3A3A3C;\n --gramlot-navigation-text: #FFFFFF;\n --gramlot-action: #007AFF;\n --gramlot-action-hover: #0061CC;\n --gramlot-brand-blue: #007AFF;\n --gramlot-brand-yellow: #AEAEB2;\n --gramlot-selected: #E0EFFF;\n --gramlot-focus-ring: #007AFF;\n --gramlot-field-background: #FFFFFF;\n --gramlot-field-readonly-background: #F2F2F7;\n --gramlot-error: #B3261E;\n --gramlot-error-background: #FFF1F0;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 6%);\n --gramlot-radius-sm: 6px;\n --gramlot-radius: 6px;\n --gramlot-radius-lg: 6px;\n --gramlot-field-height: 20px;\n --gramlot-field-padding: 1px 3px;\n --gramlot-field-line-height: 1.15;\n --gramlot-field-font-size: 1rem;\n --gramlot-label-size: .8em;\n --gramlot-label-gap: 2px;\n --gramlot-label-color: var(--gramlot-text-secondary);\n --gramlot-space-4: 6px;\n --gramlot-font-ui: -apple-system, BlinkMacSystemFont, \"Helvetica Neue\", Arial, sans-serif;\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n --gramlot-background: #1C1C1E;\n --gramlot-surface: #2C2C2E;\n --gramlot-surface-subtle: #3A3A3C;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #636366;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3A3A3C;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n }\n :root[data-theme=\"dark\"] {\n --gramlot-background: #1C1C1E;\n --gramlot-surface: #2C2C2E;\n --gramlot-surface-subtle: #3A3A3C;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #636366;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3A3A3C;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n}\n@layer gramlot.base {\n html { font-size: 13px; }\n}\n@layer gramlot.components {\n :where(label) { font-size: var(--gramlot-label-size); font-weight: normal; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(button, input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"], .button) { min-block-size: 26px; padding: 2px 8px; font-weight: 500; }\n}\n@layer gramlot.utilities {\n .card { box-shadow: var(--gramlot-shadow); }\n}\n"};
|
|
@@ -11,7 +11,7 @@ export const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
|
11
11
|
const BINDING_ATTRIBUTES = new Set([
|
|
12
12
|
'default', 'default_value', 'live', 'group', 'visible', 'action', 'fire', 'ask', '_ask', '_ask_if', '_ask_title', '_ask_onCancel',
|
|
13
13
|
'if', 'else', '_init', '_onStart', '_onBuilt', '_delay', '_timing', '_userChanges',
|
|
14
|
-
'remote', '_cachedRemote', '_onRemote',
|
|
14
|
+
'remote', '_cachedRemote', '_onRemote', 'onClose',
|
|
15
15
|
]);
|
|
16
16
|
const BINDING_ATTRIBUTE_PREFIXES = ['default_', 'attr_', 'fire_', 'connect_on', 'subscribe_', 'selfsubscribe_', 'formsubscribe_', 'remote_'];
|
|
17
17
|
|
|
@@ -55,6 +55,9 @@ export function requireStyleClassAttributes(node, attrs, prefixes = []) {
|
|
|
55
55
|
* the dialect `prefixes` (`html_`).
|
|
56
56
|
*/
|
|
57
57
|
export function requireNoScriptAttributes(node, attrs, prefixes = []) {
|
|
58
|
+
if (attrs.onClose != null && !node.parentNode?._getMeta('gramlot_component')?.childParameters?.onClose) {
|
|
59
|
+
throw new Error('onClose is only supported on a tab/stack panel');
|
|
60
|
+
}
|
|
58
61
|
for (const [name, value] of Object.entries(withoutNullValues(withoutBindingAttributes(attrs)))) {
|
|
59
62
|
const prefix = prefixes.find(candidate => name.startsWith(candidate));
|
|
60
63
|
const bare = prefix ? name.slice(prefix.length) : name;
|