@gramlot/gramlot 0.3.24 → 0.3.26

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 (131) hide show
  1. package/dist/components/editors/__init__.py +2 -2
  2. package/dist/components/editors/assets/collection.js +20 -19
  3. package/dist/components/editors/assets/index.js +1 -1
  4. package/dist/components/editors/assets/modules/chunk-74O4WKIV.js +1 -0
  5. package/dist/components/editors/assets/modules/{code-mirror-engine-QX4A5FVO.js → code-mirror-engine-RWQTR5G5.js} +29 -29
  6. package/dist/components/editors/assets/modules/{jodit-engine-MMSPIWM7.js → jodit-engine-MTSA4GZ3.js} +292 -292
  7. package/dist/components/editors/assets/modules/markdown-document-VFC23FAY.js +1 -0
  8. package/dist/components/editors/assets/modules/{prose-mirror-engine-IXTRTG6B.js → prose-mirror-engine-GMZPJPNN.js} +13 -13
  9. package/dist/components/grid/__init__.py +3 -2
  10. package/dist/components/grid/assets/collection.js +68 -17
  11. package/dist/components/grid/assets/index.js +1 -1
  12. package/dist/components/grid/grammar.json +57 -1
  13. package/dist/components/grouplets/__init__.py +2 -2
  14. package/dist/components/grouplets/assets/collection.js +3 -20
  15. package/dist/components/grouplets/assets/index.js +1 -1
  16. package/dist/components/grouplets/assets/modules/chunk-BLMUM44K.js +1 -0
  17. package/dist/components/grouplets/assets/modules/markdown-document-YWNZTOKK.js +1 -0
  18. package/dist/components/inputs/__init__.py +1 -1
  19. package/dist/components/inputs/assets/collection.js +59 -34
  20. package/dist/components/inputs/assets/index.js +1 -1
  21. package/dist/components/inputs/grammar.json +64 -0
  22. package/dist/components/layout/__init__.py +1 -1
  23. package/dist/components/layout/assets/collection.js +67 -57
  24. package/dist/components/layout/assets/index.js +1 -1
  25. package/dist/components/layout/grammar.json +35 -0
  26. package/dist/components/selection_trial/__init__.py +1 -1
  27. package/dist/components/selection_trial/assets/collection.js +3 -3
  28. package/dist/components/selection_trial/assets/index.js +1 -1
  29. package/dist/components/selection_trial/grammar.json +35 -0
  30. package/dist/components/tree/__init__.py +1 -1
  31. package/dist/components/tree/assets/collection.js +26 -23
  32. package/dist/components/tree/assets/index.js +1 -1
  33. package/dist/components/tree/grammar.json +341 -1
  34. package/dist/components/uploads/__init__.py +13 -0
  35. package/dist/components/uploads/assets/collection.js +67 -0
  36. package/dist/components/uploads/assets/index.js +3 -0
  37. package/dist/components/uploads/commands.json +7 -0
  38. package/dist/components/uploads/grammar.json +789 -0
  39. package/dist/{components/editors/assets/modules/chunk-OCFLP2K4.js → gramlot-markdown.js} +12 -12
  40. package/dist/gramlot.js +4910 -566
  41. package/dist/gramlot.min.js +1587 -43
  42. package/dist/runtime-notices.json +28 -0
  43. package/package.json +4 -2
  44. package/src/binding/grid-struct.js +1 -1
  45. package/src/binding/providers.js +4 -1
  46. package/src/binding/remote-resolver.js +1 -8
  47. package/src/binding/runtime.js +40 -1
  48. package/src/binding/validation-context.js +40 -0
  49. package/src/browser-camera-provider.d.ts +8 -0
  50. package/src/browser-camera-provider.js +104 -0
  51. package/src/builder/source.js +13 -2
  52. package/src/components/attachment-manager.js +160 -0
  53. package/src/components/bases.js +17 -6
  54. package/src/components/border-container.js +86 -8
  55. package/src/components/buttons.js +11 -1
  56. package/src/components/choice-editor.js +20 -7
  57. package/src/components/database-choices.js +4 -2
  58. package/src/components/editing-status-styles.js +26 -0
  59. package/src/components/editing-status.js +115 -0
  60. package/src/components/field-state.js +37 -58
  61. package/src/components/grid-cell-editor.js +181 -0
  62. package/src/components/grid-grammar.json +21 -0
  63. package/src/components/grid-structure.js +2 -1
  64. package/src/components/grid-styles.js +51 -1
  65. package/src/components/grid.js +87 -10
  66. package/src/components/grouplet-card.js +11 -3
  67. package/src/components/html-preview.js +17 -4
  68. package/src/components/image-crop-dialog.js +272 -0
  69. package/src/components/image-crop.js +79 -0
  70. package/src/components/image-uploader.js +252 -0
  71. package/src/components/inputs.js +2 -1
  72. package/src/components/jodit-engine.js +1 -1
  73. package/src/components/markdown-document.js +2 -2
  74. package/src/components/screen-capture.js +43 -0
  75. package/src/components/selected-container.js +6 -2
  76. package/src/components/tree.js +416 -17
  77. package/src/components/typed-editor.js +19 -9
  78. package/src/components/upload-engine.js +156 -0
  79. package/src/components/uploader.js +208 -0
  80. package/src/components/uploads.js +7 -0
  81. package/src/editing-session.d.ts +25 -0
  82. package/src/editing-session.js +396 -0
  83. package/src/experiments/selection-trial.js +18 -2
  84. package/src/format.js +22 -7
  85. package/src/gramlot.d.ts +2 -0
  86. package/src/gramlot.js +2 -1
  87. package/src/handlers/device-handler.d.ts +2 -1
  88. package/src/handlers/rpc-handler.d.ts +3 -3
  89. package/src/index-page-styles.js +1 -0
  90. package/src/index.d.ts +13 -0
  91. package/src/index.js +13 -0
  92. package/src/inout.d.ts +2 -0
  93. package/src/inout.js +6 -0
  94. package/src/markdown-loader.d.ts +1 -0
  95. package/src/markdown-loader.js +4 -0
  96. package/src/markdown.d.ts +1 -0
  97. package/src/markdown.js +2 -0
  98. package/src/media-frame.js +9 -0
  99. package/src/renderer/attributes.js +7 -1
  100. package/src/renderer/gramlot-renderer.d.ts +2 -0
  101. package/src/renderer/gramlot-renderer.js +31 -2
  102. package/src/server/assets.d.ts +1 -1
  103. package/src/server/assets.js +1 -1
  104. package/src/server/gramlot-server.d.ts +8 -1
  105. package/src/server/gramlot-server.js +83 -7
  106. package/src/server/index.d.ts +2 -0
  107. package/src/server/index.js +2 -0
  108. package/src/server/page-base.js +17 -4
  109. package/src/server/page.d.ts +13 -1
  110. package/src/server/page.js +6 -0
  111. package/src/server/source-import.d.ts +2 -0
  112. package/src/server/source-import.js +31 -0
  113. package/src/server/upload.d.ts +20 -0
  114. package/src/server/upload.js +142 -0
  115. package/src/server/visual-editor.d.ts +11 -0
  116. package/src/server/visual-editor.js +149 -0
  117. package/src/source-picker.d.ts +9 -0
  118. package/src/source-picker.js +57 -0
  119. package/src/tree-store.d.ts +24 -0
  120. package/src/tree-store.js +193 -0
  121. package/src/validation-run.js +50 -0
  122. package/src/view/button.js +8 -5
  123. package/src/view/controls.js +9 -42
  124. package/src/view/html.js +10 -2
  125. package/src/visual-editor-icons.js +10 -0
  126. package/src/visual-editor.d.ts +56 -0
  127. package/src/visual-editor.js +844 -0
  128. package/themes/gramlot-base/theme.css +99 -0
  129. package/dist/components/editors/assets/modules/chunk-MMJXUHRQ.js +0 -3
  130. package/src/form-state.d.ts +0 -20
  131. package/src/form-state.js +0 -198
@@ -1,2 +1,3 @@
1
1
  // Generated from canonical themes; edit themes/, not this file.
