@gramlot/gramlot 0.3.10 → 0.3.16
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/components/editors/__init__.py +13 -0
- package/dist/components/{editors.js → editors/assets/collection.js} +131 -246
- package/dist/components/editors/assets/index.js +2 -0
- package/dist/components/editors/commands.json +7 -0
- package/dist/components/editors/grammar.json +7045 -0
- package/dist/components/inputs/__init__.py +13 -0
- package/dist/components/{inputs.js → inputs/assets/collection.js} +287 -198
- package/dist/components/inputs/assets/index.js +2 -0
- package/dist/components/inputs/commands.json +7 -0
- package/dist/components/inputs/grammar.json +42881 -0
- package/dist/components/layout/__init__.py +13 -0
- package/dist/components/layout/assets/collection.js +25737 -0
- package/dist/components/layout/assets/index.js +2 -0
- package/dist/components/layout/commands.json +7 -0
- package/dist/components/layout/grammar.json +1798 -0
- package/dist/components/tree/__init__.py +13 -0
- package/dist/components/{tree.js → tree/assets/collection.js} +62 -175
- package/dist/components/tree/assets/index.js +2 -0
- package/dist/components/tree/commands.json +7 -0
- package/dist/components/tree/grammar.json +339 -0
- package/dist/components/typst/__init__.py +13 -0
- package/dist/components/typst/assets/collection.js +4 -0
- package/dist/components/typst/assets/index.js +2 -0
- package/dist/components/typst/commands.json +7 -0
- package/dist/components/typst/grammar.json +81 -0
- package/dist/gramlot.js +2496 -905
- package/dist/gramlot.min.js +109 -28
- package/dist/runtime-notices.json +0 -196
- package/package.json +1 -1
- package/src/binding/ask-dialog.js +1 -1
- package/src/binding/installation.js +5 -6
- package/src/binding/runtime.js +4 -2
- package/src/bootstrap.d.ts +1 -1
- package/src/bootstrap.js +52 -30
- package/src/builder/binding.json +25 -0
- package/src/builder/gramlot-builder.js +16 -3
- package/src/builder/source.js +33 -1
- package/src/collection-artifact.d.ts +11 -0
- package/src/collection-artifact.js +57 -0
- package/src/commands.d.ts +9 -0
- package/src/commands.js +36 -0
- package/src/components/bases.js +1 -1
- package/src/components/border-container.js +26 -1
- package/src/components/buttons.js +84 -161
- package/src/components/choice-editor.js +31 -10
- package/src/components/database-choices.js +110 -0
- package/src/components/inputs.js +15 -2
- package/src/components/layout.js +5 -3
- package/src/components/menus.js +346 -0
- package/src/components/popup.js +15 -2
- package/src/components/registry.js +18 -3
- package/src/components/toolbar-overflow.js +181 -0
- package/src/components/tree.js +14 -4
- package/src/components/windows.js +284 -0
- package/src/filesystem.js +1 -0
- package/src/gramlot.d.ts +2 -0
- package/src/gramlot.js +4 -2
- package/src/handlers/rpc-handler.d.ts +6 -1
- package/src/handlers/rpc-handler.js +7 -2
- package/src/handlers/source-handler.d.ts +2 -1
- package/src/handlers/source-handler.js +10 -1
- package/src/ide-documents.js +1 -1
- package/src/ide-runtime.js +3 -2
- package/src/index-page-styles.js +1 -1
- package/src/index-theme.js +1 -1
- package/src/index.d.ts +5 -0
- package/src/index.js +5 -0
- package/src/renderer/gramlot-html-renderer.js +1 -0
- package/src/renderer/gramlot-renderer.js +13 -3
- package/src/server/gramlot-file-server.d.ts +2 -0
- package/src/server/gramlot-file-server.js +45 -1
- package/src/server/gramlot-server.d.ts +20 -2
- package/src/server/gramlot-server.js +86 -6
- package/src/server/page-base.js +1 -0
- package/src/server/page.d.ts +3 -0
- package/src/view/button.js +47 -3
- package/src/view/controls.js +8 -0
- package/src/view/html.js +1 -0
- package/src/view/menu-command.js +45 -0
- package/src/view/menu.js +87 -0
- package/themes/gramlot-compact/README.md +19 -0
- package/themes/gramlot-compact/theme.css +138 -45
- package/themes/joanna/README.md +19 -0
- package/themes/joanna/theme.css +134 -78
- package/themes/mela/theme.css +184 -0
- package/themes/mimi/README.md +19 -0
- package/themes/mimi/theme.css +133 -77
- package/themes/palettes/README.md +3 -0
- package/themes/palettes/compact.css +86 -0
- package/themes/palettes/joanna.css +86 -0
- package/themes/palettes/mimi.css +86 -0
- package/tools/gramlot-tools-inspector.js +3 -3
- package/dist/components/layout.js +0 -3385
- package/dist/components/typst.js +0 -4
package/src/view/button.js
CHANGED
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
* target selection; this binding owns execution, ask, delay and disposal.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import {SourceBag} from '@genrojs/builders';
|
|
6
7
|
import {invokeHook} from '../binding/hooks.js';
|
|
8
|
+
import {captureCommand} from './menu-command.js';
|
|
7
9
|
|
|
8
10
|
export class ButtonBinding {
|
|
9
11
|
#binding;
|
|
10
12
|
#record;
|
|
11
13
|
#cancelDelay = null;
|
|
12
14
|
#pendingCount = 0;
|
|
15
|
+
#activations = new Set();
|
|
16
|
+
#warnedCommand = null;
|
|
13
17
|
|
|
14
18
|
/** The binding of a Gramlot button; html_button remains native despite its DOM tag. */
|
|
15
19
|
static for(binding, record) {
|
|
@@ -48,7 +52,15 @@ export class ButtonBinding {
|
|
|
48
52
|
const found = [];
|
|
49
53
|
if (controllers.length) found.push('controller');
|
|
50
54
|
if (attrs.action != null) found.push('action');
|
|
55
|
+
if (node.nodeTag === 'menuline' && attrs.command != null) found.push('registered');
|
|
51
56
|
if (fireAttributes(attrs).length) found.push('fire');
|
|
57
|
+
if (node.nodeTag === 'menuline' && node.value instanceof SourceBag
|
|
58
|
+
&& node.value.getNodes().some(child => child.nodeTag === 'menu') && found.length) {
|
|
59
|
+
throw new Error(`menuline '${node.label}': a submenu cannot also execute a command`);
|
|
60
|
+
}
|
|
61
|
+
if (node.nodeTag==='menuline' && attrs.group && found.length) {
|
|
62
|
+
throw new Error(`menuline '${node.label}': a group cannot execute a command`);
|
|
63
|
+
}
|
|
52
64
|
if (found.length > 1) {
|
|
53
65
|
throw new Error(`${node.nodeTag} '${node.label}': ${found.join(' and ')} together; a button has one click mechanism`);
|
|
54
66
|
}
|
|
@@ -68,6 +80,16 @@ export class ButtonBinding {
|
|
|
68
80
|
* again, so an ambiguity raises now, and a button that gained a mechanism gets `type="button"`.
|
|
69
81
|
*/
|
|
70
82
|
refresh() {
|
|
83
|
+
if (this.node.nodeTag === 'menuline') {
|
|
84
|
+
const command = this.node.getAttr('command');
|
|
85
|
+
const definition = command ? this.binding.runtime.gramlot.commands.get(command) : null;
|
|
86
|
+
this.element.setCommandDefinition(definition, this.node.label);
|
|
87
|
+
if (command && !definition && this.#warnedCommand !== command) {
|
|
88
|
+
console.warn(`Unknown command '${command}' in menu '${this.node.parentNode?.label}', entry '${this.node.label}'`);
|
|
89
|
+
this.#warnedCommand = command;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
for (const activation of this.#activations) if (!activation.current()) activation.cancel();
|
|
71
93
|
const mechanism = this.mechanism;
|
|
72
94
|
if (mechanism && this.node.getAttr('type') == null && this.element.getAttribute('type') !== 'button') {
|
|
73
95
|
this.element.setAttribute('type', 'button');
|
|
@@ -79,6 +101,8 @@ export class ButtonBinding {
|
|
|
79
101
|
this.element.releaseCommand();
|
|
80
102
|
delete this.element.activateCommand;
|
|
81
103
|
this.#cancelDelay?.();
|
|
104
|
+
for (const activation of this.#activations) { activation.cancel(); activation.release(); }
|
|
105
|
+
this.#activations.clear();
|
|
82
106
|
}
|
|
83
107
|
|
|
84
108
|
handleEvent(event) {
|
|
@@ -103,6 +127,9 @@ export class ButtonBinding {
|
|
|
103
127
|
if (!mechanism) return;
|
|
104
128
|
event.stopPropagation();
|
|
105
129
|
if (this.element.disabled) return;
|
|
130
|
+
const activation = mechanism === 'registered' ? captureCommand(this.binding, event) : null;
|
|
131
|
+
if (mechanism === 'registered' && !activation) return;
|
|
132
|
+
if (activation) this.#activations.add(activation);
|
|
106
133
|
const counter = this.binding.countClick();
|
|
107
134
|
// Legacy reads inherited _delay. An explicit zero overrides an ancestor's delay.
|
|
108
135
|
let owner = this.node;
|
|
@@ -116,11 +143,12 @@ export class ButtonBinding {
|
|
|
116
143
|
release();
|
|
117
144
|
this.#cancelDelay = null;
|
|
118
145
|
this.#pendingCount = 0;
|
|
119
|
-
this.#execute(event, count);
|
|
146
|
+
this.#execute(event, count, activation);
|
|
120
147
|
}, delay);
|
|
121
148
|
const release = this.binding.track(() => this.#cancelDelay?.());
|
|
122
149
|
this.#cancelDelay = () => {
|
|
123
150
|
clearTimeout(timer);
|
|
151
|
+
if (activation) { activation.cancel(); activation.release(); this.#activations.delete(activation); }
|
|
124
152
|
release();
|
|
125
153
|
this.#cancelDelay = null;
|
|
126
154
|
this.#pendingCount = 0;
|
|
@@ -128,11 +156,27 @@ export class ButtonBinding {
|
|
|
128
156
|
return;
|
|
129
157
|
}
|
|
130
158
|
this.#cancelDelay?.();
|
|
131
|
-
return this.#execute(event, counter);
|
|
159
|
+
return this.#execute(event, counter, activation);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async #executeRegistered(activation) {
|
|
163
|
+
try {
|
|
164
|
+
if (!activation.current()) return;
|
|
165
|
+
const ask = this.node.getAttr('ask'), dialog = this.binding.runtime.askDialog;
|
|
166
|
+
const keywords = {...activation.message.parameters};
|
|
167
|
+
if (ask && dialog.required(this.binding, ask, keywords, 'ask')) {
|
|
168
|
+
const result = await dialog.show(this.binding, ask, keywords);
|
|
169
|
+
if (result === null) return;
|
|
170
|
+
}
|
|
171
|
+
activation.deliver();
|
|
172
|
+
} finally {
|
|
173
|
+
activation.release(); this.#activations.delete(activation);
|
|
174
|
+
}
|
|
132
175
|
}
|
|
133
176
|
|
|
134
177
|
/** Deliver the last event once; arguments are read when the mechanism executes. */
|
|
135
|
-
#execute(event, counter) {
|
|
178
|
+
#execute(event, counter, activation = null) {
|
|
179
|
+
if (activation) return this.#executeRegistered(activation);
|
|
136
180
|
if (this.binding.closed || this.element.disabled) return;
|
|
137
181
|
const mechanism = this.mechanism;
|
|
138
182
|
if (!mechanism) return;
|
package/src/view/controls.js
CHANGED
|
@@ -581,6 +581,14 @@ function componentContext(adapter) {
|
|
|
581
581
|
callLogic:(name, keywords) => callLogic(binding.runtime, node, name, keywords),
|
|
582
582
|
format:(value, options) => app.format(value, options), invoke,
|
|
583
583
|
remote:(method, keywords, signal) => app.rpc.call('data', method, keywords, {signal}),
|
|
584
|
+
selectionOutputs:({selectedCaption, selectedRecord, fields}, row) => {
|
|
585
|
+
if (binding.closed) return;
|
|
586
|
+
if (selectedCaption) node.setRelativeData(selectedCaption, row?.caption ?? null);
|
|
587
|
+
if (selectedRecord) node.setRelativeData(selectedRecord, row ? new Bag(row.record) : null);
|
|
588
|
+
for (const [name, path] of Object.entries(fields)) {
|
|
589
|
+
node.setRelativeData(path, row?.record[name.slice(9)] ?? null);
|
|
590
|
+
}
|
|
591
|
+
},
|
|
584
592
|
validationCurrent:() => {
|
|
585
593
|
const pointer = node.getAttr('value');
|
|
586
594
|
const path = node.pointerType(pointer) ? node.absDatapath(pointer) : null;
|
package/src/view/html.js
CHANGED
|
@@ -65,6 +65,7 @@ export class HtmlElement {
|
|
|
65
65
|
}
|
|
66
66
|
for (const [key, value] of Object.entries(node.attr)) {
|
|
67
67
|
if (key === 'value' && this.definition(node).meta.gramlot_component) continue;
|
|
68
|
+
if (node.nodeTag === 'menuline' && key === 'parameters') continue;
|
|
68
69
|
if (this.metadataAttributes.has(key) || ['ask', '_ask'].includes(key) || (value && typeof value === 'object' && Object.hasOwn(value, '$gramlotRef'))) continue;
|
|
69
70
|
if (value != null && !['string', 'number', 'boolean'].includes(typeof value)) {
|
|
70
71
|
throw new TypeError(`HTML attribute ${key} must be scalar`);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Registered commands use the existing node-scoped publication bus. */
|
|
2
|
+
import {SourceBag} from '@genrojs/builders';
|
|
3
|
+
import {toTytx,fromTytx} from '@genrojs/tytx';
|
|
4
|
+
|
|
5
|
+
export function commandFrame(node) {
|
|
6
|
+
for(let parent=node.parentNode;parent;parent=parent.parentNode)if(parent.nodeTag==='framePane')return parent;
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
export function frameRecipient(frame) {
|
|
10
|
+
if(!frame || !(frame.value instanceof SourceBag))return null;
|
|
11
|
+
const center=frame.value.getNodes().find(node=>node.getAttr('region')==='center');
|
|
12
|
+
const targets=[];
|
|
13
|
+
function visit(node){
|
|
14
|
+
if(node.nodeTag==='framePane')return;
|
|
15
|
+
if(node.getAttr('frameTarget')===true)targets.push(node);
|
|
16
|
+
if(node.value instanceof SourceBag)for(const child of node.value.getNodes())visit(child);
|
|
17
|
+
}
|
|
18
|
+
if(center)visit(center);
|
|
19
|
+
return targets.length===1?targets[0]:null;
|
|
20
|
+
}
|
|
21
|
+
function eligible(binding){
|
|
22
|
+
if(binding.closed||!binding.runtime.renderer.attached(binding.node))return false;
|
|
23
|
+
for(let node=binding.node;node;node=node.parentNode){
|
|
24
|
+
const [,attrs]=node.rootBuilder.runtimeValues(node);
|
|
25
|
+
if(attrs.hidden===true||attrs.disabled===true)return false;
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
function freeze(value){if(value&&typeof value==='object'){for(const item of Object.values(value))freeze(item);Object.freeze(value);}return value;}
|
|
30
|
+
export function captureCommand(binding,event){
|
|
31
|
+
const sender=binding.node,command=sender.getAttr('command');
|
|
32
|
+
const definition=binding.runtime.gramlot.commands.get(command);
|
|
33
|
+
const frame=commandFrame(sender),target=frameRecipient(frame);
|
|
34
|
+
if(!definition||!target){console.warn(`Cannot dispatch command '${command}' at '${sender.label}': missing or duplicate frame recipient`);return null;}
|
|
35
|
+
const raw=sender.getAttr('parameters')??{};
|
|
36
|
+
if(typeof raw!=='object'||Array.isArray(raw))throw new TypeError('Command parameters require a mapping');
|
|
37
|
+
const values=Object.fromEntries(Object.entries(raw).map(([key,value])=>[key,sender.pointerType(value)?sender.getRelativeData(value):value]));
|
|
38
|
+
const parameters=freeze(fromTytx(toTytx(values)));
|
|
39
|
+
const modifiers=Object.freeze(Object.fromEntries(['shift','ctrl','alt','meta'].map(key=>[key,Boolean(event[`${key}Key`])])));
|
|
40
|
+
const message=Object.freeze({sender,target,command,parameters,modifiers});
|
|
41
|
+
let cancelled=false;
|
|
42
|
+
const release=binding.runtime.bindingFor(target).track(()=>{cancelled=true;});
|
|
43
|
+
const current=()=>!cancelled&&eligible(binding)&&frameRecipient(frame)===target&&binding.runtime.renderer.attached(target)&&sender.getAttr('command')===command;
|
|
44
|
+
return {message,current,release,cancel(){cancelled=true;},deliver(){if(current())target.publish(definition.publish,message);}};
|
|
45
|
+
}
|
package/src/view/menu.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** Menu-owned RpcResolver and validated, keyed Bag-to-Source projection. */
|
|
2
|
+
import {Bag} from '@genrojs/bag';
|
|
3
|
+
import {SourceBag, sourceTarget} from '@genrojs/builders';
|
|
4
|
+
import {toTytx} from '@genrojs/tytx';
|
|
5
|
+
import {RpcResolver} from '../binding/rpc-resolver.js';
|
|
6
|
+
|
|
7
|
+
const ENTRY_FIELDS=new Set(['kind','command','caption','icon','iconSrc','tooltip','disabled','hidden','checked','favorite','parameters','resolver','cacheTime','sync']);
|
|
8
|
+
function entries(bag,ancestors=new Set()) {
|
|
9
|
+
if (!(bag instanceof Bag) || ancestors.has(bag)) throw new TypeError('Menu resolver must return an acyclic Bag');
|
|
10
|
+
const parents=new Set([...ancestors,bag]);
|
|
11
|
+
return bag.getNodes().map(node=>{
|
|
12
|
+
const a=node.attr,kind=a.kind,value=node.staticValue;
|
|
13
|
+
if(Object.keys(a).some(key=>!ENTRY_FIELDS.has(key)&&!key.startsWith('resolver_')))throw new TypeError(`Unsupported menu record field: ${node.label}`);
|
|
14
|
+
if(!['command','separator','submenu'].includes(kind))throw new TypeError(`Invalid menu kind: ${node.label}`);
|
|
15
|
+
for(const name of ['disabled','hidden','checked'])if(a[name]!=null && typeof a[name]!=='boolean' && !(typeof a[name]==='string'&&a[name].startsWith('^')))throw new TypeError(`Invalid menu ${name}`);
|
|
16
|
+
if(a.favorite!=null&&typeof a.favorite!=='boolean')throw new TypeError('favorite must be boolean');
|
|
17
|
+
if(a.caption!=null&&typeof a.caption!=='string')throw new TypeError('Menu caption must be text');
|
|
18
|
+
if(a.parameters!=null && (typeof a.parameters!=='object'||Array.isArray(a.parameters)))throw new TypeError('Menu parameters must be a mapping');
|
|
19
|
+
if(kind==='command' && (typeof a.command!=='string'||!a.command||value!=null||a.resolver!=null))throw new TypeError('Command record requires a command and no children/resolver');
|
|
20
|
+
if(kind==='separator' && (value!=null||Object.keys(a).length!==1))throw new TypeError('Separator record accepts kind only');
|
|
21
|
+
if(kind==='submenu' && (typeof a.caption!=='string'||a.command!=null||((value instanceof Bag)===(a.resolver!=null))||(!(value instanceof Bag)&&value!=null)))throw new TypeError('Submenu requires caption and exactly one content source');
|
|
22
|
+
const children=value instanceof Bag?entries(value,parents):null;
|
|
23
|
+
return {label:node.label,attrs:{...a},children};
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function project(menu,records) {
|
|
27
|
+
const handle=menu.builder.wrapSource(menu);
|
|
28
|
+
const old=menu.value instanceof SourceBag?menu.value.getNodes():[];
|
|
29
|
+
const keys=new Set(records.map(item=>item.label));
|
|
30
|
+
for(const node of old)if(!keys.has(node.label))menu.value.popNode(node.label);
|
|
31
|
+
for(const [index,item] of records.entries()){
|
|
32
|
+
const {kind,...attrs}=item.attrs;
|
|
33
|
+
const resolver=Object.fromEntries(Object.entries(attrs).filter(([key])=>key==='resolver'||key==='cacheTime'||key==='sync'||key.startsWith('resolver_')));
|
|
34
|
+
for(const key of Object.keys(resolver))delete attrs[key];
|
|
35
|
+
const value=kind==='separator'?'-':null;
|
|
36
|
+
let node=menu.value instanceof SourceBag?menu.value.getNodes().find(node=>node.label===item.label):null;
|
|
37
|
+
const wasSubmenu=node?.value instanceof SourceBag;
|
|
38
|
+
if(node && (wasSubmenu!==(kind==='submenu') || (node.value==='-')!==(kind==='separator'))){menu.value.popNode(node.label);node=null;}
|
|
39
|
+
if(!node)node=sourceTarget(handle.menuline(value,{...attrs,node_label:item.label}));
|
|
40
|
+
else {
|
|
41
|
+
const previous=Object.keys(node.attr).filter(key=>ENTRY_FIELDS.has(key)&&!Object.hasOwn(attrs,key));
|
|
42
|
+
node.setAttr({...Object.fromEntries(previous.map(key=>[key,null])),...attrs});
|
|
43
|
+
}
|
|
44
|
+
if(kind==='submenu') {
|
|
45
|
+
let child=node.value instanceof SourceBag?node.value.getNodes().find(n=>n.nodeTag==='menu'):null;
|
|
46
|
+
if(!child)child=sourceTarget(node.builder.wrapSource(node).menu({...resolver,node_label:'menu'}));
|
|
47
|
+
else child.setAttr({...Object.fromEntries(Object.keys(child.attr).filter(key=>key==='resolver'||key==='cacheTime'||key==='sync'||key.startsWith('resolver_')).map(key=>[key,null])),...resolver});
|
|
48
|
+
if(item.children)project(child,item.children);
|
|
49
|
+
}
|
|
50
|
+
const order=menu.value.getNodes().indexOf(node);
|
|
51
|
+
if(order!==index)menu.value.move(order,index);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export class MenuBinding {
|
|
55
|
+
#key=null; #resolver=null; #generation=0; #closed=false; #projection=null;
|
|
56
|
+
constructor(binding,element){this.binding=binding;this.element=element;}
|
|
57
|
+
get node(){return this.binding.node;}
|
|
58
|
+
attach(){this.element.menuBinding=this;this.refresh();}
|
|
59
|
+
detach(){this.#closed=true;this.#generation++;this.node.requests.inflight?.cancel();delete this.element.menuBinding;this.element.close(false);}
|
|
60
|
+
refresh(){
|
|
61
|
+
const [,attrs]=this.node.rootBuilder.runtimeValues(this.node);
|
|
62
|
+
const params=Object.fromEntries(Object.entries(attrs).filter(([key])=>key.startsWith('resolver_')).map(([key,value])=>[key.slice(9),value]));
|
|
63
|
+
const key=toTytx([attrs.resolver,params,attrs.cacheTime,attrs.sync]);
|
|
64
|
+
if(key===this.#key)return;
|
|
65
|
+
this.#key=key;this.#generation++;this.#projection=null;
|
|
66
|
+
this.#resolver=attrs.resolver?new RpcResolver({binding:this.binding,method:attrs.resolver,params,cacheTime:attrs.cacheTime??-1,sync:attrs.sync??false,onError:()=>{}}):null;
|
|
67
|
+
if(this.#resolver){this.element.setStatus('loading');if(this.element.opened&&this.element.isConnected)this.load();}
|
|
68
|
+
else this.element.setStatus(null);
|
|
69
|
+
}
|
|
70
|
+
async load(force=false){
|
|
71
|
+
if(this.#closed||!this.#resolver)return;
|
|
72
|
+
const resolver=this.#resolver,generation=this.#generation;
|
|
73
|
+
try{
|
|
74
|
+
if(force)resolver.refresh();else resolver.resolve();
|
|
75
|
+
if(resolver.loading){this.element.setStatus('loading');await resolver.loading;}
|
|
76
|
+
if(this.#closed||generation!==this.#generation)return;
|
|
77
|
+
const result=resolver.cachedValue;
|
|
78
|
+
const records=entries(result);
|
|
79
|
+
const fingerprint=toTytx(result);
|
|
80
|
+
if(this.#projection!==fingerprint){project(this.node,records);this.#projection=fingerprint;}
|
|
81
|
+
this.element.setStatus(records.length?null:'empty');
|
|
82
|
+
}catch(error){
|
|
83
|
+
if(this.#closed||generation!==this.#generation)return;
|
|
84
|
+
this.element.setStatus('error');console.warn(`Menu '${this.node.label}' failed to load`,error);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# Compact
|
|
2
|
+
|
|
3
|
+
Professional desktop profile, revised at the owner's request on 2026-10-23.
|
|
4
|
+
Neutral blue-gray, compact daily work. Controls are 28px high; body and field text are 13px. Light and dark
|
|
5
|
+
palettes use the same semantic roles. Existing touch targets remain larger.
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
class Page(BasePage):
|
|
9
|
+
css = ("/themes/gramlot-compact/theme.css",)
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The server loads Base first. The gallery's existing appearance selector uses the
|
|
13
|
+
same canonical stylesheet. Inputs, command buttons, menus, tabs and window chrome
|
|
14
|
+
share existing field/button/spacing/radius tokens. Fixed Source dimensions still
|
|
15
|
+
win; use semantic spacing variables when a page should follow profile density.
|
|
16
|
+
These revised aesthetics are a development preview awaiting owner feedback.
|
|
17
|
+
|
|
18
|
+
## Historical record — before the 2026-10-23 aesthetic revision
|
|
19
|
+
|
|
1
20
|
# Gramlot Compact theme
|
|
2
21
|
|
|
3
22
|
Compact is the denser alternative to Gramlot Base. It reduces typography, spacing,
|
|
@@ -1,61 +1,154 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* gramlot-compact: professional density profile; load after Base. */
|
|
2
2
|
@layer gramlot.tokens {
|
|
3
3
|
:root {
|
|
4
|
+
color-scheme: light;
|
|
5
|
+
--gramlot-background: #f3f5f7;
|
|
6
|
+
--gramlot-surface: #ffffff;
|
|
7
|
+
--gramlot-surface-subtle: #e9edf2;
|
|
8
|
+
--gramlot-ink: #202936;
|
|
9
|
+
--gramlot-text-secondary: #526174;
|
|
10
|
+
--gramlot-border: #ccd3dc;
|
|
11
|
+
--gramlot-border-control: #7b899b;
|
|
12
|
+
--gramlot-action: #235db2;
|
|
13
|
+
--gramlot-action-hover: #194987;
|
|
14
|
+
--gramlot-selected: #e3edfb;
|
|
15
|
+
--gramlot-field-background: #ffffff;
|
|
16
|
+
--gramlot-field-readonly-background: #e9edf2;
|
|
17
|
+
--gramlot-label-color: #526174;
|
|
18
|
+
--gramlot-focus-ring: #235db2;
|
|
19
|
+
--gramlot-brand-blue: #235db2;
|
|
20
|
+
--gramlot-brand-yellow: #235db2;
|
|
21
|
+
--gramlot-navigation: #202936;
|
|
22
|
+
--gramlot-navigation-text: #f6f8fb;
|
|
23
|
+
--gramlot-error: #aa2637;
|
|
24
|
+
--gramlot-error-background: #fff0f1;
|
|
25
|
+
--gramlot-success: #236747;
|
|
26
|
+
--gramlot-success-background: #e9f4ec;
|
|
27
|
+
--gramlot-warning: #735313;
|
|
28
|
+
--gramlot-warning-background: #fff5da;
|
|
4
29
|
--gramlot-field-height: 28px;
|
|
5
|
-
--gramlot-field-
|
|
6
|
-
--gramlot-field-
|
|
30
|
+
--gramlot-field-padding: 2px 7px;
|
|
31
|
+
--gramlot-field-line-height: 1.3;
|
|
7
32
|
--gramlot-field-font-size: 1rem;
|
|
8
|
-
--gramlot-
|
|
9
|
-
--gramlot-
|
|
10
|
-
--gramlot-
|
|
11
|
-
--gramlot-
|
|
12
|
-
--gramlot-
|
|
13
|
-
--gramlot-
|
|
14
|
-
--gramlot-
|
|
15
|
-
--gramlot-radius
|
|
16
|
-
--gramlot-radius:
|
|
17
|
-
--gramlot-radius
|
|
33
|
+
--gramlot-button-padding: 2px 7px;
|
|
34
|
+
--gramlot-button-gap: 4px;
|
|
35
|
+
--gramlot-button-background: var(--gramlot-surface);
|
|
36
|
+
--gramlot-button-hover: var(--gramlot-selected);
|
|
37
|
+
--gramlot-label-size: 1em;
|
|
38
|
+
--gramlot-label-gap: 3px;
|
|
39
|
+
--gramlot-radius-sm: 4px;
|
|
40
|
+
--gramlot-radius: 4px;
|
|
41
|
+
--gramlot-radius-lg: 6px;
|
|
42
|
+
--gramlot-window-radius: 6px;
|
|
43
|
+
--gramlot-toolbar-gap: 2px;
|
|
44
|
+
--gramlot-tree-row-height: var(--gramlot-field-height);
|
|
45
|
+
--gramlot-space-1: 3px;
|
|
46
|
+
--gramlot-space-2: 4px;
|
|
47
|
+
--gramlot-space-3: 8px;
|
|
48
|
+
--gramlot-space-4: 8px;
|
|
49
|
+
--gramlot-space-6: 12px;
|
|
50
|
+
--gramlot-space-8: 16px;
|
|
51
|
+
--gramlot-space-12: 24px;
|
|
52
|
+
--gramlot-tab-height: 28px;
|
|
53
|
+
--gramlot-tab-padding: 2px 7px;
|
|
54
|
+
--gramlot-tab-radius: 4px;
|
|
55
|
+
--gramlot-tab-gap: 2px;
|
|
56
|
+
--gramlot-tab-strip-padding: 2px;
|
|
57
|
+
--gramlot-tab-background: var(--gramlot-surface-subtle);
|
|
58
|
+
--gramlot-tab-selected-background: var(--gramlot-surface);
|
|
59
|
+
--gramlot-tab-selected-color: var(--gramlot-action);
|
|
60
|
+
--gramlot-tab-border: var(--gramlot-border);
|
|
61
|
+
--gramlot-shadow: 0 2px 8px rgb(0 0 0 / 10%);
|
|
62
|
+
}
|
|
63
|
+
@media (prefers-color-scheme: dark) {
|
|
64
|
+
:root:not([data-theme="light"]) {
|
|
65
|
+
color-scheme: dark;
|
|
66
|
+
--gramlot-background: #171c24;
|
|
67
|
+
--gramlot-surface: #222a35;
|
|
68
|
+
--gramlot-surface-subtle: #2b3543;
|
|
69
|
+
--gramlot-ink: #edf1f7;
|
|
70
|
+
--gramlot-text-secondary: #b8c4d4;
|
|
71
|
+
--gramlot-border: #435064;
|
|
72
|
+
--gramlot-border-control: #7f90a7;
|
|
73
|
+
--gramlot-action: #9dbff4;
|
|
74
|
+
--gramlot-action-hover: #c1d6ff;
|
|
75
|
+
--gramlot-selected: #314766;
|
|
76
|
+
--gramlot-field-background: #222a35;
|
|
77
|
+
--gramlot-field-readonly-background: #2b3543;
|
|
78
|
+
--gramlot-label-color: #b8c4d4;
|
|
79
|
+
--gramlot-focus-ring: #9dbff4;
|
|
80
|
+
--gramlot-brand-blue: #9dbff4;
|
|
81
|
+
--gramlot-brand-yellow: #9dbff4;
|
|
82
|
+
--gramlot-navigation: #171c24;
|
|
83
|
+
--gramlot-navigation-text: #f6f8fb;
|
|
84
|
+
--gramlot-error: #ffb4b4;
|
|
85
|
+
--gramlot-error-background: #48292f;
|
|
86
|
+
--gramlot-success: #98dfbd;
|
|
87
|
+
--gramlot-success-background: #243f32;
|
|
88
|
+
--gramlot-warning: #f3d58c;
|
|
89
|
+
--gramlot-warning-background: #413820;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
:root[data-theme="dark"] {
|
|
93
|
+
color-scheme: dark;
|
|
94
|
+
--gramlot-background: #171c24;
|
|
95
|
+
--gramlot-surface: #222a35;
|
|
96
|
+
--gramlot-surface-subtle: #2b3543;
|
|
97
|
+
--gramlot-ink: #edf1f7;
|
|
98
|
+
--gramlot-text-secondary: #b8c4d4;
|
|
99
|
+
--gramlot-border: #435064;
|
|
100
|
+
--gramlot-border-control: #7f90a7;
|
|
101
|
+
--gramlot-action: #9dbff4;
|
|
102
|
+
--gramlot-action-hover: #c1d6ff;
|
|
103
|
+
--gramlot-selected: #314766;
|
|
104
|
+
--gramlot-field-background: #222a35;
|
|
105
|
+
--gramlot-field-readonly-background: #2b3543;
|
|
106
|
+
--gramlot-label-color: #b8c4d4;
|
|
107
|
+
--gramlot-focus-ring: #9dbff4;
|
|
108
|
+
--gramlot-brand-blue: #9dbff4;
|
|
109
|
+
--gramlot-brand-yellow: #9dbff4;
|
|
110
|
+
--gramlot-navigation: #171c24;
|
|
111
|
+
--gramlot-navigation-text: #f6f8fb;
|
|
112
|
+
--gramlot-error: #ffb4b4;
|
|
113
|
+
--gramlot-error-background: #48292f;
|
|
114
|
+
--gramlot-success: #98dfbd;
|
|
115
|
+
--gramlot-success-background: #243f32;
|
|
116
|
+
--gramlot-warning: #f3d58c;
|
|
117
|
+
--gramlot-warning-background: #413820;
|
|
18
118
|
}
|
|
19
119
|
}
|
|
20
|
-
|
|
21
120
|
@layer gramlot.base {
|
|
22
121
|
html { font-size: 13px; }
|
|
23
|
-
body { line-height: 1.
|
|
24
|
-
:where(h1,
|
|
25
|
-
h1 { font-size: 1.
|
|
26
|
-
h2 {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
blockquote { padding-inline-start: .6rem; }
|
|
30
|
-
hr { margin-block: 1rem; }
|
|
122
|
+
body { line-height: 1.4; }
|
|
123
|
+
:where(h1,h2,h3,h4,h5,h6,p,ul,ol,dl,blockquote,pre,figure) { margin-block: 0 var(--gramlot-space-3); }
|
|
124
|
+
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
|
|
125
|
+
:where(h1,h2,h3) { letter-spacing: -.015em; }
|
|
126
|
+
pre { padding: var(--gramlot-space-3); }
|
|
127
|
+
hr { margin-block: var(--gramlot-space-6); }
|
|
31
128
|
}
|
|
32
|
-
|
|
33
129
|
@layer gramlot.components {
|
|
34
|
-
:where(button,
|
|
35
|
-
min-block-size:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
line-height: 1.35;
|
|
130
|
+
:where(button,input[type="button"],input[type="submit"],input[type="reset"],.button) {
|
|
131
|
+
min-block-size: var(--gramlot-field-height); padding: var(--gramlot-button-padding);
|
|
132
|
+
font-size: 1rem; line-height: 1.3; font-weight: 500;
|
|
133
|
+
background: var(--gramlot-button-background); color: var(--gramlot-ink); border-color: var(--gramlot-border-control);
|
|
39
134
|
}
|
|
40
|
-
:where(
|
|
41
|
-
|
|
42
|
-
min-block-size: var(--gramlot-field-height);
|
|
43
|
-
padding: var(--gramlot-field-padding);
|
|
44
|
-
font-size: var(--gramlot-field-font-size);
|
|
45
|
-
line-height: var(--gramlot-field-line-height);
|
|
135
|
+
:where(button,input[type="button"],input[type="submit"],input[type="reset"],.button):hover:not(:disabled) {
|
|
136
|
+
background: var(--gramlot-selected); color: var(--gramlot-action-hover); border-color: var(--gramlot-action);
|
|
46
137
|
}
|
|
47
|
-
:where(
|
|
48
|
-
:where(input[
|
|
49
|
-
:where(
|
|
50
|
-
:where(
|
|
138
|
+
:where(label) { font-size: 1em; font-weight: 400; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }
|
|
139
|
+
:where(input[readonly],textarea[readonly]) { background: var(--gramlot-field-readonly-background); }
|
|
140
|
+
:where(.button--quiet,button.quiet) { background: transparent; color: var(--gramlot-action); border-color: transparent; }
|
|
141
|
+
:where(.button--quiet,button.quiet):hover:not(:disabled) { background: var(--gramlot-selected); border-color: transparent; }
|
|
142
|
+
:where(textarea) { min-block-size: 4.5rem; }
|
|
143
|
+
:where(input[type="color"]) { min-block-size: var(--gramlot-field-height); }
|
|
144
|
+
:where(input[type="file"])::file-selector-button { padding: var(--gramlot-field-padding); }
|
|
145
|
+
:where(fieldset,details) { padding: var(--gramlot-space-3); margin-block-end: var(--gramlot-space-3); }
|
|
51
146
|
:where(table) { font-size: 1rem; }
|
|
52
|
-
:where(th,
|
|
53
|
-
:where(details) {
|
|
54
|
-
:where(
|
|
55
|
-
:where(dialog) { padding: .75rem; }
|
|
147
|
+
:where(th,td) { padding: var(--gramlot-field-padding); height: var(--gramlot-field-height); vertical-align: middle; }
|
|
148
|
+
:where(details[open]>summary) { margin-block-end: var(--gramlot-space-3); }
|
|
149
|
+
:where(dialog) { padding: var(--gramlot-space-4); }
|
|
56
150
|
}
|
|
57
|
-
|
|
58
151
|
@layer gramlot.utilities {
|
|
59
|
-
.example-page { inline-size: min(100% -
|
|
60
|
-
.card { padding:
|
|
152
|
+
.example-page { inline-size: min(100% - 2 * var(--gramlot-space-4),var(--gramlot-page-width)); padding-block: var(--gramlot-space-4); }
|
|
153
|
+
.card { padding: var(--gramlot-space-4); box-shadow: none; }
|
|
61
154
|
}
|
package/themes/joanna/README.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# Joanna
|
|
2
|
+
|
|
3
|
+
Professional desktop profile, revised at the owner's request on 2026-10-23.
|
|
4
|
+
Balanced density, warm neutral surfaces and blue accent. Controls are 32px high; body and field text are 14px. Light and dark
|
|
5
|
+
palettes use the same semantic roles. Existing touch targets remain larger.
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
class Page(BasePage):
|
|
9
|
+
css = ("/themes/gramlot-compact/theme.css", "/themes/joanna/theme.css")
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The server loads Base first. The gallery's existing appearance selector uses the
|
|
13
|
+
same canonical stylesheet. Inputs, command buttons, menus, tabs and window chrome
|
|
14
|
+
share existing field/button/spacing/radius tokens. Fixed Source dimensions still
|
|
15
|
+
win; use semantic spacing variables when a page should follow profile density.
|
|
16
|
+
These revised aesthetics are a development preview awaiting owner feedback.
|
|
17
|
+
|
|
18
|
+
## Historical record — before the 2026-10-23 aesthetic revision
|
|
19
|
+
|
|
1
20
|
# joanna
|
|
2
21
|
|
|
3
22
|
A Gramlot interpretation of GenroPy's `joanna` theme. The light palette
|