fsanyoto commited on
Commit
9edd100
Β·
verified Β·
1 Parent(s): 1e5ed01

Deploy AIOS web (React glide grid + FastAPI slice)

Browse files
RELEASES.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "current": "fb95e03 (fb95e03)",
3
  "releases": [
4
  {
5
  "version": "v75",
 
1
  {
2
+ "current": "7136711 (7136711)",
3
  "releases": [
4
  {
5
  "version": "v75",
VERSION CHANGED
@@ -1 +1 @@
1
- fb95e03 (fb95e03)
 
1
+ 7136711 (7136711)
web/public/AIOS_DEPLOY_RECEIPT CHANGED
@@ -1 +1 @@
1
- c1800efe2418019609b7b1ea42920ca57c35c09e154e6c621dc10f920a5fa0e2
 
1
+ 7ee9f87817884c1a02bd6a53dda203de137dd074cef7244242692aa64a670d3a
web/src/sheet/ChartDialog.tsx CHANGED
@@ -45,6 +45,7 @@
45
 
46
  import { createContext, Fragment, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
47
  import type { ReactNode } from "react";
 
48
  import { AnchoredOverlay, BodyPortal, useOverlayLayer } from "../customer-grid/OverlaySurface";
49
  // The document's own addresser, in SHEET coordinates. A second spelling of A1 in this file would
50
  // be a second answer to a question the document already answers.
@@ -533,6 +534,8 @@ export default function ChartDialog({
533
  const [stacking, setStacking] = useState<SheetChartSpec["stacking"]>(chart?.stacking);
534
  const chartStacking = SHEET_CHART_STACKING_KINDS.includes(kind) ? stacking : undefined;
535
  const [rangeDraft, setRangeDraft] = useState(() => (chart?.source?.ranges ?? [seedRange]).map(chartRangeText).join(", "));
 
 
536
  const [databases, setDatabases] = useState<{ key: string; label: string }[]>([]);
537
  const [loading, setLoading] = useState(!editing);
538
  const [database, setDatabase] = useState("");
 
45
 
46
  import { createContext, Fragment, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
47
  import type { ReactNode } from "react";
48
+ import { useCellRefHighlight } from "./refHighlight";
49
  import { AnchoredOverlay, BodyPortal, useOverlayLayer } from "../customer-grid/OverlaySurface";
50
  // The document's own addresser, in SHEET coordinates. A second spelling of A1 in this file would
51
  // be a second answer to a question the document already answers.
 
534
  const [stacking, setStacking] = useState<SheetChartSpec["stacking"]>(chart?.stacking);
535
  const chartStacking = SHEET_CHART_STACKING_KINDS.includes(kind) ? stacking : undefined;
536
  const [rangeDraft, setRangeDraft] = useState(() => (chart?.source?.ranges ?? [seedRange]).map(chartRangeText).join(", "));
537
+ // The data range and the anchor cell are outlined on the grid while the dialog is open.
538
+ useCellRefHighlight([tab === "range" ? rangeDraft : "", anchor]);
539
  const [databases, setDatabases] = useState<{ key: string; label: string }[]>([]);
540
  const [loading, setLoading] = useState(!editing);
541
  const [database, setDatabase] = useState("");
web/src/sheet/LinkDialog.tsx CHANGED
@@ -34,6 +34,7 @@
34
 
35
  import { useMemo, useState } from "react";
36
  import type { FormEvent } from "react";
 
37
  import type { Rectangle } from "@glideapps/glide-data-grid";
38
  import { AnchoredOverlay } from "../customer-grid/OverlaySurface";
39
  import type { AnchorRect } from "../customer-grid/OverlaySurface";
@@ -168,6 +169,8 @@ export default function LinkDialog({
168
  held?.kind === "sheet" ? held.href : (sheets[0] ?? "")
169
  ));
170
  const [why, setWhy] = useState("");
 
 
171
 
172
  const pick = (next: CellLink["kind"]) => {
173
  setKind(next);
 
34
 
35
  import { useMemo, useState } from "react";
36
  import type { FormEvent } from "react";
37
+ import { useCellRefHighlight } from "./refHighlight";
38
  import type { Rectangle } from "@glideapps/glide-data-grid";
39
  import { AnchoredOverlay } from "../customer-grid/OverlaySurface";
40
  import type { AnchorRect } from "../customer-grid/OverlaySurface";
 
169
  held?.kind === "sheet" ? held.href : (sheets[0] ?? "")
170
  ));
171
  const [why, setWhy] = useState("");
172
+ // A link to a cell outlines that cell on the grid while the dialog is open (refHighlight.ts).
173
+ useCellRefHighlight([kind === "cell" ? addr : ""]);
174
 
175
  const pick = (next: CellLink["kind"]) => {
176
  setKind(next);
web/src/sheet/RulesDialog.tsx CHANGED
@@ -28,6 +28,7 @@
28
 
29
  import { useCallback, useId, useState } from "react";
30
  import { ConfirmDialog } from "../ui/ConfirmDialog";
 
31
  import {
32
  DEFAULT_BAR_FILL, DEFAULT_RULE_SCALE,
33
  RULE_FILLS, RULE_INKS, RULE_KIND_LABEL, RULE_OPS, RULE_OP_LABEL, RULE_SCALES,
@@ -186,6 +187,8 @@ function RuleCard({ rule, index, count, onPatch, onMove, onRemove }: RuleCardPro
186
  const ids = useId();
187
  const kind = ruleKind(rule);
188
  const arity = ruleArity(rule.op);
 
 
189
 
190
  /**
191
  * ⭐⭐ CHANGING THE KIND CHANGES WHAT THE RULE NEEDS TO BE COMPLETE, so it carries those needs
 
28
 
29
  import { useCallback, useId, useState } from "react";
30
  import { ConfirmDialog } from "../ui/ConfirmDialog";
31
+ import { useCellRefHighlight } from "./refHighlight";
32
  import {
33
  DEFAULT_BAR_FILL, DEFAULT_RULE_SCALE,
34
  RULE_FILLS, RULE_INKS, RULE_KIND_LABEL, RULE_OPS, RULE_OP_LABEL, RULE_SCALES,
 
187
  const ids = useId();
188
  const kind = ruleKind(rule);
189
  const arity = ruleArity(rule.op);
190
+ // The rule's range and any cell its formula names are outlined on the grid (refHighlight.ts).
191
+ useCellRefHighlight([rangeText(rule.range), kind === "formula" ? String(rule.value ?? "") : ""]);
192
 
193
  /**
194
  * ⭐⭐ CHANGING THE KIND CHANGES WHAT THE RULE NEEDS TO BE COMPLETE, so it carries those needs
web/src/sheet/SheetGrid.tsx CHANGED
@@ -135,7 +135,7 @@ import {
135
  ERROR_REF, ERROR_VALUE, autoCloseFormula, cycleAnchorAtCaret, workbookFormulaGetter,
136
  } from "./formulaEval";
137
  import { colorForSlot } from "./refColors";
138
- import { useHighlightedCellRefs } from "./refHighlight";
139
  import "../styles/wave52/sheet-grid.css";
140
  import "../styles/wave61/sheet-grid.css";
141
  // β›”β›” CONTRACT C8: ONE ESCAPE ARBITER FOR THE WHOLE APP, topmost wins. Nothing in this tree adds
@@ -2757,15 +2757,14 @@ export default function SheetGrid({
2757
  return out;
2758
  }, [externalRefs, formulaEdit, selected, tab.name]);
2759
 
2760
- // The newest reference a panel names is scrolled to, so a cell typed far off screen (R9997) is
2761
- // seen being outlined rather than outlined out of sight.
2762
- const lastExternalRef = externalRefs[externalRefs.length - 1] ?? "";
2763
- useEffect(() => {
2764
- const ref = refsIn(lastExternalRef)[0];
2765
  if (!ref || (ref.start.sheet && ref.start.sheet.toLowerCase() !== tab.name.toLowerCase())) return;
2766
  const viewRow = viewRowOf(ref.start.row - 1);
2767
  if (viewRow >= 0) gridRef.current?.scrollTo(viewIndexOf(visCols, colToIndex(ref.start.col) - 1), viewRow);
2768
- }, [lastExternalRef, tab.name, viewRowOf, visCols]);
2769
 
2770
  /**
2771
  * ⭐⭐ W53-T02 / INSTRUCTION 18, VERBATIM β€” THE LIVE POINT-MODE PROPOSAL, AND IT IS THE ONE
 
135
  ERROR_REF, ERROR_VALUE, autoCloseFormula, cycleAnchorAtCaret, workbookFormulaGetter,
136
  } from "./formulaEval";
137
  import { colorForSlot } from "./refColors";
138
+ import { useCellRefFocus, useHighlightedCellRefs } from "./refHighlight";
139
  import "../styles/wave52/sheet-grid.css";
140
  import "../styles/wave61/sheet-grid.css";
141
  // β›”β›” CONTRACT C8: ONE ESCAPE ARBITER FOR THE WHOLE APP, topmost wins. Nothing in this tree adds
 
2757
  return out;
2758
  }, [externalRefs, formulaEdit, selected, tab.name]);
2759
 
2760
+ // A reference a person just TYPED is scrolled to, so a cell far off screen (R9997) is seen being
2761
+ // outlined rather than outlined out of sight. Opening a panel scrolls nowhere (refHighlight.ts).
2762
+ useCellRefFocus((text) => {
2763
+ const ref = refsIn(text)[0];
 
2764
  if (!ref || (ref.start.sheet && ref.start.sheet.toLowerCase() !== tab.name.toLowerCase())) return;
2765
  const viewRow = viewRowOf(ref.start.row - 1);
2766
  if (viewRow >= 0) gridRef.current?.scrollTo(viewIndexOf(visCols, colToIndex(ref.start.col) - 1), viewRow);
2767
+ });
2768
 
2769
  /**
2770
  * ⭐⭐ W53-T02 / INSTRUCTION 18, VERBATIM β€” THE LIVE POINT-MODE PROPOSAL, AND IT IS THE ONE
web/src/sheet/refHighlight.ts CHANGED
@@ -6,10 +6,16 @@
6
  // grid reads `useHighlightedCellRefs()` and paints those cells through the SAME outline path a
7
  // formula's references use (`SheetGrid.tsx::formulaRefCells`), so there is no second border
8
  // mechanism to keep in step. Unmounting a panel takes its outlines off with it.
9
- import { useEffect, useSyncExternalStore } from "react";
 
 
 
 
 
10
 
11
  const owners = new Map<number, readonly string[]>();
12
  const listeners = new Set<() => void>();
 
13
  let snapshot: readonly string[] = [];
14
  let nextOwner = 1;
15
 
@@ -27,14 +33,36 @@ export const useHighlightedCellRefs = (): readonly string[] => useSyncExternalSt
27
  () => snapshot,
28
  );
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  /** Register the cell references a surface is showing. Blank or partial text is simply ignored
31
  * by the grid, which only outlines what parses as a reference. */
32
  export const useCellRefHighlight = (texts: readonly string[]): void => {
33
- const key = texts.map((text) => String(text ?? "").trim()).filter(Boolean).join("\u0000");
 
34
  useEffect(() => {
 
 
 
 
 
 
 
35
  if (!key) return;
36
  const id = nextOwner++;
37
- owners.set(id, key.split("\u0000"));
38
  publish();
39
  return () => { owners.delete(id); publish(); };
40
  }, [key]);
 
6
  // grid reads `useHighlightedCellRefs()` and paints those cells through the SAME outline path a
7
  // formula's references use (`SheetGrid.tsx::formulaRefCells`), so there is no second border
8
  // mechanism to keep in step. Unmounting a panel takes its outlines off with it.
9
+ //
10
+ // β›” OUTLINE ON OPEN, SCROLL ONLY ON A CHANGE. A panel opened over a saved binding names every cell
11
+ // it reads, including a far-away helper (Daily Sales F10000). Scrolling to the last one registered
12
+ // would move the sheet the moment a cell is opened, so the grid scrolls only to a reference that
13
+ // APPEARED after the surface mounted: the one the person just typed.
14
+ import { useEffect, useRef, useSyncExternalStore } from "react";
15
 
16
  const owners = new Map<number, readonly string[]>();
17
  const listeners = new Set<() => void>();
18
+ const focusListeners = new Set<(text: string) => void>();
19
  let snapshot: readonly string[] = [];
20
  let nextOwner = 1;
21
 
 
33
  () => snapshot,
34
  );
35
 
36
+ /** The grid's subscription to "a reference was just typed": it scrolls there. */
37
+ export const useCellRefFocus = (onFocus: (text: string) => void): void => {
38
+ const latest = useRef(onFocus);
39
+ latest.current = onFocus;
40
+ useEffect(() => {
41
+ const listener = (text: string) => latest.current(text);
42
+ focusListeners.add(listener);
43
+ return () => { focusListeners.delete(listener); };
44
+ }, []);
45
+ };
46
+
47
+ const clean = (texts: readonly string[]) =>
48
+ texts.map((text) => String(text ?? "").trim()).filter(Boolean);
49
+
50
  /** Register the cell references a surface is showing. Blank or partial text is simply ignored
51
  * by the grid, which only outlines what parses as a reference. */
52
  export const useCellRefHighlight = (texts: readonly string[]): void => {
53
+ const key = clean(texts).join("\u0000");
54
+ const opened = useRef<Set<string> | null>(null);
55
  useEffect(() => {
56
+ const now = key ? key.split("\u0000") : [];
57
+ if (opened.current === null) opened.current = new Set(now);
58
+ else {
59
+ const typed = now.filter((text) => !opened.current!.has(text));
60
+ opened.current = new Set(now);
61
+ if (typed.length) for (const listener of focusListeners) listener(typed[typed.length - 1]);
62
+ }
63
  if (!key) return;
64
  const id = nextOwner++;
65
+ owners.set(id, now);
66
  publish();
67
  return () => { owners.delete(id); publish(); };
68
  }, [key]);
web/src/sheet/ribbonInsert.tsx CHANGED
@@ -53,6 +53,7 @@
53
 
54
  import { useState } from "react";
55
  import type { FormEvent } from "react";
 
56
  import type { RibbonTabContext } from "./Ribbon";
57
  import {
58
  IconChartColumn, IconChartBar, IconChartLine, IconChartArea,
@@ -333,6 +334,8 @@ function SparklineForm({
333
  const [data, setData] = useState(() => rangeText(seed));
334
  const [location, setLocation] = useState(() => rangeText(defaultLocation(seed)));
335
  const [why, setWhy] = useState("");
 
 
336
 
337
  const submit = (event: FormEvent<HTMLFormElement>) => {
338
  event.preventDefault();
 
53
 
54
  import { useState } from "react";
55
  import type { FormEvent } from "react";
56
+ import { useCellRefHighlight } from "./refHighlight";
57
  import type { RibbonTabContext } from "./Ribbon";
58
  import {
59
  IconChartColumn, IconChartBar, IconChartLine, IconChartArea,
 
334
  const [data, setData] = useState(() => rangeText(seed));
335
  const [location, setLocation] = useState(() => rangeText(defaultLocation(seed)));
336
  const [why, setWhy] = useState("");
337
+ // Both ranges are outlined on the grid while the form is open (refHighlight.ts).
338
+ useCellRefHighlight([data, location]);
339
 
340
  const submit = (event: FormEvent<HTMLFormElement>) => {
341
  event.preventDefault();