2
2
  export const appearanceStyles = {"base":"","compact":"/* gramlot-compact: professional density profile; load after Base. */\n@layer gramlot.tokens {\n :root {\n color-scheme: light;\n --gramlot-background: #f3f5f7;\n --gramlot-surface: #ffffff;\n --gramlot-header-background: #303946;\n --gramlot-header-color: #ffffff;\n --gramlot-surface-subtle: #e9edf2;\n --gramlot-ink: #202936;\n --gramlot-text-secondary: #526174;\n --gramlot-border: #ccd3dc;\n --gramlot-border-control: #7b899b;\n --gramlot-action: #235db2;\n --gramlot-action-hover: #194987;\n --gramlot-selected: #e3edfb;\n --gramlot-field-background: #ffffff;\n --gramlot-field-readonly-background: #e9edf2;\n --gramlot-label-color: #526174;\n --gramlot-focus-ring: #235db2;\n --gramlot-brand-blue: #235db2;\n --gramlot-brand-yellow: #235db2;\n --gramlot-navigation: #202936;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #aa2637;\n --gramlot-error-background: #fff0f1;\n --gramlot-success: #236747;\n --gramlot-success-background: #e9f4ec;\n --gramlot-warning: #735313;\n --gramlot-warning-background: #fff5da;\n --gramlot-field-height: 28px;\n --gramlot-field-padding: 2px 7px;\n --gramlot-field-line-height: 1.3;\n --gramlot-field-font-size: 1rem;\n --gramlot-button-padding: 2px 7px;\n --gramlot-button-gap: 4px;\n --gramlot-button-background: var(--gramlot-surface);\n --gramlot-button-hover: var(--gramlot-selected);\n --gramlot-label-size: 1em;\n --gramlot-label-gap: 3px;\n --gramlot-radius-sm: 4px;\n --gramlot-radius: 4px;\n --gramlot-radius-lg: 6px;\n --gramlot-window-radius: 6px;\n --gramlot-toolbar-gap: 2px;\n --gramlot-tree-row-height: var(--gramlot-field-height);\n --gramlot-space-1: 3px;\n --gramlot-space-2: 4px;\n --gramlot-space-3: 8px;\n --gramlot-space-4: 8px;\n --gramlot-space-6: 12px;\n --gramlot-space-8: 16px;\n --gramlot-space-12: 24px;\n --gramlot-tab-height: 28px;\n --gramlot-tab-padding: 2px 7px;\n --gramlot-tab-radius: 4px;\n --gramlot-tab-gap: 2px;\n --gramlot-tab-strip-padding: 2px;\n --gramlot-tab-background: var(--gramlot-surface-subtle);\n --gramlot-tab-selected-background: var(--gramlot-surface);\n --gramlot-tab-selected-color: var(--gramlot-action);\n --gramlot-tab-border: var(--gramlot-border);\n --gramlot-shadow: 0 2px 8px rgb(0 0 0 / 10%);\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n color-scheme: dark;\n --gramlot-background: #171c24;\n --gramlot-surface: #222a35;\n --gramlot-header-background: #354152;\n --gramlot-header-color: #edf1f7;\n --gramlot-surface-subtle: #2b3543;\n --gramlot-ink: #edf1f7;\n --gramlot-text-secondary: #b8c4d4;\n --gramlot-border: #435064;\n --gramlot-border-control: #7f90a7;\n --gramlot-action: #9dbff4;\n --gramlot-action-hover: #c1d6ff;\n --gramlot-selected: #314766;\n --gramlot-field-background: #222a35;\n --gramlot-field-readonly-background: #2b3543;\n --gramlot-label-color: #b8c4d4;\n --gramlot-focus-ring: #9dbff4;\n --gramlot-brand-blue: #9dbff4;\n --gramlot-brand-yellow: #9dbff4;\n --gramlot-navigation: #171c24;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n }\n :root[data-theme=\"dark\"] {\n color-scheme: dark;\n --gramlot-background: #171c24;\n --gramlot-surface: #222a35;\n --gramlot-header-background: #354152;\n --gramlot-header-color: #edf1f7;\n --gramlot-surface-subtle: #2b3543;\n --gramlot-ink: #edf1f7;\n --gramlot-text-secondary: #b8c4d4;\n --gramlot-border: #435064;\n --gramlot-border-control: #7f90a7;\n --gramlot-action: #9dbff4;\n --gramlot-action-hover: #c1d6ff;\n --gramlot-selected: #314766;\n --gramlot-field-background: #222a35;\n --gramlot-field-readonly-background: #2b3543;\n --gramlot-label-color: #b8c4d4;\n --gramlot-focus-ring: #9dbff4;\n --gramlot-brand-blue: #9dbff4;\n --gramlot-brand-yellow: #9dbff4;\n --gramlot-navigation: #171c24;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n}\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.4; }\n :where(h1,h2,h3,h4,h5,h6,p,ul,ol,dl,blockquote,pre,figure) { margin-block: 0 var(--gramlot-space-3); }\n h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }\n :where(h1,h2,h3) { letter-spacing: -.015em; }\n pre { padding: var(--gramlot-space-3); }\n hr { margin-block: var(--gramlot-space-6); }\n}\n@layer gramlot.components {\n :where(button,input[type=\"button\"],input[type=\"submit\"],input[type=\"reset\"],.button) {\n min-block-size: var(--gramlot-field-height); padding: var(--gramlot-button-padding);\n font-size: 1rem; line-height: 1.3; font-weight: 500;\n background: var(--gramlot-button-background); color: var(--gramlot-ink); border-color: var(--gramlot-border-control);\n }\n :where(button,input[type=\"button\"],input[type=\"submit\"],input[type=\"reset\"],.button):hover:not(:disabled) {\n background: var(--gramlot-selected); color: var(--gramlot-action-hover); border-color: var(--gramlot-action);\n }\n :where(label) { font-size: 1em; font-weight: 400; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(input[readonly],textarea[readonly]) { background: var(--gramlot-field-readonly-background); }\n :where(.button--quiet,button.quiet) { background: transparent; color: var(--gramlot-action); border-color: transparent; }\n :where(.button--quiet,button.quiet):hover:not(:disabled) { background: var(--gramlot-selected); border-color: transparent; }\n :where(textarea) { min-block-size: 4.5rem; }\n :where(input[type=\"color\"]) { min-block-size: var(--gramlot-field-height); }\n :where(input[type=\"file\"])::file-selector-button { padding: var(--gramlot-field-padding); }\n :where(fieldset,details) { padding: var(--gramlot-space-3); margin-block-end: var(--gramlot-space-3); }\n :where(table) { font-size: 1rem; }\n :where(th,td) { padding: var(--gramlot-field-padding); height: var(--gramlot-field-height); vertical-align: middle; }\n :where(details[open]>summary) { margin-block-end: var(--gramlot-space-3); }\n :where(dialog) { padding: var(--gramlot-space-4); }\n}\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 2 * var(--gramlot-space-4),var(--gramlot-page-width)); padding-block: var(--gramlot-space-4); }\n .card { padding: var(--gramlot-space-4); box-shadow: none; }\n}\n\n/* Resident Bag grid: shared palette and theme density. */\n:root {\n --gramlot-grid-row-height: 32px;\n --gramlot-grid-header-height: 30px;\n --gramlot-grid-group-height: 22px;\n --gramlot-grid-cell-padding: .25rem .65rem;\n}\n","mimi":"/* gramlot-compact: professional density profile; load after Base. */\n@layer gramlot.tokens {\n :root {\n color-scheme: light;\n --gramlot-background: #f3f5f7;\n --gramlot-surface: #ffffff;\n --gramlot-header-background: #303946;\n --gramlot-header-color: #ffffff;\n --gramlot-surface-subtle: #e9edf2;\n --gramlot-ink: #202936;\n --gramlot-text-secondary: #526174;\n --gramlot-border: #ccd3dc;\n --gramlot-border-control: #7b899b;\n --gramlot-action: #235db2;\n --gramlot-action-hover: #194987;\n --gramlot-selected: #e3edfb;\n --gramlot-field-background: #ffffff;\n --gramlot-field-readonly-background: #e9edf2;\n --gramlot-label-color: #526174;\n --gramlot-focus-ring: #235db2;\n --gramlot-brand-blue: #235db2;\n --gramlot-brand-yellow: #235db2;\n --gramlot-navigation: #202936;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #aa2637;\n --gramlot-error-background: #fff0f1;\n --gramlot-success: #236747;\n --gramlot-success-background: #e9f4ec;\n --gramlot-warning: #735313;\n --gramlot-warning-background: #fff5da;\n --gramlot-field-height: 28px;\n --gramlot-field-padding: 2px 7px;\n --gramlot-field-line-height: 1.3;\n --gramlot-field-font-size: 1rem;\n --gramlot-button-padding: 2px 7px;\n --gramlot-button-gap: 4px;\n --gramlot-button-background: var(--gramlot-surface);\n --gramlot-button-hover: var(--gramlot-selected);\n --gramlot-label-size: 1em;\n --gramlot-label-gap: 3px;\n --gramlot-radius-sm: 4px;\n --gramlot-radius: 4px;\n --gramlot-radius-lg: 6px;\n --gramlot-window-radius: 6px;\n --gramlot-toolbar-gap: 2px;\n --gramlot-tree-row-height: var(--gramlot-field-height);\n --gramlot-space-1: 3px;\n --gramlot-space-2: 4px;\n --gramlot-space-3: 8px;\n --gramlot-space-4: 8px;\n --gramlot-space-6: 12px;\n --gramlot-space-8: 16px;\n --gramlot-space-12: 24px;\n --gramlot-tab-height: 28px;\n --gramlot-tab-padding: 2px 7px;\n --gramlot-tab-radius: 4px;\n --gramlot-tab-gap: 2px;\n --gramlot-tab-strip-padding: 2px;\n --gramlot-tab-background: var(--gramlot-surface-subtle);\n --gramlot-tab-selected-background: var(--gramlot-surface);\n --gramlot-tab-selected-color: var(--gramlot-action);\n --gramlot-tab-border: var(--gramlot-border);\n --gramlot-shadow: 0 2px 8px rgb(0 0 0 / 10%);\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n color-scheme: dark;\n --gramlot-background: #171c24;\n --gramlot-surface: #222a35;\n --gramlot-header-background: #354152;\n --gramlot-header-color: #edf1f7;\n --gramlot-surface-subtle: #2b3543;\n --gramlot-ink: #edf1f7;\n --gramlot-text-secondary: #b8c4d4;\n --gramlot-border: #435064;\n --gramlot-border-control: #7f90a7;\n --gramlot-action: #9dbff4;\n --gramlot-action-hover: #c1d6ff;\n --gramlot-selected: #314766;\n --gramlot-field-background: #222a35;\n --gramlot-field-readonly-background: #2b3543;\n --gramlot-label-color: #b8c4d4;\n --gramlot-focus-ring: #9dbff4;\n --gramlot-brand-blue: #9dbff4;\n --gramlot-brand-yellow: #9dbff4;\n --gramlot-navigation: #171c24;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n }\n :root[data-theme=\"dark\"] {\n color-scheme: dark;\n --gramlot-background: #171c24;\n --gramlot-surface: #222a35;\n --gramlot-header-background: #354152;\n --gramlot-header-color: #edf1f7;\n --gramlot-surface-subtle: #2b3543;\n --gramlot-ink: #edf1f7;\n --gramlot-text-secondary: #b8c4d4;\n --gramlot-border: #435064;\n --gramlot-border-control: #7f90a7;\n --gramlot-action: #9dbff4;\n --gramlot-action-hover: #c1d6ff;\n --gramlot-selected: #314766;\n --gramlot-field-background: #222a35;\n --gramlot-field-readonly-background: #2b3543;\n --gramlot-label-color: #b8c4d4;\n --gramlot-focus-ring: #9dbff4;\n --gramlot-brand-blue: #9dbff4;\n --gramlot-brand-yellow: #9dbff4;\n --gramlot-navigation: #171c24;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n}\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.4; }\n :where(h1,h2,h3,h4,h5,h6,p,ul,ol,dl,blockquote,pre,figure) { margin-block: 0 var(--gramlot-space-3); }\n h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }\n :where(h1,h2,h3) { letter-spacing: -.015em; }\n pre { padding: var(--gramlot-space-3); }\n hr { margin-block: var(--gramlot-space-6); }\n}\n@layer gramlot.components {\n :where(button,input[type=\"button\"],input[type=\"submit\"],input[type=\"reset\"],.button) {\n min-block-size: var(--gramlot-field-height); padding: var(--gramlot-button-padding);\n font-size: 1rem; line-height: 1.3; font-weight: 500;\n background: var(--gramlot-button-background); color: var(--gramlot-ink); border-color: var(--gramlot-border-control);\n }\n :where(button,input[type=\"button\"],input[type=\"submit\"],input[type=\"reset\"],.button):hover:not(:disabled) {\n background: var(--gramlot-selected); color: var(--gramlot-action-hover); border-color: var(--gramlot-action);\n }\n :where(label) { font-size: 1em; font-weight: 400; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(input[readonly],textarea[readonly]) { background: var(--gramlot-field-readonly-background); }\n :where(.button--quiet,button.quiet) { background: transparent; color: var(--gramlot-action); border-color: transparent; }\n :where(.button--quiet,button.quiet):hover:not(:disabled) { background: var(--gramlot-selected); border-color: transparent; }\n :where(textarea) { min-block-size: 4.5rem; }\n :where(input[type=\"color\"]) { min-block-size: var(--gramlot-field-height); }\n :where(input[type=\"file\"])::file-selector-button { padding: var(--gramlot-field-padding); }\n :where(fieldset,details) { padding: var(--gramlot-space-3); margin-block-end: var(--gramlot-space-3); }\n :where(table) { font-size: 1rem; }\n :where(th,td) { padding: var(--gramlot-field-padding); height: var(--gramlot-field-height); vertical-align: middle; }\n :where(details[open]>summary) { margin-block-end: var(--gramlot-space-3); }\n :where(dialog) { padding: var(--gramlot-space-4); }\n}\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 2 * var(--gramlot-space-4),var(--gramlot-page-width)); padding-block: var(--gramlot-space-4); }\n .card { padding: var(--gramlot-space-4); box-shadow: none; }\n}\n\n/* Resident Bag grid: shared palette and theme density. */\n:root {\n --gramlot-grid-row-height: 32px;\n --gramlot-grid-header-height: 30px;\n --gramlot-grid-group-height: 22px;\n --gramlot-grid-cell-padding: .25rem .65rem;\n}\n\n/* mimi: professional density profile; load after Base and Compact. */\n@layer gramlot.tokens {\n :root {\n color-scheme: light;\n --gramlot-background: #edf1ef;\n --gramlot-surface: #fbfcfb;\n --gramlot-header-background: #30473c;\n --gramlot-header-color: #fbfcfb;\n --gramlot-surface-subtle: #e2e9e5;\n --gramlot-ink: #24332e;\n --gramlot-text-secondary: #52655d;\n --gramlot-border: #c4d0c9;\n --gramlot-border-control: #768a7e;\n --gramlot-action: #176b61;\n --gramlot-action-hover: #105247;\n --gramlot-selected: #dceee8;\n --gramlot-field-background: #fbfcfb;\n --gramlot-field-readonly-background: #e2e9e5;\n --gramlot-label-color: #52655d;\n --gramlot-focus-ring: #176b61;\n --gramlot-brand-blue: #176b61;\n --gramlot-brand-yellow: #176b61;\n --gramlot-navigation: #24332e;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #aa2637;\n --gramlot-error-background: #fff0f1;\n --gramlot-success: #236747;\n --gramlot-success-background: #e9f4ec;\n --gramlot-warning: #735313;\n --gramlot-warning-background: #fff5da;\n --gramlot-field-height: 24px;\n --gramlot-field-padding: 1px 5px;\n --gramlot-field-line-height: 1.3;\n --gramlot-field-font-size: 1rem;\n --gramlot-button-padding: 1px 5px;\n --gramlot-button-gap: 4px;\n --gramlot-button-background: var(--gramlot-surface);\n --gramlot-button-hover: var(--gramlot-selected);\n --gramlot-label-size: 1em;\n --gramlot-label-gap: 3px;\n --gramlot-radius-sm: 3px;\n --gramlot-radius: 3px;\n --gramlot-radius-lg: 5px;\n --gramlot-window-radius: 5px;\n --gramlot-toolbar-gap: 2px;\n --gramlot-tree-row-height: var(--gramlot-field-height);\n --gramlot-space-1: 3px;\n --gramlot-space-2: 3px;\n --gramlot-space-3: 6px;\n --gramlot-space-4: 6px;\n --gramlot-space-6: 9px;\n --gramlot-space-8: 12px;\n --gramlot-space-12: 18px;\n --gramlot-tab-height: 24px;\n --gramlot-tab-padding: 1px 5px;\n --gramlot-tab-radius: 3px;\n --gramlot-tab-gap: 2px;\n --gramlot-tab-strip-padding: 2px;\n --gramlot-tab-background: var(--gramlot-surface-subtle);\n --gramlot-tab-selected-background: var(--gramlot-surface);\n --gramlot-tab-selected-color: var(--gramlot-action);\n --gramlot-tab-border: var(--gramlot-border);\n --gramlot-shadow: 0 2px 8px rgb(0 0 0 / 10%);\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n color-scheme: dark;\n --gramlot-background: #17201d;\n --gramlot-surface: #202c27;\n --gramlot-header-background: #334d40;\n --gramlot-header-color: #ebf3ee;\n --gramlot-surface-subtle: #2a3932;\n --gramlot-ink: #ebf3ee;\n --gramlot-text-secondary: #b6c9be;\n --gramlot-border: #40594a;\n --gramlot-border-control: #7c9987;\n --gramlot-action: #8ad8c4;\n --gramlot-action-hover: #b0eadc;\n --gramlot-selected: #2d4c40;\n --gramlot-field-background: #202c27;\n --gramlot-field-readonly-background: #2a3932;\n --gramlot-label-color: #b6c9be;\n --gramlot-focus-ring: #8ad8c4;\n --gramlot-brand-blue: #8ad8c4;\n --gramlot-brand-yellow: #8ad8c4;\n --gramlot-navigation: #17201d;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n }\n :root[data-theme=\"dark\"] {\n color-scheme: dark;\n --gramlot-background: #17201d;\n --gramlot-surface: #202c27;\n --gramlot-header-background: #334d40;\n --gramlot-header-color: #ebf3ee;\n --gramlot-surface-subtle: #2a3932;\n --gramlot-ink: #ebf3ee;\n --gramlot-text-secondary: #b6c9be;\n --gramlot-border: #40594a;\n --gramlot-border-control: #7c9987;\n --gramlot-action: #8ad8c4;\n --gramlot-action-hover: #b0eadc;\n --gramlot-selected: #2d4c40;\n --gramlot-field-background: #202c27;\n --gramlot-field-readonly-background: #2a3932;\n --gramlot-label-color: #b6c9be;\n --gramlot-focus-ring: #8ad8c4;\n --gramlot-brand-blue: #8ad8c4;\n --gramlot-brand-yellow: #8ad8c4;\n --gramlot-navigation: #17201d;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n}\n@layer gramlot.base {\n html { font-size: 12.5px; }\n body { line-height: 1.4; }\n :where(h1,h2,h3,h4,h5,h6,p,ul,ol,dl,blockquote,pre,figure) { margin-block: 0 var(--gramlot-space-3); }\n h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }\n :where(h1,h2,h3) { letter-spacing: -.015em; }\n pre { padding: var(--gramlot-space-3); }\n hr { margin-block: var(--gramlot-space-6); }\n}\n@layer gramlot.components {\n :where(button,input[type=\"button\"],input[type=\"submit\"],input[type=\"reset\"],.button) {\n min-block-size: var(--gramlot-field-height); padding: var(--gramlot-button-padding);\n font-size: 1rem; line-height: 1.3; font-weight: 500;\n background: var(--gramlot-button-background); color: var(--gramlot-ink); border-color: var(--gramlot-border-control);\n }\n :where(button,input[type=\"button\"],input[type=\"submit\"],input[type=\"reset\"],.button):hover:not(:disabled) {\n background: var(--gramlot-selected); color: var(--gramlot-action-hover); border-color: var(--gramlot-action);\n }\n :where(label) { font-size: 1em; font-weight: 400; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(input[readonly],textarea[readonly]) { background: var(--gramlot-field-readonly-background); }\n :where(.button--quiet,button.quiet) { background: transparent; color: var(--gramlot-action); border-color: transparent; }\n :where(.button--quiet,button.quiet):hover:not(:disabled) { background: var(--gramlot-selected); border-color: transparent; }\n :where(textarea) { min-block-size: 4.5rem; }\n :where(input[type=\"color\"]) { min-block-size: var(--gramlot-field-height); }\n :where(input[type=\"file\"])::file-selector-button { padding: var(--gramlot-field-padding); }\n :where(fieldset,details) { padding: var(--gramlot-space-3); margin-block-end: var(--gramlot-space-3); }\n :where(table) { font-size: 1rem; }\n :where(th,td) { padding: var(--gramlot-field-padding); height: var(--gramlot-field-height); vertical-align: middle; }\n :where(details[open]>summary) { margin-block-end: var(--gramlot-space-3); }\n :where(dialog) { padding: var(--gramlot-space-4); }\n}\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 2 * var(--gramlot-space-4),var(--gramlot-page-width)); padding-block: var(--gramlot-space-4); }\n .card { padding: var(--gramlot-space-4); box-shadow: none; }\n}\n\n/* Resident Bag grid: shared palette and theme density. */\n:root {\n --gramlot-grid-row-height: 24px;\n --gramlot-grid-header-height: 24px;\n --gramlot-grid-group-height: 20px;\n --gramlot-grid-cell-padding: 2px 6px;\n}\n","joanna":"/* gramlot-compact: professional density profile; load after Base. */\n@layer gramlot.tokens {\n :root {\n color-scheme: light;\n --gramlot-background: #f3f5f7;\n --gramlot-surface: #ffffff;\n --gramlot-header-background: #303946;\n --gramlot-header-color: #ffffff;\n --gramlot-surface-subtle: #e9edf2;\n --gramlot-ink: #202936;\n --gramlot-text-secondary: #526174;\n --gramlot-border: #ccd3dc;\n --gramlot-border-control: #7b899b;\n --gramlot-action: #235db2;\n --gramlot-action-hover: #194987;\n --gramlot-selected: #e3edfb;\n --gramlot-field-background: #ffffff;\n --gramlot-field-readonly-background: #e9edf2;\n --gramlot-label-color: #526174;\n --gramlot-focus-ring: #235db2;\n --gramlot-brand-blue: #235db2;\n --gramlot-brand-yellow: #235db2;\n --gramlot-navigation: #202936;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #aa2637;\n --gramlot-error-background: #fff0f1;\n --gramlot-success: #236747;\n --gramlot-success-background: #e9f4ec;\n --gramlot-warning: #735313;\n --gramlot-warning-background: #fff5da;\n --gramlot-field-height: 28px;\n --gramlot-field-padding: 2px 7px;\n --gramlot-field-line-height: 1.3;\n --gramlot-field-font-size: 1rem;\n --gramlot-button-padding: 2px 7px;\n --gramlot-button-gap: 4px;\n --gramlot-button-background: var(--gramlot-surface);\n --gramlot-button-hover: var(--gramlot-selected);\n --gramlot-label-size: 1em;\n --gramlot-label-gap: 3px;\n --gramlot-radius-sm: 4px;\n --gramlot-radius: 4px;\n --gramlot-radius-lg: 6px;\n --gramlot-window-radius: 6px;\n --gramlot-toolbar-gap: 2px;\n --gramlot-tree-row-height: var(--gramlot-field-height);\n --gramlot-space-1: 3px;\n --gramlot-space-2: 4px;\n --gramlot-space-3: 8px;\n --gramlot-space-4: 8px;\n --gramlot-space-6: 12px;\n --gramlot-space-8: 16px;\n --gramlot-space-12: 24px;\n --gramlot-tab-height: 28px;\n --gramlot-tab-padding: 2px 7px;\n --gramlot-tab-radius: 4px;\n --gramlot-tab-gap: 2px;\n --gramlot-tab-strip-padding: 2px;\n --gramlot-tab-background: var(--gramlot-surface-subtle);\n --gramlot-tab-selected-background: var(--gramlot-surface);\n --gramlot-tab-selected-color: var(--gramlot-action);\n --gramlot-tab-border: var(--gramlot-border);\n --gramlot-shadow: 0 2px 8px rgb(0 0 0 / 10%);\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n color-scheme: dark;\n --gramlot-background: #171c24;\n --gramlot-surface: #222a35;\n --gramlot-header-background: #354152;\n --gramlot-header-color: #edf1f7;\n --gramlot-surface-subtle: #2b3543;\n --gramlot-ink: #edf1f7;\n --gramlot-text-secondary: #b8c4d4;\n --gramlot-border: #435064;\n --gramlot-border-control: #7f90a7;\n --gramlot-action: #9dbff4;\n --gramlot-action-hover: #c1d6ff;\n --gramlot-selected: #314766;\n --gramlot-field-background: #222a35;\n --gramlot-field-readonly-background: #2b3543;\n --gramlot-label-color: #b8c4d4;\n --gramlot-focus-ring: #9dbff4;\n --gramlot-brand-blue: #9dbff4;\n --gramlot-brand-yellow: #9dbff4;\n --gramlot-navigation: #171c24;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n }\n :root[data-theme=\"dark\"] {\n color-scheme: dark;\n --gramlot-background: #171c24;\n --gramlot-surface: #222a35;\n --gramlot-header-background: #354152;\n --gramlot-header-color: #edf1f7;\n --gramlot-surface-subtle: #2b3543;\n --gramlot-ink: #edf1f7;\n --gramlot-text-secondary: #b8c4d4;\n --gramlot-border: #435064;\n --gramlot-border-control: #7f90a7;\n --gramlot-action: #9dbff4;\n --gramlot-action-hover: #c1d6ff;\n --gramlot-selected: #314766;\n --gramlot-field-background: #222a35;\n --gramlot-field-readonly-background: #2b3543;\n --gramlot-label-color: #b8c4d4;\n --gramlot-focus-ring: #9dbff4;\n --gramlot-brand-blue: #9dbff4;\n --gramlot-brand-yellow: #9dbff4;\n --gramlot-navigation: #171c24;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n}\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.4; }\n :where(h1,h2,h3,h4,h5,h6,p,ul,ol,dl,blockquote,pre,figure) { margin-block: 0 var(--gramlot-space-3); }\n h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }\n :where(h1,h2,h3) { letter-spacing: -.015em; }\n pre { padding: var(--gramlot-space-3); }\n hr { margin-block: var(--gramlot-space-6); }\n}\n@layer gramlot.components {\n :where(button,input[type=\"button\"],input[type=\"submit\"],input[type=\"reset\"],.button) {\n min-block-size: var(--gramlot-field-height); padding: var(--gramlot-button-padding);\n font-size: 1rem; line-height: 1.3; font-weight: 500;\n background: var(--gramlot-button-background); color: var(--gramlot-ink); border-color: var(--gramlot-border-control);\n }\n :where(button,input[type=\"button\"],input[type=\"submit\"],input[type=\"reset\"],.button):hover:not(:disabled) {\n background: var(--gramlot-selected); color: var(--gramlot-action-hover); border-color: var(--gramlot-action);\n }\n :where(label) { font-size: 1em; font-weight: 400; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(input[readonly],textarea[readonly]) { background: var(--gramlot-field-readonly-background); }\n :where(.button--quiet,button.quiet) { background: transparent; color: var(--gramlot-action); border-color: transparent; }\n :where(.button--quiet,button.quiet):hover:not(:disabled) { background: var(--gramlot-selected); border-color: transparent; }\n :where(textarea) { min-block-size: 4.5rem; }\n :where(input[type=\"color\"]) { min-block-size: var(--gramlot-field-height); }\n :where(input[type=\"file\"])::file-selector-button { padding: var(--gramlot-field-padding); }\n :where(fieldset,details) { padding: var(--gramlot-space-3); margin-block-end: var(--gramlot-space-3); }\n :where(table) { font-size: 1rem; }\n :where(th,td) { padding: var(--gramlot-field-padding); height: var(--gramlot-field-height); vertical-align: middle; }\n :where(details[open]>summary) { margin-block-end: var(--gramlot-space-3); }\n :where(dialog) { padding: var(--gramlot-space-4); }\n}\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 2 * var(--gramlot-space-4),var(--gramlot-page-width)); padding-block: var(--gramlot-space-4); }\n .card { padding: var(--gramlot-space-4); box-shadow: none; }\n}\n\n/* Resident Bag grid: shared palette and theme density. */\n:root {\n --gramlot-grid-row-height: 32px;\n --gramlot-grid-header-height: 30px;\n --gramlot-grid-group-height: 22px;\n --gramlot-grid-cell-padding: .25rem .65rem;\n}\n\n/* joanna: professional density profile; load after Base and Compact. */\n@layer gramlot.tokens {\n :root {\n color-scheme: light;\n --gramlot-background: #f5f4f2;\n --gramlot-surface: #ffffff;\n --gramlot-header-background: #3f4249;\n --gramlot-header-color: #ffffff;\n --gramlot-surface-subtle: #eeece8;\n --gramlot-ink: #292c31;\n --gramlot-text-secondary: #5d636c;\n --gramlot-border: #d5d2cc;\n --gramlot-border-control: #858990;\n --gramlot-action: #245fb4;\n --gramlot-action-hover: #194880;\n --gramlot-selected: #e6eef9;\n --gramlot-field-background: #ffffff;\n --gramlot-field-readonly-background: #eeece8;\n --gramlot-label-color: #5d636c;\n --gramlot-focus-ring: #245fb4;\n --gramlot-brand-blue: #245fb4;\n --gramlot-brand-yellow: #245fb4;\n --gramlot-navigation: #292c31;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #aa2637;\n --gramlot-error-background: #fff0f1;\n --gramlot-success: #236747;\n --gramlot-success-background: #e9f4ec;\n --gramlot-warning: #735313;\n --gramlot-warning-background: #fff5da;\n --gramlot-field-height: 32px;\n --gramlot-field-padding: 3px 9px;\n --gramlot-field-line-height: 1.3;\n --gramlot-field-font-size: 1rem;\n --gramlot-button-padding: 3px 9px;\n --gramlot-button-gap: 4px;\n --gramlot-button-background: var(--gramlot-surface);\n --gramlot-button-hover: var(--gramlot-selected);\n --gramlot-label-size: 1em;\n --gramlot-label-gap: 3px;\n --gramlot-radius-sm: 6px;\n --gramlot-radius: 6px;\n --gramlot-radius-lg: 8px;\n --gramlot-window-radius: 8px;\n --gramlot-toolbar-gap: 2px;\n --gramlot-tree-row-height: var(--gramlot-field-height);\n --gramlot-space-1: 3px;\n --gramlot-space-2: 5px;\n --gramlot-space-3: 10px;\n --gramlot-space-4: 10px;\n --gramlot-space-6: 15px;\n --gramlot-space-8: 20px;\n --gramlot-space-12: 30px;\n --gramlot-tab-height: 32px;\n --gramlot-tab-padding: 3px 9px;\n --gramlot-tab-radius: 6px;\n --gramlot-tab-gap: 2px;\n --gramlot-tab-strip-padding: 2px;\n --gramlot-tab-background: var(--gramlot-surface-subtle);\n --gramlot-tab-selected-background: var(--gramlot-surface);\n --gramlot-tab-selected-color: var(--gramlot-action);\n --gramlot-tab-border: var(--gramlot-border);\n --gramlot-shadow: 0 2px 8px rgb(0 0 0 / 10%);\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n color-scheme: dark;\n --gramlot-background: #1b1c20;\n --gramlot-surface: #25272c;\n --gramlot-header-background: #41444c;\n --gramlot-header-color: #f3f2ef;\n --gramlot-surface-subtle: #303239;\n --gramlot-ink: #f3f2ef;\n --gramlot-text-secondary: #c4c3c0;\n --gramlot-border: #454951;\n --gramlot-border-control: #858c99;\n --gramlot-action: #abcbff;\n --gramlot-action-hover: #cedfff;\n --gramlot-selected: #324765;\n --gramlot-field-background: #25272c;\n --gramlot-field-readonly-background: #303239;\n --gramlot-label-color: #c4c3c0;\n --gramlot-focus-ring: #abcbff;\n --gramlot-brand-blue: #abcbff;\n --gramlot-brand-yellow: #abcbff;\n --gramlot-navigation: #1b1c20;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n }\n :root[data-theme=\"dark\"] {\n color-scheme: dark;\n --gramlot-background: #1b1c20;\n --gramlot-surface: #25272c;\n --gramlot-header-background: #41444c;\n --gramlot-header-color: #f3f2ef;\n --gramlot-surface-subtle: #303239;\n --gramlot-ink: #f3f2ef;\n --gramlot-text-secondary: #c4c3c0;\n --gramlot-border: #454951;\n --gramlot-border-control: #858c99;\n --gramlot-action: #abcbff;\n --gramlot-action-hover: #cedfff;\n --gramlot-selected: #324765;\n --gramlot-field-background: #25272c;\n --gramlot-field-readonly-background: #303239;\n --gramlot-label-color: #c4c3c0;\n --gramlot-focus-ring: #abcbff;\n --gramlot-brand-blue: #abcbff;\n --gramlot-brand-yellow: #abcbff;\n --gramlot-navigation: #1b1c20;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n}\n@layer gramlot.base {\n html { font-size: 14px; }\n body { line-height: 1.4; }\n :where(h1,h2,h3,h4,h5,h6,p,ul,ol,dl,blockquote,pre,figure) { margin-block: 0 var(--gramlot-space-3); }\n h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }\n :where(h1,h2,h3) { letter-spacing: -.015em; }\n pre { padding: var(--gramlot-space-3); }\n hr { margin-block: var(--gramlot-space-6); }\n}\n@layer gramlot.components {\n :where(button,input[type=\"button\"],input[type=\"submit\"],input[type=\"reset\"],.button) {\n min-block-size: var(--gramlot-field-height); padding: var(--gramlot-button-padding);\n font-size: 1rem; line-height: 1.3; font-weight: 500;\n background: var(--gramlot-button-background); color: var(--gramlot-ink); border-color: var(--gramlot-border-control);\n }\n :where(button,input[type=\"button\"],input[type=\"submit\"],input[type=\"reset\"],.button):hover:not(:disabled) {\n background: var(--gramlot-selected); color: var(--gramlot-action-hover); border-color: var(--gramlot-action);\n }\n :where(label) { font-size: 1em; font-weight: 400; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(input[readonly],textarea[readonly]) { background: var(--gramlot-field-readonly-background); }\n :where(.button--quiet,button.quiet) { background: transparent; color: var(--gramlot-action); border-color: transparent; }\n :where(.button--quiet,button.quiet):hover:not(:disabled) { background: var(--gramlot-selected); border-color: transparent; }\n :where(textarea) { min-block-size: 4.5rem; }\n :where(input[type=\"color\"]) { min-block-size: var(--gramlot-field-height); }\n :where(input[type=\"file\"])::file-selector-button { padding: var(--gramlot-field-padding); }\n :where(fieldset,details) { padding: var(--gramlot-space-3); margin-block-end: var(--gramlot-space-3); }\n :where(table) { font-size: 1rem; }\n :where(th,td) { padding: var(--gramlot-field-padding); height: var(--gramlot-field-height); vertical-align: middle; }\n :where(details[open]>summary) { margin-block-end: var(--gramlot-space-3); }\n :where(dialog) { padding: var(--gramlot-space-4); }\n}\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 2 * var(--gramlot-space-4),var(--gramlot-page-width)); padding-block: var(--gramlot-space-4); }\n .card { padding: var(--gramlot-space-4); box-shadow: none; }\n}\n\n/* Resident Bag grid: shared palette and theme density. */\n:root {\n --gramlot-grid-row-height: 26px;\n --gramlot-grid-header-height: 26px;\n --gramlot-grid-group-height: 22px;\n --gramlot-grid-cell-padding: 3px 8px;\n}\n","mela":"/* gramlot-compact: professional density profile; load after Base. */\n@layer gramlot.tokens {\n :root {\n color-scheme: light;\n --gramlot-background: #f3f5f7;\n --gramlot-surface: #ffffff;\n --gramlot-header-background: #303946;\n --gramlot-header-color: #ffffff;\n --gramlot-surface-subtle: #e9edf2;\n --gramlot-ink: #202936;\n --gramlot-text-secondary: #526174;\n --gramlot-border: #ccd3dc;\n --gramlot-border-control: #7b899b;\n --gramlot-action: #235db2;\n --gramlot-action-hover: #194987;\n --gramlot-selected: #e3edfb;\n --gramlot-field-background: #ffffff;\n --gramlot-field-readonly-background: #e9edf2;\n --gramlot-label-color: #526174;\n --gramlot-focus-ring: #235db2;\n --gramlot-brand-blue: #235db2;\n --gramlot-brand-yellow: #235db2;\n --gramlot-navigation: #202936;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #aa2637;\n --gramlot-error-background: #fff0f1;\n --gramlot-success: #236747;\n --gramlot-success-background: #e9f4ec;\n --gramlot-warning: #735313;\n --gramlot-warning-background: #fff5da;\n --gramlot-field-height: 28px;\n --gramlot-field-padding: 2px 7px;\n --gramlot-field-line-height: 1.3;\n --gramlot-field-font-size: 1rem;\n --gramlot-button-padding: 2px 7px;\n --gramlot-button-gap: 4px;\n --gramlot-button-background: var(--gramlot-surface);\n --gramlot-button-hover: var(--gramlot-selected);\n --gramlot-label-size: 1em;\n --gramlot-label-gap: 3px;\n --gramlot-radius-sm: 4px;\n --gramlot-radius: 4px;\n --gramlot-radius-lg: 6px;\n --gramlot-window-radius: 6px;\n --gramlot-toolbar-gap: 2px;\n --gramlot-tree-row-height: var(--gramlot-field-height);\n --gramlot-space-1: 3px;\n --gramlot-space-2: 4px;\n --gramlot-space-3: 8px;\n --gramlot-space-4: 8px;\n --gramlot-space-6: 12px;\n --gramlot-space-8: 16px;\n --gramlot-space-12: 24px;\n --gramlot-tab-height: 28px;\n --gramlot-tab-padding: 2px 7px;\n --gramlot-tab-radius: 4px;\n --gramlot-tab-gap: 2px;\n --gramlot-tab-strip-padding: 2px;\n --gramlot-tab-background: var(--gramlot-surface-subtle);\n --gramlot-tab-selected-background: var(--gramlot-surface);\n --gramlot-tab-selected-color: var(--gramlot-action);\n --gramlot-tab-border: var(--gramlot-border);\n --gramlot-shadow: 0 2px 8px rgb(0 0 0 / 10%);\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n color-scheme: dark;\n --gramlot-background: #171c24;\n --gramlot-surface: #222a35;\n --gramlot-header-background: #354152;\n --gramlot-header-color: #edf1f7;\n --gramlot-surface-subtle: #2b3543;\n --gramlot-ink: #edf1f7;\n --gramlot-text-secondary: #b8c4d4;\n --gramlot-border: #435064;\n --gramlot-border-control: #7f90a7;\n --gramlot-action: #9dbff4;\n --gramlot-action-hover: #c1d6ff;\n --gramlot-selected: #314766;\n --gramlot-field-background: #222a35;\n --gramlot-field-readonly-background: #2b3543;\n --gramlot-label-color: #b8c4d4;\n --gramlot-focus-ring: #9dbff4;\n --gramlot-brand-blue: #9dbff4;\n --gramlot-brand-yellow: #9dbff4;\n --gramlot-navigation: #171c24;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n }\n :root[data-theme=\"dark\"] {\n color-scheme: dark;\n --gramlot-background: #171c24;\n --gramlot-surface: #222a35;\n --gramlot-header-background: #354152;\n --gramlot-header-color: #edf1f7;\n --gramlot-surface-subtle: #2b3543;\n --gramlot-ink: #edf1f7;\n --gramlot-text-secondary: #b8c4d4;\n --gramlot-border: #435064;\n --gramlot-border-control: #7f90a7;\n --gramlot-action: #9dbff4;\n --gramlot-action-hover: #c1d6ff;\n --gramlot-selected: #314766;\n --gramlot-field-background: #222a35;\n --gramlot-field-readonly-background: #2b3543;\n --gramlot-label-color: #b8c4d4;\n --gramlot-focus-ring: #9dbff4;\n --gramlot-brand-blue: #9dbff4;\n --gramlot-brand-yellow: #9dbff4;\n --gramlot-navigation: #171c24;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n}\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.4; }\n :where(h1,h2,h3,h4,h5,h6,p,ul,ol,dl,blockquote,pre,figure) { margin-block: 0 var(--gramlot-space-3); }\n h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }\n :where(h1,h2,h3) { letter-spacing: -.015em; }\n pre { padding: var(--gramlot-space-3); }\n hr { margin-block: var(--gramlot-space-6); }\n}\n@layer gramlot.components {\n :where(button,input[type=\"button\"],input[type=\"submit\"],input[type=\"reset\"],.button) {\n min-block-size: var(--gramlot-field-height); padding: var(--gramlot-button-padding);\n font-size: 1rem; line-height: 1.3; font-weight: 500;\n background: var(--gramlot-button-background); color: var(--gramlot-ink); border-color: var(--gramlot-border-control);\n }\n :where(button,input[type=\"button\"],input[type=\"submit\"],input[type=\"reset\"],.button):hover:not(:disabled) {\n background: var(--gramlot-selected); color: var(--gramlot-action-hover); border-color: var(--gramlot-action);\n }\n :where(label) { font-size: 1em; font-weight: 400; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(input[readonly],textarea[readonly]) { background: var(--gramlot-field-readonly-background); }\n :where(.button--quiet,button.quiet) { background: transparent; color: var(--gramlot-action); border-color: transparent; }\n :where(.button--quiet,button.quiet):hover:not(:disabled) { background: var(--gramlot-selected); border-color: transparent; }\n :where(textarea) { min-block-size: 4.5rem; }\n :where(input[type=\"color\"]) { min-block-size: var(--gramlot-field-height); }\n :where(input[type=\"file\"])::file-selector-button { padding: var(--gramlot-field-padding); }\n :where(fieldset,details) { padding: var(--gramlot-space-3); margin-block-end: var(--gramlot-space-3); }\n :where(table) { font-size: 1rem; }\n :where(th,td) { padding: var(--gramlot-field-padding); height: var(--gramlot-field-height); vertical-align: middle; }\n :where(details[open]>summary) { margin-block-end: var(--gramlot-space-3); }\n :where(dialog) { padding: var(--gramlot-space-4); }\n}\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 2 * var(--gramlot-space-4),var(--gramlot-page-width)); padding-block: var(--gramlot-space-4); }\n .card { padding: var(--gramlot-space-4); box-shadow: none; }\n}\n\n/* Resident Bag grid: shared palette and theme density. */\n:root {\n --gramlot-grid-row-height: 32px;\n --gramlot-grid-header-height: 30px;\n --gramlot-grid-group-height: 22px;\n --gramlot-grid-cell-padding: .25rem .65rem;\n}\n\n/* Mela: Apple-inspired desktop and touch appearance; load after Base and Compact. */\n@layer gramlot.tokens {\n :root {\n color-scheme: light;\n --gramlot-font-ui: -apple-system, BlinkMacSystemFont, \"Helvetica Neue\", system-ui, sans-serif;\n --gramlot-font-code: ui-monospace, SFMono-Regular, Menlo, monospace;\n --gramlot-tree-hover-background: var(--gramlot-surface-subtle);\n --gramlot-tree-selected-background: var(--gramlot-selected);\n --gramlot-tree-selected-color: var(--gramlot-ink);\n --gramlot-window-backdrop: rgb(0 0 0 / 24%);\n --gramlot-background: #f2f2f7;\n --gramlot-surface: #ffffff;\n --gramlot-header-background: #38383d;\n --gramlot-header-color: #ffffff;\n --gramlot-surface-subtle: #eaeaed;\n --gramlot-ink: #1d1d1f;\n --gramlot-text-secondary: #636366;\n --gramlot-border: #d9d9de;\n --gramlot-border-control: #8a8a8e;\n --gramlot-action: #0066cc;\n --gramlot-action-hover: #004c99;\n --gramlot-selected: #dceaff;\n --gramlot-field-background: #ffffff;\n --gramlot-field-readonly-background: #eaeaed;\n --gramlot-label-color: #636366;\n --gramlot-focus-ring: #0066cc;\n --gramlot-brand-blue: #0066cc;\n --gramlot-brand-yellow: #0066cc;\n --gramlot-navigation: #eaeaed;\n --gramlot-navigation-text: #1d1d1f;\n --gramlot-error: #b42318;\n --gramlot-error-background: #fff0ee;\n --gramlot-success: #20783d;\n --gramlot-success-background: #eaf7ed;\n --gramlot-warning: #805500;\n --gramlot-warning-background: #fff5dc;\n --gramlot-field-height: 28px;\n --gramlot-field-padding: 3px 8px;\n --gramlot-field-line-height: 1.3;\n --gramlot-field-font-size: 1rem;\n --gramlot-button-padding: 3px 9px;\n --gramlot-button-gap: 4px;\n --gramlot-button-background: #0066cc;\n --gramlot-button-color: #ffffff;\n --gramlot-chrome-background: var(--gramlot-surface);\n --gramlot-button-hover: #004c99;\n --gramlot-label-size: 1em;\n --gramlot-label-gap: 4px;\n --gramlot-radius-sm: 6px;\n --gramlot-radius: 8px;\n --gramlot-radius-lg: 10px;\n --gramlot-window-radius: 12px;\n --gramlot-toolbar-gap: 3px;\n --gramlot-tree-row-height: var(--gramlot-field-height);\n --gramlot-space-1: 3px;\n --gramlot-space-2: 4px;\n --gramlot-space-3: 8px;\n --gramlot-space-4: 12px;\n --gramlot-space-6: 16px;\n --gramlot-space-8: 20px;\n --gramlot-space-12: 28px;\n --gramlot-tab-height: 28px;\n --gramlot-tab-padding: 3px 10px;\n --gramlot-tab-radius: 6px;\n --gramlot-tab-gap: 3px;\n --gramlot-tab-strip-padding: 3px;\n --gramlot-tab-background: var(--gramlot-surface-subtle);\n --gramlot-tab-selected-background: var(--gramlot-surface);\n --gramlot-tab-selected-color: var(--gramlot-action);\n --gramlot-tab-border: var(--gramlot-border);\n --gramlot-shadow: 0 8px 28px rgb(0 0 0 / 16%);\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n color-scheme: dark;\n --gramlot-background: #000000;\n --gramlot-surface: #1c1c1e;\n --gramlot-header-background: #323236;\n --gramlot-header-color: #f5f5f7;\n --gramlot-surface-subtle: #38383a;\n --gramlot-ink: #f5f5f7;\n --gramlot-text-secondary: #bdbdc4;\n --gramlot-border: #48484c;\n --gramlot-border-control: #74747c;\n --gramlot-action: #70b7ff;\n --gramlot-action-hover: #abd5ff;\n --gramlot-selected: #244367;\n --gramlot-field-background: #1c1c1e;\n --gramlot-field-readonly-background: #38383a;\n --gramlot-label-color: #bdbdc4;\n --gramlot-focus-ring: #70b7ff;\n --gramlot-brand-blue: #70b7ff;\n --gramlot-brand-yellow: #70b7ff;\n --gramlot-navigation: #1c1c1e;\n --gramlot-navigation-text: #f5f5f7;\n --gramlot-error: #ffb4ab;\n --gramlot-error-background: #492926;\n --gramlot-success: #8ddb9d;\n --gramlot-success-background: #263e2c;\n --gramlot-warning: #f5d581;\n --gramlot-warning-background: #433a26;\n }\n }\n :root[data-theme=\"dark\"] {\n color-scheme: dark;\n --gramlot-background: #000000;\n --gramlot-surface: #1c1c1e;\n --gramlot-header-background: #323236;\n --gramlot-header-color: #f5f5f7;\n --gramlot-surface-subtle: #38383a;\n --gramlot-ink: #f5f5f7;\n --gramlot-text-secondary: #bdbdc4;\n --gramlot-border: #48484c;\n --gramlot-border-control: #74747c;\n --gramlot-action: #70b7ff;\n --gramlot-action-hover: #abd5ff;\n --gramlot-selected: #244367;\n --gramlot-field-background: #1c1c1e;\n --gramlot-field-readonly-background: #38383a;\n --gramlot-label-color: #bdbdc4;\n --gramlot-focus-ring: #70b7ff;\n --gramlot-brand-blue: #70b7ff;\n --gramlot-brand-yellow: #70b7ff;\n --gramlot-navigation: #1c1c1e;\n --gramlot-navigation-text: #f5f5f7;\n --gramlot-error: #ffb4ab;\n --gramlot-error-background: #492926;\n --gramlot-success: #8ddb9d;\n --gramlot-success-background: #263e2c;\n --gramlot-warning: #f5d581;\n --gramlot-warning-background: #433a26;\n }\n}\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.4; }\n :where(h1,h2,h3,h4,h5,h6,p,ul,ol,dl,blockquote,pre,figure) { margin-block: 0 var(--gramlot-space-3); }\n h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }\n :where(h1,h2,h3) { letter-spacing: -.015em; }\n pre { padding: var(--gramlot-space-3); }\n hr { margin-block: var(--gramlot-space-6); }\n}\n@layer gramlot.components {\n :where(button,input[type=\"button\"],input[type=\"submit\"],input[type=\"reset\"],.button) {\n min-block-size: var(--gramlot-field-height); padding: var(--gramlot-button-padding);\n font-size: 1rem; line-height: 1.3; font-weight: 500;\n background: var(--gramlot-button-background); color: #ffffff; border-color: transparent;\n }\n :where(button,input[type=\"button\"],input[type=\"submit\"],input[type=\"reset\"],.button):hover:not(:disabled) {\n background: #004c99; color: #ffffff; border-color: transparent;\n }\n gramlot-button.button--secondary,gramlot-toggle-button.button--secondary,gramlot-drop-down-button.button--secondary { background:transparent; border-color:transparent; }\n :where(.button--secondary,button.secondary) { background:var(--gramlot-selected); color:var(--gramlot-action); border-color:transparent; }\n :where(.button--secondary,button.secondary):hover:not(:disabled) { background:var(--gramlot-selected); color:var(--gramlot-action-hover); border-color:var(--gramlot-action); }\n :where(button,.button):active:not(:disabled) { transform:none; filter:brightness(.9); }\n :where(label) { font-size: 1em; font-weight: 400; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(input[readonly],textarea[readonly]) { background: var(--gramlot-field-readonly-background); }\n :where(.button--quiet,button.quiet) { background: transparent; color: var(--gramlot-action); border-color: transparent; }\n :where(.button--quiet,button.quiet):hover:not(:disabled) { background: var(--gramlot-selected); border-color: transparent; }\n :where(textarea) { min-block-size: 4.5rem; }\n :where(input[type=\"color\"]) { min-block-size: var(--gramlot-field-height); }\n :where(input[type=\"file\"])::file-selector-button { padding: var(--gramlot-field-padding); }\n :where(fieldset,details) { padding: var(--gramlot-space-3); margin-block-end: var(--gramlot-space-3); }\n :where(table) { font-size: 1rem; }\n :where(th,td) { padding: var(--gramlot-field-padding); height: var(--gramlot-field-height); vertical-align: middle; }\n :where(details[open]>summary) { margin-block-end: var(--gramlot-space-3); }\n :where(dialog) { padding: var(--gramlot-space-4); }\n}\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 2 * var(--gramlot-space-4),var(--gramlot-page-width)); padding-block: var(--gramlot-space-4); }\n .card { padding: var(--gramlot-space-4); box-shadow: none; }\n}\n\n/* Responsive density changes appearance only; Source owns layout and modality. */\n@layer gramlot.tokens {\n @media (max-width: 640px), (pointer: coarse) {\n :root {\n --gramlot-field-height: 44px;\n --gramlot-touch-target: 44px;\n --gramlot-field-font-size: 16px;\n --gramlot-field-padding: 8px 12px;\n --gramlot-button-padding: 8px 12px;\n --gramlot-tab-height: 44px;\n --gramlot-radius-sm: 9px;\n --gramlot-radius: 12px;\n --gramlot-radius-lg: 14px;\n --gramlot-window-radius: 16px;\n --gramlot-space-4: 16px;\n }\n }\n}\n@layer gramlot.base {\n @media (max-width: 640px), (pointer: coarse) {\n html { font-size: 17px; }\n @supports (font: -apple-system-body) { html { font: -apple-system-body; } }\n body { line-height:1.4; }\n h1 { font-size:2rem; font-weight:700; letter-spacing:-.025em; }\n h2 { font-size:1.3rem; font-weight:650; }\n h3 { font-size:1.05rem; font-weight:600; }\n }\n}\n\n/* Touch presentation follows the existing density setting; minimums grow with text. */\n@layer gramlot.touch {\n @media (max-width:640px), (pointer:coarse) {\n :root:not([data-gramlot-touch=\"off\"]) {\n --gramlot-field-height:max(44px,2.65rem); --gramlot-field-font-size:max(16px,1rem);\n --gramlot-field-padding:.55rem .75rem; --gramlot-button-padding:.6rem 1rem;\n --gramlot-label-size:.88rem; --gramlot-label-gap:.4rem;\n --gramlot-tree-row-height:max(44px,2.65rem); --gramlot-tab-height:max(44px,2.65rem);\n }\n :where(button,.button,summary,[role=\"tab\"],a) { min-block-size:44px; }\n :where(nav a,.actions a) { display:inline-flex; align-items:center; }\n :where(label:has(input[type=\"checkbox\"]),label:has(input[type=\"radio\"])) { min-block-size:44px; display:inline-flex; align-items:center; gap:.6rem; }\n }\n}\n/* Content stays opaque. Materials are confined to navigation controls. */\n@layer gramlot.components {\n :where([role=\"toolbar\"]) { --gramlot-button-padding:4px 6px; background:var(--gramlot-surface); color:var(--gramlot-ink); }\n @supports (backdrop-filter:blur(16px)) {\n :where([role=\"toolbar\"]) { background:color-mix(in srgb,var(--gramlot-surface) 92%,transparent); backdrop-filter:blur(16px) saturate(1.2); }\n }\n @media (prefers-reduced-transparency:reduce), (prefers-contrast:more) {\n :where([role=\"toolbar\"]) { background:var(--gramlot-surface); backdrop-filter:none; }\n }\n @media (prefers-contrast:more) {\n :where(input,select,textarea,button,.button) { border:2px solid currentColor; }\n :where(a) { text-decoration:underline; }\n }\n @media (prefers-reduced-motion:reduce) {\n :where(button,.button) { transition:none; transform:none; }\n }\n @media (forced-colors:active) {\n :where(button,.button) { background:ButtonFace; color:ButtonText; border-color:ButtonText; filter:none; }\n :where([role=\"toolbar\"]) { background:Canvas; color:CanvasText; backdrop-filter:none; }\n }\n}\n"};
