File size: 7,213 Bytes
82cdb59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/* styles/wave52/sheet-grid.css β€” this wave's OWN stylesheet (W52-T06, contract C7).
   ═══════════════════════════════════════════════════════════════════════════════════════════
   β›”β›” THIS FILE IS THE FENCE. Wave 52's other lanes carry their own `styles/wave52/*.css`;
   nothing here may touch `index.css` or any earlier wave's sheet.css. Every selector below is
   either brand new (the `formula-assist-*` / `sheet-formula-*` families) or a POSITIONING-ONLY
   rule laid under a class that is already declared, UNSCOPED, at top level elsewhere (`cg-pop`,
   `cg-type-list`, `cg-type-row` in index.css; `FormulaBar.tsx`'s prior dropdown used the same
   trio, so nothing here re-declares their surface, only where they sit).

   β›” TOKENS ONLY: no literal font-size (only `--lp-fs-*`), no literal colour (only `--lp-*`), no
   literal z-index (only `var(--cg-z-*)`, and `cg-pop` already carries one). The one exception the
   whole app already makes is a reference's OWN colour, which is data (CR-4's six-slot rotation
   computed by `refColors.ts`) rather than styling, so it rides an INLINE style in the component,
   never a class in this file.

   ⚠ DESIGN CONTRACT: a transient overlay over a dense grid. No layout shift on open (both panels
   are `position: absolute`, so the grid underneath never reflows), dismiss on Escape (owned by
   the component that mounts `FormulaAssist`), never traps focus, and the only permitted motion is
   the panel's own open/close β€” never an animation keyed to a keystroke.
   ═══════════════════════════════════════════════════════════════════════════════════════════ */

/* ── the assist itself: unwrapped, so it never introduces a box into a flex row (FormulaBar's
      `.sheet-fx-field` is `display: flex`, and an extra block child would size oddly inside it) ── */
.formula-assist {
  display: contents;
}

/* ⚠ ABSOLUTE, under the caller's OWN `position: relative` wrapper (`.cg-pop-wrap` in FormulaBar,
   `.sheet-formula-editor-input-wrap` in the grid's floating editor). `cg-pop` already carries the
   surface, the border, the shadow and `z-index: var(--cg-z-menu)`; only placement is this file's. */
.formula-assist-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  max-height: 232px;
  min-width: 260px;
}

.formula-assist-summary {
  margin-left: auto;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--lp-fs-2xs);
  color: var(--lp-muted);
}

/* ST-12: below and left aligned with the cell/input by default. */
.formula-assist-tip {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ST-12/ST-15: when the dropdown ALSO owns the space below, the tooltip moves above so the two
   never overlap. */
.formula-assist-tip--above {
  top: auto;
  bottom: calc(100% + 4px);
}

.formula-assist-tip-sig {
  font-size: var(--lp-fs-2xs);
  color: var(--lp-ink);
}

/* ST-4: the argument currently being typed. */
.formula-assist-tip-bold {
  font-weight: 600;
  color: var(--lp-ink);
}

/* CR-1/CR-5: a reference's colour is DATA (an inline style from `refColors.ts`), not a class; this
   only sets the weight every coloured span shares. */
.formula-assist-ref {
  font-weight: 600;
}

/* ── FormulaBar.tsx's own coloured backdrop (CR-1), matching `.sheet-fx-input`'s box exactly
      (`styles/wave50/sheet.css::.sheet-fx-input`: `padding: 3px 8px; border: 1px solid
      var(--lp-line); border-radius: var(--lp-r-md); font-size: var(--lp-fs-xs);`) so the two align
      pixel for pixel. `border-color: transparent` keeps the SAME box, invisibly. ────────────────── */
.formula-assist-backdrop-bar {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
  white-space: pre;
  overflow: hidden;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: var(--lp-r-md);
  font-size: var(--lp-fs-xs);
  color: var(--lp-ink);
  box-sizing: border-box;
}

.formula-assist-input-bar--colored {
  color: transparent;
  caret-color: var(--lp-ink);
}

/* ── SheetGrid.tsx's own floating formula editor (PM-1..PM-18), positioned via `getBounds()` on
      the cell being edited. `position: fixed` so it survives the canvas's own scroll and reads the
      same rect the library itself reports (screen space), matching every other `AnchoredOverlay`
      anchor already rectangle-based in this file. ────────────────────────────────────────────── */
.sheet-formula-editor {
  position: fixed;
  z-index: var(--cg-z-menu);
  display: flex;
  flex-direction: column;
}

.sheet-formula-editor-input-wrap {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
}

/* The coloured backdrop UNDER a transparent-text input (CR-1: a plain input cannot show more than
   one text colour, so the visible glyphs are painted here and the real input's own text is made
   transparent while a reference is present -- see `.sheet-formula-editor-input--colored`). Padding,
   border and font must match the input exactly or the two would not align pixel for pixel. */
.sheet-formula-editor-backdrop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
  white-space: pre;
  overflow: hidden;
  padding: 0 7px;
  border: 1px solid transparent;
  font-size: var(--lp-fs-xs);
  color: var(--lp-ink);
  box-sizing: border-box;
}

.sheet-formula-editor-input {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: var(--lp-fs-xs);
  color: var(--lp-ink);
  background: var(--lp-surface);
  border: 1px solid var(--lp-blue-deep);
  border-radius: var(--lp-r-sm);
  padding: 0 7px;
}

/* CR-1: text made transparent so the coloured backdrop shows through; the caret stays visible on
   its own channel, which is CR-7's "colour is never the only channel" -- the caret and the grid
   border both still say where the caret and the reference are without relying on hue alone. */
.sheet-formula-editor-input--colored {
  color: transparent;
  caret-color: var(--lp-ink);
}

/* PM-18: the mode indicator. Cheap on purpose, it is the one thing the whole of Part A is tested
   against. Sits inside the editor's own box so it moves with the cell rather than the viewport. */
.sheet-formula-mode {
  align-self: flex-end;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: var(--lp-r-sm);
  background: var(--lp-surface-2);
  color: var(--lp-muted);
  font-size: var(--lp-fs-2xs);
  font-weight: 600;
  pointer-events: none;
}

.sheet-formula-mode--point {
  background: var(--lp-blue-tint);
  color: var(--lp-blue-deep);
}