@gramlot/gramlot 0.3.16 → 0.3.18
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/components/editors/__init__.py +1 -1
- package/dist/components/editors/assets/collection.js +16162 -11689
- package/dist/components/editors/assets/index.js +1 -1
- package/dist/components/editors/grammar.json +3 -0
- package/dist/components/inputs/__init__.py +1 -1
- package/dist/components/inputs/assets/collection.js +134 -179
- package/dist/components/inputs/assets/index.js +1 -1
- package/dist/components/inputs/grammar.json +19 -0
- package/dist/components/layout/__init__.py +1 -1
- package/dist/components/layout/assets/collection.js +4643 -3481
- package/dist/components/layout/assets/index.js +1 -1
- package/dist/components/layout/grammar.json +509 -1
- package/dist/components/tree/__init__.py +1 -1
- package/dist/components/tree/assets/collection.js +306 -94
- package/dist/components/tree/assets/index.js +1 -1
- package/dist/components/tree/grammar.json +16 -0
- package/dist/components/typst/__init__.py +1 -1
- package/dist/components/typst/assets/collection.js +2 -2
- package/dist/components/typst/assets/index.js +1 -1
- package/dist/gramlot.js +2126 -506
- package/dist/gramlot.min.js +97 -40
- package/dist/runtime-notices.json +4 -0
- package/package.json +12 -8
- package/src/binding/device-resolver.js +27 -0
- package/src/binding/error-notifications.js +84 -0
- package/src/binding/remote-resolver.d.ts +18 -0
- package/src/binding/remote.js +11 -4
- package/src/binding/runtime.js +6 -2
- package/src/bootstrap.js +4 -4
- package/src/components/buttons.js +10 -3
- package/src/components/code-mirror-engine.js +14 -4
- package/src/components/code-mirror.js +2 -3
- package/src/components/container.js +1 -1
- package/src/components/date-calendar.js +1 -1
- package/src/components/formlet-labels.js +5 -4
- package/src/components/html-document.js +4 -2
- package/src/components/html-editor.js +2 -2
- package/src/components/jodit-engine.js +72 -11
- package/src/components/labelbox.js +19 -63
- package/src/components/layout.js +31 -19
- package/src/components/markdown-document.js +1 -1
- package/src/components/markdown-editor.js +2 -2
- package/src/components/menus.js +7 -6
- package/src/components/prose-mirror-engine.js +14 -1
- package/src/components/registry.js +2 -0
- package/src/components/selected-container.js +107 -14
- package/src/components/toolbar-overflow.js +9 -8
- package/src/components/transform-pane.js +140 -0
- package/src/components/tray-geometry.js +87 -0
- package/src/components/tray-pane.js +435 -0
- package/src/components/tray-settings.js +62 -0
- package/src/components/tree.js +115 -21
- package/src/components/typed-editor.js +1 -1
- package/src/components/typst-client.js +14 -13
- package/src/components/validation.js +1 -1
- package/src/components/window-surface.js +281 -0
- package/src/components/windows.js +32 -261
- package/src/device-frames.js +195 -0
- package/src/filesystem.d.ts +12 -5
- package/src/filesystem.js +8 -8
- package/src/gramlot.d.ts +3 -1
- package/src/gramlot.js +11 -4
- package/src/handlers/device-handler.d.ts +75 -0
- package/src/handlers/device-handler.js +1037 -0
- package/src/handlers/dom-handler.d.ts +2 -0
- package/src/handlers/dom-handler.js +9 -0
- package/src/handlers/rpc-handler.d.ts +2 -2
- package/src/http-transport.d.ts +3 -3
- package/src/http-transport.js +17 -11
- package/src/ide-documents.js +6 -4
- package/src/ide-runtime.d.ts +14 -3
- package/src/ide-runtime.js +123 -94
- package/src/index-page-runtime.d.ts +2 -2
- package/src/index-page-runtime.js +91 -43
- package/src/index-page-styles.js +1 -1
- package/src/index.d.ts +7 -2
- package/src/index.js +5 -1
- package/src/inout.d.ts +1 -1
- package/src/inout.js +5 -1
- package/src/mobile-environment.d.ts +6 -0
- package/src/mobile-environment.js +52 -0
- package/src/navigation-resolver.d.ts +14 -2
- package/src/renderer/attributes.js +5 -2
- package/src/renderer/drag-drop.js +5 -4
- package/src/renderer/gramlot-renderer.d.ts +13 -2
- package/src/renderer/gramlot-renderer.js +49 -13
- package/src/server/index-page.js +4 -4
- package/src/view/controls.js +48 -23
- package/src/view/html.js +85 -4
- package/src/view/labelbox.js +97 -0
- package/themes/gramlot-base/theme.css +10 -0
- package/themes/gramlot-compact/theme.css +6 -0
- package/themes/joanna/theme.css +6 -0
- package/themes/mela/theme.css +68 -15
- package/themes/mimi/theme.css +6 -0
- package/themes/palettes/compact.css +6 -0
- package/themes/palettes/joanna.css +6 -0
- package/themes/palettes/mimi.css +6 -0
- package/src/date-parser/civil.js +0 -61
- package/src/date-parser/index.d.ts +0 -18
- package/src/date-parser/index.js +0 -196
- package/src/date-parser/locales.js +0 -257
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/** Shared DOM presentation; instance-owned projection cache, no application state. */
|
|
2
|
+
export const labelboxPositions = ['TL', 'TC', 'TR', 'L', 'R', 'BL', 'BC', 'BR'];
|
|
3
|
+
export const labelboxStyle = `.gramlot-labelbox[hidden]{display:none!important}
|
|
4
|
+
.gramlot-labelbox{box-sizing:border-box;min-width:0;min-height:0;--gramlot-label-width:initial;--gramlot-formlet-label-width:initial;display:grid;gap:var(--gramlot-label-gap,.25em);grid-template-areas:'label' 'control';grid-template-columns:minmax(0,1fr);grid-template-rows:max-content minmax(0,1fr)}
|
|
5
|
+
.gramlot-labelbox>.label-box{grid-area:label;color:var(--gramlot-label-color,var(--gramlot-text-secondary,inherit));font-size:var(--gramlot-label-size,1em)} .gramlot-labelbox>.control-box{box-sizing:border-box;grid-area:control;min-width:0;min-height:0;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
|
|
6
|
+
.gramlot-labelbox>.control-box>*{max-width:100%;box-sizing:border-box}
|
|
7
|
+
.gramlot-labelbox[data-position='L']{grid-template-areas:'label control';grid-template-rows:minmax(0,1fr)}
|
|
8
|
+
.gramlot-labelbox[data-position='R']{grid-template-areas:'control label';grid-template-columns:minmax(0,1fr) max-content;grid-template-rows:minmax(0,1fr)}
|
|
9
|
+
.gramlot-labelbox[data-position='L']>.label-box,.gramlot-labelbox[data-position='R']>.label-box{align-self:center}
|
|
10
|
+
.gramlot-labelbox[data-position^='B']{grid-template-areas:'control' 'label';grid-template-rows:minmax(0,1fr) max-content}
|
|
11
|
+
.gramlot-labelbox[data-position$='C']>.label-box{text-align:center}
|
|
12
|
+
.gramlot-labelbox[data-position$='R']>.label-box{text-align:right}
|
|
13
|
+
.gramlot-labelbox>.label-box[hidden]{display:none} .gramlot-labelbox>.label-box label{display:block}
|
|
14
|
+
.gramlot-labelbox[data-position='L']>.label-box{text-align:right;padding-right:2px}
|
|
15
|
+
.gramlot-labelbox[data-formlet-aligned]>.label-box>label{width:max-content;margin-left:auto}
|
|
16
|
+
.gramlot-labelbox[data-position='L']{grid-template-columns:var(--gramlot-label-width,var(--gramlot-formlet-label-width,max-content)) minmax(0,1fr)}
|
|
17
|
+
.gramlot-labelbox:has(>.label-box[hidden]){gap:0;grid-template-areas:'control';grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
|
|
18
|
+
.gramlot-labelbox[data-variant='card']{gap:0;border:1px solid var(--gramlot-border-control,#b9c2ce);border-radius:var(--gramlot-window-radius,9px);background:var(--gramlot-surface,#fff);color:var(--gramlot-ink,CanvasText);box-shadow:0 3px 10px #0002}
|
|
19
|
+
.gramlot-labelbox[data-variant='card']>.label-box{background:var(--gramlot-card-header-background,var(--gramlot-header-background,#303946));color:var(--gramlot-card-header-color,var(--gramlot-header-color,#fff));box-sizing:border-box;min-height:28px;padding:3px 10px;border-radius:calc(var(--gramlot-window-radius,9px) - 1px) calc(var(--gramlot-window-radius,9px) - 1px) 0 0;font-weight:600}
|
|
20
|
+
.gramlot-labelbox[data-variant='card']>.label-box>label{color:inherit;font:inherit;line-height:20px;margin:0}
|
|
21
|
+
.gramlot-labelbox[data-variant='card']>.control-box{padding:12px}
|
|
22
|
+
.gramlot-labelbox[data-movable]>.label-box{cursor:grab;touch-action:none;user-select:none}
|
|
23
|
+
.gramlot-labelbox[data-movable]>.label-box>label{cursor:inherit;user-select:none;-webkit-user-select:none}
|
|
24
|
+
.gramlot-labelbox[data-selected]{outline:2px solid var(--gramlot-focus-ring,var(--gramlot-brand-blue,#3766b5));outline-offset:-2px}
|
|
25
|
+
.gramlot-labelbox[data-tray-block]>.label-box{position:relative;padding-inline:32px 60px}
|
|
26
|
+
.gramlot-labelbox>.label-box>.tray-settings-button{position:absolute;right:3px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:26px;height:26px;padding:4px;border:0;border-radius:4px;background:transparent;color:inherit;cursor:pointer}
|
|
27
|
+
.gramlot-labelbox>.label-box>button[hidden]{display:none}
|
|
28
|
+
.gramlot-labelbox>.label-box>.tray-settings-button[data-kind=layer]{right:31px}
|
|
29
|
+
.tray-settings-button{opacity:.65}
|
|
30
|
+
.tray-settings-button:hover,.tray-settings-button:focus-visible{opacity:1}
|
|
31
|
+
.tray-settings-button svg{width:18px;height:18px;pointer-events:none}
|
|
32
|
+
.gramlot-labelbox>.label-box>.tray-settings-button:hover{background:color-mix(in srgb,currentColor 12%,transparent)}
|
|
33
|
+
.tray-settings-button:focus-visible{outline:2px solid var(--gramlot-focus-ring,Highlight);outline-offset:-2px}
|
|
34
|
+
|
|
35
|
+
.gramlot-labelbox>.label-box>.tray-rotate{position:absolute;left:3px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:26px;height:26px;padding:4px;border:0;border-radius:4px;background:transparent;color:inherit;cursor:grab;touch-action:none;opacity:.7}
|
|
36
|
+
.tray-rotate svg{width:18px;height:18px;pointer-events:none}
|
|
37
|
+
.gramlot-labelbox>.label-box>.tray-rotate:hover{opacity:1;background:color-mix(in srgb,currentColor 12%,transparent)}
|
|
38
|
+
.tray-rotate:focus-visible{opacity:1;outline:2px solid var(--gramlot-focus-ring,Highlight);outline-offset:-2px}
|
|
39
|
+
.gramlot-labelbox[data-rotating]>.label-box>.tray-rotate{cursor:grabbing}
|
|
40
|
+
.gramlot-labelbox[data-moving]>.label-box{cursor:grabbing}
|
|
41
|
+
.gramlot-labelbox[data-resizable]>.control-box{overflow:auto}
|
|
42
|
+
.gramlot-labelbox>.tray-resize{position:absolute;right:1px;bottom:1px;width:22px;height:22px;padding:2px;display:grid;place-items:end;border:0;background:transparent;color:inherit;cursor:nwse-resize;touch-action:none;border-radius:3px;opacity:.65}
|
|
43
|
+
.gramlot-labelbox>.tray-resize[hidden]{display:none}
|
|
44
|
+
.gramlot-labelbox>.tray-resize svg{width:16px;height:16px;pointer-events:none}
|
|
45
|
+
.gramlot-labelbox>.tray-resize:hover,.gramlot-labelbox>.tray-resize:focus-visible{opacity:1}
|
|
46
|
+
.gramlot-labelbox>.tray-resize:focus-visible{outline:2px solid var(--gramlot-focus-ring,Highlight);outline-offset:-2px}`;
|
|
47
|
+
|
|
48
|
+
export function createLabelbox(document, controlBox) {
|
|
49
|
+
const box = document.createElement('div'), labelBox = document.createElement('div');
|
|
50
|
+
const fieldLabel = document.createElement('label');
|
|
51
|
+
labelBox.append(fieldLabel); box.append(labelBox, controlBox);
|
|
52
|
+
const layout = {box, labelBox, fieldLabel, controlBox, previous: {box:{},label:{},labelBox:{},controlBox:{}}};
|
|
53
|
+
box.labelbox = layout;
|
|
54
|
+
return layout;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function projectLabelbox(layout, attrs, adapt) {
|
|
58
|
+
const {lbl, lbl_variant, lbl_position = lbl_variant === 'card' ? 'TC' : 'TL', ...rest} = attrs;
|
|
59
|
+
if (!labelboxPositions.includes(lbl_position)) throw new TypeError(`Invalid lbl_position: ${lbl_position}`);
|
|
60
|
+
const groups = {box:{},label:{},labelBox:{},controlBox:{}};
|
|
61
|
+
const prefixes = [['box_l_','labelBox'],['box_c_','controlBox'],['lbl_','label'],['box_','box']];
|
|
62
|
+
for (const [name,value] of Object.entries(rest)) {
|
|
63
|
+
const match = prefixes.find(([prefix]) => name.startsWith(prefix));
|
|
64
|
+
if (match) { groups[match[1]][name.slice(match[0].length)] = value; delete rest[name]; }
|
|
65
|
+
}
|
|
66
|
+
const elements = {box:layout.box,label:layout.fieldLabel,labelBox:layout.labelBox,controlBox:layout.controlBox};
|
|
67
|
+
for (const [name,element] of Object.entries(elements)) {
|
|
68
|
+
const next = adapt(groups[name]), previous = layout.previous[name];
|
|
69
|
+
for (const key of new Set([...Object.keys(previous),...Object.keys(next)])) {
|
|
70
|
+
if (next[key] == null) element.removeAttribute(key);
|
|
71
|
+
else element.setAttribute(key,String(next[key]));
|
|
72
|
+
}
|
|
73
|
+
layout.previous[name] = next;
|
|
74
|
+
}
|
|
75
|
+
if (attrs.lbl_width == null) layout.box.style.removeProperty('--gramlot-label-width');
|
|
76
|
+
else layout.box.style.setProperty('--gramlot-label-width',attrs.lbl_width);
|
|
77
|
+
layout.box.classList.add('labelbox','gramlot-labelbox');
|
|
78
|
+
layout.labelBox.classList.add('label-box'); layout.controlBox.classList.add('control-box');
|
|
79
|
+
layout.box.dataset.position = lbl_position;
|
|
80
|
+
if (lbl_variant == null) delete layout.box.dataset.variant;
|
|
81
|
+
else layout.box.dataset.variant = lbl_variant;
|
|
82
|
+
layout.fieldLabel.textContent = lbl ?? '';
|
|
83
|
+
layout.labelBox.hidden = lbl == null || lbl === '';
|
|
84
|
+
layout.box.dispatchEvent(new layout.box.ownerDocument.defaultView.Event('gramlot-label-layout', {bubbles:true}));
|
|
85
|
+
return rest;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Content identity behind an optional renderer-created Labelbox presentation. */
|
|
89
|
+
export function labelboxContent(presentation) {
|
|
90
|
+
return presentation?.labelbox ? presentation.labelbox.controlBox.firstElementChild : presentation;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Layout surface of content; ordinary unwrapped DOM remains its own surface. */
|
|
94
|
+
export function labelboxPresentation(content) {
|
|
95
|
+
const box = content?.parentElement?.parentElement;
|
|
96
|
+
return box?.labelbox && labelboxContent(box) === content ? box : content;
|
|
97
|
+
}
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
--gramlot-ink: #243449;
|
|
19
19
|
--gramlot-background: #f7f8f5;
|
|
20
20
|
--gramlot-surface: #ffffff;
|
|
21
|
+
--gramlot-header-background: #303946;
|
|
22
|
+
--gramlot-header-color: #ffffff;
|
|
21
23
|
--gramlot-surface-subtle: #edf1f7;
|
|
22
24
|
--gramlot-text-secondary: #566579;
|
|
23
25
|
--gramlot-border: #d5dce5;
|
|
@@ -42,6 +44,10 @@
|
|
|
42
44
|
--gramlot-label-size: 1em;
|
|
43
45
|
--gramlot-font-ui: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
44
46
|
--gramlot-font-code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
47
|
+
--gramlot-editor-keyword: light-dark(#754052, #d5a7bc);
|
|
48
|
+
--gramlot-editor-string: light-dark(#35634d, #a7c5ac);
|
|
49
|
+
--gramlot-editor-number: light-dark(#80552d, #d6b58e);
|
|
50
|
+
--gramlot-editor-function: light-dark(#365f87, #a5bfdc);
|
|
45
51
|
--gramlot-space-1: 0.25rem;
|
|
46
52
|
--gramlot-space-2: 0.5rem;
|
|
47
53
|
--gramlot-space-3: 0.75rem;
|
|
@@ -63,6 +69,8 @@
|
|
|
63
69
|
--gramlot-ink: #edf2fa;
|
|
64
70
|
--gramlot-background: #111b29;
|
|
65
71
|
--gramlot-surface: #1b293b;
|
|
72
|
+
--gramlot-header-background: #2c3d52;
|
|
73
|
+
--gramlot-header-color: #edf2fa;
|
|
66
74
|
--gramlot-surface-subtle: #24354b;
|
|
67
75
|
--gramlot-text-secondary: #bdc9d9;
|
|
68
76
|
--gramlot-border: #44566d;
|
|
@@ -88,6 +96,8 @@
|
|
|
88
96
|
--gramlot-ink: #edf2fa;
|
|
89
97
|
--gramlot-background: #111b29;
|
|
90
98
|
--gramlot-surface: #1b293b;
|
|
99
|
+
--gramlot-header-background: #2c3d52;
|
|
100
|
+
--gramlot-header-color: #edf2fa;
|
|
91
101
|
--gramlot-surface-subtle: #24354b;
|
|
92
102
|
--gramlot-text-secondary: #bdc9d9;
|
|
93
103
|
--gramlot-border: #44566d;
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
color-scheme: light;
|
|
5
5
|
--gramlot-background: #f3f5f7;
|
|
6
6
|
--gramlot-surface: #ffffff;
|
|
7
|
+
--gramlot-header-background: #303946;
|
|
8
|
+
--gramlot-header-color: #ffffff;
|
|
7
9
|
--gramlot-surface-subtle: #e9edf2;
|
|
8
10
|
--gramlot-ink: #202936;
|
|
9
11
|
--gramlot-text-secondary: #526174;
|
|
@@ -65,6 +67,8 @@
|
|
|
65
67
|
color-scheme: dark;
|
|
66
68
|
--gramlot-background: #171c24;
|
|
67
69
|
--gramlot-surface: #222a35;
|
|
70
|
+
--gramlot-header-background: #354152;
|
|
71
|
+
--gramlot-header-color: #edf1f7;
|
|
68
72
|
--gramlot-surface-subtle: #2b3543;
|
|
69
73
|
--gramlot-ink: #edf1f7;
|
|
70
74
|
--gramlot-text-secondary: #b8c4d4;
|
|
@@ -93,6 +97,8 @@
|
|
|
93
97
|
color-scheme: dark;
|
|
94
98
|
--gramlot-background: #171c24;
|
|
95
99
|
--gramlot-surface: #222a35;
|
|
100
|
+
--gramlot-header-background: #354152;
|
|
101
|
+
--gramlot-header-color: #edf1f7;
|
|
96
102
|
--gramlot-surface-subtle: #2b3543;
|
|
97
103
|
--gramlot-ink: #edf1f7;
|
|
98
104
|
--gramlot-text-secondary: #b8c4d4;
|
package/themes/joanna/theme.css
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
color-scheme: light;
|
|
5
5
|
--gramlot-background: #f5f4f2;
|
|
6
6
|
--gramlot-surface: #ffffff;
|
|
7
|
+
--gramlot-header-background: #3f4249;
|
|
8
|
+
--gramlot-header-color: #ffffff;
|
|
7
9
|
--gramlot-surface-subtle: #eeece8;
|
|
8
10
|
--gramlot-ink: #292c31;
|
|
9
11
|
--gramlot-text-secondary: #5d636c;
|
|
@@ -65,6 +67,8 @@
|
|
|
65
67
|
color-scheme: dark;
|
|
66
68
|
--gramlot-background: #1b1c20;
|
|
67
69
|
--gramlot-surface: #25272c;
|
|
70
|
+
--gramlot-header-background: #41444c;
|
|
71
|
+
--gramlot-header-color: #f3f2ef;
|
|
68
72
|
--gramlot-surface-subtle: #303239;
|
|
69
73
|
--gramlot-ink: #f3f2ef;
|
|
70
74
|
--gramlot-text-secondary: #c4c3c0;
|
|
@@ -93,6 +97,8 @@
|
|
|
93
97
|
color-scheme: dark;
|
|
94
98
|
--gramlot-background: #1b1c20;
|
|
95
99
|
--gramlot-surface: #25272c;
|
|
100
|
+
--gramlot-header-background: #41444c;
|
|
101
|
+
--gramlot-header-color: #f3f2ef;
|
|
96
102
|
--gramlot-surface-subtle: #303239;
|
|
97
103
|
--gramlot-ink: #f3f2ef;
|
|
98
104
|
--gramlot-text-secondary: #c4c3c0;
|
package/themes/mela/theme.css
CHANGED
|
@@ -8,13 +8,15 @@
|
|
|
8
8
|
--gramlot-tree-selected-background: var(--gramlot-selected);
|
|
9
9
|
--gramlot-tree-selected-color: var(--gramlot-ink);
|
|
10
10
|
--gramlot-window-backdrop: rgb(0 0 0 / 24%);
|
|
11
|
-
--gramlot-background: #
|
|
11
|
+
--gramlot-background: #f2f2f7;
|
|
12
12
|
--gramlot-surface: #ffffff;
|
|
13
|
+
--gramlot-header-background: #38383d;
|
|
14
|
+
--gramlot-header-color: #ffffff;
|
|
13
15
|
--gramlot-surface-subtle: #eaeaed;
|
|
14
16
|
--gramlot-ink: #1d1d1f;
|
|
15
17
|
--gramlot-text-secondary: #636366;
|
|
16
18
|
--gramlot-border: #d9d9de;
|
|
17
|
-
--gramlot-border-control: #
|
|
19
|
+
--gramlot-border-control: #8a8a8e;
|
|
18
20
|
--gramlot-action: #0066cc;
|
|
19
21
|
--gramlot-action-hover: #004c99;
|
|
20
22
|
--gramlot-selected: #dceaff;
|
|
@@ -38,8 +40,10 @@
|
|
|
38
40
|
--gramlot-field-font-size: 1rem;
|
|
39
41
|
--gramlot-button-padding: 3px 9px;
|
|
40
42
|
--gramlot-button-gap: 4px;
|
|
41
|
-
--gramlot-button-background:
|
|
42
|
-
--gramlot-button-
|
|
43
|
+
--gramlot-button-background: #0066cc;
|
|
44
|
+
--gramlot-button-color: #ffffff;
|
|
45
|
+
--gramlot-chrome-background: var(--gramlot-surface);
|
|
46
|
+
--gramlot-button-hover: #004c99;
|
|
43
47
|
--gramlot-label-size: 1em;
|
|
44
48
|
--gramlot-label-gap: 4px;
|
|
45
49
|
--gramlot-radius-sm: 6px;
|
|
@@ -69,8 +73,10 @@
|
|
|
69
73
|
@media (prefers-color-scheme: dark) {
|
|
70
74
|
:root:not([data-theme="light"]) {
|
|
71
75
|
color-scheme: dark;
|
|
72
|
-
--gramlot-background: #
|
|
73
|
-
--gramlot-surface: #
|
|
76
|
+
--gramlot-background: #000000;
|
|
77
|
+
--gramlot-surface: #1c1c1e;
|
|
78
|
+
--gramlot-header-background: #323236;
|
|
79
|
+
--gramlot-header-color: #f5f5f7;
|
|
74
80
|
--gramlot-surface-subtle: #38383a;
|
|
75
81
|
--gramlot-ink: #f5f5f7;
|
|
76
82
|
--gramlot-text-secondary: #bdbdc4;
|
|
@@ -78,8 +84,8 @@
|
|
|
78
84
|
--gramlot-border-control: #74747c;
|
|
79
85
|
--gramlot-action: #70b7ff;
|
|
80
86
|
--gramlot-action-hover: #abd5ff;
|
|
81
|
-
--gramlot-selected: #
|
|
82
|
-
--gramlot-field-background: #
|
|
87
|
+
--gramlot-selected: #244367;
|
|
88
|
+
--gramlot-field-background: #1c1c1e;
|
|
83
89
|
--gramlot-field-readonly-background: #38383a;
|
|
84
90
|
--gramlot-label-color: #bdbdc4;
|
|
85
91
|
--gramlot-focus-ring: #70b7ff;
|
|
@@ -97,8 +103,10 @@
|
|
|
97
103
|
}
|
|
98
104
|
:root[data-theme="dark"] {
|
|
99
105
|
color-scheme: dark;
|
|
100
|
-
--gramlot-background: #
|
|
101
|
-
--gramlot-surface: #
|
|
106
|
+
--gramlot-background: #000000;
|
|
107
|
+
--gramlot-surface: #1c1c1e;
|
|
108
|
+
--gramlot-header-background: #323236;
|
|
109
|
+
--gramlot-header-color: #f5f5f7;
|
|
102
110
|
--gramlot-surface-subtle: #38383a;
|
|
103
111
|
--gramlot-ink: #f5f5f7;
|
|
104
112
|
--gramlot-text-secondary: #bdbdc4;
|
|
@@ -106,8 +114,8 @@
|
|
|
106
114
|
--gramlot-border-control: #74747c;
|
|
107
115
|
--gramlot-action: #70b7ff;
|
|
108
116
|
--gramlot-action-hover: #abd5ff;
|
|
109
|
-
--gramlot-selected: #
|
|
110
|
-
--gramlot-field-background: #
|
|
117
|
+
--gramlot-selected: #244367;
|
|
118
|
+
--gramlot-field-background: #1c1c1e;
|
|
111
119
|
--gramlot-field-readonly-background: #38383a;
|
|
112
120
|
--gramlot-label-color: #bdbdc4;
|
|
113
121
|
--gramlot-focus-ring: #70b7ff;
|
|
@@ -136,11 +144,15 @@
|
|
|
136
144
|
:where(button,input[type="button"],input[type="submit"],input[type="reset"],.button) {
|
|
137
145
|
min-block-size: var(--gramlot-field-height); padding: var(--gramlot-button-padding);
|
|
138
146
|
font-size: 1rem; line-height: 1.3; font-weight: 500;
|
|
139
|
-
background: var(--gramlot-button-background); color:
|
|
147
|
+
background: var(--gramlot-button-background); color: #ffffff; border-color: transparent;
|
|
140
148
|
}
|
|
141
149
|
:where(button,input[type="button"],input[type="submit"],input[type="reset"],.button):hover:not(:disabled) {
|
|
142
|
-
background:
|
|
150
|
+
background: #004c99; color: #ffffff; border-color: transparent;
|
|
143
151
|
}
|
|
152
|
+
gramlot-button.button--secondary,gramlot-toggle-button.button--secondary,gramlot-drop-down-button.button--secondary { background:transparent; border-color:transparent; }
|
|
153
|
+
:where(.button--secondary,button.secondary) { background:var(--gramlot-selected); color:var(--gramlot-action); border-color:transparent; }
|
|
154
|
+
:where(.button--secondary,button.secondary):hover:not(:disabled) { background:var(--gramlot-selected); color:var(--gramlot-action-hover); border-color:var(--gramlot-action); }
|
|
155
|
+
:where(button,.button):active:not(:disabled) { transform:none; filter:brightness(.9); }
|
|
144
156
|
:where(label) { font-size: 1em; font-weight: 400; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }
|
|
145
157
|
:where(input[readonly],textarea[readonly]) { background: var(--gramlot-field-readonly-background); }
|
|
146
158
|
:where(.button--quiet,button.quiet) { background: transparent; color: var(--gramlot-action); border-color: transparent; }
|
|
@@ -179,6 +191,47 @@
|
|
|
179
191
|
}
|
|
180
192
|
@layer gramlot.base {
|
|
181
193
|
@media (max-width: 640px), (pointer: coarse) {
|
|
182
|
-
html { font-size:
|
|
194
|
+
html { font-size: 17px; }
|
|
195
|
+
@supports (font: -apple-system-body) { html { font: -apple-system-body; } }
|
|
196
|
+
body { line-height:1.4; }
|
|
197
|
+
h1 { font-size:2rem; font-weight:700; letter-spacing:-.025em; }
|
|
198
|
+
h2 { font-size:1.3rem; font-weight:650; }
|
|
199
|
+
h3 { font-size:1.05rem; font-weight:600; }
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* Touch presentation follows the existing density setting; minimums grow with text. */
|
|
204
|
+
@layer gramlot.touch {
|
|
205
|
+
@media (max-width:640px), (pointer:coarse) {
|
|
206
|
+
:root:not([data-gramlot-touch="off"]) {
|
|
207
|
+
--gramlot-field-height:max(44px,2.65rem); --gramlot-field-font-size:max(16px,1rem);
|
|
208
|
+
--gramlot-field-padding:.55rem .75rem; --gramlot-button-padding:.6rem 1rem;
|
|
209
|
+
--gramlot-label-size:.88rem; --gramlot-label-gap:.4rem;
|
|
210
|
+
--gramlot-tree-row-height:max(44px,2.65rem); --gramlot-tab-height:max(44px,2.65rem);
|
|
211
|
+
}
|
|
212
|
+
:where(button,.button,summary,[role="tab"],a) { min-block-size:44px; }
|
|
213
|
+
:where(nav a,.actions a) { display:inline-flex; align-items:center; }
|
|
214
|
+
:where(label:has(input[type="checkbox"]),label:has(input[type="radio"])) { min-block-size:44px; display:inline-flex; align-items:center; gap:.6rem; }
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/* Content stays opaque. Materials are confined to navigation controls. */
|
|
218
|
+
@layer gramlot.components {
|
|
219
|
+
:where([role="toolbar"]) { --gramlot-button-padding:4px 6px; background:var(--gramlot-surface); color:var(--gramlot-ink); }
|
|
220
|
+
@supports (backdrop-filter:blur(16px)) {
|
|
221
|
+
:where([role="toolbar"]) { background:color-mix(in srgb,var(--gramlot-surface) 92%,transparent); backdrop-filter:blur(16px) saturate(1.2); }
|
|
222
|
+
}
|
|
223
|
+
@media (prefers-reduced-transparency:reduce), (prefers-contrast:more) {
|
|
224
|
+
:where([role="toolbar"]) { background:var(--gramlot-surface); backdrop-filter:none; }
|
|
225
|
+
}
|
|
226
|
+
@media (prefers-contrast:more) {
|
|
227
|
+
:where(input,select,textarea,button,.button) { border:2px solid currentColor; }
|
|
228
|
+
:where(a) { text-decoration:underline; }
|
|
229
|
+
}
|
|
230
|
+
@media (prefers-reduced-motion:reduce) {
|
|
231
|
+
:where(button,.button) { transition:none; transform:none; }
|
|
232
|
+
}
|
|
233
|
+
@media (forced-colors:active) {
|
|
234
|
+
:where(button,.button) { background:ButtonFace; color:ButtonText; border-color:ButtonText; filter:none; }
|
|
235
|
+
:where([role="toolbar"]) { background:Canvas; color:CanvasText; backdrop-filter:none; }
|
|
183
236
|
}
|
|
184
237
|
}
|
package/themes/mimi/theme.css
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
color-scheme: light;
|
|
5
5
|
--gramlot-background: #edf1ef;
|
|
6
6
|
--gramlot-surface: #fbfcfb;
|
|
7
|
+
--gramlot-header-background: #30473c;
|
|
8
|
+
--gramlot-header-color: #fbfcfb;
|
|
7
9
|
--gramlot-surface-subtle: #e2e9e5;
|
|
8
10
|
--gramlot-ink: #24332e;
|
|
9
11
|
--gramlot-text-secondary: #52655d;
|
|
@@ -65,6 +67,8 @@
|
|
|
65
67
|
color-scheme: dark;
|
|
66
68
|
--gramlot-background: #17201d;
|
|
67
69
|
--gramlot-surface: #202c27;
|
|
70
|
+
--gramlot-header-background: #334d40;
|
|
71
|
+
--gramlot-header-color: #ebf3ee;
|
|
68
72
|
--gramlot-surface-subtle: #2a3932;
|
|
69
73
|
--gramlot-ink: #ebf3ee;
|
|
70
74
|
--gramlot-text-secondary: #b6c9be;
|
|
@@ -93,6 +97,8 @@
|
|
|
93
97
|
color-scheme: dark;
|
|
94
98
|
--gramlot-background: #17201d;
|
|
95
99
|
--gramlot-surface: #202c27;
|
|
100
|
+
--gramlot-header-background: #334d40;
|
|
101
|
+
--gramlot-header-color: #ebf3ee;
|
|
96
102
|
--gramlot-surface-subtle: #2a3932;
|
|
97
103
|
--gramlot-ink: #ebf3ee;
|
|
98
104
|
--gramlot-text-secondary: #b6c9be;
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
color-scheme: light;
|
|
5
5
|
--gramlot-background: #f3f5f7;
|
|
6
6
|
--gramlot-surface: #ffffff;
|
|
7
|
+
--gramlot-header-background: #303946;
|
|
8
|
+
--gramlot-header-color: #ffffff;
|
|
7
9
|
--gramlot-surface-subtle: #e9edf2;
|
|
8
10
|
--gramlot-ink: #202936;
|
|
9
11
|
--gramlot-text-secondary: #526174;
|
|
@@ -32,6 +34,8 @@
|
|
|
32
34
|
color-scheme: dark;
|
|
33
35
|
--gramlot-background: #171c24;
|
|
34
36
|
--gramlot-surface: #222a35;
|
|
37
|
+
--gramlot-header-background: #354152;
|
|
38
|
+
--gramlot-header-color: #edf1f7;
|
|
35
39
|
--gramlot-surface-subtle: #2b3543;
|
|
36
40
|
--gramlot-ink: #edf1f7;
|
|
37
41
|
--gramlot-text-secondary: #b8c4d4;
|
|
@@ -60,6 +64,8 @@
|
|
|
60
64
|
color-scheme: dark;
|
|
61
65
|
--gramlot-background: #171c24;
|
|
62
66
|
--gramlot-surface: #222a35;
|
|
67
|
+
--gramlot-header-background: #354152;
|
|
68
|
+
--gramlot-header-color: #edf1f7;
|
|
63
69
|
--gramlot-surface-subtle: #2b3543;
|
|
64
70
|
--gramlot-ink: #edf1f7;
|
|
65
71
|
--gramlot-text-secondary: #b8c4d4;
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
color-scheme: light;
|
|
5
5
|
--gramlot-background: #f5f4f2;
|
|
6
6
|
--gramlot-surface: #ffffff;
|
|
7
|
+
--gramlot-header-background: #3f4249;
|
|
8
|
+
--gramlot-header-color: #ffffff;
|
|
7
9
|
--gramlot-surface-subtle: #eeece8;
|
|
8
10
|
--gramlot-ink: #292c31;
|
|
9
11
|
--gramlot-text-secondary: #5d636c;
|
|
@@ -32,6 +34,8 @@
|
|
|
32
34
|
color-scheme: dark;
|
|
33
35
|
--gramlot-background: #1b1c20;
|
|
34
36
|
--gramlot-surface: #25272c;
|
|
37
|
+
--gramlot-header-background: #41444c;
|
|
38
|
+
--gramlot-header-color: #f3f2ef;
|
|
35
39
|
--gramlot-surface-subtle: #303239;
|
|
36
40
|
--gramlot-ink: #f3f2ef;
|
|
37
41
|
--gramlot-text-secondary: #c4c3c0;
|
|
@@ -60,6 +64,8 @@
|
|
|
60
64
|
color-scheme: dark;
|
|
61
65
|
--gramlot-background: #1b1c20;
|
|
62
66
|
--gramlot-surface: #25272c;
|
|
67
|
+
--gramlot-header-background: #41444c;
|
|
68
|
+
--gramlot-header-color: #f3f2ef;
|
|
63
69
|
--gramlot-surface-subtle: #303239;
|
|
64
70
|
--gramlot-ink: #f3f2ef;
|
|
65
71
|
--gramlot-text-secondary: #c4c3c0;
|
package/themes/palettes/mimi.css
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
color-scheme: light;
|
|
5
5
|
--gramlot-background: #edf1ef;
|
|
6
6
|
--gramlot-surface: #fbfcfb;
|
|
7
|
+
--gramlot-header-background: #30473c;
|
|
8
|
+
--gramlot-header-color: #fbfcfb;
|
|
7
9
|
--gramlot-surface-subtle: #e2e9e5;
|
|
8
10
|
--gramlot-ink: #24332e;
|
|
9
11
|
--gramlot-text-secondary: #52655d;
|
|
@@ -32,6 +34,8 @@
|
|
|
32
34
|
color-scheme: dark;
|
|
33
35
|
--gramlot-background: #17201d;
|
|
34
36
|
--gramlot-surface: #202c27;
|
|
37
|
+
--gramlot-header-background: #334d40;
|
|
38
|
+
--gramlot-header-color: #ebf3ee;
|
|
35
39
|
--gramlot-surface-subtle: #2a3932;
|
|
36
40
|
--gramlot-ink: #ebf3ee;
|
|
37
41
|
--gramlot-text-secondary: #b6c9be;
|
|
@@ -60,6 +64,8 @@
|
|
|
60
64
|
color-scheme: dark;
|
|
61
65
|
--gramlot-background: #17201d;
|
|
62
66
|
--gramlot-surface: #202c27;
|
|
67
|
+
--gramlot-header-background: #334d40;
|
|
68
|
+
--gramlot-header-color: #ebf3ee;
|
|
63
69
|
--gramlot-surface-subtle: #2a3932;
|
|
64
70
|
--gramlot-ink: #ebf3ee;
|
|
65
71
|
--gramlot-text-secondary: #b6c9be;
|
package/src/date-parser/civil.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Softwell S.r.l. - SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
// Gregorian civil calendar arithmetic. No clock, timezone, or Date object.
|
|
3
|
-
export function daysInMonth(year, month) {
|
|
4
|
-
if (month === 2) return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0) ? 29 : 28;
|
|
5
|
-
return [4, 6, 9, 11].includes(month) ? 30 : 31;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function civil(year, month, day) {
|
|
9
|
-
if (![year, month, day].every(Number.isInteger) || year < 1 || year > 9999 ||
|
|
10
|
-
month < 1 || month > 12 || day < 1 || day > daysInMonth(year, month)) {
|
|
11
|
-
throw new RangeError('Date must exist in Gregorian years 0001–9999.');
|
|
12
|
-
}
|
|
13
|
-
return `${String(year).padStart(4, '0')}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function parts(date) {
|
|
17
|
-
if (typeof date !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
18
|
-
throw new RangeError('Expected a civil date in YYYY-MM-DD format.');
|
|
19
|
-
}
|
|
20
|
-
const result = date.split('-').map(Number);
|
|
21
|
-
civil(...result);
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function ordinal(year, month, day) {
|
|
26
|
-
const previous = year - 1;
|
|
27
|
-
let result = 365 * previous + Math.floor(previous / 4) - Math.floor(previous / 100) +
|
|
28
|
-
Math.floor(previous / 400) + day - 1;
|
|
29
|
-
for (let m = 1; m < month; m++) result += daysInMonth(year, m);
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function addDays(date, offset) {
|
|
34
|
-
let target = ordinal(...parts(date)) + offset;
|
|
35
|
-
if (!Number.isSafeInteger(target) || target < 0 || target > ordinal(9999, 12, 31)) {
|
|
36
|
-
throw new RangeError('Date offset exceeds Gregorian years 0001–9999.');
|
|
37
|
-
}
|
|
38
|
-
// Binary search keeps arbitrarily large supported offsets bounded.
|
|
39
|
-
let low = 1, high = 10000;
|
|
40
|
-
while (high - low > 1) {
|
|
41
|
-
const middle = Math.floor((low + high) / 2);
|
|
42
|
-
if (ordinal(middle, 1, 1) <= target) low = middle;
|
|
43
|
-
else high = middle;
|
|
44
|
-
}
|
|
45
|
-
target -= ordinal(low, 1, 1);
|
|
46
|
-
let month = 1;
|
|
47
|
-
while (target >= daysInMonth(low, month)) target -= daysInMonth(low, month++);
|
|
48
|
-
return civil(low, month, target + 1);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function monday(date) {
|
|
52
|
-
return addDays(date, -(ordinal(...parts(date)) % 7));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function monthPeriod(year, month, offset = 0, count = 1) {
|
|
56
|
-
const index = year * 12 + month - 1 + offset;
|
|
57
|
-
const y = Math.floor(index / 12), m = ((index % 12) + 12) % 12 + 1;
|
|
58
|
-
const endIndex = index + count - 1;
|
|
59
|
-
const ey = Math.floor(endIndex / 12), em = ((endIndex % 12) + 12) % 12 + 1;
|
|
60
|
-
return {start: civil(y, m, 1), end: civil(ey, em, daysInMonth(ey, em))};
|
|
61
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** Natural-language civil dates and periods, independent of DOM, clock and timezone. */
|
|
2
|
-
export interface DateExpressionOptions {
|
|
3
|
-
/** Required Gregorian civil ISO date, YYYY-MM-DD (0001–9999). */
|
|
4
|
-
workdate: string;
|
|
5
|
-
/** Supported Italian/English locale; defaults to it-IT. */
|
|
6
|
-
locale?: string;
|
|
7
|
-
/** Integer 0–99, default 20. Inclusive window [work year + ahead - 100, work year + ahead - 1]. */
|
|
8
|
-
twoDigitYearAhead?: number;
|
|
9
|
-
}
|
|
10
|
-
export type DateExpressionErrorCode = 'INVALID_CONTEXT' | 'INVALID_INPUT' |
|
|
11
|
-
'UNRECOGNIZED_EXPRESSION' | 'INVALID_DATE' |
|
|
12
|
-
'INVALID_RANGE';
|
|
13
|
-
export type DateExpressionResult =
|
|
14
|
-
{ok: true; kind: 'date'; date: string} |
|
|
15
|
-
{ok: true; kind: 'period'; start: string | null; end: string | null} |
|
|
16
|
-
{ok: false; error: {code: DateExpressionErrorCode; message: string}};
|
|
17
|
-
/** Parse a complete expression without reading or modifying page state. */
|
|
18
|
-
export function parseDateExpression(text: string, options: DateExpressionOptions): DateExpressionResult;
|