3
+ export const paletteStyles = {"default":"","compact":"/* Color-only override: load after the chosen appearance profile. */\n@layer gramlot.tokens {\n :root {\n color-scheme: light;\n --gramlot-background: #f3f5f7;\n --gramlot-surface: #ffffff;\n --gramlot-header-background: #303946;\n --gramlot-header-color: #ffffff;\n --gramlot-surface-subtle: #e9edf2;\n --gramlot-ink: #202936;\n --gramlot-text-secondary: #526174;\n --gramlot-border: #ccd3dc;\n --gramlot-border-control: #7b899b;\n --gramlot-action: #235db2;\n --gramlot-action-hover: #194987;\n --gramlot-selected: #e3edfb;\n --gramlot-field-background: #ffffff;\n --gramlot-field-readonly-background: #e9edf2;\n --gramlot-label-color: #526174;\n --gramlot-focus-ring: #235db2;\n --gramlot-brand-blue: #235db2;\n --gramlot-brand-yellow: #235db2;\n --gramlot-navigation: #202936;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #aa2637;\n --gramlot-error-background: #fff0f1;\n --gramlot-success: #236747;\n --gramlot-success-background: #e9f4ec;\n --gramlot-warning: #735313;\n --gramlot-warning-background: #fff5da;\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n color-scheme: dark;\n --gramlot-background: #171c24;\n --gramlot-surface: #222a35;\n --gramlot-header-background: #354152;\n --gramlot-header-color: #edf1f7;\n --gramlot-surface-subtle: #2b3543;\n --gramlot-ink: #edf1f7;\n --gramlot-text-secondary: #b8c4d4;\n --gramlot-border: #435064;\n --gramlot-border-control: #7f90a7;\n --gramlot-action: #9dbff4;\n --gramlot-action-hover: #c1d6ff;\n --gramlot-selected: #314766;\n --gramlot-field-background: #222a35;\n --gramlot-field-readonly-background: #2b3543;\n --gramlot-label-color: #b8c4d4;\n --gramlot-focus-ring: #9dbff4;\n --gramlot-brand-blue: #9dbff4;\n --gramlot-brand-yellow: #9dbff4;\n --gramlot-navigation: #171c24;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n }\n :root[data-theme=\"dark\"] {\n color-scheme: dark;\n --gramlot-background: #171c24;\n --gramlot-surface: #222a35;\n --gramlot-header-background: #354152;\n --gramlot-header-color: #edf1f7;\n --gramlot-surface-subtle: #2b3543;\n --gramlot-ink: #edf1f7;\n --gramlot-text-secondary: #b8c4d4;\n --gramlot-border: #435064;\n --gramlot-border-control: #7f90a7;\n --gramlot-action: #9dbff4;\n --gramlot-action-hover: #c1d6ff;\n --gramlot-selected: #314766;\n --gramlot-field-background: #222a35;\n --gramlot-field-readonly-background: #2b3543;\n --gramlot-label-color: #b8c4d4;\n --gramlot-focus-ring: #9dbff4;\n --gramlot-brand-blue: #9dbff4;\n --gramlot-brand-yellow: #9dbff4;\n --gramlot-navigation: #171c24;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n}\n","mimi":"/* Color-only override: load after the chosen appearance profile. */\n@layer gramlot.tokens {\n :root {\n color-scheme: light;\n --gramlot-background: #edf1ef;\n --gramlot-surface: #fbfcfb;\n --gramlot-header-background: #30473c;\n --gramlot-header-color: #fbfcfb;\n --gramlot-surface-subtle: #e2e9e5;\n --gramlot-ink: #24332e;\n --gramlot-text-secondary: #52655d;\n --gramlot-border: #c4d0c9;\n --gramlot-border-control: #768a7e;\n --gramlot-action: #176b61;\n --gramlot-action-hover: #105247;\n --gramlot-selected: #dceee8;\n --gramlot-field-background: #fbfcfb;\n --gramlot-field-readonly-background: #e2e9e5;\n --gramlot-label-color: #52655d;\n --gramlot-focus-ring: #176b61;\n --gramlot-brand-blue: #176b61;\n --gramlot-brand-yellow: #176b61;\n --gramlot-navigation: #24332e;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #aa2637;\n --gramlot-error-background: #fff0f1;\n --gramlot-success: #236747;\n --gramlot-success-background: #e9f4ec;\n --gramlot-warning: #735313;\n --gramlot-warning-background: #fff5da;\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n color-scheme: dark;\n --gramlot-background: #17201d;\n --gramlot-surface: #202c27;\n --gramlot-header-background: #334d40;\n --gramlot-header-color: #ebf3ee;\n --gramlot-surface-subtle: #2a3932;\n --gramlot-ink: #ebf3ee;\n --gramlot-text-secondary: #b6c9be;\n --gramlot-border: #40594a;\n --gramlot-border-control: #7c9987;\n --gramlot-action: #8ad8c4;\n --gramlot-action-hover: #b0eadc;\n --gramlot-selected: #2d4c40;\n --gramlot-field-background: #202c27;\n --gramlot-field-readonly-background: #2a3932;\n --gramlot-label-color: #b6c9be;\n --gramlot-focus-ring: #8ad8c4;\n --gramlot-brand-blue: #8ad8c4;\n --gramlot-brand-yellow: #8ad8c4;\n --gramlot-navigation: #17201d;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n }\n :root[data-theme=\"dark\"] {\n color-scheme: dark;\n --gramlot-background: #17201d;\n --gramlot-surface: #202c27;\n --gramlot-header-background: #334d40;\n --gramlot-header-color: #ebf3ee;\n --gramlot-surface-subtle: #2a3932;\n --gramlot-ink: #ebf3ee;\n --gramlot-text-secondary: #b6c9be;\n --gramlot-border: #40594a;\n --gramlot-border-control: #7c9987;\n --gramlot-action: #8ad8c4;\n --gramlot-action-hover: #b0eadc;\n --gramlot-selected: #2d4c40;\n --gramlot-field-background: #202c27;\n --gramlot-field-readonly-background: #2a3932;\n --gramlot-label-color: #b6c9be;\n --gramlot-focus-ring: #8ad8c4;\n --gramlot-brand-blue: #8ad8c4;\n --gramlot-brand-yellow: #8ad8c4;\n --gramlot-navigation: #17201d;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n}\n","joanna":"/* Color-only override: load after the chosen appearance profile. */\n@layer gramlot.tokens {\n :root {\n color-scheme: light;\n --gramlot-background: #f5f4f2;\n --gramlot-surface: #ffffff;\n --gramlot-header-background: #3f4249;\n --gramlot-header-color: #ffffff;\n --gramlot-surface-subtle: #eeece8;\n --gramlot-ink: #292c31;\n --gramlot-text-secondary: #5d636c;\n --gramlot-border: #d5d2cc;\n --gramlot-border-control: #858990;\n --gramlot-action: #245fb4;\n --gramlot-action-hover: #194880;\n --gramlot-selected: #e6eef9;\n --gramlot-field-background: #ffffff;\n --gramlot-field-readonly-background: #eeece8;\n --gramlot-label-color: #5d636c;\n --gramlot-focus-ring: #245fb4;\n --gramlot-brand-blue: #245fb4;\n --gramlot-brand-yellow: #245fb4;\n --gramlot-navigation: #292c31;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #aa2637;\n --gramlot-error-background: #fff0f1;\n --gramlot-success: #236747;\n --gramlot-success-background: #e9f4ec;\n --gramlot-warning: #735313;\n --gramlot-warning-background: #fff5da;\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n color-scheme: dark;\n --gramlot-background: #1b1c20;\n --gramlot-surface: #25272c;\n --gramlot-header-background: #41444c;\n --gramlot-header-color: #f3f2ef;\n --gramlot-surface-subtle: #303239;\n --gramlot-ink: #f3f2ef;\n --gramlot-text-secondary: #c4c3c0;\n --gramlot-border: #454951;\n --gramlot-border-control: #858c99;\n --gramlot-action: #abcbff;\n --gramlot-action-hover: #cedfff;\n --gramlot-selected: #324765;\n --gramlot-field-background: #25272c;\n --gramlot-field-readonly-background: #303239;\n --gramlot-label-color: #c4c3c0;\n --gramlot-focus-ring: #abcbff;\n --gramlot-brand-blue: #abcbff;\n --gramlot-brand-yellow: #abcbff;\n --gramlot-navigation: #1b1c20;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n }\n :root[data-theme=\"dark\"] {\n color-scheme: dark;\n --gramlot-background: #1b1c20;\n --gramlot-surface: #25272c;\n --gramlot-header-background: #41444c;\n --gramlot-header-color: #f3f2ef;\n --gramlot-surface-subtle: #303239;\n --gramlot-ink: #f3f2ef;\n --gramlot-text-secondary: #c4c3c0;\n --gramlot-border: #454951;\n --gramlot-border-control: #858c99;\n --gramlot-action: #abcbff;\n --gramlot-action-hover: #cedfff;\n --gramlot-selected: #324765;\n --gramlot-field-background: #25272c;\n --gramlot-field-readonly-background: #303239;\n --gramlot-label-color: #c4c3c0;\n --gramlot-focus-ring: #abcbff;\n --gramlot-brand-blue: #abcbff;\n --gramlot-brand-yellow: #abcbff;\n --gramlot-navigation: #1b1c20;\n --gramlot-navigation-text: #f6f8fb;\n --gramlot-error: #ffb4b4;\n --gramlot-error-background: #48292f;\n --gramlot-success: #98dfbd;\n --gramlot-success-background: #243f32;\n --gramlot-warning: #f3d58c;\n --gramlot-warning-background: #413820;\n }\n}\n"};
package/src/index.d.ts CHANGED
@@ -20,6 +20,8 @@ export {GramlotRenderer} from './renderer/gramlot-renderer.js';
20
20
  export {GramlotHtmlRenderer} from './renderer/gramlot-html-renderer.js';
