@gramlot/gramlot 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/icons/align-center.svg +4 -0
- package/assets/icons/align-justify.svg +4 -0
- package/assets/icons/align-left.svg +4 -0
- package/assets/icons/align-right.svg +4 -0
- package/assets/icons/bold.svg +4 -0
- package/assets/icons/eraser.svg +4 -0
- package/assets/icons/horizontal-rule.svg +4 -0
- package/assets/icons/image.svg +4 -0
- package/assets/icons/indent.svg +4 -0
- package/assets/icons/italic.svg +4 -0
- package/assets/icons/list-bulleted.svg +4 -0
- package/assets/icons/list-numbered.svg +4 -0
- package/assets/icons/outdent.svg +4 -0
- package/assets/icons/paragraph.svg +4 -0
- package/assets/icons/select-all.svg +4 -0
- package/assets/icons/strikethrough.svg +4 -0
- package/assets/icons/underline.svg +4 -0
- package/dist/components/charts/__init__.py +1 -1
- package/dist/components/charts/assets/index.js +1 -1
- package/dist/components/charts/grammar.json +2032 -72
- package/dist/components/editors/__init__.py +1 -1
- package/dist/components/editors/assets/collection.js +1 -1
- package/dist/components/editors/assets/index.js +1 -1
- package/dist/components/editors/assets/libraries/codemirror.js +30 -30
- package/dist/components/editors/assets/libraries/jodit.js +452 -448
- package/dist/components/editors/commands.json +113 -1
- package/dist/components/editors/grammar.json +6 -4
- package/dist/components/grid/__init__.py +1 -1
- package/dist/components/grid/assets/index.js +1 -1
- package/dist/components/grid/grammar.json +61 -0
- package/dist/components/inputs/__init__.py +1 -1
- package/dist/components/inputs/assets/index.js +1 -1
- package/dist/components/inputs/grammar.json +35 -0
- package/dist/components/layout/__init__.py +1 -1
- package/dist/components/layout/assets/collection.js +1 -0
- package/dist/components/layout/assets/index.js +1 -1
- package/dist/components/layout/grammar.json +364 -0
- package/dist/components/tree/__init__.py +1 -1
- package/dist/components/tree/assets/index.js +1 -1
- package/dist/components/tree/grammar.json +35 -0
- package/dist/gramlot.js +1165 -420
- package/dist/gramlot.min.js +125 -100
- package/dist/libraries.json +5 -4
- package/dist/standard-collections.js +1 -1
- package/dist/standard-grammar.js +1 -1
- package/package.json +4 -2
- package/src/binding/providers.js +2 -1
- package/src/binding/remote.js +41 -6
- package/src/binding/runtime.js +24 -0
- package/src/builder/gramlot-builder.js +52 -18
- package/src/builder/source.js +66 -12
- package/src/chat.d.ts +1 -0
- package/src/chat.js +13 -1
- package/src/components/chart-bar3d-options.js +0 -1
- package/src/components/chart-boxplot-options.js +1 -1
- package/src/components/chart-candlestick-options.js +1 -1
- package/src/components/chart-engines/echarts-options.js +6 -5
- package/src/components/chart-engines/echarts.js +27 -10
- package/src/components/chart-engines/plotly-map.js +1 -1
- package/src/components/chart-engines/plotly.js +21 -14
- package/src/components/chart-engines/uplot.js +17 -11
- package/src/components/chart-engines/vega.js +17 -11
- package/src/components/chart-funnel-options.js +1 -1
- package/src/components/chart-geographic-options.js +1 -1
- package/src/components/chart-heatmap-options.js +1 -1
- package/src/components/chart-map-bar3d-options.js +2 -2
- package/src/components/chart-map-options.js +2 -2
- package/src/components/chart-parallel-options.js +1 -1
- package/src/components/chart-radar-options.js +1 -1
- package/src/components/chart-renderer.js +6 -1
- package/src/components/chart-sankey-options.js +1 -1
- package/src/components/chart-spatial-options.js +1 -1
- package/src/components/chart-sunburst-options.js +13 -1
- package/src/components/chart-theme.js +14 -0
- package/src/components/chart-treemap-options.js +1 -1
- package/src/components/chart-type-data.js +24 -4
- package/src/components/charts.js +7 -6
- package/src/components/check-box-tree.js +1 -1
- package/src/components/choice-editor.js +3 -3
- package/src/components/code-mirror-engine.js +2 -1
- package/src/components/code-mirror.js +1 -1
- package/src/components/editor-commands.js +69 -0
- package/src/components/editors.js +5 -3
- package/src/components/form-tray-pane.js +18 -0
- package/src/components/graphical-ranges.js +16 -3
- package/src/components/grid-check-sets.js +39 -3
- package/src/components/grid-header-interaction.js +3 -3
- package/src/components/grid-styles.js +19 -3
- package/src/components/grid.js +42 -9
- package/src/components/html-editor-commands.js +61 -0
- package/src/components/html-editor.js +18 -3
- package/src/components/inputs.js +1 -0
- package/src/components/jodit-engine.js +107 -6
- package/src/components/layout.js +3 -2
- package/src/components/menus.js +6 -1
- package/src/components/selected-container.js +16 -3
- package/src/components/tab-bar.js +20 -2
- package/src/components/tray-base.js +528 -0
- package/src/components/tray-pane.js +41 -518
- package/src/components/tree.js +44 -1
- package/src/components/typed-editor.js +5 -2
- package/src/editing-session.js +2 -1
- package/src/ide-runtime.js +3 -1
- package/src/index-page-runtime.js +11 -3
- package/src/index.d.ts +2 -1
- package/src/index.js +2 -1
- package/src/libraries.js +4 -4
- package/src/object-extract.d.ts +7 -0
- package/src/object-extract.js +31 -0
- package/src/renderer/attributes.js +1 -1
- package/src/renderer/gramlot-renderer.d.ts +2 -2
- package/src/server/chat.d.ts +3 -1
- package/src/server/chat.js +17 -6
- package/src/server/gramlot-server.js +5 -1
- package/src/server/index-page.js +27 -8
- package/src/server/toolbar-icon-name.d.ts +17 -0
- package/src/view/labelbox.js +6 -1
- package/src/visual-editor.d.ts +1 -0
- package/src/visual-editor.js +4 -3
- package/themes/gramlot-base/theme.css +7 -0
- package/themes/gramlot-index/icons/align-center.svg +4 -0
- package/themes/gramlot-index/icons/align-justify.svg +4 -0
- package/themes/gramlot-index/icons/align-left.svg +4 -0
- package/themes/gramlot-index/icons/align-right.svg +4 -0
- package/themes/gramlot-index/icons/bold.svg +4 -0
- package/themes/gramlot-index/icons/eraser.svg +4 -0
- package/themes/gramlot-index/icons/horizontal-rule.svg +4 -0
- package/themes/gramlot-index/icons/image.svg +4 -0
- package/themes/gramlot-index/icons/indent.svg +4 -0
- package/themes/gramlot-index/icons/italic.svg +4 -0
- package/themes/gramlot-index/icons/list-bulleted.svg +4 -0
- package/themes/gramlot-index/icons/list-numbered.svg +4 -0
- package/themes/gramlot-index/icons/outdent.svg +4 -0
- package/themes/gramlot-index/icons/paragraph.svg +4 -0
- package/themes/gramlot-index/icons/select-all.svg +4 -0
- package/themes/gramlot-index/icons/strikethrough.svg +4 -0
- package/themes/gramlot-index/icons/underline.svg +4 -0
- package/themes/gramlot-index/icons.json +17 -0
- package/themes/gramlot-index/theme.css +3 -0
- package/tools/gramlot-tools-inspector.js +11 -3
- package/src/builder/chart-icon.js +0 -2
|
@@ -28,12 +28,15 @@ export function TypedEditor(HTMLElement) {
|
|
|
28
28
|
super();
|
|
29
29
|
this.control.addEventListener('focus', () => {
|
|
30
30
|
this.#focused = true;
|
|
31
|
-
|
|
31
|
+
// select() applies its selection after the focus event in Chromium (#147).
|
|
32
|
+
// Show the editing text after the current script, then read the final selection.
|
|
33
|
+
queueMicrotask(() => {
|
|
34
|
+
if (!this.#focused || this.#dirty) return;
|
|
32
35
|
const start = this.control.selectionStart, end = this.control.selectionEnd;
|
|
33
36
|
const all = start === 0 && end === this.control.value.length;
|
|
34
37
|
this.#policy = this.context(); this.display();
|
|
35
38
|
this.control.setSelectionRange(start, all ? this.control.value.length : end);
|
|
36
|
-
}
|
|
39
|
+
});
|
|
37
40
|
});
|
|
38
41
|
this.control.addEventListener('input', () => {
|
|
39
42
|
if (!this.#selecting) this.#selection = null;
|
package/src/editing-session.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import {Bag} from '@genrojs/bag';
|
|
3
3
|
import {fromTytx, toTytx} from '@genrojs/tytx';
|
|
4
4
|
import {ValidationRun} from './validation-run.js';
|
|
5
|
+
import {objectExtract} from './object-extract.js';
|
|
5
6
|
import {validationContext} from './binding/validation-context.js';
|
|
6
7
|
|
|
7
8
|
// TYTX is the existing typed snapshot format (dates, Decimal and nested Bags included).
|
|
@@ -310,7 +311,7 @@ export class EditingSession {
|
|
|
310
311
|
const field = this.validations.get(node.fullpath);
|
|
311
312
|
if (!field || this.disposed || this.writing) return;
|
|
312
313
|
const resolved = this.validationParameters(node,field.component);
|
|
313
|
-
const rules =
|
|
314
|
+
const rules = objectExtract(resolved, 'validate_*', {pop: false, slice: false});
|
|
314
315
|
const configuration = toTytx(Object.fromEntries(Object.entries(resolved).filter(([name]) => name !== 'value')));
|
|
315
316
|
// The field is compared by its Data path and value: a new node at the same path with the same value
|
|
316
317
|
// (a reloaded row) keeps the validation result and the draft.
|
package/src/ide-runtime.js
CHANGED
|
@@ -190,9 +190,11 @@ export class IdeLogic {
|
|
|
190
190
|
}
|
|
191
191
|
previewPane[html ? 'htmlPreview' : 'markdownPreview']({value:`^.documents.${key}.content`,flex:'1',min_height:0,
|
|
192
192
|
...(markdown ? {allowHtml:`^.documents.${key}.allowHtml`} : {})});
|
|
193
|
+
// htmlEditor is a frame: the identity, view and history subscription belong to its canvas.
|
|
194
|
+
const editorAttrs = {nodeId:`${context.editorPrefix}_rich_editor_${key}`,editorView:'rich',selfsubscribe_historyChanged:'ideHistoryChanged'};
|
|
193
195
|
views.contentPane({title:'Rich text',pageName:'rich',height:'100%'})[html ? 'htmlEditor' : 'markdownEditor']({
|
|
194
196
|
datapath:`.documents.${key}`,value:'^.content',readonly:'^.readonly',height:'100%',
|
|
195
|
-
|
|
197
|
+
...(html ? Object.fromEntries(Object.entries(editorAttrs).map(([name, value]) => [`canvas_${name}`, value])) : editorAttrs)});
|
|
196
198
|
target.dataController({func:'ideSave',documentKey:key,[`subscribe_${context.editorPrefix}_rich_editor_${key}_save`]:true});
|
|
197
199
|
}
|
|
198
200
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/* @ts-self-types="./index-page-runtime.d.ts" */
|
|
2
2
|
import {Bag} from '@genrojs/bag';
|
|
3
3
|
|
|
4
|
+
// Built-in texts by language of the page locale; English when the language has none.
|
|
5
|
+
const TEXTS = {
|
|
6
|
+
en: {openFailed:'Page could not be opened', callbackFailed:'Page load callback failed'},
|
|
7
|
+
it: {openFailed:'Impossibile aprire la pagina', callbackFailed:'Errore nella callback di caricamento della pagina'},
|
|
8
|
+
};
|
|
9
|
+
|
|
4
10
|
/** Coordinate a declared navigation Bag and tabContainer through Source and Data.
|
|
5
11
|
* Region contents, drawer presentation, themes and application controls belong to the Page.
|
|
6
12
|
*/
|
|
@@ -11,6 +17,8 @@ export function mountIndexPage(renderer, root, onSelection = () => {}, prepareEn
|
|
|
11
17
|
// other node is read at its address when it is used.
|
|
12
18
|
if (typeof state !== 'string' || !state) throw new TypeError('IndexPage state must be a Data path');
|
|
13
19
|
const data = renderer.binding.gramlot.data;
|
|
20
|
+
const language = renderer.binding.gramlot.locale.split('-')[0].toLowerCase();
|
|
21
|
+
const texts = TEXTS[language] ?? TEXTS.en;
|
|
14
22
|
const read = name => data.getItem(`${state}.${name}`);
|
|
15
23
|
const write = (name, value) => data.setItem(`${state}.${name}`, value);
|
|
16
24
|
const navigation = () => read('navigation');
|
|
@@ -34,7 +42,7 @@ export function mountIndexPage(renderer, root, onSelection = () => {}, prepareEn
|
|
|
34
42
|
}
|
|
35
43
|
const notifyLoad = (entry, status, error) => {
|
|
36
44
|
try { onLoad(entry.url, status, error); }
|
|
37
|
-
catch (callbackError) { renderer.binding.reportError(callbackError,
|
|
45
|
+
catch (callbackError) { renderer.binding.reportError(callbackError, texts.callbackFailed); }
|
|
38
46
|
};
|
|
39
47
|
const finishLoad = (entry, status, error) => {
|
|
40
48
|
if (!entry.loading) return;
|
|
@@ -56,7 +64,7 @@ export function mountIndexPage(renderer, root, onSelection = () => {}, prepareEn
|
|
|
56
64
|
// Includes validation and preparation errors before the asynchronous load starts.
|
|
57
65
|
function requestSelection(path) {
|
|
58
66
|
void select(path).catch(error => {
|
|
59
|
-
if (!context.disposed) renderer.binding.reportError(error,
|
|
67
|
+
if (!context.disposed) renderer.binding.reportError(error, texts.openFailed);
|
|
60
68
|
});
|
|
61
69
|
}
|
|
62
70
|
async function select(path) {
|
|
@@ -104,7 +112,7 @@ export function mountIndexPage(renderer, root, onSelection = () => {}, prepareEn
|
|
|
104
112
|
} catch (error) {
|
|
105
113
|
if (context.disposed || entries.get(url) !== entry) return;
|
|
106
114
|
try {
|
|
107
|
-
renderer.binding.reportError(error,
|
|
115
|
+
renderer.binding.reportError(error, texts.openFailed);
|
|
108
116
|
entries.delete(url);
|
|
109
117
|
forget(paneLabel);
|
|
110
118
|
if (entry.pane) tabs().value.popNode(paneLabel);
|
package/src/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export {IndexPage} from "./server/index-page.js";
|
|
|
38
38
|
export {IndexLogic, mountIndexPage} from "./index-page-runtime.js";
|
|
39
39
|
|
|
40
40
|
export {parseDateExpression} from '@genrojs/toolbox';
|
|
41
|
+
export {objectExtract} from './object-extract.js';
|
|
41
42
|
export type {DateExpressionOptions, DateExpressionResult, DateExpressionErrorCode} from '@genrojs/toolbox';
|
|
42
43
|
|
|
43
44
|
export {FramePage} from "./server/frame-page.js";
|
|
@@ -57,7 +58,7 @@ export type {DeviceDatabase, DeviceOrientation, DeviceMotionEvent, DeviceProvide
|
|
|
57
58
|
|
|
58
59
|
export {MobileEnvironment} from './mobile-environment.js';
|
|
59
60
|
|
|
60
|
-
export {chatRender, chatSend, chatCompleted, chatReset, chatResize, chatPickAttachments, chatRenderAttachments, chatRemoveAttachment} from './chat.js';
|
|
61
|
+
export {chatRender, chatSend, chatDraftKey, chatCompleted, chatReset, chatResize, chatPickAttachments, chatRenderAttachments, chatRemoveAttachment} from './chat.js';
|
|
61
62
|
|
|
62
63
|
// Preserve fluent Source identity across separately prepared collection bundles.
|
|
63
64
|
export {sourceTarget} from '@genrojs/builders';
|
package/src/index.js
CHANGED
|
@@ -36,6 +36,7 @@ export {IndexLogic, mountIndexPage} from './index-page-runtime.js';
|
|
|
36
36
|
export {NavigationResolver} from './navigation-resolver.js';
|
|
37
37
|
|
|
38
38
|
export {parseDateExpression} from '@genrojs/toolbox';
|
|
39
|
+
export {objectExtract} from './object-extract.js';
|
|
39
40
|
|
|
40
41
|
export {fileSystemTree, FileSystemLogic, FileSystemController, DirectoryResolver} from "./filesystem.js";
|
|
41
42
|
export {IdeLogic} from "./ide-runtime.js";
|
|
@@ -50,7 +51,7 @@ export {BrowserCameraProvider} from './browser-camera-provider.js';
|
|
|
50
51
|
|
|
51
52
|
export {MobileEnvironment} from './mobile-environment.js';
|
|
52
53
|
|
|
53
|
-
export {chatRender, chatSend, chatCompleted, chatReset, chatResize, chatPickAttachments, chatRenderAttachments, chatRemoveAttachment} from './chat.js';
|
|
54
|
+
export {chatRender, chatSend, chatDraftKey, chatCompleted, chatReset, chatResize, chatPickAttachments, chatRenderAttachments, chatRemoveAttachment} from './chat.js';
|
|
54
55
|
|
|
55
56
|
// Preserve fluent Source identity across separately prepared collection bundles.
|
|
56
57
|
export {sourceTarget} from '@genrojs/builders';
|
package/src/libraries.js
CHANGED
|
@@ -52,11 +52,11 @@ export const libraries = Object.freeze({
|
|
|
52
52
|
jodit: Object.freeze({packages: {jodit: '4.18.10'}, local: './components/jodit-engine.js',
|
|
53
53
|
url: null, integrity: null, format: 'module'}),
|
|
54
54
|
codemirror: Object.freeze({packages: {
|
|
55
|
-
'@codemirror/autocomplete': '6.20.4', '@codemirror/commands': '6.11.
|
|
55
|
+
'@codemirror/autocomplete': '6.20.4', '@codemirror/commands': '6.11.2', '@codemirror/lang-css': '6.3.1',
|
|
56
56
|
'@codemirror/lang-html': '6.4.12', '@codemirror/lang-javascript': '6.2.5', '@codemirror/lang-json': '6.0.2',
|
|
57
|
-
'@codemirror/lang-markdown': '6.5.
|
|
58
|
-
'@codemirror/lang-xml': '6.1.0', '@codemirror/language': '6.13.1', '@codemirror/lint': '6.9.8',
|
|
59
|
-
'@codemirror/search': '6.7.
|
|
57
|
+
'@codemirror/lang-markdown': '6.5.3', '@codemirror/lang-python': '6.2.1', '@codemirror/lang-rust': '6.0.2', '@codemirror/lang-sql': '6.10.0',
|
|
58
|
+
'@codemirror/lang-xml': '6.1.0', '@codemirror/lang-yaml': '6.1.3', '@codemirror/language': '6.13.1', '@codemirror/lint': '6.9.8',
|
|
59
|
+
'@codemirror/search': '6.7.3', '@codemirror/state': '6.7.6', '@codemirror/view': '6.44.2',
|
|
60
60
|
'@lezer/highlight': '1.2.5', 'codemirror-lang-typst': '0.6.0'},
|
|
61
61
|
local: './components/code-mirror-engine.js', url: null, integrity: null, format: 'module'}),
|
|
62
62
|
prosemirror: Object.freeze({packages: {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The entries of `obj` named by `keys`: a prefix followed by `*`, or a comma-separated list of names.
|
|
3
|
+
* The extracted entries leave `obj` unless `pop` is false; a prefix is removed from the names unless
|
|
4
|
+
* `slice` is false.
|
|
5
|
+
*/
|
|
6
|
+
export function objectExtract(obj: Record<string, unknown>, keys: string,
|
|
7
|
+
options?: {pop?: boolean, slice?: boolean}): Record<string, unknown>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* @ts-self-types="./object-extract.d.ts" */
|
|
2
|
+
/**
|
|
3
|
+
* The attribute families of legacy `objectExtract` (`gnrlang.js:709`).
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The entries of `obj` named by `keys`, as a new object. `keys` is a prefix followed by `*`
|
|
10
|
+
* (`'tooltip_*'`: every entry whose name starts with `tooltip_`, named without the prefix unless
|
|
11
|
+
* `slice` is false) or a comma-separated list of names (`'width, height'`: the names present in
|
|
12
|
+
* `obj`). The extracted entries leave `obj` unless `pop` is false.
|
|
13
|
+
*/
|
|
14
|
+
export function objectExtract(obj, keys, {pop = true, slice = true} = {}) {
|
|
15
|
+
const result = {};
|
|
16
|
+
if (keys.endsWith('*')) {
|
|
17
|
+
const prefix = keys.slice(0, -1);
|
|
18
|
+
for (const name of Object.keys(obj)) {
|
|
19
|
+
if (!name.startsWith(prefix)) continue;
|
|
20
|
+
result[slice ? name.slice(prefix.length) : name] = obj[name];
|
|
21
|
+
if (pop) delete obj[name];
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
for (const name of keys.split(',').map(key => key.trim())) {
|
|
26
|
+
if (!Object.hasOwn(obj, name)) continue;
|
|
27
|
+
result[name] = obj[name];
|
|
28
|
+
if (pop) delete obj[name];
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
@@ -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', 'onComplete', 'onClose', 'onEnd', 'onChecked', 'onDrag', 'onDrop', 'dropTargetCb', 'onDragEnd',
|
|
14
|
+
'remote', '_cachedRemote', '_onRemote', '_onCalling', '_waitingMessage', '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_'];
|
|
@@ -41,14 +41,14 @@ export class GramlotRenderer extends GramlotHtmlRenderer {
|
|
|
41
41
|
dropValues: Record<string, unknown>; item: unknown; path: string | undefined;
|
|
42
42
|
source: Record<string, unknown>; selfdrop: boolean;
|
|
43
43
|
dropEffect: 'copy' | 'move' | 'link'; dataAvailable: boolean;
|
|
44
|
-
placement?: 'before' | 'inside' | 'after';
|
|
44
|
+
placement?: 'before' | 'inside' | 'after' | {left:number; top:number};
|
|
45
45
|
}): boolean;
|
|
46
46
|
/** Invoke the general onDrop action on already accepted data not consumed by typed actions. */
|
|
47
47
|
invokeDrop(node: SourceBagNode, context: {
|
|
48
48
|
dropValues: Record<string, unknown>; item: unknown; path: string | undefined;
|
|
49
49
|
source: Record<string, unknown>; selfdrop: boolean;
|
|
50
50
|
dropEffect: 'copy' | 'move' | 'link'; dataAvailable: boolean;
|
|
51
|
-
placement?: 'before' | 'inside' | 'after';
|
|
51
|
+
placement?: 'before' | 'inside' | 'after' | {left:number; top:number};
|
|
52
52
|
}): Promise<void>;
|
|
53
53
|
/** Origin callback, followed by local endDrag publication even if the callback fails. */
|
|
54
54
|
endDrag(node: SourceBagNode, context: {source: Record<string, unknown>; dropEffect: string}, topic: string): Promise<void>;
|
package/src/server/chat.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type {GramlotBuilder} from '../builder/gramlot-builder.js';
|
|
|
4
4
|
|
|
5
5
|
type Pane = GramlotBuilder['root'];
|
|
6
6
|
export class ChatPane {
|
|
7
|
-
constructor(parent: Pane, options: {datapath: string; chat_id?: string; [attribute: string]: unknown});
|
|
7
|
+
constructor(parent: Pane, options: {datapath: string; chat_id?: string; models?: Record<string, string> | null; [attribute: string]: unknown});
|
|
8
8
|
frame: Pane;
|
|
9
9
|
composer: Pane;
|
|
10
10
|
messages: Pane;
|
|
@@ -12,12 +12,14 @@ export class ChatPane {
|
|
|
12
12
|
toolbar: Pane;
|
|
13
13
|
sendButton: Pane;
|
|
14
14
|
attachmentButton: Pane;
|
|
15
|
+
modelSelector: Pane | null;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export interface ChatRequestContext {
|
|
18
19
|
chatId: string;
|
|
19
20
|
attachments: Bag;
|
|
20
21
|
feedback: (text: string) => void;
|
|
22
|
+
model: string | null;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export class ChatPageStore extends PageStore {
|
package/src/server/chat.js
CHANGED
|
@@ -7,19 +7,23 @@ const identifier = /^[A-Za-z][A-Za-z0-9_]*$/;
|
|
|
7
7
|
const conversation = ready => new Bag({messages: new Bag(), ready, request: null, response: null, feedback: ''});
|
|
8
8
|
|
|
9
9
|
export class ChatPane {
|
|
10
|
-
constructor(parent, {datapath, chat_id = 'main', ...attributes}) {
|
|
10
|
+
constructor(parent, {datapath, chat_id = 'main', models = null, ...attributes}) {
|
|
11
11
|
if (typeof chat_id !== 'string' || !identifier.test(chat_id)) throw new TypeError('Invalid chat_id');
|
|
12
|
+
if (models !== null && (typeof models !== 'object' || Array.isArray(models) || !Object.keys(models).length
|
|
13
|
+
|| !Object.values(models).every(caption => typeof caption === 'string'))) {
|
|
14
|
+
throw new TypeError('models must map model values to captions');
|
|
15
|
+
}
|
|
12
16
|
const frame = this.frame = parent.framePane({datapath, ...attributes});
|
|
13
17
|
const defaults = {
|
|
14
18
|
conversation: conversation(false), messageData: new Bag(), draft: '', pending: false,
|
|
15
19
|
requestId: '', error: '', attachments: new Bag(), picking: false, composerHeight: 96,
|
|
20
|
+
model: models ? Object.keys(models)[0] : null,
|
|
16
21
|
};
|
|
17
22
|
for (const [name, value] of Object.entries(defaults)) {
|
|
18
23
|
frame.dataSetter({destination_path: '.' + name, value});
|
|
19
24
|
}
|
|
20
25
|
frame.dataBinder({destination_path: '.conversation', server_path: 'chats.' + chat_id});
|
|
21
26
|
frame.dataController({func:'chatCompleted', response:'^.conversation.response'});
|
|
22
|
-
frame.top.setAttr({height:'44px'});
|
|
23
27
|
this.messages = frame.center.chatMessages({height:'100%', min_height:0});
|
|
24
28
|
this.messages.dataController({func:'chatRender', messages:'^.conversation.messages', _onBuilt:true});
|
|
25
29
|
frame.bottom.setAttr({height:'^.composerHeight', splitter:false});
|
|
@@ -28,14 +32,14 @@ export class ChatPane {
|
|
|
28
32
|
this.composer.bottom.setAttr({height:'44px'});
|
|
29
33
|
const pane = this.composer.center.contentPane({overflow:'hidden'});
|
|
30
34
|
const center = pane.div({display:'flex', flex_direction:'column', padding:'4px 10px', gap:'4px'});
|
|
31
|
-
center.dataFormula({result_path:'.status', formula:'
|
|
35
|
+
center.dataFormula({result_path:'.status', formula:'feedback || (pending ? "Sending to the server…" : "")',
|
|
32
36
|
pending:'^.pending', feedback:'^.conversation.feedback', _init:true});
|
|
33
37
|
center.div('^.status', {node_label:'chatFeedback', class:'gramlot-chat-status', role:'status',
|
|
34
38
|
aria_live:'polite', display:'^.status:={} ? "flex" : "none"', 'data-pending':'^.pending',
|
|
35
39
|
height:'22px', min_height:'22px', overflow:'hidden', white_space:'nowrap',
|
|
36
40
|
text_overflow:'ellipsis', font_size:'13px'});
|
|
37
41
|
this.editor = center.textarea({value:'^.draft', live:true, aria_label:'Message', placeholder:'Write a message…',
|
|
38
|
-
class:'gramlot-chat-editor', rows:1, min_height:'44px', height:'44px', line_height:'20px',
|
|
42
|
+
class:'gramlot-chat-editor', connect_onkeydown:'chatDraftKey', rows:1, min_height:'44px', height:'44px', line_height:'20px',
|
|
39
43
|
resize:'none', width:'100%', box_sizing:'border-box', border_radius:'18px', padding:'10px 14px'});
|
|
40
44
|
const previews = center.div({display:'flex', gap:'6px', overflow_x:'auto', max_height:'76px'});
|
|
41
45
|
previews.dataController({func:'chatRenderAttachments', attachments:'^.attachments', _onBuilt:true});
|
|
@@ -50,8 +54,14 @@ export class ChatPane {
|
|
|
50
54
|
style:'--gramlot-touch-target:36px;--gramlot-button-padding:0;--gramlot-field-height:36px;',
|
|
51
55
|
picking:'^.picking', disabled:'^.pending:={} || {picking}'});
|
|
52
56
|
this.attachmentButton.dataController({func:'chatPickAttachments'});
|
|
57
|
+
this.modelSelector = null;
|
|
58
|
+
if (models) {
|
|
59
|
+
this.modelSelector = actions.select({value:'^.model', aria_label:'Model', title:'Model', width:'auto',
|
|
60
|
+
flex_shrink:0, disabled:'^.pending'});
|
|
61
|
+
for (const [model, caption] of Object.entries(models)) this.modelSelector.option(caption, {value:model});
|
|
62
|
+
}
|
|
53
63
|
this.toolbar = actions.div({display:'flex', align_items:'center', gap:'10px', flex:1, min_width:0, overflow_x:'auto'});
|
|
54
|
-
this.sendButton = actions.button({aria_label:'Send', title:'Send message', class:'gramlot-chat-send',
|
|
64
|
+
this.sendButton = actions.button({aria_label:'Send', title:'Send message (Enter)', class:'gramlot-chat-send',
|
|
55
65
|
font_size:'16px', flex_shrink:0, width:'36px', height:'36px', chat_id,
|
|
56
66
|
style:'--gramlot-radius-sm:50%;--gramlot-button-padding:9px;--gramlot-button-gap:0px;--gramlot-field-height:36px;--gramlot-touch-target:36px;',
|
|
57
67
|
ready:'^.conversation.ready', draft:'^.draft', attachments:'^.attachments', picking:'^.picking',
|
|
@@ -121,7 +131,8 @@ export class ChatPageStore extends PageStore {
|
|
|
121
131
|
if (typeof status !== 'string') throw new TypeError('Feedback must be text');
|
|
122
132
|
if (!this.closed) this.data.setItem(base + '.feedback', status);
|
|
123
133
|
};
|
|
124
|
-
const
|
|
134
|
+
const model = request.getItem('model') ?? null;
|
|
135
|
+
const result = await this.processMessage(text, {chatId, attachments, feedback, model});
|
|
125
136
|
if (this.closed) return;
|
|
126
137
|
if (typeof result !== 'string' && !(result instanceof GramlotBuilderBag)) throw new TypeError('Invalid reply');
|
|
127
138
|
const messages = this.conversationMessages(chatId);
|
|
@@ -600,10 +600,14 @@ export class GramlotServer {
|
|
|
600
600
|
throw new Refusal(`Access refused: ${name}`);
|
|
601
601
|
}
|
|
602
602
|
if (!source) return callable.call(instance, params);
|
|
603
|
+
const {_inheritedAttributes: inherited, ...sourceParams} = params;
|
|
603
604
|
const builder = new record.PageClass.sourceBuilder(name,
|
|
604
605
|
{auth: elementRule => this.#authOutcome(elementRule, owner, identity), nameSyntax: this.nameSyntax});
|
|
606
|
+
// remote with sendInheritedAttributes: the _root_ node above the fragment carries them, so every
|
|
607
|
+
// node of the fragment inherits them, as the root_wrapper of legacy makeRoot.
|
|
608
|
+
if (inherited !== undefined) builder.source.parentNode.setAttr(inherited, false);
|
|
605
609
|
this.loadCollections(builder, this.pageCollections(record.PageClass));
|
|
606
|
-
const result = await callable.call(instance, builder.root,
|
|
610
|
+
const result = await callable.call(instance, builder.root, sourceParams);
|
|
607
611
|
if (result !== undefined && result !== null) throw new TypeError('Source methods populate root and return no value');
|
|
608
612
|
const icons = page._icons.definitions();
|
|
609
613
|
if (Object.keys(icons).length) response.icons = icons;
|
package/src/server/index-page.js
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
import {Bag} from '@genrojs/bag';
|
|
4
4
|
import {FramePage} from './frame-page.js';
|
|
5
5
|
|
|
6
|
+
// Built-in texts by language of the page locale; English when the language has none.
|
|
7
|
+
const TEXTS = {
|
|
8
|
+
en: {navigation:'Navigation', settings:'Settings', tools:'Application tools',
|
|
9
|
+
appearance:'Theme', palette:'Colors', theme:'Color mode',
|
|
10
|
+
palettes:'default:Theme default,compact:Blue & slate,mimi:Sage & green,joanna:Warm gray & blue',
|
|
11
|
+
themes:'auto:System,light:Light,dark:Dark'},
|
|
12
|
+
it: {navigation:'Navigazione', settings:'Impostazioni', tools:"Strumenti dell'applicazione",
|
|
13
|
+
appearance:'Tema', palette:'Colori', theme:'Modalità colore',
|
|
14
|
+
palettes:'default:Predefiniti del tema,compact:Blu e ardesia,mimi:Salvia e verde,joanna:Grigio caldo e blu',
|
|
15
|
+
themes:'auto:Sistema,light:Chiaro,dark:Scuro'},
|
|
16
|
+
};
|
|
17
|
+
|
|
6
18
|
export class IndexPage extends FramePage {
|
|
7
19
|
static title = 'Application';
|
|
8
20
|
static shellId = 'index';
|
|
@@ -15,6 +27,12 @@ export class IndexPage extends FramePage {
|
|
|
15
27
|
static themeGroup = null;
|
|
16
28
|
static css = ['/themes/gramlot-index/theme.css'];
|
|
17
29
|
|
|
30
|
+
#language() {
|
|
31
|
+
const language = (this.constructor.locale ?? '').split('-')[0].toLowerCase();
|
|
32
|
+
return TEXTS[language] ? language : 'en';
|
|
33
|
+
}
|
|
34
|
+
#texts() { return TEXTS[this.#language()]; }
|
|
35
|
+
|
|
18
36
|
main(root) {
|
|
19
37
|
const {navigation, datapath, shellId, navigationSelection, themeGroup} = this.constructor;
|
|
20
38
|
if (!(navigation instanceof Bag)) throw new TypeError('IndexPage.navigation must be a Bag');
|
|
@@ -29,7 +47,7 @@ export class IndexPage extends FramePage {
|
|
|
29
47
|
})) frame.dataSetter({datapath,destination_path,value});
|
|
30
48
|
this.commandBar(frame);
|
|
31
49
|
super.main(frame.center);
|
|
32
|
-
const settings = frame.center.floatingPane({id:`${shellId}-settings`, title:
|
|
50
|
+
const settings = frame.center.floatingPane({id:`${shellId}-settings`, title:this.#texts().settings, datapath,
|
|
33
51
|
open:'^.settingsOpen', width:'390px', height:'420px'});
|
|
34
52
|
settings.frame.center.setAttr({padding:'12px', overflow:'auto'});
|
|
35
53
|
this.settings(settings.frame.center);
|
|
@@ -41,17 +59,17 @@ export class IndexPage extends FramePage {
|
|
|
41
59
|
region.setAttr({id:`${shellId}-rail-region`, width:'42px', class:'gramlot-index-rail-region', datapath});
|
|
42
60
|
const rail = region.menu({id:`${shellId}-rail`, class:'gramlot-index-rail',
|
|
43
61
|
presentation:'bar', orientation:'vertical', labelPosition:'tooltip', icon_size:24,
|
|
44
|
-
width:'100%', height:'100%', aria_label:
|
|
62
|
+
width:'100%', height:'100%', aria_label:this.#texts().tools});
|
|
45
63
|
for (const tool of sidebarTools) {
|
|
46
64
|
if (tool && typeof tool === 'object' && !Array.isArray(tool)) {
|
|
47
65
|
rail.menuline(tool);
|
|
48
66
|
} else if (tool === 'toolbar') {
|
|
49
67
|
this.toolbar(rail);
|
|
50
68
|
} else if (tool === 'navigation') {
|
|
51
|
-
rail.menuline({id:`${shellId}-navigation-button`, caption:
|
|
69
|
+
rail.menuline({id:`${shellId}-navigation-button`, caption:this.#texts().navigation, icon:'navigation',
|
|
52
70
|
checked:'^.navigationOpen', action:"this.SET('.navigationOpen', !this.GET('.navigationOpen'))"});
|
|
53
71
|
} else if (tool === 'settings') {
|
|
54
|
-
rail.menuline({id:`${shellId}-settings-button`, caption:
|
|
72
|
+
rail.menuline({id:`${shellId}-settings-button`, caption:this.#texts().settings, icon:'settings',
|
|
55
73
|
checked:'^.settingsOpen', action:"this.SET('.settingsOpen', !this.GET('.settingsOpen'))"});
|
|
56
74
|
} else {
|
|
57
75
|
throw new TypeError(`Unknown IndexPage sidebar tool: ${tool}`);
|
|
@@ -73,16 +91,17 @@ export class IndexPage extends FramePage {
|
|
|
73
91
|
const fields = pane.formlet({columns:1, lbl_position:'L', lbl_text_align:'right',
|
|
74
92
|
box_c_width:'100%', gap:'8px 12px'});
|
|
75
93
|
const prefix = this.constructor.settingsId ?? this.constructor.shellId;
|
|
94
|
+
const texts = this.#texts();
|
|
76
95
|
for (const [name,lbl,values] of [
|
|
77
|
-
['appearance',
|
|
78
|
-
['palette',
|
|
79
|
-
['theme',
|
|
96
|
+
['appearance',texts.appearance,'base:Base,compact:Compact,mimi:Mimi,joanna:Joanna,mela:Mela'],
|
|
97
|
+
['palette',texts.palette,texts.palettes],
|
|
98
|
+
['theme',texts.theme,texts.themes],
|
|
80
99
|
]) fields.filteringSelect({id:`${prefix}-${name}`, lbl, value:`^.${name}`, values, validate_notnull:true});
|
|
81
100
|
return fields;
|
|
82
101
|
}
|
|
83
102
|
left(pane) {
|
|
84
103
|
pane.setAttr({width: '240px', splitter: true, nodeId:`${this.constructor.shellId}Navigation`,
|
|
85
|
-
drawer: "^.navigationOpen:={} ? true : 'close'", drawer_label:
|
|
104
|
+
drawer: "^.navigationOpen:={} ? true : 'close'", drawer_label: this.#texts().navigation});
|
|
86
105
|
pane.dataController({script: "this.SET('.navigationOpen', open)",
|
|
87
106
|
[`subscribe_${this.constructor.shellId}Navigation_closable_change`]: true});
|
|
88
107
|
pane.tree({node_label: 'tree', storepath: '.navigation',
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
// Generated from assets/icons/.
|
|
2
2
|
export type ToolbarIconName =
|
|
3
|
+
| 'align-center'
|
|
4
|
+
| 'align-justify'
|
|
5
|
+
| 'align-left'
|
|
6
|
+
| 'align-right'
|
|
3
7
|
| 'applications'
|
|
4
8
|
| 'archive'
|
|
5
9
|
| 'attachment'
|
|
10
|
+
| 'bold'
|
|
6
11
|
| 'book'
|
|
7
12
|
| 'bookmark'
|
|
8
13
|
| 'calendar'
|
|
@@ -23,6 +28,7 @@ export type ToolbarIconName =
|
|
|
23
28
|
| 'download'
|
|
24
29
|
| 'duplicate'
|
|
25
30
|
| 'edit'
|
|
31
|
+
| 'eraser'
|
|
26
32
|
| 'expand'
|
|
27
33
|
| 'export'
|
|
28
34
|
| 'eye'
|
|
@@ -32,12 +38,18 @@ export type ToolbarIconName =
|
|
|
32
38
|
| 'group'
|
|
33
39
|
| 'help'
|
|
34
40
|
| 'home'
|
|
41
|
+
| 'horizontal-rule'
|
|
42
|
+
| 'image'
|
|
35
43
|
| 'import'
|
|
44
|
+
| 'indent'
|
|
36
45
|
| 'info'
|
|
37
46
|
| 'inspector'
|
|
47
|
+
| 'italic'
|
|
38
48
|
| 'last'
|
|
39
49
|
| 'layers'
|
|
40
50
|
| 'link'
|
|
51
|
+
| 'list-bulleted'
|
|
52
|
+
| 'list-numbered'
|
|
41
53
|
| 'list'
|
|
42
54
|
| 'lock'
|
|
43
55
|
| 'logout'
|
|
@@ -45,11 +57,13 @@ export type ToolbarIconName =
|
|
|
45
57
|
| 'new'
|
|
46
58
|
| 'next'
|
|
47
59
|
| 'open'
|
|
60
|
+
| 'outdent'
|
|
48
61
|
| 'palette'
|
|
49
62
|
| 'panel-bottom'
|
|
50
63
|
| 'panel-left'
|
|
51
64
|
| 'panel-right'
|
|
52
65
|
| 'panel-top'
|
|
66
|
+
| 'paragraph'
|
|
53
67
|
| 'paste'
|
|
54
68
|
| 'pause'
|
|
55
69
|
| 'pin'
|
|
@@ -60,13 +74,16 @@ export type ToolbarIconName =
|
|
|
60
74
|
| 'refresh'
|
|
61
75
|
| 'save'
|
|
62
76
|
| 'search'
|
|
77
|
+
| 'select-all'
|
|
63
78
|
| 'send'
|
|
64
79
|
| 'settings'
|
|
65
80
|
| 'sort-ascending'
|
|
66
81
|
| 'sort-descending'
|
|
67
82
|
| 'stop'
|
|
83
|
+
| 'strikethrough'
|
|
68
84
|
| 'table'
|
|
69
85
|
| 'tree'
|
|
86
|
+
| 'underline'
|
|
70
87
|
| 'undo'
|
|
71
88
|
| 'unlock'
|
|
72
89
|
| 'upload'
|
package/src/view/labelbox.js
CHANGED
|
@@ -28,8 +28,12 @@ export const labelboxStyle = `.gramlot-labelbox>.label-box>.label-menu-trigger{f
|
|
|
28
28
|
.gramlot-labelbox[data-variant='card']>.control-box{padding:12px}
|
|
29
29
|
.gramlot-labelbox[data-movable]>.label-box{cursor:grab;touch-action:none;user-select:none}
|
|
30
30
|
.gramlot-labelbox[data-movable]>.label-box>label{cursor:inherit;user-select:none;-webkit-user-select:none}
|
|
31
|
+
gramlot-form-tray-pane > .gramlot-labelbox[data-selected]{outline:1px solid #dd8200;outline-offset:-1px}
|
|
31
32
|
.gramlot-labelbox[data-selected]{outline:2px solid var(--gramlot-focus-ring,var(--gramlot-brand-blue,#3766b5));outline-offset:-2px}
|
|
32
|
-
.gramlot-labelbox[data-tray-block]>.label-box{position:relative
|
|
33
|
+
.gramlot-labelbox[data-tray-block]>.label-box{position:relative}
|
|
34
|
+
gramlot-tray-pane > .gramlot-labelbox[data-tray-block]>.label-box{padding-inline:88px 32px}
|
|
35
|
+
gramlot-form-tray-pane > .gramlot-labelbox>.label-box{font-weight:600}
|
|
36
|
+
gramlot-form-tray-pane > .gramlot-labelbox[data-selected]>.label-box{padding-inline:30px}
|
|
33
37
|
.gramlot-labelbox>.label-box>.tray-settings-button{position:absolute;left:31px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:26px;height:26px;padding:4px;border:0;border-radius:4px;background:transparent;color:inherit;cursor:pointer}
|
|
34
38
|
.gramlot-labelbox>.label-box>button[hidden]{display:none}
|
|
35
39
|
.gramlot-labelbox>.label-box>.tray-settings-button[data-kind=layer]{left:59px}
|
|
@@ -44,6 +48,7 @@ export const labelboxStyle = `.gramlot-labelbox>.label-box>.label-menu-trigger{f
|
|
|
44
48
|
.tray-settings-button:focus-visible{outline:2px solid var(--gramlot-focus-ring,Highlight);outline-offset:-2px}
|
|
45
49
|
|
|
46
50
|
.gramlot-labelbox>.label-box>.tray-rotate{position:absolute;left:3px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:26px;height:26px;padding:4px;border:0;border-radius:4px;background:transparent;color:inherit;cursor:grab;touch-action:none;opacity:.7}
|
|
51
|
+
.gramlot-labelbox>.label-box>.tray-rotate[hidden]{display:none}
|
|
47
52
|
.tray-rotate svg{width:18px;height:18px;pointer-events:none}
|
|
48
53
|
.gramlot-labelbox>.label-box>.tray-rotate:hover{opacity:1;background:color-mix(in srgb,currentColor 12%,transparent)}
|
|
49
54
|
.tray-rotate:focus-visible{opacity:1;outline:2px solid var(--gramlot-focus-ring,Highlight);outline-offset:-2px}
|
package/src/visual-editor.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export class VisualEditorLogic {
|
|
|
13
13
|
chatPickAttachments(node:SourceBagNode, ...args:unknown[]):unknown;
|
|
14
14
|
chatRenderAttachments(node:SourceBagNode, ...args:unknown[]):unknown;
|
|
15
15
|
chatRemoveAttachment(node:SourceBagNode, ...args:unknown[]):unknown;
|
|
16
|
+
chatDraftKey(node:SourceBagNode, ...args:unknown[]):unknown;
|
|
16
17
|
chatSend(node:SourceBagNode, ...args:unknown[]):unknown;
|
|
17
18
|
assistantState(node:SourceBagNode, ...args:unknown[]):unknown;
|
|
18
19
|
assistantApply(node:SourceBagNode, ...args:unknown[]):unknown;
|
package/src/visual-editor.js
CHANGED
|
@@ -5,7 +5,7 @@ import {SourcePicker} from './source-picker.js';
|
|
|
5
5
|
import {appearanceStyles, paletteStyles} from './index-page-styles.js';
|
|
6
6
|
import {toolIcons} from './visual-editor-icons.js';
|
|
7
7
|
import {Bag} from '@genrojs/bag';
|
|
8
|
-
import {chatRender, chatSend, chatCompleted, chatReset, chatResize, chatPickAttachments, chatRenderAttachments, chatRemoveAttachment} from './chat.js';
|
|
8
|
+
import {chatRender, chatSend, chatDraftKey, chatCompleted, chatReset, chatResize, chatPickAttachments, chatRenderAttachments, chatRemoveAttachment} from './chat.js';
|
|
9
9
|
|
|
10
10
|
export function visualEditorScope(node) {
|
|
11
11
|
for (let scope = node; scope; scope = scope.parentNode) {
|
|
@@ -30,14 +30,14 @@ const catalogueSections = [
|
|
|
30
30
|
['html.document', 'Document and metadata', 'html head body title base meta link style script noscript template slot'],
|
|
31
31
|
['components.layout.containers', 'Containers', 'borderContainer contentPane framePane stackContainer tabContainer'],
|
|
32
32
|
['components.layout.windows', 'Windows', 'dialog floatingPane'],
|
|
33
|
-
['components.layout.composition', 'Composition', 'formlet groupBox trayPane transformPane'],
|
|
33
|
+
['components.layout.composition', 'Composition', 'formlet groupBox trayPane formTrayPane transformPane'],
|
|
34
34
|
['components.inputs.text', 'Text', 'textbox textBoxArea passwordbox'],
|
|
35
35
|
['components.inputs.choices', 'Choices', 'checkbox radioButton radioButtonText checkBoxText filteringSelect comboBox callbackSelect dbSelect dbComboBox'],
|
|
36
36
|
['components.inputs.numbers', 'Numbers and colors', 'numberTextBox horizontalSlider verticalSlider knob starRating colorpicker'],
|
|
37
37
|
['components.inputs.dates', 'Dates and times', 'dateTextBox timeTextBox dateCalendar'],
|
|
38
38
|
['components.commands', 'Buttons and menus', 'button toggleButton dropDownButton menu menuline spacer'],
|
|
39
39
|
['components.data', 'Trees and grids', 'tree grid searchBox'],
|
|
40
|
-
['components.editors', 'Editors and previews', 'codeMirror
|
|
40
|
+
['components.editors', 'Editors and previews', 'codeMirror htmlPreview markdownEditor markdownPreview typstPreview']
|
|
41
41
|
];
|
|
42
42
|
const sectionTitles = {html:'HTML', components:'Gramlot', 'components.layout':'Layout', 'components.inputs':'Inputs'};
|
|
43
43
|
const styleParameters = Object.fromEntries(['class','style','width','height','padding','margin','color','background']
|
|
@@ -82,6 +82,7 @@ export class VisualEditorLogic {
|
|
|
82
82
|
chatPickAttachments(node) { return chatPickAttachments(this.page, node); }
|
|
83
83
|
chatRenderAttachments(node, params) { return chatRenderAttachments(this.page, node, params); }
|
|
84
84
|
chatRemoveAttachment(node) { return chatRemoveAttachment(this.page, node); }
|
|
85
|
+
chatDraftKey(node, event) { return chatDraftKey(this.page, node, event); }
|
|
85
86
|
chatSend(node) {
|
|
86
87
|
if (node.GET('.pending') || !node.GET('.conversation.ready') || !node.GET('.draft')?.trim()) return;
|
|
87
88
|
const editor = visualEditorScope(node);
|
|
@@ -321,6 +321,7 @@
|
|
|
321
321
|
/* Resident Bag grid: shared palette and theme density. */
|
|
322
322
|
:root {
|
|
323
323
|
--gramlot-grid-background: var(--gramlot-surface);
|
|
324
|
+
--gramlot-grid-empty-background: var(--gramlot-surface-subtle);
|
|
324
325
|
--gramlot-grid-color: var(--gramlot-ink);
|
|
325
326
|
--gramlot-grid-border-color: var(--gramlot-border);
|
|
326
327
|
--gramlot-grid-header-background: light-dark(#e5e7eb, #373b42);
|
|
@@ -505,3 +506,9 @@
|
|
|
505
506
|
/* A toolbar with no tools and no authored items takes no space (it may hold an empty text node). */
|
|
506
507
|
.gramlot-grid-toolbar:not(:has(> *)) { display:none; }
|
|
507
508
|
.gramlot-grid-toolbar > .gramlot-grid-search { margin-inline-start:auto; }
|
|
509
|
+
|
|
510
|
+
/* The layer of `_waitingMessage` over the element of a remote node while its request runs (legacy hiderLayer). */
|
|
511
|
+
.gramlot-waiting-host { position:relative; }
|
|
512
|
+
.gramlot-waiting-layer { position:absolute; inset:0; z-index:399; display:flex; align-items:center; justify-content:center;
|
|
513
|
+
background:color-mix(in srgb, var(--gramlot-surface, #ffffff) 55%, transparent); }
|
|
514
|
+
.gramlot-waiting-message { text-align:center; font-size:2em; font-weight:600; color:var(--gramlot-text-secondary, #555555); }
|