@gramlot/gramlot 0.3.26 → 0.3.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/components/chat/__init__.py +1 -1
  2. package/dist/components/chat/assets/collection.js +3 -3
  3. package/dist/components/chat/assets/index.js +1 -1
  4. package/dist/components/editors/__init__.py +1 -1
  5. package/dist/components/editors/assets/collection.js +16 -16
  6. package/dist/components/editors/assets/index.js +1 -1
  7. package/dist/components/grid/__init__.py +1 -1
  8. package/dist/components/grid/assets/collection.js +28 -19
  9. package/dist/components/grid/assets/index.js +1 -1
  10. package/dist/components/grid/grammar.json +21 -0
  11. package/dist/components/grouplets/__init__.py +1 -1
  12. package/dist/components/grouplets/assets/collection.js +2 -2
  13. package/dist/components/grouplets/assets/index.js +1 -1
  14. package/dist/components/inputs/__init__.py +1 -1
  15. package/dist/components/inputs/assets/collection.js +21 -21
  16. package/dist/components/inputs/assets/index.js +1 -1
  17. package/dist/components/layout/__init__.py +1 -1
  18. package/dist/components/layout/assets/collection.js +15 -15
  19. package/dist/components/layout/assets/index.js +1 -1
  20. package/dist/components/selection_trial/__init__.py +1 -1
  21. package/dist/components/selection_trial/assets/collection.js +3 -3
  22. package/dist/components/selection_trial/assets/index.js +1 -1
  23. package/dist/components/tree/__init__.py +1 -1
  24. package/dist/components/tree/assets/collection.js +11 -11
  25. package/dist/components/tree/assets/index.js +1 -1
  26. package/dist/components/typst/__init__.py +1 -1
  27. package/dist/components/typst/assets/collection.js +3 -3
  28. package/dist/components/typst/assets/index.js +1 -1
  29. package/dist/components/uploads/__init__.py +1 -1
  30. package/dist/components/uploads/assets/collection.js +8 -8
  31. package/dist/components/uploads/assets/index.js +1 -1
  32. package/dist/gramlot.js +624 -86
  33. package/dist/gramlot.min.js +47 -46
  34. package/package.json +1 -1
  35. package/src/binding/grid-struct.js +1 -1
  36. package/src/binding/validation-context.js +2 -1
  37. package/src/components/bases.js +5 -3
  38. package/src/components/choice-editor.js +28 -13
  39. package/src/components/database-choices.js +9 -6
  40. package/src/components/field-state.js +8 -1
  41. package/src/components/grid-cell-editor.js +83 -19
  42. package/src/components/grid-grammar.json +21 -0
  43. package/src/components/grid-structure.js +4 -1
  44. package/src/components/grid-styles.js +11 -2
  45. package/src/components/grid.js +16 -1
  46. package/src/components/inputs.js +2 -2
  47. package/src/components/parameters.js +6 -2
  48. package/src/components/tree.js +1 -0
  49. package/src/components/typed-editor.js +4 -4
  50. package/src/components/validation.js +1 -1
  51. package/src/editing-session.d.ts +1 -0
  52. package/src/editing-session.js +113 -15
  53. package/src/editor-values.js +57 -0
  54. package/src/gramlot.d.ts +1 -0
  55. package/src/gramlot.js +7 -4
  56. package/src/index.d.ts +1 -1
  57. package/src/renderer/gramlot-renderer.d.ts +1 -0
  58. package/src/renderer/gramlot-renderer.js +11 -0
  59. package/src/server/source-import.d.ts +1 -1
  60. package/src/server/source-import.js +5 -1
  61. package/src/server/visual-editor.d.ts +1 -1
  62. package/src/server/visual-editor.js +30 -20
  63. package/src/source-picker.d.ts +1 -1
  64. package/src/source-picker.js +1 -2
  65. package/src/visual-editor-canvas.js +29 -0
  66. package/src/visual-editor-catalogue.js +34 -0
  67. package/src/visual-editor.d.ts +5 -0
  68. package/src/visual-editor.js +244 -26
  69. package/themes/gramlot-base/theme.css +78 -36
  70. package/tools/gramlot-tools-inspector.js +1 -1
  71. package/tools/inspector-agent.js +1 -1
@@ -1,3 +1,6 @@
1
+ import {VisualEditorCanvas} from './visual-editor-canvas.js';
2
+ import {validateCatalogue, catalogueAllows, validateCatalogueSource} from './visual-editor-catalogue.js';
3
+ import {editorTypes, scalarType, scalarText, parseScalar} from './editor-values.js';
1
4
  import {SourcePicker} from './source-picker.js';
2
5
  import {appearanceStyles, paletteStyles} from './index-page-styles.js';
3
6
  import {toolIcons} from './visual-editor-icons.js';