21
21
  export {GramlotSvgRenderer} from './renderer/gramlot-svg-renderer.js';
22
22
  export {Bag, BagNode} from '@genrojs/bag';
23
+ export {default as createDOMPurify} from 'dompurify';
24
+ export {loadMarkdown} from './markdown-loader.js';
23
25
  export {createDecimal, toTytx, fromTytx, fromTytxIter} from '@genrojs/tytx';
24
26
  export {References} from './references.js';
25
27
  export type {SourceReference} from './references.js';
@@ -49,8 +51,19 @@ export type {CommandDefinition,CommandGroupMetadata} from './commands.js';
49
51
  export {collectionBuildId, verifyCollectionArtifact} from './collection-artifact.js';
50
52
 
51
53
  export {DeviceHandler} from './handlers/device-handler.js';
54
+ export {BrowserCameraProvider} from './browser-camera-provider.js';
52
55
  export type {DeviceProvider, DeviceClipboard, DeviceName, DeviceAudio, DeviceAudioSession, DeviceNetwork, DeviceLifecycleEvent, DeviceHapticStyle, AppInfo, DeviceLocation, DevicePhoto, DeviceBarcode, DeviceBiometrics, DeviceNotificationRequest, DeviceNotificationSchedule, DeviceNotificationEvent, DevicePushRegistration, DevicePushEvent, DeviceShortcutRequest, DeviceLinkRequest} from './handlers/device-handler.js';
