@gramlot/gramlot 0.2.20 → 0.3.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/dist/gramlot.js +1343 -303
- package/dist/gramlot.min.js +363 -24
- package/package.json +6 -3
- package/src/binding/ask-dialog.js +2 -2
- package/src/binding/inline.js +3 -10
- package/src/binding/installation.js +2 -1
- package/src/binding/pointer.js +12 -148
- package/src/binding/providers.js +2 -1
- package/src/binding/runtime.js +2 -1
- package/src/bootstrap.d.ts +2 -0
- package/src/bootstrap.js +9 -2
- package/src/builder/gramlot-builder.js +21 -4
- package/src/builder/source.js +11 -10
- package/src/components/bases.js +182 -0
- package/src/components/buttons.js +254 -0
- package/src/components/choice-editor.js +221 -0
- package/src/components/choices.js +13 -0
- package/src/components/date-calendar.js +139 -0
- package/src/components/field-state.js +166 -0
- package/src/components/formlet-labels.js +80 -0
- package/src/components/index.js +5 -0
- package/src/components/inputs.js +196 -0
- package/src/components/labelbox.js +74 -0
- package/src/components/layout.js +190 -0
- package/src/components/parameters.js +6 -0
- package/src/components/popup.js +22 -0
- package/src/components/registry.js +83 -0
- package/src/components/typed-editor.js +260 -0
- package/src/components/validation.js +138 -0
- package/src/format.js +13 -6
- package/src/gramlot.d.ts +5 -1
- package/src/gramlot.js +8 -1
- package/src/handlers/dom-handler.d.ts +1 -0
- package/src/handlers/dom-handler.js +7 -0
- package/src/index-page-runtime.js +78 -30
- package/src/index-page-styles.js +2 -2
- package/src/index-theme.js +1 -1
- package/src/renderer/attributes.js +3 -40
- package/src/renderer/gramlot-html-renderer.js +4 -3
- package/src/renderer/gramlot-renderer.js +62 -4
- package/src/server/gramlot-server.d.ts +3 -0
- package/src/server/gramlot-server.js +9 -3
- package/src/server/index-page.d.ts +1 -0
- package/src/server/index-page.js +8 -3
- package/src/server/page-base.js +1 -0
- package/src/server/page.d.ts +1 -0
- package/src/server/resources.d.ts +2 -0
- package/src/view/button.js +17 -13
- package/src/view/controls.js +152 -4
- package/src/view/html.js +18 -0
- package/themes/gramlot-base/README.md +6 -0
- package/themes/gramlot-base/theme.css +34 -6
- package/themes/gramlot-compact/README.md +6 -0
- package/themes/gramlot-compact/theme.css +8 -4
- package/themes/joanna/README.md +23 -0
- package/themes/joanna/theme.css +89 -0
- package/themes/mimi/README.md +23 -0
- package/themes/mimi/theme.css +89 -0
- package/tools/gramlot-tools-inspector.js +42 -18
- package/tools/inspector-agent.js +8 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Gramlot Base: application UI theme. Brand sources: assets/branding/theme-tokens.json. */
|
|
2
|
-
@layer gramlot.reset, gramlot.tokens, gramlot.base, gramlot.components, gramlot.utilities;
|
|
2
|
+
@layer gramlot.reset, gramlot.tokens, gramlot.base, gramlot.components, gramlot.utilities, gramlot.touch;
|
|
3
3
|
|
|
4
4
|
@layer gramlot.reset {
|
|
5
5
|
*, *::before, *::after { box-sizing: border-box; }
|
|
@@ -34,6 +34,12 @@
|
|
|
34
34
|
--gramlot-error: #b13d48;
|
|
35
35
|
--gramlot-error-background: #fceef0;
|
|
36
36
|
|
|
37
|
+
--gramlot-field-height: 2.75rem;
|
|
38
|
+
--gramlot-field-padding: .55rem .75rem;
|
|
39
|
+
--gramlot-field-font-size: .875rem;
|
|
40
|
+
--gramlot-field-background: var(--gramlot-surface);
|
|
41
|
+
--gramlot-field-readonly-background: var(--gramlot-surface-subtle);
|
|
42
|
+
--gramlot-label-size: 1em;
|
|
37
43
|
--gramlot-font-ui: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
38
44
|
--gramlot-font-code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
39
45
|
--gramlot-space-1: 0.25rem;
|
|
@@ -185,14 +191,14 @@
|
|
|
185
191
|
display: block;
|
|
186
192
|
inline-size: 100%;
|
|
187
193
|
min-inline-size: 0;
|
|
188
|
-
min-block-size:
|
|
194
|
+
min-block-size: var(--gramlot-field-height);
|
|
189
195
|
border: 1px solid var(--gramlot-border-control);
|
|
190
196
|
border-radius: var(--gramlot-radius-sm);
|
|
191
|
-
background: var(--gramlot-
|
|
197
|
+
background: var(--gramlot-field-background);
|
|
192
198
|
color: var(--gramlot-ink);
|
|
193
|
-
padding:
|
|
194
|
-
font-size:
|
|
195
|
-
line-height: 1.5;
|
|
199
|
+
padding: var(--gramlot-field-padding);
|
|
200
|
+
font-size: var(--gramlot-field-font-size);
|
|
201
|
+
line-height: var(--gramlot-field-line-height,1.5);
|
|
196
202
|
}
|
|
197
203
|
:where(textarea) { min-block-size: 7rem; resize: vertical; }
|
|
198
204
|
:where(input, textarea)::placeholder { color: var(--gramlot-text-secondary); opacity: 1; }
|
|
@@ -262,3 +268,25 @@
|
|
|
262
268
|
html { scroll-behavior: auto; }
|
|
263
269
|
*, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
|
|
264
270
|
}
|
|
271
|
+
|
|
272
|
+
/* Interaction density is independent of the selected color/profile theme. */
|
|
273
|
+
@layer gramlot.touch {
|
|
274
|
+
:root[data-gramlot-touch="on"] {--gramlot-touch-target:44px; --gramlot-field-height:44px; --gramlot-field-font-size:16px;
|
|
275
|
+
--gramlot-field-padding:8px 10px; --gramlot-field-line-height:1.35;
|
|
276
|
+
--gramlot-label-size:14px; --gramlot-label-gap:6px; --gramlot-space-2:10px;
|
|
277
|
+
--gramlot-calendar-width:322px; --gramlot-choice-toggle-width:44px;}
|
|
278
|
+
@media (pointer: coarse) {
|
|
279
|
+
:root:not([data-gramlot-touch="off"]) {--gramlot-touch-target:44px; --gramlot-field-height:44px; --gramlot-field-font-size:16px;
|
|
280
|
+
--gramlot-field-padding:8px 10px; --gramlot-field-line-height:1.35;
|
|
281
|
+
--gramlot-label-size:14px; --gramlot-label-gap:6px; --gramlot-space-2:10px;
|
|
282
|
+
--gramlot-calendar-width:322px; --gramlot-choice-toggle-width:44px;}
|
|
283
|
+
}
|
|
284
|
+
button, select, input:not([type=checkbox]):not([type=radio]), summary {
|
|
285
|
+
min-block-size:var(--gramlot-touch-target, revert-layer);
|
|
286
|
+
}
|
|
287
|
+
button { min-inline-size:var(--gramlot-touch-target, revert-layer); }
|
|
288
|
+
input[type=checkbox], input[type=radio] {
|
|
289
|
+
min-inline-size:calc(var(--gramlot-touch-target, 0px) / 2);
|
|
290
|
+
min-block-size:calc(var(--gramlot-touch-target, 0px) / 2);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
@@ -47,3 +47,9 @@ Color mode is independent: `data-theme="light"` or `data-theme="dark"` on the
|
|
|
47
47
|
document root selects it, otherwise Base follows the system preference. Application
|
|
48
48
|
CSS outside the Gramlot cascade layers can override both themes. Browser zoom remains
|
|
49
49
|
available; multiline controls keep their native behavior.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
For additional compact palettes, load `mimi/theme.css` or
|
|
53
|
+
`joanna/theme.css` after Base and Compact. Both inherit the same semantic
|
|
54
|
+
variables and style input components as well as ordinary HTML. See
|
|
55
|
+
[theme profiles](../../docs/public/096-themes-and-css.md#gc-096-017).
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */
|
|
2
2
|
@layer gramlot.tokens {
|
|
3
3
|
:root {
|
|
4
|
+
--gramlot-field-height: 28px;
|
|
5
|
+
--gramlot-field-line-height: 1.35;
|
|
6
|
+
--gramlot-field-padding: .25rem .5rem;
|
|
7
|
+
--gramlot-field-font-size: 1rem;
|
|
4
8
|
--gramlot-space-1: .2rem;
|
|
5
9
|
--gramlot-space-2: .4rem;
|
|
6
10
|
--gramlot-space-3: .5rem;
|
|
@@ -35,10 +39,10 @@
|
|
|
35
39
|
}
|
|
36
40
|
:where(label) { font-size: .95rem; }
|
|
37
41
|
:where(input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]), select, textarea) {
|
|
38
|
-
min-block-size:
|
|
39
|
-
padding:
|
|
40
|
-
font-size:
|
|
41
|
-
line-height:
|
|
42
|
+
min-block-size: var(--gramlot-field-height);
|
|
43
|
+
padding: var(--gramlot-field-padding);
|
|
44
|
+
font-size: var(--gramlot-field-font-size);
|
|
45
|
+
line-height: var(--gramlot-field-line-height);
|
|
42
46
|
}
|
|
43
47
|
:where(textarea) { min-block-size: 5rem; }
|
|
44
48
|
:where(input[type="color"]) { min-block-size: 28px; }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# joanna
|
|
2
|
+
|
|
3
|
+
A Gramlot interpretation of GenroPy's `joanna` theme. The light palette
|
|
4
|
+
comes from `resources/common/themes/joanna.css` in GenroPy; styles are
|
|
5
|
+
implemented for current HTML and Gramlot components, without Dojo dependencies.
|
|
6
|
+
Dark mode is a new coordinated adaptation. It is not a pixel-identical port of
|
|
7
|
+
legacy layout widgets. Legacy user color variants are outside this increment.
|
|
8
|
+
|
|
9
|
+
Load Base, Compact and this profile in order:
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
class Page(BasePage):
|
|
13
|
+
css = ("/themes/gramlot-base/theme.css",
|
|
14
|
+
"/themes/gramlot-compact/theme.css",
|
|
15
|
+
"/themes/joanna/theme.css")
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The index/gallery Theme selector applies this same CSS to the shell and frames.
|
|
19
|
+
Color mode is independent. CSS variables inherit into input shadow roots, including
|
|
20
|
+
labels, choices, calendar and validation messages. Application CSS can override the
|
|
21
|
+
semantic variables; component-specific Source attributes keep normal precedence.
|
|
22
|
+
|
|
23
|
+
Density refinement: live Mimi invoice fields measured 17.5px / 12px text / 10.8px labels. Gramlot Mimi uses 18px fields, joanna 20px; both use 1px × 3px padding, 2px label gap and 6px stack spacing. joanna retains its own 13px typography and Joanna .8em label ratio; only Mimi was measured in the live invoice. Override field-line-height and label-gap using the shared --gramlot-* tokens.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* Gramlot adaptation of legacy joanna; load after Base and Compact. */
|
|
2
|
+
@layer gramlot.tokens {
|
|
3
|
+
:root {
|
|
4
|
+
--gramlot-background: #F2F2F7;
|
|
5
|
+
--gramlot-surface: #FFFFFF;
|
|
6
|
+
--gramlot-surface-subtle: #F2F2F7;
|
|
7
|
+
--gramlot-ink: #3A3A3C;
|
|
8
|
+
--gramlot-text-secondary: #636366;
|
|
9
|
+
--gramlot-border: #D1D1D6;
|
|
10
|
+
--gramlot-border-control: #AEAEB2;
|
|
11
|
+
--gramlot-navigation: #3A3A3C;
|
|
12
|
+
--gramlot-navigation-text: #FFFFFF;
|
|
13
|
+
--gramlot-action: #007AFF;
|
|
14
|
+
--gramlot-action-hover: #0061CC;
|
|
15
|
+
--gramlot-brand-blue: #007AFF;
|
|
16
|
+
--gramlot-brand-yellow: #AEAEB2;
|
|
17
|
+
--gramlot-selected: #E0EFFF;
|
|
18
|
+
--gramlot-focus-ring: #007AFF;
|
|
19
|
+
--gramlot-field-background: #FFFFFF;
|
|
20
|
+
--gramlot-field-readonly-background: #F2F2F7;
|
|
21
|
+
--gramlot-error: #B3261E;
|
|
22
|
+
--gramlot-error-background: #FFF1F0;
|
|
23
|
+
--gramlot-shadow: 0 1px 4px rgb(0 0 0 / 6%);
|
|
24
|
+
--gramlot-radius-sm: 6px;
|
|
25
|
+
--gramlot-radius: 6px;
|
|
26
|
+
--gramlot-radius-lg: 6px;
|
|
27
|
+
--gramlot-field-height: 20px;
|
|
28
|
+
--gramlot-field-padding: 1px 3px;
|
|
29
|
+
--gramlot-field-line-height: 1.15;
|
|
30
|
+
--gramlot-field-font-size: 1rem;
|
|
31
|
+
--gramlot-label-size: .8em;
|
|
32
|
+
--gramlot-label-gap: 2px;
|
|
33
|
+
--gramlot-label-color: var(--gramlot-text-secondary);
|
|
34
|
+
--gramlot-space-4: 6px;
|
|
35
|
+
--gramlot-font-ui: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
|
|
36
|
+
}
|
|
37
|
+
@media (prefers-color-scheme: dark) {
|
|
38
|
+
:root:not([data-theme="light"]) {
|
|
39
|
+
--gramlot-background: #1C1C1E;
|
|
40
|
+
--gramlot-surface: #2C2C2E;
|
|
41
|
+
--gramlot-surface-subtle: #3A3A3C;
|
|
42
|
+
--gramlot-ink: #F2F2F7;
|
|
43
|
+
--gramlot-text-secondary: #C7C7CC;
|
|
44
|
+
--gramlot-border: #636366;
|
|
45
|
+
--gramlot-border-control: #8E8E93;
|
|
46
|
+
--gramlot-navigation: #1C1C1E;
|
|
47
|
+
--gramlot-action: #78B7FF;
|
|
48
|
+
--gramlot-action-hover: #A6CFFF;
|
|
49
|
+
--gramlot-brand-blue: #3478CA;
|
|
50
|
+
--gramlot-selected: #254163;
|
|
51
|
+
--gramlot-focus-ring: #78B7FF;
|
|
52
|
+
--gramlot-field-background: #202124;
|
|
53
|
+
--gramlot-field-readonly-background: #3A3A3C;
|
|
54
|
+
--gramlot-error: #FFB4AB;
|
|
55
|
+
--gramlot-error-background: #482524;
|
|
56
|
+
--gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
:root[data-theme="dark"] {
|
|
60
|
+
--gramlot-background: #1C1C1E;
|
|
61
|
+
--gramlot-surface: #2C2C2E;
|
|
62
|
+
--gramlot-surface-subtle: #3A3A3C;
|
|
63
|
+
--gramlot-ink: #F2F2F7;
|
|
64
|
+
--gramlot-text-secondary: #C7C7CC;
|
|
65
|
+
--gramlot-border: #636366;
|
|
66
|
+
--gramlot-border-control: #8E8E93;
|
|
67
|
+
--gramlot-navigation: #1C1C1E;
|
|
68
|
+
--gramlot-action: #78B7FF;
|
|
69
|
+
--gramlot-action-hover: #A6CFFF;
|
|
70
|
+
--gramlot-brand-blue: #3478CA;
|
|
71
|
+
--gramlot-selected: #254163;
|
|
72
|
+
--gramlot-focus-ring: #78B7FF;
|
|
73
|
+
--gramlot-field-background: #202124;
|
|
74
|
+
--gramlot-field-readonly-background: #3A3A3C;
|
|
75
|
+
--gramlot-error: #FFB4AB;
|
|
76
|
+
--gramlot-error-background: #482524;
|
|
77
|
+
--gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
@layer gramlot.base {
|
|
81
|
+
html { font-size: 13px; }
|
|
82
|
+
}
|
|
83
|
+
@layer gramlot.components {
|
|
84
|
+
:where(label) { font-size: var(--gramlot-label-size); font-weight: normal; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }
|
|
85
|
+
:where(button, input[type="button"], input[type="submit"], input[type="reset"], .button) { min-block-size: 26px; padding: 2px 8px; font-weight: 500; }
|
|
86
|
+
}
|
|
87
|
+
@layer gramlot.utilities {
|
|
88
|
+
.card { box-shadow: var(--gramlot-shadow); }
|
|
89
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# mimi
|
|
2
|
+
|
|
3
|
+
A Gramlot interpretation of GenroPy's `mimi` theme. The light palette
|
|
4
|
+
comes from `resources/common/themes/mimi.css` in GenroPy; styles are
|
|
5
|
+
implemented for current HTML and Gramlot components, without Dojo dependencies.
|
|
6
|
+
Dark mode is a new coordinated adaptation. It is not a pixel-identical port of
|
|
7
|
+
legacy layout widgets. Legacy user color variants are outside this increment.
|
|
8
|
+
|
|
9
|
+
Load Base, Compact and this profile in order:
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
class Page(BasePage):
|
|
13
|
+
css = ("/themes/gramlot-base/theme.css",
|
|
14
|
+
"/themes/gramlot-compact/theme.css",
|
|
15
|
+
"/themes/mimi/theme.css")
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The index/gallery Theme selector applies this same CSS to the shell and frames.
|
|
19
|
+
Color mode is independent. CSS variables inherit into input shadow roots, including
|
|
20
|
+
labels, choices, calendar and validation messages. Application CSS can override the
|
|
21
|
+
semantic variables; component-specific Source attributes keep normal precedence.
|
|
22
|
+
|
|
23
|
+
Density refinement: live Mimi invoice fields measured 17.5px / 12px text / 10.8px labels. Gramlot Mimi uses 18px fields, joanna 20px; both use 1px × 3px padding, 2px label gap and 6px stack spacing. joanna retains its own 13px typography and Joanna .8em label ratio; only Mimi was measured in the live invoice. Override field-line-height and label-gap using the shared --gramlot-* tokens.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* Gramlot adaptation of legacy mimi; load after Base and Compact. */
|
|
2
|
+
@layer gramlot.tokens {
|
|
3
|
+
:root {
|
|
4
|
+
--gramlot-background: #EDEEF0;
|
|
5
|
+
--gramlot-surface: #F5F5F6;
|
|
6
|
+
--gramlot-surface-subtle: #E0E1E3;
|
|
7
|
+
--gramlot-ink: #3C3D40;
|
|
8
|
+
--gramlot-text-secondary: #6B6E72;
|
|
9
|
+
--gramlot-border: #BDBFC2;
|
|
10
|
+
--gramlot-border-control: #9EA0A3;
|
|
11
|
+
--gramlot-navigation: #48494C;
|
|
12
|
+
--gramlot-navigation-text: #FFFFFF;
|
|
13
|
+
--gramlot-action: #0071E3;
|
|
14
|
+
--gramlot-action-hover: #005BBB;
|
|
15
|
+
--gramlot-brand-blue: #0071E3;
|
|
16
|
+
--gramlot-brand-yellow: #9EA0A3;
|
|
17
|
+
--gramlot-selected: #E8F1FC;
|
|
18
|
+
--gramlot-focus-ring: #0071E3;
|
|
19
|
+
--gramlot-field-background: #FFFFFF;
|
|
20
|
+
--gramlot-field-readonly-background: #E0E1E3;
|
|
21
|
+
--gramlot-error: #B3261E;
|
|
22
|
+
--gramlot-error-background: #FFF1F0;
|
|
23
|
+
--gramlot-shadow: 0 1px 4px rgb(0 0 0 / 6%);
|
|
24
|
+
--gramlot-radius-sm: 4px;
|
|
25
|
+
--gramlot-radius: 3px;
|
|
26
|
+
--gramlot-radius-lg: 3px;
|
|
27
|
+
--gramlot-field-height: 18px;
|
|
28
|
+
--gramlot-field-padding: 1px 3px;
|
|
29
|
+
--gramlot-field-line-height: 1.15;
|
|
30
|
+
--gramlot-field-font-size: 1rem;
|
|
31
|
+
--gramlot-label-size: .9em;
|
|
32
|
+
--gramlot-label-gap: 2px;
|
|
33
|
+
--gramlot-label-color: var(--gramlot-text-secondary);
|
|
34
|
+
--gramlot-space-4: 6px;
|
|
35
|
+
--gramlot-font-ui: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
|
|
36
|
+
}
|
|
37
|
+
@media (prefers-color-scheme: dark) {
|
|
38
|
+
:root:not([data-theme="light"]) {
|
|
39
|
+
--gramlot-background: #242527;
|
|
40
|
+
--gramlot-surface: #303134;
|
|
41
|
+
--gramlot-surface-subtle: #3C3D40;
|
|
42
|
+
--gramlot-ink: #F2F2F7;
|
|
43
|
+
--gramlot-text-secondary: #C7C7CC;
|
|
44
|
+
--gramlot-border: #6B6E72;
|
|
45
|
+
--gramlot-border-control: #8E8E93;
|
|
46
|
+
--gramlot-navigation: #1C1C1E;
|
|
47
|
+
--gramlot-action: #78B7FF;
|
|
48
|
+
--gramlot-action-hover: #A6CFFF;
|
|
49
|
+
--gramlot-brand-blue: #3478CA;
|
|
50
|
+
--gramlot-selected: #254163;
|
|
51
|
+
--gramlot-focus-ring: #78B7FF;
|
|
52
|
+
--gramlot-field-background: #202124;
|
|
53
|
+
--gramlot-field-readonly-background: #3C3D40;
|
|
54
|
+
--gramlot-error: #FFB4AB;
|
|
55
|
+
--gramlot-error-background: #482524;
|
|
56
|
+
--gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
:root[data-theme="dark"] {
|
|
60
|
+
--gramlot-background: #242527;
|
|
61
|
+
--gramlot-surface: #303134;
|
|
62
|
+
--gramlot-surface-subtle: #3C3D40;
|
|
63
|
+
--gramlot-ink: #F2F2F7;
|
|
64
|
+
--gramlot-text-secondary: #C7C7CC;
|
|
65
|
+
--gramlot-border: #6B6E72;
|
|
66
|
+
--gramlot-border-control: #8E8E93;
|
|
67
|
+
--gramlot-navigation: #1C1C1E;
|
|
68
|
+
--gramlot-action: #78B7FF;
|
|
69
|
+
--gramlot-action-hover: #A6CFFF;
|
|
70
|
+
--gramlot-brand-blue: #3478CA;
|
|
71
|
+
--gramlot-selected: #254163;
|
|
72
|
+
--gramlot-focus-ring: #78B7FF;
|
|
73
|
+
--gramlot-field-background: #202124;
|
|
74
|
+
--gramlot-field-readonly-background: #3C3D40;
|
|
75
|
+
--gramlot-error: #FFB4AB;
|
|
76
|
+
--gramlot-error-background: #482524;
|
|
77
|
+
--gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
@layer gramlot.base {
|
|
81
|
+
html { font-size: 12px; }
|
|
82
|
+
}
|
|
83
|
+
@layer gramlot.components {
|
|
84
|
+
:where(label) { font-size: var(--gramlot-label-size); font-weight: normal; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }
|
|
85
|
+
:where(button, input[type="button"], input[type="submit"], input[type="reset"], .button) { min-block-size: 24px; padding: 2px 8px; font-weight: 500; }
|
|
86
|
+
}
|
|
87
|
+
@layer gramlot.utilities {
|
|
88
|
+
.card { box-shadow: var(--gramlot-shadow); }
|
|
89
|
+
}
|
|
@@ -49,6 +49,9 @@ function parseScalar(type, text) {
|
|
|
49
49
|
}
|
|
50
50
|
throw new Error(`Invalid ${type} value: ${text || "(empty)"}`);
|
|
51
51
|
}
|
|
52
|
+
function readParameterEnums(node) {
|
|
53
|
+
return Object.fromEntries(Object.entries(node._getMeta("gramlot_component")?.parameters ?? {}).filter(([, spec]) => spec.enum).map(([name, spec]) => [name, spec.enum]));
|
|
54
|
+
}
|
|
52
55
|
|
|
53
56
|
// ../tools/gramlot-tools-inspector/src/inspector-styles.js
|
|
54
57
|
var InspectorStyles = class {
|
|
@@ -141,7 +144,7 @@ function attachInspectorAgent(gramlot, port) {
|
|
|
141
144
|
if (!identities.has(node)) identities.set(node, ++nextNode);
|
|
142
145
|
return identities.get(node);
|
|
143
146
|
};
|
|
144
|
-
const describe = (store, ancestors = /* @__PURE__ */ new Set()) => {
|
|
147
|
+
const describe = (store, root, ancestors = /* @__PURE__ */ new Set()) => {
|
|
145
148
|
if (ancestors.has(store)) throw new Error("Inspector snapshots require an acyclic Bag");
|
|
146
149
|
const next = /* @__PURE__ */ new Set([...ancestors, store]);
|
|
147
150
|
return store.getNodes().map((node) => {
|
|
@@ -152,15 +155,16 @@ function attachInspectorAgent(gramlot, port) {
|
|
|
152
155
|
label: node.label,
|
|
153
156
|
revision: versions.get(node) ?? 0,
|
|
154
157
|
value: branch ? null : cell(value),
|
|
155
|
-
children: branch ? describe(value, next) : null,
|
|
158
|
+
children: branch ? describe(value, root, next) : null,
|
|
156
159
|
readonly: !!node.resolver,
|
|
160
|
+
parameterEnums: root === "source" ? readParameterEnums(node) : {},
|
|
157
161
|
attrs: Object.entries(node.getAttr()).filter(([name]) => name !== "_meta").map(([name, value2]) => [name, cell(value2)])
|
|
158
162
|
};
|
|
159
163
|
});
|
|
160
164
|
};
|
|
161
165
|
const snapshot = () => ({
|
|
162
|
-
data: describe(bag("data")),
|
|
163
|
-
source: describe(bag("source")),
|
|
166
|
+
data: describe(bag("data"), "data"),
|
|
167
|
+
source: describe(bag("source"), "source"),
|
|
164
168
|
breakpoints: [...breakpoints.values()].map(({ test, ...record }) => record)
|
|
165
169
|
});
|
|
166
170
|
const send = (data) => {
|
|
@@ -382,6 +386,7 @@ var InspectorConnection = class {
|
|
|
382
386
|
id: row.id,
|
|
383
387
|
revision: row.revision,
|
|
384
388
|
branch,
|
|
389
|
+
parameterEnums: row.parameterEnums,
|
|
385
390
|
readonly: row.readonly || !!row.value?.readonly,
|
|
386
391
|
readonlyAttrs: new Set(row.attrs.filter(([, descriptor]) => descriptor.readonly).map(([name]) => name)),
|
|
387
392
|
valueWire: JSON.stringify(row.value),
|
|
@@ -413,7 +418,7 @@ var InspectorConnection = class {
|
|
|
413
418
|
};
|
|
414
419
|
|
|
415
420
|
// ../tools/gramlot-tools-inspector/src/gramlot-tools-inspector.css
|
|
416
|
-
var gramlot_tools_inspector_default = ":host { all: initial; color-scheme: light; font: 12px/1.4 system-ui, sans-serif; color: #38414b; }\n* { box-sizing: border-box; }\nbutton, input, select { font: inherit; color: inherit; }\nbutton { cursor: pointer; }\nbutton:focus-visible, input:focus-visible, select:focus-visible { outline: 1px solid #3574cb; outline-offset: -1px; }\n.tree { padding: 7px 3px; }\n.properties { background: white; }\n.properties-heading { font-size: 11px; display: flex; align-items: center; justify-content: space-between; height: 29px; padding: 0 8px; background: #f1f3f5; color: #6d7989; border-bottom: 1px solid #d1d7df; }\n.properties-heading button { background: white; border: 1px solid #c5cdda; border-radius: 2px; width: 23px; height: 23px; padding: 0; font-size: 18px; line-height: 20px; }\nfieldset { border: 0; margin: 0; padding: 0; min-width: 0; }\n.property-row { display: grid; grid-template-columns: minmax(95px, 30%) minmax(0, 1fr); min-height: 20px; border-bottom: 1px solid #d1d7df; font-size: 11px; }\n.property-name { display: flex; align-items: center; justify-content: flex-end; background: #888; color: white; font-weight: 700; padding: 1px 6px; border-right: 1px solid #d1d7df; overflow-wrap: anywhere; text-align: right; }\n.property-value { display: flex; align-items: center; min-width: 0; }\n.property-row input { border: 0; border-radius: 0; min-width: 0; width: 100%; height: 19px; padding: 1px 5px; background: transparent; }\n.property-name input { color: white; text-align: right; padding: 0; }\n.property-value input { flex: 1; }\n.property-value input[type=checkbox] { flex: none; width: 14px; height: 14px; margin: 2px 6px; }\n.property-value select { max-width: 82px; height: 20px; padding: 0; border: 0; border-left: 1px solid #d1d7df; background: #f1f3f5; font-size: 10px; }\n.remove { margin-left: auto; flex: none; width: 22px; height: 20px; padding: 3px; border: 0; background: transparent; color: #7c8797; opacity: 0; }\n.remove svg { width: 13px; height: 13px; }\n.property-row:hover .remove, .property-row:focus-within .remove { opacity: 1; }\n.remove:hover { color: #b82323; background: #fbe9e9; }\n:disabled { cursor: default; opacity: .65; }\n.path { flex: none; padding: 5px 9px; border-top: 1px solid #c9cfd6; background: #f5f7f9; color: #697687; font-size: 11px; min-height: 27px; overflow-wrap: anywhere; }\n.error, .edit-status, .breakpoint-status, .breakpoint-line { font-size: 11px; margin: 0; padding: 3px 8px; overflow-wrap: anywhere; }\n.error, .edit-status, .breakpoint-status { color: #a12121; }\n.breakpoint-line { background: #fff2ed; color: #854127; border-bottom: 1px solid #d1d7df; }\n.error:empty, .edit-status:empty, .breakpoint-status:empty, .breakpoint-line:empty { display: none; }\n.breakpoint-dialog { width: min(340px, 90vw); color: #38414b; border: 1px solid #bbc3cf; border-radius: 4px; padding: 12px; box-shadow: 0 8px 28px #0003; font: 12px/1.4 system-ui, sans-serif; }\n.breakpoint-dialog::backdrop { background: #0002; }\n.breakpoint-dialog h2 { font-size: 13px; margin: 0 0 10px; overflow-wrap: anywhere; }\n.breakpoint-dialog select, .breakpoint-dialog input { width: 100%; border: 1px solid #bbc3cf; padding: 4px; margin: 0 0 7px; background: white; }\n.dialog-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 7px; }\n.dialog-actions button { padding: 3px 10px; border: 1px solid #bbc3cf; border-radius: 3px; background: #f1f3f5; }\n.heading-label { flex: 1; }\n.properties-heading .breakpoint-count { width: auto; padding: 0 5px; margin-right: 5px; font-size: 11px; color: #b04a35; }\n.breakpoint-entry { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid #d1d7df; }\n.breakpoint-entry span { flex: 1; overflow-wrap: anywhere; }\n.breakpoint-entry button { background: transparent; border: 0; font-size: 17px; }\n[hidden] { display: none !important; }\n.targetbar { flex: none; height: 28px; padding: 2px 6px; background: #edf2fa; border-bottom: 1px solid #dadce0; }\n.targetbar select { width: 100%; height: 23px; border: 0; background: transparent; font-size: 11px; }\n.styles-panel { flex: 1; min-height: 0; overflow: auto; background: #fff; font-size: 11px; }\n.styles-toolbar { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; background: #f1f3f5; border-bottom: 1px solid #d1d7df; }\n.styles-toolbar span { flex: 1; font-weight: 600; }\n.styles-toolbar button, .styles-toolbar a { padding: 3px 7px; border: 1px solid #c5cdda; border-radius: 3px; background: white; }\n.styles-toolbar a { color: inherit; text-decoration: none; }\n.styles-toolbar a[aria-disabled=true] { cursor: default; opacity: .65; }\n.styles-toolbar a:focus-visible { outline: 1px solid #3574cb; outline-offset: -1px; }\n.styles-help, .styles-empty, .styles-status { margin: 0; padding: 7px 9px; color: #697687; }\n.styles-status { color: #a12121; }\n.styles-status:empty { display: none; }\n.styles-group h3 { margin: 0; padding: 6px 9px; font-size: 11px; background: #edf2fa; border-block: 1px solid #d1d7df; }\n.style-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 25px 23px; align-items: center; gap: 8px; min-width: 0; padding: 3px 9px; border-bottom: 1px solid #e8ebef; }\n.style-row label { min-width: 0; font: 11px/1.4 ui-monospace, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.style-row input { min-width: 0; width: 100%; height: 23px; padding: 2px 5px; border: 1px solid #c5cdda; border-radius: 3px; background: white; }\n.style-row input[type=color] { width: 25px; padding: 1px; cursor: pointer; }\n.style-row button { grid-column: 4; width: 23px; height: 23px; padding: 0; border: 1px solid #c5cdda; border-radius: 3px; background: #f5f7f9; font-size: 15px; }\n\n:host([embedded]) { display: block; height: 100%; min-height: 0; }\n:host([embedded]) > div { height: 100%; }\n.embedded-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }\n";
|
|
421
|
+
var gramlot_tools_inspector_default = ":host { all: initial; color-scheme: light; font: 12px/1.4 system-ui, sans-serif; color: #38414b; }\n* { box-sizing: border-box; }\nbutton, input, select { font: inherit; color: inherit; }\nbutton { cursor: pointer; }\nbutton:focus-visible, input:focus-visible, select:focus-visible { outline: 1px solid #3574cb; outline-offset: -1px; }\n.tree { padding: 7px 3px; }\n.properties { background: white; }\n.properties-heading { font-size: 11px; display: flex; align-items: center; justify-content: space-between; height: 29px; padding: 0 8px; background: #f1f3f5; color: #6d7989; border-bottom: 1px solid #d1d7df; }\n.properties-heading button { background: white; border: 1px solid #c5cdda; border-radius: 2px; width: 23px; height: 23px; padding: 0; font-size: 18px; line-height: 20px; }\nfieldset { border: 0; margin: 0; padding: 0; min-width: 0; }\n.property-row { display: grid; grid-template-columns: minmax(95px, 30%) minmax(0, 1fr); min-height: 20px; border-bottom: 1px solid #d1d7df; font-size: 11px; }\n.property-name { display: flex; align-items: center; justify-content: flex-end; background: #888; color: white; font-weight: 700; padding: 1px 6px; border-right: 1px solid #d1d7df; overflow-wrap: anywhere; text-align: right; }\n.property-value { display: flex; align-items: center; min-width: 0; }\n.property-row input { border: 0; border-radius: 0; min-width: 0; width: 100%; height: 19px; padding: 1px 5px; background: transparent; }\n.property-name input { color: white; text-align: right; padding: 0; }\n.property-value input { flex: 1; }\n.property-value input[type=checkbox] { flex: none; width: 14px; height: 14px; margin: 2px 6px; }\n.property-value select { max-width: 82px; height: 20px; padding: 0; border: 0; border-left: 1px solid #d1d7df; background: #f1f3f5; font-size: 10px; }\n.remove { display: inline-flex; align-items: center; justify-content: center; margin-left: auto; flex: none; width: 22px; height: 20px; padding: 3px; border: 0; background: transparent; color: #7c8797; opacity: 0; }\n.remove svg { width: 13px; height: 13px; }\n.property-row:hover .remove, .property-row:focus-within .remove { opacity: 1; }\n.remove:hover { color: #b82323; background: #fbe9e9; }\n:disabled { cursor: default; opacity: .65; }\n.path { flex: none; padding: 5px 9px; border-top: 1px solid #c9cfd6; background: #f5f7f9; color: #697687; font-size: 11px; min-height: 27px; overflow-wrap: anywhere; }\n.error, .edit-status, .breakpoint-status, .breakpoint-line { font-size: 11px; margin: 0; padding: 3px 8px; overflow-wrap: anywhere; }\n.error, .edit-status, .breakpoint-status { color: #a12121; }\n.breakpoint-line { background: #fff2ed; color: #854127; border-bottom: 1px solid #d1d7df; }\n.error:empty, .edit-status:empty, .breakpoint-status:empty, .breakpoint-line:empty { display: none; }\n.breakpoint-dialog { width: min(340px, 90vw); color: #38414b; border: 1px solid #bbc3cf; border-radius: 4px; padding: 12px; box-shadow: 0 8px 28px #0003; font: 12px/1.4 system-ui, sans-serif; }\n.breakpoint-dialog::backdrop { background: #0002; }\n.breakpoint-dialog h2 { font-size: 13px; margin: 0 0 10px; overflow-wrap: anywhere; }\n.breakpoint-dialog select, .breakpoint-dialog input { width: 100%; border: 1px solid #bbc3cf; padding: 4px; margin: 0 0 7px; background: white; }\n.dialog-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 7px; }\n.dialog-actions button { padding: 3px 10px; border: 1px solid #bbc3cf; border-radius: 3px; background: #f1f3f5; }\n.heading-label { flex: 1; }\n.properties-heading .breakpoint-count { width: auto; padding: 0 5px; margin-right: 5px; font-size: 11px; color: #b04a35; }\n.breakpoint-entry { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid #d1d7df; }\n.breakpoint-entry span { flex: 1; overflow-wrap: anywhere; }\n.breakpoint-entry button { background: transparent; border: 0; font-size: 17px; }\n[hidden] { display: none !important; }\n.targetbar { flex: none; height: 28px; padding: 2px 6px; background: #edf2fa; border-bottom: 1px solid #dadce0; }\n.targetbar select { width: 100%; height: 23px; border: 0; background: transparent; font-size: 11px; }\n.styles-panel { flex: 1; min-height: 0; overflow: auto; background: #fff; font-size: 11px; }\n.styles-toolbar { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; background: #f1f3f5; border-bottom: 1px solid #d1d7df; }\n.styles-toolbar span { flex: 1; font-weight: 600; }\n.styles-toolbar button, .styles-toolbar a { padding: 3px 7px; border: 1px solid #c5cdda; border-radius: 3px; background: white; }\n.styles-toolbar a { color: inherit; text-decoration: none; }\n.styles-toolbar a[aria-disabled=true] { cursor: default; opacity: .65; }\n.styles-toolbar a:focus-visible { outline: 1px solid #3574cb; outline-offset: -1px; }\n.styles-help, .styles-empty, .styles-status { margin: 0; padding: 7px 9px; color: #697687; }\n.styles-status { color: #a12121; }\n.styles-status:empty { display: none; }\n.styles-group h3 { margin: 0; padding: 6px 9px; font-size: 11px; background: #edf2fa; border-block: 1px solid #d1d7df; }\n.style-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 25px 23px; align-items: center; gap: 8px; min-width: 0; padding: 3px 9px; border-bottom: 1px solid #e8ebef; }\n.style-row label { min-width: 0; font: 11px/1.4 ui-monospace, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.style-row input { min-width: 0; width: 100%; height: 23px; padding: 2px 5px; border: 1px solid #c5cdda; border-radius: 3px; background: white; }\n.style-row input[type=color] { width: 25px; padding: 1px; cursor: pointer; }\n.style-row button { grid-column: 4; width: 23px; height: 23px; padding: 0; border: 1px solid #c5cdda; border-radius: 3px; background: #f5f7f9; font-size: 15px; }\n\n:host([embedded]) { display: block; height: 100%; min-height: 0; }\n:host([embedded]) > div { height: 100%; }\n.embedded-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }\n\n.property-value select.enum-value { flex: 1; min-width: 0; max-width: none; width: 100%; border: 0; background: white; font: inherit; padding: 1px 5px; }\n";
|
|
417
422
|
|
|
418
423
|
// ../tools/poc/gramlot-poc-tree.js
|
|
419
424
|
import { Bag as Bag2 } from "@gramlot/gramlot";
|
|
@@ -878,6 +883,10 @@ var GramlotToolsInspector = class extends HTMLElement {
|
|
|
878
883
|
ui.data.setItem("editor.dirty", true);
|
|
879
884
|
ui.data.setItem("editor.status", "Unsaved changes");
|
|
880
885
|
}
|
|
886
|
+
enumChanged(node) {
|
|
887
|
+
this.editChanged(node);
|
|
888
|
+
inspector.#applyEdit();
|
|
889
|
+
}
|
|
881
890
|
typeChanged(node) {
|
|
882
891
|
const row = ui.data.getItem(`editor.rows.${node.getAttr("data-row")}`);
|
|
883
892
|
row.setItem("inputType", inspector.#inputType(row.getItem("type")));
|
|
@@ -1064,7 +1073,7 @@ var GramlotToolsInspector = class extends HTMLElement {
|
|
|
1064
1073
|
const targetbar = palette.div({ node_label: "targetbar", class: "targetbar", hidden: "^singleTarget" });
|
|
1065
1074
|
targetbar.select({ node_label: "targets", value: "^targetId", disabled: "^busy", "aria-label": "Inspected page", connect_onchange: "inspector.selectTarget" });
|
|
1066
1075
|
const toolbar = palette.webcomponent({ code: "gramlot-poc-tabs", node_label: "tabs", role: "tablist", "aria-label": "Inspected root" });
|
|
1067
|
-
for (const name of ["Data", "Source", "Styles"]) toolbar.
|
|
1076
|
+
for (const name of ["Data", "Source", "Styles"]) toolbar.html_button(name, {
|
|
1068
1077
|
node_label: name.toLowerCase(),
|
|
1069
1078
|
type: "button",
|
|
1070
1079
|
role: "tab",
|
|
@@ -1086,7 +1095,7 @@ var GramlotToolsInspector = class extends HTMLElement {
|
|
|
1086
1095
|
const properties = content.section({ node_label: "properties", slot: "bottom", class: "properties", "aria-label": "Selected node properties" });
|
|
1087
1096
|
const heading = properties.div({ class: "properties-heading" });
|
|
1088
1097
|
heading.span("Properties", { class: "heading-label" });
|
|
1089
|
-
heading.
|
|
1098
|
+
heading.html_button("^breakpointCount", {
|
|
1090
1099
|
type: "button",
|
|
1091
1100
|
class: "breakpoint-count",
|
|
1092
1101
|
hidden: "^noBreakpoints",
|
|
@@ -1094,7 +1103,7 @@ var GramlotToolsInspector = class extends HTMLElement {
|
|
|
1094
1103
|
title: "Active breakpoints",
|
|
1095
1104
|
connect_onclick: "inspector.showBreakpoints"
|
|
1096
1105
|
});
|
|
1097
|
-
heading.
|
|
1106
|
+
heading.html_button("+", {
|
|
1098
1107
|
type: "button",
|
|
1099
1108
|
"aria-label": "Add attribute",
|
|
1100
1109
|
title: "Add attribute",
|
|
@@ -1110,8 +1119,8 @@ var GramlotToolsInspector = class extends HTMLElement {
|
|
|
1110
1119
|
const styles = palette.section({ node_label: "styles", class: "styles-panel", hidden: "^treeActive", "aria-label": "CSS variables" });
|
|
1111
1120
|
const stylebar = styles.div({ class: "styles-toolbar" });
|
|
1112
1121
|
stylebar.span("Document variables");
|
|
1113
|
-
stylebar.
|
|
1114
|
-
stylebar.
|
|
1122
|
+
stylebar.html_button("Refresh", { type: "button", disabled: "^styles.busy", connect_onclick: "inspector.refreshStyles" });
|
|
1123
|
+
stylebar.html_button("Reset all", { type: "button", disabled: "^styles.noChanges", connect_onclick: "inspector.resetStyles" });
|
|
1115
1124
|
stylebar.a("Download CSS", { href: "^styles.downloadUrl", download: "theme-overrides.css", "aria-disabled": "^styles.noDownload" });
|
|
1116
1125
|
styles.p("Temporary preview \xB7 Enter or leave a field to apply. Closing the connection clears previews.", { class: "styles-help" });
|
|
1117
1126
|
styles.p("^styles.status", { role: "status", class: "styles-status" });
|
|
@@ -1127,12 +1136,12 @@ var GramlotToolsInspector = class extends HTMLElement {
|
|
|
1127
1136
|
breakpoint.input({ value: "^editor.condition", live: true, connect_oninput: "inspector.breakpointChanged", "aria-label": "Breakpoint condition", placeholder: "Condition (optional)" });
|
|
1128
1137
|
breakpoint.p("^breakpointStatus", { role: "status", class: "breakpoint-status" });
|
|
1129
1138
|
const actions = breakpoint.div({ class: "dialog-actions" });
|
|
1130
|
-
actions.
|
|
1131
|
-
actions.
|
|
1139
|
+
actions.html_button("Cancel", { type: "button", connect_onclick: "inspector.closeBreakpoint" });
|
|
1140
|
+
actions.html_button("Save", { type: "button", connect_onclick: "inspector.setBreakpoint" });
|
|
1132
1141
|
const list = palette.dialog({ node_label: "breakpoints", "aria-label": "Active breakpoints", class: "breakpoint-dialog" });
|
|
1133
1142
|
list.h2("Active breakpoints");
|
|
1134
1143
|
list.div({ node_label: "entries" });
|
|
1135
|
-
list.div({ class: "dialog-actions" }).
|
|
1144
|
+
list.div({ class: "dialog-actions" }).html_button("Close", { type: "button", connect_onclick: "inspector.closeBreakpoints" });
|
|
1136
1145
|
ui.src.startSource(builder.source);
|
|
1137
1146
|
for (const name of ["data", "source"]) this.#trees[name] = ui.dom.getDomNode(ui.src.source.getNode(`main.palette.content.tree.${name}`));
|
|
1138
1147
|
this.#renderTargets();
|
|
@@ -1349,7 +1358,7 @@ ${declarations}
|
|
|
1349
1358
|
"data-field": "color",
|
|
1350
1359
|
connect_onchange: "inspector.setStyle"
|
|
1351
1360
|
});
|
|
1352
|
-
row.
|
|
1361
|
+
row.html_button("\u21B6", {
|
|
1353
1362
|
type: "button",
|
|
1354
1363
|
"aria-label": `Reset ${record.name}`,
|
|
1355
1364
|
title: "Reset variable",
|
|
@@ -1419,6 +1428,7 @@ ${declarations}
|
|
|
1419
1428
|
this.#snapshot = entry ? {
|
|
1420
1429
|
node: entry.node,
|
|
1421
1430
|
value: entry.node.getValue(true),
|
|
1431
|
+
parameterEnums: ui.data.getItem("root") !== "source" ? {} : this.#connection ? this.#connection.nodeInfo(entry.node).parameterEnums : readParameterEnums(entry.node),
|
|
1422
1432
|
attrs: { ...entry.node.getAttr() },
|
|
1423
1433
|
resolver: entry.node.resolver,
|
|
1424
1434
|
revision: this.#connection?.nodeInfo(entry.node)?.revision
|
|
@@ -1456,7 +1466,20 @@ ${declarations}
|
|
|
1456
1466
|
if (fresh) label.input({ value: "^.name", live: true, "aria-label": "New attribute name", "data-row": row.label, connect_oninput: "inspector.editChanged" });
|
|
1457
1467
|
else label.span(name);
|
|
1458
1468
|
const cell = line.div({ class: "property-value" });
|
|
1459
|
-
|
|
1469
|
+
const choices = !primary && this.#snapshot.parameterEnums[name];
|
|
1470
|
+
const value = data.getItem("text");
|
|
1471
|
+
if (choices && choices.includes(value)) {
|
|
1472
|
+
const select = cell.select({
|
|
1473
|
+
value: "^.text",
|
|
1474
|
+
class: "enum-value",
|
|
1475
|
+
disabled: locked,
|
|
1476
|
+
"aria-label": `${name} value`,
|
|
1477
|
+
"data-row": row.label,
|
|
1478
|
+
connect_onchange: "inspector.enumChanged",
|
|
1479
|
+
connect_onkeydown: "inspector.editKey"
|
|
1480
|
+
});
|
|
1481
|
+
for (const choice of choices) select.option(choice, { value: choice });
|
|
1482
|
+
} else cell.input({
|
|
1460
1483
|
value: "^.text",
|
|
1461
1484
|
type: "^.inputType",
|
|
1462
1485
|
live: true,
|
|
@@ -1470,10 +1493,10 @@ ${declarations}
|
|
|
1470
1493
|
});
|
|
1471
1494
|
if (fresh) {
|
|
1472
1495
|
const type = cell.select({ value: "^.type", "aria-label": "New attribute type", "data-row": row.label, connect_onchange: "inspector.typeChanged" });
|
|
1473
|
-
for (const
|
|
1496
|
+
for (const value2 of editorTypes) type.option(value2, { value: value2 });
|
|
1474
1497
|
}
|
|
1475
1498
|
if (!primary) {
|
|
1476
|
-
const button = cell.
|
|
1499
|
+
const button = cell.html_button({
|
|
1477
1500
|
type: "button",
|
|
1478
1501
|
disabled: locked,
|
|
1479
1502
|
"aria-label": `Remove ${name || "new attribute"}`,
|
|
@@ -1509,6 +1532,7 @@ ${declarations}
|
|
|
1509
1532
|
this.#loadEditor(this.#selected());
|
|
1510
1533
|
} else {
|
|
1511
1534
|
this.#snapshot = {
|
|
1535
|
+
...this.#snapshot,
|
|
1512
1536
|
node: target,
|
|
1513
1537
|
value: target.getValue(true),
|
|
1514
1538
|
attrs: { ...target.getAttr() },
|
|
@@ -1668,7 +1692,7 @@ ${declarations}
|
|
|
1668
1692
|
const config = node.value;
|
|
1669
1693
|
const row = builder.root.div({ class: "breakpoint-entry" });
|
|
1670
1694
|
row.span(`${config.getItem("root")}: ${config.getItem("path")} \xB7 ${config.getItem("mode")} \xB7 ${config.getItem("hits")} hits`);
|
|
1671
|
-
row.
|
|
1695
|
+
row.html_button("\xD7", {
|
|
1672
1696
|
type: "button",
|
|
1673
1697
|
"aria-label": `Remove breakpoint ${config.getItem("root")}: ${config.getItem("path")}`,
|
|
1674
1698
|
"data-breakpoint": node.label,
|
package/tools/inspector-agent.js
CHANGED
|
@@ -9,6 +9,9 @@ function scalarType(value) {
|
|
|
9
9
|
}
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
|
+
function readParameterEnums(node) {
|
|
13
|
+
return Object.fromEntries(Object.entries(node._getMeta("gramlot_component")?.parameters ?? {}).filter(([, spec]) => spec.enum).map(([name, spec]) => [name, spec.enum]));
|
|
14
|
+
}
|
|
12
15
|
|
|
13
16
|
// ../tools/gramlot-tools-inspector/src/inspector-styles.js
|
|
14
17
|
var InspectorStyles = class {
|
|
@@ -101,7 +104,7 @@ function attachInspectorAgent(gramlot, port) {
|
|
|
101
104
|
if (!identities.has(node)) identities.set(node, ++nextNode);
|
|
102
105
|
return identities.get(node);
|
|
103
106
|
};
|
|
104
|
-
const describe = (store, ancestors = /* @__PURE__ */ new Set()) => {
|
|
107
|
+
const describe = (store, root, ancestors = /* @__PURE__ */ new Set()) => {
|
|
105
108
|
if (ancestors.has(store)) throw new Error("Inspector snapshots require an acyclic Bag");
|
|
106
109
|
const next = /* @__PURE__ */ new Set([...ancestors, store]);
|
|
107
110
|
return store.getNodes().map((node) => {
|
|
@@ -112,15 +115,16 @@ function attachInspectorAgent(gramlot, port) {
|
|
|
112
115
|
label: node.label,
|
|
113
116
|
revision: versions.get(node) ?? 0,
|
|
114
117
|
value: branch ? null : cell(value),
|
|
115
|
-
children: branch ? describe(value, next) : null,
|
|
118
|
+
children: branch ? describe(value, root, next) : null,
|
|
116
119
|
readonly: !!node.resolver,
|
|
120
|
+
parameterEnums: root === "source" ? readParameterEnums(node) : {},
|
|
117
121
|
attrs: Object.entries(node.getAttr()).filter(([name]) => name !== "_meta").map(([name, value2]) => [name, cell(value2)])
|
|
118
122
|
};
|
|
119
123
|
});
|
|
120
124
|
};
|
|
121
125
|
const snapshot = () => ({
|
|
122
|
-
data: describe(bag("data")),
|
|
123
|
-
source: describe(bag("source")),
|
|
126
|
+
data: describe(bag("data"), "data"),
|
|
127
|
+
source: describe(bag("source"), "source"),
|
|
124
128
|
breakpoints: [...breakpoints.values()].map(({ test, ...record }) => record)
|
|
125
129
|
});
|
|
126
130
|
const send = (data) => {
|