@gramlot/gramlot 0.2.20 → 0.3.1
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 +10 -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 +56 -23
- 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,13 +418,13 @@ 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\n/* Presentation changes preserve the inspector runtime and selection. */\n:host([hidden]) { display: none; }\n:host([docked]) { display: block; height: 100%; min-height: 0; }\n:host([docked][hidden]) { display: none; }\n:host([docked]) > div { height: 100%; }\n:host([docked]) .targetbar select { min-height: 40px; font-size: 16px; }\n:host([docked]) .property-row { min-height: 36px; font-size: 13px; }\n:host([docked]) .property-row input { min-height: 35px; font-size: 16px; }\n:host([docked]) .remove { opacity: 1; min-height: 35px; width: 32px; }\n\n:host([docked]) { --tree-action-size: 28px; --tree-font-size: 14px; --tree-row-height: 40px; --separator-size: 14px; }\n:host([docked]) .targetbar { height: 44px; }\n:host([docked]) gramlot-poc-tabs > button { height: 44px; font-size: 14px; }\n:host([docked]) .properties-heading { height: 40px; font-size: 13px; }\n:host([docked]) .properties-heading button { width: 36px; height: 36px; }\n:host([docked]) .property-value select { height: 35px; font-size: 14px; }\n";
|
|
417
422
|
|
|
418
423
|
// ../tools/poc/gramlot-poc-tree.js
|
|
419
424
|
import { Bag as Bag2 } from "@gramlot/gramlot";
|
|
420
425
|
|
|
421
426
|
// ../tools/poc/gramlot-poc-tree.css
|
|
422
|
-
var gramlot_poc_tree_default = "/* Copyright 2025-2026 Softwell S.r.l. - SPDX-License-Identifier: Apache-2.0\n * Inspector subset of the DevTools storeTree stylesheet and inspector.css variables. */\n:host { display:block; font:11px/18px -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; color:#38414b; }\n:host([hidden]) { display:none; }\nul { list-style:none; margin:0; padding-left:17px; }\n.tree-root { padding-left:
|
|
427
|
+
var gramlot_poc_tree_default = "/* Copyright 2025-2026 Softwell S.r.l. - SPDX-License-Identifier: Apache-2.0\n * Inspector subset of the DevTools storeTree stylesheet and inspector.css variables. */\n:host { display:block; font:var(--tree-font-size,11px)/var(--tree-row-height,18px) -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; color:#38414b; }\n:host([hidden]) { display:none; }\nul { list-style:none; margin:0; padding-left:17px; }\n.tree-root { padding-left:calc(var(--tree-action-size,14px) + 2px); }\n.tree-root > ul { padding-left:2px; }\nsummary, .leaf { position:relative; }\nli { line-height:var(--tree-row-height,18px); }\nsummary { display:flex; align-items:center; gap:7px; padding:0 5px; cursor:pointer; user-select:none; list-style:none; }\nsummary::-webkit-details-marker { display:none; }\nsummary::before { content:''; width:5px; height:5px; border-right:1.5px solid #78818a; border-bottom:1.5px solid #78818a; transform:rotate(-45deg); flex:none; margin:0 3px; }\ndetails[open] > summary::before { transform:rotate(45deg); }\n.leaf { display:flex; align-items:center; gap:7px; padding:0 5px 0 23px; cursor:pointer; }\nsummary:hover,.leaf:hover { background:#f0f3f6; }\n.selected,.selected:hover { background:transparent; color:#315dbd; font-weight:700; border-radius:2px; }\n.caption { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }\n/* Reserve a left gutter; showing an action must not shift the node label. */\n.actions { position:absolute; left:calc(-1 * var(--tree-action-size,14px)); top:0; display:inline-flex; opacity:0; pointer-events:none; }\nsummary:hover > .actions,.leaf:hover > .actions,summary:focus-visible > .actions,.leaf:focus-visible > .actions,\n.actions:has(button:focus-visible),.actions:has(button.active) { opacity:1; pointer-events:auto; }\n.actions button { border:0; background:transparent; color:#80868b; font:inherit; font-size:11px; line-height:var(--tree-row-height,18px); width:var(--tree-action-size,14px); height:var(--tree-row-height,18px); padding:0; cursor:pointer; border-radius:3px; }\n.actions button:hover { background:#e1e5ed; }\n.actions button[data-action=breakpoint] { font-size:0; }\n.actions button[data-action=breakpoint]::before { content:''; display:inline-block; box-sizing:border-box; width:8px; height:8px; border:1.5px solid currentColor; border-radius:50%; vertical-align:middle; }\n.actions button.active { color:#b3261e; }\n.actions button.active.conditional { color:#f9ab00; }\n.actions button.active[data-action=breakpoint]::before { background:currentColor; }\n.actions button:focus-visible,summary:focus-visible,.leaf:focus-visible { outline:2px solid #356f9f; outline-offset:-2px; }\n\n@media (hover: none) { .actions { opacity:1; pointer-events:auto; } }\n";
|
|
423
428
|
|
|
424
429
|
// ../tools/poc/gramlot-poc-tree.js
|
|
425
430
|
var sequence = 0;
|
|
@@ -599,7 +604,10 @@ var GramlotPocPalette = class extends HTMLElement {
|
|
|
599
604
|
this.attachShadow({ mode: "open" }).innerHTML = `<style>
|
|
600
605
|
:host{box-sizing:border-box;position:fixed;z-index:2147483647;left:16px;top:16px;width:480px;height:620px;min-width:min(280px,100vw);min-height:200px;max-width:calc(100vw - 16px);max-height:calc(100vh - 16px);display:block;font:11px/1.45 -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;background:white;color:#38414b;border:1px solid #b9bec5;border-radius:4px;box-shadow:0 6px 22px #20283026;overflow:hidden}
|
|
601
606
|
*{box-sizing:border-box}.frame{height:100%;display:flex;flex-direction:column}.bar{display:flex;align-items:center;height:25px;min-height:25px;padding:0 4px;border-bottom:1px solid #d8d8dc;background:#eceef1;cursor:move;touch-action:none;user-select:none}.title{flex:1;min-width:0;text-align:left;padding-left:5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:600}.body{flex:1;min-height:0;display:flex;flex-direction:column}.resize{position:absolute;right:2px;bottom:2px;width:14px;height:14px;cursor:nwse-resize;touch-action:none;background:repeating-linear-gradient(135deg,transparent 0 3px,#aab0b8 3px 4px,transparent 4px 6px);clip-path:polygon(100% 0,100% 100%,0 100%)}button{font:inherit;color:#69727c;background:transparent;border:0;cursor:pointer}.close,.collapse{width:22px;flex:none;height:22px;font-size:18px;line-height:18px;padding:0}.close:hover,.collapse:hover{background:#dce1e7}.bar:focus-visible,button:focus-visible{outline:2px solid #356f9f;outline-offset:-2px}.resize:focus-visible{clip-path:none}::slotted(*){min-height:0}
|
|
602
|
-
:host([
|
|
607
|
+
:host([docked]){position:relative!important;inset:0!important;width:100%!important;height:100%!important;min-width:0;min-height:0;max-width:none;max-height:none;border:0;border-radius:0;box-shadow:none}
|
|
608
|
+
:host([docked]) .bar,:host([docked]) .resize{display:none}
|
|
609
|
+
:host([docked][collapsed]) .body{display:flex}
|
|
610
|
+
:host([collapsed]:not([docked])){height:27px!important;min-height:27px}:host([collapsed]:not([docked])) .body,:host([collapsed]:not([docked])) .resize{display:none}
|
|
603
611
|
</style><div class="frame" role="dialog" aria-modal="false" aria-labelledby="title"><div class="bar" tabindex="0" aria-label="Move inspector: arrow keys, Home to reset"><span class="title" id="title"></span><button class="collapse" type="button" aria-label="Collapse inspector" aria-expanded="true" aria-controls="palette-body">\u2212</button><button class="close" type="button" aria-label="Close inspector">\xD7</button></div><div class="body" id="palette-body"><slot></slot></div><button class="resize" type="button" aria-label="Resize inspector: arrow keys"></button></div>`;
|
|
604
612
|
this._bar = this.shadowRoot.querySelector(".bar");
|
|
605
613
|
this._grip = this.shadowRoot.querySelector(".resize");
|
|
@@ -639,7 +647,7 @@ var GramlotPocPalette = class extends HTMLElement {
|
|
|
639
647
|
}
|
|
640
648
|
});
|
|
641
649
|
}
|
|
642
|
-
this._fit = () => this._adjust(this.getBoundingClientRect(), 0, 0, false);
|
|
650
|
+
this._fit = () => !this.hasAttribute("docked") && this._adjust(this.getBoundingClientRect(), 0, 0, false);
|
|
643
651
|
}
|
|
644
652
|
get collapsed() {
|
|
645
653
|
return this.hasAttribute("collapsed");
|
|
@@ -704,7 +712,7 @@ var GramlotPocSplitter = class extends HTMLElement {
|
|
|
704
712
|
constructor() {
|
|
705
713
|
super();
|
|
706
714
|
this.attachShadow({ mode: "open" }).innerHTML = `<style>
|
|
707
|
-
:host{display:grid;grid-template-rows:minmax(60px,var(--top-size,45%)) 6px minmax(60px,1fr);min-height:126px;flex:1;overflow:hidden}
|
|
715
|
+
:host{display:grid;grid-template-rows:minmax(60px,var(--top-size,45%)) var(--separator-size,6px) minmax(60px,1fr);min-height:126px;flex:1;overflow:hidden}
|
|
708
716
|
.region{overflow:auto;min-height:0;min-width:0}.handle{position:relative;background:#e4e7eb;cursor:row-resize;touch-action:none;user-select:none}.handle:after{content:'';position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);height:1px;width:28px;background:#c2c9d3}.handle:hover{background:#c4d9ef}.handle:focus-visible{outline:2px solid #356f9f;outline-offset:-2px}::slotted(*){min-height:0}
|
|
709
717
|
</style><div class="region"><slot name="top"></slot></div><div class="handle" role="separator" aria-label="Resize tree and properties" aria-orientation="horizontal" tabindex="0" aria-valuemin="10" aria-valuemax="90" aria-valuenow="45"></div><div class="region"><slot name="bottom"></slot></div>`;
|
|
710
718
|
const handle = this.shadowRoot.querySelector(".handle");
|
|
@@ -744,6 +752,12 @@ customElements.define("gramlot-poc-splitter", GramlotPocSplitter);
|
|
|
744
752
|
// ../tools/gramlot-tools-inspector/src/gramlot-tools-inspector.js
|
|
745
753
|
var nextId = 0;
|
|
746
754
|
var GramlotToolsInspector = class extends HTMLElement {
|
|
755
|
+
static observedAttributes = ["docked"];
|
|
756
|
+
attributeChangedCallback() {
|
|
757
|
+
if (this.#ui && !this.hasAttribute("embedded")) {
|
|
758
|
+
this.#ui.src.source.getNode("main.palette").setAttr({ docked: this.hasAttribute("docked") ? "" : null });
|
|
759
|
+
}
|
|
760
|
+
}
|
|
747
761
|
#target = null;
|
|
748
762
|
#connection = null;
|
|
749
763
|
#connectionRelease = null;
|
|
@@ -878,6 +892,10 @@ var GramlotToolsInspector = class extends HTMLElement {
|
|
|
878
892
|
ui.data.setItem("editor.dirty", true);
|
|
879
893
|
ui.data.setItem("editor.status", "Unsaved changes");
|
|
880
894
|
}
|
|
895
|
+
enumChanged(node) {
|
|
896
|
+
this.editChanged(node);
|
|
897
|
+
inspector.#applyEdit();
|
|
898
|
+
}
|
|
881
899
|
typeChanged(node) {
|
|
882
900
|
const row = ui.data.getItem(`editor.rows.${node.getAttr("data-row")}`);
|
|
883
901
|
row.setItem("inputType", inspector.#inputType(row.getItem("type")));
|
|
@@ -1060,11 +1078,11 @@ var GramlotToolsInspector = class extends HTMLElement {
|
|
|
1060
1078
|
const builder = new GramlotBuilder();
|
|
1061
1079
|
const root = builder.root;
|
|
1062
1080
|
root.style(gramlot_tools_inspector_default);
|
|
1063
|
-
const palette = this.hasAttribute("embedded") ? root.section({ node_label: "palette", class: "embedded-panel", "aria-label": "Gramlot inspector" }) : root.webcomponent({ code: "gramlot-poc-palette", node_label: "palette", title: "Gramlot inspector", connect_onclose: "inspector.close" });
|
|
1081
|
+
const palette = this.hasAttribute("embedded") ? root.section({ node_label: "palette", class: "embedded-panel", "aria-label": "Gramlot inspector" }) : root.webcomponent({ code: "gramlot-poc-palette", node_label: "palette", title: "Gramlot inspector", docked: this.hasAttribute("docked") ? "" : null, connect_onclose: "inspector.close" });
|
|
1064
1082
|
const targetbar = palette.div({ node_label: "targetbar", class: "targetbar", hidden: "^singleTarget" });
|
|
1065
1083
|
targetbar.select({ node_label: "targets", value: "^targetId", disabled: "^busy", "aria-label": "Inspected page", connect_onchange: "inspector.selectTarget" });
|
|
1066
1084
|
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.
|
|
1085
|
+
for (const name of ["Data", "Source", "Styles"]) toolbar.html_button(name, {
|
|
1068
1086
|
node_label: name.toLowerCase(),
|
|
1069
1087
|
type: "button",
|
|
1070
1088
|
role: "tab",
|
|
@@ -1086,7 +1104,7 @@ var GramlotToolsInspector = class extends HTMLElement {
|
|
|
1086
1104
|
const properties = content.section({ node_label: "properties", slot: "bottom", class: "properties", "aria-label": "Selected node properties" });
|
|
1087
1105
|
const heading = properties.div({ class: "properties-heading" });
|
|
1088
1106
|
heading.span("Properties", { class: "heading-label" });
|
|
1089
|
-
heading.
|
|
1107
|
+
heading.html_button("^breakpointCount", {
|
|
1090
1108
|
type: "button",
|
|
1091
1109
|
class: "breakpoint-count",
|
|
1092
1110
|
hidden: "^noBreakpoints",
|
|
@@ -1094,7 +1112,7 @@ var GramlotToolsInspector = class extends HTMLElement {
|
|
|
1094
1112
|
title: "Active breakpoints",
|
|
1095
1113
|
connect_onclick: "inspector.showBreakpoints"
|
|
1096
1114
|
});
|
|
1097
|
-
heading.
|
|
1115
|
+
heading.html_button("+", {
|
|
1098
1116
|
type: "button",
|
|
1099
1117
|
"aria-label": "Add attribute",
|
|
1100
1118
|
title: "Add attribute",
|
|
@@ -1110,8 +1128,8 @@ var GramlotToolsInspector = class extends HTMLElement {
|
|
|
1110
1128
|
const styles = palette.section({ node_label: "styles", class: "styles-panel", hidden: "^treeActive", "aria-label": "CSS variables" });
|
|
1111
1129
|
const stylebar = styles.div({ class: "styles-toolbar" });
|
|
1112
1130
|
stylebar.span("Document variables");
|
|
1113
|
-
stylebar.
|
|
1114
|
-
stylebar.
|
|
1131
|
+
stylebar.html_button("Refresh", { type: "button", disabled: "^styles.busy", connect_onclick: "inspector.refreshStyles" });
|
|
1132
|
+
stylebar.html_button("Reset all", { type: "button", disabled: "^styles.noChanges", connect_onclick: "inspector.resetStyles" });
|
|
1115
1133
|
stylebar.a("Download CSS", { href: "^styles.downloadUrl", download: "theme-overrides.css", "aria-disabled": "^styles.noDownload" });
|
|
1116
1134
|
styles.p("Temporary preview \xB7 Enter or leave a field to apply. Closing the connection clears previews.", { class: "styles-help" });
|
|
1117
1135
|
styles.p("^styles.status", { role: "status", class: "styles-status" });
|
|
@@ -1127,12 +1145,12 @@ var GramlotToolsInspector = class extends HTMLElement {
|
|
|
1127
1145
|
breakpoint.input({ value: "^editor.condition", live: true, connect_oninput: "inspector.breakpointChanged", "aria-label": "Breakpoint condition", placeholder: "Condition (optional)" });
|
|
1128
1146
|
breakpoint.p("^breakpointStatus", { role: "status", class: "breakpoint-status" });
|
|
1129
1147
|
const actions = breakpoint.div({ class: "dialog-actions" });
|
|
1130
|
-
actions.
|
|
1131
|
-
actions.
|
|
1148
|
+
actions.html_button("Cancel", { type: "button", connect_onclick: "inspector.closeBreakpoint" });
|
|
1149
|
+
actions.html_button("Save", { type: "button", connect_onclick: "inspector.setBreakpoint" });
|
|
1132
1150
|
const list = palette.dialog({ node_label: "breakpoints", "aria-label": "Active breakpoints", class: "breakpoint-dialog" });
|
|
1133
1151
|
list.h2("Active breakpoints");
|
|
1134
1152
|
list.div({ node_label: "entries" });
|
|
1135
|
-
list.div({ class: "dialog-actions" }).
|
|
1153
|
+
list.div({ class: "dialog-actions" }).html_button("Close", { type: "button", connect_onclick: "inspector.closeBreakpoints" });
|
|
1136
1154
|
ui.src.startSource(builder.source);
|
|
1137
1155
|
for (const name of ["data", "source"]) this.#trees[name] = ui.dom.getDomNode(ui.src.source.getNode(`main.palette.content.tree.${name}`));
|
|
1138
1156
|
this.#renderTargets();
|
|
@@ -1349,7 +1367,7 @@ ${declarations}
|
|
|
1349
1367
|
"data-field": "color",
|
|
1350
1368
|
connect_onchange: "inspector.setStyle"
|
|
1351
1369
|
});
|
|
1352
|
-
row.
|
|
1370
|
+
row.html_button("\u21B6", {
|
|
1353
1371
|
type: "button",
|
|
1354
1372
|
"aria-label": `Reset ${record.name}`,
|
|
1355
1373
|
title: "Reset variable",
|
|
@@ -1419,6 +1437,7 @@ ${declarations}
|
|
|
1419
1437
|
this.#snapshot = entry ? {
|
|
1420
1438
|
node: entry.node,
|
|
1421
1439
|
value: entry.node.getValue(true),
|
|
1440
|
+
parameterEnums: ui.data.getItem("root") !== "source" ? {} : this.#connection ? this.#connection.nodeInfo(entry.node).parameterEnums : readParameterEnums(entry.node),
|
|
1422
1441
|
attrs: { ...entry.node.getAttr() },
|
|
1423
1442
|
resolver: entry.node.resolver,
|
|
1424
1443
|
revision: this.#connection?.nodeInfo(entry.node)?.revision
|
|
@@ -1456,7 +1475,20 @@ ${declarations}
|
|
|
1456
1475
|
if (fresh) label.input({ value: "^.name", live: true, "aria-label": "New attribute name", "data-row": row.label, connect_oninput: "inspector.editChanged" });
|
|
1457
1476
|
else label.span(name);
|
|
1458
1477
|
const cell = line.div({ class: "property-value" });
|
|
1459
|
-
|
|
1478
|
+
const choices = !primary && this.#snapshot.parameterEnums[name];
|
|
1479
|
+
const value = data.getItem("text");
|
|
1480
|
+
if (choices && choices.includes(value)) {
|
|
1481
|
+
const select = cell.select({
|
|
1482
|
+
value: "^.text",
|
|
1483
|
+
class: "enum-value",
|
|
1484
|
+
disabled: locked,
|
|
1485
|
+
"aria-label": `${name} value`,
|
|
1486
|
+
"data-row": row.label,
|
|
1487
|
+
connect_onchange: "inspector.enumChanged",
|
|
1488
|
+
connect_onkeydown: "inspector.editKey"
|
|
1489
|
+
});
|
|
1490
|
+
for (const choice of choices) select.option(choice, { value: choice });
|
|
1491
|
+
} else cell.input({
|
|
1460
1492
|
value: "^.text",
|
|
1461
1493
|
type: "^.inputType",
|
|
1462
1494
|
live: true,
|
|
@@ -1470,10 +1502,10 @@ ${declarations}
|
|
|
1470
1502
|
});
|
|
1471
1503
|
if (fresh) {
|
|
1472
1504
|
const type = cell.select({ value: "^.type", "aria-label": "New attribute type", "data-row": row.label, connect_onchange: "inspector.typeChanged" });
|
|
1473
|
-
for (const
|
|
1505
|
+
for (const value2 of editorTypes) type.option(value2, { value: value2 });
|
|
1474
1506
|
}
|
|
1475
1507
|
if (!primary) {
|
|
1476
|
-
const button = cell.
|
|
1508
|
+
const button = cell.html_button({
|
|
1477
1509
|
type: "button",
|
|
1478
1510
|
disabled: locked,
|
|
1479
1511
|
"aria-label": `Remove ${name || "new attribute"}`,
|
|
@@ -1509,6 +1541,7 @@ ${declarations}
|
|
|
1509
1541
|
this.#loadEditor(this.#selected());
|
|
1510
1542
|
} else {
|
|
1511
1543
|
this.#snapshot = {
|
|
1544
|
+
...this.#snapshot,
|
|
1512
1545
|
node: target,
|
|
1513
1546
|
value: target.getValue(true),
|
|
1514
1547
|
attrs: { ...target.getAttr() },
|
|
@@ -1668,7 +1701,7 @@ ${declarations}
|
|
|
1668
1701
|
const config = node.value;
|
|
1669
1702
|
const row = builder.root.div({ class: "breakpoint-entry" });
|
|
1670
1703
|
row.span(`${config.getItem("root")}: ${config.getItem("path")} \xB7 ${config.getItem("mode")} \xB7 ${config.getItem("hits")} hits`);
|
|
1671
|
-
row.
|
|
1704
|
+
row.html_button("\xD7", {
|
|
1672
1705
|
type: "button",
|
|
1673
1706
|
"aria-label": `Remove breakpoint ${config.getItem("root")}: ${config.getItem("path")}`,
|
|
1674
1707
|
"data-breakpoint": node.label,
|