53
56
 
54
57
  export {MobileEnvironment} from './mobile-environment.js';
55
58
 
56
59
  export {chatRender, chatSend, chatCompleted, chatReset, chatResize, chatPickAttachments, chatRenderAttachments, chatRemoveAttachment} from './chat.js';
60
+
61
+ // Preserve fluent Source identity across separately prepared collection bundles.
62
+ export {sourceTarget} from '@genrojs/builders';
63
+ export {TreeStore, TreeStoreResolver, TreeStoreLogic} from './tree-store.js';
64
+ export {UploadTarget} from './server/upload.js';
65
+
66
+ export {VisualEditorLogic, visualEditorScope} from './visual-editor.js';
67
+ export {VisualEditor} from './server/visual-editor.js';
68
+ export {SourceImport} from './server/source-import.js';
69
+ export {SourcePicker} from './source-picker.js';
package/src/index.js CHANGED
@@ -20,6 +20,8 @@ export {GramlotRenderer} from './renderer/gramlot-renderer.js';
20
20
  export {GramlotHtmlRenderer} from './renderer/gramlot-html-renderer.js';
21
21
  export {GramlotSvgRenderer} from './renderer/gramlot-svg-renderer.js';
22
22
  export {Bag, BagNode} from '@genrojs/bag';