@@ -70,6 +73,7 @@ const specifications = (node, tag, current = null) => {
70
73
 
71
74
  // Editor-local view resources; selection itself remains in the Data Bag.
72
75
  const canvasSelections = new WeakMap();
76
+ const canvasDocuments = new WeakMap();
73
77
 
74
78
  export class VisualEditorLogic {
75
79
  chatRender(node, params) { return chatRender(this.page, node, params); }
@@ -90,8 +94,10 @@ export class VisualEditorLogic {
90
94
  const content = mode === 'code' ? editor.GET('.codeDocument.content') : wire;
91
95
  if (mode === 'code' && !editor.GET('.codeDocument.writable')) { node.SET('.error', 'Page code editing is disabled by the host'); return; }
92
96
  const run = (editor.GET('.assistantRun.run') ?? 0) + 1;
97
+ const scope = editor.GET('.catalogueScope');
93
98
  const schema = {commonParameters:styleParameters, labelboxParameters, widgets:{}};
94
99
  for (const [tag, info] of Object.entries(node.builder.schema)) {
100
+ if (!catalogueAllows(scope, tag, info._meta ?? {})) continue;
95
101
  if (info._meta?.data_element || info._meta?.subbuilder || info._meta?.container) continue;
96
102
  const component = info._meta?.gramlot_component;
97
103
  schema.widgets[tag] = {parameters:component?.parameters ?? {}, labelbox:!!component?.labelbox,
@@ -205,6 +211,7 @@ export class VisualEditorLogic {
205
211
  }
206
212
  };
207
213
  candidate.getNodes().forEach(validateChildren);
214
+ validateCatalogueSource(visualEditorScope(node).GET('.catalogueScope'), candidate);
208
215
  app.src.renderer.validateCandidate(candidate, {replacingNode:design});
209
216
  const current = node.builder.source.getNode(`${sourceRoot(node)}.${path}`);
210
217
  let selected = path;
@@ -229,14 +236,39 @@ export class VisualEditorLogic {
229
236
  initializeCanvasSelection(node) {
230
237
  const renderer = node.rootBuilder.binding.renderer;
231
238
  const design = node.builder.source.getNode(sourceRoot(node));
232
- const picker = new SourcePicker({renderer, root:design, onSelect:selected => {
233
- node.SET('.sourceSearch', '');
234
- node.SET('.selection', selected.fullpath.slice(design.fullpath.length + 1));
235
- }});
239
+ const editor = visualEditorScope(node), css = editor.GET('.canvasCss');
240
+ if (css != null) this.applyCanvasCss(editor, css);
241
+ const previous = canvasSelections.get(design);
242
+ previous?.dispose();
243
+ const picker = new SourcePicker({renderer, root:design,
244
+ ...(canvasDocuments.has(design) ? {canvas:canvasDocuments.get(design).body} : {}),
245
+ onSelect:selected => {
246
+ node.SET('.sourceSearch', '');
247
+ node.SET('.selection', selected.fullpath.slice(design.fullpath.length + 1));
248
+ }});
236
249
  canvasSelections.set(design, picker);
237
- renderer.onDispose(design.parentNode, () => canvasSelections.delete(design));
250
+ if (!previous) renderer.onDispose(design.parentNode, () => {
251
+ canvasSelections.delete(design); canvasDocuments.delete(design);
252
+ });
238
253
  this.highlightSelection(node);
239
254
  }
255
+ applyCanvasCss(node, texts) {
256
+ if (!Array.isArray(texts) || texts.some(text => typeof text !== 'string'))
257
+ throw new TypeError('canvas CSS must be a list of CSS texts');
258
+ const editor = visualEditorScope(node), design = editor.builder.source.getNode(sourceRoot(editor));
259
+ let canvas = canvasDocuments.get(design);
260
+ if (!canvas) {
261
+ canvas = new VisualEditorCanvas({app:editor.rootBuilder.binding.gramlot, editor, design});
262
+ canvasDocuments.set(design, canvas);
263
+ }
264
+ canvas.setCss(texts);
265
+ }
266
+ setCanvasCss(node, texts) {
267
+ const editor = visualEditorScope(node);
268
+ this.applyCanvasCss(editor, texts);
269
+ editor.SET('.canvasCss', texts);
270
+ this.initializeCanvasSelection(editor);
271
+ }
240
272
  highlightSelection(node) {
241
273
  const design = node.builder.source.getNode(sourceRoot(node));
242
274
  const path = node.GET('.selection');
@@ -330,6 +362,7 @@ export class VisualEditorLogic {
330
362
  const parent = path ? node.builder.source.getNode(`${sourceRoot(node)}.${path}`) : null;
331
363
  if (!parent) throw new Error('Choose a destination in the Source tree');
332
364
  const source = node.rootBuilder.binding.gramlot.src.prepareSource(saved.getValue(true), parent.builder);
365
+ validateCatalogueSource(visualEditorScope(node).GET('.catalogueScope'), source);
333
366
  const branch = source.getNodes()[0];
334
367
  parent.builder.validateParent(branch.nodeTag, parent.nodeTag);
335
368
  const body = parent.getValue(true);
@@ -349,7 +382,7 @@ export class VisualEditorLogic {
349
382
  fields.getValue(true).clear();
350
383
  const root = node.builder.wrapSource(fields);
351
384
  root.p(`Paste ${saved.getAttr('name')} into ${parent.label} [${parent.nodeTag}]`, {class:'visual-editor-hint'});
352
- const form = root.formlet({columns:2, gap:'8px 10px', lbl_position:'TL', box_c_width:'100%', align_items:'start'});
385
+ const form = root.formlet({columns:2, gap:'4px 6px', lbl_position:'TL', box_c_width:'100%', align_items:'start'});
353
386
  for (const [name, spec] of required) this.parameterField(node, form, branch.nodeTag, name, spec, 'insertion', spec.default);
354
387
  node.SET('.insertionOpen', true);
355
388
  }
@@ -372,6 +405,7 @@ export class VisualEditorLogic {
372
405
  if (!parent) throw new Error('The destination no longer exists');
373
406
  const app = node.rootBuilder.binding.gramlot;
374
407
  const source = app.src.prepareSource(node.GET('.insertion.clipboard'), parent.builder);
408
+ validateCatalogueSource(visualEditorScope(node).GET('.catalogueScope'), source);
375
409
  const branch = source.getNodes()[0];
376
410
  const attrs = {...branch.getAttr()};
377
411
  for (const [name, spec] of Object.entries(specifications(parent, branch.nodeTag))) {
@@ -394,6 +428,7 @@ export class VisualEditorLogic {
394
428
  candidateParent.builder.validateChildren(candidateParent.nodeTag, [...(children instanceof node.builder.source.constructor
395
429
  ? children.getNodes().map(child => child.nodeTag) : []), branch.nodeTag]);
396
430
  const inserted = this.appendBranch(candidateParent, branch, label);
431
+ validateCatalogueSource(visualEditorScope(node).GET('.catalogueScope'), candidate);
397
432
  app.src.renderer.validateCandidate(candidate, {replacingNode:design});
398
433
  this.appendBranch(parent, inserted, label);
399
434
  node.SET('.insertionOpen', false);
@@ -453,6 +488,7 @@ export class VisualEditorLogic {
453
488
  if (request.signal.aborted) return;
454
489
  if (design.value.toTytx() !== before) throw new Error('Source changed while preparing preview; it was retained');
455
490
  const candidate = this.page.src.prepareSource(wire, design.builder);
491
+ validateCatalogueSource(editor.GET('.catalogueScope'), candidate);
456
492
  this.page.src.renderer.validateCandidate(candidate, {replacingNode:design});
457
493
  if (editor.GET('.assistantRun')) editor.SET('.assistantRun.blocked', true);
458
494
  editor.SET('.selection', null);
@@ -482,29 +518,18 @@ export class VisualEditorLogic {
482
518
  async copySource(node) {
483
519
  node.SET('.fileStatus', '');
484
520
  try {
485
- const page = node.builder.source.getNode(sourceRoot(node)).getValue(true);
486
- await node.rootBuilder.binding.gramlot.utl.inout.copyText(page.toTytx());
521
+ await node.rootBuilder.binding.gramlot.utl.inout.copyText(this.currentSource(node));
487
522
  node.SET('.fileStatus', 'Source copied');
488
523
  } catch (error) { node.SET('.fileStatus', `Copy failed: ${error.message}`); }
489
524
  }
490
525
  downloadPage(node) {
491
- const page = node.builder.source.getNode(sourceRoot(node)).getValue(true);
492
- node.rootBuilder.binding.gramlot.utl.inout.saveText(page.toTytx(), node.GET('.filename'), 'application/json');
526
+ node.rootBuilder.binding.gramlot.utl.inout.saveText(this.currentSource(node), node.GET('.filename'), 'application/json');
493
527
  }
494
528
 
495
529
  openUpload(node) { node.SET('.uploadOpen', true); }
496
530
  sourceUploaded(node, {item, result}) {
497
531
  try {
498
- const app = node.rootBuilder.binding.gramlot;
499
- const target = node.builder.source.getNode(sourceRoot(node));
500
- const source = app.src.prepareSource(result, target.builder);
501
- const roots = source.getNodes();
502
- if (roots.length !== 1 || roots[0].label !== 'pageRoot') throw new Error('Expected one pageRoot Source');
503
- app.src.renderer.validateCandidate(source, {replacingNode:target});
504
- if (node.GET('.assistantRun')) node.SET('.assistantRun.blocked', true);
505
- target.setValue(source, true, {_text:null}, true);
506
- node.SET('.filename', item.value.getItem('name'));
507
- node.SET('.selection', 'pageRoot');
532
+ this.loadSource(node, {source:result, filename:item.value.getItem('name')});
508
533
  node.SET('.fileStatus', 'Source opened');
509
534
  node.SET('.uploadOpen', false);
510
535
  } catch (error) {
@@ -512,6 +537,41 @@ export class VisualEditorLogic {
512
537
  throw error;
513
538
  }
514
539
  }
540
+ initializeDocument(node) {
541
+ const editor = visualEditorScope(node), source = editor.builder.source;
542
+ const prefix = sourceRoot(editor).split('.');
543
+ const subscription = `${editor.getAttr('visualEditorId')}-document`;
544
+ editor.SET('.modified', false);
545
+ source.subscribe(subscription, {any:event => {
546
+ if (prefix.every((part, index) => event.pathlist[index] === part)) editor.SET('.modified', true);
547
+ }});
548
+ editor.rootBuilder.binding.renderer.onDispose(editor, () => source.unsubscribe(subscription, {any:true}));
549
+ }
550
+ currentSource(node) {
551
+ const editor = visualEditorScope(node);
552
+ return editor.builder.source.getNode(sourceRoot(editor)).getValue(true).toTytx();
553
+ }
554
+ markSaved(node) { visualEditorScope(node).SET('.modified', false); }
555
+ loadSource(node, {source, filename}) {
556
+ const editor = visualEditorScope(node);
557
+ if (typeof source !== 'string') throw new TypeError('source must be Source TYTX');
558
+ if (typeof filename !== 'string' || !filename.trim()) throw new TypeError('filename must be a non-empty string');
559
+ const app = editor.rootBuilder.binding.gramlot;
560
+ const target = editor.builder.source.getNode(sourceRoot(editor));
561
+ const candidate = app.src.prepareSource(source, target.builder);
562
+ const roots = candidate.getNodes();
563
+ if (roots.length !== 1 || roots[0].label !== 'pageRoot') throw new Error('Expected one pageRoot Source');
564
+ validateCatalogueSource(editor.GET('.catalogueScope'), candidate);
565
+ app.src.renderer.validateCandidate(candidate, {replacingNode:target});
566
+ if (editor.GET('.assistantRun')) editor.SET('.assistantRun.blocked', true);
567
+ editor.SET('.selection', null);
568
+ target.setValue(candidate, true, {_text:null}, true);
569
+ editor.SET('.filename', filename);
570
+ editor.SET('.insertionOpen', false);
571
+ editor.SET('.sourceSearch', '');
572
+ editor.SET('.selection', 'pageRoot');
573
+ this.markSaved(editor);
574
+ }
515
575
  toggleNavigation(node) { node.SET('.navigationOpen', node.GET('.navigationOpen') === 'close' ? true : 'close'); }
516
576
  openCatalogue(node) { node.SET(`${editorData(node)}.catalogueOpen`, true); }
517
577
  openProperties(node) { this.showProperties(node, {path:node.GET('.selection')}); }
@@ -542,6 +602,11 @@ export class VisualEditorLogic {
542
602
  node.rootBuilder.binding.renderer.destination.ownerDocument.documentElement.setAttribute('data-theme', mode);
543
603
  }
544
604
  initializeEditor(node, {dataRoot}) {
605
+ const scope = node.GET('.catalogueScope');
606
+ validateCatalogue(scope);
607
+ if (Array.isArray(scope)) for (const tag of scope) {
608
+ if (!node.builder.schema[tag]) throw new Error(`Unknown catalogue tag: ${tag}`);
609
+ }
545
610
  node.SET('.editingMode', 'source');
546
611
  node.SET('.clipboard', new Bag());
547
612
  node.SET('.clipboardVisible', false);
@@ -572,9 +637,10 @@ export class VisualEditorLogic {
572
637
  return bag;
573
638
  };
574
639
  for (const [path, caption, tags] of catalogueSections) {
575
- if (tags.split(' ').some(tag => node.builder.schema[tag])) ensureGroup(path, caption);
640
+ if (tags.split(' ').some(tag => node.builder.schema[tag] && catalogueAllows(scope, tag, node.builder.schema[tag]._meta ?? {}))) ensureGroup(path, caption);
576
641
  }
577
642
  for (const [tag, info] of Object.entries(node.builder.schema).sort(([a], [b]) => a.localeCompare(b))) {
643
+ if (!catalogueAllows(scope, tag, info._meta ?? {})) continue;
578
644
  if (info._meta?.data_element || info._meta?.subbuilder || info._meta?.container) continue;
579
645
  const root = info._meta?.gramlot_component ? 'components' : 'html';
580
646
  const section = catalogueSections.find(([path, , tags]) => path.startsWith(root + '.') && tags.split(' ').includes(tag));
@@ -602,6 +668,7 @@ export class VisualEditorLogic {
602
668
  const targetPath = `${sourceRoot(node)}.${path}`;
603
669
  const moving = node.builder.source.getNode(sourcePath);
604
670
  if (!moving || sourcePath === `${sourceRoot(node)}.pageRoot`) throw new Error('The page root cannot be moved');
671
+ validateCatalogueSource(visualEditorScope(node).GET('.catalogueScope'), moving.parentBag);
605
672
  if (moving.resolver) throw new Error('Resolver-backed Source nodes cannot be moved in this trial');
606
673
  if (sourcePath === targetPath || targetPath.startsWith(sourcePath + '.')) throw new Error('A node cannot be moved into itself');
607
674
  const parent = item, origin = moving.parentBag, Source = node.builder.source.constructor;
@@ -631,6 +698,7 @@ export class VisualEditorLogic {
631
698
  return;
632
699
  }
633
700
  const tag = dropValues['app/widget'].tag;
701
+ this.validateCatalogueTag(node, tag);
634
702
  item.builder.validateParent(tag, item.nodeTag);
635
703
  const body = item.getValue(true);
636
704
  item.builder.validateChildren(item.nodeTag, [...(body instanceof node.builder.source.constructor ? body.getNodes().map(child => child.nodeTag) : []), tag]);
@@ -644,7 +712,7 @@ export class VisualEditorLogic {
644
712
  fields.getValue(true).clear();
645
713
  const root = node.builder.wrapSource(fields);
646
714
  root.p(`Insert ${tag} into ${item.label} [${item.nodeTag}]`, {class:'visual-editor-hint'});
647
- const form = root.formlet({columns:2, gap:'8px 10px', lbl_position:'TL', box_c_width:'100%', align_items:'start'});
715
+ const form = root.formlet({columns:2, gap:'4px 6px', lbl_position:'TL', box_c_width:'100%', align_items:'start'});
648
716
  for (const [name, spec] of required) this.parameterField(node, form, tag, name, spec, 'insertion', spec.default);
649
717
  node.SET('.insertionOpen', true);
650
718
  }
@@ -659,8 +727,9 @@ export class VisualEditorLogic {
659
727
  const parent = current.parentNode;
660
728
  const entries = specifications(parent, current.nodeTag, current);
661
729
  node.SET('.properties.path', path);
730
+ this.attributeRows(node, current);
662
731
  node.SET('.propertiesTitle', `${current.label} [${current.nodeTag}]`);
663
- node.SET('.propertiesHeight', `${Math.min(340, 120 + Math.ceil(Object.keys(entries).filter(name => parameterTheme(name, new Set()) === 'general').length / 2) * 48)}px`);
732
+ node.SET('.propertiesHeight', `${Math.min(300, Math.max(180, 80 + Math.ceil(Object.keys(entries).filter(name => parameterTheme(name, new Set()) === 'general').length / 2) * 38))}px`);
664
733
  const root = node.builder.wrapSource(fields);
665
734
  if (path !== 'pageRoot') root.p(path, {class:'visual-editor-destination'});
666
735
  const parentFields = new Set(Object.keys(parent._getMeta('gramlot_component')?.childParameters ?? {}));
@@ -671,11 +740,13 @@ export class VisualEditorLogic {
671
740
  tabMode:'underline', height:'100%', min_height:0, flex:1});
672
741
  for (const [key, title] of parameterThemes) {
673
742
  if (!groups.get(key).length) continue;
674
- const panel = tabs.contentPane({pageName:key, title, overflow:'auto', padding:'10px', min_height:0});
743
+ const panel = tabs.contentPane({pageName:key, title, overflow:'auto', padding:'4px', min_height:0,
744
+ ...(key === 'styles' ? {nodeId:visualEditorScope(node).getAttr('visualEditorId') + 'StyleAttributes'} : {})});
745
+ if (key === 'styles') { this.attributeFields(node, panel, current, 'styles'); continue; }
675
746
  if (key === 'container') panel.p(`Child parameters of ${parent.nodeTag}`, {class:'visual-editor-hint'});
676
747
  if (key === 'behaviour' && Object.hasOwn(entries, 'action')) panel.p('action: use a named Logic method, for example openCatalogue.', {class:'visual-editor-hint'});
677
748
  if (key === 'behaviour' && current.nodeTag === 'borderContainer') panel.p('persist remembers splitter sizes and requires a stable container id.', {class:'visual-editor-hint'});
678
- const form = panel.formlet({columns:2, gap:'8px 10px', lbl_position:'TL', box_c_width:'100%', align_items:'start'});
749
+ const form = panel.formlet({columns:2, gap:'4px 6px', lbl_position:'TL', box_c_width:'100%', align_items:'start'});
679
750
  if (key === 'general' && current._getMeta('gramlot_component')?.labelbox) {
680
751
  this.labelboxFields(node, form, current, entries);
681
752
  }
@@ -692,7 +763,7 @@ export class VisualEditorLogic {
692
763
  if (!advanced) {
693
764
  const details = panel.details({class:'visual-validation-advanced'});
694
765
  details.summary('Conditions and messages');
695
- advanced = details.formlet({columns:2, gap:'8px 10px', lbl_position:'TL', box_c_width:'100%', align_items:'start'});
766
+ advanced = details.formlet({columns:2, gap:'4px 6px', lbl_position:'TL', box_c_width:'100%', align_items:'start'});
696
767
  }
697
768
  target = advanced;
698
769
  }
@@ -700,8 +771,142 @@ export class VisualEditorLogic {
700
771
  this.parameterField(node, target, current.nodeTag, name, spec, 'properties', value ?? spec.default);
701
772
  }
702
773
  }
774
+ const more = tabs.contentPane({nodeId:visualEditorScope(node).getAttr('visualEditorId') + 'MoreAttributes', pageName:'attributes', title:'More attributes', overflow:'auto', padding:'4px', min_height:0});
775
+ this.attributeFields(node, more, current);
703
776
  node.SET('.propertiesOpen', true);
704
777
  }
778
+ attributeRows(node, current) {
779
+ const rows = new Bag();
780
+ for (const [name, value] of Object.entries(current.getAttr())) {
781
+ if (name === '_meta') continue;
782
+ const type = scalarType(value);
783
+ const text = type ? scalarText(value, type) : '[non-scalar value]';
784
+ rows.setItem(`r${rows.length}`, new Bag({name, type:type ?? 'readonly', text, original:text}));
785
+ }
786
+ node.SET('.properties.attributeRows', rows);
787
+ node.SET('.properties.attributeDraft', new Bag({name:'', type:'string', text:''}));
788
+ node.SET('.properties.attributeDraftHidden', true);
789
+ }
790
+ attributeFields(node, panel, current, scope = 'attributes') {
791
+ const path = node.GET('.properties.path');
792
+ const base = `${editorData(node)}.properties`;
793
+ const renderer = node.rootBuilder.binding.gramlot.src.renderer;
794
+ const parentFields = new Set(Object.keys(current.parentNode._getMeta('gramlot_component')?.childParameters ?? {}));
795
+ const list = panel.div({class:'visual-editor-attribute-list', 'aria-label':scope === 'styles' ? 'Style attributes' : 'Node attributes'});
796
+ const heading = list.div({class:'visual-editor-attribute-row visual-editor-attribute-heading'});
797
+ heading.span('Attribute', {class:'visual-editor-attribute-name'});
798
+ const headingValue = heading.div({class:'visual-editor-attribute-value'});
799
+ headingValue.span('Value');
800
+ headingValue.button('+', {action:'beginAttribute', editingPath:path,
801
+ 'aria-label':scope === 'styles' ? 'Add style attribute' : 'Add attribute', title:'Add attribute', class:'visual-editor-attribute-command'});
802
+ for (const row of node.GET('.properties.attributeRows').getNodes()) {
803
+ const name = row.value.getItem('name'), type = row.value.getItem('type'), key = row.label;
804
+ if (scope === 'styles' && parameterTheme(name, parentFields) !== 'styles' && !renderer._isStyleContribution(name)) continue;
805
+ const editable = type !== 'readonly';
806
+ const line = list.div({class:'visual-editor-attribute-row'});
807
+ line.span(name, {class:'visual-editor-attribute-name', title:name});
808
+ const cell = line.div({class:'visual-editor-attribute-value'});
809
+ cell.input({value:`^${base}.attributeRows.${key}.text`, disabled:!editable,
810
+ 'aria-label':`${name} attribute value`, title:editable ? type : 'Non-scalar values are read-only'});
811
+ cell.button('×', {action:'removeAttribute', attributeRow:key, editingPath:path, disabled:!editable,
812
+ 'aria-label':`Remove ${name} attribute`, title:`Remove ${name}`, class:'visual-editor-attribute-command'});
813
+ // Both tabs bind the same row; one controller owns each write.
814
+ if (editable && scope === 'attributes') line.dataController({func:'changeAttribute', value:`^${base}.attributeRows.${key}.text`,
815
+ attributeRow:key, editingPath:path, _userChanges:true});
816
+ }
817
+ const add = list.div({class:'visual-editor-attribute-row', hidden:`^${base}.attributeDraftHidden`,
818
+ connect_onkeydown:'attributeDraftKey'});
819
+ const nameCell = add.div({class:'visual-editor-attribute-name'});
820
+ nameCell.input({value:`^${base}.attributeDraft.name`, live:true, 'aria-label':'New attribute name', placeholder:'Attribute name'});
821
+ const valueCell = add.div({class:'visual-editor-attribute-value'});
822
+ valueCell.input({value:`^${base}.attributeDraft.text`, live:true, 'aria-label':'New attribute value', placeholder:'Value'});
823
+ const types = valueCell.select({value:`^${base}.attributeDraft.type`, 'aria-label':'New attribute type'});
824
+ for (const type of editorTypes) types.option(type, {value:type});
825
+ valueCell.button('✓', {action:'addAttribute', editingPath:path, 'aria-label':'Apply new attribute', title:'Apply (Enter)', class:'visual-editor-attribute-command'});
826
+ valueCell.button('×', {action:'cancelAttribute', 'aria-label':'Cancel new attribute', title:'Cancel (Escape)', class:'visual-editor-attribute-command'});
827
+ }
828
+ beginAttribute(node, {editingPath}) {
829
+ const editor = visualEditorScope(node);
830
+ if (editingPath !== editor.GET('.selection')) return;
831
+ editor.SET('.properties.attributeDraft', new Bag({name:'', type:'string', text:''}));
832
+ editor.SET('.properties.attributeDraftHidden', false);
833
+ editor.SET('.propertyError', '');
834
+ }
835
+ cancelAttribute(node) {
836
+ visualEditorScope(node).SET('.properties.attributeDraftHidden', true);
837
+ }
838
+ attributeDraftKey(node, event) {
839
+ if (event.isComposing || !['Enter', 'Escape'].includes(event.key)) return;
840
+ event.preventDefault();
841
+ event.stopPropagation();
842
+ const editor = visualEditorScope(node);
843
+ if (event.key === 'Escape') this.cancelAttribute(editor);
844
+ else this.addAttribute(editor, {editingPath:editor.GET('.properties.path')});
845
+ }
846
+ addAttribute(node, {editingPath}) {
847
+ const editor = visualEditorScope(node);
848
+ if (editingPath !== editor.GET('.selection')) return;
849
+ editor.SET('.propertyError', '');
850
+ try {
851
+ const draft = editor.GET('.properties.attributeDraft');
852
+ const name = draft.getItem('name');
853
+ if (!name || !/^[^\s"'<>/=]+$/.test(name)) throw new Error('Enter a valid attribute name.');
854
+ if (['_meta', '__proto__', 'constructor', 'prototype'].includes(name)) throw new Error('Unsupported attribute name.');
855
+ const current = editor.builder.source.getNode(`${sourceRoot(editor)}.${editingPath}`);
856
+ if (!current) throw new Error('The selected Source node no longer exists');
857
+ if (Object.hasOwn(current.getAttr(), name)) throw new Error(`Duplicate attribute: ${name}`);
858
+ const value = parseScalar(draft.getItem('type'), String(draft.getItem('text') ?? ''));
859
+ this.writeAttribute(editor, current, editingPath, name, value, false);
860
+ } catch (error) { editor.SET('.propertyError', error.message); }
861
+ }
862
+ changeAttribute(node, {attributeRow, editingPath, value}) {
863
+ this.editAttribute(node, {attributeRow, editingPath, value, remove:false});
864
+ }
865
+ removeAttribute(node, {attributeRow, editingPath}) {
866
+ this.editAttribute(node, {attributeRow, editingPath, remove:true});
867
+ }
868
+ editAttribute(node, {attributeRow, editingPath, value, remove}) {
869
+ const editor = visualEditorScope(node);
870
+ if (editingPath !== editor.GET('.selection')) return;
871
+ editor.SET('.propertyError', '');
872
+ try {
873
+ const row = editor.GET('.properties.attributeRows').getItem(attributeRow);
874
+ if (!row || row.getItem('type') === 'readonly') throw new Error('This attribute is not editable');
875
+ const name = row.getItem('name');
876
+ if (['_meta', '__proto__', 'constructor', 'prototype'].includes(name)) throw new Error('Unsupported attribute name.');
877
+ const current = editor.builder.source.getNode(`${sourceRoot(editor)}.${editingPath}`);
878
+ if (!current) throw new Error('The selected Source node no longer exists');
879
+ const attrs = current.getAttr(), type = scalarType(attrs[name]);
880
+ if (!Object.hasOwn(attrs, name) || type !== row.getItem('type') || scalarText(attrs[name], type) !== row.getItem('original'))
881
+ throw new Error('Attribute changed; select the node again before editing.');
882
+ const parsed = remove ? null : parseScalar(type, String(value ?? ''));
883
+ this.writeAttribute(editor, current, editingPath, name, parsed, remove, row);
884
+ } catch (error) { editor.SET('.propertyError', error.message); }
885
+ }
886
+ writeAttribute(editor, current, path, name, value, remove, row = null) {
887
+ const attrs = {...current.getAttr()};
888
+ if (remove) delete attrs[name]; else attrs[name] = value;
889
+ const specs = specifications(current.parentNode, current.nodeTag, current);
890
+ if (specs[name]) this.validateParameter(current.parentNode, current, name, specs[name], remove ? null : value);
891
+ const design = editor.builder.source.getNode(sourceRoot(editor)), app = editor.rootBuilder.binding.gramlot;
892
+ const candidate = app.src.prepareSource(design.getValue(true).toTytx(), design.builder);
893
+ candidate.getNode(path).setAttr(attrs, true, false, false);
894
+ validateCatalogueSource(editor.GET('.catalogueScope'), candidate);
895
+ app.src.renderer.validateCandidate(candidate, {replacingNode:design});
896
+ current.setAttr(attrs, true, false, false);
897
+ if (row && !remove) {
898
+ const text = scalarText(value, row.getItem('type'));
899
+ row.setItem('original', text);
900
+ row.setItem('text', text);
901
+ const type = editor.GET(`.properties.types.${name}`);
902
+ if (specs[name]?.enum) editor.SET(`.properties.parameters.${name}`, value);
903
+ else if (type) editor.SET(`.properties.parameters.${name}.${type}`, value);
904
+ } else {
905
+ const tab = editor.GET('.parameterTab') === 'styles' ? 'styles' : 'attributes';
906
+ this.showProperties(editor, {path});
907
+ editor.SET('.parameterTab', tab);
908
+ }
909
+ }
705
910
  toggleLabelboxAttributes(node, {prefix}) {
706
911
  node.SET(`.properties.${prefix}Hidden`, !node.GET(`.properties.${prefix}Hidden`));
707
912
  }
@@ -803,6 +1008,7 @@ export class VisualEditorLogic {
803
1008
  try {
804
1009
  const current = node.builder.source.getNode(`${sourceRoot(node)}.${editingPath}`);
805
1010
  if (!current) throw new Error('The selected Source node no longer exists');
1011
+ if (parameterName !== '_text' && Object.is(current.getAttr(parameterName), value)) return;
806
1012
  const specs = specifications(current.parentNode, current.nodeTag, current);
807
1013
  const spec = specs[parameterName];
808
1014
  if (!spec) throw new Error(`Unknown parameter: ${parameterName}`);
@@ -814,6 +1020,12 @@ export class VisualEditorLogic {
814
1020
  else attrs[parameterName] = value;
815
1021
  current.setAttr(attrs, true, false, false);
816
1022
  }
1023
+ this.attributeRows(node, current);
1024
+ for (const [field, scope] of [['MoreAttributes', 'attributes'], ['StyleAttributes', 'styles']]) {
1025
+ const panel = editorField(node, field);
1026
+ panel.getValue(true).clear();
1027
+ this.attributeFields(node, node.builder.wrapSource(panel), current, scope);
1028
+ }
817
1029
  } catch (error) { node.SET('.propertyError', error.message); }
818
1030
  }
819
1031
  validateParameter(parent, current, name, spec, value) {
@@ -824,12 +1036,18 @@ export class VisualEditorLogic {
824
1036
  if (!empty && spec.unique && children instanceof parent.builder.source.constructor &&
825
1037
  children.getNodes().some(child => child !== current && child.getAttr(name) === value)) throw new Error(`${name} is already in use`);
826
1038
  }
1039
+ validateCatalogueTag(node, tag) {
1040
+ const scope = visualEditorScope(node).GET('.catalogueScope');
1041
+ if (!catalogueAllows(scope, tag, node.builder.schema[tag]?._meta ?? {}))
1042
+ throw new Error(`Tag ${tag} is outside the editor catalogue`);
1043
+ }
827
1044
  applyInsert(node) {
828
1045
  if (node.GET('.insertion.clipboard')) { this.finishPaste(node); return; }
829
1046
  const path = node.GET('.insertion.parentPath');
830
1047
  const parent = node.builder.source.getNode(`${sourceRoot(node)}.${path}`);
831
1048
  if (!parent) throw new Error('The target Source node is no longer available');
832
1049
  const tag = node.GET('.insertion.tag');
1050
+ this.validateCatalogueTag(node, tag);
833
1051
  const attrs = {};
834
1052
  for (const [name, spec] of Object.entries(specifications(parent, tag)).filter(([, spec]) => spec.required)) {
835
1053
  const type = node.GET(`.insertion.types.${name}`);
@@ -332,21 +332,26 @@
332
332
  --gramlot-grid-column-width: 10rem;
333
333
  }
334
334
 
335
+ /* Chat controls reserve focus paint inside their measured composer regions. */
336
+ .gramlot-chat-editor:focus-visible { outline:2px solid var(--gramlot-focus-ring);outline-offset:-2px; }
337
+ .gramlot-chat-send-icon { display:block;flex:none;width:16px;height:16px;background:currentColor;
338
+ mask:center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
339
+
335
340
  /* Reusable VisualEditor composition. */
336
- .visual-search-toolbar { flex:none;min-width:0;padding:4px 7px 6px;box-sizing:border-box; }
337
- .visual-search-field { display:flex;align-items:center;gap:6px;width:100%;min-width:0;box-sizing:border-box;
338
- min-height:var(--gramlot-field-height,28px);padding:0 7px;border:1px solid transparent;
341
+ .visual-search-toolbar { flex:none;min-width:0;padding:2px 4px 3px;box-sizing:border-box; }
342
+ .visual-search-field { display:flex;align-items:center;gap:4px;width:100%;min-width:0;box-sizing:border-box;
343
+ min-height:24px;padding:0 6px;border:1px solid transparent;
339
344
  border-radius:999px;background:var(--gramlot-field-background,var(--gramlot-surface));color:var(--gramlot-ink); }
340
345
  .visual-search-field:focus-within { border-color:var(--gramlot-action);box-shadow:inset 0 0 0 1px var(--gramlot-action); }
341
- .visual-search-icon { flex:none;display:block;width:15px;height:15px;background:currentColor;opacity:.6;
346
+ .visual-search-icon { flex:none;display:block;width:13px;height:13px;background:currentColor;opacity:.6;
342
347
  mask:center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10' cy='10' r='6.5' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='m15 15 6 6' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
343
348
  .visual-search-field input[type=search] { flex:1;width:100%;min-width:0;box-sizing:border-box;min-height:0;
344
- margin:0;padding:3px 0;border:0;border-radius:0;outline:0;box-shadow:none;background:transparent;color:inherit;font:inherit; }
349
+ margin:0;padding:1px 0;border:0;border-radius:0;outline:0;box-shadow:none;background:transparent;color:inherit;font:inherit; }
345
350
  .visual-search-field input[type=search]:focus,
346
351
  .visual-search-field input[type=search]:focus-visible { outline:none;box-shadow:none;background:transparent; }
347
352
  .visual-search-field input[type=search]::-webkit-search-cancel-button,
348
353
  .visual-search-field input[type=search]::-webkit-search-decoration { -webkit-appearance:none; }
349
- .visual-search-field .visual-search-clear { display:grid;place-items:center;flex:none;width:24px;min-width:24px;height:24px;min-height:24px;
354
+ .visual-search-field .visual-search-clear { display:grid;place-items:center;flex:none;width:20px;min-width:20px;height:20px;min-height:20px;
350
355
  padding:0;margin:0;border:0;border-radius:50%;background:transparent;color:inherit;box-shadow:none;cursor:pointer; }
351
356
  .visual-search-clear::before { content:'';width:14px;height:14px;background:currentColor;opacity:.6;
352
357
  mask:center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M10 1a9 9 0 1 0 0 18a9 9 0 0 0 0-18z M6 7.2L7.2 6L10 8.8L12.8 6L14 7.2L11.2 10L14 12.8L12.8 14L10 11.2L7.2 14L6 12.8L8.8 10z'/%3E%3C/svg%3E"); }
@@ -355,64 +360,101 @@
355
360
  .visual-search-clear[hidden] { display:none; }
356
361
 
357
362
  .visual-editor-fields {
358
- --gramlot-field-padding:3px 7px;
359
- --gramlot-formlet-gap:6px;
363
+ --gramlot-field-padding:1px 5px;
364
+ --gramlot-formlet-gap:4px;
360
365
  --gramlot-label-size:12px;
361
- --gramlot-label-gap:4px;
366
+ --gramlot-label-gap:2px;
362
367
  font-size:12px;
363
368
  }
364
- .visual-editor-destination { margin:8px 10px 2px; font-size:11px; overflow-wrap:anywhere; }
369
+ .visual-editor-destination { margin:8px 10px 2px; font-size:12px; overflow-wrap:anywhere; }
365
370
  .visual-editor-widget { margin:0 10px 8px; font-size:14px; }
366
- .visual-editor-hint { margin:0 0 8px; font-size:11px; color:var(--gramlot-text-secondary); }
367
- .visual-parameter-field { display:grid;gap:4px;min-width:0; }
368
- .visual-validation-advanced { margin-top:12px; }
369
- .visual-validation-advanced summary { cursor:pointer; margin-bottom:8px; font-weight:600; }
370
- .visual-editor-fields select { min-height:var(--gramlot-field-height,28px);padding:3px 7px;font:inherit; }
371
+ .visual-editor-hint { margin:0 0 8px; font-size:12px; color:var(--gramlot-text-secondary); }
372
+ .visual-parameter-field { display:grid;gap:2px;min-width:0; }
373
+ .visual-validation-advanced { margin-top:6px; }
374
+ .visual-validation-advanced summary { cursor:pointer; margin-bottom:4px; font-weight:600; }
375
+ .visual-editor-fields select { min-height:24px;padding:1px 5px;font:inherit; }
371
376
  .visual-editor-fields .label-box label { margin:0;font-size:12px;font-weight:500;line-height:1.35; }
372
377
  .visual-editor-fields .visual-editor-hint { margin:0;line-height:1.5; }
373
378
  .visual-editor-fields .visual-labelbox-heading { align-items:end; }
374
379
  .visual-editor-fields .visual-labelbox-heading > gramlot-button { margin-bottom:2px; }
375
380
  .visual-editor-fields .label-box label { overflow-wrap:anywhere; }
376
381
 
382
+ /* Inspector-like property table; the value cell contains its row commands. */
383
+ .visual-editor-attribute-list { border:1px solid var(--gramlot-border);border-radius:0;overflow:hidden;font-size:12px; }
384
+ .visual-editor-attribute-row { display:grid;grid-template-columns:minmax(90px,38%) minmax(0,1fr);min-height:24px;
385
+ border-bottom:1px solid var(--gramlot-border); }
386
+ .visual-editor-attribute-row:last-child { border-bottom:0; }
387
+ .visual-editor-attribute-row[hidden] { display:none; }
388
+ .visual-editor-attribute-name { display:flex;align-items:center;min-width:0;padding:1px 5px;overflow-wrap:anywhere;
389
+ background:var(--gramlot-surface-subtle);border-right:1px solid var(--gramlot-border); }
390
+ .visual-editor-attribute-value { display:flex;align-items:center;min-width:0; }
391
+ .visual-editor-attribute-heading { font-weight:600;color:var(--gramlot-text-secondary);background:var(--gramlot-surface-subtle); }
392
+ .visual-editor-attribute-heading .visual-editor-attribute-value { padding-left:5px; }
393
+ .visual-editor-attribute-row input { flex:1;min-width:0;width:100%;height:23px;box-sizing:border-box;border:0;border-radius:0;
394
+ padding:1px 5px;font:inherit;background:transparent;color:var(--gramlot-ink); }
395
+ .visual-editor-attribute-name:has(input) { padding:0; }
396
+ .visual-editor-fields .visual-editor-attribute-value select { flex:none;width:60px;max-width:25%;height:23px;min-height:0;
397
+ padding:0 2px;border:0;border-left:1px solid var(--gramlot-border);border-radius:0;font:inherit;background:var(--gramlot-surface-subtle);color:var(--gramlot-ink); }
398
+ .visual-editor-attribute-command { flex:none;margin-left:auto;width:22px;min-width:22px;height:23px;
399
+ --gramlot-button-padding:0 5px;--gramlot-field-height:23px;
400
+ --gramlot-button-background:transparent;--gramlot-border-control:transparent; }
401
+ .visual-editor-attribute-row input:focus-visible,.visual-editor-attribute-row select:focus-visible { outline:1px solid var(--gramlot-focus-ring);outline-offset:-1px; }
402
+
403
+ /* Tool density is local: authored widgets in the canvas retain their own sizing. */
404
+ .visual-editor-sidebar,.visual-editor-popup,.visual-editor-fields,.visual-editor-chat,
405
+ .visual-editor-toolbar,.visual-editor-rail,.visual-editor-code {
406
+ font-size:12px;line-height:1.3;
407
+ --gramlot-field-height:24px;--gramlot-field-font-size:12px;--gramlot-field-padding:1px 5px;
408
+ --gramlot-field-line-height:1.3;--gramlot-button-padding:1px 5px;
409
+ --gramlot-tree-row-height:24px;--gramlot-tab-height:24px;--gramlot-tab-padding:1px 6px;
410
+ --gramlot-tab-strip-padding:0;--gramlot-tab-gap:0;--gramlot-label-size:12px;--gramlot-label-gap:2px;
411
+ --gramlot-region-header-padding:0 5px;
412
+ }
413
+ :is(.visual-editor-sidebar,.visual-editor-popup) gramlot-tree::part(row) { min-height:24px;border-radius:1px; }
414
+ :is(.visual-editor-sidebar,.visual-editor-popup) gramlot-tree::part(expander) { width:16px;height:20px; }
415
+ :is(.visual-editor-sidebar,.visual-editor-popup) gramlot-tree::part(spacer) { width:16px;height:20px; }
416
+ :is(.visual-editor-sidebar,.visual-editor-popup) gramlot-tree::part(icon) { width:14px;height:14px; }
417
+ :is(.visual-editor-sidebar,.visual-editor-popup) gramlot-tree::part(group) { padding-inline-start:16px; }
418
+
377
419
  /* Workbench chrome uses the selected canonical palette and density. */
378
420
  .visual-editor-shell { position:relative;min-width:0;isolation:isolate;background:var(--gramlot-background);color:var(--gramlot-ink);
379
421
  font-size:var(--gramlot-field-font-size,13px);line-height:1.4;
380
422
  --gramlot-region-header-background:transparent;--gramlot-region-header-padding:0 8px;
381
423
  --gramlot-region-header-border:transparent;--gramlot-region-title-size:11px;
382
424
  --gramlot-splitter-background:color-mix(in srgb,var(--gramlot-border) 60%,transparent); }
383
- .visual-editor-layout { width:calc(100% - 42px);margin-left:42px; }
384
- .visual-editor-rail { position:absolute;inset:0 auto 0 0;width:42px;padding:7px 4px;gap:8px;
425
+ .visual-editor-layout { width:calc(100% - 32px);margin-left:32px; }
426
+ .visual-editor-rail { position:absolute;inset:0 auto 0 0;width:32px;padding:3px 2px;gap:3px;
385
427
  background:var(--gramlot-background);border-right:1px solid var(--gramlot-splitter-background); }
386
- .visual-editor-tool { --gramlot-button-padding:5px;--gramlot-button-gap:0px; }
387
- .visual-tool-icon { width:17px;height:17px;display:block;flex:none;background:currentColor;mask-position:center;mask-repeat:no-repeat;mask-size:contain; }
388
- .visual-editor-rail .visual-tool-icon { width:19px;height:19px; }
389
- .visual-editor-rail .visual-editor-tool { --gramlot-button-padding:6px; }
428
+ .visual-editor-tool { --gramlot-button-padding:3px;--gramlot-button-gap:0px; }
429
+ .visual-tool-icon { width:15px;height:15px;display:block;flex:none;background:currentColor;mask-position:center;mask-repeat:no-repeat;mask-size:contain; }
430
+ .visual-editor-rail .visual-tool-icon { width:16px;height:16px; }
431
+ .visual-editor-rail .visual-editor-tool { --gramlot-button-padding:4px; }
390
432
  .visual-editor-rail,.visual-editor-toolbar { --gramlot-action:var(--gramlot-text-secondary);--gramlot-action-hover:var(--gramlot-ink); }
391
- .visual-editor-toolbar { height:38px;box-sizing:border-box;padding:3px 10px;gap:5px;border-bottom:1px solid var(--gramlot-splitter-background);
392
- background:var(--gramlot-background); --gramlot-button-padding:3px 7px; --gramlot-button-gap:4px; }
393
- .visual-editor-brand { font-size:12px;font-weight:600;letter-spacing:-.02em;white-space:nowrap;margin-right:8px; }
394
- .visual-toolbar-divider { width:1px;height:16px;background:var(--gramlot-border);margin:0 5px; }
395
- .visual-editor-filename { font-size:11px;color:var(--gramlot-text-secondary);padding:0 4px;white-space:nowrap; }
433
+ .visual-editor-toolbar { height:30px;box-sizing:border-box;padding:1px 6px;gap:2px;border-bottom:1px solid var(--gramlot-splitter-background);
434
+ background:var(--gramlot-background); --gramlot-button-padding:2px 4px; --gramlot-button-gap:2px; }
435
+ .visual-editor-brand { font-size:12px;font-weight:600;letter-spacing:-.02em;white-space:nowrap;margin-right:4px; }
436
+ .visual-toolbar-divider { width:1px;height:16px;background:var(--gramlot-border);margin:0 3px; }
437
+ .visual-editor-filename { font-size:12px;color:var(--gramlot-text-secondary);padding:0 4px;white-space:nowrap; }
396
438
  .visual-editor-sidebar,.visual-editor-chat { background:color-mix(in srgb,var(--gramlot-background) 65%,var(--gramlot-surface)); }
397
439
  .visual-editor-sidebar .visual-search-field { background:color-mix(in srgb,var(--gramlot-surface) 65%,transparent); }
398
440
  .visual-editor-workspace { background:var(--gramlot-surface); }
399
- .visual-editor-canvas { box-sizing:border-box;min-height:100%;padding:8px;display:flex;flex-direction:column; }
441
+ .visual-editor-canvas { box-sizing:border-box;min-height:100%;padding:2px;display:flex;flex-direction:column; }
400
442
  .visual-editor-canvas > div { flex:1;min-height:180px;box-sizing:border-box;background:var(--gramlot-surface); }
401
443
  .visual-editor-canvas > div.gramlot-source-selected { outline:1px dashed color-mix(in srgb,var(--gramlot-action) 35%,transparent)!important;outline-offset:-1px!important; }
402
- .visual-editor-file-status { margin:0;padding:0 6px;font-size:11px;color:var(--gramlot-text-secondary);max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
444
+ .visual-editor-file-status { margin:0;padding:0 6px;font-size:12px;color:var(--gramlot-text-secondary);max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
403
445
  .visual-editor-destination { margin:2px 10px 4px;opacity:.65;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
404
446
  .visual-editor-error { position:absolute;bottom:8px;left:320px;max-width:calc(100% - 340px);margin:0;padding:6px 10px;background:var(--gramlot-error-background);color:var(--gramlot-error);border-radius:4px; }
405
- .visual-editor-chat select { height:26px;min-height:26px;padding:2px 5px;border-color:transparent;background:transparent;font-size:11px;text-overflow:ellipsis; }
447
+ .visual-editor-chat select { height:22px;min-height:24px;padding:1px 4px;border-color:transparent;background:transparent;font-size:12px;text-overflow:ellipsis; }
406
448
  .visual-editor-chat select { flex-shrink:0; }
407
449
  .visual-editor-chat .gramlot-chat-editor { border-color:var(--gramlot-border);background:var(--gramlot-surface);font-size:12px; }
408
450
  @media (max-width:900px) { .visual-editor-brand { display:none; }.visual-editor-file-status{max-width:110px;} }
409
451
 
410
- .visual-labelbox-section { display:grid;gap:6px;min-width:0; }
411
- .visual-labelbox-heading { display:grid;grid-template-columns:minmax(0,1fr) 28px;align-items:center;gap:6px; }
412
- .visual-labelbox-heading > gramlot-button { --gramlot-button-padding:4px;font-size:15px; }
452
+ .visual-labelbox-section { display:grid;gap:3px;min-width:0; }
453
+ .visual-labelbox-heading { display:grid;grid-template-columns:minmax(0,1fr) 22px;align-items:center;gap:3px; }
454
+ .visual-labelbox-heading > gramlot-button { --gramlot-button-padding:2px;font-size:13px; }
413
455
  .visual-labelbox-title { font-weight:600;color:var(--gramlot-text-secondary); }
414
- .visual-labelbox-attribute { display:grid;grid-template-columns:150px minmax(0,1fr);align-items:start;gap:8px;
415
- padding:7px;border:1px solid var(--gramlot-border);border-radius:5px; }
456
+ .visual-labelbox-attribute { display:grid;grid-template-columns:minmax(80px,40%) minmax(0,1fr);align-items:start;gap:4px;
457
+ padding:3px;border:1px solid var(--gramlot-border);border-radius:2px; }
416
458
  .visual-labelbox-attribute[hidden] { display:none; }
417
459
 
418
460
  /* Selection is a view-only decoration: no border, padding, size or Source writes. */
@@ -427,6 +469,6 @@
427
469
  box-shadow:inset 3px 0 var(--gramlot-action, #456bc4);
428
470
  }
429
471
 
430
- .visual-clipboard { padding:8px; gap:4px; border-top:1px solid var(--gramlot-border); }
472
+ .visual-clipboard { padding:3px; gap:2px; border-top:1px solid var(--gramlot-border); }
431
473
  .visual-clipboard-title { font-weight:600; }
432
- .visual-clipboard .visual-editor-hint { font-size:12px; }
474
+ .visual-clipboard .visual-editor-hint { font-size:11px; }