23
+ export {default as createDOMPurify} from 'dompurify';
24
+ export {loadMarkdown} from './markdown-loader.js';
23
25
  // createDecimal and Bag are the typed literals of a page module, as in server/page.js: the import map of the browser
24
26
  // resolves @gramlot/gramlot/page to this entry only.
25
27
  export {createDecimal, toTytx, fromTytx, fromTytxIter} from '@genrojs/tytx';
@@ -44,7 +46,18 @@ export * from './components/index.js';
44
46
  export {collectionBuildId, verifyCollectionArtifact} from './collection-artifact.js';
45
47
 
46
48
  export {DeviceHandler} from './handlers/device-handler.js';
49
+ export {BrowserCameraProvider} from './browser-camera-provider.js';
47
50
 
48
51
  export {MobileEnvironment} from './mobile-environment.js';
49
52
 
50
53
  export {chatRender, chatSend, chatCompleted, chatReset, chatResize, chatPickAttachments, chatRenderAttachments, chatRemoveAttachment} from './chat.js';
54
+
55
+ // Preserve fluent Source identity across separately prepared collection bundles.
56
+ export {sourceTarget} from '@genrojs/builders';
57
+ export {TreeStore, TreeStoreResolver, TreeStoreLogic} from './tree-store.js';
58
+ export {UploadTarget} from './server/upload.js';
59
+
60
+ export {VisualEditorLogic, visualEditorScope} from './visual-editor.js';
61
+ export {VisualEditor} from './server/visual-editor.js';
62
+ export {SourceImport} from './server/source-import.js';
63
+ export {SourcePicker} from './source-picker.js';
package/src/inout.d.ts CHANGED
@@ -38,6 +38,8 @@ export class InOut {
38
38
  restore(path: string): Promise<Bag>;
39
39
  /** Export the data at `path` as `'json'` or `'xml'`; types become text. */
40
40
  download(path: string, filename: string, format: 'json' | 'xml'): void;
41
+ /** Copy exact text to the browser clipboard. Requires browser permission; failures reject. */
42
+ copyText(text: string): Promise<void>;
41
43
  /** Hand `text` to the browser as a file named `filename`. */
42
44
  saveText(text: string, filename: string, type: string): void;
43
45
  /** Follow `url` through a link, as a download when `filename` is given. */
package/src/inout.js CHANGED
@@ -122,6 +122,12 @@ export class InOut {
122
122
  }
123
123
  }
124
124
 
125
+ /** Copy exact text through the browser clipboard; permission failures reject. */
126
+ async copyText(text) {
127
+ if (typeof text !== 'string') throw new TypeError('gramlot.utl.inout.copyText: text must be a string');
128
+ await this.document.defaultView.navigator.clipboard.writeText(text);
129
+ }
130
+
125
131
  /** Hand text to the browser as a file named filename. */
126
132
  saveText(text, filename, type) {
127
133
  const window = this.document.defaultView;
@@ -0,0 +1 @@
1
+ export function loadMarkdown(): Promise<typeof import('markdown-it')>;
@@ -0,0 +1,4 @@
1
+ /** Native module caching shares the code; it does not share mutable parser options. */
2
+ export function loadMarkdown() {
3
+ return import('@gramlot/gramlot/markdown');
4
+ }
@@ -0,0 +1 @@
1
+ export {default} from 'markdown-it';
@@ -0,0 +1,2 @@
1
+ /** Optional parser library. Consumers own their parser instances and policies. */
2
+ export {default} from 'markdown-it';
@@ -0,0 +1,9 @@
1
+ /** Draw one decoded media frame for image acquisition. */
2
+ export function captureVideoFrame(document, video) {
3
+ if (!video.videoWidth || !video.videoHeight) throw new Error('Video image is not ready');
4
+ const canvas = document.createElement('canvas'); canvas.width = video.videoWidth; canvas.height = video.videoHeight;
5
+ const context = canvas.getContext('2d');
6
+ if (!context) throw new Error('Video image is unavailable');
7
+ context.drawImage(video, 0, 0);
8
+ return canvas;
9
+ }
@@ -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', '_onCalling', 'onClose', 'onEnd', 'onDrag', 'onDrop', 'dropTargetCb', 'onDragEnd',
14
+ 'remote', '_cachedRemote', '_onRemote', '_onCalling', 'onComplete', 'onClose', 'onEnd', 'onChecked', 'onDrag', 'onDrop', 'dropTargetCb', 'onDragEnd',
15
15
  'dropTarget', 'dropTypes', 'dragTags', 'dropTags', 'effectAllowed', 'dropEffect', 'dragClass',
16
16
  ]);
17
17
  const BINDING_ATTRIBUTE_PREFIXES = ['default_', 'attr_', 'fire_', 'connect_on', 'subscribe_', 'selfsubscribe_', 'formsubscribe_', 'remote_'];
@@ -68,6 +68,12 @@ export function requireNoScriptAttributes(node, attrs, prefixes = []) {
68
68
  if (attrs.onEnd != null && (node.nodeTag.toLowerCase() !== 'transformpane' || !node._getMeta('gramlot_component')?.parameters?.onEnd)) {
69
69
  throw new Error('onEnd is only supported on transformPane');
70
70
  }
71
+ if (attrs.onChecked != null && !node._getMeta('gramlot_component')?.parameters?.onChecked) {
72
+ throw new Error('onChecked is only supported on a component that declares it');
73
+ }
74
+ if (attrs.onComplete != null && !['uploader', 'imageUploader'].includes(node.nodeTag)) {
75
+ throw new Error('onComplete is only supported on an uploader or imageUploader');
76
+ }
71
77
  if (attrs.onClose != null && !node.parentNode?._getMeta('gramlot_component')?.childParameters?.onClose) {
72
78
  throw new Error('onClose is only supported on a tab/stack panel');
73
79
  }
@@ -71,6 +71,8 @@ export class GramlotRenderer extends GramlotHtmlRenderer {
71
71
  /** Whether a node still belongs to the observed Source. */
72
72
  attached(node: SourceBagNode): boolean;
73
73
  /** Build an inserted node and report the build to the binding runtime. */
74
+ unmountView(node: SourceBagNode): void;
75
+ mountView(node: SourceBagNode): void;
74
76
  insert(node: SourceBagNode): void;
75
77
  /** Build the DOM of a node inside `container`, before `before`. */
76
78
  buildNode(node: SourceBagNode, container: DomNode, before?: DomNode | null, parent?: unknown): {
@@ -30,6 +30,8 @@ export class GramlotRenderer extends GramlotHtmlRenderer {
30
30
  static renderType = 'object';
31
31
  // Nodes inside buildNode: events on them are ignored on arrival (P4, R04).
32
32
  #constructing = new Set();
33
+ // Explicitly unmounted views keep Source bindings, but Source updates cannot remount them.
34
+ #unmounted = new WeakSet();
33
35
  // The attributes of each node after runtimeValues and the `==` evaluation, binding attributes included.
34
36
  #resolvedAttributes = new WeakMap();
35
37
  // The resolved projection that `project` hands to the rebuild of a control whose shape changed.
@@ -48,7 +50,7 @@ export class GramlotRenderer extends GramlotHtmlRenderer {
48
50
  this._binding = binding;
49
51
  this.source = source;
50
52
  this.destination = destination;
51
- this.html = new HtmlElement({metadataAttributes: ['__ref'],
53
+ this.html = new HtmlElement({uploadContext: () => ({gramlot: binding.gramlot, window: destination.ownerDocument.defaultView}), metadataAttributes: ['__ref'],
52
54
  format: (value, options) => binding.gramlot.format(value, options),
53
55
  reportError: (node, error, title) => { if (this.records.has(node)) binding.reportError(error, title); },
54
56
  callLogic: (node, name, keywords) => {
@@ -139,7 +141,7 @@ export class GramlotRenderer extends GramlotHtmlRenderer {
139
141
  */
140
142
  render(node, opts = {}) {
141
143
  if (!(node instanceof GramlotBuilderBagNode)) throw new TypeError('Source children must be GramlotBuilderBagNodes');
142
- if (node._getMeta('data_element')) return null;
144
+ if (node._getMeta('data_element') || this.#unmounted.has(node)) return null;
143
145
  if (!this.binding.bindingFor(node) && this.#queued(node)) return null;
144
146
  if (node.nodeTag) this.html.validate(node, node._getMeta('subbuilder') ? node.parentBag._builder : node.builder);
145
147
  else if (!(node.value instanceof SourceBag)) throw new TypeError('Source fragments must contain child SourceBags');
@@ -269,6 +271,21 @@ export class GramlotRenderer extends GramlotHtmlRenderer {
269
271
  this.#validateBlock(block, replacingNode ? replacingNode.nodeTag : null);
270
272
  requireInstallable(block);
271
273
  this.references?.validate(block, excluded);
274
+ const nodeIds = new Set();
275
+ const validateNodeIds = bag => {
276
+ for (const node of bag.getNodes()) {
277
+ const nodeId = node.getAttr('nodeId');
278
+ if (nodeId != null) {
279
+ const mounted = this.binding.nodeIds.get(nodeId);
280
+ if (nodeIds.has(nodeId) || (mounted && mounted !== node && !excluded.has(mounted))) {
281
+ throw new Error(`Duplicate nodeId '${nodeId}'`);
282
+ }
283
+ nodeIds.add(nodeId);
284
+ }
285
+ if (node.value instanceof SourceBag) validateNodeIds(node.value);
286
+ }
287
+ };
288
+ validateNodeIds(block);
272
289
  return block;
273
290
  }
274
291
 
@@ -377,6 +394,7 @@ export class GramlotRenderer extends GramlotHtmlRenderer {
377
394
  if (!errors.length) throw error;
378
395
  errors.push(error);
379
396
  }
397
+ this.binding.refreshSourceTrees();
380
398
  if (errors.length) throw errors.length === 1 ? errors[0] : new AggregateError(errors, 'Source cleanup failed');
381
399
  }
382
400
  } catch (error) {
@@ -435,6 +453,16 @@ export class GramlotRenderer extends GramlotHtmlRenderer {
435
453
  walk(event.node);
436
454
  }
437
455
 
456
+ /** Release only the view; Source bindings and their semantic resources stay active. */
457
+ unmountView(node) {
458
+ this.#unmounted.add(node);
459
+ this.remove(node);
460
+ }
461
+ /** Rebuild an explicitly unmounted view from its current Source and Data. */
462
+ mountView(node) {
463
+ this.#unmounted.delete(node);
464
+ this.insert(node);
465
+ }
438
466
  /**
439
467
  * Build an inserted node, then report the build to the BindingRuntime (§5.1 step 7). A node that
440
468
  * left the Source meanwhile (an `_init` that removed its own branch, P4) is not built, nor a node
@@ -443,6 +471,7 @@ export class GramlotRenderer extends GramlotHtmlRenderer {
443
471
  */
444
472
  insert(node) {
445
473
  if (!this.attached(node) || this.records.has(node)) return;
474
+ for (let current = node; current; current = current.parentNode) if (this.#unmounted.has(current)) return;
446
475
  if (node._getMeta('data_element')) {
447
476
  // A `dataController` or `dataRpc` inserted in a button may give it a mechanism, or an ambiguous one (S12).
448
477
  this.records.get(node.parentBag?.parentNode)?.button?.refresh();
@@ -9,4 +9,4 @@ export function gramlotDev(): 'YES' | 'DEBUG' | null;
9
9
  /** URL of a packaged browser asset in `dist`: a `file:` URL from npm (read with `fs.readFile`), an `https:`
10
10
  * URL from JSR (read with `fetch`). Without a name, the runtime to serve at the runtime URL: `gramlot.js`
11
11
  * when `GRAMLOT_DEV=DEBUG`, `gramlot.min.js` otherwise. Another name throws a `TypeError`. */
12
- export function runtimeAsset(name?: 'gramlot.js' | 'gramlot.min.js' | 'runtime-notices.json' | null): URL;
12
+ export function runtimeAsset(name?: 'gramlot.js' | 'gramlot.min.js' | 'gramlot-markdown.js' | 'runtime-notices.json' | null): URL;
@@ -18,7 +18,7 @@ export function gramlotDev() {
18
18
  return value;
19
19
  }
20
20
 
21
- const RUNTIME_ASSETS = ['gramlot.js', 'gramlot.min.js', 'runtime-notices.json'];
21
+ const RUNTIME_ASSETS = ['gramlot.js', 'gramlot.min.js', 'gramlot-markdown.js', 'runtime-notices.json'];
22
22
 
23
23
  /** URL of a packaged browser asset in dist: a file: URL from npm (read with fs.readFile).
24
24
  * Without a name, the runtime to serve at the runtime URL: gramlot.js when
@@ -1,3 +1,4 @@
1
+ import type {UploadTransfer} from './upload.js';
1
2
  /**
2
3
  * The neutral server: registers pages and builds their Sources, with no HTTP engine.
3
4
  *
@@ -73,6 +74,8 @@ export interface GramlotServerOptions {
73
74
  maxPages?: number;
74
75
  /** Application collections: generated Builder grammar and root-relative browser module URL. */
75
76
  collections?: PreparedCollection[];
77
+ /** Enable upload control only when the adapter provides a binary transport. */
78
+ uploadsEnabled?: boolean;
76
79
  /** The base theme of every page, a folder of the core themes, or false for none; default `gramlot-base`. */
77
80
  cssTheme?: string | false;
78
81
  }
@@ -109,6 +112,8 @@ export interface OpenedPage {
109
112
  export class GramlotServer {
110
113
  /** URL of the runtime bundle. */
111
114
  runtimeUrl: string;
115
+ /** Shared optional Markdown module, alongside the runtime. */
116
+ readonly markdownUrl: string;
112
117
  /** URL of the request envelopes. */
113
118
  rpcUrl: string;
114
119
  /** URL of the page close endpoint. */
@@ -158,8 +163,10 @@ export class GramlotServer {
158
163
  openPage(path: string, options?: {owner?: unknown; prefix?: string}): Promise<OpenedPage>;
159
164
  /** The text of a request body: UTF-8, a leading byte order mark removed; other bytes throw `InvalidRequest`. */
160
165
  decodeBody(data: ArrayBuffer | ArrayBufferView): string;
161
- /** Answer the request envelope `text` (TYTX) with the response envelope (TYTX); throws only `InvalidRequest`. `identity` is the identity of this call, read only by `evaluateAuth`. */
166
+ /** Answer the request envelope `text` (TYTX) with the response envelope (TYTX); throws only `InvalidRequest`. `identity` is the trusted identity of this call, supplied to the fresh Page and `evaluateAuth`. */
162
167
  call(text: string, options?: {owner?: unknown; identity?: unknown}): Promise<string>;
168
+ /** Admit a one-use upload after owner and operation authorization checks. */
169
+ admitUpload(options: {pageId: string; transferId: string; authorization: string; owner?: unknown; identity?: unknown}): UploadTransfer;
163
170
  /** Close the page named by the close message `text` (`{"pageId": string}` as JSON) when `owner` owns it; throws `InvalidRequest`. */
164
171
  close(text: string, options?: {owner?: unknown}): void;
165
172
  /** Forget a registered page when `owner` owns it. */
@@ -10,7 +10,8 @@ import {fromTytx, toTytx} from '@genrojs/tytx';
10
10
  import {GramlotBuilder} from '../builder/gramlot-builder.js';
11
11
  import {NAME_SYNTAX} from '../builder/name-syntax.js';
12
12
  import {gramlotDev} from './assets.js';
13
- import {ENDPOINT_METHOD, Page, SOURCE_METHOD, resolveDeclared} from './page.js';
13
+ import {ENDPOINT_METHOD, Page, SOURCE_METHOD, UPLOAD_METHOD, resolveDeclared} from './page.js';
14
+ import {UploadRegistry, UploadTarget} from './upload.js';
14
15
  import {InvalidResourceName, SEGMENT, loadOrder} from './resources.js';
15
16
 
16
17
  export class PageExpired extends Error { name = 'PageExpired'; }
@@ -68,8 +69,8 @@ function parseRequest(text) {
68
69
  for (const field of ['id', 'pageId', 'contentType', 'name']) {
69
70
  if (typeof request[field] !== 'string') throw new InvalidRequest(`Request ${field} must be a string`);
70
71
  }
71
- if (!['source', 'data'].includes(request.contentType)) {
72
- throw new InvalidRequest('Request contentType must be source or data');
72
+ if (!['source', 'data', 'upload'].includes(request.contentType)) {
73
+ throw new InvalidRequest('Request contentType must be source, data or upload');
73
74
  }
74
75
  if (!isMapping(request.params)) throw new InvalidRequest('Request params must be a mapping');
75
76
  return request;
@@ -105,8 +106,10 @@ const prefixed = (prefix, url) => url.startsWith('/') && !url.startsWith('//') ?
105
106
  * owner move the expiry to now plus `pageTtl` (GC-230 §010).
106
107
  */
107
108
  export class GramlotServer {
109
+ get markdownUrl() { return this.runtimeUrl.replace(/[^/]+$/, 'gramlot-markdown.js'); }
110
+
108
111
  constructor({runtimeUrl = '/assets/gramlot.js', rpcUrl = '/gramlot/rpc', closeUrl = '/gramlot/close',
109
- rootId = 'gramlot-root', pageTtl = 1800, maxPages = 1000, collections = [],
112
+ rootId = 'gramlot-root', pageTtl = 1800, maxPages = 1000, collections = [], uploadsEnabled = false,
110
113
  cssTheme = 'gramlot-base'} = {}) {
111
114
  if (cssTheme !== false && !isThemeName(cssTheme)) {
112
115
  throw new TypeError(`The base theme must be a theme name or false, not ${JSON.stringify(cssTheme)}`);
@@ -118,6 +121,7 @@ export class GramlotServer {
118
121
  }
119
122
  Object.assign(this, {runtimeUrl, rpcUrl, closeUrl, rootId, pageTtl, maxPages, cssTheme});
120
123
  this.pages = new Map();
124
+ this.uploads = uploadsEnabled ? new UploadRegistry() : null;
121
125
  this.collections = [...collections];
122
126
  this.preparedGrammars = new WeakMap();
123
127
  this.environmentPages = new WeakMap();
@@ -235,7 +239,10 @@ export class GramlotServer {
235
239
 
236
240
  prune() {
237
241
  const now = performance.now();
238
- for (const [id, record] of this.pages) if (record.expires <= now) this.pages.delete(id);
242
+ for (const [id, record] of this.pages) if (record.expires <= now) {
243
+ this.pages.delete(id);
244
+ void this.uploads?.closePage(id, record.owner);
245
+ }
239
246
  }
240
247
 
241
248
  /** Describe the root application without registering a page session. */
@@ -329,6 +336,7 @@ export class GramlotServer {
329
336
  head.script(scriptJson({imports: {'@gramlot/gramlot/page': prefixed(prefix, this.runtimeUrl),
330
337
  '@gramlot/gramlot': prefixed(prefix, this.runtimeUrl),
331
338
  '@gramlot/gramlot/components':prefixed(prefix,this.runtimeUrl),
339
+ '@gramlot/gramlot/markdown':prefixed(prefix,this.markdownUrl),
332
340
  ...Object.fromEntries((resources.collections ?? []).map(({name,url})=>[`@gramlot/collections/${encodeURIComponent(name)}`,prefixed(prefix,url)]))}}),
333
341
  {type: 'importmap', nonce});
334
342
  const body = root.body();
@@ -357,7 +365,7 @@ export class GramlotServer {
357
365
  /** Answer the request envelope `text` (TYTX) with the response envelope (TYTX).
358
366
  * Throws only InvalidRequest; every other failure is an outcome in the response,
359
367
  * a value that TYTX cannot serialise included. `identity` is the identity of this call (for
360
- * example the avatar of a login), read only by evaluateAuth; the server keeps nothing of it. */
368
+ * example the avatar of a login), supplied by the host to the fresh Page and evaluateAuth; the server keeps nothing of it between calls. */
361
369
  async call(text, {owner = null, identity = null} = {}) {
362
370
  const request = parseRequest(text);
363
371
  const response = {id: request.id, contentType: request.contentType};
@@ -395,6 +403,8 @@ export class GramlotServer {
395
403
  record.expires = this.#expiry();
396
404
  const page = new record.PageClass();
397
405
  page.pageId = pageId;
406
+ Object.defineProperty(page, 'requestIdentity', {value:identity, writable:false});
407
+ if (contentType === 'upload') return this.#uploadControl(page, pageId, owner, identity, name, params);
398
408
  const source = contentType === 'source';
399
409
  let instance = page;
400
410
  let callable = page.main;
@@ -423,6 +433,68 @@ export class GramlotServer {
423
433
  return builder.toTytx();
424
434
  }
425
435
 
436
+ #uploadOperation(page, operation, owner, identity) {
437
+ const declared = this.nameSyntax.matches(operation) ? resolveDeclared(page, operation, UPLOAD_METHOD) : null;
438
+ if (!declared) throw new EndpointNotFound(`Unknown upload operation: ${operation}`);
439
+ const refused = this.#authOutcome(declared.method[UPLOAD_METHOD].auth, owner, identity);
440
+ if (refused) throw new (refused === 'not_authenticated' ? NotAuthenticated : NotAuthorized)(`Access refused: ${operation}`);
441
+ return declared;
442
+ }
443
+
444
+ async #uploadControl(page, pageId, owner, identity, name, params) {
445
+ if (!this.uploads) throw new EndpointNotFound('Upload is unavailable');
446
+ await this.uploads.expire();
447
+ this.prune();
448
+ if (this.pages.get(pageId)?.owner !== owner) throw new PageExpired('Unknown, expired or unowned page');
449
+ if (name === 'prepare') {
450
+ if (Object.keys(params).sort().join(',') !== 'metadata,operation') throw new TypeError('Invalid upload preparation');
451
+ const {operation, metadata} = params;
452
+ if (typeof operation !== 'string' || !isMapping(metadata) ||
453
+ Object.keys(metadata).sort().join(',') !== 'context,fields,mediaType,name,size' ||
454
+ typeof metadata.name !== 'string' || typeof metadata.mediaType !== 'string' ||
455
+ !Number.isSafeInteger(metadata.size) || metadata.size < 0 || !isMapping(metadata.fields) || !isMapping(metadata.context)) {
456
+ throw new TypeError('Invalid upload metadata');
457
+ }
458
+ const {instance, method} = this.#uploadOperation(page, operation, owner, identity);
459
+ const target = await method.call(instance, metadata);
460
+ let registered = false;
461
+ try {
462
+ this.prune();
463
+ if (this.pages.get(pageId)?.owner !== owner) throw new PageExpired('Unknown, expired or unowned page');
464
+ this.#uploadOperation(page, operation, owner, identity);
465
+ const grant = await this.uploads.prepare({pageId, owner, operation, target, size:metadata.size});
466
+ registered = true;
467
+ this.prune();
468
+ if (this.pages.get(pageId)?.owner !== owner) {
469
+ await this.uploads.closePage(pageId, owner);
470
+ throw new PageExpired('Unknown, expired or unowned page');
471
+ }
472
+ return grant;
473
+ } catch (error) {
474
+ if (target instanceof UploadTarget && !registered) await target.abort();
475
+ throw error;
476
+ }
477
+ }
478
+ if (!['status','cancel'].includes(name) || Object.keys(params).join(',') !== 'transferId') throw new TypeError('Invalid upload control');
479
+ const record = this.uploads.record(params.transferId, pageId, owner);
480
+ this.#uploadOperation(page, record.operation, owner, identity);
481
+ return name === 'status' ? record.transfer.status() : record.transfer.abort();
482
+ }
483
+
484
+ /** Admit a single binary upload; adapters provide the current request identity. */
485
+ admitUpload({pageId, owner = null, identity = null, transferId, authorization}) {
486
+ this.prune();
487
+ if (!this.uploads) throw new EndpointNotFound('Upload is unavailable');
488
+ const record = this.pages.get(pageId);
489
+ if (!record || record.owner !== owner) throw new PageExpired('Unknown, expired or unowned page');
490
+ const page = new record.PageClass();
491
+ page.pageId = pageId;
492
+ Object.defineProperty(page, 'requestIdentity', {value:identity, writable:false});
493
+ const upload = this.uploads.record(transferId, pageId, owner);
494
+ this.#uploadOperation(page, upload.operation, owner, identity);
495
+ return this.uploads.admit(transferId, pageId, owner, authorization);
496
+ }
497
+
426
498
  /** Close the page named by the close message `text`, `{"pageId": string}` as JSON, when `owner`
427
499
  * owns it (GC-230 §125); an unknown or unowned page is left as it is. A text that is not JSON, or
428
500
  * whose pageId is not a string, is an InvalidRequest. */
@@ -440,11 +512,15 @@ export class GramlotServer {
440
512
  }
441
513
 
442
514
  closePage(pageId, {owner = null} = {}) {
443
- if (this.pages.get(pageId)?.owner === owner) this.pages.delete(pageId);
515
+ if (this.pages.get(pageId)?.owner === owner) {
516
+ this.pages.delete(pageId);
517
+ void this.uploads?.closePage(pageId, owner);
518
+ }
444
519
  }
445
520
 
446
521
  /** Forget every registered page; adapters call it on shutdown. */
447
522
  closeAll() {
523
+ for (const [pageId, record] of this.pages) void this.uploads?.closePage(pageId, record.owner);
448
524
  this.pages = new Map();
449
525
  }
450
526
 
@@ -17,3 +17,5 @@ export {InvalidResourceName, parseRequires} from './resources.js';
17
17
  export type {Resources} from './resources.js';
18
18
  export {NAME_SYNTAX, NameSyntax} from '../builder/name-syntax.js';
19
19
  export type {NameSyntaxDescriptor} from '../builder/name-syntax.js';
20
+
21
+ export {UploadTarget} from './upload.js';
@@ -15,3 +15,5 @@ export {gramlotDev, runtimeAsset} from './assets.js';
15
15
  export {checkProtocol} from './conformance.js';
16
16
  export {InvalidResourceName, parseRequires} from './resources.js';
17
17
  export {NAME_SYNTAX, NameSyntax} from '../builder/name-syntax.js';
18
+
19
+ export {UploadTarget} from './upload.js';